From 78e7be87665249a51412e312db58744384578525 Mon Sep 17 00:00:00 2001 From: xboard Date: Sun, 27 Jul 2025 00:19:14 +0800 Subject: [PATCH] feat: add plugin migrations and fix plan management bugs - Plugin database migration support - Fix empty prices error in plan management - Plugin update functionality - Custom shadowsocks encryption algorithms --- .../Controllers/V2/Admin/PluginController.php | 56 ++- app/Http/Routes/V2/AdminRoute.php | 1 + app/Models/Plugin.php | 1 + app/Services/Plugin/PluginManager.php | 135 ++++-- public/assets/admin/assets/index.js | 32 +- public/assets/admin/assets/vendor.js | 376 +++++++++-------- public/assets/admin/index.html | 2 +- public/assets/admin/locales/en-US.js | 34 +- public/assets/admin/locales/ko-KR.js | 394 ++---------------- public/assets/admin/locales/zh-CN.js | 34 +- 10 files changed, 453 insertions(+), 612 deletions(-) diff --git a/app/Http/Controllers/V2/Admin/PluginController.php b/app/Http/Controllers/V2/Admin/PluginController.php index 0c6c905..da41477 100644 --- a/app/Http/Controllers/V2/Admin/PluginController.php +++ b/app/Http/Controllers/V2/Admin/PluginController.php @@ -38,7 +38,7 @@ class PluginController extends Controller ], [ 'value' => Plugin::TYPE_PAYMENT, - 'label' => '支付方式', + 'label' => '支付方式', 'description' => '提供支付接口的插件,如支付宝、微信支付等', 'icon' => '💳' ] @@ -52,14 +52,14 @@ class PluginController extends Controller public function index(Request $request) { $type = $request->query('type'); - - $installedPlugins = Plugin::when($type, function($query) use ($type) { - return $query->byType($type); - }) + + $installedPlugins = Plugin::when($type, function ($query) use ($type) { + return $query->byType($type); + }) ->get() ->keyBy('code') ->toArray(); - + $pluginPath = base_path('plugins'); $plugins = []; @@ -72,19 +72,26 @@ class PluginController extends Controller $config = json_decode(File::get($configFile), true); $code = $config['code']; $pluginType = $config['type'] ?? Plugin::TYPE_FEATURE; - + // 如果指定了类型,过滤插件 if ($type && $pluginType !== $type) { continue; } - + $installed = isset($installedPlugins[$code]); $pluginConfig = $installed ? $this->configService->getConfig($code) : ($config['config'] ?? []); $readmeFile = collect(['README.md', 'readme.md']) ->map(fn($f) => $directory . '/' . $f) ->first(fn($path) => File::exists($path)); $readmeContent = $readmeFile ? File::get($readmeFile) : ''; - + $needUpgrade = false; + if ($installed) { + $installedVersion = $installedPlugins[$code]['version'] ?? null; + $localVersion = $config['version'] ?? null; + if ($installedVersion && $localVersion && version_compare($localVersion, $installedVersion, '>')) { + $needUpgrade = true; + } + } $plugins[] = [ 'code' => $config['code'], 'name' => $config['name'], @@ -98,6 +105,7 @@ class PluginController extends Controller 'can_be_deleted' => !in_array($code, Plugin::PROTECTED_PLUGINS), 'config' => $pluginConfig, 'readme' => $readmeContent, + 'need_upgrade' => $needUpgrade, ]; } } @@ -138,8 +146,16 @@ class PluginController extends Controller 'code' => 'required|string' ]); + $code = $request->input('code'); + $plugin = Plugin::where('code', $code)->first(); + if ($plugin && $plugin->is_enabled) { + return response()->json([ + 'message' => '请先禁用插件后再卸载' + ], 400); + } + try { - $this->pluginManager->uninstall($request->input('code')); + $this->pluginManager->uninstall($code); return response()->json([ 'message' => '插件卸载成功' ]); @@ -150,6 +166,26 @@ class PluginController extends Controller } } + /** + * 升级插件 + */ + public function upgrade(Request $request) + { + $request->validate([ + 'code' => 'required|string', + ]); + try { + $this->pluginManager->update($request->input('code')); + return response()->json([ + 'message' => '插件升级成功' + ]); + } catch (\Exception $e) { + return response()->json([ + 'message' => '插件升级失败:' . $e->getMessage() + ], 400); + } + } + /** * 启用插件 */ diff --git a/app/Http/Routes/V2/AdminRoute.php b/app/Http/Routes/V2/AdminRoute.php index faade5c..cbb240b 100644 --- a/app/Http/Routes/V2/AdminRoute.php +++ b/app/Http/Routes/V2/AdminRoute.php @@ -257,6 +257,7 @@ class AdminRoute $router->post('disable', [\App\Http\Controllers\V2\Admin\PluginController::class, 'disable']); $router->get('config', [\App\Http\Controllers\V2\Admin\PluginController::class, 'getConfig']); $router->post('config', [\App\Http\Controllers\V2\Admin\PluginController::class, 'updateConfig']); + $router->post('upgrade', [\App\Http\Controllers\V2\Admin\PluginController::class, 'upgrade']); }); // 流量重置管理 diff --git a/app/Models/Plugin.php b/app/Models/Plugin.php index 6032f49..84c7dd1 100644 --- a/app/Models/Plugin.php +++ b/app/Models/Plugin.php @@ -19,6 +19,7 @@ use Illuminate\Support\Facades\Log; * @property string $requires * @property string $config * @property string $type + * @property boolean $is_enabled */ class Plugin extends Model { diff --git a/app/Services/Plugin/PluginManager.php b/app/Services/Plugin/PluginManager.php index 66c6f64..3e52dc5 100644 --- a/app/Services/Plugin/PluginManager.php +++ b/app/Services/Plugin/PluginManager.php @@ -137,32 +137,32 @@ class PluginManager */ public function install(string $pluginCode): bool { + $configFile = $this->getPluginPath($pluginCode) . '/config.json'; + + if (!File::exists($configFile)) { + throw new \Exception('Plugin config file not found'); + } + + $config = json_decode(File::get($configFile), true); + if (!$this->validateConfig($config)) { + throw new \Exception('Invalid plugin config'); + } + + // 检查插件是否已安装 + if (Plugin::where('code', $pluginCode)->exists()) { + throw new \Exception('Plugin already installed'); + } + + // 检查依赖 + if (!$this->checkDependencies($config['require'] ?? [])) { + throw new \Exception('Dependencies not satisfied'); + } + + // 运行数据库迁移 + $this->runMigrations(pluginCode: $pluginCode); + DB::beginTransaction(); try { - $configFile = $this->getPluginPath($pluginCode) . '/config.json'; - - if (!File::exists($configFile)) { - throw new \Exception('Plugin config file not found'); - } - - $config = json_decode(File::get($configFile), true); - if (!$this->validateConfig($config)) { - throw new \Exception('Invalid plugin config'); - } - - // 检查插件是否已安装 - if (Plugin::where('code', $pluginCode)->exists()) { - throw new \Exception('Plugin already installed'); - } - - // 检查依赖 - if (!$this->checkDependencies($config['require'] ?? [])) { - throw new \Exception('Dependencies not satisfied'); - } - - // 运行数据库迁移 - $this->runMigrations($pluginCode); - // 提取配置默认值 $defaultValues = $this->extractDefaultConfig($config); @@ -170,7 +170,7 @@ class PluginManager $plugin = $this->loadPlugin($pluginCode); // 注册到数据库 - $dbPlugin = Plugin::create([ + Plugin::create([ 'code' => $pluginCode, 'name' => $config['name'], 'version' => $config['version'], @@ -191,7 +191,9 @@ class PluginManager DB::commit(); return true; } catch (\Exception $e) { - DB::rollBack(); + if (DB::transactionLevel() > 0) { + DB::rollBack(); + } throw $e; } } @@ -223,7 +225,22 @@ class PluginManager if (File::exists($migrationsPath)) { Artisan::call('migrate', [ - '--path' => "plugins/{$pluginCode}/database/migrations", + '--path' => "plugins/" . Str::studly($pluginCode) . "/database/migrations", + '--force' => true + ]); + } + } + + /** + * 回滚插件数据库迁移 + */ + protected function runMigrationsRollback(string $pluginCode): void + { + $migrationsPath = $this->getPluginPath($pluginCode) . '/database/migrations'; + + if (File::exists($migrationsPath)) { + Artisan::call('migrate:rollback', [ + '--path' => "plugins/" . Str::studly($pluginCode) . "/database/migrations", '--force' => true ]); } @@ -352,10 +369,8 @@ class PluginManager */ public function uninstall(string $pluginCode): bool { - // 先禁用插件 $this->disable($pluginCode); - - // 删除数据库记录 + $this->runMigrationsRollback($pluginCode); Plugin::query()->where('code', $pluginCode)->delete(); return true; @@ -400,6 +415,62 @@ class PluginManager return true; } + /** + * 升级插件 + * + * @param string $pluginCode + * @return bool + * @throws \Exception + */ + public function update(string $pluginCode): bool + { + $dbPlugin = Plugin::where('code', $pluginCode)->first(); + if (!$dbPlugin) { + throw new \Exception('Plugin not installed: ' . $pluginCode); + } + + // 获取插件配置文件中的最新版本 + $configFile = $this->getPluginPath($pluginCode) . '/config.json'; + if (!File::exists($configFile)) { + throw new \Exception('Plugin config file not found'); + } + + $config = json_decode(File::get($configFile), true); + if (!$config || !isset($config['version'])) { + throw new \Exception('Invalid plugin config or missing version'); + } + + $newVersion = $config['version']; + $oldVersion = $dbPlugin->version; + + if (version_compare($newVersion, $oldVersion, '<=')) { + throw new \Exception('Plugin is already up to date'); + } + + $this->disable($pluginCode); + $this->runMigrations($pluginCode); + + $plugin = $this->loadPlugin($pluginCode); + if ($plugin) { + if (!empty($dbPlugin->config)) { + $plugin->setConfig(json_decode($dbPlugin->config, true)); + } + + if (method_exists($plugin, 'update')) { + $plugin->update($oldVersion, $newVersion); + } + } + + $dbPlugin->update([ + 'version' => $newVersion, + 'updated_at' => now(), + ]); + + $this->enable($pluginCode); + + return true; + } + /** * 上传插件 * @@ -466,6 +537,10 @@ class PluginManager File::deleteDirectory($pluginPath); File::deleteDirectory($extractPath); + if (Plugin::where('code', $config['code'])->exists()) { + return $this->update($config['code']); + } + return true; } diff --git a/public/assets/admin/assets/index.js b/public/assets/admin/assets/index.js index 78693e1..cf60ad1 100644 --- a/public/assets/admin/assets/index.js +++ b/public/assets/admin/assets/index.js @@ -1,21 +1,21 @@ -import{r as u,j as e,t as lo,c as io,I as ea,a as gt,S as kn,u as Gs,b as oo,d as Tn,R as Tr,e as Dr,f as co,F as mo,C as uo,L as Fr,T as Pr,g as Lr,h as xo,i as ho,k as go,l as po,m as z,n as Rr,o as Er,z as h,p as M,q as we,s as Te,v as re,w as Os,x as Re,y as Vr,A as fo,O as Dn,B as jo,D as vo,E as bo,G as yo,H as _o,J as No,Q as wo,K as Co,M as Ir,N as So,P as ko,U as To,V as Do,W as Fo,X as Po,Y as Mr,Z as Or,_ as Va,$ as Ia,a0 as Fn,a1 as os,a2 as Ma,a3 as Oa,a4 as zr,a5 as $r,a6 as Ar,a7 as qr,a8 as Hr,a9 as Lo,aa as Ur,ab as Kr,ac as Br,ad as Gr,ae as pt,af as Wr,ag as Ro,ah as Yr,ai as Jr,aj as Eo,ak as Vo,al as Io,am as Mo,an as Oo,ao as zo,ap as $o,aq as Ao,ar as qo,as as Ho,at as Qr,au as Uo,av as Ko,aw as tt,ax as Xr,ay as Bo,az as Go,aA as Zr,aB as Pn,aC as Wo,aD as Yo,aE as sr,aF as Jo,aG as el,aH as Qo,aI as sl,aJ as Xo,aK as Zo,aL as ec,aM as sc,aN as tc,aO as ac,aP as nc,aQ as tl,aR as rc,aS as lc,aT as ic,aU as xs,aV as oc,aW as Ln,aX as cc,aY as dc,aZ as al,a_ as nl,a$ as rl,b0 as mc,b1 as uc,b2 as xc,b3 as ll,b4 as hc,b5 as Rn,b6 as il,b7 as gc,b8 as ol,b9 as pc,ba as cl,bb as fc,bc as dl,bd as ml,be as jc,bf as vc,bg as ul,bh as bc,bi as xl,bj as yc,bk as hl,bl as gl,bm as pl,bn as _c,bo as fl,bp as Nc,bq as wc,br as Is,bs as Le,bt as Cs,bu as Cc,bv as Sc,bw as kc,bx as Tc,by as Dc,bz as Fc,bA as tr,bB as ar,bC as Pc,bD as Lc,bE as En,bF as Rc,bG as Ec,bH as wa,bI as Lt,bJ as sa,bK as Vc,bL as jl,bM as Ic,bN as Mc,bO as vl,bP as Oc,bQ as zc,bR as nr,bS as fn,bT as jn,bU as $c,bV as Ac,bW as bl,bX as qc,bY as Hc,bZ as Uc,b_ as Kc,b$ as Ca,c0 as vn,c1 as Be,c2 as Sa,c3 as Bc,c4 as nn,c5 as Gc,c6 as bn,c7 as us,c8 as Gt,c9 as Wt,ca as yn,cb as yl,cc as Ge,cd as Ze,ce as _l,cf as Nl,cg as Wc,ch as Yc,ci as Jc,cj as Qc,ck as Xc,cl as wl,cm as Zc,cn as ed,co as sd,cp as Ue,cq as rr,cr as td,cs as Cl,ct as Sl,cu as kl,cv as Tl,cw as Dl,cx as Fl,cy as ad,cz as nd,cA as rd,cB as za,cC as rt,cD as hs,cE as gs,cF as ld,cG as id,cH as od,cI as cd,cJ as dd,cK as ka,cL as md,cM as ud,cN as _n,cO as Vn,cP as In,cQ as xd,cR as Ls,cS as Rs,cT as $a,cU as hd,cV as Ta,cW as gd,cX as lr,cY as Pl,cZ as ir,c_ as Da,c$ as pd,d0 as Mn,d1 as fd,d2 as jd,d3 as vd,d4 as Ll,d5 as bd,d6 as yd,d7 as Rl,d8 as Nn,d9 as El,da as _d,db as wn,dc as Vl,dd as Nd,de as wd,df as Cd,dg as Il,dh as Sd,di as kd,dj as Ml,dk as Yt,dl as On,dm as Td,dn as or,dp as Ol,dq as Dd,dr as cr,ds as Fd,dt as Pd}from"./vendor.js";import"./index.js";var cp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dp(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Ld(s){if(s.__esModule)return s;var n=s.default;if(typeof n=="function"){var t=function r(){return this instanceof r?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var a=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return s[r]}})}),t}const Rd={theme:"system",setTheme:()=>null},zl=u.createContext(Rd);function Ed({children:s,defaultTheme:n="system",storageKey:t="vite-ui-theme",...r}){const[a,i]=u.useState(()=>localStorage.getItem(t)||n);u.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),a==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(x);return}d.classList.add(a)},[a]);const l={theme:a,setTheme:d=>{localStorage.setItem(t,d),i(d)}};return e.jsx(zl.Provider,{...r,value:l,children:s})}const Vd=()=>{const s=u.useContext(zl);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},Id=function(){const n=typeof document<"u"&&document.createElement("link").relList;return n&&n.supports&&n.supports("modulepreload")?"modulepreload":"preload"}(),Md=function(s,n){return new URL(s,n).href},dr={},Ne=function(n,t,r){let a=Promise.resolve();if(t&&t.length>0){const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),x=d?.nonce||d?.getAttribute("nonce");a=Promise.allSettled(t.map(m=>{if(m=Md(m,r),m in dr)return;dr[m]=!0;const o=m.endsWith(".css"),c=o?'[rel="stylesheet"]':"";if(!!r)for(let S=l.length-1;S>=0;S--){const C=l[S];if(C.href===m&&(!o||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${c}`))return;const D=document.createElement("link");if(D.rel=o?"stylesheet":Id,o||(D.as="script"),D.crossOrigin="",D.href=m,x&&D.setAttribute("nonce",x),document.head.appendChild(D),o)return new Promise((S,C)=>{D.addEventListener("load",S),D.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function i(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return a.then(l=>{for(const d of l||[])d.status==="rejected"&&i(d.reason);return n().catch(i)})};function N(...s){return lo(io(s))}const It=gt("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),F=u.forwardRef(({className:s,variant:n,size:t,asChild:r=!1,children:a,disabled:i,loading:l=!1,leftSection:d,rightSection:x,...m},o)=>{const c=r?kn:"button";return e.jsxs(c,{className:N(It({variant:n,size:t,className:s})),disabled:l||i,ref:o,...m,children:[(d&&l||!d&&!x&&l)&&e.jsx(ea,{className:"mr-2 h-4 w-4 animate-spin"}),!l&&d&&e.jsx("div",{className:"mr-2",children:d}),a,!l&&x&&e.jsx("div",{className:"ml-2",children:x}),x&&l&&e.jsx(ea,{className:"ml-2 h-4 w-4 animate-spin"})]})});F.displayName="Button";function Nt({className:s,minimal:n=!1}){const t=Gs(),r=oo(),a=r?.message||r?.statusText||"Unknown error occurred";return e.jsx("div",{className:N("h-svh w-full",s),children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[!n&&e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"500"}),e.jsxs("span",{className:"font-medium",children:["Oops! Something went wrong ",":')"]}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["We apologize for the inconvenience. ",e.jsx("br",{}),a]}),!n&&e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(F,{variant:"outline",onClick:()=>t(-1),children:"Go Back"}),e.jsx(F,{onClick:()=>t("/"),children:"Back to Home"})]})]})})}function mr(){const s=Gs();return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"404"}),e.jsx("span",{className:"font-medium",children:"Oops! Page Not Found!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["It seems like the page you're looking for ",e.jsx("br",{}),"does not exist or might have been removed."]}),e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(F,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(F,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function Od(){return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"503"}),e.jsx("span",{className:"font-medium",children:"Website is under maintenance!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["The site is not available at the moment. ",e.jsx("br",{}),"We'll be back online shortly."]}),e.jsx("div",{className:"mt-6 flex gap-4",children:e.jsx(F,{variant:"outline",children:"Learn more"})})]})})}function zd(s){return typeof s>"u"}function $d(s){return s===null}function Ad(s){return $d(s)||zd(s)}class qd{storage;prefixKey;constructor(n){this.storage=n.storage,this.prefixKey=n.prefixKey}getKey(n){return`${this.prefixKey}${n}`.toUpperCase()}set(n,t,r=null){const a=JSON.stringify({value:t,time:Date.now(),expire:r!==null?new Date().getTime()+r*1e3:null});this.storage.setItem(this.getKey(n),a)}get(n,t=null){const r=this.storage.getItem(this.getKey(n));if(!r)return{value:t,time:0};try{const a=JSON.parse(r),{value:i,time:l,expire:d}=a;return Ad(d)||d>new Date().getTime()?{value:i,time:l}:(this.remove(n),{value:t,time:0})}catch{return this.remove(n),{value:t,time:0}}}remove(n){this.storage.removeItem(this.getKey(n))}clear(){this.storage.clear()}}function $l({prefixKey:s="",storage:n=sessionStorage}){return new qd({prefixKey:s,storage:n})}const Al="Xboard_",Hd=function(s={}){return $l({prefixKey:s.prefixKey||"",storage:localStorage})},Ud=function(s={}){return $l({prefixKey:s.prefixKey||"",storage:sessionStorage})},zn=Hd({prefixKey:Al});Ud({prefixKey:Al});const ql="access_token";function ta(){return zn.get(ql)}function Hl(){zn.remove(ql)}const ur=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function Kd({children:s}){const n=Gs(),t=Tn(),r=ta();return u.useEffect(()=>{if(!r.value&&!ur.includes(t.pathname)){const a=encodeURIComponent(t.pathname+t.search);n(`/sign-in?redirect=${a}`)}},[r.value,t.pathname,t.search,n]),ur.includes(t.pathname)||r.value?e.jsx(e.Fragment,{children:s}):null}const Ee=u.forwardRef(({className:s,orientation:n="horizontal",decorative:t=!0,...r},a)=>e.jsx(Tr,{ref:a,decorative:t,orientation:n,className:N("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...r}));Ee.displayName=Tr.displayName;const Bd=gt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Je=u.forwardRef(({className:s,...n},t)=>e.jsx(Dr,{ref:t,className:N(Bd(),s),...n}));Je.displayName=Dr.displayName;const De=mo,Ul=u.createContext({}),v=({...s})=>e.jsx(Ul.Provider,{value:{name:s.name},children:e.jsx(uo,{...s})}),Aa=()=>{const s=u.useContext(Ul),n=u.useContext(Kl),{getFieldState:t,formState:r}=co(),a=t(s.name,r);if(!s)throw new Error("useFormField should be used within ");const{id:i}=n;return{id:i,name:s.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...a}},Kl=u.createContext({}),j=u.forwardRef(({className:s,...n},t)=>{const r=u.useId();return e.jsx(Kl.Provider,{value:{id:r},children:e.jsx("div",{ref:t,className:N("space-y-2",s),...n})})});j.displayName="FormItem";const b=u.forwardRef(({className:s,...n},t)=>{const{error:r,formItemId:a}=Aa();return e.jsx(Je,{ref:t,className:N(r&&"text-destructive",s),htmlFor:a,...n})});b.displayName="FormLabel";const y=u.forwardRef(({...s},n)=>{const{error:t,formItemId:r,formDescriptionId:a,formMessageId:i}=Aa();return e.jsx(kn,{ref:n,id:r,"aria-describedby":t?`${a} ${i}`:`${a}`,"aria-invalid":!!t,...s})});y.displayName="FormControl";const $=u.forwardRef(({className:s,...n},t)=>{const{formDescriptionId:r}=Aa();return e.jsx("p",{ref:t,id:r,className:N("text-[0.8rem] text-muted-foreground",s),...n})});$.displayName="FormDescription";const P=u.forwardRef(({className:s,children:n,...t},r)=>{const{error:a,formMessageId:i}=Aa(),l=a?String(a?.message):n;return l?e.jsx("p",{ref:r,id:i,className:N("text-[0.8rem] font-medium text-destructive",s),...t,children:l}):null});P.displayName="FormMessage";const ft=xo,lt=u.forwardRef(({className:s,...n},t)=>e.jsx(Fr,{ref:t,className:N("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...n}));lt.displayName=Fr.displayName;const Ke=u.forwardRef(({className:s,...n},t)=>e.jsx(Pr,{ref:t,className:N("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",s),...n}));Ke.displayName=Pr.displayName;const bs=u.forwardRef(({className:s,...n},t)=>e.jsx(Lr,{ref:t,className:N("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...n}));bs.displayName=Lr.displayName;function oe(s=void 0,n="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),ho(s).format(n))}function Gd(s=void 0,n="YYYY-MM-DD"){return oe(s,n)}function xr(s){const n=typeof s=="string"?parseFloat(s):s;return isNaN(n)?"0.00":n.toFixed(2)}function Ks(s,n=!0){if(s==null)return n?"¥0.00":"0.00";const t=typeof s=="string"?parseFloat(s):s;if(isNaN(t))return n?"¥0.00":"0.00";const a=(t/100).toFixed(2).replace(/\.?0+$/,i=>i.includes(".")?".00":i);return n?`¥${a}`:a}function Rt(s){return new Promise(n=>{try{const t=document.createElement("button");t.style.position="fixed",t.style.left="-9999px",t.style.opacity="0",t.setAttribute("data-clipboard-text",s),document.body.appendChild(t);const r=new go(t);r.on("success",()=>{r.destroy(),document.body.removeChild(t),n(!0)}),r.on("error",a=>{console.error("Clipboard.js failed:",a),r.destroy(),document.body.removeChild(t),n(!1)}),t.click()}catch(t){console.error("copyToClipboard failed:",t),n(!1)}})}function ze(s){if(s==null||s<=0)return"0 B";const n=1024,t=["B","KB","MB","GB","TB"];let r=Math.floor(Math.log(s)/Math.log(n));return r<0?r=0:r>=t.length&&(r=t.length-1),`${parseFloat((s/Math.pow(n,r)).toFixed(2))} ${t[r]}`}const hr="i18nextLng";function Wd(){return console.log(localStorage.getItem(hr)),localStorage.getItem(hr)}function Bl(){Hl();const s=window.location.pathname,n=s&&!["/404","/sign-in"].includes(s),t=new URL(window.location.href),a=`${t.pathname.split("/")[1]?`/${t.pathname.split("/")[1]}`:""}#/sign-in`;window.location.href=a+(n?`?redirect=${s}`:"")}const Yd=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function Jd(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const Dt=po.create({baseURL:Jd(),timeout:12e3,headers:{"Content-Type":"application/json"}});Dt.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const n=ta();if(!Yd.includes(s.url?.split("?")[0]||"")){if(!n.value)return Bl(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=n.value}return s.headers["Content-Language"]=Wd()||"zh-CN",s},s=>Promise.reject(s));Dt.interceptors.response.use(s=>s?.data||{code:-1,message:"未知错误"},s=>{const n=s.response?.status,t=s.response?.data?.message;return(n===401||n===403)&&Bl(),z.error(t||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[n]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});const I={get:(s,n)=>Dt.get(s,n),post:(s,n,t)=>Dt.post(s,n,t),put:(s,n,t)=>Dt.put(s,n,t),delete:(s,n)=>Dt.delete(s,n)},Qd="access_token";function Xd(s){zn.set(Qd,s)}const ct=window?.settings?.secure_path,Fa={getStats:()=>I.get(ct+"/monitor/api/stats"),getOverride:()=>I.get(ct+"/stat/getOverride"),getOrderStat:s=>I.get(ct+"/stat/getOrder",{params:s}),getStatsData:()=>I.get(ct+"/stat/getStats"),getNodeTrafficData:s=>I.get(ct+"/stat/getTrafficRank",{params:s}),getServerLastRank:()=>I.get(ct+"/stat/getServerLastRank"),getServerYesterdayRank:()=>I.get(ct+"/stat/getServerYesterdayRank")},Ot=window?.settings?.secure_path,Jt={getList:()=>I.get(Ot+"/theme/getThemes"),getConfig:s=>I.post(Ot+"/theme/getThemeConfig",{name:s}),updateConfig:(s,n)=>I.post(Ot+"/theme/saveThemeConfig",{name:s,config:n}),upload:s=>{const n=new FormData;return n.append("file",s),I.post(Ot+"/theme/upload",n,{headers:{"Content-Type":"multipart/form-data"}})},drop:s=>I.post(Ot+"/theme/delete",{name:s})},wt=window?.settings?.secure_path,ut={getList:()=>I.get(wt+"/server/manage/getNodes"),save:s=>I.post(wt+"/server/manage/save",s),drop:s=>I.post(wt+"/server/manage/drop",s),copy:s=>I.post(wt+"/server/manage/copy",s),update:s=>I.post(wt+"/server/manage/update",s),sort:s=>I.post(wt+"/server/manage/sort",s)},rn=window?.settings?.secure_path,jt={getList:()=>I.get(rn+"/server/group/fetch"),save:s=>I.post(rn+"/server/group/save",s),drop:s=>I.post(rn+"/server/group/drop",s)},ln=window?.settings?.secure_path,qa={getList:()=>I.get(ln+"/server/route/fetch"),save:s=>I.post(ln+"/server/route/save",s),drop:s=>I.post(ln+"/server/route/drop",s)},dt=window?.settings?.secure_path,xt={getList:()=>I.get(dt+"/payment/fetch"),getMethodList:()=>I.get(dt+"/payment/getPaymentMethods"),getMethodForm:s=>I.post(dt+"/payment/getPaymentForm",s),save:s=>I.post(dt+"/payment/save",s),drop:s=>I.post(dt+"/payment/drop",s),updateStatus:s=>I.post(dt+"/payment/show",s),sort:s=>I.post(dt+"/payment/sort",s)},zt=window?.settings?.secure_path,aa={getList:()=>I.get(`${zt}/notice/fetch`),save:s=>I.post(`${zt}/notice/save`,s),drop:s=>I.post(`${zt}/notice/drop`,{id:s}),updateStatus:s=>I.post(`${zt}/notice/show`,{id:s}),sort:s=>I.post(`${zt}/notice/sort`,{ids:s})},Ct=window?.settings?.secure_path,Et={getList:()=>I.get(Ct+"/knowledge/fetch"),getInfo:s=>I.get(Ct+"/knowledge/fetch?id="+s),save:s=>I.post(Ct+"/knowledge/save",s),drop:s=>I.post(Ct+"/knowledge/drop",s),updateStatus:s=>I.post(Ct+"/knowledge/show",s),sort:s=>I.post(Ct+"/knowledge/sort",s)},$t=window?.settings?.secure_path,ys={getList:()=>I.get($t+"/plan/fetch"),save:s=>I.post($t+"/plan/save",s),update:s=>I.post($t+"/plan/update",s),drop:s=>I.post($t+"/plan/drop",s),sort:s=>I.post($t+"/plan/sort",{ids:s})},St=window?.settings?.secure_path,mt={getList:s=>I.post(St+"/order/fetch",s),getInfo:s=>I.post(St+"/order/detail",s),markPaid:s=>I.post(St+"/order/paid",s),makeCancel:s=>I.post(St+"/order/cancel",s),update:s=>I.post(St+"/order/update",s),assign:s=>I.post(St+"/order/assign",s)},Ds=window?.settings?.secure_path,Ps={getTemplates:s=>I.post(Ds+"/gift-card/templates",s),createTemplate:s=>I.post(Ds+"/gift-card/create-template",s),updateTemplate:s=>I.post(Ds+"/gift-card/update-template",s),deleteTemplate:s=>I.post(Ds+"/gift-card/delete-template",s),getCodes:s=>I.post(Ds+"/gift-card/codes",s),generateCodes:s=>s.download_csv?I.post(Ds+"/gift-card/generate-codes",s,{responseType:"blob"}):I.post(Ds+"/gift-card/generate-codes",s),toggleCode:s=>I.post(Ds+"/gift-card/toggle-code",s),exportCodes:s=>I.get(Ds+`/gift-card/export-codes?batch_id=${s}`,{responseType:"blob"}),getUsages:s=>I.post(Ds+"/gift-card/usages",s),getStatistics:s=>I.post(Ds+"/gift-card/statistics",s),getTypes:()=>I.get(Ds+"/gift-card/types")},ma=window?.settings?.secure_path,Pa={getList:s=>I.post(ma+"/coupon/fetch",s),save:s=>I.post(ma+"/coupon/generate",s),drop:s=>I.post(ma+"/coupon/drop",s),update:s=>I.post(ma+"/coupon/update",s)},js=window?.settings?.secure_path,qs={getList:s=>I.post(`${js}/user/fetch`,s),update:s=>I.post(`${js}/user/update`,s),resetSecret:s=>I.post(`${js}/user/resetSecret`,{id:s}),generate:s=>s.download_csv?I.post(`${js}/user/generate`,s,{responseType:"blob"}):I.post(`${js}/user/generate`,s),getStats:s=>I.post(`${js}/stat/getStatUser`,s),destroy:s=>I.post(`${js}/user/destroy`,{id:s}),sendMail:s=>I.post(`${js}/user/sendMail`,s),dumpCSV:s=>I.post(`${js}/user/dumpCSV`,s,{responseType:"blob"}),batchBan:s=>I.post(`${js}/user/ban`,s)},na={getLogs:s=>I.get(`${js}/traffic-reset/logs`,{params:s}),getStats:s=>I.get(`${js}/traffic-reset/stats`,{params:s}),resetUser:s=>I.post(`${js}/traffic-reset/reset-user`,s),getUserHistory:(s,n)=>I.get(`${js}/traffic-reset/user/${s}/history`,{params:n})},ua=window?.settings?.secure_path,Ft={getList:s=>I.post(ua+"/ticket/fetch",s),getInfo:s=>I.get(ua+"/ticket/fetch?id= "+s),reply:s=>I.post(ua+"/ticket/reply",s),close:s=>I.post(ua+"/ticket/close",{id:s})},as=window?.settings?.secure_path,ye={getSettings:(s="")=>I.get(as+"/config/fetch?key="+s),saveSettings:s=>I.post(as+"/config/save",s),getEmailTemplate:()=>I.get(as+"/config/getEmailTemplate"),sendTestMail:()=>I.post(as+"/config/testSendMail"),setTelegramWebhook:()=>I.post(as+"/config/setTelegramWebhook"),updateSystemConfig:s=>I.post(as+"/config/save",s),getSystemStatus:()=>I.get(`${as}/system/getSystemStatus`),getQueueStats:()=>I.get(`${as}/system/getQueueStats`),getQueueWorkload:()=>I.get(`${as}/system/getQueueWorkload`),getQueueMasters:()=>I.get(`${as}/system/getQueueMasters`),getHorizonFailedJobs:s=>I.get(`${as}/system/getHorizonFailedJobs`,{params:s}),getSystemLog:s=>I.get(`${as}/system/getSystemLog`,{params:s}),getLogFiles:()=>I.get(`${as}/log/files`),getLogContent:s=>I.get(`${as}/log/fetch`,{params:s}),getLogClearStats:s=>I.get(`${as}/system/getLogClearStats`,{params:s}),clearSystemLog:s=>I.post(`${as}/system/clearSystemLog`,s)},$s=window?.settings?.secure_path,As={getPluginTypes:()=>I.get(`${$s}/plugin/types`),getPluginList:s=>{const n=s?{type:s}:{};return I.get(`${$s}/plugin/getPlugins`,{params:n})},uploadPlugin:s=>{const n=new FormData;return n.append("file",s),I.post(`${$s}/plugin/upload`,n,{headers:{"Content-Type":"multipart/form-data"}})},deletePlugin:s=>I.post(`${$s}/plugin/delete`,{code:s}),installPlugin:s=>I.post(`${$s}/plugin/install`,{code:s}),uninstallPlugin:s=>I.post(`${$s}/plugin/uninstall`,{code:s}),enablePlugin:s=>I.post(`${$s}/plugin/enable`,{code:s}),disablePlugin:s=>I.post(`${$s}/plugin/disable`,{code:s}),getPluginConfig:s=>I.get(`${$s}/plugin/config`,{params:{code:s}}),updatePluginConfig:(s,n)=>I.post(`${$s}/plugin/config`,{code:s,config:n})};window?.settings?.secure_path;Rr.config({monaco:Er});const Zd=h.object({subscribe_template_singbox:h.string().optional().default(""),subscribe_template_clash:h.string().optional().default(""),subscribe_template_clashmeta:h.string().optional().default(""),subscribe_template_stash:h.string().optional().default(""),subscribe_template_surge:h.string().optional().default(""),subscribe_template_surfboard:h.string().optional().default("")}),gr=[{key:"singbox",label:"Sing-box",language:"json"},{key:"clash",label:"Clash",language:"yaml"},{key:"clashmeta",label:"Clash Meta",language:"yaml"},{key:"stash",label:"Stash",language:"yaml"},{key:"surge",label:"Surge",language:"ini"},{key:"surfboard",label:"Surfboard",language:"ini"}],pr={subscribe_template_singbox:"",subscribe_template_clash:"",subscribe_template_clashmeta:"",subscribe_template_stash:"",subscribe_template_surge:"",subscribe_template_surfboard:""};function em(){const{t:s}=M("settings"),[n,t]=u.useState(!1),r=u.useRef(null),[a,i]=u.useState("singbox"),l=we({resolver:Te(Zd),defaultValues:pr,mode:"onChange"}),{data:d,isLoading:x}=re({queryKey:["settings","client"],queryFn:()=>ye.getSettings("subscribe_template")}),{mutateAsync:m}=Os({mutationFn:ye.saveSettings,onSuccess:()=>{z.success(s("common.autoSaved"))},onError:D=>{console.error("保存失败:",D),z.error(s("common.saveFailed"))}});u.useEffect(()=>{if(d?.data?.subscribe_template){const D=d.data.subscribe_template;Object.entries(D).forEach(([S,C])=>{if(S in pr){const T=typeof C=="string"?C:"";l.setValue(S,T)}}),r.current=l.getValues()}},[d,l]);const o=u.useCallback(Re.debounce(async D=>{if(!r.current||!Re.isEqual(D,r.current)){t(!0);try{await m(D),r.current=D}catch(S){console.error("保存设置失败:",S)}finally{t(!1)}}},1500),[m]),c=u.useCallback(()=>{const D=l.getValues();o(D)},[l,o]),f=u.useCallback((D,S)=>e.jsx(v,{control:l.control,name:D,render:({field:C})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s(`subscribe_template.${D.replace("subscribe_template_","")}.title`)}),e.jsx(y,{children:e.jsx(Vr,{height:"500px",defaultLanguage:S,value:C.value||"",onChange:T=>{C.onChange(T||""),c()},options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0}})}),e.jsx($,{children:s(`subscribe_template.${D.replace("subscribe_template_","")}.description`)}),e.jsx(P,{})]})}),[l.control,s,c]);return x?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.loading")})}):e.jsx(De,{...l,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ft,{value:a,onValueChange:i,className:"w-full",children:[e.jsx(lt,{className:"",children:gr.map(({key:D,label:S})=>e.jsx(Ke,{value:D,className:"text-xs",children:S},D))}),gr.map(({key:D,language:S})=>e.jsx(bs,{value:D,className:"mt-4",children:f(`subscribe_template_${D}`,S)},D))]}),n&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500"}),s("common.saving")]})]})})}function sm(){const{t:s}=M("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("subscribe_template.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("subscribe_template.description")})]}),e.jsx(Ee,{}),e.jsx(em,{})]})}const tm=()=>e.jsx(Kd,{children:e.jsx(Dn,{})}),am=fo([{path:"/sign-in",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>vm);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(tm,{}),children:[{path:"/",lazy:async()=>({Component:(await Ne(()=>Promise.resolve().then(()=>Tm),void 0,import.meta.url)).default}),errorElement:e.jsx(Nt,{}),children:[{index:!0,lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Ym);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(Nt,{}),children:[{path:"system",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Zm);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>au);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>ou);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>xu);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>ju);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Nu);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Tu);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Ru);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Ou);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Hu);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe-template",element:e.jsx(sm,{})}]},{path:"payment",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Ju);return{default:s}},void 0,import.meta.url)).default})},{path:"plugin",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Zu);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>ax);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>dx);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>jx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(Nt,{}),children:[{path:"manage",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Wx);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Zx);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>rh);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(Nt,{}),children:[{path:"plan",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>hh);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Th);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Oh);return{default:s}},void 0,import.meta.url)).default})},{path:"gift-card",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>ng);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(Nt,{}),children:[{path:"manage",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Eg);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>Zg);return{default:s}},void 0,import.meta.url)).default})},{path:"traffic-reset-logs",lazy:async()=>({Component:(await Ne(async()=>{const{default:s}=await Promise.resolve().then(()=>rp);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:Nt},{path:"/404",Component:mr},{path:"/503",Component:Od},{path:"*",Component:mr}]);function nm(){return I.get("/user/info")}const on={token:ta()?.value||"",userInfo:null,isLoggedIn:!!ta()?.value,loading:!1,error:null},Qt=jo("user/fetchUserInfo",async()=>(await nm()).data,{condition:(s,{getState:n})=>{const{user:t}=n();return!!t.token&&!t.loading}}),Gl=vo({name:"user",initialState:on,reducers:{setToken(s,n){s.token=n.payload,s.isLoggedIn=!!n.payload},resetUserState:()=>on},extraReducers:s=>{s.addCase(Qt.pending,n=>{n.loading=!0,n.error=null}).addCase(Qt.fulfilled,(n,t)=>{n.loading=!1,n.userInfo=t.payload,n.error=null}).addCase(Qt.rejected,(n,t)=>{if(n.loading=!1,n.error=t.error.message||"Failed to fetch user info",!n.token)return on})}}),{setToken:rm,resetUserState:lm}=Gl.actions,im=s=>s.user.userInfo,om=Gl.reducer,Wl=bo({reducer:{user:om}});ta()?.value&&Wl.dispatch(Qt());yo.use(_o).use(No).init({resources:{"en-US":window.XBOARD_TRANSLATIONS?.["en-US"]||{},"zh-CN":window.XBOARD_TRANSLATIONS?.["zh-CN"]||{},"ko-KR":window.XBOARD_TRANSLATIONS?.["ko-KR"]||{}},fallbackLng:"zh-CN",supportedLngs:["en-US","zh-CN","ko-KR"],detection:{order:["querystring","localStorage","navigator"],lookupQuerystring:"lang",lookupLocalStorage:"i18nextLng",caches:["localStorage"]},interpolation:{escapeValue:!1}});const cm=new wo;Co.createRoot(document.getElementById("root")).render(e.jsx(Ir.StrictMode,{children:e.jsx(So,{client:cm,children:e.jsx(ko,{store:Wl,children:e.jsxs(Ed,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(To,{router:am}),e.jsx(Do,{richColors:!0,position:"top-right"})]})})})}));const ke=u.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:N("rounded-xl border bg-card text-card-foreground shadow",s),...n}));ke.displayName="Card";const Fe=u.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:N("flex flex-col space-y-1.5 p-6",s),...n}));Fe.displayName="CardHeader";const Ve=u.forwardRef(({className:s,...n},t)=>e.jsx("h3",{ref:t,className:N("font-semibold leading-none tracking-tight",s),...n}));Ve.displayName="CardTitle";const Zs=u.forwardRef(({className:s,...n},t)=>e.jsx("p",{ref:t,className:N("text-sm text-muted-foreground",s),...n}));Zs.displayName="CardDescription";const Pe=u.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:N("p-6 pt-0",s),...n}));Pe.displayName="CardContent";const dm=u.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:N("flex items-center p-6 pt-0",s),...n}));dm.displayName="CardFooter";const k=u.forwardRef(({className:s,type:n,...t},r)=>e.jsx("input",{type:n,className:N("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:r,...t}));k.displayName="Input";const Yl=u.forwardRef(({className:s,...n},t)=>{const[r,a]=u.useState(!1);return e.jsxs("div",{className:"relative rounded-md",children:[e.jsx("input",{type:r?"text":"password",className:N("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:t,...n}),e.jsx(F,{type:"button",size:"icon",variant:"ghost",className:"absolute right-1 top-1/2 h-6 w-6 -translate-y-1/2 rounded-md text-muted-foreground",onClick:()=>a(i=>!i),children:r?e.jsx(Fo,{size:18}):e.jsx(Po,{size:18})})]})});Yl.displayName="PasswordInput";const mm=s=>I.post("/passport/auth/login",s);function um({className:s,onForgotPassword:n,...t}){const r=Gs(),a=Mr(),{t:i}=M("auth"),l=h.object({email:h.string().min(1,{message:i("signIn.validation.emailRequired")}),password:h.string().min(1,{message:i("signIn.validation.passwordRequired")}).min(7,{message:i("signIn.validation.passwordLength")})}),d=we({resolver:Te(l),defaultValues:{email:"",password:""}});async function x(m){try{const{data:o}=await mm(m);Xd(o.auth_data),a(rm(o.auth_data)),await a(Qt()).unwrap(),r("/")}catch(o){console.error("Login failed:",o),o.response?.data?.message&&d.setError("root",{message:o.response.data.message})}}return e.jsx("div",{className:N("grid gap-6",s),...t,children:e.jsx(De,{...d,children:e.jsx("form",{onSubmit:d.handleSubmit(x),className:"space-y-4",children:e.jsxs("div",{className:"space-y-4",children:[d.formState.errors.root&&e.jsx("div",{className:"text-sm text-destructive",children:d.formState.errors.root.message}),e.jsx(v,{control:d.control,name:"email",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:i("signIn.email")}),e.jsx(y,{children:e.jsx(k,{placeholder:i("signIn.emailPlaceholder"),autoComplete:"email",...m})}),e.jsx(P,{})]})}),e.jsx(v,{control:d.control,name:"password",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:i("signIn.password")}),e.jsx(y,{children:e.jsx(Yl,{placeholder:i("signIn.passwordPlaceholder"),autoComplete:"current-password",...m})}),e.jsx(P,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(F,{variant:"link",type:"button",className:"px-0 text-sm font-normal text-muted-foreground hover:text-primary",onClick:n,children:i("signIn.forgotPassword")})}),e.jsx(F,{className:"w-full",size:"lg",loading:d.formState.isSubmitting,children:i("signIn.submit")})]})})})})}const me=Or,ps=zr,xm=$r,et=Fn,Jl=u.forwardRef(({className:s,...n},t)=>e.jsx(Va,{ref:t,className:N("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...n}));Jl.displayName=Va.displayName;const ce=u.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(xm,{children:[e.jsx(Jl,{}),e.jsxs(Ia,{ref:r,className:N("max-h-[95%] overflow-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...t,children:[n,e.jsxs(Fn,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(os,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ce.displayName=Ia.displayName;const pe=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-1.5 text-center sm:text-left",s),...n});pe.displayName="DialogHeader";const Ie=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Ie.displayName="DialogFooter";const ue=u.forwardRef(({className:s,...n},t)=>e.jsx(Ma,{ref:t,className:N("text-lg font-semibold leading-none tracking-tight",s),...n}));ue.displayName=Ma.displayName;const $e=u.forwardRef(({className:s,...n},t)=>e.jsx(Oa,{ref:t,className:N("text-sm text-muted-foreground",s),...n}));$e.displayName=Oa.displayName;const Vt=gt("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),G=u.forwardRef(({className:s,variant:n,size:t,asChild:r=!1,...a},i)=>{const l=r?kn:"button";return e.jsx(l,{className:N(Vt({variant:n,size:t,className:s})),ref:i,...a})});G.displayName="Button";const Hs=Eo,Bs=Vo,hm=Io,gm=u.forwardRef(({className:s,inset:n,children:t,...r},a)=>e.jsxs(Ar,{ref:a,className:N("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",n&&"pl-8",s),...r,children:[t,e.jsx(qr,{className:"ml-auto h-4 w-4"})]}));gm.displayName=Ar.displayName;const pm=u.forwardRef(({className:s,...n},t)=>e.jsx(Hr,{ref:t,className:N("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...n}));pm.displayName=Hr.displayName;const zs=u.forwardRef(({className:s,sideOffset:n=4,...t},r)=>e.jsx(Lo,{children:e.jsx(Ur,{ref:r,sideOffset:n,className:N("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...t})}));zs.displayName=Ur.displayName;const Se=u.forwardRef(({className:s,inset:n,...t},r)=>e.jsx(Kr,{ref:r,className:N("relative flex cursor-default cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",s),...t}));Se.displayName=Kr.displayName;const Ql=u.forwardRef(({className:s,children:n,checked:t,...r},a)=>e.jsxs(Br,{ref:a,className:N("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:t,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Gr,{children:e.jsx(pt,{className:"h-4 w-4"})})}),n]}));Ql.displayName=Br.displayName;const fm=u.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(Wr,{ref:r,className:N("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...t,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Gr,{children:e.jsx(Ro,{className:"h-4 w-4 fill-current"})})}),n]}));fm.displayName=Wr.displayName;const Ha=u.forwardRef(({className:s,inset:n,...t},r)=>e.jsx(Yr,{ref:r,className:N("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",s),...t}));Ha.displayName=Yr.displayName;const at=u.forwardRef(({className:s,...n},t)=>e.jsx(Jr,{ref:t,className:N("-mx-1 my-1 h-px bg-muted",s),...n}));at.displayName=Jr.displayName;const Cn=({className:s,...n})=>e.jsx("span",{className:N("ml-auto text-xs tracking-widest opacity-60",s),...n});Cn.displayName="DropdownMenuShortcut";const cn=[{code:"en-US",name:"English",flag:Mo,shortName:"EN"},{code:"zh-CN",name:"中文",flag:Oo,shortName:"CN"}];function Xl(){const{i18n:s}=M(),n=a=>{s.changeLanguage(a)},t=cn.find(a=>a.code===s.language)||cn[1],r=t.flag;return e.jsxs(Hs,{children:[e.jsx(Bs,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",children:[e.jsx(r,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:"text-sm font-medium",children:t.shortName})]})}),e.jsx(zs,{align:"end",className:"w-[120px]",children:cn.map(a=>{const i=a.flag,l=a.code===s.language;return e.jsxs(Se,{onClick:()=>n(a.code),className:N("flex items-center gap-2 px-2 py-1.5 cursor-pointer",l&&"bg-accent"),children:[e.jsx(i,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:N("text-sm",l&&"font-medium"),children:a.name})]},a.code)})})]})}function jm(){const[s,n]=u.useState(!1),{t}=M("auth"),r=t("signIn.resetPassword.command");return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"container relative flex min-h-svh flex-col items-center justify-center bg-primary-foreground px-4 py-8 lg:max-w-none lg:px-0",children:[e.jsx("div",{className:"absolute right-4 top-4 md:right-8 md:top-8",children:e.jsx(Xl,{})}),e.jsxs("div",{className:"mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px] md:w-[420px] lg:p-8",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-center",children:[e.jsx("h1",{className:"text-2xl font-bold sm:text-3xl",children:window?.settings?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:window?.settings?.description})]}),e.jsxs(ke,{className:"p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-left",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-tight sm:text-2xl",children:t("signIn.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("signIn.description")})]}),e.jsx(um,{onForgotPassword:()=>n(!0)})]})]})]}),e.jsx(me,{open:s,onOpenChange:n,children:e.jsx(ce,{className:"max-w-[90vw] sm:max-w-lg",children:e.jsxs(pe,{children:[e.jsx(ue,{children:t("signIn.resetPassword.title")}),e.jsx($e,{children:t("signIn.resetPassword.description")}),e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"max-w-full overflow-x-auto rounded-md bg-secondary p-4 pr-12 text-sm",children:r}),e.jsx(G,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>Rt(r).then(()=>{z.success(t("common:copy.success"))}),children:e.jsx(zo,{className:"h-4 w-4"})})]})})]})})})]})}const vm=Object.freeze(Object.defineProperty({__proto__:null,default:jm},Symbol.toStringTag,{value:"Module"})),Ae=u.forwardRef(({className:s,fadedBelow:n=!1,fixedHeight:t=!1,...r},a)=>e.jsx("div",{ref:a,className:N("relative flex h-full w-full flex-col",n&&"after:pointer-events-none after:absolute after:bottom-0 after:left-0 after:hidden after:h-32 after:w-full after:bg-[linear-gradient(180deg,_transparent_10%,_hsl(var(--background))_70%)] after:md:block",t&&"md:h-svh",s),...r}));Ae.displayName="Layout";const qe=u.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:N("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...n}));qe.displayName="LayoutHeader";const We=u.forwardRef(({className:s,fixedHeight:n,...t},r)=>e.jsx("div",{ref:r,className:N("flex-1 overflow-hidden px-4 py-6 md:px-8",n&&"h-[calc(100%-var(--header-height))]",s),...t}));We.displayName="LayoutBody";const Zl=$o,ei=Ao,si=qo,fe=Ho,xe=Uo,he=Ko,de=u.forwardRef(({className:s,sideOffset:n=4,...t},r)=>e.jsx(Qr,{ref:r,sideOffset:n,className:N("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...t}));de.displayName=Qr.displayName;function Ua(){const{pathname:s}=Tn();return{checkActiveNav:t=>{if(t==="/"&&s==="/")return!0;const r=t.replace(/^\//,""),a=s.replace(/^\//,"");return r?a.startsWith(r):!1}}}function ti({key:s,defaultValue:n}){const[t,r]=u.useState(()=>{const a=localStorage.getItem(s);return a!==null?JSON.parse(a):n});return u.useEffect(()=>{localStorage.setItem(s,JSON.stringify(t))},[t,s]),[t,r]}function bm(){const[s,n]=ti({key:"collapsed-sidebar-items",defaultValue:[]}),t=a=>!s.includes(a);return{isExpanded:t,toggleItem:a=>{t(a)?n([...s,a]):n(s.filter(i=>i!==a))}}}function ym({links:s,isCollapsed:n,className:t,closeNav:r}){const{t:a}=M(),i=({sub:l,...d})=>{const x=`${a(d.title)}-${d.href}`;return n&&l?u.createElement(wm,{...d,sub:l,key:x,closeNav:r}):n?u.createElement(Nm,{...d,key:x,closeNav:r}):l?u.createElement(_m,{...d,sub:l,key:x,closeNav:r}):u.createElement(ai,{...d,key:x,closeNav:r})};return e.jsx("div",{"data-collapsed":n,className:N("group border-b bg-background py-2 transition-[max-height,padding] duration-500 data-[collapsed=true]:py-2 md:border-none",t),children:e.jsx(fe,{delayDuration:0,children:e.jsx("nav",{className:"grid gap-1 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2",children:s.map(i)})})})}function ai({title:s,icon:n,label:t,href:r,closeNav:a,subLink:i=!1}){const{checkActiveNav:l}=Ua(),{t:d}=M();return e.jsxs(tt,{to:r,onClick:a,className:N(It({variant:l(r)?"secondary":"ghost",size:"sm"}),"h-12 justify-start text-wrap rounded-none px-6",i&&"h-10 w-full border-l border-l-slate-500 px-2"),"aria-current":l(r)?"page":void 0,children:[e.jsx("div",{className:"mr-2",children:n}),d(s),t&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:d(t)})]})}function _m({title:s,icon:n,label:t,sub:r,closeNav:a}){const{checkActiveNav:i}=Ua(),{isExpanded:l,toggleItem:d}=bm(),{t:x}=M(),m=!!r?.find(f=>i(f.href)),o=x(s),c=l(o)||m;return e.jsxs(Zl,{open:c,onOpenChange:()=>d(o),children:[e.jsxs(ei,{className:N(It({variant:m?"secondary":"ghost",size:"sm"}),"group h-12 w-full justify-start rounded-none px-6"),children:[e.jsx("div",{className:"mr-2",children:n}),x(s),t&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:x(t)}),e.jsx("span",{className:N('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(Xr,{stroke:1})})]}),e.jsx(si,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:r.map(f=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(ai,{...f,subLink:!0,closeNav:a})},x(f.title)))})})]})}function Nm({title:s,icon:n,label:t,href:r,closeNav:a}){const{checkActiveNav:i}=Ua(),{t:l}=M();return e.jsxs(xe,{delayDuration:0,children:[e.jsx(he,{asChild:!0,children:e.jsxs(tt,{to:r,onClick:a,className:N(It({variant:i(r)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[n,e.jsx("span",{className:"sr-only",children:l(s)})]})}),e.jsxs(de,{side:"right",className:"flex items-center gap-4",children:[l(s),t&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:l(t)})]})]})}function wm({title:s,icon:n,label:t,sub:r,closeNav:a}){const{checkActiveNav:i}=Ua(),{t:l}=M(),d=!!r?.find(x=>i(x.href));return e.jsxs(Hs,{children:[e.jsxs(xe,{delayDuration:0,children:[e.jsx(he,{asChild:!0,children:e.jsx(Bs,{asChild:!0,children:e.jsx(F,{variant:d?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:n})})}),e.jsxs(de,{side:"right",className:"flex items-center gap-4",children:[l(s)," ",t&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:l(t)}),e.jsx(Xr,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(zs,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(Ha,{children:[l(s)," ",t?`(${l(t)})`:""]}),e.jsx(at,{}),r.map(({title:x,icon:m,label:o,href:c})=>e.jsx(Se,{asChild:!0,children:e.jsxs(tt,{to:c,onClick:a,className:`${i(c)?"bg-secondary":""}`,children:[m," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:l(x)}),o&&e.jsx("span",{className:"ml-auto text-xs",children:l(o)})]})},`${l(x)}-${c}`))]})]})}const ni=[{title:"nav:dashboard",label:"",href:"/",icon:e.jsx(Bo,{size:18})},{title:"nav:systemManagement",label:"",href:"",icon:e.jsx(Go,{size:18}),sub:[{title:"nav:systemConfig",label:"",href:"/config/system",icon:e.jsx(Zr,{size:18})},{title:"nav:pluginManagement",label:"",href:"/config/plugin",icon:e.jsx(Pn,{size:18})},{title:"nav:themeConfig",label:"",href:"/config/theme",icon:e.jsx(Wo,{size:18})},{title:"nav:noticeManagement",label:"",href:"/config/notice",icon:e.jsx(Yo,{size:18})},{title:"nav:paymentConfig",label:"",href:"/config/payment",icon:e.jsx(sr,{size:18})},{title:"nav:knowledgeManagement",label:"",href:"/config/knowledge",icon:e.jsx(Jo,{size:18})}]},{title:"nav:nodeManagement",label:"",href:"",icon:e.jsx(el,{size:18}),sub:[{title:"nav:nodeManagement",label:"",href:"/server/manage",icon:e.jsx(Qo,{size:18})},{title:"nav:permissionGroupManagement",label:"",href:"/server/group",icon:e.jsx(sl,{size:18})},{title:"nav:routeManagement",label:"",href:"/server/route",icon:e.jsx(Xo,{size:18})}]},{title:"nav:subscriptionManagement",label:"",href:"",icon:e.jsx(Zo,{size:18}),sub:[{title:"nav:planManagement",label:"",href:"/finance/plan",icon:e.jsx(ec,{size:18})},{title:"nav:orderManagement",label:"",href:"/finance/order",icon:e.jsx(sr,{size:18})},{title:"nav:couponManagement",label:"",href:"/finance/coupon",icon:e.jsx(sc,{size:18})},{title:"nav:giftCardManagement",label:"",href:"/finance/gift-card",icon:e.jsx(tc,{size:18})}]},{title:"nav:userManagement",label:"",href:"",icon:e.jsx(ac,{size:18}),sub:[{title:"nav:userManagement",label:"",href:"/user/manage",icon:e.jsx(nc,{size:18})},{title:"nav:ticketManagement",label:"",href:"/user/ticket",icon:e.jsx(tl,{size:18})}]}];function Cm({className:s,isCollapsed:n,setIsCollapsed:t}){const[r,a]=u.useState(!1),{t:i}=M();return u.useEffect(()=>{r?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[r]),e.jsxs("aside",{className:N(`fixed left-0 right-0 top-0 z-50 flex h-auto flex-col border-r-2 border-r-muted transition-[width] md:bottom-0 md:right-auto md:h-svh ${n?"md:w-14":"md:w-64"}`,s),children:[e.jsx("div",{onClick:()=>a(!1),className:`absolute inset-0 transition-[opacity] delay-100 duration-700 ${r?"h-svh opacity-50":"h-0 opacity-0"} w-full bg-black md:hidden`}),e.jsxs(Ae,{className:`flex h-full flex-col ${r?"h-[100vh] md:h-full":""}`,children:[e.jsxs(qe,{className:"sticky top-0 justify-between px-4 py-3 shadow md:px-4",children:[e.jsxs("div",{className:`flex items-center ${n?"":"gap-2"}`,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:`transition-all ${n?"h-6 w-6":"h-8 w-8"}`,children:[e.jsx("rect",{width:"256",height:"256",fill:"none"}),e.jsx("line",{x1:"208",y1:"128",x2:"128",y2:"208",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("line",{x1:"192",y1:"40",x2:"40",y2:"192",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("span",{className:"sr-only",children:"Website Name"})]}),e.jsx("div",{className:`flex flex-col justify-end truncate ${n?"invisible w-0":"visible w-auto"}`,children:e.jsx("span",{className:"font-medium",children:window?.settings?.title})})]}),e.jsx(F,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":i("common:toggleNavigation"),"aria-controls":"sidebar-menu","aria-expanded":r,onClick:()=>a(l=>!l),children:r?e.jsx(rc,{}):e.jsx(lc,{})})]}),e.jsx(ym,{id:"sidebar-menu",className:N("flex-1 overflow-auto overscroll-contain",r?"block":"hidden md:block","md:py-2"),closeNav:()=>a(!1),isCollapsed:n,links:ni}),e.jsx("div",{className:N("border-t border-border/50 bg-background","px-4 py-2.5 text-xs text-muted-foreground",r?"block":"hidden md:block",n?"text-center":"text-left"),children:e.jsxs("div",{className:N("flex items-center gap-1.5",n?"justify-center":"justify-start"),children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),e.jsxs("span",{className:N("whitespace-nowrap tracking-wide","transition-opacity duration-200",n&&"md:opacity-0"),children:["v",window?.settings?.version]})]})}),e.jsx(F,{onClick:()=>t(l=>!l),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex","aria-label":i("common:toggleSidebar"),children:e.jsx(ic,{stroke:1.5,className:`h-5 w-5 ${n?"rotate-180":""}`})})]})]})}function Sm(){const[s,n]=ti({key:"collapsed-sidebar",defaultValue:!1});return u.useEffect(()=>{const t=()=>{n(window.innerWidth<768?!1:s)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[s,n]),[s,n]}function km(){const[s,n]=Sm();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(Cm,{isCollapsed:s,setIsCollapsed:n}),e.jsx("main",{id:"content",className:`overflow-x-hidden pt-16 transition-[margin] md:overflow-y-hidden md:pt-0 ${s?"md:ml-14":"md:ml-64"} h-full`,children:e.jsx(Dn,{})})]})}const Tm=Object.freeze(Object.defineProperty({__proto__:null,default:km},Symbol.toStringTag,{value:"Module"})),it=u.forwardRef(({className:s,...n},t)=>e.jsx(xs,{ref:t,className:N("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...n}));it.displayName=xs.displayName;const Dm=({children:s,...n})=>e.jsx(me,{...n,children:e.jsx(ce,{className:"overflow-hidden p-0",children:e.jsx(it,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:s})})}),vt=u.forwardRef(({className:s,...n},t)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(oc,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(xs.Input,{ref:t,className:N("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",s),...n})]}));vt.displayName=xs.Input.displayName;const ot=u.forwardRef(({className:s,...n},t)=>e.jsx(xs.List,{ref:t,className:N("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...n}));ot.displayName=xs.List.displayName;const bt=u.forwardRef((s,n)=>e.jsx(xs.Empty,{ref:n,className:"py-6 text-center text-sm",...s}));bt.displayName=xs.Empty.displayName;const ks=u.forwardRef(({className:s,...n},t)=>e.jsx(xs.Group,{ref:t,className:N("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",s),...n}));ks.displayName=xs.Group.displayName;const Mt=u.forwardRef(({className:s,...n},t)=>e.jsx(xs.Separator,{ref:t,className:N("-mx-1 h-px bg-border",s),...n}));Mt.displayName=xs.Separator.displayName;const rs=u.forwardRef(({className:s,...n},t)=>e.jsx(xs.Item,{ref:t,className:N("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...n}));rs.displayName=xs.Item.displayName;function Fm(){const s=[];for(const n of ni)if(n.href&&s.push(n),n.sub)for(const t of n.sub)s.push({...t,parent:n.title});return s}function cs(){const[s,n]=u.useState(!1),t=Gs(),r=Fm(),{t:a}=M("search"),{t:i}=M("nav");u.useEffect(()=>{const d=x=>{x.key==="k"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),n(m=>!m))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]);const l=u.useCallback(d=>{n(!1),t(d)},[t]);return e.jsxs(e.Fragment,{children:[e.jsxs(G,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-10 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>n(!0),children:[e.jsx(Ln,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex",children:a("placeholder")}),e.jsx("span",{className:"sr-only",children:a("shortcut.label")}),e.jsx("kbd",{className:"pointer-events-none absolute right-1.5 top-2 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:a("shortcut.key")})]}),e.jsxs(Dm,{open:s,onOpenChange:n,children:[e.jsx(vt,{placeholder:a("placeholder")}),e.jsxs(ot,{children:[e.jsx(bt,{children:a("noResults")}),e.jsx(ks,{heading:a("title"),children:r.map(d=>e.jsxs(rs,{value:`${d.parent?d.parent+" ":""}${d.title}`,onSelect:()=>l(d.href),children:[e.jsx("div",{className:"mr-2",children:d.icon}),e.jsx("span",{children:i(d.title)}),d.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:i(d.parent)})]},d.href))})]})]})]})}function es(){const{theme:s,setTheme:n}=Vd();return u.useEffect(()=>{const t=s==="dark"?"#020817":"#fff",r=document.querySelector("meta[name='theme-color']");r&&r.setAttribute("content",t)},[s]),e.jsxs(e.Fragment,{children:[e.jsx(F,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>n(s==="light"?"dark":"light"),children:s==="light"?e.jsx(cc,{size:20}):e.jsx(dc,{size:20})}),e.jsx(Xl,{})]})}const ri=u.forwardRef(({className:s,...n},t)=>e.jsx(al,{ref:t,className:N("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...n}));ri.displayName=al.displayName;const li=u.forwardRef(({className:s,...n},t)=>e.jsx(nl,{ref:t,className:N("aspect-square h-full w-full",s),...n}));li.displayName=nl.displayName;const ii=u.forwardRef(({className:s,...n},t)=>e.jsx(rl,{ref:t,className:N("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...n}));ii.displayName=rl.displayName;function ss(){const s=Gs(),n=Mr(),t=mc(im),{t:r}=M(["common"]),a=()=>{Hl(),n(lm()),s("/sign-in")},i=t?.email?.split("@")[0]||r("common:user"),l=i.substring(0,2).toUpperCase();return e.jsxs(Hs,{children:[e.jsx(Bs,{asChild:!0,children:e.jsx(F,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(ri,{className:"h-8 w-8",children:[e.jsx(li,{src:t?.avatar_url,alt:i}),e.jsx(ii,{children:l})]})})}),e.jsxs(zs,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(Ha,{className:"font-normal",children:e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("p",{className:"text-sm font-medium leading-none",children:i}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:t?.email||r("common:defaultEmail")})]})}),e.jsx(at,{}),e.jsx(Se,{asChild:!0,children:e.jsxs(tt,{to:"/config/system",children:[r("common:settings"),e.jsx(Cn,{children:"⌘S"})]})}),e.jsx(at,{}),e.jsxs(Se,{onClick:a,children:[r("common:logout"),e.jsx(Cn,{children:"⇧⌘Q"})]})]})]})}const J=uc,fs=bc,Q=xc,W=u.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(ll,{ref:r,className:N("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...t,children:[n,e.jsx(hc,{asChild:!0,children:e.jsx(Rn,{className:"h-4 w-4 opacity-50"})})]}));W.displayName=ll.displayName;const oi=u.forwardRef(({className:s,...n},t)=>e.jsx(il,{ref:t,className:N("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(gc,{className:"h-4 w-4"})}));oi.displayName=il.displayName;const ci=u.forwardRef(({className:s,...n},t)=>e.jsx(ol,{ref:t,className:N("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(Rn,{className:"h-4 w-4"})}));ci.displayName=ol.displayName;const Y=u.forwardRef(({className:s,children:n,position:t="popper",...r},a)=>e.jsx(pc,{children:e.jsxs(cl,{ref:a,className:N("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:t,...r,children:[e.jsx(oi,{}),e.jsx(fc,{className:N("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(ci,{})]})}));Y.displayName=cl.displayName;const Pm=u.forwardRef(({className:s,...n},t)=>e.jsx(dl,{ref:t,className:N("px-2 py-1.5 text-sm font-semibold",s),...n}));Pm.displayName=dl.displayName;const A=u.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(ml,{ref:r,className:N("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...t,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(jc,{children:e.jsx(pt,{className:"h-4 w-4"})})}),e.jsx(vc,{children:n})]}));A.displayName=ml.displayName;const Lm=u.forwardRef(({className:s,...n},t)=>e.jsx(ul,{ref:t,className:N("-mx-1 my-1 h-px bg-muted",s),...n}));Lm.displayName=ul.displayName;function Ss({className:s,classNames:n,showOutsideDays:t=!0,captionLayout:r="label",buttonVariant:a="ghost",formatters:i,components:l,...d}){const x=xl();return e.jsx(yc,{showOutsideDays:t,className:N("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,s),captionLayout:r,formatters:{formatMonthDropdown:m=>m.toLocaleString("default",{month:"short"}),...i},classNames:{root:N("w-fit",x.root),months:N("relative flex flex-col gap-4 md:flex-row",x.months),month:N("flex w-full flex-col gap-4",x.month),nav:N("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",x.nav),button_previous:N(Vt({variant:a}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",x.button_previous),button_next:N(Vt({variant:a}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",x.button_next),month_caption:N("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",x.month_caption),dropdowns:N("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",x.dropdowns),dropdown_root:N("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",x.dropdown_root),dropdown:N("absolute inset-0 opacity-0",x.dropdown),caption_label:N("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",x.caption_label),table:"w-full border-collapse",weekdays:N("flex",x.weekdays),weekday:N("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",x.weekday),week:N("mt-2 flex w-full",x.week),week_number_header:N("w-[--cell-size] select-none",x.week_number_header),week_number:N("text-muted-foreground select-none text-[0.8rem]",x.week_number),day:N("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",x.day),range_start:N("bg-accent rounded-l-md",x.range_start),range_middle:N("rounded-none",x.range_middle),range_end:N("bg-accent rounded-r-md",x.range_end),today:N("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",x.today),outside:N("text-muted-foreground aria-selected:text-muted-foreground",x.outside),disabled:N("text-muted-foreground opacity-50",x.disabled),hidden:N("invisible",x.hidden),...n},components:{Root:({className:m,rootRef:o,...c})=>e.jsx("div",{"data-slot":"calendar",ref:o,className:N(m),...c}),Chevron:({className:m,orientation:o,...c})=>o==="left"?e.jsx(hl,{className:N("size-4",m),...c}):o==="right"?e.jsx(gl,{className:N("size-4",m),...c}):e.jsx(pl,{className:N("size-4",m),...c}),DayButton:Rm,WeekNumber:({children:m,...o})=>e.jsx("td",{...o,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:m})}),...l},...d})}function Rm({className:s,day:n,modifiers:t,...r}){const a=xl(),i=u.useRef(null);return u.useEffect(()=>{t.focused&&i.current?.focus()},[t.focused]),e.jsx(G,{ref:i,variant:"ghost",size:"icon","data-day":n.date.toLocaleDateString(),"data-selected-single":t.selected&&!t.range_start&&!t.range_end&&!t.range_middle,"data-range-start":t.range_start,"data-range-end":t.range_end,"data-range-middle":t.range_middle,className:N("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",a.day,s),...r})}const ls=Nc,is=wc,Xe=u.forwardRef(({className:s,align:n="center",sideOffset:t=4,...r},a)=>e.jsx(_c,{children:e.jsx(fl,{ref:a,align:n,sideOffset:t,className:N("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...r})}));Xe.displayName=fl.displayName;const Js={income:{main:"hsl(var(--primary))",gradient:{start:"hsl(var(--primary))",end:"transparent"}},commission:{main:"hsl(var(--secondary))",gradient:{start:"hsl(var(--secondary))",end:"transparent"}}},Kt=s=>(s/100).toFixed(2),Em=({active:s,payload:n,label:t})=>{const{t:r}=M();return s&&n&&n.length?e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-sm",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:t}),n.map((a,i)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:a.color}}),e.jsxs("span",{className:"text-muted-foreground",children:[r(a.name),":"]}),e.jsx("span",{className:"font-medium",children:a.name.includes(r("dashboard:overview.amount"))?`¥${Kt(a.value)}`:r("dashboard:overview.transactions",{count:a.value})})]},i))]}):null},Vm=[{value:"7d",label:"dashboard:overview.last7Days"},{value:"30d",label:"dashboard:overview.last30Days"},{value:"90d",label:"dashboard:overview.last90Days"},{value:"180d",label:"dashboard:overview.last180Days"},{value:"365d",label:"dashboard:overview.lastYear"},{value:"custom",label:"dashboard:overview.customRange"}],Im=(s,n)=>{const t=new Date;if(s==="custom"&&n)return{startDate:n.from,endDate:n.to};let r;switch(s){case"7d":r=Is(t,7);break;case"30d":r=Is(t,30);break;case"90d":r=Is(t,90);break;case"180d":r=Is(t,180);break;case"365d":r=Is(t,365);break;default:r=Is(t,30)}return{startDate:r,endDate:t}};function Mm(){const[s,n]=u.useState("amount"),[t,r]=u.useState("30d"),[a,i]=u.useState({from:Is(new Date,7),to:new Date}),{t:l}=M(),{startDate:d,endDate:x}=Im(t,a),{data:m}=re({queryKey:["orderStat",{start_date:Le(d,"yyyy-MM-dd"),end_date:Le(x,"yyyy-MM-dd")}],queryFn:async()=>{const{data:o}=await Fa.getOrderStat({start_date:Le(d,"yyyy-MM-dd"),end_date:Le(x,"yyyy-MM-dd")});return o},refetchInterval:3e4});return e.jsxs(ke,{children:[e.jsx(Fe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ve,{children:l("dashboard:overview.title")}),e.jsxs(Zs,{children:[m?.summary.start_date," ",l("dashboard:overview.to")," ",m?.summary.end_date]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsxs(J,{value:t,onValueChange:o=>r(o),children:[e.jsx(W,{className:"w-[120px]",children:e.jsx(Q,{placeholder:l("dashboard:overview.selectTimeRange")})}),e.jsx(Y,{children:Vm.map(o=>e.jsx(A,{value:o.value,children:l(o.label)},o.value))})]}),t==="custom"&&e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:N("min-w-0 justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a?.from?a.to?e.jsxs(e.Fragment,{children:[Le(a.from,"yyyy-MM-dd")," -"," ",Le(a.to,"yyyy-MM-dd")]}):Le(a.from,"yyyy-MM-dd"):l("dashboard:overview.selectDate")})]})}),e.jsx(Xe,{className:"w-auto p-0",align:"end",children:e.jsx(Ss,{mode:"range",defaultMonth:a?.from,selected:{from:a?.from,to:a?.to},onSelect:o=>{o?.from&&o?.to&&i({from:o.from,to:o.to})},captionLayout:"dropdown",numberOfMonths:2})})]})]}),e.jsx(ft,{value:s,onValueChange:o=>n(o),children:e.jsxs(lt,{children:[e.jsx(Ke,{value:"amount",children:l("dashboard:overview.amount")}),e.jsx(Ke,{value:"count",children:l("dashboard:overview.count")})]})})]})]})}),e.jsxs(Pe,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:l("dashboard:overview.totalIncome")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Kt(m?.summary?.paid_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l("dashboard:overview.totalTransactions",{count:m?.summary?.paid_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[l("dashboard:overview.avgOrderAmount")," ¥",Kt(m?.summary?.avg_paid_amount||0)]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:l("dashboard:overview.totalCommission")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Kt(m?.summary?.commission_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l("dashboard:overview.totalTransactions",{count:m?.summary?.commission_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[l("dashboard:overview.commissionRate")," ",m?.summary?.commission_rate.toFixed(2)||0,"%"]})]})]}),e.jsx("div",{className:"h-[400px] w-full",children:e.jsx(Cc,{width:"100%",height:"100%",children:e.jsxs(Sc,{data:m?.list||[],margin:{top:20,right:20,left:0,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"incomeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:Js.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:Js.income.gradient.end,stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"commissionGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:Js.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:Js.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(kc,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:o=>Le(new Date(o),"MM-dd",{locale:Pc})}),e.jsx(Tc,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:o=>s==="amount"?`¥${Kt(o)}`:l("dashboard:overview.transactions",{count:o})}),e.jsx(Dc,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(Fc,{content:e.jsx(Em,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(tr,{type:"monotone",dataKey:"paid_total",name:l("dashboard:overview.orderAmount"),stroke:Js.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(tr,{type:"monotone",dataKey:"commission_total",name:l("dashboard:overview.commissionAmount"),stroke:Js.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(ar,{dataKey:"paid_count",name:l("dashboard:overview.orderCount"),fill:Js.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(ar,{dataKey:"commission_count",name:l("dashboard:overview.commissionCount"),fill:Js.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})]})]})}function be({className:s,...n}){return e.jsx("div",{className:N("animate-pulse rounded-md bg-primary/10",s),...n})}function Om(){return e.jsxs(ke,{children:[e.jsxs(Fe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(be,{className:"h-4 w-[120px]"}),e.jsx(be,{className:"h-4 w-4"})]}),e.jsxs(Pe,{children:[e.jsx(be,{className:"h-8 w-[140px] mb-2"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{className:"h-4 w-4"}),e.jsx(be,{className:"h-4 w-[100px]"})]})]})]})}function zm(){return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:Array.from({length:8}).map((s,n)=>e.jsx(Om,{},n))})}var ie=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.CANCELLED=2]="CANCELLED",s[s.COMPLETED=3]="COMPLETED",s[s.DISCOUNTED=4]="DISCOUNTED",s))(ie||{});const At={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},qt={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var Ms=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=4]="RESET_FLOW",s))(Ms||{}),Ce=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(Ce||{});const xa={0:"待确认",1:"发放中",2:"有效",3:"无效"},ha={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var Qe=(s=>(s.MONTH_PRICE="month_price",s.QUARTER_PRICE="quarter_price",s.HALF_YEAR_PRICE="half_year_price",s.YEAR_PRICE="year_price",s.TWO_YEAR_PRICE="two_year_price",s.THREE_YEAR_PRICE="three_year_price",s.ONETIME_PRICE="onetime_price",s.RESET_PRICE="reset_price",s))(Qe||{});const $m={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var ge=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s.Tuic="tuic",s.Socks="socks",s.Naive="naive",s.Http="http",s.Mieru="mieru",s.AnyTLS="anytls",s))(ge||{});const Fs=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"},{type:"tuic",label:"TUIC"},{type:"socks",label:"SOCKS"},{type:"naive",label:"Naive"},{type:"http",label:"HTTP"},{type:"mieru",label:"Mieru"},{type:"anytls",label:"AnyTLS"}],vs={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a",tuic:"#00C853",socks:"#2196F3",naive:"#9C27B0",http:"#FF5722",mieru:"#4CAF50",anytls:"#7E57C2"};var ws=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(ws||{});const Am={1:"按金额优惠",2:"按比例优惠"};var st=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(st||{}),ms=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(ms||{}),Xt=(s=>(s.MONTH="monthly",s.QUARTER="quarterly",s.HALF_YEAR="half_yearly",s.YEAR="yearly",s.TWO_YEAR="two_yearly",s.THREE_YEAR="three_yearly",s.ONETIME="onetime",s.RESET="reset_traffic",s))(Xt||{});function Qs({title:s,value:n,icon:t,trend:r,description:a,onClick:i,highlight:l,className:d}){return e.jsxs(ke,{className:N("transition-colors",i&&"cursor-pointer hover:bg-muted/50",l&&"border-primary/50",d),onClick:i,children:[e.jsxs(Fe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ve,{className:"text-sm font-medium",children:s}),t]}),e.jsxs(Pe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n}),r?e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(Vc,{className:N("h-4 w-4",r.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:N("ml-1 text-xs",r.isPositive?"text-emerald-500":"text-red-500"),children:[r.isPositive?"+":"-",Math.abs(r.value),"%"]}),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:r.label})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:a})]})]})}function qm({className:s}){const n=Gs(),{t}=M(),{data:r,isLoading:a}=re({queryKey:["dashboardStats"],queryFn:async()=>(await Fa.getStatsData()).data,refetchInterval:1e3*60*5});if(a||!r)return e.jsx(zm,{});const i=()=>{const l=new URLSearchParams;l.set("commission_status",Ce.PENDING.toString()),l.set("status",ie.COMPLETED.toString()),l.set("commission_balance","gt:0"),n(`/finance/order?${l.toString()}`)};return e.jsxs("div",{className:N("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx(Qs,{title:t("dashboard:stats.todayIncome"),value:Ks(r.todayIncome),icon:e.jsx(Lc,{className:"h-4 w-4 text-emerald-500"}),trend:{value:r.dayIncomeGrowth,label:t("dashboard:stats.vsYesterday"),isPositive:r.dayIncomeGrowth>0}}),e.jsx(Qs,{title:t("dashboard:stats.monthlyIncome"),value:Ks(r.currentMonthIncome),icon:e.jsx(En,{className:"h-4 w-4 text-blue-500"}),trend:{value:r.monthIncomeGrowth,label:t("dashboard:stats.vsLastMonth"),isPositive:r.monthIncomeGrowth>0}}),e.jsx(Qs,{title:t("dashboard:stats.pendingTickets"),value:r.ticketPendingTotal,icon:e.jsx(Rc,{className:N("h-4 w-4",r.ticketPendingTotal>0?"text-orange-500":"text-muted-foreground")}),description:r.ticketPendingTotal>0?t("dashboard:stats.hasPendingTickets"):t("dashboard:stats.noPendingTickets"),onClick:()=>n("/user/ticket"),highlight:r.ticketPendingTotal>0}),e.jsx(Qs,{title:t("dashboard:stats.pendingCommission"),value:r.commissionPendingTotal,icon:e.jsx(Ec,{className:N("h-4 w-4",r.commissionPendingTotal>0?"text-blue-500":"text-muted-foreground")}),description:r.commissionPendingTotal>0?t("dashboard:stats.hasPendingCommission"):t("dashboard:stats.noPendingCommission"),onClick:i,highlight:r.commissionPendingTotal>0}),e.jsx(Qs,{title:t("dashboard:stats.monthlyNewUsers"),value:r.currentMonthNewUsers,icon:e.jsx(wa,{className:"h-4 w-4 text-blue-500"}),trend:{value:r.userGrowth,label:t("dashboard:stats.vsLastMonth"),isPositive:r.userGrowth>0}}),e.jsx(Qs,{title:t("dashboard:stats.totalUsers"),value:r.totalUsers,icon:e.jsx(wa,{className:"h-4 w-4 text-muted-foreground"}),description:t("dashboard:stats.activeUsers",{count:r.activeUsers})}),e.jsx(Qs,{title:t("dashboard:stats.monthlyUpload"),value:ze(r.monthTraffic.upload),icon:e.jsx(Lt,{className:"h-4 w-4 text-emerald-500"}),description:t("dashboard:stats.todayTraffic",{value:ze(r.todayTraffic.upload)})}),e.jsx(Qs,{title:t("dashboard:stats.monthlyDownload"),value:ze(r.monthTraffic.download),icon:e.jsx(sa,{className:"h-4 w-4 text-blue-500"}),description:t("dashboard:stats.todayTraffic",{value:ze(r.todayTraffic.download)})})]})}const ht=u.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(jl,{ref:r,className:N("relative overflow-hidden",s),...t,children:[e.jsx(Ic,{className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(La,{}),e.jsx(Mc,{})]}));ht.displayName=jl.displayName;const La=u.forwardRef(({className:s,orientation:n="vertical",...t},r)=>e.jsx(vl,{ref:r,orientation:n,className:N("flex touch-none select-none transition-colors",n==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",n==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",s),...t,children:e.jsx(Oc,{className:"relative flex-1 rounded-full bg-border"})}));La.displayName=vl.displayName;const Sn={today:{getValue:()=>{const s=$c();return{start:s,end:Ac(s,1)}}},last7days:{getValue:()=>{const s=new Date;return{start:Is(s,7),end:s}}},last30days:{getValue:()=>{const s=new Date;return{start:Is(s,30),end:s}}},custom:{getValue:()=>null}};function fr({selectedRange:s,customDateRange:n,onRangeChange:t,onCustomRangeChange:r}){const{t:a}=M(),i={today:a("dashboard:trafficRank.today"),last7days:a("dashboard:trafficRank.last7days"),last30days:a("dashboard:trafficRank.last30days"),custom:a("dashboard:trafficRank.customRange")};return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.jsxs(J,{value:s,onValueChange:t,children:[e.jsx(W,{className:"w-[120px]",children:e.jsx(Q,{placeholder:a("dashboard:trafficRank.selectTimeRange")})}),e.jsx(Y,{position:"popper",className:"z-50",children:Object.entries(Sn).map(([l])=>e.jsx(A,{value:l,children:i[l]},l))})]}),s==="custom"&&e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:N("min-w-0 justify-start text-left font-normal",!n&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:n?.from?n.to?e.jsxs(e.Fragment,{children:[Le(n.from,"yyyy-MM-dd")," -"," ",Le(n.to,"yyyy-MM-dd")]}):Le(n.from,"yyyy-MM-dd"):e.jsx("span",{children:a("dashboard:trafficRank.selectDateRange")})})]})}),e.jsx(Xe,{className:"w-auto p-0",align:"end",children:e.jsx(Ss,{mode:"range",defaultMonth:n?.from,selected:{from:n?.from,to:n?.to},onSelect:l=>{l?.from&&l?.to&&r({from:l.from,to:l.to})},numberOfMonths:2})})]})]})}const kt=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Hm({className:s}){const{t:n}=M(),[t,r]=u.useState("today"),[a,i]=u.useState({from:Is(new Date,7),to:new Date}),[l,d]=u.useState("today"),[x,m]=u.useState({from:Is(new Date,7),to:new Date}),o=u.useMemo(()=>t==="custom"?{start:a.from,end:a.to}:Sn[t].getValue(),[t,a]),c=u.useMemo(()=>l==="custom"?{start:x.from,end:x.to}:Sn[l].getValue(),[l,x]),{data:f}=re({queryKey:["nodeTrafficRank",o.start,o.end],queryFn:()=>Fa.getNodeTrafficData({type:"node",start_time:Re.round(o.start.getTime()/1e3),end_time:Re.round(o.end.getTime()/1e3)}),refetchInterval:3e4}),{data:D}=re({queryKey:["userTrafficRank",c.start,c.end],queryFn:()=>Fa.getNodeTrafficData({type:"user",start_time:Re.round(c.start.getTime()/1e3),end_time:Re.round(c.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:N("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(ke,{children:[e.jsx(Fe,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(Ve,{className:"flex items-center text-base font-medium",children:[e.jsx(zc,{className:"mr-2 h-4 w-4"}),n("dashboard:trafficRank.nodeTrafficRank")]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(fr,{selectedRange:t,customDateRange:a,onRangeChange:r,onCustomRangeChange:i}),e.jsx(nr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Pe,{className:"flex-1",children:f?.data?e.jsxs(ht,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:f.data.map(S=>e.jsx(fe,{delayDuration:200,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:S.name}),e.jsxs("span",{className:N("ml-2 flex items-center text-xs font-medium",S.change>=0?"text-green-600":"text-red-600"),children:[S.change>=0?e.jsx(fn,{className:"mr-1 h-3 w-3"}):e.jsx(jn,{className:"mr-1 h-3 w-3"}),Math.abs(S.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${S.value/f.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:kt(S.value)})]})]})})}),e.jsx(de,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.currentTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:kt(S.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:kt(S.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:N("font-medium",S.change>=0?"text-green-600":"text-red-600"),children:[S.change>=0?"+":"",S.change,"%"]})]})})]})},S.id))}),e.jsx(La,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:n("common:loading")})})})]}),e.jsxs(ke,{children:[e.jsx(Fe,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(Ve,{className:"flex items-center text-base font-medium",children:[e.jsx(wa,{className:"mr-2 h-4 w-4"}),n("dashboard:trafficRank.userTrafficRank")]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(fr,{selectedRange:l,customDateRange:x,onRangeChange:d,onCustomRangeChange:m}),e.jsx(nr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Pe,{className:"flex-1",children:D?.data?e.jsxs(ht,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:D.data.map(S=>e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:S.name}),e.jsxs("span",{className:N("ml-2 flex items-center text-xs font-medium",S.change>=0?"text-green-600":"text-red-600"),children:[S.change>=0?e.jsx(fn,{className:"mr-1 h-3 w-3"}):e.jsx(jn,{className:"mr-1 h-3 w-3"}),Math.abs(S.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${S.value/D.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:kt(S.value)})]})]})})}),e.jsx(de,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.currentTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:kt(S.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:kt(S.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:N("font-medium",S.change>=0?"text-green-600":"text-red-600"),children:[S.change>=0?"+":"",S.change,"%"]})]})})]})},S.id))}),e.jsx(La,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:n("common:loading")})})})]})]})}const Um=gt("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/10",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function q({className:s,variant:n,...t}){return e.jsx("div",{className:N(Um({variant:n}),s),...t})}const ba=u.forwardRef(({className:s,value:n,...t},r)=>e.jsx(bl,{ref:r,className:N("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...t,children:e.jsx(qc,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));ba.displayName=bl.displayName;const $n=u.forwardRef(({className:s,...n},t)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:t,className:N("w-full caption-bottom text-sm",s),...n})}));$n.displayName="Table";const An=u.forwardRef(({className:s,...n},t)=>e.jsx("thead",{ref:t,className:N("[&_tr]:border-b",s),...n}));An.displayName="TableHeader";const qn=u.forwardRef(({className:s,...n},t)=>e.jsx("tbody",{ref:t,className:N("[&_tr:last-child]:border-0",s),...n}));qn.displayName="TableBody";const Km=u.forwardRef(({className:s,...n},t)=>e.jsx("tfoot",{ref:t,className:N("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...n}));Km.displayName="TableFooter";const Xs=u.forwardRef(({className:s,...n},t)=>e.jsx("tr",{ref:t,className:N("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...n}));Xs.displayName="TableRow";const Hn=u.forwardRef(({className:s,...n},t)=>e.jsx("th",{ref:t,className:N("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...n}));Hn.displayName="TableHead";const Pt=u.forwardRef(({className:s,...n},t)=>e.jsx("td",{ref:t,className:N("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...n}));Pt.displayName="TableCell";const Bm=u.forwardRef(({className:s,...n},t)=>e.jsx("caption",{ref:t,className:N("mt-4 text-sm text-muted-foreground",s),...n}));Bm.displayName="TableCaption";function di({table:s}){const[n,t]=u.useState(""),{t:r}=M("common");u.useEffect(()=>{t((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const a=i=>{const l=parseInt(i);!isNaN(l)&&l>=1&&l<=s.getPageCount()?s.setPageIndex(l-1):t((s.getState().pagination.pageIndex+1).toString())};return e.jsxs("div",{className:"flex flex-col-reverse gap-4 px-2 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"flex-1 text-sm text-muted-foreground",children:r("table.pagination.selected",{selected:s.getFilteredSelectedRowModel().rows.length,total:s.getFilteredRowModel().rows.length})}),e.jsxs("div",{className:"flex flex-col-reverse items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:r("table.pagination.itemsPerPage")}),e.jsxs(J,{value:`${s.getState().pagination.pageSize}`,onValueChange:i=>{s.setPageSize(Number(i))},children:[e.jsx(W,{className:"h-8 w-[70px]",children:e.jsx(Q,{placeholder:s.getState().pagination.pageSize})}),e.jsx(Y,{side:"top",children:[10,20,30,40,50,100,500].map(i=>e.jsx(A,{value:`${i}`,children:i},i))})]})]}),e.jsxs("div",{className:"flex items-center justify-center space-x-2 text-sm font-medium",children:[e.jsx("span",{children:r("table.pagination.page")}),e.jsx(k,{type:"text",value:n,onChange:i=>t(i.target.value),onBlur:i=>a(i.target.value),onKeyDown:i=>{i.key==="Enter"&&a(i.currentTarget.value)},className:"h-8 w-[50px] text-center"}),e.jsx("span",{children:r("table.pagination.pageOf",{total:s.getPageCount()})})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(F,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(0),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:r("table.pagination.firstPage")}),e.jsx(Hc,{className:"h-4 w-4"})]}),e.jsxs(F,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.previousPage(),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:r("table.pagination.previousPage")}),e.jsx(Uc,{className:"h-4 w-4"})]}),e.jsxs(F,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.nextPage(),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:r("table.pagination.nextPage")}),e.jsx(qr,{className:"h-4 w-4"})]}),e.jsxs(F,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(s.getPageCount()-1),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:r("table.pagination.lastPage")}),e.jsx(Kc,{className:"h-4 w-4"})]})]})]})]})}function ts({table:s,toolbar:n,draggable:t=!1,onDragStart:r,onDragEnd:a,onDragOver:i,onDragLeave:l,onDrop:d,showPagination:x=!0,isLoading:m=!1}){const{t:o}=M("common"),c=u.useRef(null),f=s.getAllColumns().filter(T=>T.getIsPinned()==="left"),D=s.getAllColumns().filter(T=>T.getIsPinned()==="right"),S=T=>f.slice(0,T).reduce((w,E)=>w+(E.getSize()??0),0),C=T=>D.slice(T+1).reduce((w,E)=>w+(E.getSize()??0),0);return e.jsxs("div",{className:"space-y-4",children:[typeof n=="function"?n(s):n,e.jsx("div",{ref:c,className:"relative overflow-auto rounded-md border bg-card",children:e.jsx("div",{className:"overflow-auto",children:e.jsxs($n,{children:[e.jsx(An,{children:s.getHeaderGroups().map(T=>e.jsx(Xs,{className:"hover:bg-transparent",children:T.headers.map((w,E)=>{const _=w.column.getIsPinned()==="left",g=w.column.getIsPinned()==="right",p=_?S(f.indexOf(w.column)):void 0,V=g?C(D.indexOf(w.column)):void 0;return e.jsx(Hn,{colSpan:w.colSpan,style:{width:w.getSize(),..._&&{left:p},...g&&{right:V}},className:N("h-11 bg-card px-4 text-muted-foreground",(_||g)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",_&&"before:right-0",g&&"before:left-0"]),children:w.isPlaceholder?null:Ca(w.column.columnDef.header,w.getContext())},w.id)})},T.id))}),e.jsx(qn,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((T,w)=>e.jsx(Xs,{"data-state":T.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:t,onDragStart:E=>r?.(E,w),onDragEnd:a,onDragOver:i,onDragLeave:l,onDrop:E=>d?.(E,w),children:T.getVisibleCells().map((E,_)=>{const g=E.column.getIsPinned()==="left",p=E.column.getIsPinned()==="right",V=g?S(f.indexOf(E.column)):void 0,R=p?C(D.indexOf(E.column)):void 0;return e.jsx(Pt,{style:{width:E.column.getSize(),...g&&{left:V},...p&&{right:R}},className:N("bg-card",(g||p)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",g&&"before:right-0",p&&"before:left-0"]),children:Ca(E.column.columnDef.cell,E.getContext())},E.id)})},T.id)):e.jsx(Xs,{children:e.jsx(Pt,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:o("table.noData")})})})]})})}),x&&e.jsx(di,{table:s})]})}const ya=s=>{if(!s)return"";let n;if(typeof s=="string"){if(n=parseInt(s),isNaN(n))return s}else n=s;return(n.toString().length===10?new Date(n*1e3):new Date(n)).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})},Ht=yl(),Ut=yl();function ga({data:s,isLoading:n,searchKeyword:t,selectedLevel:r,total:a,currentPage:i,pageSize:l,onViewDetail:d,onPageChange:x,onPageSizeChange:m}){const{t:o}=M(),c=S=>{switch(S.toLowerCase()){case"info":return e.jsx(Gt,{className:"h-4 w-4 text-blue-500"});case"warning":return e.jsx(Wt,{className:"h-4 w-4 text-yellow-500"});case"error":return e.jsx(yn,{className:"h-4 w-4 text-red-500"});default:return e.jsx(Gt,{className:"h-4 w-4 text-slate-500"})}},f=u.useMemo(()=>[Ht.accessor("level",{id:"level",header:()=>o("dashboard:systemLog.level"),size:80,cell:({getValue:S,row:C})=>{const T=S();return e.jsxs("div",{className:"flex items-center gap-1",children:[c(T),e.jsx("span",{className:N(T.toLowerCase()==="error"&&"text-red-600",T.toLowerCase()==="warning"&&"text-yellow-600",T.toLowerCase()==="info"&&"text-blue-600"),children:T})]})}}),Ht.accessor("created_at",{id:"created_at",header:()=>o("dashboard:systemLog.time"),size:160,cell:({getValue:S})=>ya(S())}),Ht.accessor(S=>S.title||S.message||"",{id:"title",header:()=>o("dashboard:systemLog.logTitle"),cell:({getValue:S})=>e.jsx("span",{className:"inline-block max-w-[300px] truncate",children:S()})}),Ht.accessor("method",{id:"method",header:()=>o("dashboard:systemLog.method"),size:100,cell:({getValue:S})=>{const C=S();return C?e.jsx(q,{variant:"outline",className:N(C==="GET"&&"border-blue-200 bg-blue-50 text-blue-700",C==="POST"&&"border-green-200 bg-green-50 text-green-700",C==="PUT"&&"border-amber-200 bg-amber-50 text-amber-700",C==="DELETE"&&"border-red-200 bg-red-50 text-red-700"),children:C}):null}}),Ht.display({id:"actions",header:()=>o("dashboard:systemLog.action"),size:80,cell:({row:S})=>e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>d(S.original),"aria-label":o("dashboard:systemLog.viewDetail"),children:e.jsx(vn,{className:"h-4 w-4"})})})],[o,d]),D=Be({data:s,columns:f,getCoreRowModel:Ge(),getPaginationRowModel:Ze(),pageCount:Math.ceil(a/l),manualPagination:!0,state:{pagination:u.useMemo(()=>({pageIndex:i-1,pageSize:l}),[i,l])},onPaginationChange:S=>{let C,T;if(typeof S=="function"){const w=S({pageIndex:i-1,pageSize:l});C=w.pageIndex,T=w.pageSize}else C=S.pageIndex,T=S.pageSize;T!==l?m(T):x(C+1)}});return e.jsxs("div",{className:"overflow-x-auto",children:[e.jsx(ts,{table:D,showPagination:!0,isLoading:n}),(t||r&&r!=="all")&&e.jsx("div",{className:"text-center text-sm text-muted-foreground",children:t&&r&&r!=="all"?o("dashboard:systemLog.filter.searchAndLevel",{keyword:t,level:r,count:a}):t?o("dashboard:systemLog.filter.searchOnly",{keyword:t,count:a}):o("dashboard:systemLog.filter.levelOnly",{level:r,count:a})})]})}function Gm(){const{t:s}=M(),[n,t]=u.useState(0),[r,a]=u.useState(!1),[i,l]=u.useState(1),[d]=u.useState(10),[x,m]=u.useState(null),[o,c]=u.useState(!1),[f,D]=u.useState(!1),[S,C]=u.useState(1),[T,w]=u.useState(10),[E,_]=u.useState(null),[g,p]=u.useState(!1),[V,R]=u.useState(""),[L,K]=u.useState(""),[Z,se]=u.useState("all"),[ae,H]=u.useState(!1),[ee,je]=u.useState(0),[ds,Me]=u.useState("all"),[le,Ts]=u.useState(1e3),[Ns,Ws]=u.useState(!1),[Us,Ys]=u.useState(null),[yt,U]=u.useState(!1);u.useEffect(()=>{const B=setTimeout(()=>{K(V),V!==L&&C(1)},500);return()=>clearTimeout(B)},[V]);const{data:te,isLoading:ne,refetch:ve,isRefetching:Ye}=re({queryKey:["systemStatus",n],queryFn:async()=>(await ye.getSystemStatus()).data,refetchInterval:3e4}),{data:_e,isLoading:Ki,refetch:lp,isRefetching:Yn}=re({queryKey:["queueStats",n],queryFn:async()=>(await ye.getQueueStats()).data,refetchInterval:3e4}),{data:Jn,isLoading:Bi,refetch:Gi}=re({queryKey:["failedJobs",i,d],queryFn:async()=>{const B=await ye.getHorizonFailedJobs({current:i,page_size:d});return{data:B.data,total:B.total||0}},enabled:r}),{data:Qn,isLoading:ra,refetch:Wi}=re({queryKey:["systemLogs",S,T,Z,L],queryFn:async()=>{const B={current:S,page_size:T};Z&&Z!=="all"&&(B.level=Z),L.trim()&&(B.keyword=L.trim());const Vs=await ye.getSystemLog(B);return{data:Vs.data,total:Vs.total||0}},enabled:f}),Xn=Jn?.data||[],Yi=Jn?.total||0,la=Qn?.data||[],ia=Qn?.total||0,Ji=u.useMemo(()=>[Ut.display({id:"failed_at",header:()=>s("dashboard:queue.details.time"),cell:({row:B})=>ya(B.original.failed_at)}),Ut.display({id:"queue",header:()=>s("dashboard:queue.details.queue"),cell:({row:B})=>B.original.queue}),Ut.display({id:"name",header:()=>s("dashboard:queue.details.name"),cell:({row:B})=>e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("span",{className:"inline-block max-w-[150px] truncate",children:B.original.name})}),e.jsx(de,{children:e.jsx("span",{children:B.original.name})})]})})}),Ut.display({id:"exception",header:()=>s("dashboard:queue.details.exception"),cell:({row:B})=>e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("span",{className:"inline-block max-w-[200px] truncate",children:B.original.exception.split(` -`)[0]})}),e.jsx(de,{className:"max-w-[300px] whitespace-pre-wrap",children:e.jsx("span",{children:B.original.exception})})]})})}),Ut.display({id:"actions",header:()=>s("dashboard:queue.details.action"),size:80,cell:({row:B})=>e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>eo(B.original),"aria-label":s("dashboard:queue.details.viewDetail"),children:e.jsx(vn,{className:"h-4 w-4"})})})],[s]),Zn=Be({data:Xn,columns:Ji,getCoreRowModel:Ge(),getPaginationRowModel:Ze(),pageCount:Math.ceil(Yi/d),manualPagination:!0,state:{pagination:{pageIndex:i-1,pageSize:d}},onPaginationChange:B=>{if(typeof B=="function"){const Vs=B({pageIndex:i-1,pageSize:d});er(Vs.pageIndex+1)}else er(B.pageIndex+1)}}),Qi=()=>{t(B=>B+1)},er=B=>{l(B)},oa=B=>{C(B)},ca=B=>{w(B),C(1)},Xi=B=>{se(B),C(1)},Zi=()=>{R(""),K(""),se("all"),C(1)},da=B=>{_(B),p(!0)},eo=B=>{m(B),c(!0)},so=async()=>{try{const B=await ye.getLogClearStats({days:ee,level:ds==="all"?void 0:ds});Ys(B.data),U(!0)}catch(B){console.error("Failed to get clear stats:",B),z.error(s("dashboard:systemLog.getStatsFailed"))}},to=async()=>{Ws(!0);try{const{data:B}=await ye.clearSystemLog({days:ee,level:ds==="all"?void 0:ds,limit:le});B&&(z.success(s("dashboard:systemLog.clearSuccess",{count:B.cleared_count}),{duration:3e3}),H(!1),U(!1),Ys(null),ve())}catch(B){console.error("Failed to clear logs:",B),z.error(s("dashboard:systemLog.clearLogsFailed"))}finally{Ws(!1)}};if(ne||Ki)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(Sa,{className:"h-6 w-6 animate-spin"})});const ao=B=>B?e.jsx(_l,{className:"h-5 w-5 text-green-500"}):e.jsx(Nl,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(ke,{children:[e.jsxs(Fe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Ve,{className:"flex items-center gap-2",children:[e.jsx(Bc,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Zs,{children:s("dashboard:queue.status.description")})]}),e.jsx(G,{variant:"outline",size:"icon",onClick:Qi,disabled:Ye||Yn,children:e.jsx(nn,{className:N("h-4 w-4",(Ye||Yn)&&"animate-spin")})})]}),e.jsx(Pe,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[ao(_e?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(q,{variant:_e?.status?"secondary":"destructive",children:_e?.status?s("dashboard:queue.status.normal"):s("dashboard:queue.status.abnormal")})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.status.waitTime",{seconds:_e?.wait?.default||0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.recentJobs")}),e.jsx("p",{className:"text-2xl font-bold",children:_e?.recentJobs||0}),e.jsx(ba,{value:(_e?.recentJobs||0)/(_e?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(de,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:_e?.periods?.recentJobs||0})})})]})}),e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.jobsPerMinute")}),e.jsx("p",{className:"text-2xl font-bold",children:_e?.jobsPerMinute||0}),e.jsx(ba,{value:(_e?.jobsPerMinute||0)/(_e?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(de,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:_e?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(ke,{children:[e.jsxs(Fe,{children:[e.jsxs(Ve,{className:"flex items-center gap-2",children:[e.jsx(Gc,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Zs,{children:s("dashboard:queue.details.description")})]}),e.jsx(Pe,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.failedJobs7Days")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"cursor-pointer text-2xl font-bold text-destructive hover:underline",title:s("dashboard:queue.details.viewFailedJobs"),onClick:()=>a(!0),style:{userSelect:"none"},children:_e?.failedJobs||0}),e.jsx(vn,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-destructive",onClick:()=>a(!0),"aria-label":s("dashboard:queue.details.viewFailedJobs")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("dashboard:queue.details.retentionPeriod",{hours:_e?.periods?.failedJobs||0})})]}),e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.longestRunningQueue")}),e.jsxs("p",{className:"text-2xl font-bold",children:[_e?.queueWithMaxRuntime?.runtime||0,"s"]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:_e?.queueWithMaxRuntime?.name||"N/A"})]})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.activeProcesses")}),e.jsxs("span",{className:"font-medium",children:[_e?.processes||0," /"," ",(_e?.processes||0)+(_e?.pausedMasters||0)]})]}),e.jsx(ba,{value:(_e?.processes||0)/((_e?.processes||0)+(_e?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]}),e.jsxs(ke,{children:[e.jsxs(Fe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Ve,{className:"flex items-center gap-2",children:[e.jsx(bn,{className:"h-5 w-5"}),s("dashboard:systemLog.title")]}),e.jsx(Zs,{children:s("dashboard:systemLog.description")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(G,{variant:"outline",onClick:()=>D(!0),children:s("dashboard:systemLog.viewAll")}),e.jsxs(G,{variant:"outline",onClick:()=>H(!0),className:"text-destructive hover:text-destructive",children:[e.jsx(us,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.clearLogs")]})]})]}),e.jsx(Pe,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-900 dark:bg-blue-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gt,{className:"h-5 w-5 text-blue-500"}),e.jsx("p",{className:"font-medium text-blue-700 dark:text-blue-300",children:s("dashboard:systemLog.tabs.info")})]}),e.jsx("p",{className:"text-2xl font-bold text-blue-700 dark:text-blue-300",children:te?.logs?.info||0})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-900 dark:bg-yellow-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wt,{className:"h-5 w-5 text-yellow-500"}),e.jsx("p",{className:"font-medium text-yellow-700 dark:text-yellow-300",children:s("dashboard:systemLog.tabs.warning")})]}),e.jsx("p",{className:"text-2xl font-bold text-yellow-700 dark:text-yellow-300",children:te?.logs?.warning||0})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-900 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(yn,{className:"h-5 w-5 text-red-500"}),e.jsx("p",{className:"font-medium text-red-700 dark:text-red-300",children:s("dashboard:systemLog.tabs.error")})]}),e.jsx("p",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:te?.logs?.error||0})]})]}),te?.logs&&te.logs.total>0&&e.jsxs("div",{className:"mt-3 text-center text-sm text-muted-foreground",children:[s("dashboard:systemLog.totalLogs"),": ",te.logs.total]})]})})]}),e.jsx(me,{open:r,onOpenChange:a,children:e.jsxs(ce,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(pe,{children:e.jsx(ue,{children:s("dashboard:queue.details.failedJobsDetailTitle")})}),e.jsxs("div",{className:"overflow-x-auto",children:[e.jsx(ts,{table:Zn,showPagination:!1,isLoading:Bi}),e.jsx(di,{table:Zn}),Xn.length===0&&e.jsx("div",{className:"py-8 text-center text-muted-foreground",children:s("dashboard:queue.details.noFailedJobs")})]}),e.jsxs(Ie,{children:[e.jsxs(G,{variant:"outline",onClick:()=>Gi(),children:[e.jsx(nn,{className:"mr-2 h-4 w-4"}),s("dashboard:common.refresh")]}),e.jsx(et,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common:close")})})]})]})}),e.jsx(me,{open:o,onOpenChange:c,children:e.jsxs(ce,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(pe,{children:e.jsx(ue,{children:s("dashboard:queue.details.jobDetailTitle")})}),x&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.id")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:x.id})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.time")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:x.failed_at})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.queue")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:x.queue})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.connection")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:x.connection})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.name")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:x.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.exception")}),e.jsx("div",{className:"max-h-[200px] overflow-y-auto rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-red-700 dark:text-red-300",children:x.exception})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.payload")}),e.jsx("div",{className:"max-h-[200px] overflow-y-auto rounded-md bg-muted/50 p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs",children:(()=>{try{return JSON.stringify(JSON.parse(x.payload),null,2)}catch{return x.payload}})()})})]})]}),e.jsx(Ie,{children:e.jsx(G,{variant:"outline",onClick:()=>c(!1),children:s("common:close")})})]})}),e.jsx(me,{open:f,onOpenChange:D,children:e.jsxs(ce,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(pe,{children:e.jsx(ue,{children:s("dashboard:systemLog.title")})}),e.jsxs(ft,{value:Z,onValueChange:Xi,className:"w-full overflow-x-auto",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-2 p-1 md:flex-row md:items-center md:justify-between",children:[e.jsxs(lt,{className:"grid w-auto grid-cols-4",children:[e.jsxs(Ke,{value:"all",className:"flex items-center gap-2",children:[e.jsx(bn,{className:"h-4 w-4"}),s("dashboard:systemLog.tabs.all")]}),e.jsxs(Ke,{value:"info",className:"flex items-center gap-2",children:[e.jsx(Gt,{className:"h-4 w-4 text-blue-500"}),s("dashboard:systemLog.tabs.info")]}),e.jsxs(Ke,{value:"warning",className:"flex items-center gap-2",children:[e.jsx(Wt,{className:"h-4 w-4 text-yellow-500"}),s("dashboard:systemLog.tabs.warning")]}),e.jsxs(Ke,{value:"error",className:"flex items-center gap-2",children:[e.jsx(yn,{className:"h-4 w-4 text-red-500"}),s("dashboard:systemLog.tabs.error")]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ln,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(k,{placeholder:s("dashboard:systemLog.search"),value:V,onChange:B=>R(B.target.value),className:"w-full md:w-64"})]})]}),e.jsx(bs,{value:"all",className:"mt-0",children:e.jsx(ga,{data:la,isLoading:ra,searchKeyword:L,selectedLevel:Z,total:ia,currentPage:S,pageSize:T,onViewDetail:da,onPageChange:oa,onPageSizeChange:ca})}),e.jsx(bs,{value:"info",className:"mt-0 overflow-x-auto",children:e.jsx(ga,{data:la,isLoading:ra,searchKeyword:L,selectedLevel:Z,total:ia,currentPage:S,pageSize:T,onViewDetail:da,onPageChange:oa,onPageSizeChange:ca})}),e.jsx(bs,{value:"warning",className:"mt-0",children:e.jsx(ga,{data:la,isLoading:ra,searchKeyword:L,selectedLevel:Z,total:ia,currentPage:S,pageSize:T,onViewDetail:da,onPageChange:oa,onPageSizeChange:ca})}),e.jsx(bs,{value:"error",className:"mt-0",children:e.jsx(ga,{data:la,isLoading:ra,searchKeyword:L,selectedLevel:Z,total:ia,currentPage:S,pageSize:T,onViewDetail:da,onPageChange:oa,onPageSizeChange:ca})})]}),e.jsxs(Ie,{children:[e.jsxs(G,{variant:"outline",onClick:()=>Wi(),children:[e.jsx(nn,{className:"mr-2 h-4 w-4"}),s("dashboard:common.refresh")]}),e.jsx(G,{variant:"outline",onClick:Zi,children:s("dashboard:systemLog.filter.reset")}),e.jsx(et,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common:close")})})]})]})}),e.jsx(me,{open:g,onOpenChange:p,children:e.jsxs(ce,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(pe,{children:e.jsx(ue,{children:s("dashboard:systemLog.detailTitle")})}),E&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.level")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx("p",{className:"font-medium",children:E.level})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.time")}),e.jsx("p",{children:ya(E.created_at)||ya(E.updated_at)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.logTitle")}),e.jsx("div",{className:"whitespace-pre-wrap rounded-md bg-muted/50 p-3",children:E.title||E.message||""})]}),(E.host||E.ip)&&e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[E.host&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.host")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:E.host})]}),E.ip&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.ip")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:E.ip})]})]}),E.uri&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.uri")}),e.jsx("div",{className:"overflow-x-auto rounded-md bg-muted/50 p-3",children:e.jsx("code",{className:"text-sm",children:E.uri})})]}),E.method&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.method")}),e.jsx("div",{children:e.jsx(q,{variant:"outline",className:"text-base font-medium",children:E.method})})]}),E.data&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.requestData")}),e.jsx("div",{className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/50 p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs",children:(()=>{try{return JSON.stringify(JSON.parse(E.data),null,2)}catch{return E.data}})()})})]}),E.context&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.exception")}),e.jsx("div",{className:"max-h-[250px] overflow-y-auto rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs text-red-700 dark:text-red-300",children:(()=>{try{const B=JSON.parse(E.context);if(B.exception){const Vs=B.exception,_t=Vs["\0*\0message"]||"",no=Vs["\0*\0file"]||"",ro=Vs["\0*\0line"]||"";return`${_t} +import{r as m,j as e,t as io,c as oo,I as ea,a as jt,S as Tn,u as Bs,b as co,d as Dn,R as Dr,e as Fr,f as mo,F as uo,C as xo,L as Pr,T as Lr,g as Rr,h as ho,i as go,k as po,l as fo,m as $,n as Er,o as Vr,z as h,p as O,q as Ne,s as ke,v as ne,w as $s,x as Le,y as Ir,A as jo,O as Fn,B as vo,D as bo,E as yo,G as _o,H as No,J as wo,Q as Co,K as So,M as Mr,N as ko,P as To,U as Do,V as Fo,W as Po,X as Lo,Y as Or,Z as zr,_ as Ia,$ as Ma,a0 as Pn,a1 as is,a2 as Oa,a3 as za,a4 as $r,a5 as Ar,a6 as qr,a7 as Ur,a8 as Hr,a9 as Ro,aa as Kr,ab as Br,ac as Gr,ad as Wr,ae as vt,af as Yr,ag as Eo,ah as Jr,ai as Qr,aj as Vo,ak as Io,al as Mo,am as Oo,an as zo,ao as $o,ap as Ao,aq as qo,ar as Uo,as as Ho,at as Xr,au as Ko,av as Bo,aw as st,ax as Zr,ay as Go,az as Wo,aA as el,aB as Ln,aC as Yo,aD as Jo,aE as tr,aF as Qo,aG as sl,aH as Xo,aI as tl,aJ as Zo,aK as ec,aL as sc,aM as tc,aN as ac,aO as nc,aP as rc,aQ as al,aR as lc,aS as ic,aT as oc,aU as hs,aV as cc,aW as Rn,aX as dc,aY as mc,aZ as nl,a_ as rl,a$ as ll,b0 as uc,b1 as xc,b2 as hc,b3 as il,b4 as gc,b5 as En,b6 as ol,b7 as pc,b8 as cl,b9 as fc,ba as dl,bb as jc,bc as ml,bd as ul,be as vc,bf as bc,bg as xl,bh as yc,bi as hl,bj as _c,bk as gl,bl as pl,bm as fl,bn as Nc,bo as jl,bp as wc,bq as Cc,br as Os,bs as Pe,bt as Cs,bu as Sc,bv as kc,bw as Tc,bx as Dc,by as Fc,bz as Pc,bA as ar,bB as nr,bC as Lc,bD as Rc,bE as Vn,bF as Ec,bG as Vc,bH as Ca,bI as Lt,bJ as sa,bK as Ic,bL as vl,bM as Mc,bN as Oc,bO as bl,bP as zc,bQ as $c,bR as rr,bS as jn,bT as vn,bU as Ac,bV as qc,bW as yl,bX as Uc,bY as Hc,bZ as Kc,b_ as Bc,b$ as Sa,c0 as bn,c1 as We,c2 as ka,c3 as Gc,c4 as rn,c5 as Wc,c6 as yn,c7 as ms,c8 as Gt,c9 as Wt,ca as _n,cb as _l,cc as Ye,cd as ss,ce as Nl,cf as wl,cg as Yc,ch as Jc,ci as Qc,cj as Xc,ck as Zc,cl as Cl,cm as ed,cn as sd,co as td,cp as Ke,cq as lr,cr as ad,cs as Sl,ct as kl,cu as Tl,cv as Dl,cw as Fl,cx as Pl,cy as nd,cz as rd,cA as ld,cB as $a,cC as nt,cD as gs,cE as ps,cF as id,cG as od,cH as cd,cI as dd,cJ as md,cK as ud,cL as Ta,cM as xd,cN as hd,cO as Nn,cP as In,cQ as Mn,cR as gd,cS as Ps,cT as Ls,cU as Aa,cV as pd,cW as fd,cX as ba,cY as Da,cZ as jd,c_ as ir,c$ as Ll,d0 as or,d1 as Fa,d2 as vd,d3 as On,d4 as bd,d5 as yd,d6 as _d,d7 as Rl,d8 as Nd,d9 as wd,da as El,db as wn,dc as Vl,dd as Cd,de as Cn,df as Il,dg as Sd,dh as kd,di as Td,dj as Ml,dk as Dd,dl as Ol,dm as Yt,dn as zn,dp as Fd,dq as cr,dr as zl,ds as Pd,dt as dr,du as Ld,dv as Rd}from"./vendor.js";import"./index.js";var mp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function up(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Ed(s){if(s.__esModule)return s;var n=s.default;if(typeof n=="function"){var t=function r(){return this instanceof r?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var a=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return s[r]}})}),t}const Vd={theme:"system",setTheme:()=>null},$l=m.createContext(Vd);function Id({children:s,defaultTheme:n="system",storageKey:t="vite-ui-theme",...r}){const[a,o]=m.useState(()=>localStorage.getItem(t)||n);m.useEffect(()=>{const d=window.document.documentElement;if(d.classList.remove("light","dark"),a==="system"){const x=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";d.classList.add(x);return}d.classList.add(a)},[a]);const l={theme:a,setTheme:d=>{localStorage.setItem(t,d),o(d)}};return e.jsx($l.Provider,{...r,value:l,children:s})}const Md=()=>{const s=m.useContext($l);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s},Od=function(){const n=typeof document<"u"&&document.createElement("link").relList;return n&&n.supports&&n.supports("modulepreload")?"modulepreload":"preload"}(),zd=function(s,n){return new URL(s,n).href},mr={},_e=function(n,t,r){let a=Promise.resolve();if(t&&t.length>0){const l=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),x=d?.nonce||d?.getAttribute("nonce");a=Promise.allSettled(t.map(u=>{if(u=zd(u,r),u in mr)return;mr[u]=!0;const i=u.endsWith(".css"),c=i?'[rel="stylesheet"]':"";if(!!r)for(let T=l.length-1;T>=0;T--){const C=l[T];if(C.href===u&&(!i||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${c}`))return;const P=document.createElement("link");if(P.rel=i?"stylesheet":Od,i||(P.as="script"),P.crossOrigin="",P.href=u,x&&P.setAttribute("nonce",x),document.head.appendChild(P),i)return new Promise((T,C)=>{P.addEventListener("load",T),P.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return a.then(l=>{for(const d of l||[])d.status==="rejected"&&o(d.reason);return n().catch(o)})};function _(...s){return io(oo(s))}const It=jt("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),L=m.forwardRef(({className:s,variant:n,size:t,asChild:r=!1,children:a,disabled:o,loading:l=!1,leftSection:d,rightSection:x,...u},i)=>{const c=r?Tn:"button";return e.jsxs(c,{className:_(It({variant:n,size:t,className:s})),disabled:l||o,ref:i,...u,children:[(d&&l||!d&&!x&&l)&&e.jsx(ea,{className:"mr-2 h-4 w-4 animate-spin"}),!l&&d&&e.jsx("div",{className:"mr-2",children:d}),a,!l&&x&&e.jsx("div",{className:"ml-2",children:x}),x&&l&&e.jsx(ea,{className:"ml-2 h-4 w-4 animate-spin"})]})});L.displayName="Button";function Nt({className:s,minimal:n=!1}){const t=Bs(),r=co(),a=r?.message||r?.statusText||"Unknown error occurred";return e.jsx("div",{className:_("h-svh w-full",s),children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[!n&&e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"500"}),e.jsxs("span",{className:"font-medium",children:["Oops! Something went wrong ",":')"]}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["We apologize for the inconvenience. ",e.jsx("br",{}),a]}),!n&&e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(L,{variant:"outline",onClick:()=>t(-1),children:"Go Back"}),e.jsx(L,{onClick:()=>t("/"),children:"Back to Home"})]})]})})}function ur(){const s=Bs();return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"404"}),e.jsx("span",{className:"font-medium",children:"Oops! Page Not Found!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["It seems like the page you're looking for ",e.jsx("br",{}),"does not exist or might have been removed."]}),e.jsxs("div",{className:"mt-6 flex gap-4",children:[e.jsx(L,{variant:"outline",onClick:()=>s(-1),children:"Go Back"}),e.jsx(L,{onClick:()=>s("/"),children:"Back to Home"})]})]})})}function $d(){return e.jsx("div",{className:"h-svh",children:e.jsxs("div",{className:"m-auto flex h-full w-full flex-col items-center justify-center gap-2",children:[e.jsx("h1",{className:"text-[7rem] font-bold leading-tight",children:"503"}),e.jsx("span",{className:"font-medium",children:"Website is under maintenance!"}),e.jsxs("p",{className:"text-center text-muted-foreground",children:["The site is not available at the moment. ",e.jsx("br",{}),"We'll be back online shortly."]}),e.jsx("div",{className:"mt-6 flex gap-4",children:e.jsx(L,{variant:"outline",children:"Learn more"})})]})})}function Ad(s){return typeof s>"u"}function qd(s){return s===null}function Ud(s){return qd(s)||Ad(s)}class Hd{storage;prefixKey;constructor(n){this.storage=n.storage,this.prefixKey=n.prefixKey}getKey(n){return`${this.prefixKey}${n}`.toUpperCase()}set(n,t,r=null){const a=JSON.stringify({value:t,time:Date.now(),expire:r!==null?new Date().getTime()+r*1e3:null});this.storage.setItem(this.getKey(n),a)}get(n,t=null){const r=this.storage.getItem(this.getKey(n));if(!r)return{value:t,time:0};try{const a=JSON.parse(r),{value:o,time:l,expire:d}=a;return Ud(d)||d>new Date().getTime()?{value:o,time:l}:(this.remove(n),{value:t,time:0})}catch{return this.remove(n),{value:t,time:0}}}remove(n){this.storage.removeItem(this.getKey(n))}clear(){this.storage.clear()}}function Al({prefixKey:s="",storage:n=sessionStorage}){return new Hd({prefixKey:s,storage:n})}const ql="Xboard_",Kd=function(s={}){return Al({prefixKey:s.prefixKey||"",storage:localStorage})},Bd=function(s={}){return Al({prefixKey:s.prefixKey||"",storage:sessionStorage})},$n=Kd({prefixKey:ql});Bd({prefixKey:ql});const Ul="access_token";function ta(){return $n.get(Ul)}function Hl(){$n.remove(Ul)}const xr=["/sign-in","/sign-in-2","/sign-up","/forgot-password","/otp"];function Gd({children:s}){const n=Bs(),t=Dn(),r=ta();return m.useEffect(()=>{if(!r.value&&!xr.includes(t.pathname)){const a=encodeURIComponent(t.pathname+t.search);n(`/sign-in?redirect=${a}`)}},[r.value,t.pathname,t.search,n]),xr.includes(t.pathname)||r.value?e.jsx(e.Fragment,{children:s}):null}const Re=m.forwardRef(({className:s,orientation:n="horizontal",decorative:t=!0,...r},a)=>e.jsx(Dr,{ref:a,decorative:t,orientation:n,className:_("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...r}));Re.displayName=Dr.displayName;const Wd=jt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Qe=m.forwardRef(({className:s,...n},t)=>e.jsx(Fr,{ref:t,className:_(Wd(),s),...n}));Qe.displayName=Fr.displayName;const Te=uo,Kl=m.createContext({}),j=({...s})=>e.jsx(Kl.Provider,{value:{name:s.name},children:e.jsx(xo,{...s})}),qa=()=>{const s=m.useContext(Kl),n=m.useContext(Bl),{getFieldState:t,formState:r}=mo(),a=t(s.name,r);if(!s)throw new Error("useFormField should be used within ");const{id:o}=n;return{id:o,name:s.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...a}},Bl=m.createContext({}),f=m.forwardRef(({className:s,...n},t)=>{const r=m.useId();return e.jsx(Bl.Provider,{value:{id:r},children:e.jsx("div",{ref:t,className:_("space-y-2",s),...n})})});f.displayName="FormItem";const v=m.forwardRef(({className:s,...n},t)=>{const{error:r,formItemId:a}=qa();return e.jsx(Qe,{ref:t,className:_(r&&"text-destructive",s),htmlFor:a,...n})});v.displayName="FormLabel";const b=m.forwardRef(({...s},n)=>{const{error:t,formItemId:r,formDescriptionId:a,formMessageId:o}=qa();return e.jsx(Tn,{ref:n,id:r,"aria-describedby":t?`${a} ${o}`:`${a}`,"aria-invalid":!!t,...s})});b.displayName="FormControl";const A=m.forwardRef(({className:s,...n},t)=>{const{formDescriptionId:r}=qa();return e.jsx("p",{ref:t,id:r,className:_("text-[0.8rem] text-muted-foreground",s),...n})});A.displayName="FormDescription";const R=m.forwardRef(({className:s,children:n,...t},r)=>{const{error:a,formMessageId:o}=qa(),l=a?String(a?.message):n;return l?e.jsx("p",{ref:r,id:o,className:_("text-[0.8rem] font-medium text-destructive",s),...t,children:l}):null});R.displayName="FormMessage";const bt=ho,rt=m.forwardRef(({className:s,...n},t)=>e.jsx(Pr,{ref:t,className:_("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",s),...n}));rt.displayName=Pr.displayName;const Be=m.forwardRef(({className:s,...n},t)=>e.jsx(Lr,{ref:t,className:_("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",s),...n}));Be.displayName=Lr.displayName;const bs=m.forwardRef(({className:s,...n},t)=>e.jsx(Rr,{ref:t,className:_("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...n}));bs.displayName=Rr.displayName;function ie(s=void 0,n="YYYY-MM-DD HH:mm:ss"){return s==null?"":(Math.floor(s).toString().length===10&&(s=s*1e3),go(s).format(n))}function Yd(s=void 0,n="YYYY-MM-DD"){return ie(s,n)}function hr(s){const n=typeof s=="string"?parseFloat(s):s;return isNaN(n)?"0.00":n.toFixed(2)}function Hs(s,n=!0){if(s==null)return n?"¥0.00":"0.00";const t=typeof s=="string"?parseFloat(s):s;if(isNaN(t))return n?"¥0.00":"0.00";const a=(t/100).toFixed(2).replace(/\.?0+$/,o=>o.includes(".")?".00":o);return n?`¥${a}`:a}function Rt(s){return new Promise(n=>{try{const t=document.createElement("button");t.style.position="fixed",t.style.left="-9999px",t.style.opacity="0",t.setAttribute("data-clipboard-text",s),document.body.appendChild(t);const r=new po(t);r.on("success",()=>{r.destroy(),document.body.removeChild(t),n(!0)}),r.on("error",a=>{console.error("Clipboard.js failed:",a),r.destroy(),document.body.removeChild(t),n(!1)}),t.click()}catch(t){console.error("copyToClipboard failed:",t),n(!1)}})}function ze(s){if(s==null||s<=0)return"0 B";const n=1024,t=["B","KB","MB","GB","TB"];let r=Math.floor(Math.log(s)/Math.log(n));return r<0?r=0:r>=t.length&&(r=t.length-1),`${parseFloat((s/Math.pow(n,r)).toFixed(2))} ${t[r]}`}const gr="i18nextLng";function Jd(){return console.log(localStorage.getItem(gr)),localStorage.getItem(gr)}function Gl(){Hl();const s=window.location.pathname,n=s&&!["/404","/sign-in"].includes(s),t=new URL(window.location.href),a=`${t.pathname.split("/")[1]?`/${t.pathname.split("/")[1]}`:""}#/sign-in`;window.location.href=a+(n?`?redirect=${s}`:"")}const Qd=["/passport/auth/login","/passport/auth/token2Login","/passport/auth/register","/guest/comm/config","/passport/comm/sendEmailVerify","/passport/auth/forget"];function Xd(){const s=window.settings?.base_url||"/";return s.endsWith("/")?s+"api/v2":s+"/api/v2"}const Dt=fo.create({baseURL:Xd(),timeout:12e3,headers:{"Content-Type":"application/json"}});Dt.interceptors.request.use(s=>{s.method?.toLowerCase()==="get"&&(s.params={...s.params,t:Date.now()});const n=ta();if(!Qd.includes(s.url?.split("?")[0]||"")){if(!n.value)return Gl(),Promise.reject({code:-1,message:"未登录"});s.headers.Authorization=n.value}return s.headers["Content-Language"]=Jd()||"zh-CN",s},s=>Promise.reject(s));Dt.interceptors.response.use(s=>s?.data||{code:-1,message:"未知错误"},s=>{const n=s.response?.status,t=s.response?.data?.message;return(n===401||n===403)&&Gl(),$.error(t||{401:"登录已过期",403:"没有权限",404:"资源或接口不存在"}[n]||"未知异常"),Promise.reject(s.response?.data||{data:null,code:-1,message:"未知错误"})});const I={get:(s,n)=>Dt.get(s,n),post:(s,n,t)=>Dt.post(s,n,t),put:(s,n,t)=>Dt.put(s,n,t),delete:(s,n)=>Dt.delete(s,n)},Zd="access_token";function em(s){$n.set(Zd,s)}const ut=window?.settings?.secure_path,Pa={getStats:()=>I.get(ut+"/monitor/api/stats"),getOverride:()=>I.get(ut+"/stat/getOverride"),getOrderStat:s=>I.get(ut+"/stat/getOrder",{params:s}),getStatsData:()=>I.get(ut+"/stat/getStats"),getNodeTrafficData:s=>I.get(ut+"/stat/getTrafficRank",{params:s}),getServerLastRank:()=>I.get(ut+"/stat/getServerLastRank"),getServerYesterdayRank:()=>I.get(ut+"/stat/getServerYesterdayRank")},Ot=window?.settings?.secure_path,Jt={getList:()=>I.get(Ot+"/theme/getThemes"),getConfig:s=>I.post(Ot+"/theme/getThemeConfig",{name:s}),updateConfig:(s,n)=>I.post(Ot+"/theme/saveThemeConfig",{name:s,config:n}),upload:s=>{const n=new FormData;return n.append("file",s),I.post(Ot+"/theme/upload",n,{headers:{"Content-Type":"multipart/form-data"}})},drop:s=>I.post(Ot+"/theme/delete",{name:s})},wt=window?.settings?.secure_path,gt={getList:()=>I.get(wt+"/server/manage/getNodes"),save:s=>I.post(wt+"/server/manage/save",s),drop:s=>I.post(wt+"/server/manage/drop",s),copy:s=>I.post(wt+"/server/manage/copy",s),update:s=>I.post(wt+"/server/manage/update",s),sort:s=>I.post(wt+"/server/manage/sort",s)},ln=window?.settings?.secure_path,yt={getList:()=>I.get(ln+"/server/group/fetch"),save:s=>I.post(ln+"/server/group/save",s),drop:s=>I.post(ln+"/server/group/drop",s)},on=window?.settings?.secure_path,Ua={getList:()=>I.get(on+"/server/route/fetch"),save:s=>I.post(on+"/server/route/save",s),drop:s=>I.post(on+"/server/route/drop",s)},xt=window?.settings?.secure_path,pt={getList:()=>I.get(xt+"/payment/fetch"),getMethodList:()=>I.get(xt+"/payment/getPaymentMethods"),getMethodForm:s=>I.post(xt+"/payment/getPaymentForm",s),save:s=>I.post(xt+"/payment/save",s),drop:s=>I.post(xt+"/payment/drop",s),updateStatus:s=>I.post(xt+"/payment/show",s),sort:s=>I.post(xt+"/payment/sort",s)},zt=window?.settings?.secure_path,aa={getList:()=>I.get(`${zt}/notice/fetch`),save:s=>I.post(`${zt}/notice/save`,s),drop:s=>I.post(`${zt}/notice/drop`,{id:s}),updateStatus:s=>I.post(`${zt}/notice/show`,{id:s}),sort:s=>I.post(`${zt}/notice/sort`,{ids:s})},Ct=window?.settings?.secure_path,Et={getList:()=>I.get(Ct+"/knowledge/fetch"),getInfo:s=>I.get(Ct+"/knowledge/fetch?id="+s),save:s=>I.post(Ct+"/knowledge/save",s),drop:s=>I.post(Ct+"/knowledge/drop",s),updateStatus:s=>I.post(Ct+"/knowledge/show",s),sort:s=>I.post(Ct+"/knowledge/sort",s)},$t=window?.settings?.secure_path,ys={getList:()=>I.get($t+"/plan/fetch"),save:s=>I.post($t+"/plan/save",s),update:s=>I.post($t+"/plan/update",s),drop:s=>I.post($t+"/plan/drop",s),sort:s=>I.post($t+"/plan/sort",{ids:s})},St=window?.settings?.secure_path,ht={getList:s=>I.post(St+"/order/fetch",s),getInfo:s=>I.post(St+"/order/detail",s),markPaid:s=>I.post(St+"/order/paid",s),makeCancel:s=>I.post(St+"/order/cancel",s),update:s=>I.post(St+"/order/update",s),assign:s=>I.post(St+"/order/assign",s)},Ts=window?.settings?.secure_path,Fs={getTemplates:s=>I.post(Ts+"/gift-card/templates",s),createTemplate:s=>I.post(Ts+"/gift-card/create-template",s),updateTemplate:s=>I.post(Ts+"/gift-card/update-template",s),deleteTemplate:s=>I.post(Ts+"/gift-card/delete-template",s),getCodes:s=>I.post(Ts+"/gift-card/codes",s),generateCodes:s=>s.download_csv?I.post(Ts+"/gift-card/generate-codes",s,{responseType:"blob"}):I.post(Ts+"/gift-card/generate-codes",s),toggleCode:s=>I.post(Ts+"/gift-card/toggle-code",s),exportCodes:s=>I.get(Ts+`/gift-card/export-codes?batch_id=${s}`,{responseType:"blob"}),getUsages:s=>I.post(Ts+"/gift-card/usages",s),getStatistics:s=>I.post(Ts+"/gift-card/statistics",s),getTypes:()=>I.get(Ts+"/gift-card/types")},ma=window?.settings?.secure_path,La={getList:s=>I.post(ma+"/coupon/fetch",s),save:s=>I.post(ma+"/coupon/generate",s),drop:s=>I.post(ma+"/coupon/drop",s),update:s=>I.post(ma+"/coupon/update",s)},js=window?.settings?.secure_path,qs={getList:s=>I.post(`${js}/user/fetch`,s),update:s=>I.post(`${js}/user/update`,s),resetSecret:s=>I.post(`${js}/user/resetSecret`,{id:s}),generate:s=>s.download_csv?I.post(`${js}/user/generate`,s,{responseType:"blob"}):I.post(`${js}/user/generate`,s),getStats:s=>I.post(`${js}/stat/getStatUser`,s),destroy:s=>I.post(`${js}/user/destroy`,{id:s}),sendMail:s=>I.post(`${js}/user/sendMail`,s),dumpCSV:s=>I.post(`${js}/user/dumpCSV`,s,{responseType:"blob"}),batchBan:s=>I.post(`${js}/user/ban`,s)},na={getLogs:s=>I.get(`${js}/traffic-reset/logs`,{params:s}),getStats:s=>I.get(`${js}/traffic-reset/stats`,{params:s}),resetUser:s=>I.post(`${js}/traffic-reset/reset-user`,s),getUserHistory:(s,n)=>I.get(`${js}/traffic-reset/user/${s}/history`,{params:n})},ua=window?.settings?.secure_path,Ft={getList:s=>I.post(ua+"/ticket/fetch",s),getInfo:s=>I.get(ua+"/ticket/fetch?id= "+s),reply:s=>I.post(ua+"/ticket/reply",s),close:s=>I.post(ua+"/ticket/close",{id:s})},rs=window?.settings?.secure_path,ve={getSettings:(s="")=>I.get(rs+"/config/fetch?key="+s),saveSettings:s=>I.post(rs+"/config/save",s),getEmailTemplate:()=>I.get(rs+"/config/getEmailTemplate"),sendTestMail:()=>I.post(rs+"/config/testSendMail"),setTelegramWebhook:()=>I.post(rs+"/config/setTelegramWebhook"),updateSystemConfig:s=>I.post(rs+"/config/save",s),getSystemStatus:()=>I.get(`${rs}/system/getSystemStatus`),getQueueStats:()=>I.get(`${rs}/system/getQueueStats`),getQueueWorkload:()=>I.get(`${rs}/system/getQueueWorkload`),getQueueMasters:()=>I.get(`${rs}/system/getQueueMasters`),getHorizonFailedJobs:s=>I.get(`${rs}/system/getHorizonFailedJobs`,{params:s}),getSystemLog:s=>I.get(`${rs}/system/getSystemLog`,{params:s}),getLogFiles:()=>I.get(`${rs}/log/files`),getLogContent:s=>I.get(`${rs}/log/fetch`,{params:s}),getLogClearStats:s=>I.get(`${rs}/system/getLogClearStats`,{params:s}),clearSystemLog:s=>I.post(`${rs}/system/clearSystemLog`,s)},Is=window?.settings?.secure_path,Ms={getPluginTypes:()=>I.get(`${Is}/plugin/types`),getPluginList:s=>{const n=s?{type:s}:{};return I.get(`${Is}/plugin/getPlugins`,{params:n})},uploadPlugin:s=>{const n=new FormData;return n.append("file",s),I.post(`${Is}/plugin/upload`,n,{headers:{"Content-Type":"multipart/form-data"}})},deletePlugin:s=>I.post(`${Is}/plugin/delete`,{code:s}),installPlugin:s=>I.post(`${Is}/plugin/install`,{code:s}),uninstallPlugin:s=>I.post(`${Is}/plugin/uninstall`,{code:s}),enablePlugin:s=>I.post(`${Is}/plugin/enable`,{code:s}),disablePlugin:s=>I.post(`${Is}/plugin/disable`,{code:s}),getPluginConfig:s=>I.get(`${Is}/plugin/config`,{params:{code:s}}),updatePluginConfig:(s,n)=>I.post(`${Is}/plugin/config`,{code:s,config:n}),upgradePlugin:s=>I.post(`${Is}/plugin/upgrade`,{code:s})};window?.settings?.secure_path;Er.config({monaco:Vr});const sm=h.object({subscribe_template_singbox:h.string().optional().default(""),subscribe_template_clash:h.string().optional().default(""),subscribe_template_clashmeta:h.string().optional().default(""),subscribe_template_stash:h.string().optional().default(""),subscribe_template_surge:h.string().optional().default(""),subscribe_template_surfboard:h.string().optional().default("")}),pr=[{key:"singbox",label:"Sing-box",language:"json"},{key:"clash",label:"Clash",language:"yaml"},{key:"clashmeta",label:"Clash Meta",language:"yaml"},{key:"stash",label:"Stash",language:"yaml"},{key:"surge",label:"Surge",language:"ini"},{key:"surfboard",label:"Surfboard",language:"ini"}],fr={subscribe_template_singbox:"",subscribe_template_clash:"",subscribe_template_clashmeta:"",subscribe_template_stash:"",subscribe_template_surge:"",subscribe_template_surfboard:""};function tm(){const{t:s}=O("settings"),[n,t]=m.useState(!1),r=m.useRef(null),[a,o]=m.useState("singbox"),l=Ne({resolver:ke(sm),defaultValues:fr,mode:"onChange"}),{data:d,isLoading:x}=ne({queryKey:["settings","client"],queryFn:()=>ve.getSettings("subscribe_template")}),{mutateAsync:u}=$s({mutationFn:ve.saveSettings,onSuccess:()=>{$.success(s("common.autoSaved"))},onError:P=>{console.error("保存失败:",P),$.error(s("common.saveFailed"))}});m.useEffect(()=>{if(d?.data?.subscribe_template){const P=d.data.subscribe_template;Object.entries(P).forEach(([T,C])=>{if(T in fr){const F=typeof C=="string"?C:"";l.setValue(T,F)}}),r.current=l.getValues()}},[d,l]);const i=m.useCallback(Le.debounce(async P=>{if(!r.current||!Le.isEqual(P,r.current)){t(!0);try{await u(P),r.current=P}catch(T){console.error("保存设置失败:",T)}finally{t(!1)}}},1500),[u]),c=m.useCallback(()=>{const P=l.getValues();i(P)},[l,i]),p=m.useCallback((P,T)=>e.jsx(j,{control:l.control,name:P,render:({field:C})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s(`subscribe_template.${P.replace("subscribe_template_","")}.title`)}),e.jsx(b,{children:e.jsx(Ir,{height:"500px",defaultLanguage:T,value:C.value||"",onChange:F=>{C.onChange(F||""),c()},options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0}})}),e.jsx(A,{children:s(`subscribe_template.${P.replace("subscribe_template_","")}.description`)}),e.jsx(R,{})]})}),[l.control,s,c]);return x?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.loading")})}):e.jsx(Te,{...l,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs(bt,{value:a,onValueChange:o,className:"w-full",children:[e.jsx(rt,{className:"",children:pr.map(({key:P,label:T})=>e.jsx(Be,{value:P,className:"text-xs",children:T},P))}),pr.map(({key:P,language:T})=>e.jsx(bs,{value:P,className:"mt-4",children:p(`subscribe_template_${P}`,T)},P))]}),n&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("div",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500"}),s("common.saving")]})]})})}function am(){const{t:s}=O("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("subscribe_template.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("subscribe_template.description")})]}),e.jsx(Re,{}),e.jsx(tm,{})]})}const nm=()=>e.jsx(Gd,{children:e.jsx(Fn,{})}),rm=jo([{path:"/sign-in",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>ym);return{default:s}},void 0,import.meta.url)).default})},{element:e.jsx(nm,{}),children:[{path:"/",lazy:async()=>({Component:(await _e(()=>Promise.resolve().then(()=>Fm),void 0,import.meta.url)).default}),errorElement:e.jsx(Nt,{}),children:[{index:!0,lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>Qm);return{default:s}},void 0,import.meta.url)).default})},{path:"config",errorElement:e.jsx(Nt,{}),children:[{path:"system",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>su);return{default:s}},void 0,import.meta.url)).default}),children:[{index:!0,lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>ru);return{default:s}},void 0,import.meta.url)).default})},{path:"safe",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>du);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>gu);return{default:s}},void 0,import.meta.url)).default})},{path:"invite",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>bu);return{default:s}},void 0,import.meta.url)).default})},{path:"frontend",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>Cu);return{default:s}},void 0,import.meta.url)).default})},{path:"server",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>Fu);return{default:s}},void 0,import.meta.url)).default})},{path:"email",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>Vu);return{default:s}},void 0,import.meta.url)).default})},{path:"telegram",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>$u);return{default:s}},void 0,import.meta.url)).default})},{path:"APP",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>Ku);return{default:s}},void 0,import.meta.url)).default})},{path:"subscribe-template",element:e.jsx(am,{})}]},{path:"payment",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>Xu);return{default:s}},void 0,import.meta.url)).default})},{path:"plugin",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>sx);return{default:s}},void 0,import.meta.url)).default})},{path:"theme",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>rx);return{default:s}},void 0,import.meta.url)).default})},{path:"notice",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>ux);return{default:s}},void 0,import.meta.url)).default})},{path:"knowledge",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>bx);return{default:s}},void 0,import.meta.url)).default})}]},{path:"server",errorElement:e.jsx(Nt,{}),children:[{path:"manage",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>Jx);return{default:s}},void 0,import.meta.url)).default})},{path:"group",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>sh);return{default:s}},void 0,import.meta.url)).default})},{path:"route",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>ih);return{default:s}},void 0,import.meta.url)).default})}]},{path:"finance",errorElement:e.jsx(Nt,{}),children:[{path:"plan",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>ph);return{default:s}},void 0,import.meta.url)).default})},{path:"order",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>Fh);return{default:s}},void 0,import.meta.url)).default})},{path:"coupon",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>$h);return{default:s}},void 0,import.meta.url)).default})},{path:"gift-card",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>lg);return{default:s}},void 0,import.meta.url)).default})}]},{path:"user",errorElement:e.jsx(Nt,{}),children:[{path:"manage",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>Ig);return{default:s}},void 0,import.meta.url)).default})},{path:"ticket",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>sp);return{default:s}},void 0,import.meta.url)).default})},{path:"traffic-reset-logs",lazy:async()=>({Component:(await _e(async()=>{const{default:s}=await Promise.resolve().then(()=>ip);return{default:s}},void 0,import.meta.url)).default})}]}]}]},{path:"/500",Component:Nt},{path:"/404",Component:ur},{path:"/503",Component:$d},{path:"*",Component:ur}]);function lm(){return I.get("/user/info")}const cn={token:ta()?.value||"",userInfo:null,isLoggedIn:!!ta()?.value,loading:!1,error:null},Qt=vo("user/fetchUserInfo",async()=>(await lm()).data,{condition:(s,{getState:n})=>{const{user:t}=n();return!!t.token&&!t.loading}}),Wl=bo({name:"user",initialState:cn,reducers:{setToken(s,n){s.token=n.payload,s.isLoggedIn=!!n.payload},resetUserState:()=>cn},extraReducers:s=>{s.addCase(Qt.pending,n=>{n.loading=!0,n.error=null}).addCase(Qt.fulfilled,(n,t)=>{n.loading=!1,n.userInfo=t.payload,n.error=null}).addCase(Qt.rejected,(n,t)=>{if(n.loading=!1,n.error=t.error.message||"Failed to fetch user info",!n.token)return cn})}}),{setToken:im,resetUserState:om}=Wl.actions,cm=s=>s.user.userInfo,dm=Wl.reducer,Yl=yo({reducer:{user:dm}});ta()?.value&&Yl.dispatch(Qt());_o.use(No).use(wo).init({resources:{"en-US":window.XBOARD_TRANSLATIONS?.["en-US"]||{},"zh-CN":window.XBOARD_TRANSLATIONS?.["zh-CN"]||{},"ko-KR":window.XBOARD_TRANSLATIONS?.["ko-KR"]||{}},fallbackLng:"zh-CN",supportedLngs:["en-US","zh-CN","ko-KR"],detection:{order:["querystring","localStorage","navigator"],lookupQuerystring:"lang",lookupLocalStorage:"i18nextLng",caches:["localStorage"]},interpolation:{escapeValue:!1}});const mm=new Co;So.createRoot(document.getElementById("root")).render(e.jsx(Mr.StrictMode,{children:e.jsx(ko,{client:mm,children:e.jsx(To,{store:Yl,children:e.jsxs(Id,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[e.jsx(Do,{router:rm}),e.jsx(Fo,{richColors:!0,position:"top-right"})]})})})}));const Se=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:_("rounded-xl border bg-card text-card-foreground shadow",s),...n}));Se.displayName="Card";const De=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:_("flex flex-col space-y-1.5 p-6",s),...n}));De.displayName="CardHeader";const Ve=m.forwardRef(({className:s,...n},t)=>e.jsx("h3",{ref:t,className:_("font-semibold leading-none tracking-tight",s),...n}));Ve.displayName="CardTitle";const Xs=m.forwardRef(({className:s,...n},t)=>e.jsx("p",{ref:t,className:_("text-sm text-muted-foreground",s),...n}));Xs.displayName="CardDescription";const Fe=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:_("p-6 pt-0",s),...n}));Fe.displayName="CardContent";const um=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:_("flex items-center p-6 pt-0",s),...n}));um.displayName="CardFooter";const D=m.forwardRef(({className:s,type:n,...t},r)=>e.jsx("input",{type:n,className:_("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:r,...t}));D.displayName="Input";const Jl=m.forwardRef(({className:s,...n},t)=>{const[r,a]=m.useState(!1);return e.jsxs("div",{className:"relative rounded-md",children:[e.jsx("input",{type:r?"text":"password",className:_("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:t,...n}),e.jsx(L,{type:"button",size:"icon",variant:"ghost",className:"absolute right-1 top-1/2 h-6 w-6 -translate-y-1/2 rounded-md text-muted-foreground",onClick:()=>a(o=>!o),children:r?e.jsx(Po,{size:18}):e.jsx(Lo,{size:18})})]})});Jl.displayName="PasswordInput";const xm=s=>I.post("/passport/auth/login",s);function hm({className:s,onForgotPassword:n,...t}){const r=Bs(),a=Or(),{t:o}=O("auth"),l=h.object({email:h.string().min(1,{message:o("signIn.validation.emailRequired")}),password:h.string().min(1,{message:o("signIn.validation.passwordRequired")}).min(7,{message:o("signIn.validation.passwordLength")})}),d=Ne({resolver:ke(l),defaultValues:{email:"",password:""}});async function x(u){try{const{data:i}=await xm(u);em(i.auth_data),a(im(i.auth_data)),await a(Qt()).unwrap(),r("/")}catch(i){console.error("Login failed:",i),i.response?.data?.message&&d.setError("root",{message:i.response.data.message})}}return e.jsx("div",{className:_("grid gap-6",s),...t,children:e.jsx(Te,{...d,children:e.jsx("form",{onSubmit:d.handleSubmit(x),className:"space-y-4",children:e.jsxs("div",{className:"space-y-4",children:[d.formState.errors.root&&e.jsx("div",{className:"text-sm text-destructive",children:d.formState.errors.root.message}),e.jsx(j,{control:d.control,name:"email",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:o("signIn.email")}),e.jsx(b,{children:e.jsx(D,{placeholder:o("signIn.emailPlaceholder"),autoComplete:"email",...u})}),e.jsx(R,{})]})}),e.jsx(j,{control:d.control,name:"password",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:o("signIn.password")}),e.jsx(b,{children:e.jsx(Jl,{placeholder:o("signIn.passwordPlaceholder"),autoComplete:"current-password",...u})}),e.jsx(R,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(L,{variant:"link",type:"button",className:"px-0 text-sm font-normal text-muted-foreground hover:text-primary",onClick:n,children:o("signIn.forgotPassword")})}),e.jsx(L,{className:"w-full",size:"lg",loading:d.formState.isSubmitting,children:o("signIn.submit")})]})})})})}const de=zr,fs=$r,gm=Ar,Zs=Pn,Ql=m.forwardRef(({className:s,...n},t)=>e.jsx(Ia,{ref:t,className:_("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...n}));Ql.displayName=Ia.displayName;const oe=m.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(gm,{children:[e.jsx(Ql,{}),e.jsxs(Ma,{ref:r,className:_("max-h-[95%] overflow-auto fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...t,children:[n,e.jsxs(Pn,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(is,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));oe.displayName=Ma.displayName;const ge=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col space-y-1.5 text-center sm:text-left",s),...n});ge.displayName="DialogHeader";const Ie=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Ie.displayName="DialogFooter";const me=m.forwardRef(({className:s,...n},t)=>e.jsx(Oa,{ref:t,className:_("text-lg font-semibold leading-none tracking-tight",s),...n}));me.displayName=Oa.displayName;const Ae=m.forwardRef(({className:s,...n},t)=>e.jsx(za,{ref:t,className:_("text-sm text-muted-foreground",s),...n}));Ae.displayName=za.displayName;const Vt=jt("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),G=m.forwardRef(({className:s,variant:n,size:t,asChild:r=!1,...a},o)=>{const l=r?Tn:"button";return e.jsx(l,{className:_(Vt({variant:n,size:t,className:s})),ref:o,...a})});G.displayName="Button";const Us=Vo,Ks=Io,pm=Mo,fm=m.forwardRef(({className:s,inset:n,children:t,...r},a)=>e.jsxs(qr,{ref:a,className:_("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",n&&"pl-8",s),...r,children:[t,e.jsx(Ur,{className:"ml-auto h-4 w-4"})]}));fm.displayName=qr.displayName;const jm=m.forwardRef(({className:s,...n},t)=>e.jsx(Hr,{ref:t,className:_("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...n}));jm.displayName=Hr.displayName;const As=m.forwardRef(({className:s,sideOffset:n=4,...t},r)=>e.jsx(Ro,{children:e.jsx(Kr,{ref:r,sideOffset:n,className:_("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...t})}));As.displayName=Kr.displayName;const Ce=m.forwardRef(({className:s,inset:n,...t},r)=>e.jsx(Br,{ref:r,className:_("relative flex cursor-default cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",s),...t}));Ce.displayName=Br.displayName;const Xl=m.forwardRef(({className:s,children:n,checked:t,...r},a)=>e.jsxs(Gr,{ref:a,className:_("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:t,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Wr,{children:e.jsx(vt,{className:"h-4 w-4"})})}),n]}));Xl.displayName=Gr.displayName;const vm=m.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(Yr,{ref:r,className:_("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...t,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Wr,{children:e.jsx(Eo,{className:"h-4 w-4 fill-current"})})}),n]}));vm.displayName=Yr.displayName;const Ha=m.forwardRef(({className:s,inset:n,...t},r)=>e.jsx(Jr,{ref:r,className:_("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",s),...t}));Ha.displayName=Jr.displayName;const tt=m.forwardRef(({className:s,...n},t)=>e.jsx(Qr,{ref:t,className:_("-mx-1 my-1 h-px bg-muted",s),...n}));tt.displayName=Qr.displayName;const Sn=({className:s,...n})=>e.jsx("span",{className:_("ml-auto text-xs tracking-widest opacity-60",s),...n});Sn.displayName="DropdownMenuShortcut";const dn=[{code:"en-US",name:"English",flag:Oo,shortName:"EN"},{code:"zh-CN",name:"中文",flag:zo,shortName:"CN"}];function Zl(){const{i18n:s}=O(),n=a=>{s.changeLanguage(a)},t=dn.find(a=>a.code===s.language)||dn[1],r=t.flag;return e.jsxs(Us,{children:[e.jsx(Ks,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 px-2 gap-1",children:[e.jsx(r,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:"text-sm font-medium",children:t.shortName})]})}),e.jsx(As,{align:"end",className:"w-[120px]",children:dn.map(a=>{const o=a.flag,l=a.code===s.language;return e.jsxs(Ce,{onClick:()=>n(a.code),className:_("flex items-center gap-2 px-2 py-1.5 cursor-pointer",l&&"bg-accent"),children:[e.jsx(o,{className:"h-4 w-5 rounded-sm shadow-sm"}),e.jsx("span",{className:_("text-sm",l&&"font-medium"),children:a.name})]},a.code)})})]})}function bm(){const[s,n]=m.useState(!1),{t}=O("auth"),r=t("signIn.resetPassword.command");return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"container relative flex min-h-svh flex-col items-center justify-center bg-primary-foreground px-4 py-8 lg:max-w-none lg:px-0",children:[e.jsx("div",{className:"absolute right-4 top-4 md:right-8 md:top-8",children:e.jsx(Zl,{})}),e.jsxs("div",{className:"mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px] md:w-[420px] lg:p-8",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-center",children:[e.jsx("h1",{className:"text-2xl font-bold sm:text-3xl",children:window?.settings?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:window?.settings?.description})]}),e.jsxs(Se,{className:"p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col space-y-2 text-left",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-tight sm:text-2xl",children:t("signIn.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("signIn.description")})]}),e.jsx(hm,{onForgotPassword:()=>n(!0)})]})]})]}),e.jsx(de,{open:s,onOpenChange:n,children:e.jsx(oe,{className:"max-w-[90vw] sm:max-w-lg",children:e.jsxs(ge,{children:[e.jsx(me,{children:t("signIn.resetPassword.title")}),e.jsx(Ae,{children:t("signIn.resetPassword.description")}),e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"max-w-full overflow-x-auto rounded-md bg-secondary p-4 pr-12 text-sm",children:r}),e.jsx(G,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 hover:bg-secondary-foreground/10",onClick:()=>Rt(r).then(()=>{$.success(t("common:copy.success"))}),children:e.jsx($o,{className:"h-4 w-4"})})]})})]})})})]})}const ym=Object.freeze(Object.defineProperty({__proto__:null,default:bm},Symbol.toStringTag,{value:"Module"})),qe=m.forwardRef(({className:s,fadedBelow:n=!1,fixedHeight:t=!1,...r},a)=>e.jsx("div",{ref:a,className:_("relative flex h-full w-full flex-col",n&&"after:pointer-events-none after:absolute after:bottom-0 after:left-0 after:hidden after:h-32 after:w-full after:bg-[linear-gradient(180deg,_transparent_10%,_hsl(var(--background))_70%)] after:md:block",t&&"md:h-svh",s),...r}));qe.displayName="Layout";const Ue=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{ref:t,className:_("flex h-[var(--header-height)] flex-none items-center gap-4 bg-background p-4 md:px-8",s),...n}));Ue.displayName="LayoutHeader";const Je=m.forwardRef(({className:s,fixedHeight:n,...t},r)=>e.jsx("div",{ref:r,className:_("flex-1 overflow-hidden px-4 py-6 md:px-8",n&&"h-[calc(100%-var(--header-height))]",s),...t}));Je.displayName="LayoutBody";const ei=Ao,si=qo,ti=Uo,pe=Ho,ue=Ko,xe=Bo,ce=m.forwardRef(({className:s,sideOffset:n=4,...t},r)=>e.jsx(Xr,{ref:r,sideOffset:n,className:_("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...t}));ce.displayName=Xr.displayName;function Ka(){const{pathname:s}=Dn();return{checkActiveNav:t=>{if(t==="/"&&s==="/")return!0;const r=t.replace(/^\//,""),a=s.replace(/^\//,"");return r?a.startsWith(r):!1}}}function ai({key:s,defaultValue:n}){const[t,r]=m.useState(()=>{const a=localStorage.getItem(s);return a!==null?JSON.parse(a):n});return m.useEffect(()=>{localStorage.setItem(s,JSON.stringify(t))},[t,s]),[t,r]}function _m(){const[s,n]=ai({key:"collapsed-sidebar-items",defaultValue:[]}),t=a=>!s.includes(a);return{isExpanded:t,toggleItem:a=>{t(a)?n([...s,a]):n(s.filter(o=>o!==a))}}}function Nm({links:s,isCollapsed:n,className:t,closeNav:r}){const{t:a}=O(),o=({sub:l,...d})=>{const x=`${a(d.title)}-${d.href}`;return n&&l?m.createElement(Sm,{...d,sub:l,key:x,closeNav:r}):n?m.createElement(Cm,{...d,key:x,closeNav:r}):l?m.createElement(wm,{...d,sub:l,key:x,closeNav:r}):m.createElement(ni,{...d,key:x,closeNav:r})};return e.jsx("div",{"data-collapsed":n,className:_("group border-b bg-background py-2 transition-[max-height,padding] duration-500 data-[collapsed=true]:py-2 md:border-none",t),children:e.jsx(pe,{delayDuration:0,children:e.jsx("nav",{className:"grid gap-1 group-[[data-collapsed=true]]:justify-center group-[[data-collapsed=true]]:px-2",children:s.map(o)})})})}function ni({title:s,icon:n,label:t,href:r,closeNav:a,subLink:o=!1}){const{checkActiveNav:l}=Ka(),{t:d}=O();return e.jsxs(st,{to:r,onClick:a,className:_(It({variant:l(r)?"secondary":"ghost",size:"sm"}),"h-12 justify-start text-wrap rounded-none px-6",o&&"h-10 w-full border-l border-l-slate-500 px-2"),"aria-current":l(r)?"page":void 0,children:[e.jsx("div",{className:"mr-2",children:n}),d(s),t&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:d(t)})]})}function wm({title:s,icon:n,label:t,sub:r,closeNav:a}){const{checkActiveNav:o}=Ka(),{isExpanded:l,toggleItem:d}=_m(),{t:x}=O(),u=!!r?.find(p=>o(p.href)),i=x(s),c=l(i)||u;return e.jsxs(ei,{open:c,onOpenChange:()=>d(i),children:[e.jsxs(si,{className:_(It({variant:u?"secondary":"ghost",size:"sm"}),"group h-12 w-full justify-start rounded-none px-6"),children:[e.jsx("div",{className:"mr-2",children:n}),x(s),t&&e.jsx("div",{className:"ml-2 rounded-lg bg-primary px-1 text-[0.625rem] text-primary-foreground",children:x(t)}),e.jsx("span",{className:_('ml-auto transition-all group-data-[state="open"]:-rotate-180'),children:e.jsx(Zr,{stroke:1})})]}),e.jsx(ti,{className:"collapsibleDropdown",asChild:!0,children:e.jsx("ul",{children:r.map(p=>e.jsx("li",{className:"my-1 ml-8",children:e.jsx(ni,{...p,subLink:!0,closeNav:a})},x(p.title)))})})]})}function Cm({title:s,icon:n,label:t,href:r,closeNav:a}){const{checkActiveNav:o}=Ka(),{t:l}=O();return e.jsxs(ue,{delayDuration:0,children:[e.jsx(xe,{asChild:!0,children:e.jsxs(st,{to:r,onClick:a,className:_(It({variant:o(r)?"secondary":"ghost",size:"icon"}),"h-12 w-12"),children:[n,e.jsx("span",{className:"sr-only",children:l(s)})]})}),e.jsxs(ce,{side:"right",className:"flex items-center gap-4",children:[l(s),t&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:l(t)})]})]})}function Sm({title:s,icon:n,label:t,sub:r,closeNav:a}){const{checkActiveNav:o}=Ka(),{t:l}=O(),d=!!r?.find(x=>o(x.href));return e.jsxs(Us,{children:[e.jsxs(ue,{delayDuration:0,children:[e.jsx(xe,{asChild:!0,children:e.jsx(Ks,{asChild:!0,children:e.jsx(L,{variant:d?"secondary":"ghost",size:"icon",className:"h-12 w-12",children:n})})}),e.jsxs(ce,{side:"right",className:"flex items-center gap-4",children:[l(s)," ",t&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:l(t)}),e.jsx(Zr,{size:18,className:"-rotate-90 text-muted-foreground"})]})]}),e.jsxs(As,{side:"right",align:"start",sideOffset:4,children:[e.jsxs(Ha,{children:[l(s)," ",t?`(${l(t)})`:""]}),e.jsx(tt,{}),r.map(({title:x,icon:u,label:i,href:c})=>e.jsx(Ce,{asChild:!0,children:e.jsxs(st,{to:c,onClick:a,className:`${o(c)?"bg-secondary":""}`,children:[u," ",e.jsx("span",{className:"ml-2 max-w-52 text-wrap",children:l(x)}),i&&e.jsx("span",{className:"ml-auto text-xs",children:l(i)})]})},`${l(x)}-${c}`))]})]})}const ri=[{title:"nav:dashboard",label:"",href:"/",icon:e.jsx(Go,{size:18})},{title:"nav:systemManagement",label:"",href:"",icon:e.jsx(Wo,{size:18}),sub:[{title:"nav:systemConfig",label:"",href:"/config/system",icon:e.jsx(el,{size:18})},{title:"nav:pluginManagement",label:"",href:"/config/plugin",icon:e.jsx(Ln,{size:18})},{title:"nav:themeConfig",label:"",href:"/config/theme",icon:e.jsx(Yo,{size:18})},{title:"nav:noticeManagement",label:"",href:"/config/notice",icon:e.jsx(Jo,{size:18})},{title:"nav:paymentConfig",label:"",href:"/config/payment",icon:e.jsx(tr,{size:18})},{title:"nav:knowledgeManagement",label:"",href:"/config/knowledge",icon:e.jsx(Qo,{size:18})}]},{title:"nav:nodeManagement",label:"",href:"",icon:e.jsx(sl,{size:18}),sub:[{title:"nav:nodeManagement",label:"",href:"/server/manage",icon:e.jsx(Xo,{size:18})},{title:"nav:permissionGroupManagement",label:"",href:"/server/group",icon:e.jsx(tl,{size:18})},{title:"nav:routeManagement",label:"",href:"/server/route",icon:e.jsx(Zo,{size:18})}]},{title:"nav:subscriptionManagement",label:"",href:"",icon:e.jsx(ec,{size:18}),sub:[{title:"nav:planManagement",label:"",href:"/finance/plan",icon:e.jsx(sc,{size:18})},{title:"nav:orderManagement",label:"",href:"/finance/order",icon:e.jsx(tr,{size:18})},{title:"nav:couponManagement",label:"",href:"/finance/coupon",icon:e.jsx(tc,{size:18})},{title:"nav:giftCardManagement",label:"",href:"/finance/gift-card",icon:e.jsx(ac,{size:18})}]},{title:"nav:userManagement",label:"",href:"",icon:e.jsx(nc,{size:18}),sub:[{title:"nav:userManagement",label:"",href:"/user/manage",icon:e.jsx(rc,{size:18})},{title:"nav:ticketManagement",label:"",href:"/user/ticket",icon:e.jsx(al,{size:18})}]}];function km({className:s,isCollapsed:n,setIsCollapsed:t}){const[r,a]=m.useState(!1),{t:o}=O();return m.useEffect(()=>{r?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")},[r]),e.jsxs("aside",{className:_(`fixed left-0 right-0 top-0 z-50 flex h-auto flex-col border-r-2 border-r-muted transition-[width] md:bottom-0 md:right-auto md:h-svh ${n?"md:w-14":"md:w-64"}`,s),children:[e.jsx("div",{onClick:()=>a(!1),className:`absolute inset-0 transition-[opacity] delay-100 duration-700 ${r?"h-svh opacity-50":"h-0 opacity-0"} w-full bg-black md:hidden`}),e.jsxs(qe,{className:`flex h-full flex-col ${r?"h-[100vh] md:h-full":""}`,children:[e.jsxs(Ue,{className:"sticky top-0 justify-between px-4 py-3 shadow md:px-4",children:[e.jsxs("div",{className:`flex items-center ${n?"":"gap-2"}`,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",className:`transition-all ${n?"h-6 w-6":"h-8 w-8"}`,children:[e.jsx("rect",{width:"256",height:"256",fill:"none"}),e.jsx("line",{x1:"208",y1:"128",x2:"128",y2:"208",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("line",{x1:"192",y1:"40",x2:"40",y2:"192",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"16"}),e.jsx("span",{className:"sr-only",children:"Website Name"})]}),e.jsx("div",{className:`flex flex-col justify-end truncate ${n?"invisible w-0":"visible w-auto"}`,children:e.jsx("span",{className:"font-medium",children:window?.settings?.title})})]}),e.jsx(L,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":o("common:toggleNavigation"),"aria-controls":"sidebar-menu","aria-expanded":r,onClick:()=>a(l=>!l),children:r?e.jsx(lc,{}):e.jsx(ic,{})})]}),e.jsx(Nm,{id:"sidebar-menu",className:_("flex-1 overflow-auto overscroll-contain",r?"block":"hidden md:block","md:py-2"),closeNav:()=>a(!1),isCollapsed:n,links:ri}),e.jsx("div",{className:_("border-t border-border/50 bg-background","px-4 py-2.5 text-xs text-muted-foreground",r?"block":"hidden md:block",n?"text-center":"text-left"),children:e.jsxs("div",{className:_("flex items-center gap-1.5",n?"justify-center":"justify-start"),children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500"}),e.jsxs("span",{className:_("whitespace-nowrap tracking-wide","transition-opacity duration-200",n&&"md:opacity-0"),children:["v",window?.settings?.version]})]})}),e.jsx(L,{onClick:()=>t(l=>!l),size:"icon",variant:"outline",className:"absolute -right-5 top-1/2 hidden rounded-full md:inline-flex","aria-label":o("common:toggleSidebar"),children:e.jsx(oc,{stroke:1.5,className:`h-5 w-5 ${n?"rotate-180":""}`})})]})]})}function Tm(){const[s,n]=ai({key:"collapsed-sidebar",defaultValue:!1});return m.useEffect(()=>{const t=()=>{n(window.innerWidth<768?!1:s)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[s,n]),[s,n]}function Dm(){const[s,n]=Tm();return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background",children:[e.jsx(km,{isCollapsed:s,setIsCollapsed:n}),e.jsx("main",{id:"content",className:`overflow-x-hidden pt-16 transition-[margin] md:overflow-y-hidden md:pt-0 ${s?"md:ml-14":"md:ml-64"} h-full`,children:e.jsx(Fn,{})})]})}const Fm=Object.freeze(Object.defineProperty({__proto__:null,default:Dm},Symbol.toStringTag,{value:"Module"})),Gs=m.forwardRef(({className:s,...n},t)=>e.jsx(hs,{ref:t,className:_("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",s),...n}));Gs.displayName=hs.displayName;const Pm=({children:s,...n})=>e.jsx(de,{...n,children:e.jsx(oe,{className:"overflow-hidden p-0",children:e.jsx(Gs,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:s})})}),lt=m.forwardRef(({className:s,...n},t)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(cc,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(hs.Input,{ref:t,className:_("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",s),...n})]}));lt.displayName=hs.Input.displayName;const Ws=m.forwardRef(({className:s,...n},t)=>e.jsx(hs.List,{ref:t,className:_("max-h-[300px] overflow-y-auto overflow-x-hidden",s),...n}));Ws.displayName=hs.List.displayName;const it=m.forwardRef((s,n)=>e.jsx(hs.Empty,{ref:n,className:"py-6 text-center text-sm",...s}));it.displayName=hs.Empty.displayName;const xs=m.forwardRef(({className:s,...n},t)=>e.jsx(hs.Group,{ref:t,className:_("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",s),...n}));xs.displayName=hs.Group.displayName;const Mt=m.forwardRef(({className:s,...n},t)=>e.jsx(hs.Separator,{ref:t,className:_("-mx-1 h-px bg-border",s),...n}));Mt.displayName=hs.Separator.displayName;const $e=m.forwardRef(({className:s,...n},t)=>e.jsx(hs.Item,{ref:t,className:_("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...n}));$e.displayName=hs.Item.displayName;function Lm(){const s=[];for(const n of ri)if(n.href&&s.push(n),n.sub)for(const t of n.sub)s.push({...t,parent:n.title});return s}function os(){const[s,n]=m.useState(!1),t=Bs(),r=Lm(),{t:a}=O("search"),{t:o}=O("nav");m.useEffect(()=>{const d=x=>{x.key==="k"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),n(u=>!u))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[]);const l=m.useCallback(d=>{n(!1),t(d)},[t]);return e.jsxs(e.Fragment,{children:[e.jsxs(G,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-10 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>n(!0),children:[e.jsx(Rn,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex",children:a("placeholder")}),e.jsx("span",{className:"sr-only",children:a("shortcut.label")}),e.jsx("kbd",{className:"pointer-events-none absolute right-1.5 top-2 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:a("shortcut.key")})]}),e.jsxs(Pm,{open:s,onOpenChange:n,children:[e.jsx(lt,{placeholder:a("placeholder")}),e.jsxs(Ws,{children:[e.jsx(it,{children:a("noResults")}),e.jsx(xs,{heading:a("title"),children:r.map(d=>e.jsxs($e,{value:`${d.parent?d.parent+" ":""}${d.title}`,onSelect:()=>l(d.href),children:[e.jsx("div",{className:"mr-2",children:d.icon}),e.jsx("span",{children:o(d.title)}),d.parent&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:o(d.parent)})]},d.href))})]})]})]})}function ts(){const{theme:s,setTheme:n}=Md();return m.useEffect(()=>{const t=s==="dark"?"#020817":"#fff",r=document.querySelector("meta[name='theme-color']");r&&r.setAttribute("content",t)},[s]),e.jsxs(e.Fragment,{children:[e.jsx(L,{size:"icon",variant:"ghost",className:"rounded-full",onClick:()=>n(s==="light"?"dark":"light"),children:s==="light"?e.jsx(dc,{size:20}):e.jsx(mc,{size:20})}),e.jsx(Zl,{})]})}const li=m.forwardRef(({className:s,...n},t)=>e.jsx(nl,{ref:t,className:_("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...n}));li.displayName=nl.displayName;const ii=m.forwardRef(({className:s,...n},t)=>e.jsx(rl,{ref:t,className:_("aspect-square h-full w-full",s),...n}));ii.displayName=rl.displayName;const oi=m.forwardRef(({className:s,...n},t)=>e.jsx(ll,{ref:t,className:_("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...n}));oi.displayName=ll.displayName;function as(){const s=Bs(),n=Or(),t=uc(cm),{t:r}=O(["common"]),a=()=>{Hl(),n(om()),s("/sign-in")},o=t?.email?.split("@")[0]||r("common:user"),l=o.substring(0,2).toUpperCase();return e.jsxs(Us,{children:[e.jsx(Ks,{asChild:!0,children:e.jsx(L,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:e.jsxs(li,{className:"h-8 w-8",children:[e.jsx(ii,{src:t?.avatar_url,alt:o}),e.jsx(oi,{children:l})]})})}),e.jsxs(As,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(Ha,{className:"font-normal",children:e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("p",{className:"text-sm font-medium leading-none",children:o}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:t?.email||r("common:defaultEmail")})]})}),e.jsx(tt,{}),e.jsx(Ce,{asChild:!0,children:e.jsxs(st,{to:"/config/system",children:[r("common:settings"),e.jsx(Sn,{children:"⌘S"})]})}),e.jsx(tt,{}),e.jsxs(Ce,{onClick:a,children:[r("common:logout"),e.jsx(Sn,{children:"⇧⌘Q"})]})]})]})}const X=xc,Ns=yc,Z=hc,J=m.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(il,{ref:r,className:_("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...t,children:[n,e.jsx(gc,{asChild:!0,children:e.jsx(En,{className:"h-4 w-4 opacity-50"})})]}));J.displayName=il.displayName;const ci=m.forwardRef(({className:s,...n},t)=>e.jsx(ol,{ref:t,className:_("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(pc,{className:"h-4 w-4"})}));ci.displayName=ol.displayName;const di=m.forwardRef(({className:s,...n},t)=>e.jsx(cl,{ref:t,className:_("flex cursor-default items-center justify-center py-1",s),...n,children:e.jsx(En,{className:"h-4 w-4"})}));di.displayName=cl.displayName;const Q=m.forwardRef(({className:s,children:n,position:t="popper",...r},a)=>e.jsx(fc,{children:e.jsxs(dl,{ref:a,className:_("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:t,...r,children:[e.jsx(ci,{}),e.jsx(jc,{className:_("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),e.jsx(di,{})]})}));Q.displayName=dl.displayName;const Rm=m.forwardRef(({className:s,...n},t)=>e.jsx(ml,{ref:t,className:_("px-2 py-1.5 text-sm font-semibold",s),...n}));Rm.displayName=ml.displayName;const q=m.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(ul,{ref:r,className:_("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...t,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(vc,{children:e.jsx(vt,{className:"h-4 w-4"})})}),e.jsx(bc,{children:n})]}));q.displayName=ul.displayName;const Em=m.forwardRef(({className:s,...n},t)=>e.jsx(xl,{ref:t,className:_("-mx-1 my-1 h-px bg-muted",s),...n}));Em.displayName=xl.displayName;function Ss({className:s,classNames:n,showOutsideDays:t=!0,captionLayout:r="label",buttonVariant:a="ghost",formatters:o,components:l,...d}){const x=hl();return e.jsx(_c,{showOutsideDays:t,className:_("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,s),captionLayout:r,formatters:{formatMonthDropdown:u=>u.toLocaleString("default",{month:"short"}),...o},classNames:{root:_("w-fit",x.root),months:_("relative flex flex-col gap-4 md:flex-row",x.months),month:_("flex w-full flex-col gap-4",x.month),nav:_("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",x.nav),button_previous:_(Vt({variant:a}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",x.button_previous),button_next:_(Vt({variant:a}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",x.button_next),month_caption:_("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",x.month_caption),dropdowns:_("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",x.dropdowns),dropdown_root:_("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",x.dropdown_root),dropdown:_("absolute inset-0 opacity-0",x.dropdown),caption_label:_("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",x.caption_label),table:"w-full border-collapse",weekdays:_("flex",x.weekdays),weekday:_("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",x.weekday),week:_("mt-2 flex w-full",x.week),week_number_header:_("w-[--cell-size] select-none",x.week_number_header),week_number:_("text-muted-foreground select-none text-[0.8rem]",x.week_number),day:_("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",x.day),range_start:_("bg-accent rounded-l-md",x.range_start),range_middle:_("rounded-none",x.range_middle),range_end:_("bg-accent rounded-r-md",x.range_end),today:_("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",x.today),outside:_("text-muted-foreground aria-selected:text-muted-foreground",x.outside),disabled:_("text-muted-foreground opacity-50",x.disabled),hidden:_("invisible",x.hidden),...n},components:{Root:({className:u,rootRef:i,...c})=>e.jsx("div",{"data-slot":"calendar",ref:i,className:_(u),...c}),Chevron:({className:u,orientation:i,...c})=>i==="left"?e.jsx(gl,{className:_("size-4",u),...c}):i==="right"?e.jsx(pl,{className:_("size-4",u),...c}):e.jsx(fl,{className:_("size-4",u),...c}),DayButton:Vm,WeekNumber:({children:u,...i})=>e.jsx("td",{...i,children:e.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:u})}),...l},...d})}function Vm({className:s,day:n,modifiers:t,...r}){const a=hl(),o=m.useRef(null);return m.useEffect(()=>{t.focused&&o.current?.focus()},[t.focused]),e.jsx(G,{ref:o,variant:"ghost",size:"icon","data-day":n.date.toLocaleDateString(),"data-selected-single":t.selected&&!t.range_start&&!t.range_end&&!t.range_middle,"data-range-start":t.range_start,"data-range-end":t.range_end,"data-range-middle":t.range_middle,className:_("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",a.day,s),...r})}const Ze=wc,es=Cc,Ge=m.forwardRef(({className:s,align:n="center",sideOffset:t=4,...r},a)=>e.jsx(Nc,{children:e.jsx(jl,{ref:a,align:n,sideOffset:t,className:_("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...r})}));Ge.displayName=jl.displayName;const Ys={income:{main:"hsl(var(--primary))",gradient:{start:"hsl(var(--primary))",end:"transparent"}},commission:{main:"hsl(var(--secondary))",gradient:{start:"hsl(var(--secondary))",end:"transparent"}}},Kt=s=>(s/100).toFixed(2),Im=({active:s,payload:n,label:t})=>{const{t:r}=O();return s&&n&&n.length?e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-sm",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:t}),n.map((a,o)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:a.color}}),e.jsxs("span",{className:"text-muted-foreground",children:[r(a.name),":"]}),e.jsx("span",{className:"font-medium",children:a.name.includes(r("dashboard:overview.amount"))?`¥${Kt(a.value)}`:r("dashboard:overview.transactions",{count:a.value})})]},o))]}):null},Mm=[{value:"7d",label:"dashboard:overview.last7Days"},{value:"30d",label:"dashboard:overview.last30Days"},{value:"90d",label:"dashboard:overview.last90Days"},{value:"180d",label:"dashboard:overview.last180Days"},{value:"365d",label:"dashboard:overview.lastYear"},{value:"custom",label:"dashboard:overview.customRange"}],Om=(s,n)=>{const t=new Date;if(s==="custom"&&n)return{startDate:n.from,endDate:n.to};let r;switch(s){case"7d":r=Os(t,7);break;case"30d":r=Os(t,30);break;case"90d":r=Os(t,90);break;case"180d":r=Os(t,180);break;case"365d":r=Os(t,365);break;default:r=Os(t,30)}return{startDate:r,endDate:t}};function zm(){const[s,n]=m.useState("amount"),[t,r]=m.useState("30d"),[a,o]=m.useState({from:Os(new Date,7),to:new Date}),{t:l}=O(),{startDate:d,endDate:x}=Om(t,a),{data:u}=ne({queryKey:["orderStat",{start_date:Pe(d,"yyyy-MM-dd"),end_date:Pe(x,"yyyy-MM-dd")}],queryFn:async()=>{const{data:i}=await Pa.getOrderStat({start_date:Pe(d,"yyyy-MM-dd"),end_date:Pe(x,"yyyy-MM-dd")});return i},refetchInterval:3e4});return e.jsxs(Se,{children:[e.jsx(De,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ve,{children:l("dashboard:overview.title")}),e.jsxs(Xs,{children:[u?.summary.start_date," ",l("dashboard:overview.to")," ",u?.summary.end_date]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsxs(X,{value:t,onValueChange:i=>r(i),children:[e.jsx(J,{className:"w-[120px]",children:e.jsx(Z,{placeholder:l("dashboard:overview.selectTimeRange")})}),e.jsx(Q,{children:Mm.map(i=>e.jsx(q,{value:i.value,children:l(i.label)},i.value))})]}),t==="custom"&&e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:_("min-w-0 justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:a?.from?a.to?e.jsxs(e.Fragment,{children:[Pe(a.from,"yyyy-MM-dd")," -"," ",Pe(a.to,"yyyy-MM-dd")]}):Pe(a.from,"yyyy-MM-dd"):l("dashboard:overview.selectDate")})]})}),e.jsx(Ge,{className:"w-auto p-0",align:"end",children:e.jsx(Ss,{mode:"range",defaultMonth:a?.from,selected:{from:a?.from,to:a?.to},onSelect:i=>{i?.from&&i?.to&&o({from:i.from,to:i.to})},captionLayout:"dropdown",numberOfMonths:2})})]})]}),e.jsx(bt,{value:s,onValueChange:i=>n(i),children:e.jsxs(rt,{children:[e.jsx(Be,{value:"amount",children:l("dashboard:overview.amount")}),e.jsx(Be,{value:"count",children:l("dashboard:overview.count")})]})})]})]})}),e.jsxs(Fe,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:l("dashboard:overview.totalIncome")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Kt(u?.summary?.paid_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l("dashboard:overview.totalTransactions",{count:u?.summary?.paid_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[l("dashboard:overview.avgOrderAmount")," ¥",Kt(u?.summary?.avg_paid_amount||0)]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:l("dashboard:overview.totalCommission")}),e.jsxs("div",{className:"text-2xl font-bold",children:["¥",Kt(u?.summary?.commission_total||0)]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l("dashboard:overview.totalTransactions",{count:u?.summary?.commission_count||0})}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[l("dashboard:overview.commissionRate")," ",u?.summary?.commission_rate.toFixed(2)||0,"%"]})]})]}),e.jsx("div",{className:"h-[400px] w-full",children:e.jsx(Sc,{width:"100%",height:"100%",children:e.jsxs(kc,{data:u?.list||[],margin:{top:20,right:20,left:0,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"incomeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:Ys.income.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:Ys.income.gradient.end,stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"commissionGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:Ys.commission.gradient.start,stopOpacity:.2}),e.jsx("stop",{offset:"100%",stopColor:Ys.commission.gradient.end,stopOpacity:.1})]})]}),e.jsx(Tc,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:i=>Pe(new Date(i),"MM-dd",{locale:Lc})}),e.jsx(Dc,{axisLine:!1,tickLine:!1,tick:{fill:"hsl(var(--muted-foreground))",fontSize:12},tickFormatter:i=>s==="amount"?`¥${Kt(i)}`:l("dashboard:overview.transactions",{count:i})}),e.jsx(Fc,{strokeDasharray:"3 3",vertical:!1,stroke:"hsl(var(--border))",opacity:.3}),e.jsx(Pc,{content:e.jsx(Im,{})}),s==="amount"?e.jsxs(e.Fragment,{children:[e.jsx(ar,{type:"monotone",dataKey:"paid_total",name:l("dashboard:overview.orderAmount"),stroke:Ys.income.main,fill:"url(#incomeGradient)",strokeWidth:2}),e.jsx(ar,{type:"monotone",dataKey:"commission_total",name:l("dashboard:overview.commissionAmount"),stroke:Ys.commission.main,fill:"url(#commissionGradient)",strokeWidth:2})]}):e.jsxs(e.Fragment,{children:[e.jsx(nr,{dataKey:"paid_count",name:l("dashboard:overview.orderCount"),fill:Ys.income.main,radius:[4,4,0,0],maxBarSize:40}),e.jsx(nr,{dataKey:"commission_count",name:l("dashboard:overview.commissionCount"),fill:Ys.commission.main,radius:[4,4,0,0],maxBarSize:40})]})]})})})]})]})}function je({className:s,...n}){return e.jsx("div",{className:_("animate-pulse rounded-md bg-primary/10",s),...n})}function $m(){return e.jsxs(Se,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(je,{className:"h-4 w-[120px]"}),e.jsx(je,{className:"h-4 w-4"})]}),e.jsxs(Fe,{children:[e.jsx(je,{className:"h-8 w-[140px] mb-2"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(je,{className:"h-4 w-4"}),e.jsx(je,{className:"h-4 w-[100px]"})]})]})]})}function Am(){return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:Array.from({length:8}).map((s,n)=>e.jsx($m,{},n))})}var le=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.CANCELLED=2]="CANCELLED",s[s.COMPLETED=3]="COMPLETED",s[s.DISCOUNTED=4]="DISCOUNTED",s))(le||{});const At={0:"待支付",1:"开通中",2:"已取消",3:"已完成",4:"已折抵"},qt={0:"yellow-500",1:"blue-500",2:"red-500",3:"green-500",4:"green-500"};var zs=(s=>(s[s.NEW=1]="NEW",s[s.RENEWAL=2]="RENEWAL",s[s.UPGRADE=3]="UPGRADE",s[s.RESET_FLOW=4]="RESET_FLOW",s))(zs||{}),we=(s=>(s[s.PENDING=0]="PENDING",s[s.PROCESSING=1]="PROCESSING",s[s.VALID=2]="VALID",s[s.INVALID=3]="INVALID",s))(we||{});const xa={0:"待确认",1:"发放中",2:"有效",3:"无效"},ha={0:"yellow-500",1:"blue-500",2:"green-500",3:"red-500"};var Xe=(s=>(s.MONTH_PRICE="month_price",s.QUARTER_PRICE="quarter_price",s.HALF_YEAR_PRICE="half_year_price",s.YEAR_PRICE="year_price",s.TWO_YEAR_PRICE="two_year_price",s.THREE_YEAR_PRICE="three_year_price",s.ONETIME_PRICE="onetime_price",s.RESET_PRICE="reset_price",s))(Xe||{});const qm={month_price:"月付",quarter_price:"季付",half_year_price:"半年付",year_price:"年付",two_year_price:"两年付",three_year_price:"三年付",onetime_price:"一次性",reset_price:"流量重置包"};var he=(s=>(s.Shadowsocks="shadowsocks",s.Vmess="vmess",s.Trojan="trojan",s.Hysteria="hysteria",s.Vless="vless",s.Tuic="tuic",s.Socks="socks",s.Naive="naive",s.Http="http",s.Mieru="mieru",s.AnyTLS="anytls",s))(he||{});const Ds=[{type:"shadowsocks",label:"Shadowsocks"},{type:"vmess",label:"VMess"},{type:"trojan",label:"Trojan"},{type:"hysteria",label:"Hysteria"},{type:"vless",label:"VLess"},{type:"tuic",label:"TUIC"},{type:"socks",label:"SOCKS"},{type:"naive",label:"Naive"},{type:"http",label:"HTTP"},{type:"mieru",label:"Mieru"},{type:"anytls",label:"AnyTLS"}],vs={shadowsocks:"#489851",vmess:"#CB3180",trojan:"#EBB749",hysteria:"#5684e6",vless:"#1a1a1a",tuic:"#00C853",socks:"#2196F3",naive:"#9C27B0",http:"#FF5722",mieru:"#4CAF50",anytls:"#7E57C2"};var ws=(s=>(s[s.AMOUNT=1]="AMOUNT",s[s.PERCENTAGE=2]="PERCENTAGE",s))(ws||{});const Um={1:"按金额优惠",2:"按比例优惠"};var et=(s=>(s[s.OPENING=0]="OPENING",s[s.CLOSED=1]="CLOSED",s))(et||{}),ds=(s=>(s[s.LOW=0]="LOW",s[s.MIDDLE=1]="MIDDLE",s[s.HIGH=2]="HIGH",s))(ds||{}),Xt=(s=>(s.MONTH="monthly",s.QUARTER="quarterly",s.HALF_YEAR="half_yearly",s.YEAR="yearly",s.TWO_YEAR="two_yearly",s.THREE_YEAR="three_yearly",s.ONETIME="onetime",s.RESET="reset_traffic",s))(Xt||{});function Js({title:s,value:n,icon:t,trend:r,description:a,onClick:o,highlight:l,className:d}){return e.jsxs(Se,{className:_("transition-colors",o&&"cursor-pointer hover:bg-muted/50",l&&"border-primary/50",d),onClick:o,children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ve,{className:"text-sm font-medium",children:s}),t]}),e.jsxs(Fe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:n}),r?e.jsxs("div",{className:"flex items-center pt-1",children:[e.jsx(Ic,{className:_("h-4 w-4",r.isPositive?"text-emerald-500":"text-red-500")}),e.jsxs("span",{className:_("ml-1 text-xs",r.isPositive?"text-emerald-500":"text-red-500"),children:[r.isPositive?"+":"-",Math.abs(r.value),"%"]}),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:r.label})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:a})]})]})}function Hm({className:s}){const n=Bs(),{t}=O(),{data:r,isLoading:a}=ne({queryKey:["dashboardStats"],queryFn:async()=>(await Pa.getStatsData()).data,refetchInterval:1e3*60*5});if(a||!r)return e.jsx(Am,{});const o=()=>{const l=new URLSearchParams;l.set("commission_status",we.PENDING.toString()),l.set("status",le.COMPLETED.toString()),l.set("commission_balance","gt:0"),n(`/finance/order?${l.toString()}`)};return e.jsxs("div",{className:_("grid gap-4 md:grid-cols-2 lg:grid-cols-4",s),children:[e.jsx(Js,{title:t("dashboard:stats.todayIncome"),value:Hs(r.todayIncome),icon:e.jsx(Rc,{className:"h-4 w-4 text-emerald-500"}),trend:{value:r.dayIncomeGrowth,label:t("dashboard:stats.vsYesterday"),isPositive:r.dayIncomeGrowth>0}}),e.jsx(Js,{title:t("dashboard:stats.monthlyIncome"),value:Hs(r.currentMonthIncome),icon:e.jsx(Vn,{className:"h-4 w-4 text-blue-500"}),trend:{value:r.monthIncomeGrowth,label:t("dashboard:stats.vsLastMonth"),isPositive:r.monthIncomeGrowth>0}}),e.jsx(Js,{title:t("dashboard:stats.pendingTickets"),value:r.ticketPendingTotal,icon:e.jsx(Ec,{className:_("h-4 w-4",r.ticketPendingTotal>0?"text-orange-500":"text-muted-foreground")}),description:r.ticketPendingTotal>0?t("dashboard:stats.hasPendingTickets"):t("dashboard:stats.noPendingTickets"),onClick:()=>n("/user/ticket"),highlight:r.ticketPendingTotal>0}),e.jsx(Js,{title:t("dashboard:stats.pendingCommission"),value:r.commissionPendingTotal,icon:e.jsx(Vc,{className:_("h-4 w-4",r.commissionPendingTotal>0?"text-blue-500":"text-muted-foreground")}),description:r.commissionPendingTotal>0?t("dashboard:stats.hasPendingCommission"):t("dashboard:stats.noPendingCommission"),onClick:o,highlight:r.commissionPendingTotal>0}),e.jsx(Js,{title:t("dashboard:stats.monthlyNewUsers"),value:r.currentMonthNewUsers,icon:e.jsx(Ca,{className:"h-4 w-4 text-blue-500"}),trend:{value:r.userGrowth,label:t("dashboard:stats.vsLastMonth"),isPositive:r.userGrowth>0}}),e.jsx(Js,{title:t("dashboard:stats.totalUsers"),value:r.totalUsers,icon:e.jsx(Ca,{className:"h-4 w-4 text-muted-foreground"}),description:t("dashboard:stats.activeUsers",{count:r.activeUsers})}),e.jsx(Js,{title:t("dashboard:stats.monthlyUpload"),value:ze(r.monthTraffic.upload),icon:e.jsx(Lt,{className:"h-4 w-4 text-emerald-500"}),description:t("dashboard:stats.todayTraffic",{value:ze(r.todayTraffic.upload)})}),e.jsx(Js,{title:t("dashboard:stats.monthlyDownload"),value:ze(r.monthTraffic.download),icon:e.jsx(sa,{className:"h-4 w-4 text-blue-500"}),description:t("dashboard:stats.todayTraffic",{value:ze(r.todayTraffic.download)})})]})}const ft=m.forwardRef(({className:s,children:n,...t},r)=>e.jsxs(vl,{ref:r,className:_("relative overflow-hidden",s),...t,children:[e.jsx(Mc,{className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(Ra,{}),e.jsx(Oc,{})]}));ft.displayName=vl.displayName;const Ra=m.forwardRef(({className:s,orientation:n="vertical",...t},r)=>e.jsx(bl,{ref:r,orientation:n,className:_("flex touch-none select-none transition-colors",n==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",n==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",s),...t,children:e.jsx(zc,{className:"relative flex-1 rounded-full bg-border"})}));Ra.displayName=bl.displayName;const kn={today:{getValue:()=>{const s=Ac();return{start:s,end:qc(s,1)}}},last7days:{getValue:()=>{const s=new Date;return{start:Os(s,7),end:s}}},last30days:{getValue:()=>{const s=new Date;return{start:Os(s,30),end:s}}},custom:{getValue:()=>null}};function jr({selectedRange:s,customDateRange:n,onRangeChange:t,onCustomRangeChange:r}){const{t:a}=O(),o={today:a("dashboard:trafficRank.today"),last7days:a("dashboard:trafficRank.last7days"),last30days:a("dashboard:trafficRank.last30days"),custom:a("dashboard:trafficRank.customRange")};return e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.jsxs(X,{value:s,onValueChange:t,children:[e.jsx(J,{className:"w-[120px]",children:e.jsx(Z,{placeholder:a("dashboard:trafficRank.selectTimeRange")})}),e.jsx(Q,{position:"popper",className:"z-50",children:Object.entries(kn).map(([l])=>e.jsx(q,{value:l,children:o[l]},l))})]}),s==="custom"&&e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:_("min-w-0 justify-start text-left font-normal",!n&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:n?.from?n.to?e.jsxs(e.Fragment,{children:[Pe(n.from,"yyyy-MM-dd")," -"," ",Pe(n.to,"yyyy-MM-dd")]}):Pe(n.from,"yyyy-MM-dd"):e.jsx("span",{children:a("dashboard:trafficRank.selectDateRange")})})]})}),e.jsx(Ge,{className:"w-auto p-0",align:"end",children:e.jsx(Ss,{mode:"range",defaultMonth:n?.from,selected:{from:n?.from,to:n?.to},onSelect:l=>{l?.from&&l?.to&&r({from:l.from,to:l.to})},numberOfMonths:2})})]})]})}const kt=s=>`${(s/1024/1024/1024).toFixed(2)} GB`;function Km({className:s}){const{t:n}=O(),[t,r]=m.useState("today"),[a,o]=m.useState({from:Os(new Date,7),to:new Date}),[l,d]=m.useState("today"),[x,u]=m.useState({from:Os(new Date,7),to:new Date}),i=m.useMemo(()=>t==="custom"?{start:a.from,end:a.to}:kn[t].getValue(),[t,a]),c=m.useMemo(()=>l==="custom"?{start:x.from,end:x.to}:kn[l].getValue(),[l,x]),{data:p}=ne({queryKey:["nodeTrafficRank",i.start,i.end],queryFn:()=>Pa.getNodeTrafficData({type:"node",start_time:Le.round(i.start.getTime()/1e3),end_time:Le.round(i.end.getTime()/1e3)}),refetchInterval:3e4}),{data:P}=ne({queryKey:["userTrafficRank",c.start,c.end],queryFn:()=>Pa.getNodeTrafficData({type:"user",start_time:Le.round(c.start.getTime()/1e3),end_time:Le.round(c.end.getTime()/1e3)}),refetchInterval:3e4});return e.jsxs("div",{className:_("grid gap-4 md:grid-cols-2",s),children:[e.jsxs(Se,{children:[e.jsx(De,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(Ve,{className:"flex items-center text-base font-medium",children:[e.jsx($c,{className:"mr-2 h-4 w-4"}),n("dashboard:trafficRank.nodeTrafficRank")]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(jr,{selectedRange:t,customDateRange:a,onRangeChange:r,onCustomRangeChange:o}),e.jsx(rr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Fe,{className:"flex-1",children:p?.data?e.jsxs(ft,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:p.data.map(T=>e.jsx(pe,{delayDuration:200,children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:T.name}),e.jsxs("span",{className:_("ml-2 flex items-center text-xs font-medium",T.change>=0?"text-green-600":"text-red-600"),children:[T.change>=0?e.jsx(jn,{className:"mr-1 h-3 w-3"}):e.jsx(vn,{className:"mr-1 h-3 w-3"}),Math.abs(T.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${T.value/p.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:kt(T.value)})]})]})})}),e.jsx(ce,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.currentTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:kt(T.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:kt(T.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:_("font-medium",T.change>=0?"text-green-600":"text-red-600"),children:[T.change>=0?"+":"",T.change,"%"]})]})})]})},T.id))}),e.jsx(Ra,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:n("common:loading")})})})]}),e.jsxs(Se,{children:[e.jsx(De,{className:"flex-none pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(Ve,{className:"flex items-center text-base font-medium",children:[e.jsx(Ca,{className:"mr-2 h-4 w-4"}),n("dashboard:trafficRank.userTrafficRank")]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx(jr,{selectedRange:l,customDateRange:x,onRangeChange:d,onCustomRangeChange:u}),e.jsx(rr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"})]})]})}),e.jsx(Fe,{className:"flex-1",children:P?.data?e.jsxs(ft,{className:"h-[400px] pr-4",children:[e.jsx("div",{className:"space-y-3",children:P.data.map(T=>e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx("div",{className:"flex cursor-pointer items-center justify-between space-x-2 rounded-lg bg-muted/50 p-2 transition-colors hover:bg-muted/70",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:T.name}),e.jsxs("span",{className:_("ml-2 flex items-center text-xs font-medium",T.change>=0?"text-green-600":"text-red-600"),children:[T.change>=0?e.jsx(jn,{className:"mr-1 h-3 w-3"}):e.jsx(vn,{className:"mr-1 h-3 w-3"}),Math.abs(T.change),"%"]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${T.value/P.data[0].value*100}%`}})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:kt(T.value)})]})]})})}),e.jsx(ce,{side:"right",className:"space-y-2 p-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.currentTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:kt(T.value)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.previousTraffic"),":"]}),e.jsx("span",{className:"font-medium",children:kt(T.previousValue)}),e.jsxs("span",{className:"text-muted-foreground",children:[n("dashboard:trafficRank.changeRate"),":"]}),e.jsxs("span",{className:_("font-medium",T.change>=0?"text-green-600":"text-red-600"),children:[T.change>=0?"+":"",T.change,"%"]})]})})]})},T.id))}),e.jsx(Ra,{orientation:"vertical"})]}):e.jsx("div",{className:"flex h-[400px] items-center justify-center",children:e.jsx("div",{className:"animate-pulse",children:n("common:loading")})})})]})]})}const Bm=jt("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/10",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function K({className:s,variant:n,...t}){return e.jsx("div",{className:_(Bm({variant:n}),s),...t})}const ya=m.forwardRef(({className:s,value:n,...t},r)=>e.jsx(yl,{ref:r,className:_("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",s),...t,children:e.jsx(Uc,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));ya.displayName=yl.displayName;const An=m.forwardRef(({className:s,...n},t)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:t,className:_("w-full caption-bottom text-sm",s),...n})}));An.displayName="Table";const qn=m.forwardRef(({className:s,...n},t)=>e.jsx("thead",{ref:t,className:_("[&_tr]:border-b",s),...n}));qn.displayName="TableHeader";const Un=m.forwardRef(({className:s,...n},t)=>e.jsx("tbody",{ref:t,className:_("[&_tr:last-child]:border-0",s),...n}));Un.displayName="TableBody";const Gm=m.forwardRef(({className:s,...n},t)=>e.jsx("tfoot",{ref:t,className:_("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...n}));Gm.displayName="TableFooter";const Qs=m.forwardRef(({className:s,...n},t)=>e.jsx("tr",{ref:t,className:_("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...n}));Qs.displayName="TableRow";const Hn=m.forwardRef(({className:s,...n},t)=>e.jsx("th",{ref:t,className:_("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...n}));Hn.displayName="TableHead";const Pt=m.forwardRef(({className:s,...n},t)=>e.jsx("td",{ref:t,className:_("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",s),...n}));Pt.displayName="TableCell";const Wm=m.forwardRef(({className:s,...n},t)=>e.jsx("caption",{ref:t,className:_("mt-4 text-sm text-muted-foreground",s),...n}));Wm.displayName="TableCaption";function mi({table:s}){const[n,t]=m.useState(""),{t:r}=O("common");m.useEffect(()=>{t((s.getState().pagination.pageIndex+1).toString())},[s.getState().pagination.pageIndex]);const a=o=>{const l=parseInt(o);!isNaN(l)&&l>=1&&l<=s.getPageCount()?s.setPageIndex(l-1):t((s.getState().pagination.pageIndex+1).toString())};return e.jsxs("div",{className:"flex flex-col-reverse gap-4 px-2 py-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"flex-1 text-sm text-muted-foreground",children:r("table.pagination.selected",{selected:s.getFilteredSelectedRowModel().rows.length,total:s.getFilteredRowModel().rows.length})}),e.jsxs("div",{className:"flex flex-col-reverse items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:r("table.pagination.itemsPerPage")}),e.jsxs(X,{value:`${s.getState().pagination.pageSize}`,onValueChange:o=>{s.setPageSize(Number(o))},children:[e.jsx(J,{className:"h-8 w-[70px]",children:e.jsx(Z,{placeholder:s.getState().pagination.pageSize})}),e.jsx(Q,{side:"top",children:[10,20,30,40,50,100,500].map(o=>e.jsx(q,{value:`${o}`,children:o},o))})]})]}),e.jsxs("div",{className:"flex items-center justify-center space-x-2 text-sm font-medium",children:[e.jsx("span",{children:r("table.pagination.page")}),e.jsx(D,{type:"text",value:n,onChange:o=>t(o.target.value),onBlur:o=>a(o.target.value),onKeyDown:o=>{o.key==="Enter"&&a(o.currentTarget.value)},className:"h-8 w-[50px] text-center"}),e.jsx("span",{children:r("table.pagination.pageOf",{total:s.getPageCount()})})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(L,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(0),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:r("table.pagination.firstPage")}),e.jsx(Hc,{className:"h-4 w-4"})]}),e.jsxs(L,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.previousPage(),disabled:!s.getCanPreviousPage(),children:[e.jsx("span",{className:"sr-only",children:r("table.pagination.previousPage")}),e.jsx(Kc,{className:"h-4 w-4"})]}),e.jsxs(L,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>s.nextPage(),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:r("table.pagination.nextPage")}),e.jsx(Ur,{className:"h-4 w-4"})]}),e.jsxs(L,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>s.setPageIndex(s.getPageCount()-1),disabled:!s.getCanNextPage(),children:[e.jsx("span",{className:"sr-only",children:r("table.pagination.lastPage")}),e.jsx(Bc,{className:"h-4 w-4"})]})]})]})]})}function ns({table:s,toolbar:n,draggable:t=!1,onDragStart:r,onDragEnd:a,onDragOver:o,onDragLeave:l,onDrop:d,showPagination:x=!0,isLoading:u=!1}){const{t:i}=O("common"),c=m.useRef(null),p=s.getAllColumns().filter(F=>F.getIsPinned()==="left"),P=s.getAllColumns().filter(F=>F.getIsPinned()==="right"),T=F=>p.slice(0,F).reduce((w,V)=>w+(V.getSize()??0),0),C=F=>P.slice(F+1).reduce((w,V)=>w+(V.getSize()??0),0);return e.jsxs("div",{className:"space-y-4",children:[typeof n=="function"?n(s):n,e.jsx("div",{ref:c,className:"relative overflow-auto rounded-md border bg-card",children:e.jsx("div",{className:"overflow-auto",children:e.jsxs(An,{children:[e.jsx(qn,{children:s.getHeaderGroups().map(F=>e.jsx(Qs,{className:"hover:bg-transparent",children:F.headers.map((w,V)=>{const y=w.column.getIsPinned()==="left",N=w.column.getIsPinned()==="right",S=y?T(p.indexOf(w.column)):void 0,M=N?C(P.indexOf(w.column)):void 0;return e.jsx(Hn,{colSpan:w.colSpan,style:{width:w.getSize(),...y&&{left:S},...N&&{right:M}},className:_("h-11 bg-card px-4 text-muted-foreground",(y||N)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",y&&"before:right-0",N&&"before:left-0"]),children:w.isPlaceholder?null:Sa(w.column.columnDef.header,w.getContext())},w.id)})},F.id))}),e.jsx(Un,{children:s.getRowModel().rows?.length?s.getRowModel().rows.map((F,w)=>e.jsx(Qs,{"data-state":F.getIsSelected()&&"selected",className:"hover:bg-muted/50",draggable:t,onDragStart:V=>r?.(V,w),onDragEnd:a,onDragOver:o,onDragLeave:l,onDrop:V=>d?.(V,w),children:F.getVisibleCells().map((V,y)=>{const N=V.column.getIsPinned()==="left",S=V.column.getIsPinned()==="right",M=N?T(p.indexOf(V.column)):void 0,E=S?C(P.indexOf(V.column)):void 0;return e.jsx(Pt,{style:{width:V.column.getSize(),...N&&{left:M},...S&&{right:E}},className:_("bg-card",(N||S)&&["sticky z-20","before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-border",N&&"before:right-0",S&&"before:left-0"]),children:Sa(V.column.columnDef.cell,V.getContext())},V.id)})},F.id)):e.jsx(Qs,{children:e.jsx(Pt,{colSpan:s.getAllColumns().length,className:"h-24 text-center",children:i("table.noData")})})})]})})}),x&&e.jsx(mi,{table:s})]})}const _a=s=>{if(!s)return"";let n;if(typeof s=="string"){if(n=parseInt(s),isNaN(n))return s}else n=s;return(n.toString().length===10?new Date(n*1e3):new Date(n)).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})},Ut=_l(),Ht=_l();function ga({data:s,isLoading:n,searchKeyword:t,selectedLevel:r,total:a,currentPage:o,pageSize:l,onViewDetail:d,onPageChange:x,onPageSizeChange:u}){const{t:i}=O(),c=T=>{switch(T.toLowerCase()){case"info":return e.jsx(Gt,{className:"h-4 w-4 text-blue-500"});case"warning":return e.jsx(Wt,{className:"h-4 w-4 text-yellow-500"});case"error":return e.jsx(_n,{className:"h-4 w-4 text-red-500"});default:return e.jsx(Gt,{className:"h-4 w-4 text-slate-500"})}},p=m.useMemo(()=>[Ut.accessor("level",{id:"level",header:()=>i("dashboard:systemLog.level"),size:80,cell:({getValue:T,row:C})=>{const F=T();return e.jsxs("div",{className:"flex items-center gap-1",children:[c(F),e.jsx("span",{className:_(F.toLowerCase()==="error"&&"text-red-600",F.toLowerCase()==="warning"&&"text-yellow-600",F.toLowerCase()==="info"&&"text-blue-600"),children:F})]})}}),Ut.accessor("created_at",{id:"created_at",header:()=>i("dashboard:systemLog.time"),size:160,cell:({getValue:T})=>_a(T())}),Ut.accessor(T=>T.title||T.message||"",{id:"title",header:()=>i("dashboard:systemLog.logTitle"),cell:({getValue:T})=>e.jsx("span",{className:"inline-block max-w-[300px] truncate",children:T()})}),Ut.accessor("method",{id:"method",header:()=>i("dashboard:systemLog.method"),size:100,cell:({getValue:T})=>{const C=T();return C?e.jsx(K,{variant:"outline",className:_(C==="GET"&&"border-blue-200 bg-blue-50 text-blue-700",C==="POST"&&"border-green-200 bg-green-50 text-green-700",C==="PUT"&&"border-amber-200 bg-amber-50 text-amber-700",C==="DELETE"&&"border-red-200 bg-red-50 text-red-700"),children:C}):null}}),Ut.display({id:"actions",header:()=>i("dashboard:systemLog.action"),size:80,cell:({row:T})=>e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>d(T.original),"aria-label":i("dashboard:systemLog.viewDetail"),children:e.jsx(bn,{className:"h-4 w-4"})})})],[i,d]),P=We({data:s,columns:p,getCoreRowModel:Ye(),getPaginationRowModel:ss(),pageCount:Math.ceil(a/l),manualPagination:!0,state:{pagination:m.useMemo(()=>({pageIndex:o-1,pageSize:l}),[o,l])},onPaginationChange:T=>{let C,F;if(typeof T=="function"){const w=T({pageIndex:o-1,pageSize:l});C=w.pageIndex,F=w.pageSize}else C=T.pageIndex,F=T.pageSize;F!==l?u(F):x(C+1)}});return e.jsxs("div",{className:"overflow-x-auto",children:[e.jsx(ns,{table:P,showPagination:!0,isLoading:n}),(t||r&&r!=="all")&&e.jsx("div",{className:"text-center text-sm text-muted-foreground",children:t&&r&&r!=="all"?i("dashboard:systemLog.filter.searchAndLevel",{keyword:t,level:r,count:a}):t?i("dashboard:systemLog.filter.searchOnly",{keyword:t,count:a}):i("dashboard:systemLog.filter.levelOnly",{level:r,count:a})})]})}function Ym(){const{t:s}=O(),[n,t]=m.useState(0),[r,a]=m.useState(!1),[o,l]=m.useState(1),[d]=m.useState(10),[x,u]=m.useState(null),[i,c]=m.useState(!1),[p,P]=m.useState(!1),[T,C]=m.useState(1),[F,w]=m.useState(10),[V,y]=m.useState(null),[N,S]=m.useState(!1),[M,E]=m.useState(""),[g,k]=m.useState(""),[W,te]=m.useState("all"),[ae,B]=m.useState(!1),[se,fe]=m.useState(0),[cs,Me]=m.useState("all"),[re,ks]=m.useState(1e3),[_s,ot]=m.useState(!1),[Es,ct]=m.useState(null),[dt,mt]=m.useState(!1);m.useEffect(()=>{const Y=setTimeout(()=>{k(M),M!==g&&C(1)},500);return()=>clearTimeout(Y)},[M]);const{data:H,isLoading:U,refetch:be,isRefetching:Oe}=ne({queryKey:["systemStatus",n],queryFn:async()=>(await ve.getSystemStatus()).data,refetchInterval:3e4}),{data:ye,isLoading:Bi,refetch:op,isRefetching:Jn}=ne({queryKey:["queueStats",n],queryFn:async()=>(await ve.getQueueStats()).data,refetchInterval:3e4}),{data:Qn,isLoading:Gi,refetch:Wi}=ne({queryKey:["failedJobs",o,d],queryFn:async()=>{const Y=await ve.getHorizonFailedJobs({current:o,page_size:d});return{data:Y.data,total:Y.total||0}},enabled:r}),{data:Xn,isLoading:ra,refetch:Yi}=ne({queryKey:["systemLogs",T,F,W,g],queryFn:async()=>{const Y={current:T,page_size:F};W&&W!=="all"&&(Y.level=W),g.trim()&&(Y.keyword=g.trim());const Vs=await ve.getSystemLog(Y);return{data:Vs.data,total:Vs.total||0}},enabled:p}),Zn=Qn?.data||[],Ji=Qn?.total||0,la=Xn?.data||[],ia=Xn?.total||0,Qi=m.useMemo(()=>[Ht.display({id:"failed_at",header:()=>s("dashboard:queue.details.time"),cell:({row:Y})=>_a(Y.original.failed_at)}),Ht.display({id:"queue",header:()=>s("dashboard:queue.details.queue"),cell:({row:Y})=>Y.original.queue}),Ht.display({id:"name",header:()=>s("dashboard:queue.details.name"),cell:({row:Y})=>e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx("span",{className:"inline-block max-w-[150px] truncate",children:Y.original.name})}),e.jsx(ce,{children:e.jsx("span",{children:Y.original.name})})]})})}),Ht.display({id:"exception",header:()=>s("dashboard:queue.details.exception"),cell:({row:Y})=>e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx("span",{className:"inline-block max-w-[200px] truncate",children:Y.original.exception.split(` +`)[0]})}),e.jsx(ce,{className:"max-w-[300px] whitespace-pre-wrap",children:e.jsx("span",{children:Y.original.exception})})]})})}),Ht.display({id:"actions",header:()=>s("dashboard:queue.details.action"),size:80,cell:({row:Y})=>e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>so(Y.original),"aria-label":s("dashboard:queue.details.viewDetail"),children:e.jsx(bn,{className:"h-4 w-4"})})})],[s]),er=We({data:Zn,columns:Qi,getCoreRowModel:Ye(),getPaginationRowModel:ss(),pageCount:Math.ceil(Ji/d),manualPagination:!0,state:{pagination:{pageIndex:o-1,pageSize:d}},onPaginationChange:Y=>{if(typeof Y=="function"){const Vs=Y({pageIndex:o-1,pageSize:d});sr(Vs.pageIndex+1)}else sr(Y.pageIndex+1)}}),Xi=()=>{t(Y=>Y+1)},sr=Y=>{l(Y)},oa=Y=>{C(Y)},ca=Y=>{w(Y),C(1)},Zi=Y=>{te(Y),C(1)},eo=()=>{E(""),k(""),te("all"),C(1)},da=Y=>{y(Y),S(!0)},so=Y=>{u(Y),c(!0)},to=async()=>{try{const Y=await ve.getLogClearStats({days:se,level:cs==="all"?void 0:cs});ct(Y.data),mt(!0)}catch(Y){console.error("Failed to get clear stats:",Y),$.error(s("dashboard:systemLog.getStatsFailed"))}},ao=async()=>{ot(!0);try{const{data:Y}=await ve.clearSystemLog({days:se,level:cs==="all"?void 0:cs,limit:re});Y&&($.success(s("dashboard:systemLog.clearSuccess",{count:Y.cleared_count}),{duration:3e3}),B(!1),mt(!1),ct(null),be())}catch(Y){console.error("Failed to clear logs:",Y),$.error(s("dashboard:systemLog.clearLogsFailed"))}finally{ot(!1)}};if(U||Bi)return e.jsx("div",{className:"flex items-center justify-center p-6",children:e.jsx(ka,{className:"h-6 w-6 animate-spin"})});const no=Y=>Y?e.jsx(Nl,{className:"h-5 w-5 text-green-500"}):e.jsx(wl,{className:"h-5 w-5 text-red-500"});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(Se,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Ve,{className:"flex items-center gap-2",children:[e.jsx(Gc,{className:"h-5 w-5"}),s("dashboard:queue.title")]}),e.jsx(Xs,{children:s("dashboard:queue.status.description")})]}),e.jsx(G,{variant:"outline",size:"icon",onClick:Xi,disabled:Oe||Jn,children:e.jsx(rn,{className:_("h-4 w-4",(Oe||Jn)&&"animate-spin")})})]}),e.jsx(Fe,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[no(ye?.status||!1),e.jsx("span",{className:"font-medium",children:s("dashboard:queue.status.running")})]}),e.jsx(K,{variant:ye?.status?"secondary":"destructive",children:ye?.status?s("dashboard:queue.status.normal"):s("dashboard:queue.status.abnormal")})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.status.waitTime",{seconds:ye?.wait?.default||0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.recentJobs")}),e.jsx("p",{className:"text-2xl font-bold",children:ye?.recentJobs||0}),e.jsx(ya,{value:(ye?.recentJobs||0)/(ye?.periods?.recentJobs||1)*100,className:"h-1"})]})}),e.jsx(ce,{children:e.jsx("p",{children:s("dashboard:queue.details.statisticsPeriod",{hours:ye?.periods?.recentJobs||0})})})]})}),e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.jobsPerMinute")}),e.jsx("p",{className:"text-2xl font-bold",children:ye?.jobsPerMinute||0}),e.jsx(ya,{value:(ye?.jobsPerMinute||0)/(ye?.queueWithMaxThroughput?.throughput||1)*100,className:"h-1"})]})}),e.jsx(ce,{children:e.jsx("p",{children:s("dashboard:queue.details.maxThroughput",{value:ye?.queueWithMaxThroughput?.throughput||0})})})]})})]})]})})]}),e.jsxs(Se,{children:[e.jsxs(De,{children:[e.jsxs(Ve,{className:"flex items-center gap-2",children:[e.jsx(Wc,{className:"h-5 w-5"}),s("dashboard:queue.jobDetails")]}),e.jsx(Xs,{children:s("dashboard:queue.details.description")})]}),e.jsx(Fe,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.failedJobs7Days")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"cursor-pointer text-2xl font-bold text-destructive hover:underline",title:s("dashboard:queue.details.viewFailedJobs"),onClick:()=>a(!0),style:{userSelect:"none"},children:ye?.failedJobs||0}),e.jsx(bn,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-destructive",onClick:()=>a(!0),"aria-label":s("dashboard:queue.details.viewFailedJobs")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("dashboard:queue.details.retentionPeriod",{hours:ye?.periods?.failedJobs||0})})]}),e.jsxs("div",{className:"space-y-2 rounded-lg bg-muted/50 p-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.longestRunningQueue")}),e.jsxs("p",{className:"text-2xl font-bold",children:[ye?.queueWithMaxRuntime?.runtime||0,"s"]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:ye?.queueWithMaxRuntime?.name||"N/A"})]})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:s("dashboard:queue.details.activeProcesses")}),e.jsxs("span",{className:"font-medium",children:[ye?.processes||0," /"," ",(ye?.processes||0)+(ye?.pausedMasters||0)]})]}),e.jsx(ya,{value:(ye?.processes||0)/((ye?.processes||0)+(ye?.pausedMasters||0))*100,className:"mt-2 h-1"})]})]})})]})]}),e.jsxs(Se,{children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Ve,{className:"flex items-center gap-2",children:[e.jsx(yn,{className:"h-5 w-5"}),s("dashboard:systemLog.title")]}),e.jsx(Xs,{children:s("dashboard:systemLog.description")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(G,{variant:"outline",onClick:()=>P(!0),children:s("dashboard:systemLog.viewAll")}),e.jsxs(G,{variant:"outline",onClick:()=>B(!0),className:"text-destructive hover:text-destructive",children:[e.jsx(ms,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.clearLogs")]})]})]}),e.jsx(Fe,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2 rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-900 dark:bg-blue-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gt,{className:"h-5 w-5 text-blue-500"}),e.jsx("p",{className:"font-medium text-blue-700 dark:text-blue-300",children:s("dashboard:systemLog.tabs.info")})]}),e.jsx("p",{className:"text-2xl font-bold text-blue-700 dark:text-blue-300",children:H?.logs?.info||0})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-900 dark:bg-yellow-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wt,{className:"h-5 w-5 text-yellow-500"}),e.jsx("p",{className:"font-medium text-yellow-700 dark:text-yellow-300",children:s("dashboard:systemLog.tabs.warning")})]}),e.jsx("p",{className:"text-2xl font-bold text-yellow-700 dark:text-yellow-300",children:H?.logs?.warning||0})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-900 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_n,{className:"h-5 w-5 text-red-500"}),e.jsx("p",{className:"font-medium text-red-700 dark:text-red-300",children:s("dashboard:systemLog.tabs.error")})]}),e.jsx("p",{className:"text-2xl font-bold text-red-700 dark:text-red-300",children:H?.logs?.error||0})]})]}),H?.logs&&H.logs.total>0&&e.jsxs("div",{className:"mt-3 text-center text-sm text-muted-foreground",children:[s("dashboard:systemLog.totalLogs"),": ",H.logs.total]})]})})]}),e.jsx(de,{open:r,onOpenChange:a,children:e.jsxs(oe,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(ge,{children:e.jsx(me,{children:s("dashboard:queue.details.failedJobsDetailTitle")})}),e.jsxs("div",{className:"overflow-x-auto",children:[e.jsx(ns,{table:er,showPagination:!1,isLoading:Gi}),e.jsx(mi,{table:er}),Zn.length===0&&e.jsx("div",{className:"py-8 text-center text-muted-foreground",children:s("dashboard:queue.details.noFailedJobs")})]}),e.jsxs(Ie,{children:[e.jsxs(G,{variant:"outline",onClick:()=>Wi(),children:[e.jsx(rn,{className:"mr-2 h-4 w-4"}),s("dashboard:common.refresh")]}),e.jsx(Zs,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common:close")})})]})]})}),e.jsx(de,{open:i,onOpenChange:c,children:e.jsxs(oe,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(ge,{children:e.jsx(me,{children:s("dashboard:queue.details.jobDetailTitle")})}),x&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.id")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:x.id})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.time")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:x.failed_at})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.queue")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:x.queue})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.connection")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:x.connection})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.name")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:x.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.exception")}),e.jsx("div",{className:"max-h-[200px] overflow-y-auto rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-red-700 dark:text-red-300",children:x.exception})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:queue.details.payload")}),e.jsx("div",{className:"max-h-[200px] overflow-y-auto rounded-md bg-muted/50 p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs",children:(()=>{try{return JSON.stringify(JSON.parse(x.payload),null,2)}catch{return x.payload}})()})})]})]}),e.jsx(Ie,{children:e.jsx(G,{variant:"outline",onClick:()=>c(!1),children:s("common:close")})})]})}),e.jsx(de,{open:p,onOpenChange:P,children:e.jsxs(oe,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(ge,{children:e.jsx(me,{children:s("dashboard:systemLog.title")})}),e.jsxs(bt,{value:W,onValueChange:Zi,className:"w-full overflow-x-auto",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-2 p-1 md:flex-row md:items-center md:justify-between",children:[e.jsxs(rt,{className:"grid w-auto grid-cols-4",children:[e.jsxs(Be,{value:"all",className:"flex items-center gap-2",children:[e.jsx(yn,{className:"h-4 w-4"}),s("dashboard:systemLog.tabs.all")]}),e.jsxs(Be,{value:"info",className:"flex items-center gap-2",children:[e.jsx(Gt,{className:"h-4 w-4 text-blue-500"}),s("dashboard:systemLog.tabs.info")]}),e.jsxs(Be,{value:"warning",className:"flex items-center gap-2",children:[e.jsx(Wt,{className:"h-4 w-4 text-yellow-500"}),s("dashboard:systemLog.tabs.warning")]}),e.jsxs(Be,{value:"error",className:"flex items-center gap-2",children:[e.jsx(_n,{className:"h-4 w-4 text-red-500"}),s("dashboard:systemLog.tabs.error")]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Rn,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(D,{placeholder:s("dashboard:systemLog.search"),value:M,onChange:Y=>E(Y.target.value),className:"w-full md:w-64"})]})]}),e.jsx(bs,{value:"all",className:"mt-0",children:e.jsx(ga,{data:la,isLoading:ra,searchKeyword:g,selectedLevel:W,total:ia,currentPage:T,pageSize:F,onViewDetail:da,onPageChange:oa,onPageSizeChange:ca})}),e.jsx(bs,{value:"info",className:"mt-0 overflow-x-auto",children:e.jsx(ga,{data:la,isLoading:ra,searchKeyword:g,selectedLevel:W,total:ia,currentPage:T,pageSize:F,onViewDetail:da,onPageChange:oa,onPageSizeChange:ca})}),e.jsx(bs,{value:"warning",className:"mt-0",children:e.jsx(ga,{data:la,isLoading:ra,searchKeyword:g,selectedLevel:W,total:ia,currentPage:T,pageSize:F,onViewDetail:da,onPageChange:oa,onPageSizeChange:ca})}),e.jsx(bs,{value:"error",className:"mt-0",children:e.jsx(ga,{data:la,isLoading:ra,searchKeyword:g,selectedLevel:W,total:ia,currentPage:T,pageSize:F,onViewDetail:da,onPageChange:oa,onPageSizeChange:ca})})]}),e.jsxs(Ie,{children:[e.jsxs(G,{variant:"outline",onClick:()=>Yi(),children:[e.jsx(rn,{className:"mr-2 h-4 w-4"}),s("dashboard:common.refresh")]}),e.jsx(G,{variant:"outline",onClick:eo,children:s("dashboard:systemLog.filter.reset")}),e.jsx(Zs,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common:close")})})]})]})}),e.jsx(de,{open:N,onOpenChange:S,children:e.jsxs(oe,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(ge,{children:e.jsx(me,{children:s("dashboard:systemLog.detailTitle")})}),V&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.level")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Gt,{className:"h-4 w-4"}),e.jsx("p",{className:"font-medium",children:V.level})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.time")}),e.jsx("p",{children:_a(V.created_at)||_a(V.updated_at)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.logTitle")}),e.jsx("div",{className:"whitespace-pre-wrap rounded-md bg-muted/50 p-3",children:V.title||V.message||""})]}),(V.host||V.ip)&&e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[V.host&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.host")}),e.jsx("p",{className:"break-all rounded-md bg-muted/50 p-2 text-sm",children:V.host})]}),V.ip&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.ip")}),e.jsx("p",{className:"rounded-md bg-muted/50 p-2 text-sm",children:V.ip})]})]}),V.uri&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.uri")}),e.jsx("div",{className:"overflow-x-auto rounded-md bg-muted/50 p-3",children:e.jsx("code",{className:"text-sm",children:V.uri})})]}),V.method&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.method")}),e.jsx("div",{children:e.jsx(K,{variant:"outline",className:"text-base font-medium",children:V.method})})]}),V.data&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.requestData")}),e.jsx("div",{className:"max-h-[150px] overflow-y-auto rounded-md bg-muted/50 p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs",children:(()=>{try{return JSON.stringify(JSON.parse(V.data),null,2)}catch{return V.data}})()})})]}),V.context&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:s("dashboard:systemLog.exception")}),e.jsx("div",{className:"max-h-[250px] overflow-y-auto rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-xs text-red-700 dark:text-red-300",children:(()=>{try{const Y=JSON.parse(V.context);if(Y.exception){const Vs=Y.exception,_t=Vs["\0*\0message"]||"",ro=Vs["\0*\0file"]||"",lo=Vs["\0*\0line"]||"";return`${_t} -File: ${no} -Line: ${ro}`}return JSON.stringify(B,null,2)}catch{return E.context}})()})})]})]}),e.jsx(Ie,{children:e.jsx(et,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common:close")})})})]})}),e.jsx(me,{open:ae,onOpenChange:H,children:e.jsxs(ce,{className:"max-w-2xl",children:[e.jsx(pe,{children:e.jsxs(ue,{className:"flex items-center gap-2",children:[e.jsx(us,{className:"h-5 w-5 text-destructive"}),s("dashboard:systemLog.clearLogs")]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{htmlFor:"clearDays",children:s("dashboard:systemLog.clearDays")}),e.jsx(k,{id:"clearDays",type:"number",min:"0",max:"365",value:ee,onChange:B=>{const Vs=B.target.value;if(Vs==="")je(0);else{const _t=parseInt(Vs);!isNaN(_t)&&_t>=0&&_t<=365&&je(_t)}},placeholder:"0"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearDaysDesc")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{htmlFor:"clearLevel",children:s("dashboard:systemLog.clearLevel")}),e.jsxs(J,{value:ds,onValueChange:Me,children:[e.jsx(W,{children:e.jsx(Q,{})}),e.jsxs(Y,{children:[e.jsx(A,{value:"all",children:s("dashboard:systemLog.tabs.all")}),e.jsx(A,{value:"info",children:s("dashboard:systemLog.tabs.info")}),e.jsx(A,{value:"warning",children:s("dashboard:systemLog.tabs.warning")}),e.jsx(A,{value:"error",children:s("dashboard:systemLog.tabs.error")})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{htmlFor:"clearLimit",children:s("dashboard:systemLog.clearLimit")}),e.jsx(k,{id:"clearLimit",type:"number",min:"100",max:"10000",value:le,onChange:B=>Ts(parseInt(B.target.value)||1e3),placeholder:"1000"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearLimitDesc")})]})]}),e.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-900 dark:bg-amber-950/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(En,{className:"h-5 w-5 text-amber-600"}),e.jsx("span",{className:"font-medium text-amber-800 dark:text-amber-200",children:s("dashboard:systemLog.clearPreview")})]}),e.jsxs(G,{variant:"outline",size:"sm",onClick:so,disabled:Ns,children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.getStats")]})]}),yt&&Us&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.cutoffDate")}),e.jsx("p",{className:"font-mono text-sm",children:Us.cutoff_date})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.totalLogs")}),e.jsx("p",{className:"font-mono text-sm font-medium",children:Us.total_logs.toLocaleString()})]})]}),e.jsxs("div",{className:"rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wt,{className:"h-4 w-4 text-red-600"}),e.jsxs("span",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:[s("dashboard:systemLog.willClear"),":",e.jsx("span",{className:"ml-1 font-bold",children:Us.logs_to_clear.toLocaleString()}),s("dashboard:systemLog.logsUnit")]})]}),e.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-300",children:s("dashboard:systemLog.clearWarning")})]})]})]})]}),e.jsxs(Ie,{children:[e.jsx(G,{variant:"outline",onClick:()=>{H(!1),U(!1),Ys(null)},children:s("common:cancel")}),e.jsx(G,{variant:"destructive",onClick:to,disabled:Ns||!yt||!Us,children:Ns?e.jsxs(e.Fragment,{children:[e.jsx(Sa,{className:"mr-2 h-4 w-4 animate-spin"}),s("dashboard:systemLog.clearing")]}):e.jsxs(e.Fragment,{children:[e.jsx(us,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.confirmClear")]})})]})]})})]})}function Wm(){const{t:s}=M();return e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:s("dashboard:title")})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(cs,{}),e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsx(We,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(qm,{}),e.jsx(Mm,{}),e.jsx(Hm,{}),e.jsx(Gm,{})]})})})]})}const Ym=Object.freeze(Object.defineProperty({__proto__:null,default:Wm},Symbol.toStringTag,{value:"Module"}));function Jm({className:s,items:n,...t}){const{pathname:r}=Tn(),a=Gs(),[i,l]=u.useState(r??"/settings"),d=m=>{l(m),a(m)},{t:x}=M("settings");return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(J,{value:i,onValueChange:d,children:[e.jsx(W,{className:"h-12 sm:w-48",children:e.jsx(Q,{placeholder:"Theme"})}),e.jsx(Y,{children:n.map(m=>e.jsx(A,{value:m.href,children:e.jsxs("div",{className:"flex gap-x-4 px-2 py-1",children:[e.jsx("span",{className:"scale-125",children:m.icon}),e.jsx("span",{className:"text-md",children:x(m.title)})]})},m.href))})]})}),e.jsx("div",{className:"hidden w-full overflow-x-auto bg-background px-1 py-2 md:block",children:e.jsx("nav",{className:N("flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",s),...t,children:n.map(m=>e.jsxs(tt,{to:m.href,className:N(It({variant:"ghost"}),r===m.href?"bg-muted hover:bg-muted":"hover:bg-transparent hover:underline","justify-start"),children:[e.jsx("span",{className:"mr-2",children:m.icon}),x(m.title)]},m.href))})})]})}const Qm=[{title:"site.title",key:"site",icon:e.jsx(Wc,{size:18}),href:"/config/system",description:"site.description"},{title:"safe.title",key:"safe",icon:e.jsx(sl,{size:18}),href:"/config/system/safe",description:"safe.description"},{title:"subscribe.title",key:"subscribe",icon:e.jsx(tl,{size:18}),href:"/config/system/subscribe",description:"subscribe.description"},{title:"invite.title",key:"invite",icon:e.jsx(Yc,{size:18}),href:"/config/system/invite",description:"invite.description"},{title:"server.title",key:"server",icon:e.jsx(el,{size:18}),href:"/config/system/server",description:"server.description"},{title:"email.title",key:"email",icon:e.jsx(Jc,{size:18}),href:"/config/system/email",description:"email.description"},{title:"telegram.title",key:"telegram",icon:e.jsx(Qc,{size:18}),href:"/config/system/telegram",description:"telegram.description"},{title:"app.title",key:"app",icon:e.jsx(Zr,{size:18}),href:"/config/system/app",description:"app.description"},{title:"subscribe_template.title",key:"subscribe_template",icon:e.jsx(Xc,{size:18}),href:"/config/system/subscribe-template",description:"subscribe_template.description"}];function Xm(){const{t:s}=M("settings");return e.jsxs(Ae,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:s("title")}),e.jsx("div",{className:"text-muted-foreground",children:s("description")})]}),e.jsx(Ee,{className:"my-6"}),e.jsxs("div",{className:"flex flex-1 flex-col space-y-8 overflow-auto lg:flex-row lg:space-x-12 lg:space-y-0",children:[e.jsx("aside",{className:"sticky top-0 lg:w-1/5",children:e.jsx(Jm,{items:Qm})}),e.jsx("div",{className:"flex-1 w-full p-1 pr-4",children:e.jsx("div",{className:"pb-16",children:e.jsx(Dn,{})})})]})]})]})}const Zm=Object.freeze(Object.defineProperty({__proto__:null,default:Xm},Symbol.toStringTag,{value:"Module"})),X=u.forwardRef(({className:s,...n},t)=>e.jsx(wl,{className:N("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...n,ref:t,children:e.jsx(Zc,{className:N("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));X.displayName=wl.displayName;const Es=u.forwardRef(({className:s,...n},t)=>e.jsx("textarea",{className:N("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:t,...n}));Es.displayName="Textarea";const eu=h.object({logo:h.string().nullable().default(""),force_https:h.number().nullable().default(0),stop_register:h.number().nullable().default(0),app_name:h.string().nullable().default(""),app_description:h.string().nullable().default(""),app_url:h.string().nullable().default(""),subscribe_url:h.string().nullable().default(""),try_out_plan_id:h.number().nullable().default(0),try_out_hour:h.coerce.number().nullable().default(0),tos_url:h.string().nullable().default(""),currency:h.string().nullable().default(""),currency_symbol:h.string().nullable().default("")});function su(){const{t:s}=M("settings"),[n,t]=u.useState(!1),r=u.useRef(null),{data:a}=re({queryKey:["settings","site"],queryFn:()=>ye.getSettings("site")}),{data:i}=re({queryKey:["plans"],queryFn:()=>ys.getList()}),l=we({resolver:Te(eu),defaultValues:{},mode:"onBlur"}),{mutateAsync:d}=Os({mutationFn:ye.saveSettings,onSuccess:o=>{o.data&&z.success(s("common.autoSaved"))}});u.useEffect(()=>{if(a?.data?.site){const o=a?.data?.site;Object.entries(o).forEach(([c,f])=>{l.setValue(c,f)}),r.current=o}},[a]);const x=u.useCallback(Re.debounce(async o=>{if(!Re.isEqual(o,r.current)){t(!0);try{const c=Object.entries(o).reduce((f,[D,S])=>(f[D]=S===null?"":S,f),{});await d(c),r.current=o}finally{t(!1)}}},1e3),[d]),m=u.useCallback(o=>{x(o)},[x]);return u.useEffect(()=>{const o=l.watch(c=>{m(c)});return()=>o.unsubscribe()},[l.watch,m]),e.jsx(De,{...l,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:l.control,name:"app_name",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("site.form.siteName.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("site.form.siteName.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),m(l.getValues())}})}),e.jsx($,{children:s("site.form.siteName.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"app_description",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("site.form.siteDescription.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("site.form.siteDescription.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),m(l.getValues())}})}),e.jsx($,{children:s("site.form.siteDescription.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"app_url",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("site.form.siteUrl.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("site.form.siteUrl.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),m(l.getValues())}})}),e.jsx($,{children:s("site.form.siteUrl.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"force_https",render:({field:o})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("site.form.forceHttps.label")}),e.jsx($,{children:s("site.form.forceHttps.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:!!o.value,onCheckedChange:c=>{o.onChange(Number(c)),m(l.getValues())}})})]})}),e.jsx(v,{control:l.control,name:"logo",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("site.form.logo.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("site.form.logo.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),m(l.getValues())}})}),e.jsx($,{children:s("site.form.logo.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"subscribe_url",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("site.form.subscribeUrl.label")}),e.jsx(y,{children:e.jsx(Es,{placeholder:s("site.form.subscribeUrl.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),m(l.getValues())}})}),e.jsx($,{children:s("site.form.subscribeUrl.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"tos_url",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("site.form.tosUrl.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("site.form.tosUrl.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),m(l.getValues())}})}),e.jsx($,{children:s("site.form.tosUrl.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"stop_register",render:({field:o})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("site.form.stopRegister.label")}),e.jsx($,{children:s("site.form.stopRegister.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:!!o.value,onCheckedChange:c=>{o.onChange(Number(c)),m(l.getValues())}})})]})}),e.jsx(v,{control:l.control,name:"try_out_plan_id",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("site.form.tryOut.label")}),e.jsx(y,{children:e.jsxs(J,{value:o.value?.toString(),onValueChange:c=>{o.onChange(Number(c)),m(l.getValues())},children:[e.jsx(W,{children:e.jsx(Q,{placeholder:s("site.form.tryOut.placeholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("site.form.tryOut.placeholder")}),i?.data?.map(c=>e.jsx(A,{value:c.id.toString(),children:c.name},c.id.toString()))]})]})}),e.jsx($,{children:s("site.form.tryOut.description")}),e.jsx(P,{})]})}),!!l.watch("try_out_plan_id")&&e.jsx(v,{control:l.control,name:"try_out_hour",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"",children:s("site.form.tryOut.duration.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("site.form.tryOut.duration.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),m(l.getValues())}})}),e.jsx($,{children:s("site.form.tryOut.duration.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"currency",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("site.form.currency.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("site.form.currency.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),m(l.getValues())}})}),e.jsx($,{children:s("site.form.currency.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"currency_symbol",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("site.form.currencySymbol.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("site.form.currencySymbol.placeholder"),...o,value:o.value||"",onChange:c=>{o.onChange(c),m(l.getValues())}})}),e.jsx($,{children:s("site.form.currencySymbol.description")}),e.jsx(P,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("site.form.saving")})]})})}function tu(){const{t:s}=M("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("site.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("site.description")})]}),e.jsx(Ee,{}),e.jsx(su,{})]})}const au=Object.freeze(Object.defineProperty({__proto__:null,default:tu},Symbol.toStringTag,{value:"Module"})),nu=h.object({email_verify:h.boolean().nullable(),safe_mode_enable:h.boolean().nullable(),secure_path:h.string().nullable(),email_whitelist_enable:h.boolean().nullable(),email_whitelist_suffix:h.array(h.string().nullable()).nullable(),email_gmail_limit_enable:h.boolean().nullable(),captcha_enable:h.boolean().nullable(),captcha_type:h.string().nullable(),recaptcha_key:h.string().nullable(),recaptcha_site_key:h.string().nullable(),recaptcha_v3_secret_key:h.string().nullable(),recaptcha_v3_site_key:h.string().nullable(),recaptcha_v3_score_threshold:h.coerce.string().transform(s=>s===""?null:s).nullable(),turnstile_secret_key:h.string().nullable(),turnstile_site_key:h.string().nullable(),register_limit_by_ip_enable:h.boolean().nullable(),register_limit_count:h.coerce.string().transform(s=>s===""?null:s).nullable(),register_limit_expire:h.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_enable:h.boolean().nullable(),password_limit_count:h.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_expire:h.coerce.string().transform(s=>s===""?null:s).nullable()}),ru={email_verify:!1,safe_mode_enable:!1,secure_path:"",email_whitelist_enable:!1,email_whitelist_suffix:[],email_gmail_limit_enable:!1,captcha_enable:!1,captcha_type:"recaptcha",recaptcha_key:"",recaptcha_site_key:"",recaptcha_v3_secret_key:"",recaptcha_v3_site_key:"",recaptcha_v3_score_threshold:"0.5",turnstile_secret_key:"",turnstile_site_key:"",register_limit_by_ip_enable:!1,register_limit_count:"",register_limit_expire:"",password_limit_enable:!1,password_limit_count:"",password_limit_expire:""};function lu(){const{t:s}=M("settings"),[n,t]=u.useState(!1),[r,a]=u.useState(!1),i=u.useRef(null),l=we({resolver:Te(nu),defaultValues:ru,mode:"onBlur"}),{data:d}=re({queryKey:["settings","safe"],queryFn:()=>ye.getSettings("safe")}),{mutateAsync:x}=Os({mutationFn:ye.saveSettings,onSuccess:c=>{c.data&&z.success(s("common.autoSaved"))}});u.useEffect(()=>{if(d?.data.safe){const c=d.data.safe,f={};Object.entries(c).forEach(([D,S])=>{if(typeof S=="number"){const C=String(S);l.setValue(D,C),f[D]=C}else l.setValue(D,S),f[D]=S}),i.current=f,a(!0)}},[d]);const m=u.useCallback(Re.debounce(async c=>{if(!Re.isEqual(c,i.current)){t(!0);try{const f={...c,email_whitelist_suffix:c.email_whitelist_suffix?.filter(Boolean)||[]};await x(f),i.current=c}finally{t(!1)}}},1e3),[x]),o=u.useCallback(c=>{r&&m(c)},[m,r]);return u.useEffect(()=>{if(!r)return;const c=l.watch(f=>{o(f)});return()=>c.unsubscribe()},[l.watch,o,r]),e.jsx(De,{...l,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:l.control,name:"email_verify",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("safe.form.emailVerify.label")}),e.jsx($,{children:s("safe.form.emailVerify.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value||!1,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),e.jsx(v,{control:l.control,name:"email_gmail_limit_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("safe.form.gmailLimit.label")}),e.jsx($,{children:s("safe.form.gmailLimit.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value||!1,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),e.jsx(v,{control:l.control,name:"safe_mode_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("safe.form.safeMode.label")}),e.jsx($,{children:s("safe.form.safeMode.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value||!1,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),e.jsx(v,{control:l.control,name:"secure_path",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.securePath.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.securePath.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.securePath.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"email_whitelist_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("safe.form.emailWhitelist.label")}),e.jsx($,{children:s("safe.form.emailWhitelist.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value||!1,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),l.watch("email_whitelist_enable")&&e.jsx(v,{control:l.control,name:"email_whitelist_suffix",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.emailWhitelist.suffixes.label")}),e.jsx(y,{children:e.jsx(Es,{placeholder:s("safe.form.emailWhitelist.suffixes.placeholder"),...c,value:(c.value||[]).join(` -`),onChange:f=>{const D=f.target.value.split(` -`).filter(Boolean);c.onChange(D),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.emailWhitelist.suffixes.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"captcha_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.enable.label")}),e.jsx($,{children:s("safe.form.captcha.enable.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value||!1,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),l.watch("captcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"captcha_type",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.type.label")}),e.jsxs(J,{onValueChange:f=>{c.onChange(f),o(l.getValues())},value:c.value||"recaptcha",children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:s("safe.form.captcha.type.description")})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"recaptcha",children:s("safe.form.captcha.type.options.recaptcha")}),e.jsx(A,{value:"recaptcha-v3",children:s("safe.form.captcha.type.options.recaptcha-v3")}),e.jsx(A,{value:"turnstile",children:s("safe.form.captcha.type.options.turnstile")})]})]}),e.jsx($,{children:s("safe.form.captcha.type.description")}),e.jsx(P,{})]})}),l.watch("captcha_type")==="recaptcha"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"recaptcha_site_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.recaptcha.siteKey.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.captcha.recaptcha.siteKey.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.captcha.recaptcha.siteKey.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"recaptcha_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.recaptcha.key.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.captcha.recaptcha.key.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.captcha.recaptcha.key.description")}),e.jsx(P,{})]})})]}),l.watch("captcha_type")==="recaptcha-v3"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"recaptcha_v3_site_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.siteKey.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.captcha.recaptcha_v3.siteKey.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.captcha.recaptcha_v3.siteKey.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"recaptcha_v3_secret_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.secretKey.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.captcha.recaptcha_v3.secretKey.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.captcha.recaptcha_v3.secretKey.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"recaptcha_v3_score_threshold",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.scoreThreshold.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",step:"0.1",min:"0",max:"1",placeholder:s("safe.form.captcha.recaptcha_v3.scoreThreshold.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.captcha.recaptcha_v3.scoreThreshold.description")}),e.jsx(P,{})]})})]}),l.watch("captcha_type")==="turnstile"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"turnstile_site_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.turnstile.siteKey.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.captcha.turnstile.siteKey.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.captcha.turnstile.siteKey.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"turnstile_secret_key",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.captcha.turnstile.secretKey.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.captcha.turnstile.secretKey.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.captcha.turnstile.secretKey.description")}),e.jsx(P,{})]})})]})]}),e.jsx(v,{control:l.control,name:"register_limit_by_ip_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx($,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value||!1,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),l.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"register_limit_count",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.registerLimit.count.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.registerLimit.count.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.registerLimit.count.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"register_limit_expire",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.registerLimit.expire.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.registerLimit.expire.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.registerLimit.expire.description")}),e.jsx(P,{})]})})]}),e.jsx(v,{control:l.control,name:"password_limit_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("safe.form.passwordLimit.enable.label")}),e.jsx($,{children:s("safe.form.passwordLimit.enable.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value||!1,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),l.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"password_limit_count",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.passwordLimit.count.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.passwordLimit.count.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.passwordLimit.count.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"password_limit_expire",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("safe.form.passwordLimit.expire.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("safe.form.passwordLimit.expire.placeholder"),...c,value:c.value||"",onChange:f=>{c.onChange(f),o(l.getValues())}})}),e.jsx($,{children:s("safe.form.passwordLimit.expire.description")}),e.jsx(P,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("safe.form.saving")})]})})}function iu(){const{t:s}=M("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("safe.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("safe.description")})]}),e.jsx(Ee,{}),e.jsx(lu,{})]})}const ou=Object.freeze(Object.defineProperty({__proto__:null,default:iu},Symbol.toStringTag,{value:"Module"})),cu=h.object({plan_change_enable:h.boolean().nullable().default(!1),reset_traffic_method:h.coerce.number().nullable().default(0),surplus_enable:h.boolean().nullable().default(!1),new_order_event_id:h.coerce.number().nullable().default(0),renew_order_event_id:h.coerce.number().nullable().default(0),change_order_event_id:h.coerce.number().nullable().default(0),show_info_to_server_enable:h.boolean().nullable().default(!1),show_protocol_to_server_enable:h.boolean().nullable().default(!1),default_remind_expire:h.boolean().nullable().default(!1),default_remind_traffic:h.boolean().nullable().default(!1),subscribe_path:h.string().nullable().default("s")}),du={plan_change_enable:!1,reset_traffic_method:0,surplus_enable:!1,new_order_event_id:0,renew_order_event_id:0,change_order_event_id:0,show_info_to_server_enable:!1,show_protocol_to_server_enable:!1,default_remind_expire:!1,default_remind_traffic:!1,subscribe_path:"s"};function mu(){const{t:s}=M("settings"),[n,t]=u.useState(!1),r=u.useRef(null),a=we({resolver:Te(cu),defaultValues:du,mode:"onBlur"}),{data:i}=re({queryKey:["settings","subscribe"],queryFn:()=>ye.getSettings("subscribe")}),{mutateAsync:l}=Os({mutationFn:ye.saveSettings,onSuccess:m=>{m.data&&z.success(s("common.autoSaved"))}});u.useEffect(()=>{if(i?.data?.subscribe){const m=i?.data?.subscribe;Object.entries(m).forEach(([o,c])=>{a.setValue(o,c)}),r.current=m}},[i]);const d=u.useCallback(Re.debounce(async m=>{if(!Re.isEqual(m,r.current)){t(!0);try{await l(m),r.current=m}finally{t(!1)}}},1e3),[l]),x=u.useCallback(m=>{d(m)},[d]);return u.useEffect(()=>{const m=a.watch(o=>{x(o)});return()=>m.unsubscribe()},[a.watch,x]),e.jsx(De,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:a.control,name:"plan_change_enable",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("subscribe.plan_change_enable.title")}),e.jsx($,{children:s("subscribe.plan_change_enable.description")}),e.jsx(y,{children:e.jsx(X,{checked:m.value||!1,onCheckedChange:o=>{m.onChange(o),x(a.getValues())}})}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"reset_traffic_method",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("subscribe.reset_traffic_method.title")}),e.jsxs(J,{onValueChange:m.onChange,value:m.value?.toString()||"0",children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:"请选择重置方式"})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("subscribe.reset_traffic_method.options.monthly_first")}),e.jsx(A,{value:"1",children:s("subscribe.reset_traffic_method.options.monthly_reset")}),e.jsx(A,{value:"2",children:s("subscribe.reset_traffic_method.options.no_reset")}),e.jsx(A,{value:"3",children:s("subscribe.reset_traffic_method.options.yearly_first")}),e.jsx(A,{value:"4",children:s("subscribe.reset_traffic_method.options.yearly_reset")})]})]}),e.jsx($,{children:s("subscribe.reset_traffic_method.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"surplus_enable",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("subscribe.surplus_enable.title")}),e.jsx($,{children:s("subscribe.surplus_enable.description")}),e.jsx(y,{children:e.jsx(X,{checked:m.value||!1,onCheckedChange:o=>{m.onChange(o),x(a.getValues())}})}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"new_order_event_id",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("subscribe.new_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(y,{children:e.jsxs(J,{onValueChange:m.onChange,value:m.value?.toString(),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:"请选择"})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("subscribe.new_order_event.options.no_action")}),e.jsx(A,{value:"1",children:s("subscribe.new_order_event.options.reset_traffic")})]})]})})}),e.jsx($,{children:s("subscribe.new_order_event.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"renew_order_event_id",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("subscribe.renew_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(y,{children:e.jsxs(J,{onValueChange:m.onChange,value:m.value?.toString(),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:"请选择"})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("subscribe.renew_order_event.options.no_action")}),e.jsx(A,{value:"1",children:s("subscribe.renew_order_event.options.reset_traffic")})]})]})})}),e.jsx($,{children:s("subscribe.renew_order_event.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"change_order_event_id",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("subscribe.change_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(y,{children:e.jsxs(J,{onValueChange:m.onChange,value:m.value?.toString(),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:"请选择"})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("subscribe.change_order_event.options.no_action")}),e.jsx(A,{value:"1",children:s("subscribe.change_order_event.options.reset_traffic")})]})]})})}),e.jsx($,{children:s("subscribe.change_order_event.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"subscribe_path",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("subscribe.subscribe_path.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:"subscribe",...m,value:m.value||"",onChange:o=>{m.onChange(o),x(a.getValues())}})}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[s("subscribe.subscribe_path.description"),e.jsx("br",{}),s("subscribe.subscribe_path.current_format",{path:m.value||"s"}),e.jsx("br",{}),s("subscribe.subscribe_path.restart_tip")]}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"show_info_to_server_enable",render:({field:m})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("subscribe.show_info_to_server.title")}),e.jsx($,{children:s("subscribe.show_info_to_server.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:m.value||!1,onCheckedChange:o=>{m.onChange(o),x(a.getValues())}})})]})}),e.jsx(v,{control:a.control,name:"show_protocol_to_server_enable",render:({field:m})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("subscribe.show_protocol_to_server.title")}),e.jsx($,{children:s("subscribe.show_protocol_to_server.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:m.value||!1,onCheckedChange:o=>{m.onChange(o),x(a.getValues())}})})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function uu(){const{t:s}=M("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("subscribe.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("subscribe.description")})]}),e.jsx(Ee,{}),e.jsx(mu,{})]})}const xu=Object.freeze(Object.defineProperty({__proto__:null,default:uu},Symbol.toStringTag,{value:"Module"})),hu=h.object({invite_force:h.boolean().default(!1),invite_commission:h.coerce.string().default("0"),invite_gen_limit:h.coerce.string().default("0"),invite_never_expire:h.boolean().default(!1),commission_first_time_enable:h.boolean().default(!1),commission_auto_check_enable:h.boolean().default(!1),commission_withdraw_limit:h.coerce.string().default("0"),commission_withdraw_method:h.array(h.string()).default(["支付宝","USDT","Paypal"]),withdraw_close_enable:h.boolean().default(!1),commission_distribution_enable:h.boolean().default(!1),commission_distribution_l1:h.coerce.number().default(0),commission_distribution_l2:h.coerce.number().default(0),commission_distribution_l3:h.coerce.number().default(0)}),gu={invite_force:!1,invite_commission:"0",invite_gen_limit:"0",invite_never_expire:!1,commission_first_time_enable:!1,commission_auto_check_enable:!1,commission_withdraw_limit:"0",commission_withdraw_method:["支付宝","USDT","Paypal"],withdraw_close_enable:!1,commission_distribution_enable:!1,commission_distribution_l1:0,commission_distribution_l2:0,commission_distribution_l3:0};function pu(){const{t:s}=M("settings"),[n,t]=u.useState(!1),[r,a]=u.useState(!1),i=u.useRef(null),l=we({resolver:Te(hu),defaultValues:gu,mode:"onBlur"}),{data:d}=re({queryKey:["settings","invite"],queryFn:()=>ye.getSettings("invite")}),{mutateAsync:x}=Os({mutationFn:ye.saveSettings,onSuccess:c=>{c.data&&z.success(s("common.autoSaved"))}});u.useEffect(()=>{if(d?.data?.invite){const c=d?.data?.invite,f={};Object.entries(c).forEach(([D,S])=>{if(typeof S=="number"){const C=String(S);l.setValue(D,C),f[D]=C}else l.setValue(D,S),f[D]=S}),i.current=f,a(!0)}},[d]);const m=u.useCallback(Re.debounce(async c=>{if(!Re.isEqual(c,i.current)){t(!0);try{await x(c),i.current=c}finally{t(!1)}}},1e3),[x]),o=u.useCallback(c=>{r&&m(c)},[m,r]);return u.useEffect(()=>{if(!r)return;const c=l.watch(f=>{o(f)});return()=>c.unsubscribe()},[l.watch,o,r]),e.jsx(De,{...l,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:l.control,name:"invite_force",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("invite.invite_force.title")}),e.jsx($,{children:s("invite.invite_force.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),e.jsx(v,{control:l.control,name:"invite_commission",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("invite.invite_commission.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("invite.invite_commission.placeholder"),...c,value:c.value||""})}),e.jsx($,{children:s("invite.invite_commission.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"invite_gen_limit",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("invite.invite_gen_limit.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("invite.invite_gen_limit.placeholder"),...c,value:c.value||""})}),e.jsx($,{children:s("invite.invite_gen_limit.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"invite_never_expire",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("invite.invite_never_expire.title")}),e.jsx($,{children:s("invite.invite_never_expire.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),e.jsx(v,{control:l.control,name:"commission_first_time_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("invite.commission_first_time.title")}),e.jsx($,{children:s("invite.commission_first_time.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),e.jsx(v,{control:l.control,name:"commission_auto_check_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("invite.commission_auto_check.title")}),e.jsx($,{children:s("invite.commission_auto_check.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),e.jsx(v,{control:l.control,name:"commission_withdraw_limit",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("invite.commission_withdraw_limit.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("invite.commission_withdraw_limit.placeholder"),...c,value:c.value||""})}),e.jsx($,{children:s("invite.commission_withdraw_limit.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"commission_withdraw_method",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("invite.commission_withdraw_method.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("invite.commission_withdraw_method.placeholder"),...c,value:Array.isArray(c.value)?c.value.join(","):"",onChange:f=>{const D=f.target.value.split(",").filter(Boolean);c.onChange(D),o(l.getValues())}})}),e.jsx($,{children:s("invite.commission_withdraw_method.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"withdraw_close_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("invite.withdraw_close.title")}),e.jsx($,{children:s("invite.withdraw_close.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),e.jsx(v,{control:l.control,name:"commission_distribution_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("invite.commission_distribution.title")}),e.jsx($,{children:s("invite.commission_distribution.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value,onCheckedChange:f=>{c.onChange(f),o(l.getValues())}})})]})}),l.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(v,{control:l.control,name:"commission_distribution_l1",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{children:s("invite.commission_distribution.l1")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...c,value:c.value||"",onChange:f=>{const D=f.target.value?Number(f.target.value):0;c.onChange(D),o(l.getValues())}})}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"commission_distribution_l2",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{children:s("invite.commission_distribution.l2")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...c,value:c.value||"",onChange:f=>{const D=f.target.value?Number(f.target.value):0;c.onChange(D),o(l.getValues())}})}),e.jsx(P,{})]})}),e.jsx(v,{control:l.control,name:"commission_distribution_l3",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{children:s("invite.commission_distribution.l3")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...c,value:c.value||"",onChange:f=>{const D=f.target.value?Number(f.target.value):0;c.onChange(D),o(l.getValues())}})}),e.jsx(P,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("invite.saving")})]})})}function fu(){const{t:s}=M("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("invite.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("invite.description")})]}),e.jsx(Ee,{}),e.jsx(pu,{})]})}const ju=Object.freeze(Object.defineProperty({__proto__:null,default:fu},Symbol.toStringTag,{value:"Module"})),vu=h.object({frontend_theme:h.string().nullable(),frontend_theme_sidebar:h.string().nullable(),frontend_theme_header:h.string().nullable(),frontend_theme_color:h.string().nullable(),frontend_background_url:h.string().url().nullable()}),bu={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function yu(){const{data:s}=re({queryKey:["settings","frontend"],queryFn:()=>ye.getSettings("frontend")}),n=we({resolver:Te(vu),defaultValues:bu,mode:"onChange"});u.useEffect(()=>{if(s?.data?.frontend){const r=s?.data?.frontend;Object.entries(r).forEach(([a,i])=>{n.setValue(a,i)})}},[s]);function t(r){ye.saveSettings(r).then(({data:a})=>{a&&z.success("更新成功")})}return e.jsx(De,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(t),className:"space-y-8",children:[e.jsx(v,{control:n.control,name:"frontend_theme_sidebar",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:"边栏风格"}),e.jsx($,{children:"边栏风格"})]}),e.jsx(y,{children:e.jsx(X,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(v,{control:n.control,name:"frontend_theme_header",render:({field:r})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:"头部风格"}),e.jsx($,{children:"边栏风格"})]}),e.jsx(y,{children:e.jsx(X,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(v,{control:n.control,name:"frontend_theme_color",render:({field:r})=>e.jsxs(j,{children:[e.jsx(b,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(y,{children:e.jsxs("select",{className:N(It({variant:"outline"}),"w-[200px] appearance-none font-normal"),...r,children:[e.jsx("option",{value:"default",children:"默认"}),e.jsx("option",{value:"black",children:"黑色"}),e.jsx("option",{value:"blackblue",children:"暗蓝色"}),e.jsx("option",{value:"green",children:"奶绿色"})]})}),e.jsx(Rn,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx($,{children:"主题色"}),e.jsx(P,{})]})}),e.jsx(v,{control:n.control,name:"frontend_background_url",render:({field:r})=>e.jsxs(j,{children:[e.jsx(b,{children:"背景"}),e.jsx(y,{children:e.jsx(k,{placeholder:"请输入图片地址",...r})}),e.jsx($,{children:"将会在后台登录页面进行展示。"}),e.jsx(P,{})]})}),e.jsx(F,{type:"submit",children:"保存设置"})]})})}function _u(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"个性化设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"自定义系统界面外观,包括主题风格、布局、颜色方案、背景图等个性化选项。"})]}),e.jsx(Ee,{}),e.jsx(yu,{})]})}const Nu=Object.freeze(Object.defineProperty({__proto__:null,default:_u},Symbol.toStringTag,{value:"Module"})),wu=h.object({server_pull_interval:h.coerce.number().nullable(),server_push_interval:h.coerce.number().nullable(),server_token:h.string().nullable(),device_limit_mode:h.coerce.number().nullable()}),Cu={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function Su(){const{t:s}=M("settings"),[n,t]=u.useState(!1),r=u.useRef(null),a=we({resolver:Te(wu),defaultValues:Cu,mode:"onBlur"}),{data:i}=re({queryKey:["settings","server"],queryFn:()=>ye.getSettings("server")}),{mutateAsync:l}=Os({mutationFn:ye.saveSettings,onSuccess:o=>{o.data&&z.success(s("common.AutoSaved"))}});u.useEffect(()=>{if(i?.data.server){const o=i.data.server;Object.entries(o).forEach(([c,f])=>{a.setValue(c,f)}),r.current=o}},[i]);const d=u.useCallback(Re.debounce(async o=>{if(!Re.isEqual(o,r.current)){t(!0);try{await l(o),r.current=o}finally{t(!1)}}},1e3),[l]),x=u.useCallback(o=>{d(o)},[d]);u.useEffect(()=>{const o=a.watch(c=>{x(c)});return()=>o.unsubscribe()},[a.watch,x]);const m=()=>{const o=Math.floor(Math.random()*17)+16,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let f="";for(let D=0;De.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("server.server_token.title")}),e.jsx(y,{children:e.jsxs("div",{className:"relative",children:[e.jsx(k,{placeholder:s("server.server_token.placeholder"),...o,value:o.value||"",className:"pr-10"}),e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2",onClick:c=>{c.preventDefault(),m()},children:e.jsx(ed,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(de,{children:e.jsx("p",{children:s("server.server_token.generate_tooltip")})})]})})]})}),e.jsx($,{children:s("server.server_token.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"server_pull_interval",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("server.server_pull_interval.title")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:s("server.server_pull_interval.placeholder"),...o,value:o.value||"",onChange:c=>{const f=c.target.value?Number(c.target.value):null;o.onChange(f)}})}),e.jsx($,{children:s("server.server_pull_interval.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"server_push_interval",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("server.server_push_interval.title")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:s("server.server_push_interval.placeholder"),...o,value:o.value||"",onChange:c=>{const f=c.target.value?Number(c.target.value):null;o.onChange(f)}})}),e.jsx($,{children:s("server.server_push_interval.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"device_limit_mode",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("server.device_limit_mode.title")}),e.jsxs(J,{onValueChange:o.onChange,value:o.value?.toString()||"0",children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:s("server.device_limit_mode.placeholder")})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("server.device_limit_mode.strict")}),e.jsx(A,{value:"1",children:s("server.device_limit_mode.relaxed")})]})]}),e.jsx($,{children:s("server.device_limit_mode.description")}),e.jsx(P,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("server.saving")})]})})}function ku(){const{t:s}=M("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("server.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("server.description")})]}),e.jsx(Ee,{}),e.jsx(Su,{})]})}const Tu=Object.freeze(Object.defineProperty({__proto__:null,default:ku},Symbol.toStringTag,{value:"Module"}));function Du({open:s,onOpenChange:n,result:t}){const r=!t.error;return e.jsx(me,{open:s,onOpenChange:n,children:e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(pe,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r?e.jsx(_l,{className:"h-5 w-5 text-green-500"}):e.jsx(Nl,{className:"h-5 w-5 text-destructive"}),e.jsx(ue,{children:r?"邮件发送成功":"邮件发送失败"})]}),e.jsx($e,{children:r?"测试邮件已成功发送,请检查收件箱":"发送测试邮件时遇到错误"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"发送详情"}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2 text-sm",children:[e.jsx("div",{className:"text-muted-foreground",children:"收件地址"}),e.jsx("div",{children:t.email}),e.jsx("div",{className:"text-muted-foreground",children:"邮件主题"}),e.jsx("div",{children:t.subject}),e.jsx("div",{className:"text-muted-foreground",children:"模板名称"}),e.jsx("div",{children:t.template_name})]})]}),t.error&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium text-destructive",children:"错误信息"}),e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive break-all",children:t.error})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"配置信息"}),e.jsx(ht,{className:"h-[200px] rounded-md border p-4",children:e.jsx("div",{className:"grid gap-2 text-sm",children:e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2",children:[e.jsx("div",{className:"text-muted-foreground",children:"驱动"}),e.jsx("div",{children:t.config.driver}),e.jsx("div",{className:"text-muted-foreground",children:"服务器"}),e.jsx("div",{children:t.config.host}),e.jsx("div",{className:"text-muted-foreground",children:"端口"}),e.jsx("div",{children:t.config.port}),e.jsx("div",{className:"text-muted-foreground",children:"加密方式"}),e.jsx("div",{children:t.config.encryption||"无"}),e.jsx("div",{className:"text-muted-foreground",children:"发件人"}),e.jsx("div",{children:t.config.from.address?`${t.config.from.address}${t.config.from.name?` (${t.config.from.name})`:""}`:"未设置"}),e.jsx("div",{className:"text-muted-foreground",children:"用户名"}),e.jsx("div",{children:t.config.username||"未设置"})]})})})]})]})]})})}const Fu=h.object({email_template:h.string().nullable().default("classic"),email_host:h.string().nullable().default(""),email_port:h.coerce.number().nullable().default(465),email_username:h.string().nullable().default(""),email_password:h.string().nullable().default(""),email_encryption:h.string().nullable().default(""),email_from_address:h.string().email().nullable().default(""),remind_mail_enable:h.boolean().nullable().default(!1)});function Pu(){const{t:s}=M("settings"),[n,t]=u.useState(null),[r,a]=u.useState(!1),i=u.useRef(null),[l,d]=u.useState(!1),x=we({resolver:Te(Fu),defaultValues:{},mode:"onBlur"}),{data:m}=re({queryKey:["settings","email"],queryFn:()=>ye.getSettings("email")}),{data:o}=re({queryKey:["emailTemplate"],queryFn:()=>ye.getEmailTemplate()}),{mutateAsync:c}=Os({mutationFn:ye.saveSettings,onSuccess:T=>{T.data&&z.success(s("common.autoSaved"))}}),{mutate:f,isPending:D}=Os({mutationFn:ye.sendTestMail,onMutate:()=>{t(null),a(!1)},onSuccess:T=>{t(T.data),a(!0),T.data.error?z.error(s("email.test.error")):z.success(s("email.test.success"))}});u.useEffect(()=>{if(m?.data.email){const T=m.data.email;Object.entries(T).forEach(([w,E])=>{x.setValue(w,E)}),i.current=T}},[m]);const S=u.useCallback(Re.debounce(async T=>{if(!Re.isEqual(T,i.current)){d(!0);try{await c(T),i.current=T}finally{d(!1)}}},1e3),[c]),C=u.useCallback(T=>{S(T)},[S]);return u.useEffect(()=>{const T=x.watch(w=>{C(w)});return()=>T.unsubscribe()},[x.watch,C]),e.jsxs(e.Fragment,{children:[e.jsx(De,{...x,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:x.control,name:"email_host",render:({field:T})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("email.email_host.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("common.placeholder"),...T,value:T.value||""})}),e.jsx($,{children:s("email.email_host.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"email_port",render:({field:T})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("email.email_port.title")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:s("common.placeholder"),...T,value:T.value||"",onChange:w=>{const E=w.target.value?Number(w.target.value):null;T.onChange(E)}})}),e.jsx($,{children:s("email.email_port.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"email_encryption",render:({field:T})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("email.email_encryption.title")}),e.jsxs(J,{onValueChange:w=>{const E=w==="none"?"":w;T.onChange(E)},value:T.value===""||T.value===null||T.value===void 0?"none":T.value,children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:"请选择加密方式"})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"none",children:s("email.email_encryption.none")}),e.jsx(A,{value:"ssl",children:s("email.email_encryption.ssl")}),e.jsx(A,{value:"tls",children:s("email.email_encryption.tls")})]})]}),e.jsx($,{children:s("email.email_encryption.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"email_username",render:({field:T})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("email.email_username.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("common.placeholder"),autoComplete:"off",...T,value:T.value||""})}),e.jsx($,{children:s("email.email_username.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"email_password",render:({field:T})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("email.email_password.title")}),e.jsx(y,{children:e.jsx(k,{type:"password",placeholder:s("common.placeholder"),autoComplete:"off",...T,value:T.value||""})}),e.jsx($,{children:s("email.email_password.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"email_from_address",render:({field:T})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("email.email_from.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("common.placeholder"),...T,value:T.value||""})}),e.jsx($,{children:s("email.email_from.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"email_template",render:({field:T})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("email.email_template.title")}),e.jsxs(J,{onValueChange:w=>{T.onChange(w),C(x.getValues())},value:T.value||void 0,children:[e.jsx(y,{children:e.jsx(W,{className:"w-[200px]",children:e.jsx(Q,{placeholder:s("email.email_template.placeholder")})})}),e.jsx(Y,{children:o?.data?.map(w=>e.jsx(A,{value:w,children:w},w))})]}),e.jsx($,{children:s("email.email_template.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"remind_mail_enable",render:({field:T})=>e.jsxs(j,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:s("email.remind_mail.title")}),e.jsx($,{children:s("email.remind_mail.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:T.value||!1,onCheckedChange:w=>{T.onChange(w),C(x.getValues())}})})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(F,{onClick:()=>f(),loading:D,disabled:D,children:s(D?"email.test.sending":"email.test.title")})})]})}),l&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("saving")}),n&&e.jsx(Du,{open:r,onOpenChange:a,result:n})]})}function Lu(){const{t:s}=M("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("email.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("email.description")})]}),e.jsx(Ee,{}),e.jsx(Pu,{})]})}const Ru=Object.freeze(Object.defineProperty({__proto__:null,default:Lu},Symbol.toStringTag,{value:"Module"})),Eu=h.object({telegram_bot_enable:h.boolean().nullable(),telegram_bot_token:h.string().nullable(),telegram_discuss_link:h.string().nullable()}),Vu={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function Iu(){const{t:s}=M("settings"),[n,t]=u.useState(!1),r=u.useRef(null),a=we({resolver:Te(Eu),defaultValues:Vu,mode:"onBlur"}),{data:i}=re({queryKey:["settings","telegram"],queryFn:()=>ye.getSettings("telegram")}),{mutateAsync:l}=Os({mutationFn:ye.saveSettings,onSuccess:c=>{c.data&&z.success(s("common.autoSaved"))}}),{mutate:d,isPending:x}=Os({mutationFn:ye.setTelegramWebhook,onSuccess:c=>{c.data&&z.success(s("telegram.webhook.success"))}});u.useEffect(()=>{if(i?.data.telegram){const c=i.data.telegram;Object.entries(c).forEach(([f,D])=>{a.setValue(f,D)}),r.current=c}},[i]);const m=u.useCallback(Re.debounce(async c=>{if(!Re.isEqual(c,r.current)){t(!0);try{await l(c),r.current=c}finally{t(!1)}}},1e3),[l]),o=u.useCallback(c=>{m(c)},[m]);return u.useEffect(()=>{const c=a.watch(f=>{o(f)});return()=>c.unsubscribe()},[a.watch,o]),e.jsx(De,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:a.control,name:"telegram_bot_token",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("telegram.bot_token.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("telegram.bot_token.placeholder"),...c,value:c.value||""})}),e.jsx($,{children:s("telegram.bot_token.description")}),e.jsx(P,{})]})}),a.watch("telegram_bot_token")&&e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("telegram.webhook.title")}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(F,{loading:x,disabled:x,onClick:()=>d(),children:s(x?"telegram.webhook.setting":"telegram.webhook.button")}),n&&e.jsx("span",{className:"text-sm text-muted-foreground",children:s("common.saving")})]}),e.jsx($,{children:s("telegram.webhook.description")}),e.jsx(P,{})]}),e.jsx(v,{control:a.control,name:"telegram_bot_enable",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("telegram.bot_enable.title")}),e.jsx($,{children:s("telegram.bot_enable.description")}),e.jsx(y,{children:e.jsx(X,{checked:c.value||!1,onCheckedChange:f=>{c.onChange(f),o(a.getValues())}})}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"telegram_discuss_link",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("telegram.discuss_link.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("telegram.discuss_link.placeholder"),...c,value:c.value||""})}),e.jsx($,{children:s("telegram.discuss_link.description")}),e.jsx(P,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Mu(){const{t:s}=M("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("telegram.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("telegram.description")})]}),e.jsx(Ee,{}),e.jsx(Iu,{})]})}const Ou=Object.freeze(Object.defineProperty({__proto__:null,default:Mu},Symbol.toStringTag,{value:"Module"})),zu=h.object({windows_version:h.string().nullable(),windows_download_url:h.string().nullable(),macos_version:h.string().nullable(),macos_download_url:h.string().nullable(),android_version:h.string().nullable(),android_download_url:h.string().nullable()}),$u={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function Au(){const{t:s}=M("settings"),[n,t]=u.useState(!1),r=u.useRef(null),a=we({resolver:Te(zu),defaultValues:$u,mode:"onBlur"}),{data:i}=re({queryKey:["settings","app"],queryFn:()=>ye.getSettings("app")}),{mutateAsync:l}=Os({mutationFn:ye.saveSettings,onSuccess:m=>{m.data&&z.success(s("app.save_success"))}});u.useEffect(()=>{if(i?.data.app){const m=i.data.app;Object.entries(m).forEach(([o,c])=>{a.setValue(o,c)}),r.current=m}},[i]);const d=u.useCallback(Re.debounce(async m=>{if(!Re.isEqual(m,r.current)){t(!0);try{await l(m),r.current=m}finally{t(!1)}}},1e3),[l]),x=u.useCallback(m=>{d(m)},[d]);return u.useEffect(()=>{const m=a.watch(o=>{x(o)});return()=>m.unsubscribe()},[a.watch,x]),e.jsx(De,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:a.control,name:"windows_version",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("app.windows.version.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("common.placeholder"),...m,value:m.value||""})}),e.jsx($,{children:s("app.windows.version.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"windows_download_url",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("app.windows.download.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("common.placeholder"),...m,value:m.value||""})}),e.jsx($,{children:s("app.windows.download.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"macos_version",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("app.macos.version.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("common.placeholder"),...m,value:m.value||""})}),e.jsx($,{children:s("app.macos.version.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"macos_download_url",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("app.macos.download.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("common.placeholder"),...m,value:m.value||""})}),e.jsx($,{children:s("app.macos.download.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"android_version",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("app.android.version.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("common.placeholder"),...m,value:m.value||""})}),e.jsx($,{children:s("app.android.version.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"android_download_url",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-base",children:s("app.android.download.title")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("common.placeholder"),...m,value:m.value||""})}),e.jsx($,{children:s("app.android.download.description")}),e.jsx(P,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function qu(){const{t:s}=M("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("app.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("app.description")})]}),e.jsx(Ee,{}),e.jsx(Au,{})]})}const Hu=Object.freeze(Object.defineProperty({__proto__:null,default:qu},Symbol.toStringTag,{value:"Module"}));Rr.config({monaco:Er});function mi({form:s,config:n,namePrefix:t="",className:r="space-y-4"}){const[a,i]=u.useState({}),l=x=>t?`${t}.${x}`:x,d=(x,m)=>{const o=l(x);switch(m.type){case"string":return e.jsx(v,{control:s.control,name:o,render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{children:m.label||m.description}),e.jsx(y,{children:e.jsx(k,{placeholder:m.placeholder,...c})}),m.description&&m.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:m.description}),e.jsx(P,{})]})},x);case"number":case"percentage":return e.jsx(v,{control:s.control,name:o,render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{children:m.label||m.description}),e.jsx(y,{children:e.jsxs("div",{className:"relative",children:[e.jsx(k,{type:"number",placeholder:m.placeholder,min:m.min??(m.type==="percentage"?0:void 0),max:m.max??(m.type==="percentage"?100:void 0),step:m.step??(m.type==="percentage"?1:void 0),...c,onChange:f=>{const D=Number(f.target.value);m.type==="percentage"?c.onChange(Math.min(100,Math.max(0,D))):c.onChange(D)},className:m.type==="percentage"?"pr-8":""}),m.type==="percentage"&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(sd,{className:"h-4 w-4 text-muted-foreground"})})]})}),m.description&&m.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:m.description}),e.jsx(P,{})]})},x);case"select":return e.jsx(v,{control:s.control,name:o,render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{children:m.label||m.description}),e.jsxs(J,{onValueChange:c.onChange,defaultValue:c.value,children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:m.placeholder})})}),e.jsx(Y,{children:m.options?.map(f=>e.jsx(A,{value:f.value,children:f.label},f.value))})]}),m.description&&m.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:m.description}),e.jsx(P,{})]})},x);case"boolean":return e.jsx(v,{control:s.control,name:o,render:({field:c})=>e.jsxs(j,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:m.label||m.description}),m.description&&m.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:m.description})]}),e.jsx(y,{children:e.jsx(X,{checked:c.value,onCheckedChange:c.onChange})})]})},x);case"text":return e.jsx(v,{control:s.control,name:o,render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{children:m.label||m.description}),e.jsx(y,{children:e.jsx(Es,{placeholder:m.placeholder,...c})}),m.description&&m.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:m.description}),e.jsx(P,{})]})},x);case"yaml":case"json":return e.jsx(v,{control:s.control,name:o,render:({field:c})=>{const f=(()=>{if(c.value===null||c.value===void 0)return"";if(typeof c.value=="string")return c.value;try{return JSON.stringify(c.value,null,2)}catch{return String(c.value)}})(),D=`${t}_${x}`,S=a[D]||150;return e.jsxs(j,{children:[e.jsx(b,{children:m.label||m.description}),e.jsx(y,{children:e.jsx("div",{className:"resize-y overflow-hidden rounded-md border",style:{height:`${S}px`},onMouseDown:C=>{const T=C.clientY,w=S,E=g=>{const p=g.clientY-T,V=Math.max(100,w+p);i(R=>({...R,[D]:V}))},_=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",_)};document.addEventListener("mousemove",E),document.addEventListener("mouseup",_)},children:e.jsx(Vr,{height:"100%",defaultLanguage:m.type,value:f,onChange:C=>{c.onChange(C||"")},options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,formatOnPaste:m.type==="json",formatOnType:m.type==="json"}})})}),m.description&&m.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:m.description}),e.jsx(P,{})]})}},x);default:return null}};return e.jsx("div",{className:r,children:Object.entries(n).map(([x,m])=>d(x,m))})}function ui(s){return Object.fromEntries(Object.entries(s).map(([n,t])=>{let r=t.value;if(t.type==="yaml"||t.type==="json"){if(r==null)r="";else if(typeof r!="string")try{r=JSON.stringify(r,null,2)}catch{r=String(r)}}return[n,r]}))}const Uu=s=>h.object({id:h.number().nullable(),name:h.string().min(2,s("form.validation.name.min")).max(30,s("form.validation.name.max")),icon:h.string().optional().nullable(),notify_domain:h.string().refine(t=>!t||/^https?:\/\/\S+/.test(t),s("form.validation.notify_domain.url")).optional().nullable(),handling_fee_fixed:h.coerce.number().min(0).optional().nullable(),handling_fee_percent:h.coerce.number().min(0).max(100).optional().nullable(),payment:h.string().min(1,s("form.validation.payment.required")),config:h.record(h.string(),h.string())}),jr={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function xi({refetch:s,dialogTrigger:n,type:t="add",defaultFormValues:r=jr}){const{t:a}=M("payment"),[i,l]=u.useState(!1),[d,x]=u.useState(!1),[m,o]=u.useState([]),[c,f]=u.useState([]),[D,S]=u.useState({}),C=Uu(a),T=we({resolver:Te(C),defaultValues:r,mode:"onChange"}),w=T.watch("payment");u.useEffect(()=>{i&&(async()=>{const{data:g}=await xt.getMethodList();o(g)})()},[i]),u.useEffect(()=>{if(!w||!i)return;(async()=>{const g={payment:w,...t==="edit"&&{id:Number(T.getValues("id"))}};try{const{data:p}=await xt.getMethodForm(g),V=Object.values(p);f(V);const R=Object.entries(p).reduce((K,[Z,se])=>(K[Z]=se,K),{});S(R);const L=ui(R);T.setValue("config",L)}catch(p){console.error("Failed to fetch payment method form:",p),f([]),S({})}})()},[w,i,T,t]);const E=async _=>{x(!0);try{(await xt.save(_)).data&&(z.success(a("form.messages.success")),T.reset(jr),s(),l(!1))}finally{x(!1)}};return e.jsxs(me,{open:i,onOpenChange:l,children:[e.jsx(ps,{asChild:!0,children:n||e.jsxs(F,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ue,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add.button")})]})}),e.jsxs(ce,{className:"max-h-[90vh] overflow-y-auto sm:max-w-[500px]",children:[e.jsx(pe,{children:e.jsx(ue,{children:a(t==="add"?"form.add.title":"form.edit.title")})}),e.jsx(De,{...T,children:e.jsxs("form",{onSubmit:T.handleSubmit(E),className:"space-y-4",children:[e.jsx(v,{control:T.control,name:"name",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:a("form.fields.name.placeholder"),..._})}),e.jsx($,{children:a("form.fields.name.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:T.control,name:"icon",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.icon.label")}),e.jsx(y,{children:e.jsx(k,{..._,value:_.value||"",placeholder:a("form.fields.icon.placeholder")})}),e.jsx($,{children:a("form.fields.icon.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:T.control,name:"notify_domain",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.notify_domain.label")}),e.jsx(y,{children:e.jsx(k,{..._,value:_.value||"",placeholder:a("form.fields.notify_domain.placeholder")})}),e.jsx($,{children:a("form.fields.notify_domain.description")}),e.jsx(P,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(v,{control:T.control,name:"handling_fee_percent",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.handling_fee_percent.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",..._,value:_.value||"",placeholder:a("form.fields.handling_fee_percent.placeholder")})}),e.jsx(P,{})]})}),e.jsx(v,{control:T.control,name:"handling_fee_fixed",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.handling_fee_fixed.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",..._,value:_.value||"",placeholder:a("form.fields.handling_fee_fixed.placeholder")})}),e.jsx(P,{})]})})]}),e.jsx(v,{control:T.control,name:"payment",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.payment.label")}),e.jsxs(J,{onValueChange:_.onChange,defaultValue:_.value,children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:a("form.fields.payment.placeholder")})})}),e.jsx(Y,{children:m.map(g=>e.jsx(A,{value:g,children:g},g))})]}),e.jsx($,{children:a("form.fields.payment.description")}),e.jsx(P,{})]})}),Object.keys(D).length>0&&e.jsxs("div",{className:"space-y-4 ",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:a("form.sections.payment_config")}),e.jsx(mi,{form:T,config:D,namePrefix:"config",className:"space-y-4"})]}),e.jsxs(Ie,{className:"pt-4",children:[e.jsx(et,{asChild:!0,children:e.jsx(F,{type:"button",variant:"outline",children:a("form.buttons.cancel")})}),e.jsx(F,{type:"submit",disabled:d,children:a("form.buttons.submit")})]})]})})]})]})}function O({column:s,title:n,tooltip:t,className:r}){return s.getCanSort()?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(F,{variant:"ghost",size:"default",className:N("-ml-3 flex h-8 items-center gap-2 text-nowrap font-medium hover:bg-muted/60",r),onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:[e.jsx("span",{children:n}),t&&e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(rr,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(de,{children:t})]})}),s.getIsSorted()==="asc"?e.jsx(fn,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(jn,{className:"h-4 w-4 text-foreground/70"}):e.jsx(td,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-foreground/70"})]})})}):e.jsxs("div",{className:N("flex items-center space-x-1 text-nowrap py-2 font-medium text-muted-foreground",r),children:[e.jsx("span",{children:n}),t&&e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx(rr,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(de,{children:t})]})})]})}const Un=ad,hi=nd,Ku=rd,gi=u.forwardRef(({className:s,...n},t)=>e.jsx(Cl,{className:N("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...n,ref:t}));gi.displayName=Cl.displayName;const Ka=u.forwardRef(({className:s,...n},t)=>e.jsxs(Ku,{children:[e.jsx(gi,{}),e.jsx(Sl,{ref:t,className:N("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...n})]}));Ka.displayName=Sl.displayName;const Ba=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-2 text-center sm:text-left",s),...n});Ba.displayName="AlertDialogHeader";const Ga=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Ga.displayName="AlertDialogFooter";const Wa=u.forwardRef(({className:s,...n},t)=>e.jsx(kl,{ref:t,className:N("text-lg font-semibold",s),...n}));Wa.displayName=kl.displayName;const Ya=u.forwardRef(({className:s,...n},t)=>e.jsx(Tl,{ref:t,className:N("text-sm text-muted-foreground",s),...n}));Ya.displayName=Tl.displayName;const Ja=u.forwardRef(({className:s,...n},t)=>e.jsx(Dl,{ref:t,className:N(Vt(),s),...n}));Ja.displayName=Dl.displayName;const Qa=u.forwardRef(({className:s,...n},t)=>e.jsx(Fl,{ref:t,className:N(Vt({variant:"outline"}),"mt-2 sm:mt-0",s),...n}));Qa.displayName=Fl.displayName;function _s({onConfirm:s,children:n,title:t="确认操作",description:r="确定要执行此操作吗?",cancelText:a="取消",confirmText:i="确认",variant:l="default",className:d}){return e.jsxs(Un,{children:[e.jsx(hi,{asChild:!0,children:n}),e.jsxs(Ka,{className:N("sm:max-w-[425px]",d),children:[e.jsxs(Ba,{children:[e.jsx(Wa,{children:t}),e.jsx(Ya,{children:r})]}),e.jsxs(Ga,{children:[e.jsx(Qa,{asChild:!0,children:e.jsx(F,{variant:"outline",children:a})}),e.jsx(Ja,{asChild:!0,children:e.jsx(F,{variant:l,onClick:s,children:i})})]})]})]})}const pi=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M11.29 15.29a2 2 0 0 0-.12.15a.8.8 0 0 0-.09.18a.6.6 0 0 0-.06.18a1.4 1.4 0 0 0 0 .2a.84.84 0 0 0 .08.38a.9.9 0 0 0 .54.54a.94.94 0 0 0 .76 0a.9.9 0 0 0 .54-.54A1 1 0 0 0 13 16a1 1 0 0 0-.29-.71a1 1 0 0 0-1.42 0M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8 8 0 0 1-8 8m0-13a3 3 0 0 0-2.6 1.5a1 1 0 1 0 1.73 1A1 1 0 0 1 12 9a1 1 0 0 1 0 2a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-.18A3 3 0 0 0 12 7"})}),Bu=({refetch:s,isSortMode:n=!1})=>{const{t}=M("payment");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx(za,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:r})=>e.jsx(O,{column:r,title:t("table.columns.id")}),cell:({row:r})=>e.jsx(q,{variant:"outline",children:r.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:r})=>e.jsx(O,{column:r,title:t("table.columns.enable")}),cell:({row:r})=>e.jsx(X,{defaultChecked:r.getValue("enable"),onCheckedChange:async()=>{const{data:a}=await xt.updateStatus({id:r.original.id});a||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:r})=>e.jsx(O,{column:r,title:t("table.columns.name")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:r.getValue("name")})}),enableSorting:!1,size:200},{accessorKey:"payment",header:({column:r})=>e.jsx(O,{column:r,title:t("table.columns.payment")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:r.getValue("payment")})}),enableSorting:!1,size:200},{accessorKey:"notify_url",header:({column:r})=>e.jsxs("div",{className:"flex items-center",children:[e.jsx(O,{column:r,title:t("table.columns.notify_url")}),e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{className:"ml-1",children:e.jsx(pi,{className:"h-4 w-4"})}),e.jsx(de,{children:t("table.columns.notify_url_tooltip")})]})})]}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[300px] truncate font-medium",children:r.getValue("notify_url")})}),enableSorting:!1,size:3e3},{id:"actions",header:({column:r})=>e.jsx(O,{className:"justify-end",column:r,title:t("table.columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(xi,{refetch:s,dialogTrigger:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(rt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:t("table.actions.edit")})]}),type:"edit",defaultFormValues:r.original}),e.jsx(_s,{title:t("table.actions.delete.title"),description:t("table.actions.delete.description"),onConfirm:async()=>{const{data:a}=await xt.drop({id:r.original.id});a&&s()},children:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(us,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:t("table.actions.delete.title")})]})})]}),size:100}]};function Gu({table:s,refetch:n,saveOrder:t,isSortMode:r}){const{t:a}=M("payment"),i=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[r?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("table.toolbar.sort.hint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xi,{refetch:n}),e.jsx(k,{placeholder:a("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:l=>s.getColumn("name")?.setFilterValue(l.target.value),className:"h-8 w-[250px]"}),i&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[a("table.toolbar.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(F,{variant:r?"default":"outline",onClick:t,size:"sm",children:a(r?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}function Wu(){const[s,n]=u.useState([]),[t,r]=u.useState([]),[a,i]=u.useState(!1),[l,d]=u.useState([]),[x,m]=u.useState({"drag-handle":!1}),[o,c]=u.useState({pageSize:20,pageIndex:0}),{refetch:f}=re({queryKey:["paymentList"],queryFn:async()=>{const{data:w}=await xt.getList();return d(w?.map(E=>({...E,enable:!!E.enable}))||[]),w}});u.useEffect(()=>{m({"drag-handle":a,actions:!a}),c({pageSize:a?99999:10,pageIndex:0})},[a]);const D=(w,E)=>{a&&(w.dataTransfer.setData("text/plain",E.toString()),w.currentTarget.classList.add("opacity-50"))},S=(w,E)=>{if(!a)return;w.preventDefault(),w.currentTarget.classList.remove("bg-muted");const _=parseInt(w.dataTransfer.getData("text/plain"));if(_===E)return;const g=[...l],[p]=g.splice(_,1);g.splice(E,0,p),d(g)},C=async()=>{a?xt.sort({ids:l.map(w=>w.id)}).then(()=>{f(),i(!1),z.success("排序保存成功")}):i(!0)},T=Be({data:l,columns:Bu({refetch:f,isSortMode:a}),state:{sorting:t,columnFilters:s,columnVisibility:x,pagination:o},onSortingChange:r,onColumnFiltersChange:n,onColumnVisibilityChange:m,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),initialState:{columnPinning:{right:["actions"]}},pageCount:a?1:void 0});return e.jsx(ts,{table:T,toolbar:w=>e.jsx(Gu,{table:w,refetch:f,saveOrder:C,isSortMode:a}),draggable:a,onDragStart:D,onDragEnd:w=>w.currentTarget.classList.remove("opacity-50"),onDragOver:w=>{w.preventDefault(),w.currentTarget.classList.add("bg-muted")},onDragLeave:w=>w.currentTarget.classList.remove("bg-muted"),onDrop:S,showPagination:!a})}function Yu(){const{t:s}=M("payment");return e.jsxs(Ae,{children:[e.jsxs(qe,{className:"flex items-center justify-between",children:[e.jsx(cs,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{children:[e.jsx("header",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")})}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),e.jsx("section",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Wu,{})})]})]})}const Ju=Object.freeze(Object.defineProperty({__proto__:null,default:Yu},Symbol.toStringTag,{value:"Module"}));function Qu({pluginName:s,onClose:n,onSuccess:t}){const{t:r}=M("plugin"),[a,i]=u.useState(!0),[l,d]=u.useState(!1),[x,m]=u.useState(null),o=ld({config:id(od())}),c=we({resolver:Te(o),defaultValues:{config:{}}});u.useEffect(()=>{(async()=>{try{const{data:S}=await As.getPluginConfig(s);m(S);const C=ui(S);c.reset({config:C})}catch{z.error(r("messages.configLoadError"))}finally{i(!1)}})()},[s,c,r]);const f=async D=>{d(!0);try{await As.updatePluginConfig(s,D.config),z.success(r("messages.configSaveSuccess")),t()}catch{z.error(r("messages.configSaveError"))}finally{d(!1)}};return a?e.jsxs("div",{className:"space-y-4",children:[e.jsx(be,{className:"h-4 w-[200px]"}),e.jsx(be,{className:"h-10 w-full"}),e.jsx(be,{className:"h-4 w-[200px]"}),e.jsx(be,{className:"h-10 w-full"})]}):e.jsx(De,{...c,children:e.jsxs("form",{onSubmit:c.handleSubmit(f),className:"space-y-4",children:[x&&e.jsx(mi,{form:c,config:x,namePrefix:"config"}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(F,{type:"button",variant:"outline",onClick:n,disabled:l,children:r("config.cancel")}),e.jsx(F,{type:"submit",loading:l,disabled:l,children:r("config.save")})]})]})})}function Xu(){const{t:s}=M("plugin"),[n,t]=u.useState(null),[r,a]=u.useState(!1),[i,l]=u.useState(null),[d,x]=u.useState(""),[m,o]=u.useState("feature"),[c,f]=u.useState("all"),[D,S]=u.useState(!1),[C,T]=u.useState(!1),[w,E]=u.useState(!1),_=u.useRef(null),[g,p]=u.useState(!1),[V,R]=u.useState(""),{data:L,isLoading:K}=re({queryKey:["pluginTypes"],queryFn:async()=>{const{data:U}=await As.getPluginTypes();return U}}),{data:Z,isLoading:se,refetch:ae}=re({queryKey:["pluginList"],queryFn:async()=>{const{data:U}=await As.getPluginList();return U}}),H=Z?.filter(U=>U.name.toLowerCase().includes(d.toLowerCase())||U.description.toLowerCase().includes(d.toLowerCase())||U.code.toLowerCase().includes(d.toLowerCase())),ee=()=>{if(!H)return[];let U=H;return m!=="all"&&(U=U.filter(te=>te.type===m)),c==="installed"?U=U.filter(te=>te.is_installed):c==="available"&&(U=U.filter(te=>!te.is_installed)),U},je=U=>L?.find(te=>te.value===U),ds=async U=>{t(U),As.installPlugin(U).then(()=>{z.success(s("messages.installSuccess")),ae()}).catch(te=>{z.error(te.message||s("messages.installError"))}).finally(()=>{t(null)})},Me=async U=>{t(U),As.uninstallPlugin(U).then(()=>{z.success(s("messages.uninstallSuccess")),ae()}).catch(te=>{z.error(te.message||s("messages.uninstallError"))}).finally(()=>{t(null)})},le=async(U,te)=>{t(U),(te?As.disablePlugin:As.enablePlugin)(U).then(()=>{z.success(s(te?"messages.disableSuccess":"messages.enableSuccess")),ae()}).catch(ve=>{z.error(ve.message||s(te?"messages.disableError":"messages.enableError"))}).finally(()=>{t(null)})},Ts=U=>{Z?.find(te=>te.code===U),l(U),a(!0)},Ns=async U=>{if(!U.name.endsWith(".zip")){z.error(s("upload.error.format"));return}S(!0),As.uploadPlugin(U).then(()=>{z.success(s("messages.uploadSuccess")),T(!1),ae()}).catch(te=>{z.error(te.message||s("messages.uploadError"))}).finally(()=>{S(!1),_.current&&(_.current.value="")})},Ws=U=>{U.preventDefault(),U.stopPropagation(),U.type==="dragenter"||U.type==="dragover"?E(!0):U.type==="dragleave"&&E(!1)},Us=U=>{U.preventDefault(),U.stopPropagation(),E(!1),U.dataTransfer.files&&U.dataTransfer.files[0]&&Ns(U.dataTransfer.files[0])},Ys=async U=>{t(U),As.deletePlugin(U).then(()=>{z.success(s("messages.deleteSuccess")),ae()}).catch(te=>{z.error(te.message||s("messages.deleteError"))}).finally(()=>{t(null)})},yt=U=>cd(U||"",{walkTokens(te){(te.type==="image"||te.type==="link")&&(te.type="text",te.raw="",te.text="")}});return e.jsxs(Ae,{children:[e.jsxs(qe,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Pn,{className:"h-6 w-6"}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:s("title")})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{children:[e.jsxs("div",{className:"mb-8 space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"relative max-w-sm flex-1",children:[e.jsx(Ln,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(k,{placeholder:s("search.placeholder"),value:d,onChange:U=>x(U.target.value),className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(J,{value:c,onValueChange:f,children:[e.jsx(W,{className:"w-[140px]",children:e.jsx(Q,{placeholder:s("status.filter_placeholder",{defaultValue:"安装状态"})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"all",children:s("status.all",{defaultValue:"全部状态"})}),e.jsx(A,{value:"installed",children:s("status.installed",{defaultValue:"已安装"})}),e.jsx(A,{value:"available",children:s("status.available",{defaultValue:"可安装"})})]})]}),e.jsxs(F,{onClick:()=>T(!0),variant:"outline",className:"shrink-0",size:"sm",children:[e.jsx(Lt,{className:"mr-2 h-4 w-4"}),s("upload.button")]})]})]}),e.jsxs(ft,{value:m,onValueChange:o,className:"w-full",children:[e.jsxs(lt,{children:[L?.map(U=>e.jsx(Ke,{value:U.value,children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{children:U.label})})},U.value)),e.jsx(Ke,{value:"all",children:s("tabs.all")})]}),e.jsx(bs,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:se||K?e.jsxs(e.Fragment,{children:[e.jsx(dn,{}),e.jsx(dn,{}),e.jsx(dn,{})]}):ee().map(U=>e.jsx(vr,{plugin:U,typeInfo:je(U.type),onInstall:ds,onUninstall:Me,onToggleEnable:le,onOpenConfig:Ts,onDelete:Ys,isLoading:n===U.code,onShowReadme:U.readme?()=>{R(U.readme),p(!0)}:void 0},U.code))})}),L?.map(U=>e.jsx(bs,{value:U.value,className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:ee().map(te=>e.jsx(vr,{plugin:te,typeInfo:je(te.type),onInstall:ds,onUninstall:Me,onToggleEnable:le,onOpenConfig:Ts,onDelete:Ys,isLoading:n===te.code,onShowReadme:te.readme?()=>{R(te.readme),p(!0)}:void 0},te.code))})},U.value))]})]}),e.jsx(me,{open:r,onOpenChange:a,children:e.jsxs(ce,{className:"sm:max-w-lg",children:[e.jsxs(pe,{children:[e.jsxs(ue,{children:[Z?.find(U=>U.code===i)?.name," ",s("config.title")]}),e.jsx($e,{children:s("config.description")})]}),i&&e.jsx(Qu,{pluginName:i,onClose:()=>a(!1),onSuccess:()=>{a(!1),ae()}})]})}),e.jsx(me,{open:C,onOpenChange:T,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:s("upload.title")}),e.jsx($e,{children:s("upload.description")})]}),e.jsxs("div",{className:N("relative mt-4 flex h-64 flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted-foreground/25 px-5 py-10 text-center transition-colors",w&&"border-primary/50 bg-muted/50"),onDragEnter:Ws,onDragLeave:Ws,onDragOver:Ws,onDrop:Us,children:[e.jsx("input",{type:"file",ref:_,className:"hidden",accept:".zip",onChange:U=>{const te=U.target.files?.[0];te&&Ns(te)}}),D?e.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[e.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-b-2 border-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("upload.uploading")})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"rounded-full border-2 border-muted-foreground/25 p-3",children:e.jsx(Lt,{className:"h-6 w-6 text-muted-foreground/50"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:[s("upload.dragText")," ",e.jsx("button",{type:"button",onClick:()=>_.current?.click(),className:"mx-1 text-primary hover:underline",children:s("upload.clickText")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("upload.supportText")})]})]})})]})]})}),e.jsx(me,{open:g,onOpenChange:p,children:e.jsxs(ce,{className:"max-w-2xl",children:[e.jsx(pe,{children:e.jsx(ue,{children:s("readme.title",{defaultValue:"插件文档"})})}),e.jsx("div",{className:"markdown-body max-h-[60vh] overflow-y-auto",dangerouslySetInnerHTML:{__html:yt(V)}})]})})]})]})}function vr({plugin:s,onInstall:n,onUninstall:t,onToggleEnable:r,onOpenConfig:a,onDelete:i,isLoading:l,onShowReadme:d,typeInfo:x}){const{t:m}=M("plugin");return e.jsx(ke,{className:"group relative overflow-hidden transition-all hover:shadow-md",children:e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx("h3",{className:"truncate text-base font-semibold",children:s.name}),x&&e.jsx(q,{variant:"outline",className:"border-primary/20 bg-primary/5 px-1.5 py-0.5 text-xs text-primary",children:x.label}),s.is_installed?e.jsx(q,{variant:s.is_enabled?"default":"outline",className:"px-1.5 py-0.5 text-xs",children:s.is_enabled?m("status.enabled"):m("status.disabled")}):e.jsx(q,{variant:"outline",className:"border-muted-foreground/30 bg-muted/30 px-1.5 py-0.5 text-xs text-muted-foreground",children:m("status.not_installed")})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1.5",children:[s.is_protected&&e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",children:e.jsx(dd,{className:"h-3 w-3"})})}),e.jsx(de,{children:e.jsx("p",{children:m("status.protected")})})]})}),s.readme&&e.jsx("button",{type:"button",onClick:d,className:"flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-primary",title:m("button.readme"),children:e.jsx(bn,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"mb-2 flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Pn,{className:"h-3 w-3"}),e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:s.code})]}),e.jsxs("span",{children:["v",s.version]}),e.jsxs("span",{children:[m("author"),": ",s.author]})]}),e.jsx("p",{className:"mb-3 overflow-hidden text-ellipsis text-sm text-muted-foreground",style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:s.description}),e.jsx("div",{className:"flex items-center justify-end gap-2",children:s.is_installed?e.jsxs(e.Fragment,{children:[s.config&&Object.keys(s.config).length>0&&e.jsxs(F,{variant:"outline",size:"sm",onClick:()=>a(s.code),disabled:!s.is_enabled||l,className:"h-7 px-2 text-xs",children:[e.jsx(ka,{className:"mr-1 h-3 w-3"}),m("button.config")]}),e.jsxs(F,{variant:s.is_enabled?"destructive":"default",size:"sm",onClick:()=>r(s.code,s.is_enabled),disabled:l,className:"h-7 px-2 text-xs",children:[e.jsx(md,{className:"mr-1 h-3 w-3"}),s.is_enabled?m("button.disable"):m("button.enable")]}),e.jsx(_s,{title:m("uninstall.title"),description:m("uninstall.description"),cancelText:m("common:cancel"),confirmText:m("uninstall.button"),variant:"destructive",onConfirm:async()=>t(s.code),children:e.jsxs(F,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-destructive",disabled:l,children:[e.jsx(us,{className:"mr-1 h-3 w-3"}),m("button.uninstall")]})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(F,{onClick:()=>n(s.code),disabled:l,size:"sm",className:"h-7 px-3 text-xs",children:[l?e.jsx("div",{className:"mr-1 h-3 w-3 animate-spin rounded-full border border-current border-t-transparent"}):null,m("button.install")]}),s.can_be_deleted!==!1&&e.jsx(_s,{title:m("delete.title"),description:m("delete.description"),cancelText:m("common:cancel"),confirmText:m("delete.button"),variant:"destructive",onConfirm:async()=>i(s.code),children:e.jsx(F,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",disabled:l,children:e.jsx(us,{className:"h-3 w-3"})})})]})})]})})}function dn(){return e.jsxs(ke,{children:[e.jsxs(Fe,{children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{className:"h-6 w-[200px]"}),e.jsx(be,{className:"h-6 w-[80px]"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(be,{className:"h-5 w-[120px]"}),e.jsx(be,{className:"h-5 w-[60px]"})]})]})}),e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx(be,{className:"h-4 w-[300px]"}),e.jsx(be,{className:"h-4 w-[150px]"})]})]}),e.jsx(Pe,{children:e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(be,{className:"h-9 w-[100px]"}),e.jsx(be,{className:"h-9 w-[100px]"}),e.jsx(be,{className:"h-8 w-8"})]})})]})}const Zu=Object.freeze(Object.defineProperty({__proto__:null,default:Xu},Symbol.toStringTag,{value:"Module"})),ex=(s,n)=>{let t=null;switch(s.field_type){case"input":t=e.jsx(k,{placeholder:s.placeholder,...n});break;case"textarea":t=e.jsx(Es,{placeholder:s.placeholder,...n});break;case"select":t=e.jsx("select",{className:N(Vt({variant:"outline"}),"w-full appearance-none font-normal"),...n,children:s.select_options&&Object.keys(s.select_options).map(r=>e.jsx("option",{value:r,children:s.select_options?.[r]},r))});break;default:t=null;break}return t};function sx({themeKey:s,themeInfo:n}){const{t}=M("theme"),[r,a]=u.useState(!1),[i,l]=u.useState(!1),[d,x]=u.useState(!1),m=we({defaultValues:n.configs.reduce((f,D)=>(f[D.field_name]="",f),{})}),o=async()=>{l(!0),Jt.getConfig(s).then(({data:f})=>{Object.entries(f).forEach(([D,S])=>{m.setValue(D,S)})}).finally(()=>{l(!1)})},c=async f=>{x(!0),Jt.updateConfig(s,f).then(()=>{z.success(t("config.success")),a(!1)}).finally(()=>{x(!1)})};return e.jsxs(me,{open:r,onOpenChange:f=>{a(f),f?o():m.reset()},children:[e.jsx(ps,{asChild:!0,children:e.jsx(F,{variant:"outline",children:t("card.configureTheme")})}),e.jsxs(ce,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:t("config.title",{name:n.name})}),e.jsx($e,{children:t("config.description")})]}),i?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(Sa,{className:"h-6 w-6 animate-spin"})}):e.jsx(De,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(c),className:"space-y-4",children:[n.configs.map(f=>e.jsx(v,{control:m.control,name:f.field_name,render:({field:D})=>e.jsxs(j,{children:[e.jsx(b,{children:f.label}),e.jsx(y,{children:ex(f,D)}),e.jsx(P,{})]})},f.field_name)),e.jsxs(Ie,{className:"mt-6 gap-2",children:[e.jsx(F,{type:"button",variant:"secondary",onClick:()=>a(!1),children:t("config.cancel")}),e.jsx(F,{type:"submit",loading:d,children:t("config.save")})]})]})})]})]})}function tx(){const{t:s}=M("theme"),[n,t]=u.useState(null),[r,a]=u.useState(!1),[i,l]=u.useState(!1),[d,x]=u.useState(!1),[m,o]=u.useState(null),c=u.useRef(null),[f,D]=u.useState(0),{data:S,isLoading:C,refetch:T}=re({queryKey:["themeList"],queryFn:async()=>{const{data:L}=await Jt.getList();return L}}),w=async L=>{t(L),ye.updateSystemConfig({frontend_theme:L}).then(()=>{z.success("主题切换成功"),T()}).finally(()=>{t(null)})},E=async L=>{if(!L.name.endsWith(".zip")){z.error(s("upload.error.format"));return}a(!0),Jt.upload(L).then(()=>{z.success("主题上传成功"),l(!1),T()}).finally(()=>{a(!1),c.current&&(c.current.value="")})},_=L=>{L.preventDefault(),L.stopPropagation(),L.type==="dragenter"||L.type==="dragover"?x(!0):L.type==="dragleave"&&x(!1)},g=L=>{L.preventDefault(),L.stopPropagation(),x(!1),L.dataTransfer.files&&L.dataTransfer.files[0]&&E(L.dataTransfer.files[0])},p=()=>{m&&D(L=>L===0?m.images.length-1:L-1)},V=()=>{m&&D(L=>L===m.images.length-1?0:L+1)},R=(L,K)=>{D(0),o({name:L,images:K})};return e.jsxs(Ae,{children:[e.jsxs(qe,{className:"flex items-center justify-between",children:[e.jsx(cs,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:s("title")})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-muted-foreground",children:s("description")}),e.jsxs(F,{onClick:()=>l(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(Lt,{className:"mr-2 h-4 w-4"}),s("upload.button")]})]})]}),e.jsx("section",{className:"grid gap-6 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3",children:C?e.jsxs(e.Fragment,{children:[e.jsx(br,{}),e.jsx(br,{})]}):S?.themes&&Object.entries(S.themes).map(([L,K])=>e.jsx(ke,{className:"group relative overflow-hidden transition-all hover:shadow-md",style:{backgroundImage:K.background_url?`url(${K.background_url})`:"none",backgroundSize:"cover",backgroundPosition:"center"},children:e.jsxs("div",{className:N("relative z-10 h-full transition-colors",K.background_url?"group-hover:from-background/98 bg-gradient-to-t from-background/95 via-background/80 to-background/60 backdrop-blur-[1px] group-hover:via-background/90 group-hover:to-background/70":"bg-background"),children:[!!K.can_delete&&e.jsx("div",{className:"absolute right-2 top-2",children:e.jsx(_s,{title:s("card.delete.title"),description:s("card.delete.description"),confirmText:s("card.delete.button"),variant:"destructive",onConfirm:async()=>{if(L===S?.active){z.error(s("card.delete.error.active"));return}t(L),Jt.drop(L).then(()=>{z.success("主题删除成功"),T()}).finally(()=>{t(null)})},children:e.jsx(F,{disabled:n===L,loading:n===L,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(us,{className:"h-4 w-4"})})})}),e.jsxs(Fe,{children:[e.jsx(Ve,{children:K.name}),e.jsx(Zs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{children:K.description}),K.version&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("card.version",{version:K.version})})]})})]}),e.jsxs(Pe,{className:"flex items-center justify-end space-x-3",children:[K.images&&Array.isArray(K.images)&&K.images.length>0&&e.jsx(F,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>R(K.name,K.images),children:e.jsx(ud,{className:"h-4 w-4"})}),e.jsx(sx,{themeKey:L,themeInfo:K}),e.jsx(F,{onClick:()=>w(L),disabled:n===L||L===S.active,loading:n===L,variant:L===S.active?"secondary":"default",children:L===S.active?s("card.currentTheme"):s("card.activateTheme")})]})]})},L))}),e.jsx(me,{open:i,onOpenChange:l,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:s("upload.title")}),e.jsx($e,{children:s("upload.description")})]}),e.jsxs("div",{className:N("relative mt-4 flex h-64 flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted-foreground/25 px-5 py-10 text-center transition-colors",d&&"border-primary/50 bg-muted/50"),onDragEnter:_,onDragLeave:_,onDragOver:_,onDrop:g,children:[e.jsx("input",{type:"file",ref:c,className:"hidden",accept:".zip",onChange:L=>{const K=L.target.files?.[0];K&&E(K)}}),r?e.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[e.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-b-2 border-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("upload.uploading")})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"rounded-full border-2 border-muted-foreground/25 p-3",children:e.jsx(Lt,{className:"h-6 w-6 text-muted-foreground/50"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:[s("upload.dragText")," ",e.jsx("button",{type:"button",onClick:()=>c.current?.click(),className:"mx-1 text-primary hover:underline",children:s("upload.clickText")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("upload.supportText")})]})]})})]})]})}),e.jsx(me,{open:!!m,onOpenChange:L=>{L||(o(null),D(0))},children:e.jsxs(ce,{className:"max-w-4xl",children:[e.jsxs(pe,{children:[e.jsxs(ue,{children:[m?.name," ",s("preview.title")]}),e.jsx($e,{className:"text-center",children:m&&s("preview.imageCount",{current:f+1,total:m.images.length})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"aspect-[16/9] overflow-hidden rounded-lg border bg-muted",children:m?.images[f]&&e.jsx("img",{src:m.images[f],alt:`${m.name} 预览图 ${f+1}`,className:"h-full w-full object-contain"})}),m&&m.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(F,{variant:"outline",size:"icon",className:"absolute left-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:p,children:e.jsx(hl,{className:"h-4 w-4"})}),e.jsx(F,{variant:"outline",size:"icon",className:"absolute right-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:V,children:e.jsx(gl,{className:"h-4 w-4"})})]})]}),m&&m.images.length>1&&e.jsx("div",{className:"mt-4 flex gap-2 overflow-x-auto pb-2",children:m.images.map((L,K)=>e.jsx("button",{onClick:()=>D(K),className:N("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",f===K?"border-primary":"border-transparent"),children:e.jsx("img",{src:L,alt:`缩略图 ${K+1}`,className:"h-full w-full object-cover"})},K))})]})})]})]})}function br(){return e.jsxs(ke,{children:[e.jsxs(Fe,{children:[e.jsx(be,{className:"h-6 w-[200px]"}),e.jsx(be,{className:"h-4 w-[300px]"})]}),e.jsxs(Pe,{className:"flex items-center justify-end space-x-3",children:[e.jsx(be,{className:"h-10 w-[100px]"}),e.jsx(be,{className:"h-10 w-[100px]"})]})]})}const ax=Object.freeze(Object.defineProperty({__proto__:null,default:tx},Symbol.toStringTag,{value:"Module"})),Xa=u.forwardRef(({className:s,value:n=[],onChange:t,...r},a)=>{const[i,l]=u.useState("");u.useEffect(()=>{if(i.includes(",")){const x=new Set([...n,...i.split(",").map(m=>m.trim())]);t(Array.from(x)),l("")}},[i,t,n]);const d=()=>{if(i){const x=new Set([...n,i]);t(Array.from(x)),l("")}};return e.jsxs("div",{className:N(" has-[:focus-visible]:outline-none has-[:focus-visible]:ring-1 has-[:focus-visible]:ring-neutral-950 dark:has-[:focus-visible]:ring-neutral-300 flex w-full flex-wrap gap-2 rounded-md border border-input shadow-sm px-3 py-2 text-sm ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",s),children:[n.map(x=>e.jsxs(q,{variant:"secondary",children:[x,e.jsx(G,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{t(n.filter(m=>m!==x))},children:e.jsx(_n,{className:"w-3"})})]},x)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:i,onChange:x=>l(x.target.value),onKeyDown:x=>{x.key==="Enter"||x.key===","?(x.preventDefault(),d()):x.key==="Backspace"&&i.length===0&&n.length>0&&(x.preventDefault(),t(n.slice(0,-1)))},...r,ref:a})]})});Xa.displayName="InputTags";const nx=h.object({id:h.number().nullable(),title:h.string().min(1).max(250),content:h.string().min(1),show:h.boolean(),tags:h.array(h.string()),img_url:h.string().nullable()}),rx={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function fi({refetch:s,dialogTrigger:n,type:t="add",defaultFormValues:r=rx}){const{t:a}=M("notice"),[i,l]=u.useState(!1),d=we({resolver:Te(nx),defaultValues:r,mode:"onChange",shouldFocusError:!0}),x=new Vn({html:!0});return e.jsx(De,{...d,children:e.jsxs(me,{onOpenChange:l,open:i,children:[e.jsx(ps,{asChild:!0,children:n||e.jsxs(F,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ue,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add.button")})]})}),e.jsxs(ce,{className:"sm:max-w-[1025px]",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:a(t==="add"?"form.add.title":"form.edit.title")}),e.jsx($e,{})]}),e.jsx(v,{control:d.control,name:"title",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.title.label")}),e.jsx("div",{className:"relative ",children:e.jsx(y,{children:e.jsx(k,{placeholder:a("form.fields.title.placeholder"),...m})})}),e.jsx(P,{})]})}),e.jsx(v,{control:d.control,name:"content",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.content.label")}),e.jsx(y,{children:e.jsx(In,{style:{height:"500px"},value:m.value,renderHTML:o=>x.render(o),onChange:({text:o})=>{m.onChange(o)}})}),e.jsx(P,{})]})}),e.jsx(v,{control:d.control,name:"img_url",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.img_url.label")}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsx(k,{type:"text",placeholder:a("form.fields.img_url.placeholder"),...m,value:m.value||""})})}),e.jsx(P,{})]})}),e.jsx(v,{control:d.control,name:"show",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.show.label")}),e.jsx("div",{className:"relative py-2",children:e.jsx(y,{children:e.jsx(X,{checked:m.value,onCheckedChange:m.onChange})})}),e.jsx(P,{})]})}),e.jsx(v,{control:d.control,name:"tags",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.fields.tags.label")}),e.jsx(y,{children:e.jsx(Xa,{value:m.value,onChange:m.onChange,placeholder:a("form.fields.tags.placeholder"),className:"w-full"})}),e.jsx(P,{})]})}),e.jsxs(Ie,{children:[e.jsx(et,{asChild:!0,children:e.jsx(F,{type:"button",variant:"outline",children:a("form.buttons.cancel")})}),e.jsx(F,{type:"submit",onClick:m=>{m.preventDefault(),d.handleSubmit(async o=>{aa.save(o).then(({data:c})=>{c&&(z.success(a("form.buttons.success")),s(),l(!1))})})()},children:a("form.buttons.submit")})]})]})]})})}function lx({table:s,refetch:n,saveOrder:t,isSortMode:r}){const{t:a}=M("notice"),i=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between space-x-2 ",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[!r&&e.jsx(fi,{refetch:n}),!r&&e.jsx(k,{placeholder:a("table.toolbar.search"),value:s.getColumn("title")?.getFilterValue()??"",onChange:l=>s.getColumn("title")?.setFilterValue(l.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),i&&!r&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:[a("table.toolbar.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(F,{variant:r?"default":"outline",onClick:t,className:"h-8",size:"sm",children:a(r?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}const ix=s=>{const{t:n}=M("notice");return[{id:"drag-handle",header:"",cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(xd,{className:"h-4 w-4 cursor-move text-muted-foreground"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.id")}),cell:({row:t})=>e.jsx(q,{variant:"outline",className:"font-mono",children:t.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.show")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(X,{defaultChecked:t.getValue("show"),onCheckedChange:async()=>{const{data:r}=await aa.updateStatus(t.original.id);r||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.title")}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[500px] items-center",children:e.jsx("span",{className:"truncate font-medium",children:t.getValue("title")})}),enableSorting:!1,size:6e3},{id:"actions",header:({column:t})=>e.jsx(O,{className:"justify-end",column:t,title:n("table.columns.actions")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(fi,{refetch:s,dialogTrigger:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(rt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("table.actions.edit")})]}),type:"edit",defaultFormValues:t.original}),e.jsx(_s,{title:n("table.actions.delete.title"),description:n("table.actions.delete.description"),onConfirm:async()=>{aa.drop(t.original.id).then(()=>{z.success(n("table.actions.delete.success")),s()})},children:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(us,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("table.actions.delete.title")})]})})]}),size:100}]};function ox(){const[s,n]=u.useState({}),[t,r]=u.useState({}),[a,i]=u.useState([]),[l,d]=u.useState([]),[x,m]=u.useState(!1),[o,c]=u.useState({}),[f,D]=u.useState({pageSize:50,pageIndex:0}),[S,C]=u.useState([]),{refetch:T}=re({queryKey:["notices"],queryFn:async()=>{const{data:p}=await aa.getList();return C(p),p}});u.useEffect(()=>{r({"drag-handle":x,content:!x,created_at:!x,actions:!x}),D({pageSize:x?99999:50,pageIndex:0})},[x]);const w=(p,V)=>{x&&(p.dataTransfer.setData("text/plain",V.toString()),p.currentTarget.classList.add("opacity-50"))},E=(p,V)=>{if(!x)return;p.preventDefault(),p.currentTarget.classList.remove("bg-muted");const R=parseInt(p.dataTransfer.getData("text/plain"));if(R===V)return;const L=[...S],[K]=L.splice(R,1);L.splice(V,0,K),C(L)},_=async()=>{if(!x){m(!0);return}aa.sort(S.map(p=>p.id)).then(()=>{z.success("排序保存成功"),m(!1),T()}).finally(()=>{m(!1)})},g=Be({data:S??[],columns:ix(T),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,columnSizing:o,pagination:f},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:i,onColumnVisibilityChange:r,onColumnSizingChange:c,onPaginationChange:D,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(ts,{table:g,toolbar:p=>e.jsx(lx,{table:p,refetch:T,saveOrder:_,isSortMode:x}),draggable:x,onDragStart:w,onDragEnd:p=>p.currentTarget.classList.remove("opacity-50"),onDragOver:p=>{p.preventDefault(),p.currentTarget.classList.add("bg-muted")},onDragLeave:p=>p.currentTarget.classList.remove("bg-muted"),onDrop:E,showPagination:!x})})}function cx(){const{t:s}=M("notice");return e.jsxs(Ae,{children:[e.jsxs(qe,{className:"flex items-center justify-between",children:[e.jsx(cs,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")})}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(ox,{})})]})]})}const dx=Object.freeze(Object.defineProperty({__proto__:null,default:cx},Symbol.toStringTag,{value:"Module"})),mx=h.object({id:h.number().nullable(),language:h.string().max(250),category:h.string().max(250),title:h.string().min(1).max(250),body:h.string().min(1),show:h.boolean()}),ux={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function ji({refreshData:s,dialogTrigger:n,type:t="add",defaultFormValues:r=ux}){const{t:a}=M("knowledge"),[i,l]=u.useState(!1),d=we({resolver:Te(mx),defaultValues:r,mode:"onChange",shouldFocusError:!0}),x=new Vn({html:!0});return u.useEffect(()=>{i&&r.id&&Et.getInfo(r.id).then(({data:m})=>{d.reset(m)})},[r.id,d,i]),e.jsxs(me,{onOpenChange:l,open:i,children:[e.jsx(ps,{asChild:!0,children:n||e.jsxs(F,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ue,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add")})]})}),e.jsxs(ce,{className:"sm:max-w-[1025px]",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:a(t==="add"?"form.add":"form.edit")}),e.jsx($e,{})]}),e.jsxs(De,{...d,children:[e.jsx(v,{control:d.control,name:"title",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.title")}),e.jsx("div",{className:"relative ",children:e.jsx(y,{children:e.jsx(k,{placeholder:a("form.titlePlaceholder"),...m})})}),e.jsx(P,{})]})}),e.jsx(v,{control:d.control,name:"category",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.category")}),e.jsx("div",{className:"relative ",children:e.jsx(y,{children:e.jsx(k,{placeholder:a("form.categoryPlaceholder"),...m})})}),e.jsx(P,{})]})}),e.jsx(v,{control:d.control,name:"language",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.language")}),e.jsx(y,{children:e.jsxs(J,{value:m.value,onValueChange:m.onChange,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("form.languagePlaceholder")})}),e.jsx(Y,{children:[{value:"en-US"},{value:"ja-JP"},{value:"ko-KR"},{value:"vi-VN"},{value:"zh-CN"},{value:"zh-TW"}].map(o=>e.jsx(A,{value:o.value,className:"cursor-pointer",children:a(`languages.${o.value}`)},o.value))})]})})]})}),e.jsx(v,{control:d.control,name:"body",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.content")}),e.jsx(y,{children:e.jsx(In,{style:{height:"500px"},value:m.value,renderHTML:o=>x.render(o),onChange:({text:o})=>{m.onChange(o)}})}),e.jsx(P,{})]})}),e.jsx(v,{control:d.control,name:"show",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.show")}),e.jsx("div",{className:"relative py-2",children:e.jsx(y,{children:e.jsx(X,{checked:m.value,onCheckedChange:m.onChange})})}),e.jsx(P,{})]})}),e.jsxs(Ie,{children:[e.jsx(et,{asChild:!0,children:e.jsx(F,{type:"button",variant:"outline",children:a("form.cancel")})}),e.jsx(F,{type:"submit",onClick:()=>{d.handleSubmit(m=>{Et.save(m).then(({data:o})=>{o&&(d.reset(),z.success(a("messages.operationSuccess")),l(!1),s())})})()},children:a("form.submit")})]})]})]})]})}function xx({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=new Set(s?.getFilterValue());return e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx($a,{className:"mr-2 h-4 w-4"}),n,a?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ee,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:a.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:a.size>2?e.jsxs(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[a.size," selected"]}):t.filter(i=>a.has(i.value)).map(i=>e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),e.jsx(Xe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(it,{children:[e.jsx(vt,{placeholder:n}),e.jsxs(ot,{children:[e.jsx(bt,{children:"No results found."}),e.jsx(ks,{children:t.map(i=>{const l=a.has(i.value);return e.jsxs(rs,{onSelect:()=>{l?a.delete(i.value):a.add(i.value);const d=Array.from(a);s?.setFilterValue(d.length?d:void 0)},children:[e.jsx("div",{className:N("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",l?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(pt,{className:N("h-4 w-4")})}),i.icon&&e.jsx(i.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:i.label}),r?.get(i.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(i.value)})]},i.value)})}),a.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{}),e.jsx(ks,{children:e.jsx(rs,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function hx({table:s,refetch:n,saveOrder:t,isSortMode:r}){const a=s.getState().columnFilters.length>0,{t:i}=M("knowledge");return e.jsxs("div",{className:"flex items-center justify-between",children:[r?e.jsx("p",{className:"text-sm text-muted-foreground",children:i("toolbar.sortModeHint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ji,{refreshData:n}),e.jsx(k,{placeholder:i("toolbar.searchPlaceholder"),value:s.getColumn("title")?.getFilterValue()??"",onChange:l=>s.getColumn("title")?.setFilterValue(l.target.value),className:"h-8 w-[250px]"}),s.getColumn("category")&&e.jsx(xx,{column:s.getColumn("category"),title:i("columns.category"),options:Array.from(new Set(s.getCoreRowModel().rows.map(l=>l.getValue("category")))).map(l=>({label:l,value:l}))}),a&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[i("toolbar.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(F,{variant:r?"default":"outline",onClick:t,size:"sm",children:i(r?"toolbar.saveSort":"toolbar.editSort")})})]})}const gx=({refetch:s,isSortMode:n=!1})=>{const{t}=M("knowledge");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx(za,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:r})=>e.jsx(O,{column:r,title:t("columns.id")}),cell:({row:r})=>e.jsx(q,{variant:"outline",className:"justify-center",children:r.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:r})=>e.jsx(O,{column:r,title:t("columns.status")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx(X,{defaultChecked:r.getValue("show"),onCheckedChange:async()=>{Et.updateStatus({id:r.original.id}).then(({data:a})=>{a||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:r})=>e.jsx(O,{column:r,title:t("columns.title")}),cell:({row:r})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"line-clamp-2 font-medium",children:r.getValue("title")})}),enableSorting:!0,size:600},{accessorKey:"category",header:({column:r})=>e.jsx(O,{column:r,title:t("columns.category")}),cell:({row:r})=>e.jsx(q,{variant:"secondary",className:"max-w-[180px] truncate",children:r.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:r})=>e.jsx(O,{className:"justify-end",column:r,title:t("columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx(ji,{refreshData:s,dialogTrigger:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(rt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:t("form.edit")})]}),type:"edit",defaultFormValues:r.original}),e.jsx(_s,{title:t("messages.deleteConfirm"),description:t("messages.deleteDescription"),confirmText:t("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{Et.drop({id:r.original.id}).then(({data:a})=>{a&&(z.success(t("messages.operationSuccess")),s())})},children:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(us,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:t("messages.deleteButton")})]})})]}),size:100}]};function px(){const[s,n]=u.useState([]),[t,r]=u.useState([]),[a,i]=u.useState(!1),[l,d]=u.useState([]),[x,m]=u.useState({"drag-handle":!1}),[o,c]=u.useState({pageSize:20,pageIndex:0}),{refetch:f,isLoading:D,data:S}=re({queryKey:["knowledge"],queryFn:async()=>{const{data:_}=await Et.getList();return d(_||[]),_}});u.useEffect(()=>{m({"drag-handle":a,actions:!a}),c({pageSize:a?99999:10,pageIndex:0})},[a]);const C=(_,g)=>{a&&(_.dataTransfer.setData("text/plain",g.toString()),_.currentTarget.classList.add("opacity-50"))},T=(_,g)=>{if(!a)return;_.preventDefault(),_.currentTarget.classList.remove("bg-muted");const p=parseInt(_.dataTransfer.getData("text/plain"));if(p===g)return;const V=[...l],[R]=V.splice(p,1);V.splice(g,0,R),d(V)},w=async()=>{a?Et.sort({ids:l.map(_=>_.id)}).then(()=>{f(),i(!1),z.success("排序保存成功")}):i(!0)},E=Be({data:l,columns:gx({refetch:f,isSortMode:a}),state:{sorting:t,columnFilters:s,columnVisibility:x,pagination:o},onSortingChange:r,onColumnFiltersChange:n,onColumnVisibilityChange:m,onPaginationChange:c,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ts,{table:E,toolbar:_=>e.jsx(hx,{table:_,refetch:f,saveOrder:w,isSortMode:a}),draggable:a,onDragStart:C,onDragEnd:_=>_.currentTarget.classList.remove("opacity-50"),onDragOver:_=>{_.preventDefault(),_.currentTarget.classList.add("bg-muted")},onDragLeave:_=>_.currentTarget.classList.remove("bg-muted"),onDrop:T,showPagination:!a})}function fx(){const{t:s}=M("knowledge");return e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight mb-2",children:s("title")}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(px,{})})]})]})}const jx=Object.freeze(Object.defineProperty({__proto__:null,default:fx},Symbol.toStringTag,{value:"Module"}));function vx(s,n){const[t,r]=u.useState(s);return u.useEffect(()=>{const a=setTimeout(()=>r(s),n);return()=>{clearTimeout(a)}},[s,n]),t}function mn(s,n){if(s.length===0)return{};if(!n)return{"":s};const t={};return s.forEach(r=>{const a=r[n]||"";t[a]||(t[a]=[]),t[a].push(r)}),t}function bx(s,n){const t=JSON.parse(JSON.stringify(s));for(const[r,a]of Object.entries(t))t[r]=a.filter(i=>!n.find(l=>l.value===i.value));return t}function yx(s,n){for(const[,t]of Object.entries(s))if(t.some(r=>n.find(a=>a.value===r.value)))return!0;return!1}const vi=u.forwardRef(({className:s,...n},t)=>hd(a=>a.filtered.count===0)?e.jsx("div",{ref:t,className:N("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...n}):null);vi.displayName="CommandEmpty";const nt=u.forwardRef(({value:s,onChange:n,placeholder:t,defaultOptions:r=[],options:a,delay:i,onSearch:l,loadingIndicator:d,emptyIndicator:x,maxSelected:m=Number.MAX_SAFE_INTEGER,onMaxSelected:o,hidePlaceholderWhenSelected:c,disabled:f,groupBy:D,className:S,badgeClassName:C,selectFirstItem:T=!0,creatable:w=!1,triggerSearchOnFocus:E=!1,commandProps:_,inputProps:g,hideClearAllButton:p=!1},V)=>{const R=u.useRef(null),[L,K]=u.useState(!1),Z=u.useRef(!1),[se,ae]=u.useState(!1),[H,ee]=u.useState(s||[]),[je,ds]=u.useState(mn(r,D)),[Me,le]=u.useState(""),Ts=vx(Me,i||500);u.useImperativeHandle(V,()=>({selectedValue:[...H],input:R.current,focus:()=>R.current?.focus()}),[H]);const Ns=u.useCallback(ne=>{const ve=H.filter(Ye=>Ye.value!==ne.value);ee(ve),n?.(ve)},[n,H]),Ws=u.useCallback(ne=>{const ve=R.current;ve&&((ne.key==="Delete"||ne.key==="Backspace")&&ve.value===""&&H.length>0&&(H[H.length-1].fixed||Ns(H[H.length-1])),ne.key==="Escape"&&ve.blur())},[Ns,H]);u.useEffect(()=>{s&&ee(s)},[s]),u.useEffect(()=>{if(!a||l)return;const ne=mn(a||[],D);JSON.stringify(ne)!==JSON.stringify(je)&&ds(ne)},[r,a,D,l,je]),u.useEffect(()=>{const ne=async()=>{ae(!0);const Ye=await l?.(Ts);ds(mn(Ye||[],D)),ae(!1)};(async()=>{!l||!L||(E&&await ne(),Ts&&await ne())})()},[Ts,D,L,E]);const Us=()=>{if(!w||yx(je,[{value:Me,label:Me}])||H.find(ve=>ve.value===Me))return;const ne=e.jsx(rs,{value:Me,className:"cursor-pointer",onMouseDown:ve=>{ve.preventDefault(),ve.stopPropagation()},onSelect:ve=>{if(H.length>=m){o?.(H.length);return}le("");const Ye=[...H,{value:ve,label:ve}];ee(Ye),n?.(Ye)},children:`Create "${Me}"`});if(!l&&Me.length>0||l&&Ts.length>0&&!se)return ne},Ys=u.useCallback(()=>{if(x)return l&&!w&&Object.keys(je).length===0?e.jsx(rs,{value:"-",disabled:!0,children:x}):e.jsx(vi,{children:x})},[w,x,l,je]),yt=u.useMemo(()=>bx(je,H),[je,H]),U=u.useCallback(()=>{if(_?.filter)return _.filter;if(w)return(ne,ve)=>ne.toLowerCase().includes(ve.toLowerCase())?1:-1},[w,_?.filter]),te=u.useCallback(()=>{const ne=H.filter(ve=>ve.fixed);ee(ne),n?.(ne)},[n,H]);return e.jsxs(it,{..._,onKeyDown:ne=>{Ws(ne),_?.onKeyDown?.(ne)},className:N("h-auto overflow-visible bg-transparent",_?.className),shouldFilter:_?.shouldFilter!==void 0?_.shouldFilter:!l,filter:U(),children:[e.jsx("div",{className:N("rounded-md border border-input text-sm ring-offset-background focus-within:ring-1 focus-within:ring-ring ",{"px-3 py-2":H.length!==0,"cursor-text":!f&&H.length!==0},S),onClick:()=>{f||R.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[H.map(ne=>e.jsxs(q,{className:N("data-[disabled]:bg-muted-foreground data-[disabled]:text-muted data-[disabled]:hover:bg-muted-foreground","data-[fixed]:bg-muted-foreground data-[fixed]:text-muted data-[fixed]:hover:bg-muted-foreground",C),"data-fixed":ne.fixed,"data-disabled":f||void 0,children:[ne.label,e.jsx("button",{className:N("ml-1 rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",(f||ne.fixed)&&"hidden"),onKeyDown:ve=>{ve.key==="Enter"&&Ns(ne)},onMouseDown:ve=>{ve.preventDefault(),ve.stopPropagation()},onClick:()=>Ns(ne),children:e.jsx(_n,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},ne.value)),e.jsx(xs.Input,{...g,ref:R,value:Me,disabled:f,onValueChange:ne=>{le(ne),g?.onValueChange?.(ne)},onBlur:ne=>{Z.current===!1&&K(!1),g?.onBlur?.(ne)},onFocus:ne=>{K(!0),E&&l?.(Ts),g?.onFocus?.(ne)},placeholder:c&&H.length!==0?"":t,className:N("flex-1 bg-transparent outline-none placeholder:text-muted-foreground",{"w-full":c,"px-3 py-2":H.length===0,"ml-1":H.length!==0},g?.className)}),e.jsx("button",{type:"button",onClick:te,className:N((p||f||H.length<1||H.filter(ne=>ne.fixed).length===H.length)&&"hidden"),children:e.jsx(_n,{})})]})}),e.jsx("div",{className:"relative",children:L&&e.jsx(ot,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{Z.current=!1},onMouseEnter:()=>{Z.current=!0},onMouseUp:()=>{R.current?.focus()},children:se?e.jsx(e.Fragment,{children:d}):e.jsxs(e.Fragment,{children:[Ys(),Us(),!T&&e.jsx(rs,{value:"-",className:"hidden"}),Object.entries(yt).map(([ne,ve])=>e.jsx(ks,{heading:ne,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:ve.map(Ye=>e.jsx(rs,{value:Ye.value,disabled:Ye.disable,onMouseDown:_e=>{_e.preventDefault(),_e.stopPropagation()},onSelect:()=>{if(H.length>=m){o?.(H.length);return}le("");const _e=[...H,Ye];ee(_e),n?.(_e)},className:N("cursor-pointer",Ye.disable&&"cursor-default text-muted-foreground"),children:Ye.label},Ye.value))})},ne))]})})})]})});nt.displayName="MultipleSelector";const _x=s=>h.object({id:h.number().optional(),name:h.string().min(2,s("messages.nameValidation.min")).max(50,s("messages.nameValidation.max")).regex(/^[a-zA-Z0-9\u4e00-\u9fa5_-]+$/,s("messages.nameValidation.pattern"))});function Za({refetch:s,dialogTrigger:n,defaultValues:t={name:""},type:r="add"}){const{t:a}=M("group"),i=we({resolver:Te(_x(a)),defaultValues:t,mode:"onChange"}),[l,d]=u.useState(!1),[x,m]=u.useState(!1),o=async c=>{m(!0),jt.save(c).then(()=>{z.success(a(r==="edit"?"messages.updateSuccess":"messages.createSuccess")),s&&s(),i.reset(),d(!1)}).finally(()=>{m(!1)})};return e.jsxs(me,{open:l,onOpenChange:d,children:[e.jsx(ps,{asChild:!0,children:n||e.jsxs(F,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ue,{icon:"ion:add"}),e.jsx("span",{children:a("form.add")})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:a(r==="edit"?"form.edit":"form.create")}),e.jsx($e,{children:a(r==="edit"?"form.editDescription":"form.createDescription")})]}),e.jsx(De,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(o),className:"space-y-4",children:[e.jsx(v,{control:i.control,name:"name",render:({field:c})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.name")}),e.jsx(y,{children:e.jsx(k,{placeholder:a("form.namePlaceholder"),...c,className:"w-full"})}),e.jsx($,{children:a("form.nameDescription")}),e.jsx(P,{})]})}),e.jsxs(Ie,{className:"gap-2",children:[e.jsx(et,{asChild:!0,children:e.jsx(F,{type:"button",variant:"outline",children:a("form.cancel")})}),e.jsxs(F,{type:"submit",disabled:x||!i.formState.isValid,children:[x&&e.jsx(Sa,{className:"mr-2 h-4 w-4 animate-spin"}),a(r==="edit"?"form.update":"form.create")]})]})]})})]})]})}const bi=u.createContext(void 0);function Nx({children:s,refetch:n}){const[t,r]=u.useState(!1),[a,i]=u.useState(null),[l,d]=u.useState(ge.Shadowsocks);return e.jsx(bi.Provider,{value:{isOpen:t,setIsOpen:r,editingServer:a,setEditingServer:i,serverType:l,setServerType:d,refetch:n},children:s})}function yi(){const s=u.useContext(bi);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function un({dialogTrigger:s,value:n,setValue:t,templateType:r}){const{t:a}=M("server");u.useEffect(()=>{console.log(n)},[n]);const[i,l]=u.useState(!1),[d,x]=u.useState(()=>{if(!n||Object.keys(n).length===0)return"";try{return JSON.stringify(n,null,2)}catch{return""}}),[m,o]=u.useState(null),c=w=>{if(!w)return null;try{const E=JSON.parse(w);return typeof E!="object"||E===null?a("network_settings.validation.must_be_object"):null}catch{return a("network_settings.validation.invalid_json")}},f={tcp:{label:"TCP",content:{acceptProxyProtocol:!1,header:{type:"none"}}},"tcp-http":{label:"TCP + HTTP",content:{acceptProxyProtocol:!1,header:{type:"http",request:{version:"1.1",method:"GET",path:["/"],headers:{Host:["www.example.com"]}},response:{version:"1.1",status:"200",reason:"OK"}}}},grpc:{label:"gRPC",content:{serviceName:"GunService"}},ws:{label:"WebSocket",content:{path:"/",headers:{Host:"v2ray.com"}}},httpupgrade:{label:"HttpUpgrade",content:{acceptProxyProtocol:!1,path:"/",host:"xray.com",headers:{key:"value"}}},xhttp:{label:"XHTTP",content:{host:"example.com",path:"/yourpath",mode:"auto",extra:{headers:{},xPaddingBytes:"100-1000",noGRPCHeader:!1,noSSEHeader:!1,scMaxEachPostBytes:1e6,scMinPostsIntervalMs:30,scMaxBufferedPosts:30,xmux:{maxConcurrency:"16-32",maxConnections:0,cMaxReuseTimes:"64-128",cMaxLifetimeMs:0,hMaxRequestTimes:"800-900",hKeepAlivePeriod:0},downloadSettings:{address:"",port:443,network:"xhttp",security:"tls",tlsSettings:{},xhttpSettings:{path:"/yourpath"},sockopt:{}}}}}},D=()=>{switch(r){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];case"httpupgrade":return["httpupgrade"];case"xhttp":return["xhttp"];default:return[]}},S=()=>{const w=c(d||"");if(w){z.error(w);return}try{if(!d){t(null),l(!1);return}t(JSON.parse(d)),l(!1)}catch{z.error(a("network_settings.errors.save_failed"))}},C=w=>{x(w),o(c(w))},T=w=>{const E=f[w];if(E){const _=JSON.stringify(E.content,null,2);x(_),o(null)}};return u.useEffect(()=>{i&&console.log(n)},[i,n]),u.useEffect(()=>{i&&n&&Object.keys(n).length>0&&x(JSON.stringify(n,null,2))},[i,n]),e.jsxs(me,{open:i,onOpenChange:w=>{!w&&i&&S(),l(w)},children:[e.jsx(ps,{asChild:!0,children:s??e.jsx(G,{variant:"link",children:a("network_settings.edit_protocol")})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(pe,{children:e.jsx(ue,{children:a("network_settings.edit_protocol_config")})}),e.jsxs("div",{className:"space-y-4",children:[D().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:D().map(w=>e.jsx(G,{variant:"outline",size:"sm",onClick:()=>T(w),children:a("network_settings.use_template",{template:f[w].label})},w))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Es,{className:`min-h-[200px] font-mono text-sm ${m?"border-red-500 focus-visible:ring-red-500":""}`,value:d,placeholder:D().length>0?a("network_settings.json_config_placeholder_with_template"):a("network_settings.json_config_placeholder"),onChange:w=>C(w.target.value)}),m&&e.jsx("p",{className:"text-sm text-red-500",children:m})]})]}),e.jsxs(Ie,{className:"gap-2",children:[e.jsx(G,{variant:"outline",onClick:()=>l(!1),children:a("common.cancel")}),e.jsx(G,{onClick:S,disabled:!!m,children:a("common.confirm")})]})]})]})}function mp(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const wx={},Cx=Object.freeze(Object.defineProperty({__proto__:null,default:wx},Symbol.toStringTag,{value:"Module"})),up=Ld(Cx),yr=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Sx=()=>{try{const s=gd.box.keyPair(),n=yr(lr.encodeBase64(s.secretKey)),t=yr(lr.encodeBase64(s.publicKey));return{privateKey:n,publicKey:t}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},kx=()=>{try{return Sx()}catch(s){throw console.error("Error generating key pair:",s),s}},Tx=s=>{const n=new Uint8Array(Math.ceil(s/2));return window.crypto.getRandomValues(n),Array.from(n).map(t=>t.toString(16).padStart(2,"0")).join("").substring(0,s)},Dx=()=>{const s=Math.floor(Math.random()*8)*2+2;return Tx(s)},Fx=h.object({cipher:h.string().default("aes-128-gcm"),plugin:h.string().optional().default(""),plugin_opts:h.string().optional().default(""),client_fingerprint:h.string().optional().default("chrome")}),Px=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({})}),Lx=h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({})}),Rx=h.object({version:h.coerce.number().default(2),alpn:h.string().default("h2"),obfs:h.object({open:h.coerce.boolean().default(!1),type:h.string().default("salamander"),password:h.string().default("")}).default({}),tls:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),bandwidth:h.object({up:h.string().default(""),down:h.string().default("")}).default({}),hop_interval:h.number().optional(),port_range:h.string().optional()}),Ex=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),reality_settings:h.object({server_port:h.coerce.number().default(443),server_name:h.string().default(""),allow_insecure:h.boolean().default(!1),public_key:h.string().default(""),private_key:h.string().default(""),short_id:h.string().default("")}).default({}),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({}),flow:h.string().default("")}),Vx=h.object({version:h.coerce.number().default(5),congestion_control:h.string().default("bbr"),alpn:h.array(h.string()).default(["h3"]),udp_relay_mode:h.string().default("native"),tls:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({})}),Ix=h.object({}),Mx=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({})}),Ox=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({})}),zx=h.object({transport:h.string().default("tcp"),multiplexing:h.string().default("MULTIPLEXING_LOW")}),$x=h.object({padding_scheme:h.array(h.string()).optional().default([]),tls:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({})}),Oe={shadowsocks:{schema:Fx,ciphers:["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"],plugins:[{value:"none",label:"None"},{value:"obfs",label:"Simple Obfs"},{value:"v2ray-plugin",label:"V2Ray Plugin"}],clientFingerprints:[{value:"chrome",label:"Chrome"},{value:"firefox",label:"Firefox"},{value:"safari",label:"Safari"},{value:"ios",label:"iOS"}]},vmess:{schema:Px,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:Lx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:Rx,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:Ex,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"},{value:"kcp",label:"mKCP"},{value:"httpupgrade",label:"HttpUpgrade"},{value:"xhttp",label:"XHTTP"}],flowOptions:["none","xtls-rprx-direct","xtls-rprx-splice","xtls-rprx-vision"]},tuic:{schema:Vx,versions:["5","4"],congestionControls:["bbr","cubic","new_reno"],alpnOptions:[{value:"h3",label:"HTTP/3"},{value:"h2",label:"HTTP/2"},{value:"http/1.1",label:"HTTP/1.1"}],udpRelayModes:[{value:"native",label:"Native"},{value:"quic",label:"QUIC"}]},socks:{schema:Ix},naive:{schema:Ox},http:{schema:Mx},mieru:{schema:zx,transportOptions:[{value:"tcp",label:"TCP"},{value:"udp",label:"UDP"}],multiplexingOptions:[{value:"MULTIPLEXING_OFF",label:"Off"},{value:"MULTIPLEXING_LOW",label:"Low"},{value:"MULTIPLEXING_MIDDLE",label:"Middle"},{value:"MULTIPLEXING_HIGH",label:"High"}]},anytls:{schema:$x,defaultPaddingScheme:["stop=8","0=30-30","1=100-400","2=400-500,c,500-1000,c,500-1000,c,500-1000,c,500-1000","3=9-9,500-1000","4=500-1000","5=500-1000","6=500-1000","7=500-1000"]}},Ax=({serverType:s,value:n,onChange:t})=>{const{t:r}=M("server"),a=s?Oe[s]:null,i=a?.schema||h.record(h.any()),l=s?i.parse({}):{},d=we({resolver:Te(i),defaultValues:l,mode:"onChange"});if(u.useEffect(()=>{if(!n||Object.keys(n).length===0){if(s){const g=i.parse({});d.reset(g)}}else d.reset(n)},[s,n,t,d,i]),u.useEffect(()=>{const g=d.watch(p=>{t(p)});return()=>g.unsubscribe()},[d,t]),!s||!a)return null;const _={shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:d.control,name:"cipher",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.shadowsocks.cipher.label")}),e.jsx(y,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.shadowsocks.cipher.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.shadowsocks.ciphers.map(p=>e.jsx(A,{value:p,children:p},p))})})]})})]})}),e.jsx(v,{control:d.control,name:"plugin",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.shadowsocks.plugin.label","插件")}),e.jsx(y,{children:e.jsxs(J,{onValueChange:p=>g.onChange(p==="none"?"":p),value:g.value===""?"none":g.value||"none",children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.shadowsocks.plugin.placeholder","选择插件")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.shadowsocks.plugins.map(p=>e.jsx(A,{value:p.value,children:p.label},p.value))})})]})}),e.jsx($,{children:g.value&&g.value!=="none"&&g.value!==""&&e.jsxs(e.Fragment,{children:[g.value==="obfs"&&r("dynamic_form.shadowsocks.plugin.obfs_hint","提示:配置格式如 obfs=http;obfs-host=www.bing.com;path=/"),g.value==="v2ray-plugin"&&r("dynamic_form.shadowsocks.plugin.v2ray_hint","提示:WebSocket模式格式为 mode=websocket;host=mydomain.me;path=/;tls=true,QUIC模式格式为 mode=quic;host=mydomain.me")]})})]})}),d.watch("plugin")&&d.watch("plugin")!=="none"&&d.watch("plugin")!==""&&e.jsx(v,{control:d.control,name:"plugin_opts",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.shadowsocks.plugin_opts.label","插件选项")}),e.jsx($,{children:r("dynamic_form.shadowsocks.plugin_opts.description","按照 key=value;key2=value2 格式输入插件选项")}),e.jsx(y,{children:e.jsx(k,{type:"text",placeholder:r("dynamic_form.shadowsocks.plugin_opts.placeholder","例如: mode=tls;host=bing.com"),...g})})]})}),(d.watch("plugin")==="shadow-tls"||d.watch("plugin")==="restls")&&e.jsx(v,{control:d.control,name:"client_fingerprint",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.shadowsocks.client_fingerprint","客户端指纹")}),e.jsx(y,{children:e.jsxs(J,{value:g.value||"chrome",onValueChange:g.onChange,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.shadowsocks.client_fingerprint_placeholder","选择客户端指纹")})}),e.jsx(Y,{children:Oe.shadowsocks.clientFingerprints.map(p=>e.jsx(A,{value:p.value,children:p.label},p.value))})]})}),e.jsx($,{children:r("dynamic_form.shadowsocks.client_fingerprint_description","客户端伪装指纹,用于降低被识别风险")})]})})]}),vmess:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:d.control,name:"tls",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.vmess.tls.label")}),e.jsx(y,{children:e.jsxs(J,{value:g.value?.toString(),onValueChange:p=>g.onChange(Number(p)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.vmess.tls.placeholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:r("dynamic_form.vmess.tls.disabled")}),e.jsx(A,{value:"1",children:r("dynamic_form.vmess.tls.enabled")})]})]})})]})}),d.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.vmess.tls_settings.server_name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.vmess.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:d.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.vmess.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(X,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),e.jsx(v,{control:d.control,name:"network",render:({field:g})=>e.jsxs(j,{children:[e.jsxs(b,{children:[r("dynamic_form.vmess.network.label"),e.jsx(un,{value:d.watch("network_settings"),setValue:p=>d.setValue("network_settings",p),templateType:d.watch("network")})]}),e.jsx(y,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.vmess.network.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.vmess.networkOptions.map(p=>e.jsx(A,{value:p.value,className:"cursor-pointer",children:p.label},p.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.trojan.server_name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.trojan.server_name.placeholder"),...g,value:g.value||""})})]})}),e.jsx(v,{control:d.control,name:"allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.trojan.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(X,{checked:g.value||!1,onCheckedChange:g.onChange})})})]})})]}),e.jsx(v,{control:d.control,name:"network",render:({field:g})=>e.jsxs(j,{children:[e.jsxs(b,{children:[r("dynamic_form.trojan.network.label"),e.jsx(un,{value:d.watch("network_settings")||{},setValue:p=>d.setValue("network_settings",p),templateType:d.watch("network")||"tcp"})]}),e.jsx(y,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value||"tcp",children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.trojan.network.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.trojan.networkOptions.map(p=>e.jsx(A,{value:p.value,className:"cursor-pointer",children:p.label},p.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"version",render:({field:g})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:r("dynamic_form.hysteria.version.label")}),e.jsx(y,{children:e.jsxs(J,{value:(g.value||2).toString(),onValueChange:p=>g.onChange(Number(p)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.hysteria.version.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.hysteria.versions.map(p=>e.jsxs(A,{value:p,className:"cursor-pointer",children:["V",p]},p))})})]})})]})}),d.watch("version")==1&&e.jsx(v,{control:d.control,name:"alpn",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.hysteria.alpn.label")}),e.jsx(y,{children:e.jsxs(J,{value:g.value||"h2",onValueChange:g.onChange,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.hysteria.alpn.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.hysteria.alpnOptions.map(p=>e.jsx(A,{value:p,children:p},p))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"obfs.open",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.hysteria.obfs.label")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(X,{checked:g.value||!1,onCheckedChange:g.onChange})})})]})}),!!d.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[d.watch("version")=="2"&&e.jsx(v,{control:d.control,name:"obfs.type",render:({field:g})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:r("dynamic_form.hysteria.obfs.type.label")}),e.jsx(y,{children:e.jsxs(J,{value:g.value||"salamander",onValueChange:g.onChange,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.hysteria.obfs.type.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:e.jsx(A,{value:"salamander",children:r("dynamic_form.hysteria.obfs.type.salamander")})})})]})})]})}),e.jsx(v,{control:d.control,name:"obfs.password",render:({field:g})=>e.jsxs(j,{className:d.watch("version")==2?"w-full":"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.hysteria.obfs.password.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.hysteria.obfs.password.placeholder"),...g,value:g.value||"",className:"pr-9"})}),e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",V=Array.from(crypto.getRandomValues(new Uint8Array(16))).map(R=>p[R%p.length]).join("");d.setValue("obfs.password",V),z.success(r("dynamic_form.hysteria.obfs.password.generate_success"))},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(Ue,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})]})]})})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"tls.server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.hysteria.tls.server_name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.hysteria.tls.server_name.placeholder"),...g,value:g.value||""})})]})}),e.jsx(v,{control:d.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.hysteria.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(X,{checked:g.value||!1,onCheckedChange:g.onChange})})})]})})]}),e.jsx(v,{control:d.control,name:"bandwidth.up",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.hysteria.bandwidth.up.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:r("dynamic_form.hysteria.bandwidth.up.placeholder")+(d.watch("version")==2?r("dynamic_form.hysteria.bandwidth.up.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...g,value:g.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:r("dynamic_form.hysteria.bandwidth.up.suffix")})})]})]})}),e.jsx(v,{control:d.control,name:"bandwidth.down",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.hysteria.bandwidth.down.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:r("dynamic_form.hysteria.bandwidth.down.placeholder")+(d.watch("version")==2?r("dynamic_form.hysteria.bandwidth.down.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...g,value:g.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:r("dynamic_form.hysteria.bandwidth.down.suffix")})})]})]})}),e.jsx(e.Fragment,{children:e.jsx(v,{control:d.control,name:"hop_interval",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.hysteria.hop_interval.label","Hop 间隔 (秒)")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:r("dynamic_form.hysteria.hop_interval.placeholder","例如: 30"),...g,value:g.value||"",onChange:p=>{const V=p.target.value?parseInt(p.target.value):void 0;g.onChange(V)}})}),e.jsx($,{children:r("dynamic_form.hysteria.hop_interval.description","Hop 间隔时间,单位为秒")})]})})})]}),vless:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:d.control,name:"tls",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.vless.tls.label")}),e.jsx(y,{children:e.jsxs(J,{value:g.value?.toString(),onValueChange:p=>g.onChange(Number(p)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.vless.tls.placeholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:r("dynamic_form.vless.tls.none")}),e.jsx(A,{value:"1",children:r("dynamic_form.vless.tls.tls")}),e.jsx(A,{value:"2",children:r("dynamic_form.vless.tls.reality")})]})]})})]})}),d.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.vless.tls_settings.server_name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.vless.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:d.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.vless.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(X,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),d.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"reality_settings.server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.vless.reality_settings.server_name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.vless.reality_settings.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:d.control,name:"reality_settings.server_port",render:({field:g})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:r("dynamic_form.vless.reality_settings.server_port.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.vless.reality_settings.server_port.placeholder"),...g})})]})}),e.jsx(v,{control:d.control,name:"reality_settings.allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.vless.reality_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(X,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx(v,{control:d.control,name:"reality_settings.private_key",render:({field:g})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:r("dynamic_form.vless.reality_settings.private_key.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(y,{children:e.jsx(k,{...g,className:"pr-9"})}),e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{try{const p=kx();d.setValue("reality_settings.private_key",p.privateKey),d.setValue("reality_settings.public_key",p.publicKey),z.success(r("dynamic_form.vless.reality_settings.key_pair.success"))}catch{z.error(r("dynamic_form.vless.reality_settings.key_pair.error"))}},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(Ue,{icon:"ion:key-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(Ta,{children:e.jsx(de,{children:e.jsx("p",{children:r("dynamic_form.vless.reality_settings.key_pair.generate")})})})]})]})]})})}),e.jsx(v,{control:d.control,name:"reality_settings.public_key",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.vless.reality_settings.public_key.label")}),e.jsx(y,{children:e.jsx(k,{...g})})]})}),e.jsx(v,{control:d.control,name:"reality_settings.short_id",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.vless.reality_settings.short_id.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(y,{children:e.jsx(k,{...g,className:"pr-9",placeholder:r("dynamic_form.vless.reality_settings.short_id.placeholder")})}),e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const p=Dx();d.setValue("reality_settings.short_id",p),z.success(r("dynamic_form.vless.reality_settings.short_id.success"))},className:"absolute right-0 top-0 h-full px-2 active:scale-90 transition-transform duration-150",children:e.jsx(Ue,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform hover:rotate-180 duration-300"})})}),e.jsx(Ta,{children:e.jsx(de,{children:e.jsx("p",{children:r("dynamic_form.vless.reality_settings.short_id.generate")})})})]})]}),e.jsx($,{className:"text-xs text-muted-foreground",children:r("dynamic_form.vless.reality_settings.short_id.description")})]})})]}),e.jsx(v,{control:d.control,name:"network",render:({field:g})=>e.jsxs(j,{children:[e.jsxs(b,{children:[r("dynamic_form.vless.network.label"),e.jsx(un,{value:d.watch("network_settings"),setValue:p=>d.setValue("network_settings",p),templateType:d.watch("network")})]}),e.jsx(y,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.vless.network.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.vless.networkOptions.map(p=>e.jsx(A,{value:p.value,className:"cursor-pointer",children:p.label},p.value))})})]})})]})}),e.jsx(v,{control:d.control,name:"flow",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.vless.flow.label")}),e.jsx(y,{children:e.jsxs(J,{onValueChange:p=>g.onChange(p==="none"?null:p),value:g.value||"none",children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.vless.flow.placeholder")})}),e.jsx(Y,{children:Oe.vless.flowOptions.map(p=>e.jsx(A,{value:p,children:p},p))})]})})]})})]}),tuic:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:d.control,name:"version",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.tuic.version.label")}),e.jsx(y,{children:e.jsxs(J,{value:g.value?.toString(),onValueChange:p=>g.onChange(Number(p)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.tuic.version.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.tuic.versions.map(p=>e.jsxs(A,{value:p,children:["V",p]},p))})})]})})]})}),e.jsx(v,{control:d.control,name:"congestion_control",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.tuic.congestion_control.label")}),e.jsx(y,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.tuic.congestion_control.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.tuic.congestionControls.map(p=>e.jsx(A,{value:p,children:p.toUpperCase()},p))})})]})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"tls.server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.tuic.tls.server_name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.tuic.tls.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:d.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.tuic.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(X,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),e.jsx(v,{control:d.control,name:"alpn",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.tuic.tls.alpn.label")}),e.jsx(y,{children:e.jsx(nt,{options:Oe.tuic.alpnOptions,onChange:p=>g.onChange(p.map(V=>V.value)),value:Oe.tuic.alpnOptions.filter(p=>g.value?.includes(p.value)),placeholder:r("dynamic_form.tuic.tls.alpn.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:r("dynamic_form.tuic.tls.alpn.empty")})})})]})}),e.jsx(v,{control:d.control,name:"udp_relay_mode",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.tuic.udp_relay_mode.label")}),e.jsx(y,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.tuic.udp_relay_mode.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.tuic.udpRelayModes.map(p=>e.jsx(A,{value:p.value,children:p.label},p.value))})})]})})]})})]}),socks:()=>e.jsx(e.Fragment,{}),naive:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:d.control,name:"tls",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.naive.tls.label")}),e.jsx(y,{children:e.jsxs(J,{value:g.value?.toString(),onValueChange:p=>g.onChange(Number(p)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.naive.tls.placeholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:r("dynamic_form.naive.tls.disabled")}),e.jsx(A,{value:"1",children:r("dynamic_form.naive.tls.enabled")})]})]})})]})}),d.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.naive.tls_settings.server_name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.naive.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:d.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.naive.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(X,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]}),http:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:d.control,name:"tls",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.http.tls.label")}),e.jsx(y,{children:e.jsxs(J,{value:g.value?.toString(),onValueChange:p=>g.onChange(Number(p)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.http.tls.placeholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:r("dynamic_form.http.tls.disabled")}),e.jsx(A,{value:"1",children:r("dynamic_form.http.tls.enabled")})]})]})})]})}),d.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.http.tls_settings.server_name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.http.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(v,{control:d.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.http.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(X,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]}),mieru:()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{control:d.control,name:"transport",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.mieru.transport.label")}),e.jsx(y,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.mieru.transport.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.mieru.transportOptions.map(p=>e.jsx(A,{value:p.value,children:p.label},p.value))})})]})})]})}),e.jsx(v,{control:d.control,name:"multiplexing",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.mieru.multiplexing.label")}),e.jsx(y,{children:e.jsxs(J,{onValueChange:g.onChange,value:g.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dynamic_form.mieru.multiplexing.placeholder")})}),e.jsx(Y,{children:e.jsx(fs,{children:Oe.mieru.multiplexingOptions.map(p=>e.jsx(A,{value:p.value,children:p.label},p.value))})})]})})]})})]}),anytls:()=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:d.control,name:"padding_scheme",render:({field:g})=>e.jsxs(j,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(b,{children:r("dynamic_form.anytls.padding_scheme.label","AnyTLS 填充方案")}),e.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:()=>{d.setValue("padding_scheme",Oe.anytls.defaultPaddingScheme),z.success(r("dynamic_form.anytls.padding_scheme.default_success","已设置默认填充方案"))},className:"h-7 px-2",children:r("dynamic_form.anytls.padding_scheme.use_default","使用默认方案")})]}),e.jsx($,{children:r("dynamic_form.anytls.padding_scheme.description","每行一个填充规则,格式如: stop=8, 0=30-30")}),e.jsx(y,{children:e.jsx("textarea",{className:"flex min-h-[100px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:r("dynamic_form.anytls.padding_scheme.placeholder",`例如: +File: ${ro} +Line: ${lo}`}return JSON.stringify(Y,null,2)}catch{return V.context}})()})})]})]}),e.jsx(Ie,{children:e.jsx(Zs,{asChild:!0,children:e.jsx(G,{variant:"outline",children:s("common:close")})})})]})}),e.jsx(de,{open:ae,onOpenChange:B,children:e.jsxs(oe,{className:"max-w-2xl",children:[e.jsx(ge,{children:e.jsxs(me,{className:"flex items-center gap-2",children:[e.jsx(ms,{className:"h-5 w-5 text-destructive"}),s("dashboard:systemLog.clearLogs")]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Qe,{htmlFor:"clearDays",children:s("dashboard:systemLog.clearDays")}),e.jsx(D,{id:"clearDays",type:"number",min:"0",max:"365",value:se,onChange:Y=>{const Vs=Y.target.value;if(Vs==="")fe(0);else{const _t=parseInt(Vs);!isNaN(_t)&&_t>=0&&_t<=365&&fe(_t)}},placeholder:"0"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearDaysDesc")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Qe,{htmlFor:"clearLevel",children:s("dashboard:systemLog.clearLevel")}),e.jsxs(X,{value:cs,onValueChange:Me,children:[e.jsx(J,{children:e.jsx(Z,{})}),e.jsxs(Q,{children:[e.jsx(q,{value:"all",children:s("dashboard:systemLog.tabs.all")}),e.jsx(q,{value:"info",children:s("dashboard:systemLog.tabs.info")}),e.jsx(q,{value:"warning",children:s("dashboard:systemLog.tabs.warning")}),e.jsx(q,{value:"error",children:s("dashboard:systemLog.tabs.error")})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Qe,{htmlFor:"clearLimit",children:s("dashboard:systemLog.clearLimit")}),e.jsx(D,{id:"clearLimit",type:"number",min:"100",max:"10000",value:re,onChange:Y=>ks(parseInt(Y.target.value)||1e3),placeholder:"1000"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("dashboard:systemLog.clearLimitDesc")})]})]}),e.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-900 dark:bg-amber-950/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vn,{className:"h-5 w-5 text-amber-600"}),e.jsx("span",{className:"font-medium text-amber-800 dark:text-amber-200",children:s("dashboard:systemLog.clearPreview")})]}),e.jsxs(G,{variant:"outline",size:"sm",onClick:to,disabled:_s,children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.getStats")]})]}),dt&&Es&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.cutoffDate")}),e.jsx("p",{className:"font-mono text-sm",children:Es.cutoff_date})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("dashboard:systemLog.totalLogs")}),e.jsx("p",{className:"font-mono text-sm font-medium",children:Es.total_logs.toLocaleString()})]})]}),e.jsxs("div",{className:"rounded-md bg-red-50 p-3 dark:bg-red-950/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wt,{className:"h-4 w-4 text-red-600"}),e.jsxs("span",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:[s("dashboard:systemLog.willClear"),":",e.jsx("span",{className:"ml-1 font-bold",children:Es.logs_to_clear.toLocaleString()}),s("dashboard:systemLog.logsUnit")]})]}),e.jsx("p",{className:"mt-1 text-xs text-red-600 dark:text-red-300",children:s("dashboard:systemLog.clearWarning")})]})]})]})]}),e.jsxs(Ie,{children:[e.jsx(G,{variant:"outline",onClick:()=>{B(!1),mt(!1),ct(null)},children:s("common:cancel")}),e.jsx(G,{variant:"destructive",onClick:ao,disabled:_s||!dt||!Es,children:_s?e.jsxs(e.Fragment,{children:[e.jsx(ka,{className:"mr-2 h-4 w-4 animate-spin"}),s("dashboard:systemLog.clearing")]}):e.jsxs(e.Fragment,{children:[e.jsx(ms,{className:"mr-2 h-4 w-4"}),s("dashboard:systemLog.confirmClear")]})})]})]})})]})}function Jm(){const{t:s}=O();return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx("div",{className:"flex items-center",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:s("dashboard:title")})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(os,{}),e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsx(Je,{children:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid gap-6",children:[e.jsx(Hm,{}),e.jsx(zm,{}),e.jsx(Km,{}),e.jsx(Ym,{})]})})})]})}const Qm=Object.freeze(Object.defineProperty({__proto__:null,default:Jm},Symbol.toStringTag,{value:"Module"}));function Xm({className:s,items:n,...t}){const{pathname:r}=Dn(),a=Bs(),[o,l]=m.useState(r??"/settings"),d=u=>{l(u),a(u)},{t:x}=O("settings");return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-1 md:hidden",children:e.jsxs(X,{value:o,onValueChange:d,children:[e.jsx(J,{className:"h-12 sm:w-48",children:e.jsx(Z,{placeholder:"Theme"})}),e.jsx(Q,{children:n.map(u=>e.jsx(q,{value:u.href,children:e.jsxs("div",{className:"flex gap-x-4 px-2 py-1",children:[e.jsx("span",{className:"scale-125",children:u.icon}),e.jsx("span",{className:"text-md",children:x(u.title)})]})},u.href))})]})}),e.jsx("div",{className:"hidden w-full overflow-x-auto bg-background px-1 py-2 md:block",children:e.jsx("nav",{className:_("flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1",s),...t,children:n.map(u=>e.jsxs(st,{to:u.href,className:_(It({variant:"ghost"}),r===u.href?"bg-muted hover:bg-muted":"hover:bg-transparent hover:underline","justify-start"),children:[e.jsx("span",{className:"mr-2",children:u.icon}),x(u.title)]},u.href))})})]})}const Zm=[{title:"site.title",key:"site",icon:e.jsx(Yc,{size:18}),href:"/config/system",description:"site.description"},{title:"safe.title",key:"safe",icon:e.jsx(tl,{size:18}),href:"/config/system/safe",description:"safe.description"},{title:"subscribe.title",key:"subscribe",icon:e.jsx(al,{size:18}),href:"/config/system/subscribe",description:"subscribe.description"},{title:"invite.title",key:"invite",icon:e.jsx(Jc,{size:18}),href:"/config/system/invite",description:"invite.description"},{title:"server.title",key:"server",icon:e.jsx(sl,{size:18}),href:"/config/system/server",description:"server.description"},{title:"email.title",key:"email",icon:e.jsx(Qc,{size:18}),href:"/config/system/email",description:"email.description"},{title:"telegram.title",key:"telegram",icon:e.jsx(Xc,{size:18}),href:"/config/system/telegram",description:"telegram.description"},{title:"app.title",key:"app",icon:e.jsx(el,{size:18}),href:"/config/system/app",description:"app.description"},{title:"subscribe_template.title",key:"subscribe_template",icon:e.jsx(Zc,{size:18}),href:"/config/system/subscribe-template",description:"subscribe_template.description"}];function eu(){const{t:s}=O("settings");return e.jsxs(qe,{fadedBelow:!0,fixedHeight:!0,children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight md:text-3xl",children:s("title")}),e.jsx("div",{className:"text-muted-foreground",children:s("description")})]}),e.jsx(Re,{className:"my-6"}),e.jsxs("div",{className:"flex flex-1 flex-col space-y-8 overflow-auto lg:flex-row lg:space-x-12 lg:space-y-0",children:[e.jsx("aside",{className:"sticky top-0 lg:w-1/5",children:e.jsx(Xm,{items:Zm})}),e.jsx("div",{className:"flex-1 w-full p-1 pr-4",children:e.jsx("div",{className:"pb-16",children:e.jsx(Fn,{})})})]})]})]})}const su=Object.freeze(Object.defineProperty({__proto__:null,default:eu},Symbol.toStringTag,{value:"Module"})),ee=m.forwardRef(({className:s,...n},t)=>e.jsx(Cl,{className:_("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...n,ref:t,children:e.jsx(ed,{className:_("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));ee.displayName=Cl.displayName;const Rs=m.forwardRef(({className:s,...n},t)=>e.jsx("textarea",{className:_("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",s),ref:t,...n}));Rs.displayName="Textarea";const tu=h.object({logo:h.string().nullable().default(""),force_https:h.number().nullable().default(0),stop_register:h.number().nullable().default(0),app_name:h.string().nullable().default(""),app_description:h.string().nullable().default(""),app_url:h.string().nullable().default(""),subscribe_url:h.string().nullable().default(""),try_out_plan_id:h.number().nullable().default(0),try_out_hour:h.coerce.number().nullable().default(0),tos_url:h.string().nullable().default(""),currency:h.string().nullable().default(""),currency_symbol:h.string().nullable().default("")});function au(){const{t:s}=O("settings"),[n,t]=m.useState(!1),r=m.useRef(null),{data:a}=ne({queryKey:["settings","site"],queryFn:()=>ve.getSettings("site")}),{data:o}=ne({queryKey:["plans"],queryFn:()=>ys.getList()}),l=Ne({resolver:ke(tu),defaultValues:{},mode:"onBlur"}),{mutateAsync:d}=$s({mutationFn:ve.saveSettings,onSuccess:i=>{i.data&&$.success(s("common.autoSaved"))}});m.useEffect(()=>{if(a?.data?.site){const i=a?.data?.site;Object.entries(i).forEach(([c,p])=>{l.setValue(c,p)}),r.current=i}},[a]);const x=m.useCallback(Le.debounce(async i=>{if(!Le.isEqual(i,r.current)){t(!0);try{const c=Object.entries(i).reduce((p,[P,T])=>(p[P]=T===null?"":T,p),{});await d(c),r.current=i}finally{t(!1)}}},1e3),[d]),u=m.useCallback(i=>{x(i)},[x]);return m.useEffect(()=>{const i=l.watch(c=>{u(c)});return()=>i.unsubscribe()},[l.watch,u]),e.jsx(Te,{...l,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:l.control,name:"app_name",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("site.form.siteName.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.siteName.placeholder"),...i,value:i.value||"",onChange:c=>{i.onChange(c),u(l.getValues())}})}),e.jsx(A,{children:s("site.form.siteName.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"app_description",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("site.form.siteDescription.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.siteDescription.placeholder"),...i,value:i.value||"",onChange:c=>{i.onChange(c),u(l.getValues())}})}),e.jsx(A,{children:s("site.form.siteDescription.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"app_url",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("site.form.siteUrl.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.siteUrl.placeholder"),...i,value:i.value||"",onChange:c=>{i.onChange(c),u(l.getValues())}})}),e.jsx(A,{children:s("site.form.siteUrl.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"force_https",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("site.form.forceHttps.label")}),e.jsx(A,{children:s("site.form.forceHttps.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:!!i.value,onCheckedChange:c=>{i.onChange(Number(c)),u(l.getValues())}})})]})}),e.jsx(j,{control:l.control,name:"logo",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("site.form.logo.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.logo.placeholder"),...i,value:i.value||"",onChange:c=>{i.onChange(c),u(l.getValues())}})}),e.jsx(A,{children:s("site.form.logo.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"subscribe_url",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("site.form.subscribeUrl.label")}),e.jsx(b,{children:e.jsx(Rs,{placeholder:s("site.form.subscribeUrl.placeholder"),...i,value:i.value||"",onChange:c=>{i.onChange(c),u(l.getValues())}})}),e.jsx(A,{children:s("site.form.subscribeUrl.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"tos_url",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("site.form.tosUrl.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.tosUrl.placeholder"),...i,value:i.value||"",onChange:c=>{i.onChange(c),u(l.getValues())}})}),e.jsx(A,{children:s("site.form.tosUrl.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"stop_register",render:({field:i})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("site.form.stopRegister.label")}),e.jsx(A,{children:s("site.form.stopRegister.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:!!i.value,onCheckedChange:c=>{i.onChange(Number(c)),u(l.getValues())}})})]})}),e.jsx(j,{control:l.control,name:"try_out_plan_id",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("site.form.tryOut.label")}),e.jsx(b,{children:e.jsxs(X,{value:i.value?.toString(),onValueChange:c=>{i.onChange(Number(c)),u(l.getValues())},children:[e.jsx(J,{children:e.jsx(Z,{placeholder:s("site.form.tryOut.placeholder")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:s("site.form.tryOut.placeholder")}),o?.data?.map(c=>e.jsx(q,{value:c.id.toString(),children:c.name},c.id.toString()))]})]})}),e.jsx(A,{children:s("site.form.tryOut.description")}),e.jsx(R,{})]})}),!!l.watch("try_out_plan_id")&&e.jsx(j,{control:l.control,name:"try_out_hour",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"",children:s("site.form.tryOut.duration.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.tryOut.duration.placeholder"),...i,value:i.value||"",onChange:c=>{i.onChange(c),u(l.getValues())}})}),e.jsx(A,{children:s("site.form.tryOut.duration.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"currency",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("site.form.currency.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.currency.placeholder"),...i,value:i.value||"",onChange:c=>{i.onChange(c),u(l.getValues())}})}),e.jsx(A,{children:s("site.form.currency.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"currency_symbol",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("site.form.currencySymbol.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("site.form.currencySymbol.placeholder"),...i,value:i.value||"",onChange:c=>{i.onChange(c),u(l.getValues())}})}),e.jsx(A,{children:s("site.form.currencySymbol.description")}),e.jsx(R,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("site.form.saving")})]})})}function nu(){const{t:s}=O("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("site.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("site.description")})]}),e.jsx(Re,{}),e.jsx(au,{})]})}const ru=Object.freeze(Object.defineProperty({__proto__:null,default:nu},Symbol.toStringTag,{value:"Module"})),lu=h.object({email_verify:h.boolean().nullable(),safe_mode_enable:h.boolean().nullable(),secure_path:h.string().nullable(),email_whitelist_enable:h.boolean().nullable(),email_whitelist_suffix:h.array(h.string().nullable()).nullable(),email_gmail_limit_enable:h.boolean().nullable(),captcha_enable:h.boolean().nullable(),captcha_type:h.string().nullable(),recaptcha_key:h.string().nullable(),recaptcha_site_key:h.string().nullable(),recaptcha_v3_secret_key:h.string().nullable(),recaptcha_v3_site_key:h.string().nullable(),recaptcha_v3_score_threshold:h.coerce.string().transform(s=>s===""?null:s).nullable(),turnstile_secret_key:h.string().nullable(),turnstile_site_key:h.string().nullable(),register_limit_by_ip_enable:h.boolean().nullable(),register_limit_count:h.coerce.string().transform(s=>s===""?null:s).nullable(),register_limit_expire:h.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_enable:h.boolean().nullable(),password_limit_count:h.coerce.string().transform(s=>s===""?null:s).nullable(),password_limit_expire:h.coerce.string().transform(s=>s===""?null:s).nullable()}),iu={email_verify:!1,safe_mode_enable:!1,secure_path:"",email_whitelist_enable:!1,email_whitelist_suffix:[],email_gmail_limit_enable:!1,captcha_enable:!1,captcha_type:"recaptcha",recaptcha_key:"",recaptcha_site_key:"",recaptcha_v3_secret_key:"",recaptcha_v3_site_key:"",recaptcha_v3_score_threshold:"0.5",turnstile_secret_key:"",turnstile_site_key:"",register_limit_by_ip_enable:!1,register_limit_count:"",register_limit_expire:"",password_limit_enable:!1,password_limit_count:"",password_limit_expire:""};function ou(){const{t:s}=O("settings"),[n,t]=m.useState(!1),[r,a]=m.useState(!1),o=m.useRef(null),l=Ne({resolver:ke(lu),defaultValues:iu,mode:"onBlur"}),{data:d}=ne({queryKey:["settings","safe"],queryFn:()=>ve.getSettings("safe")}),{mutateAsync:x}=$s({mutationFn:ve.saveSettings,onSuccess:c=>{c.data&&$.success(s("common.autoSaved"))}});m.useEffect(()=>{if(d?.data.safe){const c=d.data.safe,p={};Object.entries(c).forEach(([P,T])=>{if(typeof T=="number"){const C=String(T);l.setValue(P,C),p[P]=C}else l.setValue(P,T),p[P]=T}),o.current=p,a(!0)}},[d]);const u=m.useCallback(Le.debounce(async c=>{if(!Le.isEqual(c,o.current)){t(!0);try{const p={...c,email_whitelist_suffix:c.email_whitelist_suffix?.filter(Boolean)||[]};await x(p),o.current=c}finally{t(!1)}}},1e3),[x]),i=m.useCallback(c=>{r&&u(c)},[u,r]);return m.useEffect(()=>{if(!r)return;const c=l.watch(p=>{i(p)});return()=>c.unsubscribe()},[l.watch,i,r]),e.jsx(Te,{...l,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:l.control,name:"email_verify",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("safe.form.emailVerify.label")}),e.jsx(A,{children:s("safe.form.emailVerify.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value||!1,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),e.jsx(j,{control:l.control,name:"email_gmail_limit_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("safe.form.gmailLimit.label")}),e.jsx(A,{children:s("safe.form.gmailLimit.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value||!1,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),e.jsx(j,{control:l.control,name:"safe_mode_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("safe.form.safeMode.label")}),e.jsx(A,{children:s("safe.form.safeMode.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value||!1,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),e.jsx(j,{control:l.control,name:"secure_path",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.securePath.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.securePath.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.securePath.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"email_whitelist_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("safe.form.emailWhitelist.label")}),e.jsx(A,{children:s("safe.form.emailWhitelist.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value||!1,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),l.watch("email_whitelist_enable")&&e.jsx(j,{control:l.control,name:"email_whitelist_suffix",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.emailWhitelist.suffixes.label")}),e.jsx(b,{children:e.jsx(Rs,{placeholder:s("safe.form.emailWhitelist.suffixes.placeholder"),...c,value:(c.value||[]).join(` +`),onChange:p=>{const P=p.target.value.split(` +`).filter(Boolean);c.onChange(P),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.emailWhitelist.suffixes.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"captcha_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("safe.form.captcha.enable.label")}),e.jsx(A,{children:s("safe.form.captcha.enable.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value||!1,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),l.watch("captcha_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(j,{control:l.control,name:"captcha_type",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.captcha.type.label")}),e.jsxs(X,{onValueChange:p=>{c.onChange(p),i(l.getValues())},value:c.value||"recaptcha",children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:s("safe.form.captcha.type.description")})})}),e.jsxs(Q,{children:[e.jsx(q,{value:"recaptcha",children:s("safe.form.captcha.type.options.recaptcha")}),e.jsx(q,{value:"recaptcha-v3",children:s("safe.form.captcha.type.options.recaptcha-v3")}),e.jsx(q,{value:"turnstile",children:s("safe.form.captcha.type.options.turnstile")})]})]}),e.jsx(A,{children:s("safe.form.captcha.type.description")}),e.jsx(R,{})]})}),l.watch("captcha_type")==="recaptcha"&&e.jsxs(e.Fragment,{children:[e.jsx(j,{control:l.control,name:"recaptcha_site_key",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.captcha.recaptcha.siteKey.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.captcha.recaptcha.siteKey.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.captcha.recaptcha.siteKey.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"recaptcha_key",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.captcha.recaptcha.key.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.captcha.recaptcha.key.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.captcha.recaptcha.key.description")}),e.jsx(R,{})]})})]}),l.watch("captcha_type")==="recaptcha-v3"&&e.jsxs(e.Fragment,{children:[e.jsx(j,{control:l.control,name:"recaptcha_v3_site_key",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.siteKey.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.captcha.recaptcha_v3.siteKey.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.captcha.recaptcha_v3.siteKey.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"recaptcha_v3_secret_key",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.secretKey.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.captcha.recaptcha_v3.secretKey.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.captcha.recaptcha_v3.secretKey.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"recaptcha_v3_score_threshold",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.captcha.recaptcha_v3.scoreThreshold.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",step:"0.1",min:"0",max:"1",placeholder:s("safe.form.captcha.recaptcha_v3.scoreThreshold.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.captcha.recaptcha_v3.scoreThreshold.description")}),e.jsx(R,{})]})})]}),l.watch("captcha_type")==="turnstile"&&e.jsxs(e.Fragment,{children:[e.jsx(j,{control:l.control,name:"turnstile_site_key",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.captcha.turnstile.siteKey.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.captcha.turnstile.siteKey.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.captcha.turnstile.siteKey.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"turnstile_secret_key",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.captcha.turnstile.secretKey.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.captcha.turnstile.secretKey.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.captcha.turnstile.secretKey.description")}),e.jsx(R,{})]})})]})]}),e.jsx(j,{control:l.control,name:"register_limit_by_ip_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("safe.form.registerLimit.enable.label")}),e.jsx(A,{children:s("safe.form.registerLimit.enable.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value||!1,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),l.watch("register_limit_by_ip_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(j,{control:l.control,name:"register_limit_count",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.registerLimit.count.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.registerLimit.count.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.registerLimit.count.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"register_limit_expire",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.registerLimit.expire.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.registerLimit.expire.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.registerLimit.expire.description")}),e.jsx(R,{})]})})]}),e.jsx(j,{control:l.control,name:"password_limit_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("safe.form.passwordLimit.enable.label")}),e.jsx(A,{children:s("safe.form.passwordLimit.enable.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value||!1,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),l.watch("password_limit_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(j,{control:l.control,name:"password_limit_count",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.passwordLimit.count.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.passwordLimit.count.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.passwordLimit.count.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"password_limit_expire",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("safe.form.passwordLimit.expire.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("safe.form.passwordLimit.expire.placeholder"),...c,value:c.value||"",onChange:p=>{c.onChange(p),i(l.getValues())}})}),e.jsx(A,{children:s("safe.form.passwordLimit.expire.description")}),e.jsx(R,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("safe.form.saving")})]})})}function cu(){const{t:s}=O("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("safe.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("safe.description")})]}),e.jsx(Re,{}),e.jsx(ou,{})]})}const du=Object.freeze(Object.defineProperty({__proto__:null,default:cu},Symbol.toStringTag,{value:"Module"})),mu=h.object({plan_change_enable:h.boolean().nullable().default(!1),reset_traffic_method:h.coerce.number().nullable().default(0),surplus_enable:h.boolean().nullable().default(!1),new_order_event_id:h.coerce.number().nullable().default(0),renew_order_event_id:h.coerce.number().nullable().default(0),change_order_event_id:h.coerce.number().nullable().default(0),show_info_to_server_enable:h.boolean().nullable().default(!1),show_protocol_to_server_enable:h.boolean().nullable().default(!1),default_remind_expire:h.boolean().nullable().default(!1),default_remind_traffic:h.boolean().nullable().default(!1),subscribe_path:h.string().nullable().default("s")}),uu={plan_change_enable:!1,reset_traffic_method:0,surplus_enable:!1,new_order_event_id:0,renew_order_event_id:0,change_order_event_id:0,show_info_to_server_enable:!1,show_protocol_to_server_enable:!1,default_remind_expire:!1,default_remind_traffic:!1,subscribe_path:"s"};function xu(){const{t:s}=O("settings"),[n,t]=m.useState(!1),r=m.useRef(null),a=Ne({resolver:ke(mu),defaultValues:uu,mode:"onBlur"}),{data:o}=ne({queryKey:["settings","subscribe"],queryFn:()=>ve.getSettings("subscribe")}),{mutateAsync:l}=$s({mutationFn:ve.saveSettings,onSuccess:u=>{u.data&&$.success(s("common.autoSaved"))}});m.useEffect(()=>{if(o?.data?.subscribe){const u=o?.data?.subscribe;Object.entries(u).forEach(([i,c])=>{a.setValue(i,c)}),r.current=u}},[o]);const d=m.useCallback(Le.debounce(async u=>{if(!Le.isEqual(u,r.current)){t(!0);try{await l(u),r.current=u}finally{t(!1)}}},1e3),[l]),x=m.useCallback(u=>{d(u)},[d]);return m.useEffect(()=>{const u=a.watch(i=>{x(i)});return()=>u.unsubscribe()},[a.watch,x]),e.jsx(Te,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:a.control,name:"plan_change_enable",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("subscribe.plan_change_enable.title")}),e.jsx(A,{children:s("subscribe.plan_change_enable.description")}),e.jsx(b,{children:e.jsx(ee,{checked:u.value||!1,onCheckedChange:i=>{u.onChange(i),x(a.getValues())}})}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"reset_traffic_method",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("subscribe.reset_traffic_method.title")}),e.jsxs(X,{onValueChange:u.onChange,value:u.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:"请选择重置方式"})})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:s("subscribe.reset_traffic_method.options.monthly_first")}),e.jsx(q,{value:"1",children:s("subscribe.reset_traffic_method.options.monthly_reset")}),e.jsx(q,{value:"2",children:s("subscribe.reset_traffic_method.options.no_reset")}),e.jsx(q,{value:"3",children:s("subscribe.reset_traffic_method.options.yearly_first")}),e.jsx(q,{value:"4",children:s("subscribe.reset_traffic_method.options.yearly_reset")})]})]}),e.jsx(A,{children:s("subscribe.reset_traffic_method.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"surplus_enable",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("subscribe.surplus_enable.title")}),e.jsx(A,{children:s("subscribe.surplus_enable.description")}),e.jsx(b,{children:e.jsx(ee,{checked:u.value||!1,onCheckedChange:i=>{u.onChange(i),x(a.getValues())}})}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"new_order_event_id",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("subscribe.new_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(X,{onValueChange:u.onChange,value:u.value?.toString(),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:"请选择"})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:s("subscribe.new_order_event.options.no_action")}),e.jsx(q,{value:"1",children:s("subscribe.new_order_event.options.reset_traffic")})]})]})})}),e.jsx(A,{children:s("subscribe.new_order_event.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"renew_order_event_id",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("subscribe.renew_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(X,{onValueChange:u.onChange,value:u.value?.toString(),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:"请选择"})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:s("subscribe.renew_order_event.options.no_action")}),e.jsx(q,{value:"1",children:s("subscribe.renew_order_event.options.reset_traffic")})]})]})})}),e.jsx(A,{children:s("subscribe.renew_order_event.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"change_order_event_id",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("subscribe.change_order_event.title")}),e.jsx("div",{className:"relative w-max",children:e.jsx(b,{children:e.jsxs(X,{onValueChange:u.onChange,value:u.value?.toString(),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:"请选择"})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:s("subscribe.change_order_event.options.no_action")}),e.jsx(q,{value:"1",children:s("subscribe.change_order_event.options.reset_traffic")})]})]})})}),e.jsx(A,{children:s("subscribe.change_order_event.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"subscribe_path",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("subscribe.subscribe_path.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:"subscribe",...u,value:u.value||"",onChange:i=>{u.onChange(i),x(a.getValues())}})}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[s("subscribe.subscribe_path.description"),e.jsx("br",{}),s("subscribe.subscribe_path.current_format",{path:u.value||"s"}),e.jsx("br",{}),s("subscribe.subscribe_path.restart_tip")]}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"show_info_to_server_enable",render:({field:u})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("subscribe.show_info_to_server.title")}),e.jsx(A,{children:s("subscribe.show_info_to_server.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:u.value||!1,onCheckedChange:i=>{u.onChange(i),x(a.getValues())}})})]})}),e.jsx(j,{control:a.control,name:"show_protocol_to_server_enable",render:({field:u})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("subscribe.show_protocol_to_server.title")}),e.jsx(A,{children:s("subscribe.show_protocol_to_server.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:u.value||!1,onCheckedChange:i=>{u.onChange(i),x(a.getValues())}})})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function hu(){const{t:s}=O("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("subscribe.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("subscribe.description")})]}),e.jsx(Re,{}),e.jsx(xu,{})]})}const gu=Object.freeze(Object.defineProperty({__proto__:null,default:hu},Symbol.toStringTag,{value:"Module"})),pu=h.object({invite_force:h.boolean().default(!1),invite_commission:h.coerce.string().default("0"),invite_gen_limit:h.coerce.string().default("0"),invite_never_expire:h.boolean().default(!1),commission_first_time_enable:h.boolean().default(!1),commission_auto_check_enable:h.boolean().default(!1),commission_withdraw_limit:h.coerce.string().default("0"),commission_withdraw_method:h.array(h.string()).default(["支付宝","USDT","Paypal"]),withdraw_close_enable:h.boolean().default(!1),commission_distribution_enable:h.boolean().default(!1),commission_distribution_l1:h.coerce.number().default(0),commission_distribution_l2:h.coerce.number().default(0),commission_distribution_l3:h.coerce.number().default(0)}),fu={invite_force:!1,invite_commission:"0",invite_gen_limit:"0",invite_never_expire:!1,commission_first_time_enable:!1,commission_auto_check_enable:!1,commission_withdraw_limit:"0",commission_withdraw_method:["支付宝","USDT","Paypal"],withdraw_close_enable:!1,commission_distribution_enable:!1,commission_distribution_l1:0,commission_distribution_l2:0,commission_distribution_l3:0};function ju(){const{t:s}=O("settings"),[n,t]=m.useState(!1),[r,a]=m.useState(!1),o=m.useRef(null),l=Ne({resolver:ke(pu),defaultValues:fu,mode:"onBlur"}),{data:d}=ne({queryKey:["settings","invite"],queryFn:()=>ve.getSettings("invite")}),{mutateAsync:x}=$s({mutationFn:ve.saveSettings,onSuccess:c=>{c.data&&$.success(s("common.autoSaved"))}});m.useEffect(()=>{if(d?.data?.invite){const c=d?.data?.invite,p={};Object.entries(c).forEach(([P,T])=>{if(typeof T=="number"){const C=String(T);l.setValue(P,C),p[P]=C}else l.setValue(P,T),p[P]=T}),o.current=p,a(!0)}},[d]);const u=m.useCallback(Le.debounce(async c=>{if(!Le.isEqual(c,o.current)){t(!0);try{await x(c),o.current=c}finally{t(!1)}}},1e3),[x]),i=m.useCallback(c=>{r&&u(c)},[u,r]);return m.useEffect(()=>{if(!r)return;const c=l.watch(p=>{i(p)});return()=>c.unsubscribe()},[l.watch,i,r]),e.jsx(Te,{...l,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:l.control,name:"invite_force",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("invite.invite_force.title")}),e.jsx(A,{children:s("invite.invite_force.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),e.jsx(j,{control:l.control,name:"invite_commission",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("invite.invite_commission.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("invite.invite_commission.placeholder"),...c,value:c.value||""})}),e.jsx(A,{children:s("invite.invite_commission.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"invite_gen_limit",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("invite.invite_gen_limit.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("invite.invite_gen_limit.placeholder"),...c,value:c.value||""})}),e.jsx(A,{children:s("invite.invite_gen_limit.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"invite_never_expire",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("invite.invite_never_expire.title")}),e.jsx(A,{children:s("invite.invite_never_expire.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),e.jsx(j,{control:l.control,name:"commission_first_time_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("invite.commission_first_time.title")}),e.jsx(A,{children:s("invite.commission_first_time.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),e.jsx(j,{control:l.control,name:"commission_auto_check_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("invite.commission_auto_check.title")}),e.jsx(A,{children:s("invite.commission_auto_check.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),e.jsx(j,{control:l.control,name:"commission_withdraw_limit",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("invite.commission_withdraw_limit.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("invite.commission_withdraw_limit.placeholder"),...c,value:c.value||""})}),e.jsx(A,{children:s("invite.commission_withdraw_limit.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"commission_withdraw_method",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("invite.commission_withdraw_method.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("invite.commission_withdraw_method.placeholder"),...c,value:Array.isArray(c.value)?c.value.join(","):"",onChange:p=>{const P=p.target.value.split(",").filter(Boolean);c.onChange(P),i(l.getValues())}})}),e.jsx(A,{children:s("invite.commission_withdraw_method.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"withdraw_close_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("invite.withdraw_close.title")}),e.jsx(A,{children:s("invite.withdraw_close.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),e.jsx(j,{control:l.control,name:"commission_distribution_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("invite.commission_distribution.title")}),e.jsx(A,{children:s("invite.commission_distribution.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value,onCheckedChange:p=>{c.onChange(p),i(l.getValues())}})})]})}),l.watch("commission_distribution_enable")&&e.jsxs(e.Fragment,{children:[e.jsx(j,{control:l.control,name:"commission_distribution_l1",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{children:s("invite.commission_distribution.l1")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...c,value:c.value||"",onChange:p=>{const P=p.target.value?Number(p.target.value):0;c.onChange(P),i(l.getValues())}})}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"commission_distribution_l2",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{children:s("invite.commission_distribution.l2")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...c,value:c.value||"",onChange:p=>{const P=p.target.value?Number(p.target.value):0;c.onChange(P),i(l.getValues())}})}),e.jsx(R,{})]})}),e.jsx(j,{control:l.control,name:"commission_distribution_l3",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{children:s("invite.commission_distribution.l3")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("invite.commission_distribution.placeholder"),...c,value:c.value||"",onChange:p=>{const P=p.target.value?Number(p.target.value):0;c.onChange(P),i(l.getValues())}})}),e.jsx(R,{})]})})]}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("invite.saving")})]})})}function vu(){const{t:s}=O("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("invite.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("invite.description")})]}),e.jsx(Re,{}),e.jsx(ju,{})]})}const bu=Object.freeze(Object.defineProperty({__proto__:null,default:vu},Symbol.toStringTag,{value:"Module"})),yu=h.object({frontend_theme:h.string().nullable(),frontend_theme_sidebar:h.string().nullable(),frontend_theme_header:h.string().nullable(),frontend_theme_color:h.string().nullable(),frontend_background_url:h.string().url().nullable()}),_u={frontend_theme:"",frontend_theme_sidebar:"",frontend_theme_header:"",frontend_theme_color:"",frontend_background_url:""};function Nu(){const{data:s}=ne({queryKey:["settings","frontend"],queryFn:()=>ve.getSettings("frontend")}),n=Ne({resolver:ke(yu),defaultValues:_u,mode:"onChange"});m.useEffect(()=>{if(s?.data?.frontend){const r=s?.data?.frontend;Object.entries(r).forEach(([a,o])=>{n.setValue(a,o)})}},[s]);function t(r){ve.saveSettings(r).then(({data:a})=>{a&&$.success("更新成功")})}return e.jsx(Te,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(t),className:"space-y-8",children:[e.jsx(j,{control:n.control,name:"frontend_theme_sidebar",render:({field:r})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:"边栏风格"}),e.jsx(A,{children:"边栏风格"})]}),e.jsx(b,{children:e.jsx(ee,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(j,{control:n.control,name:"frontend_theme_header",render:({field:r})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:"头部风格"}),e.jsx(A,{children:"边栏风格"})]}),e.jsx(b,{children:e.jsx(ee,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(j,{control:n.control,name:"frontend_theme_color",render:({field:r})=>e.jsxs(f,{children:[e.jsx(v,{children:"主题色"}),e.jsxs("div",{className:"relative w-max",children:[e.jsx(b,{children:e.jsxs("select",{className:_(It({variant:"outline"}),"w-[200px] appearance-none font-normal"),...r,children:[e.jsx("option",{value:"default",children:"默认"}),e.jsx("option",{value:"black",children:"黑色"}),e.jsx("option",{value:"blackblue",children:"暗蓝色"}),e.jsx("option",{value:"green",children:"奶绿色"})]})}),e.jsx(En,{className:"absolute right-3 top-2.5 h-4 w-4 opacity-50"})]}),e.jsx(A,{children:"主题色"}),e.jsx(R,{})]})}),e.jsx(j,{control:n.control,name:"frontend_background_url",render:({field:r})=>e.jsxs(f,{children:[e.jsx(v,{children:"背景"}),e.jsx(b,{children:e.jsx(D,{placeholder:"请输入图片地址",...r})}),e.jsx(A,{children:"将会在后台登录页面进行展示。"}),e.jsx(R,{})]})}),e.jsx(L,{type:"submit",children:"保存设置"})]})})}function wu(){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"个性化设置"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"自定义系统界面外观,包括主题风格、布局、颜色方案、背景图等个性化选项。"})]}),e.jsx(Re,{}),e.jsx(Nu,{})]})}const Cu=Object.freeze(Object.defineProperty({__proto__:null,default:wu},Symbol.toStringTag,{value:"Module"})),Su=h.object({server_pull_interval:h.coerce.number().nullable(),server_push_interval:h.coerce.number().nullable(),server_token:h.string().nullable(),device_limit_mode:h.coerce.number().nullable()}),ku={server_pull_interval:0,server_push_interval:0,server_token:"",device_limit_mode:0};function Tu(){const{t:s}=O("settings"),[n,t]=m.useState(!1),r=m.useRef(null),a=Ne({resolver:ke(Su),defaultValues:ku,mode:"onBlur"}),{data:o}=ne({queryKey:["settings","server"],queryFn:()=>ve.getSettings("server")}),{mutateAsync:l}=$s({mutationFn:ve.saveSettings,onSuccess:i=>{i.data&&$.success(s("common.AutoSaved"))}});m.useEffect(()=>{if(o?.data.server){const i=o.data.server;Object.entries(i).forEach(([c,p])=>{a.setValue(c,p)}),r.current=i}},[o]);const d=m.useCallback(Le.debounce(async i=>{if(!Le.isEqual(i,r.current)){t(!0);try{await l(i),r.current=i}finally{t(!1)}}},1e3),[l]),x=m.useCallback(i=>{d(i)},[d]);m.useEffect(()=>{const i=a.watch(c=>{x(c)});return()=>i.unsubscribe()},[a.watch,x]);const u=()=>{const i=Math.floor(Math.random()*17)+16,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let p="";for(let P=0;Pe.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("server.server_token.title")}),e.jsx(b,{children:e.jsxs("div",{className:"relative",children:[e.jsx(D,{placeholder:s("server.server_token.placeholder"),...i,value:i.value||"",className:"pr-10"}),e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2",onClick:c=>{c.preventDefault(),u()},children:e.jsx(sd,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(ce,{children:e.jsx("p",{children:s("server.server_token.generate_tooltip")})})]})})]})}),e.jsx(A,{children:s("server.server_token.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"server_pull_interval",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("server.server_pull_interval.title")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("server.server_pull_interval.placeholder"),...i,value:i.value||"",onChange:c=>{const p=c.target.value?Number(c.target.value):null;i.onChange(p)}})}),e.jsx(A,{children:s("server.server_pull_interval.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"server_push_interval",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("server.server_push_interval.title")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("server.server_push_interval.placeholder"),...i,value:i.value||"",onChange:c=>{const p=c.target.value?Number(c.target.value):null;i.onChange(p)}})}),e.jsx(A,{children:s("server.server_push_interval.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"device_limit_mode",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("server.device_limit_mode.title")}),e.jsxs(X,{onValueChange:i.onChange,value:i.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:s("server.device_limit_mode.placeholder")})})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:s("server.device_limit_mode.strict")}),e.jsx(q,{value:"1",children:s("server.device_limit_mode.relaxed")})]})]}),e.jsx(A,{children:s("server.device_limit_mode.description")}),e.jsx(R,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("server.saving")})]})})}function Du(){const{t:s}=O("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("server.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("server.description")})]}),e.jsx(Re,{}),e.jsx(Tu,{})]})}const Fu=Object.freeze(Object.defineProperty({__proto__:null,default:Du},Symbol.toStringTag,{value:"Module"}));function Pu({open:s,onOpenChange:n,result:t}){const r=!t.error;return e.jsx(de,{open:s,onOpenChange:n,children:e.jsxs(oe,{className:"sm:max-w-[425px]",children:[e.jsxs(ge,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r?e.jsx(Nl,{className:"h-5 w-5 text-green-500"}):e.jsx(wl,{className:"h-5 w-5 text-destructive"}),e.jsx(me,{children:r?"邮件发送成功":"邮件发送失败"})]}),e.jsx(Ae,{children:r?"测试邮件已成功发送,请检查收件箱":"发送测试邮件时遇到错误"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"发送详情"}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2 text-sm",children:[e.jsx("div",{className:"text-muted-foreground",children:"收件地址"}),e.jsx("div",{children:t.email}),e.jsx("div",{className:"text-muted-foreground",children:"邮件主题"}),e.jsx("div",{children:t.subject}),e.jsx("div",{className:"text-muted-foreground",children:"模板名称"}),e.jsx("div",{children:t.template_name})]})]}),t.error&&e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium text-destructive",children:"错误信息"}),e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive break-all",children:t.error})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"font-medium",children:"配置信息"}),e.jsx(ft,{className:"h-[200px] rounded-md border p-4",children:e.jsx("div",{className:"grid gap-2 text-sm",children:e.jsxs("div",{className:"grid grid-cols-[100px_1fr] items-center gap-2",children:[e.jsx("div",{className:"text-muted-foreground",children:"驱动"}),e.jsx("div",{children:t.config.driver}),e.jsx("div",{className:"text-muted-foreground",children:"服务器"}),e.jsx("div",{children:t.config.host}),e.jsx("div",{className:"text-muted-foreground",children:"端口"}),e.jsx("div",{children:t.config.port}),e.jsx("div",{className:"text-muted-foreground",children:"加密方式"}),e.jsx("div",{children:t.config.encryption||"无"}),e.jsx("div",{className:"text-muted-foreground",children:"发件人"}),e.jsx("div",{children:t.config.from.address?`${t.config.from.address}${t.config.from.name?` (${t.config.from.name})`:""}`:"未设置"}),e.jsx("div",{className:"text-muted-foreground",children:"用户名"}),e.jsx("div",{children:t.config.username||"未设置"})]})})})]})]})]})})}const Lu=h.object({email_template:h.string().nullable().default("classic"),email_host:h.string().nullable().default(""),email_port:h.coerce.number().nullable().default(465),email_username:h.string().nullable().default(""),email_password:h.string().nullable().default(""),email_encryption:h.string().nullable().default(""),email_from_address:h.string().email().nullable().default(""),remind_mail_enable:h.boolean().nullable().default(!1)});function Ru(){const{t:s}=O("settings"),[n,t]=m.useState(null),[r,a]=m.useState(!1),o=m.useRef(null),[l,d]=m.useState(!1),x=Ne({resolver:ke(Lu),defaultValues:{},mode:"onBlur"}),{data:u}=ne({queryKey:["settings","email"],queryFn:()=>ve.getSettings("email")}),{data:i}=ne({queryKey:["emailTemplate"],queryFn:()=>ve.getEmailTemplate()}),{mutateAsync:c}=$s({mutationFn:ve.saveSettings,onSuccess:F=>{F.data&&$.success(s("common.autoSaved"))}}),{mutate:p,isPending:P}=$s({mutationFn:ve.sendTestMail,onMutate:()=>{t(null),a(!1)},onSuccess:F=>{t(F.data),a(!0),F.data.error?$.error(s("email.test.error")):$.success(s("email.test.success"))}});m.useEffect(()=>{if(u?.data.email){const F=u.data.email;Object.entries(F).forEach(([w,V])=>{x.setValue(w,V)}),o.current=F}},[u]);const T=m.useCallback(Le.debounce(async F=>{if(!Le.isEqual(F,o.current)){d(!0);try{await c(F),o.current=F}finally{d(!1)}}},1e3),[c]),C=m.useCallback(F=>{T(F)},[T]);return m.useEffect(()=>{const F=x.watch(w=>{C(w)});return()=>F.unsubscribe()},[x.watch,C]),e.jsxs(e.Fragment,{children:[e.jsx(Te,{...x,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:x.control,name:"email_host",render:({field:F})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("email.email_host.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...F,value:F.value||""})}),e.jsx(A,{children:s("email.email_host.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"email_port",render:({field:F})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("email.email_port.title")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:s("common.placeholder"),...F,value:F.value||"",onChange:w=>{const V=w.target.value?Number(w.target.value):null;F.onChange(V)}})}),e.jsx(A,{children:s("email.email_port.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"email_encryption",render:({field:F})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("email.email_encryption.title")}),e.jsxs(X,{onValueChange:w=>{const V=w==="none"?"":w;F.onChange(V)},value:F.value===""||F.value===null||F.value===void 0?"none":F.value,children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:"请选择加密方式"})})}),e.jsxs(Q,{children:[e.jsx(q,{value:"none",children:s("email.email_encryption.none")}),e.jsx(q,{value:"ssl",children:s("email.email_encryption.ssl")}),e.jsx(q,{value:"tls",children:s("email.email_encryption.tls")})]})]}),e.jsx(A,{children:s("email.email_encryption.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"email_username",render:({field:F})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("email.email_username.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),autoComplete:"off",...F,value:F.value||""})}),e.jsx(A,{children:s("email.email_username.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"email_password",render:({field:F})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("email.email_password.title")}),e.jsx(b,{children:e.jsx(D,{type:"password",placeholder:s("common.placeholder"),autoComplete:"off",...F,value:F.value||""})}),e.jsx(A,{children:s("email.email_password.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"email_from_address",render:({field:F})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("email.email_from.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...F,value:F.value||""})}),e.jsx(A,{children:s("email.email_from.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"email_template",render:({field:F})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("email.email_template.title")}),e.jsxs(X,{onValueChange:w=>{F.onChange(w),C(x.getValues())},value:F.value||void 0,children:[e.jsx(b,{children:e.jsx(J,{className:"w-[200px]",children:e.jsx(Z,{placeholder:s("email.email_template.placeholder")})})}),e.jsx(Q,{children:i?.data?.map(w=>e.jsx(q,{value:w,children:w},w))})]}),e.jsx(A,{children:s("email.email_template.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"remind_mail_enable",render:({field:F})=>e.jsxs(f,{children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:s("email.remind_mail.title")}),e.jsx(A,{children:s("email.remind_mail.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:F.value||!1,onCheckedChange:w=>{F.onChange(w),C(x.getValues())}})})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(L,{onClick:()=>p(),loading:P,disabled:P,children:s(P?"email.test.sending":"email.test.title")})})]})}),l&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("saving")}),n&&e.jsx(Pu,{open:r,onOpenChange:a,result:n})]})}function Eu(){const{t:s}=O("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("email.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("email.description")})]}),e.jsx(Re,{}),e.jsx(Ru,{})]})}const Vu=Object.freeze(Object.defineProperty({__proto__:null,default:Eu},Symbol.toStringTag,{value:"Module"})),Iu=h.object({telegram_bot_enable:h.boolean().nullable(),telegram_bot_token:h.string().nullable(),telegram_discuss_link:h.string().nullable()}),Mu={telegram_bot_enable:!1,telegram_bot_token:"",telegram_discuss_link:""};function Ou(){const{t:s}=O("settings"),[n,t]=m.useState(!1),r=m.useRef(null),a=Ne({resolver:ke(Iu),defaultValues:Mu,mode:"onBlur"}),{data:o}=ne({queryKey:["settings","telegram"],queryFn:()=>ve.getSettings("telegram")}),{mutateAsync:l}=$s({mutationFn:ve.saveSettings,onSuccess:c=>{c.data&&$.success(s("common.autoSaved"))}}),{mutate:d,isPending:x}=$s({mutationFn:ve.setTelegramWebhook,onSuccess:c=>{c.data&&$.success(s("telegram.webhook.success"))}});m.useEffect(()=>{if(o?.data.telegram){const c=o.data.telegram;Object.entries(c).forEach(([p,P])=>{a.setValue(p,P)}),r.current=c}},[o]);const u=m.useCallback(Le.debounce(async c=>{if(!Le.isEqual(c,r.current)){t(!0);try{await l(c),r.current=c}finally{t(!1)}}},1e3),[l]),i=m.useCallback(c=>{u(c)},[u]);return m.useEffect(()=>{const c=a.watch(p=>{i(p)});return()=>c.unsubscribe()},[a.watch,i]),e.jsx(Te,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:a.control,name:"telegram_bot_token",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("telegram.bot_token.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("telegram.bot_token.placeholder"),...c,value:c.value||""})}),e.jsx(A,{children:s("telegram.bot_token.description")}),e.jsx(R,{})]})}),a.watch("telegram_bot_token")&&e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("telegram.webhook.title")}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(L,{loading:x,disabled:x,onClick:()=>d(),children:s(x?"telegram.webhook.setting":"telegram.webhook.button")}),n&&e.jsx("span",{className:"text-sm text-muted-foreground",children:s("common.saving")})]}),e.jsx(A,{children:s("telegram.webhook.description")}),e.jsx(R,{})]}),e.jsx(j,{control:a.control,name:"telegram_bot_enable",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("telegram.bot_enable.title")}),e.jsx(A,{children:s("telegram.bot_enable.description")}),e.jsx(b,{children:e.jsx(ee,{checked:c.value||!1,onCheckedChange:p=>{c.onChange(p),i(a.getValues())}})}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"telegram_discuss_link",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("telegram.discuss_link.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("telegram.discuss_link.placeholder"),...c,value:c.value||""})}),e.jsx(A,{children:s("telegram.discuss_link.description")}),e.jsx(R,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function zu(){const{t:s}=O("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("telegram.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("telegram.description")})]}),e.jsx(Re,{}),e.jsx(Ou,{})]})}const $u=Object.freeze(Object.defineProperty({__proto__:null,default:zu},Symbol.toStringTag,{value:"Module"})),Au=h.object({windows_version:h.string().nullable(),windows_download_url:h.string().nullable(),macos_version:h.string().nullable(),macos_download_url:h.string().nullable(),android_version:h.string().nullable(),android_download_url:h.string().nullable()}),qu={windows_version:"",windows_download_url:"",macos_version:"",macos_download_url:"",android_version:"",android_download_url:""};function Uu(){const{t:s}=O("settings"),[n,t]=m.useState(!1),r=m.useRef(null),a=Ne({resolver:ke(Au),defaultValues:qu,mode:"onBlur"}),{data:o}=ne({queryKey:["settings","app"],queryFn:()=>ve.getSettings("app")}),{mutateAsync:l}=$s({mutationFn:ve.saveSettings,onSuccess:u=>{u.data&&$.success(s("app.save_success"))}});m.useEffect(()=>{if(o?.data.app){const u=o.data.app;Object.entries(u).forEach(([i,c])=>{a.setValue(i,c)}),r.current=u}},[o]);const d=m.useCallback(Le.debounce(async u=>{if(!Le.isEqual(u,r.current)){t(!0);try{await l(u),r.current=u}finally{t(!1)}}},1e3),[l]),x=m.useCallback(u=>{d(u)},[d]);return m.useEffect(()=>{const u=a.watch(i=>{x(i)});return()=>u.unsubscribe()},[a.watch,x]),e.jsx(Te,{...a,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:a.control,name:"windows_version",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("app.windows.version.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...u,value:u.value||""})}),e.jsx(A,{children:s("app.windows.version.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"windows_download_url",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("app.windows.download.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...u,value:u.value||""})}),e.jsx(A,{children:s("app.windows.download.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"macos_version",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("app.macos.version.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...u,value:u.value||""})}),e.jsx(A,{children:s("app.macos.version.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"macos_download_url",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("app.macos.download.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...u,value:u.value||""})}),e.jsx(A,{children:s("app.macos.download.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"android_version",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("app.android.version.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...u,value:u.value||""})}),e.jsx(A,{children:s("app.android.version.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"android_download_url",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-base",children:s("app.android.download.title")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("common.placeholder"),...u,value:u.value||""})}),e.jsx(A,{children:s("app.android.download.description")}),e.jsx(R,{})]})}),n&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("common.saving")})]})})}function Hu(){const{t:s}=O("settings");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("app.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("app.description")})]}),e.jsx(Re,{}),e.jsx(Uu,{})]})}const Ku=Object.freeze(Object.defineProperty({__proto__:null,default:Hu},Symbol.toStringTag,{value:"Module"}));Er.config({monaco:Vr});function ui({form:s,config:n,namePrefix:t="",className:r="space-y-4"}){const[a,o]=m.useState({}),l=x=>t?`${t}.${x}`:x,d=(x,u)=>{const i=l(x);switch(u.type){case"string":return e.jsx(j,{control:s.control,name:i,render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{children:u.label||u.description}),e.jsx(b,{children:e.jsx(D,{placeholder:u.placeholder,...c})}),u.description&&u.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:u.description}),e.jsx(R,{})]})},x);case"number":case"percentage":return e.jsx(j,{control:s.control,name:i,render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{children:u.label||u.description}),e.jsx(b,{children:e.jsxs("div",{className:"relative",children:[e.jsx(D,{type:"number",placeholder:u.placeholder,min:u.min??(u.type==="percentage"?0:void 0),max:u.max??(u.type==="percentage"?100:void 0),step:u.step??(u.type==="percentage"?1:void 0),...c,onChange:p=>{const P=Number(p.target.value);u.type==="percentage"?c.onChange(Math.min(100,Math.max(0,P))):c.onChange(P)},className:u.type==="percentage"?"pr-8":""}),u.type==="percentage"&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(td,{className:"h-4 w-4 text-muted-foreground"})})]})}),u.description&&u.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:u.description}),e.jsx(R,{})]})},x);case"select":return e.jsx(j,{control:s.control,name:i,render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{children:u.label||u.description}),e.jsxs(X,{onValueChange:c.onChange,defaultValue:c.value,children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:u.placeholder})})}),e.jsx(Q,{children:u.options?.map(p=>e.jsx(q,{value:p.value,children:p.label},p.value))})]}),u.description&&u.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:u.description}),e.jsx(R,{})]})},x);case"boolean":return e.jsx(j,{control:s.control,name:i,render:({field:c})=>e.jsxs(f,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:u.label||u.description}),u.description&&u.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:u.description})]}),e.jsx(b,{children:e.jsx(ee,{checked:c.value,onCheckedChange:c.onChange})})]})},x);case"text":return e.jsx(j,{control:s.control,name:i,render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{children:u.label||u.description}),e.jsx(b,{children:e.jsx(Rs,{placeholder:u.placeholder,...c})}),u.description&&u.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:u.description}),e.jsx(R,{})]})},x);case"yaml":case"json":return e.jsx(j,{control:s.control,name:i,render:({field:c})=>{const p=(()=>{if(c.value===null||c.value===void 0)return"";if(typeof c.value=="string")return c.value;try{return JSON.stringify(c.value,null,2)}catch{return String(c.value)}})(),P=`${t}_${x}`,T=a[P]||150;return e.jsxs(f,{children:[e.jsx(v,{children:u.label||u.description}),e.jsx(b,{children:e.jsx("div",{className:"resize-y overflow-hidden rounded-md border",style:{height:`${T}px`},onMouseDown:C=>{const F=C.clientY,w=T,V=N=>{const S=N.clientY-F,M=Math.max(100,w+S);o(E=>({...E,[P]:M}))},y=()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",y)};document.addEventListener("mousemove",V),document.addEventListener("mouseup",y)},children:e.jsx(Ir,{height:"100%",defaultLanguage:u.type,value:p,onChange:C=>{c.onChange(C||"")},options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,formatOnPaste:u.type==="json",formatOnType:u.type==="json"}})})}),u.description&&u.label&&e.jsx("p",{className:"text-sm text-muted-foreground",children:u.description}),e.jsx(R,{})]})}},x);default:return null}};return e.jsx("div",{className:r,children:Object.entries(n).map(([x,u])=>d(x,u))})}function xi(s){return Object.fromEntries(Object.entries(s).map(([n,t])=>{let r=t.value;if(t.type==="yaml"||t.type==="json"){if(r==null)r="";else if(typeof r!="string")try{r=JSON.stringify(r,null,2)}catch{r=String(r)}}return[n,r]}))}const Bu=s=>h.object({id:h.number().nullable(),name:h.string().min(2,s("form.validation.name.min")).max(30,s("form.validation.name.max")),icon:h.string().optional().nullable(),notify_domain:h.string().refine(t=>!t||/^https?:\/\/\S+/.test(t),s("form.validation.notify_domain.url")).optional().nullable(),handling_fee_fixed:h.coerce.number().min(0).optional().nullable(),handling_fee_percent:h.coerce.number().min(0).max(100).optional().nullable(),payment:h.string().min(1,s("form.validation.payment.required")),config:h.record(h.string(),h.string())}),vr={id:null,name:"",icon:"",notify_domain:"",handling_fee_fixed:0,handling_fee_percent:0,payment:"",config:{}};function hi({refetch:s,dialogTrigger:n,type:t="add",defaultFormValues:r=vr}){const{t:a}=O("payment"),[o,l]=m.useState(!1),[d,x]=m.useState(!1),[u,i]=m.useState([]),[c,p]=m.useState([]),[P,T]=m.useState({}),C=Bu(a),F=Ne({resolver:ke(C),defaultValues:r,mode:"onChange"}),w=F.watch("payment");m.useEffect(()=>{o&&(async()=>{const{data:N}=await pt.getMethodList();i(N)})()},[o]),m.useEffect(()=>{if(!w||!o)return;(async()=>{const N={payment:w,...t==="edit"&&{id:Number(F.getValues("id"))}};try{const{data:S}=await pt.getMethodForm(N),M=Object.values(S);p(M);const E=Object.entries(S).reduce((k,[W,te])=>(k[W]=te,k),{});T(E);const g=xi(E);F.setValue("config",g)}catch(S){console.error("Failed to fetch payment method form:",S),p([]),T({})}})()},[w,o,F,t]);const V=async y=>{x(!0);try{(await pt.save(y)).data&&($.success(a("form.messages.success")),F.reset(vr),s(),l(!1))}finally{x(!1)}};return e.jsxs(de,{open:o,onOpenChange:l,children:[e.jsx(fs,{asChild:!0,children:n||e.jsxs(L,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ke,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add.button")})]})}),e.jsxs(oe,{className:"max-h-[90vh] overflow-y-auto sm:max-w-[500px]",children:[e.jsx(ge,{children:e.jsx(me,{children:a(t==="add"?"form.add.title":"form.edit.title")})}),e.jsx(Te,{...F,children:e.jsxs("form",{onSubmit:F.handleSubmit(V),className:"space-y-4",children:[e.jsx(j,{control:F.control,name:"name",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:a("form.fields.name.placeholder"),...y})}),e.jsx(A,{children:a("form.fields.name.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:F.control,name:"icon",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.icon.label")}),e.jsx(b,{children:e.jsx(D,{...y,value:y.value||"",placeholder:a("form.fields.icon.placeholder")})}),e.jsx(A,{children:a("form.fields.icon.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:F.control,name:"notify_domain",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.notify_domain.label")}),e.jsx(b,{children:e.jsx(D,{...y,value:y.value||"",placeholder:a("form.fields.notify_domain.placeholder")})}),e.jsx(A,{children:a("form.fields.notify_domain.description")}),e.jsx(R,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(j,{control:F.control,name:"handling_fee_percent",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.handling_fee_percent.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",...y,value:y.value||"",placeholder:a("form.fields.handling_fee_percent.placeholder")})}),e.jsx(R,{})]})}),e.jsx(j,{control:F.control,name:"handling_fee_fixed",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.handling_fee_fixed.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",...y,value:y.value||"",placeholder:a("form.fields.handling_fee_fixed.placeholder")})}),e.jsx(R,{})]})})]}),e.jsx(j,{control:F.control,name:"payment",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.payment.label")}),e.jsxs(X,{onValueChange:y.onChange,defaultValue:y.value,children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:a("form.fields.payment.placeholder")})})}),e.jsx(Q,{children:u.map(N=>e.jsx(q,{value:N,children:N},N))})]}),e.jsx(A,{children:a("form.fields.payment.description")}),e.jsx(R,{})]})}),Object.keys(P).length>0&&e.jsxs("div",{className:"space-y-4 ",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:a("form.sections.payment_config")}),e.jsx(ui,{form:F,config:P,namePrefix:"config",className:"space-y-4"})]}),e.jsxs(Ie,{className:"pt-4",children:[e.jsx(Zs,{asChild:!0,children:e.jsx(L,{type:"button",variant:"outline",children:a("form.buttons.cancel")})}),e.jsx(L,{type:"submit",disabled:d,children:a("form.buttons.submit")})]})]})})]})]})}function z({column:s,title:n,tooltip:t,className:r}){return s.getCanSort()?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(L,{variant:"ghost",size:"default",className:_("-ml-3 flex h-8 items-center gap-2 text-nowrap font-medium hover:bg-muted/60",r),onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:[e.jsx("span",{children:n}),t&&e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(lr,{className:"h-4 w-4 cursor-pointer text-muted-foreground"})}),e.jsx(ce,{children:t})]})}),s.getIsSorted()==="asc"?e.jsx(jn,{className:"h-4 w-4 text-foreground/70"}):s.getIsSorted()==="desc"?e.jsx(vn,{className:"h-4 w-4 text-foreground/70"}):e.jsx(ad,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-foreground/70"})]})})}):e.jsxs("div",{className:_("flex items-center space-x-1 text-nowrap py-2 font-medium text-muted-foreground",r),children:[e.jsx("span",{children:n}),t&&e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{children:e.jsx(lr,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx(ce,{children:t})]})})]})}const Kn=nd,gi=rd,Gu=ld,pi=m.forwardRef(({className:s,...n},t)=>e.jsx(Sl,{className:_("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...n,ref:t}));pi.displayName=Sl.displayName;const Ba=m.forwardRef(({className:s,...n},t)=>e.jsxs(Gu,{children:[e.jsx(pi,{}),e.jsx(kl,{ref:t,className:_("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...n})]}));Ba.displayName=kl.displayName;const Ga=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col space-y-2 text-center sm:text-left",s),...n});Ga.displayName="AlertDialogHeader";const Wa=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Wa.displayName="AlertDialogFooter";const Ya=m.forwardRef(({className:s,...n},t)=>e.jsx(Tl,{ref:t,className:_("text-lg font-semibold",s),...n}));Ya.displayName=Tl.displayName;const Ja=m.forwardRef(({className:s,...n},t)=>e.jsx(Dl,{ref:t,className:_("text-sm text-muted-foreground",s),...n}));Ja.displayName=Dl.displayName;const Qa=m.forwardRef(({className:s,...n},t)=>e.jsx(Fl,{ref:t,className:_(Vt(),s),...n}));Qa.displayName=Fl.displayName;const Xa=m.forwardRef(({className:s,...n},t)=>e.jsx(Pl,{ref:t,className:_(Vt({variant:"outline"}),"mt-2 sm:mt-0",s),...n}));Xa.displayName=Pl.displayName;function us({onConfirm:s,children:n,title:t="确认操作",description:r="确定要执行此操作吗?",cancelText:a="取消",confirmText:o="确认",variant:l="default",className:d}){return e.jsxs(Kn,{children:[e.jsx(gi,{asChild:!0,children:n}),e.jsxs(Ba,{className:_("sm:max-w-[425px]",d),children:[e.jsxs(Ga,{children:[e.jsx(Ya,{children:t}),e.jsx(Ja,{children:r})]}),e.jsxs(Wa,{children:[e.jsx(Xa,{asChild:!0,children:e.jsx(L,{variant:"outline",children:a})}),e.jsx(Qa,{asChild:!0,children:e.jsx(L,{variant:l,onClick:s,children:o})})]})]})]})}const fi=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M11.29 15.29a2 2 0 0 0-.12.15a.8.8 0 0 0-.09.18a.6.6 0 0 0-.06.18a1.4 1.4 0 0 0 0 .2a.84.84 0 0 0 .08.38a.9.9 0 0 0 .54.54a.94.94 0 0 0 .76 0a.9.9 0 0 0 .54-.54A1 1 0 0 0 13 16a1 1 0 0 0-.29-.71a1 1 0 0 0-1.42 0M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8 8 0 0 1-8 8m0-13a3 3 0 0 0-2.6 1.5a1 1 0 1 0 1.73 1A1 1 0 0 1 12 9a1 1 0 0 1 0 2a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-.18A3 3 0 0 0 12 7"})}),Wu=({refetch:s,isSortMode:n=!1})=>{const{t}=O("payment");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx($a,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:r})=>e.jsx(z,{column:r,title:t("table.columns.id")}),cell:({row:r})=>e.jsx(K,{variant:"outline",children:r.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"enable",header:({column:r})=>e.jsx(z,{column:r,title:t("table.columns.enable")}),cell:({row:r})=>e.jsx(ee,{defaultChecked:r.getValue("enable"),onCheckedChange:async()=>{const{data:a}=await pt.updateStatus({id:r.original.id});a||s()}}),enableSorting:!1,size:100},{accessorKey:"name",header:({column:r})=>e.jsx(z,{column:r,title:t("table.columns.name")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:r.getValue("name")})}),enableSorting:!1,size:200},{accessorKey:"payment",header:({column:r})=>e.jsx(z,{column:r,title:t("table.columns.payment")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[200px] truncate font-medium",children:r.getValue("payment")})}),enableSorting:!1,size:200},{accessorKey:"notify_url",header:({column:r})=>e.jsxs("div",{className:"flex items-center",children:[e.jsx(z,{column:r,title:t("table.columns.notify_url")}),e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{className:"ml-1",children:e.jsx(fi,{className:"h-4 w-4"})}),e.jsx(ce,{children:t("table.columns.notify_url_tooltip")})]})})]}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{className:"max-w-[300px] truncate font-medium",children:r.getValue("notify_url")})}),enableSorting:!1,size:3e3},{id:"actions",header:({column:r})=>e.jsx(z,{className:"justify-end",column:r,title:t("table.columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(hi,{refetch:s,dialogTrigger:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(nt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:t("table.actions.edit")})]}),type:"edit",defaultFormValues:r.original}),e.jsx(us,{title:t("table.actions.delete.title"),description:t("table.actions.delete.description"),onConfirm:async()=>{const{data:a}=await pt.drop({id:r.original.id});a&&s()},children:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-destructive/10",children:[e.jsx(ms,{className:"h-4 w-4 text-muted-foreground hover:text-destructive"}),e.jsx("span",{className:"sr-only",children:t("table.actions.delete.title")})]})})]}),size:100}]};function Yu({table:s,refetch:n,saveOrder:t,isSortMode:r}){const{t:a}=O("payment"),o=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between",children:[r?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("table.toolbar.sort.hint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(hi,{refetch:n}),e.jsx(D,{placeholder:a("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:l=>s.getColumn("name")?.setFilterValue(l.target.value),className:"h-8 w-[250px]"}),o&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[a("table.toolbar.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(L,{variant:r?"default":"outline",onClick:t,size:"sm",children:a(r?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}function Ju(){const[s,n]=m.useState([]),[t,r]=m.useState([]),[a,o]=m.useState(!1),[l,d]=m.useState([]),[x,u]=m.useState({"drag-handle":!1}),[i,c]=m.useState({pageSize:20,pageIndex:0}),{refetch:p}=ne({queryKey:["paymentList"],queryFn:async()=>{const{data:w}=await pt.getList();return d(w?.map(V=>({...V,enable:!!V.enable}))||[]),w}});m.useEffect(()=>{u({"drag-handle":a,actions:!a}),c({pageSize:a?99999:10,pageIndex:0})},[a]);const P=(w,V)=>{a&&(w.dataTransfer.setData("text/plain",V.toString()),w.currentTarget.classList.add("opacity-50"))},T=(w,V)=>{if(!a)return;w.preventDefault(),w.currentTarget.classList.remove("bg-muted");const y=parseInt(w.dataTransfer.getData("text/plain"));if(y===V)return;const N=[...l],[S]=N.splice(y,1);N.splice(V,0,S),d(N)},C=async()=>{a?pt.sort({ids:l.map(w=>w.id)}).then(()=>{p(),o(!1),$.success("排序保存成功")}):o(!0)},F=We({data:l,columns:Wu({refetch:p,isSortMode:a}),state:{sorting:t,columnFilters:s,columnVisibility:x,pagination:i},onSortingChange:r,onColumnFiltersChange:n,onColumnVisibilityChange:u,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps(),initialState:{columnPinning:{right:["actions"]}},pageCount:a?1:void 0});return e.jsx(ns,{table:F,toolbar:w=>e.jsx(Yu,{table:w,refetch:p,saveOrder:C,isSortMode:a}),draggable:a,onDragStart:P,onDragEnd:w=>w.currentTarget.classList.remove("opacity-50"),onDragOver:w=>{w.preventDefault(),w.currentTarget.classList.add("bg-muted")},onDragLeave:w=>w.currentTarget.classList.remove("bg-muted"),onDrop:T,showPagination:!a})}function Qu(){const{t:s}=O("payment");return e.jsxs(qe,{children:[e.jsxs(Ue,{className:"flex items-center justify-between",children:[e.jsx(os,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{children:[e.jsx("header",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")})}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),e.jsx("section",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Ju,{})})]})]})}const Xu=Object.freeze(Object.defineProperty({__proto__:null,default:Qu},Symbol.toStringTag,{value:"Module"}));function Zu({pluginName:s,onClose:n,onSuccess:t}){const{t:r}=O("plugin"),[a,o]=m.useState(!0),[l,d]=m.useState(!1),[x,u]=m.useState(null),i=id({config:od(cd())}),c=Ne({resolver:ke(i),defaultValues:{config:{}}});m.useEffect(()=>{(async()=>{try{const{data:T}=await Ms.getPluginConfig(s);u(T);const C=xi(T);c.reset({config:C})}catch{$.error(r("messages.configLoadError"))}finally{o(!1)}})()},[s,c,r]);const p=async P=>{d(!0);try{await Ms.updatePluginConfig(s,P.config),$.success(r("messages.configSaveSuccess")),t()}catch{$.error(r("messages.configSaveError"))}finally{d(!1)}};return a?e.jsxs("div",{className:"space-y-4",children:[e.jsx(je,{className:"h-4 w-[200px]"}),e.jsx(je,{className:"h-10 w-full"}),e.jsx(je,{className:"h-4 w-[200px]"}),e.jsx(je,{className:"h-10 w-full"})]}):e.jsx(Te,{...c,children:e.jsxs("form",{onSubmit:c.handleSubmit(p),className:"space-y-4",children:[x&&e.jsx(ui,{form:c,config:x,namePrefix:"config"}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(L,{type:"button",variant:"outline",onClick:n,disabled:l,children:r("config.cancel")}),e.jsx(L,{type:"submit",loading:l,disabled:l,children:r("config.save")})]})]})})}function ex(){const{t:s}=O("plugin"),[n,t]=m.useState(null),[r,a]=m.useState(!1),[o,l]=m.useState(null),[d,x]=m.useState(""),[u,i]=m.useState("feature"),[c,p]=m.useState("all"),[P,T]=m.useState(!1),[C,F]=m.useState(!1),[w,V]=m.useState(!1),y=m.useRef(null),[N,S]=m.useState(!1),[M,E]=m.useState(""),{data:g,isLoading:k}=ne({queryKey:["pluginTypes"],queryFn:async()=>{const{data:H}=await Ms.getPluginTypes();return H}}),{data:W,isLoading:te,refetch:ae}=ne({queryKey:["pluginList"],queryFn:async()=>{const{data:H}=await Ms.getPluginList();return H}}),B=W?.filter(H=>H.name.toLowerCase().includes(d.toLowerCase())||H.description.toLowerCase().includes(d.toLowerCase())||H.code.toLowerCase().includes(d.toLowerCase())),se=()=>{if(!B)return[];let H=B;return u!=="all"&&(H=H.filter(U=>U.type===u)),c==="installed"?H=H.filter(U=>U.is_installed):c==="available"&&(H=H.filter(U=>!U.is_installed)),H},fe=H=>g?.find(U=>U.value===H),cs=async H=>{t(H),Ms.installPlugin(H).then(()=>{$.success(s("messages.installSuccess")),ae()}).catch(U=>{$.error(U.message||s("messages.installError"))}).finally(()=>{t(null)})},Me=async H=>{t(H),Ms.upgradePlugin(H).then(()=>{$.success(s("messages.upgradeSuccess")),ae()}).catch(U=>{$.error(U.message||s("messages.upgradeError"))}).finally(()=>{t(null)})},re=async H=>{t(H),Ms.uninstallPlugin(H).then(()=>{$.success(s("messages.uninstallSuccess")),ae()}).catch(U=>{$.error(U.message||s("messages.uninstallError"))}).finally(()=>{t(null)})},ks=async(H,U)=>{t(H),(U?Ms.disablePlugin:Ms.enablePlugin)(H).then(()=>{$.success(s(U?"messages.disableSuccess":"messages.enableSuccess")),ae()}).catch(Oe=>{$.error(Oe.message||s(U?"messages.disableError":"messages.enableError"))}).finally(()=>{t(null)})},_s=H=>{W?.find(U=>U.code===H),l(H),a(!0)},ot=async H=>{if(!H.name.endsWith(".zip")){$.error(s("upload.error.format"));return}T(!0),Ms.uploadPlugin(H).then(()=>{$.success(s("messages.uploadSuccess")),F(!1),ae()}).catch(U=>{$.error(U.message||s("messages.uploadError"))}).finally(()=>{T(!1),y.current&&(y.current.value="")})},Es=H=>{H.preventDefault(),H.stopPropagation(),H.type==="dragenter"||H.type==="dragover"?V(!0):H.type==="dragleave"&&V(!1)},ct=H=>{H.preventDefault(),H.stopPropagation(),V(!1),H.dataTransfer.files&&H.dataTransfer.files[0]&&ot(H.dataTransfer.files[0])},dt=async H=>{t(H),Ms.deletePlugin(H).then(()=>{$.success(s("messages.deleteSuccess")),ae()}).catch(U=>{$.error(U.message||s("messages.deleteError"))}).finally(()=>{t(null)})},mt=H=>dd(H||"",{walkTokens(U){(U.type==="image"||U.type==="link")&&(U.type="text",U.raw="",U.text="")}});return e.jsxs(qe,{children:[e.jsxs(Ue,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(Ln,{className:"h-6 w-6"}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:s("title")})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{children:[e.jsxs("div",{className:"mb-8 space-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"relative max-w-sm flex-1",children:[e.jsx(Rn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(D,{placeholder:s("search.placeholder"),value:d,onChange:H=>x(H.target.value),className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(X,{value:c,onValueChange:p,children:[e.jsx(J,{className:"w-[140px]",children:e.jsx(Z,{placeholder:s("status.filter_placeholder",{defaultValue:"安装状态"})})}),e.jsxs(Q,{children:[e.jsx(q,{value:"all",children:s("status.all",{defaultValue:"全部状态"})}),e.jsx(q,{value:"installed",children:s("status.installed",{defaultValue:"已安装"})}),e.jsx(q,{value:"available",children:s("status.available",{defaultValue:"可安装"})})]})]}),e.jsxs(L,{onClick:()=>F(!0),variant:"outline",className:"shrink-0",size:"sm",children:[e.jsx(Lt,{className:"mr-2 h-4 w-4"}),s("upload.button")]})]})]}),e.jsxs(bt,{value:u,onValueChange:i,className:"w-full",children:[e.jsxs(rt,{children:[g?.map(H=>e.jsx(Be,{value:H.value,children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{children:H.label})})},H.value)),e.jsx(Be,{value:"all",children:s("tabs.all")})]}),e.jsx(bs,{value:"all",className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:te||k?e.jsxs(e.Fragment,{children:[e.jsx(mn,{}),e.jsx(mn,{}),e.jsx(mn,{})]}):se().map(H=>e.jsx(br,{plugin:H,typeInfo:fe(H.type),onInstall:cs,onUpgrade:Me,onUninstall:re,onToggleEnable:ks,onOpenConfig:_s,onDelete:dt,isLoading:n===H.code,onShowReadme:H.readme?()=>{E(H.readme),S(!0)}:void 0},H.code))})}),g?.map(H=>e.jsx(bs,{value:H.value,className:"mt-6",children:e.jsx("div",{className:"space-y-4",children:se().map(U=>e.jsx(br,{plugin:U,typeInfo:fe(U.type),onInstall:cs,onUpgrade:Me,onUninstall:re,onToggleEnable:ks,onOpenConfig:_s,onDelete:dt,isLoading:n===U.code,onShowReadme:U.readme?()=>{E(U.readme),S(!0)}:void 0},U.code))})},H.value))]})]}),e.jsx(de,{open:r,onOpenChange:a,children:e.jsxs(oe,{className:"sm:max-w-lg",children:[e.jsxs(ge,{children:[e.jsxs(me,{children:[W?.find(H=>H.code===o)?.name," ",s("config.title")]}),e.jsx(Ae,{children:s("config.description")})]}),o&&e.jsx(Zu,{pluginName:o,onClose:()=>a(!1),onSuccess:()=>{a(!1),ae()}})]})}),e.jsx(de,{open:C,onOpenChange:F,children:e.jsxs(oe,{className:"sm:max-w-md",children:[e.jsxs(ge,{children:[e.jsx(me,{children:s("upload.title")}),e.jsx(Ae,{children:s("upload.description")})]}),e.jsxs("div",{className:_("relative mt-4 flex h-64 flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted-foreground/25 px-5 py-10 text-center transition-colors",w&&"border-primary/50 bg-muted/50"),onDragEnter:Es,onDragLeave:Es,onDragOver:Es,onDrop:ct,children:[e.jsx("input",{type:"file",ref:y,className:"hidden",accept:".zip",onChange:H=>{const U=H.target.files?.[0];U&&ot(U)}}),P?e.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[e.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-b-2 border-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("upload.uploading")})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"rounded-full border-2 border-muted-foreground/25 p-3",children:e.jsx(Lt,{className:"h-6 w-6 text-muted-foreground/50"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:[s("upload.dragText")," ",e.jsx("button",{type:"button",onClick:()=>y.current?.click(),className:"mx-1 text-primary hover:underline",children:s("upload.clickText")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("upload.supportText")})]})]})})]})]})}),e.jsx(de,{open:N,onOpenChange:S,children:e.jsxs(oe,{className:"max-w-2xl",children:[e.jsx(ge,{children:e.jsx(me,{children:s("readme.title",{defaultValue:"插件文档"})})}),e.jsx("div",{className:"markdown-body max-h-[60vh] overflow-y-auto",dangerouslySetInnerHTML:{__html:mt(M)}})]})})]})]})}function br({plugin:s,onInstall:n,onUpgrade:t,onUninstall:r,onToggleEnable:a,onOpenConfig:o,onDelete:l,isLoading:d,onShowReadme:x,typeInfo:u}){const{t:i}=O("plugin");return e.jsx(Se,{className:"group relative overflow-hidden transition-all hover:shadow-md",children:e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx("h3",{className:"truncate text-base font-semibold",children:s.name}),u&&e.jsx(K,{variant:"outline",className:"border-primary/20 bg-primary/5 px-1.5 py-0.5 text-xs text-primary",children:u.label}),s.is_installed?e.jsx(K,{variant:s.is_enabled?"default":"outline",className:"px-1.5 py-0.5 text-xs",children:s.is_enabled?i("status.enabled"):i("status.disabled")}):e.jsx(K,{variant:"outline",className:"border-muted-foreground/30 bg-muted/30 px-1.5 py-0.5 text-xs text-muted-foreground",children:i("status.not_installed")})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1.5",children:[s.is_protected&&e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",children:e.jsx(md,{className:"h-3 w-3"})})}),e.jsx(ce,{children:e.jsx("p",{children:i("status.protected")})})]})}),s.readme&&e.jsx("button",{type:"button",onClick:x,className:"flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-primary",title:i("button.readme"),children:e.jsx(yn,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"mb-2 flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ln,{className:"h-3 w-3"}),e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:s.code})]}),e.jsxs("span",{children:["v",s.version]}),e.jsxs("span",{children:[i("author"),": ",s.author]})]}),e.jsx("p",{className:"mb-3 overflow-hidden text-ellipsis text-sm text-muted-foreground",style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:s.description}),e.jsx("div",{className:"flex items-center justify-end gap-2",children:s.is_installed?e.jsxs(e.Fragment,{children:[s.need_upgrade&&e.jsx(us,{title:i("upgrade.title"),description:i("upgrade.description"),cancelText:i("common:cancel"),confirmText:i("upgrade.button"),variant:"default",onConfirm:async()=>t(s.code),children:e.jsxs(L,{variant:"destructive",size:"sm",disabled:d,className:"h-7 px-2 text-xs bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(ud,{className:"mr-1 h-3 w-3"}),i("button.upgrade")]})}),s.config&&Object.keys(s.config).length>0&&e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>o(s.code),disabled:!s.is_enabled||d,className:"h-7 px-2 text-xs",children:[e.jsx(Ta,{className:"mr-1 h-3 w-3"}),i("button.config")]}),e.jsxs(L,{variant:s.is_enabled?"destructive":"default",size:"sm",onClick:()=>a(s.code,s.is_enabled),disabled:d,className:"h-7 px-2 text-xs",children:[e.jsx(xd,{className:"mr-1 h-3 w-3"}),s.is_enabled?i("button.disable"):i("button.enable")]}),e.jsx(us,{title:i("uninstall.title"),description:i("uninstall.description"),cancelText:i("common:cancel"),confirmText:i("uninstall.button"),variant:"destructive",onConfirm:async()=>r(s.code),children:e.jsxs(L,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs text-muted-foreground hover:text-destructive",disabled:d||s.is_enabled,children:[e.jsx(ms,{className:"mr-1 h-3 w-3"}),i("button.uninstall")]})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(L,{onClick:()=>n(s.code),disabled:d,size:"sm",className:"h-7 px-3 text-xs",children:[d?e.jsx("div",{className:"mr-1 h-3 w-3 animate-spin rounded-full border border-current border-t-transparent"}):null,i("button.install")]}),s.can_be_deleted!==!1&&e.jsx(us,{title:i("delete.title"),description:i("delete.description"),cancelText:i("common:cancel"),confirmText:i("delete.button"),variant:"destructive",onConfirm:async()=>l(s.code),children:e.jsx(L,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",disabled:d,children:e.jsx(ms,{className:"h-3 w-3"})})})]})})]})})}function mn(){return e.jsxs(Se,{children:[e.jsxs(De,{children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(je,{className:"h-6 w-[200px]"}),e.jsx(je,{className:"h-6 w-[80px]"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(je,{className:"h-5 w-[120px]"}),e.jsx(je,{className:"h-5 w-[60px]"})]})]})}),e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx(je,{className:"h-4 w-[300px]"}),e.jsx(je,{className:"h-4 w-[150px]"})]})]}),e.jsx(Fe,{children:e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(je,{className:"h-9 w-[100px]"}),e.jsx(je,{className:"h-9 w-[100px]"}),e.jsx(je,{className:"h-8 w-8"})]})})]})}const sx=Object.freeze(Object.defineProperty({__proto__:null,default:ex},Symbol.toStringTag,{value:"Module"})),tx=(s,n)=>{let t=null;switch(s.field_type){case"input":t=e.jsx(D,{placeholder:s.placeholder,...n});break;case"textarea":t=e.jsx(Rs,{placeholder:s.placeholder,...n});break;case"select":t=e.jsx("select",{className:_(Vt({variant:"outline"}),"w-full appearance-none font-normal"),...n,children:s.select_options&&Object.keys(s.select_options).map(r=>e.jsx("option",{value:r,children:s.select_options?.[r]},r))});break;default:t=null;break}return t};function ax({themeKey:s,themeInfo:n}){const{t}=O("theme"),[r,a]=m.useState(!1),[o,l]=m.useState(!1),[d,x]=m.useState(!1),u=Ne({defaultValues:n.configs.reduce((p,P)=>(p[P.field_name]="",p),{})}),i=async()=>{l(!0),Jt.getConfig(s).then(({data:p})=>{Object.entries(p).forEach(([P,T])=>{u.setValue(P,T)})}).finally(()=>{l(!1)})},c=async p=>{x(!0),Jt.updateConfig(s,p).then(()=>{$.success(t("config.success")),a(!1)}).finally(()=>{x(!1)})};return e.jsxs(de,{open:r,onOpenChange:p=>{a(p),p?i():u.reset()},children:[e.jsx(fs,{asChild:!0,children:e.jsx(L,{variant:"outline",children:t("card.configureTheme")})}),e.jsxs(oe,{className:"max-h-[90vh] overflow-auto sm:max-w-[425px]",children:[e.jsxs(ge,{children:[e.jsx(me,{children:t("config.title",{name:n.name})}),e.jsx(Ae,{children:t("config.description")})]}),o?e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(ka,{className:"h-6 w-6 animate-spin"})}):e.jsx(Te,{...u,children:e.jsxs("form",{onSubmit:u.handleSubmit(c),className:"space-y-4",children:[n.configs.map(p=>e.jsx(j,{control:u.control,name:p.field_name,render:({field:P})=>e.jsxs(f,{children:[e.jsx(v,{children:p.label}),e.jsx(b,{children:tx(p,P)}),e.jsx(R,{})]})},p.field_name)),e.jsxs(Ie,{className:"mt-6 gap-2",children:[e.jsx(L,{type:"button",variant:"secondary",onClick:()=>a(!1),children:t("config.cancel")}),e.jsx(L,{type:"submit",loading:d,children:t("config.save")})]})]})})]})]})}function nx(){const{t:s}=O("theme"),[n,t]=m.useState(null),[r,a]=m.useState(!1),[o,l]=m.useState(!1),[d,x]=m.useState(!1),[u,i]=m.useState(null),c=m.useRef(null),[p,P]=m.useState(0),{data:T,isLoading:C,refetch:F}=ne({queryKey:["themeList"],queryFn:async()=>{const{data:g}=await Jt.getList();return g}}),w=async g=>{t(g),ve.updateSystemConfig({frontend_theme:g}).then(()=>{$.success("主题切换成功"),F()}).finally(()=>{t(null)})},V=async g=>{if(!g.name.endsWith(".zip")){$.error(s("upload.error.format"));return}a(!0),Jt.upload(g).then(()=>{$.success("主题上传成功"),l(!1),F()}).finally(()=>{a(!1),c.current&&(c.current.value="")})},y=g=>{g.preventDefault(),g.stopPropagation(),g.type==="dragenter"||g.type==="dragover"?x(!0):g.type==="dragleave"&&x(!1)},N=g=>{g.preventDefault(),g.stopPropagation(),x(!1),g.dataTransfer.files&&g.dataTransfer.files[0]&&V(g.dataTransfer.files[0])},S=()=>{u&&P(g=>g===0?u.images.length-1:g-1)},M=()=>{u&&P(g=>g===u.images.length-1?0:g+1)},E=(g,k)=>{P(0),i({name:g,images:k})};return e.jsxs(qe,{children:[e.jsxs(Ue,{className:"flex items-center justify-between",children:[e.jsx(os,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:s("title")})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-muted-foreground",children:s("description")}),e.jsxs(L,{onClick:()=>l(!0),variant:"outline",className:"ml-4 shrink-0",size:"sm",children:[e.jsx(Lt,{className:"mr-2 h-4 w-4"}),s("upload.button")]})]})]}),e.jsx("section",{className:"grid gap-6 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3",children:C?e.jsxs(e.Fragment,{children:[e.jsx(yr,{}),e.jsx(yr,{})]}):T?.themes&&Object.entries(T.themes).map(([g,k])=>e.jsx(Se,{className:"group relative overflow-hidden transition-all hover:shadow-md",style:{backgroundImage:k.background_url?`url(${k.background_url})`:"none",backgroundSize:"cover",backgroundPosition:"center"},children:e.jsxs("div",{className:_("relative z-10 h-full transition-colors",k.background_url?"group-hover:from-background/98 bg-gradient-to-t from-background/95 via-background/80 to-background/60 backdrop-blur-[1px] group-hover:via-background/90 group-hover:to-background/70":"bg-background"),children:[!!k.can_delete&&e.jsx("div",{className:"absolute right-2 top-2",children:e.jsx(us,{title:s("card.delete.title"),description:s("card.delete.description"),confirmText:s("card.delete.button"),variant:"destructive",onConfirm:async()=>{if(g===T?.active){$.error(s("card.delete.error.active"));return}t(g),Jt.drop(g).then(()=>{$.success("主题删除成功"),F()}).finally(()=>{t(null)})},children:e.jsx(L,{disabled:n===g,loading:n===g,variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",children:e.jsx(ms,{className:"h-4 w-4"})})})}),e.jsxs(De,{children:[e.jsx(Ve,{children:k.name}),e.jsx(Xs,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{children:k.description}),k.version&&e.jsx("div",{className:"text-sm text-muted-foreground",children:s("card.version",{version:k.version})})]})})]}),e.jsxs(Fe,{className:"flex items-center justify-end space-x-3",children:[k.images&&Array.isArray(k.images)&&k.images.length>0&&e.jsx(L,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>E(k.name,k.images),children:e.jsx(hd,{className:"h-4 w-4"})}),e.jsx(ax,{themeKey:g,themeInfo:k}),e.jsx(L,{onClick:()=>w(g),disabled:n===g||g===T.active,loading:n===g,variant:g===T.active?"secondary":"default",children:g===T.active?s("card.currentTheme"):s("card.activateTheme")})]})]})},g))}),e.jsx(de,{open:o,onOpenChange:l,children:e.jsxs(oe,{className:"sm:max-w-md",children:[e.jsxs(ge,{children:[e.jsx(me,{children:s("upload.title")}),e.jsx(Ae,{children:s("upload.description")})]}),e.jsxs("div",{className:_("relative mt-4 flex h-64 flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted-foreground/25 px-5 py-10 text-center transition-colors",d&&"border-primary/50 bg-muted/50"),onDragEnter:y,onDragLeave:y,onDragOver:y,onDrop:N,children:[e.jsx("input",{type:"file",ref:c,className:"hidden",accept:".zip",onChange:g=>{const k=g.target.files?.[0];k&&V(k)}}),r?e.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[e.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-b-2 border-primary"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("upload.uploading")})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"rounded-full border-2 border-muted-foreground/25 p-3",children:e.jsx(Lt,{className:"h-6 w-6 text-muted-foreground/50"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:[s("upload.dragText")," ",e.jsx("button",{type:"button",onClick:()=>c.current?.click(),className:"mx-1 text-primary hover:underline",children:s("upload.clickText")})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("upload.supportText")})]})]})})]})]})}),e.jsx(de,{open:!!u,onOpenChange:g=>{g||(i(null),P(0))},children:e.jsxs(oe,{className:"max-w-4xl",children:[e.jsxs(ge,{children:[e.jsxs(me,{children:[u?.name," ",s("preview.title")]}),e.jsx(Ae,{className:"text-center",children:u&&s("preview.imageCount",{current:p+1,total:u.images.length})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"aspect-[16/9] overflow-hidden rounded-lg border bg-muted",children:u?.images[p]&&e.jsx("img",{src:u.images[p],alt:`${u.name} 预览图 ${p+1}`,className:"h-full w-full object-contain"})}),u&&u.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(L,{variant:"outline",size:"icon",className:"absolute left-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:S,children:e.jsx(gl,{className:"h-4 w-4"})}),e.jsx(L,{variant:"outline",size:"icon",className:"absolute right-4 top-1/2 h-8 w-8 -translate-y-1/2 rounded-full bg-background/80 hover:bg-background",onClick:M,children:e.jsx(pl,{className:"h-4 w-4"})})]})]}),u&&u.images.length>1&&e.jsx("div",{className:"mt-4 flex gap-2 overflow-x-auto pb-2",children:u.images.map((g,k)=>e.jsx("button",{onClick:()=>P(k),className:_("relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-md border-2",p===k?"border-primary":"border-transparent"),children:e.jsx("img",{src:g,alt:`缩略图 ${k+1}`,className:"h-full w-full object-cover"})},k))})]})})]})]})}function yr(){return e.jsxs(Se,{children:[e.jsxs(De,{children:[e.jsx(je,{className:"h-6 w-[200px]"}),e.jsx(je,{className:"h-4 w-[300px]"})]}),e.jsxs(Fe,{className:"flex items-center justify-end space-x-3",children:[e.jsx(je,{className:"h-10 w-[100px]"}),e.jsx(je,{className:"h-10 w-[100px]"})]})]})}const rx=Object.freeze(Object.defineProperty({__proto__:null,default:nx},Symbol.toStringTag,{value:"Module"})),Za=m.forwardRef(({className:s,value:n=[],onChange:t,...r},a)=>{const[o,l]=m.useState("");m.useEffect(()=>{if(o.includes(",")){const x=new Set([...n,...o.split(",").map(u=>u.trim())]);t(Array.from(x)),l("")}},[o,t,n]);const d=()=>{if(o){const x=new Set([...n,o]);t(Array.from(x)),l("")}};return e.jsxs("div",{className:_(" has-[:focus-visible]:outline-none has-[:focus-visible]:ring-1 has-[:focus-visible]:ring-neutral-950 dark:has-[:focus-visible]:ring-neutral-300 flex w-full flex-wrap gap-2 rounded-md border border-input shadow-sm px-3 py-2 text-sm ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",s),children:[n.map(x=>e.jsxs(K,{variant:"secondary",children:[x,e.jsx(G,{variant:"ghost",size:"icon",className:"ml-2 h-3 w-3",onClick:()=>{t(n.filter(u=>u!==x))},children:e.jsx(Nn,{className:"w-3"})})]},x)),e.jsx("input",{className:"flex-1 outline-none placeholder:text-muted-foreground bg-transparent",value:o,onChange:x=>l(x.target.value),onKeyDown:x=>{x.key==="Enter"||x.key===","?(x.preventDefault(),d()):x.key==="Backspace"&&o.length===0&&n.length>0&&(x.preventDefault(),t(n.slice(0,-1)))},...r,ref:a})]})});Za.displayName="InputTags";const lx=h.object({id:h.number().nullable(),title:h.string().min(1).max(250),content:h.string().min(1),show:h.boolean(),tags:h.array(h.string()),img_url:h.string().nullable()}),ix={id:null,show:!1,tags:[],img_url:"",title:"",content:""};function ji({refetch:s,dialogTrigger:n,type:t="add",defaultFormValues:r=ix}){const{t:a}=O("notice"),[o,l]=m.useState(!1),d=Ne({resolver:ke(lx),defaultValues:r,mode:"onChange",shouldFocusError:!0}),x=new In({html:!0});return e.jsx(Te,{...d,children:e.jsxs(de,{onOpenChange:l,open:o,children:[e.jsx(fs,{asChild:!0,children:n||e.jsxs(L,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ke,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add.button")})]})}),e.jsxs(oe,{className:"sm:max-w-[1025px]",children:[e.jsxs(ge,{children:[e.jsx(me,{children:a(t==="add"?"form.add.title":"form.edit.title")}),e.jsx(Ae,{})]}),e.jsx(j,{control:d.control,name:"title",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.title.label")}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(D,{placeholder:a("form.fields.title.placeholder"),...u})})}),e.jsx(R,{})]})}),e.jsx(j,{control:d.control,name:"content",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.content.label")}),e.jsx(b,{children:e.jsx(Mn,{style:{height:"500px"},value:u.value,renderHTML:i=>x.render(i),onChange:({text:i})=>{u.onChange(i)}})}),e.jsx(R,{})]})}),e.jsx(j,{control:d.control,name:"img_url",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.img_url.label")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(D,{type:"text",placeholder:a("form.fields.img_url.placeholder"),...u,value:u.value||""})})}),e.jsx(R,{})]})}),e.jsx(j,{control:d.control,name:"show",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.show.label")}),e.jsx("div",{className:"relative py-2",children:e.jsx(b,{children:e.jsx(ee,{checked:u.value,onCheckedChange:u.onChange})})}),e.jsx(R,{})]})}),e.jsx(j,{control:d.control,name:"tags",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.fields.tags.label")}),e.jsx(b,{children:e.jsx(Za,{value:u.value,onChange:u.onChange,placeholder:a("form.fields.tags.placeholder"),className:"w-full"})}),e.jsx(R,{})]})}),e.jsxs(Ie,{children:[e.jsx(Zs,{asChild:!0,children:e.jsx(L,{type:"button",variant:"outline",children:a("form.buttons.cancel")})}),e.jsx(L,{type:"submit",onClick:u=>{u.preventDefault(),d.handleSubmit(async i=>{aa.save(i).then(({data:c})=>{c&&($.success(a("form.buttons.success")),s(),l(!1))})})()},children:a("form.buttons.submit")})]})]})]})})}function ox({table:s,refetch:n,saveOrder:t,isSortMode:r}){const{t:a}=O("notice"),o=s.getState().columnFilters.length>0;return e.jsxs("div",{className:"flex items-center justify-between space-x-2 ",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[!r&&e.jsx(ji,{refetch:n}),!r&&e.jsx(D,{placeholder:a("table.toolbar.search"),value:s.getColumn("title")?.getFilterValue()??"",onChange:l=>s.getColumn("title")?.setFilterValue(l.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),o&&!r&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-9 px-2 lg:px-3",children:[a("table.toolbar.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(L,{variant:r?"default":"outline",onClick:t,className:"h-8",size:"sm",children:a(r?"table.toolbar.sort.save":"table.toolbar.sort.edit")})})]})}const cx=s=>{const{t:n}=O("notice");return[{id:"drag-handle",header:"",cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(gd,{className:"h-4 w-4 cursor-move text-muted-foreground"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.id")}),cell:({row:t})=>e.jsx(K,{variant:"outline",className:"font-mono",children:t.getValue("id")}),enableSorting:!0,size:60},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.show")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(ee,{defaultChecked:t.getValue("show"),onCheckedChange:async()=>{const{data:r}=await aa.updateStatus(t.original.id);r||s()}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.title")}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[500px] items-center",children:e.jsx("span",{className:"truncate font-medium",children:t.getValue("title")})}),enableSorting:!1,size:6e3},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:n("table.columns.actions")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-end space-x-2",children:[e.jsx(ji,{refetch:s,dialogTrigger:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(nt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("table.actions.edit")})]}),type:"edit",defaultFormValues:t.original}),e.jsx(us,{title:n("table.actions.delete.title"),description:n("table.actions.delete.description"),onConfirm:async()=>{aa.drop(t.original.id).then(()=>{$.success(n("table.actions.delete.success")),s()})},children:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ms,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("table.actions.delete.title")})]})})]}),size:100}]};function dx(){const[s,n]=m.useState({}),[t,r]=m.useState({}),[a,o]=m.useState([]),[l,d]=m.useState([]),[x,u]=m.useState(!1),[i,c]=m.useState({}),[p,P]=m.useState({pageSize:50,pageIndex:0}),[T,C]=m.useState([]),{refetch:F}=ne({queryKey:["notices"],queryFn:async()=>{const{data:S}=await aa.getList();return C(S),S}});m.useEffect(()=>{r({"drag-handle":x,content:!x,created_at:!x,actions:!x}),P({pageSize:x?99999:50,pageIndex:0})},[x]);const w=(S,M)=>{x&&(S.dataTransfer.setData("text/plain",M.toString()),S.currentTarget.classList.add("opacity-50"))},V=(S,M)=>{if(!x)return;S.preventDefault(),S.currentTarget.classList.remove("bg-muted");const E=parseInt(S.dataTransfer.getData("text/plain"));if(E===M)return;const g=[...T],[k]=g.splice(E,1);g.splice(M,0,k),C(g)},y=async()=>{if(!x){u(!0);return}aa.sort(T.map(S=>S.id)).then(()=>{$.success("排序保存成功"),u(!1),F()}).finally(()=>{u(!1)})},N=We({data:T??[],columns:cx(F),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,columnSizing:i,pagination:p},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:o,onColumnVisibilityChange:r,onColumnSizingChange:c,onPaginationChange:P,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(ns,{table:N,toolbar:S=>e.jsx(ox,{table:S,refetch:F,saveOrder:y,isSortMode:x}),draggable:x,onDragStart:w,onDragEnd:S=>S.currentTarget.classList.remove("opacity-50"),onDragOver:S=>{S.preventDefault(),S.currentTarget.classList.add("bg-muted")},onDragLeave:S=>S.currentTarget.classList.remove("bg-muted"),onDrop:V,showPagination:!x})})}function mx(){const{t:s}=O("notice");return e.jsxs(qe,{children:[e.jsxs(Ue,{className:"flex items-center justify-between",children:[e.jsx(os,{}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")})}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(dx,{})})]})]})}const ux=Object.freeze(Object.defineProperty({__proto__:null,default:mx},Symbol.toStringTag,{value:"Module"})),xx=h.object({id:h.number().nullable(),language:h.string().max(250),category:h.string().max(250),title:h.string().min(1).max(250),body:h.string().min(1),show:h.boolean()}),hx={id:null,language:"zh-CN",category:"",title:"",body:"",show:!1};function vi({refreshData:s,dialogTrigger:n,type:t="add",defaultFormValues:r=hx}){const{t:a}=O("knowledge"),[o,l]=m.useState(!1),d=Ne({resolver:ke(xx),defaultValues:r,mode:"onChange",shouldFocusError:!0}),x=new In({html:!0});return m.useEffect(()=>{o&&r.id&&Et.getInfo(r.id).then(({data:u})=>{d.reset(u)})},[r.id,d,o]),e.jsxs(de,{onOpenChange:l,open:o,children:[e.jsx(fs,{asChild:!0,children:n||e.jsxs(L,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ke,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add")})]})}),e.jsxs(oe,{className:"sm:max-w-[1025px]",children:[e.jsxs(ge,{children:[e.jsx(me,{children:a(t==="add"?"form.add":"form.edit")}),e.jsx(Ae,{})]}),e.jsxs(Te,{...d,children:[e.jsx(j,{control:d.control,name:"title",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.title")}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(D,{placeholder:a("form.titlePlaceholder"),...u})})}),e.jsx(R,{})]})}),e.jsx(j,{control:d.control,name:"category",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.category")}),e.jsx("div",{className:"relative ",children:e.jsx(b,{children:e.jsx(D,{placeholder:a("form.categoryPlaceholder"),...u})})}),e.jsx(R,{})]})}),e.jsx(j,{control:d.control,name:"language",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.language")}),e.jsx(b,{children:e.jsxs(X,{value:u.value,onValueChange:u.onChange,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:a("form.languagePlaceholder")})}),e.jsx(Q,{children:[{value:"en-US"},{value:"ja-JP"},{value:"ko-KR"},{value:"vi-VN"},{value:"zh-CN"},{value:"zh-TW"}].map(i=>e.jsx(q,{value:i.value,className:"cursor-pointer",children:a(`languages.${i.value}`)},i.value))})]})})]})}),e.jsx(j,{control:d.control,name:"body",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.content")}),e.jsx(b,{children:e.jsx(Mn,{style:{height:"500px"},value:u.value,renderHTML:i=>x.render(i),onChange:({text:i})=>{u.onChange(i)}})}),e.jsx(R,{})]})}),e.jsx(j,{control:d.control,name:"show",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.show")}),e.jsx("div",{className:"relative py-2",children:e.jsx(b,{children:e.jsx(ee,{checked:u.value,onCheckedChange:u.onChange})})}),e.jsx(R,{})]})}),e.jsxs(Ie,{children:[e.jsx(Zs,{asChild:!0,children:e.jsx(L,{type:"button",variant:"outline",children:a("form.cancel")})}),e.jsx(L,{type:"submit",onClick:()=>{d.handleSubmit(u=>{Et.save(u).then(({data:i})=>{i&&(d.reset(),$.success(a("messages.operationSuccess")),l(!1),s())})})()},children:a("form.submit")})]})]})]})]})}function gx({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Aa,{className:"mr-2 h-4 w-4"}),n,a?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:a.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:a.size>2?e.jsxs(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[a.size," selected"]}):t.filter(o=>a.has(o.value)).map(o=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(Ge,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Gs,{children:[e.jsx(lt,{placeholder:n}),e.jsxs(Ws,{children:[e.jsx(it,{children:"No results found."}),e.jsx(xs,{children:t.map(o=>{const l=a.has(o.value);return e.jsxs($e,{onSelect:()=>{l?a.delete(o.value):a.add(o.value);const d=Array.from(a);s?.setFilterValue(d.length?d:void 0)},children:[e.jsx("div",{className:_("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",l?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(vt,{className:_("h-4 w-4")})}),o.icon&&e.jsx(o.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:o.label}),r?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(o.value)})]},o.value)})}),a.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{}),e.jsx(xs,{children:e.jsx($e,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function px({table:s,refetch:n,saveOrder:t,isSortMode:r}){const a=s.getState().columnFilters.length>0,{t:o}=O("knowledge");return e.jsxs("div",{className:"flex items-center justify-between",children:[r?e.jsx("p",{className:"text-sm text-muted-foreground",children:o("toolbar.sortModeHint")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(vi,{refreshData:n}),e.jsx(D,{placeholder:o("toolbar.searchPlaceholder"),value:s.getColumn("title")?.getFilterValue()??"",onChange:l=>s.getColumn("title")?.setFilterValue(l.target.value),className:"h-8 w-[250px]"}),s.getColumn("category")&&e.jsx(gx,{column:s.getColumn("category"),title:o("columns.category"),options:Array.from(new Set(s.getCoreRowModel().rows.map(l=>l.getValue("category")))).map(l=>({label:l,value:l}))}),a&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),children:[o("toolbar.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(L,{variant:r?"default":"outline",onClick:t,size:"sm",children:o(r?"toolbar.saveSort":"toolbar.editSort")})})]})}const fx=({refetch:s,isSortMode:n=!1})=>{const{t}=O("knowledge");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:n?"cursor-move":"opacity-0",children:e.jsx($a,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:r})=>e.jsx(z,{column:r,title:t("columns.id")}),cell:({row:r})=>e.jsx(K,{variant:"outline",className:"justify-center",children:r.getValue("id")}),enableSorting:!0,size:70},{accessorKey:"show",header:({column:r})=>e.jsx(z,{column:r,title:t("columns.status")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center",children:e.jsx(ee,{defaultChecked:r.getValue("show"),onCheckedChange:async()=>{Et.updateStatus({id:r.original.id}).then(({data:a})=>{a||s()})}})}),enableSorting:!1,size:100},{accessorKey:"title",header:({column:r})=>e.jsx(z,{column:r,title:t("columns.title")}),cell:({row:r})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"line-clamp-2 font-medium",children:r.getValue("title")})}),enableSorting:!0,size:600},{accessorKey:"category",header:({column:r})=>e.jsx(z,{column:r,title:t("columns.category")}),cell:({row:r})=>e.jsx(K,{variant:"secondary",className:"max-w-[180px] truncate",children:r.getValue("category")}),enableSorting:!0,size:1800},{id:"actions",header:({column:r})=>e.jsx(z,{className:"justify-end",column:r,title:t("columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-end space-x-1",children:[e.jsx(vi,{refreshData:s,dialogTrigger:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(nt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:t("form.edit")})]}),type:"edit",defaultFormValues:r.original}),e.jsx(us,{title:t("messages.deleteConfirm"),description:t("messages.deleteDescription"),confirmText:t("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{Et.drop({id:r.original.id}).then(({data:a})=>{a&&($.success(t("messages.operationSuccess")),s())})},children:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ms,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:t("messages.deleteButton")})]})})]}),size:100}]};function jx(){const[s,n]=m.useState([]),[t,r]=m.useState([]),[a,o]=m.useState(!1),[l,d]=m.useState([]),[x,u]=m.useState({"drag-handle":!1}),[i,c]=m.useState({pageSize:20,pageIndex:0}),{refetch:p,isLoading:P,data:T}=ne({queryKey:["knowledge"],queryFn:async()=>{const{data:y}=await Et.getList();return d(y||[]),y}});m.useEffect(()=>{u({"drag-handle":a,actions:!a}),c({pageSize:a?99999:10,pageIndex:0})},[a]);const C=(y,N)=>{a&&(y.dataTransfer.setData("text/plain",N.toString()),y.currentTarget.classList.add("opacity-50"))},F=(y,N)=>{if(!a)return;y.preventDefault(),y.currentTarget.classList.remove("bg-muted");const S=parseInt(y.dataTransfer.getData("text/plain"));if(S===N)return;const M=[...l],[E]=M.splice(S,1);M.splice(N,0,E),d(M)},w=async()=>{a?Et.sort({ids:l.map(y=>y.id)}).then(()=>{p(),o(!1),$.success("排序保存成功")}):o(!0)},V=We({data:l,columns:fx({refetch:p,isSortMode:a}),state:{sorting:t,columnFilters:s,columnVisibility:x,pagination:i},onSortingChange:r,onColumnFiltersChange:n,onColumnVisibilityChange:u,onPaginationChange:c,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ns,{table:V,toolbar:y=>e.jsx(px,{table:y,refetch:p,saveOrder:w,isSortMode:a}),draggable:a,onDragStart:C,onDragEnd:y=>y.currentTarget.classList.remove("opacity-50"),onDragOver:y=>{y.preventDefault(),y.currentTarget.classList.add("bg-muted")},onDragLeave:y=>y.currentTarget.classList.remove("bg-muted"),onDrop:F,showPagination:!a})}function vx(){const{t:s}=O("knowledge");return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight mb-2",children:s("title")}),e.jsx("p",{className:"text-muted-foreground",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(jx,{})})]})]})}const bx=Object.freeze(Object.defineProperty({__proto__:null,default:vx},Symbol.toStringTag,{value:"Module"}));function yx(s,n){const[t,r]=m.useState(s);return m.useEffect(()=>{const a=setTimeout(()=>r(s),n);return()=>{clearTimeout(a)}},[s,n]),t}function un(s,n){if(s.length===0)return{};if(!n)return{"":s};const t={};return s.forEach(r=>{const a=r[n]||"";t[a]||(t[a]=[]),t[a].push(r)}),t}function _x(s,n){const t=JSON.parse(JSON.stringify(s));for(const[r,a]of Object.entries(t))t[r]=a.filter(o=>!n.find(l=>l.value===o.value));return t}function Nx(s,n){for(const[,t]of Object.entries(s))if(t.some(r=>n.find(a=>a.value===r.value)))return!0;return!1}const bi=m.forwardRef(({className:s,...n},t)=>pd(a=>a.filtered.count===0)?e.jsx("div",{ref:t,className:_("py-6 text-center text-sm",s),"cmdk-empty":"",role:"presentation",...n}):null);bi.displayName="CommandEmpty";const at=m.forwardRef(({value:s,onChange:n,placeholder:t,defaultOptions:r=[],options:a,delay:o,onSearch:l,loadingIndicator:d,emptyIndicator:x,maxSelected:u=Number.MAX_SAFE_INTEGER,onMaxSelected:i,hidePlaceholderWhenSelected:c,disabled:p,groupBy:P,className:T,badgeClassName:C,selectFirstItem:F=!0,creatable:w=!1,triggerSearchOnFocus:V=!1,commandProps:y,inputProps:N,hideClearAllButton:S=!1},M)=>{const E=m.useRef(null),[g,k]=m.useState(!1),W=m.useRef(!1),[te,ae]=m.useState(!1),[B,se]=m.useState(s||[]),[fe,cs]=m.useState(un(r,P)),[Me,re]=m.useState(""),ks=yx(Me,o||500);m.useImperativeHandle(M,()=>({selectedValue:[...B],input:E.current,focus:()=>E.current?.focus()}),[B]);const _s=m.useCallback(U=>{const be=B.filter(Oe=>Oe.value!==U.value);se(be),n?.(be)},[n,B]),ot=m.useCallback(U=>{const be=E.current;be&&((U.key==="Delete"||U.key==="Backspace")&&be.value===""&&B.length>0&&(B[B.length-1].fixed||_s(B[B.length-1])),U.key==="Escape"&&be.blur())},[_s,B]);m.useEffect(()=>{s&&se(s)},[s]),m.useEffect(()=>{if(!a||l)return;const U=un(a||[],P);JSON.stringify(U)!==JSON.stringify(fe)&&cs(U)},[r,a,P,l,fe]),m.useEffect(()=>{const U=async()=>{ae(!0);const Oe=await l?.(ks);cs(un(Oe||[],P)),ae(!1)};(async()=>{!l||!g||(V&&await U(),ks&&await U())})()},[ks,P,g,V]);const Es=()=>{if(!w||Nx(fe,[{value:Me,label:Me}])||B.find(be=>be.value===Me))return;const U=e.jsx($e,{value:Me,className:"cursor-pointer",onMouseDown:be=>{be.preventDefault(),be.stopPropagation()},onSelect:be=>{if(B.length>=u){i?.(B.length);return}re("");const Oe=[...B,{value:be,label:be}];se(Oe),n?.(Oe)},children:`Create "${Me}"`});if(!l&&Me.length>0||l&&ks.length>0&&!te)return U},ct=m.useCallback(()=>{if(x)return l&&!w&&Object.keys(fe).length===0?e.jsx($e,{value:"-",disabled:!0,children:x}):e.jsx(bi,{children:x})},[w,x,l,fe]),dt=m.useMemo(()=>_x(fe,B),[fe,B]),mt=m.useCallback(()=>{if(y?.filter)return y.filter;if(w)return(U,be)=>U.toLowerCase().includes(be.toLowerCase())?1:-1},[w,y?.filter]),H=m.useCallback(()=>{const U=B.filter(be=>be.fixed);se(U),n?.(U)},[n,B]);return e.jsxs(Gs,{...y,onKeyDown:U=>{ot(U),y?.onKeyDown?.(U)},className:_("h-auto overflow-visible bg-transparent",y?.className),shouldFilter:y?.shouldFilter!==void 0?y.shouldFilter:!l,filter:mt(),children:[e.jsx("div",{className:_("rounded-md border border-input text-sm ring-offset-background focus-within:ring-1 focus-within:ring-ring ",{"px-3 py-2":B.length!==0,"cursor-text":!p&&B.length!==0},T),onClick:()=>{p||E.current?.focus()},children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[B.map(U=>e.jsxs(K,{className:_("data-[disabled]:bg-muted-foreground data-[disabled]:text-muted data-[disabled]:hover:bg-muted-foreground","data-[fixed]:bg-muted-foreground data-[fixed]:text-muted data-[fixed]:hover:bg-muted-foreground",C),"data-fixed":U.fixed,"data-disabled":p||void 0,children:[U.label,e.jsx("button",{className:_("ml-1 rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",(p||U.fixed)&&"hidden"),onKeyDown:be=>{be.key==="Enter"&&_s(U)},onMouseDown:be=>{be.preventDefault(),be.stopPropagation()},onClick:()=>_s(U),children:e.jsx(Nn,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},U.value)),e.jsx(hs.Input,{...N,ref:E,value:Me,disabled:p,onValueChange:U=>{re(U),N?.onValueChange?.(U)},onBlur:U=>{W.current===!1&&k(!1),N?.onBlur?.(U)},onFocus:U=>{k(!0),V&&l?.(ks),N?.onFocus?.(U)},placeholder:c&&B.length!==0?"":t,className:_("flex-1 bg-transparent outline-none placeholder:text-muted-foreground",{"w-full":c,"px-3 py-2":B.length===0,"ml-1":B.length!==0},N?.className)}),e.jsx("button",{type:"button",onClick:H,className:_((S||p||B.length<1||B.filter(U=>U.fixed).length===B.length)&&"hidden"),children:e.jsx(Nn,{})})]})}),e.jsx("div",{className:"relative",children:g&&e.jsx(Ws,{className:"absolute top-1 z-10 w-full rounded-md border bg-popover text-popover-foreground shadow-md outline-none animate-in",onMouseLeave:()=>{W.current=!1},onMouseEnter:()=>{W.current=!0},onMouseUp:()=>{E.current?.focus()},children:te?e.jsx(e.Fragment,{children:d}):e.jsxs(e.Fragment,{children:[ct(),Es(),!F&&e.jsx($e,{value:"-",className:"hidden"}),Object.entries(dt).map(([U,be])=>e.jsx(xs,{heading:U,className:"h-full overflow-auto",children:e.jsx(e.Fragment,{children:be.map(Oe=>e.jsx($e,{value:Oe.value,disabled:Oe.disable,onMouseDown:ye=>{ye.preventDefault(),ye.stopPropagation()},onSelect:()=>{if(B.length>=u){i?.(B.length);return}re("");const ye=[...B,Oe];se(ye),n?.(ye)},className:_("cursor-pointer",Oe.disable&&"cursor-default text-muted-foreground"),children:Oe.label},Oe.value))})},U))]})})})]})});at.displayName="MultipleSelector";const wx=s=>h.object({id:h.number().optional(),name:h.string().min(2,s("messages.nameValidation.min")).max(50,s("messages.nameValidation.max")).regex(/^[a-zA-Z0-9\u4e00-\u9fa5_-]+$/,s("messages.nameValidation.pattern"))});function en({refetch:s,dialogTrigger:n,defaultValues:t={name:""},type:r="add"}){const{t:a}=O("group"),o=Ne({resolver:ke(wx(a)),defaultValues:t,mode:"onChange"}),[l,d]=m.useState(!1),[x,u]=m.useState(!1),i=async c=>{u(!0),yt.save(c).then(()=>{$.success(a(r==="edit"?"messages.updateSuccess":"messages.createSuccess")),s&&s(),o.reset(),d(!1)}).finally(()=>{u(!1)})};return e.jsxs(de,{open:l,onOpenChange:d,children:[e.jsx(fs,{asChild:!0,children:n||e.jsxs(L,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ke,{icon:"ion:add"}),e.jsx("span",{children:a("form.add")})]})}),e.jsxs(oe,{className:"sm:max-w-[425px]",children:[e.jsxs(ge,{children:[e.jsx(me,{children:a(r==="edit"?"form.edit":"form.create")}),e.jsx(Ae,{children:a(r==="edit"?"form.editDescription":"form.createDescription")})]}),e.jsx(Te,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(i),className:"space-y-4",children:[e.jsx(j,{control:o.control,name:"name",render:({field:c})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.name")}),e.jsx(b,{children:e.jsx(D,{placeholder:a("form.namePlaceholder"),...c,className:"w-full"})}),e.jsx(A,{children:a("form.nameDescription")}),e.jsx(R,{})]})}),e.jsxs(Ie,{className:"gap-2",children:[e.jsx(Zs,{asChild:!0,children:e.jsx(L,{type:"button",variant:"outline",children:a("form.cancel")})}),e.jsxs(L,{type:"submit",disabled:x||!o.formState.isValid,children:[x&&e.jsx(ka,{className:"mr-2 h-4 w-4 animate-spin"}),a(r==="edit"?"form.update":"form.create")]})]})]})})]})]})}const yi=m.createContext(void 0);function Cx({children:s,refetch:n}){const[t,r]=m.useState(!1),[a,o]=m.useState(null),[l,d]=m.useState(he.Shadowsocks);return e.jsx(yi.Provider,{value:{isOpen:t,setIsOpen:r,editingServer:a,setEditingServer:o,serverType:l,setServerType:d,refetch:n},children:s})}function _i(){const s=m.useContext(yi);if(s===void 0)throw new Error("useServerEdit must be used within a ServerEditProvider");return s}function xn({dialogTrigger:s,value:n,setValue:t,templateType:r}){const{t:a}=O("server");m.useEffect(()=>{console.log(n)},[n]);const[o,l]=m.useState(!1),[d,x]=m.useState(()=>{if(!n||Object.keys(n).length===0)return"";try{return JSON.stringify(n,null,2)}catch{return""}}),[u,i]=m.useState(null),c=w=>{if(!w)return null;try{const V=JSON.parse(w);return typeof V!="object"||V===null?a("network_settings.validation.must_be_object"):null}catch{return a("network_settings.validation.invalid_json")}},p={tcp:{label:"TCP",content:{acceptProxyProtocol:!1,header:{type:"none"}}},"tcp-http":{label:"TCP + HTTP",content:{acceptProxyProtocol:!1,header:{type:"http",request:{version:"1.1",method:"GET",path:["/"],headers:{Host:["www.example.com"]}},response:{version:"1.1",status:"200",reason:"OK"}}}},grpc:{label:"gRPC",content:{serviceName:"GunService"}},ws:{label:"WebSocket",content:{path:"/",headers:{Host:"v2ray.com"}}},httpupgrade:{label:"HttpUpgrade",content:{acceptProxyProtocol:!1,path:"/",host:"xray.com",headers:{key:"value"}}},xhttp:{label:"XHTTP",content:{host:"example.com",path:"/yourpath",mode:"auto",extra:{headers:{},xPaddingBytes:"100-1000",noGRPCHeader:!1,noSSEHeader:!1,scMaxEachPostBytes:1e6,scMinPostsIntervalMs:30,scMaxBufferedPosts:30,xmux:{maxConcurrency:"16-32",maxConnections:0,cMaxReuseTimes:"64-128",cMaxLifetimeMs:0,hMaxRequestTimes:"800-900",hKeepAlivePeriod:0},downloadSettings:{address:"",port:443,network:"xhttp",security:"tls",tlsSettings:{},xhttpSettings:{path:"/yourpath"},sockopt:{}}}}}},P=()=>{switch(r){case"tcp":return["tcp","tcp-http"];case"grpc":return["grpc"];case"ws":return["ws"];case"httpupgrade":return["httpupgrade"];case"xhttp":return["xhttp"];default:return[]}},T=()=>{const w=c(d||"");if(w){$.error(w);return}try{if(!d){t(null),l(!1);return}t(JSON.parse(d)),l(!1)}catch{$.error(a("network_settings.errors.save_failed"))}},C=w=>{x(w),i(c(w))},F=w=>{const V=p[w];if(V){const y=JSON.stringify(V.content,null,2);x(y),i(null)}};return m.useEffect(()=>{o&&console.log(n)},[o,n]),m.useEffect(()=>{o&&n&&Object.keys(n).length>0&&x(JSON.stringify(n,null,2))},[o,n]),e.jsxs(de,{open:o,onOpenChange:w=>{!w&&o&&T(),l(w)},children:[e.jsx(fs,{asChild:!0,children:s??e.jsx(G,{variant:"link",children:a("network_settings.edit_protocol")})}),e.jsxs(oe,{className:"sm:max-w-[425px]",children:[e.jsx(ge,{children:e.jsx(me,{children:a("network_settings.edit_protocol_config")})}),e.jsxs("div",{className:"space-y-4",children:[P().length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:P().map(w=>e.jsx(G,{variant:"outline",size:"sm",onClick:()=>F(w),children:a("network_settings.use_template",{template:p[w].label})},w))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Rs,{className:`min-h-[200px] font-mono text-sm ${u?"border-red-500 focus-visible:ring-red-500":""}`,value:d,placeholder:P().length>0?a("network_settings.json_config_placeholder_with_template"):a("network_settings.json_config_placeholder"),onChange:w=>C(w.target.value)}),u&&e.jsx("p",{className:"text-sm text-red-500",children:u})]})]}),e.jsxs(Ie,{className:"gap-2",children:[e.jsx(G,{variant:"outline",onClick:()=>l(!1),children:a("common.cancel")}),e.jsx(G,{onClick:T,disabled:!!u,children:a("common.confirm")})]})]})]})}function xp(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}const Sx={},kx=Object.freeze(Object.defineProperty({__proto__:null,default:Sx},Symbol.toStringTag,{value:"Module"})),hp=Ed(kx),_r=s=>s.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Tx=()=>{try{const s=jd.box.keyPair(),n=_r(ir.encodeBase64(s.secretKey)),t=_r(ir.encodeBase64(s.publicKey));return{privateKey:n,publicKey:t}}catch(s){throw console.error("Error generating x25519 key pair:",s),s}},Dx=()=>{try{return Tx()}catch(s){throw console.error("Error generating key pair:",s),s}},Fx=s=>{const n=new Uint8Array(Math.ceil(s/2));return window.crypto.getRandomValues(n),Array.from(n).map(t=>t.toString(16).padStart(2,"0")).join("").substring(0,s)},Px=()=>{const s=Math.floor(Math.random()*8)*2+2;return Fx(s)},Lx=h.object({cipher:h.string().default("aes-128-gcm"),plugin:h.string().optional().default(""),plugin_opts:h.string().optional().default(""),client_fingerprint:h.string().optional().default("chrome")}),Rx=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({})}),Ex=h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({})}),Vx=h.object({version:h.coerce.number().default(2),alpn:h.string().default("h2"),obfs:h.object({open:h.coerce.boolean().default(!1),type:h.string().default("salamander"),password:h.string().default("")}).default({}),tls:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),bandwidth:h.object({up:h.string().default(""),down:h.string().default("")}).default({}),hop_interval:h.number().optional(),port_range:h.string().optional()}),Ix=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({}),reality_settings:h.object({server_port:h.coerce.number().default(443),server_name:h.string().default(""),allow_insecure:h.boolean().default(!1),public_key:h.string().default(""),private_key:h.string().default(""),short_id:h.string().default("")}).default({}),network:h.string().default("tcp"),network_settings:h.record(h.any()).default({}),flow:h.string().default("")}),Mx=h.object({version:h.coerce.number().default(5),congestion_control:h.string().default("bbr"),alpn:h.array(h.string()).default(["h3"]),udp_relay_mode:h.string().default("native"),tls:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({})}),Ox=h.object({}),zx=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({})}),$x=h.object({tls:h.coerce.number().default(0),tls_settings:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({})}),Ax=h.object({transport:h.string().default("tcp"),multiplexing:h.string().default("MULTIPLEXING_LOW")}),qx=h.object({padding_scheme:h.array(h.string()).optional().default([]),tls:h.object({server_name:h.string().default(""),allow_insecure:h.boolean().default(!1)}).default({})}),Ee={shadowsocks:{schema:Lx,ciphers:["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"],plugins:[{value:"none",label:"None"},{value:"obfs",label:"Simple Obfs"},{value:"v2ray-plugin",label:"V2Ray Plugin"}],clientFingerprints:[{value:"chrome",label:"Chrome"},{value:"firefox",label:"Firefox"},{value:"safari",label:"Safari"},{value:"ios",label:"iOS"}]},vmess:{schema:Rx,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},trojan:{schema:Ex,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"}]},hysteria:{schema:Vx,versions:["1","2"],alpnOptions:["hysteria","http/1.1","h2","h3"]},vless:{schema:Ix,networkOptions:[{value:"tcp",label:"TCP"},{value:"ws",label:"Websocket"},{value:"grpc",label:"gRPC"},{value:"kcp",label:"mKCP"},{value:"httpupgrade",label:"HttpUpgrade"},{value:"xhttp",label:"XHTTP"}],flowOptions:["none","xtls-rprx-direct","xtls-rprx-splice","xtls-rprx-vision"]},tuic:{schema:Mx,versions:["5","4"],congestionControls:["bbr","cubic","new_reno"],alpnOptions:[{value:"h3",label:"HTTP/3"},{value:"h2",label:"HTTP/2"},{value:"http/1.1",label:"HTTP/1.1"}],udpRelayModes:[{value:"native",label:"Native"},{value:"quic",label:"QUIC"}]},socks:{schema:Ox},naive:{schema:$x},http:{schema:zx},mieru:{schema:Ax,transportOptions:[{value:"tcp",label:"TCP"},{value:"udp",label:"UDP"}],multiplexingOptions:[{value:"MULTIPLEXING_OFF",label:"Off"},{value:"MULTIPLEXING_LOW",label:"Low"},{value:"MULTIPLEXING_MIDDLE",label:"Middle"},{value:"MULTIPLEXING_HIGH",label:"High"}]},anytls:{schema:qx,defaultPaddingScheme:["stop=8","0=30-30","1=100-400","2=400-500,c,500-1000,c,500-1000,c,500-1000,c,500-1000","3=9-9,500-1000","4=500-1000","5=500-1000","6=500-1000","7=500-1000"]}},Ux=({serverType:s,value:n,onChange:t})=>{const{t:r}=O("server"),a=s?Ee[s]:null,o=a?.schema||h.record(h.any()),l=s?o.parse({}):{},d=Ne({resolver:ke(o),defaultValues:l,mode:"onChange"}),[x,u]=m.useState(!1),[i,c]=m.useState("");if(m.useEffect(()=>{if(!n||Object.keys(n).length===0){if(s){const g=o.parse({});d.reset(g)}}else d.reset(n)},[s,n,t,d,o]),m.useEffect(()=>{const g=d.watch(k=>{t(k)});return()=>g.unsubscribe()},[d,t]),!s||!a)return null;const E={shadowsocks:()=>e.jsxs(e.Fragment,{children:[e.jsx(j,{control:d.control,name:"cipher",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.shadowsocks.cipher.label")}),e.jsx(b,{children:e.jsxs(Ze,{open:x,onOpenChange:u,children:[e.jsx(es,{asChild:!0,children:e.jsxs(G,{variant:"outline",role:"combobox","aria-expanded":x,className:_("w-full justify-between",!g.value&&"text-muted-foreground"),disabled:!1,children:[g.value||r("dynamic_form.shadowsocks.cipher.placeholder"),e.jsx(fd,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ge,{className:"w-[400px] p-0",align:"start",children:e.jsxs(Gs,{shouldFilter:!1,children:[e.jsx(lt,{placeholder:r("dynamic_form.shadowsocks.cipher.search_placeholder"),value:i,onValueChange:k=>{c(k),k&&!Ee.shadowsocks.ciphers.includes(k)&&g.onChange(k)}}),e.jsxs(Ws,{children:[e.jsxs(it,{children:[i&&e.jsxs($e,{value:i,onSelect:k=>{g.onChange(k),c(""),u(!1)},children:[e.jsx(ba,{className:"mr-2 h-4 w-4 opacity-100"}),e.jsxs("span",{className:"font-medium text-blue-600",children:[r("dynamic_form.shadowsocks.cipher.use_custom"),' "',i,'"']}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",r("dynamic_form.shadowsocks.cipher.custom_label"),")"]})]}),!i&&e.jsxs("div",{className:"p-2 text-sm text-muted-foreground",children:[e.jsx("p",{children:r("dynamic_form.shadowsocks.cipher.no_results")}),e.jsx("p",{className:"mt-1 text-xs",children:r("dynamic_form.shadowsocks.cipher.custom_hint")})]})]}),e.jsx(xs,{heading:r("dynamic_form.shadowsocks.cipher.preset_group"),children:Ee.shadowsocks.ciphers.filter(k=>k.toLowerCase().includes(i.toLowerCase())).map(k=>e.jsxs($e,{value:k,onSelect:W=>{g.onChange(W),c(""),u(!1)},children:[e.jsx(ba,{className:_("mr-2 h-4 w-4",g.value===k?"opacity-100":"opacity-0")}),k]},k))}),g.value&&!Ee.shadowsocks.ciphers.includes(g.value)&&e.jsx(xs,{heading:r("dynamic_form.shadowsocks.cipher.custom_group"),children:e.jsxs($e,{value:g.value,onSelect:()=>{},children:[e.jsx(ba,{className:"mr-2 h-4 w-4 opacity-100"}),e.jsx("span",{className:"font-medium text-blue-600",children:g.value}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",r("dynamic_form.shadowsocks.cipher.current_value"),")"]})]})})]})]})})]})}),e.jsx(A,{children:r("dynamic_form.shadowsocks.cipher.description")})]})}),e.jsx(j,{control:d.control,name:"plugin",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.shadowsocks.plugin.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:k=>g.onChange(k==="none"?"":k),value:g.value===""?"none":g.value||"none",children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.shadowsocks.plugin.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.shadowsocks.plugins.map(k=>e.jsx(q,{value:k.value,children:k.label},k.value))})})]})}),e.jsx(A,{children:g.value&&g.value!=="none"&&g.value!==""&&e.jsxs(e.Fragment,{children:[g.value==="obfs"&&r("dynamic_form.shadowsocks.plugin.obfs_hint"),g.value==="v2ray-plugin"&&r("dynamic_form.shadowsocks.plugin.v2ray_hint")]})})]})}),d.watch("plugin")&&d.watch("plugin")!=="none"&&d.watch("plugin")!==""&&e.jsx(j,{control:d.control,name:"plugin_opts",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.shadowsocks.plugin_opts.label")}),e.jsx(A,{children:r("dynamic_form.shadowsocks.plugin_opts.description")}),e.jsx(b,{children:e.jsx(D,{type:"text",placeholder:r("dynamic_form.shadowsocks.plugin_opts.placeholder"),...g})})]})}),(d.watch("plugin")==="shadow-tls"||d.watch("plugin")==="restls")&&e.jsx(j,{control:d.control,name:"client_fingerprint",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.shadowsocks.client_fingerprint")}),e.jsx(b,{children:e.jsxs(X,{value:g.value||"chrome",onValueChange:g.onChange,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.shadowsocks.client_fingerprint_placeholder")})}),e.jsx(Q,{children:Ee.shadowsocks.clientFingerprints.map(k=>e.jsx(q,{value:k.value,children:k.label},k.value))})]})}),e.jsx(A,{children:r("dynamic_form.shadowsocks.client_fingerprint_description")})]})})]}),vmess:()=>e.jsxs(e.Fragment,{children:[e.jsx(j,{control:d.control,name:"tls",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.vmess.tls.label")}),e.jsx(b,{children:e.jsxs(X,{value:g.value?.toString(),onValueChange:k=>g.onChange(Number(k)),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.vmess.tls.placeholder")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:r("dynamic_form.vmess.tls.disabled")}),e.jsx(q,{value:"1",children:r("dynamic_form.vmess.tls.enabled")})]})]})})]})}),d.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.vmess.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.vmess.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(j,{control:d.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.vmess.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),e.jsx(j,{control:d.control,name:"network",render:({field:g})=>e.jsxs(f,{children:[e.jsxs(v,{children:[r("dynamic_form.vmess.network.label"),e.jsx(xn,{value:d.watch("network_settings"),setValue:k=>d.setValue("network_settings",k),templateType:d.watch("network")})]}),e.jsx(b,{children:e.jsxs(X,{onValueChange:g.onChange,value:g.value,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.vmess.network.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.vmess.networkOptions.map(k=>e.jsx(q,{value:k.value,className:"cursor-pointer",children:k.label},k.value))})})]})})]})})]}),trojan:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.trojan.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.trojan.server_name.placeholder"),...g,value:g.value||""})})]})}),e.jsx(j,{control:d.control,name:"allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.trojan.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:g.value||!1,onCheckedChange:g.onChange})})})]})})]}),e.jsx(j,{control:d.control,name:"network",render:({field:g})=>e.jsxs(f,{children:[e.jsxs(v,{children:[r("dynamic_form.trojan.network.label"),e.jsx(xn,{value:d.watch("network_settings")||{},setValue:k=>d.setValue("network_settings",k),templateType:d.watch("network")||"tcp"})]}),e.jsx(b,{children:e.jsxs(X,{onValueChange:g.onChange,value:g.value||"tcp",children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.trojan.network.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.trojan.networkOptions.map(k=>e.jsx(q,{value:k.value,className:"cursor-pointer",children:k.label},k.value))})})]})})]})})]}),hysteria:()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"version",render:({field:g})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(v,{children:r("dynamic_form.hysteria.version.label")}),e.jsx(b,{children:e.jsxs(X,{value:(g.value||2).toString(),onValueChange:k=>g.onChange(Number(k)),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.hysteria.version.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.hysteria.versions.map(k=>e.jsxs(q,{value:k,className:"cursor-pointer",children:["V",k]},k))})})]})})]})}),d.watch("version")==1&&e.jsx(j,{control:d.control,name:"alpn",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.hysteria.alpn.label")}),e.jsx(b,{children:e.jsxs(X,{value:g.value||"h2",onValueChange:g.onChange,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.hysteria.alpn.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.hysteria.alpnOptions.map(k=>e.jsx(q,{value:k,children:k},k))})})]})})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"obfs.open",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.hysteria.obfs.label")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:g.value||!1,onCheckedChange:g.onChange})})})]})}),!!d.watch("obfs.open")&&e.jsxs(e.Fragment,{children:[d.watch("version")=="2"&&e.jsx(j,{control:d.control,name:"obfs.type",render:({field:g})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(v,{children:r("dynamic_form.hysteria.obfs.type.label")}),e.jsx(b,{children:e.jsxs(X,{value:g.value||"salamander",onValueChange:g.onChange,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.hysteria.obfs.type.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:e.jsx(q,{value:"salamander",children:r("dynamic_form.hysteria.obfs.type.salamander")})})})]})})]})}),e.jsx(j,{control:d.control,name:"obfs.password",render:({field:g})=>e.jsxs(f,{className:d.watch("version")==2?"w-full":"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.hysteria.obfs.password.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.hysteria.obfs.password.placeholder"),...g,value:g.value||"",className:"pr-9"})}),e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",W=Array.from(crypto.getRandomValues(new Uint8Array(16))).map(te=>k[te%k.length]).join("");d.setValue("obfs.password",W),$.success(r("dynamic_form.hysteria.obfs.password.generate_success"))},className:"absolute right-0 top-0 h-full px-2 transition-transform duration-150 active:scale-90",children:e.jsx(Ke,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform duration-300 hover:rotate-180"})})]})]})})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"tls.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.hysteria.tls.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.hysteria.tls.server_name.placeholder"),...g,value:g.value||""})})]})}),e.jsx(j,{control:d.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.hysteria.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:g.value||!1,onCheckedChange:g.onChange})})})]})})]}),e.jsx(j,{control:d.control,name:"bandwidth.up",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.hysteria.bandwidth.up.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:r("dynamic_form.hysteria.bandwidth.up.placeholder")+(d.watch("version")==2?r("dynamic_form.hysteria.bandwidth.up.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...g,value:g.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:r("dynamic_form.hysteria.bandwidth.up.suffix")})})]})]})}),e.jsx(j,{control:d.control,name:"bandwidth.down",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.hysteria.bandwidth.down.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:r("dynamic_form.hysteria.bandwidth.down.placeholder")+(d.watch("version")==2?r("dynamic_form.hysteria.bandwidth.down.bbr_tip"):""),className:"rounded-br-none rounded-tr-none",...g,value:g.value||""})}),e.jsx("div",{className:"pointer-events-none z-[-1] flex items-center rounded-md rounded-bl-none rounded-tl-none border border-l-0 border-input px-3 shadow-sm",children:e.jsx("span",{className:"text-gray-500",children:r("dynamic_form.hysteria.bandwidth.down.suffix")})})]})]})}),e.jsx(e.Fragment,{children:e.jsx(j,{control:d.control,name:"hop_interval",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.hysteria.hop_interval.label","Hop 间隔 (秒)")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:r("dynamic_form.hysteria.hop_interval.placeholder","例如: 30"),...g,value:g.value||"",onChange:k=>{const W=k.target.value?parseInt(k.target.value):void 0;g.onChange(W)}})}),e.jsx(A,{children:r("dynamic_form.hysteria.hop_interval.description","Hop 间隔时间,单位为秒")})]})})})]}),vless:()=>e.jsxs(e.Fragment,{children:[e.jsx(j,{control:d.control,name:"tls",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.vless.tls.label")}),e.jsx(b,{children:e.jsxs(X,{value:g.value?.toString(),onValueChange:k=>g.onChange(Number(k)),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.vless.tls.placeholder")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:r("dynamic_form.vless.tls.none")}),e.jsx(q,{value:"1",children:r("dynamic_form.vless.tls.tls")}),e.jsx(q,{value:"2",children:r("dynamic_form.vless.tls.reality")})]})]})})]})}),d.watch("tls")=="1"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.vless.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.vless.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(j,{control:d.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.vless.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),d.watch("tls")==2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"reality_settings.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.vless.reality_settings.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.vless.reality_settings.server_name.placeholder"),...g})})]})}),e.jsx(j,{control:d.control,name:"reality_settings.server_port",render:({field:g})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(v,{children:r("dynamic_form.vless.reality_settings.server_port.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.vless.reality_settings.server_port.placeholder"),...g})})]})}),e.jsx(j,{control:d.control,name:"reality_settings.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.vless.reality_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),e.jsx("div",{className:"flex items-end gap-2",children:e.jsx(j,{control:d.control,name:"reality_settings.private_key",render:({field:g})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(v,{children:r("dynamic_form.vless.reality_settings.private_key.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{children:e.jsx(D,{...g,className:"pr-9"})}),e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{try{const k=Dx();d.setValue("reality_settings.private_key",k.privateKey),d.setValue("reality_settings.public_key",k.publicKey),$.success(r("dynamic_form.vless.reality_settings.key_pair.success"))}catch{$.error(r("dynamic_form.vless.reality_settings.key_pair.error"))}},className:"absolute right-0 top-0 h-full px-2 transition-transform duration-150 active:scale-90",children:e.jsx(Ke,{icon:"ion:key-outline",className:"h-4 w-4 transition-transform duration-300 hover:rotate-180"})})}),e.jsx(Da,{children:e.jsx(ce,{children:e.jsx("p",{children:r("dynamic_form.vless.reality_settings.key_pair.generate")})})})]})]})]})})}),e.jsx(j,{control:d.control,name:"reality_settings.public_key",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.vless.reality_settings.public_key.label")}),e.jsx(b,{children:e.jsx(D,{...g})})]})}),e.jsx(j,{control:d.control,name:"reality_settings.short_id",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.vless.reality_settings.short_id.label")}),e.jsxs("div",{className:"relative",children:[e.jsx(b,{children:e.jsx(D,{...g,className:"pr-9",placeholder:r("dynamic_form.vless.reality_settings.short_id.placeholder")})}),e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(G,{type:"button",variant:"ghost",size:"icon",onClick:()=>{const k=Px();d.setValue("reality_settings.short_id",k),$.success(r("dynamic_form.vless.reality_settings.short_id.success"))},className:"absolute right-0 top-0 h-full px-2 transition-transform duration-150 active:scale-90",children:e.jsx(Ke,{icon:"ion:refresh-outline",className:"h-4 w-4 transition-transform duration-300 hover:rotate-180"})})}),e.jsx(Da,{children:e.jsx(ce,{children:e.jsx("p",{children:r("dynamic_form.vless.reality_settings.short_id.generate")})})})]})]}),e.jsx(A,{className:"text-xs text-muted-foreground",children:r("dynamic_form.vless.reality_settings.short_id.description")})]})})]}),e.jsx(j,{control:d.control,name:"network",render:({field:g})=>e.jsxs(f,{children:[e.jsxs(v,{children:[r("dynamic_form.vless.network.label"),e.jsx(xn,{value:d.watch("network_settings"),setValue:k=>d.setValue("network_settings",k),templateType:d.watch("network")})]}),e.jsx(b,{children:e.jsxs(X,{onValueChange:g.onChange,value:g.value,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.vless.network.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.vless.networkOptions.map(k=>e.jsx(q,{value:k.value,className:"cursor-pointer",children:k.label},k.value))})})]})})]})}),e.jsx(j,{control:d.control,name:"flow",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.vless.flow.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:k=>g.onChange(k==="none"?null:k),value:g.value||"none",children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.vless.flow.placeholder")})}),e.jsx(Q,{children:Ee.vless.flowOptions.map(k=>e.jsx(q,{value:k,children:k},k))})]})})]})})]}),tuic:()=>e.jsxs(e.Fragment,{children:[e.jsx(j,{control:d.control,name:"version",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.tuic.version.label")}),e.jsx(b,{children:e.jsxs(X,{value:g.value?.toString(),onValueChange:k=>g.onChange(Number(k)),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.tuic.version.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.tuic.versions.map(k=>e.jsxs(q,{value:k,children:["V",k]},k))})})]})})]})}),e.jsx(j,{control:d.control,name:"congestion_control",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.tuic.congestion_control.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:g.onChange,value:g.value,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.tuic.congestion_control.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.tuic.congestionControls.map(k=>e.jsx(q,{value:k,children:k.toUpperCase()},k))})})]})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"tls.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.tuic.tls.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.tuic.tls.server_name.placeholder"),...g})})]})}),e.jsx(j,{control:d.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.tuic.tls.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:g.value,onCheckedChange:g.onChange})})})]})})]}),e.jsx(j,{control:d.control,name:"alpn",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.tuic.tls.alpn.label")}),e.jsx(b,{children:e.jsx(at,{options:Ee.tuic.alpnOptions,onChange:k=>g.onChange(k.map(W=>W.value)),value:Ee.tuic.alpnOptions.filter(k=>g.value?.includes(k.value)),placeholder:r("dynamic_form.tuic.tls.alpn.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:r("dynamic_form.tuic.tls.alpn.empty")})})})]})}),e.jsx(j,{control:d.control,name:"udp_relay_mode",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.tuic.udp_relay_mode.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:g.onChange,value:g.value,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.tuic.udp_relay_mode.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.tuic.udpRelayModes.map(k=>e.jsx(q,{value:k.value,children:k.label},k.value))})})]})})]})})]}),socks:()=>e.jsx(e.Fragment,{}),naive:()=>e.jsxs(e.Fragment,{children:[e.jsx(j,{control:d.control,name:"tls",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.naive.tls.label")}),e.jsx(b,{children:e.jsxs(X,{value:g.value?.toString(),onValueChange:k=>g.onChange(Number(k)),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.naive.tls.placeholder")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:r("dynamic_form.naive.tls.disabled")}),e.jsx(q,{value:"1",children:r("dynamic_form.naive.tls.enabled")})]})]})})]})}),d.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.naive.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.naive.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(j,{control:d.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.naive.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]}),http:()=>e.jsxs(e.Fragment,{children:[e.jsx(j,{control:d.control,name:"tls",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.http.tls.label")}),e.jsx(b,{children:e.jsxs(X,{value:g.value?.toString(),onValueChange:k=>g.onChange(Number(k)),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.http.tls.placeholder")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:r("dynamic_form.http.tls.disabled")}),e.jsx(q,{value:"1",children:r("dynamic_form.http.tls.enabled")})]})]})})]})}),d.watch("tls")==1&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"tls_settings.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.http.tls_settings.server_name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.http.tls_settings.server_name.placeholder"),...g})})]})}),e.jsx(j,{control:d.control,name:"tls_settings.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.http.tls_settings.allow_insecure")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]}),mieru:()=>e.jsxs(e.Fragment,{children:[e.jsx(j,{control:d.control,name:"transport",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.mieru.transport.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:g.onChange,value:g.value,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.mieru.transport.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.mieru.transportOptions.map(k=>e.jsx(q,{value:k.value,children:k.label},k.value))})})]})})]})}),e.jsx(j,{control:d.control,name:"multiplexing",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.mieru.multiplexing.label")}),e.jsx(b,{children:e.jsxs(X,{onValueChange:g.onChange,value:g.value,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dynamic_form.mieru.multiplexing.placeholder")})}),e.jsx(Q,{children:e.jsx(Ns,{children:Ee.mieru.multiplexingOptions.map(k=>e.jsx(q,{value:k.value,children:k.label},k.value))})})]})})]})})]}),anytls:()=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:d.control,name:"padding_scheme",render:({field:g})=>e.jsxs(f,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(v,{children:r("dynamic_form.anytls.padding_scheme.label","AnyTLS 填充方案")}),e.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:()=>{d.setValue("padding_scheme",Ee.anytls.defaultPaddingScheme),$.success(r("dynamic_form.anytls.padding_scheme.default_success","已设置默认填充方案"))},className:"h-7 px-2",children:r("dynamic_form.anytls.padding_scheme.use_default","使用默认方案")})]}),e.jsx(A,{children:r("dynamic_form.anytls.padding_scheme.description","每行一个填充规则,格式如: stop=8, 0=30-30")}),e.jsx(b,{children:e.jsx("textarea",{className:"flex min-h-[100px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",placeholder:r("dynamic_form.anytls.padding_scheme.placeholder",`例如: stop=8 0=30-30 1=100-400 2=400-500,c,500-1000`),...g,value:Array.isArray(g.value)?g.value.join(` -`):"",onChange:p=>{const R=p.target.value.split(` -`).filter(L=>L.trim()!=="");g.onChange(R)}})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:d.control,name:"tls.server_name",render:({field:g})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:r("dynamic_form.anytls.tls.server_name.label","SNI")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dynamic_form.anytls.tls.server_name.placeholder","服务器名称"),...g})})]})}),e.jsx(v,{control:d.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dynamic_form.anytls.tls.allow_insecure","允许不安全连接")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(y,{children:e.jsx(X,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]})})};return e.jsx(fe,{children:_[s]?.()})};function qx(){const{t:s}=M("server"),n=h.object({start:h.string().min(1,s("form.dynamic_rate.start_time_error")),end:h.string().min(1,s("form.dynamic_rate.end_time_error")),rate:h.string().min(1,s("form.dynamic_rate.multiplier_error")).refine(R=>!isNaN(parseFloat(R))&&isFinite(Number(R)),{message:s("form.dynamic_rate.multiplier_error_numeric")}).refine(R=>parseFloat(R)>=0,{message:s("form.dynamic_rate.multiplier_error_gte_zero")})}),t=h.object({id:h.number().optional().nullable(),specific_key:h.string().optional().nullable(),code:h.string().optional(),show:h.boolean().optional().nullable(),name:h.string().min(1,s("form.name.error")),rate:h.string().min(1,s("form.rate.error")).refine(R=>!isNaN(parseFloat(R))&&isFinite(Number(R)),{message:s("form.rate.error_numeric")}).refine(R=>parseFloat(R)>=0,{message:s("form.rate.error_gte_zero")}),rate_time_enable:h.boolean().default(!1),rate_time_ranges:h.array(n).default([]),tags:h.array(h.string()).default([]),excludes:h.array(h.string()).default([]),ips:h.array(h.string()).default([]),group_ids:h.array(h.string()).default([]),host:h.string().min(1,s("form.host.error")),port:h.string().min(1,s("form.port.error")),server_port:h.string().min(1,s("form.server_port.error")),parent_id:h.string().default("0").nullable(),route_ids:h.array(h.string()).default([]),protocol_settings:h.record(h.any()).default({}).nullable()}),r={id:null,specific_key:null,code:"",show:!1,name:"",rate:"1",rate_time_enable:!1,rate_time_ranges:[],tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null},{isOpen:a,setIsOpen:i,editingServer:l,setEditingServer:d,serverType:x,setServerType:m,refetch:o}=yi(),[c,f]=u.useState([]),[D,S]=u.useState([]),[C,T]=u.useState([]),w=we({resolver:Te(t),defaultValues:r,mode:"onChange"});u.useEffect(()=>{E()},[a]),u.useEffect(()=>{l?.type&&l.type!==x&&m(l.type)},[l,x,m]),u.useEffect(()=>{l?l.type===x&&w.reset({...r,...l}):w.reset({...r,protocol_settings:Oe[x].schema.parse({})})},[l,w,x]);const E=async()=>{if(!a)return;const[R,L,K]=await Promise.all([jt.getList(),qa.getList(),ut.getList()]);f(R.data?.map(Z=>({label:Z.name,value:Z.id.toString()}))||[]),S(L.data?.map(Z=>({label:Z.remarks,value:Z.id.toString()}))||[]),T(K.data||[])},_=u.useMemo(()=>C?.filter(R=>(R.parent_id===0||R.parent_id===null)&&R.type===x&&R.id!==w.watch("id")),[x,C,w]),g=()=>e.jsxs(Hs,{children:[e.jsx(Bs,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ue,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(zs,{align:"start",children:e.jsx(hm,{children:Fs.map(({type:R,label:L})=>e.jsx(Se,{onClick:()=>{m(R),i(!0)},className:"cursor-pointer",children:e.jsx(q,{variant:"outline",className:"text-white",style:{background:vs[R]},children:L})},R))})})]}),p=()=>{i(!1),d(null),w.reset(r)},V=async()=>{const R=w.getValues();(await ut.save({...R,type:x})).data&&(p(),z.success(s("form.success")),o())};return e.jsxs(me,{open:a,onOpenChange:p,children:[g(),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:s(l?"form.edit_node":"form.new_node")}),e.jsx($e,{})]}),e.jsxs(De,{...w,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{control:w.control,name:"name",render:({field:R})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:s("form.name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("form.name.placeholder"),...R})}),e.jsx(P,{})]})}),e.jsx(v,{control:w.control,name:"rate",render:({field:R})=>e.jsxs(j,{className:"flex-[1]",children:[e.jsx(b,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(y,{children:e.jsx(k,{type:"number",min:"0",step:"0.1",...R})})}),e.jsx(P,{})]})})]}),e.jsx(v,{control:w.control,name:"rate_time_enable",render:({field:R})=>e.jsxs(j,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(b,{children:s("form.dynamic_rate.enable_label")}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("form.dynamic_rate.enable_description")})]}),e.jsx(y,{children:e.jsx(X,{checked:R.value,onCheckedChange:R.onChange})})]}),e.jsx(P,{})]})}),w.watch("rate_time_enable")&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(b,{className:"",children:s("form.dynamic_rate.rules_label")}),e.jsxs(F,{type:"button",variant:"outline",size:"sm",onClick:()=>{const R=w.getValues("rate_time_ranges")||[];w.setValue("rate_time_ranges",[...R,{start:"00:00",end:"23:59",rate:"1"}])},children:[e.jsx(Ue,{icon:"ion:add",className:"mr-1 size-4"}),s("form.dynamic_rate.add_rule")]})]}),(w.watch("rate_time_ranges")||[]).map((R,L)=>e.jsxs("div",{className:"space-y-2 rounded border p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:s("form.dynamic_rate.rule_title",{index:L+1})}),e.jsx(F,{type:"button",variant:"ghost",size:"sm",onClick:()=>{const K=w.getValues("rate_time_ranges")||[];K.splice(L,1),w.setValue("rate_time_ranges",[...K])},children:e.jsx(Ue,{icon:"ion:trash-outline",className:"size-4"})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(v,{control:w.control,name:`rate_time_ranges.${L}.start`,render:({field:K})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-xs",children:s("form.dynamic_rate.start_time")}),e.jsx(y,{children:e.jsx(k,{type:"time",...K,className:"text-sm"})}),e.jsx(P,{})]})}),e.jsx(v,{control:w.control,name:`rate_time_ranges.${L}.end`,render:({field:K})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-xs",children:s("form.dynamic_rate.end_time")}),e.jsx(y,{children:e.jsx(k,{type:"time",...K,className:"text-sm"})}),e.jsx(P,{})]})}),e.jsx(v,{control:w.control,name:`rate_time_ranges.${L}.rate`,render:({field:K})=>e.jsxs(j,{children:[e.jsx(b,{className:"text-xs",children:s("form.dynamic_rate.multiplier")}),e.jsx(y,{children:e.jsx(k,{type:"number",min:"0",step:"0.1",...K,className:"text-sm",placeholder:"1.0"})}),e.jsx(P,{})]})})]})]},L)),(w.watch("rate_time_ranges")||[]).length===0&&e.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:s("form.dynamic_rate.no_rules")})]}),e.jsx(v,{control:w.control,name:"code",render:({field:R})=>e.jsxs(j,{children:[e.jsxs(b,{children:[s("form.code.label"),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:s("form.code.optional")})]}),e.jsx(y,{children:e.jsx(k,{placeholder:s("form.code.placeholder"),...R,value:R.value||""})}),e.jsx(P,{})]})}),e.jsx(v,{control:w.control,name:"tags",render:({field:R})=>e.jsxs(j,{children:[e.jsx(b,{children:s("form.tags.label")}),e.jsx(y,{children:e.jsx(Xa,{value:R.value,onChange:R.onChange,placeholder:s("form.tags.placeholder"),className:"w-full"})}),e.jsx(P,{})]})}),e.jsx(v,{control:w.control,name:"group_ids",render:({field:R})=>e.jsxs(j,{children:[e.jsxs(b,{className:"flex items-center justify-between",children:[s("form.groups.label"),e.jsx(Za,{dialogTrigger:e.jsx(F,{variant:"link",children:s("form.groups.add")}),refetch:E})]}),e.jsx(y,{children:e.jsx(nt,{options:c,onChange:L=>R.onChange(L.map(K=>K.value)),value:c?.filter(L=>R.value.includes(L.value)),placeholder:s("form.groups.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:s("form.groups.empty")})})}),e.jsx(P,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:w.control,name:"host",render:({field:R})=>e.jsxs(j,{children:[e.jsx(b,{children:s("form.host.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:s("form.host.placeholder"),...R})}),e.jsx(P,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(v,{control:w.control,name:"port",render:({field:R})=>e.jsxs(j,{className:"flex-1",children:[e.jsxs(b,{className:"flex items-center gap-1.5",children:[s("form.port.label"),e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(Ue,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Ta,{children:e.jsx(de,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:s("form.port.tooltip")})})})]})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(y,{children:e.jsx(k,{placeholder:s("form.port.placeholder"),...R})}),e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(F,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const L=R.value;L&&w.setValue("server_port",L)},children:e.jsx(Ue,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(de,{side:"right",children:e.jsx("p",{children:s("form.port.sync")})})]})})]}),e.jsx(P,{})]})}),e.jsx(v,{control:w.control,name:"server_port",render:({field:R})=>e.jsxs(j,{className:"flex-1",children:[e.jsxs(b,{className:"flex items-center gap-1.5",children:[s("form.server_port.label"),e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(Ue,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Ta,{children:e.jsx(de,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:s("form.server_port.tooltip")})})})]})})]}),e.jsx(y,{children:e.jsx(k,{placeholder:s("form.server_port.placeholder"),...R})}),e.jsx(P,{})]})})]})]}),a&&e.jsx(Ax,{serverType:x,value:w.watch("protocol_settings"),onChange:R=>w.setValue("protocol_settings",R,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(v,{control:w.control,name:"parent_id",render:({field:R})=>e.jsxs(j,{children:[e.jsx(b,{children:s("form.parent.label")}),e.jsxs(J,{onValueChange:R.onChange,value:R.value?.toString()||"0",children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:s("form.parent.placeholder")})})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("form.parent.none")}),_?.map(L=>e.jsx(A,{value:L.id.toString(),className:"cursor-pointer",children:L.name},L.id))]})]}),e.jsx(P,{})]})}),e.jsx(v,{control:w.control,name:"route_ids",render:({field:R})=>e.jsxs(j,{children:[e.jsx(b,{children:s("form.route.label")}),e.jsx(y,{children:e.jsx(nt,{options:D,onChange:L=>R.onChange(L.map(K=>K.value)),value:D?.filter(L=>R.value.includes(L.value)),placeholder:s("form.route.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:s("form.route.empty")})})}),e.jsx(P,{})]})})]}),e.jsxs(Ie,{className:"mt-6 flex flex-col gap-2 sm:flex-row sm:gap-0",children:[e.jsx(F,{type:"button",variant:"outline",onClick:p,className:"w-full sm:w-auto",children:s("form.cancel")}),e.jsx(F,{type:"submit",onClick:V,className:"w-full sm:w-auto",children:s("form.submit")})]})]})]})]})}function _r({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=new Set(s?.getFilterValue());return e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx($a,{className:"mr-2 h-4 w-4"}),n,a?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ee,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:a.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:a.size>2?e.jsxs(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[a.size," selected"]}):t.filter(i=>a.has(i.value)).map(i=>e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),e.jsx(Xe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(it,{children:[e.jsx(vt,{placeholder:n}),e.jsxs(ot,{children:[e.jsx(bt,{children:"No results found."}),e.jsx(ks,{children:t.map(i=>{const l=a.has(i.value);return e.jsxs(rs,{onSelect:()=>{l?a.delete(i.value):a.add(i.value);const d=Array.from(a);s?.setFilterValue(d.length?d:void 0)},className:"cursor-pointer",children:[e.jsx("div",{className:N("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",l?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(pt,{className:N("h-4 w-4")})}),i.icon&&e.jsx(i.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${i.color}`}),e.jsx("span",{children:i.label}),r?.get(i.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(i.value)})]},i.value)})}),a.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{}),e.jsx(ks,{children:e.jsx(rs,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const Hx=[{value:ge.Shadowsocks,label:Fs.find(s=>s.type===ge.Shadowsocks)?.label,color:vs[ge.Shadowsocks]},{value:ge.Vmess,label:Fs.find(s=>s.type===ge.Vmess)?.label,color:vs[ge.Vmess]},{value:ge.Trojan,label:Fs.find(s=>s.type===ge.Trojan)?.label,color:vs[ge.Trojan]},{value:ge.Hysteria,label:Fs.find(s=>s.type===ge.Hysteria)?.label,color:vs[ge.Hysteria]},{value:ge.Vless,label:Fs.find(s=>s.type===ge.Vless)?.label,color:vs[ge.Vless]},{value:ge.Tuic,label:Fs.find(s=>s.type===ge.Tuic)?.label,color:vs[ge.Tuic]},{value:ge.Socks,label:Fs.find(s=>s.type===ge.Socks)?.label,color:vs[ge.Socks]},{value:ge.Naive,label:Fs.find(s=>s.type===ge.Naive)?.label,color:vs[ge.Naive]},{value:ge.Http,label:Fs.find(s=>s.type===ge.Http)?.label,color:vs[ge.Http]},{value:ge.Mieru,label:Fs.find(s=>s.type===ge.Mieru)?.label,color:vs[ge.Mieru]}];function Ux({table:s,saveOrder:n,isSortMode:t,groups:r}){const a=s.getState().columnFilters.length>0,{t:i}=M("server");return e.jsxs("div",{className:"flex items-center justify-between ",children:[e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[!t&&e.jsxs(e.Fragment,{children:[e.jsx(qx,{}),e.jsx(k,{placeholder:i("toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:l=>s.getColumn("name")?.setFilterValue(l.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex gap-x-2",children:[s.getColumn("type")&&e.jsx(_r,{column:s.getColumn("type"),title:i("toolbar.type"),options:Hx}),s.getColumn("group_ids")&&e.jsx(_r,{column:s.getColumn("group_ids"),title:i("columns.groups.title"),options:r.map(l=>({label:l.name,value:l.id.toString()}))})]}),a&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[i("toolbar.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]}),t&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:i("toolbar.sort.tip")})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(F,{variant:t?"default":"outline",onClick:n,size:"sm",children:i(t?"toolbar.sort.save":"toolbar.sort.edit")})})]})}const Ra=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.71 12.71a6 6 0 1 0-7.42 0a10 10 0 0 0-6.22 8.18a1 1 0 0 0 2 .22a8 8 0 0 1 15.9 0a1 1 0 0 0 1 .89h.11a1 1 0 0 0 .88-1.1a10 10 0 0 0-6.25-8.19M12 12a4 4 0 1 1 4-4a4 4 0 0 1-4 4"})}),pa={0:"bg-destructive/80 shadow-sm shadow-destructive/50",1:"bg-yellow-500/80 shadow-sm shadow-yellow-500/50",2:"bg-emerald-500/80 shadow-sm shadow-emerald-500/50"},He=(s,n)=>n>0?Math.round(s/n*100):0,Kx=s=>{const{t:n}=M("server");return[{id:"drag-handle",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.sort")}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(za,{className:"size-4 cursor-move text-muted-foreground transition-colors hover:text-primary","aria-hidden":"true"})}),size:50},{accessorKey:"id",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.nodeId")}),cell:({row:t})=>{const r=t.getValue("id"),a=t.original.code;return e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(q,{variant:"outline",className:N("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:vs[t.original.type]},children:[e.jsx(Pl,{className:"size-3"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"flex items-center gap-0.5",children:a??r}),t.original.parent?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground/30",children:"→"}),e.jsx("span",{children:t.original.parent?.code||t.original.parent?.id})]}):""]})]}),e.jsx(F,{variant:"ghost",size:"icon",className:"size-5 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:text-muted-foreground group-hover/id:opacity-100",onClick:i=>{i.stopPropagation(),Rt(a||r.toString()).then(()=>{z.success(n("common:copy.success"))})},children:e.jsx(ir,{className:"size-3"})})]})}),e.jsxs(de,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[Fs.find(i=>i.type===t.original.type)?.label,t.original.parent?" (子节点)":""]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a?"点击括号内容或复制按钮可复制节点代码":"点击复制按钮可复制节点ID"})]})]})})},size:50,enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.show")}),cell:({row:t})=>{const[r,a]=u.useState(!!t.getValue("show"));return e.jsx(X,{checked:r,onCheckedChange:async i=>{a(i),ut.update({id:t.original.id,type:t.original.type,show:i?1:0}).catch(()=>{a(!i),s()})},style:{backgroundColor:r?vs[t.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(O,{column:t,title:n("columns.node"),tooltip:e.jsxs("div",{className:"grid grid-cols-1 gap-3 p-2",children:[e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:N("h-2.5 w-2.5 rounded-full",pa[0])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.0")})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:N("h-2.5 w-2.5 rounded-full",pa[1])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.1")})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:N("h-2.5 w-2.5 rounded-full",pa[2])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.2")})]})]})})}),cell:({row:t})=>e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:N("size-2.5 flex-shrink-0 rounded-full transition-all duration-200",pa[t.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:t.getValue("name")})]})}),e.jsx(de,{children:e.jsxs("div",{className:" space-y-3",children:[e.jsx("p",{className:"font-medium",children:n(`columns.status.${t.original.available_status}`)}),t.original.load_status&&e.jsxs("div",{className:"border-t border-border/50 pt-3",children:[e.jsx("p",{className:"mb-3 text-sm font-medium",children:n("columns.loadStatus.details")}),e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsx("div",{children:e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[n("columns.loadStatus.cpu"),":"]}),e.jsxs("div",{className:"ml-2 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:N("h-full transition-all duration-300",t.original.load_status.cpu>=90?"bg-destructive":t.original.load_status.cpu>=70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${Math.min(100,t.original.load_status.cpu)}%`}})}),e.jsxs("span",{className:N("min-w-[3rem] text-right font-semibold",t.original.load_status.cpu>=90?"text-destructive":t.original.load_status.cpu>=70?"text-yellow-600":"text-emerald-600"),children:[Math.round(t.original.load_status.cpu),"%"]})]})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[n("columns.loadStatus.memory"),":"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:N("h-full transition-all duration-300",He(t.original.load_status.mem.used,t.original.load_status.mem.total)>=90?"bg-destructive":He(t.original.load_status.mem.used,t.original.load_status.mem.total)>=70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${He(t.original.load_status.mem.used,t.original.load_status.mem.total)}%`}})}),e.jsxs("span",{className:N("min-w-[3rem] text-right font-semibold",He(t.original.load_status.mem.used,t.original.load_status.mem.total)>=90?"text-destructive":He(t.original.load_status.mem.used,t.original.load_status.mem.total)>=70?"text-yellow-600":"text-emerald-600"),children:[He(t.original.load_status.mem.used,t.original.load_status.mem.total),"%"]})]})]}),e.jsxs("div",{className:"ml-auto w-[9.5rem] text-right text-xs text-muted-foreground",children:[ze(t.original.load_status.mem.used)," ","/"," ",ze(t.original.load_status.mem.total)]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[n("columns.loadStatus.swap"),":"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:N("h-full transition-all duration-300",He(t.original.load_status.swap.used,t.original.load_status.swap.total)>=80?"bg-destructive":He(t.original.load_status.swap.used,t.original.load_status.swap.total)>=50?"bg-yellow-500":"bg-emerald-500"),style:{width:`${He(t.original.load_status.swap.used,t.original.load_status.swap.total)}%`}})}),e.jsxs("span",{className:N("min-w-[3rem] text-right font-semibold",He(t.original.load_status.swap.used,t.original.load_status.swap.total)>=80?"text-destructive":He(t.original.load_status.swap.used,t.original.load_status.swap.total)>=50?"text-yellow-600":"text-emerald-600"),children:[He(t.original.load_status.swap.used,t.original.load_status.swap.total),"%"]})]})]}),e.jsxs("div",{className:"ml-auto w-[9.5rem] text-right text-xs text-muted-foreground",children:[ze(t.original.load_status.swap.used)," ","/"," ",ze(t.original.load_status.swap.total)]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[n("columns.loadStatus.disk"),":"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:N("h-full transition-all duration-300",He(t.original.load_status.disk.used,t.original.load_status.disk.total)>=90?"bg-destructive":He(t.original.load_status.disk.used,t.original.load_status.disk.total)>=70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${He(t.original.load_status.disk.used,t.original.load_status.disk.total)}%`}})}),e.jsxs("span",{className:N("min-w-[3rem] text-right font-semibold",He(t.original.load_status.disk.used,t.original.load_status.disk.total)>=90?"text-destructive":He(t.original.load_status.disk.used,t.original.load_status.disk.total)>=70?"text-yellow-600":"text-emerald-600"),children:[He(t.original.load_status.disk.used,t.original.load_status.disk.total),"%"]})]})]}),e.jsxs("div",{className:"ml-auto w-[9.5rem] text-right text-xs text-muted-foreground",children:[ze(t.original.load_status.disk.used)," ","/"," ",ze(t.original.load_status.disk.total)]})]})]})]})]})})]})}),enableSorting:!1,size:200},{accessorKey:"host",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.address")}),cell:({row:t})=>{const r=`${t.original.host}:${t.original.port}`,a=t.original.port!==t.original.server_port;return e.jsxs("div",{className:"group relative flex min-w-0 items-start",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-1 gap-y-0.5 pr-7",children:[e.jsx("div",{className:"flex items-center ",children:e.jsxs("span",{className:"font-mono text-sm font-medium text-foreground/90",children:[t.original.host,":",t.original.port]})}),a&&e.jsxs("span",{className:"whitespace-nowrap text-[0.7rem] tracking-tight text-muted-foreground/40",children:["(",n("columns.internalPort")," ",t.original.server_port,")"]})]}),e.jsx("div",{className:"absolute right-0 top-0",children:e.jsx(fe,{delayDuration:0,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(F,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:bg-muted/50 hover:text-muted-foreground group-hover:opacity-100",onClick:i=>{i.stopPropagation(),Rt(r).then(()=>{z.success(n("common:copy.success"))})},children:e.jsx(ir,{className:"size-3"})})}),e.jsx(de,{side:"top",sideOffset:10,children:n("columns.copyAddress")})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.onlineUsers.title"),tooltip:n("columns.onlineUsers.tooltip")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Ra,{className:"size-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("online")})]}),size:80,enableSorting:!0,enableHiding:!0},{accessorKey:"rate",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.rate.title"),tooltip:n("columns.rate.tooltip")}),cell:({row:t})=>e.jsxs(q,{variant:"secondary",className:"font-medium",children:[t.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"group_ids",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.groups.title"),tooltip:n("columns.groups.tooltip")}),cell:({row:t})=>{const r=t.original.groups||[];return e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[r.map((a,i)=>e.jsx(q,{variant:"secondary",className:N("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5"),children:a.name},i)),r.length===0&&e.jsx("span",{className:"text-sm text-muted-foreground",children:n("columns.groups.empty")})]})},enableSorting:!1,filterFn:(t,r,a)=>{const i=t.getValue(r);return i?a.some(l=>i.includes(l)):!1}},{accessorKey:"type",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.type")}),cell:({row:t})=>{const r=t.getValue("type");return e.jsx(q,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:vs[r]},children:r})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:t})=>e.jsx(O,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>{const{setIsOpen:r,setEditingServer:a,setServerType:i}=yi();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(Hs,{modal:!1,children:[e.jsx(Bs,{asChild:!0,children:e.jsx(F,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":n("columns.actions"),children:e.jsx(Da,{className:"size-4"})})}),e.jsxs(zs,{align:"end",className:"w-40",children:[e.jsx(Se,{className:"cursor-pointer",onClick:()=>{i(t.original.type),a(t.original),r(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(pd,{className:"mr-2 size-4"}),n("columns.actions_dropdown.edit")]})}),e.jsxs(Se,{className:"cursor-pointer",onClick:async()=>{ut.copy({id:t.original.id}).then(({data:l})=>{l&&(z.success(n("columns.actions_dropdown.copy_success")),s())})},children:[e.jsx(Mn,{className:"mr-2 size-4"}),n("columns.actions_dropdown.copy")]}),e.jsx(at,{}),e.jsx(Se,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:l=>l.preventDefault(),children:e.jsx(_s,{title:n("columns.actions_dropdown.delete.title"),description:n("columns.actions_dropdown.delete.description"),confirmText:n("columns.actions_dropdown.delete.confirm"),variant:"destructive",onConfirm:async()=>{ut.drop({id:t.original.id}).then(({data:l})=>{l&&(z.success(n("columns.actions_dropdown.delete_success")),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(us,{className:"mr-2 size-4"}),n("columns.actions_dropdown.delete.confirm")]})})})]})]})})},size:50}]};function Bx(){const[s,n]=u.useState({}),[t,r]=u.useState({"drag-handle":!1}),[a,i]=u.useState([]),[l,d]=u.useState({pageSize:500,pageIndex:0}),[x,m]=u.useState([]),[o,c]=u.useState(!1),[f,D]=u.useState({}),[S,C]=u.useState([]),{refetch:T}=re({queryKey:["nodeList"],queryFn:async()=>{const{data:V}=await ut.getList();return C(V),V}}),{data:w}=re({queryKey:["groups"],queryFn:async()=>{const{data:V}=await jt.getList();return V}});u.useEffect(()=>{r({"drag-handle":o,show:!o,host:!o,online:!o,rate:!o,groups:!o,type:!1,actions:!o}),D({name:o?2e3:200}),d({pageSize:o?99999:500,pageIndex:0})},[o]);const E=(V,R)=>{o&&(V.dataTransfer.setData("text/plain",R.toString()),V.currentTarget.classList.add("opacity-50"))},_=(V,R)=>{if(!o)return;V.preventDefault(),V.currentTarget.classList.remove("bg-muted");const L=parseInt(V.dataTransfer.getData("text/plain"));if(L===R)return;const K=[...S],[Z]=K.splice(L,1);K.splice(R,0,Z),C(K)},g=async()=>{if(!o){c(!0);return}const V=S?.map((R,L)=>({id:R.id,order:L+1}));ut.sort(V).then(()=>{z.success("排序保存成功"),c(!1),T()}).finally(()=>{c(!1)})},p=Be({data:S||[],columns:Kx(T),state:{sorting:x,columnVisibility:t,rowSelection:s,columnFilters:a,columnSizing:f,pagination:l},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:m,onColumnFiltersChange:i,onColumnVisibilityChange:r,onColumnSizingChange:D,onPaginationChange:d,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Nx,{refetch:T,children:e.jsx("div",{className:"space-y-4",children:e.jsx(ts,{table:p,toolbar:V=>e.jsx(Ux,{table:V,refetch:T,saveOrder:g,isSortMode:o,groups:w||[]}),draggable:o,onDragStart:E,onDragEnd:V=>V.currentTarget.classList.remove("opacity-50"),onDragOver:V=>{V.preventDefault(),V.currentTarget.classList.add("bg-muted")},onDragLeave:V=>V.currentTarget.classList.remove("bg-muted"),onDrop:_,showPagination:!o})})})}function Gx(){const{t:s}=M("server");return e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("manage.title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("manage.description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Bx,{})})]})]})}const Wx=Object.freeze(Object.defineProperty({__proto__:null,default:Gx},Symbol.toStringTag,{value:"Module"}));function Yx({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=M("group");return e.jsx("div",{className:"flex items-center justify-between space-x-4",children:e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(Za,{refetch:n}),e.jsx(k,{placeholder:r("toolbar.searchPlaceholder"),value:s.getColumn("name")?.getFilterValue()??"",onChange:a=>s.getColumn("name")?.setFilterValue(a.target.value),className:N("h-8 w-[150px] lg:w-[250px]",t&&"border-primary/50 ring-primary/20")}),t&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("toolbar.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]})})}const Jx=s=>{const{t:n}=M("group");return[{accessorKey:"id",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.id")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(q,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.name")}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium",children:t.getValue("name")})})},{accessorKey:"users_count",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.usersCount")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"server_count",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.serverCount")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Pl,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("server_count")})]}),enableSorting:!0,size:8e3},{id:"actions",header:({column:t})=>e.jsx(O,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Za,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(rt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(_s,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{jt.drop({id:t.original.id}).then(({data:r})=>{r&&(z.success(n("messages.updateSuccess")),s())})},children:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(us,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("messages.deleteButton")})]})})]})}]};function Qx(){const[s,n]=u.useState({}),[t,r]=u.useState({}),[a,i]=u.useState([]),[l,d]=u.useState([]),{data:x,refetch:m,isLoading:o}=re({queryKey:["serverGroupList"],queryFn:async()=>{const{data:f}=await jt.getList();return f}}),c=Be({data:x||[],columns:Jx(m),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:i,onColumnVisibilityChange:r,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ts,{table:c,toolbar:f=>e.jsx(Yx,{table:f,refetch:m}),isLoading:o})}function Xx(){const{t:s}=M("group");return e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Qx,{})})]})]})}const Zx=Object.freeze(Object.defineProperty({__proto__:null,default:Xx},Symbol.toStringTag,{value:"Module"})),eh=s=>h.object({remarks:h.string().min(1,s("form.validation.remarks")),match:h.array(h.string()),action:h.enum(["block","dns"]),action_value:h.string().optional()});function _i({refetch:s,dialogTrigger:n,defaultValues:t={remarks:"",match:[],action:"block",action_value:""},type:r="create"}){const{t:a}=M("route"),i=we({resolver:Te(eh(a)),defaultValues:t,mode:"onChange"}),[l,d]=u.useState(!1);return e.jsxs(me,{open:l,onOpenChange:d,children:[e.jsx(ps,{asChild:!0,children:n||e.jsxs(F,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ue,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add")})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:a(r==="edit"?"form.edit":"form.create")}),e.jsx($e,{})]}),e.jsxs(De,{...i,children:[e.jsx(v,{control:i.control,name:"remarks",render:({field:x})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:a("form.remarks")}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsx(k,{type:"text",placeholder:a("form.remarksPlaceholder"),...x})})}),e.jsx(P,{})]})}),e.jsx(v,{control:i.control,name:"match",render:({field:x})=>e.jsxs(j,{className:"flex-[2]",children:[e.jsx(b,{children:a("form.match")}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsx(Es,{className:"min-h-[120px]",placeholder:a("form.matchPlaceholder"),value:Array.isArray(x.value)?x.value.join(` -`):"",onChange:m=>{const o=m.target.value.split(` -`);x.onChange(o)}})})}),e.jsx(P,{})]})}),e.jsx(v,{control:i.control,name:"action",render:({field:x})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsxs(J,{onValueChange:x.onChange,defaultValue:x.value,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("form.actionPlaceholder")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"block",children:a("actions.block")}),e.jsx(A,{value:"dns",children:a("actions.dns")})]})]})})}),e.jsx(P,{})]})}),i.watch("action")==="dns"&&e.jsx(v,{control:i.control,name:"action_value",render:({field:x})=>e.jsxs(j,{children:[e.jsx(b,{children:a("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(y,{children:e.jsx(k,{type:"text",placeholder:a("form.dnsPlaceholder"),...x})})})]})}),e.jsxs(Ie,{children:[e.jsx(et,{asChild:!0,children:e.jsx(F,{variant:"outline",children:a("form.cancel")})}),e.jsx(F,{type:"submit",onClick:()=>{const x=i.getValues(),m={...x,match:Array.isArray(x.match)?x.match.filter(o=>o.trim()!==""):[]};qa.save(m).then(({data:o})=>{o&&(d(!1),s&&s(),z.success(a(r==="edit"?"messages.updateSuccess":"messages.createSuccess")),i.reset())})},children:a("form.submit")})]})]})]})]})}function sh({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=M("route");return e.jsx("div",{className:"flex items-center justify-between ",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[e.jsx(_i,{refetch:n}),e.jsx(k,{placeholder:r("toolbar.searchPlaceholder"),value:s.getColumn("remarks")?.getFilterValue()??"",onChange:a=>s.getColumn("remarks")?.setFilterValue(a.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),t&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("toolbar.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]})})}function th({columns:s,data:n,refetch:t}){const[r,a]=u.useState({}),[i,l]=u.useState({}),[d,x]=u.useState([]),[m,o]=u.useState([]),c=Be({data:n,columns:s,state:{sorting:m,columnVisibility:i,rowSelection:r,columnFilters:d},enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:o,onColumnFiltersChange:x,onColumnVisibilityChange:l,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ts,{table:c,toolbar:f=>e.jsx(sh,{table:f,refetch:t})})}const ah=s=>{const{t:n}=M("route"),t={block:{icon:fd,variant:"destructive",className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800"},dns:{icon:jd,variant:"secondary",className:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800"}};return[{accessorKey:"id",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.id")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(q,{variant:"outline",children:r.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.remarks")}),cell:({row:r})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:r.original.remarks})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action_value",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.action_value.title")}),cell:({row:r})=>{const a=r.original.action,i=r.original.action_value,l=r.original.match?.length||0;return e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("span",{className:"text-sm font-medium",children:a==="dns"&&i?n("columns.action_value.dns",{value:i}):a==="block"?e.jsx("span",{className:"text-destructive",children:n("columns.action_value.block")}):n("columns.action_value.direct")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("columns.matchRules",{count:l})})]})},enableHiding:!1,enableSorting:!1,size:300},{accessorKey:"action",header:({column:r})=>e.jsx(O,{column:r,title:n("columns.action")}),cell:({row:r})=>{const a=r.getValue("action"),i=t[a]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(q,{variant:t[a]?.variant||"default",className:N("flex items-center gap-1.5 px-3 py-1 capitalize",t[a]?.className),children:[i&&e.jsx(i,{className:"h-3.5 w-3.5"}),n(`actions.${a}`)]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:n("columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(_i,{defaultValues:r.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(rt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(_s,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{qa.drop({id:r.original.id}).then(({data:a})=>{a&&(z.success(n("messages.deleteSuccess")),s())})},children:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(us,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("messages.deleteButton")})]})})]})}]};function nh(){const{t:s}=M("route"),[n,t]=u.useState([]);function r(){qa.getList().then(({data:a})=>{t(a)})}return u.useEffect(()=>{r()},[]),e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(th,{data:n,columns:ah(r),refetch:r})})]})]})}const rh=Object.freeze(Object.defineProperty({__proto__:null,default:nh},Symbol.toStringTag,{value:"Module"})),Ni=u.createContext(void 0);function lh({children:s,refreshData:n}){const[t,r]=u.useState(!1),[a,i]=u.useState(null);return e.jsx(Ni.Provider,{value:{isOpen:t,setIsOpen:r,editingPlan:a,setEditingPlan:i,refreshData:n},children:s})}function Kn(){const s=u.useContext(Ni);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function ih({table:s,saveOrder:n,isSortMode:t}){const{setIsOpen:r}=Kn(),{t:a}=M("subscribe");return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsxs(F,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>r(!0),children:[e.jsx(Ue,{icon:"ion:add"}),e.jsx("div",{children:a("plan.add")})]}),e.jsx(k,{placeholder:a("plan.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:i=>s.getColumn("name")?.setFilterValue(i.target.value),className:"h-8 w-[150px] lg:w-[250px]"})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(F,{variant:t?"default":"outline",onClick:n,size:"sm",children:a(t?"plan.sort.save":"plan.sort.edit")})})]})}const Nr={monthly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},quarterly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},half_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},two_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},three_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},onetime:{color:"text-slate-700",bgColor:"bg-slate-100/80"},reset_traffic:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},oh=s=>{const{t:n}=M("subscribe");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx(za,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(O,{column:t,title:n("plan.columns.id")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(q,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:t})=>e.jsx(O,{column:t,title:n("plan.columns.show")}),cell:({row:t})=>e.jsx(X,{defaultChecked:t.getValue("show"),onCheckedChange:r=>{ys.update({id:t.original.id,show:r}).then(({data:a})=>{!a&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:t})=>e.jsx(O,{column:t,title:n("plan.columns.sell")}),cell:({row:t})=>e.jsx(X,{defaultChecked:t.getValue("sell"),onCheckedChange:r=>{ys.update({id:t.original.id,sell:r}).then(({data:a})=>{!a&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:t})=>e.jsx(O,{column:t,title:n("plan.columns.renew"),tooltip:n("plan.columns.renew_tooltip")}),cell:({row:t})=>e.jsx(X,{defaultChecked:t.getValue("renew"),onCheckedChange:r=>{ys.update({id:t.original.id,renew:r}).then(({data:a})=>{!a&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:t})=>e.jsx(O,{column:t,title:n("plan.columns.name")}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:t.getValue("name")})}),enableSorting:!1,enableHiding:!1,size:900},{accessorKey:"users_count",header:({column:t})=>e.jsx(O,{column:t,title:n("plan.columns.stats")}),cell:({row:t})=>{const r=t.getValue("users_count")||0,a=t.original.active_users_count||0,i=r>0?Math.round(a/r*100):0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 rounded-md bg-slate-50 px-2 py-1 hover:bg-slate-100 transition-colors cursor-help",children:[e.jsx(wa,{className:"h-3.5 w-3.5 text-slate-500"}),e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r})]})}),e.jsx(de,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"总用户数"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"所有使用该套餐的用户(包括已过期)"})]})})]})}),e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 rounded-md bg-green-50 px-2 py-1 hover:bg-green-100 transition-colors cursor-help",children:[e.jsx(vd,{className:"h-3.5 w-3.5 text-green-600"}),e.jsx("span",{className:"text-sm font-medium text-green-700",children:a})]})}),e.jsx(de,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"有效期内用户"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"当前仍在有效期内的活跃用户"}),r>0&&e.jsxs("p",{className:"text-xs font-medium text-green-600",children:["活跃率:",i,"%"]})]})})]})})]})},enableSorting:!0,size:120},{accessorKey:"group",header:({column:t})=>e.jsx(O,{column:t,title:n("plan.columns.group")}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[600px] flex-wrap items-center gap-1.5 text-nowrap",children:e.jsx(q,{variant:"secondary",className:N("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5"),children:t.getValue("group")?.name})}),enableSorting:!1,enableHiding:!1},{accessorKey:"prices",header:({column:t})=>e.jsx(O,{column:t,title:n("plan.columns.price")}),cell:({row:t})=>{const r=t.getValue("prices"),a=[{period:n("plan.columns.price_period.monthly"),key:"monthly",unit:n("plan.columns.price_period.unit.month")},{period:n("plan.columns.price_period.quarterly"),key:"quarterly",unit:n("plan.columns.price_period.unit.quarter")},{period:n("plan.columns.price_period.half_yearly"),key:"half_yearly",unit:n("plan.columns.price_period.unit.half_year")},{period:n("plan.columns.price_period.yearly"),key:"yearly",unit:n("plan.columns.price_period.unit.year")},{period:n("plan.columns.price_period.two_yearly"),key:"two_yearly",unit:n("plan.columns.price_period.unit.two_year")},{period:n("plan.columns.price_period.three_yearly"),key:"three_yearly",unit:n("plan.columns.price_period.unit.three_year")},{period:n("plan.columns.price_period.onetime"),key:"onetime",unit:""},{period:n("plan.columns.price_period.reset_traffic"),key:"reset_traffic",unit:n("plan.columns.price_period.unit.times")}];return e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:a.map(({period:i,key:l,unit:d})=>r[l]!=null&&e.jsxs(q,{variant:"secondary",className:N("px-2 py-0.5 font-medium transition-colors text-nowrap",Nr[l].color,Nr[l].bgColor,"border border-border/50","hover:bg-slate-200/80"),children:[i," ¥",r[l],d]},l))})},enableSorting:!1,size:9e3},{id:"actions",header:({column:t})=>e.jsx(O,{className:"justify-end",column:t,title:n("plan.columns.actions")}),cell:({row:t})=>{const{setIsOpen:r,setEditingPlan:a}=Kn();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{a(t.original),r(!0)},children:[e.jsx(rt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("plan.columns.edit")})]}),e.jsx(_s,{title:n("plan.columns.delete_confirm.title"),description:n("plan.columns.delete_confirm.description"),confirmText:n("plan.columns.delete"),variant:"destructive",onConfirm:async()=>{ys.drop({id:t.original.id}).then(({data:i})=>{i&&(z.success(n("plan.columns.delete_confirm.success")),s())})},children:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(us,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("plan.columns.delete")})]})})]})}}]},ch=h.object({id:h.number().nullable(),group_id:h.union([h.number(),h.string()]).nullable().optional(),name:h.string().min(1).max(250),tags:h.array(h.string()).nullable().optional(),content:h.string().nullable().optional(),transfer_enable:h.union([h.number().min(0),h.string().min(1)]),prices:h.object({monthly:h.union([h.number(),h.string()]).nullable().optional(),quarterly:h.union([h.number(),h.string()]).nullable().optional(),half_yearly:h.union([h.number(),h.string()]).nullable().optional(),yearly:h.union([h.number(),h.string()]).nullable().optional(),two_yearly:h.union([h.number(),h.string()]).nullable().optional(),three_yearly:h.union([h.number(),h.string()]).nullable().optional(),onetime:h.union([h.number(),h.string()]).nullable().optional(),reset_traffic:h.union([h.number(),h.string()]).nullable().optional()}).default({}),speed_limit:h.union([h.number(),h.string()]).nullable().optional(),capacity_limit:h.union([h.number(),h.string()]).nullable().optional(),device_limit:h.union([h.number(),h.string()]).nullable().optional(),force_update:h.boolean().optional(),reset_traffic_method:h.number().nullable(),users_count:h.number().optional(),active_users_count:h.number().optional()}),Bn=u.forwardRef(({className:s,...n},t)=>e.jsx(Ll,{ref:t,className:N("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",s),...n,children:e.jsx(bd,{className:N("flex items-center justify-center text-current"),children:e.jsx(pt,{className:"h-4 w-4"})})}));Bn.displayName=Ll.displayName;const fa={id:null,group_id:null,name:"",tags:[],content:"",transfer_enable:"",prices:{monthly:"",quarterly:"",half_yearly:"",yearly:"",two_yearly:"",three_yearly:"",onetime:"",reset_traffic:""},speed_limit:"",capacity_limit:"",device_limit:"",force_update:!1,reset_traffic_method:null},ja={monthly:{label:"月付",months:1,discount:1},quarterly:{label:"季付",months:3,discount:.95},half_yearly:{label:"半年付",months:6,discount:.9},yearly:{label:"年付",months:12,discount:.85},two_yearly:{label:"两年付",months:24,discount:.8},three_yearly:{label:"三年付",months:36,discount:.75},onetime:{label:"流量包",months:1,discount:1},reset_traffic:{label:"重置包",months:1,discount:1}},dh=[{value:null,label:"follow_system"},{value:0,label:"monthly_first"},{value:1,label:"monthly_reset"},{value:2,label:"no_reset"},{value:3,label:"yearly_first"},{value:4,label:"yearly_reset"}];function mh(){const{isOpen:s,setIsOpen:n,editingPlan:t,setEditingPlan:r,refreshData:a}=Kn(),[i,l]=u.useState(!1),{t:d}=M("subscribe"),x=we({resolver:Te(ch),defaultValues:{...fa,...t||{}},mode:"onChange"});u.useEffect(()=>{t?x.reset({...fa,...t}):x.reset(fa)},[t,x]);const m=new Vn({html:!0}),[o,c]=u.useState();async function f(){jt.getList().then(({data:w})=>{c(w)})}u.useEffect(()=>{s&&f()},[s]);const D=async w=>{l(!0),ys.save(w).then(({data:E})=>{E&&(z.success(d(t?"plan.form.submit.success.update":"plan.form.submit.success.add")),T(),a())}).finally(()=>{l(!1)})},S=w=>{const E=Object.values(w).map(_=>_?.message).filter(Boolean);z.error(E.join(` -`)||d("plan.form.submit.error.validation","表单校验失败"))},C=w=>{if(isNaN(w))return;const E=Object.entries(ja).reduce((_,[g,p])=>{const V=w*p.months*p.discount;return{..._,[g]:V.toFixed(2)}},{});x.setValue("prices",E,{shouldDirty:!0})},T=()=>{n(!1),r(null),x.reset(fa)};return e.jsx(me,{open:s,onOpenChange:T,children:e.jsxs(ce,{children:[e.jsxs(pe,{children:[e.jsx(ue,{children:d(t?"plan.form.edit_title":"plan.form.add_title")}),e.jsx($e,{})]}),e.jsx(De,{...x,children:e.jsxs("form",{onSubmit:x.handleSubmit(D,S),children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{control:x.control,name:"name",render:({field:w})=>e.jsxs(j,{children:[e.jsx(b,{children:d("plan.form.name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:d("plan.form.name.placeholder"),...w})}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"tags",render:({field:w})=>e.jsxs(j,{children:[e.jsx(b,{children:d("plan.form.tags.label","标签")}),e.jsx(y,{children:e.jsx(Xa,{value:w.value||[],onChange:w.onChange,placeholder:d("plan.form.tags.placeholder","输入标签后按回车确认"),className:"w-full"})}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"group_id",render:({field:w})=>e.jsxs(j,{children:[e.jsxs(b,{className:"flex items-center justify-between",children:[d("plan.form.group.label"),e.jsx(Za,{dialogTrigger:e.jsx(F,{variant:"link",children:d("plan.form.group.add")}),refetch:f})]}),e.jsxs(J,{value:w.value?.toString()??"",onValueChange:E=>w.onChange(E?Number(E):null),children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:d("plan.form.group.placeholder")})})}),e.jsx(Y,{children:o?.map(E=>e.jsx(A,{value:E.id.toString(),children:E.name},E.id))})]}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"transfer_enable",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:d("plan.form.transfer.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(k,{type:"number",min:0,placeholder:d("plan.form.transfer.placeholder"),className:"rounded-r-none",...w})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.transfer.unit")})]}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"speed_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:d("plan.form.speed.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(k,{type:"number",min:0,placeholder:d("plan.form.speed.placeholder"),className:"rounded-r-none",...w,value:w.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.speed.unit")})]}),e.jsx(P,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center",children:[e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"}),e.jsx("h3",{className:"mx-4 text-sm font-medium text-gray-500 dark:text-gray-400",children:d("plan.form.price.title")}),e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(k,{type:"number",step:"0.01",placeholder:d("plan.form.price.base_price"),className:"h-7 w-32 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500",onChange:w=>{const E=parseFloat(w.target.value);C(E)}})]}),e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(F,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const w=Object.keys(ja).reduce((E,_)=>({...E,[_]:""}),{});x.setValue("prices",w,{shouldDirty:!0})},children:d("plan.form.price.clear.button")})}),e.jsx(de,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:d("plan.form.price.clear.tooltip")})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(ja).filter(([w])=>!["onetime","reset_traffic"].includes(w)).map(([w,E])=>e.jsx("div",{className:"group relative rounded-md bg-card p-2 ring-1 ring-gray-200 transition-all hover:ring-primary dark:ring-gray-800",children:e.jsx(v,{control:x.control,name:`prices.${w}`,render:({field:_})=>e.jsxs(j,{children:[e.jsxs(b,{className:"text-xs font-medium text-muted-foreground",children:[d(`plan.columns.price_period.${w}`),e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",E.months===1?d("plan.form.price.period.monthly"):d("plan.form.price.period.months",{count:E.months}),")"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:"0.00",min:0,step:"0.01",..._,value:_.value??"",onChange:g=>_.onChange(g.target.value),className:"h-7 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500"})})]})]})})},w))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(ja).filter(([w])=>["onetime","reset_traffic"].includes(w)).map(([w,E])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(v,{control:x.control,name:`prices.${w}`,render:({field:_})=>e.jsx(j,{children:e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsx(b,{className:"text-xs font-medium",children:d(`plan.columns.price_period.${w}`)}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:d(w==="onetime"?"plan.form.price.onetime_desc":"plan.form.price.reset_desc")})]}),e.jsxs("div",{className:"relative w-full md:w-32",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:"0.00",min:0,step:"0.01",..._,value:_.value??"",className:"h-7 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500"})})]})]})})})},w))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(v,{control:x.control,name:"device_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:d("plan.form.device.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(k,{type:"number",min:0,placeholder:d("plan.form.device.placeholder"),className:"rounded-r-none",...w,value:w.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.device.unit")})]}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"capacity_limit",render:({field:w})=>e.jsxs(j,{className:"flex-1",children:[e.jsx(b,{children:d("plan.form.capacity.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(y,{children:e.jsx(k,{type:"number",min:0,placeholder:d("plan.form.capacity.placeholder"),className:"rounded-r-none",...w,value:w.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.capacity.unit")})]}),e.jsx(P,{})]})})]}),e.jsx(v,{control:x.control,name:"reset_traffic_method",render:({field:w})=>e.jsxs(j,{children:[e.jsx(b,{children:d("plan.form.reset_method.label")}),e.jsxs(J,{value:w.value?.toString()??"null",onValueChange:E=>w.onChange(E=="null"?null:Number(E)),children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:d("plan.form.reset_method.placeholder")})})}),e.jsx(Y,{children:dh.map(E=>e.jsx(A,{value:E.value?.toString()??"null",children:d(`plan.form.reset_method.options.${E.label}`)},E.value))})]}),e.jsx($,{className:"text-xs",children:d("plan.form.reset_method.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"content",render:({field:w})=>{const[E,_]=u.useState(!1);return e.jsxs(j,{className:"space-y-2",children:[e.jsxs(b,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[d("plan.form.content.label"),e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(F,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",type:"button",onClick:()=>_(!E),children:E?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{d:"M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"}),e.jsx("path",{fillRule:"evenodd",d:"M.664 10.59a1.651 1.651 0 010-1.186A10.004 10.004 0 0110 3c4.257 0 7.893 2.66 9.336 6.41.147.381.146.804 0 1.186A10.004 10.004 0 0110 17c-4.257 0-7.893-2.66-9.336-6.41zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{fillRule:"evenodd",d:"M3.28 2.22a.75.75 0 00-1.06 1.06l14.5 14.5a.75.75 0 101.06-1.06l-1.745-1.745a10.029 10.029 0 003.3-4.38 1.651 1.651 0 000-1.185A10.004 10.004 0 009.999 3a9.956 9.956 0 00-4.744 1.194L3.28 2.22zM7.752 6.69l1.092 1.092a2.5 2.5 0 013.374 3.373l1.091 1.092a4 4 0 00-5.557-5.557z",clipRule:"evenodd"}),e.jsx("path",{d:"M10.748 13.93l2.523 2.523a9.987 9.987 0 01-3.27.547c-4.258 0-7.894-2.66-9.337-6.41a1.651 1.651 0 010-1.186A10.007 10.007 0 012.839 6.02L6.07 9.252a4 4 0 004.678 4.678z"})]})})}),e.jsx(de,{side:"top",children:e.jsx("p",{className:"text-xs",children:d(E?"plan.form.content.preview_button.hide":"plan.form.content.preview_button.show")})})]})})]}),e.jsx(fe,{children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx(F,{variant:"outline",size:"sm",type:"button",onClick:()=>{w.onChange(d("plan.form.content.template.content"))},children:d("plan.form.content.template.button")})}),e.jsx(de,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:d("plan.form.content.template.tooltip")})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${E?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"}`,children:[e.jsx("div",{className:"space-y-2",children:e.jsx(y,{children:e.jsx(In,{style:{height:"400px"},value:w.value||"",renderHTML:g=>m.render(g),onChange:({text:g})=>w.onChange(g),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:d("plan.form.content.placeholder"),className:"rounded-md border"})})}),E&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:d("plan.form.content.preview")}),e.jsx("div",{className:"prose prose-sm dark:prose-invert h-[400px] max-w-none overflow-y-auto rounded-md border p-4",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:m.render(w.value||"")}})})]})]}),e.jsx($,{className:"text-xs",children:d("plan.form.content.description")}),e.jsx(P,{})]})}})]}),e.jsx(Ie,{className:"mt-6",children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("div",{className:"flex-shrink-0",children:t&&e.jsx(v,{control:x.control,name:"force_update",render:({field:w})=>e.jsxs(j,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(y,{children:e.jsx(Bn,{checked:w.value,onCheckedChange:w.onChange})}),e.jsx("div",{className:"",children:e.jsx(b,{className:"text-sm",children:d("plan.form.force_update.label")})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(F,{type:"button",variant:"outline",onClick:T,children:d("plan.form.submit.cancel")}),e.jsx(F,{type:"submit",disabled:i,children:d(i?"plan.form.submit.submitting":"plan.form.submit.submit")})]})]})})]})})]})})}function uh(){const[s,n]=u.useState({}),[t,r]=u.useState({"drag-handle":!1}),[a,i]=u.useState([]),[l,d]=u.useState([]),[x,m]=u.useState(!1),[o,c]=u.useState({pageSize:20,pageIndex:0}),[f,D]=u.useState([]),{refetch:S}=re({queryKey:["planList"],queryFn:async()=>{const{data:_}=await ys.getList();return D(_),_}});u.useEffect(()=>{r({"drag-handle":x}),c({pageSize:x?99999:10,pageIndex:0})},[x]);const C=(_,g)=>{x&&(_.dataTransfer.setData("text/plain",g.toString()),_.currentTarget.classList.add("opacity-50"))},T=(_,g)=>{if(!x)return;_.preventDefault(),_.currentTarget.classList.remove("bg-muted");const p=parseInt(_.dataTransfer.getData("text/plain"));if(p===g)return;const V=[...f],[R]=V.splice(p,1);V.splice(g,0,R),D(V)},w=async()=>{if(!x){m(!0);return}const _=f?.map(g=>g.id);ys.sort(_).then(()=>{z.success("排序保存成功"),m(!1),S()}).finally(()=>{m(!1)})},E=Be({data:f||[],columns:oh(S),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:o},enableRowSelection:!0,onPaginationChange:c,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:i,onColumnVisibilityChange:r,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}},pageCount:x?1:void 0});return e.jsx(lh,{refreshData:S,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(ts,{table:E,toolbar:_=>e.jsx(ih,{table:_,refetch:S,saveOrder:w,isSortMode:x}),draggable:x,onDragStart:C,onDragEnd:_=>_.currentTarget.classList.remove("opacity-50"),onDragOver:_=>{_.preventDefault(),_.currentTarget.classList.add("bg-muted")},onDragLeave:_=>_.currentTarget.classList.remove("bg-muted"),onDrop:T,showPagination:!x}),e.jsx(mh,{})]})})}function xh(){const{t:s}=M("subscribe");return e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("plan.title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("plan.page.description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(uh,{})})]})]})}const hh=Object.freeze(Object.defineProperty({__proto__:null,default:xh},Symbol.toStringTag,{value:"Module"})),Tt=[{value:ie.PENDING,label:At[ie.PENDING],icon:yd,color:qt[ie.PENDING]},{value:ie.PROCESSING,label:At[ie.PROCESSING],icon:Rl,color:qt[ie.PROCESSING]},{value:ie.COMPLETED,label:At[ie.COMPLETED],icon:Nn,color:qt[ie.COMPLETED]},{value:ie.CANCELLED,label:At[ie.CANCELLED],icon:El,color:qt[ie.CANCELLED]},{value:ie.DISCOUNTED,label:At[ie.DISCOUNTED],icon:Nn,color:qt[ie.DISCOUNTED]}],Bt=[{value:Ce.PENDING,label:xa[Ce.PENDING],icon:_d,color:ha[Ce.PENDING]},{value:Ce.PROCESSING,label:xa[Ce.PROCESSING],icon:Rl,color:ha[Ce.PROCESSING]},{value:Ce.VALID,label:xa[Ce.VALID],icon:Nn,color:ha[Ce.VALID]},{value:Ce.INVALID,label:xa[Ce.INVALID],icon:El,color:ha[Ce.INVALID]}];function va({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=s?.getFilterValue(),i=Array.isArray(a)?new Set(a):a!==void 0?new Set([a]):new Set;return e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx($a,{className:"mr-2 h-4 w-4"}),n,i?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ee,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:i.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:i.size>2?e.jsxs(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[i.size," selected"]}):t.filter(l=>i.has(l.value)).map(l=>e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:l.label},l.value))})]})]})}),e.jsx(Xe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(it,{children:[e.jsx(vt,{placeholder:n}),e.jsxs(ot,{children:[e.jsx(bt,{children:"No results found."}),e.jsx(ks,{children:t.map(l=>{const d=i.has(l.value);return e.jsxs(rs,{onSelect:()=>{const x=new Set(i);d?x.delete(l.value):x.add(l.value);const m=Array.from(x);s?.setFilterValue(m.length?m:void 0)},children:[e.jsx("div",{className:N("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(pt,{className:N("h-4 w-4")})}),l.icon&&e.jsx(l.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${l.color}`}),e.jsx("span",{children:l.label}),r?.get(l.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(l.value)})]},l.value)})}),i.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{}),e.jsx(ks,{children:e.jsx(rs,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const gh=h.object({email:h.string().min(1),plan_id:h.number(),period:h.string(),total_amount:h.number()}),ph={email:"",plan_id:0,total_amount:0,period:""};function wi({refetch:s,trigger:n,defaultValues:t}){const{t:r}=M("order"),[a,i]=u.useState(!1),l=we({resolver:Te(gh),defaultValues:{...ph,...t},mode:"onChange"}),[d,x]=u.useState([]);return u.useEffect(()=>{a&&ys.getList().then(({data:m})=>{x(m)})},[a]),e.jsxs(me,{open:a,onOpenChange:i,children:[e.jsx(ps,{asChild:!0,children:n||e.jsxs(F,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Ue,{icon:"ion:add"}),e.jsx("div",{children:r("dialog.addOrder")})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:r("dialog.assignOrder")}),e.jsx($e,{})]}),e.jsxs(De,{...l,children:[e.jsx(v,{control:l.control,name:"email",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dialog.fields.userEmail")}),e.jsx(y,{children:e.jsx(k,{placeholder:r("dialog.placeholders.email"),...m})})]})}),e.jsx(v,{control:l.control,name:"plan_id",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dialog.fields.subscriptionPlan")}),e.jsx(y,{children:e.jsxs(J,{value:m.value?m.value?.toString():void 0,onValueChange:o=>m.onChange(parseInt(o)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dialog.placeholders.plan")})}),e.jsx(Y,{children:d.map(o=>e.jsx(A,{value:o.id.toString(),children:o.name},o.id))})]})})]})}),e.jsx(v,{control:l.control,name:"period",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dialog.fields.orderPeriod")}),e.jsx(y,{children:e.jsxs(J,{value:m.value,onValueChange:m.onChange,children:[e.jsx(W,{children:e.jsx(Q,{placeholder:r("dialog.placeholders.period")})}),e.jsx(Y,{children:Object.keys($m).map(o=>e.jsx(A,{value:o,children:r(`period.${o}`)},o))})]})})]})}),e.jsx(v,{control:l.control,name:"total_amount",render:({field:m})=>e.jsxs(j,{children:[e.jsx(b,{children:r("dialog.fields.paymentAmount")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:r("dialog.placeholders.amount"),value:m.value/100,onChange:o=>m.onChange(parseFloat(o.currentTarget.value)*100)})}),e.jsx(P,{})]})}),e.jsxs(Ie,{children:[e.jsx(F,{variant:"outline",onClick:()=>i(!1),children:r("dialog.actions.cancel")}),e.jsx(F,{type:"submit",onClick:()=>{l.handleSubmit(m=>{mt.assign(m).then(({data:o})=>{o&&(s&&s(),l.reset(),i(!1),z.success(r("dialog.messages.addSuccess")))})})()},children:r("dialog.actions.confirm")})]})]})]})]})}function fh({table:s,refetch:n}){const{t}=M("order"),r=s.getState().columnFilters.length>0,a=Object.values(Ms).filter(x=>typeof x=="number").map(x=>({label:t(`type.${Ms[x]}`),value:x,color:x===Ms.NEW?"green-500":x===Ms.RENEWAL?"blue-500":x===Ms.UPGRADE?"purple-500":"orange-500"})),i=Object.values(Qe).map(x=>({label:t(`period.${x}`),value:x,color:x===Qe.MONTH_PRICE?"slate-500":x===Qe.QUARTER_PRICE?"cyan-500":x===Qe.HALF_YEAR_PRICE?"indigo-500":x===Qe.YEAR_PRICE?"violet-500":x===Qe.TWO_YEAR_PRICE?"fuchsia-500":x===Qe.THREE_YEAR_PRICE?"pink-500":x===Qe.ONETIME_PRICE?"rose-500":"orange-500"})),l=Object.values(ie).filter(x=>typeof x=="number").map(x=>({label:t(`status.${ie[x]}`),value:x,icon:x===ie.PENDING?Tt[0].icon:x===ie.PROCESSING?Tt[1].icon:x===ie.COMPLETED?Tt[2].icon:x===ie.CANCELLED?Tt[3].icon:Tt[4].icon,color:x===ie.PENDING?"yellow-500":x===ie.PROCESSING?"blue-500":x===ie.COMPLETED?"green-500":x===ie.CANCELLED?"red-500":"green-500"})),d=Object.values(Ce).filter(x=>typeof x=="number").map(x=>({label:t(`commission.${Ce[x]}`),value:x,icon:x===Ce.PENDING?Bt[0].icon:x===Ce.PROCESSING?Bt[1].icon:x===Ce.VALID?Bt[2].icon:Bt[3].icon,color:x===Ce.PENDING?"yellow-500":x===Ce.PROCESSING?"blue-500":x===Ce.VALID?"green-500":"red-500"}));return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(wi,{refetch:n}),e.jsx(k,{placeholder:t("search.placeholder"),value:s.getColumn("trade_no")?.getFilterValue()??"",onChange:x=>s.getColumn("trade_no")?.setFilterValue(x.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex flex-wrap gap-x-2",children:[s.getColumn("type")&&e.jsx(va,{column:s.getColumn("type"),title:t("table.columns.type"),options:a}),s.getColumn("period")&&e.jsx(va,{column:s.getColumn("period"),title:t("table.columns.period"),options:i}),s.getColumn("status")&&e.jsx(va,{column:s.getColumn("status"),title:t("table.columns.status"),options:l}),s.getColumn("commission_status")&&e.jsx(va,{column:s.getColumn("commission_status"),title:t("table.columns.commissionStatus"),options:d})]}),r&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[t("actions.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]})}function ns({label:s,value:n,className:t,valueClassName:r}){return e.jsxs("div",{className:N("flex items-center py-1.5",t),children:[e.jsx("div",{className:"w-28 shrink-0 text-sm text-muted-foreground",children:s}),e.jsx("div",{className:N("text-sm",r),children:n||"-"})]})}function jh({status:s}){const{t:n}=M("order"),t={[ie.PENDING]:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",[ie.PROCESSING]:"bg-blue-100 text-blue-800 hover:bg-blue-100",[ie.CANCELLED]:"bg-red-100 text-red-800 hover:bg-red-100",[ie.COMPLETED]:"bg-green-100 text-green-800 hover:bg-green-100",[ie.DISCOUNTED]:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(q,{variant:"secondary",className:N("font-medium",t[s]),children:n(`status.${ie[s]}`)})}function vh({id:s,trigger:n}){const[t,r]=u.useState(!1),[a,i]=u.useState(),{t:l}=M("order");return u.useEffect(()=>{(async()=>{if(t){const{data:x}=await mt.getInfo({id:s});i(x)}})()},[t,s]),e.jsxs(me,{onOpenChange:r,open:t,children:[e.jsx(ps,{asChild:!0,children:n}),e.jsxs(ce,{className:"max-w-xl",children:[e.jsxs(pe,{className:"space-y-2",children:[e.jsx(ue,{className:"text-lg font-medium",children:l("dialog.title")}),e.jsx("div",{className:"flex items-center justify-between text-sm",children:e.jsxs("div",{className:"flex items-center space-x-6",children:[e.jsxs("div",{className:"text-muted-foreground",children:[l("table.columns.tradeNo"),":",a?.trade_no]}),!!a?.status&&e.jsx(jh,{status:a.status})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:l("dialog.basicInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ns,{label:l("dialog.fields.userEmail"),value:a?.user?.email?e.jsxs(tt,{to:`/user/manage?email=${a.user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[a.user.email,e.jsx(wn,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(ns,{label:l("dialog.fields.orderPeriod"),value:a&&l(`period.${a.period}`)}),e.jsx(ns,{label:l("dialog.fields.subscriptionPlan"),value:a?.plan?.name,valueClassName:"font-medium"}),e.jsx(ns,{label:l("dialog.fields.callbackNo"),value:a?.callback_no,valueClassName:"font-mono text-xs"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:l("dialog.amountInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ns,{label:l("dialog.fields.paymentAmount"),value:Ks(a?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(Ee,{className:"my-2"}),e.jsx(ns,{label:l("dialog.fields.balancePayment"),value:Ks(a?.balance_amount||0)}),e.jsx(ns,{label:l("dialog.fields.discountAmount"),value:Ks(a?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(ns,{label:l("dialog.fields.refundAmount"),value:Ks(a?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(ns,{label:l("dialog.fields.deductionAmount"),value:Ks(a?.surplus_amount||0)})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:l("dialog.timeInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ns,{label:l("dialog.fields.createdAt"),value:oe(a?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(ns,{label:l("dialog.fields.updatedAt"),value:oe(a?.updated_at),valueClassName:"font-mono text-xs"})]})]}),(a?.commission_status===1||a?.commission_status===2)&&a?.commission_balance&&e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:l("dialog.commissionInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ns,{label:l("dialog.fields.commissionStatus"),value:e.jsx(q,{variant:"secondary",className:"bg-orange-100 font-medium text-orange-800 hover:bg-orange-100",children:l("dialog.commissionStatusActive")})}),e.jsx(ns,{label:l("dialog.fields.commissionAmount"),value:Ks(a?.commission_balance||0),valueClassName:"font-medium text-orange-600"}),a?.actual_commission_balance&&e.jsx(ns,{label:l("dialog.fields.actualCommissionAmount"),value:Ks(a?.actual_commission_balance||0),valueClassName:"font-medium text-orange-700"}),a?.invite_user&&e.jsxs(e.Fragment,{children:[e.jsx(Ee,{className:"my-2"}),e.jsx(ns,{label:l("dialog.fields.inviteUser"),value:e.jsxs(tt,{to:`/user/manage?email=${a.invite_user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[a.invite_user.email,e.jsx(wn,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]})}),e.jsx(ns,{label:l("dialog.fields.inviteUserId"),value:a?.invite_user?.id,valueClassName:"font-mono text-xs"})]})]})]})]})]})]})}const bh={[Ms.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ms.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ms.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Ms.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},yh={[Qe.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Qe.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Qe.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Qe.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Qe.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Qe.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Qe.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Qe.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},_h=s=>ie[s],Nh=s=>Ce[s],wh=s=>Ms[s],Ch=s=>{const{t:n}=M("order");return[{accessorKey:"trade_no",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.tradeNo")}),cell:({row:t})=>{const r=t.original.trade_no,a=r.length>6?`${r.slice(0,3)}...${r.slice(-3)}`:r;return e.jsx("div",{className:"flex items-center",children:e.jsx(vh,{trigger:e.jsxs(G,{variant:"ghost",size:"sm",className:"flex h-8 items-center gap-1.5 px-2 font-medium text-primary transition-colors hover:bg-primary/10 hover:text-primary/80",children:[e.jsx("span",{className:"font-mono",children:a}),e.jsx(wn,{className:"h-3.5 w-3.5 opacity-70"})]}),id:t.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.type")}),cell:({row:t})=>{const r=t.getValue("type"),a=bh[r];return e.jsx(q,{variant:"secondary",className:N("font-medium transition-colors text-nowrap",a.color,a.bgColor,"border border-border/50","hover:bg-slate-200/80"),children:n(`type.${wh(r)}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.plan")}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium text-foreground/90 sm:max-w-72 md:max-w-[31rem]",children:t.original.plan?.name||"-"})}),enableSorting:!1,enableHiding:!1},{accessorKey:"period",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.period")}),cell:({row:t})=>{const r=t.getValue("period"),a=yh[r];return e.jsx(q,{variant:"secondary",className:N("font-medium transition-colors text-nowrap",a?.color,a?.bgColor,"hover:bg-opacity-80"),children:n(`period.${r}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"total_amount",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.amount")}),cell:({row:t})=>{const r=t.getValue("total_amount"),a=typeof r=="number"?(r/100).toFixed(2):"N/A";return e.jsxs("div",{className:"flex items-center font-mono text-foreground/90",children:["¥",a]})},enableSorting:!0,enableHiding:!1},{accessorKey:"status",header:({column:t})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(O,{column:t,title:n("table.columns.status")}),e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx(pi,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(de,{side:"top",className:"max-w-[200px] text-sm",children:n("status.tooltip")})]})})]}),cell:({row:t})=>{const r=Tt.find(a=>a.value===t.getValue("status"));return r?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r.icon&&e.jsx(r.icon,{className:`h-4 w-4 text-${r.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n(`status.${_h(r.value)}`)})]}),r.value===ie.PENDING&&e.jsxs(Hs,{modal:!0,children:[e.jsx(Bs,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Da,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(zs,{align:"end",className:"w-[140px]",children:[e.jsx(Se,{className:"cursor-pointer",onClick:async()=>{await mt.markPaid({trade_no:t.original.trade_no}),s()},children:n("actions.markAsPaid")}),e.jsx(Se,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await mt.makeCancel({trade_no:t.original.trade_no}),s()},children:n("actions.cancel")})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.commission")}),cell:({row:t})=>{const r=t.getValue("commission_balance"),a=r?(r/100).toFixed(2):"-";return e.jsx("div",{className:"flex items-center font-mono text-foreground/90",children:r?`¥${a}`:"-"})},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_status",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.commissionStatus")}),cell:({row:t})=>{const r=t.original.status,a=t.original.commission_balance,i=Bt.find(l=>l.value===t.getValue("commission_status"));return a==0||!i?e.jsx("span",{className:"text-muted-foreground",children:"-"}):e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[i.icon&&e.jsx(i.icon,{className:`h-4 w-4 text-${i.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n(`commission.${Nh(i.value)}`)})]}),i.value===Ce.PENDING&&r===ie.COMPLETED&&e.jsxs(Hs,{modal:!0,children:[e.jsx(Bs,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Da,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(zs,{align:"end",className:"w-[120px]",children:[e.jsx(Se,{className:"cursor-pointer",onClick:async()=>{await mt.update({trade_no:t.original.trade_no,commission_status:Ce.PROCESSING}),s()},children:n("commission.PROCESSING")}),e.jsx(Se,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await mt.update({trade_no:t.original.trade_no,commission_status:Ce.INVALID}),s()},children:n("commission.INVALID")})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.createdAt")}),cell:({row:t})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:oe(t.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}]};function Sh(){const[s]=Vl(),[n,t]=u.useState({}),[r,a]=u.useState({}),[i,l]=u.useState([]),[d,x]=u.useState([]),[m,o]=u.useState({pageIndex:0,pageSize:20});u.useEffect(()=>{const T=Object.entries({user_id:"string",order_id:"string",commission_status:"number",status:"number",commission_balance:"string"}).map(([w,E])=>{const _=s.get(w);return _?{id:w,value:E==="number"?parseInt(_):_}:null}).filter(Boolean);T.length>0&&l(T)},[s]);const{refetch:c,data:f,isLoading:D}=re({queryKey:["orderList",m,i,d],queryFn:()=>mt.getList({pageSize:m.pageSize,current:m.pageIndex+1,filter:i,sort:d})}),S=Be({data:f?.data??[],columns:Ch(c),state:{sorting:d,columnVisibility:r,rowSelection:n,columnFilters:i,pagination:m},rowCount:f?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:l,onColumnVisibilityChange:a,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),onPaginationChange:o,getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ts,{table:S,toolbar:e.jsx(fh,{table:S,refetch:c}),showPagination:!0})}function kh(){const{t:s}=M("order");return e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Sh,{})})]})]})}const Th=Object.freeze(Object.defineProperty({__proto__:null,default:kh},Symbol.toStringTag,{value:"Module"}));function Dh({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=new Set(s?.getFilterValue());return e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx($a,{className:"mr-2 h-4 w-4"}),n,a?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ee,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:a.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:a.size>2?e.jsxs(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[a.size," selected"]}):t.filter(i=>a.has(i.value)).map(i=>e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:i.label},i.value))})]})]})}),e.jsx(Xe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(it,{children:[e.jsx(vt,{placeholder:n}),e.jsxs(ot,{children:[e.jsx(bt,{children:"No results found."}),e.jsx(ks,{children:t.map(i=>{const l=a.has(i.value);return e.jsxs(rs,{onSelect:()=>{l?a.delete(i.value):a.add(i.value);const d=Array.from(a);s?.setFilterValue(d.length?d:void 0)},children:[e.jsx("div",{className:N("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",l?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(pt,{className:N("h-4 w-4")})}),i.icon&&e.jsx(i.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${i.color}`}),e.jsx("span",{children:i.label}),r?.get(i.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(i.value)})]},i.value)})}),a.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{}),e.jsx(ks,{children:e.jsx(rs,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Fh=s=>h.object({id:h.coerce.number().nullable().optional(),name:h.string().min(1,s("form.name.required")),code:h.string().nullable(),type:h.coerce.number(),value:h.coerce.number(),started_at:h.coerce.number(),ended_at:h.coerce.number(),limit_use:h.union([h.string(),h.number()]).nullable(),limit_use_with_user:h.union([h.string(),h.number()]).nullable(),generate_count:h.coerce.number().nullable().optional(),limit_plan_ids:h.array(h.coerce.number()).default([]).nullable(),limit_period:h.array(h.nativeEnum(Xt)).default([]).nullable()}).refine(n=>n.ended_at>n.started_at,{message:s("form.validity.endTimeError"),path:["ended_at"]}),wr={name:"",code:null,type:ws.AMOUNT,value:0,started_at:Math.floor(Date.now()/1e3),ended_at:Math.floor(Date.now()/1e3)+7*24*60*60,limit_use:null,limit_use_with_user:null,limit_plan_ids:[],limit_period:[],generate_count:null},Ph=s=>[{label:s("form.timeRange.presets.1week"),days:7},{label:s("form.timeRange.presets.2weeks"),days:14},{label:s("form.timeRange.presets.1month"),days:30},{label:s("form.timeRange.presets.3months"),days:90},{label:s("form.timeRange.presets.6months"),days:180},{label:s("form.timeRange.presets.1year"),days:365}];function Ci({defaultValues:s,refetch:n,type:t="create",dialogTrigger:r=null,open:a,onOpenChange:i}){const{t:l}=M("coupon"),[d,x]=u.useState(!1),m=a??d,o=i??x,[c,f]=u.useState([]),D=Fh(l),S=Ph(l),C=we({resolver:Te(D),defaultValues:s||wr});u.useEffect(()=>{s&&C.reset(s)},[s,C]),u.useEffect(()=>{ys.getList().then(({data:g})=>f(g))},[]);const T=g=>{if(!g)return;const p=(V,R)=>{const L=new Date(R*1e3);return V.setHours(L.getHours(),L.getMinutes(),L.getSeconds()),Math.floor(V.getTime()/1e3)};g.from&&C.setValue("started_at",p(g.from,C.watch("started_at"))),g.to&&C.setValue("ended_at",p(g.to,C.watch("ended_at")))},w=g=>{const p=new Date,V=Math.floor(p.getTime()/1e3),R=Math.floor((p.getTime()+g*24*60*60*1e3)/1e3);C.setValue("started_at",V),C.setValue("ended_at",R)},E=async g=>{const p=await Pa.save(g);if(g.generate_count&&typeof p=="string"){const V=new Blob([p],{type:"text/csv;charset=utf-8;"}),R=document.createElement("a");R.href=window.URL.createObjectURL(V),R.download=`coupons_${new Date().getTime()}.csv`,R.click(),window.URL.revokeObjectURL(R.href)}o(!1),t==="create"&&C.reset(wr),n()},_=(g,p)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:p}),e.jsx(k,{type:"datetime-local",step:"1",value:oe(C.watch(g),"YYYY-MM-DDTHH:mm:ss"),onChange:V=>{const R=new Date(V.target.value);C.setValue(g,Math.floor(R.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(me,{open:m,onOpenChange:o,children:[r&&e.jsx(ps,{asChild:!0,children:r}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsx(pe,{children:e.jsx(ue,{children:l(t==="create"?"form.add":"form.edit")})}),e.jsx(De,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(E),className:"space-y-4",children:[e.jsx(v,{control:C.control,name:"name",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:l("form.name.label")}),e.jsx(k,{placeholder:l("form.name.placeholder"),...g}),e.jsx(P,{})]})}),t==="create"&&e.jsx(v,{control:C.control,name:"generate_count",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:l("form.generateCount.label")}),e.jsx(k,{type:"number",min:0,placeholder:l("form.generateCount.placeholder"),...g,value:g.value??"",onChange:p=>g.onChange(p.target.value===""?null:parseInt(p.target.value)),className:"h-9"}),e.jsx($,{className:"text-xs",children:l("form.generateCount.description")}),e.jsx(P,{})]})}),(!C.watch("generate_count")||C.watch("generate_count")==null)&&e.jsx(v,{control:C.control,name:"code",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:l("form.code.label")}),e.jsx(k,{placeholder:l("form.code.placeholder"),...g,value:g.value??"",className:"h-9"}),e.jsx($,{className:"text-xs",children:l("form.code.description")}),e.jsx(P,{})]})}),e.jsxs(j,{children:[e.jsx(b,{children:l("form.type.label")}),e.jsxs("div",{className:"flex",children:[e.jsx(v,{control:C.control,name:"type",render:({field:g})=>e.jsxs(J,{value:g.value.toString(),onValueChange:p=>{const V=g.value,R=parseInt(p);g.onChange(R);const L=C.getValues("value");L&&(V===ws.AMOUNT&&R===ws.PERCENTAGE?C.setValue("value",L/100):V===ws.PERCENTAGE&&R===ws.AMOUNT&&C.setValue("value",L*100))},children:[e.jsx(W,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(Q,{placeholder:l("form.type.placeholder")})}),e.jsx(Y,{children:Object.entries(Am).map(([p,V])=>e.jsx(A,{value:p,children:l(`table.toolbar.types.${p}`)},p))})]})}),e.jsx(v,{control:C.control,name:"value",render:({field:g})=>{const p=g.value==null?"":C.watch("type")===ws.AMOUNT&&typeof g.value=="number"?(g.value/100).toString():g.value.toString();return e.jsx(k,{type:"number",placeholder:l("form.value.placeholder"),...g,value:p,onChange:V=>{const R=V.target.value;if(R===""){g.onChange("");return}const L=parseFloat(R);isNaN(L)||g.onChange(C.watch("type")===ws.AMOUNT?Math.round(L*100):L)},step:"any",min:0,className:"flex-[2] rounded-none border-x-0 text-left"})}}),e.jsx("div",{className:"flex min-w-[40px] items-center justify-center rounded-md rounded-l-none border border-l-0 border-input bg-muted/50 px-3 font-medium text-muted-foreground",children:e.jsx("span",{children:C.watch("type")==ws.AMOUNT?"¥":"%"})})]})]}),e.jsxs(j,{children:[e.jsx(b,{children:l("form.validity.label")}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",className:N("w-full justify-start text-left font-normal",!C.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),e.jsxs("span",{className:"truncate",children:[oe(C.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ",l("form.validity.to")," ",oe(C.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})]})}),e.jsxs(Xe,{className:"w-auto p-0",align:"start",children:[e.jsxs("div",{className:"border-b border-border p-3",children:[e.jsx("div",{className:"mb-2 text-sm font-medium text-muted-foreground",children:l("form.timeRange.quickSet")}),e.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-6",children:S.map(g=>e.jsx(F,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs",onClick:()=>w(g.days),type:"button",children:g.label},g.days))})]}),e.jsx("div",{className:"hidden border-b border-border sm:block",children:e.jsx(Ss,{mode:"range",selected:{from:new Date(C.watch("started_at")*1e3),to:new Date(C.watch("ended_at")*1e3)},onSelect:T,numberOfMonths:2})}),e.jsx("div",{className:"border-b border-border sm:hidden",children:e.jsx(Ss,{mode:"range",selected:{from:new Date(C.watch("started_at")*1e3),to:new Date(C.watch("ended_at")*1e3)},onSelect:T,numberOfMonths:1})}),e.jsx("div",{className:"p-3",children:e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[_("started_at",l("table.validity.startTime")),e.jsx("div",{className:"text-center text-sm text-muted-foreground sm:mt-6",children:l("form.validity.to")}),_("ended_at",l("table.validity.endTime"))]})})]})]}),e.jsx(P,{})]}),e.jsx(v,{control:C.control,name:"limit_use",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:l("form.limitUse.label")}),e.jsx(k,{type:"number",min:0,placeholder:l("form.limitUse.placeholder"),...g,value:g.value??"",onChange:p=>g.onChange(p.target.value===""?null:parseInt(p.target.value)),className:"h-9"}),e.jsx($,{className:"text-xs",children:l("form.limitUse.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:C.control,name:"limit_use_with_user",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:l("form.limitUseWithUser.label")}),e.jsx(k,{type:"number",min:0,placeholder:l("form.limitUseWithUser.placeholder"),...g,value:g.value??"",onChange:p=>g.onChange(p.target.value===""?null:parseInt(p.target.value)),className:"h-9"}),e.jsx($,{className:"text-xs",children:l("form.limitUseWithUser.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:C.control,name:"limit_period",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:l("form.limitPeriod.label")}),e.jsx(nt,{options:Object.entries(Xt).filter(([p])=>isNaN(Number(p))).map(([p,V])=>({label:l(`coupon:period.${V}`),value:p})),onChange:p=>{if(p.length===0){g.onChange([]);return}const V=p.map(R=>Xt[R.value]);g.onChange(V)},value:(g.value||[]).map(p=>({label:l(`coupon:period.${p}`),value:Object.entries(Xt).find(([V,R])=>R===p)?.[0]||""})),placeholder:l("form.limitPeriod.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:l("form.limitPeriod.empty")})}),e.jsx($,{className:"text-xs",children:l("form.limitPeriod.description")}),e.jsx(P,{})]})}),e.jsx(v,{control:C.control,name:"limit_plan_ids",render:({field:g})=>e.jsxs(j,{children:[e.jsx(b,{children:l("form.limitPlan.label")}),e.jsx(nt,{options:c?.map(p=>({label:p.name,value:p.id.toString()}))||[],onChange:p=>g.onChange(p.map(V=>Number(V.value))),value:(c||[]).filter(p=>(g.value||[]).includes(p.id)).map(p=>({label:p.name,value:p.id.toString()})),placeholder:l("form.limitPlan.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:l("form.limitPlan.empty")})}),e.jsx(P,{})]})}),e.jsx(Ie,{children:e.jsx(F,{type:"submit",disabled:C.formState.isSubmitting,children:C.formState.isSubmitting?l("form.submit.saving"):l("form.submit.save")})})]})})]})]})}function Lh({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=M("coupon");return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ci,{refetch:n,dialogTrigger:e.jsxs(F,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Ue,{icon:"ion:add"}),e.jsx("div",{children:r("form.add")})]})}),e.jsx(k,{placeholder:r("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:a=>s.getColumn("name")?.setFilterValue(a.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(Dh,{column:s.getColumn("type"),title:r("table.toolbar.type"),options:[{value:ws.AMOUNT,label:r(`table.toolbar.types.${ws.AMOUNT}`)},{value:ws.PERCENTAGE,label:r(`table.toolbar.types.${ws.PERCENTAGE}`)}]}),t&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("table.toolbar.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]})}const Si=u.createContext(void 0);function Rh({children:s,refetch:n}){const[t,r]=u.useState(!1),[a,i]=u.useState(null),l=x=>{i(x),r(!0)},d=()=>{r(!1),i(null)};return e.jsxs(Si.Provider,{value:{isOpen:t,currentCoupon:a,openEdit:l,closeEdit:d},children:[s,a&&e.jsx(Ci,{defaultValues:a,refetch:n,type:"edit",open:t,onOpenChange:r})]})}function Eh(){const s=u.useContext(Si);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const Vh=s=>{const{t:n}=M("coupon");return[{accessorKey:"id",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.id")}),cell:({row:t})=>e.jsx(q,{children:t.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.show")}),cell:({row:t})=>e.jsx(X,{defaultChecked:t.original.show,onCheckedChange:r=>{Pa.update({id:t.original.id,show:r}).then(({data:a})=>!a&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.name")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{children:t.original.name})}),enableSorting:!1,size:800},{accessorKey:"type",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.type")}),cell:({row:t})=>e.jsx(q,{variant:"outline",children:n(`table.toolbar.types.${t.original.type}`)}),enableSorting:!0},{accessorKey:"code",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.code")}),cell:({row:t})=>e.jsx(q,{variant:"secondary",children:t.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.limitUse")}),cell:({row:t})=>e.jsx(q,{variant:"outline",children:t.original.limit_use===null?n("table.validity.unlimited"):t.original.limit_use}),enableSorting:!0},{accessorKey:"limit_use_with_user",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.limitUseWithUser")}),cell:({row:t})=>e.jsx(q,{variant:"outline",children:t.original.limit_use_with_user===null?n("table.validity.noLimit"):t.original.limit_use_with_user}),enableSorting:!0},{accessorKey:"#",header:({column:t})=>e.jsx(O,{column:t,title:n("table.columns.validity")}),cell:({row:t})=>{const[r,a]=u.useState(!1),i=Date.now(),l=t.original.started_at*1e3,d=t.original.ended_at*1e3,x=i>d,m=ie.jsx(O,{className:"justify-end",column:t,title:n("table.columns.actions")}),cell:({row:t})=>{const{openEdit:r}=Eh();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>r(t.original),children:[e.jsx(rt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("table.actions.edit")})]}),e.jsx(_s,{title:n("table.actions.deleteConfirm.title"),description:n("table.actions.deleteConfirm.description"),confirmText:n("table.actions.deleteConfirm.confirmText"),variant:"destructive",onConfirm:async()=>{Pa.drop({id:t.original.id}).then(({data:a})=>{a&&(z.success("删除成功"),s())})},children:e.jsxs(F,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(us,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("table.actions.delete")})]})})]})}}]};function Ih(){const[s,n]=u.useState({}),[t,r]=u.useState({}),[a,i]=u.useState([]),[l,d]=u.useState([]),[x,m]=u.useState({pageIndex:0,pageSize:20}),{refetch:o,data:c}=re({queryKey:["couponList",x,a,l],queryFn:()=>Pa.getList({pageSize:x.pageSize,current:x.pageIndex+1,filter:a,sort:l})}),f=Be({data:c?.data??[],columns:Vh(o),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:x},pageCount:Math.ceil((c?.total??0)/x.pageSize),rowCount:c?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:i,onColumnVisibilityChange:r,onPaginationChange:m,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Rh,{refetch:o,children:e.jsx("div",{className:"space-y-4",children:e.jsx(ts,{table:f,toolbar:e.jsx(Lh,{table:f,refetch:o})})})})}function Mh(){const{t:s}=M("coupon");return e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Ih,{})})]})]})}const Oh=Object.freeze(Object.defineProperty({__proto__:null,default:Mh},Symbol.toStringTag,{value:"Module"})),zh=h.object({name:h.string().min(1,"请输入模板名称"),description:h.string().optional(),type:h.number().min(1).max(4),status:h.boolean(),sort:h.number().min(0),icon:h.string().optional(),background_image:h.string().optional(),conditions:h.object({allowed_plans:h.array(h.number()).optional(),disallowed_plans:h.array(h.number()).optional(),new_user_only:h.boolean().optional(),new_user_max_days:h.number().optional(),paid_user_only:h.boolean().optional(),require_invite:h.boolean().optional()}).optional(),limits:h.object({max_use_per_user:h.number().optional(),cooldown_hours:h.number().optional(),invite_reward_rate:h.number().optional()}).optional(),rewards:h.object({balance:h.number().optional(),transfer_enable:h.number().optional(),expire_days:h.number().optional(),device_limit:h.number().optional(),reset_package:h.boolean().optional(),plan_id:h.number().optional(),plan_validity_days:h.number().optional(),random_rewards:h.array(h.object({weight:h.number(),balance:h.number().optional(),transfer_enable:h.number().optional(),expire_days:h.number().optional(),device_limit:h.number().optional()})).optional()}),special_config:h.object({start_time:h.number().optional(),end_time:h.number().optional(),festival_bonus:h.number().optional()}).optional()});function ki({template:s,refetch:n,open:t,onOpenChange:r}){const{t:a}=M("giftCard"),[i,l]=u.useState(!1),[d,x]=u.useState([]),[m,o]=u.useState([]),c=we({resolver:Te(zh),defaultValues:{name:"",description:"",type:1,status:!0,sort:0,icon:"",background_image:"",conditions:{},limits:{},rewards:{},special_config:{}}}),{fields:f,append:D,remove:S}=Nd({control:c.control,name:"rewards.random_rewards"});u.useEffect(()=>{t&&(async()=>{try{const p=(await ys.getList()).data||[];x(p),o(p.map(V=>({label:V.name,value:V.id.toString()})))}catch(g){console.error("Failed to fetch plans:",g),z.error("Failed to load plan list")}})()},[t]),u.useEffect(()=>{if(s){const _=s.rewards||{};c.reset({name:s.name,description:s.description||"",type:s.type,status:s.status,sort:s.sort,icon:s.icon||"",background_image:s.background_image||"",conditions:s.conditions&&!Array.isArray(s.conditions)?s.conditions:{},limits:s.limits&&!Array.isArray(s.limits)?{...s.limits,invite_reward_rate:s.limits.invite_reward_rate||void 0}:{},rewards:{balance:_.balance?_.balance/100:void 0,transfer_enable:typeof _.transfer_enable=="number"?_.transfer_enable/1024/1024/1024:void 0,expire_days:_.expire_days,device_limit:_.device_limit,reset_package:_.reset_package,plan_id:_.plan_id,plan_validity_days:_.plan_validity_days,random_rewards:_.random_rewards?.map(g=>({weight:g.weight,balance:g.balance?g.balance/100:void 0,transfer_enable:typeof g.transfer_enable=="number"?g.transfer_enable/1024/1024/1024:void 0,expire_days:g.expire_days,device_limit:g.device_limit}))||[]},special_config:s.special_config&&!Array.isArray(s.special_config)?s.special_config:{}})}else c.reset({name:"",description:"",type:1,status:!0,sort:0,icon:"",background_image:"",conditions:{},limits:{},rewards:{random_rewards:[]},special_config:{}})},[s,c]);const C=_=>{console.error("Form validation failed:",_),z.error(a("messages.formInvalid"))},T=async _=>{l(!0);const g=JSON.parse(JSON.stringify(_));g.rewards&&(typeof g.rewards.balance=="number"&&(g.rewards.balance=Math.round(g.rewards.balance*100)),typeof g.rewards.transfer_enable=="number"&&(g.rewards.transfer_enable=Math.round(g.rewards.transfer_enable*1024*1024*1024)),g.rewards.random_rewards&&g.rewards.random_rewards.forEach(V=>{typeof V.balance=="number"&&(V.balance=Math.round(V.balance*100)),typeof V.transfer_enable=="number"&&(V.transfer_enable=Math.round(V.transfer_enable*1024*1024*1024))}));const p={...g,conditions:g.conditions||{},limits:g.limits||{},rewards:g.rewards||{},special_config:g.special_config||{}};try{s?(await Ps.updateTemplate({id:s.id,...p}),z.success(a("messages.templateUpdated"))):(await Ps.createTemplate(p),z.success(a("messages.templateCreated"))),n(),r(!1)}catch(V){const R=V?.response?.data?.errors;R&&Object.keys(R).forEach(L=>{c.setError(L,{type:"manual",message:R[L][0]})}),z.error(a(s?"messages.updateTemplateFailed":"messages.createTemplateFailed"))}finally{l(!1)}},w=c.watch("type"),E=w===1;return e.jsx(me,{open:t,onOpenChange:r,children:e.jsxs(ce,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(pe,{children:e.jsx(ue,{children:a(s?"template.form.edit":"template.form.add")})}),e.jsx(De,{...c,children:e.jsxs("form",{onSubmit:c.handleSubmit(T,C),className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(v,{control:c.control,name:"name",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.name.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:a("template.form.name.placeholder"),..._})}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"type",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.type.label")}),e.jsxs(J,{value:_.value.toString(),onValueChange:g=>_.onChange(parseInt(g)),children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:a("template.form.type.placeholder")})})}),e.jsx(Y,{children:[1,2,3].map(g=>e.jsx(A,{value:g.toString(),children:a(`types.${g}`)},g))})]}),e.jsx(P,{})]})})]}),e.jsx(v,{control:c.control,name:"description",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.description.label")}),e.jsx(y,{children:e.jsx(Es,{placeholder:a("template.form.description.placeholder"),..._})}),e.jsx(P,{})]})}),e.jsx("div",{className:"grid grid-cols-3 gap-4",children:e.jsx(v,{control:c.control,name:"status",render:({field:_})=>e.jsxs(j,{className:"col-span-3 flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{className:"text-base",children:a("template.form.status.label")}),e.jsx($,{children:a("template.form.status.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:_.value,onCheckedChange:_.onChange})})]})})}),e.jsxs(ke,{children:[e.jsx(Fe,{children:e.jsx(Ve,{children:a("template.form.rewards.title")})}),e.jsxs(Pe,{className:"space-y-4",children:[E&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(v,{control:c.control,name:"rewards.balance",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.rewards.balance.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.rewards.balance.placeholder"),..._,value:_.value??"",onChange:g=>{const p=g.target.valueAsNumber;_.onChange(isNaN(p)?void 0:p)}})})]})}),e.jsx(v,{control:c.control,name:"rewards.transfer_enable",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.rewards.transfer_enable.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",min:"0",step:"0.01",placeholder:a("template.form.rewards.transfer_enable.placeholder"),value:_.value??"",onChange:g=>{const p=g.target.valueAsNumber;_.onChange(isNaN(p)?void 0:p)}})})]})}),e.jsx(v,{control:c.control,name:"rewards.expire_days",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.rewards.expire_days.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.rewards.expire_days.placeholder"),..._,value:_.value??"",onChange:g=>{const p=g.target.valueAsNumber;_.onChange(isNaN(p)?void 0:p)}})})]})}),e.jsx(v,{control:c.control,name:"rewards.device_limit",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.rewards.device_limit.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.rewards.device_limit.placeholder"),..._,value:_.value??"",onChange:g=>{const p=g.target.valueAsNumber;_.onChange(isNaN(p)?void 0:p)}})})]})})]}),e.jsx(v,{control:c.control,name:"rewards.reset_package",render:({field:_})=>e.jsxs(j,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(b,{children:a("template.form.rewards.reset_package.label")}),e.jsx($,{children:a("template.form.rewards.reset_package.description")})]}),e.jsx(y,{children:e.jsx(X,{checked:_.value,onCheckedChange:_.onChange})})]})})]}),w===4&&e.jsx("p",{children:a("template.form.rewards.task_card.description")}),w===2&&e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(v,{control:c.control,name:"rewards.plan_id",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.rewards.plan_id.label")}),e.jsxs(J,{value:_.value?.toString(),onValueChange:g=>_.onChange(parseInt(g,10)),children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:a("template.form.rewards.plan_id.placeholder")})})}),e.jsx(Y,{children:d.map(g=>e.jsx(A,{value:g.id.toString(),children:g.name},g.id))})]}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"rewards.plan_validity_days",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.rewards.plan_validity_days.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.rewards.plan_validity_days.placeholder"),..._,value:_.value??"",onChange:g=>{const p=g.target.valueAsNumber;_.onChange(isNaN(p)?void 0:p)}})})]})})]}),w===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{children:a("template.form.rewards.random_rewards.label")}),f.map((_,g)=>e.jsxs("div",{className:"flex items-center space-x-2 rounded-md border p-2",children:[e.jsx(v,{control:c.control,name:`rewards.random_rewards.${g}.weight`,render:({field:p})=>e.jsx(j,{children:e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.rewards.random_rewards.weight"),...p,value:p.value??"",onChange:V=>{const R=V.target.valueAsNumber;p.onChange(isNaN(R)?0:R)}})})})}),e.jsx(v,{control:c.control,name:`rewards.random_rewards.${g}.balance`,render:({field:p})=>e.jsx(j,{children:e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.rewards.balance.label"),...p,value:p.value??"",onChange:V=>{const R=V.target.valueAsNumber;p.onChange(isNaN(R)?void 0:R)}})})})}),e.jsx(v,{control:c.control,name:`rewards.random_rewards.${g}.transfer_enable`,render:({field:p})=>e.jsx(j,{children:e.jsx(y,{children:e.jsx(k,{type:"number",min:"0",step:"0.01",placeholder:a("template.form.rewards.transfer_enable.label")+" (GB)",value:p.value??"",onChange:V=>{const R=V.target.valueAsNumber;p.onChange(isNaN(R)?void 0:R)}})})})}),e.jsx(v,{control:c.control,name:`rewards.random_rewards.${g}.expire_days`,render:({field:p})=>e.jsx(j,{children:e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.rewards.expire_days.label"),...p,value:p.value??"",onChange:V=>{const R=V.target.valueAsNumber;p.onChange(isNaN(R)?void 0:R)}})})})}),e.jsx(v,{control:c.control,name:`rewards.random_rewards.${g}.device_limit`,render:({field:p})=>e.jsx(j,{children:e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.rewards.device_limit.label"),...p,value:p.value??"",onChange:V=>{const R=V.target.valueAsNumber;p.onChange(isNaN(R)?void 0:R)}})})})}),e.jsx(F,{type:"button",variant:"ghost",size:"icon",onClick:()=>S(g),children:e.jsx(wd,{className:"h-4 w-4"})})]},_.id)),e.jsx(F,{type:"button",variant:"outline",onClick:()=>D({weight:10,balance:void 0,transfer_enable:void 0,expire_days:void 0,device_limit:void 0}),children:a("template.form.rewards.random_rewards.add")})]})]})]}),e.jsxs(ke,{children:[e.jsx(Fe,{children:e.jsx(Ve,{children:a("template.form.conditions.title")})}),e.jsxs(Pe,{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-1 gap-4",children:e.jsx(v,{control:c.control,name:"conditions.new_user_max_days",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.conditions.new_user_max_days.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.conditions.new_user_max_days.placeholder"),..._,value:_.value??"",onChange:g=>{const p=g.target.valueAsNumber;_.onChange(isNaN(p)?void 0:p)}})})]})})}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(v,{control:c.control,name:"conditions.new_user_only",render:({field:_})=>e.jsxs(j,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(b,{children:a("template.form.conditions.new_user_only.label")})}),e.jsx(y,{children:e.jsx(X,{checked:_.value,onCheckedChange:_.onChange})})]})}),e.jsx(v,{control:c.control,name:"conditions.paid_user_only",render:({field:_})=>e.jsxs(j,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(b,{children:a("template.form.conditions.paid_user_only.label")})}),e.jsx(y,{children:e.jsx(X,{checked:_.value,onCheckedChange:_.onChange})})]})}),e.jsx(v,{control:c.control,name:"conditions.require_invite",render:({field:_})=>e.jsxs(j,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(b,{children:a("template.form.conditions.require_invite.label")})}),e.jsx(y,{children:e.jsx(X,{checked:_.value,onCheckedChange:_.onChange})})]})})]}),e.jsx(v,{control:c.control,name:"conditions.allowed_plans",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.conditions.allowed_plans.label")}),e.jsx(y,{children:e.jsx(nt,{value:_.value?.map(g=>({label:d.find(p=>p.id===g)?.name||`ID: ${g}`,value:g.toString()}))??[],onChange:g=>_.onChange(g.map(p=>parseInt(p.value))),options:m,placeholder:a("template.form.conditions.allowed_plans.placeholder")})})]})}),e.jsx(v,{control:c.control,name:"conditions.disallowed_plans",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.conditions.disallowed_plans.label")}),e.jsx(y,{children:e.jsx(nt,{value:_.value?.map(g=>({label:d.find(p=>p.id===g)?.name||`ID: ${g}`,value:g.toString()}))??[],onChange:g=>_.onChange(g.map(p=>parseInt(p.value))),options:m,placeholder:a("template.form.conditions.disallowed_plans.placeholder")})})]})})]})]}),e.jsxs(ke,{children:[e.jsx(Fe,{children:e.jsx(Ve,{children:a("template.form.limits.title")})}),e.jsx(Pe,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(v,{control:c.control,name:"limits.max_use_per_user",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.limits.max_use_per_user.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.limits.max_use_per_user.placeholder"),..._,value:_.value??"",onChange:g=>{const p=g.target.valueAsNumber;_.onChange(isNaN(p)?void 0:p)}})})]})}),e.jsx(v,{control:c.control,name:"limits.cooldown_hours",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.limits.cooldown_hours.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",placeholder:a("template.form.limits.cooldown_hours.placeholder"),..._,value:_.value??"",onChange:g=>{const p=g.target.valueAsNumber;_.onChange(isNaN(p)?void 0:p)}})})]})}),e.jsx(v,{control:c.control,name:"limits.invite_reward_rate",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.limits.invite_reward_rate.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",step:"0.01",placeholder:a("template.form.limits.invite_reward_rate.placeholder"),..._,value:_.value??"",onChange:g=>{const p=g.target.valueAsNumber;_.onChange(isNaN(p)?void 0:p)}})}),e.jsx($,{children:a("template.form.limits.invite_reward_rate.description")})]})})]})})]}),e.jsxs(ke,{children:[e.jsx(Fe,{children:e.jsx(Ve,{children:a("template.form.special_config.title")})}),e.jsx(Pe,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-3 items-end gap-4",children:[e.jsx(v,{control:c.control,name:"special_config.start_time",render:({field:_})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(b,{children:a("template.form.special_config.start_time.label")}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsx(y,{children:e.jsxs(F,{variant:"outline",className:N("w-full pl-3 text-left font-normal",!_.value&&"text-muted-foreground"),children:[_.value?Le(new Date(_.value*1e3),"PPP"):e.jsx("span",{children:a("template.form.special_config.start_time.placeholder")}),e.jsx(Cs,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:_.value?new Date(_.value*1e3):void 0,onSelect:g=>_.onChange(g?Math.floor(g.getTime()/1e3):void 0),initialFocus:!0})})]}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"special_config.end_time",render:({field:_})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(b,{children:a("template.form.special_config.end_time.label")}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsx(y,{children:e.jsxs(F,{variant:"outline",className:N("w-full pl-3 text-left font-normal",!_.value&&"text-muted-foreground"),children:[_.value?Le(new Date(_.value*1e3),"PPP"):e.jsx("span",{children:a("template.form.special_config.end_time.placeholder")}),e.jsx(Cs,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:_.value?new Date(_.value*1e3):void 0,onSelect:g=>_.onChange(g?Math.floor(g.getTime()/1e3):void 0),initialFocus:!0})})]}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"special_config.festival_bonus",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.special_config.festival_bonus.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",step:"0.1",placeholder:a("template.form.special_config.festival_bonus.placeholder"),..._,value:_.value??"",onChange:g=>{const p=g.target.valueAsNumber;_.onChange(isNaN(p)?void 0:p)}})})]})})]})})]}),e.jsxs(ke,{children:[e.jsx(Fe,{children:e.jsx(Ve,{children:a("template.form.display.title")})}),e.jsx(Pe,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(v,{control:c.control,name:"icon",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.icon.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:a("template.form.icon.placeholder"),..._})}),e.jsx(P,{})]})}),e.jsx(v,{control:c.control,name:"background_image",render:({field:_})=>e.jsxs(j,{children:[e.jsx(b,{children:a("template.form.background_image.label")}),e.jsx(y,{children:e.jsx(k,{placeholder:a("template.form.background_image.placeholder"),..._})}),e.jsx(P,{})]})})]})})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(F,{type:"button",variant:"outline",onClick:()=>r(!1),children:a("common:cancel")}),e.jsx(F,{type:"submit",disabled:i,children:a(i?"common:saving":"common:submit")})]})]})})]})})}const Ti=u.createContext(void 0);function $h({children:s,refetch:n}){const[t,r]=u.useState(!1),[a,i]=u.useState(null),l=x=>{i(x),r(!!x)},d=()=>{r(!1),i(null)};return e.jsxs(Ti.Provider,{value:{isOpen:t,editingTemplate:a,setEditingTemplate:l,closeEdit:d},children:[s,e.jsx(ki,{template:a,refetch:n,open:t,onOpenChange:r})]})}function Ah(){const s=u.useContext(Ti);if(s===void 0)throw new Error("useTemplateEdit must be used within a TemplateEditProvider");return s}function qh({rewards:s,type:n}){const{t}=M(["giftCard","common"]),r=[];return s&&(s.balance&&r.push(`${t("template.form.rewards.balance.short_label")}: ${s.balance/100} ${t("common:currency.yuan","元")}`),s.transfer_enable&&r.push(`${t("template.form.rewards.transfer_enable.short_label")}: ${ze(s.transfer_enable)}`),s.expire_days&&r.push(`${t("template.form.rewards.expire_days.short_label")}: ${s.expire_days}${t("common:time.day","天")}`),s.device_limit&&r.push(`${t("template.form.rewards.device_limit.short_label")}: ${s.device_limit}`),n===2&&s.plan_id&&r.push(`${t("template.form.rewards.plan_id.short_label")}: ${s.plan_id}`),n===2&&s.plan_validity_days&&r.push(`${t("template.form.rewards.plan_validity_days.short_label")}: ${s.plan_validity_days}${t("common:time.day","天")}`),n===3&&s.random_rewards?.length&&r.push(t("types.3"))),r.length===0?e.jsx(q,{variant:"secondary",children:t("template.table.columns.no_rewards")}):e.jsx("div",{className:"flex flex-col space-y-1",children:r.map((a,i)=>e.jsx(q,{variant:"outline",className:"whitespace-nowrap",children:a},i))})}const Hh=s=>{const{t:n}=M("giftCard");return[{accessorKey:"id",header:({column:t})=>e.jsx(O,{column:t,title:n("template.table.columns.id")}),cell:({row:t})=>e.jsx(q,{children:t.original.id}),enableSorting:!0},{accessorKey:"status",header:({column:t})=>e.jsx(O,{column:t,title:n("template.table.columns.status")}),cell:({row:t})=>{const[r,a]=u.useState(!1);return e.jsx(X,{checked:t.original.status,disabled:r,onCheckedChange:async i=>{a(!0);try{const{data:l}=await Ps.updateTemplate({id:t.original.id,status:i});l?(z.success(n("messages.templateUpdated")),s()):z.error(n("messages.updateTemplateFailed"))}catch{z.error(n("messages.updateTemplateFailed"))}finally{a(!1)}}})},enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx(O,{column:t,title:n("template.table.columns.name")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{children:t.original.name})}),enableSorting:!1,size:300},{accessorKey:"type",header:({column:t})=>e.jsx(O,{column:t,title:n("template.table.columns.type")}),cell:({row:t})=>e.jsx(q,{variant:"outline",children:n(`types.${t.original.type}`)}),enableSorting:!0},{accessorKey:"rewards",header:({column:t})=>e.jsx(O,{column:t,title:n("template.table.columns.rewards")}),cell:({row:t})=>e.jsx(qh,{rewards:t.original.rewards,type:t.original.type}),enableSorting:!1},{accessorKey:"sort",header:({column:t})=>e.jsx(O,{column:t,title:n("template.table.columns.sort")}),cell:({row:t})=>e.jsx(q,{variant:"secondary",children:t.original.sort}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(O,{column:t,title:n("template.table.columns.created_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:oe(t.original.created_at)}),enableSorting:!0},{id:"actions",header:({column:t})=>e.jsx(O,{column:t,title:n("template.table.columns.actions")}),cell:({row:t})=>{const{setEditingTemplate:r}=Ah();return e.jsxs("div",{className:"flex space-x-2",children:[e.jsxs(F,{variant:"outline",size:"sm",onClick:()=>r(t.original),children:[e.jsx(rt,{className:"h-4 w-4"}),n("template.actions.edit")]}),e.jsx(_s,{title:n("template.actions.deleteConfirm.title"),description:n("template.actions.deleteConfirm.description"),confirmText:n("template.actions.deleteConfirm.confirmText"),onConfirm:async()=>{try{const{data:a}=await Ps.deleteTemplate({id:t.original.id});a?(z.success(n("messages.templateDeleted")),s()):z.error(n("messages.deleteTemplateFailed"))}catch{z.error(n("messages.deleteTemplateFailed"))}},children:e.jsxs(F,{variant:"outline",size:"sm",children:[e.jsx(us,{className:"h-4 w-4"}),n("template.actions.delete")]})})]})},enableSorting:!1}]};function Di({table:s}){return e.jsxs(Hs,{children:[e.jsx(Cd,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e.jsx(Il,{className:"mr-2 h-4 w-4"}),"显示列"]})}),e.jsxs(zs,{align:"end",className:"w-[150px]",children:[e.jsx(Ha,{children:"切换显示列"}),e.jsx(at,{}),s.getAllColumns().filter(n=>typeof n.accessorFn<"u"&&n.getCanHide()).map(n=>e.jsx(Ql,{className:"capitalize",checked:n.getIsVisible(),onCheckedChange:t=>n.toggleVisibility(!!t),children:n.id},n.id))]})]})}function Ea({column:s,title:n,options:t}){const r=new Set(s?.getFilterValue());return e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(G,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Sd,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ee,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:r.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:r.size>2?e.jsxs(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):t.filter(a=>r.has(a.value)).map(a=>e.jsx(q,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:a.label},`selected-${a.value}`))})]})]})}),e.jsx(Xe,{className:"w-[200px] p-0",align:"start",children:e.jsxs(it,{children:[e.jsx(vt,{placeholder:n}),e.jsxs(ot,{children:[e.jsx(bt,{children:"No results found."}),e.jsx(ks,{children:t.map(a=>{const i=r.has(a.value);return e.jsxs(rs,{onSelect:()=>{i?r.delete(a.value):r.add(a.value);const l=Array.from(r);s?.setFilterValue(l.length?l:void 0)},children:[e.jsx("div",{className:N("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",i?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(kd,{className:N("h-4 w-4")})}),a.icon&&e.jsx(a.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:a.label})]},`option-${a.value}`)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{}),e.jsx(ks,{children:e.jsx(rs,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function Uh({table:s,refetch:n}){const{t}=M("giftCard"),[r,a]=u.useState(!1),i=s.getState().columnFilters.length>0,l=[{label:t("types.1"),value:"1"},{label:t("types.2"),value:"2"},{label:t("types.3"),value:"3"},{label:t("types.4"),value:"4"},{label:t("types.5"),value:"5"},{label:t("types.6"),value:"6"},{label:t("types.7"),value:"7"},{label:t("types.8"),value:"8"},{label:t("types.9"),value:"9"},{label:t("types.10"),value:"10"}],d=[{label:t("common.enabled"),value:"true"},{label:t("common.disabled"),value:"false"}];return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(k,{placeholder:t("common.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:x=>s.getColumn("name")?.setFilterValue(x.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(Ea,{column:s.getColumn("type"),title:t("template.table.columns.type"),options:l}),s.getColumn("status")&&e.jsx(Ea,{column:s.getColumn("status"),title:t("template.table.columns.status"),options:d}),i&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[t("common.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(F,{variant:"outline",size:"sm",onClick:()=>a(!0),children:[e.jsx(Ml,{className:"h-4 w-4 mr-2"}),t("template.form.add")]}),e.jsx(Di,{table:s})]}),e.jsx(ki,{template:null,refetch:n,open:r,onOpenChange:a})]})}function Kh(){const[s,n]=u.useState({}),[t,r]=u.useState({}),[a,i]=u.useState([]),[l,d]=u.useState([]),[x,m]=u.useState({pageIndex:0,pageSize:20}),{refetch:o,data:c}=re({queryKey:["giftCardTemplates",x,a,l],queryFn:()=>Ps.getTemplates({per_page:x.pageSize,page:x.pageIndex+1,filter:a,sort:l})});console.log(c);const f=Be({data:c?.data??[],columns:Hh(o),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:x},pageCount:Math.ceil((c?.total??0)/x.pageSize),rowCount:c?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:i,onColumnVisibilityChange:r,onPaginationChange:m,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx($h,{refetch:o,children:e.jsx("div",{className:"space-y-4",children:e.jsx(ts,{table:f,toolbar:e.jsx(Uh,{table:f,refetch:o})})})})}const Bh=h.object({template_id:h.number().min(1,"请选择一个模板"),count:h.number().min(1,"生成数量必须大于0").max(1e4,"单次最多生成10000个"),prefix:h.string().optional(),expires_hours:h.number().min(1,"有效期必须大于0"),max_usage:h.number().min(1,"最大使用次数必须大于0"),download_csv:h.boolean().optional()});function Gh({refetch:s,open:n,onOpenChange:t}){const{t:r}=M("giftCard"),[a,i]=u.useState(!1),[l,d]=u.useState([]);u.useEffect(()=>{n&&Ps.getTemplates({per_page:1e3,page:1}).then(({data:o})=>{d(o||[])})},[n]);const x=we({resolver:Te(Bh),defaultValues:{count:10,prefix:"",expires_hours:24*30,max_usage:1,download_csv:!1}}),m=async o=>{i(!0);try{if(o.download_csv){const c=await Ps.generateCodes(o);if(c&&c instanceof Blob){const f=window.URL.createObjectURL(c),D=document.createElement("a");D.href=f,D.download=`gift_codes_${new Date().getTime()}.csv`,document.body.appendChild(D),D.click(),D.remove(),window.URL.revokeObjectURL(f),z.success(r("messages.codesGenerated")),s(),t(!1),x.reset()}}else await Ps.generateCodes(o),z.success(r("messages.codesGenerated")),s(),t(!1),x.reset()}catch{z.error(r("messages.generateCodesFailed"))}finally{i(!1)}};return e.jsx(me,{open:n,onOpenChange:t,children:e.jsxs(ce,{children:[e.jsx(pe,{children:e.jsx(ue,{children:r("code.form.generate")})}),e.jsx(De,{...x,children:e.jsxs("form",{onSubmit:x.handleSubmit(m),className:"space-y-4",children:[e.jsx(v,{control:x.control,name:"template_id",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:r("code.form.template_id.label")}),e.jsxs(J,{onValueChange:c=>o.onChange(parseInt(c)),children:[e.jsx(y,{children:e.jsx(W,{children:e.jsx(Q,{placeholder:r("code.form.template_id.placeholder")})})}),e.jsx(Y,{children:l.map(c=>e.jsx(A,{value:c.id.toString(),children:c.name},c.id))})]}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"count",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:r("code.form.count.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",...o,onChange:c=>o.onChange(parseInt(c.target.value)||0)})}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"prefix",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:r("code.form.prefix.label")}),e.jsx(y,{children:e.jsx(k,{...o})}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"expires_hours",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:r("code.form.expires_hours.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",...o,onChange:c=>o.onChange(parseInt(c.target.value)||0)})}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"max_usage",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:r("code.form.max_usage.label")}),e.jsx(y,{children:e.jsx(k,{type:"number",...o,onChange:c=>o.onChange(parseInt(c.target.value)||0)})}),e.jsx(P,{})]})}),e.jsx(v,{control:x.control,name:"download_csv",render:({field:o})=>e.jsxs(j,{className:"flex cursor-pointer flex-row items-center space-x-2 space-y-0",children:[e.jsx(y,{children:e.jsx("input",{type:"checkbox",checked:o.value,onChange:c=>o.onChange(c.target.checked)})}),e.jsx(b,{children:r("code.form.download_csv")})]})}),e.jsxs(Ie,{children:[e.jsx(F,{type:"button",variant:"outline",onClick:()=>t(!1),children:r("common.cancel")}),e.jsx(F,{type:"submit",disabled:a,children:r(a?"code.form.submit.generating":"code.form.submit.generate")})]})]})})]})})}function Wh({table:s,refetch:n}){const{t}=M("giftCard"),[r,a]=u.useState(!1),i=s.getState().columnFilters.length>0,l=Object.entries(t("code.status",{returnObjects:!0})).map(([d,x])=>({value:d,label:x}));return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(k,{placeholder:t("common.search"),value:s.getColumn("code")?.getFilterValue()??"",onChange:d=>s.getColumn("code")?.setFilterValue(d.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("status")&&e.jsx(Ea,{column:s.getColumn("status"),title:t("code.table.columns.status"),options:l}),i&&e.jsxs(F,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[t("common.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(F,{variant:"outline",size:"sm",onClick:()=>a(!0),children:[e.jsx(Ml,{className:"h-4 w-4 mr-2"}),t("code.form.generate")]}),e.jsxs(F,{variant:"outline",size:"sm",disabled:!0,children:[e.jsx(sa,{className:"h-4 w-4 mr-2"}),t("common.export")]}),e.jsx(Di,{table:s})]}),e.jsx(Gh,{refetch:n,open:r,onOpenChange:a})]})}const Yh=0,Jh=1,Qh=2,xn=3,Xh=s=>{const{t:n}=M("giftCard");return[{accessorKey:"id",header:({column:t})=>e.jsx(O,{column:t,title:n("code.table.columns.id")}),cell:({row:t})=>e.jsx(q,{children:t.original.id})},{accessorKey:"code",header:({column:t})=>e.jsx(O,{column:t,title:n("code.table.columns.code")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(q,{variant:"secondary",children:t.original.code}),e.jsx(F,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>Rt(t.original.code).then(()=>{z.success(n("common:copy.success"))}),children:e.jsx(Mn,{className:"h-4 w-4"})})]})},{accessorKey:"template_name",header:({column:t})=>e.jsx(O,{column:t,title:n("code.table.columns.template_name")})},{accessorKey:"status",header:({column:t})=>e.jsx(O,{column:t,title:n("code.table.columns.status")}),cell:({row:t})=>{const r=t.original.status,a=r===xn,i=r===Yh||r===xn;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(q,{variant:r===Jh?"secondary":r===Qh||r===xn?"destructive":"default",children:n(`code.status.${r}`)}),i&&e.jsx(X,{checked:!a,onCheckedChange:async l=>{const d=l?"enable":"disable";try{const{data:x}=await Ps.toggleCode({id:t.original.id,action:d});x?(z.success(n("messages.codeStatusUpdated")),s()):z.error(n("messages.updateCodeStatusFailed"))}catch{z.error(n("messages.updateCodeStatusFailed"))}}})]})}},{accessorKey:"expires_at",header:({column:t})=>e.jsx(O,{column:t,title:n("code.table.columns.expires_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:oe(t.original.expires_at)})},{accessorKey:"usage_count",header:({column:t})=>e.jsx(O,{column:t,title:n("code.table.columns.usage_count")}),cell:({row:t})=>e.jsx(q,{variant:"outline",children:t.original.usage_count})},{accessorKey:"max_usage",header:({column:t})=>e.jsx(O,{column:t,title:n("code.table.columns.max_usage")}),cell:({row:t})=>e.jsx(q,{variant:"outline",children:t.original.max_usage})},{accessorKey:"created_at",header:({column:t})=>e.jsx(O,{column:t,title:n("code.table.columns.created_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:oe(t.original.created_at)})}]};function Zh(){const[s,n]=u.useState({}),[t,r]=u.useState({}),[a,i]=u.useState([]),[l,d]=u.useState([]),[x,m]=u.useState({pageIndex:0,pageSize:20}),{refetch:o,data:c}=re({queryKey:["giftCardCodes",x,a,l],queryFn:()=>Ps.getCodes({per_page:x.pageSize,page:x.pageIndex+1,filter:a,sort:l})}),f=Be({data:c?.data??[],columns:Xh(o),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:x},pageCount:Math.ceil((c?.total??0)/x.pageSize),rowCount:c?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:i,onColumnVisibilityChange:r,onPaginationChange:m,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(ts,{table:f,toolbar:e.jsx(Wh,{table:f,refetch:o})})})}const eg=()=>{const{t:s}=M("giftCard");return[{accessorKey:"id",header:({column:n})=>e.jsx(O,{column:n,title:s("usage.table.columns.id")}),cell:({row:n})=>e.jsx(q,{children:n.original.id})},{accessorKey:"code",header:({column:n})=>e.jsx(O,{column:n,title:s("usage.table.columns.code")}),cell:({row:n})=>e.jsx(q,{variant:"secondary",children:n.original.code})},{accessorKey:"user_email",header:({column:n})=>e.jsx(O,{column:n,title:s("usage.table.columns.user_email")})},{accessorKey:"template_name",header:({column:n})=>e.jsx(O,{column:n,title:s("usage.table.columns.template_name")})},{accessorKey:"created_at",header:({column:n})=>e.jsx(O,{column:n,title:s("usage.table.columns.created_at")}),cell:({row:n})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:oe(n.original.created_at)})}]};function sg(){const[s,n]=u.useState([]),[t,r]=u.useState([]),[a,i]=u.useState({pageIndex:0,pageSize:20}),{data:l}=re({queryKey:["giftCardUsages",a,s,t],queryFn:()=>Ps.getUsages({per_page:a.pageSize,page:a.pageIndex+1,filter:s,sort:t})}),d=Be({data:l?.data??[],columns:eg(),state:{sorting:t,columnFilters:s,pagination:a},pageCount:Math.ceil((l?.total??0)/a.pageSize),rowCount:l?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,onSortingChange:r,onColumnFiltersChange:n,onPaginationChange:i,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),getSortedRowModel:gs()});return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(k,{placeholder:"搜索用户邮箱...",value:d.getColumn("user_email")?.getFilterValue()??"",onChange:x=>d.getColumn("user_email")?.setFilterValue(x.target.value),className:"h-8 w-[150px] lg:w-[250px]"})}),e.jsx(ts,{table:d})]})}function tg(){const{t:s}=M("giftCard"),{data:n,isLoading:t}=re({queryKey:["giftCardStats"],queryFn:()=>Ps.getStatistics({})}),r=n?.data?.total_stats,a=[{title:s("statistics.total.templates_count"),value:r?.templates_count},{title:s("statistics.total.active_templates_count"),value:r?.active_templates_count},{title:s("statistics.total.codes_count"),value:r?.codes_count},{title:s("statistics.total.used_codes_count"),value:r?.used_codes_count}];return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:a.map((i,l)=>e.jsxs(ke,{children:[e.jsx(Fe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:e.jsx(Ve,{className:"text-sm font-medium",children:i.title})}),e.jsx(Pe,{children:t?e.jsx(be,{className:"h-8 w-1/2"}):e.jsx("div",{className:"text-2xl font-bold",children:i.value??0})})]},l))})}function ag(){const{t:s}=M("giftCard"),[n,t]=u.useState("templates");return e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-6 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("description")})]})}),e.jsxs(ft,{value:n,onValueChange:t,className:"flex-1",children:[e.jsxs(lt,{className:"grid w-full grid-cols-4",children:[e.jsx(Ke,{value:"templates",children:s("tabs.templates")}),e.jsx(Ke,{value:"codes",children:s("tabs.codes")}),e.jsx(Ke,{value:"usages",children:s("tabs.usages")}),e.jsx(Ke,{value:"statistics",children:s("tabs.statistics")})]}),e.jsx(bs,{value:"templates",className:"mt-6 flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("template.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("template.description")})]})}),e.jsx(Kh,{})]})}),e.jsx(bs,{value:"codes",className:"mt-6 flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("code.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("code.description")})]})}),e.jsx(Zh,{})]})}),e.jsx(bs,{value:"usages",className:"mt-6 flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("usage.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("usage.description")})]})}),e.jsx(sg,{})]})}),e.jsx(bs,{value:"statistics",className:"mt-6 flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("statistics.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("statistics.description")})]})}),e.jsx(tg,{})]})})]})]})]})}const ng=Object.freeze(Object.defineProperty({__proto__:null,default:ag},Symbol.toStringTag,{value:"Module"})),rg=1,lg=1e6;let hn=0;function ig(){return hn=(hn+1)%Number.MAX_SAFE_INTEGER,hn.toString()}const gn=new Map,Cr=s=>{if(gn.has(s))return;const n=setTimeout(()=>{gn.delete(s),Zt({type:"REMOVE_TOAST",toastId:s})},lg);gn.set(s,n)},og=(s,n)=>{switch(n.type){case"ADD_TOAST":return{...s,toasts:[n.toast,...s.toasts].slice(0,rg)};case"UPDATE_TOAST":return{...s,toasts:s.toasts.map(t=>t.id===n.toast.id?{...t,...n.toast}:t)};case"DISMISS_TOAST":{const{toastId:t}=n;return t?Cr(t):s.toasts.forEach(r=>{Cr(r.id)}),{...s,toasts:s.toasts.map(r=>r.id===t||t===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return n.toastId===void 0?{...s,toasts:[]}:{...s,toasts:s.toasts.filter(t=>t.id!==n.toastId)}}},_a=[];let Na={toasts:[]};function Zt(s){Na=og(Na,s),_a.forEach(n=>{n(Na)})}function cg({...s}){const n=ig(),t=a=>Zt({type:"UPDATE_TOAST",toast:{...a,id:n}}),r=()=>Zt({type:"DISMISS_TOAST",toastId:n});return Zt({type:"ADD_TOAST",toast:{...s,id:n,open:!0,onOpenChange:a=>{a||r()}}}),{id:n,dismiss:r,update:t}}function Fi(){const[s,n]=u.useState(Na);return u.useEffect(()=>(_a.push(n),()=>{const t=_a.indexOf(n);t>-1&&_a.splice(t,1)}),[s]),{...s,toast:cg,dismiss:t=>Zt({type:"DISMISS_TOAST",toastId:t})}}function dg({open:s,onOpenChange:n,table:t}){const{t:r}=M("user"),{toast:a}=Fi(),[i,l]=u.useState(!1),[d,x]=u.useState(""),[m,o]=u.useState(""),c=async()=>{if(!d||!m){a({title:r("messages.error"),description:r("messages.send_mail.required_fields"),variant:"destructive"});return}try{l(!0),await qs.sendMail({subject:d,content:m,filter:t.getState().columnFilters,sort:t.getState().sorting[0]?.id,sort_type:t.getState().sorting[0]?.desc?"DESC":"ASC"}),a({title:r("messages.success"),description:r("messages.send_mail.success")}),n(!1),x(""),o("")}catch{a({title:r("messages.error"),description:r("messages.send_mail.failed"),variant:"destructive"})}finally{l(!1)}};return e.jsx(me,{open:s,onOpenChange:n,children:e.jsxs(ce,{className:"sm:max-w-[500px]",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:r("send_mail.title")}),e.jsx($e,{children:r("send_mail.description")})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"subject",className:"text-right",children:r("send_mail.subject")}),e.jsx(k,{id:"subject",value:d,onChange:f=>x(f.target.value),className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"content",className:"text-right",children:r("send_mail.content")}),e.jsx(Es,{id:"content",value:m,onChange:f=>o(f.target.value),className:"col-span-3",rows:6})]})]}),e.jsx(Ie,{children:e.jsx(G,{type:"submit",onClick:c,disabled:i,children:r(i?"send_mail.sending":"send_mail.send")})})]})})}function mg({trigger:s}){const{t:n}=M("user"),[t,r]=u.useState(!1),[a,i]=u.useState(30),{data:l,isLoading:d}=re({queryKey:["trafficResetStats",a],queryFn:()=>na.getStats({days:a}),enabled:t}),x=[{title:n("traffic_reset.stats.total_resets"),value:l?.data?.total_resets||0,icon:Yt,color:"text-blue-600",bgColor:"bg-blue-100"},{title:n("traffic_reset.stats.auto_resets"),value:l?.data?.auto_resets||0,icon:ka,color:"text-green-600",bgColor:"bg-green-100"},{title:n("traffic_reset.stats.manual_resets"),value:l?.data?.manual_resets||0,icon:Cs,color:"text-orange-600",bgColor:"bg-orange-100"},{title:n("traffic_reset.stats.cron_resets"),value:l?.data?.cron_resets||0,icon:On,color:"text-purple-600",bgColor:"bg-purple-100"}],m=[{value:7,label:n("traffic_reset.stats.days_options.week")},{value:30,label:n("traffic_reset.stats.days_options.month")},{value:90,label:n("traffic_reset.stats.days_options.quarter")},{value:365,label:n("traffic_reset.stats.days_options.year")}];return e.jsxs(me,{open:t,onOpenChange:r,children:[e.jsx(ps,{asChild:!0,children:s}),e.jsxs(ce,{className:"max-w-2xl",children:[e.jsxs(pe,{children:[e.jsxs(ue,{className:"flex items-center gap-2",children:[e.jsx(En,{className:"h-5 w-5"}),n("traffic_reset.stats.title")]}),e.jsx($e,{children:n("traffic_reset.stats.description")})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-medium",children:n("traffic_reset.stats.time_range")}),e.jsxs(J,{value:a.toString(),onValueChange:o=>i(Number(o)),children:[e.jsx(W,{className:"w-[180px]",children:e.jsx(Q,{})}),e.jsx(Y,{children:m.map(o=>e.jsx(A,{value:o.value.toString(),children:o.label},o.value))})]})]}),d?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(ea,{className:"h-6 w-6 animate-spin"})}):e.jsx("div",{className:"grid grid-cols-2 gap-4",children:x.map((o,c)=>e.jsxs(ke,{className:"relative overflow-hidden",children:[e.jsxs(Fe,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ve,{className:"text-sm font-medium text-muted-foreground",children:o.title}),e.jsx("div",{className:`rounded-lg p-2 ${o.bgColor}`,children:e.jsx(o.icon,{className:`h-4 w-4 ${o.color}`})})]}),e.jsxs(Pe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:o.value.toLocaleString()}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n("traffic_reset.stats.in_period",{days:a})})]})]},c))}),l?.data&&e.jsxs(ke,{children:[e.jsxs(Fe,{children:[e.jsx(Ve,{className:"text-lg",children:n("traffic_reset.stats.breakdown")}),e.jsx(Zs,{children:n("traffic_reset.stats.breakdown_description")})]}),e.jsx(Pe,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:n("traffic_reset.stats.auto_percentage")}),e.jsxs(q,{variant:"outline",className:"border-green-200 bg-green-50 text-green-700",children:[l.data.total_resets>0?(l.data.auto_resets/l.data.total_resets*100).toFixed(1):0,"%"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:n("traffic_reset.stats.manual_percentage")}),e.jsxs(q,{variant:"outline",className:"border-orange-200 bg-orange-50 text-orange-700",children:[l.data.total_resets>0?(l.data.manual_resets/l.data.total_resets*100).toFixed(1):0,"%"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:n("traffic_reset.stats.cron_percentage")}),e.jsxs(q,{variant:"outline",className:"border-purple-200 bg-purple-50 text-purple-700",children:[l.data.total_resets>0?(l.data.cron_resets/l.data.total_resets*100).toFixed(1):0,"%"]})]})]})})]})]})]})]})}const ug=h.object({email_prefix:h.string().optional(),email_suffix:h.string().min(1),password:h.string().optional(),expired_at:h.number().optional().nullable(),plan_id:h.number().nullable(),generate_count:h.number().optional().nullable(),download_csv:h.boolean().optional()}).refine(s=>s.generate_count===null?s.email_prefix!==void 0&&s.email_prefix!=="":!0,{message:"Email prefix is required when generate_count is null",path:["email_prefix"]}),xg={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0,download_csv:!1};function hg({refetch:s}){const{t:n}=M("user"),[t,r]=u.useState(!1),a=we({resolver:Te(ug),defaultValues:xg,mode:"onChange"}),[i,l]=u.useState([]);return u.useEffect(()=>{t&&ys.getList().then(({data:d})=>{d&&l(d)})},[t]),e.jsxs(me,{open:t,onOpenChange:r,children:[e.jsx(ps,{asChild:!0,children:e.jsxs(G,{size:"sm",variant:"outline",className:"gap-0 space-x-2",children:[e.jsx(Ue,{icon:"ion:add"}),e.jsx("div",{children:n("generate.button")})]})}),e.jsxs(ce,{className:"sm:max-w-[425px]",children:[e.jsxs(pe,{children:[e.jsx(ue,{children:n("generate.title")}),e.jsx($e,{})]}),e.jsxs(De,{...a,children:[e.jsxs(j,{children:[e.jsx(b,{children:n("generate.form.email")}),e.jsxs("div",{className:"flex",children:[!a.watch("generate_count")&&e.jsx(v,{control:a.control,name:"email_prefix",render:({field:d})=>e.jsx(k,{className:"flex-[5] rounded-r-none",placeholder:n("generate.form.email_prefix"),...d})}),e.jsx("div",{className:`z-[-1] border border-r-0 border-input px-3 py-1 shadow-sm ${a.watch("generate_count")?"rounded-l-md":"border-l-0"}`,children:"@"}),e.jsx(v,{control:a.control,name:"email_suffix",render:({field:d})=>e.jsx(k,{className:"flex-[4] rounded-l-none",placeholder:n("generate.form.email_domain"),...d})})]})]}),e.jsx(v,{control:a.control,name:"password",render:({field:d})=>e.jsxs(j,{children:[e.jsx(b,{children:n("generate.form.password")}),e.jsx(k,{placeholder:n("generate.form.password_placeholder"),...d}),e.jsx(P,{})]})}),e.jsx(v,{control:a.control,name:"expired_at",render:({field:d})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(b,{children:n("generate.form.expire_time")}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsx(y,{children:e.jsxs(G,{variant:"outline",className:N("w-full pl-3 text-left font-normal",!d.value&&"text-muted-foreground"),children:[d.value?oe(d.value):e.jsx("span",{children:n("generate.form.expire_time_placeholder")}),e.jsx(Cs,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(Xe,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(Td,{asChild:!0,children:e.jsx(G,{variant:"outline",className:"w-full",onClick:()=>{d.onChange(null)},children:n("generate.form.permanent")})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Ss,{mode:"single",selected:d.value?new Date(d.value*1e3):void 0,onSelect:x=>{x&&d.onChange(x?.getTime()/1e3)}})})]})]})]})}),e.jsx(v,{control:a.control,name:"plan_id",render:({field:d})=>e.jsxs(j,{children:[e.jsx(b,{children:n("generate.form.subscription")}),e.jsx(y,{children:e.jsxs(J,{value:d.value?d.value.toString():"null",onValueChange:x=>d.onChange(x==="null"?null:parseInt(x)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:n("generate.form.subscription_none")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"null",children:n("generate.form.subscription_none")}),i.map(x=>e.jsx(A,{value:x.id.toString(),children:x.name},x.id))]})]})})]})}),!a.watch("email_prefix")&&e.jsx(v,{control:a.control,name:"generate_count",render:({field:d})=>e.jsxs(j,{children:[e.jsx(b,{children:n("generate.form.generate_count")}),e.jsx(k,{type:"number",placeholder:n("generate.form.generate_count_placeholder"),value:d.value||"",onChange:x=>d.onChange(x.target.value?parseInt(x.target.value):null)})]})}),a.watch("generate_count")&&e.jsx(v,{control:a.control,name:"download_csv",render:({field:d})=>e.jsxs(j,{className:"flex cursor-pointer flex-row items-center space-x-2 space-y-0",children:[e.jsx(y,{children:e.jsx(Bn,{checked:d.value,onCheckedChange:d.onChange})}),e.jsx(b,{children:n("generate.form.download_csv")})]})})]}),e.jsxs(Ie,{children:[e.jsx(G,{variant:"outline",onClick:()=>r(!1),children:n("generate.form.cancel")}),e.jsx(G,{onClick:()=>a.handleSubmit(async d=>{if(d.download_csv){const x=await qs.generate(d);if(x&&x instanceof Blob){const m=window.URL.createObjectURL(x),o=document.createElement("a");o.href=m,o.download=`users_${new Date().getTime()}.csv`,document.body.appendChild(o),o.click(),o.remove(),window.URL.revokeObjectURL(m),z.success(n("generate.form.success")),a.reset(),s(),r(!1)}}else{const{data:x}=await qs.generate(d);x&&(z.success(n("generate.form.success")),a.reset(),s(),r(!1))}})(),children:n("generate.form.submit")})]})]})]})}const Gn=Or,Pi=zr,gg=$r,Li=u.forwardRef(({className:s,...n},t)=>e.jsx(Va,{className:N("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...n,ref:t}));Li.displayName=Va.displayName;const pg=gt("fixed overflow-y-scroll z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-md",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-md"}},defaultVariants:{side:"right"}}),en=u.forwardRef(({side:s="right",className:n,children:t,...r},a)=>e.jsxs(gg,{children:[e.jsx(Li,{}),e.jsxs(Ia,{ref:a,className:N(pg({side:s}),n),...r,children:[e.jsxs(Fn,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(os,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),t]})]}));en.displayName=Ia.displayName;const sn=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col space-y-2 text-center sm:text-left",s),...n});sn.displayName="SheetHeader";const Ri=({className:s,...n})=>e.jsx("div",{className:N("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Ri.displayName="SheetFooter";const tn=u.forwardRef(({className:s,...n},t)=>e.jsx(Ma,{ref:t,className:N("text-lg font-semibold text-foreground",s),...n}));tn.displayName=Ma.displayName;const an=u.forwardRef(({className:s,...n},t)=>e.jsx(Oa,{ref:t,className:N("text-sm text-muted-foreground",s),...n}));an.displayName=Oa.displayName;function fg({table:s,refetch:n,permissionGroups:t=[],subscriptionPlans:r=[]}){const{t:a}=M("user"),{toast:i}=Fi(),l=s.getState().columnFilters.length>0,[d,x]=u.useState([]),[m,o]=u.useState(!1),[c,f]=u.useState(!1),[D,S]=u.useState(!1),[C,T]=u.useState(!1),w=async()=>{try{const se=await qs.dumpCSV({filter:s.getState().columnFilters,sort:s.getState().sorting[0]?.id,sort_type:s.getState().sorting[0]?.desc?"DESC":"ASC"}),ae=se;console.log(se);const H=new Blob([ae],{type:"text/csv;charset=utf-8;"}),ee=window.URL.createObjectURL(H),je=document.createElement("a");je.href=ee,je.setAttribute("download",`users_${new Date().toISOString()}.csv`),document.body.appendChild(je),je.click(),je.remove(),window.URL.revokeObjectURL(ee),i({title:a("messages.success"),description:a("messages.export.success")})}catch{i({title:a("messages.error"),description:a("messages.export.failed"),variant:"destructive"})}},E=async()=>{try{T(!0),await qs.batchBan({filter:s.getState().columnFilters,sort:s.getState().sorting[0]?.id,sort_type:s.getState().sorting[0]?.desc?"DESC":"ASC"}),i({title:a("messages.success"),description:a("messages.batch_ban.success")}),n()}catch{i({title:a("messages.error"),description:a("messages.batch_ban.failed"),variant:"destructive"})}finally{T(!1),S(!1)}},_=[{label:a("filter.fields.email"),value:"email",type:"text",operators:[{label:a("filter.operators.contains"),value:"contains"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.id"),value:"id",type:"number",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.plan_id"),value:"plan_id",type:"select",operators:[{label:a("filter.operators.eq"),value:"eq"}],useOptions:!0},{label:a("filter.fields.transfer_enable"),value:"transfer_enable",type:"number",unit:"GB",operators:[{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.lt"),value:"lt"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.total_used"),value:"total_used",type:"number",unit:"GB",operators:[{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.lt"),value:"lt"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.online_count"),value:"online_count",type:"number",operators:[{label:a("filter.operators.eq"),value:"eq"},{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.lt"),value:"lt"}]},{label:a("filter.fields.expired_at"),value:"expired_at",type:"date",operators:[{label:a("filter.operators.lt"),value:"lt"},{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.uuid"),value:"uuid",type:"text",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.token"),value:"token",type:"text",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.banned"),value:"banned",type:"select",operators:[{label:a("filter.operators.eq"),value:"eq"}],options:[{label:a("filter.status.normal"),value:"0"},{label:a("filter.status.banned"),value:"1"}]},{label:a("filter.fields.remark"),value:"remarks",type:"text",operators:[{label:a("filter.operators.contains"),value:"contains"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.inviter_email"),value:"invite_user.email",type:"text",operators:[{label:a("filter.operators.contains"),value:"contains"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.invite_user_id"),value:"invite_user_id",type:"number",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.is_admin"),value:"is_admin",type:"boolean",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.is_staff"),value:"is_staff",type:"boolean",operators:[{label:a("filter.operators.eq"),value:"eq"}]}],g=se=>se*1024*1024*1024,p=se=>se/(1024*1024*1024),V=()=>{x([...d,{field:"",operator:"",value:""}])},R=se=>{x(d.filter((ae,H)=>H!==se))},L=(se,ae,H)=>{const ee=[...d];if(ee[se]={...ee[se],[ae]:H},ae==="field"){const je=_.find(ds=>ds.value===H);je&&(ee[se].operator=je.operators[0].value,ee[se].value=je.type==="boolean"?!1:"")}x(ee)},K=(se,ae)=>{const H=_.find(ee=>ee.value===se.field);if(!H)return null;switch(H.type){case"text":return e.jsx(k,{placeholder:a("filter.sheet.value"),value:se.value,onChange:ee=>L(ae,"value",ee.target.value)});case"number":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(k,{type:"number",placeholder:a("filter.sheet.value_number",{unit:H.unit}),value:H.unit==="GB"?p(se.value||0):se.value,onChange:ee=>{const je=Number(ee.target.value);L(ae,"value",H.unit==="GB"?g(je):je)}}),H.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:H.unit})]});case"date":return e.jsx(Ss,{mode:"single",selected:se.value,onSelect:ee=>L(ae,"value",ee),className:"flex flex-1 justify-center rounded-md border"});case"select":return e.jsxs(J,{value:se.value,onValueChange:ee=>L(ae,"value",ee),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("filter.sheet.value")})}),e.jsx(Y,{children:H.useOptions?r.map(ee=>e.jsx(A,{value:ee.value.toString(),children:ee.label},ee.value)):H.options?.map(ee=>e.jsx(A,{value:ee.value.toString(),children:ee.label},ee.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(X,{checked:se.value,onCheckedChange:ee=>L(ae,"value",ee)}),e.jsx(Je,{children:se.value?a("filter.boolean.true"):a("filter.boolean.false")})]});default:return null}},Z=()=>{const se=d.filter(ae=>ae.field&&ae.operator&&ae.value!=="").map(ae=>{const H=_.find(je=>je.value===ae.field);let ee=ae.value;return ae.operator==="contains"?{id:ae.field,value:ee}:(H?.type==="date"&&ee instanceof Date&&(ee=Math.floor(ee.getTime()/1e3)),H?.type==="boolean"&&(ee=ee?1:0),{id:ae.field,value:`${ae.operator}:${ee}`})});s.setColumnFilters(se),o(!1)};return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[e.jsx(hg,{refetch:n}),e.jsx(k,{placeholder:a("filter.email_search"),value:s.getColumn("email")?.getFilterValue()??"",onChange:se=>s.getColumn("email")?.setFilterValue(se.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(Gn,{open:m,onOpenChange:o,children:[e.jsx(Pi,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Il,{className:"mr-2 h-4 w-4"}),a("filter.advanced"),d.length>0&&e.jsx(q,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:d.length})]})}),e.jsxs(en,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(sn,{children:[e.jsx(tn,{children:a("filter.sheet.title")}),e.jsx(an,{children:a("filter.sheet.description")})]}),e.jsxs("div",{className:"mt-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-medium",children:a("filter.sheet.conditions")}),e.jsx(F,{variant:"outline",size:"sm",onClick:V,children:a("filter.sheet.add")})]}),e.jsx(ht,{className:"h-[calc(100vh-280px)] ",children:e.jsx("div",{className:"space-y-4",children:d.map((se,ae)=>e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Je,{children:a("filter.sheet.condition",{number:ae+1})}),e.jsx(F,{variant:"ghost",size:"sm",onClick:()=>R(ae),children:e.jsx(os,{className:"h-4 w-4"})})]}),e.jsxs(J,{value:se.field,onValueChange:H=>L(ae,"field",H),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("filter.sheet.field")})}),e.jsx(Y,{children:e.jsx(fs,{children:_.map(H=>e.jsx(A,{value:H.value,className:"cursor-pointer",children:H.label},H.value))})})]}),se.field&&e.jsxs(J,{value:se.operator,onValueChange:H=>L(ae,"operator",H),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:a("filter.sheet.operator")})}),e.jsx(Y,{children:_.find(H=>H.value===se.field)?.operators.map(H=>e.jsx(A,{value:H.value,children:H.label},H.value))})]}),se.field&&se.operator&&K(se,ae)]},ae))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(F,{variant:"outline",onClick:()=>{x([]),o(!1)},children:a("filter.sheet.reset")}),e.jsx(F,{onClick:Z,children:a("filter.sheet.apply")})]})]})]})]}),l&&e.jsxs(F,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),x([])},className:"h-8 px-2 lg:px-3",children:[a("filter.sheet.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]}),e.jsxs(Hs,{modal:!1,children:[e.jsx(Bs,{asChild:!0,children:e.jsx(F,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:a("actions.title")})}),e.jsxs(zs,{children:[e.jsx(Se,{onClick:()=>f(!0),children:a("actions.send_email")}),e.jsx(Se,{onClick:w,children:a("actions.export_csv")}),e.jsx(at,{}),e.jsx(Se,{asChild:!0,children:e.jsx(mg,{trigger:e.jsx("div",{className:"w-full cursor-pointer px-2 py-1.5 text-sm",children:a("actions.traffic_reset_stats")})})}),e.jsx(at,{}),e.jsx(Se,{onClick:()=>S(!0),className:"text-red-600 focus:text-red-600",children:a("actions.batch_ban")})]})]})]}),e.jsx(dg,{open:c,onOpenChange:f,table:s}),e.jsx(Un,{open:D,onOpenChange:S,children:e.jsxs(Ka,{children:[e.jsxs(Ba,{children:[e.jsx(Wa,{children:a("actions.confirm_ban.title")}),e.jsx(Ya,{children:a(l?"actions.confirm_ban.filtered_description":"actions.confirm_ban.all_description")})]}),e.jsxs(Ga,{children:[e.jsx(Qa,{disabled:C,children:a("actions.confirm_ban.cancel")}),e.jsx(Ja,{onClick:E,disabled:C,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:a(C?"actions.confirm_ban.banning":"actions.confirm_ban.confirm")})]})]})})]})}const Ei=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m17.71 11.29l-5-5a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21l-5 5a1 1 0 0 0 1.42 1.42L11 9.41V17a1 1 0 0 0 2 0V9.41l3.29 3.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42"})}),Vi=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.71 11.29a1 1 0 0 0-1.42 0L13 14.59V7a1 1 0 0 0-2 0v7.59l-3.29-3.3a1 1 0 0 0-1.42 1.42l5 5a1 1 0 0 0 .33.21a.94.94 0 0 0 .76 0a1 1 0 0 0 .33-.21l5-5a1 1 0 0 0 0-1.42"})}),jg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17 11H9.41l3.3-3.29a1 1 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33a1 1 0 0 0 0 .76a1 1 0 0 0 .21.33l5 5a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42L9.41 13H17a1 1 0 0 0 0-2"})}),vg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.92 11.62a1 1 0 0 0-.21-.33l-5-5a1 1 0 0 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l5-5a1 1 0 0 0 .21-.33a1 1 0 0 0 0-.76"})}),pn=[{accessorKey:"record_at",header:"时间",cell:({row:s})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("time",{className:"text-sm text-muted-foreground",children:Gd(s.original.record_at)})})},{accessorKey:"u",header:"上行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ei,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:ze(s.original.u/parseFloat(s.original.server_rate))})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Vi,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:ze(s.original.d/parseFloat(s.original.server_rate))})]})},{accessorKey:"server_rate",header:"倍率",cell:({row:s})=>{const n=s.original.server_rate;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(q,{variant:"outline",className:"font-mono",children:[n,"x"]})})}},{id:"total",header:"总计",cell:({row:s})=>{const n=s.original.u+s.original.d;return e.jsx("div",{className:"flex items-center justify-end font-mono text-sm",children:ze(n)})}}];function Ii({user_id:s,dialogTrigger:n}){const{t}=M(["traffic"]),[r,a]=u.useState(!1),[i,l]=u.useState({pageIndex:0,pageSize:20}),{data:d,isLoading:x}=re({queryKey:["userStats",s,i,r],queryFn:()=>r?qs.getStats({user_id:s,pageSize:i.pageSize,page:i.pageIndex+1}):null}),m=Be({data:d?.data??[],columns:pn,pageCount:Math.ceil((d?.total??0)/i.pageSize),state:{pagination:i},manualPagination:!0,getCoreRowModel:Ge(),onPaginationChange:l});return e.jsxs(me,{open:r,onOpenChange:a,children:[e.jsx(ps,{asChild:!0,children:n}),e.jsxs(ce,{className:"sm:max-w-[700px]",children:[e.jsx(pe,{children:e.jsx(ue,{children:t("trafficRecord.title")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs($n,{children:[e.jsx(An,{children:m.getHeaderGroups().map(o=>e.jsx(Xs,{children:o.headers.map(c=>e.jsx(Hn,{className:N("h-10 px-2 text-xs",c.id==="total"&&"text-right"),children:c.isPlaceholder?null:Ca(c.column.columnDef.header,c.getContext())},c.id))},o.id))}),e.jsx(qn,{children:x?Array.from({length:i.pageSize}).map((o,c)=>e.jsx(Xs,{children:Array.from({length:pn.length}).map((f,D)=>e.jsx(Pt,{className:"p-2",children:e.jsx(be,{className:"h-6 w-full"})},D))},c)):m.getRowModel().rows?.length?m.getRowModel().rows.map(o=>e.jsx(Xs,{"data-state":o.getIsSelected()&&"selected",className:"h-10",children:o.getVisibleCells().map(c=>e.jsx(Pt,{className:"px-2",children:Ca(c.column.columnDef.cell,c.getContext())},c.id))},o.id)):e.jsx(Xs,{children:e.jsx(Pt,{colSpan:pn.length,className:"h-24 text-center",children:t("trafficRecord.noRecords")})})})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:t("trafficRecord.perPage")}),e.jsxs(J,{value:`${m.getState().pagination.pageSize}`,onValueChange:o=>{m.setPageSize(Number(o))},children:[e.jsx(W,{className:"h-8 w-[70px]",children:e.jsx(Q,{placeholder:m.getState().pagination.pageSize})}),e.jsx(Y,{side:"top",children:[10,20,30,40,50].map(o=>e.jsx(A,{value:`${o}`,children:o},o))})]}),e.jsx("p",{className:"text-sm font-medium",children:t("trafficRecord.records")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"flex w-[100px] items-center justify-center text-sm",children:t("trafficRecord.page",{current:m.getState().pagination.pageIndex+1,total:m.getPageCount()})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>m.previousPage(),disabled:!m.getCanPreviousPage()||x,children:e.jsx(jg,{className:"h-4 w-4"})}),e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>m.nextPage(),disabled:!m.getCanNextPage()||x,children:e.jsx(vg,{className:"h-4 w-4"})})]})]})]})]})]})]})}function bg({user:s,trigger:n,onSuccess:t}){const{t:r}=M("user"),[a,i]=u.useState(!1),[l,d]=u.useState(""),[x,m]=u.useState(!1),{data:o,isLoading:c}=re({queryKey:["trafficResetHistory",s.id],queryFn:()=>na.getUserHistory(s.id,{limit:10}),enabled:a}),f=async()=>{try{m(!0);const{data:C}=await na.resetUser({user_id:s.id,reason:l.trim()||void 0});C&&(z.success(r("traffic_reset.reset_success")),i(!1),d(""),t?.())}finally{m(!1)}},D=C=>{switch(C){case"manual":return"bg-blue-100 text-blue-800 border-blue-200";case"monthly":return"bg-green-100 text-green-800 border-green-200";case"yearly":return"bg-purple-100 text-purple-800 border-purple-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},S=C=>{switch(C){case"manual":return"bg-orange-100 text-orange-800 border-orange-200";case"cron":return"bg-indigo-100 text-indigo-800 border-indigo-200";case"auto":return"bg-emerald-100 text-emerald-800 border-emerald-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}};return e.jsxs(me,{open:a,onOpenChange:i,children:[e.jsx(ps,{asChild:!0,children:n}),e.jsxs(ce,{className:"max-h-[90vh] max-w-4xl overflow-hidden",children:[e.jsxs(pe,{children:[e.jsxs(ue,{className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"h-5 w-5"}),r("traffic_reset.title")]}),e.jsx($e,{children:r("traffic_reset.description",{email:s.email})})]}),e.jsxs(ft,{defaultValue:"reset",className:"w-full",children:[e.jsxs(lt,{className:"grid w-full grid-cols-2",children:[e.jsxs(Ke,{value:"reset",className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"h-4 w-4"}),r("traffic_reset.tabs.reset")]}),e.jsxs(Ke,{value:"history",className:"flex items-center gap-2",children:[e.jsx(or,{className:"h-4 w-4"}),r("traffic_reset.tabs.history")]})]}),e.jsxs(bs,{value:"reset",className:"space-y-4",children:[e.jsxs(ke,{children:[e.jsx(Fe,{className:"pb-3",children:e.jsxs(Ve,{className:"flex items-center gap-2 text-lg",children:[e.jsx(Ol,{className:"h-5 w-5"}),r("traffic_reset.user_info")]})}),e.jsx(Pe,{className:"space-y-3",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx(Je,{className:"text-muted-foreground",children:r("columns.email")}),e.jsx("p",{className:"font-medium",children:s.email})]}),e.jsxs("div",{children:[e.jsx(Je,{className:"text-muted-foreground",children:r("columns.used_traffic")}),e.jsx("p",{className:"font-medium",children:ze(s.total_used)})]}),e.jsxs("div",{children:[e.jsx(Je,{className:"text-muted-foreground",children:r("columns.total_traffic")}),e.jsx("p",{className:"font-medium",children:ze(s.transfer_enable)})]}),e.jsxs("div",{children:[e.jsx(Je,{className:"text-muted-foreground",children:r("columns.expire_time")}),e.jsx("p",{className:"font-medium",children:s.expired_at?oe(s.expired_at):r("columns.expire_status.permanent")})]})]})})]}),e.jsxs(ke,{className:"border-amber-200 bg-amber-50",children:[e.jsx(Fe,{className:"pb-3",children:e.jsxs(Ve,{className:"flex items-center gap-2 text-lg text-amber-800",children:[e.jsx(Wt,{className:"h-5 w-5"}),r("traffic_reset.warning.title")]})}),e.jsx(Pe,{children:e.jsxs("ul",{className:"space-y-2 text-sm text-amber-700",children:[e.jsxs("li",{children:["• ",r("traffic_reset.warning.irreversible")]}),e.jsxs("li",{children:["• ",r("traffic_reset.warning.reset_to_zero")]}),e.jsxs("li",{children:["• ",r("traffic_reset.warning.logged")]})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Je,{htmlFor:"reason",children:r("traffic_reset.reason.label")}),e.jsx(Es,{id:"reason",placeholder:r("traffic_reset.reason.placeholder"),value:l,onChange:C=>d(C.target.value),className:"min-h-[80px]"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r("traffic_reset.reason.optional")})]}),e.jsxs(Ie,{children:[e.jsx(G,{variant:"outline",onClick:()=>i(!1),children:r("common:cancel")}),e.jsx(G,{onClick:f,disabled:x,className:"bg-destructive hover:bg-destructive/90",children:x?e.jsxs(e.Fragment,{children:[e.jsx(ea,{className:"mr-2 h-4 w-4 animate-spin"}),r("traffic_reset.resetting")]}):e.jsxs(e.Fragment,{children:[e.jsx(Yt,{className:"mr-2 h-4 w-4"}),r("traffic_reset.confirm_reset")]})})]})]}),e.jsx(bs,{value:"history",className:"space-y-4",children:c?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(ea,{className:"h-6 w-6 animate-spin"})}):e.jsxs("div",{className:"space-y-4",children:[o?.data?.user&&e.jsxs(ke,{children:[e.jsx(Fe,{className:"pb-3",children:e.jsx(Ve,{className:"text-lg",children:r("traffic_reset.history.summary")})}),e.jsx(Pe,{children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx(Je,{className:"text-muted-foreground",children:r("traffic_reset.history.reset_count")}),e.jsx("p",{className:"font-medium",children:o.data.user.reset_count})]}),e.jsxs("div",{children:[e.jsx(Je,{className:"text-muted-foreground",children:r("traffic_reset.history.last_reset")}),e.jsx("p",{className:"font-medium",children:o.data.user.last_reset_at?oe(o.data.user.last_reset_at):r("traffic_reset.history.never")})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(Je,{className:"text-muted-foreground",children:r("traffic_reset.history.next_reset")}),e.jsx("p",{className:"font-medium",children:o.data.user.next_reset_at?oe(o.data.user.next_reset_at):r("traffic_reset.history.no_schedule")})]})]})})]}),e.jsxs(ke,{children:[e.jsxs(Fe,{className:"pb-3",children:[e.jsx(Ve,{className:"text-lg",children:r("traffic_reset.history.records")}),e.jsx(Zs,{children:r("traffic_reset.history.recent_records")})]}),e.jsx(Pe,{children:e.jsx(ht,{className:"h-[300px]",children:o?.data?.history?.length?e.jsx("div",{className:"space-y-3",children:o.data.history.map((C,T)=>e.jsxs("div",{children:[e.jsx("div",{className:"flex items-start justify-between rounded-lg border bg-card p-3",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{className:D(C.reset_type),children:C.reset_type_name}),e.jsx(q,{variant:"outline",className:S(C.trigger_source),children:C.trigger_source_name})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsxs(Je,{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(On,{className:"h-3 w-3"}),r("traffic_reset.history.reset_time")]}),e.jsx("p",{className:"font-medium",children:oe(C.reset_time)})]}),e.jsxs("div",{children:[e.jsx(Je,{className:"text-muted-foreground",children:r("traffic_reset.history.traffic_cleared")}),e.jsx("p",{className:"font-medium text-destructive",children:C.old_traffic.formatted})]})]})]})}),Te.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M5 18h4.24a1 1 0 0 0 .71-.29l6.92-6.93L19.71 8a1 1 0 0 0 0-1.42l-4.24-4.29a1 1 0 0 0-1.42 0l-2.82 2.83l-6.94 6.93a1 1 0 0 0-.29.71V17a1 1 0 0 0 1 1m9.76-13.59l2.83 2.83l-1.42 1.42l-2.83-2.83ZM6 13.17l5.93-5.93l2.83 2.83L8.83 16H6ZM21 20H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2"})}),Ng=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11h-6V5a1 1 0 0 0-2 0v6H5a1 1 0 0 0 0 2h6v6a1 1 0 0 0 2 0v-6h6a1 1 0 0 0 0-2"})}),wg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 8.94a1.3 1.3 0 0 0-.06-.27v-.09a1 1 0 0 0-.19-.28l-6-6a1 1 0 0 0-.28-.19a.3.3 0 0 0-.09 0a.9.9 0 0 0-.33-.11H10a3 3 0 0 0-3 3v1H6a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-1h1a3 3 0 0 0 3-3zm-6-3.53L17.59 8H16a1 1 0 0 1-1-1ZM15 19a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h1v7a3 3 0 0 0 3 3h5Zm4-4a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3v3a3 3 0 0 0 3 3h3Z"})}),Sr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 11a1 1 0 0 0-1 1a8.05 8.05 0 1 1-2.22-5.5h-2.4a1 1 0 0 0 0 2h4.53a1 1 0 0 0 1-1V3a1 1 0 0 0-2 0v1.77A10 10 0 1 0 22 12a1 1 0 0 0-1-1"})}),Cg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9.5 10.5H12a1 1 0 0 0 0-2h-1V8a1 1 0 0 0-2 0v.55a2.5 2.5 0 0 0 .5 4.95h1a.5.5 0 0 1 0 1H8a1 1 0 0 0 0 2h1v.5a1 1 0 0 0 2 0v-.55a2.5 2.5 0 0 0-.5-4.95h-1a.5.5 0 0 1 0-1M21 12h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Z"})}),Sg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12.3 12.22A4.92 4.92 0 0 0 14 8.5a5 5 0 0 0-10 0a4.92 4.92 0 0 0 1.7 3.72A8 8 0 0 0 1 19.5a1 1 0 0 0 2 0a6 6 0 0 1 12 0a1 1 0 0 0 2 0a8 8 0 0 0-4.7-7.28M9 11.5a3 3 0 1 1 3-3a3 3 0 0 1-3 3m9.74.32A5 5 0 0 0 15 3.5a1 1 0 0 0 0 2a3 3 0 0 1 3 3a3 3 0 0 1-1.5 2.59a1 1 0 0 0-.5.84a1 1 0 0 0 .45.86l.39.26l.13.07a7 7 0 0 1 4 6.38a1 1 0 0 0 2 0a9 9 0 0 0-4.23-7.68"})}),kg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 0 0-6.88 2.77V3a1 1 0 0 0-2 0v4.5a1 1 0 0 0 1 1h4.5a1 1 0 0 0 0-2h-2.4A8 8 0 1 1 4 12a1 1 0 0 0-2 0A10 10 0 1 0 12 2m0 6a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h2a1 1 0 0 0 0-2h-1V9a1 1 0 0 0-1-1"})}),Tg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M20 6h-4V5a3 3 0 0 0-3-3h-2a3 3 0 0 0-3 3v1H4a1 1 0 0 0 0 2h1v11a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V8h1a1 1 0 0 0 0-2M10 5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1h-4Zm7 14a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V8h10Z"})}),Dg=(s,n,t,r)=>{const{t:a}=M("user");return[{accessorKey:"is_admin",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.is_admin")}),enableSorting:!1,enableHiding:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l)),size:0},{accessorKey:"is_staff",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.is_staff")}),enableSorting:!1,enableHiding:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l)),size:0},{accessorKey:"id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.id")}),cell:({row:i})=>e.jsx(q,{variant:"outline",children:i.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.email")}),cell:({row:i})=>{const l=i.original.t||0,d=Date.now()/1e3-l<120,x=Math.floor(Date.now()/1e3-l);let m=d?a("columns.online_status.online"):l===0?a("columns.online_status.never"):a("columns.online_status.last_online",{time:oe(l)});if(!d&&l!==0){const D=Math.floor(x/60),S=Math.floor(D/60),C=Math.floor(S/24);C>0?m+=` -`+a("columns.online_status.offline_duration.days",{count:C}):S>0?m+=` -`+a("columns.online_status.offline_duration.hours",{count:S}):D>0?m+=` -`+a("columns.online_status.offline_duration.minutes",{count:D}):m+=` -`+a("columns.online_status.offline_duration.seconds",{count:x})}const[o,c]=Ir.useState(!1),f=i.original.email;return e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsxs("div",{className:"flex items-center gap-2.5 group",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[e.jsx("div",{className:N("size-2.5 rounded-full ring-2 ring-offset-2",d?"bg-green-500 ring-green-500/20":"bg-gray-300 ring-gray-300/20","transition-all duration-300")}),e.jsx("span",{className:"font-medium text-foreground/90",children:f}),e.jsx("button",{type:"button",className:N("ml-1 p-1 rounded transition-opacity bg-transparent hover:bg-muted",o?"opacity-100":"opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto"),tabIndex:-1,"aria-label":a("columns.actions_menu.copy_email",{defaultValue:"Copy Email"}),onClick:D=>{D.stopPropagation(),Rt(f),z.success(a("common:copy.success"))},style:{lineHeight:0},children:e.jsx(Mn,{className:"h-4 w-4 text-muted-foreground"})})]})}),e.jsx(de,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:m})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.online_count")}),cell:({row:i})=>{const l=i.original.device_limit,d=i.original.online_count||0;return e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(q,{variant:"outline",className:N("min-w-[4rem] justify-center",l!==null&&d>=l?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[d," / ",l===null?"∞":l]})})}),e.jsx(de,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:l===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:l})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.status")}),cell:({row:i})=>{const l=i.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(q,{className:N("min-w-20 justify-center transition-colors",l?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(l?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(i,l,d)=>d.includes(i.getValue(l))},{accessorKey:"plan_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.subscription")}),cell:({row:i})=>e.jsx("div",{className:"min-w-[10em] break-all",children:i.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.group")}),cell:({row:i})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(q,{variant:"outline",className:N("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5 whitespace-nowrap"),children:i.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.used_traffic")}),cell:({row:i})=>{const l=ze(i.original?.total_used),d=ze(i.original?.transfer_enable),x=i.original?.total_used/i.original?.transfer_enable*100||0;return e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{className:"w-full",children:e.jsxs("div",{className:"w-full space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:N("h-full rounded-full transition-all",x>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(x,100)}%`}})})]})}),e.jsx(de,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",d]})})]})})}},{accessorKey:"transfer_enable",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.total_traffic")}),cell:({row:i})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:ze(i.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.expire_time")}),cell:({row:i})=>{const l=i.original.expired_at,d=Date.now()/1e3,x=l!=null&&le.jsx(O,{column:i,title:a("columns.balance")}),cell:({row:i})=>{const l=xr(i.original?.balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:l})]})}},{accessorKey:"commission_balance",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.commission")}),cell:({row:i})=>{const l=xr(i.original?.commission_balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:l})]})}},{accessorKey:"created_at",header:({column:i})=>e.jsx(O,{column:i,title:a("columns.register_time")}),cell:({row:i})=>e.jsx("div",{className:"truncate",children:oe(i.original?.created_at)}),size:1e3},{id:"actions",header:({column:i})=>e.jsx(O,{column:i,className:"justify-end",title:a("columns.actions")}),cell:({row:i,table:l})=>e.jsxs(Hs,{modal:!1,children:[e.jsx(Bs,{asChild:!0,children:e.jsx("div",{className:"text-center",children:e.jsx(G,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":a("columns.actions"),children:e.jsx(Da,{className:"size-4"})})})}),e.jsxs(zs,{align:"end",className:"min-w-[40px]",children:[e.jsx(Se,{onSelect:d=>{d.preventDefault(),t(i.original),r(!0)},className:"p-0",children:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(_g,{className:"mr-2"}),a("columns.actions_menu.edit")]})}),e.jsx(Se,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(wi,{defaultValues:{email:i.original.email},trigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Ng,{className:"mr-2"}),a("columns.actions_menu.assign_order")]})})}),e.jsx(Se,{onSelect:()=>{Rt(i.original.subscribe_url).then(()=>{z.success(a("common:copy.success"))})},className:"p-0 ,",children:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(wg,{className:"mr-2"}),a("columns.actions_menu.copy_url")]})}),e.jsxs(Se,{className:"",onSelect:()=>{qs.resetSecret(i.original.id).then(({data:d})=>{d&&z.success("重置成功")})},children:[e.jsx(Sr,{className:"mr-4"}),a("columns.actions_menu.reset_secret")]}),e.jsx(Se,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(G,{variant:"ghost",className:"h-auto w-full justify-start px-2 py-1.5 font-normal",asChild:!0,children:e.jsxs(tt,{to:`/finance/order?user_id=eq:${i.original.id}`,children:[e.jsx(Cg,{className:"mr-2"}),a("columns.actions_menu.orders")]})})}),e.jsxs(Se,{onSelect:()=>{l.setColumnFilters([{id:"invite_user_id",value:"eq:"+i.original?.id}])},children:[e.jsx(Sg,{className:"mr-4"}),a("columns.actions_menu.invites")]}),e.jsx(Se,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(Ii,{user_id:i.original?.id,dialogTrigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(kg,{className:"mr-2"}),a("columns.actions_menu.traffic_records")]})})}),e.jsx(Se,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(bg,{user:i.original,onSuccess:s,trigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Sr,{className:"mr-2"}),a("columns.actions_menu.reset_traffic")]})})}),e.jsx(Se,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(yg,{title:a("columns.actions_menu.delete_confirm_title"),description:a("columns.actions_menu.delete_confirm_description",{email:i.original.email}),cancelText:a("common:cancel"),confirmText:a("common:confirm"),variant:"destructive",onConfirm:async()=>{try{const{data:d}=await qs.destroy(i.original.id);d&&(z.success(a("common:delete.success")),s())}catch{z.error(a("common:delete.failed"))}},children:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5 text-destructive hover:text-destructive",children:[e.jsx(Tg,{className:"mr-2"}),a("columns.actions_menu.delete")]})})})]})]})}]},Mi=u.createContext(void 0),Wn=()=>{const s=u.useContext(Mi);if(!s)throw new Error("useUserEdit must be used within an UserEditProvider");return s},Oi=({children:s,refreshData:n})=>{const[t,r]=u.useState(!1),[a,i]=u.useState(null),l={isOpen:t,setIsOpen:r,editingUser:a,setEditingUser:i,refreshData:n};return e.jsx(Mi.Provider,{value:l,children:s})},Fg=h.object({id:h.number().default(0),email:h.string().email().default(""),invite_user_email:h.string().email().nullable().optional().default(null),password:h.string().optional().nullable().default(null),balance:h.coerce.number().default(0),commission_balance:h.coerce.number().default(0),u:h.coerce.number().default(0),d:h.coerce.number().default(0),transfer_enable:h.number().default(0),expired_at:h.number().nullable().default(null),plan_id:h.number().nullable().default(null),banned:h.boolean().default(!1),commission_type:h.number().default(0),commission_rate:h.number().nullable().default(null),discount:h.number().nullable().default(null),speed_limit:h.number().nullable().default(null),device_limit:h.number().nullable().default(null),is_admin:h.boolean().default(!1),is_staff:h.boolean().default(!1),remarks:h.string().nullable().default(null)});function zi(){const{t:s}=M("user"),{isOpen:n,setIsOpen:t,editingUser:r,refreshData:a}=Wn(),[i,l]=u.useState(!1),[d,x]=u.useState([]),m=we({resolver:Te(Fg)});return u.useEffect(()=>{n&&ys.getList().then(({data:o})=>{x(o)})},[n]),u.useEffect(()=>{if(r){const o=r.invite_user?.email,{invite_user:c,...f}=r;m.reset({...f,invite_user_email:o||null,password:null,u:f.u?(f.u/1024/1024/1024).toFixed(3):"",d:f.d?(f.d/1024/1024/1024).toFixed(3):""})}},[r,m]),e.jsx(Gn,{open:n,onOpenChange:t,children:e.jsxs(en,{className:"max-w-[90%] space-y-4",children:[e.jsxs(sn,{children:[e.jsx(tn,{children:s("edit.title")}),e.jsx(an,{})]}),e.jsxs(De,{...m,children:[e.jsx(v,{control:m.control,name:"email",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.email")}),e.jsx(y,{children:e.jsx(k,{...o,placeholder:s("edit.form.email_placeholder"),autoComplete:"off","data-form-type":"other"})}),e.jsx(P,{...o})]})}),e.jsx(v,{control:m.control,name:"invite_user_email",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.inviter_email")}),e.jsx(y,{children:e.jsx(k,{value:o.value||"",onChange:c=>o.onChange(c.target.value?c.target.value:null),placeholder:s("edit.form.inviter_email_placeholder"),autoComplete:"off","data-form-type":"other"})}),e.jsx(P,{...o})]})}),e.jsx(v,{control:m.control,name:"password",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.password")}),e.jsx(y,{children:e.jsx(k,{type:"password",value:o.value||"",onChange:o.onChange,placeholder:s("edit.form.password_placeholder"),autoComplete:"off","data-form-type":"other"})}),e.jsx(P,{...o})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(v,{control:m.control,name:"balance",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.balance")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:o.value||"",onChange:o.onChange,placeholder:s("edit.form.balance_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(P,{...o})]})}),e.jsx(v,{control:m.control,name:"commission_balance",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.commission_balance")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:o.value||"",onChange:o.onChange,placeholder:s("edit.form.commission_balance_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(P,{...o})]})}),e.jsx(v,{control:m.control,name:"u",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.upload")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",step:"any",value:o.value??"",onChange:c=>o.onChange(c.target.value),placeholder:s("edit.form.upload_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(P,{...o})]})}),e.jsx(v,{control:m.control,name:"d",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.download")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",step:"any",value:o.value??"",onChange:c=>o.onChange(c.target.value),placeholder:s("edit.form.download_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(P,{...o})]})})]}),e.jsx(v,{control:m.control,name:"transfer_enable",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.total_traffic")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:o.value/1024/1024/1024||"",onChange:c=>o.onChange(parseInt(c.target.value)*1024*1024*1024),placeholder:s("edit.form.total_traffic_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(P,{})]})}),e.jsx(v,{control:m.control,name:"expired_at",render:({field:o})=>e.jsxs(j,{className:"flex flex-col",children:[e.jsx(b,{children:s("edit.form.expire_time")}),e.jsxs(ls,{open:i,onOpenChange:l,children:[e.jsx(is,{asChild:!0,children:e.jsx(y,{children:e.jsxs(F,{type:"button",variant:"outline",className:N("w-full pl-3 text-left font-normal",!o.value&&"text-muted-foreground"),onClick:()=>l(!0),children:[o.value?oe(o.value):e.jsx("span",{children:s("edit.form.expire_time_placeholder")}),e.jsx(Cs,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:c=>{c.preventDefault()},onEscapeKeyDown:c=>{c.preventDefault()},children:e.jsxs("div",{className:"flex flex-col space-y-3 p-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(F,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{o.onChange(null),l(!1)},children:s("edit.form.expire_time_permanent")}),e.jsx(F,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const c=new Date;c.setMonth(c.getMonth()+1),c.setHours(23,59,59,999),o.onChange(Math.floor(c.getTime()/1e3)),l(!1)},children:s("edit.form.expire_time_1month")}),e.jsx(F,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const c=new Date;c.setMonth(c.getMonth()+3),c.setHours(23,59,59,999),o.onChange(Math.floor(c.getTime()/1e3)),l(!1)},children:s("edit.form.expire_time_3months")})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Ss,{mode:"single",selected:o.value?new Date(o.value*1e3):void 0,onSelect:c=>{if(c){const f=new Date(o.value?o.value*1e3:Date.now());c.setHours(f.getHours(),f.getMinutes(),f.getSeconds()),o.onChange(Math.floor(c.getTime()/1e3))}},disabled:c=>c{const c=new Date;c.setHours(23,59,59,999),o.onChange(Math.floor(c.getTime()/1e3))},className:"h-6 px-2 text-xs",children:s("edit.form.expire_time_today")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{type:"datetime-local",step:"1",value:oe(o.value,"YYYY-MM-DDTHH:mm:ss"),onChange:c=>{const f=new Date(c.target.value);isNaN(f.getTime())||o.onChange(Math.floor(f.getTime()/1e3))},className:"flex-1"}),e.jsx(F,{type:"button",variant:"outline",onClick:()=>l(!1),children:s("edit.form.expire_time_confirm")})]})]})]})})]}),e.jsx(P,{})]})}),e.jsx(v,{control:m.control,name:"plan_id",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.subscription")}),e.jsx(y,{children:e.jsxs(J,{value:o.value!==null?String(o.value):"null",onValueChange:c=>o.onChange(c==="null"?null:parseInt(c)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"null",children:s("edit.form.subscription_none")}),d.map(c=>e.jsx(A,{value:String(c.id),children:c.name},c.id))]})]})})]})}),e.jsx(v,{control:m.control,name:"banned",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.account_status")}),e.jsx(y,{children:e.jsxs(J,{value:o.value.toString(),onValueChange:c=>o.onChange(c==="true"),children:[e.jsx(W,{children:e.jsx(Q,{})}),e.jsxs(Y,{children:[e.jsx(A,{value:"true",children:s("columns.status_text.banned")}),e.jsx(A,{value:"false",children:s("columns.status_text.normal")})]})]})})]})}),e.jsx(v,{control:m.control,name:"commission_type",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.commission_type")}),e.jsx(y,{children:e.jsxs(J,{value:o.value.toString(),onValueChange:c=>o.onChange(parseInt(c)),children:[e.jsx(W,{children:e.jsx(Q,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"0",children:s("edit.form.commission_type_system")}),e.jsx(A,{value:"1",children:s("edit.form.commission_type_cycle")}),e.jsx(A,{value:"2",children:s("edit.form.commission_type_onetime")})]})]})})]})}),e.jsx(v,{control:m.control,name:"commission_rate",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.commission_rate")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:o.value||"",onChange:c=>o.onChange(parseInt(c.currentTarget.value)||null),placeholder:s("edit.form.commission_rate_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})})]})}),e.jsx(v,{control:m.control,name:"discount",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.discount")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:o.value||"",onChange:c=>o.onChange(parseInt(c.currentTarget.value)||null),placeholder:s("edit.form.discount_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})}),e.jsx(P,{})]})}),e.jsx(v,{control:m.control,name:"speed_limit",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.speed_limit")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:o.value||"",onChange:c=>o.onChange(parseInt(c.currentTarget.value)||null),placeholder:s("edit.form.speed_limit_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"Mbps"})]})}),e.jsx(P,{})]})}),e.jsx(v,{control:m.control,name:"device_limit",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.device_limit")}),e.jsx(y,{children:e.jsxs("div",{className:"flex",children:[e.jsx(k,{type:"number",value:o.value||"",onChange:c=>o.onChange(parseInt(c.currentTarget.value)||null),placeholder:s("edit.form.device_limit_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"台"})]})}),e.jsx(P,{})]})}),e.jsx(v,{control:m.control,name:"is_admin",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.is_admin")}),e.jsx("div",{className:"py-2",children:e.jsx(y,{children:e.jsx(X,{checked:o.value,onCheckedChange:c=>o.onChange(c)})})}),e.jsx(P,{})]})}),e.jsx(v,{control:m.control,name:"is_staff",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.is_staff")}),e.jsx("div",{className:"py-2",children:e.jsx(y,{children:e.jsx(X,{checked:o.value,onCheckedChange:c=>o.onChange(c)})})})]})}),e.jsx(v,{control:m.control,name:"remarks",render:({field:o})=>e.jsxs(j,{children:[e.jsx(b,{children:s("edit.form.remarks")}),e.jsx(y,{children:e.jsx(Es,{className:"h-24",value:o.value||"",onChange:c=>o.onChange(c.currentTarget.value??null),placeholder:s("edit.form.remarks_placeholder")})}),e.jsx(P,{})]})}),e.jsxs(Ri,{children:[e.jsx(F,{variant:"outline",onClick:()=>t(!1),children:s("edit.form.cancel")}),e.jsx(F,{type:"submit",onClick:()=>{m.handleSubmit(o=>{const c={id:o.id};m.formState.dirtyFields.u&&(c.u=Math.round(parseFloat(o.u)*1024*1024*1024)),m.formState.dirtyFields.d&&(c.d=Math.round(parseFloat(o.d)*1024*1024*1024)),Object.keys(o).forEach(f=>{f!=="u"&&f!=="d"&&f!=="id"&&m.formState.dirtyFields[f]&&(c[f]=o[f])}),qs.update(c).then(({data:f})=>{f&&(z.success(s("edit.form.success")),t(!1),a())})})()},children:s("edit.form.submit")})]})]})]})})}function Pg(){const[s]=Vl(),[n,t]=u.useState({}),[r,a]=u.useState({is_admin:!1,is_staff:!1}),[i,l]=u.useState([]),[d,x]=u.useState([]),[m,o]=u.useState({pageIndex:0,pageSize:20});u.useEffect(()=>{const g=s.get("email");g&&l(p=>p.some(R=>R.id==="email")?p:[...p,{id:"email",value:g}])},[s]);const{refetch:c,data:f,isLoading:D}=re({queryKey:["userList",m,i,d],queryFn:()=>qs.getList({pageSize:m.pageSize,current:m.pageIndex+1,filter:i,sort:d})}),[S,C]=u.useState([]),[T,w]=u.useState([]);u.useEffect(()=>{jt.getList().then(({data:g})=>{C(g)}),ys.getList().then(({data:g})=>{w(g)})},[]);const E=S.map(g=>({label:g.name,value:g.id})),_=T.map(g=>({label:g.name,value:g.id}));return e.jsxs(Oi,{refreshData:c,children:[e.jsx(Lg,{data:f?.data??[],rowCount:f?.total??0,sorting:d,setSorting:x,columnVisibility:r,setColumnVisibility:a,rowSelection:n,setRowSelection:t,columnFilters:i,setColumnFilters:l,pagination:m,setPagination:o,refetch:c,serverGroupList:S,permissionGroups:E,subscriptionPlans:_,isLoading:D}),e.jsx(zi,{})]})}function Lg({data:s,rowCount:n,sorting:t,setSorting:r,columnVisibility:a,setColumnVisibility:i,rowSelection:l,setRowSelection:d,columnFilters:x,setColumnFilters:m,pagination:o,setPagination:c,refetch:f,serverGroupList:D,permissionGroups:S,subscriptionPlans:C,isLoading:T}){const{setIsOpen:w,setEditingUser:E}=Wn(),_=Be({data:s,columns:Dg(f,D,E,w),state:{sorting:t,columnVisibility:a,rowSelection:l,columnFilters:x,pagination:o},rowCount:n,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:d,onSortingChange:r,onColumnFiltersChange:m,onColumnVisibilityChange:i,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),onPaginationChange:c,getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnVisibility:{commission_balance:!1,created_at:!1,is_admin:!1,is_staff:!1,permission_group:!1,plan_id:!1},columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(fg,{table:_,refetch:f,serverGroupList:D,permissionGroups:S,subscriptionPlans:C}),e.jsx(ts,{table:_,isLoading:T})]})}function Rg(){const{t:s}=M("user");return e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("manage.title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("manage.description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx("div",{className:"w-full",children:e.jsx(Pg,{})})})]})]})}const Eg=Object.freeze(Object.defineProperty({__proto__:null,default:Rg},Symbol.toStringTag,{value:"Module"})),Vg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11H5a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})});function Ig({table:s}){const{t:n}=M("ticket");return e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-4",children:[e.jsx(ft,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:t=>s.getColumn("status")?.setFilterValue(t),children:e.jsxs(lt,{className:"grid w-full grid-cols-2",children:[e.jsx(Ke,{value:"0",children:n("status.pending")}),e.jsx(Ke,{value:"1",children:n("status.closed")})]})}),s.getColumn("level")&&e.jsx(Ea,{column:s.getColumn("level"),title:n("columns.level"),options:[{label:n("level.low"),value:ms.LOW,icon:Vg,color:"gray"},{label:n("level.medium"),value:ms.MIDDLE,icon:Ei,color:"yellow"},{label:n("level.high"),value:ms.HIGH,icon:Vi,color:"red"}]})]})})}function Mg(){return e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground",children:[e.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}const Og=gt("flex gap-2 max-w-[60%] items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),$i=u.forwardRef(({className:s,variant:n,layout:t,children:r,...a},i)=>e.jsx("div",{className:N(Og({variant:n,layout:t,className:s}),"relative group"),ref:i,...a,children:u.Children.map(r,l=>u.isValidElement(l)&&typeof l.type!="string"?u.cloneElement(l,{variant:n,layout:t}):l)}));$i.displayName="ChatBubble";const zg=gt("p-4",{variants:{variant:{received:"bg-secondary text-secondary-foreground rounded-r-lg rounded-tl-lg",sent:"bg-primary text-primary-foreground rounded-l-lg rounded-tr-lg"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),Ai=u.forwardRef(({className:s,variant:n,layout:t,isLoading:r=!1,children:a,...i},l)=>e.jsx("div",{className:N(zg({variant:n,layout:t,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:l,...i,children:r?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(Mg,{})}):a}));Ai.displayName="ChatBubbleMessage";const $g=u.forwardRef(({variant:s,className:n,children:t,...r},a)=>e.jsx("div",{ref:a,className:N("absolute top-1/2 -translate-y-1/2 flex opacity-0 group-hover:opacity-100 transition-opacity duration-200",s==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",n),...r,children:t}));$g.displayName="ChatBubbleActionWrapper";const qi=u.forwardRef(({className:s,...n},t)=>e.jsx(Es,{autoComplete:"off",ref:t,name:"message",className:N("max-h-12 px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",s),...n}));qi.displayName="ChatInput";const Hi=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29l-4.3 4.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l4.29-4.3l4.29 4.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42Z"})}),Ui=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.098 12.634L13 11.423V7a1 1 0 0 0-2 0v5a1 1 0 0 0 .5.866l2.598 1.5a1 1 0 1 0 1-1.732M12 2a10 10 0 1 0 10 10A10.01 10.01 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8.01 8.01 0 0 1-8 8"})}),kr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m11.29 12l3.54-3.54a1 1 0 0 0 0-1.41a1 1 0 0 0-1.42 0l-4.24 4.24a1 1 0 0 0 0 1.42L13.41 17a1 1 0 0 0 .71.29a1 1 0 0 0 .71-.29a1 1 0 0 0 0-1.41Z"})}),Ag=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21.71 20.29L18 16.61A9 9 0 1 0 16.61 18l3.68 3.68a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.39M11 18a7 7 0 1 1 7-7a7 7 0 0 1-7 7"})}),qg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M3.71 16.29a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21a1 1 0 0 0-.21.33a1 1 0 0 0 .21 1.09a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1 1 0 0 0 .21-1.09a1 1 0 0 0-.21-.33M7 8h14a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2m-3.29 3.29a1 1 0 0 0-1.09-.21a1.2 1.2 0 0 0-.33.21a1 1 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1 1 0 0 0-.21-.33M21 11H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2M3.71 6.29a1 1 0 0 0-.33-.21a1 1 0 0 0-1.09.21a1.2 1.2 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a1 1 0 0 0 1.09-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1.2 1.2 0 0 0-.21-.33M21 16H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})}),Hg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9 12H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m-1-2h4a1 1 0 0 0 0-2H8a1 1 0 0 0 0 2m1 6H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m12-4h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Zm-6.44-2.83a.8.8 0 0 0-.18-.09a.6.6 0 0 0-.19-.06a1 1 0 0 0-.9.27A1.05 1.05 0 0 0 12 17a1 1 0 0 0 .07.38a1.2 1.2 0 0 0 .22.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21A1 1 0 0 0 14 17a1.05 1.05 0 0 0-.29-.71a2 2 0 0 0-.15-.12m.14-3.88a1 1 0 0 0-1.62.33A1 1 0 0 0 13 14a1 1 0 0 0 1-1a1 1 0 0 0-.08-.38a.9.9 0 0 0-.22-.33"})});function Ug(){return e.jsxs("div",{className:"flex h-full flex-col space-y-4 p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(be,{className:"h-8 w-3/4"}),e.jsx(be,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(be,{className:"h-20 w-2/3"},s))})]})}function Kg(){return e.jsx("div",{className:"space-y-4 p-4",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(be,{className:"h-5 w-4/5"}),e.jsx(be,{className:"h-4 w-2/3"}),e.jsx(be,{className:"h-3 w-1/2"})]},s))})}function Bg({ticket:s,isActive:n,onClick:t}){const{t:r}=M("ticket"),a=i=>{switch(i){case ms.HIGH:return"bg-red-50 text-red-600 border-red-200";case ms.MIDDLE:return"bg-yellow-50 text-yellow-600 border-yellow-200";case ms.LOW:return"bg-green-50 text-green-600 border-green-200";default:return"bg-gray-50 text-gray-600 border-gray-200"}};return e.jsxs("div",{className:N("flex cursor-pointer flex-col border-b p-4 hover:bg-accent/50",n&&"bg-accent"),onClick:t,children:[e.jsxs("div",{className:"flex max-w-[280px] items-center justify-between gap-2",children:[e.jsx("h4",{className:"flex-1 truncate font-medium",children:s.subject}),e.jsx(q,{variant:s.status===st.CLOSED?"secondary":"default",className:"shrink-0",children:s.status===st.CLOSED?r("status.closed"):r("status.processing")})]}),e.jsx("div",{className:"mt-1 max-w-[280px] truncate text-sm text-muted-foreground",children:s.user?.email}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[e.jsx("time",{className:"text-muted-foreground",children:oe(s.updated_at)}),e.jsx("div",{className:N("rounded-full border px-2 py-0.5 text-xs font-medium",a(s.level)),children:r(`level.${s.level===ms.LOW?"low":s.level===ms.MIDDLE?"medium":"high"}`)})]})]})}function Gg({ticketId:s,dialogTrigger:n}){const{t}=M("ticket"),r=Gs(),a=u.useRef(null),i=u.useRef(null),[l,d]=u.useState(!1),[x,m]=u.useState(""),[o,c]=u.useState(!1),[f,D]=u.useState(s),[S,C]=u.useState(""),[T,w]=u.useState(!1),{setIsOpen:E,setEditingUser:_}=Wn(),{data:g,isLoading:p,refetch:V}=re({queryKey:["tickets",l],queryFn:()=>l?Ft.getList({filter:[{id:"status",value:[st.OPENING]}]}):Promise.resolve(null),enabled:l}),{data:R,refetch:L,isLoading:K}=re({queryKey:["ticket",f,l],queryFn:()=>l?Ft.getInfo(f):Promise.resolve(null),refetchInterval:l?5e3:!1,retry:3}),Z=R?.data,ae=(g?.data||[]).filter(le=>le.subject.toLowerCase().includes(S.toLowerCase())||le.user?.email.toLowerCase().includes(S.toLowerCase())),H=(le="smooth")=>{if(a.current){const{scrollHeight:Ts,clientHeight:Ns}=a.current;a.current.scrollTo({top:Ts-Ns,behavior:le})}};u.useEffect(()=>{if(!l)return;const le=requestAnimationFrame(()=>{H("instant"),setTimeout(()=>H(),1e3)});return()=>{cancelAnimationFrame(le)}},[l,Z?.messages]);const ee=async()=>{const le=x.trim();!le||o||(c(!0),Ft.reply({id:f,message:le}).then(()=>{m(""),L(),H(),setTimeout(()=>{i.current?.focus()},0)}).finally(()=>{c(!1)}))},je=async()=>{Ft.close(f).then(()=>{z.success(t("actions.close_success")),L(),V()})},ds=()=>{Z?.user&&r("/finance/order?user_id="+Z.user.id)},Me=Z?.status===st.CLOSED;return e.jsxs(me,{open:l,onOpenChange:d,children:[e.jsx(ps,{asChild:!0,children:n??e.jsx(G,{variant:"outline",children:t("actions.view_ticket")})}),e.jsxs(ce,{className:"flex h-[90vh] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(ue,{}),e.jsxs("div",{className:"flex h-full",children:[e.jsx(G,{variant:"ghost",size:"icon",className:"absolute left-2 top-2 z-50 md:hidden",onClick:()=>w(!T),children:e.jsx(kr,{className:N("h-4 w-4 transition-transform",!T&&"rotate-180")})}),e.jsxs("div",{className:N("absolute inset-y-0 left-0 z-40 flex flex-col border-r bg-background transition-transform duration-200 ease-in-out md:relative",T?"-translate-x-full":"translate-x-0","w-80 md:w-80 md:translate-x-0"),children:[e.jsxs("div",{className:"space-y-4 border-b p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-semibold",children:t("list.title")}),e.jsx(G,{variant:"ghost",size:"icon",className:"hidden h-8 w-8 md:flex",onClick:()=>w(!T),children:e.jsx(kr,{className:N("h-4 w-4 transition-transform",!T&&"rotate-180")})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ag,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 transform text-muted-foreground"}),e.jsx(k,{placeholder:t("list.search_placeholder"),value:S,onChange:le=>C(le.target.value),className:"pl-8"})]})]}),e.jsx(ht,{className:"flex-1",children:e.jsx("div",{className:"w-full",children:p?e.jsx(Kg,{}):ae.length===0?e.jsx("div",{className:"flex h-full items-center justify-center p-4 text-muted-foreground",children:t(S?"list.no_search_results":"list.no_tickets")}):ae.map(le=>e.jsx(Bg,{ticket:le,isActive:le.id===f,onClick:()=>{D(le.id),window.innerWidth<768&&w(!0)}},le.id))})})]}),e.jsxs("div",{className:"relative flex flex-1 flex-col",children:[!T&&e.jsx("div",{className:"absolute inset-0 z-30 bg-black/20 md:hidden",onClick:()=>w(!0)}),K?e.jsx(Ug,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col space-y-4 border-b p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:Z?.subject}),e.jsx(q,{variant:Me?"secondary":"default",children:t(Me?"status.closed":"status.processing")}),!Me&&e.jsx(_s,{title:t("actions.close_confirm_title"),description:t("actions.close_confirm_description"),confirmText:t("actions.close_confirm_button"),variant:"destructive",onConfirm:je,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(Hi,{className:"h-4 w-4"}),t("actions.close_ticket")]})})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(Ra,{className:"h-4 w-4"}),e.jsx("span",{children:Z?.user?.email})]}),e.jsx(Ee,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(Ui,{className:"h-4 w-4"}),e.jsxs("span",{children:[t("detail.created_at")," ",oe(Z?.created_at)]})]}),e.jsx(Ee,{orientation:"vertical",className:"h-4"}),e.jsx(q,{variant:"outline",children:Z?.level!=null&&t(`level.${Z.level===ms.LOW?"low":Z.level===ms.MIDDLE?"medium":"high"}`)})]})]}),Z?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.user_info"),onClick:()=>{_(Z.user),E(!0)},children:e.jsx(Ra,{className:"h-4 w-4"})}),e.jsx(Ii,{user_id:Z.user.id,dialogTrigger:e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.traffic_records"),children:e.jsx(qg,{className:"h-4 w-4"})})}),e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.order_records"),onClick:ds,children:e.jsx(Hg,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:a,className:"h-full space-y-4 overflow-y-auto p-6",children:Z?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t("detail.no_messages")}):Z?.messages?.map(le=>e.jsx($i,{variant:le.is_from_admin?"sent":"received",className:le.is_from_admin?"ml-auto":"mr-auto",children:e.jsx(Ai,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:le.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:oe(le.created_at)})})]})})},le.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(qi,{ref:i,disabled:Me||o,placeholder:t(Me?"detail.input.closed_placeholder":"detail.input.reply_placeholder"),className:"flex-1 resize-none rounded-lg border bg-background p-3 focus-visible:ring-1",value:x,onChange:le=>m(le.target.value),onKeyDown:le=>{le.key==="Enter"&&!le.shiftKey&&(le.preventDefault(),ee())}}),e.jsx(G,{disabled:Me||o||!x.trim(),onClick:ee,children:t(o?"detail.input.sending":"detail.input.send")})]})})]})]})]})]})]})}const Wg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 4H5a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3m-.41 2l-5.88 5.88a1 1 0 0 1-1.42 0L5.41 6ZM20 17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7.41l5.88 5.88a3 3 0 0 0 4.24 0L20 7.41Z"})}),Yg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21.92 11.6C19.9 6.91 16.1 4 12 4s-7.9 2.91-9.92 7.6a1 1 0 0 0 0 .8C4.1 17.09 7.9 20 12 20s7.9-2.91 9.92-7.6a1 1 0 0 0 0-.8M12 18c-3.17 0-6.17-2.29-7.9-6C5.83 8.29 8.83 6 12 6s6.17 2.29 7.9 6c-1.73 3.71-4.73 6-7.9 6m0-10a4 4 0 1 0 4 4a4 4 0 0 0-4-4m0 6a2 2 0 1 1 2-2a2 2 0 0 1-2 2"})}),Jg=s=>{const{t:n}=M("ticket");return[{accessorKey:"id",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.id")}),cell:({row:t})=>e.jsx(q,{variant:"outline",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.subject")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Wg,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"max-w-[500px] truncate font-medium",children:t.getValue("subject")})]}),enableSorting:!1,enableHiding:!1,size:4e3},{accessorKey:"level",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.level")}),cell:({row:t})=>{const r=t.getValue("level"),a=r===ms.LOW?"default":r===ms.MIDDLE?"secondary":"destructive";return e.jsx(q,{variant:a,className:"whitespace-nowrap",children:n(`level.${r===ms.LOW?"low":r===ms.MIDDLE?"medium":"high"}`)})},filterFn:(t,r,a)=>a.includes(t.getValue(r))},{accessorKey:"status",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.status")}),cell:({row:t})=>{const r=t.getValue("status"),a=t.original.reply_status,i=r===st.CLOSED?n("status.closed"):n(a===0?"status.replied":"status.pending"),l=r===st.CLOSED?"default":a===0?"secondary":"destructive";return e.jsx(q,{variant:l,className:"whitespace-nowrap",children:i})}},{accessorKey:"updated_at",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.updated_at")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(Ui,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:oe(t.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(O,{column:t,title:n("columns.created_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:oe(t.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:t})=>e.jsx(O,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>{const r=t.original.status!==st.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Gg,{ticketId:t.original.id,dialogTrigger:e.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.view_details"),children:e.jsx(Yg,{className:"h-4 w-4"})})}),r&&e.jsx(_s,{title:n("actions.close_confirm_title"),description:n("actions.close_confirm_description"),confirmText:n("actions.close_confirm_button"),variant:"destructive",onConfirm:async()=>{Ft.close(t.original.id).then(()=>{z.success(n("actions.close_success")),s()})},children:e.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.close_ticket"),children:e.jsx(Hi,{className:"h-4 w-4"})})})]})}}]};function Qg(){const[s,n]=u.useState({}),[t,r]=u.useState({}),[a,i]=u.useState([{id:"status",value:"0"}]),[l,d]=u.useState([]),[x,m]=u.useState({pageIndex:0,pageSize:20}),{refetch:o,data:c}=re({queryKey:["orderList",x,a,l],queryFn:()=>Ft.getList({pageSize:x.pageSize,current:x.pageIndex+1,filter:a,sort:l})}),f=Be({data:c?.data??[],columns:Jg(o),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:x},rowCount:c?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:i,onColumnVisibilityChange:r,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),onPaginationChange:m,getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ig,{table:f,refetch:o}),e.jsx(ts,{table:f,showPagination:!0})]})}function Xg(){const{t:s}=M("ticket");return e.jsxs(Oi,{refreshData:()=>{},children:[e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx(cs,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Qg,{})})]})]}),e.jsx(zi,{})]})}const Zg=Object.freeze(Object.defineProperty({__proto__:null,default:Xg},Symbol.toStringTag,{value:"Module"}));function ep({table:s,refetch:n}){const{t}=M("user"),r=s.getState().columnFilters.length>0,[a,i]=u.useState(),[l,d]=u.useState(),[x,m]=u.useState(!1),o=[{value:"monthly",label:t("traffic_reset_logs.filters.reset_types.monthly")},{value:"first_day_month",label:t("traffic_reset_logs.filters.reset_types.first_day_month")},{value:"yearly",label:t("traffic_reset_logs.filters.reset_types.yearly")},{value:"first_day_year",label:t("traffic_reset_logs.filters.reset_types.first_day_year")},{value:"manual",label:t("traffic_reset_logs.filters.reset_types.manual")}],c=[{value:"auto",label:t("traffic_reset_logs.filters.trigger_sources.auto")},{value:"manual",label:t("traffic_reset_logs.filters.trigger_sources.manual")},{value:"cron",label:t("traffic_reset_logs.filters.trigger_sources.cron")}],f=()=>{let T=s.getState().columnFilters.filter(w=>w.id!=="date_range");(a||l)&&T.push({id:"date_range",value:{start:a?Le(a,"yyyy-MM-dd"):null,end:l?Le(l,"yyyy-MM-dd"):null}}),s.setColumnFilters(T)},D=async()=>{try{m(!0);const T=s.getState().columnFilters.reduce((L,K)=>{if(K.value)if(K.id==="date_range"){const Z=K.value;Z.start&&(L.start_date=Z.start),Z.end&&(L.end_date=Z.end)}else L[K.id]=K.value;return L},{}),E=(await na.getLogs({...T,page:1,per_page:1e4})).data.map(L=>({ID:L.id,用户邮箱:L.user_email,用户ID:L.user_id,重置类型:L.reset_type_name,触发源:L.trigger_source_name,清零流量:L.old_traffic.formatted,"上传流量(GB)":(L.old_traffic.upload/1024**3).toFixed(2),"下载流量(GB)":(L.old_traffic.download/1024**3).toFixed(2),重置时间:Le(new Date(L.reset_time),"yyyy-MM-dd HH:mm:ss"),记录时间:Le(new Date(L.created_at),"yyyy-MM-dd HH:mm:ss"),原因:L.reason||""})),_=Object.keys(E[0]||{}),g=[_.join(","),...E.map(L=>_.map(K=>{const Z=L[K];return typeof Z=="string"&&Z.includes(",")?`"${Z}"`:Z}).join(","))].join(` -`),p=new Blob([g],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a"),R=URL.createObjectURL(p);V.setAttribute("href",R),V.setAttribute("download",`traffic-reset-logs-${Le(new Date,"yyyy-MM-dd")}.csv`),V.style.visibility="hidden",document.body.appendChild(V),V.click(),document.body.removeChild(V),z.success(t("traffic_reset_logs.actions.export_success"))}catch(C){console.error("导出失败:",C),z.error(t("traffic_reset_logs.actions.export_failed"))}finally{m(!1)}},S=()=>e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.search_user")}),e.jsx(k,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:C=>s.getColumn("user_email")?.setFilterValue(C.target.value),className:"h-9"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.reset_type")}),e.jsxs(J,{value:s.getColumn("reset_type")?.getFilterValue()??"",onValueChange:C=>s.getColumn("reset_type")?.setFilterValue(C==="all"?"":C),children:[e.jsx(W,{className:"h-9",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.reset_type")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"all",children:t("traffic_reset_logs.filters.all_types")}),o.map(C=>e.jsx(A,{value:C.value,children:C.label},C.value))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.trigger_source")}),e.jsxs(J,{value:s.getColumn("trigger_source")?.getFilterValue()??"",onValueChange:C=>s.getColumn("trigger_source")?.setFilterValue(C==="all"?"":C),children:[e.jsx(W,{className:"h-9",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.trigger_source")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"all",children:t("traffic_reset_logs.filters.all_sources")}),c.map(C=>e.jsx(A,{value:C.value,children:C.label},C.value))]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.start_date")}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",className:N("h-9 w-full justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),a?Le(a,"MM-dd"):t("traffic_reset_logs.filters.start_date")]})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:a,onSelect:i,initialFocus:!0})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.end_date")}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",className:N("h-9 w-full justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),l?Le(l,"MM-dd"):t("traffic_reset_logs.filters.end_date")]})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:l,onSelect:d,initialFocus:!0})})]})]})]}),(a||l)&&e.jsxs(F,{variant:"outline",className:"w-full",onClick:f,children:[e.jsx(cr,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.apply_date")]}),r&&e.jsxs(F,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),i(void 0),d(void 0)},className:"w-full",children:[t("traffic_reset_logs.filters.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between md:hidden",children:[e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(Gn,{children:[e.jsx(Pi,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:"h-8",children:[e.jsx(Dd,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.reset_type"),r&&e.jsx("div",{className:"ml-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:s.getState().columnFilters.length})]})}),e.jsxs(en,{side:"bottom",className:"h-[85vh]",children:[e.jsxs(sn,{className:"mb-4",children:[e.jsx(tn,{children:t("traffic_reset_logs.filters.filter_title")}),e.jsx(an,{children:t("traffic_reset_logs.filters.filter_description")})]}),e.jsx("div",{className:"max-h-[calc(85vh-120px)] overflow-y-auto",children:e.jsx(S,{})})]})]})}),e.jsxs(F,{variant:"outline",size:"sm",className:"h-8",onClick:D,disabled:x,children:[e.jsx(sa,{className:"mr-2 h-4 w-4"}),t(x?"traffic_reset_logs.actions.exporting":"traffic_reset_logs.actions.export")]})]}),e.jsxs("div",{className:"hidden items-center justify-between md:flex",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(k,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:C=>s.getColumn("user_email")?.setFilterValue(C.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(J,{value:s.getColumn("reset_type")?.getFilterValue()??"",onValueChange:C=>s.getColumn("reset_type")?.setFilterValue(C==="all"?"":C),children:[e.jsx(W,{className:"h-8 w-[180px]",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.reset_type")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"all",children:t("traffic_reset_logs.filters.all_types")}),o.map(C=>e.jsx(A,{value:C.value,children:C.label},C.value))]})]}),e.jsxs(J,{value:s.getColumn("trigger_source")?.getFilterValue()??"",onValueChange:C=>s.getColumn("trigger_source")?.setFilterValue(C==="all"?"":C),children:[e.jsx(W,{className:"h-8 w-[180px]",children:e.jsx(Q,{placeholder:t("traffic_reset_logs.filters.trigger_source")})}),e.jsxs(Y,{children:[e.jsx(A,{value:"all",children:t("traffic_reset_logs.filters.all_sources")}),c.map(C=>e.jsx(A,{value:C.value,children:C.label},C.value))]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:N("h-8 w-[140px] justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),a?Le(a,"yyyy-MM-dd"):t("traffic_reset_logs.filters.start_date")]})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:a,onSelect:i,initialFocus:!0})})]}),e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",className:N("h-8 w-[140px] justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),l?Le(l,"yyyy-MM-dd"):t("traffic_reset_logs.filters.end_date")]})}),e.jsx(Xe,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:l,onSelect:d,initialFocus:!0})})]}),(a||l)&&e.jsxs(F,{variant:"outline",size:"sm",className:"h-8",onClick:f,children:[e.jsx(cr,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.apply_date")]})]}),r&&e.jsxs(F,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),i(void 0),d(void 0)},className:"h-8 px-2 lg:px-3",children:[t("traffic_reset_logs.filters.reset"),e.jsx(os,{className:"ml-2 h-4 w-4"})]})]}),e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(F,{variant:"outline",size:"sm",className:"h-8 border-dashed",onClick:D,disabled:x,children:[e.jsx(sa,{className:"mr-2 h-4 w-4"}),t(x?"traffic_reset_logs.actions.exporting":"traffic_reset_logs.actions.export")]})})]})]})}const sp=()=>{const{t:s}=M("user"),n=a=>{switch(a){case"manual":return"bg-blue-100 text-blue-800 border-blue-200";case"monthly":return"bg-green-100 text-green-800 border-green-200";case"yearly":return"bg-purple-100 text-purple-800 border-purple-200";case"first_day_month":return"bg-orange-100 text-orange-800 border-orange-200";case"first_day_year":return"bg-indigo-100 text-indigo-800 border-indigo-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},t=a=>{switch(a){case"manual":return"bg-orange-100 text-orange-800 border-orange-200";case"cron":return"bg-indigo-100 text-indigo-800 border-indigo-200";case"auto":return"bg-emerald-100 text-emerald-800 border-emerald-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},r=a=>{switch(a){case"manual":return e.jsx(ka,{className:"h-3 w-3"});case"cron":return e.jsx(Pd,{className:"h-3 w-3"});case"auto":return e.jsx(Fd,{className:"h-3 w-3"});default:return e.jsx(ka,{className:"h-3 w-3"})}};return[{accessorKey:"id",header:({column:a})=>e.jsx(O,{column:a,title:s("traffic_reset_logs.columns.id"),className:"w-[60px]"}),cell:({row:a})=>e.jsx("div",{className:"w-[60px]",children:e.jsx(q,{variant:"outline",className:"text-xs",children:a.original.id})}),enableSorting:!0,enableHiding:!0,size:60},{accessorKey:"user_email",header:({column:a})=>e.jsx(O,{column:a,title:s("traffic_reset_logs.columns.user"),className:"min-w-[200px]"}),cell:({row:a})=>e.jsxs("div",{className:"flex min-w-[200px] items-start gap-2",children:[e.jsx(Ol,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:a.original.user_email}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["ID: ",a.original.user_id]})]})]}),enableSorting:!1,enableHiding:!1,size:100},{accessorKey:"trigger_source",header:({column:a})=>e.jsx(O,{column:a,title:s("traffic_reset_logs.columns.trigger_source"),className:"w-[120px]"}),cell:({row:a})=>e.jsx("div",{className:"w-[120px]",children:e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsx("div",{className:"cursor-pointer",children:e.jsxs(q,{variant:"outline",className:N("flex items-center gap-1.5 border text-xs",t(a.original.trigger_source)),children:[r(a.original.trigger_source),e.jsx("span",{className:"truncate",children:a.original.trigger_source_name})]})})}),e.jsx(de,{side:"bottom",className:"max-w-[200px]",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm font-medium",children:a.original.trigger_source_name}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[a.original.trigger_source==="manual"&&s("traffic_reset_logs.trigger_descriptions.manual"),a.original.trigger_source==="cron"&&s("traffic_reset_logs.trigger_descriptions.cron"),a.original.trigger_source==="auto"&&s("traffic_reset_logs.trigger_descriptions.auto"),!["manual","cron","auto"].includes(a.original.trigger_source)&&s("traffic_reset_logs.trigger_descriptions.other")]})]})})]})})}),enableSorting:!0,enableHiding:!1,filterFn:(a,i,l)=>l.includes(a.getValue(i)),size:120},{accessorKey:"reset_type",header:({column:a})=>e.jsx(O,{column:a,title:s("traffic_reset_logs.columns.reset_type"),className:"w-[120px]"}),cell:({row:a})=>e.jsx("div",{className:"w-[120px]",children:e.jsx(q,{className:N("border text-xs",n(a.original.reset_type)),children:e.jsx("span",{className:"truncate",children:a.original.reset_type_name})})}),enableSorting:!0,enableHiding:!1,filterFn:(a,i,l)=>l.includes(a.getValue(i)),size:120},{accessorKey:"old_traffic",header:({column:a})=>e.jsx(O,{column:a,title:s("traffic_reset_logs.columns.cleared_traffic"),className:"w-[120px]"}),cell:({row:a})=>{const i=a.original.old_traffic;return e.jsx("div",{className:"w-[120px]",children:e.jsx(fe,{delayDuration:100,children:e.jsxs(xe,{children:[e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"cursor-pointer text-center",children:[e.jsx("div",{className:"text-sm font-medium text-destructive",children:i.formatted}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("traffic_reset_logs.columns.cleared")})]})}),e.jsxs(de,{side:"bottom",className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Lt,{className:"h-3 w-3"}),e.jsxs("span",{children:[s("traffic_reset_logs.columns.upload"),":"," ",(i.upload/1024**3).toFixed(2)," GB"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(sa,{className:"h-3 w-3"}),e.jsxs("span",{children:[s("traffic_reset_logs.columns.download"),":"," ",(i.download/1024**3).toFixed(2)," GB"]})]})]})]})})})},enableSorting:!1,enableHiding:!1,size:120},{accessorKey:"reset_time",header:({column:a})=>e.jsx(O,{column:a,title:s("traffic_reset_logs.columns.reset_time"),className:"w-[140px]"}),cell:({row:a})=>e.jsx("div",{className:"w-[140px]",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Yt,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium",children:oe(a.original.reset_time,"MM-DD")}),e.jsx("div",{className:"text-xs text-muted-foreground",children:oe(a.original.reset_time,"HH:mm")})]})]})}),enableSorting:!0,enableHiding:!0,size:140},{accessorKey:"created_at",header:({column:a})=>e.jsx(O,{column:a,title:s("traffic_reset_logs.columns.log_time"),className:"w-[140px]"}),cell:({row:a})=>e.jsx("div",{className:"w-[140px]",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(On,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium",children:oe(a.original.created_at,"YYYY-MM-DD")}),e.jsx("div",{className:"text-xs text-muted-foreground",children:oe(a.original.created_at,"H:m:s")})]})]})}),enableSorting:!0,enableHiding:!1,size:1400}]};function tp(){const[s,n]=u.useState({}),[t,r]=u.useState({reset_time:!1}),[a,i]=u.useState([]),[l,d]=u.useState([{id:"created_at",desc:!0}]),[x,m]=u.useState({pageIndex:0,pageSize:20}),o={page:x.pageIndex+1,per_page:x.pageSize,...a.reduce((S,C)=>{if(C.value)if(C.id==="date_range"){const T=C.value;T.start&&(S.start_date=T.start),T.end&&(S.end_date=T.end)}else S[C.id]=C.value;return S},{})},{refetch:c,data:f,isLoading:D}=re({queryKey:["trafficResetLogs",x,a,l],queryFn:()=>na.getLogs(o)});return e.jsx(ap,{data:f?.data??[],rowCount:f?.total??0,sorting:l,setSorting:d,columnVisibility:t,setColumnVisibility:r,rowSelection:s,setRowSelection:n,columnFilters:a,setColumnFilters:i,pagination:x,setPagination:m,refetch:c,isLoading:D})}function ap({data:s,rowCount:n,sorting:t,setSorting:r,columnVisibility:a,setColumnVisibility:i,rowSelection:l,setRowSelection:d,columnFilters:x,setColumnFilters:m,pagination:o,setPagination:c,refetch:f,isLoading:D}){const S=Be({data:s,columns:sp(),state:{sorting:t,columnVisibility:a,rowSelection:l,columnFilters:x,pagination:o},rowCount:n,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:d,onSortingChange:r,onColumnFiltersChange:m,onColumnVisibilityChange:i,getCoreRowModel:Ge(),getFilteredRowModel:hs(),getPaginationRowModel:Ze(),onPaginationChange:c,getSortedRowModel:gs(),getFacetedRowModel:Ls(),getFacetedUniqueValues:Rs(),initialState:{columnVisibility:{reset_time:!1}}});return e.jsxs("div",{className:"h-full space-y-4",children:[e.jsx(ep,{table:S,refetch:f}),e.jsx(ts,{table:S,isLoading:D})]})}function np(){const{t:s}=M("user");return e.jsxs(Ae,{children:[e.jsxs(qe,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(cs,{})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(es,{}),e.jsx(ss,{})]})]}),e.jsxs(We,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-4 space-y-2 md:mb-2 md:flex md:items-center md:justify-between md:space-y-0",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-xl font-bold tracking-tight md:text-2xl",children:s("traffic_reset_logs.title")}),e.jsx("p",{className:"text-sm text-muted-foreground md:mt-2",children:s("traffic_reset_logs.description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-hidden px-4 py-1",children:e.jsx("div",{className:"h-full w-full",children:e.jsx(tp,{})})})]})]})}const rp=Object.freeze(Object.defineProperty({__proto__:null,default:np},Symbol.toStringTag,{value:"Module"}));export{Ne as _,mp as a,cp as c,dp as g,up as r}; +`):"",onChange:k=>{const te=k.target.value.split(` +`).filter(ae=>ae.trim()!=="");g.onChange(te)}})})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:d.control,name:"tls.server_name",render:({field:g})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:r("dynamic_form.anytls.tls.server_name.label","SNI")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dynamic_form.anytls.tls.server_name.placeholder","服务器名称"),...g})})]})}),e.jsx(j,{control:d.control,name:"tls.allow_insecure",render:({field:g})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dynamic_form.anytls.tls.allow_insecure","允许不安全连接")}),e.jsx("div",{className:"py-2 text-center",children:e.jsx(b,{children:e.jsx(ee,{checked:g.value,onCheckedChange:g.onChange})})})]})})]})]})})};return e.jsx(pe,{children:E[s]?.()})};function Hx(){const{t:s}=O("server"),n=h.object({start:h.string().min(1,s("form.dynamic_rate.start_time_error")),end:h.string().min(1,s("form.dynamic_rate.end_time_error")),rate:h.string().min(1,s("form.dynamic_rate.multiplier_error")).refine(E=>!isNaN(parseFloat(E))&&isFinite(Number(E)),{message:s("form.dynamic_rate.multiplier_error_numeric")}).refine(E=>parseFloat(E)>=0,{message:s("form.dynamic_rate.multiplier_error_gte_zero")})}),t=h.object({id:h.number().optional().nullable(),specific_key:h.string().optional().nullable(),code:h.string().optional(),show:h.boolean().optional().nullable(),name:h.string().min(1,s("form.name.error")),rate:h.string().min(1,s("form.rate.error")).refine(E=>!isNaN(parseFloat(E))&&isFinite(Number(E)),{message:s("form.rate.error_numeric")}).refine(E=>parseFloat(E)>=0,{message:s("form.rate.error_gte_zero")}),rate_time_enable:h.boolean().default(!1),rate_time_ranges:h.array(n).default([]),tags:h.array(h.string()).default([]),excludes:h.array(h.string()).default([]),ips:h.array(h.string()).default([]),group_ids:h.array(h.string()).default([]),host:h.string().min(1,s("form.host.error")),port:h.string().min(1,s("form.port.error")),server_port:h.string().min(1,s("form.server_port.error")),parent_id:h.string().default("0").nullable(),route_ids:h.array(h.string()).default([]),protocol_settings:h.record(h.any()).default({}).nullable()}),r={id:null,specific_key:null,code:"",show:!1,name:"",rate:"1",rate_time_enable:!1,rate_time_ranges:[],tags:[],excludes:[],ips:[],group_ids:[],host:"",port:"",server_port:"",parent_id:"0",route_ids:[],protocol_settings:null},{isOpen:a,setIsOpen:o,editingServer:l,setEditingServer:d,serverType:x,setServerType:u,refetch:i}=_i(),[c,p]=m.useState([]),[P,T]=m.useState([]),[C,F]=m.useState([]),w=Ne({resolver:ke(t),defaultValues:r,mode:"onChange"});m.useEffect(()=>{V()},[a]),m.useEffect(()=>{l?.type&&l.type!==x&&u(l.type)},[l,x,u]),m.useEffect(()=>{l?l.type===x&&w.reset({...r,...l}):w.reset({...r,protocol_settings:Ee[x].schema.parse({})})},[l,w,x]);const V=async()=>{if(!a)return;const[E,g,k]=await Promise.all([yt.getList(),Ua.getList(),gt.getList()]);p(E.data?.map(W=>({label:W.name,value:W.id.toString()}))||[]),T(g.data?.map(W=>({label:W.remarks,value:W.id.toString()}))||[]),F(k.data||[])},y=m.useMemo(()=>C?.filter(E=>(E.parent_id===0||E.parent_id===null)&&E.type===x&&E.id!==w.watch("id")),[x,C,w]),N=()=>e.jsxs(Us,{children:[e.jsx(Ks,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ke,{icon:"ion:add"}),e.jsx("div",{children:s("form.add_node")})]})}),e.jsx(As,{align:"start",children:e.jsx(pm,{children:Ds.map(({type:E,label:g})=>e.jsx(Ce,{onClick:()=>{u(E),o(!0)},className:"cursor-pointer",children:e.jsx(K,{variant:"outline",className:"text-white",style:{background:vs[E]},children:g})},E))})})]}),S=()=>{o(!1),d(null),w.reset(r)},M=async()=>{const E=w.getValues();(await gt.save({...E,type:x})).data&&(S(),$.success(s("form.success")),i())};return e.jsxs(de,{open:a,onOpenChange:S,children:[N(),e.jsxs(oe,{className:"sm:max-w-[425px]",children:[e.jsxs(ge,{children:[e.jsx(me,{children:s(l?"form.edit_node":"form.new_node")}),e.jsx(Ae,{})]}),e.jsxs(Te,{...w,children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{control:w.control,name:"name",render:({field:E})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:s("form.name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("form.name.placeholder"),...E})}),e.jsx(R,{})]})}),e.jsx(j,{control:w.control,name:"rate",render:({field:E})=>e.jsxs(f,{className:"flex-[1]",children:[e.jsx(v,{children:s("form.rate.label")}),e.jsx("div",{className:"relative flex",children:e.jsx(b,{children:e.jsx(D,{type:"number",min:"0",step:"0.1",...E})})}),e.jsx(R,{})]})})]}),e.jsx(j,{control:w.control,name:"rate_time_enable",render:({field:E})=>e.jsxs(f,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(v,{children:s("form.dynamic_rate.enable_label")}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("form.dynamic_rate.enable_description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:E.value,onCheckedChange:E.onChange})})]}),e.jsx(R,{})]})}),w.watch("rate_time_enable")&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(v,{className:"",children:s("form.dynamic_rate.rules_label")}),e.jsxs(L,{type:"button",variant:"outline",size:"sm",onClick:()=>{const E=w.getValues("rate_time_ranges")||[];w.setValue("rate_time_ranges",[...E,{start:"00:00",end:"23:59",rate:"1"}])},children:[e.jsx(Ke,{icon:"ion:add",className:"mr-1 size-4"}),s("form.dynamic_rate.add_rule")]})]}),(w.watch("rate_time_ranges")||[]).map((E,g)=>e.jsxs("div",{className:"space-y-2 rounded border p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:s("form.dynamic_rate.rule_title",{index:g+1})}),e.jsx(L,{type:"button",variant:"ghost",size:"sm",onClick:()=>{const k=w.getValues("rate_time_ranges")||[];k.splice(g,1),w.setValue("rate_time_ranges",[...k])},children:e.jsx(Ke,{icon:"ion:trash-outline",className:"size-4"})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(j,{control:w.control,name:`rate_time_ranges.${g}.start`,render:({field:k})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-xs",children:s("form.dynamic_rate.start_time")}),e.jsx(b,{children:e.jsx(D,{type:"time",...k,className:"text-sm"})}),e.jsx(R,{})]})}),e.jsx(j,{control:w.control,name:`rate_time_ranges.${g}.end`,render:({field:k})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-xs",children:s("form.dynamic_rate.end_time")}),e.jsx(b,{children:e.jsx(D,{type:"time",...k,className:"text-sm"})}),e.jsx(R,{})]})}),e.jsx(j,{control:w.control,name:`rate_time_ranges.${g}.rate`,render:({field:k})=>e.jsxs(f,{children:[e.jsx(v,{className:"text-xs",children:s("form.dynamic_rate.multiplier")}),e.jsx(b,{children:e.jsx(D,{type:"number",min:"0",step:"0.1",...k,className:"text-sm",placeholder:"1.0"})}),e.jsx(R,{})]})})]})]},g)),(w.watch("rate_time_ranges")||[]).length===0&&e.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:s("form.dynamic_rate.no_rules")})]}),e.jsx(j,{control:w.control,name:"code",render:({field:E})=>e.jsxs(f,{children:[e.jsxs(v,{children:[s("form.code.label"),e.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:s("form.code.optional")})]}),e.jsx(b,{children:e.jsx(D,{placeholder:s("form.code.placeholder"),...E,value:E.value||""})}),e.jsx(R,{})]})}),e.jsx(j,{control:w.control,name:"tags",render:({field:E})=>e.jsxs(f,{children:[e.jsx(v,{children:s("form.tags.label")}),e.jsx(b,{children:e.jsx(Za,{value:E.value,onChange:E.onChange,placeholder:s("form.tags.placeholder"),className:"w-full"})}),e.jsx(R,{})]})}),e.jsx(j,{control:w.control,name:"group_ids",render:({field:E})=>e.jsxs(f,{children:[e.jsxs(v,{className:"flex items-center justify-between",children:[s("form.groups.label"),e.jsx(en,{dialogTrigger:e.jsx(L,{variant:"link",children:s("form.groups.add")}),refetch:V})]}),e.jsx(b,{children:e.jsx(at,{options:c,onChange:g=>E.onChange(g.map(k=>k.value)),value:c?.filter(g=>E.value.includes(g.value)),placeholder:s("form.groups.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:s("form.groups.empty")})})}),e.jsx(R,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:w.control,name:"host",render:({field:E})=>e.jsxs(f,{children:[e.jsx(v,{children:s("form.host.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:s("form.host.placeholder"),...E})}),e.jsx(R,{})]})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(j,{control:w.control,name:"port",render:({field:E})=>e.jsxs(f,{className:"flex-1",children:[e.jsxs(v,{className:"flex items-center gap-1.5",children:[s("form.port.label"),e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(Ke,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Da,{children:e.jsx(ce,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:s("form.port.tooltip")})})})]})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(b,{children:e.jsx(D,{placeholder:s("form.port.placeholder"),...E})}),e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(L,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>{const g=E.value;g&&w.setValue("server_port",g)},children:e.jsx(Ke,{icon:"tabler:arrows-right",className:"size-3"})})}),e.jsx(ce,{side:"right",children:e.jsx("p",{children:s("form.port.sync")})})]})})]}),e.jsx(R,{})]})}),e.jsx(j,{control:w.control,name:"server_port",render:({field:E})=>e.jsxs(f,{className:"flex-1",children:[e.jsxs(v,{className:"flex items-center gap-1.5",children:[s("form.server_port.label"),e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(Ke,{icon:"ph:info-light",className:"size-3.5 cursor-help text-muted-foreground"})}),e.jsx(Da,{children:e.jsx(ce,{side:"top",sideOffset:8,className:"max-w-80 p-3",children:e.jsx("p",{children:s("form.server_port.tooltip")})})})]})})]}),e.jsx(b,{children:e.jsx(D,{placeholder:s("form.server_port.placeholder"),...E})}),e.jsx(R,{})]})})]})]}),a&&e.jsx(Ux,{serverType:x,value:w.watch("protocol_settings"),onChange:E=>w.setValue("protocol_settings",E,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}),e.jsx(j,{control:w.control,name:"parent_id",render:({field:E})=>e.jsxs(f,{children:[e.jsx(v,{children:s("form.parent.label")}),e.jsxs(X,{onValueChange:E.onChange,value:E.value?.toString()||"0",children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:s("form.parent.placeholder")})})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:s("form.parent.none")}),y?.map(g=>e.jsx(q,{value:g.id.toString(),className:"cursor-pointer",children:g.name},g.id))]})]}),e.jsx(R,{})]})}),e.jsx(j,{control:w.control,name:"route_ids",render:({field:E})=>e.jsxs(f,{children:[e.jsx(v,{children:s("form.route.label")}),e.jsx(b,{children:e.jsx(at,{options:P,onChange:g=>E.onChange(g.map(k=>k.value)),value:P?.filter(g=>E.value.includes(g.value)),placeholder:s("form.route.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-lg leading-10 text-gray-600 dark:text-gray-400",children:s("form.route.empty")})})}),e.jsx(R,{})]})})]}),e.jsxs(Ie,{className:"mt-6 flex flex-col gap-2 sm:flex-row sm:gap-0",children:[e.jsx(L,{type:"button",variant:"outline",onClick:S,className:"w-full sm:w-auto",children:s("form.cancel")}),e.jsx(L,{type:"submit",onClick:M,className:"w-full sm:w-auto",children:s("form.submit")})]})]})]})]})}function Nr({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Aa,{className:"mr-2 h-4 w-4"}),n,a?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:a.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:a.size>2?e.jsxs(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[a.size," selected"]}):t.filter(o=>a.has(o.value)).map(o=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(Ge,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Gs,{children:[e.jsx(lt,{placeholder:n}),e.jsxs(Ws,{children:[e.jsx(it,{children:"No results found."}),e.jsx(xs,{children:t.map(o=>{const l=a.has(o.value);return e.jsxs($e,{onSelect:()=>{l?a.delete(o.value):a.add(o.value);const d=Array.from(a);s?.setFilterValue(d.length?d:void 0)},className:"cursor-pointer",children:[e.jsx("div",{className:_("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",l?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(vt,{className:_("h-4 w-4")})}),o.icon&&e.jsx(o.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${o.color}`}),e.jsx("span",{children:o.label}),r?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(o.value)})]},o.value)})}),a.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{}),e.jsx(xs,{children:e.jsx($e,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center cursor-pointer",children:"Clear filters"})})]})]})]})})]})}const Kx=[{value:he.Shadowsocks,label:Ds.find(s=>s.type===he.Shadowsocks)?.label,color:vs[he.Shadowsocks]},{value:he.Vmess,label:Ds.find(s=>s.type===he.Vmess)?.label,color:vs[he.Vmess]},{value:he.Trojan,label:Ds.find(s=>s.type===he.Trojan)?.label,color:vs[he.Trojan]},{value:he.Hysteria,label:Ds.find(s=>s.type===he.Hysteria)?.label,color:vs[he.Hysteria]},{value:he.Vless,label:Ds.find(s=>s.type===he.Vless)?.label,color:vs[he.Vless]},{value:he.Tuic,label:Ds.find(s=>s.type===he.Tuic)?.label,color:vs[he.Tuic]},{value:he.Socks,label:Ds.find(s=>s.type===he.Socks)?.label,color:vs[he.Socks]},{value:he.Naive,label:Ds.find(s=>s.type===he.Naive)?.label,color:vs[he.Naive]},{value:he.Http,label:Ds.find(s=>s.type===he.Http)?.label,color:vs[he.Http]},{value:he.Mieru,label:Ds.find(s=>s.type===he.Mieru)?.label,color:vs[he.Mieru]}];function Bx({table:s,saveOrder:n,isSortMode:t,groups:r}){const a=s.getState().columnFilters.length>0,{t:o}=O("server");return e.jsxs("div",{className:"flex items-center justify-between ",children:[e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[!t&&e.jsxs(e.Fragment,{children:[e.jsx(Hx,{}),e.jsx(D,{placeholder:o("toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:l=>s.getColumn("name")?.setFilterValue(l.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex gap-x-2",children:[s.getColumn("type")&&e.jsx(Nr,{column:s.getColumn("type"),title:o("toolbar.type"),options:Kx}),s.getColumn("group_ids")&&e.jsx(Nr,{column:s.getColumn("group_ids"),title:o("columns.groups.title"),options:r.map(l=>({label:l.name,value:l.id.toString()}))})]}),a&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[o("toolbar.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]}),t&&e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:o("toolbar.sort.tip")})})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(L,{variant:t?"default":"outline",onClick:n,size:"sm",children:o(t?"toolbar.sort.save":"toolbar.sort.edit")})})]})}const Ea=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.71 12.71a6 6 0 1 0-7.42 0a10 10 0 0 0-6.22 8.18a1 1 0 0 0 2 .22a8 8 0 0 1 15.9 0a1 1 0 0 0 1 .89h.11a1 1 0 0 0 .88-1.1a10 10 0 0 0-6.25-8.19M12 12a4 4 0 1 1 4-4a4 4 0 0 1-4 4"})}),pa={0:"bg-destructive/80 shadow-sm shadow-destructive/50",1:"bg-yellow-500/80 shadow-sm shadow-yellow-500/50",2:"bg-emerald-500/80 shadow-sm shadow-emerald-500/50"},He=(s,n)=>n>0?Math.round(s/n*100):0,Gx=s=>{const{t:n}=O("server");return[{id:"drag-handle",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.sort")}),cell:()=>e.jsx("div",{className:"flex items-center justify-center",children:e.jsx($a,{className:"size-4 cursor-move text-muted-foreground transition-colors hover:text-primary","aria-hidden":"true"})}),size:50},{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.nodeId")}),cell:({row:t})=>{const r=t.getValue("id"),a=t.original.code;return e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"group/id flex items-center space-x-2",children:[e.jsxs(K,{variant:"outline",className:_("border-2 font-medium transition-all duration-200 hover:opacity-80","flex items-center gap-1.5"),style:{borderColor:vs[t.original.type]},children:[e.jsx(Ll,{className:"size-3"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"flex items-center gap-0.5",children:a??r}),t.original.parent?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-muted-foreground/30",children:"→"}),e.jsx("span",{children:t.original.parent?.code||t.original.parent?.id})]}):""]})]}),e.jsx(L,{variant:"ghost",size:"icon",className:"size-5 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:text-muted-foreground group-hover/id:opacity-100",onClick:o=>{o.stopPropagation(),Rt(a||r.toString()).then(()=>{$.success(n("common:copy.success"))})},children:e.jsx(or,{className:"size-3"})})]})}),e.jsxs(ce,{side:"top",className:"flex flex-col gap-1 p-3",children:[e.jsxs("p",{className:"font-medium",children:[Ds.find(o=>o.type===t.original.type)?.label,t.original.parent?" (子节点)":""]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a?"点击括号内容或复制按钮可复制节点代码":"点击复制按钮可复制节点ID"})]})]})})},size:50,enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.show")}),cell:({row:t})=>{const[r,a]=m.useState(!!t.getValue("show"));return e.jsx(ee,{checked:r,onCheckedChange:async o=>{a(o),gt.update({id:t.original.id,type:t.original.type,show:o?1:0}).catch(()=>{a(!o),s()})},style:{backgroundColor:r?vs[t.original.type]:void 0}})},size:50,enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx(z,{column:t,title:n("columns.node"),tooltip:e.jsxs("div",{className:"grid grid-cols-1 gap-3 p-2",children:[e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:_("h-2.5 w-2.5 rounded-full",pa[0])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.0")})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:_("h-2.5 w-2.5 rounded-full",pa[1])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.1")})]}),e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:_("h-2.5 w-2.5 rounded-full",pa[2])}),e.jsx("span",{className:"text-sm font-medium",children:n("columns.status.2")})]})]})})}),cell:({row:t})=>e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{children:e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:_("size-2.5 flex-shrink-0 rounded-full transition-all duration-200",pa[t.original.available_status])}),e.jsx("span",{className:"text-left font-medium transition-colors hover:text-primary",children:t.getValue("name")})]})}),e.jsx(ce,{children:e.jsxs("div",{className:" space-y-3",children:[e.jsx("p",{className:"font-medium",children:n(`columns.status.${t.original.available_status}`)}),t.original.load_status&&e.jsxs("div",{className:"border-t border-border/50 pt-3",children:[e.jsx("p",{className:"mb-3 text-sm font-medium",children:n("columns.loadStatus.details")}),e.jsxs("div",{className:"space-y-3 text-xs",children:[e.jsx("div",{children:e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[n("columns.loadStatus.cpu"),":"]}),e.jsxs("div",{className:"ml-2 flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:_("h-full transition-all duration-300",t.original.load_status.cpu>=90?"bg-destructive":t.original.load_status.cpu>=70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${Math.min(100,t.original.load_status.cpu)}%`}})}),e.jsxs("span",{className:_("min-w-[3rem] text-right font-semibold",t.original.load_status.cpu>=90?"text-destructive":t.original.load_status.cpu>=70?"text-yellow-600":"text-emerald-600"),children:[Math.round(t.original.load_status.cpu),"%"]})]})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[n("columns.loadStatus.memory"),":"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:_("h-full transition-all duration-300",He(t.original.load_status.mem.used,t.original.load_status.mem.total)>=90?"bg-destructive":He(t.original.load_status.mem.used,t.original.load_status.mem.total)>=70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${He(t.original.load_status.mem.used,t.original.load_status.mem.total)}%`}})}),e.jsxs("span",{className:_("min-w-[3rem] text-right font-semibold",He(t.original.load_status.mem.used,t.original.load_status.mem.total)>=90?"text-destructive":He(t.original.load_status.mem.used,t.original.load_status.mem.total)>=70?"text-yellow-600":"text-emerald-600"),children:[He(t.original.load_status.mem.used,t.original.load_status.mem.total),"%"]})]})]}),e.jsxs("div",{className:"ml-auto w-[9.5rem] text-right text-xs text-muted-foreground",children:[ze(t.original.load_status.mem.used)," ","/"," ",ze(t.original.load_status.mem.total)]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[n("columns.loadStatus.swap"),":"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:_("h-full transition-all duration-300",He(t.original.load_status.swap.used,t.original.load_status.swap.total)>=80?"bg-destructive":He(t.original.load_status.swap.used,t.original.load_status.swap.total)>=50?"bg-yellow-500":"bg-emerald-500"),style:{width:`${He(t.original.load_status.swap.used,t.original.load_status.swap.total)}%`}})}),e.jsxs("span",{className:_("min-w-[3rem] text-right font-semibold",He(t.original.load_status.swap.used,t.original.load_status.swap.total)>=80?"text-destructive":He(t.original.load_status.swap.used,t.original.load_status.swap.total)>=50?"text-yellow-600":"text-emerald-600"),children:[He(t.original.load_status.swap.used,t.original.load_status.swap.total),"%"]})]})]}),e.jsxs("div",{className:"ml-auto w-[9.5rem] text-right text-xs text-muted-foreground",children:[ze(t.original.load_status.swap.used)," ","/"," ",ze(t.original.load_status.swap.total)]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:[n("columns.loadStatus.disk"),":"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-2 w-20 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:_("h-full transition-all duration-300",He(t.original.load_status.disk.used,t.original.load_status.disk.total)>=90?"bg-destructive":He(t.original.load_status.disk.used,t.original.load_status.disk.total)>=70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${He(t.original.load_status.disk.used,t.original.load_status.disk.total)}%`}})}),e.jsxs("span",{className:_("min-w-[3rem] text-right font-semibold",He(t.original.load_status.disk.used,t.original.load_status.disk.total)>=90?"text-destructive":He(t.original.load_status.disk.used,t.original.load_status.disk.total)>=70?"text-yellow-600":"text-emerald-600"),children:[He(t.original.load_status.disk.used,t.original.load_status.disk.total),"%"]})]})]}),e.jsxs("div",{className:"ml-auto w-[9.5rem] text-right text-xs text-muted-foreground",children:[ze(t.original.load_status.disk.used)," ","/"," ",ze(t.original.load_status.disk.total)]})]})]})]})]})})]})}),enableSorting:!1,size:200},{accessorKey:"host",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.address")}),cell:({row:t})=>{const r=`${t.original.host}:${t.original.port}`,a=t.original.port!==t.original.server_port;return e.jsxs("div",{className:"group relative flex min-w-0 items-start",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-1 gap-y-0.5 pr-7",children:[e.jsx("div",{className:"flex items-center ",children:e.jsxs("span",{className:"font-mono text-sm font-medium text-foreground/90",children:[t.original.host,":",t.original.port]})}),a&&e.jsxs("span",{className:"whitespace-nowrap text-[0.7rem] tracking-tight text-muted-foreground/40",children:["(",n("columns.internalPort")," ",t.original.server_port,")"]})]}),e.jsx("div",{className:"absolute right-0 top-0",children:e.jsx(pe,{delayDuration:0,children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"size-6 text-muted-foreground/40 opacity-0 transition-all duration-200 hover:bg-muted/50 hover:text-muted-foreground group-hover:opacity-100",onClick:o=>{o.stopPropagation(),Rt(r).then(()=>{$.success(n("common:copy.success"))})},children:e.jsx(or,{className:"size-3"})})}),e.jsx(ce,{side:"top",sideOffset:10,children:n("columns.copyAddress")})]})})})]})},enableSorting:!1,enableHiding:!0},{accessorKey:"online",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.onlineUsers.title"),tooltip:n("columns.onlineUsers.tooltip")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Ea,{className:"size-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("online")})]}),size:80,enableSorting:!0,enableHiding:!0},{accessorKey:"rate",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.rate.title"),tooltip:n("columns.rate.tooltip")}),cell:({row:t})=>e.jsxs(K,{variant:"secondary",className:"font-medium",children:[t.getValue("rate")," x"]}),size:80,enableSorting:!1,enableHiding:!0},{accessorKey:"group_ids",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.groups.title"),tooltip:n("columns.groups.tooltip")}),cell:({row:t})=>{const r=t.original.groups||[];return e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[r.map((a,o)=>e.jsx(K,{variant:"secondary",className:_("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5"),children:a.name},o)),r.length===0&&e.jsx("span",{className:"text-sm text-muted-foreground",children:n("columns.groups.empty")})]})},enableSorting:!1,filterFn:(t,r,a)=>{const o=t.getValue(r);return o?a.some(l=>o.includes(l)):!1}},{accessorKey:"type",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.type")}),cell:({row:t})=>{const r=t.getValue("type");return e.jsx(K,{variant:"outline",className:"border-2 font-medium transition-colors",style:{borderColor:vs[r]},children:r})},enableSorting:!1,enableHiding:!0,enableColumnFilter:!1,size:8e3},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>{const{setIsOpen:r,setEditingServer:a,setServerType:o}=_i();return e.jsx("div",{className:"flex justify-center",children:e.jsxs(Us,{modal:!1,children:[e.jsx(Ks,{asChild:!0,children:e.jsx(L,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":n("columns.actions"),children:e.jsx(Fa,{className:"size-4"})})}),e.jsxs(As,{align:"end",className:"w-40",children:[e.jsx(Ce,{className:"cursor-pointer",onClick:()=>{o(t.original.type),a(t.original),r(!0)},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(vd,{className:"mr-2 size-4"}),n("columns.actions_dropdown.edit")]})}),e.jsxs(Ce,{className:"cursor-pointer",onClick:async()=>{gt.copy({id:t.original.id}).then(({data:l})=>{l&&($.success(n("columns.actions_dropdown.copy_success")),s())})},children:[e.jsx(On,{className:"mr-2 size-4"}),n("columns.actions_dropdown.copy")]}),e.jsx(tt,{}),e.jsx(Ce,{className:"cursor-pointer text-destructive focus:text-destructive",onSelect:l=>l.preventDefault(),children:e.jsx(us,{title:n("columns.actions_dropdown.delete.title"),description:n("columns.actions_dropdown.delete.description"),confirmText:n("columns.actions_dropdown.delete.confirm"),variant:"destructive",onConfirm:async()=>{gt.drop({id:t.original.id}).then(({data:l})=>{l&&($.success(n("columns.actions_dropdown.delete_success")),s())})},children:e.jsxs("div",{className:"flex w-full items-center",children:[e.jsx(ms,{className:"mr-2 size-4"}),n("columns.actions_dropdown.delete.confirm")]})})})]})]})})},size:50}]};function Wx(){const[s,n]=m.useState({}),[t,r]=m.useState({"drag-handle":!1}),[a,o]=m.useState([]),[l,d]=m.useState({pageSize:500,pageIndex:0}),[x,u]=m.useState([]),[i,c]=m.useState(!1),[p,P]=m.useState({}),[T,C]=m.useState([]),{refetch:F}=ne({queryKey:["nodeList"],queryFn:async()=>{const{data:M}=await gt.getList();return C(M),M}}),{data:w}=ne({queryKey:["groups"],queryFn:async()=>{const{data:M}=await yt.getList();return M}});m.useEffect(()=>{r({"drag-handle":i,show:!i,host:!i,online:!i,rate:!i,groups:!i,type:!1,actions:!i}),P({name:i?2e3:200}),d({pageSize:i?99999:500,pageIndex:0})},[i]);const V=(M,E)=>{i&&(M.dataTransfer.setData("text/plain",E.toString()),M.currentTarget.classList.add("opacity-50"))},y=(M,E)=>{if(!i)return;M.preventDefault(),M.currentTarget.classList.remove("bg-muted");const g=parseInt(M.dataTransfer.getData("text/plain"));if(g===E)return;const k=[...T],[W]=k.splice(g,1);k.splice(E,0,W),C(k)},N=async()=>{if(!i){c(!0);return}const M=T?.map((E,g)=>({id:E.id,order:g+1}));gt.sort(M).then(()=>{$.success("排序保存成功"),c(!1),F()}).finally(()=>{c(!1)})},S=We({data:T||[],columns:Gx(F),state:{sorting:x,columnVisibility:t,rowSelection:s,columnFilters:a,columnSizing:p,pagination:l},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:u,onColumnFiltersChange:o,onColumnVisibilityChange:r,onColumnSizingChange:P,onPaginationChange:d,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Cx,{refetch:F,children:e.jsx("div",{className:"space-y-4",children:e.jsx(ns,{table:S,toolbar:M=>e.jsx(Bx,{table:M,refetch:F,saveOrder:N,isSortMode:i,groups:w||[]}),draggable:i,onDragStart:V,onDragEnd:M=>M.currentTarget.classList.remove("opacity-50"),onDragOver:M=>{M.preventDefault(),M.currentTarget.classList.add("bg-muted")},onDragLeave:M=>M.currentTarget.classList.remove("bg-muted"),onDrop:y,showPagination:!i})})})}function Yx(){const{t:s}=O("server");return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("manage.title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("manage.description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Wx,{})})]})]})}const Jx=Object.freeze(Object.defineProperty({__proto__:null,default:Yx},Symbol.toStringTag,{value:"Module"}));function Qx({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=O("group");return e.jsx("div",{className:"flex items-center justify-between space-x-4",children:e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(en,{refetch:n}),e.jsx(D,{placeholder:r("toolbar.searchPlaceholder"),value:s.getColumn("name")?.getFilterValue()??"",onChange:a=>s.getColumn("name")?.setFilterValue(a.target.value),className:_("h-8 w-[150px] lg:w-[250px]",t&&"border-primary/50 ring-primary/20")}),t&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("toolbar.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]})})}const Xx=s=>{const{t:n}=O("group");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.id")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(K,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0},{accessorKey:"name",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.name")}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium",children:t.getValue("name")})})},{accessorKey:"users_count",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.usersCount")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Ea,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("users_count")})]}),enableSorting:!0},{accessorKey:"server_count",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.serverCount")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 px-4",children:[e.jsx(Ll,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:t.getValue("server_count")})]}),enableSorting:!0,size:8e3},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(en,{defaultValues:t.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(nt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(us,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{yt.drop({id:t.original.id}).then(({data:r})=>{r&&($.success(n("messages.updateSuccess")),s())})},children:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ms,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("messages.deleteButton")})]})})]})}]};function Zx(){const[s,n]=m.useState({}),[t,r]=m.useState({}),[a,o]=m.useState([]),[l,d]=m.useState([]),{data:x,refetch:u,isLoading:i}=ne({queryKey:["serverGroupList"],queryFn:async()=>{const{data:p}=await yt.getList();return p}}),c=We({data:x||[],columns:Xx(u),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a},enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:o,onColumnVisibilityChange:r,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ns,{table:c,toolbar:p=>e.jsx(Qx,{table:p,refetch:u}),isLoading:i})}function eh(){const{t:s}=O("group");return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Zx,{})})]})]})}const sh=Object.freeze(Object.defineProperty({__proto__:null,default:eh},Symbol.toStringTag,{value:"Module"})),th=s=>h.object({remarks:h.string().min(1,s("form.validation.remarks")),match:h.array(h.string()),action:h.enum(["block","dns"]),action_value:h.string().optional()});function Ni({refetch:s,dialogTrigger:n,defaultValues:t={remarks:"",match:[],action:"block",action_value:""},type:r="create"}){const{t:a}=O("route"),o=Ne({resolver:ke(th(a)),defaultValues:t,mode:"onChange"}),[l,d]=m.useState(!1);return e.jsxs(de,{open:l,onOpenChange:d,children:[e.jsx(fs,{asChild:!0,children:n||e.jsxs(L,{variant:"outline",size:"sm",className:"space-x-2",children:[e.jsx(Ke,{icon:"ion:add"})," ",e.jsx("div",{children:a("form.add")})]})}),e.jsxs(oe,{className:"sm:max-w-[425px]",children:[e.jsxs(ge,{children:[e.jsx(me,{children:a(r==="edit"?"form.edit":"form.create")}),e.jsx(Ae,{})]}),e.jsxs(Te,{...o,children:[e.jsx(j,{control:o.control,name:"remarks",render:({field:x})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:a("form.remarks")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(D,{type:"text",placeholder:a("form.remarksPlaceholder"),...x})})}),e.jsx(R,{})]})}),e.jsx(j,{control:o.control,name:"match",render:({field:x})=>e.jsxs(f,{className:"flex-[2]",children:[e.jsx(v,{children:a("form.match")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(Rs,{className:"min-h-[120px]",placeholder:a("form.matchPlaceholder"),value:Array.isArray(x.value)?x.value.join(` +`):"",onChange:u=>{const i=u.target.value.split(` +`);x.onChange(i)}})})}),e.jsx(R,{})]})}),e.jsx(j,{control:o.control,name:"action",render:({field:x})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.action")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsxs(X,{onValueChange:x.onChange,defaultValue:x.value,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:a("form.actionPlaceholder")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"block",children:a("actions.block")}),e.jsx(q,{value:"dns",children:a("actions.dns")})]})]})})}),e.jsx(R,{})]})}),o.watch("action")==="dns"&&e.jsx(j,{control:o.control,name:"action_value",render:({field:x})=>e.jsxs(f,{children:[e.jsx(v,{children:a("form.dns")}),e.jsx("div",{className:"relative",children:e.jsx(b,{children:e.jsx(D,{type:"text",placeholder:a("form.dnsPlaceholder"),...x})})})]})}),e.jsxs(Ie,{children:[e.jsx(Zs,{asChild:!0,children:e.jsx(L,{variant:"outline",children:a("form.cancel")})}),e.jsx(L,{type:"submit",onClick:()=>{const x=o.getValues(),u={...x,match:Array.isArray(x.match)?x.match.filter(i=>i.trim()!==""):[]};Ua.save(u).then(({data:i})=>{i&&(d(!1),s&&s(),$.success(a(r==="edit"?"messages.updateSuccess":"messages.createSuccess")),o.reset())})},children:a("form.submit")})]})]})]})]})}function ah({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=O("route");return e.jsx("div",{className:"flex items-center justify-between ",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-2",children:[e.jsx(Ni,{refetch:n}),e.jsx(D,{placeholder:r("toolbar.searchPlaceholder"),value:s.getColumn("remarks")?.getFilterValue()??"",onChange:a=>s.getColumn("remarks")?.setFilterValue(a.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),t&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("toolbar.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]})})}function nh({columns:s,data:n,refetch:t}){const[r,a]=m.useState({}),[o,l]=m.useState({}),[d,x]=m.useState([]),[u,i]=m.useState([]),c=We({data:n,columns:s,state:{sorting:u,columnVisibility:o,rowSelection:r,columnFilters:d},enableRowSelection:!0,onRowSelectionChange:a,onSortingChange:i,onColumnFiltersChange:x,onColumnVisibilityChange:l,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ns,{table:c,toolbar:p=>e.jsx(ah,{table:p,refetch:t})})}const rh=s=>{const{t:n}=O("route"),t={block:{icon:bd,variant:"destructive",className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-400 hover:bg-red-200 dark:hover:bg-red-800"},dns:{icon:yd,variant:"secondary",className:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800"}};return[{accessorKey:"id",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.id")}),cell:({row:r})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(K,{variant:"outline",children:r.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"remarks",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.remarks")}),cell:({row:r})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:r.original.remarks})}),enableHiding:!1,enableSorting:!1},{accessorKey:"action_value",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.action_value.title")}),cell:({row:r})=>{const a=r.original.action,o=r.original.action_value,l=r.original.match?.length||0;return e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("span",{className:"text-sm font-medium",children:a==="dns"&&o?n("columns.action_value.dns",{value:o}):a==="block"?e.jsx("span",{className:"text-destructive",children:n("columns.action_value.block")}):n("columns.action_value.direct")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("columns.matchRules",{count:l})})]})},enableHiding:!1,enableSorting:!1,size:300},{accessorKey:"action",header:({column:r})=>e.jsx(z,{column:r,title:n("columns.action")}),cell:({row:r})=>{const a=r.getValue("action"),o=t[a]?.icon;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(K,{variant:t[a]?.variant||"default",className:_("flex items-center gap-1.5 px-3 py-1 capitalize",t[a]?.className),children:[o&&e.jsx(o,{className:"h-3.5 w-3.5"}),n(`actions.${a}`)]})})},enableSorting:!1,size:9e3},{id:"actions",header:()=>e.jsx("div",{className:"text-right",children:n("columns.actions")}),cell:({row:r})=>e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Ni,{defaultValues:r.original,refetch:s,type:"edit",dialogTrigger:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",children:[e.jsx(nt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("form.edit")})]})}),e.jsx(us,{title:n("messages.deleteConfirm"),description:n("messages.deleteDescription"),confirmText:n("messages.deleteButton"),variant:"destructive",onConfirm:async()=>{Ua.drop({id:r.original.id}).then(({data:a})=>{a&&($.success(n("messages.deleteSuccess")),s())})},children:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ms,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("messages.deleteButton")})]})})]})}]};function lh(){const{t:s}=O("route"),[n,t]=m.useState([]);function r(){Ua.getList().then(({data:a})=>{t(a)})}return m.useEffect(()=>{r()},[]),e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(nh,{data:n,columns:rh(r),refetch:r})})]})]})}const ih=Object.freeze(Object.defineProperty({__proto__:null,default:lh},Symbol.toStringTag,{value:"Module"})),wi=m.createContext(void 0);function oh({children:s,refreshData:n}){const[t,r]=m.useState(!1),[a,o]=m.useState(null);return e.jsx(wi.Provider,{value:{isOpen:t,setIsOpen:r,editingPlan:a,setEditingPlan:o,refreshData:n},children:s})}function Bn(){const s=m.useContext(wi);if(s===void 0)throw new Error("usePlanEdit must be used within a PlanEditProvider");return s}function ch({table:s,saveOrder:n,isSortMode:t}){const{setIsOpen:r}=Bn(),{t:a}=O("subscribe");return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsxs(L,{variant:"outline",className:"space-x-2",size:"sm",onClick:()=>r(!0),children:[e.jsx(Ke,{icon:"ion:add"}),e.jsx("div",{children:a("plan.add")})]}),e.jsx(D,{placeholder:a("plan.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:o=>s.getColumn("name")?.setFilterValue(o.target.value),className:"h-8 w-[150px] lg:w-[250px]"})]}),s.getRowCount()>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(L,{variant:t?"default":"outline",onClick:n,size:"sm",children:a(t?"plan.sort.save":"plan.sort.edit")})})]})}const wr={monthly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},quarterly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},half_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},two_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},three_yearly:{color:"text-slate-700",bgColor:"bg-slate-100/80"},onetime:{color:"text-slate-700",bgColor:"bg-slate-100/80"},reset_traffic:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},dh=s=>{const{t:n}=O("subscribe");return[{id:"drag-handle",header:()=>null,cell:()=>e.jsx("div",{className:"cursor-move",children:e.jsx($a,{className:"size-4"})}),size:40,enableSorting:!1},{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.id")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(K,{variant:"outline",children:t.getValue("id")})}),enableSorting:!0,enableHiding:!1},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.show")}),cell:({row:t})=>e.jsx(ee,{defaultChecked:t.getValue("show"),onCheckedChange:r=>{ys.update({id:t.original.id,show:r}).then(({data:a})=>{!a&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"sell",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.sell")}),cell:({row:t})=>e.jsx(ee,{defaultChecked:t.getValue("sell"),onCheckedChange:r=>{ys.update({id:t.original.id,sell:r}).then(({data:a})=>{!a&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"renew",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.renew"),tooltip:n("plan.columns.renew_tooltip")}),cell:({row:t})=>e.jsx(ee,{defaultChecked:t.getValue("renew"),onCheckedChange:r=>{ys.update({id:t.original.id,renew:r}).then(({data:a})=>{!a&&s()})}}),enableSorting:!1,enableHiding:!1},{accessorKey:"name",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.name")}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium sm:max-w-72 md:max-w-[31rem]",children:t.getValue("name")})}),enableSorting:!1,enableHiding:!1,size:900},{accessorKey:"users_count",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.stats")}),cell:({row:t})=>{const r=t.getValue("users_count")||0,a=t.original.active_users_count||0,o=r>0?Math.round(a/r*100):0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 rounded-md bg-slate-50 px-2 py-1 hover:bg-slate-100 transition-colors cursor-help",children:[e.jsx(Ca,{className:"h-3.5 w-3.5 text-slate-500"}),e.jsx("span",{className:"text-sm font-medium text-slate-700",children:r})]})}),e.jsx(ce,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"总用户数"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"所有使用该套餐的用户(包括已过期)"})]})})]})}),e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 rounded-md bg-green-50 px-2 py-1 hover:bg-green-100 transition-colors cursor-help",children:[e.jsx(_d,{className:"h-3.5 w-3.5 text-green-600"}),e.jsx("span",{className:"text-sm font-medium text-green-700",children:a})]})}),e.jsx(ce,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"有效期内用户"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"当前仍在有效期内的活跃用户"}),r>0&&e.jsxs("p",{className:"text-xs font-medium text-green-600",children:["活跃率:",o,"%"]})]})})]})})]})},enableSorting:!0,size:120},{accessorKey:"group",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.group")}),cell:({row:t})=>e.jsx("div",{className:"flex max-w-[600px] flex-wrap items-center gap-1.5 text-nowrap",children:e.jsx(K,{variant:"secondary",className:_("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5"),children:t.getValue("group")?.name})}),enableSorting:!1,enableHiding:!1},{accessorKey:"prices",header:({column:t})=>e.jsx(z,{column:t,title:n("plan.columns.price")}),cell:({row:t})=>{const r=t.getValue("prices"),a=[{period:n("plan.columns.price_period.monthly"),key:"monthly",unit:n("plan.columns.price_period.unit.month")},{period:n("plan.columns.price_period.quarterly"),key:"quarterly",unit:n("plan.columns.price_period.unit.quarter")},{period:n("plan.columns.price_period.half_yearly"),key:"half_yearly",unit:n("plan.columns.price_period.unit.half_year")},{period:n("plan.columns.price_period.yearly"),key:"yearly",unit:n("plan.columns.price_period.unit.year")},{period:n("plan.columns.price_period.two_yearly"),key:"two_yearly",unit:n("plan.columns.price_period.unit.two_year")},{period:n("plan.columns.price_period.three_yearly"),key:"three_yearly",unit:n("plan.columns.price_period.unit.three_year")},{period:n("plan.columns.price_period.onetime"),key:"onetime",unit:""},{period:n("plan.columns.price_period.reset_traffic"),key:"reset_traffic",unit:n("plan.columns.price_period.unit.times")}];return r?e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:a.map(({period:o,key:l,unit:d})=>r[l]!=null&&e.jsxs(K,{variant:"secondary",className:_("px-2 py-0.5 font-medium transition-colors text-nowrap",wr[l].color,wr[l].bgColor,"border border-border/50","hover:bg-slate-200/80"),children:[o," ¥",r[l],d]},l))}):e.jsx("div",{className:"flex items-center",children:e.jsx(K,{variant:"outline",className:"px-2 py-0.5 text-xs text-muted-foreground border-dashed",children:n("plan.columns.price_period.no_price")})})},enableSorting:!1,size:9e3},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:n("plan.columns.actions")}),cell:({row:t})=>{const{setIsOpen:r,setEditingPlan:a}=Bn();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>{a(t.original),r(!0)},children:[e.jsx(nt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("plan.columns.edit")})]}),e.jsx(us,{title:n("plan.columns.delete_confirm.title"),description:n("plan.columns.delete_confirm.description"),confirmText:n("plan.columns.delete"),variant:"destructive",onConfirm:async()=>{ys.drop({id:t.original.id}).then(({data:o})=>{o&&($.success(n("plan.columns.delete_confirm.success")),s())})},children:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ms,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("plan.columns.delete")})]})})]})}}]},mh=h.object({id:h.number().nullable(),group_id:h.union([h.number(),h.string()]).nullable().optional(),name:h.string().min(1).max(250),tags:h.array(h.string()).nullable().optional(),content:h.string().nullable().optional(),transfer_enable:h.union([h.number().min(0),h.string().min(1)]),prices:h.object({monthly:h.union([h.number(),h.string()]).nullable().optional(),quarterly:h.union([h.number(),h.string()]).nullable().optional(),half_yearly:h.union([h.number(),h.string()]).nullable().optional(),yearly:h.union([h.number(),h.string()]).nullable().optional(),two_yearly:h.union([h.number(),h.string()]).nullable().optional(),three_yearly:h.union([h.number(),h.string()]).nullable().optional(),onetime:h.union([h.number(),h.string()]).nullable().optional(),reset_traffic:h.union([h.number(),h.string()]).nullable().optional()}).default({}),speed_limit:h.union([h.number(),h.string()]).nullable().optional(),capacity_limit:h.union([h.number(),h.string()]).nullable().optional(),device_limit:h.union([h.number(),h.string()]).nullable().optional(),force_update:h.boolean().optional(),reset_traffic_method:h.number().nullable(),users_count:h.number().optional(),active_users_count:h.number().optional()}),Gn=m.forwardRef(({className:s,...n},t)=>e.jsx(Rl,{ref:t,className:_("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",s),...n,children:e.jsx(Nd,{className:_("flex items-center justify-center text-current"),children:e.jsx(vt,{className:"h-4 w-4"})})}));Gn.displayName=Rl.displayName;const fa={id:null,group_id:null,name:"",tags:[],content:"",transfer_enable:"",prices:{monthly:"",quarterly:"",half_yearly:"",yearly:"",two_yearly:"",three_yearly:"",onetime:"",reset_traffic:""},speed_limit:"",capacity_limit:"",device_limit:"",force_update:!1,reset_traffic_method:null},ja={monthly:{label:"月付",months:1,discount:1},quarterly:{label:"季付",months:3,discount:.95},half_yearly:{label:"半年付",months:6,discount:.9},yearly:{label:"年付",months:12,discount:.85},two_yearly:{label:"两年付",months:24,discount:.8},three_yearly:{label:"三年付",months:36,discount:.75},onetime:{label:"流量包",months:1,discount:1},reset_traffic:{label:"重置包",months:1,discount:1}},uh=[{value:null,label:"follow_system"},{value:0,label:"monthly_first"},{value:1,label:"monthly_reset"},{value:2,label:"no_reset"},{value:3,label:"yearly_first"},{value:4,label:"yearly_reset"}];function xh(){const{isOpen:s,setIsOpen:n,editingPlan:t,setEditingPlan:r,refreshData:a}=Bn(),[o,l]=m.useState(!1),{t:d}=O("subscribe"),x=Ne({resolver:ke(mh),defaultValues:{...fa,...t||{}},mode:"onChange"});m.useEffect(()=>{t?x.reset({...fa,...t}):x.reset(fa)},[t,x]);const u=new In({html:!0}),[i,c]=m.useState();async function p(){yt.getList().then(({data:w})=>{c(w)})}m.useEffect(()=>{s&&p()},[s]);const P=async w=>{l(!0),ys.save(w).then(({data:V})=>{V&&($.success(d(t?"plan.form.submit.success.update":"plan.form.submit.success.add")),F(),a())}).finally(()=>{l(!1)})},T=w=>{const V=Object.values(w).map(y=>y?.message).filter(Boolean);$.error(V.join(` +`)||d("plan.form.submit.error.validation","表单校验失败"))},C=w=>{if(isNaN(w))return;const V=Object.entries(ja).reduce((y,[N,S])=>{const M=w*S.months*S.discount;return{...y,[N]:M.toFixed(2)}},{});x.setValue("prices",V,{shouldDirty:!0})},F=()=>{n(!1),r(null),x.reset(fa)};return e.jsx(de,{open:s,onOpenChange:F,children:e.jsxs(oe,{children:[e.jsxs(ge,{children:[e.jsx(me,{children:d(t?"plan.form.edit_title":"plan.form.add_title")}),e.jsx(Ae,{})]}),e.jsx(Te,{...x,children:e.jsxs("form",{onSubmit:x.handleSubmit(P,T),children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(j,{control:x.control,name:"name",render:({field:w})=>e.jsxs(f,{children:[e.jsx(v,{children:d("plan.form.name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:d("plan.form.name.placeholder"),...w})}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"tags",render:({field:w})=>e.jsxs(f,{children:[e.jsx(v,{children:d("plan.form.tags.label","标签")}),e.jsx(b,{children:e.jsx(Za,{value:w.value||[],onChange:w.onChange,placeholder:d("plan.form.tags.placeholder","输入标签后按回车确认"),className:"w-full"})}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"group_id",render:({field:w})=>e.jsxs(f,{children:[e.jsxs(v,{className:"flex items-center justify-between",children:[d("plan.form.group.label"),e.jsx(en,{dialogTrigger:e.jsx(L,{variant:"link",children:d("plan.form.group.add")}),refetch:p})]}),e.jsxs(X,{value:w.value?.toString()??"",onValueChange:V=>w.onChange(V?Number(V):null),children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:d("plan.form.group.placeholder")})})}),e.jsx(Q,{children:i?.map(V=>e.jsx(q,{value:V.id.toString(),children:V.name},V.id))})]}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"transfer_enable",render:({field:w})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(v,{children:d("plan.form.transfer.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",min:0,placeholder:d("plan.form.transfer.placeholder"),className:"rounded-r-none",...w})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.transfer.unit")})]}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"speed_limit",render:({field:w})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(v,{children:d("plan.form.speed.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",min:0,placeholder:d("plan.form.speed.placeholder"),className:"rounded-r-none",...w,value:w.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.speed.unit")})]}),e.jsx(R,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center",children:[e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"}),e.jsx("h3",{className:"mx-4 text-sm font-medium text-gray-500 dark:text-gray-400",children:d("plan.form.price.title")}),e.jsx("div",{className:"flex-grow border-t border-gray-200 dark:border-gray-700"})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(D,{type:"number",step:"0.01",placeholder:d("plan.form.price.base_price"),className:"h-7 w-32 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500",onChange:w=>{const V=parseFloat(w.target.value);C(V)}})]}),e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(L,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const w=Object.keys(ja).reduce((V,y)=>({...V,[y]:""}),{});x.setValue("prices",w,{shouldDirty:!0})},children:d("plan.form.price.clear.button")})}),e.jsx(ce,{side:"top",align:"end",children:e.jsx("p",{className:"text-xs",children:d("plan.form.price.clear.tooltip")})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-3",children:Object.entries(ja).filter(([w])=>!["onetime","reset_traffic"].includes(w)).map(([w,V])=>e.jsx("div",{className:"group relative rounded-md bg-card p-2 ring-1 ring-gray-200 transition-all hover:ring-primary dark:ring-gray-800",children:e.jsx(j,{control:x.control,name:`prices.${w}`,render:({field:y})=>e.jsxs(f,{children:[e.jsxs(v,{className:"text-xs font-medium text-muted-foreground",children:[d(`plan.columns.price_period.${w}`),e.jsxs("span",{className:"ml-1 text-[10px] text-gray-400",children:["(",V.months===1?d("plan.form.price.period.monthly"):d("plan.form.price.period.months",{count:V.months}),")"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:"0.00",min:0,step:"0.01",...y,value:y.value??"",onChange:N=>y.onChange(N.target.value),className:"h-7 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500"})})]})]})})},w))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:Object.entries(ja).filter(([w])=>["onetime","reset_traffic"].includes(w)).map(([w,V])=>e.jsx("div",{className:"rounded-md border border-dashed border-gray-200 bg-muted/30 p-3 dark:border-gray-700",children:e.jsx(j,{control:x.control,name:`prices.${w}`,render:({field:y})=>e.jsx(f,{children:e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"space-y-0",children:[e.jsx(v,{className:"text-xs font-medium",children:d(`plan.columns.price_period.${w}`)}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:d(w==="onetime"?"plan.form.price.onetime_desc":"plan.form.price.reset_desc")})]}),e.jsxs("div",{className:"relative w-full md:w-32",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2",children:e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"¥"})}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:"0.00",min:0,step:"0.01",...y,value:y.value??"",className:"h-7 border-0 bg-gray-50 pl-6 pr-2 text-sm shadow-none ring-1 ring-gray-200 transition-shadow focus-visible:ring-2 focus-visible:ring-primary dark:bg-gray-800/50 dark:ring-gray-700 dark:placeholder:text-gray-500"})})]})]})})})},w))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(j,{control:x.control,name:"device_limit",render:({field:w})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(v,{children:d("plan.form.device.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",min:0,placeholder:d("plan.form.device.placeholder"),className:"rounded-r-none",...w,value:w.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.device.unit")})]}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"capacity_limit",render:({field:w})=>e.jsxs(f,{className:"flex-1",children:[e.jsx(v,{children:d("plan.form.capacity.label")}),e.jsxs("div",{className:"relative flex",children:[e.jsx(b,{children:e.jsx(D,{type:"number",min:0,placeholder:d("plan.form.capacity.placeholder"),className:"rounded-r-none",...w,value:w.value??""})}),e.jsx("div",{className:"flex items-center rounded-r-md border border-l-0 border-input bg-muted px-3 text-sm text-muted-foreground",children:d("plan.form.capacity.unit")})]}),e.jsx(R,{})]})})]}),e.jsx(j,{control:x.control,name:"reset_traffic_method",render:({field:w})=>e.jsxs(f,{children:[e.jsx(v,{children:d("plan.form.reset_method.label")}),e.jsxs(X,{value:w.value?.toString()??"null",onValueChange:V=>w.onChange(V=="null"?null:Number(V)),children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:d("plan.form.reset_method.placeholder")})})}),e.jsx(Q,{children:uh.map(V=>e.jsx(q,{value:V.value?.toString()??"null",children:d(`plan.form.reset_method.options.${V.label}`)},V.value))})]}),e.jsx(A,{className:"text-xs",children:d("plan.form.reset_method.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"content",render:({field:w})=>{const[V,y]=m.useState(!1);return e.jsxs(f,{className:"space-y-2",children:[e.jsxs(v,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[d("plan.form.content.label"),e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",type:"button",onClick:()=>y(!V),children:V?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{d:"M10 12.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"}),e.jsx("path",{fillRule:"evenodd",d:"M.664 10.59a1.651 1.651 0 010-1.186A10.004 10.004 0 0110 3c4.257 0 7.893 2.66 9.336 6.41.147.381.146.804 0 1.186A10.004 10.004 0 0110 17c-4.257 0-7.893-2.66-9.336-6.41zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4",children:[e.jsx("path",{fillRule:"evenodd",d:"M3.28 2.22a.75.75 0 00-1.06 1.06l14.5 14.5a.75.75 0 101.06-1.06l-1.745-1.745a10.029 10.029 0 003.3-4.38 1.651 1.651 0 000-1.185A10.004 10.004 0 009.999 3a9.956 9.956 0 00-4.744 1.194L3.28 2.22zM7.752 6.69l1.092 1.092a2.5 2.5 0 013.374 3.373l1.091 1.092a4 4 0 00-5.557-5.557z",clipRule:"evenodd"}),e.jsx("path",{d:"M10.748 13.93l2.523 2.523a9.987 9.987 0 01-3.27.547c-4.258 0-7.894-2.66-9.337-6.41a1.651 1.651 0 010-1.186A10.007 10.007 0 012.839 6.02L6.07 9.252a4 4 0 004.678 4.678z"})]})})}),e.jsx(ce,{side:"top",children:e.jsx("p",{className:"text-xs",children:d(V?"plan.form.content.preview_button.hide":"plan.form.content.preview_button.show")})})]})})]}),e.jsx(pe,{children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx(L,{variant:"outline",size:"sm",type:"button",onClick:()=>{w.onChange(d("plan.form.content.template.content"))},children:d("plan.form.content.template.button")})}),e.jsx(ce,{side:"left",align:"center",children:e.jsx("p",{className:"text-xs",children:d("plan.form.content.template.tooltip")})})]})})]}),e.jsxs("div",{className:`grid gap-4 ${V?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"}`,children:[e.jsx("div",{className:"space-y-2",children:e.jsx(b,{children:e.jsx(Mn,{style:{height:"400px"},value:w.value||"",renderHTML:N=>u.render(N),onChange:({text:N})=>w.onChange(N),config:{view:{menu:!0,md:!0,html:!1},canView:{menu:!0,md:!0,html:!1,fullScreen:!1,hideMenu:!1}},placeholder:d("plan.form.content.placeholder"),className:"rounded-md border"})})}),V&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:d("plan.form.content.preview")}),e.jsx("div",{className:"prose prose-sm dark:prose-invert h-[400px] max-w-none overflow-y-auto rounded-md border p-4",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:u.render(w.value||"")}})})]})]}),e.jsx(A,{className:"text-xs",children:d("plan.form.content.description")}),e.jsx(R,{})]})}})]}),e.jsx(Ie,{className:"mt-6",children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("div",{className:"flex-shrink-0",children:t&&e.jsx(j,{control:x.control,name:"force_update",render:({field:w})=>e.jsxs(f,{className:"flex flex-row items-center space-x-2 space-y-0",children:[e.jsx(b,{children:e.jsx(Gn,{checked:w.value,onCheckedChange:w.onChange})}),e.jsx("div",{className:"",children:e.jsx(v,{className:"text-sm",children:d("plan.form.force_update.label")})})]})})}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(L,{type:"button",variant:"outline",onClick:F,children:d("plan.form.submit.cancel")}),e.jsx(L,{type:"submit",disabled:o,children:d(o?"plan.form.submit.submitting":"plan.form.submit.submit")})]})]})})]})})]})})}function hh(){const[s,n]=m.useState({}),[t,r]=m.useState({"drag-handle":!1}),[a,o]=m.useState([]),[l,d]=m.useState([]),[x,u]=m.useState(!1),[i,c]=m.useState({pageSize:20,pageIndex:0}),[p,P]=m.useState([]),{refetch:T}=ne({queryKey:["planList"],queryFn:async()=>{const{data:y}=await ys.getList();return P(y),y}});m.useEffect(()=>{r({"drag-handle":x}),c({pageSize:x?99999:10,pageIndex:0})},[x]);const C=(y,N)=>{x&&(y.dataTransfer.setData("text/plain",N.toString()),y.currentTarget.classList.add("opacity-50"))},F=(y,N)=>{if(!x)return;y.preventDefault(),y.currentTarget.classList.remove("bg-muted");const S=parseInt(y.dataTransfer.getData("text/plain"));if(S===N)return;const M=[...p],[E]=M.splice(S,1);M.splice(N,0,E),P(M)},w=async()=>{if(!x){u(!0);return}const y=p?.map(N=>N.id);ys.sort(y).then(()=>{$.success("排序保存成功"),u(!1),T()}).finally(()=>{u(!1)})},V=We({data:p||[],columns:dh(T),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:i},enableRowSelection:!0,onPaginationChange:c,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:o,onColumnVisibilityChange:r,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}},pageCount:x?1:void 0});return e.jsx(oh,{refreshData:T,children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(ns,{table:V,toolbar:y=>e.jsx(ch,{table:y,refetch:T,saveOrder:w,isSortMode:x}),draggable:x,onDragStart:C,onDragEnd:y=>y.currentTarget.classList.remove("opacity-50"),onDragOver:y=>{y.preventDefault(),y.currentTarget.classList.add("bg-muted")},onDragLeave:y=>y.currentTarget.classList.remove("bg-muted"),onDrop:F,showPagination:!x}),e.jsx(xh,{})]})})}function gh(){const{t:s}=O("subscribe");return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("plan.title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("plan.page.description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(hh,{})})]})]})}const ph=Object.freeze(Object.defineProperty({__proto__:null,default:gh},Symbol.toStringTag,{value:"Module"})),Tt=[{value:le.PENDING,label:At[le.PENDING],icon:wd,color:qt[le.PENDING]},{value:le.PROCESSING,label:At[le.PROCESSING],icon:El,color:qt[le.PROCESSING]},{value:le.COMPLETED,label:At[le.COMPLETED],icon:wn,color:qt[le.COMPLETED]},{value:le.CANCELLED,label:At[le.CANCELLED],icon:Vl,color:qt[le.CANCELLED]},{value:le.DISCOUNTED,label:At[le.DISCOUNTED],icon:wn,color:qt[le.DISCOUNTED]}],Bt=[{value:we.PENDING,label:xa[we.PENDING],icon:Cd,color:ha[we.PENDING]},{value:we.PROCESSING,label:xa[we.PROCESSING],icon:El,color:ha[we.PROCESSING]},{value:we.VALID,label:xa[we.VALID],icon:wn,color:ha[we.VALID]},{value:we.INVALID,label:xa[we.INVALID],icon:Vl,color:ha[we.INVALID]}];function va({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=s?.getFilterValue(),o=Array.isArray(a)?new Set(a):a!==void 0?new Set([a]):new Set;return e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Aa,{className:"mr-2 h-4 w-4"}),n,o?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:o.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:o.size>2?e.jsxs(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[o.size," selected"]}):t.filter(l=>o.has(l.value)).map(l=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:l.label},l.value))})]})]})}),e.jsx(Ge,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Gs,{children:[e.jsx(lt,{placeholder:n}),e.jsxs(Ws,{children:[e.jsx(it,{children:"No results found."}),e.jsx(xs,{children:t.map(l=>{const d=o.has(l.value);return e.jsxs($e,{onSelect:()=>{const x=new Set(o);d?x.delete(l.value):x.add(l.value);const u=Array.from(x);s?.setFilterValue(u.length?u:void 0)},children:[e.jsx("div",{className:_("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",d?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(vt,{className:_("h-4 w-4")})}),l.icon&&e.jsx(l.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${l.color}`}),e.jsx("span",{children:l.label}),r?.get(l.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(l.value)})]},l.value)})}),o.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{}),e.jsx(xs,{children:e.jsx($e,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const fh=h.object({email:h.string().min(1),plan_id:h.number(),period:h.string(),total_amount:h.number()}),jh={email:"",plan_id:0,total_amount:0,period:""};function Ci({refetch:s,trigger:n,defaultValues:t}){const{t:r}=O("order"),[a,o]=m.useState(!1),l=Ne({resolver:ke(fh),defaultValues:{...jh,...t},mode:"onChange"}),[d,x]=m.useState([]);return m.useEffect(()=>{a&&ys.getList().then(({data:u})=>{x(u)})},[a]),e.jsxs(de,{open:a,onOpenChange:o,children:[e.jsx(fs,{asChild:!0,children:n||e.jsxs(L,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Ke,{icon:"ion:add"}),e.jsx("div",{children:r("dialog.addOrder")})]})}),e.jsxs(oe,{className:"sm:max-w-[425px]",children:[e.jsxs(ge,{children:[e.jsx(me,{children:r("dialog.assignOrder")}),e.jsx(Ae,{})]}),e.jsxs(Te,{...l,children:[e.jsx(j,{control:l.control,name:"email",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dialog.fields.userEmail")}),e.jsx(b,{children:e.jsx(D,{placeholder:r("dialog.placeholders.email"),...u})})]})}),e.jsx(j,{control:l.control,name:"plan_id",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dialog.fields.subscriptionPlan")}),e.jsx(b,{children:e.jsxs(X,{value:u.value?u.value?.toString():void 0,onValueChange:i=>u.onChange(parseInt(i)),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dialog.placeholders.plan")})}),e.jsx(Q,{children:d.map(i=>e.jsx(q,{value:i.id.toString(),children:i.name},i.id))})]})})]})}),e.jsx(j,{control:l.control,name:"period",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dialog.fields.orderPeriod")}),e.jsx(b,{children:e.jsxs(X,{value:u.value,onValueChange:u.onChange,children:[e.jsx(J,{children:e.jsx(Z,{placeholder:r("dialog.placeholders.period")})}),e.jsx(Q,{children:Object.keys(qm).map(i=>e.jsx(q,{value:i,children:r(`period.${i}`)},i))})]})})]})}),e.jsx(j,{control:l.control,name:"total_amount",render:({field:u})=>e.jsxs(f,{children:[e.jsx(v,{children:r("dialog.fields.paymentAmount")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:r("dialog.placeholders.amount"),value:u.value/100,onChange:i=>u.onChange(parseFloat(i.currentTarget.value)*100)})}),e.jsx(R,{})]})}),e.jsxs(Ie,{children:[e.jsx(L,{variant:"outline",onClick:()=>o(!1),children:r("dialog.actions.cancel")}),e.jsx(L,{type:"submit",onClick:()=>{l.handleSubmit(u=>{ht.assign(u).then(({data:i})=>{i&&(s&&s(),l.reset(),o(!1),$.success(r("dialog.messages.addSuccess")))})})()},children:r("dialog.actions.confirm")})]})]})]})]})}function vh({table:s,refetch:n}){const{t}=O("order"),r=s.getState().columnFilters.length>0,a=Object.values(zs).filter(x=>typeof x=="number").map(x=>({label:t(`type.${zs[x]}`),value:x,color:x===zs.NEW?"green-500":x===zs.RENEWAL?"blue-500":x===zs.UPGRADE?"purple-500":"orange-500"})),o=Object.values(Xe).map(x=>({label:t(`period.${x}`),value:x,color:x===Xe.MONTH_PRICE?"slate-500":x===Xe.QUARTER_PRICE?"cyan-500":x===Xe.HALF_YEAR_PRICE?"indigo-500":x===Xe.YEAR_PRICE?"violet-500":x===Xe.TWO_YEAR_PRICE?"fuchsia-500":x===Xe.THREE_YEAR_PRICE?"pink-500":x===Xe.ONETIME_PRICE?"rose-500":"orange-500"})),l=Object.values(le).filter(x=>typeof x=="number").map(x=>({label:t(`status.${le[x]}`),value:x,icon:x===le.PENDING?Tt[0].icon:x===le.PROCESSING?Tt[1].icon:x===le.COMPLETED?Tt[2].icon:x===le.CANCELLED?Tt[3].icon:Tt[4].icon,color:x===le.PENDING?"yellow-500":x===le.PROCESSING?"blue-500":x===le.COMPLETED?"green-500":x===le.CANCELLED?"red-500":"green-500"})),d=Object.values(we).filter(x=>typeof x=="number").map(x=>({label:t(`commission.${we[x]}`),value:x,icon:x===we.PENDING?Bt[0].icon:x===we.PROCESSING?Bt[1].icon:x===we.VALID?Bt[2].icon:Bt[3].icon,color:x===we.PENDING?"yellow-500":x===we.PROCESSING?"blue-500":x===we.VALID?"green-500":"red-500"}));return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ci,{refetch:n}),e.jsx(D,{placeholder:t("search.placeholder"),value:s.getColumn("trade_no")?.getFilterValue()??"",onChange:x=>s.getColumn("trade_no")?.setFilterValue(x.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs("div",{className:"flex flex-wrap gap-x-2",children:[s.getColumn("type")&&e.jsx(va,{column:s.getColumn("type"),title:t("table.columns.type"),options:a}),s.getColumn("period")&&e.jsx(va,{column:s.getColumn("period"),title:t("table.columns.period"),options:o}),s.getColumn("status")&&e.jsx(va,{column:s.getColumn("status"),title:t("table.columns.status"),options:l}),s.getColumn("commission_status")&&e.jsx(va,{column:s.getColumn("commission_status"),title:t("table.columns.commissionStatus"),options:d})]}),r&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[t("actions.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]})}function ls({label:s,value:n,className:t,valueClassName:r}){return e.jsxs("div",{className:_("flex items-center py-1.5",t),children:[e.jsx("div",{className:"w-28 shrink-0 text-sm text-muted-foreground",children:s}),e.jsx("div",{className:_("text-sm",r),children:n||"-"})]})}function bh({status:s}){const{t:n}=O("order"),t={[le.PENDING]:"bg-yellow-100 text-yellow-800 hover:bg-yellow-100",[le.PROCESSING]:"bg-blue-100 text-blue-800 hover:bg-blue-100",[le.CANCELLED]:"bg-red-100 text-red-800 hover:bg-red-100",[le.COMPLETED]:"bg-green-100 text-green-800 hover:bg-green-100",[le.DISCOUNTED]:"bg-gray-100 text-gray-800 hover:bg-gray-100"};return e.jsx(K,{variant:"secondary",className:_("font-medium",t[s]),children:n(`status.${le[s]}`)})}function yh({id:s,trigger:n}){const[t,r]=m.useState(!1),[a,o]=m.useState(),{t:l}=O("order");return m.useEffect(()=>{(async()=>{if(t){const{data:x}=await ht.getInfo({id:s});o(x)}})()},[t,s]),e.jsxs(de,{onOpenChange:r,open:t,children:[e.jsx(fs,{asChild:!0,children:n}),e.jsxs(oe,{className:"max-w-xl",children:[e.jsxs(ge,{className:"space-y-2",children:[e.jsx(me,{className:"text-lg font-medium",children:l("dialog.title")}),e.jsx("div",{className:"flex items-center justify-between text-sm",children:e.jsxs("div",{className:"flex items-center space-x-6",children:[e.jsxs("div",{className:"text-muted-foreground",children:[l("table.columns.tradeNo"),":",a?.trade_no]}),!!a?.status&&e.jsx(bh,{status:a.status})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:l("dialog.basicInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ls,{label:l("dialog.fields.userEmail"),value:a?.user?.email?e.jsxs(st,{to:`/user/manage?email=${a.user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[a.user.email,e.jsx(Cn,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]}):"-"}),e.jsx(ls,{label:l("dialog.fields.orderPeriod"),value:a&&l(`period.${a.period}`)}),e.jsx(ls,{label:l("dialog.fields.subscriptionPlan"),value:a?.plan?.name,valueClassName:"font-medium"}),e.jsx(ls,{label:l("dialog.fields.callbackNo"),value:a?.callback_no,valueClassName:"font-mono text-xs"})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:l("dialog.amountInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ls,{label:l("dialog.fields.paymentAmount"),value:Hs(a?.total_amount||0),valueClassName:"font-medium text-primary"}),e.jsx(Re,{className:"my-2"}),e.jsx(ls,{label:l("dialog.fields.balancePayment"),value:Hs(a?.balance_amount||0)}),e.jsx(ls,{label:l("dialog.fields.discountAmount"),value:Hs(a?.discount_amount||0),valueClassName:"text-green-600"}),e.jsx(ls,{label:l("dialog.fields.refundAmount"),value:Hs(a?.refund_amount||0),valueClassName:"text-red-600"}),e.jsx(ls,{label:l("dialog.fields.deductionAmount"),value:Hs(a?.surplus_amount||0)})]})]}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:l("dialog.timeInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ls,{label:l("dialog.fields.createdAt"),value:ie(a?.created_at),valueClassName:"font-mono text-xs"}),e.jsx(ls,{label:l("dialog.fields.updatedAt"),value:ie(a?.updated_at),valueClassName:"font-mono text-xs"})]})]}),(a?.commission_status===1||a?.commission_status===2)&&a?.commission_balance&&e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsx("div",{className:"mb-2 text-sm font-medium",children:l("dialog.commissionInfo")}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(ls,{label:l("dialog.fields.commissionStatus"),value:e.jsx(K,{variant:"secondary",className:"bg-orange-100 font-medium text-orange-800 hover:bg-orange-100",children:l("dialog.commissionStatusActive")})}),e.jsx(ls,{label:l("dialog.fields.commissionAmount"),value:Hs(a?.commission_balance||0),valueClassName:"font-medium text-orange-600"}),a?.actual_commission_balance&&e.jsx(ls,{label:l("dialog.fields.actualCommissionAmount"),value:Hs(a?.actual_commission_balance||0),valueClassName:"font-medium text-orange-700"}),a?.invite_user&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{className:"my-2"}),e.jsx(ls,{label:l("dialog.fields.inviteUser"),value:e.jsxs(st,{to:`/user/manage?email=${a.invite_user.email}`,className:"group inline-flex items-center gap-1 text-primary hover:underline",children:[a.invite_user.email,e.jsx(Cn,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]})}),e.jsx(ls,{label:l("dialog.fields.inviteUserId"),value:a?.invite_user?.id,valueClassName:"font-mono text-xs"})]})]})]})]})]})]})}const _h={[zs.NEW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[zs.RENEWAL]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[zs.UPGRADE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[zs.RESET_FLOW]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},Nh={[Xe.MONTH_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Xe.QUARTER_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Xe.HALF_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Xe.YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Xe.TWO_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Xe.THREE_YEAR_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Xe.ONETIME_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"},[Xe.RESET_PRICE]:{color:"text-slate-700",bgColor:"bg-slate-100/80"}},wh=s=>le[s],Ch=s=>we[s],Sh=s=>zs[s],kh=s=>{const{t:n}=O("order");return[{accessorKey:"trade_no",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.tradeNo")}),cell:({row:t})=>{const r=t.original.trade_no,a=r.length>6?`${r.slice(0,3)}...${r.slice(-3)}`:r;return e.jsx("div",{className:"flex items-center",children:e.jsx(yh,{trigger:e.jsxs(G,{variant:"ghost",size:"sm",className:"flex h-8 items-center gap-1.5 px-2 font-medium text-primary transition-colors hover:bg-primary/10 hover:text-primary/80",children:[e.jsx("span",{className:"font-mono",children:a}),e.jsx(Cn,{className:"h-3.5 w-3.5 opacity-70"})]}),id:t.original.id})})},enableSorting:!1,enableHiding:!1},{accessorKey:"type",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.type")}),cell:({row:t})=>{const r=t.getValue("type"),a=_h[r];return e.jsx(K,{variant:"secondary",className:_("font-medium transition-colors text-nowrap",a.color,a.bgColor,"border border-border/50","hover:bg-slate-200/80"),children:n(`type.${Sh(r)}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"plan.name",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.plan")}),cell:({row:t})=>e.jsx("div",{className:"flex space-x-2",children:e.jsx("span",{className:"max-w-32 truncate font-medium text-foreground/90 sm:max-w-72 md:max-w-[31rem]",children:t.original.plan?.name||"-"})}),enableSorting:!1,enableHiding:!1},{accessorKey:"period",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.period")}),cell:({row:t})=>{const r=t.getValue("period"),a=Nh[r];return e.jsx(K,{variant:"secondary",className:_("font-medium transition-colors text-nowrap",a?.color,a?.bgColor,"hover:bg-opacity-80"),children:n(`period.${r}`)})},enableSorting:!1,enableHiding:!1},{accessorKey:"total_amount",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.amount")}),cell:({row:t})=>{const r=t.getValue("total_amount"),a=typeof r=="number"?(r/100).toFixed(2):"N/A";return e.jsxs("div",{className:"flex items-center font-mono text-foreground/90",children:["¥",a]})},enableSorting:!0,enableHiding:!1},{accessorKey:"status",header:({column:t})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(z,{column:t,title:n("table.columns.status")}),e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{children:e.jsx(fi,{className:"h-4 w-4 text-muted-foreground/70 transition-colors hover:text-muted-foreground"})}),e.jsx(ce,{side:"top",className:"max-w-[200px] text-sm",children:n("status.tooltip")})]})})]}),cell:({row:t})=>{const r=Tt.find(a=>a.value===t.getValue("status"));return r?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[r.icon&&e.jsx(r.icon,{className:`h-4 w-4 text-${r.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n(`status.${wh(r.value)}`)})]}),r.value===le.PENDING&&e.jsxs(Us,{modal:!0,children:[e.jsx(Ks,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Fa,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(As,{align:"end",className:"w-[140px]",children:[e.jsx(Ce,{className:"cursor-pointer",onClick:async()=>{await ht.markPaid({trade_no:t.original.trade_no}),s()},children:n("actions.markAsPaid")}),e.jsx(Ce,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await ht.makeCancel({trade_no:t.original.trade_no}),s()},children:n("actions.cancel")})]})]})]}):null},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_balance",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.commission")}),cell:({row:t})=>{const r=t.getValue("commission_balance"),a=r?(r/100).toFixed(2):"-";return e.jsx("div",{className:"flex items-center font-mono text-foreground/90",children:r?`¥${a}`:"-"})},enableSorting:!0,enableHiding:!1},{accessorKey:"commission_status",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.commissionStatus")}),cell:({row:t})=>{const r=t.original.status,a=t.original.commission_balance,o=Bt.find(l=>l.value===t.getValue("commission_status"));return a==0||!o?e.jsx("span",{className:"text-muted-foreground",children:"-"}):e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[o.icon&&e.jsx(o.icon,{className:`h-4 w-4 text-${o.color}`}),e.jsx("span",{className:"text-sm font-medium",children:n(`commission.${Ch(o.value)}`)})]}),o.value===we.PENDING&&r===le.COMPLETED&&e.jsxs(Us,{modal:!0,children:[e.jsx(Ks,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 hover:bg-muted/60",children:[e.jsx(Fa,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:n("actions.openMenu")})]})}),e.jsxs(As,{align:"end",className:"w-[120px]",children:[e.jsx(Ce,{className:"cursor-pointer",onClick:async()=>{await ht.update({trade_no:t.original.trade_no,commission_status:we.PROCESSING}),s()},children:n("commission.PROCESSING")}),e.jsx(Ce,{className:"cursor-pointer text-destructive focus:text-destructive",onClick:async()=>{await ht.update({trade_no:t.original.trade_no,commission_status:we.INVALID}),s()},children:n("commission.INVALID")})]})]})]})},enableSorting:!0,enableHiding:!1},{accessorKey:"created_at",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.createdAt")}),cell:({row:t})=>e.jsx("div",{className:"text-nowrap font-mono text-sm text-muted-foreground",children:ie(t.getValue("created_at"),"YYYY/MM/DD HH:mm:ss")}),enableSorting:!0,enableHiding:!1}]};function Th(){const[s]=Il(),[n,t]=m.useState({}),[r,a]=m.useState({}),[o,l]=m.useState([]),[d,x]=m.useState([]),[u,i]=m.useState({pageIndex:0,pageSize:20});m.useEffect(()=>{const F=Object.entries({user_id:"string",order_id:"string",commission_status:"number",status:"number",commission_balance:"string"}).map(([w,V])=>{const y=s.get(w);return y?{id:w,value:V==="number"?parseInt(y):y}:null}).filter(Boolean);F.length>0&&l(F)},[s]);const{refetch:c,data:p,isLoading:P}=ne({queryKey:["orderList",u,o,d],queryFn:()=>ht.getList({pageSize:u.pageSize,current:u.pageIndex+1,filter:o,sort:d})}),T=We({data:p?.data??[],columns:kh(c),state:{sorting:d,columnVisibility:r,rowSelection:n,columnFilters:o,pagination:u},rowCount:p?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:t,onSortingChange:x,onColumnFiltersChange:l,onColumnVisibilityChange:a,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),onPaginationChange:i,getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(ns,{table:T,toolbar:e.jsx(vh,{table:T,refetch:c}),showPagination:!0})}function Dh(){const{t:s}=O("order");return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Th,{})})]})]})}const Fh=Object.freeze(Object.defineProperty({__proto__:null,default:Dh},Symbol.toStringTag,{value:"Module"}));function Ph({column:s,title:n,options:t}){const r=s?.getFacetedUniqueValues(),a=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Aa,{className:"mr-2 h-4 w-4"}),n,a?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:a.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:a.size>2?e.jsxs(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[a.size," selected"]}):t.filter(o=>a.has(o.value)).map(o=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:o.label},o.value))})]})]})}),e.jsx(Ge,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Gs,{children:[e.jsx(lt,{placeholder:n}),e.jsxs(Ws,{children:[e.jsx(it,{children:"No results found."}),e.jsx(xs,{children:t.map(o=>{const l=a.has(o.value);return e.jsxs($e,{onSelect:()=>{l?a.delete(o.value):a.add(o.value);const d=Array.from(a);s?.setFilterValue(d.length?d:void 0)},children:[e.jsx("div",{className:_("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",l?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(vt,{className:_("h-4 w-4")})}),o.icon&&e.jsx(o.icon,{className:`mr-2 h-4 w-4 text-muted-foreground text-${o.color}`}),e.jsx("span",{children:o.label}),r?.get(o.value)&&e.jsx("span",{className:"ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs",children:r.get(o.value)})]},o.value)})}),a.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{}),e.jsx(xs,{children:e.jsx($e,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}const Lh=s=>h.object({id:h.coerce.number().nullable().optional(),name:h.string().min(1,s("form.name.required")),code:h.string().nullable(),type:h.coerce.number(),value:h.coerce.number(),started_at:h.coerce.number(),ended_at:h.coerce.number(),limit_use:h.union([h.string(),h.number()]).nullable(),limit_use_with_user:h.union([h.string(),h.number()]).nullable(),generate_count:h.coerce.number().nullable().optional(),limit_plan_ids:h.array(h.coerce.number()).default([]).nullable(),limit_period:h.array(h.nativeEnum(Xt)).default([]).nullable()}).refine(n=>n.ended_at>n.started_at,{message:s("form.validity.endTimeError"),path:["ended_at"]}),Cr={name:"",code:null,type:ws.AMOUNT,value:0,started_at:Math.floor(Date.now()/1e3),ended_at:Math.floor(Date.now()/1e3)+7*24*60*60,limit_use:null,limit_use_with_user:null,limit_plan_ids:[],limit_period:[],generate_count:null},Rh=s=>[{label:s("form.timeRange.presets.1week"),days:7},{label:s("form.timeRange.presets.2weeks"),days:14},{label:s("form.timeRange.presets.1month"),days:30},{label:s("form.timeRange.presets.3months"),days:90},{label:s("form.timeRange.presets.6months"),days:180},{label:s("form.timeRange.presets.1year"),days:365}];function Si({defaultValues:s,refetch:n,type:t="create",dialogTrigger:r=null,open:a,onOpenChange:o}){const{t:l}=O("coupon"),[d,x]=m.useState(!1),u=a??d,i=o??x,[c,p]=m.useState([]),P=Lh(l),T=Rh(l),C=Ne({resolver:ke(P),defaultValues:s||Cr});m.useEffect(()=>{s&&C.reset(s)},[s,C]),m.useEffect(()=>{ys.getList().then(({data:N})=>p(N))},[]);const F=N=>{if(!N)return;const S=(M,E)=>{const g=new Date(E*1e3);return M.setHours(g.getHours(),g.getMinutes(),g.getSeconds()),Math.floor(M.getTime()/1e3)};N.from&&C.setValue("started_at",S(N.from,C.watch("started_at"))),N.to&&C.setValue("ended_at",S(N.to,C.watch("ended_at")))},w=N=>{const S=new Date,M=Math.floor(S.getTime()/1e3),E=Math.floor((S.getTime()+N*24*60*60*1e3)/1e3);C.setValue("started_at",M),C.setValue("ended_at",E)},V=async N=>{const S=await La.save(N);if(N.generate_count&&typeof S=="string"){const M=new Blob([S],{type:"text/csv;charset=utf-8;"}),E=document.createElement("a");E.href=window.URL.createObjectURL(M),E.download=`coupons_${new Date().getTime()}.csv`,E.click(),window.URL.revokeObjectURL(E.href)}i(!1),t==="create"&&C.reset(Cr),n()},y=(N,S)=>e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:S}),e.jsx(D,{type:"datetime-local",step:"1",value:ie(C.watch(N),"YYYY-MM-DDTHH:mm:ss"),onChange:M=>{const E=new Date(M.target.value);C.setValue(N,Math.floor(E.getTime()/1e3))},className:"h-8 [&::-webkit-calendar-picker-indicator]:hidden"})]});return e.jsxs(de,{open:u,onOpenChange:i,children:[r&&e.jsx(fs,{asChild:!0,children:r}),e.jsxs(oe,{className:"sm:max-w-[425px]",children:[e.jsx(ge,{children:e.jsx(me,{children:l(t==="create"?"form.add":"form.edit")})}),e.jsx(Te,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(V),className:"space-y-4",children:[e.jsx(j,{control:C.control,name:"name",render:({field:N})=>e.jsxs(f,{children:[e.jsx(v,{children:l("form.name.label")}),e.jsx(D,{placeholder:l("form.name.placeholder"),...N}),e.jsx(R,{})]})}),t==="create"&&e.jsx(j,{control:C.control,name:"generate_count",render:({field:N})=>e.jsxs(f,{children:[e.jsx(v,{children:l("form.generateCount.label")}),e.jsx(D,{type:"number",min:0,placeholder:l("form.generateCount.placeholder"),...N,value:N.value??"",onChange:S=>N.onChange(S.target.value===""?null:parseInt(S.target.value)),className:"h-9"}),e.jsx(A,{className:"text-xs",children:l("form.generateCount.description")}),e.jsx(R,{})]})}),(!C.watch("generate_count")||C.watch("generate_count")==null)&&e.jsx(j,{control:C.control,name:"code",render:({field:N})=>e.jsxs(f,{children:[e.jsx(v,{children:l("form.code.label")}),e.jsx(D,{placeholder:l("form.code.placeholder"),...N,value:N.value??"",className:"h-9"}),e.jsx(A,{className:"text-xs",children:l("form.code.description")}),e.jsx(R,{})]})}),e.jsxs(f,{children:[e.jsx(v,{children:l("form.type.label")}),e.jsxs("div",{className:"flex",children:[e.jsx(j,{control:C.control,name:"type",render:({field:N})=>e.jsxs(X,{value:N.value.toString(),onValueChange:S=>{const M=N.value,E=parseInt(S);N.onChange(E);const g=C.getValues("value");g&&(M===ws.AMOUNT&&E===ws.PERCENTAGE?C.setValue("value",g/100):M===ws.PERCENTAGE&&E===ws.AMOUNT&&C.setValue("value",g*100))},children:[e.jsx(J,{className:"flex-[1.2] rounded-r-none border-r-0 focus:z-10",children:e.jsx(Z,{placeholder:l("form.type.placeholder")})}),e.jsx(Q,{children:Object.entries(Um).map(([S,M])=>e.jsx(q,{value:S,children:l(`table.toolbar.types.${S}`)},S))})]})}),e.jsx(j,{control:C.control,name:"value",render:({field:N})=>{const S=N.value==null?"":C.watch("type")===ws.AMOUNT&&typeof N.value=="number"?(N.value/100).toString():N.value.toString();return e.jsx(D,{type:"number",placeholder:l("form.value.placeholder"),...N,value:S,onChange:M=>{const E=M.target.value;if(E===""){N.onChange("");return}const g=parseFloat(E);isNaN(g)||N.onChange(C.watch("type")===ws.AMOUNT?Math.round(g*100):g)},step:"any",min:0,className:"flex-[2] rounded-none border-x-0 text-left"})}}),e.jsx("div",{className:"flex min-w-[40px] items-center justify-center rounded-md rounded-l-none border border-l-0 border-input bg-muted/50 px-3 font-medium text-muted-foreground",children:e.jsx("span",{children:C.watch("type")==ws.AMOUNT?"¥":"%"})})]})]}),e.jsxs(f,{children:[e.jsx(v,{children:l("form.validity.label")}),e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(L,{variant:"outline",className:_("w-full justify-start text-left font-normal",!C.watch("started_at")&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),e.jsxs("span",{className:"truncate",children:[ie(C.watch("started_at"),"YYYY-MM-DD HH:mm:ss")," ",l("form.validity.to")," ",ie(C.watch("ended_at"),"YYYY-MM-DD HH:mm:ss")]})]})}),e.jsxs(Ge,{className:"w-auto p-0",align:"start",children:[e.jsxs("div",{className:"border-b border-border p-3",children:[e.jsx("div",{className:"mb-2 text-sm font-medium text-muted-foreground",children:l("form.timeRange.quickSet")}),e.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-6",children:T.map(N=>e.jsx(L,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs",onClick:()=>w(N.days),type:"button",children:N.label},N.days))})]}),e.jsx("div",{className:"hidden border-b border-border sm:block",children:e.jsx(Ss,{mode:"range",selected:{from:new Date(C.watch("started_at")*1e3),to:new Date(C.watch("ended_at")*1e3)},onSelect:F,numberOfMonths:2})}),e.jsx("div",{className:"border-b border-border sm:hidden",children:e.jsx(Ss,{mode:"range",selected:{from:new Date(C.watch("started_at")*1e3),to:new Date(C.watch("ended_at")*1e3)},onSelect:F,numberOfMonths:1})}),e.jsx("div",{className:"p-3",children:e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[y("started_at",l("table.validity.startTime")),e.jsx("div",{className:"text-center text-sm text-muted-foreground sm:mt-6",children:l("form.validity.to")}),y("ended_at",l("table.validity.endTime"))]})})]})]}),e.jsx(R,{})]}),e.jsx(j,{control:C.control,name:"limit_use",render:({field:N})=>e.jsxs(f,{children:[e.jsx(v,{children:l("form.limitUse.label")}),e.jsx(D,{type:"number",min:0,placeholder:l("form.limitUse.placeholder"),...N,value:N.value??"",onChange:S=>N.onChange(S.target.value===""?null:parseInt(S.target.value)),className:"h-9"}),e.jsx(A,{className:"text-xs",children:l("form.limitUse.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:C.control,name:"limit_use_with_user",render:({field:N})=>e.jsxs(f,{children:[e.jsx(v,{children:l("form.limitUseWithUser.label")}),e.jsx(D,{type:"number",min:0,placeholder:l("form.limitUseWithUser.placeholder"),...N,value:N.value??"",onChange:S=>N.onChange(S.target.value===""?null:parseInt(S.target.value)),className:"h-9"}),e.jsx(A,{className:"text-xs",children:l("form.limitUseWithUser.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:C.control,name:"limit_period",render:({field:N})=>e.jsxs(f,{children:[e.jsx(v,{children:l("form.limitPeriod.label")}),e.jsx(at,{options:Object.entries(Xt).filter(([S])=>isNaN(Number(S))).map(([S,M])=>({label:l(`coupon:period.${M}`),value:S})),onChange:S=>{if(S.length===0){N.onChange([]);return}const M=S.map(E=>Xt[E.value]);N.onChange(M)},value:(N.value||[]).map(S=>({label:l(`coupon:period.${S}`),value:Object.entries(Xt).find(([M,E])=>E===S)?.[0]||""})),placeholder:l("form.limitPeriod.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:l("form.limitPeriod.empty")})}),e.jsx(A,{className:"text-xs",children:l("form.limitPeriod.description")}),e.jsx(R,{})]})}),e.jsx(j,{control:C.control,name:"limit_plan_ids",render:({field:N})=>e.jsxs(f,{children:[e.jsx(v,{children:l("form.limitPlan.label")}),e.jsx(at,{options:c?.map(S=>({label:S.name,value:S.id.toString()}))||[],onChange:S=>N.onChange(S.map(M=>Number(M.value))),value:(c||[]).filter(S=>(N.value||[]).includes(S.id)).map(S=>({label:S.name,value:S.id.toString()})),placeholder:l("form.limitPlan.placeholder"),emptyIndicator:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:l("form.limitPlan.empty")})}),e.jsx(R,{})]})}),e.jsx(Ie,{children:e.jsx(L,{type:"submit",disabled:C.formState.isSubmitting,children:C.formState.isSubmitting?l("form.submit.saving"):l("form.submit.save")})})]})})]})]})}function Eh({table:s,refetch:n}){const t=s.getState().columnFilters.length>0,{t:r}=O("coupon");return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Si,{refetch:n,dialogTrigger:e.jsxs(L,{variant:"outline",size:"sm",className:"h-8 space-x-2",children:[e.jsx(Ke,{icon:"ion:add"}),e.jsx("div",{children:r("form.add")})]})}),e.jsx(D,{placeholder:r("table.toolbar.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:a=>s.getColumn("name")?.setFilterValue(a.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(Ph,{column:s.getColumn("type"),title:r("table.toolbar.type"),options:[{value:ws.AMOUNT,label:r(`table.toolbar.types.${ws.AMOUNT}`)},{value:ws.PERCENTAGE,label:r(`table.toolbar.types.${ws.PERCENTAGE}`)}]}),t&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[r("table.toolbar.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]})}const ki=m.createContext(void 0);function Vh({children:s,refetch:n}){const[t,r]=m.useState(!1),[a,o]=m.useState(null),l=x=>{o(x),r(!0)},d=()=>{r(!1),o(null)};return e.jsxs(ki.Provider,{value:{isOpen:t,currentCoupon:a,openEdit:l,closeEdit:d},children:[s,a&&e.jsx(Si,{defaultValues:a,refetch:n,type:"edit",open:t,onOpenChange:r})]})}function Ih(){const s=m.useContext(ki);if(s===void 0)throw new Error("useCouponEdit must be used within a CouponEditProvider");return s}const Mh=s=>{const{t:n}=O("coupon");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.id")}),cell:({row:t})=>e.jsx(K,{children:t.original.id}),enableSorting:!0},{accessorKey:"show",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.show")}),cell:({row:t})=>e.jsx(ee,{defaultChecked:t.original.show,onCheckedChange:r=>{La.update({id:t.original.id,show:r}).then(({data:a})=>!a&&s())}}),enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.name")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{children:t.original.name})}),enableSorting:!1,size:800},{accessorKey:"type",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.type")}),cell:({row:t})=>e.jsx(K,{variant:"outline",children:n(`table.toolbar.types.${t.original.type}`)}),enableSorting:!0},{accessorKey:"code",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.code")}),cell:({row:t})=>e.jsx(K,{variant:"secondary",children:t.original.code}),enableSorting:!0},{accessorKey:"limit_use",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.limitUse")}),cell:({row:t})=>e.jsx(K,{variant:"outline",children:t.original.limit_use===null?n("table.validity.unlimited"):t.original.limit_use}),enableSorting:!0},{accessorKey:"limit_use_with_user",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.limitUseWithUser")}),cell:({row:t})=>e.jsx(K,{variant:"outline",children:t.original.limit_use_with_user===null?n("table.validity.noLimit"):t.original.limit_use_with_user}),enableSorting:!0},{accessorKey:"#",header:({column:t})=>e.jsx(z,{column:t,title:n("table.columns.validity")}),cell:({row:t})=>{const[r,a]=m.useState(!1),o=Date.now(),l=t.original.started_at*1e3,d=t.original.ended_at*1e3,x=o>d,u=oe.jsx(z,{className:"justify-end",column:t,title:n("table.columns.actions")}),cell:({row:t})=>{const{openEdit:r}=Ih();return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-muted",onClick:()=>r(t.original),children:[e.jsx(nt,{className:"h-4 w-4 text-muted-foreground hover:text-foreground"}),e.jsx("span",{className:"sr-only",children:n("table.actions.edit")})]}),e.jsx(us,{title:n("table.actions.deleteConfirm.title"),description:n("table.actions.deleteConfirm.description"),confirmText:n("table.actions.deleteConfirm.confirmText"),variant:"destructive",onConfirm:async()=>{La.drop({id:t.original.id}).then(({data:a})=>{a&&($.success("删除成功"),s())})},children:e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-red-100 dark:hover:bg-red-900",children:[e.jsx(ms,{className:"h-4 w-4 text-muted-foreground hover:text-red-600 dark:hover:text-red-400"}),e.jsx("span",{className:"sr-only",children:n("table.actions.delete")})]})})]})}}]};function Oh(){const[s,n]=m.useState({}),[t,r]=m.useState({}),[a,o]=m.useState([]),[l,d]=m.useState([]),[x,u]=m.useState({pageIndex:0,pageSize:20}),{refetch:i,data:c}=ne({queryKey:["couponList",x,a,l],queryFn:()=>La.getList({pageSize:x.pageSize,current:x.pageIndex+1,filter:a,sort:l})}),p=We({data:c?.data??[],columns:Mh(i),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:x},pageCount:Math.ceil((c?.total??0)/x.pageSize),rowCount:c?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:o,onColumnVisibilityChange:r,onPaginationChange:u,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(Vh,{refetch:i,children:e.jsx("div",{className:"space-y-4",children:e.jsx(ns,{table:p,toolbar:e.jsx(Eh,{table:p,refetch:i})})})})}function zh(){const{t:s}=O("coupon");return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Oh,{})})]})]})}const $h=Object.freeze(Object.defineProperty({__proto__:null,default:zh},Symbol.toStringTag,{value:"Module"})),Ah=h.object({name:h.string().min(1,"请输入模板名称"),description:h.string().optional(),type:h.number().min(1).max(4),status:h.boolean(),sort:h.number().min(0),icon:h.string().optional(),background_image:h.string().optional(),conditions:h.object({allowed_plans:h.array(h.number()).optional(),disallowed_plans:h.array(h.number()).optional(),new_user_only:h.boolean().optional(),new_user_max_days:h.number().optional(),paid_user_only:h.boolean().optional(),require_invite:h.boolean().optional()}).optional(),limits:h.object({max_use_per_user:h.number().optional(),cooldown_hours:h.number().optional(),invite_reward_rate:h.number().optional()}).optional(),rewards:h.object({balance:h.number().optional(),transfer_enable:h.number().optional(),expire_days:h.number().optional(),device_limit:h.number().optional(),reset_package:h.boolean().optional(),plan_id:h.number().optional(),plan_validity_days:h.number().optional(),random_rewards:h.array(h.object({weight:h.number(),balance:h.number().optional(),transfer_enable:h.number().optional(),expire_days:h.number().optional(),device_limit:h.number().optional()})).optional()}),special_config:h.object({start_time:h.number().optional(),end_time:h.number().optional(),festival_bonus:h.number().optional()}).optional()});function Ti({template:s,refetch:n,open:t,onOpenChange:r}){const{t:a}=O("giftCard"),[o,l]=m.useState(!1),[d,x]=m.useState([]),[u,i]=m.useState([]),c=Ne({resolver:ke(Ah),defaultValues:{name:"",description:"",type:1,status:!0,sort:0,icon:"",background_image:"",conditions:{},limits:{},rewards:{},special_config:{}}}),{fields:p,append:P,remove:T}=Sd({control:c.control,name:"rewards.random_rewards"});m.useEffect(()=>{t&&(async()=>{try{const S=(await ys.getList()).data||[];x(S),i(S.map(M=>({label:M.name,value:M.id.toString()})))}catch(N){console.error("Failed to fetch plans:",N),$.error("Failed to load plan list")}})()},[t]),m.useEffect(()=>{if(s){const y=s.rewards||{};c.reset({name:s.name,description:s.description||"",type:s.type,status:s.status,sort:s.sort,icon:s.icon||"",background_image:s.background_image||"",conditions:s.conditions&&!Array.isArray(s.conditions)?s.conditions:{},limits:s.limits&&!Array.isArray(s.limits)?{...s.limits,invite_reward_rate:s.limits.invite_reward_rate||void 0}:{},rewards:{balance:y.balance?y.balance/100:void 0,transfer_enable:typeof y.transfer_enable=="number"?y.transfer_enable/1024/1024/1024:void 0,expire_days:y.expire_days,device_limit:y.device_limit,reset_package:y.reset_package,plan_id:y.plan_id,plan_validity_days:y.plan_validity_days,random_rewards:y.random_rewards?.map(N=>({weight:N.weight,balance:N.balance?N.balance/100:void 0,transfer_enable:typeof N.transfer_enable=="number"?N.transfer_enable/1024/1024/1024:void 0,expire_days:N.expire_days,device_limit:N.device_limit}))||[]},special_config:s.special_config&&!Array.isArray(s.special_config)?s.special_config:{}})}else c.reset({name:"",description:"",type:1,status:!0,sort:0,icon:"",background_image:"",conditions:{},limits:{},rewards:{random_rewards:[]},special_config:{}})},[s,c]);const C=y=>{console.error("Form validation failed:",y),$.error(a("messages.formInvalid"))},F=async y=>{l(!0);const N=JSON.parse(JSON.stringify(y));N.rewards&&(typeof N.rewards.balance=="number"&&(N.rewards.balance=Math.round(N.rewards.balance*100)),typeof N.rewards.transfer_enable=="number"&&(N.rewards.transfer_enable=Math.round(N.rewards.transfer_enable*1024*1024*1024)),N.rewards.random_rewards&&N.rewards.random_rewards.forEach(M=>{typeof M.balance=="number"&&(M.balance=Math.round(M.balance*100)),typeof M.transfer_enable=="number"&&(M.transfer_enable=Math.round(M.transfer_enable*1024*1024*1024))}));const S={...N,conditions:N.conditions||{},limits:N.limits||{},rewards:N.rewards||{},special_config:N.special_config||{}};try{s?(await Fs.updateTemplate({id:s.id,...S}),$.success(a("messages.templateUpdated"))):(await Fs.createTemplate(S),$.success(a("messages.templateCreated"))),n(),r(!1)}catch(M){const E=M?.response?.data?.errors;E&&Object.keys(E).forEach(g=>{c.setError(g,{type:"manual",message:E[g][0]})}),$.error(a(s?"messages.updateTemplateFailed":"messages.createTemplateFailed"))}finally{l(!1)}},w=c.watch("type"),V=w===1;return e.jsx(de,{open:t,onOpenChange:r,children:e.jsxs(oe,{className:"max-h-[90vh] max-w-4xl overflow-y-auto",children:[e.jsx(ge,{children:e.jsx(me,{children:a(s?"template.form.edit":"template.form.add")})}),e.jsx(Te,{...c,children:e.jsxs("form",{onSubmit:c.handleSubmit(F,C),className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(j,{control:c.control,name:"name",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.name.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:a("template.form.name.placeholder"),...y})}),e.jsx(R,{})]})}),e.jsx(j,{control:c.control,name:"type",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.type.label")}),e.jsxs(X,{value:y.value.toString(),onValueChange:N=>y.onChange(parseInt(N)),children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:a("template.form.type.placeholder")})})}),e.jsx(Q,{children:[1,2,3].map(N=>e.jsx(q,{value:N.toString(),children:a(`types.${N}`)},N))})]}),e.jsx(R,{})]})})]}),e.jsx(j,{control:c.control,name:"description",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.description.label")}),e.jsx(b,{children:e.jsx(Rs,{placeholder:a("template.form.description.placeholder"),...y})}),e.jsx(R,{})]})}),e.jsx("div",{className:"grid grid-cols-3 gap-4",children:e.jsx(j,{control:c.control,name:"status",render:({field:y})=>e.jsxs(f,{className:"col-span-3 flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{className:"text-base",children:a("template.form.status.label")}),e.jsx(A,{children:a("template.form.status.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:y.value,onCheckedChange:y.onChange})})]})})}),e.jsxs(Se,{children:[e.jsx(De,{children:e.jsx(Ve,{children:a("template.form.rewards.title")})}),e.jsxs(Fe,{className:"space-y-4",children:[V&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(j,{control:c.control,name:"rewards.balance",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.rewards.balance.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.rewards.balance.placeholder"),...y,value:y.value??"",onChange:N=>{const S=N.target.valueAsNumber;y.onChange(isNaN(S)?void 0:S)}})})]})}),e.jsx(j,{control:c.control,name:"rewards.transfer_enable",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.rewards.transfer_enable.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",min:"0",step:"0.01",placeholder:a("template.form.rewards.transfer_enable.placeholder"),value:y.value??"",onChange:N=>{const S=N.target.valueAsNumber;y.onChange(isNaN(S)?void 0:S)}})})]})}),e.jsx(j,{control:c.control,name:"rewards.expire_days",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.rewards.expire_days.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.rewards.expire_days.placeholder"),...y,value:y.value??"",onChange:N=>{const S=N.target.valueAsNumber;y.onChange(isNaN(S)?void 0:S)}})})]})}),e.jsx(j,{control:c.control,name:"rewards.device_limit",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.rewards.device_limit.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.rewards.device_limit.placeholder"),...y,value:y.value??"",onChange:N=>{const S=N.target.valueAsNumber;y.onChange(isNaN(S)?void 0:S)}})})]})})]}),e.jsx(j,{control:c.control,name:"rewards.reset_package",render:({field:y})=>e.jsxs(f,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{children:a("template.form.rewards.reset_package.label")}),e.jsx(A,{children:a("template.form.rewards.reset_package.description")})]}),e.jsx(b,{children:e.jsx(ee,{checked:y.value,onCheckedChange:y.onChange})})]})})]}),w===4&&e.jsx("p",{children:a("template.form.rewards.task_card.description")}),w===2&&e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(j,{control:c.control,name:"rewards.plan_id",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.rewards.plan_id.label")}),e.jsxs(X,{value:y.value?.toString(),onValueChange:N=>y.onChange(parseInt(N,10)),children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:a("template.form.rewards.plan_id.placeholder")})})}),e.jsx(Q,{children:d.map(N=>e.jsx(q,{value:N.id.toString(),children:N.name},N.id))})]}),e.jsx(R,{})]})}),e.jsx(j,{control:c.control,name:"rewards.plan_validity_days",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.rewards.plan_validity_days.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.rewards.plan_validity_days.placeholder"),...y,value:y.value??"",onChange:N=>{const S=N.target.valueAsNumber;y.onChange(isNaN(S)?void 0:S)}})})]})})]}),w===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{children:a("template.form.rewards.random_rewards.label")}),p.map((y,N)=>e.jsxs("div",{className:"flex items-center space-x-2 rounded-md border p-2",children:[e.jsx(j,{control:c.control,name:`rewards.random_rewards.${N}.weight`,render:({field:S})=>e.jsx(f,{children:e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.rewards.random_rewards.weight"),...S,value:S.value??"",onChange:M=>{const E=M.target.valueAsNumber;S.onChange(isNaN(E)?0:E)}})})})}),e.jsx(j,{control:c.control,name:`rewards.random_rewards.${N}.balance`,render:({field:S})=>e.jsx(f,{children:e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.rewards.balance.label"),...S,value:S.value??"",onChange:M=>{const E=M.target.valueAsNumber;S.onChange(isNaN(E)?void 0:E)}})})})}),e.jsx(j,{control:c.control,name:`rewards.random_rewards.${N}.transfer_enable`,render:({field:S})=>e.jsx(f,{children:e.jsx(b,{children:e.jsx(D,{type:"number",min:"0",step:"0.01",placeholder:a("template.form.rewards.transfer_enable.label")+" (GB)",value:S.value??"",onChange:M=>{const E=M.target.valueAsNumber;S.onChange(isNaN(E)?void 0:E)}})})})}),e.jsx(j,{control:c.control,name:`rewards.random_rewards.${N}.expire_days`,render:({field:S})=>e.jsx(f,{children:e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.rewards.expire_days.label"),...S,value:S.value??"",onChange:M=>{const E=M.target.valueAsNumber;S.onChange(isNaN(E)?void 0:E)}})})})}),e.jsx(j,{control:c.control,name:`rewards.random_rewards.${N}.device_limit`,render:({field:S})=>e.jsx(f,{children:e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.rewards.device_limit.label"),...S,value:S.value??"",onChange:M=>{const E=M.target.valueAsNumber;S.onChange(isNaN(E)?void 0:E)}})})})}),e.jsx(L,{type:"button",variant:"ghost",size:"icon",onClick:()=>T(N),children:e.jsx(kd,{className:"h-4 w-4"})})]},y.id)),e.jsx(L,{type:"button",variant:"outline",onClick:()=>P({weight:10,balance:void 0,transfer_enable:void 0,expire_days:void 0,device_limit:void 0}),children:a("template.form.rewards.random_rewards.add")})]})]})]}),e.jsxs(Se,{children:[e.jsx(De,{children:e.jsx(Ve,{children:a("template.form.conditions.title")})}),e.jsxs(Fe,{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-1 gap-4",children:e.jsx(j,{control:c.control,name:"conditions.new_user_max_days",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.conditions.new_user_max_days.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.conditions.new_user_max_days.placeholder"),...y,value:y.value??"",onChange:N=>{const S=N.target.valueAsNumber;y.onChange(isNaN(S)?void 0:S)}})})]})})}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(j,{control:c.control,name:"conditions.new_user_only",render:({field:y})=>e.jsxs(f,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(v,{children:a("template.form.conditions.new_user_only.label")})}),e.jsx(b,{children:e.jsx(ee,{checked:y.value,onCheckedChange:y.onChange})})]})}),e.jsx(j,{control:c.control,name:"conditions.paid_user_only",render:({field:y})=>e.jsxs(f,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(v,{children:a("template.form.conditions.paid_user_only.label")})}),e.jsx(b,{children:e.jsx(ee,{checked:y.value,onCheckedChange:y.onChange})})]})}),e.jsx(j,{control:c.control,name:"conditions.require_invite",render:({field:y})=>e.jsxs(f,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsx("div",{className:"space-y-0.5",children:e.jsx(v,{children:a("template.form.conditions.require_invite.label")})}),e.jsx(b,{children:e.jsx(ee,{checked:y.value,onCheckedChange:y.onChange})})]})})]}),e.jsx(j,{control:c.control,name:"conditions.allowed_plans",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.conditions.allowed_plans.label")}),e.jsx(b,{children:e.jsx(at,{value:y.value?.map(N=>({label:d.find(S=>S.id===N)?.name||`ID: ${N}`,value:N.toString()}))??[],onChange:N=>y.onChange(N.map(S=>parseInt(S.value))),options:u,placeholder:a("template.form.conditions.allowed_plans.placeholder")})})]})}),e.jsx(j,{control:c.control,name:"conditions.disallowed_plans",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.conditions.disallowed_plans.label")}),e.jsx(b,{children:e.jsx(at,{value:y.value?.map(N=>({label:d.find(S=>S.id===N)?.name||`ID: ${N}`,value:N.toString()}))??[],onChange:N=>y.onChange(N.map(S=>parseInt(S.value))),options:u,placeholder:a("template.form.conditions.disallowed_plans.placeholder")})})]})})]})]}),e.jsxs(Se,{children:[e.jsx(De,{children:e.jsx(Ve,{children:a("template.form.limits.title")})}),e.jsx(Fe,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(j,{control:c.control,name:"limits.max_use_per_user",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.limits.max_use_per_user.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.limits.max_use_per_user.placeholder"),...y,value:y.value??"",onChange:N=>{const S=N.target.valueAsNumber;y.onChange(isNaN(S)?void 0:S)}})})]})}),e.jsx(j,{control:c.control,name:"limits.cooldown_hours",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.limits.cooldown_hours.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",placeholder:a("template.form.limits.cooldown_hours.placeholder"),...y,value:y.value??"",onChange:N=>{const S=N.target.valueAsNumber;y.onChange(isNaN(S)?void 0:S)}})})]})}),e.jsx(j,{control:c.control,name:"limits.invite_reward_rate",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.limits.invite_reward_rate.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",step:"0.01",placeholder:a("template.form.limits.invite_reward_rate.placeholder"),...y,value:y.value??"",onChange:N=>{const S=N.target.valueAsNumber;y.onChange(isNaN(S)?void 0:S)}})}),e.jsx(A,{children:a("template.form.limits.invite_reward_rate.description")})]})})]})})]}),e.jsxs(Se,{children:[e.jsx(De,{children:e.jsx(Ve,{children:a("template.form.special_config.title")})}),e.jsx(Fe,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-3 items-end gap-4",children:[e.jsx(j,{control:c.control,name:"special_config.start_time",render:({field:y})=>e.jsxs(f,{className:"flex flex-col",children:[e.jsx(v,{children:a("template.form.special_config.start_time.label")}),e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsx(b,{children:e.jsxs(L,{variant:"outline",className:_("w-full pl-3 text-left font-normal",!y.value&&"text-muted-foreground"),children:[y.value?Pe(new Date(y.value*1e3),"PPP"):e.jsx("span",{children:a("template.form.special_config.start_time.placeholder")}),e.jsx(Cs,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Ge,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:y.value?new Date(y.value*1e3):void 0,onSelect:N=>y.onChange(N?Math.floor(N.getTime()/1e3):void 0),initialFocus:!0})})]}),e.jsx(R,{})]})}),e.jsx(j,{control:c.control,name:"special_config.end_time",render:({field:y})=>e.jsxs(f,{className:"flex flex-col",children:[e.jsx(v,{children:a("template.form.special_config.end_time.label")}),e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsx(b,{children:e.jsxs(L,{variant:"outline",className:_("w-full pl-3 text-left font-normal",!y.value&&"text-muted-foreground"),children:[y.value?Pe(new Date(y.value*1e3),"PPP"):e.jsx("span",{children:a("template.form.special_config.end_time.placeholder")}),e.jsx(Cs,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Ge,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:y.value?new Date(y.value*1e3):void 0,onSelect:N=>y.onChange(N?Math.floor(N.getTime()/1e3):void 0),initialFocus:!0})})]}),e.jsx(R,{})]})}),e.jsx(j,{control:c.control,name:"special_config.festival_bonus",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.special_config.festival_bonus.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",step:"0.1",placeholder:a("template.form.special_config.festival_bonus.placeholder"),...y,value:y.value??"",onChange:N=>{const S=N.target.valueAsNumber;y.onChange(isNaN(S)?void 0:S)}})})]})})]})})]}),e.jsxs(Se,{children:[e.jsx(De,{children:e.jsx(Ve,{children:a("template.form.display.title")})}),e.jsx(Fe,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(j,{control:c.control,name:"icon",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.icon.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:a("template.form.icon.placeholder"),...y})}),e.jsx(R,{})]})}),e.jsx(j,{control:c.control,name:"background_image",render:({field:y})=>e.jsxs(f,{children:[e.jsx(v,{children:a("template.form.background_image.label")}),e.jsx(b,{children:e.jsx(D,{placeholder:a("template.form.background_image.placeholder"),...y})}),e.jsx(R,{})]})})]})})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(L,{type:"button",variant:"outline",onClick:()=>r(!1),children:a("common:cancel")}),e.jsx(L,{type:"submit",disabled:o,children:a(o?"common:saving":"common:submit")})]})]})})]})})}const Di=m.createContext(void 0);function qh({children:s,refetch:n}){const[t,r]=m.useState(!1),[a,o]=m.useState(null),l=x=>{o(x),r(!!x)},d=()=>{r(!1),o(null)};return e.jsxs(Di.Provider,{value:{isOpen:t,editingTemplate:a,setEditingTemplate:l,closeEdit:d},children:[s,e.jsx(Ti,{template:a,refetch:n,open:t,onOpenChange:r})]})}function Uh(){const s=m.useContext(Di);if(s===void 0)throw new Error("useTemplateEdit must be used within a TemplateEditProvider");return s}function Hh({rewards:s,type:n}){const{t}=O(["giftCard","common"]),r=[];return s&&(s.balance&&r.push(`${t("template.form.rewards.balance.short_label")}: ${s.balance/100} ${t("common:currency.yuan","元")}`),s.transfer_enable&&r.push(`${t("template.form.rewards.transfer_enable.short_label")}: ${ze(s.transfer_enable)}`),s.expire_days&&r.push(`${t("template.form.rewards.expire_days.short_label")}: ${s.expire_days}${t("common:time.day","天")}`),s.device_limit&&r.push(`${t("template.form.rewards.device_limit.short_label")}: ${s.device_limit}`),n===2&&s.plan_id&&r.push(`${t("template.form.rewards.plan_id.short_label")}: ${s.plan_id}`),n===2&&s.plan_validity_days&&r.push(`${t("template.form.rewards.plan_validity_days.short_label")}: ${s.plan_validity_days}${t("common:time.day","天")}`),n===3&&s.random_rewards?.length&&r.push(t("types.3"))),r.length===0?e.jsx(K,{variant:"secondary",children:t("template.table.columns.no_rewards")}):e.jsx("div",{className:"flex flex-col space-y-1",children:r.map((a,o)=>e.jsx(K,{variant:"outline",className:"whitespace-nowrap",children:a},o))})}const Kh=s=>{const{t:n}=O("giftCard");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("template.table.columns.id")}),cell:({row:t})=>e.jsx(K,{children:t.original.id}),enableSorting:!0},{accessorKey:"status",header:({column:t})=>e.jsx(z,{column:t,title:n("template.table.columns.status")}),cell:({row:t})=>{const[r,a]=m.useState(!1);return e.jsx(ee,{checked:t.original.status,disabled:r,onCheckedChange:async o=>{a(!0);try{const{data:l}=await Fs.updateTemplate({id:t.original.id,status:o});l?($.success(n("messages.templateUpdated")),s()):$.error(n("messages.updateTemplateFailed"))}catch{$.error(n("messages.updateTemplateFailed"))}finally{a(!1)}}})},enableSorting:!1},{accessorKey:"name",header:({column:t})=>e.jsx(z,{column:t,title:n("template.table.columns.name")}),cell:({row:t})=>e.jsx("div",{className:"flex items-center",children:e.jsx("span",{children:t.original.name})}),enableSorting:!1,size:300},{accessorKey:"type",header:({column:t})=>e.jsx(z,{column:t,title:n("template.table.columns.type")}),cell:({row:t})=>e.jsx(K,{variant:"outline",children:n(`types.${t.original.type}`)}),enableSorting:!0},{accessorKey:"rewards",header:({column:t})=>e.jsx(z,{column:t,title:n("template.table.columns.rewards")}),cell:({row:t})=>e.jsx(Hh,{rewards:t.original.rewards,type:t.original.type}),enableSorting:!1},{accessorKey:"sort",header:({column:t})=>e.jsx(z,{column:t,title:n("template.table.columns.sort")}),cell:({row:t})=>e.jsx(K,{variant:"secondary",children:t.original.sort}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(z,{column:t,title:n("template.table.columns.created_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:ie(t.original.created_at)}),enableSorting:!0},{id:"actions",header:({column:t})=>e.jsx(z,{column:t,title:n("template.table.columns.actions")}),cell:({row:t})=>{const{setEditingTemplate:r}=Uh();return e.jsxs("div",{className:"flex space-x-2",children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>r(t.original),children:[e.jsx(nt,{className:"h-4 w-4"}),n("template.actions.edit")]}),e.jsx(us,{title:n("template.actions.deleteConfirm.title"),description:n("template.actions.deleteConfirm.description"),confirmText:n("template.actions.deleteConfirm.confirmText"),onConfirm:async()=>{try{const{data:a}=await Fs.deleteTemplate({id:t.original.id});a?($.success(n("messages.templateDeleted")),s()):$.error(n("messages.deleteTemplateFailed"))}catch{$.error(n("messages.deleteTemplateFailed"))}},children:e.jsxs(L,{variant:"outline",size:"sm",children:[e.jsx(ms,{className:"h-4 w-4"}),n("template.actions.delete")]})})]})},enableSorting:!1}]};function Fi({table:s}){return e.jsxs(Us,{children:[e.jsx(Td,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[e.jsx(Ml,{className:"mr-2 h-4 w-4"}),"显示列"]})}),e.jsxs(As,{align:"end",className:"w-[150px]",children:[e.jsx(Ha,{children:"切换显示列"}),e.jsx(tt,{}),s.getAllColumns().filter(n=>typeof n.accessorFn<"u"&&n.getCanHide()).map(n=>e.jsx(Xl,{className:"capitalize",checked:n.getIsVisible(),onCheckedChange:t=>n.toggleVisibility(!!t),children:n.id},n.id))]})]})}function Va({column:s,title:n,options:t}){const r=new Set(s?.getFilterValue());return e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(G,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Dd,{className:"mr-2 h-4 w-4"}),n,r?.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{orientation:"vertical",className:"mx-2 h-4"}),e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:r.size}),e.jsx("div",{className:"hidden space-x-1 lg:flex",children:r.size>2?e.jsxs(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[r.size," selected"]}):t.filter(a=>r.has(a.value)).map(a=>e.jsx(K,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:a.label},`selected-${a.value}`))})]})]})}),e.jsx(Ge,{className:"w-[200px] p-0",align:"start",children:e.jsxs(Gs,{children:[e.jsx(lt,{placeholder:n}),e.jsxs(Ws,{children:[e.jsx(it,{children:"No results found."}),e.jsx(xs,{children:t.map(a=>{const o=r.has(a.value);return e.jsxs($e,{onSelect:()=>{o?r.delete(a.value):r.add(a.value);const l=Array.from(r);s?.setFilterValue(l.length?l:void 0)},children:[e.jsx("div",{className:_("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",o?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:e.jsx(ba,{className:_("h-4 w-4")})}),a.icon&&e.jsx(a.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:a.label})]},`option-${a.value}`)})}),r.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(Mt,{}),e.jsx(xs,{children:e.jsx($e,{onSelect:()=>s?.setFilterValue(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function Bh({table:s,refetch:n}){const{t}=O("giftCard"),[r,a]=m.useState(!1),o=s.getState().columnFilters.length>0,l=[{label:t("types.1"),value:"1"},{label:t("types.2"),value:"2"},{label:t("types.3"),value:"3"},{label:t("types.4"),value:"4"},{label:t("types.5"),value:"5"},{label:t("types.6"),value:"6"},{label:t("types.7"),value:"7"},{label:t("types.8"),value:"8"},{label:t("types.9"),value:"9"},{label:t("types.10"),value:"10"}],d=[{label:t("common.enabled"),value:"true"},{label:t("common.disabled"),value:"false"}];return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(D,{placeholder:t("common.search"),value:s.getColumn("name")?.getFilterValue()??"",onChange:x=>s.getColumn("name")?.setFilterValue(x.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("type")&&e.jsx(Va,{column:s.getColumn("type"),title:t("template.table.columns.type"),options:l}),s.getColumn("status")&&e.jsx(Va,{column:s.getColumn("status"),title:t("template.table.columns.status"),options:d}),o&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[t("common.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>a(!0),children:[e.jsx(Ol,{className:"h-4 w-4 mr-2"}),t("template.form.add")]}),e.jsx(Fi,{table:s})]}),e.jsx(Ti,{template:null,refetch:n,open:r,onOpenChange:a})]})}function Gh(){const[s,n]=m.useState({}),[t,r]=m.useState({}),[a,o]=m.useState([]),[l,d]=m.useState([]),[x,u]=m.useState({pageIndex:0,pageSize:20}),{refetch:i,data:c}=ne({queryKey:["giftCardTemplates",x,a,l],queryFn:()=>Fs.getTemplates({per_page:x.pageSize,page:x.pageIndex+1,filter:a,sort:l})});console.log(c);const p=We({data:c?.data??[],columns:Kh(i),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:x},pageCount:Math.ceil((c?.total??0)/x.pageSize),rowCount:c?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:o,onColumnVisibilityChange:r,onPaginationChange:u,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx(qh,{refetch:i,children:e.jsx("div",{className:"space-y-4",children:e.jsx(ns,{table:p,toolbar:e.jsx(Bh,{table:p,refetch:i})})})})}const Wh=h.object({template_id:h.number().min(1,"请选择一个模板"),count:h.number().min(1,"生成数量必须大于0").max(1e4,"单次最多生成10000个"),prefix:h.string().optional(),expires_hours:h.number().min(1,"有效期必须大于0"),max_usage:h.number().min(1,"最大使用次数必须大于0"),download_csv:h.boolean().optional()});function Yh({refetch:s,open:n,onOpenChange:t}){const{t:r}=O("giftCard"),[a,o]=m.useState(!1),[l,d]=m.useState([]);m.useEffect(()=>{n&&Fs.getTemplates({per_page:1e3,page:1}).then(({data:i})=>{d(i||[])})},[n]);const x=Ne({resolver:ke(Wh),defaultValues:{count:10,prefix:"",expires_hours:24*30,max_usage:1,download_csv:!1}}),u=async i=>{o(!0);try{if(i.download_csv){const c=await Fs.generateCodes(i);if(c&&c instanceof Blob){const p=window.URL.createObjectURL(c),P=document.createElement("a");P.href=p,P.download=`gift_codes_${new Date().getTime()}.csv`,document.body.appendChild(P),P.click(),P.remove(),window.URL.revokeObjectURL(p),$.success(r("messages.codesGenerated")),s(),t(!1),x.reset()}}else await Fs.generateCodes(i),$.success(r("messages.codesGenerated")),s(),t(!1),x.reset()}catch{$.error(r("messages.generateCodesFailed"))}finally{o(!1)}};return e.jsx(de,{open:n,onOpenChange:t,children:e.jsxs(oe,{children:[e.jsx(ge,{children:e.jsx(me,{children:r("code.form.generate")})}),e.jsx(Te,{...x,children:e.jsxs("form",{onSubmit:x.handleSubmit(u),className:"space-y-4",children:[e.jsx(j,{control:x.control,name:"template_id",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:r("code.form.template_id.label")}),e.jsxs(X,{onValueChange:c=>i.onChange(parseInt(c)),children:[e.jsx(b,{children:e.jsx(J,{children:e.jsx(Z,{placeholder:r("code.form.template_id.placeholder")})})}),e.jsx(Q,{children:l.map(c=>e.jsx(q,{value:c.id.toString(),children:c.name},c.id))})]}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"count",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:r("code.form.count.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",...i,onChange:c=>i.onChange(parseInt(c.target.value)||0)})}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"prefix",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:r("code.form.prefix.label")}),e.jsx(b,{children:e.jsx(D,{...i})}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"expires_hours",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:r("code.form.expires_hours.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",...i,onChange:c=>i.onChange(parseInt(c.target.value)||0)})}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"max_usage",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:r("code.form.max_usage.label")}),e.jsx(b,{children:e.jsx(D,{type:"number",...i,onChange:c=>i.onChange(parseInt(c.target.value)||0)})}),e.jsx(R,{})]})}),e.jsx(j,{control:x.control,name:"download_csv",render:({field:i})=>e.jsxs(f,{className:"flex cursor-pointer flex-row items-center space-x-2 space-y-0",children:[e.jsx(b,{children:e.jsx("input",{type:"checkbox",checked:i.value,onChange:c=>i.onChange(c.target.checked)})}),e.jsx(v,{children:r("code.form.download_csv")})]})}),e.jsxs(Ie,{children:[e.jsx(L,{type:"button",variant:"outline",onClick:()=>t(!1),children:r("common.cancel")}),e.jsx(L,{type:"submit",disabled:a,children:r(a?"code.form.submit.generating":"code.form.submit.generate")})]})]})})]})})}function Jh({table:s,refetch:n}){const{t}=O("giftCard"),[r,a]=m.useState(!1),o=s.getState().columnFilters.length>0,l=Object.entries(t("code.status",{returnObjects:!0})).map(([d,x])=>({value:d,label:x}));return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(D,{placeholder:t("common.search"),value:s.getColumn("code")?.getFilterValue()??"",onChange:d=>s.getColumn("code")?.setFilterValue(d.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),s.getColumn("status")&&e.jsx(Va,{column:s.getColumn("status"),title:t("code.table.columns.status"),options:l}),o&&e.jsxs(L,{variant:"ghost",onClick:()=>s.resetColumnFilters(),className:"h-8 px-2 lg:px-3",children:[t("common.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>a(!0),children:[e.jsx(Ol,{className:"h-4 w-4 mr-2"}),t("code.form.generate")]}),e.jsxs(L,{variant:"outline",size:"sm",disabled:!0,children:[e.jsx(sa,{className:"h-4 w-4 mr-2"}),t("common.export")]}),e.jsx(Fi,{table:s})]}),e.jsx(Yh,{refetch:n,open:r,onOpenChange:a})]})}const Qh=0,Xh=1,Zh=2,hn=3,eg=s=>{const{t:n}=O("giftCard");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("code.table.columns.id")}),cell:({row:t})=>e.jsx(K,{children:t.original.id})},{accessorKey:"code",header:({column:t})=>e.jsx(z,{column:t,title:n("code.table.columns.code")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(K,{variant:"secondary",children:t.original.code}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>Rt(t.original.code).then(()=>{$.success(n("common:copy.success"))}),children:e.jsx(On,{className:"h-4 w-4"})})]})},{accessorKey:"template_name",header:({column:t})=>e.jsx(z,{column:t,title:n("code.table.columns.template_name")})},{accessorKey:"status",header:({column:t})=>e.jsx(z,{column:t,title:n("code.table.columns.status")}),cell:({row:t})=>{const r=t.original.status,a=r===hn,o=r===Qh||r===hn;return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(K,{variant:r===Xh?"secondary":r===Zh||r===hn?"destructive":"default",children:n(`code.status.${r}`)}),o&&e.jsx(ee,{checked:!a,onCheckedChange:async l=>{const d=l?"enable":"disable";try{const{data:x}=await Fs.toggleCode({id:t.original.id,action:d});x?($.success(n("messages.codeStatusUpdated")),s()):$.error(n("messages.updateCodeStatusFailed"))}catch{$.error(n("messages.updateCodeStatusFailed"))}}})]})}},{accessorKey:"expires_at",header:({column:t})=>e.jsx(z,{column:t,title:n("code.table.columns.expires_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:ie(t.original.expires_at)})},{accessorKey:"usage_count",header:({column:t})=>e.jsx(z,{column:t,title:n("code.table.columns.usage_count")}),cell:({row:t})=>e.jsx(K,{variant:"outline",children:t.original.usage_count})},{accessorKey:"max_usage",header:({column:t})=>e.jsx(z,{column:t,title:n("code.table.columns.max_usage")}),cell:({row:t})=>e.jsx(K,{variant:"outline",children:t.original.max_usage})},{accessorKey:"created_at",header:({column:t})=>e.jsx(z,{column:t,title:n("code.table.columns.created_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:ie(t.original.created_at)})}]};function sg(){const[s,n]=m.useState({}),[t,r]=m.useState({}),[a,o]=m.useState([]),[l,d]=m.useState([]),[x,u]=m.useState({pageIndex:0,pageSize:20}),{refetch:i,data:c}=ne({queryKey:["giftCardCodes",x,a,l],queryFn:()=>Fs.getCodes({per_page:x.pageSize,page:x.pageIndex+1,filter:a,sort:l})}),p=We({data:c?.data??[],columns:eg(i),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:x},pageCount:Math.ceil((c?.total??0)/x.pageSize),rowCount:c?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:o,onColumnVisibilityChange:r,onPaginationChange:u,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsx("div",{className:"space-y-4",children:e.jsx(ns,{table:p,toolbar:e.jsx(Jh,{table:p,refetch:i})})})}const tg=()=>{const{t:s}=O("giftCard");return[{accessorKey:"id",header:({column:n})=>e.jsx(z,{column:n,title:s("usage.table.columns.id")}),cell:({row:n})=>e.jsx(K,{children:n.original.id})},{accessorKey:"code",header:({column:n})=>e.jsx(z,{column:n,title:s("usage.table.columns.code")}),cell:({row:n})=>e.jsx(K,{variant:"secondary",children:n.original.code})},{accessorKey:"user_email",header:({column:n})=>e.jsx(z,{column:n,title:s("usage.table.columns.user_email")})},{accessorKey:"template_name",header:({column:n})=>e.jsx(z,{column:n,title:s("usage.table.columns.template_name")})},{accessorKey:"created_at",header:({column:n})=>e.jsx(z,{column:n,title:s("usage.table.columns.created_at")}),cell:({row:n})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:ie(n.original.created_at)})}]};function ag(){const[s,n]=m.useState([]),[t,r]=m.useState([]),[a,o]=m.useState({pageIndex:0,pageSize:20}),{data:l}=ne({queryKey:["giftCardUsages",a,s,t],queryFn:()=>Fs.getUsages({per_page:a.pageSize,page:a.pageIndex+1,filter:s,sort:t})}),d=We({data:l?.data??[],columns:tg(),state:{sorting:t,columnFilters:s,pagination:a},pageCount:Math.ceil((l?.total??0)/a.pageSize),rowCount:l?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,onSortingChange:r,onColumnFiltersChange:n,onPaginationChange:o,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),getSortedRowModel:ps()});return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(D,{placeholder:"搜索用户邮箱...",value:d.getColumn("user_email")?.getFilterValue()??"",onChange:x=>d.getColumn("user_email")?.setFilterValue(x.target.value),className:"h-8 w-[150px] lg:w-[250px]"})}),e.jsx(ns,{table:d})]})}function ng(){const{t:s}=O("giftCard"),{data:n,isLoading:t}=ne({queryKey:["giftCardStats"],queryFn:()=>Fs.getStatistics({})}),r=n?.data?.total_stats,a=[{title:s("statistics.total.templates_count"),value:r?.templates_count},{title:s("statistics.total.active_templates_count"),value:r?.active_templates_count},{title:s("statistics.total.codes_count"),value:r?.codes_count},{title:s("statistics.total.used_codes_count"),value:r?.used_codes_count}];return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:a.map((o,l)=>e.jsxs(Se,{children:[e.jsx(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:e.jsx(Ve,{className:"text-sm font-medium",children:o.title})}),e.jsx(Fe,{children:t?e.jsx(je,{className:"h-8 w-1/2"}):e.jsx("div",{className:"text-2xl font-bold",children:o.value??0})})]},l))})}function rg(){const{t:s}=O("giftCard"),[n,t]=m.useState("templates");return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-6 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s("description")})]})}),e.jsxs(bt,{value:n,onValueChange:t,className:"flex-1",children:[e.jsxs(rt,{className:"grid w-full grid-cols-4",children:[e.jsx(Be,{value:"templates",children:s("tabs.templates")}),e.jsx(Be,{value:"codes",children:s("tabs.codes")}),e.jsx(Be,{value:"usages",children:s("tabs.usages")}),e.jsx(Be,{value:"statistics",children:s("tabs.statistics")})]}),e.jsx(bs,{value:"templates",className:"mt-6 flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("template.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("template.description")})]})}),e.jsx(Gh,{})]})}),e.jsx(bs,{value:"codes",className:"mt-6 flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("code.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("code.description")})]})}),e.jsx(sg,{})]})}),e.jsx(bs,{value:"usages",className:"mt-6 flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("usage.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("usage.description")})]})}),e.jsx(ag,{})]})}),e.jsx(bs,{value:"statistics",className:"mt-6 flex-1",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:s("statistics.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("statistics.description")})]})}),e.jsx(ng,{})]})})]})]})]})}const lg=Object.freeze(Object.defineProperty({__proto__:null,default:rg},Symbol.toStringTag,{value:"Module"})),ig=1,og=1e6;let gn=0;function cg(){return gn=(gn+1)%Number.MAX_SAFE_INTEGER,gn.toString()}const pn=new Map,Sr=s=>{if(pn.has(s))return;const n=setTimeout(()=>{pn.delete(s),Zt({type:"REMOVE_TOAST",toastId:s})},og);pn.set(s,n)},dg=(s,n)=>{switch(n.type){case"ADD_TOAST":return{...s,toasts:[n.toast,...s.toasts].slice(0,ig)};case"UPDATE_TOAST":return{...s,toasts:s.toasts.map(t=>t.id===n.toast.id?{...t,...n.toast}:t)};case"DISMISS_TOAST":{const{toastId:t}=n;return t?Sr(t):s.toasts.forEach(r=>{Sr(r.id)}),{...s,toasts:s.toasts.map(r=>r.id===t||t===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return n.toastId===void 0?{...s,toasts:[]}:{...s,toasts:s.toasts.filter(t=>t.id!==n.toastId)}}},Na=[];let wa={toasts:[]};function Zt(s){wa=dg(wa,s),Na.forEach(n=>{n(wa)})}function mg({...s}){const n=cg(),t=a=>Zt({type:"UPDATE_TOAST",toast:{...a,id:n}}),r=()=>Zt({type:"DISMISS_TOAST",toastId:n});return Zt({type:"ADD_TOAST",toast:{...s,id:n,open:!0,onOpenChange:a=>{a||r()}}}),{id:n,dismiss:r,update:t}}function Pi(){const[s,n]=m.useState(wa);return m.useEffect(()=>(Na.push(n),()=>{const t=Na.indexOf(n);t>-1&&Na.splice(t,1)}),[s]),{...s,toast:mg,dismiss:t=>Zt({type:"DISMISS_TOAST",toastId:t})}}function ug({open:s,onOpenChange:n,table:t}){const{t:r}=O("user"),{toast:a}=Pi(),[o,l]=m.useState(!1),[d,x]=m.useState(""),[u,i]=m.useState(""),c=async()=>{if(!d||!u){a({title:r("messages.error"),description:r("messages.send_mail.required_fields"),variant:"destructive"});return}try{l(!0),await qs.sendMail({subject:d,content:u,filter:t.getState().columnFilters,sort:t.getState().sorting[0]?.id,sort_type:t.getState().sorting[0]?.desc?"DESC":"ASC"}),a({title:r("messages.success"),description:r("messages.send_mail.success")}),n(!1),x(""),i("")}catch{a({title:r("messages.error"),description:r("messages.send_mail.failed"),variant:"destructive"})}finally{l(!1)}};return e.jsx(de,{open:s,onOpenChange:n,children:e.jsxs(oe,{className:"sm:max-w-[500px]",children:[e.jsxs(ge,{children:[e.jsx(me,{children:r("send_mail.title")}),e.jsx(Ae,{children:r("send_mail.description")})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"subject",className:"text-right",children:r("send_mail.subject")}),e.jsx(D,{id:"subject",value:d,onChange:p=>x(p.target.value),className:"col-span-3"})]}),e.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[e.jsx("label",{htmlFor:"content",className:"text-right",children:r("send_mail.content")}),e.jsx(Rs,{id:"content",value:u,onChange:p=>i(p.target.value),className:"col-span-3",rows:6})]})]}),e.jsx(Ie,{children:e.jsx(G,{type:"submit",onClick:c,disabled:o,children:r(o?"send_mail.sending":"send_mail.send")})})]})})}function xg({trigger:s}){const{t:n}=O("user"),[t,r]=m.useState(!1),[a,o]=m.useState(30),{data:l,isLoading:d}=ne({queryKey:["trafficResetStats",a],queryFn:()=>na.getStats({days:a}),enabled:t}),x=[{title:n("traffic_reset.stats.total_resets"),value:l?.data?.total_resets||0,icon:Yt,color:"text-blue-600",bgColor:"bg-blue-100"},{title:n("traffic_reset.stats.auto_resets"),value:l?.data?.auto_resets||0,icon:Ta,color:"text-green-600",bgColor:"bg-green-100"},{title:n("traffic_reset.stats.manual_resets"),value:l?.data?.manual_resets||0,icon:Cs,color:"text-orange-600",bgColor:"bg-orange-100"},{title:n("traffic_reset.stats.cron_resets"),value:l?.data?.cron_resets||0,icon:zn,color:"text-purple-600",bgColor:"bg-purple-100"}],u=[{value:7,label:n("traffic_reset.stats.days_options.week")},{value:30,label:n("traffic_reset.stats.days_options.month")},{value:90,label:n("traffic_reset.stats.days_options.quarter")},{value:365,label:n("traffic_reset.stats.days_options.year")}];return e.jsxs(de,{open:t,onOpenChange:r,children:[e.jsx(fs,{asChild:!0,children:s}),e.jsxs(oe,{className:"max-w-2xl",children:[e.jsxs(ge,{children:[e.jsxs(me,{className:"flex items-center gap-2",children:[e.jsx(Vn,{className:"h-5 w-5"}),n("traffic_reset.stats.title")]}),e.jsx(Ae,{children:n("traffic_reset.stats.description")})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-medium",children:n("traffic_reset.stats.time_range")}),e.jsxs(X,{value:a.toString(),onValueChange:i=>o(Number(i)),children:[e.jsx(J,{className:"w-[180px]",children:e.jsx(Z,{})}),e.jsx(Q,{children:u.map(i=>e.jsx(q,{value:i.value.toString(),children:i.label},i.value))})]})]}),d?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(ea,{className:"h-6 w-6 animate-spin"})}):e.jsx("div",{className:"grid grid-cols-2 gap-4",children:x.map((i,c)=>e.jsxs(Se,{className:"relative overflow-hidden",children:[e.jsxs(De,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Ve,{className:"text-sm font-medium text-muted-foreground",children:i.title}),e.jsx("div",{className:`rounded-lg p-2 ${i.bgColor}`,children:e.jsx(i.icon,{className:`h-4 w-4 ${i.color}`})})]}),e.jsxs(Fe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:i.value.toLocaleString()}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n("traffic_reset.stats.in_period",{days:a})})]})]},c))}),l?.data&&e.jsxs(Se,{children:[e.jsxs(De,{children:[e.jsx(Ve,{className:"text-lg",children:n("traffic_reset.stats.breakdown")}),e.jsx(Xs,{children:n("traffic_reset.stats.breakdown_description")})]}),e.jsx(Fe,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:n("traffic_reset.stats.auto_percentage")}),e.jsxs(K,{variant:"outline",className:"border-green-200 bg-green-50 text-green-700",children:[l.data.total_resets>0?(l.data.auto_resets/l.data.total_resets*100).toFixed(1):0,"%"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:n("traffic_reset.stats.manual_percentage")}),e.jsxs(K,{variant:"outline",className:"border-orange-200 bg-orange-50 text-orange-700",children:[l.data.total_resets>0?(l.data.manual_resets/l.data.total_resets*100).toFixed(1):0,"%"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:n("traffic_reset.stats.cron_percentage")}),e.jsxs(K,{variant:"outline",className:"border-purple-200 bg-purple-50 text-purple-700",children:[l.data.total_resets>0?(l.data.cron_resets/l.data.total_resets*100).toFixed(1):0,"%"]})]})]})})]})]})]})]})}const hg=h.object({email_prefix:h.string().optional(),email_suffix:h.string().min(1),password:h.string().optional(),expired_at:h.number().optional().nullable(),plan_id:h.number().nullable(),generate_count:h.number().optional().nullable(),download_csv:h.boolean().optional()}).refine(s=>s.generate_count===null?s.email_prefix!==void 0&&s.email_prefix!=="":!0,{message:"Email prefix is required when generate_count is null",path:["email_prefix"]}),gg={email_prefix:"",email_suffix:"",password:"",expired_at:null,plan_id:null,generate_count:void 0,download_csv:!1};function pg({refetch:s}){const{t:n}=O("user"),[t,r]=m.useState(!1),a=Ne({resolver:ke(hg),defaultValues:gg,mode:"onChange"}),[o,l]=m.useState([]);return m.useEffect(()=>{t&&ys.getList().then(({data:d})=>{d&&l(d)})},[t]),e.jsxs(de,{open:t,onOpenChange:r,children:[e.jsx(fs,{asChild:!0,children:e.jsxs(G,{size:"sm",variant:"outline",className:"gap-0 space-x-2",children:[e.jsx(Ke,{icon:"ion:add"}),e.jsx("div",{children:n("generate.button")})]})}),e.jsxs(oe,{className:"sm:max-w-[425px]",children:[e.jsxs(ge,{children:[e.jsx(me,{children:n("generate.title")}),e.jsx(Ae,{})]}),e.jsxs(Te,{...a,children:[e.jsxs(f,{children:[e.jsx(v,{children:n("generate.form.email")}),e.jsxs("div",{className:"flex",children:[!a.watch("generate_count")&&e.jsx(j,{control:a.control,name:"email_prefix",render:({field:d})=>e.jsx(D,{className:"flex-[5] rounded-r-none",placeholder:n("generate.form.email_prefix"),...d})}),e.jsx("div",{className:`z-[-1] border border-r-0 border-input px-3 py-1 shadow-sm ${a.watch("generate_count")?"rounded-l-md":"border-l-0"}`,children:"@"}),e.jsx(j,{control:a.control,name:"email_suffix",render:({field:d})=>e.jsx(D,{className:"flex-[4] rounded-l-none",placeholder:n("generate.form.email_domain"),...d})})]})]}),e.jsx(j,{control:a.control,name:"password",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:n("generate.form.password")}),e.jsx(D,{placeholder:n("generate.form.password_placeholder"),...d}),e.jsx(R,{})]})}),e.jsx(j,{control:a.control,name:"expired_at",render:({field:d})=>e.jsxs(f,{className:"flex flex-col",children:[e.jsx(v,{children:n("generate.form.expire_time")}),e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsx(b,{children:e.jsxs(G,{variant:"outline",className:_("w-full pl-3 text-left font-normal",!d.value&&"text-muted-foreground"),children:[d.value?ie(d.value):e.jsx("span",{children:n("generate.form.expire_time_placeholder")}),e.jsx(Cs,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsxs(Ge,{className:"flex w-auto flex-col space-y-2 p-2",children:[e.jsx(Fd,{asChild:!0,children:e.jsx(G,{variant:"outline",className:"w-full",onClick:()=>{d.onChange(null)},children:n("generate.form.permanent")})}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Ss,{mode:"single",selected:d.value?new Date(d.value*1e3):void 0,onSelect:x=>{x&&d.onChange(x?.getTime()/1e3)}})})]})]})]})}),e.jsx(j,{control:a.control,name:"plan_id",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:n("generate.form.subscription")}),e.jsx(b,{children:e.jsxs(X,{value:d.value?d.value.toString():"null",onValueChange:x=>d.onChange(x==="null"?null:parseInt(x)),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:n("generate.form.subscription_none")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"null",children:n("generate.form.subscription_none")}),o.map(x=>e.jsx(q,{value:x.id.toString(),children:x.name},x.id))]})]})})]})}),!a.watch("email_prefix")&&e.jsx(j,{control:a.control,name:"generate_count",render:({field:d})=>e.jsxs(f,{children:[e.jsx(v,{children:n("generate.form.generate_count")}),e.jsx(D,{type:"number",placeholder:n("generate.form.generate_count_placeholder"),value:d.value||"",onChange:x=>d.onChange(x.target.value?parseInt(x.target.value):null)})]})}),a.watch("generate_count")&&e.jsx(j,{control:a.control,name:"download_csv",render:({field:d})=>e.jsxs(f,{className:"flex cursor-pointer flex-row items-center space-x-2 space-y-0",children:[e.jsx(b,{children:e.jsx(Gn,{checked:d.value,onCheckedChange:d.onChange})}),e.jsx(v,{children:n("generate.form.download_csv")})]})})]}),e.jsxs(Ie,{children:[e.jsx(G,{variant:"outline",onClick:()=>r(!1),children:n("generate.form.cancel")}),e.jsx(G,{onClick:()=>a.handleSubmit(async d=>{if(d.download_csv){const x=await qs.generate(d);if(x&&x instanceof Blob){const u=window.URL.createObjectURL(x),i=document.createElement("a");i.href=u,i.download=`users_${new Date().getTime()}.csv`,document.body.appendChild(i),i.click(),i.remove(),window.URL.revokeObjectURL(u),$.success(n("generate.form.success")),a.reset(),s(),r(!1)}}else{const{data:x}=await qs.generate(d);x&&($.success(n("generate.form.success")),a.reset(),s(),r(!1))}})(),children:n("generate.form.submit")})]})]})]})}const Wn=zr,Li=$r,fg=Ar,Ri=m.forwardRef(({className:s,...n},t)=>e.jsx(Ia,{className:_("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...n,ref:t}));Ri.displayName=Ia.displayName;const jg=jt("fixed overflow-y-scroll z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-md",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-md"}},defaultVariants:{side:"right"}}),sn=m.forwardRef(({side:s="right",className:n,children:t,...r},a)=>e.jsxs(fg,{children:[e.jsx(Ri,{}),e.jsxs(Ma,{ref:a,className:_(jg({side:s}),n),...r,children:[e.jsxs(Pn,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(is,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),t]})]}));sn.displayName=Ma.displayName;const tn=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col space-y-2 text-center sm:text-left",s),...n});tn.displayName="SheetHeader";const Ei=({className:s,...n})=>e.jsx("div",{className:_("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...n});Ei.displayName="SheetFooter";const an=m.forwardRef(({className:s,...n},t)=>e.jsx(Oa,{ref:t,className:_("text-lg font-semibold text-foreground",s),...n}));an.displayName=Oa.displayName;const nn=m.forwardRef(({className:s,...n},t)=>e.jsx(za,{ref:t,className:_("text-sm text-muted-foreground",s),...n}));nn.displayName=za.displayName;function vg({table:s,refetch:n,permissionGroups:t=[],subscriptionPlans:r=[]}){const{t:a}=O("user"),{toast:o}=Pi(),l=s.getState().columnFilters.length>0,[d,x]=m.useState([]),[u,i]=m.useState(!1),[c,p]=m.useState(!1),[P,T]=m.useState(!1),[C,F]=m.useState(!1),w=async()=>{try{const te=await qs.dumpCSV({filter:s.getState().columnFilters,sort:s.getState().sorting[0]?.id,sort_type:s.getState().sorting[0]?.desc?"DESC":"ASC"}),ae=te;console.log(te);const B=new Blob([ae],{type:"text/csv;charset=utf-8;"}),se=window.URL.createObjectURL(B),fe=document.createElement("a");fe.href=se,fe.setAttribute("download",`users_${new Date().toISOString()}.csv`),document.body.appendChild(fe),fe.click(),fe.remove(),window.URL.revokeObjectURL(se),o({title:a("messages.success"),description:a("messages.export.success")})}catch{o({title:a("messages.error"),description:a("messages.export.failed"),variant:"destructive"})}},V=async()=>{try{F(!0),await qs.batchBan({filter:s.getState().columnFilters,sort:s.getState().sorting[0]?.id,sort_type:s.getState().sorting[0]?.desc?"DESC":"ASC"}),o({title:a("messages.success"),description:a("messages.batch_ban.success")}),n()}catch{o({title:a("messages.error"),description:a("messages.batch_ban.failed"),variant:"destructive"})}finally{F(!1),T(!1)}},y=[{label:a("filter.fields.email"),value:"email",type:"text",operators:[{label:a("filter.operators.contains"),value:"contains"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.id"),value:"id",type:"number",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.plan_id"),value:"plan_id",type:"select",operators:[{label:a("filter.operators.eq"),value:"eq"}],useOptions:!0},{label:a("filter.fields.transfer_enable"),value:"transfer_enable",type:"number",unit:"GB",operators:[{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.lt"),value:"lt"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.total_used"),value:"total_used",type:"number",unit:"GB",operators:[{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.lt"),value:"lt"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.online_count"),value:"online_count",type:"number",operators:[{label:a("filter.operators.eq"),value:"eq"},{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.lt"),value:"lt"}]},{label:a("filter.fields.expired_at"),value:"expired_at",type:"date",operators:[{label:a("filter.operators.lt"),value:"lt"},{label:a("filter.operators.gt"),value:"gt"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.uuid"),value:"uuid",type:"text",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.token"),value:"token",type:"text",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.banned"),value:"banned",type:"select",operators:[{label:a("filter.operators.eq"),value:"eq"}],options:[{label:a("filter.status.normal"),value:"0"},{label:a("filter.status.banned"),value:"1"}]},{label:a("filter.fields.remark"),value:"remarks",type:"text",operators:[{label:a("filter.operators.contains"),value:"contains"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.inviter_email"),value:"invite_user.email",type:"text",operators:[{label:a("filter.operators.contains"),value:"contains"},{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.invite_user_id"),value:"invite_user_id",type:"number",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.is_admin"),value:"is_admin",type:"boolean",operators:[{label:a("filter.operators.eq"),value:"eq"}]},{label:a("filter.fields.is_staff"),value:"is_staff",type:"boolean",operators:[{label:a("filter.operators.eq"),value:"eq"}]}],N=te=>te*1024*1024*1024,S=te=>te/(1024*1024*1024),M=()=>{x([...d,{field:"",operator:"",value:""}])},E=te=>{x(d.filter((ae,B)=>B!==te))},g=(te,ae,B)=>{const se=[...d];if(se[te]={...se[te],[ae]:B},ae==="field"){const fe=y.find(cs=>cs.value===B);fe&&(se[te].operator=fe.operators[0].value,se[te].value=fe.type==="boolean"?!1:"")}x(se)},k=(te,ae)=>{const B=y.find(se=>se.value===te.field);if(!B)return null;switch(B.type){case"text":return e.jsx(D,{placeholder:a("filter.sheet.value"),value:te.value,onChange:se=>g(ae,"value",se.target.value)});case"number":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(D,{type:"number",placeholder:a("filter.sheet.value_number",{unit:B.unit}),value:B.unit==="GB"?S(te.value||0):te.value,onChange:se=>{const fe=Number(se.target.value);g(ae,"value",B.unit==="GB"?N(fe):fe)}}),B.unit&&e.jsx("span",{className:"text-sm text-muted-foreground",children:B.unit})]});case"date":return e.jsx(Ss,{mode:"single",selected:te.value,onSelect:se=>g(ae,"value",se),className:"flex flex-1 justify-center rounded-md border"});case"select":return e.jsxs(X,{value:te.value,onValueChange:se=>g(ae,"value",se),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:a("filter.sheet.value")})}),e.jsx(Q,{children:B.useOptions?r.map(se=>e.jsx(q,{value:se.value.toString(),children:se.label},se.value)):B.options?.map(se=>e.jsx(q,{value:se.value.toString(),children:se.label},se.value))})]});case"boolean":return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ee,{checked:te.value,onCheckedChange:se=>g(ae,"value",se)}),e.jsx(Qe,{children:te.value?a("filter.boolean.true"):a("filter.boolean.false")})]});default:return null}},W=()=>{const te=d.filter(ae=>ae.field&&ae.operator&&ae.value!=="").map(ae=>{const B=y.find(fe=>fe.value===ae.field);let se=ae.value;return ae.operator==="contains"?{id:ae.field,value:se}:(B?.type==="date"&&se instanceof Date&&(se=Math.floor(se.getTime()/1e3)),B?.type==="boolean"&&(se=se?1:0),{id:ae.field,value:`${ae.operator}:${se}`})});s.setColumnFilters(te),i(!1)};return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[e.jsx(pg,{refetch:n}),e.jsx(D,{placeholder:a("filter.email_search"),value:s.getColumn("email")?.getFilterValue()??"",onChange:te=>s.getColumn("email")?.setFilterValue(te.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(Wn,{open:u,onOpenChange:i,children:[e.jsx(Li,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:[e.jsx(Ml,{className:"mr-2 h-4 w-4"}),a("filter.advanced"),d.length>0&&e.jsx(K,{variant:"secondary",className:"ml-2 rounded-sm px-1",children:d.length})]})}),e.jsxs(sn,{className:"w-[400px] sm:w-[540px]",children:[e.jsxs(tn,{children:[e.jsx(an,{children:a("filter.sheet.title")}),e.jsx(nn,{children:a("filter.sheet.description")})]}),e.jsxs("div",{className:"mt-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-medium",children:a("filter.sheet.conditions")}),e.jsx(L,{variant:"outline",size:"sm",onClick:M,children:a("filter.sheet.add")})]}),e.jsx(ft,{className:"h-[calc(100vh-280px)] ",children:e.jsx("div",{className:"space-y-4",children:d.map((te,ae)=>e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Qe,{children:a("filter.sheet.condition",{number:ae+1})}),e.jsx(L,{variant:"ghost",size:"sm",onClick:()=>E(ae),children:e.jsx(is,{className:"h-4 w-4"})})]}),e.jsxs(X,{value:te.field,onValueChange:B=>g(ae,"field",B),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:a("filter.sheet.field")})}),e.jsx(Q,{children:e.jsx(Ns,{children:y.map(B=>e.jsx(q,{value:B.value,className:"cursor-pointer",children:B.label},B.value))})})]}),te.field&&e.jsxs(X,{value:te.operator,onValueChange:B=>g(ae,"operator",B),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:a("filter.sheet.operator")})}),e.jsx(Q,{children:y.find(B=>B.value===te.field)?.operators.map(B=>e.jsx(q,{value:B.value,children:B.label},B.value))})]}),te.field&&te.operator&&k(te,ae)]},ae))})}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(L,{variant:"outline",onClick:()=>{x([]),i(!1)},children:a("filter.sheet.reset")}),e.jsx(L,{onClick:W,children:a("filter.sheet.apply")})]})]})]})]}),l&&e.jsxs(L,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),x([])},className:"h-8 px-2 lg:px-3",children:[a("filter.sheet.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]}),e.jsxs(Us,{modal:!1,children:[e.jsx(Ks,{asChild:!0,children:e.jsx(L,{variant:"outline",size:"sm",className:"h-8 border-dashed",children:a("actions.title")})}),e.jsxs(As,{children:[e.jsx(Ce,{onClick:()=>p(!0),children:a("actions.send_email")}),e.jsx(Ce,{onClick:w,children:a("actions.export_csv")}),e.jsx(tt,{}),e.jsx(Ce,{asChild:!0,children:e.jsx(xg,{trigger:e.jsx("div",{className:"w-full cursor-pointer px-2 py-1.5 text-sm",children:a("actions.traffic_reset_stats")})})}),e.jsx(tt,{}),e.jsx(Ce,{onClick:()=>T(!0),className:"text-red-600 focus:text-red-600",children:a("actions.batch_ban")})]})]})]}),e.jsx(ug,{open:c,onOpenChange:p,table:s}),e.jsx(Kn,{open:P,onOpenChange:T,children:e.jsxs(Ba,{children:[e.jsxs(Ga,{children:[e.jsx(Ya,{children:a("actions.confirm_ban.title")}),e.jsx(Ja,{children:a(l?"actions.confirm_ban.filtered_description":"actions.confirm_ban.all_description")})]}),e.jsxs(Wa,{children:[e.jsx(Xa,{disabled:C,children:a("actions.confirm_ban.cancel")}),e.jsx(Qa,{onClick:V,disabled:C,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:a(C?"actions.confirm_ban.banning":"actions.confirm_ban.confirm")})]})]})})]})}const Vi=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m17.71 11.29l-5-5a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21l-5 5a1 1 0 0 0 1.42 1.42L11 9.41V17a1 1 0 0 0 2 0V9.41l3.29 3.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42"})}),Ii=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.71 11.29a1 1 0 0 0-1.42 0L13 14.59V7a1 1 0 0 0-2 0v7.59l-3.29-3.3a1 1 0 0 0-1.42 1.42l5 5a1 1 0 0 0 .33.21a.94.94 0 0 0 .76 0a1 1 0 0 0 .33-.21l5-5a1 1 0 0 0 0-1.42"})}),bg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17 11H9.41l3.3-3.29a1 1 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33a1 1 0 0 0 0 .76a1 1 0 0 0 .21.33l5 5a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42L9.41 13H17a1 1 0 0 0 0-2"})}),yg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M17.92 11.62a1 1 0 0 0-.21-.33l-5-5a1 1 0 0 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l5-5a1 1 0 0 0 .21-.33a1 1 0 0 0 0-.76"})}),fn=[{accessorKey:"record_at",header:"时间",cell:({row:s})=>e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("time",{className:"text-sm text-muted-foreground",children:Yd(s.original.record_at)})})},{accessorKey:"u",header:"上行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Vi,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"font-mono text-sm",children:ze(s.original.u/parseFloat(s.original.server_rate))})]})},{accessorKey:"d",header:"下行流量",cell:({row:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ii,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"font-mono text-sm",children:ze(s.original.d/parseFloat(s.original.server_rate))})]})},{accessorKey:"server_rate",header:"倍率",cell:({row:s})=>{const n=s.original.server_rate;return e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(K,{variant:"outline",className:"font-mono",children:[n,"x"]})})}},{id:"total",header:"总计",cell:({row:s})=>{const n=s.original.u+s.original.d;return e.jsx("div",{className:"flex items-center justify-end font-mono text-sm",children:ze(n)})}}];function Mi({user_id:s,dialogTrigger:n}){const{t}=O(["traffic"]),[r,a]=m.useState(!1),[o,l]=m.useState({pageIndex:0,pageSize:20}),{data:d,isLoading:x}=ne({queryKey:["userStats",s,o,r],queryFn:()=>r?qs.getStats({user_id:s,pageSize:o.pageSize,page:o.pageIndex+1}):null}),u=We({data:d?.data??[],columns:fn,pageCount:Math.ceil((d?.total??0)/o.pageSize),state:{pagination:o},manualPagination:!0,getCoreRowModel:Ye(),onPaginationChange:l});return e.jsxs(de,{open:r,onOpenChange:a,children:[e.jsx(fs,{asChild:!0,children:n}),e.jsxs(oe,{className:"sm:max-w-[700px]",children:[e.jsx(ge,{children:e.jsx(me,{children:t("trafficRecord.title")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-md border",children:e.jsxs(An,{children:[e.jsx(qn,{children:u.getHeaderGroups().map(i=>e.jsx(Qs,{children:i.headers.map(c=>e.jsx(Hn,{className:_("h-10 px-2 text-xs",c.id==="total"&&"text-right"),children:c.isPlaceholder?null:Sa(c.column.columnDef.header,c.getContext())},c.id))},i.id))}),e.jsx(Un,{children:x?Array.from({length:o.pageSize}).map((i,c)=>e.jsx(Qs,{children:Array.from({length:fn.length}).map((p,P)=>e.jsx(Pt,{className:"p-2",children:e.jsx(je,{className:"h-6 w-full"})},P))},c)):u.getRowModel().rows?.length?u.getRowModel().rows.map(i=>e.jsx(Qs,{"data-state":i.getIsSelected()&&"selected",className:"h-10",children:i.getVisibleCells().map(c=>e.jsx(Pt,{className:"px-2",children:Sa(c.column.columnDef.cell,c.getContext())},c.id))},i.id)):e.jsx(Qs,{children:e.jsx(Pt,{colSpan:fn.length,className:"h-24 text-center",children:t("trafficRecord.noRecords")})})})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-sm font-medium",children:t("trafficRecord.perPage")}),e.jsxs(X,{value:`${u.getState().pagination.pageSize}`,onValueChange:i=>{u.setPageSize(Number(i))},children:[e.jsx(J,{className:"h-8 w-[70px]",children:e.jsx(Z,{placeholder:u.getState().pagination.pageSize})}),e.jsx(Q,{side:"top",children:[10,20,30,40,50].map(i=>e.jsx(q,{value:`${i}`,children:i},i))})]}),e.jsx("p",{className:"text-sm font-medium",children:t("trafficRecord.records")})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"flex w-[100px] items-center justify-center text-sm",children:t("trafficRecord.page",{current:u.getState().pagination.pageIndex+1,total:u.getPageCount()})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>u.previousPage(),disabled:!u.getCanPreviousPage()||x,children:e.jsx(bg,{className:"h-4 w-4"})}),e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>u.nextPage(),disabled:!u.getCanNextPage()||x,children:e.jsx(yg,{className:"h-4 w-4"})})]})]})]})]})]})]})}function _g({user:s,trigger:n,onSuccess:t}){const{t:r}=O("user"),[a,o]=m.useState(!1),[l,d]=m.useState(""),[x,u]=m.useState(!1),{data:i,isLoading:c}=ne({queryKey:["trafficResetHistory",s.id],queryFn:()=>na.getUserHistory(s.id,{limit:10}),enabled:a}),p=async()=>{try{u(!0);const{data:C}=await na.resetUser({user_id:s.id,reason:l.trim()||void 0});C&&($.success(r("traffic_reset.reset_success")),o(!1),d(""),t?.())}finally{u(!1)}},P=C=>{switch(C){case"manual":return"bg-blue-100 text-blue-800 border-blue-200";case"monthly":return"bg-green-100 text-green-800 border-green-200";case"yearly":return"bg-purple-100 text-purple-800 border-purple-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},T=C=>{switch(C){case"manual":return"bg-orange-100 text-orange-800 border-orange-200";case"cron":return"bg-indigo-100 text-indigo-800 border-indigo-200";case"auto":return"bg-emerald-100 text-emerald-800 border-emerald-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}};return e.jsxs(de,{open:a,onOpenChange:o,children:[e.jsx(fs,{asChild:!0,children:n}),e.jsxs(oe,{className:"max-h-[90vh] max-w-4xl overflow-hidden",children:[e.jsxs(ge,{children:[e.jsxs(me,{className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"h-5 w-5"}),r("traffic_reset.title")]}),e.jsx(Ae,{children:r("traffic_reset.description",{email:s.email})})]}),e.jsxs(bt,{defaultValue:"reset",className:"w-full",children:[e.jsxs(rt,{className:"grid w-full grid-cols-2",children:[e.jsxs(Be,{value:"reset",className:"flex items-center gap-2",children:[e.jsx(Yt,{className:"h-4 w-4"}),r("traffic_reset.tabs.reset")]}),e.jsxs(Be,{value:"history",className:"flex items-center gap-2",children:[e.jsx(cr,{className:"h-4 w-4"}),r("traffic_reset.tabs.history")]})]}),e.jsxs(bs,{value:"reset",className:"space-y-4",children:[e.jsxs(Se,{children:[e.jsx(De,{className:"pb-3",children:e.jsxs(Ve,{className:"flex items-center gap-2 text-lg",children:[e.jsx(zl,{className:"h-5 w-5"}),r("traffic_reset.user_info")]})}),e.jsx(Fe,{className:"space-y-3",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx(Qe,{className:"text-muted-foreground",children:r("columns.email")}),e.jsx("p",{className:"font-medium",children:s.email})]}),e.jsxs("div",{children:[e.jsx(Qe,{className:"text-muted-foreground",children:r("columns.used_traffic")}),e.jsx("p",{className:"font-medium",children:ze(s.total_used)})]}),e.jsxs("div",{children:[e.jsx(Qe,{className:"text-muted-foreground",children:r("columns.total_traffic")}),e.jsx("p",{className:"font-medium",children:ze(s.transfer_enable)})]}),e.jsxs("div",{children:[e.jsx(Qe,{className:"text-muted-foreground",children:r("columns.expire_time")}),e.jsx("p",{className:"font-medium",children:s.expired_at?ie(s.expired_at):r("columns.expire_status.permanent")})]})]})})]}),e.jsxs(Se,{className:"border-amber-200 bg-amber-50",children:[e.jsx(De,{className:"pb-3",children:e.jsxs(Ve,{className:"flex items-center gap-2 text-lg text-amber-800",children:[e.jsx(Wt,{className:"h-5 w-5"}),r("traffic_reset.warning.title")]})}),e.jsx(Fe,{children:e.jsxs("ul",{className:"space-y-2 text-sm text-amber-700",children:[e.jsxs("li",{children:["• ",r("traffic_reset.warning.irreversible")]}),e.jsxs("li",{children:["• ",r("traffic_reset.warning.reset_to_zero")]}),e.jsxs("li",{children:["• ",r("traffic_reset.warning.logged")]})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Qe,{htmlFor:"reason",children:r("traffic_reset.reason.label")}),e.jsx(Rs,{id:"reason",placeholder:r("traffic_reset.reason.placeholder"),value:l,onChange:C=>d(C.target.value),className:"min-h-[80px]"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r("traffic_reset.reason.optional")})]}),e.jsxs(Ie,{children:[e.jsx(G,{variant:"outline",onClick:()=>o(!1),children:r("common:cancel")}),e.jsx(G,{onClick:p,disabled:x,className:"bg-destructive hover:bg-destructive/90",children:x?e.jsxs(e.Fragment,{children:[e.jsx(ea,{className:"mr-2 h-4 w-4 animate-spin"}),r("traffic_reset.resetting")]}):e.jsxs(e.Fragment,{children:[e.jsx(Yt,{className:"mr-2 h-4 w-4"}),r("traffic_reset.confirm_reset")]})})]})]}),e.jsx(bs,{value:"history",className:"space-y-4",children:c?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(ea,{className:"h-6 w-6 animate-spin"})}):e.jsxs("div",{className:"space-y-4",children:[i?.data?.user&&e.jsxs(Se,{children:[e.jsx(De,{className:"pb-3",children:e.jsx(Ve,{className:"text-lg",children:r("traffic_reset.history.summary")})}),e.jsx(Fe,{children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx(Qe,{className:"text-muted-foreground",children:r("traffic_reset.history.reset_count")}),e.jsx("p",{className:"font-medium",children:i.data.user.reset_count})]}),e.jsxs("div",{children:[e.jsx(Qe,{className:"text-muted-foreground",children:r("traffic_reset.history.last_reset")}),e.jsx("p",{className:"font-medium",children:i.data.user.last_reset_at?ie(i.data.user.last_reset_at):r("traffic_reset.history.never")})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(Qe,{className:"text-muted-foreground",children:r("traffic_reset.history.next_reset")}),e.jsx("p",{className:"font-medium",children:i.data.user.next_reset_at?ie(i.data.user.next_reset_at):r("traffic_reset.history.no_schedule")})]})]})})]}),e.jsxs(Se,{children:[e.jsxs(De,{className:"pb-3",children:[e.jsx(Ve,{className:"text-lg",children:r("traffic_reset.history.records")}),e.jsx(Xs,{children:r("traffic_reset.history.recent_records")})]}),e.jsx(Fe,{children:e.jsx(ft,{className:"h-[300px]",children:i?.data?.history?.length?e.jsx("div",{className:"space-y-3",children:i.data.history.map((C,F)=>e.jsxs("div",{children:[e.jsx("div",{className:"flex items-start justify-between rounded-lg border bg-card p-3",children:e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{className:P(C.reset_type),children:C.reset_type_name}),e.jsx(K,{variant:"outline",className:T(C.trigger_source),children:C.trigger_source_name})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsxs(Qe,{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(zn,{className:"h-3 w-3"}),r("traffic_reset.history.reset_time")]}),e.jsx("p",{className:"font-medium",children:ie(C.reset_time)})]}),e.jsxs("div",{children:[e.jsx(Qe,{className:"text-muted-foreground",children:r("traffic_reset.history.traffic_cleared")}),e.jsx("p",{className:"font-medium text-destructive",children:C.old_traffic.formatted})]})]})]})}),Fe.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M5 18h4.24a1 1 0 0 0 .71-.29l6.92-6.93L19.71 8a1 1 0 0 0 0-1.42l-4.24-4.29a1 1 0 0 0-1.42 0l-2.82 2.83l-6.94 6.93a1 1 0 0 0-.29.71V17a1 1 0 0 0 1 1m9.76-13.59l2.83 2.83l-1.42 1.42l-2.83-2.83ZM6 13.17l5.93-5.93l2.83 2.83L8.83 16H6ZM21 20H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2"})}),Cg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11h-6V5a1 1 0 0 0-2 0v6H5a1 1 0 0 0 0 2h6v6a1 1 0 0 0 2 0v-6h6a1 1 0 0 0 0-2"})}),Sg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 8.94a1.3 1.3 0 0 0-.06-.27v-.09a1 1 0 0 0-.19-.28l-6-6a1 1 0 0 0-.28-.19a.3.3 0 0 0-.09 0a.9.9 0 0 0-.33-.11H10a3 3 0 0 0-3 3v1H6a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3v-1h1a3 3 0 0 0 3-3zm-6-3.53L17.59 8H16a1 1 0 0 1-1-1ZM15 19a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h1v7a3 3 0 0 0 3 3h5Zm4-4a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3v3a3 3 0 0 0 3 3h3Z"})}),kr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21 11a1 1 0 0 0-1 1a8.05 8.05 0 1 1-2.22-5.5h-2.4a1 1 0 0 0 0 2h4.53a1 1 0 0 0 1-1V3a1 1 0 0 0-2 0v1.77A10 10 0 1 0 22 12a1 1 0 0 0-1-1"})}),kg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9.5 10.5H12a1 1 0 0 0 0-2h-1V8a1 1 0 0 0-2 0v.55a2.5 2.5 0 0 0 .5 4.95h1a.5.5 0 0 1 0 1H8a1 1 0 0 0 0 2h1v.5a1 1 0 0 0 2 0v-.55a2.5 2.5 0 0 0-.5-4.95h-1a.5.5 0 0 1 0-1M21 12h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Z"})}),Tg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12.3 12.22A4.92 4.92 0 0 0 14 8.5a5 5 0 0 0-10 0a4.92 4.92 0 0 0 1.7 3.72A8 8 0 0 0 1 19.5a1 1 0 0 0 2 0a6 6 0 0 1 12 0a1 1 0 0 0 2 0a8 8 0 0 0-4.7-7.28M9 11.5a3 3 0 1 1 3-3a3 3 0 0 1-3 3m9.74.32A5 5 0 0 0 15 3.5a1 1 0 0 0 0 2a3 3 0 0 1 3 3a3 3 0 0 1-1.5 2.59a1 1 0 0 0-.5.84a1 1 0 0 0 .45.86l.39.26l.13.07a7 7 0 0 1 4 6.38a1 1 0 0 0 2 0a9 9 0 0 0-4.23-7.68"})}),Dg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M12 2a10 10 0 0 0-6.88 2.77V3a1 1 0 0 0-2 0v4.5a1 1 0 0 0 1 1h4.5a1 1 0 0 0 0-2h-2.4A8 8 0 1 1 4 12a1 1 0 0 0-2 0A10 10 0 1 0 12 2m0 6a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h2a1 1 0 0 0 0-2h-1V9a1 1 0 0 0-1-1"})}),Fg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M20 6h-4V5a3 3 0 0 0-3-3h-2a3 3 0 0 0-3 3v1H4a1 1 0 0 0 0 2h1v11a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V8h1a1 1 0 0 0 0-2M10 5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v1h-4Zm7 14a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V8h10Z"})}),Pg=(s,n,t,r)=>{const{t:a}=O("user");return[{accessorKey:"is_admin",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.is_admin")}),enableSorting:!1,enableHiding:!0,filterFn:(o,l,d)=>d.includes(o.getValue(l)),size:0},{accessorKey:"is_staff",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.is_staff")}),enableSorting:!1,enableHiding:!0,filterFn:(o,l,d)=>d.includes(o.getValue(l)),size:0},{accessorKey:"id",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.id")}),cell:({row:o})=>e.jsx(K,{variant:"outline",children:o.original.id}),enableSorting:!0,enableHiding:!1},{accessorKey:"email",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.email")}),cell:({row:o})=>{const l=o.original.t||0,d=Date.now()/1e3-l<120,x=Math.floor(Date.now()/1e3-l);let u=d?a("columns.online_status.online"):l===0?a("columns.online_status.never"):a("columns.online_status.last_online",{time:ie(l)});if(!d&&l!==0){const P=Math.floor(x/60),T=Math.floor(P/60),C=Math.floor(T/24);C>0?u+=` +`+a("columns.online_status.offline_duration.days",{count:C}):T>0?u+=` +`+a("columns.online_status.offline_duration.hours",{count:T}):P>0?u+=` +`+a("columns.online_status.offline_duration.minutes",{count:P}):u+=` +`+a("columns.online_status.offline_duration.seconds",{count:x})}const[i,c]=Mr.useState(!1),p=o.original.email;return e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{children:e.jsxs("div",{className:"flex items-center gap-2.5 group",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[e.jsx("div",{className:_("size-2.5 rounded-full ring-2 ring-offset-2",d?"bg-green-500 ring-green-500/20":"bg-gray-300 ring-gray-300/20","transition-all duration-300")}),e.jsx("span",{className:"font-medium text-foreground/90",children:p}),e.jsx("button",{type:"button",className:_("ml-1 p-1 rounded transition-opacity bg-transparent hover:bg-muted",i?"opacity-100":"opacity-0 pointer-events-none","group-hover:opacity-100 group-hover:pointer-events-auto"),tabIndex:-1,"aria-label":a("columns.actions_menu.copy_email",{defaultValue:"Copy Email"}),onClick:P=>{P.stopPropagation(),Rt(p),$.success(a("common:copy.success"))},style:{lineHeight:0},children:e.jsx(On,{className:"h-4 w-4 text-muted-foreground"})})]})}),e.jsx(ce,{side:"bottom",className:"max-w-[280px]",children:e.jsx("p",{className:"whitespace-pre-line text-sm",children:u})})]})})},enableSorting:!1,enableHiding:!1},{accessorKey:"online_count",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.online_count")}),cell:({row:o})=>{const l=o.original.device_limit,d=o.original.online_count||0;return e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsxs(K,{variant:"outline",className:_("min-w-[4rem] justify-center",l!==null&&d>=l?"border-destructive/50 bg-destructive/10 text-destructive":"border-primary/40 bg-primary/5 text-primary/90"),children:[d," / ",l===null?"∞":l]})})}),e.jsx(ce,{side:"bottom",children:e.jsx("p",{className:"text-sm",children:l===null?a("columns.device_limit.unlimited"):a("columns.device_limit.limited",{count:l})})})]})})},enableSorting:!0,enableHiding:!1},{accessorKey:"banned",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.status")}),cell:({row:o})=>{const l=o.original.banned;return e.jsx("div",{className:"flex justify-center",children:e.jsx(K,{className:_("min-w-20 justify-center transition-colors",l?"bg-destructive/15 text-destructive hover:bg-destructive/25":"bg-success/15 text-success hover:bg-success/25"),children:a(l?"columns.status_text.banned":"columns.status_text.normal")})})},enableSorting:!0,filterFn:(o,l,d)=>d.includes(o.getValue(l))},{accessorKey:"plan_id",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.subscription")}),cell:({row:o})=>e.jsx("div",{className:"min-w-[10em] break-all",children:o.original?.plan?.name||"-"}),enableSorting:!1,enableHiding:!1},{accessorKey:"group_id",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.group")}),cell:({row:o})=>e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(K,{variant:"outline",className:_("px-2 py-0.5 font-medium","bg-secondary/50 hover:bg-secondary/70","border border-border/50","transition-all duration-200","cursor-default select-none","flex items-center gap-1.5 whitespace-nowrap"),children:o.original?.group?.name||"-"})}),enableSorting:!1},{accessorKey:"total_used",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.used_traffic")}),cell:({row:o})=>{const l=ze(o.original?.total_used),d=ze(o.original?.transfer_enable),x=o.original?.total_used/o.original?.transfer_enable*100||0;return e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{className:"w-full",children:e.jsxs("div",{className:"w-full space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:l}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-full bg-secondary",children:e.jsx("div",{className:_("h-full rounded-full transition-all",x>90?"bg-destructive":"bg-primary"),style:{width:`${Math.min(x,100)}%`}})})]})}),e.jsx(ce,{side:"bottom",children:e.jsxs("p",{className:"text-sm",children:[a("columns.total_traffic"),": ",d]})})]})})}},{accessorKey:"transfer_enable",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.total_traffic")}),cell:({row:o})=>e.jsx("div",{className:"font-medium text-muted-foreground",children:ze(o.original?.transfer_enable)})},{accessorKey:"expired_at",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.expire_time")}),cell:({row:o})=>{const l=o.original.expired_at,d=Date.now()/1e3,x=l!=null&&le.jsx(z,{column:o,title:a("columns.balance")}),cell:({row:o})=>{const l=hr(o.original?.balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:l})]})}},{accessorKey:"commission_balance",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.commission")}),cell:({row:o})=>{const l=hr(o.original?.commission_balance);return e.jsxs("div",{className:"flex items-center gap-1 font-medium",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"¥"}),e.jsx("span",{className:"tabular-nums text-foreground",children:l})]})}},{accessorKey:"created_at",header:({column:o})=>e.jsx(z,{column:o,title:a("columns.register_time")}),cell:({row:o})=>e.jsx("div",{className:"truncate",children:ie(o.original?.created_at)}),size:1e3},{id:"actions",header:({column:o})=>e.jsx(z,{column:o,className:"justify-end",title:a("columns.actions")}),cell:({row:o,table:l})=>e.jsxs(Us,{modal:!1,children:[e.jsx(Ks,{asChild:!0,children:e.jsx("div",{className:"text-center",children:e.jsx(G,{variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted","aria-label":a("columns.actions"),children:e.jsx(Fa,{className:"size-4"})})})}),e.jsxs(As,{align:"end",className:"min-w-[40px]",children:[e.jsx(Ce,{onSelect:d=>{d.preventDefault(),t(o.original),r(!0)},className:"p-0",children:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(wg,{className:"mr-2"}),a("columns.actions_menu.edit")]})}),e.jsx(Ce,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(Ci,{defaultValues:{email:o.original.email},trigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Cg,{className:"mr-2"}),a("columns.actions_menu.assign_order")]})})}),e.jsx(Ce,{onSelect:()=>{Rt(o.original.subscribe_url).then(()=>{$.success(a("common:copy.success"))})},className:"p-0 ,",children:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Sg,{className:"mr-2"}),a("columns.actions_menu.copy_url")]})}),e.jsxs(Ce,{className:"",onSelect:()=>{qs.resetSecret(o.original.id).then(({data:d})=>{d&&$.success("重置成功")})},children:[e.jsx(kr,{className:"mr-4"}),a("columns.actions_menu.reset_secret")]}),e.jsx(Ce,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(G,{variant:"ghost",className:"h-auto w-full justify-start px-2 py-1.5 font-normal",asChild:!0,children:e.jsxs(st,{to:`/finance/order?user_id=eq:${o.original.id}`,children:[e.jsx(kg,{className:"mr-2"}),a("columns.actions_menu.orders")]})})}),e.jsxs(Ce,{onSelect:()=>{l.setColumnFilters([{id:"invite_user_id",value:"eq:"+o.original?.id}])},children:[e.jsx(Tg,{className:"mr-4"}),a("columns.actions_menu.invites")]}),e.jsx(Ce,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(Mi,{user_id:o.original?.id,dialogTrigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(Dg,{className:"mr-2"}),a("columns.actions_menu.traffic_records")]})})}),e.jsx(Ce,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(_g,{user:o.original,onSuccess:s,trigger:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5",children:[e.jsx(kr,{className:"mr-2"}),a("columns.actions_menu.reset_traffic")]})})}),e.jsx(Ce,{onSelect:d=>d.preventDefault(),className:"p-0",children:e.jsx(Ng,{title:a("columns.actions_menu.delete_confirm_title"),description:a("columns.actions_menu.delete_confirm_description",{email:o.original.email}),cancelText:a("common:cancel"),confirmText:a("common:confirm"),variant:"destructive",onConfirm:async()=>{try{const{data:d}=await qs.destroy(o.original.id);d&&($.success(a("common:delete.success")),s())}catch{$.error(a("common:delete.failed"))}},children:e.jsxs(G,{variant:"ghost",className:"w-full justify-start px-2 py-1.5 text-destructive hover:text-destructive",children:[e.jsx(Fg,{className:"mr-2"}),a("columns.actions_menu.delete")]})})})]})]})}]},Oi=m.createContext(void 0),Yn=()=>{const s=m.useContext(Oi);if(!s)throw new Error("useUserEdit must be used within an UserEditProvider");return s},zi=({children:s,refreshData:n})=>{const[t,r]=m.useState(!1),[a,o]=m.useState(null),l={isOpen:t,setIsOpen:r,editingUser:a,setEditingUser:o,refreshData:n};return e.jsx(Oi.Provider,{value:l,children:s})},Lg=h.object({id:h.number().default(0),email:h.string().email().default(""),invite_user_email:h.string().email().nullable().optional().default(null),password:h.string().optional().nullable().default(null),balance:h.coerce.number().default(0),commission_balance:h.coerce.number().default(0),u:h.coerce.number().default(0),d:h.coerce.number().default(0),transfer_enable:h.number().default(0),expired_at:h.number().nullable().default(null),plan_id:h.number().nullable().default(null),banned:h.boolean().default(!1),commission_type:h.number().default(0),commission_rate:h.number().nullable().default(null),discount:h.number().nullable().default(null),speed_limit:h.number().nullable().default(null),device_limit:h.number().nullable().default(null),is_admin:h.boolean().default(!1),is_staff:h.boolean().default(!1),remarks:h.string().nullable().default(null)});function $i(){const{t:s}=O("user"),{isOpen:n,setIsOpen:t,editingUser:r,refreshData:a}=Yn(),[o,l]=m.useState(!1),[d,x]=m.useState([]),u=Ne({resolver:ke(Lg)});return m.useEffect(()=>{n&&ys.getList().then(({data:i})=>{x(i)})},[n]),m.useEffect(()=>{if(r){const i=r.invite_user?.email,{invite_user:c,...p}=r;u.reset({...p,invite_user_email:i||null,password:null,u:p.u?(p.u/1024/1024/1024).toFixed(3):"",d:p.d?(p.d/1024/1024/1024).toFixed(3):""})}},[r,u]),e.jsx(Wn,{open:n,onOpenChange:t,children:e.jsxs(sn,{className:"max-w-[90%] space-y-4",children:[e.jsxs(tn,{children:[e.jsx(an,{children:s("edit.title")}),e.jsx(nn,{})]}),e.jsxs(Te,{...u,children:[e.jsx(j,{control:u.control,name:"email",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.email")}),e.jsx(b,{children:e.jsx(D,{...i,placeholder:s("edit.form.email_placeholder"),autoComplete:"off","data-form-type":"other"})}),e.jsx(R,{...i})]})}),e.jsx(j,{control:u.control,name:"invite_user_email",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.inviter_email")}),e.jsx(b,{children:e.jsx(D,{value:i.value||"",onChange:c=>i.onChange(c.target.value?c.target.value:null),placeholder:s("edit.form.inviter_email_placeholder"),autoComplete:"off","data-form-type":"other"})}),e.jsx(R,{...i})]})}),e.jsx(j,{control:u.control,name:"password",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.password")}),e.jsx(b,{children:e.jsx(D,{type:"password",value:i.value||"",onChange:i.onChange,placeholder:s("edit.form.password_placeholder"),autoComplete:"off","data-form-type":"other"})}),e.jsx(R,{...i})]})}),e.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[e.jsx(j,{control:u.control,name:"balance",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.balance")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:i.value||"",onChange:i.onChange,placeholder:s("edit.form.balance_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(R,{...i})]})}),e.jsx(j,{control:u.control,name:"commission_balance",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.commission_balance")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:i.value||"",onChange:i.onChange,placeholder:s("edit.form.commission_balance_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"¥"})]})}),e.jsx(R,{...i})]})}),e.jsx(j,{control:u.control,name:"u",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.upload")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",step:"any",value:i.value??"",onChange:c=>i.onChange(c.target.value),placeholder:s("edit.form.upload_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(R,{...i})]})}),e.jsx(j,{control:u.control,name:"d",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.download")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",step:"any",value:i.value??"",onChange:c=>i.onChange(c.target.value),placeholder:s("edit.form.download_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(R,{...i})]})})]}),e.jsx(j,{control:u.control,name:"transfer_enable",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.total_traffic")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:i.value/1024/1024/1024||"",onChange:c=>i.onChange(parseInt(c.target.value)*1024*1024*1024),placeholder:s("edit.form.total_traffic_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"GB"})]})}),e.jsx(R,{})]})}),e.jsx(j,{control:u.control,name:"expired_at",render:({field:i})=>e.jsxs(f,{className:"flex flex-col",children:[e.jsx(v,{children:s("edit.form.expire_time")}),e.jsxs(Ze,{open:o,onOpenChange:l,children:[e.jsx(es,{asChild:!0,children:e.jsx(b,{children:e.jsxs(L,{type:"button",variant:"outline",className:_("w-full pl-3 text-left font-normal",!i.value&&"text-muted-foreground"),onClick:()=>l(!0),children:[i.value?ie(i.value):e.jsx("span",{children:s("edit.form.expire_time_placeholder")}),e.jsx(Cs,{className:"ml-auto h-4 w-4 opacity-50"})]})})}),e.jsx(Ge,{className:"w-auto p-0",align:"start",side:"top",sideOffset:4,onInteractOutside:c=>{c.preventDefault()},onEscapeKeyDown:c=>{c.preventDefault()},children:e.jsxs("div",{className:"flex flex-col space-y-3 p-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{i.onChange(null),l(!1)},children:s("edit.form.expire_time_permanent")}),e.jsx(L,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const c=new Date;c.setMonth(c.getMonth()+1),c.setHours(23,59,59,999),i.onChange(Math.floor(c.getTime()/1e3)),l(!1)},children:s("edit.form.expire_time_1month")}),e.jsx(L,{type:"button",variant:"outline",className:"flex-1",onClick:()=>{const c=new Date;c.setMonth(c.getMonth()+3),c.setHours(23,59,59,999),i.onChange(Math.floor(c.getTime()/1e3)),l(!1)},children:s("edit.form.expire_time_3months")})]}),e.jsx("div",{className:"rounded-md border",children:e.jsx(Ss,{mode:"single",selected:i.value?new Date(i.value*1e3):void 0,onSelect:c=>{if(c){const p=new Date(i.value?i.value*1e3:Date.now());c.setHours(p.getHours(),p.getMinutes(),p.getSeconds()),i.onChange(Math.floor(c.getTime()/1e3))}},disabled:c=>c{const c=new Date;c.setHours(23,59,59,999),i.onChange(Math.floor(c.getTime()/1e3))},className:"h-6 px-2 text-xs",children:s("edit.form.expire_time_today")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(D,{type:"datetime-local",step:"1",value:ie(i.value,"YYYY-MM-DDTHH:mm:ss"),onChange:c=>{const p=new Date(c.target.value);isNaN(p.getTime())||i.onChange(Math.floor(p.getTime()/1e3))},className:"flex-1"}),e.jsx(L,{type:"button",variant:"outline",onClick:()=>l(!1),children:s("edit.form.expire_time_confirm")})]})]})]})})]}),e.jsx(R,{})]})}),e.jsx(j,{control:u.control,name:"plan_id",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.subscription")}),e.jsx(b,{children:e.jsxs(X,{value:i.value!==null?String(i.value):"null",onValueChange:c=>i.onChange(c==="null"?null:parseInt(c)),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"null",children:s("edit.form.subscription_none")}),d.map(c=>e.jsx(q,{value:String(c.id),children:c.name},c.id))]})]})})]})}),e.jsx(j,{control:u.control,name:"banned",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.account_status")}),e.jsx(b,{children:e.jsxs(X,{value:i.value.toString(),onValueChange:c=>i.onChange(c==="true"),children:[e.jsx(J,{children:e.jsx(Z,{})}),e.jsxs(Q,{children:[e.jsx(q,{value:"true",children:s("columns.status_text.banned")}),e.jsx(q,{value:"false",children:s("columns.status_text.normal")})]})]})})]})}),e.jsx(j,{control:u.control,name:"commission_type",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.commission_type")}),e.jsx(b,{children:e.jsxs(X,{value:i.value.toString(),onValueChange:c=>i.onChange(parseInt(c)),children:[e.jsx(J,{children:e.jsx(Z,{placeholder:s("edit.form.subscription_none")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"0",children:s("edit.form.commission_type_system")}),e.jsx(q,{value:"1",children:s("edit.form.commission_type_cycle")}),e.jsx(q,{value:"2",children:s("edit.form.commission_type_onetime")})]})]})})]})}),e.jsx(j,{control:u.control,name:"commission_rate",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.commission_rate")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:i.value||"",onChange:c=>i.onChange(parseInt(c.currentTarget.value)||null),placeholder:s("edit.form.commission_rate_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})})]})}),e.jsx(j,{control:u.control,name:"discount",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.discount")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:i.value||"",onChange:c=>i.onChange(parseInt(c.currentTarget.value)||null),placeholder:s("edit.form.discount_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"%"})]})}),e.jsx(R,{})]})}),e.jsx(j,{control:u.control,name:"speed_limit",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.speed_limit")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:i.value||"",onChange:c=>i.onChange(parseInt(c.currentTarget.value)||null),placeholder:s("edit.form.speed_limit_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"Mbps"})]})}),e.jsx(R,{})]})}),e.jsx(j,{control:u.control,name:"device_limit",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.device_limit")}),e.jsx(b,{children:e.jsxs("div",{className:"flex",children:[e.jsx(D,{type:"number",value:i.value||"",onChange:c=>i.onChange(parseInt(c.currentTarget.value)||null),placeholder:s("edit.form.device_limit_placeholder"),className:"rounded-r-none"}),e.jsx("div",{className:"z-[-1] rounded-md rounded-l-none border border-l-0 border-input px-3 py-1 shadow-sm",children:"台"})]})}),e.jsx(R,{})]})}),e.jsx(j,{control:u.control,name:"is_admin",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.is_admin")}),e.jsx("div",{className:"py-2",children:e.jsx(b,{children:e.jsx(ee,{checked:i.value,onCheckedChange:c=>i.onChange(c)})})}),e.jsx(R,{})]})}),e.jsx(j,{control:u.control,name:"is_staff",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.is_staff")}),e.jsx("div",{className:"py-2",children:e.jsx(b,{children:e.jsx(ee,{checked:i.value,onCheckedChange:c=>i.onChange(c)})})})]})}),e.jsx(j,{control:u.control,name:"remarks",render:({field:i})=>e.jsxs(f,{children:[e.jsx(v,{children:s("edit.form.remarks")}),e.jsx(b,{children:e.jsx(Rs,{className:"h-24",value:i.value||"",onChange:c=>i.onChange(c.currentTarget.value??null),placeholder:s("edit.form.remarks_placeholder")})}),e.jsx(R,{})]})}),e.jsxs(Ei,{children:[e.jsx(L,{variant:"outline",onClick:()=>t(!1),children:s("edit.form.cancel")}),e.jsx(L,{type:"submit",onClick:()=>{u.handleSubmit(i=>{const c={id:i.id};u.formState.dirtyFields.u&&(c.u=Math.round(parseFloat(i.u)*1024*1024*1024)),u.formState.dirtyFields.d&&(c.d=Math.round(parseFloat(i.d)*1024*1024*1024)),Object.keys(i).forEach(p=>{p!=="u"&&p!=="d"&&p!=="id"&&u.formState.dirtyFields[p]&&(c[p]=i[p])}),qs.update(c).then(({data:p})=>{p&&($.success(s("edit.form.success")),t(!1),a())})})()},children:s("edit.form.submit")})]})]})]})})}function Rg(){const[s]=Il(),[n,t]=m.useState({}),[r,a]=m.useState({is_admin:!1,is_staff:!1}),[o,l]=m.useState([]),[d,x]=m.useState([]),[u,i]=m.useState({pageIndex:0,pageSize:20});m.useEffect(()=>{const N=s.get("email");N&&l(S=>S.some(E=>E.id==="email")?S:[...S,{id:"email",value:N}])},[s]);const{refetch:c,data:p,isLoading:P}=ne({queryKey:["userList",u,o,d],queryFn:()=>qs.getList({pageSize:u.pageSize,current:u.pageIndex+1,filter:o,sort:d})}),[T,C]=m.useState([]),[F,w]=m.useState([]);m.useEffect(()=>{yt.getList().then(({data:N})=>{C(N)}),ys.getList().then(({data:N})=>{w(N)})},[]);const V=T.map(N=>({label:N.name,value:N.id})),y=F.map(N=>({label:N.name,value:N.id}));return e.jsxs(zi,{refreshData:c,children:[e.jsx(Eg,{data:p?.data??[],rowCount:p?.total??0,sorting:d,setSorting:x,columnVisibility:r,setColumnVisibility:a,rowSelection:n,setRowSelection:t,columnFilters:o,setColumnFilters:l,pagination:u,setPagination:i,refetch:c,serverGroupList:T,permissionGroups:V,subscriptionPlans:y,isLoading:P}),e.jsx($i,{})]})}function Eg({data:s,rowCount:n,sorting:t,setSorting:r,columnVisibility:a,setColumnVisibility:o,rowSelection:l,setRowSelection:d,columnFilters:x,setColumnFilters:u,pagination:i,setPagination:c,refetch:p,serverGroupList:P,permissionGroups:T,subscriptionPlans:C,isLoading:F}){const{setIsOpen:w,setEditingUser:V}=Yn(),y=We({data:s,columns:Pg(p,P,V,w),state:{sorting:t,columnVisibility:a,rowSelection:l,columnFilters:x,pagination:i},rowCount:n,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:d,onSortingChange:r,onColumnFiltersChange:u,onColumnVisibilityChange:o,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),onPaginationChange:c,getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnVisibility:{commission_balance:!1,created_at:!1,is_admin:!1,is_staff:!1,permission_group:!1,plan_id:!1},columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(vg,{table:y,refetch:p,serverGroupList:P,permissionGroups:T,subscriptionPlans:C}),e.jsx(ns,{table:y,isLoading:F})]})}function Vg(){const{t:s}=O("user");return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("manage.title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("manage.description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx("div",{className:"w-full",children:e.jsx(Rg,{})})})]})]})}const Ig=Object.freeze(Object.defineProperty({__proto__:null,default:Vg},Symbol.toStringTag,{value:"Module"})),Mg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 11H5a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})});function Og({table:s}){const{t:n}=O("ticket");return e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex flex-1 flex-col-reverse items-start gap-y-2 sm:flex-row sm:items-center sm:space-x-4",children:[e.jsx(bt,{defaultValue:s.getColumn("status")?.getFilterValue(),onValueChange:t=>s.getColumn("status")?.setFilterValue(t),children:e.jsxs(rt,{className:"grid w-full grid-cols-2",children:[e.jsx(Be,{value:"0",children:n("status.pending")}),e.jsx(Be,{value:"1",children:n("status.closed")})]})}),s.getColumn("level")&&e.jsx(Va,{column:s.getColumn("level"),title:n("columns.level"),options:[{label:n("level.low"),value:ds.LOW,icon:Mg,color:"gray"},{label:n("level.medium"),value:ds.MIDDLE,icon:Vi,color:"yellow"},{label:n("level.high"),value:ds.HIGH,icon:Ii,color:"red"}]})]})})}function zg(){return e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground",children:[e.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),e.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:e.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}const $g=jt("flex gap-2 max-w-[60%] items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),Ai=m.forwardRef(({className:s,variant:n,layout:t,children:r,...a},o)=>e.jsx("div",{className:_($g({variant:n,layout:t,className:s}),"relative group"),ref:o,...a,children:m.Children.map(r,l=>m.isValidElement(l)&&typeof l.type!="string"?m.cloneElement(l,{variant:n,layout:t}):l)}));Ai.displayName="ChatBubble";const Ag=jt("p-4",{variants:{variant:{received:"bg-secondary text-secondary-foreground rounded-r-lg rounded-tl-lg",sent:"bg-primary text-primary-foreground rounded-l-lg rounded-tr-lg"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),qi=m.forwardRef(({className:s,variant:n,layout:t,isLoading:r=!1,children:a,...o},l)=>e.jsx("div",{className:_(Ag({variant:n,layout:t,className:s}),"break-words max-w-full whitespace-pre-wrap"),ref:l,...o,children:r?e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx(zg,{})}):a}));qi.displayName="ChatBubbleMessage";const qg=m.forwardRef(({variant:s,className:n,children:t,...r},a)=>e.jsx("div",{ref:a,className:_("absolute top-1/2 -translate-y-1/2 flex opacity-0 group-hover:opacity-100 transition-opacity duration-200",s==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",n),...r,children:t}));qg.displayName="ChatBubbleActionWrapper";const Ui=m.forwardRef(({className:s,...n},t)=>e.jsx(Rs,{autoComplete:"off",ref:t,name:"message",className:_("max-h-12 px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",s),...n}));Ui.displayName="ChatInput";const Hi=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m13.41 12l4.3-4.29a1 1 0 1 0-1.42-1.42L12 10.59l-4.29-4.3a1 1 0 0 0-1.42 1.42l4.3 4.29l-4.3 4.29a1 1 0 0 0 0 1.42a1 1 0 0 0 1.42 0l4.29-4.3l4.29 4.3a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.42Z"})}),Ki=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M15.098 12.634L13 11.423V7a1 1 0 0 0-2 0v5a1 1 0 0 0 .5.866l2.598 1.5a1 1 0 1 0 1-1.732M12 2a10 10 0 1 0 10 10A10.01 10.01 0 0 0 12 2m0 18a8 8 0 1 1 8-8a8.01 8.01 0 0 1-8 8"})}),Tr=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"m11.29 12l3.54-3.54a1 1 0 0 0 0-1.41a1 1 0 0 0-1.42 0l-4.24 4.24a1 1 0 0 0 0 1.42L13.41 17a1 1 0 0 0 .71.29a1 1 0 0 0 .71-.29a1 1 0 0 0 0-1.41Z"})}),Ug=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21.71 20.29L18 16.61A9 9 0 1 0 16.61 18l3.68 3.68a1 1 0 0 0 1.42 0a1 1 0 0 0 0-1.39M11 18a7 7 0 1 1 7-7a7 7 0 0 1-7 7"})}),Hg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M3.71 16.29a1 1 0 0 0-.33-.21a1 1 0 0 0-.76 0a1 1 0 0 0-.33.21a1 1 0 0 0-.21.33a1 1 0 0 0 .21 1.09a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1 1 0 0 0 .21-1.09a1 1 0 0 0-.21-.33M7 8h14a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2m-3.29 3.29a1 1 0 0 0-1.09-.21a1.2 1.2 0 0 0-.33.21a1 1 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1 1 0 0 0-.21-.33M21 11H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2M3.71 6.29a1 1 0 0 0-.33-.21a1 1 0 0 0-1.09.21a1.2 1.2 0 0 0-.21.33a.94.94 0 0 0 0 .76a1.2 1.2 0 0 0 .21.33a1.2 1.2 0 0 0 .33.21a1 1 0 0 0 1.09-.21a1.2 1.2 0 0 0 .21-.33a.94.94 0 0 0 0-.76a1.2 1.2 0 0 0-.21-.33M21 16H7a1 1 0 0 0 0 2h14a1 1 0 0 0 0-2"})}),Kg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M9 12H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m-1-2h4a1 1 0 0 0 0-2H8a1 1 0 0 0 0 2m1 6H7a1 1 0 0 0 0 2h2a1 1 0 0 0 0-2m12-4h-3V3a1 1 0 0 0-.5-.87a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0l-3 1.72l-3-1.72a1 1 0 0 0-1 0A1 1 0 0 0 2 3v16a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-6a1 1 0 0 0-1-1M5 20a1 1 0 0 1-1-1V4.73l2 1.14a1.08 1.08 0 0 0 1 0l3-1.72l3 1.72a1.08 1.08 0 0 0 1 0l2-1.14V19a3 3 0 0 0 .18 1Zm15-1a1 1 0 0 1-2 0v-5h2Zm-6.44-2.83a.8.8 0 0 0-.18-.09a.6.6 0 0 0-.19-.06a1 1 0 0 0-.9.27A1.05 1.05 0 0 0 12 17a1 1 0 0 0 .07.38a1.2 1.2 0 0 0 .22.33a1.2 1.2 0 0 0 .33.21a.94.94 0 0 0 .76 0a1.2 1.2 0 0 0 .33-.21A1 1 0 0 0 14 17a1.05 1.05 0 0 0-.29-.71a2 2 0 0 0-.15-.12m.14-3.88a1 1 0 0 0-1.62.33A1 1 0 0 0 13 14a1 1 0 0 0 1-1a1 1 0 0 0-.08-.38a.9.9 0 0 0-.22-.33"})});function Bg(){return e.jsxs("div",{className:"flex h-full flex-col space-y-4 p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(je,{className:"h-8 w-3/4"}),e.jsx(je,{className:"h-4 w-1/2"})]}),e.jsx("div",{className:"flex-1 space-y-4",children:[1,2,3].map(s=>e.jsx(je,{className:"h-20 w-2/3"},s))})]})}function Gg(){return e.jsx("div",{className:"space-y-4 p-4",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(je,{className:"h-5 w-4/5"}),e.jsx(je,{className:"h-4 w-2/3"}),e.jsx(je,{className:"h-3 w-1/2"})]},s))})}function Wg({ticket:s,isActive:n,onClick:t}){const{t:r}=O("ticket"),a=o=>{switch(o){case ds.HIGH:return"bg-red-50 text-red-600 border-red-200";case ds.MIDDLE:return"bg-yellow-50 text-yellow-600 border-yellow-200";case ds.LOW:return"bg-green-50 text-green-600 border-green-200";default:return"bg-gray-50 text-gray-600 border-gray-200"}};return e.jsxs("div",{className:_("flex cursor-pointer flex-col border-b p-4 hover:bg-accent/50",n&&"bg-accent"),onClick:t,children:[e.jsxs("div",{className:"flex max-w-[280px] items-center justify-between gap-2",children:[e.jsx("h4",{className:"flex-1 truncate font-medium",children:s.subject}),e.jsx(K,{variant:s.status===et.CLOSED?"secondary":"default",className:"shrink-0",children:s.status===et.CLOSED?r("status.closed"):r("status.processing")})]}),e.jsx("div",{className:"mt-1 max-w-[280px] truncate text-sm text-muted-foreground",children:s.user?.email}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs",children:[e.jsx("time",{className:"text-muted-foreground",children:ie(s.updated_at)}),e.jsx("div",{className:_("rounded-full border px-2 py-0.5 text-xs font-medium",a(s.level)),children:r(`level.${s.level===ds.LOW?"low":s.level===ds.MIDDLE?"medium":"high"}`)})]})]})}function Yg({ticketId:s,dialogTrigger:n}){const{t}=O("ticket"),r=Bs(),a=m.useRef(null),o=m.useRef(null),[l,d]=m.useState(!1),[x,u]=m.useState(""),[i,c]=m.useState(!1),[p,P]=m.useState(s),[T,C]=m.useState(""),[F,w]=m.useState(!1),{setIsOpen:V,setEditingUser:y}=Yn(),{data:N,isLoading:S,refetch:M}=ne({queryKey:["tickets",l],queryFn:()=>l?Ft.getList({filter:[{id:"status",value:[et.OPENING]}]}):Promise.resolve(null),enabled:l}),{data:E,refetch:g,isLoading:k}=ne({queryKey:["ticket",p,l],queryFn:()=>l?Ft.getInfo(p):Promise.resolve(null),refetchInterval:l?5e3:!1,retry:3}),W=E?.data,ae=(N?.data||[]).filter(re=>re.subject.toLowerCase().includes(T.toLowerCase())||re.user?.email.toLowerCase().includes(T.toLowerCase())),B=(re="smooth")=>{if(a.current){const{scrollHeight:ks,clientHeight:_s}=a.current;a.current.scrollTo({top:ks-_s,behavior:re})}};m.useEffect(()=>{if(!l)return;const re=requestAnimationFrame(()=>{B("instant"),setTimeout(()=>B(),1e3)});return()=>{cancelAnimationFrame(re)}},[l,W?.messages]);const se=async()=>{const re=x.trim();!re||i||(c(!0),Ft.reply({id:p,message:re}).then(()=>{u(""),g(),B(),setTimeout(()=>{o.current?.focus()},0)}).finally(()=>{c(!1)}))},fe=async()=>{Ft.close(p).then(()=>{$.success(t("actions.close_success")),g(),M()})},cs=()=>{W?.user&&r("/finance/order?user_id="+W.user.id)},Me=W?.status===et.CLOSED;return e.jsxs(de,{open:l,onOpenChange:d,children:[e.jsx(fs,{asChild:!0,children:n??e.jsx(G,{variant:"outline",children:t("actions.view_ticket")})}),e.jsxs(oe,{className:"flex h-[90vh] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(me,{}),e.jsxs("div",{className:"flex h-full",children:[e.jsx(G,{variant:"ghost",size:"icon",className:"absolute left-2 top-2 z-50 md:hidden",onClick:()=>w(!F),children:e.jsx(Tr,{className:_("h-4 w-4 transition-transform",!F&&"rotate-180")})}),e.jsxs("div",{className:_("absolute inset-y-0 left-0 z-40 flex flex-col border-r bg-background transition-transform duration-200 ease-in-out md:relative",F?"-translate-x-full":"translate-x-0","w-80 md:w-80 md:translate-x-0"),children:[e.jsxs("div",{className:"space-y-4 border-b p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-semibold",children:t("list.title")}),e.jsx(G,{variant:"ghost",size:"icon",className:"hidden h-8 w-8 md:flex",onClick:()=>w(!F),children:e.jsx(Tr,{className:_("h-4 w-4 transition-transform",!F&&"rotate-180")})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ug,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 transform text-muted-foreground"}),e.jsx(D,{placeholder:t("list.search_placeholder"),value:T,onChange:re=>C(re.target.value),className:"pl-8"})]})]}),e.jsx(ft,{className:"flex-1",children:e.jsx("div",{className:"w-full",children:S?e.jsx(Gg,{}):ae.length===0?e.jsx("div",{className:"flex h-full items-center justify-center p-4 text-muted-foreground",children:t(T?"list.no_search_results":"list.no_tickets")}):ae.map(re=>e.jsx(Wg,{ticket:re,isActive:re.id===p,onClick:()=>{P(re.id),window.innerWidth<768&&w(!0)}},re.id))})})]}),e.jsxs("div",{className:"relative flex flex-1 flex-col",children:[!F&&e.jsx("div",{className:"absolute inset-0 z-30 bg-black/20 md:hidden",onClick:()=>w(!0)}),k?e.jsx(Bg,{}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col space-y-4 border-b p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h2",{className:"text-2xl font-semibold",children:W?.subject}),e.jsx(K,{variant:Me?"secondary":"default",children:t(Me?"status.closed":"status.processing")}),!Me&&e.jsx(us,{title:t("actions.close_confirm_title"),description:t("actions.close_confirm_description"),confirmText:t("actions.close_confirm_button"),variant:"destructive",onConfirm:fe,children:e.jsxs(G,{variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-destructive",children:[e.jsx(Hi,{className:"h-4 w-4"}),t("actions.close_ticket")]})})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(Ea,{className:"h-4 w-4"}),e.jsx("span",{children:W?.user?.email})]}),e.jsx(Re,{orientation:"vertical",className:"h-4"}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(Ki,{className:"h-4 w-4"}),e.jsxs("span",{children:[t("detail.created_at")," ",ie(W?.created_at)]})]}),e.jsx(Re,{orientation:"vertical",className:"h-4"}),e.jsx(K,{variant:"outline",children:W?.level!=null&&t(`level.${W.level===ds.LOW?"low":W.level===ds.MIDDLE?"medium":"high"}`)})]})]}),W?.user&&e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.user_info"),onClick:()=>{y(W.user),V(!0)},children:e.jsx(Ea,{className:"h-4 w-4"})}),e.jsx(Mi,{user_id:W.user.id,dialogTrigger:e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.traffic_records"),children:e.jsx(Hg,{className:"h-4 w-4"})})}),e.jsx(G,{variant:"outline",size:"icon",className:"h-8 w-8",title:t("detail.order_records"),onClick:cs,children:e.jsx(Kg,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx("div",{ref:a,className:"h-full space-y-4 overflow-y-auto p-6",children:W?.messages?.length===0?e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:t("detail.no_messages")}):W?.messages?.map(re=>e.jsx(Ai,{variant:re.is_from_admin?"sent":"received",className:re.is_from_admin?"ml-auto":"mr-auto",children:e.jsx(qi,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"whitespace-pre-wrap break-words",children:re.message}),e.jsx("div",{className:"text-right",children:e.jsx("time",{className:"text-[10px] text-muted-foreground",children:ie(re.created_at)})})]})})},re.id))})}),e.jsx("div",{className:"border-t p-4",children:e.jsxs("div",{className:"relative flex items-center space-x-2",children:[e.jsx(Ui,{ref:o,disabled:Me||i,placeholder:t(Me?"detail.input.closed_placeholder":"detail.input.reply_placeholder"),className:"flex-1 resize-none rounded-lg border bg-background p-3 focus-visible:ring-1",value:x,onChange:re=>u(re.target.value),onKeyDown:re=>{re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),se())}}),e.jsx(G,{disabled:Me||i||!x.trim(),onClick:se,children:t(i?"detail.input.sending":"detail.input.send")})]})})]})]})]})]})]})}const Jg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M19 4H5a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3m-.41 2l-5.88 5.88a1 1 0 0 1-1.42 0L5.41 6ZM20 17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7.41l5.88 5.88a3 3 0 0 0 4.24 0L20 7.41Z"})}),Qg=s=>e.jsx("svg",{className:"inline-block",viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...s,children:e.jsx("path",{fill:"currentColor",d:"M21.92 11.6C19.9 6.91 16.1 4 12 4s-7.9 2.91-9.92 7.6a1 1 0 0 0 0 .8C4.1 17.09 7.9 20 12 20s7.9-2.91 9.92-7.6a1 1 0 0 0 0-.8M12 18c-3.17 0-6.17-2.29-7.9-6C5.83 8.29 8.83 6 12 6s6.17 2.29 7.9 6c-1.73 3.71-4.73 6-7.9 6m0-10a4 4 0 1 0 4 4a4 4 0 0 0-4-4m0 6a2 2 0 1 1 2-2a2 2 0 0 1-2 2"})}),Xg=s=>{const{t:n}=O("ticket");return[{accessorKey:"id",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.id")}),cell:({row:t})=>e.jsx(K,{variant:"outline",children:t.getValue("id")}),enableSorting:!1,enableHiding:!1},{accessorKey:"subject",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.subject")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Jg,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"max-w-[500px] truncate font-medium",children:t.getValue("subject")})]}),enableSorting:!1,enableHiding:!1,size:4e3},{accessorKey:"level",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.level")}),cell:({row:t})=>{const r=t.getValue("level"),a=r===ds.LOW?"default":r===ds.MIDDLE?"secondary":"destructive";return e.jsx(K,{variant:a,className:"whitespace-nowrap",children:n(`level.${r===ds.LOW?"low":r===ds.MIDDLE?"medium":"high"}`)})},filterFn:(t,r,a)=>a.includes(t.getValue(r))},{accessorKey:"status",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.status")}),cell:({row:t})=>{const r=t.getValue("status"),a=t.original.reply_status,o=r===et.CLOSED?n("status.closed"):n(a===0?"status.replied":"status.pending"),l=r===et.CLOSED?"default":a===0?"secondary":"destructive";return e.jsx(K,{variant:l,className:"whitespace-nowrap",children:o})}},{accessorKey:"updated_at",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.updated_at")}),cell:({row:t})=>e.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[e.jsx(Ki,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:ie(t.getValue("updated_at"))})]}),enableSorting:!0},{accessorKey:"created_at",header:({column:t})=>e.jsx(z,{column:t,title:n("columns.created_at")}),cell:({row:t})=>e.jsx("div",{className:"text-sm text-muted-foreground",children:ie(t.getValue("created_at"))}),enableSorting:!0,meta:{isFlexGrow:!0}},{id:"actions",header:({column:t})=>e.jsx(z,{className:"justify-end",column:t,title:n("columns.actions")}),cell:({row:t})=>{const r=t.original.status!==et.CLOSED;return e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(Yg,{ticketId:t.original.id,dialogTrigger:e.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.view_details"),children:e.jsx(Qg,{className:"h-4 w-4"})})}),r&&e.jsx(us,{title:n("actions.close_confirm_title"),description:n("actions.close_confirm_description"),confirmText:n("actions.close_confirm_button"),variant:"destructive",onConfirm:async()=>{Ft.close(t.original.id).then(()=>{$.success(n("actions.close_success")),s()})},children:e.jsx(G,{variant:"ghost",size:"icon",className:"h-8 w-8",title:n("actions.close_ticket"),children:e.jsx(Hi,{className:"h-4 w-4"})})})]})}}]};function Zg(){const[s,n]=m.useState({}),[t,r]=m.useState({}),[a,o]=m.useState([{id:"status",value:"0"}]),[l,d]=m.useState([]),[x,u]=m.useState({pageIndex:0,pageSize:20}),{refetch:i,data:c}=ne({queryKey:["orderList",x,a,l],queryFn:()=>Ft.getList({pageSize:x.pageSize,current:x.pageIndex+1,filter:a,sort:l})}),p=We({data:c?.data??[],columns:Xg(i),state:{sorting:l,columnVisibility:t,rowSelection:s,columnFilters:a,pagination:x},rowCount:c?.total??0,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:n,onSortingChange:d,onColumnFiltersChange:o,onColumnVisibilityChange:r,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),onPaginationChange:u,getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnPinning:{right:["actions"]}}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Og,{table:p,refetch:i}),e.jsx(ns,{table:p,showPagination:!0})]})}function ep(){const{t:s}=O("ticket");return e.jsxs(zi,{refreshData:()=>{},children:[e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx(os,{}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-2 flex items-center justify-between space-y-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:s("title")}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:s("description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0",children:e.jsx(Zg,{})})]})]}),e.jsx($i,{})]})}const sp=Object.freeze(Object.defineProperty({__proto__:null,default:ep},Symbol.toStringTag,{value:"Module"}));function tp({table:s,refetch:n}){const{t}=O("user"),r=s.getState().columnFilters.length>0,[a,o]=m.useState(),[l,d]=m.useState(),[x,u]=m.useState(!1),i=[{value:"monthly",label:t("traffic_reset_logs.filters.reset_types.monthly")},{value:"first_day_month",label:t("traffic_reset_logs.filters.reset_types.first_day_month")},{value:"yearly",label:t("traffic_reset_logs.filters.reset_types.yearly")},{value:"first_day_year",label:t("traffic_reset_logs.filters.reset_types.first_day_year")},{value:"manual",label:t("traffic_reset_logs.filters.reset_types.manual")}],c=[{value:"auto",label:t("traffic_reset_logs.filters.trigger_sources.auto")},{value:"manual",label:t("traffic_reset_logs.filters.trigger_sources.manual")},{value:"cron",label:t("traffic_reset_logs.filters.trigger_sources.cron")}],p=()=>{let F=s.getState().columnFilters.filter(w=>w.id!=="date_range");(a||l)&&F.push({id:"date_range",value:{start:a?Pe(a,"yyyy-MM-dd"):null,end:l?Pe(l,"yyyy-MM-dd"):null}}),s.setColumnFilters(F)},P=async()=>{try{u(!0);const F=s.getState().columnFilters.reduce((g,k)=>{if(k.value)if(k.id==="date_range"){const W=k.value;W.start&&(g.start_date=W.start),W.end&&(g.end_date=W.end)}else g[k.id]=k.value;return g},{}),V=(await na.getLogs({...F,page:1,per_page:1e4})).data.map(g=>({ID:g.id,用户邮箱:g.user_email,用户ID:g.user_id,重置类型:g.reset_type_name,触发源:g.trigger_source_name,清零流量:g.old_traffic.formatted,"上传流量(GB)":(g.old_traffic.upload/1024**3).toFixed(2),"下载流量(GB)":(g.old_traffic.download/1024**3).toFixed(2),重置时间:Pe(new Date(g.reset_time),"yyyy-MM-dd HH:mm:ss"),记录时间:Pe(new Date(g.created_at),"yyyy-MM-dd HH:mm:ss"),原因:g.reason||""})),y=Object.keys(V[0]||{}),N=[y.join(","),...V.map(g=>y.map(k=>{const W=g[k];return typeof W=="string"&&W.includes(",")?`"${W}"`:W}).join(","))].join(` +`),S=new Blob([N],{type:"text/csv;charset=utf-8;"}),M=document.createElement("a"),E=URL.createObjectURL(S);M.setAttribute("href",E),M.setAttribute("download",`traffic-reset-logs-${Pe(new Date,"yyyy-MM-dd")}.csv`),M.style.visibility="hidden",document.body.appendChild(M),M.click(),document.body.removeChild(M),$.success(t("traffic_reset_logs.actions.export_success"))}catch(C){console.error("导出失败:",C),$.error(t("traffic_reset_logs.actions.export_failed"))}finally{u(!1)}},T=()=>e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.search_user")}),e.jsx(D,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:C=>s.getColumn("user_email")?.setFilterValue(C.target.value),className:"h-9"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.reset_type")}),e.jsxs(X,{value:s.getColumn("reset_type")?.getFilterValue()??"",onValueChange:C=>s.getColumn("reset_type")?.setFilterValue(C==="all"?"":C),children:[e.jsx(J,{className:"h-9",children:e.jsx(Z,{placeholder:t("traffic_reset_logs.filters.reset_type")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"all",children:t("traffic_reset_logs.filters.all_types")}),i.map(C=>e.jsx(q,{value:C.value,children:C.label},C.value))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.trigger_source")}),e.jsxs(X,{value:s.getColumn("trigger_source")?.getFilterValue()??"",onValueChange:C=>s.getColumn("trigger_source")?.setFilterValue(C==="all"?"":C),children:[e.jsx(J,{className:"h-9",children:e.jsx(Z,{placeholder:t("traffic_reset_logs.filters.trigger_source")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"all",children:t("traffic_reset_logs.filters.all_sources")}),c.map(C=>e.jsx(q,{value:C.value,children:C.label},C.value))]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.start_date")}),e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(L,{variant:"outline",className:_("h-9 w-full justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),a?Pe(a,"MM-dd"):t("traffic_reset_logs.filters.start_date")]})}),e.jsx(Ge,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:a,onSelect:o,initialFocus:!0})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:t("traffic_reset_logs.filters.end_date")}),e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(L,{variant:"outline",className:_("h-9 w-full justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),l?Pe(l,"MM-dd"):t("traffic_reset_logs.filters.end_date")]})}),e.jsx(Ge,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:l,onSelect:d,initialFocus:!0})})]})]})]}),(a||l)&&e.jsxs(L,{variant:"outline",className:"w-full",onClick:p,children:[e.jsx(dr,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.apply_date")]}),r&&e.jsxs(L,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),o(void 0),d(void 0)},className:"w-full",children:[t("traffic_reset_logs.filters.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]});return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between md:hidden",children:[e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(Wn,{children:[e.jsx(Li,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:"h-8",children:[e.jsx(Pd,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.reset_type"),r&&e.jsx("div",{className:"ml-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:s.getState().columnFilters.length})]})}),e.jsxs(sn,{side:"bottom",className:"h-[85vh]",children:[e.jsxs(tn,{className:"mb-4",children:[e.jsx(an,{children:t("traffic_reset_logs.filters.filter_title")}),e.jsx(nn,{children:t("traffic_reset_logs.filters.filter_description")})]}),e.jsx("div",{className:"max-h-[calc(85vh-120px)] overflow-y-auto",children:e.jsx(T,{})})]})]})}),e.jsxs(L,{variant:"outline",size:"sm",className:"h-8",onClick:P,disabled:x,children:[e.jsx(sa,{className:"mr-2 h-4 w-4"}),t(x?"traffic_reset_logs.actions.exporting":"traffic_reset_logs.actions.export")]})]}),e.jsxs("div",{className:"hidden items-center justify-between md:flex",children:[e.jsxs("div",{className:"flex flex-1 items-center space-x-2",children:[e.jsx(D,{placeholder:t("traffic_reset_logs.filters.search_user"),value:s.getColumn("user_email")?.getFilterValue()??"",onChange:C=>s.getColumn("user_email")?.setFilterValue(C.target.value),className:"h-8 w-[150px] lg:w-[250px]"}),e.jsxs(X,{value:s.getColumn("reset_type")?.getFilterValue()??"",onValueChange:C=>s.getColumn("reset_type")?.setFilterValue(C==="all"?"":C),children:[e.jsx(J,{className:"h-8 w-[180px]",children:e.jsx(Z,{placeholder:t("traffic_reset_logs.filters.reset_type")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"all",children:t("traffic_reset_logs.filters.all_types")}),i.map(C=>e.jsx(q,{value:C.value,children:C.label},C.value))]})]}),e.jsxs(X,{value:s.getColumn("trigger_source")?.getFilterValue()??"",onValueChange:C=>s.getColumn("trigger_source")?.setFilterValue(C==="all"?"":C),children:[e.jsx(J,{className:"h-8 w-[180px]",children:e.jsx(Z,{placeholder:t("traffic_reset_logs.filters.trigger_source")})}),e.jsxs(Q,{children:[e.jsx(q,{value:"all",children:t("traffic_reset_logs.filters.all_sources")}),c.map(C=>e.jsx(q,{value:C.value,children:C.label},C.value))]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:_("h-8 w-[140px] justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),a?Pe(a,"yyyy-MM-dd"):t("traffic_reset_logs.filters.start_date")]})}),e.jsx(Ge,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:a,onSelect:o,initialFocus:!0})})]}),e.jsxs(Ze,{children:[e.jsx(es,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:_("h-8 w-[140px] justify-start text-left font-normal",!l&&"text-muted-foreground"),children:[e.jsx(Cs,{className:"mr-2 h-4 w-4"}),l?Pe(l,"yyyy-MM-dd"):t("traffic_reset_logs.filters.end_date")]})}),e.jsx(Ge,{className:"w-auto p-0",align:"start",children:e.jsx(Ss,{mode:"single",selected:l,onSelect:d,initialFocus:!0})})]}),(a||l)&&e.jsxs(L,{variant:"outline",size:"sm",className:"h-8",onClick:p,children:[e.jsx(dr,{className:"mr-2 h-4 w-4"}),t("traffic_reset_logs.filters.apply_date")]})]}),r&&e.jsxs(L,{variant:"ghost",onClick:()=>{s.resetColumnFilters(),o(void 0),d(void 0)},className:"h-8 px-2 lg:px-3",children:[t("traffic_reset_logs.filters.reset"),e.jsx(is,{className:"ml-2 h-4 w-4"})]})]}),e.jsx("div",{className:"flex items-center space-x-2",children:e.jsxs(L,{variant:"outline",size:"sm",className:"h-8 border-dashed",onClick:P,disabled:x,children:[e.jsx(sa,{className:"mr-2 h-4 w-4"}),t(x?"traffic_reset_logs.actions.exporting":"traffic_reset_logs.actions.export")]})})]})]})}const ap=()=>{const{t:s}=O("user"),n=a=>{switch(a){case"manual":return"bg-blue-100 text-blue-800 border-blue-200";case"monthly":return"bg-green-100 text-green-800 border-green-200";case"yearly":return"bg-purple-100 text-purple-800 border-purple-200";case"first_day_month":return"bg-orange-100 text-orange-800 border-orange-200";case"first_day_year":return"bg-indigo-100 text-indigo-800 border-indigo-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},t=a=>{switch(a){case"manual":return"bg-orange-100 text-orange-800 border-orange-200";case"cron":return"bg-indigo-100 text-indigo-800 border-indigo-200";case"auto":return"bg-emerald-100 text-emerald-800 border-emerald-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},r=a=>{switch(a){case"manual":return e.jsx(Ta,{className:"h-3 w-3"});case"cron":return e.jsx(Rd,{className:"h-3 w-3"});case"auto":return e.jsx(Ld,{className:"h-3 w-3"});default:return e.jsx(Ta,{className:"h-3 w-3"})}};return[{accessorKey:"id",header:({column:a})=>e.jsx(z,{column:a,title:s("traffic_reset_logs.columns.id"),className:"w-[60px]"}),cell:({row:a})=>e.jsx("div",{className:"w-[60px]",children:e.jsx(K,{variant:"outline",className:"text-xs",children:a.original.id})}),enableSorting:!0,enableHiding:!0,size:60},{accessorKey:"user_email",header:({column:a})=>e.jsx(z,{column:a,title:s("traffic_reset_logs.columns.user"),className:"min-w-[200px]"}),cell:({row:a})=>e.jsxs("div",{className:"flex min-w-[200px] items-start gap-2",children:[e.jsx(zl,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:a.original.user_email}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["ID: ",a.original.user_id]})]})]}),enableSorting:!1,enableHiding:!1,size:100},{accessorKey:"trigger_source",header:({column:a})=>e.jsx(z,{column:a,title:s("traffic_reset_logs.columns.trigger_source"),className:"w-[120px]"}),cell:({row:a})=>e.jsx("div",{className:"w-[120px]",children:e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsx("div",{className:"cursor-pointer",children:e.jsxs(K,{variant:"outline",className:_("flex items-center gap-1.5 border text-xs",t(a.original.trigger_source)),children:[r(a.original.trigger_source),e.jsx("span",{className:"truncate",children:a.original.trigger_source_name})]})})}),e.jsx(ce,{side:"bottom",className:"max-w-[200px]",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm font-medium",children:a.original.trigger_source_name}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[a.original.trigger_source==="manual"&&s("traffic_reset_logs.trigger_descriptions.manual"),a.original.trigger_source==="cron"&&s("traffic_reset_logs.trigger_descriptions.cron"),a.original.trigger_source==="auto"&&s("traffic_reset_logs.trigger_descriptions.auto"),!["manual","cron","auto"].includes(a.original.trigger_source)&&s("traffic_reset_logs.trigger_descriptions.other")]})]})})]})})}),enableSorting:!0,enableHiding:!1,filterFn:(a,o,l)=>l.includes(a.getValue(o)),size:120},{accessorKey:"reset_type",header:({column:a})=>e.jsx(z,{column:a,title:s("traffic_reset_logs.columns.reset_type"),className:"w-[120px]"}),cell:({row:a})=>e.jsx("div",{className:"w-[120px]",children:e.jsx(K,{className:_("border text-xs",n(a.original.reset_type)),children:e.jsx("span",{className:"truncate",children:a.original.reset_type_name})})}),enableSorting:!0,enableHiding:!1,filterFn:(a,o,l)=>l.includes(a.getValue(o)),size:120},{accessorKey:"old_traffic",header:({column:a})=>e.jsx(z,{column:a,title:s("traffic_reset_logs.columns.cleared_traffic"),className:"w-[120px]"}),cell:({row:a})=>{const o=a.original.old_traffic;return e.jsx("div",{className:"w-[120px]",children:e.jsx(pe,{delayDuration:100,children:e.jsxs(ue,{children:[e.jsx(xe,{asChild:!0,children:e.jsxs("div",{className:"cursor-pointer text-center",children:[e.jsx("div",{className:"text-sm font-medium text-destructive",children:o.formatted}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s("traffic_reset_logs.columns.cleared")})]})}),e.jsxs(ce,{side:"bottom",className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Lt,{className:"h-3 w-3"}),e.jsxs("span",{children:[s("traffic_reset_logs.columns.upload"),":"," ",(o.upload/1024**3).toFixed(2)," GB"]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(sa,{className:"h-3 w-3"}),e.jsxs("span",{children:[s("traffic_reset_logs.columns.download"),":"," ",(o.download/1024**3).toFixed(2)," GB"]})]})]})]})})})},enableSorting:!1,enableHiding:!1,size:120},{accessorKey:"reset_time",header:({column:a})=>e.jsx(z,{column:a,title:s("traffic_reset_logs.columns.reset_time"),className:"w-[140px]"}),cell:({row:a})=>e.jsx("div",{className:"w-[140px]",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Yt,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium",children:ie(a.original.reset_time,"MM-DD")}),e.jsx("div",{className:"text-xs text-muted-foreground",children:ie(a.original.reset_time,"HH:mm")})]})]})}),enableSorting:!0,enableHiding:!0,size:140},{accessorKey:"created_at",header:({column:a})=>e.jsx(z,{column:a,title:s("traffic_reset_logs.columns.log_time"),className:"w-[140px]"}),cell:({row:a})=>e.jsx("div",{className:"w-[140px]",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(zn,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium",children:ie(a.original.created_at,"YYYY-MM-DD")}),e.jsx("div",{className:"text-xs text-muted-foreground",children:ie(a.original.created_at,"H:m:s")})]})]})}),enableSorting:!0,enableHiding:!1,size:1400}]};function np(){const[s,n]=m.useState({}),[t,r]=m.useState({reset_time:!1}),[a,o]=m.useState([]),[l,d]=m.useState([{id:"created_at",desc:!0}]),[x,u]=m.useState({pageIndex:0,pageSize:20}),i={page:x.pageIndex+1,per_page:x.pageSize,...a.reduce((T,C)=>{if(C.value)if(C.id==="date_range"){const F=C.value;F.start&&(T.start_date=F.start),F.end&&(T.end_date=F.end)}else T[C.id]=C.value;return T},{})},{refetch:c,data:p,isLoading:P}=ne({queryKey:["trafficResetLogs",x,a,l],queryFn:()=>na.getLogs(i)});return e.jsx(rp,{data:p?.data??[],rowCount:p?.total??0,sorting:l,setSorting:d,columnVisibility:t,setColumnVisibility:r,rowSelection:s,setRowSelection:n,columnFilters:a,setColumnFilters:o,pagination:x,setPagination:u,refetch:c,isLoading:P})}function rp({data:s,rowCount:n,sorting:t,setSorting:r,columnVisibility:a,setColumnVisibility:o,rowSelection:l,setRowSelection:d,columnFilters:x,setColumnFilters:u,pagination:i,setPagination:c,refetch:p,isLoading:P}){const T=We({data:s,columns:ap(),state:{sorting:t,columnVisibility:a,rowSelection:l,columnFilters:x,pagination:i},rowCount:n,manualPagination:!0,manualFiltering:!0,manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:d,onSortingChange:r,onColumnFiltersChange:u,onColumnVisibilityChange:o,getCoreRowModel:Ye(),getFilteredRowModel:gs(),getPaginationRowModel:ss(),onPaginationChange:c,getSortedRowModel:ps(),getFacetedRowModel:Ps(),getFacetedUniqueValues:Ls(),initialState:{columnVisibility:{reset_time:!1}}});return e.jsxs("div",{className:"h-full space-y-4",children:[e.jsx(tp,{table:T,refetch:p}),e.jsx(ns,{table:T,isLoading:P})]})}function lp(){const{t:s}=O("user");return e.jsxs(qe,{children:[e.jsxs(Ue,{children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(os,{})}),e.jsxs("div",{className:"ml-auto flex items-center space-x-4",children:[e.jsx(ts,{}),e.jsx(as,{})]})]}),e.jsxs(Je,{className:"flex flex-col",fixedHeight:!0,children:[e.jsx("div",{className:"mb-4 space-y-2 md:mb-2 md:flex md:items-center md:justify-between md:space-y-0",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-xl font-bold tracking-tight md:text-2xl",children:s("traffic_reset_logs.title")}),e.jsx("p",{className:"text-sm text-muted-foreground md:mt-2",children:s("traffic_reset_logs.description")})]})}),e.jsx("div",{className:"-mx-4 flex-1 overflow-hidden px-4 py-1",children:e.jsx("div",{className:"h-full w-full",children:e.jsx(np,{})})})]})]})}const ip=Object.freeze(Object.defineProperty({__proto__:null,default:lp},Symbol.toStringTag,{value:"Module"}));export{_e as _,xp as a,mp as c,up as g,hp as r}; diff --git a/public/assets/admin/assets/vendor.js b/public/assets/admin/assets/vendor.js index af3decb..2f4c15b 100644 --- a/public/assets/admin/assets/vendor.js +++ b/public/assets/admin/assets/vendor.js @@ -6,7 +6,7 @@ import{g as cs,c as Hh,_ as At,a as yit,r as wit}from"./index.js";function wNe(n * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var TP=Symbol.for("react.element"),Cit=Symbol.for("react.portal"),xit=Symbol.for("react.fragment"),Sit=Symbol.for("react.strict_mode"),kit=Symbol.for("react.profiler"),Eit=Symbol.for("react.provider"),Lit=Symbol.for("react.context"),Tit=Symbol.for("react.forward_ref"),Dit=Symbol.for("react.suspense"),Iit=Symbol.for("react.memo"),Ait=Symbol.for("react.lazy"),Gme=Symbol.iterator;function Nit(n){return n===null||typeof n!="object"?null:(n=Gme&&n[Gme]||n["@@iterator"],typeof n=="function"?n:null)}var SNe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},kNe=Object.assign,ENe={};function ML(n,e,t){this.props=n,this.context=e,this.refs=ENe,this.updater=t||SNe}ML.prototype.isReactComponent={};ML.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};ML.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function LNe(){}LNe.prototype=ML.prototype;function Kse(n,e,t){this.props=n,this.context=e,this.refs=ENe,this.updater=t||SNe}var Gse=Kse.prototype=new LNe;Gse.constructor=Kse;kNe(Gse,ML.prototype);Gse.isPureReactComponent=!0;var Yme=Array.isArray,TNe=Object.prototype.hasOwnProperty,Yse={current:null},DNe={key:!0,ref:!0,__self:!0,__source:!0};function INe(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)TNe.call(e,i)&&!DNe.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1a||r[o]!==s[a]){var l=` -`+r[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{pU=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?pD(n):""}function Yit(n){switch(n.tag){case 5:return pD(n.type);case 16:return pD("Lazy");case 13:return pD("Suspense");case 19:return pD("SuspenseList");case 0:case 2:case 15:return n=mU(n.type,!1),n;case 11:return n=mU(n.type.render,!1),n;case 1:return n=mU(n.type,!0),n;default:return""}}function BG(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case rS:return"Fragment";case iS:return"Portal";case OG:return"Profiler";case eoe:return"StrictMode";case MG:return"Suspense";case FG:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case BNe:return(n.displayName||"Context")+".Consumer";case FNe:return(n._context.displayName||"Context")+".Provider";case toe:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case noe:return e=n.displayName||null,e!==null?e:BG(n.type)||"Memo";case nv:e=n._payload,n=n._init;try{return BG(n(e))}catch{}}return null}function Zit(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return BG(e);case 8:return e===eoe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function fb(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function WNe(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Xit(n){var e=WNe(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function ZM(n){n._valueTracker||(n._valueTracker=Xit(n))}function HNe(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=WNe(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function M5(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function $G(n,e){var t=e.checked;return Lo({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function t_e(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=fb(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function VNe(n,e){e=e.checked,e!=null&&Jse(n,"checked",e,!1)}function WG(n,e){VNe(n,e);var t=fb(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?HG(n,e.type,t):e.hasOwnProperty("defaultValue")&&HG(n,e.type,fb(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function n_e(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function HG(n,e,t){(e!=="number"||M5(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var mD=Array.isArray;function YS(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=XM.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function bA(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var nI={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Qit=["Webkit","ms","Moz","O"];Object.keys(nI).forEach(function(n){Qit.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),nI[e]=nI[n]})});function qNe(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||nI.hasOwnProperty(n)&&nI[n]?(""+e).trim():e+"px"}function KNe(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=qNe(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var Jit=Lo({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function UG(n,e){if(e){if(Jit[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Nt(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Nt(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Nt(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Nt(62))}}function jG(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var qG=null;function ioe(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var KG=null,ZS=null,XS=null;function s_e(n){if(n=AP(n)){if(typeof KG!="function")throw Error(Nt(280));var e=n.stateNode;e&&(e=r$(e),KG(n.stateNode,n.type,e))}}function GNe(n){ZS?XS?XS.push(n):XS=[n]:ZS=n}function YNe(){if(ZS){var n=ZS,e=XS;if(XS=ZS=null,s_e(n),e)for(n=0;n>>=0,n===0?32:31-(urt(n)/drt|0)|0}var QM=64,JM=4194304;function _D(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function W5(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=_D(a):(s&=o,s!==0&&(i=_D(s)))}else o=t&~r,o!==0?i=_D(o):s!==0&&(i=_D(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0t;t++)e.push(n);return e}function DP(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-cg(e),n[e]=t}function prt(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0=rI),g_e=" ",p_e=!1;function pRe(n,e){switch(n){case"keyup":return zrt.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mRe(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var sS=!1;function jrt(n,e){switch(n){case"compositionend":return mRe(e);case"keypress":return e.which!==32?null:(p_e=!0,g_e);case"textInput":return n=e.data,n===g_e&&p_e?null:n;default:return null}}function qrt(n,e){if(sS)return n==="compositionend"||!doe&&pRe(n,e)?(n=fRe(),yF=loe=Sv=null,sS=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=b_e(t)}}function yRe(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?yRe(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function wRe(){for(var n=window,e=M5();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=M5(n.document)}return e}function hoe(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function tst(n){var e=wRe(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&yRe(t.ownerDocument.documentElement,t)){if(i!==null&&hoe(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=y_e(t,s);var o=y_e(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,oS=null,JG=null,oI=null,eY=!1;function w_e(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;eY||oS==null||oS!==M5(i)||(i=oS,"selectionStart"in i&&hoe(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),oI&&kA(oI,i)||(oI=i,i=z5(JG,"onSelect"),0cS||(n.current=oY[cS],oY[cS]=null,cS--)}function Vs(n,e){cS++,oY[cS]=n.current,n.current=e}var gb={},kc=Kb(gb),Gu=Kb(!1),fw=gb;function qk(n,e){var t=n.type.contextTypes;if(!t)return gb;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Yu(n){return n=n.childContextTypes,n!=null}function j5(){ro(Gu),ro(kc)}function T_e(n,e,t){if(kc.current!==gb)throw Error(Nt(168));Vs(kc,e),Vs(Gu,t)}function IRe(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(Nt(108,Zit(n)||"Unknown",r));return Lo({},t,i)}function q5(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||gb,fw=kc.current,Vs(kc,n),Vs(Gu,Gu.current),!0}function D_e(n,e,t){var i=n.stateNode;if(!i)throw Error(Nt(169));t?(n=IRe(n,e,fw),i.__reactInternalMemoizedMergedChildContext=n,ro(Gu),ro(kc),Vs(kc,n)):ro(Gu),Vs(Gu,t)}var Zm=null,s$=!1,IU=!1;function ARe(n){Zm===null?Zm=[n]:Zm.push(n)}function fst(n){s$=!0,ARe(n)}function Gb(){if(!IU&&Zm!==null){IU=!0;var n=0,e=_s;try{var t=Zm;for(_s=1;n>=o,r-=o,c_=1<<32-cg(e)+r|t<D?(I=L,L=null):I=L.sibling;var O=h(_,L,y[D],C);if(O===null){L===null&&(L=I);break}n&&L&&O.alternate===null&&e(_,L),v=s(O,v,D),k===null?x=O:k.sibling=O,k=O,L=I}if(D===y.length)return t(_,L),uo&&W1(_,D),x;if(L===null){for(;DD?(I=L,L=null):I=L.sibling;var M=h(_,L,O.value,C);if(M===null){L===null&&(L=I);break}n&&L&&M.alternate===null&&e(_,L),v=s(M,v,D),k===null?x=M:k.sibling=M,k=M,L=I}if(O.done)return t(_,L),uo&&W1(_,D),x;if(L===null){for(;!O.done;D++,O=y.next())O=d(_,O.value,C),O!==null&&(v=s(O,v,D),k===null?x=O:k.sibling=O,k=O);return uo&&W1(_,D),x}for(L=i(_,L);!O.done;D++,O=y.next())O=f(L,_,D,O.value,C),O!==null&&(n&&O.alternate!==null&&L.delete(O.key===null?D:O.key),v=s(O,v,D),k===null?x=O:k.sibling=O,k=O);return n&&L.forEach(function(B){return e(_,B)}),uo&&W1(_,D),x}function m(_,v,y,C){if(typeof y=="object"&&y!==null&&y.type===rS&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case YM:e:{for(var x=y.key,k=v;k!==null;){if(k.key===x){if(x=y.type,x===rS){if(k.tag===7){t(_,k.sibling),v=r(k,y.props.children),v.return=_,_=v;break e}}else if(k.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===nv&&N_e(x)===k.type){t(_,k.sibling),v=r(k,y.props),v.ref=lT(_,k,y),v.return=_,_=v;break e}t(_,k);break}else e(_,k);k=k.sibling}y.type===rS?(v=zy(y.props.children,_.mode,C,y.key),v.return=_,_=v):(C=TF(y.type,y.key,y.props,null,_.mode,C),C.ref=lT(_,v,y),C.return=_,_=C)}return o(_);case iS:e:{for(k=y.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){t(_,v.sibling),v=r(v,y.children||[]),v.return=_,_=v;break e}else{t(_,v);break}else e(_,v);v=v.sibling}v=BU(y,_.mode,C),v.return=_,_=v}return o(_);case nv:return k=y._init,m(_,v,k(y._payload),C)}if(mD(y))return g(_,v,y,C);if(iT(y))return p(_,v,y,C);o4(_,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(t(_,v.sibling),v=r(v,y),v.return=_,_=v):(t(_,v),v=FU(y,_.mode,C),v.return=_,_=v),o(_)):t(_,v)}return m}var Gk=ORe(!0),MRe=ORe(!1),Y5=Kb(null),Z5=null,hS=null,moe=null;function _oe(){moe=hS=Z5=null}function voe(n){var e=Y5.current;ro(Y5),n._currentValue=e}function cY(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function JS(n,e){Z5=n,moe=hS=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Vu=!0),n.firstContext=null)}function tf(n){var e=n._currentValue;if(moe!==n)if(n={context:n,memoizedValue:e,next:null},hS===null){if(Z5===null)throw Error(Nt(308));hS=n,Z5.dependencies={lanes:0,firstContext:n}}else hS=hS.next=n;return e}var xy=null;function boe(n){xy===null?xy=[n]:xy.push(n)}function FRe(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,boe(e)):(t.next=r.next,r.next=t),e.interleaved=t,V_(n,i)}function V_(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var iv=!1;function yoe(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function BRe(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function E_(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Qv(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,Br&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,V_(n,t)}return r=i.interleaved,r===null?(e.next=e,boe(i)):(e.next=r.next,r.next=e),i.interleaved=e,V_(n,t)}function CF(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,soe(n,t)}}function R_e(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function X5(n,e,t,i){var r=n.updateQueue;iv=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=n.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=r.baseState;o=0,u=c=l=null,a=s;do{var h=a.lane,f=a.eventTime;if((i&h)===h){u!==null&&(u=u.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=n,p=a;switch(h=e,f=t,p.tag){case 1:if(g=p.payload,typeof g=="function"){d=g.call(f,d,h);break e}d=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=p.payload,h=typeof g=="function"?g.call(f,d,h):g,h==null)break e;d=Lo({},d,h);break e;case 2:iv=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,h=r.effects,h===null?r.effects=[a]:h.push(a))}else f={eventTime:f,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=f,l=d):u=u.next=f,o|=h;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;h=a,a=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}while(!0);if(u===null&&(l=d),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);mw|=o,n.lanes=o,n.memoizedState=d}}function P_e(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var i=NU.transition;NU.transition={};try{n(!1),e()}finally{_s=t,NU.transition=i}}function tPe(){return nf().memoizedState}function _st(n,e,t){var i=eb(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},nPe(n))iPe(e,t);else if(t=FRe(n,e,t,i),t!==null){var r=iu();ug(t,n,i,r),rPe(t,e,i)}}function vst(n,e,t){var i=eb(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(nPe(n))iPe(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,Cg(a,o)){var l=e.interleaved;l===null?(r.next=r,boe(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=FRe(n,e,r,i),t!==null&&(r=iu(),ug(t,n,i,r),rPe(t,e,i))}}function nPe(n){var e=n.alternate;return n===So||e!==null&&e===So}function iPe(n,e){aI=J5=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function rPe(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,soe(n,t)}}var e6={readContext:tf,useCallback:ec,useContext:ec,useEffect:ec,useImperativeHandle:ec,useInsertionEffect:ec,useLayoutEffect:ec,useMemo:ec,useReducer:ec,useRef:ec,useState:ec,useDebugValue:ec,useDeferredValue:ec,useTransition:ec,useMutableSource:ec,useSyncExternalStore:ec,useId:ec,unstable_isNewReconciler:!1},bst={readContext:tf,useCallback:function(n,e){return op().memoizedState=[n,e===void 0?null:e],n},useContext:tf,useEffect:M_e,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,SF(4194308,4,ZRe.bind(null,e,n),t)},useLayoutEffect:function(n,e){return SF(4194308,4,n,e)},useInsertionEffect:function(n,e){return SF(4,2,n,e)},useMemo:function(n,e){var t=op();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=op();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=_st.bind(null,So,n),[i.memoizedState,n]},useRef:function(n){var e=op();return n={current:n},e.memoizedState=n},useState:O_e,useDebugValue:Toe,useDeferredValue:function(n){return op().memoizedState=n},useTransition:function(){var n=O_e(!1),e=n[0];return n=mst.bind(null,n[1]),op().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=So,r=op();if(uo){if(t===void 0)throw Error(Nt(407));t=t()}else{if(t=e(),vl===null)throw Error(Nt(349));pw&30||VRe(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,M_e(URe.bind(null,i,s,n),[n]),i.flags|=2048,RA(9,zRe.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=op(),e=vl.identifierPrefix;if(uo){var t=u_,i=c_;t=(i&~(1<<32-cg(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=AA++,0")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{pU=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?pD(n):""}function Yit(n){switch(n.tag){case 5:return pD(n.type);case 16:return pD("Lazy");case 13:return pD("Suspense");case 19:return pD("SuspenseList");case 0:case 2:case 15:return n=mU(n.type,!1),n;case 11:return n=mU(n.type.render,!1),n;case 1:return n=mU(n.type,!0),n;default:return""}}function BG(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case rS:return"Fragment";case iS:return"Portal";case OG:return"Profiler";case eoe:return"StrictMode";case MG:return"Suspense";case FG:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case BNe:return(n.displayName||"Context")+".Consumer";case FNe:return(n._context.displayName||"Context")+".Provider";case toe:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case noe:return e=n.displayName||null,e!==null?e:BG(n.type)||"Memo";case nv:e=n._payload,n=n._init;try{return BG(n(e))}catch{}}return null}function Zit(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return BG(e);case 8:return e===eoe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function fb(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function WNe(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Xit(n){var e=WNe(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function ZM(n){n._valueTracker||(n._valueTracker=Xit(n))}function HNe(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=WNe(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function MF(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function $G(n,e){var t=e.checked;return Lo({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function t_e(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=fb(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function VNe(n,e){e=e.checked,e!=null&&Jse(n,"checked",e,!1)}function WG(n,e){VNe(n,e);var t=fb(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?HG(n,e.type,t):e.hasOwnProperty("defaultValue")&&HG(n,e.type,fb(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function n_e(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function HG(n,e,t){(e!=="number"||MF(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var mD=Array.isArray;function YS(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=XM.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function bA(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var nI={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Qit=["Webkit","ms","Moz","O"];Object.keys(nI).forEach(function(n){Qit.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),nI[e]=nI[n]})});function qNe(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||nI.hasOwnProperty(n)&&nI[n]?(""+e).trim():e+"px"}function KNe(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=qNe(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var Jit=Lo({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function UG(n,e){if(e){if(Jit[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Nt(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Nt(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Nt(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Nt(62))}}function jG(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var qG=null;function ioe(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var KG=null,ZS=null,XS=null;function s_e(n){if(n=AP(n)){if(typeof KG!="function")throw Error(Nt(280));var e=n.stateNode;e&&(e=r$(e),KG(n.stateNode,n.type,e))}}function GNe(n){ZS?XS?XS.push(n):XS=[n]:ZS=n}function YNe(){if(ZS){var n=ZS,e=XS;if(XS=ZS=null,s_e(n),e)for(n=0;n>>=0,n===0?32:31-(urt(n)/drt|0)|0}var QM=64,JM=4194304;function _D(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function WF(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=_D(a):(s&=o,s!==0&&(i=_D(s)))}else o=t&~r,o!==0?i=_D(o):s!==0&&(i=_D(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0t;t++)e.push(n);return e}function DP(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-cg(e),n[e]=t}function prt(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0=rI),g_e=" ",p_e=!1;function pRe(n,e){switch(n){case"keyup":return zrt.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mRe(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var sS=!1;function jrt(n,e){switch(n){case"compositionend":return mRe(e);case"keypress":return e.which!==32?null:(p_e=!0,g_e);case"textInput":return n=e.data,n===g_e&&p_e?null:n;default:return null}}function qrt(n,e){if(sS)return n==="compositionend"||!doe&&pRe(n,e)?(n=fRe(),y5=loe=Sv=null,sS=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=b_e(t)}}function yRe(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?yRe(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function wRe(){for(var n=window,e=MF();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=MF(n.document)}return e}function hoe(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function tst(n){var e=wRe(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&yRe(t.ownerDocument.documentElement,t)){if(i!==null&&hoe(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=y_e(t,s);var o=y_e(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,oS=null,JG=null,oI=null,eY=!1;function w_e(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;eY||oS==null||oS!==MF(i)||(i=oS,"selectionStart"in i&&hoe(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),oI&&kA(oI,i)||(oI=i,i=zF(JG,"onSelect"),0cS||(n.current=oY[cS],oY[cS]=null,cS--)}function Vs(n,e){cS++,oY[cS]=n.current,n.current=e}var gb={},kc=Kb(gb),Gu=Kb(!1),fw=gb;function qk(n,e){var t=n.type.contextTypes;if(!t)return gb;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Yu(n){return n=n.childContextTypes,n!=null}function jF(){ro(Gu),ro(kc)}function T_e(n,e,t){if(kc.current!==gb)throw Error(Nt(168));Vs(kc,e),Vs(Gu,t)}function IRe(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(Nt(108,Zit(n)||"Unknown",r));return Lo({},t,i)}function qF(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||gb,fw=kc.current,Vs(kc,n),Vs(Gu,Gu.current),!0}function D_e(n,e,t){var i=n.stateNode;if(!i)throw Error(Nt(169));t?(n=IRe(n,e,fw),i.__reactInternalMemoizedMergedChildContext=n,ro(Gu),ro(kc),Vs(kc,n)):ro(Gu),Vs(Gu,t)}var Zm=null,s$=!1,IU=!1;function ARe(n){Zm===null?Zm=[n]:Zm.push(n)}function fst(n){s$=!0,ARe(n)}function Gb(){if(!IU&&Zm!==null){IU=!0;var n=0,e=_s;try{var t=Zm;for(_s=1;n>=o,r-=o,c_=1<<32-cg(e)+r|t<D?(I=L,L=null):I=L.sibling;var O=h(_,L,y[D],C);if(O===null){L===null&&(L=I);break}n&&L&&O.alternate===null&&e(_,L),v=s(O,v,D),k===null?x=O:k.sibling=O,k=O,L=I}if(D===y.length)return t(_,L),uo&&W1(_,D),x;if(L===null){for(;DD?(I=L,L=null):I=L.sibling;var M=h(_,L,O.value,C);if(M===null){L===null&&(L=I);break}n&&L&&M.alternate===null&&e(_,L),v=s(M,v,D),k===null?x=M:k.sibling=M,k=M,L=I}if(O.done)return t(_,L),uo&&W1(_,D),x;if(L===null){for(;!O.done;D++,O=y.next())O=d(_,O.value,C),O!==null&&(v=s(O,v,D),k===null?x=O:k.sibling=O,k=O);return uo&&W1(_,D),x}for(L=i(_,L);!O.done;D++,O=y.next())O=f(L,_,D,O.value,C),O!==null&&(n&&O.alternate!==null&&L.delete(O.key===null?D:O.key),v=s(O,v,D),k===null?x=O:k.sibling=O,k=O);return n&&L.forEach(function(B){return e(_,B)}),uo&&W1(_,D),x}function m(_,v,y,C){if(typeof y=="object"&&y!==null&&y.type===rS&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case YM:e:{for(var x=y.key,k=v;k!==null;){if(k.key===x){if(x=y.type,x===rS){if(k.tag===7){t(_,k.sibling),v=r(k,y.props.children),v.return=_,_=v;break e}}else if(k.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===nv&&N_e(x)===k.type){t(_,k.sibling),v=r(k,y.props),v.ref=lT(_,k,y),v.return=_,_=v;break e}t(_,k);break}else e(_,k);k=k.sibling}y.type===rS?(v=zy(y.props.children,_.mode,C,y.key),v.return=_,_=v):(C=T5(y.type,y.key,y.props,null,_.mode,C),C.ref=lT(_,v,y),C.return=_,_=C)}return o(_);case iS:e:{for(k=y.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){t(_,v.sibling),v=r(v,y.children||[]),v.return=_,_=v;break e}else{t(_,v);break}else e(_,v);v=v.sibling}v=BU(y,_.mode,C),v.return=_,_=v}return o(_);case nv:return k=y._init,m(_,v,k(y._payload),C)}if(mD(y))return g(_,v,y,C);if(iT(y))return p(_,v,y,C);o4(_,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(t(_,v.sibling),v=r(v,y),v.return=_,_=v):(t(_,v),v=FU(y,_.mode,C),v.return=_,_=v),o(_)):t(_,v)}return m}var Gk=ORe(!0),MRe=ORe(!1),YF=Kb(null),ZF=null,hS=null,moe=null;function _oe(){moe=hS=ZF=null}function voe(n){var e=YF.current;ro(YF),n._currentValue=e}function cY(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function JS(n,e){ZF=n,moe=hS=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Vu=!0),n.firstContext=null)}function tf(n){var e=n._currentValue;if(moe!==n)if(n={context:n,memoizedValue:e,next:null},hS===null){if(ZF===null)throw Error(Nt(308));hS=n,ZF.dependencies={lanes:0,firstContext:n}}else hS=hS.next=n;return e}var xy=null;function boe(n){xy===null?xy=[n]:xy.push(n)}function FRe(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,boe(e)):(t.next=r.next,r.next=t),e.interleaved=t,V_(n,i)}function V_(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var iv=!1;function yoe(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function BRe(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function E_(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Qv(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,Br&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,V_(n,t)}return r=i.interleaved,r===null?(e.next=e,boe(i)):(e.next=r.next,r.next=e),i.interleaved=e,V_(n,t)}function C5(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,soe(n,t)}}function R_e(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function XF(n,e,t,i){var r=n.updateQueue;iv=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=n.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=r.baseState;o=0,u=c=l=null,a=s;do{var h=a.lane,f=a.eventTime;if((i&h)===h){u!==null&&(u=u.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=n,p=a;switch(h=e,f=t,p.tag){case 1:if(g=p.payload,typeof g=="function"){d=g.call(f,d,h);break e}d=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=p.payload,h=typeof g=="function"?g.call(f,d,h):g,h==null)break e;d=Lo({},d,h);break e;case 2:iv=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,h=r.effects,h===null?r.effects=[a]:h.push(a))}else f={eventTime:f,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=f,l=d):u=u.next=f,o|=h;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;h=a,a=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}while(!0);if(u===null&&(l=d),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);mw|=o,n.lanes=o,n.memoizedState=d}}function P_e(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var i=NU.transition;NU.transition={};try{n(!1),e()}finally{_s=t,NU.transition=i}}function tPe(){return nf().memoizedState}function _st(n,e,t){var i=eb(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},nPe(n))iPe(e,t);else if(t=FRe(n,e,t,i),t!==null){var r=iu();ug(t,n,i,r),rPe(t,e,i)}}function vst(n,e,t){var i=eb(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(nPe(n))iPe(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,Cg(a,o)){var l=e.interleaved;l===null?(r.next=r,boe(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=FRe(n,e,r,i),t!==null&&(r=iu(),ug(t,n,i,r),rPe(t,e,i))}}function nPe(n){var e=n.alternate;return n===So||e!==null&&e===So}function iPe(n,e){aI=JF=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function rPe(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,soe(n,t)}}var e6={readContext:tf,useCallback:ec,useContext:ec,useEffect:ec,useImperativeHandle:ec,useInsertionEffect:ec,useLayoutEffect:ec,useMemo:ec,useReducer:ec,useRef:ec,useState:ec,useDebugValue:ec,useDeferredValue:ec,useTransition:ec,useMutableSource:ec,useSyncExternalStore:ec,useId:ec,unstable_isNewReconciler:!1},bst={readContext:tf,useCallback:function(n,e){return op().memoizedState=[n,e===void 0?null:e],n},useContext:tf,useEffect:M_e,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,S5(4194308,4,ZRe.bind(null,e,n),t)},useLayoutEffect:function(n,e){return S5(4194308,4,n,e)},useInsertionEffect:function(n,e){return S5(4,2,n,e)},useMemo:function(n,e){var t=op();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=op();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=_st.bind(null,So,n),[i.memoizedState,n]},useRef:function(n){var e=op();return n={current:n},e.memoizedState=n},useState:O_e,useDebugValue:Toe,useDeferredValue:function(n){return op().memoizedState=n},useTransition:function(){var n=O_e(!1),e=n[0];return n=mst.bind(null,n[1]),op().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=So,r=op();if(uo){if(t===void 0)throw Error(Nt(407));t=t()}else{if(t=e(),vl===null)throw Error(Nt(349));pw&30||VRe(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,M_e(URe.bind(null,i,s,n),[n]),i.flags|=2048,RA(9,zRe.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=op(),e=vl.identifierPrefix;if(uo){var t=u_,i=c_;t=(i&~(1<<32-cg(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=AA++,0<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[bp]=e,n[TA]=i,gPe(n,e,!1,!1),e.stateNode=n;e:{switch(o=jG(t,i),t){case"dialog":Qs("cancel",n),Qs("close",n),r=i;break;case"iframe":case"object":case"embed":Qs("load",n),r=i;break;case"video":case"audio":for(r=0;rXk&&(e.flags|=128,i=!0,cT(s,!1),e.lanes=4194304)}else{if(!i)if(n=Q5(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),cT(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!uo)return tc(e),null}else 2*Go()-s.renderingStartTime>Xk&&t!==1073741824&&(e.flags|=128,i=!0,cT(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Go(),e.sibling=null,t=yo.current,Vs(yo,i?t&1|2:t&1),e):(tc(e),null);case 22:case 23:return Poe(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Ed&1073741824&&(tc(e),e.subtreeFlags&6&&(e.flags|=8192)):tc(e),null;case 24:return null;case 25:return null}throw Error(Nt(156,e.tag))}function Lst(n,e){switch(goe(e),e.tag){case 1:return Yu(e.type)&&j5(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Yk(),ro(Gu),ro(kc),xoe(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return Coe(e),null;case 13:if(ro(yo),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Nt(340));Kk()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return ro(yo),null;case 4:return Yk(),null;case 10:return voe(e.type._context),null;case 22:case 23:return Poe(),null;case 24:return null;default:return null}}var l4=!1,uc=!1,Tst=typeof WeakSet=="function"?WeakSet:Set,_n=null;function fS(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Ro(n,e,i)}else t.current=null}function vY(n,e,t){try{t()}catch(i){Ro(n,e,i)}}var K_e=!1;function Dst(n,e){if(tY=H5,n=wRe(),hoe(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=n,h=null;t:for(;;){for(var f;d!==t||r!==0&&d.nodeType!==3||(a=o+r),d!==s||i!==0&&d.nodeType!==3||(l=o+i),d.nodeType===3&&(o+=d.nodeValue.length),(f=d.firstChild)!==null;)h=d,d=f;for(;;){if(d===n)break t;if(h===t&&++c===r&&(a=o),h===s&&++u===i&&(l=o),(f=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=f}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(nY={focusedElem:n,selectionRange:t},H5=!1,_n=e;_n!==null;)if(e=_n,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,_n=n;else for(;_n!==null;){e=_n;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var p=g.memoizedProps,m=g.memoizedState,_=e.stateNode,v=_.getSnapshotBeforeUpdate(e.elementType===e.type?p:Bf(e.type,p),m);_.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var y=e.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Nt(163))}}catch(C){Ro(e,e.return,C)}if(n=e.sibling,n!==null){n.return=e.return,_n=n;break}_n=e.return}return g=K_e,K_e=!1,g}function lI(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&vY(e,t,s)}r=r.next}while(r!==i)}}function l$(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function bY(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function _Pe(n){var e=n.alternate;e!==null&&(n.alternate=null,_Pe(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[bp],delete e[TA],delete e[sY],delete e[dst],delete e[hst])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function vPe(n){return n.tag===5||n.tag===3||n.tag===4}function G_e(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||vPe(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function yY(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=U5));else if(i!==4&&(n=n.child,n!==null))for(yY(n,e,t),n=n.sibling;n!==null;)yY(n,e,t),n=n.sibling}function wY(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(wY(n,e,t),n=n.sibling;n!==null;)wY(n,e,t),n=n.sibling}var Dl=null,Hf=!1;function F0(n,e,t){for(t=t.child;t!==null;)bPe(n,e,t),t=t.sibling}function bPe(n,e,t){if(Op&&typeof Op.onCommitFiberUnmount=="function")try{Op.onCommitFiberUnmount(e$,t)}catch{}switch(t.tag){case 5:uc||fS(t,e);case 6:var i=Dl,r=Hf;Dl=null,F0(n,e,t),Dl=i,Hf=r,Dl!==null&&(Hf?(n=Dl,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Dl.removeChild(t.stateNode));break;case 18:Dl!==null&&(Hf?(n=Dl,t=t.stateNode,n.nodeType===8?DU(n.parentNode,t):n.nodeType===1&&DU(n,t),xA(n)):DU(Dl,t.stateNode));break;case 4:i=Dl,r=Hf,Dl=t.stateNode.containerInfo,Hf=!0,F0(n,e,t),Dl=i,Hf=r;break;case 0:case 11:case 14:case 15:if(!uc&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&vY(t,e,o),r=r.next}while(r!==i)}F0(n,e,t);break;case 1:if(!uc&&(fS(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){Ro(t,e,a)}F0(n,e,t);break;case 21:F0(n,e,t);break;case 22:t.mode&1?(uc=(i=uc)||t.memoizedState!==null,F0(n,e,t),uc=i):F0(n,e,t);break;default:F0(n,e,t)}}function Y_e(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new Tst),e.forEach(function(i){var r=Bst.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Sf(n,e){var t=e.deletions;if(t!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=Go()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Ast(i/1960))-i,10n?16:n,kv===null)var i=!1;else{if(n=kv,kv=null,i6=0,Br&6)throw Error(Nt(331));var r=Br;for(Br|=4,_n=n.current;_n!==null;){var s=_n,o=s.child;if(_n.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lGo()-Noe?Vy(n,0):Aoe|=t),Zu(n,e)}function LPe(n,e){e===0&&(n.mode&1?(e=JM,JM<<=1,!(JM&130023424)&&(JM=4194304)):e=1);var t=iu();n=V_(n,e),n!==null&&(DP(n,e,t),Zu(n,t))}function Fst(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),LPe(n,t)}function Bst(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(Nt(314))}i!==null&&i.delete(e),LPe(n,t)}var TPe;TPe=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Gu.current)Vu=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Vu=!1,kst(n,e,t);Vu=!!(n.flags&131072)}else Vu=!1,uo&&e.flags&1048576&&NRe(e,G5,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;kF(n,e),n=e.pendingProps;var r=qk(e,kc.current);JS(e,t),r=koe(null,e,i,n,r,t);var s=Eoe();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Yu(i)?(s=!0,q5(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,yoe(e),r.updater=a$,e.stateNode=r,r._reactInternals=e,dY(e,i,n,t),e=gY(null,e,i,!0,s,t)):(e.tag=0,uo&&s&&foe(e),jc(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(kF(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=Wst(i),n=Bf(i,n),r){case 0:e=fY(null,e,i,n,t);break e;case 1:e=U_e(null,e,i,n,t);break e;case 11:e=V_e(null,e,i,n,t);break e;case 14:e=z_e(null,e,i,Bf(i.type,n),t);break e}throw Error(Nt(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bf(i,r),fY(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bf(i,r),U_e(n,e,i,r,t);case 3:e:{if(dPe(e),n===null)throw Error(Nt(387));i=e.pendingProps,s=e.memoizedState,r=s.element,BRe(n,e),X5(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Zk(Error(Nt(423)),e),e=j_e(n,e,i,t,r);break e}else if(i!==r){r=Zk(Error(Nt(424)),e),e=j_e(n,e,i,t,r);break e}else for($d=Xv(e.stateNode.containerInfo.firstChild),Vd=e,uo=!0,Gf=null,t=MRe(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Kk(),i===r){e=z_(n,e,t);break e}jc(n,e,i,t)}e=e.child}return e;case 5:return $Re(e),n===null&&lY(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,iY(i,r)?o=null:s!==null&&iY(i,s)&&(e.flags|=32),uPe(n,e),jc(n,e,o,t),e.child;case 6:return n===null&&lY(e),null;case 13:return hPe(n,e,t);case 4:return woe(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Gk(e,null,i,t):jc(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bf(i,r),V_e(n,e,i,r,t);case 7:return jc(n,e,e.pendingProps,t),e.child;case 8:return jc(n,e,e.pendingProps.children,t),e.child;case 12:return jc(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,Vs(Y5,i._currentValue),i._currentValue=o,s!==null)if(Cg(s.value,o)){if(s.children===r.children&&!Gu.current){e=z_(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=E_(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),cY(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Nt(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),cY(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}jc(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,JS(e,t),r=tf(r),i=i(r),e.flags|=1,jc(n,e,i,t),e.child;case 14:return i=e.type,r=Bf(i,e.pendingProps),r=Bf(i.type,r),z_e(n,e,i,r,t);case 15:return lPe(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bf(i,r),kF(n,e),e.tag=1,Yu(i)?(n=!0,q5(e)):n=!1,JS(e,t),sPe(e,i,r),dY(e,i,r,t),gY(null,e,i,!0,n,t);case 19:return fPe(n,e,t);case 22:return cPe(n,e,t)}throw Error(Nt(156,e.tag))};function DPe(n,e){return nRe(n,e)}function $st(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jh(n,e,t,i){return new $st(n,e,t,i)}function Moe(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Wst(n){if(typeof n=="function")return Moe(n)?1:0;if(n!=null){if(n=n.$$typeof,n===toe)return 11;if(n===noe)return 14}return 2}function tb(n,e){var t=n.alternate;return t===null?(t=jh(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function TF(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")Moe(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case rS:return zy(t.children,r,s,e);case eoe:o=8,r|=8;break;case OG:return n=jh(12,t,e,r|2),n.elementType=OG,n.lanes=s,n;case MG:return n=jh(13,t,e,r),n.elementType=MG,n.lanes=s,n;case FG:return n=jh(19,t,e,r),n.elementType=FG,n.lanes=s,n;case $Ne:return u$(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case FNe:o=10;break e;case BNe:o=9;break e;case toe:o=11;break e;case noe:o=14;break e;case nv:o=16,i=null;break e}throw Error(Nt(130,n==null?n:typeof n,""))}return e=jh(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function zy(n,e,t,i){return n=jh(7,n,i,e),n.lanes=t,n}function u$(n,e,t,i){return n=jh(22,n,i,e),n.elementType=$Ne,n.lanes=t,n.stateNode={isHidden:!1},n}function FU(n,e,t){return n=jh(6,n,null,e),n.lanes=t,n}function BU(n,e,t){return e=jh(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function Hst(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=vU(0),this.expirationTimes=vU(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vU(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Foe(n,e,t,i,r,s,o,a,l){return n=new Hst(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=jh(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},yoe(s),n}function Vst(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(RPe)}catch(n){console.error(n)}}RPe(),RNe.exports=lh;var h0=RNe.exports;const p$=cs(h0),qst=wNe({__proto__:null,default:p$},[h0]);var i0e=h0;Xme.createRoot=i0e.createRoot,Xme.hydrateRoot=i0e.hydrateRoot;/** +`+s.stack}return{value:n,source:e,stack:r,digest:null}}function OU(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function hY(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var Cst=typeof WeakMap=="function"?WeakMap:Map;function oPe(n,e,t){t=E_(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){n6||(n6=!0,CY=i),hY(n,e)},t}function aPe(n,e,t){t=E_(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){hY(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){hY(n,e),typeof i!="function"&&(Jv===null?Jv=new Set([this]):Jv.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function $_e(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new Cst;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=Mst.bind(null,n,e,t),e.then(n,n))}function W_e(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function H_e(n,e,t,i,r){return n.mode&1?(n.flags|=65536,n.lanes=r,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=E_(-1,1),e.tag=2,Qv(t,e,1))),t.lanes|=1),n)}var xst=d0.ReactCurrentOwner,Vu=!1;function jc(n,e,t,i){e.child=n===null?MRe(e,null,t,i):Gk(e,n.child,t,i)}function V_e(n,e,t,i,r){t=t.render;var s=e.ref;return JS(e,r),i=koe(n,e,t,i,s,r),t=Eoe(),n!==null&&!Vu?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,z_(n,e,r)):(uo&&t&&foe(e),e.flags|=1,jc(n,e,i,r),e.child)}function z_e(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!Moe(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,lPe(n,e,s,i,r)):(n=T5(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&r)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:kA,t(o,i)&&n.ref===e.ref)return z_(n,e,r)}return e.flags|=1,n=tb(s,i),n.ref=e.ref,n.return=e,e.child=n}function lPe(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(kA(s,i)&&n.ref===e.ref)if(Vu=!1,e.pendingProps=i=s,(n.lanes&r)!==0)n.flags&131072&&(Vu=!0);else return e.lanes=n.lanes,z_(n,e,r)}return fY(n,e,t,i,r)}function cPe(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Vs(gS,Ed),Ed|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,Vs(gS,Ed),Ed|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,Vs(gS,Ed),Ed|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,Vs(gS,Ed),Ed|=i;return jc(n,e,r,t),e.child}function uPe(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function fY(n,e,t,i,r){var s=Yu(t)?fw:kc.current;return s=qk(e,s),JS(e,r),t=koe(n,e,t,i,s,r),i=Eoe(),n!==null&&!Vu?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,z_(n,e,r)):(uo&&i&&foe(e),e.flags|=1,jc(n,e,t,r),e.child)}function U_e(n,e,t,i,r){if(Yu(t)){var s=!0;qF(e)}else s=!1;if(JS(e,r),e.stateNode===null)k5(n,e),sPe(e,t,i),dY(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=t.contextType;typeof c=="object"&&c!==null?c=tf(c):(c=Yu(t)?fw:kc.current,c=qk(e,c));var u=t.getDerivedStateFromProps,d=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||l!==c)&&B_e(e,o,i,c),iv=!1;var h=e.memoizedState;o.state=h,XF(e,i,o,r),l=e.memoizedState,a!==i||h!==l||Gu.current||iv?(typeof u=="function"&&(uY(e,t,u,i),l=e.memoizedState),(a=iv||F_e(e,t,a,i,h,l,c))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),o.props=i,o.state=l,o.context=c,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,BRe(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:Bf(e.type,a),o.props=c,d=e.pendingProps,h=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=tf(l):(l=Yu(t)?fw:kc.current,l=qk(e,l));var f=t.getDerivedStateFromProps;(u=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||h!==l)&&B_e(e,o,i,l),iv=!1,h=e.memoizedState,o.state=h,XF(e,i,o,r);var g=e.memoizedState;a!==d||h!==g||Gu.current||iv?(typeof f=="function"&&(uY(e,t,f,i),g=e.memoizedState),(c=iv||F_e(e,t,c,i,h,g,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,g,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=g),o.props=i,o.state=g,o.context=l,i=c):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=1024),i=!1)}return gY(n,e,t,i,s,r)}function gY(n,e,t,i,r,s){uPe(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&D_e(e,t,!1),z_(n,e,s);i=e.stateNode,xst.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=Gk(e,n.child,null,s),e.child=Gk(e,null,a,s)):jc(n,e,a,s),e.memoizedState=i.state,r&&D_e(e,t,!0),e.child}function dPe(n){var e=n.stateNode;e.pendingContext?T_e(n,e.pendingContext,e.pendingContext!==e.context):e.context&&T_e(n,e.context,!1),woe(n,e.containerInfo)}function j_e(n,e,t,i,r){return Kk(),poe(r),e.flags|=256,jc(n,e,t,i),e.child}var pY={dehydrated:null,treeContext:null,retryLane:0};function mY(n){return{baseLanes:n,cachePool:null,transitions:null}}function hPe(n,e,t){var i=e.pendingProps,r=yo.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(r&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),Vs(yo,r&1),n===null)return lY(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=u$(o,i,0,null),n=zy(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=mY(t),e.memoizedState=pY,n):Doe(e,o));if(r=n.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return Sst(n,e,o,i,a,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,a=r.sibling;var l={mode:"hidden",children:i.children};return!(o&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=tb(r,l),i.subtreeFlags=r.subtreeFlags&14680064),a!==null?s=tb(a,s):(s=zy(s,o,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=n.child.memoizedState,o=o===null?mY(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=pY,i}return s=n.child,n=s.sibling,i=tb(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function Doe(n,e){return e=u$({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function a4(n,e,t,i){return i!==null&&poe(i),Gk(e,n.child,null,t),n=Doe(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function Sst(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=OU(Error(Nt(422))),a4(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=u$({mode:"visible",children:i.children},r,0,null),s=zy(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&Gk(e,n.child,null,o),e.child.memoizedState=mY(o),e.memoizedState=pY,s);if(!(e.mode&1))return a4(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(Nt(419)),i=OU(s,i,void 0),a4(n,e,o,i)}if(a=(o&n.childLanes)!==0,Vu||a){if(i=vl,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|o)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,V_(n,r),ug(i,n,r,-1))}return Ooe(),i=OU(Error(Nt(421))),a4(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=Fst.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,$d=Xv(r.nextSibling),Vd=e,uo=!0,Gf=null,n!==null&&(Mh[Fh++]=c_,Mh[Fh++]=u_,Mh[Fh++]=gw,c_=n.id,u_=n.overflow,gw=e),e=Doe(e,i.children),e.flags|=4096,e)}function q_e(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),cY(n.return,e,t)}function MU(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function fPe(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(jc(n,e,i.children,t),i=yo.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&q_e(n,t,e);else if(n.tag===19)q_e(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(Vs(yo,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&QF(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),MU(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&QF(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}MU(e,!0,t,null,s);break;case"together":MU(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function k5(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function z_(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),mw|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(Nt(153));if(e.child!==null){for(n=e.child,t=tb(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=tb(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function kst(n,e,t){switch(e.tag){case 3:dPe(e),Kk();break;case 5:$Re(e);break;case 1:Yu(e.type)&&qF(e);break;case 4:woe(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;Vs(YF,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(Vs(yo,yo.current&1),e.flags|=128,null):t&e.child.childLanes?hPe(n,e,t):(Vs(yo,yo.current&1),n=z_(n,e,t),n!==null?n.sibling:null);Vs(yo,yo.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return fPe(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Vs(yo,yo.current),i)break;return null;case 22:case 23:return e.lanes=0,cPe(n,e,t)}return z_(n,e,t)}var gPe,_Y,pPe,mPe;gPe=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};_Y=function(){};pPe=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,Sy(Mp.current);var s=null;switch(t){case"input":r=$G(n,r),i=$G(n,i),s=[];break;case"select":r=Lo({},r,{value:void 0}),i=Lo({},i,{value:void 0}),s=[];break;case"textarea":r=VG(n,r),i=VG(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=UF)}UG(t,i);var o;t=null;for(c in r)if(!i.hasOwnProperty(c)&&r.hasOwnProperty(c)&&r[c]!=null)if(c==="style"){var a=r[c];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(vA.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in i){var l=i[c];if(a=r?.[c],i.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(vA.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Qs("scroll",n),s||a===l||(s=[])):(s=s||[]).push(c,l))}t&&(s=s||[]).push("style",t);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};mPe=function(n,e,t,i){t!==i&&(e.flags|=4)};function cT(n,e){if(!uo)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function tc(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function Est(n,e,t){var i=e.pendingProps;switch(goe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tc(e),null;case 1:return Yu(e.type)&&jF(),tc(e),null;case 3:return i=e.stateNode,Yk(),ro(Gu),ro(kc),xoe(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(s4(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Gf!==null&&(kY(Gf),Gf=null))),_Y(n,e),tc(e),null;case 5:Coe(e);var r=Sy(IA.current);if(t=e.type,n!==null&&e.stateNode!=null)pPe(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(Nt(166));return tc(e),null}if(n=Sy(Mp.current),s4(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[bp]=e,i[TA]=s,n=(e.mode&1)!==0,t){case"dialog":Qs("cancel",i),Qs("close",i);break;case"iframe":case"object":case"embed":Qs("load",i);break;case"video":case"audio":for(r=0;r<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[bp]=e,n[TA]=i,gPe(n,e,!1,!1),e.stateNode=n;e:{switch(o=jG(t,i),t){case"dialog":Qs("cancel",n),Qs("close",n),r=i;break;case"iframe":case"object":case"embed":Qs("load",n),r=i;break;case"video":case"audio":for(r=0;rXk&&(e.flags|=128,i=!0,cT(s,!1),e.lanes=4194304)}else{if(!i)if(n=QF(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),cT(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!uo)return tc(e),null}else 2*Go()-s.renderingStartTime>Xk&&t!==1073741824&&(e.flags|=128,i=!0,cT(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Go(),e.sibling=null,t=yo.current,Vs(yo,i?t&1|2:t&1),e):(tc(e),null);case 22:case 23:return Poe(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Ed&1073741824&&(tc(e),e.subtreeFlags&6&&(e.flags|=8192)):tc(e),null;case 24:return null;case 25:return null}throw Error(Nt(156,e.tag))}function Lst(n,e){switch(goe(e),e.tag){case 1:return Yu(e.type)&&jF(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Yk(),ro(Gu),ro(kc),xoe(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return Coe(e),null;case 13:if(ro(yo),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Nt(340));Kk()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return ro(yo),null;case 4:return Yk(),null;case 10:return voe(e.type._context),null;case 22:case 23:return Poe(),null;case 24:return null;default:return null}}var l4=!1,uc=!1,Tst=typeof WeakSet=="function"?WeakSet:Set,_n=null;function fS(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Ro(n,e,i)}else t.current=null}function vY(n,e,t){try{t()}catch(i){Ro(n,e,i)}}var K_e=!1;function Dst(n,e){if(tY=HF,n=wRe(),hoe(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=n,h=null;t:for(;;){for(var f;d!==t||r!==0&&d.nodeType!==3||(a=o+r),d!==s||i!==0&&d.nodeType!==3||(l=o+i),d.nodeType===3&&(o+=d.nodeValue.length),(f=d.firstChild)!==null;)h=d,d=f;for(;;){if(d===n)break t;if(h===t&&++c===r&&(a=o),h===s&&++u===i&&(l=o),(f=d.nextSibling)!==null)break;d=h,h=d.parentNode}d=f}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(nY={focusedElem:n,selectionRange:t},HF=!1,_n=e;_n!==null;)if(e=_n,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,_n=n;else for(;_n!==null;){e=_n;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var p=g.memoizedProps,m=g.memoizedState,_=e.stateNode,v=_.getSnapshotBeforeUpdate(e.elementType===e.type?p:Bf(e.type,p),m);_.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var y=e.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Nt(163))}}catch(C){Ro(e,e.return,C)}if(n=e.sibling,n!==null){n.return=e.return,_n=n;break}_n=e.return}return g=K_e,K_e=!1,g}function lI(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&vY(e,t,s)}r=r.next}while(r!==i)}}function l$(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function bY(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function _Pe(n){var e=n.alternate;e!==null&&(n.alternate=null,_Pe(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[bp],delete e[TA],delete e[sY],delete e[dst],delete e[hst])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function vPe(n){return n.tag===5||n.tag===3||n.tag===4}function G_e(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||vPe(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function yY(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=UF));else if(i!==4&&(n=n.child,n!==null))for(yY(n,e,t),n=n.sibling;n!==null;)yY(n,e,t),n=n.sibling}function wY(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(wY(n,e,t),n=n.sibling;n!==null;)wY(n,e,t),n=n.sibling}var Dl=null,Hf=!1;function F0(n,e,t){for(t=t.child;t!==null;)bPe(n,e,t),t=t.sibling}function bPe(n,e,t){if(Op&&typeof Op.onCommitFiberUnmount=="function")try{Op.onCommitFiberUnmount(e$,t)}catch{}switch(t.tag){case 5:uc||fS(t,e);case 6:var i=Dl,r=Hf;Dl=null,F0(n,e,t),Dl=i,Hf=r,Dl!==null&&(Hf?(n=Dl,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Dl.removeChild(t.stateNode));break;case 18:Dl!==null&&(Hf?(n=Dl,t=t.stateNode,n.nodeType===8?DU(n.parentNode,t):n.nodeType===1&&DU(n,t),xA(n)):DU(Dl,t.stateNode));break;case 4:i=Dl,r=Hf,Dl=t.stateNode.containerInfo,Hf=!0,F0(n,e,t),Dl=i,Hf=r;break;case 0:case 11:case 14:case 15:if(!uc&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&vY(t,e,o),r=r.next}while(r!==i)}F0(n,e,t);break;case 1:if(!uc&&(fS(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){Ro(t,e,a)}F0(n,e,t);break;case 21:F0(n,e,t);break;case 22:t.mode&1?(uc=(i=uc)||t.memoizedState!==null,F0(n,e,t),uc=i):F0(n,e,t);break;default:F0(n,e,t)}}function Y_e(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new Tst),e.forEach(function(i){var r=Bst.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Sf(n,e){var t=e.deletions;if(t!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=Go()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Ast(i/1960))-i,10n?16:n,kv===null)var i=!1;else{if(n=kv,kv=null,i6=0,Br&6)throw Error(Nt(331));var r=Br;for(Br|=4,_n=n.current;_n!==null;){var s=_n,o=s.child;if(_n.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lGo()-Noe?Vy(n,0):Aoe|=t),Zu(n,e)}function LPe(n,e){e===0&&(n.mode&1?(e=JM,JM<<=1,!(JM&130023424)&&(JM=4194304)):e=1);var t=iu();n=V_(n,e),n!==null&&(DP(n,e,t),Zu(n,t))}function Fst(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),LPe(n,t)}function Bst(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(Nt(314))}i!==null&&i.delete(e),LPe(n,t)}var TPe;TPe=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Gu.current)Vu=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Vu=!1,kst(n,e,t);Vu=!!(n.flags&131072)}else Vu=!1,uo&&e.flags&1048576&&NRe(e,GF,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;k5(n,e),n=e.pendingProps;var r=qk(e,kc.current);JS(e,t),r=koe(null,e,i,n,r,t);var s=Eoe();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Yu(i)?(s=!0,qF(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,yoe(e),r.updater=a$,e.stateNode=r,r._reactInternals=e,dY(e,i,n,t),e=gY(null,e,i,!0,s,t)):(e.tag=0,uo&&s&&foe(e),jc(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(k5(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=Wst(i),n=Bf(i,n),r){case 0:e=fY(null,e,i,n,t);break e;case 1:e=U_e(null,e,i,n,t);break e;case 11:e=V_e(null,e,i,n,t);break e;case 14:e=z_e(null,e,i,Bf(i.type,n),t);break e}throw Error(Nt(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bf(i,r),fY(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bf(i,r),U_e(n,e,i,r,t);case 3:e:{if(dPe(e),n===null)throw Error(Nt(387));i=e.pendingProps,s=e.memoizedState,r=s.element,BRe(n,e),XF(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Zk(Error(Nt(423)),e),e=j_e(n,e,i,t,r);break e}else if(i!==r){r=Zk(Error(Nt(424)),e),e=j_e(n,e,i,t,r);break e}else for($d=Xv(e.stateNode.containerInfo.firstChild),Vd=e,uo=!0,Gf=null,t=MRe(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Kk(),i===r){e=z_(n,e,t);break e}jc(n,e,i,t)}e=e.child}return e;case 5:return $Re(e),n===null&&lY(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,iY(i,r)?o=null:s!==null&&iY(i,s)&&(e.flags|=32),uPe(n,e),jc(n,e,o,t),e.child;case 6:return n===null&&lY(e),null;case 13:return hPe(n,e,t);case 4:return woe(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Gk(e,null,i,t):jc(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bf(i,r),V_e(n,e,i,r,t);case 7:return jc(n,e,e.pendingProps,t),e.child;case 8:return jc(n,e,e.pendingProps.children,t),e.child;case 12:return jc(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,Vs(YF,i._currentValue),i._currentValue=o,s!==null)if(Cg(s.value,o)){if(s.children===r.children&&!Gu.current){e=z_(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=E_(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),cY(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Nt(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),cY(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}jc(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,JS(e,t),r=tf(r),i=i(r),e.flags|=1,jc(n,e,i,t),e.child;case 14:return i=e.type,r=Bf(i,e.pendingProps),r=Bf(i.type,r),z_e(n,e,i,r,t);case 15:return lPe(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bf(i,r),k5(n,e),e.tag=1,Yu(i)?(n=!0,qF(e)):n=!1,JS(e,t),sPe(e,i,r),dY(e,i,r,t),gY(null,e,i,!0,n,t);case 19:return fPe(n,e,t);case 22:return cPe(n,e,t)}throw Error(Nt(156,e.tag))};function DPe(n,e){return nRe(n,e)}function $st(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jh(n,e,t,i){return new $st(n,e,t,i)}function Moe(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Wst(n){if(typeof n=="function")return Moe(n)?1:0;if(n!=null){if(n=n.$$typeof,n===toe)return 11;if(n===noe)return 14}return 2}function tb(n,e){var t=n.alternate;return t===null?(t=jh(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function T5(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")Moe(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case rS:return zy(t.children,r,s,e);case eoe:o=8,r|=8;break;case OG:return n=jh(12,t,e,r|2),n.elementType=OG,n.lanes=s,n;case MG:return n=jh(13,t,e,r),n.elementType=MG,n.lanes=s,n;case FG:return n=jh(19,t,e,r),n.elementType=FG,n.lanes=s,n;case $Ne:return u$(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case FNe:o=10;break e;case BNe:o=9;break e;case toe:o=11;break e;case noe:o=14;break e;case nv:o=16,i=null;break e}throw Error(Nt(130,n==null?n:typeof n,""))}return e=jh(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function zy(n,e,t,i){return n=jh(7,n,i,e),n.lanes=t,n}function u$(n,e,t,i){return n=jh(22,n,i,e),n.elementType=$Ne,n.lanes=t,n.stateNode={isHidden:!1},n}function FU(n,e,t){return n=jh(6,n,null,e),n.lanes=t,n}function BU(n,e,t){return e=jh(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function Hst(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=vU(0),this.expirationTimes=vU(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vU(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Foe(n,e,t,i,r,s,o,a,l){return n=new Hst(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=jh(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},yoe(s),n}function Vst(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(RPe)}catch(n){console.error(n)}}RPe(),RNe.exports=lh;var h0=RNe.exports;const p$=cs(h0),qst=wNe({__proto__:null,default:p$},[h0]);var i0e=h0;Xme.createRoot=i0e.createRoot,Xme.hydrateRoot=i0e.hydrateRoot;/** * @remix-run/router v1.21.0 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function lo(){return lo=Object.assign?Object.assign.bind():function(n){for(var e=1;e"u")throw new Error(e)}function vw(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Gst(){return Math.random().toString(36).substr(2,8)}function s0e(n,e){return{usr:n.state,key:n.key,idx:e}}function OA(n,e,t,i){return t===void 0&&(t=null),lo({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof e=="string"?f0(e):e,{state:t,key:e&&e.key||i||Gst()})}function bw(n){let{pathname:e="/",search:t="",hash:i=""}=n;return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function f0(n){let e={};if(n){let t=n.indexOf("#");t>=0&&(e.hash=n.substr(t),n=n.substr(0,t));let i=n.indexOf("?");i>=0&&(e.search=n.substr(i),n=n.substr(0,i)),n&&(e.pathname=n)}return e}function Yst(n,e,t,i){i===void 0&&(i={});let{window:r=document.defaultView,v5Compat:s=!1}=i,o=r.history,a=ba.Pop,l=null,c=u();c==null&&(c=0,o.replaceState(lo({},o.state,{idx:c}),""));function u(){return(o.state||{idx:null}).idx}function d(){a=ba.Pop;let m=u(),_=m==null?null:m-c;c=m,l&&l({action:a,location:p.location,delta:_})}function h(m,_){a=ba.Push;let v=OA(p.location,m,_);t(v,m),c=u()+1;let y=s0e(v,c),C=p.createHref(v);try{o.pushState(y,"",C)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;r.location.assign(C)}s&&l&&l({action:a,location:p.location,delta:1})}function f(m,_){a=ba.Replace;let v=OA(p.location,m,_);t(v,m),c=u();let y=s0e(v,c),C=p.createHref(v);o.replaceState(y,"",C),s&&l&&l({action:a,location:p.location,delta:0})}function g(m){let _=r.location.origin!=="null"?r.location.origin:r.location.href,v=typeof m=="string"?m:bw(m);return v=v.replace(/ $/,"%20"),pr(_,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,_)}let p={get action(){return a},get location(){return n(r,o)},listen(m){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(r0e,d),l=m,()=>{r.removeEventListener(r0e,d),l=null}},createHref(m){return e(r,m)},createURL:g,encodeLocation(m){let _=g(m);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:h,replace:f,go(m){return o.go(m)}};return p}var Cs;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(Cs||(Cs={}));const Zst=new Set(["lazy","caseSensitive","path","id","index","children"]);function Xst(n){return n.index===!0}function o6(n,e,t,i){return t===void 0&&(t=[]),i===void 0&&(i={}),n.map((r,s)=>{let o=[...t,String(s)],a=typeof r.id=="string"?r.id:o.join("-");if(pr(r.index!==!0||!r.children,"Cannot specify children on an index route"),pr(!i[a],'Found a route id collision on id "'+a+`". Route id's must be globally unique within Data Router usages`),Xst(r)){let l=lo({},r,e(r),{id:a});return i[a]=l,l}else{let l=lo({},r,e(r),{id:a,children:void 0});return i[a]=l,r.children&&(l.children=o6(r.children,e,o,i)),l}})}function sy(n,e,t){return t===void 0&&(t="/"),DF(n,e,t,!1)}function DF(n,e,t,i){let r=typeof e=="string"?f0(e):e,s=$L(r.pathname||"/",t);if(s==null)return null;let o=PPe(n);Jst(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(pr(l.relativePath.startsWith(i),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(i.length));let c=L_([i,l.relativePath]),u=t.concat(l);s.children&&s.children.length>0&&(pr(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),PPe(s.children,e,u,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:oot(c,s.index),routesMeta:u})};return n.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))r(s,o);else for(let l of OPe(s.path))r(s,o,l)}),e}function OPe(n){let e=n.split("/");if(e.length===0)return[];let[t,...i]=e,r=t.endsWith("?"),s=t.replace(/\?$/,"");if(i.length===0)return r?[s,""]:[s];let o=OPe(i.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),r&&a.push(...o),a.map(l=>n.startsWith("/")&&l===""?"/":l)}function Jst(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:aot(e.routesMeta.map(i=>i.childrenIndex),t.routesMeta.map(i=>i.childrenIndex)))}const eot=/^:[\w-]+$/,tot=3,not=2,iot=1,rot=10,sot=-2,o0e=n=>n==="*";function oot(n,e){let t=n.split("/"),i=t.length;return t.some(o0e)&&(i+=sot),e&&(i+=not),t.filter(r=>!o0e(r)).reduce((r,s)=>r+(eot.test(s)?tot:s===""?iot:rot),i)}function aot(n,e){return n.length===e.length&&n.slice(0,-1).every((i,r)=>i===e[r])?n[n.length-1]-e[e.length-1]:0}function lot(n,e,t){t===void 0&&(t=!1);let{routesMeta:i}=n,r={},s="/",o=[];for(let a=0;a{let{paramName:h,isOptional:f}=u;if(h==="*"){let p=a[d]||"";o=s.slice(0,s.length-p.length).replace(/(.)\/+$/,"$1")}const g=a[d];return f&&!g?c[h]=void 0:c[h]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:n}}function cot(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!0),vw(n==="*"||!n.endsWith("*")||n.endsWith("/*"),'Route path "'+n+'" will be treated as if it were '+('"'+n.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+n.replace(/\*$/,"/*")+'".'));let i=[],r="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(i.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return n.endsWith("*")?(i.push({paramName:"*"}),r+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?r+="\\/*$":n!==""&&n!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function uot(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return vw(!1,'The URL path "'+n+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),n}}function $L(n,e){if(e==="/")return n;if(!n.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,i=n.charAt(t);return i&&i!=="/"?null:n.slice(t)||"/"}function dot(n,e){e===void 0&&(e="/");let{pathname:t,search:i="",hash:r=""}=typeof n=="string"?f0(n):n;return{pathname:t?t.startsWith("/")?t:hot(t,e):e,search:got(i),hash:pot(r)}}function hot(n,e){let t=e.replace(/\/+$/,"").split("/");return n.split("/").forEach(r=>{r===".."?t.length>1&&t.pop():r!=="."&&t.push(r)}),t.length>1?t.join("/"):"/"}function $U(n,e,t,i){return"Cannot include a '"+n+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+t+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function MPe(n){return n.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Hoe(n,e){let t=MPe(n);return e?t.map((i,r)=>r===t.length-1?i.pathname:i.pathnameBase):t.map(i=>i.pathnameBase)}function Voe(n,e,t,i){i===void 0&&(i=!1);let r;typeof n=="string"?r=f0(n):(r=lo({},n),pr(!r.pathname||!r.pathname.includes("?"),$U("?","pathname","search",r)),pr(!r.pathname||!r.pathname.includes("#"),$U("#","pathname","hash",r)),pr(!r.search||!r.search.includes("#"),$U("#","search","hash",r)));let s=n===""||r.pathname==="",o=s?"/":r.pathname,a;if(o==null)a=t;else{let d=e.length-1;if(!i&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),d-=1;r.pathname=h.join("/")}a=d>=0?e[d]:"/"}let l=dot(r,a),c=o&&o!=="/"&&o.endsWith("/"),u=(s||o===".")&&t.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const L_=n=>n.join("/").replace(/\/\/+/g,"/"),fot=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),got=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,pot=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n;class a6{constructor(e,t,i,r){r===void 0&&(r=!1),this.status=e,this.statusText=t||"",this.internal=r,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}}function m$(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}const FPe=["post","put","patch","delete"],mot=new Set(FPe),_ot=["get",...FPe],vot=new Set(_ot),bot=new Set([301,302,303,307,308]),yot=new Set([307,308]),WU={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},wot={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},dT={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},zoe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Cot=n=>({hasErrorBoundary:!!n.hasErrorBoundary}),BPe="remix-router-transitions";function xot(n){const e=n.window?n.window:typeof window<"u"?window:void 0,t=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",i=!t;pr(n.routes.length>0,"You must provide a non-empty routes array to createRouter");let r;if(n.mapRouteProperties)r=n.mapRouteProperties;else if(n.detectErrorBoundary){let H=n.detectErrorBoundary;r=Y=>({hasErrorBoundary:H(Y)})}else r=Cot;let s={},o=o6(n.routes,r,void 0,s),a,l=n.basename||"/",c=n.dataStrategy||Lot,u=n.patchRoutesOnNavigation,d=lo({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},n.future),h=null,f=new Set,g=null,p=null,m=null,_=n.hydrationData!=null,v=sy(o,n.history.location,l),y=null;if(v==null&&!u){let H=Nu(404,{pathname:n.history.location.pathname}),{matches:Y,route:ne}=v0e(o);v=Y,y={[ne.id]:H}}v&&!n.hydrationData&&Wn(v,o,n.history.location.pathname).active&&(v=null);let C;if(v)if(v.some(H=>H.route.lazy))C=!1;else if(!v.some(H=>H.route.loader))C=!0;else if(d.v7_partialHydration){let H=n.hydrationData?n.hydrationData.loaderData:null,Y=n.hydrationData?n.hydrationData.errors:null;if(Y){let ne=v.findIndex(N=>Y[N.route.id]!==void 0);C=v.slice(0,ne+1).every(N=>!LY(N.route,H,Y))}else C=v.every(ne=>!LY(ne.route,H,Y))}else C=n.hydrationData!=null;else if(C=!1,v=[],d.v7_partialHydration){let H=Wn(null,o,n.history.location.pathname);H.active&&H.matches&&(v=H.matches)}let x,k={historyAction:n.history.action,location:n.history.location,matches:v,initialized:C,navigation:WU,restoreScrollPosition:n.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:n.hydrationData&&n.hydrationData.loaderData||{},actionData:n.hydrationData&&n.hydrationData.actionData||null,errors:n.hydrationData&&n.hydrationData.errors||y,fetchers:new Map,blockers:new Map},L=ba.Pop,D=!1,I,O=!1,M=new Map,B=null,G=!1,W=!1,z=[],q=new Set,ee=new Map,Z=0,j=-1,te=new Map,le=new Set,ue=new Map,de=new Map,we=new Set,xe=new Map,Me=new Map,Re;function _t(){if(h=n.history.listen(H=>{let{action:Y,location:ne,delta:N}=H;if(Re){Re(),Re=void 0;return}vw(Me.size===0||N!=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 F=qn({currentLocation:k.location,nextLocation:ne,historyAction:Y});if(F&&N!=null){let V=new Promise(A=>{Re=A});n.history.go(N*-1),Ft(F,{state:"blocked",location:ne,proceed(){Ft(F,{state:"proceeding",proceed:void 0,reset:void 0,location:ne}),V.then(()=>n.history.go(N))},reset(){let A=new Map(k.blockers);A.set(F,dT),gt({blockers:A})}});return}return jn(Y,ne)}),t){Hot(e,M);let H=()=>Vot(e,M);e.addEventListener("pagehide",H),B=()=>e.removeEventListener("pagehide",H)}return k.initialized||jn(ba.Pop,k.location,{initialHydration:!0}),x}function Qe(){h&&h(),B&&B(),f.clear(),I&&I.abort(),k.fetchers.forEach((H,Y)=>Pr(Y)),k.blockers.forEach((H,Y)=>As(Y))}function pt(H){return f.add(H),()=>f.delete(H)}function gt(H,Y){Y===void 0&&(Y={}),k=lo({},k,H);let ne=[],N=[];d.v7_fetcherPersist&&k.fetchers.forEach((F,V)=>{F.state==="idle"&&(we.has(V)?N.push(V):ne.push(V))}),[...f].forEach(F=>F(k,{deletedFetchers:N,viewTransitionOpts:Y.viewTransitionOpts,flushSync:Y.flushSync===!0})),d.v7_fetcherPersist&&(ne.forEach(F=>k.fetchers.delete(F)),N.forEach(F=>Pr(F)))}function Ue(H,Y,ne){var N,F;let{flushSync:V}=ne===void 0?{}:ne,A=k.actionData!=null&&k.navigation.formMethod!=null&&Vf(k.navigation.formMethod)&&k.navigation.state==="loading"&&((N=H.state)==null?void 0:N._isRedirect)!==!0,K;Y.actionData?Object.keys(Y.actionData).length>0?K=Y.actionData:K=null:A?K=k.actionData:K=null;let ge=Y.loaderData?m0e(k.loaderData,Y.loaderData,Y.matches||[],Y.errors):k.loaderData,pe=k.blockers;pe.size>0&&(pe=new Map(pe),pe.forEach((ht,bt)=>pe.set(bt,dT)));let Ee=D===!0||k.navigation.formMethod!=null&&Vf(k.navigation.formMethod)&&((F=H.state)==null?void 0:F._isRedirect)!==!0;a&&(o=a,a=void 0),G||L===ba.Pop||(L===ba.Push?n.history.push(H,H.state):L===ba.Replace&&n.history.replace(H,H.state));let Be;if(L===ba.Pop){let ht=M.get(k.location.pathname);ht&&ht.has(H.pathname)?Be={currentLocation:k.location,nextLocation:H}:M.has(H.pathname)&&(Be={currentLocation:H,nextLocation:k.location})}else if(O){let ht=M.get(k.location.pathname);ht?ht.add(H.pathname):(ht=new Set([H.pathname]),M.set(k.location.pathname,ht)),Be={currentLocation:k.location,nextLocation:H}}gt(lo({},Y,{actionData:K,loaderData:ge,historyAction:L,location:H,initialized:!0,navigation:WU,revalidation:"idle",restoreScrollPosition:Yi(H,Y.matches||k.matches),preventScrollReset:Ee,blockers:pe}),{viewTransitionOpts:Be,flushSync:V===!0}),L=ba.Pop,D=!1,O=!1,G=!1,W=!1,z=[]}async function wn(H,Y){if(typeof H=="number"){n.history.go(H);return}let ne=EY(k.location,k.matches,l,d.v7_prependBasename,H,d.v7_relativeSplatPath,Y?.fromRouteId,Y?.relative),{path:N,submission:F,error:V}=l0e(d.v7_normalizeFormMethod,!1,ne,Y),A=k.location,K=OA(k.location,N,Y&&Y.state);K=lo({},K,n.history.encodeLocation(K));let ge=Y&&Y.replace!=null?Y.replace:void 0,pe=ba.Push;ge===!0?pe=ba.Replace:ge===!1||F!=null&&Vf(F.formMethod)&&F.formAction===k.location.pathname+k.location.search&&(pe=ba.Replace);let Ee=Y&&"preventScrollReset"in Y?Y.preventScrollReset===!0:void 0,Be=(Y&&Y.flushSync)===!0,ht=qn({currentLocation:A,nextLocation:K,historyAction:pe});if(ht){Ft(ht,{state:"blocked",location:K,proceed(){Ft(ht,{state:"proceeding",proceed:void 0,reset:void 0,location:K}),wn(H,Y)},reset(){let bt=new Map(k.blockers);bt.set(ht,dT),gt({blockers:bt})}});return}return await jn(pe,K,{submission:F,pendingError:V,preventScrollReset:Ee,replace:Y&&Y.replace,enableViewTransition:Y&&Y.viewTransition,flushSync:Be})}function Xt(){if(Pi(),gt({revalidation:"loading"}),k.navigation.state!=="submitting"){if(k.navigation.state==="idle"){jn(k.historyAction,k.location,{startUninterruptedRevalidation:!0});return}jn(L||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation,enableViewTransition:O===!0})}}async function jn(H,Y,ne){I&&I.abort(),I=null,L=H,G=(ne&&ne.startUninterruptedRevalidation)===!0,mi(k.location,k.matches),D=(ne&&ne.preventScrollReset)===!0,O=(ne&&ne.enableViewTransition)===!0;let N=a||o,F=ne&&ne.overrideNavigation,V=sy(N,Y,l),A=(ne&&ne.flushSync)===!0,K=Wn(V,N,Y.pathname);if(K.active&&K.matches&&(V=K.matches),!V){let{error:hn,notFoundMatches:Fe,route:_e}=pi(Y.pathname);Ue(Y,{matches:Fe,loaderData:{},errors:{[_e.id]:hn}},{flushSync:A});return}if(k.initialized&&!W&&Rot(k.location,Y)&&!(ne&&ne.submission&&Vf(ne.submission.formMethod))){Ue(Y,{matches:V},{flushSync:A});return}I=new AbortController;let ge=sx(n.history,Y,I.signal,ne&&ne.submission),pe;if(ne&&ne.pendingError)pe=[oy(V).route.id,{type:Cs.error,error:ne.pendingError}];else if(ne&&ne.submission&&Vf(ne.submission.formMethod)){let hn=await ji(ge,Y,ne.submission,V,K.active,{replace:ne.replace,flushSync:A});if(hn.shortCircuited)return;if(hn.pendingActionResult){let[Fe,_e]=hn.pendingActionResult;if(Id(_e)&&m$(_e.error)&&_e.error.status===404){I=null,Ue(Y,{matches:hn.matches,loaderData:{},errors:{[Fe]:_e.error}});return}}V=hn.matches||V,pe=hn.pendingActionResult,F=HU(Y,ne.submission),A=!1,K.active=!1,ge=sx(n.history,ge.url,ge.signal)}let{shortCircuited:Ee,matches:Be,loaderData:ht,errors:bt}=await ci(ge,Y,V,K.active,F,ne&&ne.submission,ne&&ne.fetcherSubmission,ne&&ne.replace,ne&&ne.initialHydration===!0,A,pe);Ee||(I=null,Ue(Y,lo({matches:Be||V},_0e(pe),{loaderData:ht,errors:bt})))}async function ji(H,Y,ne,N,F,V){V===void 0&&(V={}),Pi();let A=$ot(Y,ne);if(gt({navigation:A},{flushSync:V.flushSync===!0}),F){let pe=await pn(N,Y.pathname,H.signal);if(pe.type==="aborted")return{shortCircuited:!0};if(pe.type==="error"){let Ee=oy(pe.partialMatches).route.id;return{matches:pe.partialMatches,pendingActionResult:[Ee,{type:Cs.error,error:pe.error}]}}else if(pe.matches)N=pe.matches;else{let{notFoundMatches:Ee,error:Be,route:ht}=pi(Y.pathname);return{matches:Ee,pendingActionResult:[ht.id,{type:Cs.error,error:Be}]}}}let K,ge=bD(N,Y);if(!ge.route.action&&!ge.route.lazy)K={type:Cs.error,error:Nu(405,{method:H.method,pathname:Y.pathname,routeId:ge.route.id})};else if(K=(await $t("action",k,H,[ge],N,null))[ge.route.id],H.signal.aborted)return{shortCircuited:!0};if(ky(K)){let pe;return V&&V.replace!=null?pe=V.replace:pe=f0e(K.response.headers.get("Location"),new URL(H.url),l)===k.location.pathname+k.location.search,await nt(H,K,!0,{submission:ne,replace:pe}),{shortCircuited:!0}}if(Ev(K))throw Nu(400,{type:"defer-action"});if(Id(K)){let pe=oy(N,ge.route.id);return(V&&V.replace)!==!0&&(L=ba.Push),{matches:N,pendingActionResult:[pe.route.id,K]}}return{matches:N,pendingActionResult:[ge.route.id,K]}}async function ci(H,Y,ne,N,F,V,A,K,ge,pe,Ee){let Be=F||HU(Y,V),ht=V||A||y0e(Be),bt=!G&&(!d.v7_partialHydration||!ge);if(N){if(bt){let Rt=ye(Ee);gt(lo({navigation:Be},Rt!==void 0?{actionData:Rt}:{}),{flushSync:pe})}let Ct=await pn(ne,Y.pathname,H.signal);if(Ct.type==="aborted")return{shortCircuited:!0};if(Ct.type==="error"){let Rt=oy(Ct.partialMatches).route.id;return{matches:Ct.partialMatches,loaderData:{},errors:{[Rt]:Ct.error}}}else if(Ct.matches)ne=Ct.matches;else{let{error:Rt,notFoundMatches:qt,route:Ye}=pi(Y.pathname);return{matches:qt,loaderData:{},errors:{[Ye.id]:Rt}}}}let hn=a||o,[Fe,_e]=u0e(n.history,k,ne,ht,Y,d.v7_partialHydration&&ge===!0,d.v7_skipActionErrorRevalidation,W,z,q,we,ue,le,hn,l,Ee);if(bn(Ct=>!(ne&&ne.some(Rt=>Rt.route.id===Ct))||Fe&&Fe.some(Rt=>Rt.route.id===Ct)),j=++Z,Fe.length===0&&_e.length===0){let Ct=qi();return Ue(Y,lo({matches:ne,loaderData:{},errors:Ee&&Id(Ee[1])?{[Ee[0]]:Ee[1].error}:null},_0e(Ee),Ct?{fetchers:new Map(k.fetchers)}:{}),{flushSync:pe}),{shortCircuited:!0}}if(bt){let Ct={};if(!N){Ct.navigation=Be;let Rt=ye(Ee);Rt!==void 0&&(Ct.actionData=Rt)}_e.length>0&&(Ct.fetchers=Ie(_e)),gt(Ct,{flushSync:pe})}_e.forEach(Ct=>{cr(Ct.key),Ct.controller&&ee.set(Ct.key,Ct.controller)});let Ze=()=>_e.forEach(Ct=>cr(Ct.key));I&&I.signal.addEventListener("abort",Ze);let{loaderResults:ct,fetcherResults:Ht}=await an(k,ne,Fe,_e,H);if(H.signal.aborted)return{shortCircuited:!0};I&&I.signal.removeEventListener("abort",Ze),_e.forEach(Ct=>ee.delete(Ct.key));let Zt=d4(ct);if(Zt)return await nt(H,Zt.result,!0,{replace:K}),{shortCircuited:!0};if(Zt=d4(Ht),Zt)return le.add(Zt.key),await nt(H,Zt.result,!0,{replace:K}),{shortCircuited:!0};let{loaderData:nn,errors:ln}=p0e(k,ne,ct,Ee,_e,Ht,xe);xe.forEach((Ct,Rt)=>{Ct.subscribe(qt=>{(qt||Ct.done)&&xe.delete(Rt)})}),d.v7_partialHydration&&ge&&k.errors&&(ln=lo({},k.errors,ln));let Wt=qi(),on=Er(j),It=Wt||on||_e.length>0;return lo({matches:ne,loaderData:nn,errors:ln},It?{fetchers:new Map(k.fetchers)}:{})}function ye(H){if(H&&!Id(H[1]))return{[H[0]]:H[1].data};if(k.actionData)return Object.keys(k.actionData).length===0?null:k.actionData}function Ie(H){return H.forEach(Y=>{let ne=k.fetchers.get(Y.key),N=hT(void 0,ne?ne.data:void 0);k.fetchers.set(Y.key,N)}),new Map(k.fetchers)}function Ve(H,Y,ne,N){if(i)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");cr(H);let F=(N&&N.flushSync)===!0,V=a||o,A=EY(k.location,k.matches,l,d.v7_prependBasename,ne,d.v7_relativeSplatPath,Y,N?.relative),K=sy(V,A,l),ge=Wn(K,V,A);if(ge.active&&ge.matches&&(K=ge.matches),!K){Qi(H,Y,Nu(404,{pathname:A}),{flushSync:F});return}let{path:pe,submission:Ee,error:Be}=l0e(d.v7_normalizeFormMethod,!0,A,N);if(Be){Qi(H,Y,Be,{flushSync:F});return}let ht=bD(K,pe),bt=(N&&N.preventScrollReset)===!0;if(Ee&&Vf(Ee.formMethod)){wt(H,Y,pe,ht,K,ge.active,F,bt,Ee);return}ue.set(H,{routeId:Y,path:pe}),vt(H,Y,pe,ht,K,ge.active,F,bt,Ee)}async function wt(H,Y,ne,N,F,V,A,K,ge){Pi(),ue.delete(H);function pe(Oe){if(!Oe.route.action&&!Oe.route.lazy){let mt=Nu(405,{method:ge.formMethod,pathname:ne,routeId:Y});return Qi(H,Y,mt,{flushSync:A}),!0}return!1}if(!V&&pe(N))return;let Ee=k.fetchers.get(H);Xn(H,Wot(ge,Ee),{flushSync:A});let Be=new AbortController,ht=sx(n.history,ne,Be.signal,ge);if(V){let Oe=await pn(F,ne,ht.signal);if(Oe.type==="aborted")return;if(Oe.type==="error"){Qi(H,Y,Oe.error,{flushSync:A});return}else if(Oe.matches){if(F=Oe.matches,N=bD(F,ne),pe(N))return}else{Qi(H,Y,Nu(404,{pathname:ne}),{flushSync:A});return}}ee.set(H,Be);let bt=Z,Fe=(await $t("action",k,ht,[N],F,H))[N.route.id];if(ht.signal.aborted){ee.get(H)===Be&&ee.delete(H);return}if(d.v7_fetcherPersist&&we.has(H)){if(ky(Fe)||Id(Fe)){Xn(H,G0(void 0));return}}else{if(ky(Fe))if(ee.delete(H),j>bt){Xn(H,G0(void 0));return}else return le.add(H),Xn(H,hT(ge)),nt(ht,Fe,!1,{fetcherSubmission:ge,preventScrollReset:K});if(Id(Fe)){Qi(H,Y,Fe.error);return}}if(Ev(Fe))throw Nu(400,{type:"defer-action"});let _e=k.navigation.location||k.location,Ze=sx(n.history,_e,Be.signal),ct=a||o,Ht=k.navigation.state!=="idle"?sy(ct,k.navigation.location,l):k.matches;pr(Ht,"Didn't find any matches after fetcher action");let Zt=++Z;te.set(H,Zt);let nn=hT(ge,Fe.data);k.fetchers.set(H,nn);let[ln,Wt]=u0e(n.history,k,Ht,ge,_e,!1,d.v7_skipActionErrorRevalidation,W,z,q,we,ue,le,ct,l,[N.route.id,Fe]);Wt.filter(Oe=>Oe.key!==H).forEach(Oe=>{let mt=Oe.key,at=k.fetchers.get(mt),lt=hT(void 0,at?at.data:void 0);k.fetchers.set(mt,lt),cr(mt),Oe.controller&&ee.set(mt,Oe.controller)}),gt({fetchers:new Map(k.fetchers)});let on=()=>Wt.forEach(Oe=>cr(Oe.key));Be.signal.addEventListener("abort",on);let{loaderResults:It,fetcherResults:Ct}=await an(k,Ht,ln,Wt,Ze);if(Be.signal.aborted)return;Be.signal.removeEventListener("abort",on),te.delete(H),ee.delete(H),Wt.forEach(Oe=>ee.delete(Oe.key));let Rt=d4(It);if(Rt)return nt(Ze,Rt.result,!1,{preventScrollReset:K});if(Rt=d4(Ct),Rt)return le.add(Rt.key),nt(Ze,Rt.result,!1,{preventScrollReset:K});let{loaderData:qt,errors:Ye}=p0e(k,Ht,It,void 0,Wt,Ct,xe);if(k.fetchers.has(H)){let Oe=G0(Fe.data);k.fetchers.set(H,Oe)}Er(Zt),k.navigation.state==="loading"&&Zt>j?(pr(L,"Expected pending action"),I&&I.abort(),Ue(k.navigation.location,{matches:Ht,loaderData:qt,errors:Ye,fetchers:new Map(k.fetchers)})):(gt({errors:Ye,loaderData:m0e(k.loaderData,qt,Ht,Ye),fetchers:new Map(k.fetchers)}),W=!1)}async function vt(H,Y,ne,N,F,V,A,K,ge){let pe=k.fetchers.get(H);Xn(H,hT(ge,pe?pe.data:void 0),{flushSync:A});let Ee=new AbortController,Be=sx(n.history,ne,Ee.signal);if(V){let Fe=await pn(F,ne,Be.signal);if(Fe.type==="aborted")return;if(Fe.type==="error"){Qi(H,Y,Fe.error,{flushSync:A});return}else if(Fe.matches)F=Fe.matches,N=bD(F,ne);else{Qi(H,Y,Nu(404,{pathname:ne}),{flushSync:A});return}}ee.set(H,Ee);let ht=Z,hn=(await $t("loader",k,Be,[N],F,H))[N.route.id];if(Ev(hn)&&(hn=await Uoe(hn,Be.signal,!0)||hn),ee.get(H)===Ee&&ee.delete(H),!Be.signal.aborted){if(we.has(H)){Xn(H,G0(void 0));return}if(ky(hn))if(j>ht){Xn(H,G0(void 0));return}else{le.add(H),await nt(Be,hn,!1,{preventScrollReset:K});return}if(Id(hn)){Qi(H,Y,hn.error);return}pr(!Ev(hn),"Unhandled fetcher deferred data"),Xn(H,G0(hn.data))}}async function nt(H,Y,ne,N){let{submission:F,fetcherSubmission:V,preventScrollReset:A,replace:K}=N===void 0?{}:N;Y.response.headers.has("X-Remix-Revalidate")&&(W=!0);let ge=Y.response.headers.get("Location");pr(ge,"Expected a Location header on the redirect Response"),ge=f0e(ge,new URL(H.url),l);let pe=OA(k.location,ge,{_isRedirect:!0});if(t){let Fe=!1;if(Y.response.headers.has("X-Remix-Reload-Document"))Fe=!0;else if(zoe.test(ge)){const _e=n.history.createURL(ge);Fe=_e.origin!==e.location.origin||$L(_e.pathname,l)==null}if(Fe){K?e.location.replace(ge):e.location.assign(ge);return}}I=null;let Ee=K===!0||Y.response.headers.has("X-Remix-Replace")?ba.Replace:ba.Push,{formMethod:Be,formAction:ht,formEncType:bt}=k.navigation;!F&&!V&&Be&&ht&&bt&&(F=y0e(k.navigation));let hn=F||V;if(yot.has(Y.response.status)&&hn&&Vf(hn.formMethod))await jn(Ee,pe,{submission:lo({},hn,{formAction:ge}),preventScrollReset:A||D,enableViewTransition:ne?O:void 0});else{let Fe=HU(pe,F);await jn(Ee,pe,{overrideNavigation:Fe,fetcherSubmission:V,preventScrollReset:A||D,enableViewTransition:ne?O:void 0})}}async function $t(H,Y,ne,N,F,V){let A,K={};try{A=await Tot(c,H,Y,ne,N,F,V,s,r)}catch(ge){return N.forEach(pe=>{K[pe.route.id]={type:Cs.error,error:ge}}),K}for(let[ge,pe]of Object.entries(A))if(Pot(pe)){let Ee=pe.result;K[ge]={type:Cs.redirect,response:Aot(Ee,ne,ge,F,l,d.v7_relativeSplatPath)}}else K[ge]=await Iot(pe);return K}async function an(H,Y,ne,N,F){let V=H.matches,A=$t("loader",H,F,ne,Y,null),K=Promise.all(N.map(async Ee=>{if(Ee.matches&&Ee.match&&Ee.controller){let ht=(await $t("loader",H,sx(n.history,Ee.path,Ee.controller.signal),[Ee.match],Ee.matches,Ee.key))[Ee.match.route.id];return{[Ee.key]:ht}}else return Promise.resolve({[Ee.key]:{type:Cs.error,error:Nu(404,{pathname:Ee.path})}})})),ge=await A,pe=(await K).reduce((Ee,Be)=>Object.assign(Ee,Be),{});return await Promise.all([Fot(Y,ge,F.signal,V,H.loaderData),Bot(Y,pe,N)]),{loaderResults:ge,fetcherResults:pe}}function Pi(){W=!0,z.push(...bn()),ue.forEach((H,Y)=>{ee.has(Y)&&q.add(Y),cr(Y)})}function Xn(H,Y,ne){ne===void 0&&(ne={}),k.fetchers.set(H,Y),gt({fetchers:new Map(k.fetchers)},{flushSync:(ne&&ne.flushSync)===!0})}function Qi(H,Y,ne,N){N===void 0&&(N={});let F=oy(k.matches,Y);Pr(H),gt({errors:{[F.route.id]:ne},fetchers:new Map(k.fetchers)},{flushSync:(N&&N.flushSync)===!0})}function qs(H){return d.v7_fetcherPersist&&(de.set(H,(de.get(H)||0)+1),we.has(H)&&we.delete(H)),k.fetchers.get(H)||wot}function Pr(H){let Y=k.fetchers.get(H);ee.has(H)&&!(Y&&Y.state==="loading"&&te.has(H))&&cr(H),ue.delete(H),te.delete(H),le.delete(H),we.delete(H),q.delete(H),k.fetchers.delete(H)}function Or(H){if(d.v7_fetcherPersist){let Y=(de.get(H)||0)-1;Y<=0?(de.delete(H),we.add(H)):de.set(H,Y)}else Pr(H);gt({fetchers:new Map(k.fetchers)})}function cr(H){let Y=ee.get(H);Y&&(Y.abort(),ee.delete(H))}function us(H){for(let Y of H){let ne=qs(Y),N=G0(ne.data);k.fetchers.set(Y,N)}}function qi(){let H=[],Y=!1;for(let ne of le){let N=k.fetchers.get(ne);pr(N,"Expected fetcher: "+ne),N.state==="loading"&&(le.delete(ne),H.push(ne),Y=!0)}return us(H),Y}function Er(H){let Y=[];for(let[ne,N]of te)if(N0}function oo(H,Y){let ne=k.blockers.get(H)||dT;return Me.get(H)!==Y&&Me.set(H,Y),ne}function As(H){k.blockers.delete(H),Me.delete(H)}function Ft(H,Y){let ne=k.blockers.get(H)||dT;pr(ne.state==="unblocked"&&Y.state==="blocked"||ne.state==="blocked"&&Y.state==="blocked"||ne.state==="blocked"&&Y.state==="proceeding"||ne.state==="blocked"&&Y.state==="unblocked"||ne.state==="proceeding"&&Y.state==="unblocked","Invalid blocker state transition: "+ne.state+" -> "+Y.state);let N=new Map(k.blockers);N.set(H,Y),gt({blockers:N})}function qn(H){let{currentLocation:Y,nextLocation:ne,historyAction:N}=H;if(Me.size===0)return;Me.size>1&&vw(!1,"A router only supports one blocker at a time");let F=Array.from(Me.entries()),[V,A]=F[F.length-1],K=k.blockers.get(V);if(!(K&&K.state==="proceeding")&&A({currentLocation:Y,nextLocation:ne,historyAction:N}))return V}function pi(H){let Y=Nu(404,{pathname:H}),ne=a||o,{matches:N,route:F}=v0e(ne);return bn(),{notFoundMatches:N,route:F,error:Y}}function bn(H){let Y=[];return xe.forEach((ne,N)=>{(!H||H(N))&&(ne.cancel(),Y.push(N),xe.delete(N))}),Y}function dn(H,Y,ne){if(g=H,m=Y,p=ne||null,!_&&k.navigation===WU){_=!0;let N=Yi(k.location,k.matches);N!=null&>({restoreScrollPosition:N})}return()=>{g=null,m=null,p=null}}function bi(H,Y){return p&&p(H,Y.map(N=>Qst(N,k.loaderData)))||H.key}function mi(H,Y){if(g&&m){let ne=bi(H,Y);g[ne]=m()}}function Yi(H,Y){if(g){let ne=bi(H,Y),N=g[ne];if(typeof N=="number")return N}return null}function Wn(H,Y,ne){if(u)if(H){if(Object.keys(H[0].params).length>0)return{active:!0,matches:DF(Y,ne,l,!0)}}else return{active:!0,matches:DF(Y,ne,l,!0)||[]};return{active:!1,matches:null}}async function pn(H,Y,ne){if(!u)return{type:"success",matches:H};let N=H;for(;;){let F=a==null,V=a||o,A=s;try{await u({path:Y,matches:N,patch:(pe,Ee)=>{ne.aborted||h0e(pe,Ee,V,A,r)}})}catch(pe){return{type:"error",error:pe,partialMatches:N}}finally{F&&!ne.aborted&&(o=[...o])}if(ne.aborted)return{type:"aborted"};let K=sy(V,Y,l);if(K)return{type:"success",matches:K};let ge=DF(V,Y,l,!0);if(!ge||N.length===ge.length&&N.every((pe,Ee)=>pe.route.id===ge[Ee].route.id))return{type:"success",matches:null};N=ge}}function re(H){s={},a=o6(H,r,void 0,s)}function oe(H,Y){let ne=a==null;h0e(H,Y,a||o,s,r),ne&&(o=[...o],gt({}))}return x={get basename(){return l},get future(){return d},get state(){return k},get routes(){return o},get window(){return e},initialize:_t,subscribe:pt,enableScrollRestoration:dn,navigate:wn,fetch:Ve,revalidate:Xt,createHref:H=>n.history.createHref(H),encodeLocation:H=>n.history.encodeLocation(H),getFetcher:qs,deleteFetcher:Or,dispose:Qe,getBlocker:oo,deleteBlocker:As,patchRoutes:oe,_internalFetchControllers:ee,_internalActiveDeferreds:xe,_internalSetRoutes:re},x}function Sot(n){return n!=null&&("formData"in n&&n.formData!=null||"body"in n&&n.body!==void 0)}function EY(n,e,t,i,r,s,o,a){let l,c;if(o){l=[];for(let d of e)if(l.push(d),d.route.id===o){c=d;break}}else l=e,c=e[e.length-1];let u=Voe(r||".",Hoe(l,s),$L(n.pathname,t)||n.pathname,a==="path");if(r==null&&(u.search=n.search,u.hash=n.hash),(r==null||r===""||r===".")&&c){let d=joe(u.search);if(c.route.index&&!d)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let h=new URLSearchParams(u.search),f=h.getAll("index");h.delete("index"),f.filter(p=>p).forEach(p=>h.append("index",p));let g=h.toString();u.search=g?"?"+g:""}}return i&&t!=="/"&&(u.pathname=u.pathname==="/"?t:L_([t,u.pathname])),bw(u)}function l0e(n,e,t,i){if(!i||!Sot(i))return{path:t};if(i.formMethod&&!Mot(i.formMethod))return{path:t,error:Nu(405,{method:i.formMethod})};let r=()=>({path:t,error:Nu(400,{type:"invalid-body"})}),s=i.formMethod||"get",o=n?s.toUpperCase():s.toLowerCase(),a=HPe(t);if(i.body!==void 0){if(i.formEncType==="text/plain"){if(!Vf(o))return r();let h=typeof i.body=="string"?i.body:i.body instanceof FormData||i.body instanceof URLSearchParams?Array.from(i.body.entries()).reduce((f,g)=>{let[p,m]=g;return""+f+p+"="+m+` + */function lo(){return lo=Object.assign?Object.assign.bind():function(n){for(var e=1;e"u")throw new Error(e)}function vw(n,e){if(!n){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Gst(){return Math.random().toString(36).substr(2,8)}function s0e(n,e){return{usr:n.state,key:n.key,idx:e}}function OA(n,e,t,i){return t===void 0&&(t=null),lo({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof e=="string"?f0(e):e,{state:t,key:e&&e.key||i||Gst()})}function bw(n){let{pathname:e="/",search:t="",hash:i=""}=n;return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function f0(n){let e={};if(n){let t=n.indexOf("#");t>=0&&(e.hash=n.substr(t),n=n.substr(0,t));let i=n.indexOf("?");i>=0&&(e.search=n.substr(i),n=n.substr(0,i)),n&&(e.pathname=n)}return e}function Yst(n,e,t,i){i===void 0&&(i={});let{window:r=document.defaultView,v5Compat:s=!1}=i,o=r.history,a=ba.Pop,l=null,c=u();c==null&&(c=0,o.replaceState(lo({},o.state,{idx:c}),""));function u(){return(o.state||{idx:null}).idx}function d(){a=ba.Pop;let m=u(),_=m==null?null:m-c;c=m,l&&l({action:a,location:p.location,delta:_})}function h(m,_){a=ba.Push;let v=OA(p.location,m,_);t(v,m),c=u()+1;let y=s0e(v,c),C=p.createHref(v);try{o.pushState(y,"",C)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;r.location.assign(C)}s&&l&&l({action:a,location:p.location,delta:1})}function f(m,_){a=ba.Replace;let v=OA(p.location,m,_);t(v,m),c=u();let y=s0e(v,c),C=p.createHref(v);o.replaceState(y,"",C),s&&l&&l({action:a,location:p.location,delta:0})}function g(m){let _=r.location.origin!=="null"?r.location.origin:r.location.href,v=typeof m=="string"?m:bw(m);return v=v.replace(/ $/,"%20"),pr(_,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,_)}let p={get action(){return a},get location(){return n(r,o)},listen(m){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(r0e,d),l=m,()=>{r.removeEventListener(r0e,d),l=null}},createHref(m){return e(r,m)},createURL:g,encodeLocation(m){let _=g(m);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:h,replace:f,go(m){return o.go(m)}};return p}var Cs;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(Cs||(Cs={}));const Zst=new Set(["lazy","caseSensitive","path","id","index","children"]);function Xst(n){return n.index===!0}function o6(n,e,t,i){return t===void 0&&(t=[]),i===void 0&&(i={}),n.map((r,s)=>{let o=[...t,String(s)],a=typeof r.id=="string"?r.id:o.join("-");if(pr(r.index!==!0||!r.children,"Cannot specify children on an index route"),pr(!i[a],'Found a route id collision on id "'+a+`". Route id's must be globally unique within Data Router usages`),Xst(r)){let l=lo({},r,e(r),{id:a});return i[a]=l,l}else{let l=lo({},r,e(r),{id:a,children:void 0});return i[a]=l,r.children&&(l.children=o6(r.children,e,o,i)),l}})}function sy(n,e,t){return t===void 0&&(t="/"),D5(n,e,t,!1)}function D5(n,e,t,i){let r=typeof e=="string"?f0(e):e,s=$L(r.pathname||"/",t);if(s==null)return null;let o=PPe(n);Jst(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(pr(l.relativePath.startsWith(i),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(i.length));let c=L_([i,l.relativePath]),u=t.concat(l);s.children&&s.children.length>0&&(pr(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),PPe(s.children,e,u,c)),!(s.path==null&&!s.index)&&e.push({path:c,score:oot(c,s.index),routesMeta:u})};return n.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))r(s,o);else for(let l of OPe(s.path))r(s,o,l)}),e}function OPe(n){let e=n.split("/");if(e.length===0)return[];let[t,...i]=e,r=t.endsWith("?"),s=t.replace(/\?$/,"");if(i.length===0)return r?[s,""]:[s];let o=OPe(i.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),r&&a.push(...o),a.map(l=>n.startsWith("/")&&l===""?"/":l)}function Jst(n){n.sort((e,t)=>e.score!==t.score?t.score-e.score:aot(e.routesMeta.map(i=>i.childrenIndex),t.routesMeta.map(i=>i.childrenIndex)))}const eot=/^:[\w-]+$/,tot=3,not=2,iot=1,rot=10,sot=-2,o0e=n=>n==="*";function oot(n,e){let t=n.split("/"),i=t.length;return t.some(o0e)&&(i+=sot),e&&(i+=not),t.filter(r=>!o0e(r)).reduce((r,s)=>r+(eot.test(s)?tot:s===""?iot:rot),i)}function aot(n,e){return n.length===e.length&&n.slice(0,-1).every((i,r)=>i===e[r])?n[n.length-1]-e[e.length-1]:0}function lot(n,e,t){t===void 0&&(t=!1);let{routesMeta:i}=n,r={},s="/",o=[];for(let a=0;a{let{paramName:h,isOptional:f}=u;if(h==="*"){let p=a[d]||"";o=s.slice(0,s.length-p.length).replace(/(.)\/+$/,"$1")}const g=a[d];return f&&!g?c[h]=void 0:c[h]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:n}}function cot(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!0),vw(n==="*"||!n.endsWith("*")||n.endsWith("/*"),'Route path "'+n+'" will be treated as if it were '+('"'+n.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+n.replace(/\*$/,"/*")+'".'));let i=[],r="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(i.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return n.endsWith("*")?(i.push({paramName:"*"}),r+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?r+="\\/*$":n!==""&&n!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function uot(n){try{return n.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return vw(!1,'The URL path "'+n+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),n}}function $L(n,e){if(e==="/")return n;if(!n.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,i=n.charAt(t);return i&&i!=="/"?null:n.slice(t)||"/"}function dot(n,e){e===void 0&&(e="/");let{pathname:t,search:i="",hash:r=""}=typeof n=="string"?f0(n):n;return{pathname:t?t.startsWith("/")?t:hot(t,e):e,search:got(i),hash:pot(r)}}function hot(n,e){let t=e.replace(/\/+$/,"").split("/");return n.split("/").forEach(r=>{r===".."?t.length>1&&t.pop():r!=="."&&t.push(r)}),t.length>1?t.join("/"):"/"}function $U(n,e,t,i){return"Cannot include a '"+n+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+t+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function MPe(n){return n.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Hoe(n,e){let t=MPe(n);return e?t.map((i,r)=>r===t.length-1?i.pathname:i.pathnameBase):t.map(i=>i.pathnameBase)}function Voe(n,e,t,i){i===void 0&&(i=!1);let r;typeof n=="string"?r=f0(n):(r=lo({},n),pr(!r.pathname||!r.pathname.includes("?"),$U("?","pathname","search",r)),pr(!r.pathname||!r.pathname.includes("#"),$U("#","pathname","hash",r)),pr(!r.search||!r.search.includes("#"),$U("#","search","hash",r)));let s=n===""||r.pathname==="",o=s?"/":r.pathname,a;if(o==null)a=t;else{let d=e.length-1;if(!i&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),d-=1;r.pathname=h.join("/")}a=d>=0?e[d]:"/"}let l=dot(r,a),c=o&&o!=="/"&&o.endsWith("/"),u=(s||o===".")&&t.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const L_=n=>n.join("/").replace(/\/\/+/g,"/"),fot=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),got=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,pot=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n;class a6{constructor(e,t,i,r){r===void 0&&(r=!1),this.status=e,this.statusText=t||"",this.internal=r,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}}function m$(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}const FPe=["post","put","patch","delete"],mot=new Set(FPe),_ot=["get",...FPe],vot=new Set(_ot),bot=new Set([301,302,303,307,308]),yot=new Set([307,308]),WU={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},wot={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},dT={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},zoe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Cot=n=>({hasErrorBoundary:!!n.hasErrorBoundary}),BPe="remix-router-transitions";function xot(n){const e=n.window?n.window:typeof window<"u"?window:void 0,t=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",i=!t;pr(n.routes.length>0,"You must provide a non-empty routes array to createRouter");let r;if(n.mapRouteProperties)r=n.mapRouteProperties;else if(n.detectErrorBoundary){let H=n.detectErrorBoundary;r=Y=>({hasErrorBoundary:H(Y)})}else r=Cot;let s={},o=o6(n.routes,r,void 0,s),a,l=n.basename||"/",c=n.dataStrategy||Lot,u=n.patchRoutesOnNavigation,d=lo({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},n.future),h=null,f=new Set,g=null,p=null,m=null,_=n.hydrationData!=null,v=sy(o,n.history.location,l),y=null;if(v==null&&!u){let H=Nu(404,{pathname:n.history.location.pathname}),{matches:Y,route:ne}=v0e(o);v=Y,y={[ne.id]:H}}v&&!n.hydrationData&&Wn(v,o,n.history.location.pathname).active&&(v=null);let C;if(v)if(v.some(H=>H.route.lazy))C=!1;else if(!v.some(H=>H.route.loader))C=!0;else if(d.v7_partialHydration){let H=n.hydrationData?n.hydrationData.loaderData:null,Y=n.hydrationData?n.hydrationData.errors:null;if(Y){let ne=v.findIndex(N=>Y[N.route.id]!==void 0);C=v.slice(0,ne+1).every(N=>!LY(N.route,H,Y))}else C=v.every(ne=>!LY(ne.route,H,Y))}else C=n.hydrationData!=null;else if(C=!1,v=[],d.v7_partialHydration){let H=Wn(null,o,n.history.location.pathname);H.active&&H.matches&&(v=H.matches)}let x,k={historyAction:n.history.action,location:n.history.location,matches:v,initialized:C,navigation:WU,restoreScrollPosition:n.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:n.hydrationData&&n.hydrationData.loaderData||{},actionData:n.hydrationData&&n.hydrationData.actionData||null,errors:n.hydrationData&&n.hydrationData.errors||y,fetchers:new Map,blockers:new Map},L=ba.Pop,D=!1,I,O=!1,M=new Map,B=null,G=!1,W=!1,z=[],q=new Set,ee=new Map,Z=0,j=-1,te=new Map,le=new Set,ue=new Map,de=new Map,we=new Set,xe=new Map,Me=new Map,Re;function _t(){if(h=n.history.listen(H=>{let{action:Y,location:ne,delta:N}=H;if(Re){Re(),Re=void 0;return}vw(Me.size===0||N!=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 F=qn({currentLocation:k.location,nextLocation:ne,historyAction:Y});if(F&&N!=null){let V=new Promise(A=>{Re=A});n.history.go(N*-1),Ft(F,{state:"blocked",location:ne,proceed(){Ft(F,{state:"proceeding",proceed:void 0,reset:void 0,location:ne}),V.then(()=>n.history.go(N))},reset(){let A=new Map(k.blockers);A.set(F,dT),gt({blockers:A})}});return}return jn(Y,ne)}),t){Hot(e,M);let H=()=>Vot(e,M);e.addEventListener("pagehide",H),B=()=>e.removeEventListener("pagehide",H)}return k.initialized||jn(ba.Pop,k.location,{initialHydration:!0}),x}function Qe(){h&&h(),B&&B(),f.clear(),I&&I.abort(),k.fetchers.forEach((H,Y)=>Pr(Y)),k.blockers.forEach((H,Y)=>As(Y))}function pt(H){return f.add(H),()=>f.delete(H)}function gt(H,Y){Y===void 0&&(Y={}),k=lo({},k,H);let ne=[],N=[];d.v7_fetcherPersist&&k.fetchers.forEach((F,V)=>{F.state==="idle"&&(we.has(V)?N.push(V):ne.push(V))}),[...f].forEach(F=>F(k,{deletedFetchers:N,viewTransitionOpts:Y.viewTransitionOpts,flushSync:Y.flushSync===!0})),d.v7_fetcherPersist&&(ne.forEach(F=>k.fetchers.delete(F)),N.forEach(F=>Pr(F)))}function Ue(H,Y,ne){var N,F;let{flushSync:V}=ne===void 0?{}:ne,A=k.actionData!=null&&k.navigation.formMethod!=null&&Vf(k.navigation.formMethod)&&k.navigation.state==="loading"&&((N=H.state)==null?void 0:N._isRedirect)!==!0,K;Y.actionData?Object.keys(Y.actionData).length>0?K=Y.actionData:K=null:A?K=k.actionData:K=null;let ge=Y.loaderData?m0e(k.loaderData,Y.loaderData,Y.matches||[],Y.errors):k.loaderData,pe=k.blockers;pe.size>0&&(pe=new Map(pe),pe.forEach((ht,bt)=>pe.set(bt,dT)));let Ee=D===!0||k.navigation.formMethod!=null&&Vf(k.navigation.formMethod)&&((F=H.state)==null?void 0:F._isRedirect)!==!0;a&&(o=a,a=void 0),G||L===ba.Pop||(L===ba.Push?n.history.push(H,H.state):L===ba.Replace&&n.history.replace(H,H.state));let Be;if(L===ba.Pop){let ht=M.get(k.location.pathname);ht&&ht.has(H.pathname)?Be={currentLocation:k.location,nextLocation:H}:M.has(H.pathname)&&(Be={currentLocation:H,nextLocation:k.location})}else if(O){let ht=M.get(k.location.pathname);ht?ht.add(H.pathname):(ht=new Set([H.pathname]),M.set(k.location.pathname,ht)),Be={currentLocation:k.location,nextLocation:H}}gt(lo({},Y,{actionData:K,loaderData:ge,historyAction:L,location:H,initialized:!0,navigation:WU,revalidation:"idle",restoreScrollPosition:Yi(H,Y.matches||k.matches),preventScrollReset:Ee,blockers:pe}),{viewTransitionOpts:Be,flushSync:V===!0}),L=ba.Pop,D=!1,O=!1,G=!1,W=!1,z=[]}async function wn(H,Y){if(typeof H=="number"){n.history.go(H);return}let ne=EY(k.location,k.matches,l,d.v7_prependBasename,H,d.v7_relativeSplatPath,Y?.fromRouteId,Y?.relative),{path:N,submission:F,error:V}=l0e(d.v7_normalizeFormMethod,!1,ne,Y),A=k.location,K=OA(k.location,N,Y&&Y.state);K=lo({},K,n.history.encodeLocation(K));let ge=Y&&Y.replace!=null?Y.replace:void 0,pe=ba.Push;ge===!0?pe=ba.Replace:ge===!1||F!=null&&Vf(F.formMethod)&&F.formAction===k.location.pathname+k.location.search&&(pe=ba.Replace);let Ee=Y&&"preventScrollReset"in Y?Y.preventScrollReset===!0:void 0,Be=(Y&&Y.flushSync)===!0,ht=qn({currentLocation:A,nextLocation:K,historyAction:pe});if(ht){Ft(ht,{state:"blocked",location:K,proceed(){Ft(ht,{state:"proceeding",proceed:void 0,reset:void 0,location:K}),wn(H,Y)},reset(){let bt=new Map(k.blockers);bt.set(ht,dT),gt({blockers:bt})}});return}return await jn(pe,K,{submission:F,pendingError:V,preventScrollReset:Ee,replace:Y&&Y.replace,enableViewTransition:Y&&Y.viewTransition,flushSync:Be})}function Xt(){if(Pi(),gt({revalidation:"loading"}),k.navigation.state!=="submitting"){if(k.navigation.state==="idle"){jn(k.historyAction,k.location,{startUninterruptedRevalidation:!0});return}jn(L||k.historyAction,k.navigation.location,{overrideNavigation:k.navigation,enableViewTransition:O===!0})}}async function jn(H,Y,ne){I&&I.abort(),I=null,L=H,G=(ne&&ne.startUninterruptedRevalidation)===!0,mi(k.location,k.matches),D=(ne&&ne.preventScrollReset)===!0,O=(ne&&ne.enableViewTransition)===!0;let N=a||o,F=ne&&ne.overrideNavigation,V=sy(N,Y,l),A=(ne&&ne.flushSync)===!0,K=Wn(V,N,Y.pathname);if(K.active&&K.matches&&(V=K.matches),!V){let{error:hn,notFoundMatches:Fe,route:_e}=pi(Y.pathname);Ue(Y,{matches:Fe,loaderData:{},errors:{[_e.id]:hn}},{flushSync:A});return}if(k.initialized&&!W&&Rot(k.location,Y)&&!(ne&&ne.submission&&Vf(ne.submission.formMethod))){Ue(Y,{matches:V},{flushSync:A});return}I=new AbortController;let ge=sx(n.history,Y,I.signal,ne&&ne.submission),pe;if(ne&&ne.pendingError)pe=[oy(V).route.id,{type:Cs.error,error:ne.pendingError}];else if(ne&&ne.submission&&Vf(ne.submission.formMethod)){let hn=await ji(ge,Y,ne.submission,V,K.active,{replace:ne.replace,flushSync:A});if(hn.shortCircuited)return;if(hn.pendingActionResult){let[Fe,_e]=hn.pendingActionResult;if(Id(_e)&&m$(_e.error)&&_e.error.status===404){I=null,Ue(Y,{matches:hn.matches,loaderData:{},errors:{[Fe]:_e.error}});return}}V=hn.matches||V,pe=hn.pendingActionResult,F=HU(Y,ne.submission),A=!1,K.active=!1,ge=sx(n.history,ge.url,ge.signal)}let{shortCircuited:Ee,matches:Be,loaderData:ht,errors:bt}=await ci(ge,Y,V,K.active,F,ne&&ne.submission,ne&&ne.fetcherSubmission,ne&&ne.replace,ne&&ne.initialHydration===!0,A,pe);Ee||(I=null,Ue(Y,lo({matches:Be||V},_0e(pe),{loaderData:ht,errors:bt})))}async function ji(H,Y,ne,N,F,V){V===void 0&&(V={}),Pi();let A=$ot(Y,ne);if(gt({navigation:A},{flushSync:V.flushSync===!0}),F){let pe=await pn(N,Y.pathname,H.signal);if(pe.type==="aborted")return{shortCircuited:!0};if(pe.type==="error"){let Ee=oy(pe.partialMatches).route.id;return{matches:pe.partialMatches,pendingActionResult:[Ee,{type:Cs.error,error:pe.error}]}}else if(pe.matches)N=pe.matches;else{let{notFoundMatches:Ee,error:Be,route:ht}=pi(Y.pathname);return{matches:Ee,pendingActionResult:[ht.id,{type:Cs.error,error:Be}]}}}let K,ge=bD(N,Y);if(!ge.route.action&&!ge.route.lazy)K={type:Cs.error,error:Nu(405,{method:H.method,pathname:Y.pathname,routeId:ge.route.id})};else if(K=(await $t("action",k,H,[ge],N,null))[ge.route.id],H.signal.aborted)return{shortCircuited:!0};if(ky(K)){let pe;return V&&V.replace!=null?pe=V.replace:pe=f0e(K.response.headers.get("Location"),new URL(H.url),l)===k.location.pathname+k.location.search,await nt(H,K,!0,{submission:ne,replace:pe}),{shortCircuited:!0}}if(Ev(K))throw Nu(400,{type:"defer-action"});if(Id(K)){let pe=oy(N,ge.route.id);return(V&&V.replace)!==!0&&(L=ba.Push),{matches:N,pendingActionResult:[pe.route.id,K]}}return{matches:N,pendingActionResult:[ge.route.id,K]}}async function ci(H,Y,ne,N,F,V,A,K,ge,pe,Ee){let Be=F||HU(Y,V),ht=V||A||y0e(Be),bt=!G&&(!d.v7_partialHydration||!ge);if(N){if(bt){let Rt=ye(Ee);gt(lo({navigation:Be},Rt!==void 0?{actionData:Rt}:{}),{flushSync:pe})}let Ct=await pn(ne,Y.pathname,H.signal);if(Ct.type==="aborted")return{shortCircuited:!0};if(Ct.type==="error"){let Rt=oy(Ct.partialMatches).route.id;return{matches:Ct.partialMatches,loaderData:{},errors:{[Rt]:Ct.error}}}else if(Ct.matches)ne=Ct.matches;else{let{error:Rt,notFoundMatches:qt,route:Ye}=pi(Y.pathname);return{matches:qt,loaderData:{},errors:{[Ye.id]:Rt}}}}let hn=a||o,[Fe,_e]=u0e(n.history,k,ne,ht,Y,d.v7_partialHydration&&ge===!0,d.v7_skipActionErrorRevalidation,W,z,q,we,ue,le,hn,l,Ee);if(bn(Ct=>!(ne&&ne.some(Rt=>Rt.route.id===Ct))||Fe&&Fe.some(Rt=>Rt.route.id===Ct)),j=++Z,Fe.length===0&&_e.length===0){let Ct=qi();return Ue(Y,lo({matches:ne,loaderData:{},errors:Ee&&Id(Ee[1])?{[Ee[0]]:Ee[1].error}:null},_0e(Ee),Ct?{fetchers:new Map(k.fetchers)}:{}),{flushSync:pe}),{shortCircuited:!0}}if(bt){let Ct={};if(!N){Ct.navigation=Be;let Rt=ye(Ee);Rt!==void 0&&(Ct.actionData=Rt)}_e.length>0&&(Ct.fetchers=Ie(_e)),gt(Ct,{flushSync:pe})}_e.forEach(Ct=>{cr(Ct.key),Ct.controller&&ee.set(Ct.key,Ct.controller)});let Ze=()=>_e.forEach(Ct=>cr(Ct.key));I&&I.signal.addEventListener("abort",Ze);let{loaderResults:ct,fetcherResults:Ht}=await an(k,ne,Fe,_e,H);if(H.signal.aborted)return{shortCircuited:!0};I&&I.signal.removeEventListener("abort",Ze),_e.forEach(Ct=>ee.delete(Ct.key));let Zt=d4(ct);if(Zt)return await nt(H,Zt.result,!0,{replace:K}),{shortCircuited:!0};if(Zt=d4(Ht),Zt)return le.add(Zt.key),await nt(H,Zt.result,!0,{replace:K}),{shortCircuited:!0};let{loaderData:nn,errors:ln}=p0e(k,ne,ct,Ee,_e,Ht,xe);xe.forEach((Ct,Rt)=>{Ct.subscribe(qt=>{(qt||Ct.done)&&xe.delete(Rt)})}),d.v7_partialHydration&&ge&&k.errors&&(ln=lo({},k.errors,ln));let Wt=qi(),on=Er(j),It=Wt||on||_e.length>0;return lo({matches:ne,loaderData:nn,errors:ln},It?{fetchers:new Map(k.fetchers)}:{})}function ye(H){if(H&&!Id(H[1]))return{[H[0]]:H[1].data};if(k.actionData)return Object.keys(k.actionData).length===0?null:k.actionData}function Ie(H){return H.forEach(Y=>{let ne=k.fetchers.get(Y.key),N=hT(void 0,ne?ne.data:void 0);k.fetchers.set(Y.key,N)}),new Map(k.fetchers)}function Ve(H,Y,ne,N){if(i)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");cr(H);let F=(N&&N.flushSync)===!0,V=a||o,A=EY(k.location,k.matches,l,d.v7_prependBasename,ne,d.v7_relativeSplatPath,Y,N?.relative),K=sy(V,A,l),ge=Wn(K,V,A);if(ge.active&&ge.matches&&(K=ge.matches),!K){Qi(H,Y,Nu(404,{pathname:A}),{flushSync:F});return}let{path:pe,submission:Ee,error:Be}=l0e(d.v7_normalizeFormMethod,!0,A,N);if(Be){Qi(H,Y,Be,{flushSync:F});return}let ht=bD(K,pe),bt=(N&&N.preventScrollReset)===!0;if(Ee&&Vf(Ee.formMethod)){wt(H,Y,pe,ht,K,ge.active,F,bt,Ee);return}ue.set(H,{routeId:Y,path:pe}),vt(H,Y,pe,ht,K,ge.active,F,bt,Ee)}async function wt(H,Y,ne,N,F,V,A,K,ge){Pi(),ue.delete(H);function pe(Oe){if(!Oe.route.action&&!Oe.route.lazy){let mt=Nu(405,{method:ge.formMethod,pathname:ne,routeId:Y});return Qi(H,Y,mt,{flushSync:A}),!0}return!1}if(!V&&pe(N))return;let Ee=k.fetchers.get(H);Xn(H,Wot(ge,Ee),{flushSync:A});let Be=new AbortController,ht=sx(n.history,ne,Be.signal,ge);if(V){let Oe=await pn(F,ne,ht.signal);if(Oe.type==="aborted")return;if(Oe.type==="error"){Qi(H,Y,Oe.error,{flushSync:A});return}else if(Oe.matches){if(F=Oe.matches,N=bD(F,ne),pe(N))return}else{Qi(H,Y,Nu(404,{pathname:ne}),{flushSync:A});return}}ee.set(H,Be);let bt=Z,Fe=(await $t("action",k,ht,[N],F,H))[N.route.id];if(ht.signal.aborted){ee.get(H)===Be&&ee.delete(H);return}if(d.v7_fetcherPersist&&we.has(H)){if(ky(Fe)||Id(Fe)){Xn(H,G0(void 0));return}}else{if(ky(Fe))if(ee.delete(H),j>bt){Xn(H,G0(void 0));return}else return le.add(H),Xn(H,hT(ge)),nt(ht,Fe,!1,{fetcherSubmission:ge,preventScrollReset:K});if(Id(Fe)){Qi(H,Y,Fe.error);return}}if(Ev(Fe))throw Nu(400,{type:"defer-action"});let _e=k.navigation.location||k.location,Ze=sx(n.history,_e,Be.signal),ct=a||o,Ht=k.navigation.state!=="idle"?sy(ct,k.navigation.location,l):k.matches;pr(Ht,"Didn't find any matches after fetcher action");let Zt=++Z;te.set(H,Zt);let nn=hT(ge,Fe.data);k.fetchers.set(H,nn);let[ln,Wt]=u0e(n.history,k,Ht,ge,_e,!1,d.v7_skipActionErrorRevalidation,W,z,q,we,ue,le,ct,l,[N.route.id,Fe]);Wt.filter(Oe=>Oe.key!==H).forEach(Oe=>{let mt=Oe.key,at=k.fetchers.get(mt),lt=hT(void 0,at?at.data:void 0);k.fetchers.set(mt,lt),cr(mt),Oe.controller&&ee.set(mt,Oe.controller)}),gt({fetchers:new Map(k.fetchers)});let on=()=>Wt.forEach(Oe=>cr(Oe.key));Be.signal.addEventListener("abort",on);let{loaderResults:It,fetcherResults:Ct}=await an(k,Ht,ln,Wt,Ze);if(Be.signal.aborted)return;Be.signal.removeEventListener("abort",on),te.delete(H),ee.delete(H),Wt.forEach(Oe=>ee.delete(Oe.key));let Rt=d4(It);if(Rt)return nt(Ze,Rt.result,!1,{preventScrollReset:K});if(Rt=d4(Ct),Rt)return le.add(Rt.key),nt(Ze,Rt.result,!1,{preventScrollReset:K});let{loaderData:qt,errors:Ye}=p0e(k,Ht,It,void 0,Wt,Ct,xe);if(k.fetchers.has(H)){let Oe=G0(Fe.data);k.fetchers.set(H,Oe)}Er(Zt),k.navigation.state==="loading"&&Zt>j?(pr(L,"Expected pending action"),I&&I.abort(),Ue(k.navigation.location,{matches:Ht,loaderData:qt,errors:Ye,fetchers:new Map(k.fetchers)})):(gt({errors:Ye,loaderData:m0e(k.loaderData,qt,Ht,Ye),fetchers:new Map(k.fetchers)}),W=!1)}async function vt(H,Y,ne,N,F,V,A,K,ge){let pe=k.fetchers.get(H);Xn(H,hT(ge,pe?pe.data:void 0),{flushSync:A});let Ee=new AbortController,Be=sx(n.history,ne,Ee.signal);if(V){let Fe=await pn(F,ne,Be.signal);if(Fe.type==="aborted")return;if(Fe.type==="error"){Qi(H,Y,Fe.error,{flushSync:A});return}else if(Fe.matches)F=Fe.matches,N=bD(F,ne);else{Qi(H,Y,Nu(404,{pathname:ne}),{flushSync:A});return}}ee.set(H,Ee);let ht=Z,hn=(await $t("loader",k,Be,[N],F,H))[N.route.id];if(Ev(hn)&&(hn=await Uoe(hn,Be.signal,!0)||hn),ee.get(H)===Ee&&ee.delete(H),!Be.signal.aborted){if(we.has(H)){Xn(H,G0(void 0));return}if(ky(hn))if(j>ht){Xn(H,G0(void 0));return}else{le.add(H),await nt(Be,hn,!1,{preventScrollReset:K});return}if(Id(hn)){Qi(H,Y,hn.error);return}pr(!Ev(hn),"Unhandled fetcher deferred data"),Xn(H,G0(hn.data))}}async function nt(H,Y,ne,N){let{submission:F,fetcherSubmission:V,preventScrollReset:A,replace:K}=N===void 0?{}:N;Y.response.headers.has("X-Remix-Revalidate")&&(W=!0);let ge=Y.response.headers.get("Location");pr(ge,"Expected a Location header on the redirect Response"),ge=f0e(ge,new URL(H.url),l);let pe=OA(k.location,ge,{_isRedirect:!0});if(t){let Fe=!1;if(Y.response.headers.has("X-Remix-Reload-Document"))Fe=!0;else if(zoe.test(ge)){const _e=n.history.createURL(ge);Fe=_e.origin!==e.location.origin||$L(_e.pathname,l)==null}if(Fe){K?e.location.replace(ge):e.location.assign(ge);return}}I=null;let Ee=K===!0||Y.response.headers.has("X-Remix-Replace")?ba.Replace:ba.Push,{formMethod:Be,formAction:ht,formEncType:bt}=k.navigation;!F&&!V&&Be&&ht&&bt&&(F=y0e(k.navigation));let hn=F||V;if(yot.has(Y.response.status)&&hn&&Vf(hn.formMethod))await jn(Ee,pe,{submission:lo({},hn,{formAction:ge}),preventScrollReset:A||D,enableViewTransition:ne?O:void 0});else{let Fe=HU(pe,F);await jn(Ee,pe,{overrideNavigation:Fe,fetcherSubmission:V,preventScrollReset:A||D,enableViewTransition:ne?O:void 0})}}async function $t(H,Y,ne,N,F,V){let A,K={};try{A=await Tot(c,H,Y,ne,N,F,V,s,r)}catch(ge){return N.forEach(pe=>{K[pe.route.id]={type:Cs.error,error:ge}}),K}for(let[ge,pe]of Object.entries(A))if(Pot(pe)){let Ee=pe.result;K[ge]={type:Cs.redirect,response:Aot(Ee,ne,ge,F,l,d.v7_relativeSplatPath)}}else K[ge]=await Iot(pe);return K}async function an(H,Y,ne,N,F){let V=H.matches,A=$t("loader",H,F,ne,Y,null),K=Promise.all(N.map(async Ee=>{if(Ee.matches&&Ee.match&&Ee.controller){let ht=(await $t("loader",H,sx(n.history,Ee.path,Ee.controller.signal),[Ee.match],Ee.matches,Ee.key))[Ee.match.route.id];return{[Ee.key]:ht}}else return Promise.resolve({[Ee.key]:{type:Cs.error,error:Nu(404,{pathname:Ee.path})}})})),ge=await A,pe=(await K).reduce((Ee,Be)=>Object.assign(Ee,Be),{});return await Promise.all([Fot(Y,ge,F.signal,V,H.loaderData),Bot(Y,pe,N)]),{loaderResults:ge,fetcherResults:pe}}function Pi(){W=!0,z.push(...bn()),ue.forEach((H,Y)=>{ee.has(Y)&&q.add(Y),cr(Y)})}function Xn(H,Y,ne){ne===void 0&&(ne={}),k.fetchers.set(H,Y),gt({fetchers:new Map(k.fetchers)},{flushSync:(ne&&ne.flushSync)===!0})}function Qi(H,Y,ne,N){N===void 0&&(N={});let F=oy(k.matches,Y);Pr(H),gt({errors:{[F.route.id]:ne},fetchers:new Map(k.fetchers)},{flushSync:(N&&N.flushSync)===!0})}function qs(H){return d.v7_fetcherPersist&&(de.set(H,(de.get(H)||0)+1),we.has(H)&&we.delete(H)),k.fetchers.get(H)||wot}function Pr(H){let Y=k.fetchers.get(H);ee.has(H)&&!(Y&&Y.state==="loading"&&te.has(H))&&cr(H),ue.delete(H),te.delete(H),le.delete(H),we.delete(H),q.delete(H),k.fetchers.delete(H)}function Or(H){if(d.v7_fetcherPersist){let Y=(de.get(H)||0)-1;Y<=0?(de.delete(H),we.add(H)):de.set(H,Y)}else Pr(H);gt({fetchers:new Map(k.fetchers)})}function cr(H){let Y=ee.get(H);Y&&(Y.abort(),ee.delete(H))}function us(H){for(let Y of H){let ne=qs(Y),N=G0(ne.data);k.fetchers.set(Y,N)}}function qi(){let H=[],Y=!1;for(let ne of le){let N=k.fetchers.get(ne);pr(N,"Expected fetcher: "+ne),N.state==="loading"&&(le.delete(ne),H.push(ne),Y=!0)}return us(H),Y}function Er(H){let Y=[];for(let[ne,N]of te)if(N0}function oo(H,Y){let ne=k.blockers.get(H)||dT;return Me.get(H)!==Y&&Me.set(H,Y),ne}function As(H){k.blockers.delete(H),Me.delete(H)}function Ft(H,Y){let ne=k.blockers.get(H)||dT;pr(ne.state==="unblocked"&&Y.state==="blocked"||ne.state==="blocked"&&Y.state==="blocked"||ne.state==="blocked"&&Y.state==="proceeding"||ne.state==="blocked"&&Y.state==="unblocked"||ne.state==="proceeding"&&Y.state==="unblocked","Invalid blocker state transition: "+ne.state+" -> "+Y.state);let N=new Map(k.blockers);N.set(H,Y),gt({blockers:N})}function qn(H){let{currentLocation:Y,nextLocation:ne,historyAction:N}=H;if(Me.size===0)return;Me.size>1&&vw(!1,"A router only supports one blocker at a time");let F=Array.from(Me.entries()),[V,A]=F[F.length-1],K=k.blockers.get(V);if(!(K&&K.state==="proceeding")&&A({currentLocation:Y,nextLocation:ne,historyAction:N}))return V}function pi(H){let Y=Nu(404,{pathname:H}),ne=a||o,{matches:N,route:F}=v0e(ne);return bn(),{notFoundMatches:N,route:F,error:Y}}function bn(H){let Y=[];return xe.forEach((ne,N)=>{(!H||H(N))&&(ne.cancel(),Y.push(N),xe.delete(N))}),Y}function dn(H,Y,ne){if(g=H,m=Y,p=ne||null,!_&&k.navigation===WU){_=!0;let N=Yi(k.location,k.matches);N!=null&>({restoreScrollPosition:N})}return()=>{g=null,m=null,p=null}}function bi(H,Y){return p&&p(H,Y.map(N=>Qst(N,k.loaderData)))||H.key}function mi(H,Y){if(g&&m){let ne=bi(H,Y);g[ne]=m()}}function Yi(H,Y){if(g){let ne=bi(H,Y),N=g[ne];if(typeof N=="number")return N}return null}function Wn(H,Y,ne){if(u)if(H){if(Object.keys(H[0].params).length>0)return{active:!0,matches:D5(Y,ne,l,!0)}}else return{active:!0,matches:D5(Y,ne,l,!0)||[]};return{active:!1,matches:null}}async function pn(H,Y,ne){if(!u)return{type:"success",matches:H};let N=H;for(;;){let F=a==null,V=a||o,A=s;try{await u({path:Y,matches:N,patch:(pe,Ee)=>{ne.aborted||h0e(pe,Ee,V,A,r)}})}catch(pe){return{type:"error",error:pe,partialMatches:N}}finally{F&&!ne.aborted&&(o=[...o])}if(ne.aborted)return{type:"aborted"};let K=sy(V,Y,l);if(K)return{type:"success",matches:K};let ge=D5(V,Y,l,!0);if(!ge||N.length===ge.length&&N.every((pe,Ee)=>pe.route.id===ge[Ee].route.id))return{type:"success",matches:null};N=ge}}function re(H){s={},a=o6(H,r,void 0,s)}function oe(H,Y){let ne=a==null;h0e(H,Y,a||o,s,r),ne&&(o=[...o],gt({}))}return x={get basename(){return l},get future(){return d},get state(){return k},get routes(){return o},get window(){return e},initialize:_t,subscribe:pt,enableScrollRestoration:dn,navigate:wn,fetch:Ve,revalidate:Xt,createHref:H=>n.history.createHref(H),encodeLocation:H=>n.history.encodeLocation(H),getFetcher:qs,deleteFetcher:Or,dispose:Qe,getBlocker:oo,deleteBlocker:As,patchRoutes:oe,_internalFetchControllers:ee,_internalActiveDeferreds:xe,_internalSetRoutes:re},x}function Sot(n){return n!=null&&("formData"in n&&n.formData!=null||"body"in n&&n.body!==void 0)}function EY(n,e,t,i,r,s,o,a){let l,c;if(o){l=[];for(let d of e)if(l.push(d),d.route.id===o){c=d;break}}else l=e,c=e[e.length-1];let u=Voe(r||".",Hoe(l,s),$L(n.pathname,t)||n.pathname,a==="path");if(r==null&&(u.search=n.search,u.hash=n.hash),(r==null||r===""||r===".")&&c){let d=joe(u.search);if(c.route.index&&!d)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let h=new URLSearchParams(u.search),f=h.getAll("index");h.delete("index"),f.filter(p=>p).forEach(p=>h.append("index",p));let g=h.toString();u.search=g?"?"+g:""}}return i&&t!=="/"&&(u.pathname=u.pathname==="/"?t:L_([t,u.pathname])),bw(u)}function l0e(n,e,t,i){if(!i||!Sot(i))return{path:t};if(i.formMethod&&!Mot(i.formMethod))return{path:t,error:Nu(405,{method:i.formMethod})};let r=()=>({path:t,error:Nu(400,{type:"invalid-body"})}),s=i.formMethod||"get",o=n?s.toUpperCase():s.toLowerCase(),a=HPe(t);if(i.body!==void 0){if(i.formEncType==="text/plain"){if(!Vf(o))return r();let h=typeof i.body=="string"?i.body:i.body instanceof FormData||i.body instanceof URLSearchParams?Array.from(i.body.entries()).reduce((f,g)=>{let[p,m]=g;return""+f+p+"="+m+` `},""):String(i.body);return{path:t,submission:{formMethod:o,formAction:a,formEncType:i.formEncType,formData:void 0,json:void 0,text:h}}}else if(i.formEncType==="application/json"){if(!Vf(o))return r();try{let h=typeof i.body=="string"?JSON.parse(i.body):i.body;return{path:t,submission:{formMethod:o,formAction:a,formEncType:i.formEncType,formData:void 0,json:h,text:void 0}}}catch{return r()}}}pr(typeof FormData=="function","FormData is not available in this environment");let l,c;if(i.formData)l=TY(i.formData),c=i.formData;else if(i.body instanceof FormData)l=TY(i.body),c=i.body;else if(i.body instanceof URLSearchParams)l=i.body,c=g0e(l);else if(i.body==null)l=new URLSearchParams,c=new FormData;else try{l=new URLSearchParams(i.body),c=g0e(l)}catch{return r()}let u={formMethod:o,formAction:a,formEncType:i&&i.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(Vf(u.formMethod))return{path:t,submission:u};let d=f0(t);return e&&d.search&&joe(d.search)&&l.append("index",""),d.search="?"+l,{path:bw(d),submission:u}}function c0e(n,e,t){t===void 0&&(t=!1);let i=n.findIndex(r=>r.route.id===e);return i>=0?n.slice(0,t?i+1:i):n}function u0e(n,e,t,i,r,s,o,a,l,c,u,d,h,f,g,p){let m=p?Id(p[1])?p[1].error:p[1].data:void 0,_=n.createURL(e.location),v=n.createURL(r),y=t;s&&e.errors?y=c0e(t,Object.keys(e.errors)[0],!0):p&&Id(p[1])&&(y=c0e(t,p[0]));let C=p?p[1].statusCode:void 0,x=o&&C&&C>=400,k=y.filter((D,I)=>{let{route:O}=D;if(O.lazy)return!0;if(O.loader==null)return!1;if(s)return LY(O,e.loaderData,e.errors);if(kot(e.loaderData,e.matches[I],D)||l.some(G=>G===D.route.id))return!0;let M=e.matches[I],B=D;return d0e(D,lo({currentUrl:_,currentParams:M.params,nextUrl:v,nextParams:B.params},i,{actionResult:m,actionStatus:C,defaultShouldRevalidate:x?!1:a||_.pathname+_.search===v.pathname+v.search||_.search!==v.search||$Pe(M,B)}))}),L=[];return d.forEach((D,I)=>{if(s||!t.some(W=>W.route.id===D.routeId)||u.has(I))return;let O=sy(f,D.path,g);if(!O){L.push({key:I,routeId:D.routeId,path:D.path,matches:null,match:null,controller:null});return}let M=e.fetchers.get(I),B=bD(O,D.path),G=!1;h.has(I)?G=!1:c.has(I)?(c.delete(I),G=!0):M&&M.state!=="idle"&&M.data===void 0?G=a:G=d0e(B,lo({currentUrl:_,currentParams:e.matches[e.matches.length-1].params,nextUrl:v,nextParams:t[t.length-1].params},i,{actionResult:m,actionStatus:C,defaultShouldRevalidate:x?!1:a})),G&&L.push({key:I,routeId:D.routeId,path:D.path,matches:O,match:B,controller:new AbortController})}),[k,L]}function LY(n,e,t){if(n.lazy)return!0;if(!n.loader)return!1;let i=e!=null&&e[n.id]!==void 0,r=t!=null&&t[n.id]!==void 0;return!i&&r?!1:typeof n.loader=="function"&&n.loader.hydrate===!0?!0:!i&&!r}function kot(n,e,t){let i=!e||t.route.id!==e.route.id,r=n[t.route.id]===void 0;return i||r}function $Pe(n,e){let t=n.route.path;return n.pathname!==e.pathname||t!=null&&t.endsWith("*")&&n.params["*"]!==e.params["*"]}function d0e(n,e){if(n.route.shouldRevalidate){let t=n.route.shouldRevalidate(e);if(typeof t=="boolean")return t}return e.defaultShouldRevalidate}function h0e(n,e,t,i,r){var s;let o;if(n){let c=i[n];pr(c,"No route found to patch children into: routeId = "+n),c.children||(c.children=[]),o=c.children}else o=t;let a=e.filter(c=>!o.some(u=>WPe(c,u))),l=o6(a,r,[n||"_","patch",String(((s=o)==null?void 0:s.length)||"0")],i);o.push(...l)}function WPe(n,e){return"id"in n&&"id"in e&&n.id===e.id?!0:n.index===e.index&&n.path===e.path&&n.caseSensitive===e.caseSensitive?(!n.children||n.children.length===0)&&(!e.children||e.children.length===0)?!0:n.children.every((t,i)=>{var r;return(r=e.children)==null?void 0:r.some(s=>WPe(t,s))}):!1}async function Eot(n,e,t){if(!n.lazy)return;let i=await n.lazy();if(!n.lazy)return;let r=t[n.id];pr(r,"No route found in manifest");let s={};for(let o in i){let l=r[o]!==void 0&&o!=="hasErrorBoundary";vw(!l,'Route "'+r.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!l&&!Zst.has(o)&&(s[o]=i[o])}Object.assign(r,s),Object.assign(r,lo({},e(r),{lazy:void 0}))}async function Lot(n){let{matches:e}=n,t=e.filter(r=>r.shouldLoad);return(await Promise.all(t.map(r=>r.resolve()))).reduce((r,s,o)=>Object.assign(r,{[t[o].route.id]:s}),{})}async function Tot(n,e,t,i,r,s,o,a,l,c){let u=s.map(f=>f.route.lazy?Eot(f.route,l,a):void 0),d=s.map((f,g)=>{let p=u[g],m=r.some(v=>v.route.id===f.route.id);return lo({},f,{shouldLoad:m,resolve:async v=>(v&&i.method==="GET"&&(f.route.lazy||f.route.loader)&&(m=!0),m?Dot(e,i,f,p,v,c):Promise.resolve({type:Cs.data,result:void 0}))})}),h=await n({matches:d,request:i,params:s[0].params,fetcherKey:o,context:c});try{await Promise.all(u)}catch{}return h}async function Dot(n,e,t,i,r,s){let o,a,l=c=>{let u,d=new Promise((g,p)=>u=p);a=()=>u(),e.signal.addEventListener("abort",a);let h=g=>typeof c!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+n+'" [routeId: '+t.route.id+"]"))):c({request:e,params:t.params,context:s},...g!==void 0?[g]:[]),f=(async()=>{try{return{type:"data",result:await(r?r(p=>h(p)):h())}}catch(g){return{type:"error",result:g}}})();return Promise.race([f,d])};try{let c=t.route[n];if(i)if(c){let u,[d]=await Promise.all([l(c).catch(h=>{u=h}),i]);if(u!==void 0)throw u;o=d}else if(await i,c=t.route[n],c)o=await l(c);else if(n==="action"){let u=new URL(e.url),d=u.pathname+u.search;throw Nu(405,{method:e.method,pathname:d,routeId:t.route.id})}else return{type:Cs.data,result:void 0};else if(c)o=await l(c);else{let u=new URL(e.url),d=u.pathname+u.search;throw Nu(404,{pathname:d})}pr(o.result!==void 0,"You defined "+(n==="action"?"an action":"a loader")+" for route "+('"'+t.route.id+"\" but didn't return anything from your `"+n+"` ")+"function. Please return a value or `null`.")}catch(c){return{type:Cs.error,result:c}}finally{a&&e.signal.removeEventListener("abort",a)}return o}async function Iot(n){let{result:e,type:t}=n;if(VPe(e)){let c;try{let u=e.headers.get("Content-Type");u&&/\bapplication\/json\b/.test(u)?e.body==null?c=null:c=await e.json():c=await e.text()}catch(u){return{type:Cs.error,error:u}}return t===Cs.error?{type:Cs.error,error:new a6(e.status,e.statusText,c),statusCode:e.status,headers:e.headers}:{type:Cs.data,data:c,statusCode:e.status,headers:e.headers}}if(t===Cs.error){if(b0e(e)){var i;if(e.data instanceof Error){var r;return{type:Cs.error,error:e.data,statusCode:(r=e.init)==null?void 0:r.status}}e=new a6(((i=e.init)==null?void 0:i.status)||500,void 0,e.data)}return{type:Cs.error,error:e,statusCode:m$(e)?e.status:void 0}}if(Oot(e)){var s,o;return{type:Cs.deferred,deferredData:e,statusCode:(s=e.init)==null?void 0:s.status,headers:((o=e.init)==null?void 0:o.headers)&&new Headers(e.init.headers)}}if(b0e(e)){var a,l;return{type:Cs.data,data:e.data,statusCode:(a=e.init)==null?void 0:a.status,headers:(l=e.init)!=null&&l.headers?new Headers(e.init.headers):void 0}}return{type:Cs.data,data:e}}function Aot(n,e,t,i,r,s){let o=n.headers.get("Location");if(pr(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!zoe.test(o)){let a=i.slice(0,i.findIndex(l=>l.route.id===t)+1);o=EY(new URL(e.url),a,r,!0,o,s),n.headers.set("Location",o)}return n}function f0e(n,e,t){if(zoe.test(n)){let i=n,r=i.startsWith("//")?new URL(e.protocol+i):new URL(i),s=$L(r.pathname,t)!=null;if(r.origin===e.origin&&s)return r.pathname+r.search+r.hash}return n}function sx(n,e,t,i){let r=n.createURL(HPe(e)).toString(),s={signal:t};if(i&&Vf(i.formMethod)){let{formMethod:o,formEncType:a}=i;s.method=o.toUpperCase(),a==="application/json"?(s.headers=new Headers({"Content-Type":a}),s.body=JSON.stringify(i.json)):a==="text/plain"?s.body=i.text:a==="application/x-www-form-urlencoded"&&i.formData?s.body=TY(i.formData):s.body=i.formData}return new Request(r,s)}function TY(n){let e=new URLSearchParams;for(let[t,i]of n.entries())e.append(t,typeof i=="string"?i:i.name);return e}function g0e(n){let e=new FormData;for(let[t,i]of n.entries())e.append(t,i);return e}function Not(n,e,t,i,r){let s={},o=null,a,l=!1,c={},u=t&&Id(t[1])?t[1].error:void 0;return n.forEach(d=>{if(!(d.route.id in e))return;let h=d.route.id,f=e[h];if(pr(!ky(f),"Cannot handle redirect results in processLoaderData"),Id(f)){let g=f.error;u!==void 0&&(g=u,u=void 0),o=o||{};{let p=oy(n,h);o[p.route.id]==null&&(o[p.route.id]=g)}s[h]=void 0,l||(l=!0,a=m$(f.error)?f.error.status:500),f.headers&&(c[h]=f.headers)}else Ev(f)?(i.set(h,f.deferredData),s[h]=f.deferredData.data,f.statusCode!=null&&f.statusCode!==200&&!l&&(a=f.statusCode),f.headers&&(c[h]=f.headers)):(s[h]=f.data,f.statusCode&&f.statusCode!==200&&!l&&(a=f.statusCode),f.headers&&(c[h]=f.headers))}),u!==void 0&&t&&(o={[t[0]]:u},s[t[0]]=void 0),{loaderData:s,errors:o,statusCode:a||200,loaderHeaders:c}}function p0e(n,e,t,i,r,s,o){let{loaderData:a,errors:l}=Not(e,t,i,o);return r.forEach(c=>{let{key:u,match:d,controller:h}=c,f=s[u];if(pr(f,"Did not find corresponding fetcher result"),!(h&&h.signal.aborted))if(Id(f)){let g=oy(n.matches,d?.route.id);l&&l[g.route.id]||(l=lo({},l,{[g.route.id]:f.error})),n.fetchers.delete(u)}else if(ky(f))pr(!1,"Unhandled fetcher revalidation redirect");else if(Ev(f))pr(!1,"Unhandled fetcher deferred data");else{let g=G0(f.data);n.fetchers.set(u,g)}}),{loaderData:a,errors:l}}function m0e(n,e,t,i){let r=lo({},e);for(let s of t){let o=s.route.id;if(e.hasOwnProperty(o)?e[o]!==void 0&&(r[o]=e[o]):n[o]!==void 0&&s.route.loader&&(r[o]=n[o]),i&&i.hasOwnProperty(o))break}return r}function _0e(n){return n?Id(n[1])?{actionData:{}}:{actionData:{[n[0]]:n[1].data}}:{}}function oy(n,e){return(e?n.slice(0,n.findIndex(i=>i.route.id===e)+1):[...n]).reverse().find(i=>i.route.hasErrorBoundary===!0)||n[0]}function v0e(n){let e=n.length===1?n[0]:n.find(t=>t.index||!t.path||t.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Nu(n,e){let{pathname:t,routeId:i,method:r,type:s,message:o}=e===void 0?{}:e,a="Unknown Server Error",l="Unknown @remix-run/router error";return n===400?(a="Bad Request",r&&t&&i?l="You made a "+r+' request to "'+t+'" but '+('did not provide a `loader` for route "'+i+'", ')+"so there is no way to handle the request.":s==="defer-action"?l="defer() is not supported in actions":s==="invalid-body"&&(l="Unable to encode submission body")):n===403?(a="Forbidden",l='Route "'+i+'" does not match URL "'+t+'"'):n===404?(a="Not Found",l='No route matches URL "'+t+'"'):n===405&&(a="Method Not Allowed",r&&t&&i?l="You made a "+r.toUpperCase()+' request to "'+t+'" but '+('did not provide an `action` for route "'+i+'", ')+"so there is no way to handle the request.":r&&(l='Invalid request method "'+r.toUpperCase()+'"')),new a6(n||500,a,new Error(l),!0)}function d4(n){let e=Object.entries(n);for(let t=e.length-1;t>=0;t--){let[i,r]=e[t];if(ky(r))return{key:i,result:r}}}function HPe(n){let e=typeof n=="string"?f0(n):n;return bw(lo({},e,{hash:""}))}function Rot(n,e){return n.pathname!==e.pathname||n.search!==e.search?!1:n.hash===""?e.hash!=="":n.hash===e.hash?!0:e.hash!==""}function Pot(n){return VPe(n.result)&&bot.has(n.result.status)}function Ev(n){return n.type===Cs.deferred}function Id(n){return n.type===Cs.error}function ky(n){return(n&&n.type)===Cs.redirect}function b0e(n){return typeof n=="object"&&n!=null&&"type"in n&&"data"in n&&"init"in n&&n.type==="DataWithResponseInit"}function Oot(n){let e=n;return e&&typeof e=="object"&&typeof e.data=="object"&&typeof e.subscribe=="function"&&typeof e.cancel=="function"&&typeof e.resolveData=="function"}function VPe(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.headers=="object"&&typeof n.body<"u"}function Mot(n){return vot.has(n.toLowerCase())}function Vf(n){return mot.has(n.toLowerCase())}async function Fot(n,e,t,i,r){let s=Object.entries(e);for(let o=0;oh?.route.id===a);if(!c)continue;let u=i.find(h=>h.route.id===c.route.id),d=u!=null&&!$Pe(u,c)&&(r&&r[c.route.id])!==void 0;Ev(l)&&d&&await Uoe(l,t,!1).then(h=>{h&&(e[a]=h)})}}async function Bot(n,e,t){for(let i=0;ic?.route.id===s)&&Ev(a)&&(pr(o,"Expected an AbortController for revalidating fetcher deferred result"),await Uoe(a,o.signal,!0).then(c=>{c&&(e[r]=c)}))}}async function Uoe(n,e,t){if(t===void 0&&(t=!1),!await n.deferredData.resolveData(e)){if(t)try{return{type:Cs.data,data:n.deferredData.unwrappedData}}catch(r){return{type:Cs.error,error:r}}return{type:Cs.data,data:n.deferredData.data}}}function joe(n){return new URLSearchParams(n).getAll("index").some(e=>e==="")}function bD(n,e){let t=typeof e=="string"?f0(e).search:e.search;if(n[n.length-1].route.index&&joe(t||""))return n[n.length-1];let i=MPe(n);return i[i.length-1]}function y0e(n){let{formMethod:e,formAction:t,formEncType:i,text:r,formData:s,json:o}=n;if(!(!e||!t||!i)){if(r!=null)return{formMethod:e,formAction:t,formEncType:i,formData:void 0,json:void 0,text:r};if(s!=null)return{formMethod:e,formAction:t,formEncType:i,formData:s,json:void 0,text:void 0};if(o!==void 0)return{formMethod:e,formAction:t,formEncType:i,formData:void 0,json:o,text:void 0}}}function HU(n,e){return e?{state:"loading",location:n,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function $ot(n,e){return{state:"submitting",location:n,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function hT(n,e){return n?{state:"loading",formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Wot(n,e){return{state:"submitting",formMethod:n.formMethod,formAction:n.formAction,formEncType:n.formEncType,formData:n.formData,json:n.json,text:n.text,data:e?e.data:void 0}}function G0(n){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:n}}function Hot(n,e){try{let t=n.sessionStorage.getItem(BPe);if(t){let i=JSON.parse(t);for(let[r,s]of Object.entries(i||{}))s&&Array.isArray(s)&&e.set(r,new Set(s||[]))}}catch{}}function Vot(n,e){if(e.size>0){let t={};for(let[i,r]of e)t[i]=[...r];try{n.sessionStorage.setItem(BPe,JSON.stringify(t))}catch(i){vw(!1,"Failed to save applied view transitions in sessionStorage ("+i+").")}}}/** * React Router v6.28.1 * @@ -56,7 +56,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function l6(){return l6=Object.assign?Object.assign.bind():function(n){for(var e=1;e{a.current=!0}),E.useCallback(function(c,u){if(u===void 0&&(u={}),!a.current)return;if(typeof c=="number"){i.go(c);return}let d=Voe(c,JSON.parse(o),s,u.relative==="path");n==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:L_([e,d.pathname])),(u.replace?i.replace:i.push)(d,u.state,u)},[e,i,o,s,n])}const jot=E.createContext(null);function qot(n){let e=E.useContext(Yb).outlet;return e&&E.createElement(jot.Provider,{value:n},e)}function KPe(n,e){let{relative:t}=e===void 0?{}:e,{future:i}=E.useContext(gC),{matches:r}=E.useContext(Yb),{pathname:s}=PP(),o=JSON.stringify(Hoe(r,i.v7_relativeSplatPath));return E.useMemo(()=>Voe(n,JSON.parse(o),s,t==="path"),[n,o,s,t])}function Kot(n,e,t,i){RP()||pr(!1);let{navigator:r}=E.useContext(gC),{matches:s}=E.useContext(Yb),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=PP(),u;u=c;let d=u.pathname||"/",h=d;if(l!=="/"){let p=l.replace(/^\//,"").split("/");h="/"+d.replace(/^\//,"").split("/").slice(p.length).join("/")}let f=sy(n,{pathname:h});return Qot(f&&f.map(p=>Object.assign({},p,{params:Object.assign({},a,p.params),pathname:L_([l,r.encodeLocation?r.encodeLocation(p.pathname).pathname:p.pathname]),pathnameBase:p.pathnameBase==="/"?l:L_([l,r.encodeLocation?r.encodeLocation(p.pathnameBase).pathname:p.pathnameBase])})),s,t,i)}function Got(){let n=nat(),e=m$(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),t=n instanceof Error?n.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},e),t?E.createElement("pre",{style:r},t):null,null)}const Yot=E.createElement(Got,null);class Zot extends E.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?E.createElement(Yb.Provider,{value:this.props.routeContext},E.createElement(UPe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Xot(n){let{routeContext:e,match:t,children:i}=n,r=E.useContext(_$);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),E.createElement(Yb.Provider,{value:e},i)}function Qot(n,e,t,i){var r;if(e===void 0&&(e=[]),t===void 0&&(t=null),i===void 0&&(i=null),n==null){var s;if(!t)return null;if(t.errors)n=t.matches;else if((s=i)!=null&&s.v7_partialHydration&&e.length===0&&!t.initialized&&t.matches.length>0)n=t.matches;else return null}let o=n,a=(r=t)==null?void 0:r.errors;if(a!=null){let u=o.findIndex(d=>d.route.id&&a?.[d.route.id]!==void 0);u>=0||pr(!1),o=o.slice(0,Math.min(o.length,u+1))}let l=!1,c=-1;if(t&&i&&i.v7_partialHydration)for(let u=0;u=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((u,d,h)=>{let f,g=!1,p=null,m=null;t&&(f=a&&d.route.id?a[d.route.id]:void 0,p=d.route.errorElement||Yot,l&&(c<0&&h===0?(rat("route-fallback"),g=!0,m=null):c===h&&(g=!0,m=d.route.hydrateFallbackElement||null)));let _=e.concat(o.slice(0,h+1)),v=()=>{let y;return f?y=p:g?y=m:d.route.Component?y=E.createElement(d.route.Component,null):d.route.element?y=d.route.element:y=u,E.createElement(Xot,{match:d,routeContext:{outlet:u,matches:_,isDataRoute:t!=null},children:y})};return t&&(d.route.ErrorBoundary||d.route.errorElement||h===0)?E.createElement(Zot,{location:t.location,revalidation:t.revalidation,component:p,error:f,children:v(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):v()},null)}var GPe=function(n){return n.UseBlocker="useBlocker",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n}(GPe||{}),c6=function(n){return n.UseBlocker="useBlocker",n.UseLoaderData="useLoaderData",n.UseActionData="useActionData",n.UseRouteError="useRouteError",n.UseNavigation="useNavigation",n.UseRouteLoaderData="useRouteLoaderData",n.UseMatches="useMatches",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n.UseRouteId="useRouteId",n}(c6||{});function Jot(n){let e=E.useContext(_$);return e||pr(!1),e}function eat(n){let e=E.useContext(zPe);return e||pr(!1),e}function tat(n){let e=E.useContext(Yb);return e||pr(!1),e}function YPe(n){let e=tat(),t=e.matches[e.matches.length-1];return t.route.id||pr(!1),t.route.id}function nat(){var n;let e=E.useContext(UPe),t=eat(c6.UseRouteError),i=YPe(c6.UseRouteError);return e!==void 0?e:(n=t.errors)==null?void 0:n[i]}function iat(){let{router:n}=Jot(GPe.UseNavigateStable),e=YPe(c6.UseNavigateStable),t=E.useRef(!1);return jPe(()=>{t.current=!0}),E.useCallback(function(r,s){s===void 0&&(s={}),t.current&&(typeof r=="number"?n.navigate(r):n.navigate(r,l6({fromRouteId:e},s)))},[n,e])}const w0e={};function rat(n,e,t){w0e[n]||(w0e[n]=!0)}const C0e={};function sat(n,e){C0e[e]||(C0e[e]=!0,console.warn(e))}const ox=(n,e,t)=>sat(n,"⚠️ React Router Future Flag Warning: "+e+". "+("You can use the `"+n+"` future flag to opt-in early. ")+("For more information, see "+t+"."));function oat(n,e){n?.v7_startTransition===void 0&&ox("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),n?.v7_relativeSplatPath===void 0&&(!e||!e.v7_relativeSplatPath)&&ox("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),e&&(e.v7_fetcherPersist===void 0&&ox("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),e.v7_normalizeFormMethod===void 0&&ox("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),e.v7_partialHydration===void 0&&ox("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),e.v7_skipActionErrorRevalidation===void 0&&ox("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function IFn(n){return qot(n.context)}function aat(n){let{basename:e="/",children:t=null,location:i,navigationType:r=ba.Pop,navigator:s,static:o=!1,future:a}=n;RP()&&pr(!1);let l=e.replace(/^\/*/,"/"),c=E.useMemo(()=>({basename:l,navigator:s,static:o,future:l6({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof i=="string"&&(i=f0(i));let{pathname:u="/",search:d="",hash:h="",state:f=null,key:g="default"}=i,p=E.useMemo(()=>{let m=$L(u,l);return m==null?null:{location:{pathname:m,search:d,hash:h,state:f,key:g},navigationType:r}},[l,u,d,h,f,g,r]);return p==null?null:E.createElement(gC.Provider,{value:c},E.createElement(qoe.Provider,{children:t,value:p}))}new Promise(()=>{});function lat(n){let e={hasErrorBoundary:n.ErrorBoundary!=null||n.errorElement!=null};return n.Component&&Object.assign(e,{element:E.createElement(n.Component),Component:void 0}),n.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:E.createElement(n.HydrateFallback),HydrateFallback:void 0}),n.ErrorBoundary&&Object.assign(e,{errorElement:E.createElement(n.ErrorBoundary),ErrorBoundary:void 0}),e}/** + */function l6(){return l6=Object.assign?Object.assign.bind():function(n){for(var e=1;e{a.current=!0}),E.useCallback(function(c,u){if(u===void 0&&(u={}),!a.current)return;if(typeof c=="number"){i.go(c);return}let d=Voe(c,JSON.parse(o),s,u.relative==="path");n==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:L_([e,d.pathname])),(u.replace?i.replace:i.push)(d,u.state,u)},[e,i,o,s,n])}const jot=E.createContext(null);function qot(n){let e=E.useContext(Yb).outlet;return e&&E.createElement(jot.Provider,{value:n},e)}function KPe(n,e){let{relative:t}=e===void 0?{}:e,{future:i}=E.useContext(gC),{matches:r}=E.useContext(Yb),{pathname:s}=PP(),o=JSON.stringify(Hoe(r,i.v7_relativeSplatPath));return E.useMemo(()=>Voe(n,JSON.parse(o),s,t==="path"),[n,o,s,t])}function Kot(n,e,t,i){RP()||pr(!1);let{navigator:r}=E.useContext(gC),{matches:s}=E.useContext(Yb),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let c=PP(),u;u=c;let d=u.pathname||"/",h=d;if(l!=="/"){let p=l.replace(/^\//,"").split("/");h="/"+d.replace(/^\//,"").split("/").slice(p.length).join("/")}let f=sy(n,{pathname:h});return Qot(f&&f.map(p=>Object.assign({},p,{params:Object.assign({},a,p.params),pathname:L_([l,r.encodeLocation?r.encodeLocation(p.pathname).pathname:p.pathname]),pathnameBase:p.pathnameBase==="/"?l:L_([l,r.encodeLocation?r.encodeLocation(p.pathnameBase).pathname:p.pathnameBase])})),s,t,i)}function Got(){let n=nat(),e=m$(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),t=n instanceof Error?n.stack:null,r={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},e),t?E.createElement("pre",{style:r},t):null,null)}const Yot=E.createElement(Got,null);class Zot extends E.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?E.createElement(Yb.Provider,{value:this.props.routeContext},E.createElement(UPe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Xot(n){let{routeContext:e,match:t,children:i}=n,r=E.useContext(_$);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),E.createElement(Yb.Provider,{value:e},i)}function Qot(n,e,t,i){var r;if(e===void 0&&(e=[]),t===void 0&&(t=null),i===void 0&&(i=null),n==null){var s;if(!t)return null;if(t.errors)n=t.matches;else if((s=i)!=null&&s.v7_partialHydration&&e.length===0&&!t.initialized&&t.matches.length>0)n=t.matches;else return null}let o=n,a=(r=t)==null?void 0:r.errors;if(a!=null){let u=o.findIndex(d=>d.route.id&&a?.[d.route.id]!==void 0);u>=0||pr(!1),o=o.slice(0,Math.min(o.length,u+1))}let l=!1,c=-1;if(t&&i&&i.v7_partialHydration)for(let u=0;u=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((u,d,h)=>{let f,g=!1,p=null,m=null;t&&(f=a&&d.route.id?a[d.route.id]:void 0,p=d.route.errorElement||Yot,l&&(c<0&&h===0?(rat("route-fallback"),g=!0,m=null):c===h&&(g=!0,m=d.route.hydrateFallbackElement||null)));let _=e.concat(o.slice(0,h+1)),v=()=>{let y;return f?y=p:g?y=m:d.route.Component?y=E.createElement(d.route.Component,null):d.route.element?y=d.route.element:y=u,E.createElement(Xot,{match:d,routeContext:{outlet:u,matches:_,isDataRoute:t!=null},children:y})};return t&&(d.route.ErrorBoundary||d.route.errorElement||h===0)?E.createElement(Zot,{location:t.location,revalidation:t.revalidation,component:p,error:f,children:v(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):v()},null)}var GPe=function(n){return n.UseBlocker="useBlocker",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n}(GPe||{}),c6=function(n){return n.UseBlocker="useBlocker",n.UseLoaderData="useLoaderData",n.UseActionData="useActionData",n.UseRouteError="useRouteError",n.UseNavigation="useNavigation",n.UseRouteLoaderData="useRouteLoaderData",n.UseMatches="useMatches",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n.UseRouteId="useRouteId",n}(c6||{});function Jot(n){let e=E.useContext(_$);return e||pr(!1),e}function eat(n){let e=E.useContext(zPe);return e||pr(!1),e}function tat(n){let e=E.useContext(Yb);return e||pr(!1),e}function YPe(n){let e=tat(),t=e.matches[e.matches.length-1];return t.route.id||pr(!1),t.route.id}function nat(){var n;let e=E.useContext(UPe),t=eat(c6.UseRouteError),i=YPe(c6.UseRouteError);return e!==void 0?e:(n=t.errors)==null?void 0:n[i]}function iat(){let{router:n}=Jot(GPe.UseNavigateStable),e=YPe(c6.UseNavigateStable),t=E.useRef(!1);return jPe(()=>{t.current=!0}),E.useCallback(function(r,s){s===void 0&&(s={}),t.current&&(typeof r=="number"?n.navigate(r):n.navigate(r,l6({fromRouteId:e},s)))},[n,e])}const w0e={};function rat(n,e,t){w0e[n]||(w0e[n]=!0)}const C0e={};function sat(n,e){C0e[e]||(C0e[e]=!0,console.warn(e))}const ox=(n,e,t)=>sat(n,"⚠️ React Router Future Flag Warning: "+e+". "+("You can use the `"+n+"` future flag to opt-in early. ")+("For more information, see "+t+"."));function oat(n,e){n?.v7_startTransition===void 0&&ox("v7_startTransition","React Router will begin wrapping state updates in `React.startTransition` in v7","https://reactrouter.com/v6/upgrading/future#v7_starttransition"),n?.v7_relativeSplatPath===void 0&&(!e||!e.v7_relativeSplatPath)&&ox("v7_relativeSplatPath","Relative route resolution within Splat routes is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath"),e&&(e.v7_fetcherPersist===void 0&&ox("v7_fetcherPersist","The persistence behavior of fetchers is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist"),e.v7_normalizeFormMethod===void 0&&ox("v7_normalizeFormMethod","Casing of `formMethod` fields is being normalized to uppercase in v7","https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod"),e.v7_partialHydration===void 0&&ox("v7_partialHydration","`RouterProvider` hydration behavior is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_partialhydration"),e.v7_skipActionErrorRevalidation===void 0&&ox("v7_skipActionErrorRevalidation","The revalidation behavior after 4xx/5xx `action` responses is changing in v7","https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation"))}function I5n(n){return qot(n.context)}function aat(n){let{basename:e="/",children:t=null,location:i,navigationType:r=ba.Pop,navigator:s,static:o=!1,future:a}=n;RP()&&pr(!1);let l=e.replace(/^\/*/,"/"),c=E.useMemo(()=>({basename:l,navigator:s,static:o,future:l6({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof i=="string"&&(i=f0(i));let{pathname:u="/",search:d="",hash:h="",state:f=null,key:g="default"}=i,p=E.useMemo(()=>{let m=$L(u,l);return m==null?null:{location:{pathname:m,search:d,hash:h,state:f,key:g},navigationType:r}},[l,u,d,h,f,g,r]);return p==null?null:E.createElement(gC.Provider,{value:c},E.createElement(qoe.Provider,{children:t,value:p}))}new Promise(()=>{});function lat(n){let e={hasErrorBoundary:n.ErrorBoundary!=null||n.errorElement!=null};return n.Component&&Object.assign(e,{element:E.createElement(n.Component),Component:void 0}),n.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:E.createElement(n.HydrateFallback),HydrateFallback:void 0}),n.ErrorBoundary&&Object.assign(e,{errorElement:E.createElement(n.ErrorBoundary),ErrorBoundary:void 0}),e}/** * React Router DOM v6.28.1 * * Copyright (c) Remix Software Inc. @@ -65,7 +65,7 @@ Error generating stack: `+s.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function MA(){return MA=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)&&(t[r]=n[r]);return t}function uat(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function dat(n,e){return n.button===0&&(!e||e==="_self")&&!uat(n)}function DY(n){return n===void 0&&(n=""),new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((e,t)=>{let i=n[t];return e.concat(Array.isArray(i)?i.map(r=>[t,r]):[[t,i]])},[]))}function hat(n,e){let t=DY(n);return e&&e.forEach((i,r)=>{t.has(r)||e.getAll(r).forEach(s=>{t.append(r,s)})}),t}const fat=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],gat="6";try{window.__reactRouterVersion=gat}catch{}function AFn(n,e){return xot({basename:void 0,future:MA({},void 0,{v7_prependBasename:!0}),history:Kst({window:void 0}),hydrationData:pat(),routes:n,mapRouteProperties:lat,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function pat(){var n;let e=(n=window)==null?void 0:n.__staticRouterHydrationData;return e&&e.errors&&(e=MA({},e,{errors:mat(e.errors)})),e}function mat(n){if(!n)return null;let e=Object.entries(n),t={};for(let[i,r]of e)if(r&&r.__type==="RouteErrorResponse")t[i]=new a6(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type==="Error"){if(r.__subType){let s=window[r.__subType];if(typeof s=="function")try{let o=new s(r.message);o.stack="",t[i]=o}catch{}}if(t[i]==null){let s=new Error(r.message);s.stack="",t[i]=s}}else t[i]=r;return t}const _at=E.createContext({isTransitioning:!1}),vat=E.createContext(new Map),bat="startTransition",x0e=JB[bat],yat="flushSync",S0e=qst[yat];function wat(n){x0e?x0e(n):n()}function fT(n){S0e?S0e(n):n()}class Cat{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=i=>{this.status==="pending"&&(this.status="resolved",e(i))},this.reject=i=>{this.status==="pending"&&(this.status="rejected",t(i))}})}}function NFn(n){let{fallbackElement:e,router:t,future:i}=n,[r,s]=E.useState(t.state),[o,a]=E.useState(),[l,c]=E.useState({isTransitioning:!1}),[u,d]=E.useState(),[h,f]=E.useState(),[g,p]=E.useState(),m=E.useRef(new Map),{v7_startTransition:_}=i||{},v=E.useCallback(D=>{_?wat(D):D()},[_]),y=E.useCallback((D,I)=>{let{deletedFetchers:O,flushSync:M,viewTransitionOpts:B}=I;O.forEach(W=>m.current.delete(W)),D.fetchers.forEach((W,z)=>{W.data!==void 0&&m.current.set(z,W.data)});let G=t.window==null||t.window.document==null||typeof t.window.document.startViewTransition!="function";if(!B||G){M?fT(()=>s(D)):v(()=>s(D));return}if(M){fT(()=>{h&&(u&&u.resolve(),h.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:B.currentLocation,nextLocation:B.nextLocation})});let W=t.window.document.startViewTransition(()=>{fT(()=>s(D))});W.finished.finally(()=>{fT(()=>{d(void 0),f(void 0),a(void 0),c({isTransitioning:!1})})}),fT(()=>f(W));return}h?(u&&u.resolve(),h.skipTransition(),p({state:D,currentLocation:B.currentLocation,nextLocation:B.nextLocation})):(a(D),c({isTransitioning:!0,flushSync:!1,currentLocation:B.currentLocation,nextLocation:B.nextLocation}))},[t.window,h,u,m,v]);E.useLayoutEffect(()=>t.subscribe(y),[t,y]),E.useEffect(()=>{l.isTransitioning&&!l.flushSync&&d(new Cat)},[l]),E.useEffect(()=>{if(u&&o&&t.window){let D=o,I=u.promise,O=t.window.document.startViewTransition(async()=>{v(()=>s(D)),await I});O.finished.finally(()=>{d(void 0),f(void 0),a(void 0),c({isTransitioning:!1})}),f(O)}},[v,o,u,t.window]),E.useEffect(()=>{u&&o&&r.location.key===o.location.key&&u.resolve()},[u,h,r.location,o]),E.useEffect(()=>{!l.isTransitioning&&g&&(a(g.state),c({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),p(void 0))},[l.isTransitioning,g]),E.useEffect(()=>{},[]);let C=E.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:D=>t.navigate(D),push:(D,I,O)=>t.navigate(D,{state:I,preventScrollReset:O?.preventScrollReset}),replace:(D,I,O)=>t.navigate(D,{replace:!0,state:I,preventScrollReset:O?.preventScrollReset})}),[t]),x=t.basename||"/",k=E.useMemo(()=>({router:t,navigator:C,static:!1,basename:x}),[t,C,x]),L=E.useMemo(()=>({v7_relativeSplatPath:t.future.v7_relativeSplatPath}),[t.future.v7_relativeSplatPath]);return E.useEffect(()=>oat(i,t.future),[i,t.future]),E.createElement(E.Fragment,null,E.createElement(_$.Provider,{value:k},E.createElement(zPe.Provider,{value:r},E.createElement(vat.Provider,{value:m.current},E.createElement(_at.Provider,{value:l},E.createElement(aat,{basename:x,location:r.location,navigationType:r.historyAction,navigator:C,future:L},r.initialized||t.future.v7_partialHydration?E.createElement(xat,{routes:t.routes,future:t.future,state:r}):e))))),null)}const xat=E.memo(Sat);function Sat(n){let{routes:e,future:t,state:i}=n;return Kot(e,void 0,i,t)}const kat=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Eat=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,RFn=E.forwardRef(function(e,t){let{onClick:i,relative:r,reloadDocument:s,replace:o,state:a,target:l,to:c,preventScrollReset:u,viewTransition:d}=e,h=cat(e,fat),{basename:f}=E.useContext(gC),g,p=!1;if(typeof c=="string"&&Eat.test(c)&&(g=c,kat))try{let y=new URL(window.location.href),C=c.startsWith("//")?new URL(y.protocol+c):new URL(c),x=$L(C.pathname,f);C.origin===y.origin&&x!=null?c=x+C.search+C.hash:p=!0}catch{}let m=zot(c,{relative:r}),_=Lat(c,{replace:o,state:a,target:l,preventScrollReset:u,relative:r,viewTransition:d});function v(y){i&&i(y),y.defaultPrevented||_(y)}return E.createElement("a",MA({},h,{href:g||m,onClick:p||s?i:v,ref:t,target:l}))});var k0e;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(k0e||(k0e={}));var E0e;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(E0e||(E0e={}));function Lat(n,e){let{target:t,replace:i,state:r,preventScrollReset:s,relative:o,viewTransition:a}=e===void 0?{}:e,l=qPe(),c=PP(),u=KPe(n,{relative:o});return E.useCallback(d=>{if(dat(d,t)){d.preventDefault();let h=i!==void 0?i:bw(c)===bw(u);l(n,{replace:h,state:r,preventScrollReset:s,relative:o,viewTransition:a})}},[c,l,u,i,r,t,n,s,o,a])}function PFn(n){let e=E.useRef(DY(n)),t=E.useRef(!1),i=PP(),r=E.useMemo(()=>hat(i.search,t.current?null:e.current),[i.search]),s=qPe(),o=E.useCallback((a,l)=>{const c=DY(typeof a=="function"?a(r):a);t.current=!0,s("?"+c,l)},[s,r]);return[r,o]}var ZPe={exports:{}},XPe={};/** + */function MA(){return MA=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)&&(t[r]=n[r]);return t}function uat(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function dat(n,e){return n.button===0&&(!e||e==="_self")&&!uat(n)}function DY(n){return n===void 0&&(n=""),new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((e,t)=>{let i=n[t];return e.concat(Array.isArray(i)?i.map(r=>[t,r]):[[t,i]])},[]))}function hat(n,e){let t=DY(n);return e&&e.forEach((i,r)=>{t.has(r)||e.getAll(r).forEach(s=>{t.append(r,s)})}),t}const fat=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],gat="6";try{window.__reactRouterVersion=gat}catch{}function A5n(n,e){return xot({basename:void 0,future:MA({},void 0,{v7_prependBasename:!0}),history:Kst({window:void 0}),hydrationData:pat(),routes:n,mapRouteProperties:lat,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function pat(){var n;let e=(n=window)==null?void 0:n.__staticRouterHydrationData;return e&&e.errors&&(e=MA({},e,{errors:mat(e.errors)})),e}function mat(n){if(!n)return null;let e=Object.entries(n),t={};for(let[i,r]of e)if(r&&r.__type==="RouteErrorResponse")t[i]=new a6(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type==="Error"){if(r.__subType){let s=window[r.__subType];if(typeof s=="function")try{let o=new s(r.message);o.stack="",t[i]=o}catch{}}if(t[i]==null){let s=new Error(r.message);s.stack="",t[i]=s}}else t[i]=r;return t}const _at=E.createContext({isTransitioning:!1}),vat=E.createContext(new Map),bat="startTransition",x0e=JB[bat],yat="flushSync",S0e=qst[yat];function wat(n){x0e?x0e(n):n()}function fT(n){S0e?S0e(n):n()}class Cat{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=i=>{this.status==="pending"&&(this.status="resolved",e(i))},this.reject=i=>{this.status==="pending"&&(this.status="rejected",t(i))}})}}function N5n(n){let{fallbackElement:e,router:t,future:i}=n,[r,s]=E.useState(t.state),[o,a]=E.useState(),[l,c]=E.useState({isTransitioning:!1}),[u,d]=E.useState(),[h,f]=E.useState(),[g,p]=E.useState(),m=E.useRef(new Map),{v7_startTransition:_}=i||{},v=E.useCallback(D=>{_?wat(D):D()},[_]),y=E.useCallback((D,I)=>{let{deletedFetchers:O,flushSync:M,viewTransitionOpts:B}=I;O.forEach(W=>m.current.delete(W)),D.fetchers.forEach((W,z)=>{W.data!==void 0&&m.current.set(z,W.data)});let G=t.window==null||t.window.document==null||typeof t.window.document.startViewTransition!="function";if(!B||G){M?fT(()=>s(D)):v(()=>s(D));return}if(M){fT(()=>{h&&(u&&u.resolve(),h.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:B.currentLocation,nextLocation:B.nextLocation})});let W=t.window.document.startViewTransition(()=>{fT(()=>s(D))});W.finished.finally(()=>{fT(()=>{d(void 0),f(void 0),a(void 0),c({isTransitioning:!1})})}),fT(()=>f(W));return}h?(u&&u.resolve(),h.skipTransition(),p({state:D,currentLocation:B.currentLocation,nextLocation:B.nextLocation})):(a(D),c({isTransitioning:!0,flushSync:!1,currentLocation:B.currentLocation,nextLocation:B.nextLocation}))},[t.window,h,u,m,v]);E.useLayoutEffect(()=>t.subscribe(y),[t,y]),E.useEffect(()=>{l.isTransitioning&&!l.flushSync&&d(new Cat)},[l]),E.useEffect(()=>{if(u&&o&&t.window){let D=o,I=u.promise,O=t.window.document.startViewTransition(async()=>{v(()=>s(D)),await I});O.finished.finally(()=>{d(void 0),f(void 0),a(void 0),c({isTransitioning:!1})}),f(O)}},[v,o,u,t.window]),E.useEffect(()=>{u&&o&&r.location.key===o.location.key&&u.resolve()},[u,h,r.location,o]),E.useEffect(()=>{!l.isTransitioning&&g&&(a(g.state),c({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),p(void 0))},[l.isTransitioning,g]),E.useEffect(()=>{},[]);let C=E.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:D=>t.navigate(D),push:(D,I,O)=>t.navigate(D,{state:I,preventScrollReset:O?.preventScrollReset}),replace:(D,I,O)=>t.navigate(D,{replace:!0,state:I,preventScrollReset:O?.preventScrollReset})}),[t]),x=t.basename||"/",k=E.useMemo(()=>({router:t,navigator:C,static:!1,basename:x}),[t,C,x]),L=E.useMemo(()=>({v7_relativeSplatPath:t.future.v7_relativeSplatPath}),[t.future.v7_relativeSplatPath]);return E.useEffect(()=>oat(i,t.future),[i,t.future]),E.createElement(E.Fragment,null,E.createElement(_$.Provider,{value:k},E.createElement(zPe.Provider,{value:r},E.createElement(vat.Provider,{value:m.current},E.createElement(_at.Provider,{value:l},E.createElement(aat,{basename:x,location:r.location,navigationType:r.historyAction,navigator:C,future:L},r.initialized||t.future.v7_partialHydration?E.createElement(xat,{routes:t.routes,future:t.future,state:r}):e))))),null)}const xat=E.memo(Sat);function Sat(n){let{routes:e,future:t,state:i}=n;return Kot(e,void 0,i,t)}const kat=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Eat=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,R5n=E.forwardRef(function(e,t){let{onClick:i,relative:r,reloadDocument:s,replace:o,state:a,target:l,to:c,preventScrollReset:u,viewTransition:d}=e,h=cat(e,fat),{basename:f}=E.useContext(gC),g,p=!1;if(typeof c=="string"&&Eat.test(c)&&(g=c,kat))try{let y=new URL(window.location.href),C=c.startsWith("//")?new URL(y.protocol+c):new URL(c),x=$L(C.pathname,f);C.origin===y.origin&&x!=null?c=x+C.search+C.hash:p=!0}catch{}let m=zot(c,{relative:r}),_=Lat(c,{replace:o,state:a,target:l,preventScrollReset:u,relative:r,viewTransition:d});function v(y){i&&i(y),y.defaultPrevented||_(y)}return E.createElement("a",MA({},h,{href:g||m,onClick:p||s?i:v,ref:t,target:l}))});var k0e;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(k0e||(k0e={}));var E0e;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(E0e||(E0e={}));function Lat(n,e){let{target:t,replace:i,state:r,preventScrollReset:s,relative:o,viewTransition:a}=e===void 0?{}:e,l=qPe(),c=PP(),u=KPe(n,{relative:o});return E.useCallback(d=>{if(dat(d,t)){d.preventDefault();let h=i!==void 0?i:bw(c)===bw(u);l(n,{replace:h,state:r,preventScrollReset:s,relative:o,viewTransition:a})}},[c,l,u,i,r,t,n,s,o,a])}function P5n(n){let e=E.useRef(DY(n)),t=E.useRef(!1),i=PP(),r=E.useMemo(()=>hat(i.search,t.current?null:e.current),[i.search]),s=qPe(),o=E.useCallback((a,l)=>{const c=DY(typeof a=="function"?a(r):a);t.current=!0,s("?"+c,l)},[s,r]);return[r,o]}var ZPe={exports:{}},XPe={};/** * @license React * use-sync-external-store-with-selector.production.js * @@ -73,18 +73,18 @@ Error generating stack: `+s.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var OP=E;function Tat(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Dat=typeof Object.is=="function"?Object.is:Tat,Iat=OP.useSyncExternalStore,Aat=OP.useRef,Nat=OP.useEffect,Rat=OP.useMemo,Pat=OP.useDebugValue;XPe.useSyncExternalStoreWithSelector=function(n,e,t,i,r){var s=Aat(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=Rat(function(){function l(f){if(!c){if(c=!0,u=f,f=i(f),r!==void 0&&o.hasValue){var g=o.value;if(r(g,f))return d=g}return d=f}if(g=d,Dat(u,f))return g;var p=i(f);return r!==void 0&&r(g,p)?(u=f,g):(u=f,d=p)}var c=!1,u,d,h=t===void 0?null:t;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,t,i,r]);var a=Iat(n,s[0],s[1]);return Nat(function(){o.hasValue=!0,o.value=a},[a]),Pat(a),a};ZPe.exports=XPe;var Oat=ZPe.exports;function Mat(n){n()}function Fat(){let n=null,e=null;return{clear(){n=null,e=null},notify(){Mat(()=>{let t=n;for(;t;)t.callback(),t=t.next})},get(){const t=[];let i=n;for(;i;)t.push(i),i=i.next;return t},subscribe(t){let i=!0;const r=e={callback:t,next:null,prev:e};return r.prev?r.prev.next=r:n=r,function(){!i||n===null||(i=!1,r.next?r.next.prev=r.prev:e=r.prev,r.prev?r.prev.next=r.next:n=r.next)}}}}var L0e={notify(){},get:()=>[]};function Bat(n,e){let t,i=L0e,r=0,s=!1;function o(p){u();const m=i.subscribe(p);let _=!1;return()=>{_||(_=!0,m(),d())}}function a(){i.notify()}function l(){g.onStateChange&&g.onStateChange()}function c(){return s}function u(){r++,t||(t=n.subscribe(l),i=Fat())}function d(){r--,t&&r===0&&(t(),t=void 0,i.clear(),i=L0e)}function h(){s||(s=!0,u())}function f(){s&&(s=!1,d())}const g={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:h,tryUnsubscribe:f,getListeners:()=>i};return g}var $at=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Wat=$at(),Hat=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Vat=Hat(),zat=()=>Wat||Vat?E.useLayoutEffect:E.useEffect,Uat=zat(),jat=Symbol.for("react-redux-context"),qat=typeof globalThis<"u"?globalThis:{};function Kat(){if(!E.createContext)return{};const n=qat[jat]??=new Map;let e=n.get(E.createContext);return e||(e=E.createContext(null),n.set(E.createContext,e)),e}var pb=Kat();function Gat(n){const{children:e,context:t,serverState:i,store:r}=n,s=E.useMemo(()=>{const l=Bat(r);return{store:r,subscription:l,getServerState:i?()=>i:void 0}},[r,i]),o=E.useMemo(()=>r.getState(),[r]);Uat(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==r.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,o]);const a=t||pb;return E.createElement(a.Provider,{value:s},e)}var OFn=Gat;function Koe(n=pb){return function(){return E.useContext(n)}}var QPe=Koe();function JPe(n=pb){const e=n===pb?QPe:Koe(n),t=()=>{const{store:i}=e();return i};return Object.assign(t,{withTypes:()=>t}),t}var Yat=JPe();function Zat(n=pb){const e=n===pb?Yat:JPe(n),t=()=>e().dispatch;return Object.assign(t,{withTypes:()=>t}),t}var MFn=Zat(),Xat=(n,e)=>n===e;function Qat(n=pb){const e=n===pb?QPe:Koe(n),t=(i,r={})=>{const{equalityFn:s=Xat}=typeof r=="function"?{equalityFn:r}:r,o=e(),{store:a,subscription:l,getServerState:c}=o;E.useRef(!0);const u=E.useCallback({[i.name](h){return i(h)}}[i.name],[i]),d=Oat.useSyncExternalStoreWithSelector(l.addNestedSub,a.getState,c||a.getState,u,s);return E.useDebugValue(d),d};return Object.assign(t,{withTypes:()=>t}),t}var FFn=Qat();function T0e(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function Jat(...n){return e=>{let t=!1;const i=n.map(r=>{const s=T0e(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r{const{children:s,...o}=i,a=E.Children.toArray(s),l=a.find(nlt);if(l){const c=l.props.children,u=a.map(d=>d===l?E.Children.count(c)>1?E.Children.only(null):E.isValidElement(c)?c.props.children:null:d);return ae.jsx(e,{...o,ref:r,children:E.isValidElement(c)?E.cloneElement(c,void 0,u):null})}return ae.jsx(e,{...o,ref:r,children:s})});return t.displayName=`${n}.Slot`,t}var BFn=eOe("Slot");function elt(n){const e=E.forwardRef((t,i)=>{const{children:r,...s}=t;if(E.isValidElement(r)){const o=rlt(r),a=ilt(s,r.props);return r.type!==E.Fragment&&(a.ref=i?Jat(i,o):o),E.cloneElement(r,a)}return E.Children.count(r)>1?E.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var tlt=Symbol("radix.slottable");function nlt(n){return E.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===tlt}function ilt(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{const l=s(...a);return r(...a),l}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function rlt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function tOe(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;etypeof n=="boolean"?`${n}`:n===0?"0":n,I0e=mr,$Fn=(n,e)=>t=>{var i;if(e?.variants==null)return I0e(n,t?.class,t?.className);const{variants:r,defaultVariants:s}=e,o=Object.keys(r).map(c=>{const u=t?.[c],d=s?.[c];if(u===null)return null;const h=D0e(u)||D0e(d);return r[c][h]}),a=t&&Object.entries(t).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),l=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((c,u)=>{let{class:d,className:h,...f}=u;return Object.entries(f).every(g=>{let[p,m]=g;return Array.isArray(m)?m.includes({...s,...a}[p]):{...s,...a}[p]===m})?[...c,d,h]:c},[]);return I0e(n,o,l,t?.class,t?.className)},Goe="-",slt=n=>{const e=alt(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:o=>{const a=o.split(Goe);return a[0]===""&&a.length!==1&&a.shift(),nOe(a,e)||olt(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&i[o]?[...l,...i[o]]:l}}},nOe=(n,e)=>{if(n.length===0)return e.classGroupId;const t=n[0],i=e.nextPart.get(t),r=i?nOe(n.slice(1),i):void 0;if(r)return r;if(e.validators.length===0)return;const s=n.join(Goe);return e.validators.find(({validator:o})=>o(s))?.classGroupId},A0e=/^\[(.+)\]$/,olt=n=>{if(A0e.test(n)){const e=A0e.exec(n)[1],t=e?.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},alt=n=>{const{theme:e,prefix:t}=n,i={nextPart:new Map,validators:[]};return clt(Object.entries(n.classGroups),t).forEach(([s,o])=>{IY(o,i,s,e)}),i},IY=(n,e,t,i)=>{n.forEach(r=>{if(typeof r=="string"){const s=r===""?e:N0e(e,r);s.classGroupId=t;return}if(typeof r=="function"){if(llt(r)){IY(r(i),e,t,i);return}e.validators.push({validator:r,classGroupId:t});return}Object.entries(r).forEach(([s,o])=>{IY(o,N0e(e,s),t,i)})})},N0e=(n,e)=>{let t=n;return e.split(Goe).forEach(i=>{t.nextPart.has(i)||t.nextPart.set(i,{nextPart:new Map,validators:[]}),t=t.nextPart.get(i)}),t},llt=n=>n.isThemeGetter,clt=(n,e)=>e?n.map(([t,i])=>{const r=i.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[t,r]}):n,ult=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,i=new Map;const r=(s,o)=>{t.set(s,o),e++,e>n&&(e=0,i=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=i.get(s))!==void 0)return r(s,o),o},set(s,o){t.has(s)?t.set(s,o):r(s,o)}}},iOe="!",dlt=n=>{const{separator:e,experimentalParseClassName:t}=n,i=e.length===1,r=e[0],s=e.length,o=a=>{const l=[];let c=0,u=0,d;for(let m=0;mu?d-u:void 0;return{modifiers:l,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:p}};return t?a=>t({className:a,parseClassName:o}):o},hlt=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(i=>{i[0]==="["?(e.push(...t.sort(),i),t=[]):t.push(i)}),e.push(...t.sort()),e},flt=n=>({cache:ult(n.cacheSize),parseClassName:dlt(n),...slt(n)}),glt=/\s+/,plt=(n,e)=>{const{parseClassName:t,getClassGroupId:i,getConflictingClassGroupIds:r}=e,s=[],o=n.trim().split(glt);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:f}=t(c);let g=!!f,p=i(g?h.substring(0,f):h);if(!p){if(!g){a=c+(a.length>0?" "+a:a);continue}if(p=i(h),!p){a=c+(a.length>0?" "+a:a);continue}g=!1}const m=hlt(u).join(":"),_=d?m+iOe:m,v=_+p;if(s.includes(v))continue;s.push(v);const y=r(p,g);for(let C=0;C0?" "+a:a)}return a};function mlt(){let n=0,e,t,i="";for(;n{if(typeof n=="string")return n;let e,t="";for(let i=0;id(u),n());return t=flt(c),i=t.cache.get,r=t.cache.set,s=a,a(l)}function a(l){const c=i(l);if(c)return c;const u=plt(l,t);return r(l,u),u}return function(){return s(mlt.apply(null,arguments))}}const Xs=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},sOe=/^\[(?:([a-z-]+):)?(.+)\]$/i,vlt=/^\d+\/\d+$/,blt=new Set(["px","full","screen"]),ylt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,wlt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Clt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,xlt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Slt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Tm=n=>tk(n)||blt.has(n)||vlt.test(n),B0=n=>WL(n,"length",Nlt),tk=n=>!!n&&!Number.isNaN(Number(n)),VU=n=>WL(n,"number",tk),gT=n=>!!n&&Number.isInteger(Number(n)),klt=n=>n.endsWith("%")&&tk(n.slice(0,-1)),Vi=n=>sOe.test(n),$0=n=>ylt.test(n),Elt=new Set(["length","size","percentage"]),Llt=n=>WL(n,Elt,oOe),Tlt=n=>WL(n,"position",oOe),Dlt=new Set(["image","url"]),Ilt=n=>WL(n,Dlt,Plt),Alt=n=>WL(n,"",Rlt),pT=()=>!0,WL=(n,e,t)=>{const i=sOe.exec(n);return i?i[1]?typeof e=="string"?i[1]===e:e.has(i[1]):t(i[2]):!1},Nlt=n=>wlt.test(n)&&!Clt.test(n),oOe=()=>!1,Rlt=n=>xlt.test(n),Plt=n=>Slt.test(n),Olt=()=>{const n=Xs("colors"),e=Xs("spacing"),t=Xs("blur"),i=Xs("brightness"),r=Xs("borderColor"),s=Xs("borderRadius"),o=Xs("borderSpacing"),a=Xs("borderWidth"),l=Xs("contrast"),c=Xs("grayscale"),u=Xs("hueRotate"),d=Xs("invert"),h=Xs("gap"),f=Xs("gradientColorStops"),g=Xs("gradientColorStopPositions"),p=Xs("inset"),m=Xs("margin"),_=Xs("opacity"),v=Xs("padding"),y=Xs("saturate"),C=Xs("scale"),x=Xs("sepia"),k=Xs("skew"),L=Xs("space"),D=Xs("translate"),I=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto",Vi,e],B=()=>[Vi,e],G=()=>["",Tm,B0],W=()=>["auto",tk,Vi],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],j=()=>["","0",Vi],te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],le=()=>[tk,Vi];return{cacheSize:500,separator:":",theme:{colors:[pT],spacing:[Tm,B0],blur:["none","",$0,Vi],brightness:le(),borderColor:[n],borderRadius:["none","","full",$0,Vi],borderSpacing:B(),borderWidth:G(),contrast:le(),grayscale:j(),hueRotate:le(),invert:j(),gap:B(),gradientColorStops:[n],gradientColorStopPositions:[klt,B0],inset:M(),margin:M(),opacity:le(),padding:B(),saturate:le(),scale:le(),sepia:j(),skew:le(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",Vi]}],container:["container"],columns:[{columns:[$0]}],"break-after":[{"break-after":te()}],"break-before":[{"break-before":te()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...z(),Vi]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",gT,Vi]}],basis:[{basis:M()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Vi]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",gT,Vi]}],"grid-cols":[{"grid-cols":[pT]}],"col-start-end":[{col:["auto",{span:["full",gT,Vi]},Vi]}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":[pT]}],"row-start-end":[{row:["auto",{span:[gT,Vi]},Vi]}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Vi]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Vi]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Vi,e]}],"min-w":[{"min-w":[Vi,e,"min","max","fit"]}],"max-w":[{"max-w":[Vi,e,"none","full","min","max","fit","prose",{screen:[$0]},$0]}],h:[{h:[Vi,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Vi,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Vi,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Vi,e,"auto","min","max","fit"]}],"font-size":[{text:["base",$0,B0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",VU]}],"font-family":[{font:[pT]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Vi]}],"line-clamp":[{"line-clamp":["none",tk,VU]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Tm,Vi]}],"list-image":[{"list-image":["none",Vi]}],"list-style-type":[{list:["none","disc","decimal",Vi]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Tm,B0]}],"underline-offset":[{"underline-offset":["auto",Tm,Vi]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Vi]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Vi]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),Tlt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Llt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Ilt]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:q()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[Tm,Vi]}],"outline-w":[{outline:[Tm,B0]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Tm,B0]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",$0,Alt]}],"shadow-color":[{shadow:[pT]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...ee(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ee()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[i]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",$0,Vi]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Vi]}],duration:[{duration:le()}],ease:[{ease:["linear","in","out","in-out",Vi]}],delay:[{delay:le()}],animate:[{animate:["none","spin","ping","pulse","bounce",Vi]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[gT,Vi]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Vi]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Vi]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Vi]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[Tm,B0,VU]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},WFn=_lt(Olt);var aOe={exports:{}},Mlt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Flt=Mlt,Blt=Flt;function lOe(){}function cOe(){}cOe.resetWarningCache=lOe;var $lt=function(){function n(i,r,s,o,a,l){if(l!==Blt){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}n.isRequired=n;function e(){return n}var t={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:e,element:n,elementType:n,instanceOf:e,node:n,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:cOe,resetWarningCache:lOe};return t.PropTypes=t,t};aOe.exports=$lt();var Wlt=aOe.exports;const ui=cs(Wlt);var Hlt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},Vlt=Object.defineProperty,zlt=Object.defineProperties,Ult=Object.getOwnPropertyDescriptors,u6=Object.getOwnPropertySymbols,uOe=Object.prototype.hasOwnProperty,dOe=Object.prototype.propertyIsEnumerable,R0e=(n,e,t)=>e in n?Vlt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,P0e=(n,e)=>{for(var t in e||(e={}))uOe.call(e,t)&&R0e(n,t,e[t]);if(u6)for(var t of u6(e))dOe.call(e,t)&&R0e(n,t,e[t]);return n},jlt=(n,e)=>zlt(n,Ult(e)),qlt=(n,e)=>{var t={};for(var i in n)uOe.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&u6)for(var i of u6(n))e.indexOf(i)<0&&dOe.call(n,i)&&(t[i]=n[i]);return t},Wr=(n,e,t)=>{const i=E.forwardRef((r,s)=>{var o=r,{color:a="currentColor",size:l=24,stroke:c=2,children:u}=o,d=qlt(o,["color","size","stroke","children"]);return E.createElement("svg",P0e(jlt(P0e({ref:s},Hlt),{width:l,height:l,stroke:a,strokeWidth:c,className:`tabler-icon tabler-icon-${n}`}),d),[...t.map(([h,f])=>E.createElement(h,f)),...u||[]])});return i.propTypes={color:ui.string,size:ui.oneOfType([ui.string,ui.number]),stroke:ui.oneOfType([ui.string,ui.number])},i.displayName=`${e}`,i},HFn=Wr("adjustments","IconAdjustments",[["path",{d:"M4 10a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M6 4v4",key:"svg-1"}],["path",{d:"M6 12v8",key:"svg-2"}],["path",{d:"M10 16a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-3"}],["path",{d:"M12 4v10",key:"svg-4"}],["path",{d:"M12 18v2",key:"svg-5"}],["path",{d:"M16 7a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-6"}],["path",{d:"M18 4v1",key:"svg-7"}],["path",{d:"M18 9v11",key:"svg-8"}]]),VFn=Wr("brand-telegram","IconBrandTelegram",[["path",{d:"M15 10l-4 4l6 6l4 -16l-18 7l4 2l2 6l3 -4",key:"svg-0"}]]),zFn=Wr("building-store","IconBuildingStore",[["path",{d:"M3 21l18 0",key:"svg-0"}],["path",{d:"M3 7v1a3 3 0 0 0 6 0v-1m0 1a3 3 0 0 0 6 0v-1m0 1a3 3 0 0 0 6 0v-1h-18l2 -4h14l2 4",key:"svg-1"}],["path",{d:"M5 21l0 -10.15",key:"svg-2"}],["path",{d:"M19 21l0 -10.15",key:"svg-3"}],["path",{d:"M9 21v-4a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v4",key:"svg-4"}]]),UFn=Wr("building","IconBuilding",[["path",{d:"M3 21l18 0",key:"svg-0"}],["path",{d:"M9 8l1 0",key:"svg-1"}],["path",{d:"M9 12l1 0",key:"svg-2"}],["path",{d:"M9 16l1 0",key:"svg-3"}],["path",{d:"M14 8l1 0",key:"svg-4"}],["path",{d:"M14 12l1 0",key:"svg-5"}],["path",{d:"M14 16l1 0",key:"svg-6"}],["path",{d:"M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16",key:"svg-7"}]]),jFn=Wr("cash","IconCash",[["path",{d:"M7 9m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M14 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M17 9v-2a2 2 0 0 0 -2 -2h-10a2 2 0 0 0 -2 2v6a2 2 0 0 0 2 2h2",key:"svg-2"}]]),qFn=Wr("chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),KFn=Wr("chevrons-left","IconChevronsLeft",[["path",{d:"M11 7l-5 5l5 5",key:"svg-0"}],["path",{d:"M17 7l-5 5l5 5",key:"svg-1"}]]),GFn=Wr("copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]),YFn=Wr("credit-card","IconCreditCard",[["path",{d:"M3 5m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M3 10l18 0",key:"svg-1"}],["path",{d:"M7 15l.01 0",key:"svg-2"}],["path",{d:"M11 15l2 0",key:"svg-3"}]]),ZFn=Wr("dashboard","IconDashboard",[["path",{d:"M12 13m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M13.45 11.55l2.05 -2.05",key:"svg-1"}],["path",{d:"M6.4 20a9 9 0 1 1 11.2 0z",key:"svg-2"}]]),XFn=Wr("device-desktop","IconDeviceDesktop",[["path",{d:"M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10z",key:"svg-0"}],["path",{d:"M7 20h10",key:"svg-1"}],["path",{d:"M9 16v4",key:"svg-2"}],["path",{d:"M15 16v4",key:"svg-3"}]]),QFn=Wr("discount-check","IconDiscountCheck",[["path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1",key:"svg-0"}],["path",{d:"M9 12l2 2l4 -4",key:"svg-1"}]]),JFn=Wr("eye-off","IconEyeOff",[["path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828",key:"svg-0"}],["path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]]),e5n=Wr("eye","IconEye",[["path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6",key:"svg-1"}]]),t5n=Wr("file-text","IconFileText",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}],["path",{d:"M9 9l1 0",key:"svg-2"}],["path",{d:"M9 13l6 0",key:"svg-3"}],["path",{d:"M9 17l6 0",key:"svg-4"}]]),n5n=Wr("gift","IconGift",[["path",{d:"M3 8m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1z",key:"svg-0"}],["path",{d:"M12 8l0 13",key:"svg-1"}],["path",{d:"M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7",key:"svg-2"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5",key:"svg-3"}]]),i5n=Wr("loader-2","IconLoader2",[["path",{d:"M12 3a9 9 0 1 0 9 9",key:"svg-0"}]]),r5n=Wr("lock","IconLock",[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-4a4 4 0 1 1 8 0v4",key:"svg-2"}]]),s5n=Wr("mail","IconMail",[["path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z",key:"svg-0"}],["path",{d:"M3 7l9 6l9 -6",key:"svg-1"}]]),o5n=Wr("menu-2","IconMenu2",[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l16 0",key:"svg-1"}],["path",{d:"M4 18l16 0",key:"svg-2"}]]),a5n=Wr("moon","IconMoon",[["path",{d:"M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z",key:"svg-0"}]]),l5n=Wr("news","IconNews",[["path",{d:"M16 6h3a1 1 0 0 1 1 1v11a2 2 0 0 1 -4 0v-13a1 1 0 0 0 -1 -1h-10a1 1 0 0 0 -1 1v12a3 3 0 0 0 3 3h11",key:"svg-0"}],["path",{d:"M8 8l4 0",key:"svg-1"}],["path",{d:"M8 12l4 0",key:"svg-2"}],["path",{d:"M8 16l4 0",key:"svg-3"}]]),c5n=Wr("route","IconRoute",[["path",{d:"M3 19a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M19 7a2 2 0 1 0 0 -4a2 2 0 0 0 0 4z",key:"svg-1"}],["path",{d:"M11 19h5.5a3.5 3.5 0 0 0 0 -7h-8a3.5 3.5 0 0 1 0 -7h4.5",key:"svg-2"}]]),u5n=Wr("server-bolt","IconServerBolt",[["path",{d:"M3 4m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M15 20h-9a3 3 0 0 1 -3 -3v-2a3 3 0 0 1 3 -3h12",key:"svg-1"}],["path",{d:"M7 8v.01",key:"svg-2"}],["path",{d:"M7 16v.01",key:"svg-3"}],["path",{d:"M20 15l-2 3h3l-2 3",key:"svg-4"}]]),d5n=Wr("server","IconServer",[["path",{d:"M3 4m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M3 12m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-1"}],["path",{d:"M7 8l0 .01",key:"svg-2"}],["path",{d:"M7 16l0 .01",key:"svg-3"}]]),h5n=Wr("settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]),f5n=Wr("sun","IconSun",[["path",{d:"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7",key:"svg-1"}]]),g5n=Wr("template","IconTemplate",[["path",{d:"M4 4m0 1a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1z",key:"svg-0"}],["path",{d:"M4 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z",key:"svg-1"}],["path",{d:"M14 12l6 0",key:"svg-2"}],["path",{d:"M14 16l6 0",key:"svg-3"}],["path",{d:"M14 20l6 0",key:"svg-4"}]]),p5n=Wr("ticket","IconTicket",[["path",{d:"M15 5l0 2",key:"svg-0"}],["path",{d:"M15 11l0 2",key:"svg-1"}],["path",{d:"M15 17l0 2",key:"svg-2"}],["path",{d:"M5 5h14a2 2 0 0 1 2 2v3a2 2 0 0 0 0 4v3a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-3a2 2 0 0 0 0 -4v-3a2 2 0 0 1 2 -2",key:"svg-3"}]]),m5n=Wr("user-circle","IconUserCircle",[["path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M12 10m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855",key:"svg-2"}]]),_5n=Wr("user","IconUser",[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}]]),v5n=Wr("users","IconUsers",[["path",{d:"M9 7m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"svg-2"}],["path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85",key:"svg-3"}]]),b5n=Wr("x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);function O0e(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function Pg(...n){return e=>{let t=!1;const i=n.map(r=>{const s=O0e(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(Glt);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(AY,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(AY,{...i,ref:e,children:t})});hOe.displayName="Slot";var AY=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=Zlt(t);return E.cloneElement(t,{...Ylt(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});AY.displayName="SlotClone";var Klt=({children:n})=>ae.jsx(ae.Fragment,{children:n});function Glt(n){return E.isValidElement(n)&&n.type===Klt}function Ylt(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function Zlt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Xlt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Pn=Xlt.reduce((n,e)=>{const t=E.forwardRef((i,r)=>{const{asChild:s,...o}=i,a=s?hOe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),ae.jsx(a,{...o,ref:r})});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function fOe(n,e){n&&h0.flushSync(()=>n.dispatchEvent(e))}var Qlt="Separator",M0e="horizontal",Jlt=["horizontal","vertical"],gOe=E.forwardRef((n,e)=>{const{decorative:t,orientation:i=M0e,...r}=n,s=ect(i)?i:M0e,a=t?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return ae.jsx(Pn.div,{"data-orientation":s,...a,...r,ref:e})});gOe.displayName=Qlt;function ect(n){return Jlt.includes(n)}var y5n=gOe,MP=n=>n.type==="checkbox",Ey=n=>n instanceof Date,Kc=n=>n==null;const pOe=n=>typeof n=="object";var Qo=n=>!Kc(n)&&!Array.isArray(n)&&pOe(n)&&!Ey(n),mOe=n=>Qo(n)&&n.target?MP(n.target)?n.target.checked:n.target.value:n,tct=n=>n.substring(0,n.search(/\.\d+(\.|$)/))||n,_Oe=(n,e)=>n.has(tct(e)),nct=n=>{const e=n.constructor&&n.constructor.prototype;return Qo(e)&&e.hasOwnProperty("isPrototypeOf")},Yoe=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Fa(n){let e;const t=Array.isArray(n),i=typeof FileList<"u"?n instanceof FileList:!1;if(n instanceof Date)e=new Date(n);else if(n instanceof Set)e=new Set(n);else if(!(Yoe&&(n instanceof Blob||i))&&(t||Qo(n)))if(e=t?[]:{},!t&&!nct(n))e=n;else for(const r in n)n.hasOwnProperty(r)&&(e[r]=Fa(n[r]));else return n;return e}var FP=n=>Array.isArray(n)?n.filter(Boolean):[],io=n=>n===void 0,Vt=(n,e,t)=>{if(!e||!Qo(n))return t;const i=FP(e.split(/[,[\].]+?/)).reduce((r,s)=>Kc(r)?r:r[s],n);return io(i)||i===n?io(n[e])?t:n[e]:i},Ph=n=>typeof n=="boolean",Zoe=n=>/^\w*$/.test(n),vOe=n=>FP(n.replace(/["|']|\]/g,"").split(/\.|\[/)),zr=(n,e,t)=>{let i=-1;const r=Zoe(e)?[e]:vOe(e),s=r.length,o=s-1;for(;++iU.useContext(bOe),w5n=n=>{const{children:e,...t}=n;return U.createElement(bOe.Provider,{value:t},e)};var yOe=(n,e,t,i=!0)=>{const r={defaultValues:e._defaultValues};for(const s in n)Object.defineProperty(r,s,{get:()=>{const o=s;return e._proxyFormState[o]!==Vh.all&&(e._proxyFormState[o]=!i||Vh.all),t&&(t[o]=!0),n[o]}});return r},zc=n=>Qo(n)&&!Object.keys(n).length,wOe=(n,e,t,i)=>{t(n);const{name:r,...s}=n;return zc(s)||Object.keys(s).length>=Object.keys(e).length||Object.keys(s).find(o=>e[o]===(!i||Vh.all))},zu=n=>Array.isArray(n)?n:[n],COe=(n,e,t)=>!n||!e||n===e||zu(n).some(i=>i&&(t?i===e:i.startsWith(e)||e.startsWith(i)));function b$(n){const e=U.useRef(n);e.current=n,U.useEffect(()=>{const t=!n.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{t&&t.unsubscribe()}},[n.disabled])}function ict(n){const e=v$(),{control:t=e.control,disabled:i,name:r,exact:s}=n,[o,a]=U.useState(t._formState),l=U.useRef(!0),c=U.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=U.useRef(r);return u.current=r,b$({disabled:i,next:d=>l.current&&COe(u.current,d.name,s)&&wOe(d,c.current,t._updateFormState)&&a({...t._formState,...d}),subject:t._subjects.state}),U.useEffect(()=>(l.current=!0,c.current.isValid&&t._updateValid(!0),()=>{l.current=!1}),[t]),U.useMemo(()=>yOe(o,t,c.current,!1),[o,t])}var Ep=n=>typeof n=="string",xOe=(n,e,t,i,r)=>Ep(n)?(i&&e.watch.add(n),Vt(t,n,r)):Array.isArray(n)?n.map(s=>(i&&e.watch.add(s),Vt(t,s))):(i&&(e.watchAll=!0),t);function rct(n){const e=v$(),{control:t=e.control,name:i,defaultValue:r,disabled:s,exact:o}=n,a=U.useRef(i);a.current=i,b$({disabled:s,subject:t._subjects.values,next:u=>{COe(a.current,u.name,o)&&c(Fa(xOe(a.current,t._names,u.values||t._formValues,!1,r)))}});const[l,c]=U.useState(t._getWatch(i,r));return U.useEffect(()=>t._removeUnmounted()),l}function sct(n){const e=v$(),{name:t,disabled:i,control:r=e.control,shouldUnregister:s}=n,o=_Oe(r._names.array,t),a=rct({control:r,name:t,defaultValue:Vt(r._formValues,t,Vt(r._defaultValues,t,n.defaultValue)),exact:!0}),l=ict({control:r,name:t,exact:!0}),c=U.useRef(r.register(t,{...n.rules,value:a,...Ph(n.disabled)?{disabled:n.disabled}:{}})),u=U.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Vt(l.errors,t)},isDirty:{enumerable:!0,get:()=>!!Vt(l.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!Vt(l.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!Vt(l.validatingFields,t)},error:{enumerable:!0,get:()=>Vt(l.errors,t)}}),[l,t]),d=U.useMemo(()=>({name:t,value:a,...Ph(i)||l.disabled?{disabled:l.disabled||i}:{},onChange:h=>c.current.onChange({target:{value:mOe(h),name:t},type:d6.CHANGE}),onBlur:()=>c.current.onBlur({target:{value:Vt(r._formValues,t),name:t},type:d6.BLUR}),ref:h=>{const f=Vt(r._fields,t);f&&h&&(f._f.ref={focus:()=>h.focus(),select:()=>h.select(),setCustomValidity:g=>h.setCustomValidity(g),reportValidity:()=>h.reportValidity()})}}),[t,r._formValues,i,l.disabled,a,r._fields]);return U.useEffect(()=>{const h=r._options.shouldUnregister||s,f=(g,p)=>{const m=Vt(r._fields,g);m&&m._f&&(m._f.mount=p)};if(f(t,!0),h){const g=Fa(Vt(r._options.defaultValues,t));zr(r._defaultValues,t,g),io(Vt(r._formValues,t))&&zr(r._formValues,t,g)}return!o&&r.register(t),()=>{(o?h&&!r._state.action:h)?r.unregister(t):f(t,!1)}},[t,r,o,s]),U.useEffect(()=>{r._updateDisabledField({disabled:i,fields:r._fields,name:t})},[i,t,r]),U.useMemo(()=>({field:d,formState:l,fieldState:u}),[d,l,u])}const C5n=n=>n.render(sct(n));var SOe=(n,e,t,i,r)=>e?{...t[n],types:{...t[n]&&t[n].types?t[n].types:{},[i]:r||!0}}:{},W0=()=>{const n=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=(Math.random()*16+n)%16|0;return(e=="x"?t:t&3|8).toString(16)})},zU=(n,e,t={})=>t.shouldFocus||io(t.shouldFocus)?t.focusName||`${n}.${io(t.focusIndex)?e:t.focusIndex}.`:"",dI=n=>({isOnSubmit:!n||n===Vh.onSubmit,isOnBlur:n===Vh.onBlur,isOnChange:n===Vh.onChange,isOnAll:n===Vh.all,isOnTouch:n===Vh.onTouched}),NY=(n,e,t)=>!t&&(e.watchAll||e.watch.has(n)||[...e.watch].some(i=>n.startsWith(i)&&/^\.\w+/.test(n.slice(i.length))));const nk=(n,e,t,i)=>{for(const r of t||Object.keys(n)){const s=Vt(n,r);if(s){const{_f:o,...a}=s;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],r)&&!i)return!0;if(o.ref&&e(o.ref,o.name)&&!i)return!0;if(nk(a,e))break}else if(Qo(a)&&nk(a,e))break}}};var kOe=(n,e,t)=>{const i=zu(Vt(n,t));return zr(i,"root",e[t]),zr(n,t,i),n},Xoe=n=>n.type==="file",yp=n=>typeof n=="function",h6=n=>{if(!Yoe)return!1;const e=n?n.ownerDocument:0;return n instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},IF=n=>Ep(n),Qoe=n=>n.type==="radio",f6=n=>n instanceof RegExp;const F0e={value:!1,isValid:!1},B0e={value:!0,isValid:!0};var EOe=n=>{if(Array.isArray(n)){if(n.length>1){const e=n.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:e,isValid:!!e.length}}return n[0].checked&&!n[0].disabled?n[0].attributes&&!io(n[0].attributes.value)?io(n[0].value)||n[0].value===""?B0e:{value:n[0].value,isValid:!0}:B0e:F0e}return F0e};const $0e={isValid:!1,value:null};var LOe=n=>Array.isArray(n)?n.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,$0e):$0e;function W0e(n,e,t="validate"){if(IF(n)||Array.isArray(n)&&n.every(IF)||Ph(n)&&!n)return{type:t,message:IF(n)?n:"",ref:e}}var ax=n=>Qo(n)&&!f6(n)?n:{value:n,message:""},RY=async(n,e,t,i,r,s)=>{const{ref:o,refs:a,required:l,maxLength:c,minLength:u,min:d,max:h,pattern:f,validate:g,name:p,valueAsNumber:m,mount:_}=n._f,v=Vt(t,p);if(!_||e.has(p))return{};const y=a?a[0]:o,C=B=>{r&&y.reportValidity&&(y.setCustomValidity(Ph(B)?"":B||""),y.reportValidity())},x={},k=Qoe(o),L=MP(o),D=k||L,I=(m||Xoe(o))&&io(o.value)&&io(v)||h6(o)&&o.value===""||v===""||Array.isArray(v)&&!v.length,O=SOe.bind(null,p,i,x),M=(B,G,W,z=Dm.maxLength,q=Dm.minLength)=>{const ee=B?G:W;x[p]={type:B?z:q,message:ee,ref:o,...O(B?z:q,ee)}};if(s?!Array.isArray(v)||!v.length:l&&(!D&&(I||Kc(v))||Ph(v)&&!v||L&&!EOe(a).isValid||k&&!LOe(a).isValid)){const{value:B,message:G}=IF(l)?{value:!!l,message:l}:ax(l);if(B&&(x[p]={type:Dm.required,message:G,ref:y,...O(Dm.required,G)},!i))return C(G),x}if(!I&&(!Kc(d)||!Kc(h))){let B,G;const W=ax(h),z=ax(d);if(!Kc(v)&&!isNaN(v)){const q=o.valueAsNumber||v&&+v;Kc(W.value)||(B=q>W.value),Kc(z.value)||(G=qnew Date(new Date().toDateString()+" "+te),Z=o.type=="time",j=o.type=="week";Ep(W.value)&&v&&(B=Z?ee(v)>ee(W.value):j?v>W.value:q>new Date(W.value)),Ep(z.value)&&v&&(G=Z?ee(v)+B.value,z=!Kc(G.value)&&v.length<+G.value;if((W||z)&&(M(W,B.message,G.message),!i))return C(x[p].message),x}if(f&&!I&&Ep(v)){const{value:B,message:G}=ax(f);if(f6(B)&&!v.match(B)&&(x[p]={type:Dm.pattern,message:G,ref:o,...O(Dm.pattern,G)},!i))return C(G),x}if(g){if(yp(g)){const B=await g(v,t),G=W0e(B,y);if(G&&(x[p]={...G,...O(Dm.validate,G.message)},!i))return C(G.message),x}else if(Qo(g)){let B={};for(const G in g){if(!zc(B)&&!i)break;const W=W0e(await g[G](v,t),y,G);W&&(B={...W,...O(G,W.message)},C(W.message),i&&(x[p]=B))}if(!zc(B)&&(x[p]={ref:y,...B},!i))return x}}return C(!0),x},UU=(n,e)=>[...n,...zu(e)],jU=n=>Array.isArray(n)?n.map(()=>{}):void 0;function qU(n,e,t){return[...n.slice(0,e),...zu(t),...n.slice(e)]}var KU=(n,e,t)=>Array.isArray(n)?(io(n[t])&&(n[t]=void 0),n.splice(t,0,n.splice(e,1)[0]),n):[],GU=(n,e)=>[...zu(e),...zu(n)];function oct(n,e){let t=0;const i=[...n];for(const r of e)i.splice(r-t,1),t++;return FP(i).length?i:[]}var YU=(n,e)=>io(e)?[]:oct(n,zu(e).sort((t,i)=>t-i)),ZU=(n,e,t)=>{[n[e],n[t]]=[n[t],n[e]]};function act(n,e){const t=e.slice(0,-1).length;let i=0;for(;i(n[e]=t,n);function x5n(n){const e=v$(),{control:t=e.control,name:i,keyName:r="id",shouldUnregister:s,rules:o}=n,[a,l]=U.useState(t._getFieldArray(i)),c=U.useRef(t._getFieldArray(i).map(W0)),u=U.useRef(a),d=U.useRef(i),h=U.useRef(!1);d.current=i,u.current=a,t._names.array.add(i),o&&t.register(i,o),b$({next:({values:k,name:L})=>{if(L===d.current||!L){const D=Vt(k,d.current);Array.isArray(D)&&(l(D),c.current=D.map(W0))}},subject:t._subjects.array});const f=U.useCallback(k=>{h.current=!0,t._updateFieldArray(i,k)},[t,i]),g=(k,L)=>{const D=zu(Fa(k)),I=UU(t._getFieldArray(i),D);t._names.focus=zU(i,I.length-1,L),c.current=UU(c.current,D.map(W0)),f(I),l(I),t._updateFieldArray(i,I,UU,{argA:jU(k)})},p=(k,L)=>{const D=zu(Fa(k)),I=GU(t._getFieldArray(i),D);t._names.focus=zU(i,0,L),c.current=GU(c.current,D.map(W0)),f(I),l(I),t._updateFieldArray(i,I,GU,{argA:jU(k)})},m=k=>{const L=YU(t._getFieldArray(i),k);c.current=YU(c.current,k),f(L),l(L),!Array.isArray(Vt(t._fields,i))&&zr(t._fields,i,void 0),t._updateFieldArray(i,L,YU,{argA:k})},_=(k,L,D)=>{const I=zu(Fa(L)),O=qU(t._getFieldArray(i),k,I);t._names.focus=zU(i,k,D),c.current=qU(c.current,k,I.map(W0)),f(O),l(O),t._updateFieldArray(i,O,qU,{argA:k,argB:jU(L)})},v=(k,L)=>{const D=t._getFieldArray(i);ZU(D,k,L),ZU(c.current,k,L),f(D),l(D),t._updateFieldArray(i,D,ZU,{argA:k,argB:L},!1)},y=(k,L)=>{const D=t._getFieldArray(i);KU(D,k,L),KU(c.current,k,L),f(D),l(D),t._updateFieldArray(i,D,KU,{argA:k,argB:L},!1)},C=(k,L)=>{const D=Fa(L),I=H0e(t._getFieldArray(i),k,D);c.current=[...I].map((O,M)=>!O||M===k?W0():c.current[M]),f(I),l([...I]),t._updateFieldArray(i,I,H0e,{argA:k,argB:D},!0,!1)},x=k=>{const L=zu(Fa(k));c.current=L.map(W0),f([...L]),l([...L]),t._updateFieldArray(i,[...L],D=>D,{},!0,!1)};return U.useEffect(()=>{if(t._state.action=!1,NY(i,t._names)&&t._subjects.state.next({...t._formState}),h.current&&(!dI(t._options.mode).isOnSubmit||t._formState.isSubmitted))if(t._options.resolver)t._executeSchema([i]).then(k=>{const L=Vt(k.errors,i),D=Vt(t._formState.errors,i);(D?!L&&D.type||L&&(D.type!==L.type||D.message!==L.message):L&&L.type)&&(L?zr(t._formState.errors,i,L):_a(t._formState.errors,i),t._subjects.state.next({errors:t._formState.errors}))});else{const k=Vt(t._fields,i);k&&k._f&&!(dI(t._options.reValidateMode).isOnSubmit&&dI(t._options.mode).isOnSubmit)&&RY(k,t._names.disabled,t._formValues,t._options.criteriaMode===Vh.all,t._options.shouldUseNativeValidation,!0).then(L=>!zc(L)&&t._subjects.state.next({errors:kOe(t._formState.errors,L,i)}))}t._subjects.values.next({name:i,values:{...t._formValues}}),t._names.focus&&nk(t._fields,(k,L)=>{if(t._names.focus&&L.startsWith(t._names.focus)&&k.focus)return k.focus(),1}),t._names.focus="",t._updateValid(),h.current=!1},[a,i,t]),U.useEffect(()=>(!Vt(t._formValues,i)&&t._updateFieldArray(i),()=>{(t._options.shouldUnregister||s)&&t.unregister(i)}),[i,t,r,s]),{swap:U.useCallback(v,[f,i,t]),move:U.useCallback(y,[f,i,t]),prepend:U.useCallback(p,[f,i,t]),append:U.useCallback(g,[f,i,t]),remove:U.useCallback(m,[f,i,t]),insert:U.useCallback(_,[f,i,t]),update:U.useCallback(C,[f,i,t]),replace:U.useCallback(x,[f,i,t]),fields:U.useMemo(()=>a.map((k,L)=>({...k,[r]:c.current[L]||W0()})),[a,r])}}var XU=()=>{let n=[];return{get observers(){return n},next:r=>{for(const s of n)s.next&&s.next(r)},subscribe:r=>(n.push(r),{unsubscribe:()=>{n=n.filter(s=>s!==r)}}),unsubscribe:()=>{n=[]}}},PY=n=>Kc(n)||!pOe(n);function dv(n,e){if(PY(n)||PY(e))return n===e;if(Ey(n)&&Ey(e))return n.getTime()===e.getTime();const t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(const r of t){const s=n[r];if(!i.includes(r))return!1;if(r!=="ref"){const o=e[r];if(Ey(s)&&Ey(o)||Qo(s)&&Qo(o)||Array.isArray(s)&&Array.isArray(o)?!dv(s,o):s!==o)return!1}}return!0}var TOe=n=>n.type==="select-multiple",cct=n=>Qoe(n)||MP(n),QU=n=>h6(n)&&n.isConnected,DOe=n=>{for(const e in n)if(yp(n[e]))return!0;return!1};function g6(n,e={}){const t=Array.isArray(n);if(Qo(n)||t)for(const i in n)Array.isArray(n[i])||Qo(n[i])&&!DOe(n[i])?(e[i]=Array.isArray(n[i])?[]:{},g6(n[i],e[i])):Kc(n[i])||(e[i]=!0);return e}function IOe(n,e,t){const i=Array.isArray(n);if(Qo(n)||i)for(const r in n)Array.isArray(n[r])||Qo(n[r])&&!DOe(n[r])?io(e)||PY(t[r])?t[r]=Array.isArray(n[r])?g6(n[r],[]):{...g6(n[r])}:IOe(n[r],Kc(e)?{}:e[r],t[r]):t[r]=!dv(n[r],e[r]);return t}var mT=(n,e)=>IOe(n,e,g6(e)),AOe=(n,{valueAsNumber:e,valueAsDate:t,setValueAs:i})=>io(n)?n:e?n===""?NaN:n&&+n:t&&Ep(n)?new Date(n):i?i(n):n;function JU(n){const e=n.ref;return Xoe(e)?e.files:Qoe(e)?LOe(n.refs).value:TOe(e)?[...e.selectedOptions].map(({value:t})=>t):MP(e)?EOe(n.refs).value:AOe(io(e.value)?n.ref.value:e.value,n)}var uct=(n,e,t,i)=>{const r={};for(const s of n){const o=Vt(e,s);o&&zr(r,s,o._f)}return{criteriaMode:t,names:[...n],fields:r,shouldUseNativeValidation:i}},_T=n=>io(n)?n:f6(n)?n.source:Qo(n)?f6(n.value)?n.value.source:n.value:n;const V0e="AsyncFunction";var dct=n=>!!n&&!!n.validate&&!!(yp(n.validate)&&n.validate.constructor.name===V0e||Qo(n.validate)&&Object.values(n.validate).find(e=>e.constructor.name===V0e)),hct=n=>n.mount&&(n.required||n.min||n.max||n.maxLength||n.minLength||n.pattern||n.validate);function z0e(n,e,t){const i=Vt(n,t);if(i||Zoe(t))return{error:i,name:t};const r=t.split(".");for(;r.length;){const s=r.join("."),o=Vt(e,s),a=Vt(n,s);if(o&&!Array.isArray(o)&&t!==s)return{name:t};if(a&&a.type)return{name:s,error:a};r.pop()}return{name:t}}var fct=(n,e,t,i,r)=>r.isOnAll?!1:!t&&r.isOnTouch?!(e||n):(t?i.isOnBlur:r.isOnBlur)?!n:(t?i.isOnChange:r.isOnChange)?n:!0,gct=(n,e)=>!FP(Vt(n,e)).length&&_a(n,e);const pct={mode:Vh.onSubmit,reValidateMode:Vh.onChange,shouldFocusError:!0};function mct(n={}){let e={...pct,...n},t={submitCount:0,isDirty:!1,isLoading:yp(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},i={},r=Qo(e.defaultValues)||Qo(e.values)?Fa(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:Fa(r),o={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:XU(),array:XU(),state:XU()},h=dI(e.mode),f=dI(e.reValidateMode),g=e.criteriaMode===Vh.all,p=ye=>Ie=>{clearTimeout(c),c=setTimeout(ye,Ie)},m=async ye=>{if(!e.disabled&&(u.isValid||ye)){const Ie=e.resolver?zc((await D()).errors):await O(i,!0);Ie!==t.isValid&&d.state.next({isValid:Ie})}},_=(ye,Ie)=>{!e.disabled&&(u.isValidating||u.validatingFields)&&((ye||Array.from(a.mount)).forEach(Ve=>{Ve&&(Ie?zr(t.validatingFields,Ve,Ie):_a(t.validatingFields,Ve))}),d.state.next({validatingFields:t.validatingFields,isValidating:!zc(t.validatingFields)}))},v=(ye,Ie=[],Ve,wt,vt=!0,nt=!0)=>{if(wt&&Ve&&!e.disabled){if(o.action=!0,nt&&Array.isArray(Vt(i,ye))){const $t=Ve(Vt(i,ye),wt.argA,wt.argB);vt&&zr(i,ye,$t)}if(nt&&Array.isArray(Vt(t.errors,ye))){const $t=Ve(Vt(t.errors,ye),wt.argA,wt.argB);vt&&zr(t.errors,ye,$t),gct(t.errors,ye)}if(u.touchedFields&&nt&&Array.isArray(Vt(t.touchedFields,ye))){const $t=Ve(Vt(t.touchedFields,ye),wt.argA,wt.argB);vt&&zr(t.touchedFields,ye,$t)}u.dirtyFields&&(t.dirtyFields=mT(r,s)),d.state.next({name:ye,isDirty:B(ye,Ie),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else zr(s,ye,Ie)},y=(ye,Ie)=>{zr(t.errors,ye,Ie),d.state.next({errors:t.errors})},C=ye=>{t.errors=ye,d.state.next({errors:t.errors,isValid:!1})},x=(ye,Ie,Ve,wt)=>{const vt=Vt(i,ye);if(vt){const nt=Vt(s,ye,io(Ve)?Vt(r,ye):Ve);io(nt)||wt&&wt.defaultChecked||Ie?zr(s,ye,Ie?nt:JU(vt._f)):z(ye,nt),o.mount&&m()}},k=(ye,Ie,Ve,wt,vt)=>{let nt=!1,$t=!1;const an={name:ye};if(!e.disabled){const Pi=!!(Vt(i,ye)&&Vt(i,ye)._f&&Vt(i,ye)._f.disabled);if(!Ve||wt){u.isDirty&&($t=t.isDirty,t.isDirty=an.isDirty=B(),nt=$t!==an.isDirty);const Xn=Pi||dv(Vt(r,ye),Ie);$t=!!(!Pi&&Vt(t.dirtyFields,ye)),Xn||Pi?_a(t.dirtyFields,ye):zr(t.dirtyFields,ye,!0),an.dirtyFields=t.dirtyFields,nt=nt||u.dirtyFields&&$t!==!Xn}if(Ve){const Xn=Vt(t.touchedFields,ye);Xn||(zr(t.touchedFields,ye,Ve),an.touchedFields=t.touchedFields,nt=nt||u.touchedFields&&Xn!==Ve)}nt&&vt&&d.state.next(an)}return nt?an:{}},L=(ye,Ie,Ve,wt)=>{const vt=Vt(t.errors,ye),nt=u.isValid&&Ph(Ie)&&t.isValid!==Ie;if(e.delayError&&Ve?(l=p(()=>y(ye,Ve)),l(e.delayError)):(clearTimeout(c),l=null,Ve?zr(t.errors,ye,Ve):_a(t.errors,ye)),(Ve?!dv(vt,Ve):vt)||!zc(wt)||nt){const $t={...wt,...nt&&Ph(Ie)?{isValid:Ie}:{},errors:t.errors,name:ye};t={...t,...$t},d.state.next($t)}},D=async ye=>{_(ye,!0);const Ie=await e.resolver(s,e.context,uct(ye||a.mount,i,e.criteriaMode,e.shouldUseNativeValidation));return _(ye),Ie},I=async ye=>{const{errors:Ie}=await D(ye);if(ye)for(const Ve of ye){const wt=Vt(Ie,Ve);wt?zr(t.errors,Ve,wt):_a(t.errors,Ve)}else t.errors=Ie;return Ie},O=async(ye,Ie,Ve={valid:!0})=>{for(const wt in ye){const vt=ye[wt];if(vt){const{_f:nt,...$t}=vt;if(nt){const an=a.array.has(nt.name),Pi=vt._f&&dct(vt._f);Pi&&u.validatingFields&&_([wt],!0);const Xn=await RY(vt,a.disabled,s,g,e.shouldUseNativeValidation&&!Ie,an);if(Pi&&u.validatingFields&&_([wt]),Xn[nt.name]&&(Ve.valid=!1,Ie))break;!Ie&&(Vt(Xn,nt.name)?an?kOe(t.errors,Xn,nt.name):zr(t.errors,nt.name,Xn[nt.name]):_a(t.errors,nt.name))}!zc($t)&&await O($t,Ie,Ve)}}return Ve.valid},M=()=>{for(const ye of a.unMount){const Ie=Vt(i,ye);Ie&&(Ie._f.refs?Ie._f.refs.every(Ve=>!QU(Ve)):!QU(Ie._f.ref))&&Me(ye)}a.unMount=new Set},B=(ye,Ie)=>!e.disabled&&(ye&&Ie&&zr(s,ye,Ie),!dv(le(),r)),G=(ye,Ie,Ve)=>xOe(ye,a,{...o.mount?s:io(Ie)?r:Ep(ye)?{[ye]:Ie}:Ie},Ve,Ie),W=ye=>FP(Vt(o.mount?s:r,ye,e.shouldUnregister?Vt(r,ye,[]):[])),z=(ye,Ie,Ve={})=>{const wt=Vt(i,ye);let vt=Ie;if(wt){const nt=wt._f;nt&&(!nt.disabled&&zr(s,ye,AOe(Ie,nt)),vt=h6(nt.ref)&&Kc(Ie)?"":Ie,TOe(nt.ref)?[...nt.ref.options].forEach($t=>$t.selected=vt.includes($t.value)):nt.refs?MP(nt.ref)?nt.refs.length>1?nt.refs.forEach($t=>(!$t.defaultChecked||!$t.disabled)&&($t.checked=Array.isArray(vt)?!!vt.find(an=>an===$t.value):vt===$t.value)):nt.refs[0]&&(nt.refs[0].checked=!!vt):nt.refs.forEach($t=>$t.checked=$t.value===vt):Xoe(nt.ref)?nt.ref.value="":(nt.ref.value=vt,nt.ref.type||d.values.next({name:ye,values:{...s}})))}(Ve.shouldDirty||Ve.shouldTouch)&&k(ye,vt,Ve.shouldTouch,Ve.shouldDirty,!0),Ve.shouldValidate&&te(ye)},q=(ye,Ie,Ve)=>{for(const wt in Ie){const vt=Ie[wt],nt=`${ye}.${wt}`,$t=Vt(i,nt);(a.array.has(ye)||Qo(vt)||$t&&!$t._f)&&!Ey(vt)?q(nt,vt,Ve):z(nt,vt,Ve)}},ee=(ye,Ie,Ve={})=>{const wt=Vt(i,ye),vt=a.array.has(ye),nt=Fa(Ie);zr(s,ye,nt),vt?(d.array.next({name:ye,values:{...s}}),(u.isDirty||u.dirtyFields)&&Ve.shouldDirty&&d.state.next({name:ye,dirtyFields:mT(r,s),isDirty:B(ye,nt)})):wt&&!wt._f&&!Kc(nt)?q(ye,nt,Ve):z(ye,nt,Ve),NY(ye,a)&&d.state.next({...t}),d.values.next({name:o.mount?ye:void 0,values:{...s}})},Z=async ye=>{o.mount=!0;const Ie=ye.target;let Ve=Ie.name,wt=!0;const vt=Vt(i,Ve),nt=()=>Ie.type?JU(vt._f):mOe(ye),$t=an=>{wt=Number.isNaN(an)||Ey(an)&&isNaN(an.getTime())||dv(an,Vt(s,Ve,an))};if(vt){let an,Pi;const Xn=nt(),Qi=ye.type===d6.BLUR||ye.type===d6.FOCUS_OUT,qs=!hct(vt._f)&&!e.resolver&&!Vt(t.errors,Ve)&&!vt._f.deps||fct(Qi,Vt(t.touchedFields,Ve),t.isSubmitted,f,h),Pr=NY(Ve,a,Qi);zr(s,Ve,Xn),Qi?(vt._f.onBlur&&vt._f.onBlur(ye),l&&l(0)):vt._f.onChange&&vt._f.onChange(ye);const Or=k(Ve,Xn,Qi,!1),cr=!zc(Or)||Pr;if(!Qi&&d.values.next({name:Ve,type:ye.type,values:{...s}}),qs)return u.isValid&&(e.mode==="onBlur"&&Qi?m():Qi||m()),cr&&d.state.next({name:Ve,...Pr?{}:Or});if(!Qi&&Pr&&d.state.next({...t}),e.resolver){const{errors:us}=await D([Ve]);if($t(Xn),wt){const qi=z0e(t.errors,i,Ve),Er=z0e(us,i,qi.name||Ve);an=Er.error,Ve=Er.name,Pi=zc(us)}}else _([Ve],!0),an=(await RY(vt,a.disabled,s,g,e.shouldUseNativeValidation))[Ve],_([Ve]),$t(Xn),wt&&(an?Pi=!1:u.isValid&&(Pi=await O(i,!0)));wt&&(vt._f.deps&&te(vt._f.deps),L(Ve,Pi,an,Or))}},j=(ye,Ie)=>{if(Vt(t.errors,Ie)&&ye.focus)return ye.focus(),1},te=async(ye,Ie={})=>{let Ve,wt;const vt=zu(ye);if(e.resolver){const nt=await I(io(ye)?ye:vt);Ve=zc(nt),wt=ye?!vt.some($t=>Vt(nt,$t)):Ve}else ye?(wt=(await Promise.all(vt.map(async nt=>{const $t=Vt(i,nt);return await O($t&&$t._f?{[nt]:$t}:$t)}))).every(Boolean),!(!wt&&!t.isValid)&&m()):wt=Ve=await O(i);return d.state.next({...!Ep(ye)||u.isValid&&Ve!==t.isValid?{}:{name:ye},...e.resolver||!ye?{isValid:Ve}:{},errors:t.errors}),Ie.shouldFocus&&!wt&&nk(i,j,ye?vt:a.mount),wt},le=ye=>{const Ie={...o.mount?s:r};return io(ye)?Ie:Ep(ye)?Vt(Ie,ye):ye.map(Ve=>Vt(Ie,Ve))},ue=(ye,Ie)=>({invalid:!!Vt((Ie||t).errors,ye),isDirty:!!Vt((Ie||t).dirtyFields,ye),error:Vt((Ie||t).errors,ye),isValidating:!!Vt(t.validatingFields,ye),isTouched:!!Vt((Ie||t).touchedFields,ye)}),de=ye=>{ye&&zu(ye).forEach(Ie=>_a(t.errors,Ie)),d.state.next({errors:ye?t.errors:{}})},we=(ye,Ie,Ve)=>{const wt=(Vt(i,ye,{_f:{}})._f||{}).ref,vt=Vt(t.errors,ye)||{},{ref:nt,message:$t,type:an,...Pi}=vt;zr(t.errors,ye,{...Pi,...Ie,ref:wt}),d.state.next({name:ye,errors:t.errors,isValid:!1}),Ve&&Ve.shouldFocus&&wt&&wt.focus&&wt.focus()},xe=(ye,Ie)=>yp(ye)?d.values.subscribe({next:Ve=>ye(G(void 0,Ie),Ve)}):G(ye,Ie,!0),Me=(ye,Ie={})=>{for(const Ve of ye?zu(ye):a.mount)a.mount.delete(Ve),a.array.delete(Ve),Ie.keepValue||(_a(i,Ve),_a(s,Ve)),!Ie.keepError&&_a(t.errors,Ve),!Ie.keepDirty&&_a(t.dirtyFields,Ve),!Ie.keepTouched&&_a(t.touchedFields,Ve),!Ie.keepIsValidating&&_a(t.validatingFields,Ve),!e.shouldUnregister&&!Ie.keepDefaultValue&&_a(r,Ve);d.values.next({values:{...s}}),d.state.next({...t,...Ie.keepDirty?{isDirty:B()}:{}}),!Ie.keepIsValid&&m()},Re=({disabled:ye,name:Ie,field:Ve,fields:wt})=>{(Ph(ye)&&o.mount||ye||a.disabled.has(Ie))&&(ye?a.disabled.add(Ie):a.disabled.delete(Ie),k(Ie,JU(Ve?Ve._f:Vt(wt,Ie)._f),!1,!1,!0))},_t=(ye,Ie={})=>{let Ve=Vt(i,ye);const wt=Ph(Ie.disabled)||Ph(e.disabled);return zr(i,ye,{...Ve||{},_f:{...Ve&&Ve._f?Ve._f:{ref:{name:ye}},name:ye,mount:!0,...Ie}}),a.mount.add(ye),Ve?Re({field:Ve,disabled:Ph(Ie.disabled)?Ie.disabled:e.disabled,name:ye}):x(ye,!0,Ie.value),{...wt?{disabled:Ie.disabled||e.disabled}:{},...e.progressive?{required:!!Ie.required,min:_T(Ie.min),max:_T(Ie.max),minLength:_T(Ie.minLength),maxLength:_T(Ie.maxLength),pattern:_T(Ie.pattern)}:{},name:ye,onChange:Z,onBlur:Z,ref:vt=>{if(vt){_t(ye,Ie),Ve=Vt(i,ye);const nt=io(vt.value)&&vt.querySelectorAll&&vt.querySelectorAll("input,select,textarea")[0]||vt,$t=cct(nt),an=Ve._f.refs||[];if($t?an.find(Pi=>Pi===nt):nt===Ve._f.ref)return;zr(i,ye,{_f:{...Ve._f,...$t?{refs:[...an.filter(QU),nt,...Array.isArray(Vt(r,ye))?[{}]:[]],ref:{type:nt.type,name:ye}}:{ref:nt}}}),x(ye,!1,void 0,nt)}else Ve=Vt(i,ye,{}),Ve._f&&(Ve._f.mount=!1),(e.shouldUnregister||Ie.shouldUnregister)&&!(_Oe(a.array,ye)&&o.action)&&a.unMount.add(ye)}}},Qe=()=>e.shouldFocusError&&nk(i,j,a.mount),pt=ye=>{Ph(ye)&&(d.state.next({disabled:ye}),nk(i,(Ie,Ve)=>{const wt=Vt(i,Ve);wt&&(Ie.disabled=wt._f.disabled||ye,Array.isArray(wt._f.refs)&&wt._f.refs.forEach(vt=>{vt.disabled=wt._f.disabled||ye}))},0,!1))},gt=(ye,Ie)=>async Ve=>{let wt;Ve&&(Ve.preventDefault&&Ve.preventDefault(),Ve.persist&&Ve.persist());let vt=Fa(s);if(a.disabled.size)for(const nt of a.disabled)zr(vt,nt,void 0);if(d.state.next({isSubmitting:!0}),e.resolver){const{errors:nt,values:$t}=await D();t.errors=nt,vt=$t}else await O(i);if(_a(t.errors,"root"),zc(t.errors)){d.state.next({errors:{}});try{await ye(vt,Ve)}catch(nt){wt=nt}}else Ie&&await Ie({...t.errors},Ve),Qe(),setTimeout(Qe);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:zc(t.errors)&&!wt,submitCount:t.submitCount+1,errors:t.errors}),wt)throw wt},Ue=(ye,Ie={})=>{Vt(i,ye)&&(io(Ie.defaultValue)?ee(ye,Fa(Vt(r,ye))):(ee(ye,Ie.defaultValue),zr(r,ye,Fa(Ie.defaultValue))),Ie.keepTouched||_a(t.touchedFields,ye),Ie.keepDirty||(_a(t.dirtyFields,ye),t.isDirty=Ie.defaultValue?B(ye,Fa(Vt(r,ye))):B()),Ie.keepError||(_a(t.errors,ye),u.isValid&&m()),d.state.next({...t}))},wn=(ye,Ie={})=>{const Ve=ye?Fa(ye):r,wt=Fa(Ve),vt=zc(ye),nt=vt?r:wt;if(Ie.keepDefaultValues||(r=Ve),!Ie.keepValues){if(Ie.keepDirtyValues){const $t=new Set([...a.mount,...Object.keys(mT(r,s))]);for(const an of Array.from($t))Vt(t.dirtyFields,an)?zr(nt,an,Vt(s,an)):ee(an,Vt(nt,an))}else{if(Yoe&&io(ye))for(const $t of a.mount){const an=Vt(i,$t);if(an&&an._f){const Pi=Array.isArray(an._f.refs)?an._f.refs[0]:an._f.ref;if(h6(Pi)){const Xn=Pi.closest("form");if(Xn){Xn.reset();break}}}}i={}}s=e.shouldUnregister?Ie.keepDefaultValues?Fa(r):{}:Fa(nt),d.array.next({values:{...nt}}),d.values.next({values:{...nt}})}a={mount:Ie.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!u.isValid||!!Ie.keepIsValid||!!Ie.keepDirtyValues,o.watch=!!e.shouldUnregister,d.state.next({submitCount:Ie.keepSubmitCount?t.submitCount:0,isDirty:vt?!1:Ie.keepDirty?t.isDirty:!!(Ie.keepDefaultValues&&!dv(ye,r)),isSubmitted:Ie.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:vt?{}:Ie.keepDirtyValues?Ie.keepDefaultValues&&s?mT(r,s):t.dirtyFields:Ie.keepDefaultValues&&ye?mT(r,ye):Ie.keepDirty?t.dirtyFields:{},touchedFields:Ie.keepTouched?t.touchedFields:{},errors:Ie.keepErrors?t.errors:{},isSubmitSuccessful:Ie.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},Xt=(ye,Ie)=>wn(yp(ye)?ye(s):ye,Ie);return{control:{register:_t,unregister:Me,getFieldState:ue,handleSubmit:gt,setError:we,_executeSchema:D,_getWatch:G,_getDirty:B,_updateValid:m,_removeUnmounted:M,_updateFieldArray:v,_updateDisabledField:Re,_getFieldArray:W,_reset:wn,_resetDefaultValues:()=>yp(e.defaultValues)&&e.defaultValues().then(ye=>{Xt(ye,e.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:ye=>{t={...t,...ye}},_disableForm:pt,_subjects:d,_proxyFormState:u,_setErrors:C,get _fields(){return i},get _formValues(){return s},get _state(){return o},set _state(ye){o=ye},get _defaultValues(){return r},get _names(){return a},set _names(ye){a=ye},get _formState(){return t},set _formState(ye){t=ye},get _options(){return e},set _options(ye){e={...e,...ye}}},trigger:te,register:_t,handleSubmit:gt,watch:xe,setValue:ee,getValues:le,reset:Xt,resetField:Ue,clearErrors:de,unregister:Me,setError:we,setFocus:(ye,Ie={})=>{const Ve=Vt(i,ye),wt=Ve&&Ve._f;if(wt){const vt=wt.refs?wt.refs[0]:wt.ref;vt.focus&&(vt.focus(),Ie.shouldSelect&&yp(vt.select)&&vt.select())}},getFieldState:ue}}function S5n(n={}){const e=U.useRef(void 0),t=U.useRef(void 0),[i,r]=U.useState({isDirty:!1,isValidating:!1,isLoading:yp(n.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1,defaultValues:yp(n.defaultValues)?void 0:n.defaultValues});e.current||(e.current={...mct(n),formState:i});const s=e.current.control;return s._options=n,b$({subject:s._subjects.state,next:o=>{wOe(o,s._proxyFormState,s._updateFormState,!0)&&r({...s._formState})}}),U.useEffect(()=>s._disableForm(n.disabled),[s,n.disabled]),U.useEffect(()=>{if(s._proxyFormState.isDirty){const o=s._getDirty();o!==i.isDirty&&s._subjects.state.next({isDirty:o})}},[s,i.isDirty]),U.useEffect(()=>{n.values&&!dv(n.values,t.current)?(s._reset(n.values,s._options.resetOptions),t.current=n.values,r(o=>({...o}))):s._resetDefaultValues()},[n.values,s]),U.useEffect(()=>{n.errors&&s._setErrors(n.errors)},[n.errors,s]),U.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),U.useEffect(()=>{n.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[n.shouldUnregister,s]),e.current.formState=yOe(i,s),e.current}const U0e=(n,e,t)=>{if(n&&"reportValidity"in n){const i=Vt(t,e);n.setCustomValidity(i&&i.message||""),n.reportValidity()}},NOe=(n,e)=>{for(const t in e.fields){const i=e.fields[t];i&&i.ref&&"reportValidity"in i.ref?U0e(i.ref,t,n):i.refs&&i.refs.forEach(r=>U0e(r,t,n))}},_ct=(n,e)=>{e.shouldUseNativeValidation&&NOe(n,e);const t={};for(const i in n){const r=Vt(e.fields,i),s=Object.assign(n[i]||{},{ref:r&&r.ref});if(vct(e.names||Object.keys(n),i)){const o=Object.assign({},Vt(t,i));zr(o,"root",s),zr(t,i,o)}else zr(t,i,s)}return t},vct=(n,e)=>n.some(t=>t.startsWith(e+"."));var bct=function(n,e){for(var t={};n.length;){var i=n[0],r=i.code,s=i.message,o=i.path.join(".");if(!t[o])if("unionErrors"in i){var a=i.unionErrors[0].errors[0];t[o]={message:a.message,type:a.code}}else t[o]={message:s,type:r};if("unionErrors"in i&&i.unionErrors.forEach(function(u){return u.errors.forEach(function(d){return n.push(d)})}),e){var l=t[o].types,c=l&&l[i.code];t[o]=SOe(o,e,t,r,c?[].concat(c,i.message):i.message)}n.shift()}return t},k5n=function(n,e,t){return t===void 0&&(t={}),function(i,r,s){try{return Promise.resolve(function(o,a){try{var l=Promise.resolve(n[t.mode==="sync"?"parse":"parseAsync"](i,e)).then(function(c){return s.shouldUseNativeValidation&&NOe({},s),{errors:{},values:t.raw?i:c}})}catch(c){return a(c)}return l&&l.then?l.then(void 0,a):l}(0,function(o){if(function(a){return Array.isArray(a?.errors)}(o))return{values:{},errors:_ct(bct(o.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw o}))}catch(o){return Promise.reject(o)}}},Ir;(function(n){n.assertEqual=r=>r;function e(r){}n.assertIs=e;function t(r){throw new Error}n.assertNever=t,n.arrayToEnum=r=>{const s={};for(const o of r)s[o]=o;return s},n.getValidEnumValues=r=>{const s=n.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(const a of s)o[a]=r[a];return n.objectValues(o)},n.objectValues=r=>n.objectKeys(r).map(function(s){return r[s]}),n.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const s=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&s.push(o);return s},n.find=(r,s)=>{for(const o of r)if(s(o))return o},n.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}n.joinValues=i,n.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(Ir||(Ir={}));var OY;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(OY||(OY={}));const cn=Ir.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xm=n=>{switch(typeof n){case"undefined":return cn.undefined;case"string":return cn.string;case"number":return isNaN(n)?cn.nan:cn.number;case"boolean":return cn.boolean;case"function":return cn.function;case"bigint":return cn.bigint;case"symbol":return cn.symbol;case"object":return Array.isArray(n)?cn.array:n===null?cn.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?cn.promise:typeof Map<"u"&&n instanceof Map?cn.map:typeof Set<"u"&&n instanceof Set?cn.set:typeof Date<"u"&&n instanceof Date?cn.date:cn.object;default:return cn.unknown}},Dt=Ir.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"]),yct=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class zd extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(s){return s.message},i={_errors:[]},r=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)i._errors.push(t(o));else{let a=i,l=0;for(;lt.message){const t={},i=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):i.push(e(r));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}zd.create=n=>new zd(n);const Qk=(n,e)=>{let t;switch(n.code){case Dt.invalid_type:n.received===cn.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case Dt.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,Ir.jsonStringifyReplacer)}`;break;case Dt.unrecognized_keys:t=`Unrecognized key(s) in object: ${Ir.joinValues(n.keys,", ")}`;break;case Dt.invalid_union:t="Invalid input";break;case Dt.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Ir.joinValues(n.options)}`;break;case Dt.invalid_enum_value:t=`Invalid enum value. Expected ${Ir.joinValues(n.options)}, received '${n.received}'`;break;case Dt.invalid_arguments:t="Invalid function arguments";break;case Dt.invalid_return_type:t="Invalid function return type";break;case Dt.invalid_date:t="Invalid date";break;case Dt.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:Ir.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case Dt.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case Dt.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case Dt.custom:t="Invalid input";break;case Dt.invalid_intersection_types:t="Intersection results could not be merged";break;case Dt.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case Dt.not_finite:t="Number must be finite";break;default:t=e.defaultError,Ir.assertNever(n)}return{message:t}};let ROe=Qk;function wct(n){ROe=n}function p6(){return ROe}const m6=n=>{const{data:e,path:t,errorMaps:i,issueData:r}=n,s=[...t,...r.path||[]],o={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let a="";const l=i.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...r,path:s,message:a}},Cct=[];function Jt(n,e){const t=p6(),i=m6({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Qk?void 0:Qk].filter(r=>!!r)});n.common.issues.push(i)}class Ec{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const r of t){if(r.status==="aborted")return di;r.status==="dirty"&&e.dirty(),i.push(r.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const r of t){const s=await r.key,o=await r.value;i.push({key:s,value:o})}return Ec.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const r of t){const{key:s,value:o}=r;if(s.status==="aborted"||o.status==="aborted")return di;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(i[s.value]=o.value)}return{status:e.value,value:i}}}const di=Object.freeze({status:"aborted"}),pS=n=>({status:"dirty",value:n}),cu=n=>({status:"valid",value:n}),MY=n=>n.status==="aborted",FY=n=>n.status==="dirty",yw=n=>n.status==="valid",FA=n=>typeof Promise<"u"&&n instanceof Promise;function _6(n,e,t,i){if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function POe(n,e,t,i,r){if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var Tn;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Tn||(Tn={}));var yD,wD;class jp{constructor(e,t,i,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const j0e=(n,e)=>{if(yw(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new zd(n.common.issues);return this._error=t,this._error}}};function $i(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:i,description:r}=n;if(e&&(t||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,a)=>{var l,c;const{message:u}=n;return o.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??i)!==null&&l!==void 0?l:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??t)!==null&&c!==void 0?c:a.defaultError}},description:r}}class Gi{get description(){return this._def.description}_getType(e){return Xm(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Xm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ec,ctx:{common:e.parent.common,data:e.data,parsedType:Xm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(FA(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){var i;const r={common:{issues:[],async:(i=t?.async)!==null&&i!==void 0?i:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xm(e)},s=this._parseSync({data:e,path:r.path,parent:r});return j0e(r,s)}"~validate"(e){var t,i;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xm(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:r});return yw(s)?{value:s.value}:{issues:r.common.issues}}catch(s){!((i=(t=s?.message)===null||t===void 0?void 0:t.toLowerCase())===null||i===void 0)&&i.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>yw(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xm(e)},r=this._parse({data:e,path:i.path,parent:i}),s=await(FA(r)?r:Promise.resolve(r));return j0e(i,s)}refine(e,t){const i=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,s)=>{const o=e(r),a=()=>s.addIssue({code:Dt.custom,...i(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((i,r)=>e(i)?!0:(r.addIssue(typeof t=="function"?t(i,r):t),!1))}_refinement(e){return new xg({schema:this,typeName:li.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:t=>this["~validate"](t)}}optional(){return Fp.create(this,this._def)}nullable(){return bb.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dg.create(this)}promise(){return eE.create(this,this._def)}or(e){return HA.create([this,e],this._def)}and(e){return VA.create(this,e,this._def)}transform(e){return new xg({...$i(this._def),schema:this,typeName:li.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new KA({...$i(this._def),innerType:this,defaultValue:t,typeName:li.ZodDefault})}brand(){return new Joe({typeName:li.ZodBranded,type:this,...$i(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new GA({...$i(this._def),innerType:this,catchValue:t,typeName:li.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return BP.create(this,e)}readonly(){return YA.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xct=/^c[^\s-]{8,}$/i,Sct=/^[0-9a-z]+$/,kct=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ect=/^[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,Lct=/^[a-z0-9_-]{21}$/i,Tct=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Dct=/^[-+]?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)?)??$/,Ict=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Act="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ej;const Nct=/^(?:(?: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])$/,Rct=/^(?:(?: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])$/,Pct=/^(([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]))$/,Oct=/^(([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])$/,Mct=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fct=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OOe="((\\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])))",Bct=new RegExp(`^${OOe}$`);function MOe(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function $ct(n){return new RegExp(`^${MOe(n)}$`)}function FOe(n){let e=`${OOe}T${MOe(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Wct(n,e){return!!((e==="v4"||!e)&&Nct.test(n)||(e==="v6"||!e)&&Pct.test(n))}function Hct(n,e){if(!Tct.test(n))return!1;try{const[t]=n.split("."),i=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||!r.typ||!r.alg||e&&r.alg!==e)}catch{return!1}}function Vct(n,e){return!!((e==="v4"||!e)&&Rct.test(n)||(e==="v6"||!e)&&Oct.test(n))}class ig extends Gi{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==cn.string){const s=this._getOrReturnCtx(e);return Jt(s,{code:Dt.invalid_type,expected:cn.string,received:s.parsedType}),di}const i=new Ec;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(r=this._getOrReturnCtx(e,r),Jt(r,{code:Dt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,a=e.data.lengthe.test(r),{validation:t,code:Dt.invalid_string,...Tn.errToObj(i)})}_addCheck(e){return new ig({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Tn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Tn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Tn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Tn.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Tn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Tn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Tn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Tn.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Tn.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Tn.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Tn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Tn.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Tn.errToObj(e)})}datetime(e){var t,i;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:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(i=e?.local)!==null&&i!==void 0?i:!1,...Tn.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,...Tn.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Tn.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Tn.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Tn.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Tn.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Tn.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Tn.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Tn.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Tn.errToObj(t)})}nonempty(e){return this.min(1,Tn.errToObj(e))}trim(){return new ig({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ig({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ig({...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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new ig({checks:[],typeName:li.ZodString,coerce:(e=n?.coerce)!==null&&e!==void 0?e:!1,...$i(n)})};function zct(n,e){const t=(n.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=t>i?t:i,s=parseInt(n.toFixed(r).replace(".","")),o=parseInt(e.toFixed(r).replace(".",""));return s%o/Math.pow(10,r)}class mb extends Gi{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)!==cn.number){const s=this._getOrReturnCtx(e);return Jt(s,{code:Dt.invalid_type,expected:cn.number,received:s.parsedType}),di}let i;const r=new Ec;for(const s of this._def.checks)s.kind==="int"?Ir.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?zct(e.data,s.value)!==0&&(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.not_finite,message:s.message}),r.dirty()):Ir.assertNever(s);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Tn.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Tn.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Tn.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Tn.toString(t))}setLimit(e,t,i,r){return new mb({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Tn.toString(r)}]})}_addCheck(e){return new mb({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Tn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Tn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Tn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Tn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Tn.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Tn.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Tn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Tn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Tn.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&Ir.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(t===null||i.value>t)&&(t=i.value):i.kind==="max"&&(e===null||i.valuenew mb({checks:[],typeName:li.ZodNumber,coerce:n?.coerce||!1,...$i(n)});class _b extends Gi{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)!==cn.bigint)return this._getInvalidInput(e);let i;const r=new Ec;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):Ir.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Jt(t,{code:Dt.invalid_type,expected:cn.bigint,received:t.parsedType}),di}gte(e,t){return this.setLimit("min",e,!0,Tn.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Tn.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Tn.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Tn.toString(t))}setLimit(e,t,i,r){return new _b({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Tn.toString(r)}]})}_addCheck(e){return new _b({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Tn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Tn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Tn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Tn.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Tn.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new _b({checks:[],typeName:li.ZodBigInt,coerce:(e=n?.coerce)!==null&&e!==void 0?e:!1,...$i(n)})};class BA extends Gi{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==cn.boolean){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.boolean,received:i.parsedType}),di}return cu(e.data)}}BA.create=n=>new BA({typeName:li.ZodBoolean,coerce:n?.coerce||!1,...$i(n)});class ww extends Gi{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==cn.date){const s=this._getOrReturnCtx(e);return Jt(s,{code:Dt.invalid_type,expected:cn.date,received:s.parsedType}),di}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Jt(s,{code:Dt.invalid_date}),di}const i=new Ec;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(r=this._getOrReturnCtx(e,r),Jt(r,{code:Dt.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):Ir.assertNever(s);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ww({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Tn.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Tn.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew ww({checks:[],coerce:n?.coerce||!1,typeName:li.ZodDate,...$i(n)});class v6 extends Gi{_parse(e){if(this._getType(e)!==cn.symbol){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.symbol,received:i.parsedType}),di}return cu(e.data)}}v6.create=n=>new v6({typeName:li.ZodSymbol,...$i(n)});class $A extends Gi{_parse(e){if(this._getType(e)!==cn.undefined){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.undefined,received:i.parsedType}),di}return cu(e.data)}}$A.create=n=>new $A({typeName:li.ZodUndefined,...$i(n)});class WA extends Gi{_parse(e){if(this._getType(e)!==cn.null){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.null,received:i.parsedType}),di}return cu(e.data)}}WA.create=n=>new WA({typeName:li.ZodNull,...$i(n)});class Jk extends Gi{constructor(){super(...arguments),this._any=!0}_parse(e){return cu(e.data)}}Jk.create=n=>new Jk({typeName:li.ZodAny,...$i(n)});class Uy extends Gi{constructor(){super(...arguments),this._unknown=!0}_parse(e){return cu(e.data)}}Uy.create=n=>new Uy({typeName:li.ZodUnknown,...$i(n)});class U_ extends Gi{_parse(e){const t=this._getOrReturnCtx(e);return Jt(t,{code:Dt.invalid_type,expected:cn.never,received:t.parsedType}),di}}U_.create=n=>new U_({typeName:li.ZodNever,...$i(n)});class b6 extends Gi{_parse(e){if(this._getType(e)!==cn.undefined){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.void,received:i.parsedType}),di}return cu(e.data)}}b6.create=n=>new b6({typeName:li.ZodVoid,...$i(n)});class dg extends Gi{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),r=this._def;if(t.parsedType!==cn.array)return Jt(t,{code:Dt.invalid_type,expected:cn.array,received:t.parsedType}),di;if(r.exactLength!==null){const o=t.data.length>r.exactLength.value,a=t.data.lengthr.maxLength.value&&(Jt(t,{code:Dt.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>r.type._parseAsync(new jp(t,o,t.path,a)))).then(o=>Ec.mergeArray(i,o));const s=[...t.data].map((o,a)=>r.type._parseSync(new jp(t,o,t.path,a)));return Ec.mergeArray(i,s)}get element(){return this._def.type}min(e,t){return new dg({...this._def,minLength:{value:e,message:Tn.toString(t)}})}max(e,t){return new dg({...this._def,maxLength:{value:e,message:Tn.toString(t)}})}length(e,t){return new dg({...this._def,exactLength:{value:e,message:Tn.toString(t)}})}nonempty(e){return this.min(1,e)}}dg.create=(n,e)=>new dg({type:n,minLength:null,maxLength:null,exactLength:null,typeName:li.ZodArray,...$i(e)});function Kx(n){if(n instanceof _o){const e={};for(const t in n.shape){const i=n.shape[t];e[t]=Fp.create(Kx(i))}return new _o({...n._def,shape:()=>e})}else return n instanceof dg?new dg({...n._def,type:Kx(n.element)}):n instanceof Fp?Fp.create(Kx(n.unwrap())):n instanceof bb?bb.create(Kx(n.unwrap())):n instanceof qp?qp.create(n.items.map(e=>Kx(e))):n}class _o extends Gi{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(),t=Ir.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==cn.object){const c=this._getOrReturnCtx(e);return Jt(c,{code:Dt.invalid_type,expected:cn.object,received:c.parsedType}),di}const{status:i,ctx:r}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof U_&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new jp(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof U_){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")a.length>0&&(Jt(r,{code:Dt.unrecognized_keys,keys:a}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new jp(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Ec.mergeObjectSync(i,c)):Ec.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return Tn.errToObj,new _o({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,i)=>{var r,s,o,a;const l=(o=(s=(r=this._def).errorMap)===null||s===void 0?void 0:s.call(r,t,i).message)!==null&&o!==void 0?o:i.defaultError;return t.code==="unrecognized_keys"?{message:(a=Tn.errToObj(e).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new _o({...this._def,unknownKeys:"strip"})}passthrough(){return new _o({...this._def,unknownKeys:"passthrough"})}extend(e){return new _o({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new _o({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:li.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new _o({...this._def,catchall:e})}pick(e){const t={};return Ir.objectKeys(e).forEach(i=>{e[i]&&this.shape[i]&&(t[i]=this.shape[i])}),new _o({...this._def,shape:()=>t})}omit(e){const t={};return Ir.objectKeys(this.shape).forEach(i=>{e[i]||(t[i]=this.shape[i])}),new _o({...this._def,shape:()=>t})}deepPartial(){return Kx(this)}partial(e){const t={};return Ir.objectKeys(this.shape).forEach(i=>{const r=this.shape[i];e&&!e[i]?t[i]=r:t[i]=r.optional()}),new _o({...this._def,shape:()=>t})}required(e){const t={};return Ir.objectKeys(this.shape).forEach(i=>{if(e&&!e[i])t[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof Fp;)s=s._def.innerType;t[i]=s}}),new _o({...this._def,shape:()=>t})}keyof(){return BOe(Ir.objectKeys(this.shape))}}_o.create=(n,e)=>new _o({shape:()=>n,unknownKeys:"strip",catchall:U_.create(),typeName:li.ZodObject,...$i(e)});_o.strictCreate=(n,e)=>new _o({shape:()=>n,unknownKeys:"strict",catchall:U_.create(),typeName:li.ZodObject,...$i(e)});_o.lazycreate=(n,e)=>new _o({shape:n,unknownKeys:"strip",catchall:U_.create(),typeName:li.ZodObject,...$i(e)});class HA extends Gi{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;function r(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new zd(a.ctx.common.issues));return Jt(t,{code:Dt.invalid_union,unionErrors:o}),di}if(t.common.async)return Promise.all(i.map(async s=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let s;const o=[];for(const l of i){const c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new zd(l));return Jt(t,{code:Dt.invalid_union,unionErrors:a}),di}}get options(){return this._def.options}}HA.create=(n,e)=>new HA({options:n,typeName:li.ZodUnion,...$i(e)});const Mm=n=>n instanceof UA?Mm(n.schema):n instanceof xg?Mm(n.innerType()):n instanceof jA?[n.value]:n instanceof vb?n.options:n instanceof qA?Ir.objectValues(n.enum):n instanceof KA?Mm(n._def.innerType):n instanceof $A?[void 0]:n instanceof WA?[null]:n instanceof Fp?[void 0,...Mm(n.unwrap())]:n instanceof bb?[null,...Mm(n.unwrap())]:n instanceof Joe||n instanceof YA?Mm(n.unwrap()):n instanceof GA?Mm(n._def.innerType):[];class y$ extends Gi{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==cn.object)return Jt(t,{code:Dt.invalid_type,expected:cn.object,received:t.parsedType}),di;const i=this.discriminator,r=t.data[i],s=this.optionsMap.get(r);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(Jt(t,{code:Dt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),di)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){const r=new Map;for(const s of t){const o=Mm(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(r.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,s)}}return new y$({typeName:li.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...$i(i)})}}function BY(n,e){const t=Xm(n),i=Xm(e);if(n===e)return{valid:!0,data:n};if(t===cn.object&&i===cn.object){const r=Ir.objectKeys(e),s=Ir.objectKeys(n).filter(a=>r.indexOf(a)!==-1),o={...n,...e};for(const a of s){const l=BY(n[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===cn.array&&i===cn.array){if(n.length!==e.length)return{valid:!1};const r=[];for(let s=0;s{if(MY(s)||MY(o))return di;const a=BY(s.value,o.value);return a.valid?((FY(s)||FY(o))&&t.dirty(),{status:t.value,value:a.data}):(Jt(i,{code:Dt.invalid_intersection_types}),di)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,o])=>r(s,o)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}VA.create=(n,e,t)=>new VA({left:n,right:e,typeName:li.ZodIntersection,...$i(t)});class qp extends Gi{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==cn.array)return Jt(i,{code:Dt.invalid_type,expected:cn.array,received:i.parsedType}),di;if(i.data.lengththis._def.items.length&&(Jt(i,{code:Dt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...i.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new jp(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(s).then(o=>Ec.mergeArray(t,o)):Ec.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new qp({...this._def,rest:e})}}qp.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qp({items:n,typeName:li.ZodTuple,rest:null,...$i(e)})};class zA extends Gi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==cn.object)return Jt(i,{code:Dt.invalid_type,expected:cn.object,received:i.parsedType}),di;const r=[],s=this._def.keyType,o=this._def.valueType;for(const a in i.data)r.push({key:s._parse(new jp(i,a,i.path,a)),value:o._parse(new jp(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?Ec.mergeObjectAsync(t,r):Ec.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,i){return t instanceof Gi?new zA({keyType:e,valueType:t,typeName:li.ZodRecord,...$i(i)}):new zA({keyType:ig.create(),valueType:e,typeName:li.ZodRecord,...$i(t)})}}class y6 extends Gi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==cn.map)return Jt(i,{code:Dt.invalid_type,expected:cn.map,received:i.parsedType}),di;const r=this._def.keyType,s=this._def.valueType,o=[...i.data.entries()].map(([a,l],c)=>({key:r._parse(new jp(i,a,i.path,[c,"key"])),value:s._parse(new jp(i,l,i.path,[c,"value"]))}));if(i.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return di;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return di;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}}y6.create=(n,e,t)=>new y6({valueType:e,keyType:n,typeName:li.ZodMap,...$i(t)});class Cw extends Gi{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==cn.set)return Jt(i,{code:Dt.invalid_type,expected:cn.set,received:i.parsedType}),di;const r=this._def;r.minSize!==null&&i.data.sizer.maxSize.value&&(Jt(i,{code:Dt.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return di;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}const a=[...i.data.values()].map((l,c)=>s._parse(new jp(i,l,i.path,c)));return i.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new Cw({...this._def,minSize:{value:e,message:Tn.toString(t)}})}max(e,t){return new Cw({...this._def,maxSize:{value:e,message:Tn.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Cw.create=(n,e)=>new Cw({valueType:n,minSize:null,maxSize:null,typeName:li.ZodSet,...$i(e)});class ik extends Gi{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==cn.function)return Jt(t,{code:Dt.invalid_type,expected:cn.function,received:t.parsedType}),di;function i(a,l){return m6({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,p6(),Qk].filter(c=>!!c),issueData:{code:Dt.invalid_arguments,argumentsError:l}})}function r(a,l){return m6({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,p6(),Qk].filter(c=>!!c),issueData:{code:Dt.invalid_return_type,returnTypeError:l}})}const s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof eE){const a=this;return cu(async function(...l){const c=new zd([]),u=await a._def.args.parseAsync(l,s).catch(f=>{throw c.addIssue(i(l,f)),c}),d=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw c.addIssue(r(d,f)),c})})}else{const a=this;return cu(function(...l){const c=a._def.args.safeParse(l,s);if(!c.success)throw new zd([i(l,c.error)]);const u=Reflect.apply(o,this,c.data),d=a._def.returns.safeParse(u,s);if(!d.success)throw new zd([r(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ik({...this._def,args:qp.create(e).rest(Uy.create())})}returns(e){return new ik({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new ik({args:e||qp.create([]).rest(Uy.create()),returns:t||Uy.create(),typeName:li.ZodFunction,...$i(i)})}}class UA extends Gi{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}UA.create=(n,e)=>new UA({getter:n,typeName:li.ZodLazy,...$i(e)});class jA extends Gi{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Jt(t,{received:t.data,code:Dt.invalid_literal,expected:this._def.value}),di}return{status:"valid",value:e.data}}get value(){return this._def.value}}jA.create=(n,e)=>new jA({value:n,typeName:li.ZodLiteral,...$i(e)});function BOe(n,e){return new vb({values:n,typeName:li.ZodEnum,...$i(e)})}class vb extends Gi{constructor(){super(...arguments),yD.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),i=this._def.values;return Jt(t,{expected:Ir.joinValues(i),received:t.parsedType,code:Dt.invalid_type}),di}if(_6(this,yD)||POe(this,yD,new Set(this._def.values)),!_6(this,yD).has(e.data)){const t=this._getOrReturnCtx(e),i=this._def.values;return Jt(t,{received:t.data,code:Dt.invalid_enum_value,options:i}),di}return cu(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return vb.create(e,{...this._def,...t})}exclude(e,t=this._def){return vb.create(this.options.filter(i=>!e.includes(i)),{...this._def,...t})}}yD=new WeakMap;vb.create=BOe;class qA extends Gi{constructor(){super(...arguments),wD.set(this,void 0)}_parse(e){const t=Ir.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==cn.string&&i.parsedType!==cn.number){const r=Ir.objectValues(t);return Jt(i,{expected:Ir.joinValues(r),received:i.parsedType,code:Dt.invalid_type}),di}if(_6(this,wD)||POe(this,wD,new Set(Ir.getValidEnumValues(this._def.values))),!_6(this,wD).has(e.data)){const r=Ir.objectValues(t);return Jt(i,{received:i.data,code:Dt.invalid_enum_value,options:r}),di}return cu(e.data)}get enum(){return this._def.values}}wD=new WeakMap;qA.create=(n,e)=>new qA({values:n,typeName:li.ZodNativeEnum,...$i(e)});class eE extends Gi{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==cn.promise&&t.common.async===!1)return Jt(t,{code:Dt.invalid_type,expected:cn.promise,received:t.parsedType}),di;const i=t.parsedType===cn.promise?t.data:Promise.resolve(t.data);return cu(i.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}eE.create=(n,e)=>new eE({type:n,typeName:li.ZodPromise,...$i(e)});class xg extends Gi{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===li.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:o=>{Jt(i,o),o.fatal?t.abort():t.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){const o=r.transform(i.data,s);if(i.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return di;const l=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return l.status==="aborted"?di:l.status==="dirty"||t.value==="dirty"?pS(l.value):l});{if(t.value==="aborted")return di;const a=this._def.schema._parseSync({data:o,path:i.path,parent:i});return a.status==="aborted"?di:a.status==="dirty"||t.value==="dirty"?pS(a.value):a}}if(r.type==="refinement"){const o=a=>{const l=r.refinement(a,s);if(i.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(i.common.async===!1){const a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?di:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?di:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(r.type==="transform")if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!yw(o))return o;const a=r.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>yw(o)?Promise.resolve(r.transform(o.value,s)).then(a=>({status:t.value,value:a})):o);Ir.assertNever(r)}}xg.create=(n,e,t)=>new xg({schema:n,typeName:li.ZodEffects,effect:e,...$i(t)});xg.createWithPreprocess=(n,e,t)=>new xg({schema:e,effect:{type:"preprocess",transform:n},typeName:li.ZodEffects,...$i(t)});class Fp extends Gi{_parse(e){return this._getType(e)===cn.undefined?cu(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fp.create=(n,e)=>new Fp({innerType:n,typeName:li.ZodOptional,...$i(e)});class bb extends Gi{_parse(e){return this._getType(e)===cn.null?cu(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}bb.create=(n,e)=>new bb({innerType:n,typeName:li.ZodNullable,...$i(e)});class KA extends Gi{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===cn.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}KA.create=(n,e)=>new KA({innerType:n,typeName:li.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...$i(e)});class GA extends Gi{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return FA(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new zd(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new zd(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}GA.create=(n,e)=>new GA({innerType:n,typeName:li.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...$i(e)});class w6 extends Gi{_parse(e){if(this._getType(e)!==cn.nan){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.nan,received:i.parsedType}),di}return{status:"valid",value:e.data}}}w6.create=n=>new w6({typeName:li.ZodNaN,...$i(n)});const Uct=Symbol("zod_brand");class Joe extends Gi{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}}class BP extends Gi{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?di:s.status==="dirty"?(t.dirty(),pS(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?di:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(e,t){return new BP({in:e,out:t,typeName:li.ZodPipeline})}}class YA extends Gi{_parse(e){const t=this._def.innerType._parse(e),i=r=>(yw(r)&&(r.value=Object.freeze(r.value)),r);return FA(t)?t.then(r=>i(r)):i(t)}unwrap(){return this._def.innerType}}YA.create=(n,e)=>new YA({innerType:n,typeName:li.ZodReadonly,...$i(e)});function $Oe(n,e={},t){return n?Jk.create().superRefine((i,r)=>{var s,o;if(!n(i)){const a=typeof e=="function"?e(i):typeof e=="string"?{message:e}:e,l=(o=(s=a.fatal)!==null&&s!==void 0?s:t)!==null&&o!==void 0?o:!0,c=typeof a=="string"?{message:a}:a;r.addIssue({code:"custom",...c,fatal:l})}}):Jk.create()}const jct={object:_o.lazycreate};var li;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(li||(li={}));const qct=(n,e={message:`Input not instance of ${n.name}`})=>$Oe(t=>t instanceof n,e),WOe=ig.create,HOe=mb.create,Kct=w6.create,Gct=_b.create,VOe=BA.create,Yct=ww.create,Zct=v6.create,Xct=$A.create,Qct=WA.create,Jct=Jk.create,eut=Uy.create,tut=U_.create,nut=b6.create,iut=dg.create,rut=_o.create,sut=_o.strictCreate,out=HA.create,aut=y$.create,lut=VA.create,cut=qp.create,uut=zA.create,dut=y6.create,hut=Cw.create,fut=ik.create,gut=UA.create,put=jA.create,mut=vb.create,_ut=qA.create,vut=eE.create,q0e=xg.create,but=Fp.create,yut=bb.create,wut=xg.createWithPreprocess,Cut=BP.create,xut=()=>WOe().optional(),Sut=()=>HOe().optional(),kut=()=>VOe().optional(),Eut={string:n=>ig.create({...n,coerce:!0}),number:n=>mb.create({...n,coerce:!0}),boolean:n=>BA.create({...n,coerce:!0}),bigint:n=>_b.create({...n,coerce:!0}),date:n=>ww.create({...n,coerce:!0})},Lut=di;var E5n=Object.freeze({__proto__:null,defaultErrorMap:Qk,setErrorMap:wct,getErrorMap:p6,makeIssue:m6,EMPTY_PATH:Cct,addIssueToContext:Jt,ParseStatus:Ec,INVALID:di,DIRTY:pS,OK:cu,isAborted:MY,isDirty:FY,isValid:yw,isAsync:FA,get util(){return Ir},get objectUtil(){return OY},ZodParsedType:cn,getParsedType:Xm,ZodType:Gi,datetimeRegex:FOe,ZodString:ig,ZodNumber:mb,ZodBigInt:_b,ZodBoolean:BA,ZodDate:ww,ZodSymbol:v6,ZodUndefined:$A,ZodNull:WA,ZodAny:Jk,ZodUnknown:Uy,ZodNever:U_,ZodVoid:b6,ZodArray:dg,ZodObject:_o,ZodUnion:HA,ZodDiscriminatedUnion:y$,ZodIntersection:VA,ZodTuple:qp,ZodRecord:zA,ZodMap:y6,ZodSet:Cw,ZodFunction:ik,ZodLazy:UA,ZodLiteral:jA,ZodEnum:vb,ZodNativeEnum:qA,ZodPromise:eE,ZodEffects:xg,ZodTransformer:xg,ZodOptional:Fp,ZodNullable:bb,ZodDefault:KA,ZodCatch:GA,ZodNaN:w6,BRAND:Uct,ZodBranded:Joe,ZodPipeline:BP,ZodReadonly:YA,custom:$Oe,Schema:Gi,ZodSchema:Gi,late:jct,get ZodFirstPartyTypeKind(){return li},coerce:Eut,any:Jct,array:iut,bigint:Gct,boolean:VOe,date:Yct,discriminatedUnion:aut,effect:q0e,enum:mut,function:fut,instanceof:qct,intersection:lut,lazy:gut,literal:put,map:dut,nan:Kct,nativeEnum:_ut,never:tut,null:Qct,nullable:yut,number:HOe,object:rut,oboolean:kut,onumber:Sut,optional:but,ostring:xut,pipeline:Cut,preprocess:wut,promise:vut,record:uut,set:hut,strictObject:sut,string:WOe,symbol:Zct,transformer:q0e,tuple:cut,undefined:Xct,union:out,unknown:eut,void:nut,NEVER:Lut,ZodIssueCode:Dt,quotelessJson:yct,ZodError:zd});const Tut=(n,e,t,i)=>{const r=[t,{code:e,...i||{}}];if(n?.services?.logger?.forward)return n.services.logger.forward(r,"warn","react-i18next::",!0);jy(r[0])&&(r[0]=`react-i18next:: ${r[0]}`),n?.services?.logger?.warn?n.services.logger.warn(...r):console?.warn&&console.warn(...r)},K0e={},$Y=(n,e,t,i)=>{jy(t)&&K0e[t]||(jy(t)&&(K0e[t]=new Date),Tut(n,e,t,i))},zOe=(n,e)=>()=>{if(n.isInitialized)e();else{const t=()=>{setTimeout(()=>{n.off("initialized",t)},0),e()};n.on("initialized",t)}},WY=(n,e,t)=>{n.loadNamespaces(e,zOe(n,t))},G0e=(n,e,t,i)=>{if(jy(t)&&(t=[t]),n.options.preload&&n.options.preload.indexOf(e)>-1)return WY(n,t,i);t.forEach(r=>{n.options.ns.indexOf(r)<0&&n.options.ns.push(r)}),n.loadLanguages(e,zOe(n,i))},Dut=(n,e,t={})=>!e.languages||!e.languages.length?($Y(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(n,{lng:t.lng,precheck:(i,r)=>{if(t.bindI18n?.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!r(i.isLanguageChangingTo,n))return!1}}),jy=n=>typeof n=="string",Iut=n=>typeof n=="object"&&n!==null,Aut=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Nut={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Rut=n=>Nut[n],Put=n=>n.replace(Aut,Rut);let HY={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Put};const Out=(n={})=>{HY={...HY,...n}},Mut=()=>HY;let UOe;const Fut=n=>{UOe=n},But=()=>UOe,L5n={type:"3rdParty",init(n){Out(n.options.react),Fut(n)}},$ut=E.createContext();class Wut{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Hut=(n,e)=>{const t=E.useRef();return E.useEffect(()=>{t.current=n},[n,e]),t.current},jOe=(n,e,t,i)=>n.getFixedT(e,t,i),Vut=(n,e,t,i)=>E.useCallback(jOe(n,e,t,i),[n,e,t,i]),T5n=(n,e={})=>{const{i18n:t}=e,{i18n:i,defaultNS:r}=E.useContext($ut)||{},s=t||i||But();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new Wut),!s){$Y(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const C=(k,L)=>jy(L)?L:Iut(L)&&jy(L.defaultValue)?L.defaultValue:Array.isArray(k)?k[k.length-1]:k,x=[C,{},!1];return x.t=C,x.i18n={},x.ready=!1,x}s.options.react?.wait&&$Y(s,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...Mut(),...s.options.react,...e},{useSuspense:a,keyPrefix:l}=o;let c=n||r||s.options?.defaultNS;c=jy(c)?[c]:c||["translation"],s.reportNamespaces.addUsedNamespaces?.(c);const u=(s.isInitialized||s.initializedStoreOnce)&&c.every(C=>Dut(C,s,o)),d=Vut(s,e.lng||null,o.nsMode==="fallback"?c:c[0],l),h=()=>d,f=()=>jOe(s,e.lng||null,o.nsMode==="fallback"?c:c[0],l),[g,p]=E.useState(h);let m=c.join();e.lng&&(m=`${e.lng}${m}`);const _=Hut(m),v=E.useRef(!0);E.useEffect(()=>{const{bindI18n:C,bindI18nStore:x}=o;v.current=!0,!u&&!a&&(e.lng?G0e(s,e.lng,c,()=>{v.current&&p(f)}):WY(s,c,()=>{v.current&&p(f)})),u&&_&&_!==m&&v.current&&p(f);const k=()=>{v.current&&p(f)};return C&&s?.on(C,k),x&&s?.store.on(x,k),()=>{v.current=!1,s&&C?.split(" ").forEach(L=>s.off(L,k)),x&&s&&x.split(" ").forEach(L=>s.store.off(L,k))}},[s,m]),E.useEffect(()=>{v.current&&u&&p(h)},[s,l,u]);const y=[g,s,u];if(y.t=g,y.i18n=s,y.ready=u,u||!u&&!a)return y;throw new Promise(C=>{e.lng?G0e(s,e.lng,c,()=>C()):WY(s,c,()=>C())})};var zut="Label",qOe=E.forwardRef((n,e)=>ae.jsx(Pn.label,{...n,ref:e,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(n.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));qOe.displayName=zut;var D5n=qOe;function Kt(n,e,{checkForDefaultPrevented:t=!0}={}){return function(r){if(n?.(r),t===!1||!r.defaultPrevented)return e?.(r)}}function Uut(n,e){const t=E.createContext(e),i=s=>{const{children:o,...a}=s,l=E.useMemo(()=>a,Object.values(a));return ae.jsx(t.Provider,{value:l,children:o})};i.displayName=n+"Provider";function r(s){const o=E.useContext(t);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${n}\``)}return[i,r]}function Ac(n,e=[]){let t=[];function i(s,o){const a=E.createContext(o),l=t.length;t=[...t,o];const c=d=>{const{scope:h,children:f,...g}=d,p=h?.[n]?.[l]||a,m=E.useMemo(()=>g,Object.values(g));return ae.jsx(p.Provider,{value:m,children:f})};c.displayName=s+"Provider";function u(d,h){const f=h?.[n]?.[l]||a,g=E.useContext(f);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const r=()=>{const s=t.map(o=>E.createContext(o));return function(a){const l=a?.[n]||s;return E.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return r.scopeName=n,[i,jut(r,...e)]}function jut(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const i=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}var VY=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(Kut);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(zY,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(zY,{...i,ref:e,children:t})});VY.displayName="Slot";var zY=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=Yut(t);return E.cloneElement(t,{...Gut(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});zY.displayName="SlotClone";var qut=({children:n})=>ae.jsx(ae.Fragment,{children:n});function Kut(n){return E.isValidElement(n)&&n.type===qut}function Gut(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function Yut(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function eae(n){const e=n+"CollectionProvider",[t,i]=Ac(e),[r,s]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=f=>{const{scope:g,children:p}=f,m=U.useRef(null),_=U.useRef(new Map).current;return ae.jsx(r,{scope:g,itemMap:_,collectionRef:m,children:p})};o.displayName=e;const a=n+"CollectionSlot",l=U.forwardRef((f,g)=>{const{scope:p,children:m}=f,_=s(a,p),v=gi(g,_.collectionRef);return ae.jsx(VY,{ref:v,children:m})});l.displayName=a;const c=n+"CollectionItemSlot",u="data-radix-collection-item",d=U.forwardRef((f,g)=>{const{scope:p,children:m,..._}=f,v=U.useRef(null),y=gi(g,v),C=s(c,p);return U.useEffect(()=>(C.itemMap.set(v,{ref:v,..._}),()=>void C.itemMap.delete(v))),ae.jsx(VY,{[u]:"",ref:y,children:m})});d.displayName=c;function h(f){const g=s(n+"CollectionConsumer",f);return U.useCallback(()=>{const m=g.collectionRef.current;if(!m)return[];const _=Array.from(m.querySelectorAll(`[${u}]`));return Array.from(g.itemMap.values()).sort((C,x)=>_.indexOf(C.ref.current)-_.indexOf(x.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:l,ItemSlot:d},h,i]}var Zut=globalThis?.document?E.useLayoutEffect:()=>{},Xut=JB.useId||(()=>{}),Qut=0;function Ud(n){const[e,t]=E.useState(Xut());return Zut(()=>{n||t(i=>i??String(Qut++))},[n]),n||(e?`radix-${e}`:"")}function Ua(n){const e=E.useRef(n);return E.useEffect(()=>{e.current=n}),E.useMemo(()=>(...t)=>e.current?.(...t),[])}function Kp({prop:n,defaultProp:e,onChange:t=()=>{}}){const[i,r]=Jut({defaultProp:e,onChange:t}),s=n!==void 0,o=s?n:i,a=Ua(t),l=E.useCallback(c=>{if(s){const d=typeof c=="function"?c(n):c;d!==n&&a(d)}else r(c)},[s,n,r,a]);return[o,l]}function Jut({defaultProp:n,onChange:e}){const t=E.useState(n),[i]=t,r=E.useRef(i),s=Ua(e);return E.useEffect(()=>{r.current!==i&&(s(i),r.current=i)},[i,r,s]),t}var edt=E.createContext(void 0);function $P(n){const e=E.useContext(edt);return n||e||"ltr"}var tj="rovingFocusGroup.onEntryFocus",tdt={bubbles:!1,cancelable:!0},w$="RovingFocusGroup",[UY,KOe,ndt]=eae(w$),[idt,C$]=Ac(w$,[ndt]),[rdt,sdt]=idt(w$),GOe=E.forwardRef((n,e)=>ae.jsx(UY.Provider,{scope:n.__scopeRovingFocusGroup,children:ae.jsx(UY.Slot,{scope:n.__scopeRovingFocusGroup,children:ae.jsx(odt,{...n,ref:e})})}));GOe.displayName=w$;var odt=E.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,orientation:i,loop:r=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=n,h=E.useRef(null),f=gi(e,h),g=$P(s),[p=null,m]=Kp({prop:o,defaultProp:a,onChange:l}),[_,v]=E.useState(!1),y=Ua(c),C=KOe(t),x=E.useRef(!1),[k,L]=E.useState(0);return E.useEffect(()=>{const D=h.current;if(D)return D.addEventListener(tj,y),()=>D.removeEventListener(tj,y)},[y]),ae.jsx(rdt,{scope:t,orientation:i,dir:g,loop:r,currentTabStopId:p,onItemFocus:E.useCallback(D=>m(D),[m]),onItemShiftTab:E.useCallback(()=>v(!0),[]),onFocusableItemAdd:E.useCallback(()=>L(D=>D+1),[]),onFocusableItemRemove:E.useCallback(()=>L(D=>D-1),[]),children:ae.jsx(Pn.div,{tabIndex:_||k===0?-1:0,"data-orientation":i,...d,ref:f,style:{outline:"none",...n.style},onMouseDown:Kt(n.onMouseDown,()=>{x.current=!0}),onFocus:Kt(n.onFocus,D=>{const I=!x.current;if(D.target===D.currentTarget&&I&&!_){const O=new CustomEvent(tj,tdt);if(D.currentTarget.dispatchEvent(O),!O.defaultPrevented){const M=C().filter(q=>q.focusable),B=M.find(q=>q.active),G=M.find(q=>q.id===p),z=[B,G,...M].filter(Boolean).map(q=>q.ref.current);XOe(z,u)}}x.current=!1}),onBlur:Kt(n.onBlur,()=>v(!1))})})}),YOe="RovingFocusGroupItem",ZOe=E.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,focusable:i=!0,active:r=!1,tabStopId:s,...o}=n,a=Ud(),l=s||a,c=sdt(YOe,t),u=c.currentTabStopId===l,d=KOe(t),{onFocusableItemAdd:h,onFocusableItemRemove:f}=c;return E.useEffect(()=>{if(i)return h(),()=>f()},[i,h,f]),ae.jsx(UY.ItemSlot,{scope:t,id:l,focusable:i,active:r,children:ae.jsx(Pn.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...o,ref:e,onMouseDown:Kt(n.onMouseDown,g=>{i?c.onItemFocus(l):g.preventDefault()}),onFocus:Kt(n.onFocus,()=>c.onItemFocus(l)),onKeyDown:Kt(n.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){c.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const p=cdt(g,c.orientation,c.dir);if(p!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let _=d().filter(v=>v.focusable).map(v=>v.ref.current);if(p==="last")_.reverse();else if(p==="prev"||p==="next"){p==="prev"&&_.reverse();const v=_.indexOf(g.currentTarget);_=c.loop?udt(_,v+1):_.slice(v+1)}setTimeout(()=>XOe(_))}})})})});ZOe.displayName=YOe;var adt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ldt(n,e){return e!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function cdt(n,e,t){const i=ldt(n.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return adt[i]}function XOe(n,e=!1){const t=document.activeElement;for(const i of n)if(i===t||(i.focus({preventScroll:e}),document.activeElement!==t))return}function udt(n,e){return n.map((t,i)=>n[(e+i)%n.length])}var QOe=GOe,JOe=ZOe,es=globalThis?.document?E.useLayoutEffect:()=>{};function ddt(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var eMe=n=>{const{present:e,children:t}=n,i=hdt(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,fdt(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};eMe.displayName="Presence";function hdt(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=ddt(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=h4(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=h4(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=h4(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=h4(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function h4(n){return n?.animationName||"none"}function fdt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var tae="Tabs",[gdt,I5n]=Ac(tae,[C$]),tMe=C$(),[pdt,nae]=gdt(tae),nMe=E.forwardRef((n,e)=>{const{__scopeTabs:t,value:i,onValueChange:r,defaultValue:s,orientation:o="horizontal",dir:a,activationMode:l="automatic",...c}=n,u=$P(a),[d,h]=Kp({prop:i,onChange:r,defaultProp:s});return ae.jsx(pdt,{scope:t,baseId:Ud(),value:d,onValueChange:h,orientation:o,dir:u,activationMode:l,children:ae.jsx(Pn.div,{dir:u,"data-orientation":o,...c,ref:e})})});nMe.displayName=tae;var iMe="TabsList",rMe=E.forwardRef((n,e)=>{const{__scopeTabs:t,loop:i=!0,...r}=n,s=nae(iMe,t),o=tMe(t);return ae.jsx(QOe,{asChild:!0,...o,orientation:s.orientation,dir:s.dir,loop:i,children:ae.jsx(Pn.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:e})})});rMe.displayName=iMe;var sMe="TabsTrigger",oMe=E.forwardRef((n,e)=>{const{__scopeTabs:t,value:i,disabled:r=!1,...s}=n,o=nae(sMe,t),a=tMe(t),l=cMe(o.baseId,i),c=uMe(o.baseId,i),u=i===o.value;return ae.jsx(JOe,{asChild:!0,...a,focusable:!r,active:u,children:ae.jsx(Pn.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...s,ref:e,onMouseDown:Kt(n.onMouseDown,d=>{!r&&d.button===0&&d.ctrlKey===!1?o.onValueChange(i):d.preventDefault()}),onKeyDown:Kt(n.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&o.onValueChange(i)}),onFocus:Kt(n.onFocus,()=>{const d=o.activationMode!=="manual";!u&&!r&&d&&o.onValueChange(i)})})})});oMe.displayName=sMe;var aMe="TabsContent",lMe=E.forwardRef((n,e)=>{const{__scopeTabs:t,value:i,forceMount:r,children:s,...o}=n,a=nae(aMe,t),l=cMe(a.baseId,i),c=uMe(a.baseId,i),u=i===a.value,d=E.useRef(u);return E.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),ae.jsx(eMe,{present:r||u,children:({present:h})=>ae.jsx(Pn.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...o,ref:e,style:{...n.style,animationDuration:d.current?"0s":void 0},children:h&&s})})});lMe.displayName=aMe;function cMe(n,e){return`${n}-trigger-${e}`}function uMe(n,e){return`${n}-content-${e}`}var A5n=nMe,N5n=rMe,R5n=oMe,P5n=lMe,HL=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},xw=typeof window>"u"||"Deno"in globalThis;function Rh(){}function mdt(n,e){return typeof n=="function"?n(e):n}function jY(n){return typeof n=="number"&&n>=0&&n!==1/0}function dMe(n,e){return Math.max(n+(e||0)-Date.now(),0)}function rk(n,e){return typeof n=="function"?n(e):n}function Yf(n,e){return typeof n=="function"?n(e):n}function Y0e(n,e){const{type:t="all",exact:i,fetchStatus:r,predicate:s,queryKey:o,stale:a}=n;if(o){if(i){if(e.queryHash!==iae(o,e.options))return!1}else if(!ZA(e.queryKey,o))return!1}if(t!=="all"){const l=e.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||r&&r!==e.state.fetchStatus||s&&!s(e))}function Z0e(n,e){const{exact:t,status:i,predicate:r,mutationKey:s}=n;if(s){if(!e.options.mutationKey)return!1;if(t){if(Sw(e.options.mutationKey)!==Sw(s))return!1}else if(!ZA(e.options.mutationKey,s))return!1}return!(i&&e.state.status!==i||r&&!r(e))}function iae(n,e){return(e?.queryKeyHashFn||Sw)(n)}function Sw(n){return JSON.stringify(n,(e,t)=>qY(t)?Object.keys(t).sort().reduce((i,r)=>(i[r]=t[r],i),{}):t)}function ZA(n,e){return n===e?!0:typeof n!=typeof e?!1:n&&e&&typeof n=="object"&&typeof e=="object"?!Object.keys(e).some(t=>!ZA(n[t],e[t])):!1}function hMe(n,e){if(n===e)return n;const t=X0e(n)&&X0e(e);if(t||qY(n)&&qY(e)){const i=t?n:Object.keys(n),r=i.length,s=t?e:Object.keys(e),o=s.length,a=t?[]:{};let l=0;for(let c=0;c{setTimeout(e,n)})}function KY(n,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(n,e):t.structuralSharing!==!1?hMe(n,e):e}function vdt(n,e,t=0){const i=[...n,e];return t&&i.length>t?i.slice(1):i}function bdt(n,e,t=0){const i=[e,...n];return t&&i.length>t?i.slice(0,-1):i}var rae=Symbol();function fMe(n,e){return!n.queryFn&&e?.initialPromise?()=>e.initialPromise:!n.queryFn||n.queryFn===rae?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}var ydt=class extends HL{#e;#t;#i;constructor(){super(),this.#i=n=>{if(!xw&&window.addEventListener){const e=()=>n();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#i=n,this.#t?.(),this.#t=n(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(n){this.#e!==n&&(this.#e=n,this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(e=>{e(n)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},sae=new ydt,wdt=class extends HL{#e=!0;#t;#i;constructor(){super(),this.#i=n=>{if(!xw&&window.addEventListener){const e=()=>n(!0),t=()=>n(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#i=n,this.#t?.(),this.#t=n(this.setOnline.bind(this))}setOnline(n){this.#e!==n&&(this.#e=n,this.listeners.forEach(t=>{t(n)}))}isOnline(){return this.#e}},x6=new wdt;function GY(){let n,e;const t=new Promise((r,s)=>{n=r,e=s});t.status="pending",t.catch(()=>{});function i(r){Object.assign(t,r),delete t.resolve,delete t.reject}return t.resolve=r=>{i({status:"fulfilled",value:r}),n(r)},t.reject=r=>{i({status:"rejected",reason:r}),e(r)},t}function Cdt(n){return Math.min(1e3*2**n,3e4)}function gMe(n){return(n??"online")==="online"?x6.isOnline():!0}var pMe=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function nj(n){return n instanceof pMe}function mMe(n){let e=!1,t=0,i=!1,r;const s=GY(),o=p=>{i||(h(new pMe(p)),n.abort?.())},a=()=>{e=!0},l=()=>{e=!1},c=()=>sae.isFocused()&&(n.networkMode==="always"||x6.isOnline())&&n.canRun(),u=()=>gMe(n.networkMode)&&n.canRun(),d=p=>{i||(i=!0,n.onSuccess?.(p),r?.(),s.resolve(p))},h=p=>{i||(i=!0,n.onError?.(p),r?.(),s.reject(p))},f=()=>new Promise(p=>{r=m=>{(i||c())&&p(m)},n.onPause?.()}).then(()=>{r=void 0,i||n.onContinue?.()}),g=()=>{if(i)return;let p;const m=t===0?n.initialPromise:void 0;try{p=m??n.fn()}catch(_){p=Promise.reject(_)}Promise.resolve(p).then(d).catch(_=>{if(i)return;const v=n.retry??(xw?0:3),y=n.retryDelay??Cdt,C=typeof y=="function"?y(t,_):y,x=v===!0||typeof v=="number"&&tc()?void 0:f()).then(()=>{e?h(_):g()})})};return{promise:s,cancel:o,continue:()=>(r?.(),s),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?g():f().then(g),s)}}function xdt(){let n=[],e=0,t=a=>{a()},i=a=>{a()},r=a=>setTimeout(a,0);const s=a=>{e?n.push(a):r(()=>{t(a)})},o=()=>{const a=n;n=[],a.length&&r(()=>{i(()=>{a.forEach(l=>{t(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{t=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{r=a}}}var Ha=xdt(),_Me=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),jY(this.gcTime)&&(this.#e=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(xw?1/0:5*60*1e3))}clearGcTimeout(){this.#e&&(clearTimeout(this.#e),this.#e=void 0)}},Sdt=class extends _Me{#e;#t;#i;#n;#o;#s;constructor(n){super(),this.#s=!1,this.#o=n.defaultOptions,this.setOptions(n.options),this.observers=[],this.#i=n.cache,this.queryKey=n.queryKey,this.queryHash=n.queryHash,this.#e=kdt(this.options),this.state=n.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(n){this.options={...this.#o,...n},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(n,e){const t=KY(this.state.data,n,this.options);return this.#r({data:t,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),t}setState(n,e){this.#r({type:"setState",state:n,setStateOptions:e})}cancel(n){const e=this.#n?.promise;return this.#n?.cancel(n),e?e.then(Rh).catch(Rh):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(n=>Yf(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rae||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(n=0){return this.state.isInvalidated||this.state.data===void 0||!dMe(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){this.observers.includes(n)&&(this.observers=this.observers.filter(e=>e!==n),this.observers.length||(this.#n&&(this.#s?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#r({type:"invalidate"})}fetch(n,e){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(n&&this.setOptions(n),!this.options.queryFn){const a=this.observers.find(l=>l.options.queryFn);a&&this.setOptions(a.options)}const t=new AbortController,i=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#s=!0,t.signal)})},r=()=>{const a=fMe(this.options,e),l={queryKey:this.queryKey,meta:this.meta};return i(l),this.#s=!1,this.options.persister?this.options.persister(a,l,this):a(l)},s={fetchOptions:e,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:r};i(s),this.options.behavior?.onFetch(s,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#r({type:"fetch",meta:s.fetchOptions?.meta});const o=a=>{nj(a)&&a.silent||this.#r({type:"error",error:a}),nj(a)||(this.#i.config.onError?.(a,this),this.#i.config.onSettled?.(this.state.data,a,this)),this.scheduleGc()};return this.#n=mMe({initialPromise:e?.initialPromise,fn:s.fetchFn,abort:t.abort.bind(t),onSuccess:a=>{if(a===void 0){o(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(a)}catch(l){o(l);return}this.#i.config.onSuccess?.(a,this),this.#i.config.onSettled?.(a,this.state.error,this),this.scheduleGc()},onError:o,onFail:(a,l)=>{this.#r({type:"failed",failureCount:a,error:l})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}),this.#n.start()}#r(n){const e=t=>{switch(n.type){case"failed":return{...t,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...vMe(t.data,this.options),fetchMeta:n.meta??null};case"success":return{...t,data:n.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:n.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=n.error;return nj(i)&&i.revert&&this.#t?{...this.#t,fetchStatus:"idle"}:{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...n.state}}};this.state=e(this.state),Ha.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:n})})}};function vMe(n,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:gMe(e.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function kdt(n){const e=typeof n.initialData=="function"?n.initialData():n.initialData,t=e!==void 0,i=t?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var Edt=class extends HL{constructor(n={}){super(),this.config=n,this.#e=new Map}#e;build(n,e,t){const i=e.queryKey,r=e.queryHash??iae(i,e);let s=this.get(r);return s||(s=new Sdt({cache:this,queryKey:i,queryHash:r,options:n.defaultQueryOptions(e),state:t,defaultOptions:n.getQueryDefaults(i)}),this.add(s)),s}add(n){this.#e.has(n.queryHash)||(this.#e.set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){const e=this.#e.get(n.queryHash);e&&(n.destroy(),e===n&&this.#e.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){Ha.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return this.#e.get(n)}getAll(){return[...this.#e.values()]}find(n){const e={exact:!0,...n};return this.getAll().find(t=>Y0e(e,t))}findAll(n={}){const e=this.getAll();return Object.keys(n).length>0?e.filter(t=>Y0e(n,t)):e}notify(n){Ha.batch(()=>{this.listeners.forEach(e=>{e(n)})})}onFocus(){Ha.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){Ha.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},Ldt=class extends _Me{#e;#t;#i;constructor(n){super(),this.mutationId=n.mutationId,this.#t=n.mutationCache,this.#e=[],this.state=n.state||bMe(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){this.#e.includes(n)||(this.#e.push(n),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){this.#e=this.#e.filter(e=>e!==n),this.scheduleGc(),this.#t.notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#t.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(n){this.#i=mMe({fn:()=>this.options.mutationFn?this.options.mutationFn(n):Promise.reject(new Error("No mutationFn found")),onFail:(i,r)=>{this.#n({type:"failed",failureCount:i,error:r})},onPause:()=>{this.#n({type:"pause"})},onContinue:()=>{this.#n({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#t.canRun(this)});const e=this.state.status==="pending",t=!this.#i.canStart();try{if(!e){this.#n({type:"pending",variables:n,isPaused:t}),await this.#t.config.onMutate?.(n,this);const r=await this.options.onMutate?.(n);r!==this.state.context&&this.#n({type:"pending",context:r,variables:n,isPaused:t})}const i=await this.#i.start();return await this.#t.config.onSuccess?.(i,n,this.state.context,this),await this.options.onSuccess?.(i,n,this.state.context),await this.#t.config.onSettled?.(i,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(i,null,n,this.state.context),this.#n({type:"success",data:i}),i}catch(i){try{throw await this.#t.config.onError?.(i,n,this.state.context,this),await this.options.onError?.(i,n,this.state.context),await this.#t.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,i,n,this.state.context),i}finally{this.#n({type:"error",error:i})}}finally{this.#t.runNext(this)}}#n(n){const e=t=>{switch(n.type){case"failed":return{...t,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...t,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:n.error,failureCount:t.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=e(this.state),Ha.batch(()=>{this.#e.forEach(t=>{t.onMutationUpdate(n)}),this.#t.notify({mutation:this,type:"updated",action:n})})}};function bMe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Tdt=class extends HL{constructor(n={}){super(),this.config=n,this.#e=new Map,this.#t=Date.now()}#e;#t;build(n,e,t){const i=new Ldt({mutationCache:this,mutationId:++this.#t,options:n.defaultMutationOptions(e),state:t});return this.add(i),i}add(n){const e=f4(n),t=this.#e.get(e)??[];t.push(n),this.#e.set(e,t),this.notify({type:"added",mutation:n})}remove(n){const e=f4(n);if(this.#e.has(e)){const t=this.#e.get(e)?.filter(i=>i!==n);t&&(t.length===0?this.#e.delete(e):this.#e.set(e,t))}this.notify({type:"removed",mutation:n})}canRun(n){const e=this.#e.get(f4(n))?.find(t=>t.state.status==="pending");return!e||e===n}runNext(n){return this.#e.get(f4(n))?.find(t=>t!==n&&t.state.isPaused)?.continue()??Promise.resolve()}clear(){Ha.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}getAll(){return[...this.#e.values()].flat()}find(n){const e={exact:!0,...n};return this.getAll().find(t=>Z0e(e,t))}findAll(n={}){return this.getAll().filter(e=>Z0e(n,e))}notify(n){Ha.batch(()=>{this.listeners.forEach(e=>{e(n)})})}resumePausedMutations(){const n=this.getAll().filter(e=>e.state.isPaused);return Ha.batch(()=>Promise.all(n.map(e=>e.continue().catch(Rh))))}};function f4(n){return n.options.scope?.id??String(n.mutationId)}function J0e(n){return{onFetch:(e,t)=>{const i=e.options,r=e.fetchOptions?.meta?.fetchMore?.direction,s=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let u=!1;const d=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(e.signal.aborted?u=!0:e.signal.addEventListener("abort",()=>{u=!0}),e.signal)})},h=fMe(e.options,e.fetchOptions),f=async(g,p,m)=>{if(u)return Promise.reject();if(p==null&&g.pages.length)return Promise.resolve(g);const _={queryKey:e.queryKey,pageParam:p,direction:m?"backward":"forward",meta:e.options.meta};d(_);const v=await h(_),{maxPages:y}=e.options,C=m?bdt:vdt;return{pages:C(g.pages,v,y),pageParams:C(g.pageParams,p,y)}};if(r&&s.length){const g=r==="backward",p=g?Ddt:eve,m={pages:s,pageParams:o},_=p(i,m);a=await f(m,_,g)}else{const g=n??s.length;do{const p=l===0?o[0]??i.initialPageParam:eve(i,a);if(l>0&&p==null)break;a=await f(a,p),l++}while(le.options.persister?.(c,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t):e.fetchFn=c}}}function eve(n,{pages:e,pageParams:t}){const i=e.length-1;return e.length>0?n.getNextPageParam(e[i],e,t[i],t):void 0}function Ddt(n,{pages:e,pageParams:t}){return e.length>0?n.getPreviousPageParam?.(e[0],e,t[0],t):void 0}var O5n=class{#e;#t;#i;#n;#o;#s;#r;#a;constructor(n={}){this.#e=n.queryCache||new Edt,this.#t=n.mutationCache||new Tdt,this.#i=n.defaultOptions||{},this.#n=new Map,this.#o=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#r=sae.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=x6.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#r?.(),this.#r=void 0,this.#a?.(),this.#a=void 0)}isFetching(n){return this.#e.findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return this.#t.findAll({...n,status:"pending"}).length}getQueryData(n){const e=this.defaultQueryOptions({queryKey:n});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(n){const e=this.defaultQueryOptions(n),t=this.#e.build(this,e),i=t.state.data;return i===void 0?this.fetchQuery(n):(n.revalidateIfStale&&t.isStaleByTime(rk(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(n){return this.#e.findAll(n).map(({queryKey:e,state:t})=>{const i=t.data;return[e,i]})}setQueryData(n,e,t){const i=this.defaultQueryOptions({queryKey:n}),s=this.#e.get(i.queryHash)?.state.data,o=mdt(e,s);if(o!==void 0)return this.#e.build(this,i).setData(o,{...t,manual:!0})}setQueriesData(n,e,t){return Ha.batch(()=>this.#e.findAll(n).map(({queryKey:i})=>[i,this.setQueryData(i,e,t)]))}getQueryState(n){const e=this.defaultQueryOptions({queryKey:n});return this.#e.get(e.queryHash)?.state}removeQueries(n){const e=this.#e;Ha.batch(()=>{e.findAll(n).forEach(t=>{e.remove(t)})})}resetQueries(n,e){const t=this.#e,i={type:"active",...n};return Ha.batch(()=>(t.findAll(n).forEach(r=>{r.reset()}),this.refetchQueries(i,e)))}cancelQueries(n,e={}){const t={revert:!0,...e},i=Ha.batch(()=>this.#e.findAll(n).map(r=>r.cancel(t)));return Promise.all(i).then(Rh).catch(Rh)}invalidateQueries(n,e={}){return Ha.batch(()=>{if(this.#e.findAll(n).forEach(i=>{i.invalidate()}),n?.refetchType==="none")return Promise.resolve();const t={...n,type:n?.refetchType??n?.type??"active"};return this.refetchQueries(t,e)})}refetchQueries(n,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},i=Ha.batch(()=>this.#e.findAll(n).filter(r=>!r.isDisabled()).map(r=>{let s=r.fetch(void 0,t);return t.throwOnError||(s=s.catch(Rh)),r.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(i).then(Rh)}fetchQuery(n){const e=this.defaultQueryOptions(n);e.retry===void 0&&(e.retry=!1);const t=this.#e.build(this,e);return t.isStaleByTime(rk(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(Rh).catch(Rh)}fetchInfiniteQuery(n){return n.behavior=J0e(n.pages),this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(Rh).catch(Rh)}ensureInfiniteQueryData(n){return n.behavior=J0e(n.pages),this.ensureQueryData(n)}resumePausedMutations(){return x6.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#i}setDefaultOptions(n){this.#i=n}setQueryDefaults(n,e){this.#n.set(Sw(n),{queryKey:n,defaultOptions:e})}getQueryDefaults(n){const e=[...this.#n.values()],t={};return e.forEach(i=>{ZA(n,i.queryKey)&&Object.assign(t,i.defaultOptions)}),t}setMutationDefaults(n,e){this.#o.set(Sw(n),{mutationKey:n,defaultOptions:e})}getMutationDefaults(n){const e=[...this.#o.values()];let t={};return e.forEach(i=>{ZA(n,i.mutationKey)&&(t={...t,...i.defaultOptions})}),t}defaultQueryOptions(n){if(n._defaulted)return n;const e={...this.#i.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return e.queryHash||(e.queryHash=iae(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===rae&&(e.enabled=!1),e}defaultMutationOptions(n){return n?._defaulted?n:{...this.#i.mutations,...n?.mutationKey&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Idt=class extends HL{constructor(n,e){super(),this.options=e,this.#e=n,this.#a=null,this.#r=GY(),this.options.experimental_prefetchInRender||this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#i=void 0;#n=void 0;#o;#s;#r;#a;#p;#h;#f;#c;#u;#l;#g=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),tve(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return YY(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return YY(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#w(),this.#t.removeObserver(this)}setOptions(n,e){const t=this.options,i=this.#t;if(this.options=this.#e.defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Yf(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#t.setOptions(this.options),t._defaulted&&!C6(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&nve(this.#t,i,this.options,t)&&this.#d(),this.updateResult(e),r&&(this.#t!==i||Yf(this.options.enabled,this.#t)!==Yf(t.enabled,this.#t)||rk(this.options.staleTime,this.#t)!==rk(t.staleTime,this.#t))&&this.#m();const s=this.#_();r&&(this.#t!==i||Yf(this.options.enabled,this.#t)!==Yf(t.enabled,this.#t)||s!==this.#l)&&this.#v(s)}getOptimisticResult(n){const e=this.#e.getQueryCache().build(this.#e,n),t=this.createResult(e,n);return Ndt(this,t)&&(this.#n=t,this.#s=this.options,this.#o=this.#t.state),t}getCurrentResult(){return this.#n}trackResult(n,e){const t={};return Object.keys(n).forEach(i=>{Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(i),e?.(i),n[i])})}),t}trackProp(n){this.#g.add(n)}getCurrentQuery(){return this.#t}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const e=this.#e.defaultQueryOptions(n),t=this.#e.getQueryCache().build(this.#e,e);return t.fetch().then(()=>this.createResult(t,e))}fetch(n){return this.#d({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#d(n){this.#C();let e=this.#t.fetch(this.options,n);return n?.throwOnError||(e=e.catch(Rh)),e}#m(){this.#y();const n=rk(this.options.staleTime,this.#t);if(xw||this.#n.isStale||!jY(n))return;const t=dMe(this.#n.dataUpdatedAt,n)+1;this.#c=setTimeout(()=>{this.#n.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(n){this.#w(),this.#l=n,!(xw||Yf(this.options.enabled,this.#t)===!1||!jY(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||sae.isFocused())&&this.#d()},this.#l))}#b(){this.#m(),this.#v(this.#_())}#y(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(n,e){const t=this.#t,i=this.options,r=this.#n,s=this.#o,o=this.#s,l=n!==t?n.state:this.#i,{state:c}=n;let u={...c},d=!1,h;if(e._optimisticResults){const L=this.hasListeners(),D=!L&&tve(n,e),I=L&&nve(n,t,e,i);(D||I)&&(u={...u,...vMe(c.data,n.options)}),e._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:g,status:p}=u;if(e.select&&u.data!==void 0)if(r&&u.data===s?.data&&e.select===this.#p)h=this.#h;else try{this.#p=e.select,h=e.select(u.data),h=KY(r?.data,h,e),this.#h=h,this.#a=null}catch(L){this.#a=L}else h=u.data;if(e.placeholderData!==void 0&&h===void 0&&p==="pending"){let L;if(r?.isPlaceholderData&&e.placeholderData===o?.placeholderData)L=r.data;else if(L=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,e.select&&L!==void 0)try{L=e.select(L),this.#a=null}catch(D){this.#a=D}L!==void 0&&(p="success",h=KY(r?.data,L,e),d=!0)}this.#a&&(f=this.#a,h=this.#h,g=Date.now(),p="error");const m=u.fetchStatus==="fetching",_=p==="pending",v=p==="error",y=_&&m,C=h!==void 0,k={status:p,fetchStatus:u.fetchStatus,isPending:_,isSuccess:p==="success",isError:v,isInitialLoading:y,isLoading:y,data:h,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:g,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:m,isRefetching:m&&!_,isLoadingError:v&&!C,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:v&&C,isStale:oae(n,e),refetch:this.refetch,promise:this.#r};if(this.options.experimental_prefetchInRender){const L=O=>{k.status==="error"?O.reject(k.error):k.data!==void 0&&O.resolve(k.data)},D=()=>{const O=this.#r=k.promise=GY();L(O)},I=this.#r;switch(I.status){case"pending":n.queryHash===t.queryHash&&L(I);break;case"fulfilled":(k.status==="error"||k.data!==I.value)&&D();break;case"rejected":(k.status!=="error"||k.error!==I.reason)&&D();break}}return k}updateResult(n){const e=this.#n,t=this.createResult(this.#t,this.options);if(this.#o=this.#t.state,this.#s=this.options,this.#o.data!==void 0&&(this.#f=this.#t),C6(t,e))return;this.#n=t;const i={},r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!this.#g.size)return!0;const a=new Set(o??this.#g);return this.options.throwOnError&&a.add("error"),Object.keys(this.#n).some(l=>{const c=l;return this.#n[c]!==e[c]&&a.has(c)})};n?.listeners!==!1&&r()&&(i.listeners=!0),this.#x({...i,...n})}#C(){const n=this.#e.getQueryCache().build(this.#e,this.options);if(n===this.#t)return;const e=this.#t;this.#t=n,this.#i=n.state,this.hasListeners()&&(e?.removeObserver(this),n.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#x(n){Ha.batch(()=>{n.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Adt(n,e){return Yf(e.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&e.retryOnMount===!1)}function tve(n,e){return Adt(n,e)||n.state.data!==void 0&&YY(n,e,e.refetchOnMount)}function YY(n,e,t){if(Yf(e.enabled,n)!==!1){const i=typeof t=="function"?t(n):t;return i==="always"||i!==!1&&oae(n,e)}return!1}function nve(n,e,t,i){return(n!==e||Yf(i.enabled,n)===!1)&&(!t.suspense||n.state.status!=="error")&&oae(n,t)}function oae(n,e){return Yf(e.enabled,n)!==!1&&n.isStaleByTime(rk(e.staleTime,n))}function Ndt(n,e){return!C6(n.getCurrentResult(),e)}var Rdt=class extends HL{#e;#t=void 0;#i;#n;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#o()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#e.defaultMutationOptions(e),C6(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#i,observer:this}),t?.mutationKey&&this.options.mutationKey&&Sw(t.mutationKey)!==Sw(this.options.mutationKey)?this.reset():this.#i?.state.status==="pending"&&this.#i.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#i?.removeObserver(this)}onMutationUpdate(e){this.#o(),this.#s(e)}getCurrentResult(){return this.#t}reset(){this.#i?.removeObserver(this),this.#i=void 0,this.#o(),this.#s()}mutate(e,t){return this.#n=t,this.#i?.removeObserver(this),this.#i=this.#e.getMutationCache().build(this.#e,this.options),this.#i.addObserver(this),this.#i.execute(e)}#o(){const e=this.#i?.state??bMe();this.#t={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#s(e){Ha.batch(()=>{if(this.#n&&this.hasListeners()){const t=this.#t.variables,i=this.#t.context;e?.type==="success"?(this.#n.onSuccess?.(e.data,t,i),this.#n.onSettled?.(e.data,null,t,i)):e?.type==="error"&&(this.#n.onError?.(e.error,t,i),this.#n.onSettled?.(void 0,e.error,t,i))}this.listeners.forEach(t=>{t(this.#t)})})}},yMe=E.createContext(void 0),wMe=n=>{const e=E.useContext(yMe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},F5n=({client:n,children:e})=>(E.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),ae.jsx(yMe.Provider,{value:n,children:e})),CMe=E.createContext(!1),Pdt=()=>E.useContext(CMe);CMe.Provider;function Odt(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var Mdt=E.createContext(Odt()),Fdt=()=>E.useContext(Mdt);function xMe(n,e){return typeof n=="function"?n(...e):!!n}function ZY(){}var Bdt=(n,e)=>{(n.suspense||n.throwOnError||n.experimental_prefetchInRender)&&(e.isReset()||(n.retryOnMount=!1))},$dt=n=>{E.useEffect(()=>{n.clearReset()},[n])},Wdt=({result:n,errorResetBoundary:e,throwOnError:t,query:i})=>n.isError&&!e.isReset()&&!n.isFetching&&i&&xMe(t,[n.error,i]),Hdt=n=>{n.suspense&&(n.staleTime===void 0&&(n.staleTime=1e3),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3)))},Vdt=(n,e)=>n.isLoading&&n.isFetching&&!e,zdt=(n,e)=>n?.suspense&&e.isPending,ive=(n,e,t)=>e.fetchOptimistic(n).catch(()=>{t.clearReset()});function Udt(n,e,t){const i=wMe(),r=Pdt(),s=Fdt(),o=i.defaultQueryOptions(n);i.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?"isRestoring":"optimistic",Hdt(o),Bdt(o,s),$dt(s);const a=!i.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new e(i,o)),c=l.getOptimisticResult(o);if(E.useSyncExternalStore(E.useCallback(u=>{const d=r?ZY:l.subscribe(Ha.batchCalls(u));return l.updateResult(),d},[l,r]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o,{listeners:!1})},[o,l]),zdt(o,c))throw ive(o,l,s);if(Wdt({result:c,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash)}))throw c.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(o,c),o.experimental_prefetchInRender&&!xw&&Vdt(c,r)&&(a?ive(o,l,s):i.getQueryCache().get(o.queryHash)?.promise)?.catch(ZY).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?c:l.trackResult(c)}function B5n(n,e){return Udt(n,Idt)}function $5n(n,e){const t=wMe(),[i]=E.useState(()=>new Rdt(t,n));E.useEffect(()=>{i.setOptions(n)},[i,n]);const r=E.useSyncExternalStore(E.useCallback(o=>i.subscribe(Ha.batchCalls(o)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),s=E.useCallback((o,a)=>{i.mutate(o,a).catch(ZY)},[i]);if(r.error&&xMe(i.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:s,mutateAsync:r.mutate}}var SMe={exports:{}};(function(n,e){(function(t,i){n.exports=i()})(Hh,function(){var t=1e3,i=6e4,r=36e5,s="millisecond",o="second",a="minute",l="hour",c="day",u="week",d="month",h="quarter",f="year",g="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,_=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(W){var z=["th","st","nd","rd"],q=W%100;return"["+W+(z[(q-20)%10]||z[q]||z[0])+"]"}},y=function(W,z,q){var ee=String(W);return!ee||ee.length>=z?W:""+Array(z+1-ee.length).join(q)+W},C={s:y,z:function(W){var z=-W.utcOffset(),q=Math.abs(z),ee=Math.floor(q/60),Z=q%60;return(z<=0?"+":"-")+y(ee,2,"0")+":"+y(Z,2,"0")},m:function W(z,q){if(z.date()1)return W(te[0])}else{var le=z.name;k[le]=z,Z=le}return!ee&&Z&&(x=Z),Z||!ee&&x},O=function(W,z){if(D(W))return W.clone();var q=typeof z=="object"?z:{};return q.date=W,q.args=arguments,new B(q)},M=C;M.l=I,M.i=D,M.w=function(W,z){return O(W,{locale:z.$L,utc:z.$u,x:z.$x,$offset:z.$offset})};var B=function(){function W(q){this.$L=I(q.locale,null,!0),this.parse(q),this.$x=this.$x||q.x||{},this[L]=!0}var z=W.prototype;return z.parse=function(q){this.$d=function(ee){var Z=ee.date,j=ee.utc;if(Z===null)return new Date(NaN);if(M.u(Z))return new Date;if(Z instanceof Date)return new Date(Z);if(typeof Z=="string"&&!/Z$/i.test(Z)){var te=Z.match(m);if(te){var le=te[2]-1||0,ue=(te[7]||"0").substring(0,3);return j?new Date(Date.UTC(te[1],le,te[3]||1,te[4]||0,te[5]||0,te[6]||0,ue)):new Date(te[1],le,te[3]||1,te[4]||0,te[5]||0,te[6]||0,ue)}}return new Date(Z)}(q),this.init()},z.init=function(){var q=this.$d;this.$y=q.getFullYear(),this.$M=q.getMonth(),this.$D=q.getDate(),this.$W=q.getDay(),this.$H=q.getHours(),this.$m=q.getMinutes(),this.$s=q.getSeconds(),this.$ms=q.getMilliseconds()},z.$utils=function(){return M},z.isValid=function(){return this.$d.toString()!==p},z.isSame=function(q,ee){var Z=O(q);return this.startOf(ee)<=Z&&Z<=this.endOf(ee)},z.isAfter=function(q,ee){return O(q){let t=n;for(;t;)t.callback(),t=t.next})},get(){const t=[];let i=n;for(;i;)t.push(i),i=i.next;return t},subscribe(t){let i=!0;const r=e={callback:t,next:null,prev:e};return r.prev?r.prev.next=r:n=r,function(){!i||n===null||(i=!1,r.next?r.next.prev=r.prev:e=r.prev,r.prev?r.prev.next=r.next:n=r.next)}}}}var L0e={notify(){},get:()=>[]};function Bat(n,e){let t,i=L0e,r=0,s=!1;function o(p){u();const m=i.subscribe(p);let _=!1;return()=>{_||(_=!0,m(),d())}}function a(){i.notify()}function l(){g.onStateChange&&g.onStateChange()}function c(){return s}function u(){r++,t||(t=n.subscribe(l),i=Fat())}function d(){r--,t&&r===0&&(t(),t=void 0,i.clear(),i=L0e)}function h(){s||(s=!0,u())}function f(){s&&(s=!1,d())}const g={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:h,tryUnsubscribe:f,getListeners:()=>i};return g}var $at=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Wat=$at(),Hat=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Vat=Hat(),zat=()=>Wat||Vat?E.useLayoutEffect:E.useEffect,Uat=zat(),jat=Symbol.for("react-redux-context"),qat=typeof globalThis<"u"?globalThis:{};function Kat(){if(!E.createContext)return{};const n=qat[jat]??=new Map;let e=n.get(E.createContext);return e||(e=E.createContext(null),n.set(E.createContext,e)),e}var pb=Kat();function Gat(n){const{children:e,context:t,serverState:i,store:r}=n,s=E.useMemo(()=>{const l=Bat(r);return{store:r,subscription:l,getServerState:i?()=>i:void 0}},[r,i]),o=E.useMemo(()=>r.getState(),[r]);Uat(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==r.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,o]);const a=t||pb;return E.createElement(a.Provider,{value:s},e)}var O5n=Gat;function Koe(n=pb){return function(){return E.useContext(n)}}var QPe=Koe();function JPe(n=pb){const e=n===pb?QPe:Koe(n),t=()=>{const{store:i}=e();return i};return Object.assign(t,{withTypes:()=>t}),t}var Yat=JPe();function Zat(n=pb){const e=n===pb?Yat:JPe(n),t=()=>e().dispatch;return Object.assign(t,{withTypes:()=>t}),t}var M5n=Zat(),Xat=(n,e)=>n===e;function Qat(n=pb){const e=n===pb?QPe:Koe(n),t=(i,r={})=>{const{equalityFn:s=Xat}=typeof r=="function"?{equalityFn:r}:r,o=e(),{store:a,subscription:l,getServerState:c}=o;E.useRef(!0);const u=E.useCallback({[i.name](h){return i(h)}}[i.name],[i]),d=Oat.useSyncExternalStoreWithSelector(l.addNestedSub,a.getState,c||a.getState,u,s);return E.useDebugValue(d),d};return Object.assign(t,{withTypes:()=>t}),t}var F5n=Qat();function T0e(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function Jat(...n){return e=>{let t=!1;const i=n.map(r=>{const s=T0e(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r{const{children:s,...o}=i,a=E.Children.toArray(s),l=a.find(nlt);if(l){const c=l.props.children,u=a.map(d=>d===l?E.Children.count(c)>1?E.Children.only(null):E.isValidElement(c)?c.props.children:null:d);return ae.jsx(e,{...o,ref:r,children:E.isValidElement(c)?E.cloneElement(c,void 0,u):null})}return ae.jsx(e,{...o,ref:r,children:s})});return t.displayName=`${n}.Slot`,t}var B5n=eOe("Slot");function elt(n){const e=E.forwardRef((t,i)=>{const{children:r,...s}=t;if(E.isValidElement(r)){const o=rlt(r),a=ilt(s,r.props);return r.type!==E.Fragment&&(a.ref=i?Jat(i,o):o),E.cloneElement(r,a)}return E.Children.count(r)>1?E.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var tlt=Symbol("radix.slottable");function nlt(n){return E.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===tlt}function ilt(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{const l=s(...a);return r(...a),l}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function rlt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function tOe(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;etypeof n=="boolean"?`${n}`:n===0?"0":n,I0e=mr,$5n=(n,e)=>t=>{var i;if(e?.variants==null)return I0e(n,t?.class,t?.className);const{variants:r,defaultVariants:s}=e,o=Object.keys(r).map(c=>{const u=t?.[c],d=s?.[c];if(u===null)return null;const h=D0e(u)||D0e(d);return r[c][h]}),a=t&&Object.entries(t).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),l=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((c,u)=>{let{class:d,className:h,...f}=u;return Object.entries(f).every(g=>{let[p,m]=g;return Array.isArray(m)?m.includes({...s,...a}[p]):{...s,...a}[p]===m})?[...c,d,h]:c},[]);return I0e(n,o,l,t?.class,t?.className)},Goe="-",slt=n=>{const e=alt(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:o=>{const a=o.split(Goe);return a[0]===""&&a.length!==1&&a.shift(),nOe(a,e)||olt(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&i[o]?[...l,...i[o]]:l}}},nOe=(n,e)=>{if(n.length===0)return e.classGroupId;const t=n[0],i=e.nextPart.get(t),r=i?nOe(n.slice(1),i):void 0;if(r)return r;if(e.validators.length===0)return;const s=n.join(Goe);return e.validators.find(({validator:o})=>o(s))?.classGroupId},A0e=/^\[(.+)\]$/,olt=n=>{if(A0e.test(n)){const e=A0e.exec(n)[1],t=e?.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},alt=n=>{const{theme:e,prefix:t}=n,i={nextPart:new Map,validators:[]};return clt(Object.entries(n.classGroups),t).forEach(([s,o])=>{IY(o,i,s,e)}),i},IY=(n,e,t,i)=>{n.forEach(r=>{if(typeof r=="string"){const s=r===""?e:N0e(e,r);s.classGroupId=t;return}if(typeof r=="function"){if(llt(r)){IY(r(i),e,t,i);return}e.validators.push({validator:r,classGroupId:t});return}Object.entries(r).forEach(([s,o])=>{IY(o,N0e(e,s),t,i)})})},N0e=(n,e)=>{let t=n;return e.split(Goe).forEach(i=>{t.nextPart.has(i)||t.nextPart.set(i,{nextPart:new Map,validators:[]}),t=t.nextPart.get(i)}),t},llt=n=>n.isThemeGetter,clt=(n,e)=>e?n.map(([t,i])=>{const r=i.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[t,r]}):n,ult=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,i=new Map;const r=(s,o)=>{t.set(s,o),e++,e>n&&(e=0,i=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=i.get(s))!==void 0)return r(s,o),o},set(s,o){t.has(s)?t.set(s,o):r(s,o)}}},iOe="!",dlt=n=>{const{separator:e,experimentalParseClassName:t}=n,i=e.length===1,r=e[0],s=e.length,o=a=>{const l=[];let c=0,u=0,d;for(let m=0;mu?d-u:void 0;return{modifiers:l,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:p}};return t?a=>t({className:a,parseClassName:o}):o},hlt=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(i=>{i[0]==="["?(e.push(...t.sort(),i),t=[]):t.push(i)}),e.push(...t.sort()),e},flt=n=>({cache:ult(n.cacheSize),parseClassName:dlt(n),...slt(n)}),glt=/\s+/,plt=(n,e)=>{const{parseClassName:t,getClassGroupId:i,getConflictingClassGroupIds:r}=e,s=[],o=n.trim().split(glt);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:f}=t(c);let g=!!f,p=i(g?h.substring(0,f):h);if(!p){if(!g){a=c+(a.length>0?" "+a:a);continue}if(p=i(h),!p){a=c+(a.length>0?" "+a:a);continue}g=!1}const m=hlt(u).join(":"),_=d?m+iOe:m,v=_+p;if(s.includes(v))continue;s.push(v);const y=r(p,g);for(let C=0;C0?" "+a:a)}return a};function mlt(){let n=0,e,t,i="";for(;n{if(typeof n=="string")return n;let e,t="";for(let i=0;id(u),n());return t=flt(c),i=t.cache.get,r=t.cache.set,s=a,a(l)}function a(l){const c=i(l);if(c)return c;const u=plt(l,t);return r(l,u),u}return function(){return s(mlt.apply(null,arguments))}}const Xs=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},sOe=/^\[(?:([a-z-]+):)?(.+)\]$/i,vlt=/^\d+\/\d+$/,blt=new Set(["px","full","screen"]),ylt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,wlt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Clt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,xlt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Slt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Tm=n=>tk(n)||blt.has(n)||vlt.test(n),B0=n=>WL(n,"length",Nlt),tk=n=>!!n&&!Number.isNaN(Number(n)),VU=n=>WL(n,"number",tk),gT=n=>!!n&&Number.isInteger(Number(n)),klt=n=>n.endsWith("%")&&tk(n.slice(0,-1)),Vi=n=>sOe.test(n),$0=n=>ylt.test(n),Elt=new Set(["length","size","percentage"]),Llt=n=>WL(n,Elt,oOe),Tlt=n=>WL(n,"position",oOe),Dlt=new Set(["image","url"]),Ilt=n=>WL(n,Dlt,Plt),Alt=n=>WL(n,"",Rlt),pT=()=>!0,WL=(n,e,t)=>{const i=sOe.exec(n);return i?i[1]?typeof e=="string"?i[1]===e:e.has(i[1]):t(i[2]):!1},Nlt=n=>wlt.test(n)&&!Clt.test(n),oOe=()=>!1,Rlt=n=>xlt.test(n),Plt=n=>Slt.test(n),Olt=()=>{const n=Xs("colors"),e=Xs("spacing"),t=Xs("blur"),i=Xs("brightness"),r=Xs("borderColor"),s=Xs("borderRadius"),o=Xs("borderSpacing"),a=Xs("borderWidth"),l=Xs("contrast"),c=Xs("grayscale"),u=Xs("hueRotate"),d=Xs("invert"),h=Xs("gap"),f=Xs("gradientColorStops"),g=Xs("gradientColorStopPositions"),p=Xs("inset"),m=Xs("margin"),_=Xs("opacity"),v=Xs("padding"),y=Xs("saturate"),C=Xs("scale"),x=Xs("sepia"),k=Xs("skew"),L=Xs("space"),D=Xs("translate"),I=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto",Vi,e],B=()=>[Vi,e],G=()=>["",Tm,B0],W=()=>["auto",tk,Vi],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],j=()=>["","0",Vi],te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],le=()=>[tk,Vi];return{cacheSize:500,separator:":",theme:{colors:[pT],spacing:[Tm,B0],blur:["none","",$0,Vi],brightness:le(),borderColor:[n],borderRadius:["none","","full",$0,Vi],borderSpacing:B(),borderWidth:G(),contrast:le(),grayscale:j(),hueRotate:le(),invert:j(),gap:B(),gradientColorStops:[n],gradientColorStopPositions:[klt,B0],inset:M(),margin:M(),opacity:le(),padding:B(),saturate:le(),scale:le(),sepia:j(),skew:le(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",Vi]}],container:["container"],columns:[{columns:[$0]}],"break-after":[{"break-after":te()}],"break-before":[{"break-before":te()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...z(),Vi]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",gT,Vi]}],basis:[{basis:M()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Vi]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",gT,Vi]}],"grid-cols":[{"grid-cols":[pT]}],"col-start-end":[{col:["auto",{span:["full",gT,Vi]},Vi]}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":[pT]}],"row-start-end":[{row:["auto",{span:[gT,Vi]},Vi]}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Vi]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Vi]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Vi,e]}],"min-w":[{"min-w":[Vi,e,"min","max","fit"]}],"max-w":[{"max-w":[Vi,e,"none","full","min","max","fit","prose",{screen:[$0]},$0]}],h:[{h:[Vi,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Vi,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Vi,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Vi,e,"auto","min","max","fit"]}],"font-size":[{text:["base",$0,B0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",VU]}],"font-family":[{font:[pT]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Vi]}],"line-clamp":[{"line-clamp":["none",tk,VU]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Tm,Vi]}],"list-image":[{"list-image":["none",Vi]}],"list-style-type":[{list:["none","disc","decimal",Vi]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Tm,B0]}],"underline-offset":[{"underline-offset":["auto",Tm,Vi]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Vi]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Vi]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),Tlt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Llt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Ilt]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:q()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[Tm,Vi]}],"outline-w":[{outline:[Tm,B0]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Tm,B0]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",$0,Alt]}],"shadow-color":[{shadow:[pT]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...ee(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ee()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[i]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",$0,Vi]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Vi]}],duration:[{duration:le()}],ease:[{ease:["linear","in","out","in-out",Vi]}],delay:[{delay:le()}],animate:[{animate:["none","spin","ping","pulse","bounce",Vi]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[gT,Vi]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Vi]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Vi]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Vi]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[Tm,B0,VU]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},W5n=_lt(Olt);var aOe={exports:{}},Mlt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Flt=Mlt,Blt=Flt;function lOe(){}function cOe(){}cOe.resetWarningCache=lOe;var $lt=function(){function n(i,r,s,o,a,l){if(l!==Blt){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}n.isRequired=n;function e(){return n}var t={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:e,element:n,elementType:n,instanceOf:e,node:n,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:cOe,resetWarningCache:lOe};return t.PropTypes=t,t};aOe.exports=$lt();var Wlt=aOe.exports;const ui=cs(Wlt);var Hlt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},Vlt=Object.defineProperty,zlt=Object.defineProperties,Ult=Object.getOwnPropertyDescriptors,u6=Object.getOwnPropertySymbols,uOe=Object.prototype.hasOwnProperty,dOe=Object.prototype.propertyIsEnumerable,R0e=(n,e,t)=>e in n?Vlt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,P0e=(n,e)=>{for(var t in e||(e={}))uOe.call(e,t)&&R0e(n,t,e[t]);if(u6)for(var t of u6(e))dOe.call(e,t)&&R0e(n,t,e[t]);return n},jlt=(n,e)=>zlt(n,Ult(e)),qlt=(n,e)=>{var t={};for(var i in n)uOe.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&u6)for(var i of u6(n))e.indexOf(i)<0&&dOe.call(n,i)&&(t[i]=n[i]);return t},Wr=(n,e,t)=>{const i=E.forwardRef((r,s)=>{var o=r,{color:a="currentColor",size:l=24,stroke:c=2,children:u}=o,d=qlt(o,["color","size","stroke","children"]);return E.createElement("svg",P0e(jlt(P0e({ref:s},Hlt),{width:l,height:l,stroke:a,strokeWidth:c,className:`tabler-icon tabler-icon-${n}`}),d),[...t.map(([h,f])=>E.createElement(h,f)),...u||[]])});return i.propTypes={color:ui.string,size:ui.oneOfType([ui.string,ui.number]),stroke:ui.oneOfType([ui.string,ui.number])},i.displayName=`${e}`,i},H5n=Wr("adjustments","IconAdjustments",[["path",{d:"M4 10a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M6 4v4",key:"svg-1"}],["path",{d:"M6 12v8",key:"svg-2"}],["path",{d:"M10 16a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-3"}],["path",{d:"M12 4v10",key:"svg-4"}],["path",{d:"M12 18v2",key:"svg-5"}],["path",{d:"M16 7a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-6"}],["path",{d:"M18 4v1",key:"svg-7"}],["path",{d:"M18 9v11",key:"svg-8"}]]),V5n=Wr("brand-telegram","IconBrandTelegram",[["path",{d:"M15 10l-4 4l6 6l4 -16l-18 7l4 2l2 6l3 -4",key:"svg-0"}]]),z5n=Wr("building-store","IconBuildingStore",[["path",{d:"M3 21l18 0",key:"svg-0"}],["path",{d:"M3 7v1a3 3 0 0 0 6 0v-1m0 1a3 3 0 0 0 6 0v-1m0 1a3 3 0 0 0 6 0v-1h-18l2 -4h14l2 4",key:"svg-1"}],["path",{d:"M5 21l0 -10.15",key:"svg-2"}],["path",{d:"M19 21l0 -10.15",key:"svg-3"}],["path",{d:"M9 21v-4a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v4",key:"svg-4"}]]),U5n=Wr("building","IconBuilding",[["path",{d:"M3 21l18 0",key:"svg-0"}],["path",{d:"M9 8l1 0",key:"svg-1"}],["path",{d:"M9 12l1 0",key:"svg-2"}],["path",{d:"M9 16l1 0",key:"svg-3"}],["path",{d:"M14 8l1 0",key:"svg-4"}],["path",{d:"M14 12l1 0",key:"svg-5"}],["path",{d:"M14 16l1 0",key:"svg-6"}],["path",{d:"M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16",key:"svg-7"}]]),j5n=Wr("cash","IconCash",[["path",{d:"M7 9m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M14 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M17 9v-2a2 2 0 0 0 -2 -2h-10a2 2 0 0 0 -2 2v6a2 2 0 0 0 2 2h2",key:"svg-2"}]]),q5n=Wr("chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),K5n=Wr("chevrons-left","IconChevronsLeft",[["path",{d:"M11 7l-5 5l5 5",key:"svg-0"}],["path",{d:"M17 7l-5 5l5 5",key:"svg-1"}]]),G5n=Wr("copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]),Y5n=Wr("credit-card","IconCreditCard",[["path",{d:"M3 5m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M3 10l18 0",key:"svg-1"}],["path",{d:"M7 15l.01 0",key:"svg-2"}],["path",{d:"M11 15l2 0",key:"svg-3"}]]),Z5n=Wr("dashboard","IconDashboard",[["path",{d:"M12 13m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M13.45 11.55l2.05 -2.05",key:"svg-1"}],["path",{d:"M6.4 20a9 9 0 1 1 11.2 0z",key:"svg-2"}]]),X5n=Wr("device-desktop","IconDeviceDesktop",[["path",{d:"M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10z",key:"svg-0"}],["path",{d:"M7 20h10",key:"svg-1"}],["path",{d:"M9 16v4",key:"svg-2"}],["path",{d:"M15 16v4",key:"svg-3"}]]),Q5n=Wr("discount-check","IconDiscountCheck",[["path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1",key:"svg-0"}],["path",{d:"M9 12l2 2l4 -4",key:"svg-1"}]]),J5n=Wr("eye-off","IconEyeOff",[["path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828",key:"svg-0"}],["path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]]),eFn=Wr("eye","IconEye",[["path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6",key:"svg-1"}]]),tFn=Wr("file-text","IconFileText",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}],["path",{d:"M9 9l1 0",key:"svg-2"}],["path",{d:"M9 13l6 0",key:"svg-3"}],["path",{d:"M9 17l6 0",key:"svg-4"}]]),nFn=Wr("gift","IconGift",[["path",{d:"M3 8m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1z",key:"svg-0"}],["path",{d:"M12 8l0 13",key:"svg-1"}],["path",{d:"M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7",key:"svg-2"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5",key:"svg-3"}]]),iFn=Wr("loader-2","IconLoader2",[["path",{d:"M12 3a9 9 0 1 0 9 9",key:"svg-0"}]]),rFn=Wr("lock","IconLock",[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-4a4 4 0 1 1 8 0v4",key:"svg-2"}]]),sFn=Wr("mail","IconMail",[["path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z",key:"svg-0"}],["path",{d:"M3 7l9 6l9 -6",key:"svg-1"}]]),oFn=Wr("menu-2","IconMenu2",[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l16 0",key:"svg-1"}],["path",{d:"M4 18l16 0",key:"svg-2"}]]),aFn=Wr("moon","IconMoon",[["path",{d:"M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z",key:"svg-0"}]]),lFn=Wr("news","IconNews",[["path",{d:"M16 6h3a1 1 0 0 1 1 1v11a2 2 0 0 1 -4 0v-13a1 1 0 0 0 -1 -1h-10a1 1 0 0 0 -1 1v12a3 3 0 0 0 3 3h11",key:"svg-0"}],["path",{d:"M8 8l4 0",key:"svg-1"}],["path",{d:"M8 12l4 0",key:"svg-2"}],["path",{d:"M8 16l4 0",key:"svg-3"}]]),cFn=Wr("route","IconRoute",[["path",{d:"M3 19a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M19 7a2 2 0 1 0 0 -4a2 2 0 0 0 0 4z",key:"svg-1"}],["path",{d:"M11 19h5.5a3.5 3.5 0 0 0 0 -7h-8a3.5 3.5 0 0 1 0 -7h4.5",key:"svg-2"}]]),uFn=Wr("server-bolt","IconServerBolt",[["path",{d:"M3 4m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M15 20h-9a3 3 0 0 1 -3 -3v-2a3 3 0 0 1 3 -3h12",key:"svg-1"}],["path",{d:"M7 8v.01",key:"svg-2"}],["path",{d:"M7 16v.01",key:"svg-3"}],["path",{d:"M20 15l-2 3h3l-2 3",key:"svg-4"}]]),dFn=Wr("server","IconServer",[["path",{d:"M3 4m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M3 12m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-1"}],["path",{d:"M7 8l0 .01",key:"svg-2"}],["path",{d:"M7 16l0 .01",key:"svg-3"}]]),hFn=Wr("settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]),fFn=Wr("sun","IconSun",[["path",{d:"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7",key:"svg-1"}]]),gFn=Wr("template","IconTemplate",[["path",{d:"M4 4m0 1a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1z",key:"svg-0"}],["path",{d:"M4 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z",key:"svg-1"}],["path",{d:"M14 12l6 0",key:"svg-2"}],["path",{d:"M14 16l6 0",key:"svg-3"}],["path",{d:"M14 20l6 0",key:"svg-4"}]]),pFn=Wr("ticket","IconTicket",[["path",{d:"M15 5l0 2",key:"svg-0"}],["path",{d:"M15 11l0 2",key:"svg-1"}],["path",{d:"M15 17l0 2",key:"svg-2"}],["path",{d:"M5 5h14a2 2 0 0 1 2 2v3a2 2 0 0 0 0 4v3a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-3a2 2 0 0 0 0 -4v-3a2 2 0 0 1 2 -2",key:"svg-3"}]]),mFn=Wr("user-circle","IconUserCircle",[["path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M12 10m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855",key:"svg-2"}]]),_Fn=Wr("user","IconUser",[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}]]),vFn=Wr("users","IconUsers",[["path",{d:"M9 7m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"svg-2"}],["path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85",key:"svg-3"}]]),bFn=Wr("x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);function O0e(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function Pg(...n){return e=>{let t=!1;const i=n.map(r=>{const s=O0e(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(Glt);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(AY,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(AY,{...i,ref:e,children:t})});hOe.displayName="Slot";var AY=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=Zlt(t);return E.cloneElement(t,{...Ylt(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});AY.displayName="SlotClone";var Klt=({children:n})=>ae.jsx(ae.Fragment,{children:n});function Glt(n){return E.isValidElement(n)&&n.type===Klt}function Ylt(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function Zlt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Xlt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Pn=Xlt.reduce((n,e)=>{const t=E.forwardRef((i,r)=>{const{asChild:s,...o}=i,a=s?hOe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),ae.jsx(a,{...o,ref:r})});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function fOe(n,e){n&&h0.flushSync(()=>n.dispatchEvent(e))}var Qlt="Separator",M0e="horizontal",Jlt=["horizontal","vertical"],gOe=E.forwardRef((n,e)=>{const{decorative:t,orientation:i=M0e,...r}=n,s=ect(i)?i:M0e,a=t?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return ae.jsx(Pn.div,{"data-orientation":s,...a,...r,ref:e})});gOe.displayName=Qlt;function ect(n){return Jlt.includes(n)}var yFn=gOe,MP=n=>n.type==="checkbox",Ey=n=>n instanceof Date,Kc=n=>n==null;const pOe=n=>typeof n=="object";var Qo=n=>!Kc(n)&&!Array.isArray(n)&&pOe(n)&&!Ey(n),mOe=n=>Qo(n)&&n.target?MP(n.target)?n.target.checked:n.target.value:n,tct=n=>n.substring(0,n.search(/\.\d+(\.|$)/))||n,_Oe=(n,e)=>n.has(tct(e)),nct=n=>{const e=n.constructor&&n.constructor.prototype;return Qo(e)&&e.hasOwnProperty("isPrototypeOf")},Yoe=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Fa(n){let e;const t=Array.isArray(n),i=typeof FileList<"u"?n instanceof FileList:!1;if(n instanceof Date)e=new Date(n);else if(n instanceof Set)e=new Set(n);else if(!(Yoe&&(n instanceof Blob||i))&&(t||Qo(n)))if(e=t?[]:{},!t&&!nct(n))e=n;else for(const r in n)n.hasOwnProperty(r)&&(e[r]=Fa(n[r]));else return n;return e}var FP=n=>Array.isArray(n)?n.filter(Boolean):[],io=n=>n===void 0,Vt=(n,e,t)=>{if(!e||!Qo(n))return t;const i=FP(e.split(/[,[\].]+?/)).reduce((r,s)=>Kc(r)?r:r[s],n);return io(i)||i===n?io(n[e])?t:n[e]:i},Ph=n=>typeof n=="boolean",Zoe=n=>/^\w*$/.test(n),vOe=n=>FP(n.replace(/["|']|\]/g,"").split(/\.|\[/)),zr=(n,e,t)=>{let i=-1;const r=Zoe(e)?[e]:vOe(e),s=r.length,o=s-1;for(;++iU.useContext(bOe),wFn=n=>{const{children:e,...t}=n;return U.createElement(bOe.Provider,{value:t},e)};var yOe=(n,e,t,i=!0)=>{const r={defaultValues:e._defaultValues};for(const s in n)Object.defineProperty(r,s,{get:()=>{const o=s;return e._proxyFormState[o]!==Vh.all&&(e._proxyFormState[o]=!i||Vh.all),t&&(t[o]=!0),n[o]}});return r},zc=n=>Qo(n)&&!Object.keys(n).length,wOe=(n,e,t,i)=>{t(n);const{name:r,...s}=n;return zc(s)||Object.keys(s).length>=Object.keys(e).length||Object.keys(s).find(o=>e[o]===(!i||Vh.all))},zu=n=>Array.isArray(n)?n:[n],COe=(n,e,t)=>!n||!e||n===e||zu(n).some(i=>i&&(t?i===e:i.startsWith(e)||e.startsWith(i)));function b$(n){const e=U.useRef(n);e.current=n,U.useEffect(()=>{const t=!n.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{t&&t.unsubscribe()}},[n.disabled])}function ict(n){const e=v$(),{control:t=e.control,disabled:i,name:r,exact:s}=n,[o,a]=U.useState(t._formState),l=U.useRef(!0),c=U.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=U.useRef(r);return u.current=r,b$({disabled:i,next:d=>l.current&&COe(u.current,d.name,s)&&wOe(d,c.current,t._updateFormState)&&a({...t._formState,...d}),subject:t._subjects.state}),U.useEffect(()=>(l.current=!0,c.current.isValid&&t._updateValid(!0),()=>{l.current=!1}),[t]),U.useMemo(()=>yOe(o,t,c.current,!1),[o,t])}var Ep=n=>typeof n=="string",xOe=(n,e,t,i,r)=>Ep(n)?(i&&e.watch.add(n),Vt(t,n,r)):Array.isArray(n)?n.map(s=>(i&&e.watch.add(s),Vt(t,s))):(i&&(e.watchAll=!0),t);function rct(n){const e=v$(),{control:t=e.control,name:i,defaultValue:r,disabled:s,exact:o}=n,a=U.useRef(i);a.current=i,b$({disabled:s,subject:t._subjects.values,next:u=>{COe(a.current,u.name,o)&&c(Fa(xOe(a.current,t._names,u.values||t._formValues,!1,r)))}});const[l,c]=U.useState(t._getWatch(i,r));return U.useEffect(()=>t._removeUnmounted()),l}function sct(n){const e=v$(),{name:t,disabled:i,control:r=e.control,shouldUnregister:s}=n,o=_Oe(r._names.array,t),a=rct({control:r,name:t,defaultValue:Vt(r._formValues,t,Vt(r._defaultValues,t,n.defaultValue)),exact:!0}),l=ict({control:r,name:t,exact:!0}),c=U.useRef(r.register(t,{...n.rules,value:a,...Ph(n.disabled)?{disabled:n.disabled}:{}})),u=U.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Vt(l.errors,t)},isDirty:{enumerable:!0,get:()=>!!Vt(l.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!Vt(l.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!Vt(l.validatingFields,t)},error:{enumerable:!0,get:()=>Vt(l.errors,t)}}),[l,t]),d=U.useMemo(()=>({name:t,value:a,...Ph(i)||l.disabled?{disabled:l.disabled||i}:{},onChange:h=>c.current.onChange({target:{value:mOe(h),name:t},type:d6.CHANGE}),onBlur:()=>c.current.onBlur({target:{value:Vt(r._formValues,t),name:t},type:d6.BLUR}),ref:h=>{const f=Vt(r._fields,t);f&&h&&(f._f.ref={focus:()=>h.focus(),select:()=>h.select(),setCustomValidity:g=>h.setCustomValidity(g),reportValidity:()=>h.reportValidity()})}}),[t,r._formValues,i,l.disabled,a,r._fields]);return U.useEffect(()=>{const h=r._options.shouldUnregister||s,f=(g,p)=>{const m=Vt(r._fields,g);m&&m._f&&(m._f.mount=p)};if(f(t,!0),h){const g=Fa(Vt(r._options.defaultValues,t));zr(r._defaultValues,t,g),io(Vt(r._formValues,t))&&zr(r._formValues,t,g)}return!o&&r.register(t),()=>{(o?h&&!r._state.action:h)?r.unregister(t):f(t,!1)}},[t,r,o,s]),U.useEffect(()=>{r._updateDisabledField({disabled:i,fields:r._fields,name:t})},[i,t,r]),U.useMemo(()=>({field:d,formState:l,fieldState:u}),[d,l,u])}const CFn=n=>n.render(sct(n));var SOe=(n,e,t,i,r)=>e?{...t[n],types:{...t[n]&&t[n].types?t[n].types:{},[i]:r||!0}}:{},W0=()=>{const n=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=(Math.random()*16+n)%16|0;return(e=="x"?t:t&3|8).toString(16)})},zU=(n,e,t={})=>t.shouldFocus||io(t.shouldFocus)?t.focusName||`${n}.${io(t.focusIndex)?e:t.focusIndex}.`:"",dI=n=>({isOnSubmit:!n||n===Vh.onSubmit,isOnBlur:n===Vh.onBlur,isOnChange:n===Vh.onChange,isOnAll:n===Vh.all,isOnTouch:n===Vh.onTouched}),NY=(n,e,t)=>!t&&(e.watchAll||e.watch.has(n)||[...e.watch].some(i=>n.startsWith(i)&&/^\.\w+/.test(n.slice(i.length))));const nk=(n,e,t,i)=>{for(const r of t||Object.keys(n)){const s=Vt(n,r);if(s){const{_f:o,...a}=s;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],r)&&!i)return!0;if(o.ref&&e(o.ref,o.name)&&!i)return!0;if(nk(a,e))break}else if(Qo(a)&&nk(a,e))break}}};var kOe=(n,e,t)=>{const i=zu(Vt(n,t));return zr(i,"root",e[t]),zr(n,t,i),n},Xoe=n=>n.type==="file",yp=n=>typeof n=="function",h6=n=>{if(!Yoe)return!1;const e=n?n.ownerDocument:0;return n instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},I5=n=>Ep(n),Qoe=n=>n.type==="radio",f6=n=>n instanceof RegExp;const F0e={value:!1,isValid:!1},B0e={value:!0,isValid:!0};var EOe=n=>{if(Array.isArray(n)){if(n.length>1){const e=n.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:e,isValid:!!e.length}}return n[0].checked&&!n[0].disabled?n[0].attributes&&!io(n[0].attributes.value)?io(n[0].value)||n[0].value===""?B0e:{value:n[0].value,isValid:!0}:B0e:F0e}return F0e};const $0e={isValid:!1,value:null};var LOe=n=>Array.isArray(n)?n.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,$0e):$0e;function W0e(n,e,t="validate"){if(I5(n)||Array.isArray(n)&&n.every(I5)||Ph(n)&&!n)return{type:t,message:I5(n)?n:"",ref:e}}var ax=n=>Qo(n)&&!f6(n)?n:{value:n,message:""},RY=async(n,e,t,i,r,s)=>{const{ref:o,refs:a,required:l,maxLength:c,minLength:u,min:d,max:h,pattern:f,validate:g,name:p,valueAsNumber:m,mount:_}=n._f,v=Vt(t,p);if(!_||e.has(p))return{};const y=a?a[0]:o,C=B=>{r&&y.reportValidity&&(y.setCustomValidity(Ph(B)?"":B||""),y.reportValidity())},x={},k=Qoe(o),L=MP(o),D=k||L,I=(m||Xoe(o))&&io(o.value)&&io(v)||h6(o)&&o.value===""||v===""||Array.isArray(v)&&!v.length,O=SOe.bind(null,p,i,x),M=(B,G,W,z=Dm.maxLength,q=Dm.minLength)=>{const ee=B?G:W;x[p]={type:B?z:q,message:ee,ref:o,...O(B?z:q,ee)}};if(s?!Array.isArray(v)||!v.length:l&&(!D&&(I||Kc(v))||Ph(v)&&!v||L&&!EOe(a).isValid||k&&!LOe(a).isValid)){const{value:B,message:G}=I5(l)?{value:!!l,message:l}:ax(l);if(B&&(x[p]={type:Dm.required,message:G,ref:y,...O(Dm.required,G)},!i))return C(G),x}if(!I&&(!Kc(d)||!Kc(h))){let B,G;const W=ax(h),z=ax(d);if(!Kc(v)&&!isNaN(v)){const q=o.valueAsNumber||v&&+v;Kc(W.value)||(B=q>W.value),Kc(z.value)||(G=qnew Date(new Date().toDateString()+" "+te),Z=o.type=="time",j=o.type=="week";Ep(W.value)&&v&&(B=Z?ee(v)>ee(W.value):j?v>W.value:q>new Date(W.value)),Ep(z.value)&&v&&(G=Z?ee(v)+B.value,z=!Kc(G.value)&&v.length<+G.value;if((W||z)&&(M(W,B.message,G.message),!i))return C(x[p].message),x}if(f&&!I&&Ep(v)){const{value:B,message:G}=ax(f);if(f6(B)&&!v.match(B)&&(x[p]={type:Dm.pattern,message:G,ref:o,...O(Dm.pattern,G)},!i))return C(G),x}if(g){if(yp(g)){const B=await g(v,t),G=W0e(B,y);if(G&&(x[p]={...G,...O(Dm.validate,G.message)},!i))return C(G.message),x}else if(Qo(g)){let B={};for(const G in g){if(!zc(B)&&!i)break;const W=W0e(await g[G](v,t),y,G);W&&(B={...W,...O(G,W.message)},C(W.message),i&&(x[p]=B))}if(!zc(B)&&(x[p]={ref:y,...B},!i))return x}}return C(!0),x},UU=(n,e)=>[...n,...zu(e)],jU=n=>Array.isArray(n)?n.map(()=>{}):void 0;function qU(n,e,t){return[...n.slice(0,e),...zu(t),...n.slice(e)]}var KU=(n,e,t)=>Array.isArray(n)?(io(n[t])&&(n[t]=void 0),n.splice(t,0,n.splice(e,1)[0]),n):[],GU=(n,e)=>[...zu(e),...zu(n)];function oct(n,e){let t=0;const i=[...n];for(const r of e)i.splice(r-t,1),t++;return FP(i).length?i:[]}var YU=(n,e)=>io(e)?[]:oct(n,zu(e).sort((t,i)=>t-i)),ZU=(n,e,t)=>{[n[e],n[t]]=[n[t],n[e]]};function act(n,e){const t=e.slice(0,-1).length;let i=0;for(;i(n[e]=t,n);function xFn(n){const e=v$(),{control:t=e.control,name:i,keyName:r="id",shouldUnregister:s,rules:o}=n,[a,l]=U.useState(t._getFieldArray(i)),c=U.useRef(t._getFieldArray(i).map(W0)),u=U.useRef(a),d=U.useRef(i),h=U.useRef(!1);d.current=i,u.current=a,t._names.array.add(i),o&&t.register(i,o),b$({next:({values:k,name:L})=>{if(L===d.current||!L){const D=Vt(k,d.current);Array.isArray(D)&&(l(D),c.current=D.map(W0))}},subject:t._subjects.array});const f=U.useCallback(k=>{h.current=!0,t._updateFieldArray(i,k)},[t,i]),g=(k,L)=>{const D=zu(Fa(k)),I=UU(t._getFieldArray(i),D);t._names.focus=zU(i,I.length-1,L),c.current=UU(c.current,D.map(W0)),f(I),l(I),t._updateFieldArray(i,I,UU,{argA:jU(k)})},p=(k,L)=>{const D=zu(Fa(k)),I=GU(t._getFieldArray(i),D);t._names.focus=zU(i,0,L),c.current=GU(c.current,D.map(W0)),f(I),l(I),t._updateFieldArray(i,I,GU,{argA:jU(k)})},m=k=>{const L=YU(t._getFieldArray(i),k);c.current=YU(c.current,k),f(L),l(L),!Array.isArray(Vt(t._fields,i))&&zr(t._fields,i,void 0),t._updateFieldArray(i,L,YU,{argA:k})},_=(k,L,D)=>{const I=zu(Fa(L)),O=qU(t._getFieldArray(i),k,I);t._names.focus=zU(i,k,D),c.current=qU(c.current,k,I.map(W0)),f(O),l(O),t._updateFieldArray(i,O,qU,{argA:k,argB:jU(L)})},v=(k,L)=>{const D=t._getFieldArray(i);ZU(D,k,L),ZU(c.current,k,L),f(D),l(D),t._updateFieldArray(i,D,ZU,{argA:k,argB:L},!1)},y=(k,L)=>{const D=t._getFieldArray(i);KU(D,k,L),KU(c.current,k,L),f(D),l(D),t._updateFieldArray(i,D,KU,{argA:k,argB:L},!1)},C=(k,L)=>{const D=Fa(L),I=H0e(t._getFieldArray(i),k,D);c.current=[...I].map((O,M)=>!O||M===k?W0():c.current[M]),f(I),l([...I]),t._updateFieldArray(i,I,H0e,{argA:k,argB:D},!0,!1)},x=k=>{const L=zu(Fa(k));c.current=L.map(W0),f([...L]),l([...L]),t._updateFieldArray(i,[...L],D=>D,{},!0,!1)};return U.useEffect(()=>{if(t._state.action=!1,NY(i,t._names)&&t._subjects.state.next({...t._formState}),h.current&&(!dI(t._options.mode).isOnSubmit||t._formState.isSubmitted))if(t._options.resolver)t._executeSchema([i]).then(k=>{const L=Vt(k.errors,i),D=Vt(t._formState.errors,i);(D?!L&&D.type||L&&(D.type!==L.type||D.message!==L.message):L&&L.type)&&(L?zr(t._formState.errors,i,L):_a(t._formState.errors,i),t._subjects.state.next({errors:t._formState.errors}))});else{const k=Vt(t._fields,i);k&&k._f&&!(dI(t._options.reValidateMode).isOnSubmit&&dI(t._options.mode).isOnSubmit)&&RY(k,t._names.disabled,t._formValues,t._options.criteriaMode===Vh.all,t._options.shouldUseNativeValidation,!0).then(L=>!zc(L)&&t._subjects.state.next({errors:kOe(t._formState.errors,L,i)}))}t._subjects.values.next({name:i,values:{...t._formValues}}),t._names.focus&&nk(t._fields,(k,L)=>{if(t._names.focus&&L.startsWith(t._names.focus)&&k.focus)return k.focus(),1}),t._names.focus="",t._updateValid(),h.current=!1},[a,i,t]),U.useEffect(()=>(!Vt(t._formValues,i)&&t._updateFieldArray(i),()=>{(t._options.shouldUnregister||s)&&t.unregister(i)}),[i,t,r,s]),{swap:U.useCallback(v,[f,i,t]),move:U.useCallback(y,[f,i,t]),prepend:U.useCallback(p,[f,i,t]),append:U.useCallback(g,[f,i,t]),remove:U.useCallback(m,[f,i,t]),insert:U.useCallback(_,[f,i,t]),update:U.useCallback(C,[f,i,t]),replace:U.useCallback(x,[f,i,t]),fields:U.useMemo(()=>a.map((k,L)=>({...k,[r]:c.current[L]||W0()})),[a,r])}}var XU=()=>{let n=[];return{get observers(){return n},next:r=>{for(const s of n)s.next&&s.next(r)},subscribe:r=>(n.push(r),{unsubscribe:()=>{n=n.filter(s=>s!==r)}}),unsubscribe:()=>{n=[]}}},PY=n=>Kc(n)||!pOe(n);function dv(n,e){if(PY(n)||PY(e))return n===e;if(Ey(n)&&Ey(e))return n.getTime()===e.getTime();const t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(const r of t){const s=n[r];if(!i.includes(r))return!1;if(r!=="ref"){const o=e[r];if(Ey(s)&&Ey(o)||Qo(s)&&Qo(o)||Array.isArray(s)&&Array.isArray(o)?!dv(s,o):s!==o)return!1}}return!0}var TOe=n=>n.type==="select-multiple",cct=n=>Qoe(n)||MP(n),QU=n=>h6(n)&&n.isConnected,DOe=n=>{for(const e in n)if(yp(n[e]))return!0;return!1};function g6(n,e={}){const t=Array.isArray(n);if(Qo(n)||t)for(const i in n)Array.isArray(n[i])||Qo(n[i])&&!DOe(n[i])?(e[i]=Array.isArray(n[i])?[]:{},g6(n[i],e[i])):Kc(n[i])||(e[i]=!0);return e}function IOe(n,e,t){const i=Array.isArray(n);if(Qo(n)||i)for(const r in n)Array.isArray(n[r])||Qo(n[r])&&!DOe(n[r])?io(e)||PY(t[r])?t[r]=Array.isArray(n[r])?g6(n[r],[]):{...g6(n[r])}:IOe(n[r],Kc(e)?{}:e[r],t[r]):t[r]=!dv(n[r],e[r]);return t}var mT=(n,e)=>IOe(n,e,g6(e)),AOe=(n,{valueAsNumber:e,valueAsDate:t,setValueAs:i})=>io(n)?n:e?n===""?NaN:n&&+n:t&&Ep(n)?new Date(n):i?i(n):n;function JU(n){const e=n.ref;return Xoe(e)?e.files:Qoe(e)?LOe(n.refs).value:TOe(e)?[...e.selectedOptions].map(({value:t})=>t):MP(e)?EOe(n.refs).value:AOe(io(e.value)?n.ref.value:e.value,n)}var uct=(n,e,t,i)=>{const r={};for(const s of n){const o=Vt(e,s);o&&zr(r,s,o._f)}return{criteriaMode:t,names:[...n],fields:r,shouldUseNativeValidation:i}},_T=n=>io(n)?n:f6(n)?n.source:Qo(n)?f6(n.value)?n.value.source:n.value:n;const V0e="AsyncFunction";var dct=n=>!!n&&!!n.validate&&!!(yp(n.validate)&&n.validate.constructor.name===V0e||Qo(n.validate)&&Object.values(n.validate).find(e=>e.constructor.name===V0e)),hct=n=>n.mount&&(n.required||n.min||n.max||n.maxLength||n.minLength||n.pattern||n.validate);function z0e(n,e,t){const i=Vt(n,t);if(i||Zoe(t))return{error:i,name:t};const r=t.split(".");for(;r.length;){const s=r.join("."),o=Vt(e,s),a=Vt(n,s);if(o&&!Array.isArray(o)&&t!==s)return{name:t};if(a&&a.type)return{name:s,error:a};r.pop()}return{name:t}}var fct=(n,e,t,i,r)=>r.isOnAll?!1:!t&&r.isOnTouch?!(e||n):(t?i.isOnBlur:r.isOnBlur)?!n:(t?i.isOnChange:r.isOnChange)?n:!0,gct=(n,e)=>!FP(Vt(n,e)).length&&_a(n,e);const pct={mode:Vh.onSubmit,reValidateMode:Vh.onChange,shouldFocusError:!0};function mct(n={}){let e={...pct,...n},t={submitCount:0,isDirty:!1,isLoading:yp(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},i={},r=Qo(e.defaultValues)||Qo(e.values)?Fa(e.defaultValues||e.values)||{}:{},s=e.shouldUnregister?{}:Fa(r),o={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:XU(),array:XU(),state:XU()},h=dI(e.mode),f=dI(e.reValidateMode),g=e.criteriaMode===Vh.all,p=ye=>Ie=>{clearTimeout(c),c=setTimeout(ye,Ie)},m=async ye=>{if(!e.disabled&&(u.isValid||ye)){const Ie=e.resolver?zc((await D()).errors):await O(i,!0);Ie!==t.isValid&&d.state.next({isValid:Ie})}},_=(ye,Ie)=>{!e.disabled&&(u.isValidating||u.validatingFields)&&((ye||Array.from(a.mount)).forEach(Ve=>{Ve&&(Ie?zr(t.validatingFields,Ve,Ie):_a(t.validatingFields,Ve))}),d.state.next({validatingFields:t.validatingFields,isValidating:!zc(t.validatingFields)}))},v=(ye,Ie=[],Ve,wt,vt=!0,nt=!0)=>{if(wt&&Ve&&!e.disabled){if(o.action=!0,nt&&Array.isArray(Vt(i,ye))){const $t=Ve(Vt(i,ye),wt.argA,wt.argB);vt&&zr(i,ye,$t)}if(nt&&Array.isArray(Vt(t.errors,ye))){const $t=Ve(Vt(t.errors,ye),wt.argA,wt.argB);vt&&zr(t.errors,ye,$t),gct(t.errors,ye)}if(u.touchedFields&&nt&&Array.isArray(Vt(t.touchedFields,ye))){const $t=Ve(Vt(t.touchedFields,ye),wt.argA,wt.argB);vt&&zr(t.touchedFields,ye,$t)}u.dirtyFields&&(t.dirtyFields=mT(r,s)),d.state.next({name:ye,isDirty:B(ye,Ie),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else zr(s,ye,Ie)},y=(ye,Ie)=>{zr(t.errors,ye,Ie),d.state.next({errors:t.errors})},C=ye=>{t.errors=ye,d.state.next({errors:t.errors,isValid:!1})},x=(ye,Ie,Ve,wt)=>{const vt=Vt(i,ye);if(vt){const nt=Vt(s,ye,io(Ve)?Vt(r,ye):Ve);io(nt)||wt&&wt.defaultChecked||Ie?zr(s,ye,Ie?nt:JU(vt._f)):z(ye,nt),o.mount&&m()}},k=(ye,Ie,Ve,wt,vt)=>{let nt=!1,$t=!1;const an={name:ye};if(!e.disabled){const Pi=!!(Vt(i,ye)&&Vt(i,ye)._f&&Vt(i,ye)._f.disabled);if(!Ve||wt){u.isDirty&&($t=t.isDirty,t.isDirty=an.isDirty=B(),nt=$t!==an.isDirty);const Xn=Pi||dv(Vt(r,ye),Ie);$t=!!(!Pi&&Vt(t.dirtyFields,ye)),Xn||Pi?_a(t.dirtyFields,ye):zr(t.dirtyFields,ye,!0),an.dirtyFields=t.dirtyFields,nt=nt||u.dirtyFields&&$t!==!Xn}if(Ve){const Xn=Vt(t.touchedFields,ye);Xn||(zr(t.touchedFields,ye,Ve),an.touchedFields=t.touchedFields,nt=nt||u.touchedFields&&Xn!==Ve)}nt&&vt&&d.state.next(an)}return nt?an:{}},L=(ye,Ie,Ve,wt)=>{const vt=Vt(t.errors,ye),nt=u.isValid&&Ph(Ie)&&t.isValid!==Ie;if(e.delayError&&Ve?(l=p(()=>y(ye,Ve)),l(e.delayError)):(clearTimeout(c),l=null,Ve?zr(t.errors,ye,Ve):_a(t.errors,ye)),(Ve?!dv(vt,Ve):vt)||!zc(wt)||nt){const $t={...wt,...nt&&Ph(Ie)?{isValid:Ie}:{},errors:t.errors,name:ye};t={...t,...$t},d.state.next($t)}},D=async ye=>{_(ye,!0);const Ie=await e.resolver(s,e.context,uct(ye||a.mount,i,e.criteriaMode,e.shouldUseNativeValidation));return _(ye),Ie},I=async ye=>{const{errors:Ie}=await D(ye);if(ye)for(const Ve of ye){const wt=Vt(Ie,Ve);wt?zr(t.errors,Ve,wt):_a(t.errors,Ve)}else t.errors=Ie;return Ie},O=async(ye,Ie,Ve={valid:!0})=>{for(const wt in ye){const vt=ye[wt];if(vt){const{_f:nt,...$t}=vt;if(nt){const an=a.array.has(nt.name),Pi=vt._f&&dct(vt._f);Pi&&u.validatingFields&&_([wt],!0);const Xn=await RY(vt,a.disabled,s,g,e.shouldUseNativeValidation&&!Ie,an);if(Pi&&u.validatingFields&&_([wt]),Xn[nt.name]&&(Ve.valid=!1,Ie))break;!Ie&&(Vt(Xn,nt.name)?an?kOe(t.errors,Xn,nt.name):zr(t.errors,nt.name,Xn[nt.name]):_a(t.errors,nt.name))}!zc($t)&&await O($t,Ie,Ve)}}return Ve.valid},M=()=>{for(const ye of a.unMount){const Ie=Vt(i,ye);Ie&&(Ie._f.refs?Ie._f.refs.every(Ve=>!QU(Ve)):!QU(Ie._f.ref))&&Me(ye)}a.unMount=new Set},B=(ye,Ie)=>!e.disabled&&(ye&&Ie&&zr(s,ye,Ie),!dv(le(),r)),G=(ye,Ie,Ve)=>xOe(ye,a,{...o.mount?s:io(Ie)?r:Ep(ye)?{[ye]:Ie}:Ie},Ve,Ie),W=ye=>FP(Vt(o.mount?s:r,ye,e.shouldUnregister?Vt(r,ye,[]):[])),z=(ye,Ie,Ve={})=>{const wt=Vt(i,ye);let vt=Ie;if(wt){const nt=wt._f;nt&&(!nt.disabled&&zr(s,ye,AOe(Ie,nt)),vt=h6(nt.ref)&&Kc(Ie)?"":Ie,TOe(nt.ref)?[...nt.ref.options].forEach($t=>$t.selected=vt.includes($t.value)):nt.refs?MP(nt.ref)?nt.refs.length>1?nt.refs.forEach($t=>(!$t.defaultChecked||!$t.disabled)&&($t.checked=Array.isArray(vt)?!!vt.find(an=>an===$t.value):vt===$t.value)):nt.refs[0]&&(nt.refs[0].checked=!!vt):nt.refs.forEach($t=>$t.checked=$t.value===vt):Xoe(nt.ref)?nt.ref.value="":(nt.ref.value=vt,nt.ref.type||d.values.next({name:ye,values:{...s}})))}(Ve.shouldDirty||Ve.shouldTouch)&&k(ye,vt,Ve.shouldTouch,Ve.shouldDirty,!0),Ve.shouldValidate&&te(ye)},q=(ye,Ie,Ve)=>{for(const wt in Ie){const vt=Ie[wt],nt=`${ye}.${wt}`,$t=Vt(i,nt);(a.array.has(ye)||Qo(vt)||$t&&!$t._f)&&!Ey(vt)?q(nt,vt,Ve):z(nt,vt,Ve)}},ee=(ye,Ie,Ve={})=>{const wt=Vt(i,ye),vt=a.array.has(ye),nt=Fa(Ie);zr(s,ye,nt),vt?(d.array.next({name:ye,values:{...s}}),(u.isDirty||u.dirtyFields)&&Ve.shouldDirty&&d.state.next({name:ye,dirtyFields:mT(r,s),isDirty:B(ye,nt)})):wt&&!wt._f&&!Kc(nt)?q(ye,nt,Ve):z(ye,nt,Ve),NY(ye,a)&&d.state.next({...t}),d.values.next({name:o.mount?ye:void 0,values:{...s}})},Z=async ye=>{o.mount=!0;const Ie=ye.target;let Ve=Ie.name,wt=!0;const vt=Vt(i,Ve),nt=()=>Ie.type?JU(vt._f):mOe(ye),$t=an=>{wt=Number.isNaN(an)||Ey(an)&&isNaN(an.getTime())||dv(an,Vt(s,Ve,an))};if(vt){let an,Pi;const Xn=nt(),Qi=ye.type===d6.BLUR||ye.type===d6.FOCUS_OUT,qs=!hct(vt._f)&&!e.resolver&&!Vt(t.errors,Ve)&&!vt._f.deps||fct(Qi,Vt(t.touchedFields,Ve),t.isSubmitted,f,h),Pr=NY(Ve,a,Qi);zr(s,Ve,Xn),Qi?(vt._f.onBlur&&vt._f.onBlur(ye),l&&l(0)):vt._f.onChange&&vt._f.onChange(ye);const Or=k(Ve,Xn,Qi,!1),cr=!zc(Or)||Pr;if(!Qi&&d.values.next({name:Ve,type:ye.type,values:{...s}}),qs)return u.isValid&&(e.mode==="onBlur"&&Qi?m():Qi||m()),cr&&d.state.next({name:Ve,...Pr?{}:Or});if(!Qi&&Pr&&d.state.next({...t}),e.resolver){const{errors:us}=await D([Ve]);if($t(Xn),wt){const qi=z0e(t.errors,i,Ve),Er=z0e(us,i,qi.name||Ve);an=Er.error,Ve=Er.name,Pi=zc(us)}}else _([Ve],!0),an=(await RY(vt,a.disabled,s,g,e.shouldUseNativeValidation))[Ve],_([Ve]),$t(Xn),wt&&(an?Pi=!1:u.isValid&&(Pi=await O(i,!0)));wt&&(vt._f.deps&&te(vt._f.deps),L(Ve,Pi,an,Or))}},j=(ye,Ie)=>{if(Vt(t.errors,Ie)&&ye.focus)return ye.focus(),1},te=async(ye,Ie={})=>{let Ve,wt;const vt=zu(ye);if(e.resolver){const nt=await I(io(ye)?ye:vt);Ve=zc(nt),wt=ye?!vt.some($t=>Vt(nt,$t)):Ve}else ye?(wt=(await Promise.all(vt.map(async nt=>{const $t=Vt(i,nt);return await O($t&&$t._f?{[nt]:$t}:$t)}))).every(Boolean),!(!wt&&!t.isValid)&&m()):wt=Ve=await O(i);return d.state.next({...!Ep(ye)||u.isValid&&Ve!==t.isValid?{}:{name:ye},...e.resolver||!ye?{isValid:Ve}:{},errors:t.errors}),Ie.shouldFocus&&!wt&&nk(i,j,ye?vt:a.mount),wt},le=ye=>{const Ie={...o.mount?s:r};return io(ye)?Ie:Ep(ye)?Vt(Ie,ye):ye.map(Ve=>Vt(Ie,Ve))},ue=(ye,Ie)=>({invalid:!!Vt((Ie||t).errors,ye),isDirty:!!Vt((Ie||t).dirtyFields,ye),error:Vt((Ie||t).errors,ye),isValidating:!!Vt(t.validatingFields,ye),isTouched:!!Vt((Ie||t).touchedFields,ye)}),de=ye=>{ye&&zu(ye).forEach(Ie=>_a(t.errors,Ie)),d.state.next({errors:ye?t.errors:{}})},we=(ye,Ie,Ve)=>{const wt=(Vt(i,ye,{_f:{}})._f||{}).ref,vt=Vt(t.errors,ye)||{},{ref:nt,message:$t,type:an,...Pi}=vt;zr(t.errors,ye,{...Pi,...Ie,ref:wt}),d.state.next({name:ye,errors:t.errors,isValid:!1}),Ve&&Ve.shouldFocus&&wt&&wt.focus&&wt.focus()},xe=(ye,Ie)=>yp(ye)?d.values.subscribe({next:Ve=>ye(G(void 0,Ie),Ve)}):G(ye,Ie,!0),Me=(ye,Ie={})=>{for(const Ve of ye?zu(ye):a.mount)a.mount.delete(Ve),a.array.delete(Ve),Ie.keepValue||(_a(i,Ve),_a(s,Ve)),!Ie.keepError&&_a(t.errors,Ve),!Ie.keepDirty&&_a(t.dirtyFields,Ve),!Ie.keepTouched&&_a(t.touchedFields,Ve),!Ie.keepIsValidating&&_a(t.validatingFields,Ve),!e.shouldUnregister&&!Ie.keepDefaultValue&&_a(r,Ve);d.values.next({values:{...s}}),d.state.next({...t,...Ie.keepDirty?{isDirty:B()}:{}}),!Ie.keepIsValid&&m()},Re=({disabled:ye,name:Ie,field:Ve,fields:wt})=>{(Ph(ye)&&o.mount||ye||a.disabled.has(Ie))&&(ye?a.disabled.add(Ie):a.disabled.delete(Ie),k(Ie,JU(Ve?Ve._f:Vt(wt,Ie)._f),!1,!1,!0))},_t=(ye,Ie={})=>{let Ve=Vt(i,ye);const wt=Ph(Ie.disabled)||Ph(e.disabled);return zr(i,ye,{...Ve||{},_f:{...Ve&&Ve._f?Ve._f:{ref:{name:ye}},name:ye,mount:!0,...Ie}}),a.mount.add(ye),Ve?Re({field:Ve,disabled:Ph(Ie.disabled)?Ie.disabled:e.disabled,name:ye}):x(ye,!0,Ie.value),{...wt?{disabled:Ie.disabled||e.disabled}:{},...e.progressive?{required:!!Ie.required,min:_T(Ie.min),max:_T(Ie.max),minLength:_T(Ie.minLength),maxLength:_T(Ie.maxLength),pattern:_T(Ie.pattern)}:{},name:ye,onChange:Z,onBlur:Z,ref:vt=>{if(vt){_t(ye,Ie),Ve=Vt(i,ye);const nt=io(vt.value)&&vt.querySelectorAll&&vt.querySelectorAll("input,select,textarea")[0]||vt,$t=cct(nt),an=Ve._f.refs||[];if($t?an.find(Pi=>Pi===nt):nt===Ve._f.ref)return;zr(i,ye,{_f:{...Ve._f,...$t?{refs:[...an.filter(QU),nt,...Array.isArray(Vt(r,ye))?[{}]:[]],ref:{type:nt.type,name:ye}}:{ref:nt}}}),x(ye,!1,void 0,nt)}else Ve=Vt(i,ye,{}),Ve._f&&(Ve._f.mount=!1),(e.shouldUnregister||Ie.shouldUnregister)&&!(_Oe(a.array,ye)&&o.action)&&a.unMount.add(ye)}}},Qe=()=>e.shouldFocusError&&nk(i,j,a.mount),pt=ye=>{Ph(ye)&&(d.state.next({disabled:ye}),nk(i,(Ie,Ve)=>{const wt=Vt(i,Ve);wt&&(Ie.disabled=wt._f.disabled||ye,Array.isArray(wt._f.refs)&&wt._f.refs.forEach(vt=>{vt.disabled=wt._f.disabled||ye}))},0,!1))},gt=(ye,Ie)=>async Ve=>{let wt;Ve&&(Ve.preventDefault&&Ve.preventDefault(),Ve.persist&&Ve.persist());let vt=Fa(s);if(a.disabled.size)for(const nt of a.disabled)zr(vt,nt,void 0);if(d.state.next({isSubmitting:!0}),e.resolver){const{errors:nt,values:$t}=await D();t.errors=nt,vt=$t}else await O(i);if(_a(t.errors,"root"),zc(t.errors)){d.state.next({errors:{}});try{await ye(vt,Ve)}catch(nt){wt=nt}}else Ie&&await Ie({...t.errors},Ve),Qe(),setTimeout(Qe);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:zc(t.errors)&&!wt,submitCount:t.submitCount+1,errors:t.errors}),wt)throw wt},Ue=(ye,Ie={})=>{Vt(i,ye)&&(io(Ie.defaultValue)?ee(ye,Fa(Vt(r,ye))):(ee(ye,Ie.defaultValue),zr(r,ye,Fa(Ie.defaultValue))),Ie.keepTouched||_a(t.touchedFields,ye),Ie.keepDirty||(_a(t.dirtyFields,ye),t.isDirty=Ie.defaultValue?B(ye,Fa(Vt(r,ye))):B()),Ie.keepError||(_a(t.errors,ye),u.isValid&&m()),d.state.next({...t}))},wn=(ye,Ie={})=>{const Ve=ye?Fa(ye):r,wt=Fa(Ve),vt=zc(ye),nt=vt?r:wt;if(Ie.keepDefaultValues||(r=Ve),!Ie.keepValues){if(Ie.keepDirtyValues){const $t=new Set([...a.mount,...Object.keys(mT(r,s))]);for(const an of Array.from($t))Vt(t.dirtyFields,an)?zr(nt,an,Vt(s,an)):ee(an,Vt(nt,an))}else{if(Yoe&&io(ye))for(const $t of a.mount){const an=Vt(i,$t);if(an&&an._f){const Pi=Array.isArray(an._f.refs)?an._f.refs[0]:an._f.ref;if(h6(Pi)){const Xn=Pi.closest("form");if(Xn){Xn.reset();break}}}}i={}}s=e.shouldUnregister?Ie.keepDefaultValues?Fa(r):{}:Fa(nt),d.array.next({values:{...nt}}),d.values.next({values:{...nt}})}a={mount:Ie.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!u.isValid||!!Ie.keepIsValid||!!Ie.keepDirtyValues,o.watch=!!e.shouldUnregister,d.state.next({submitCount:Ie.keepSubmitCount?t.submitCount:0,isDirty:vt?!1:Ie.keepDirty?t.isDirty:!!(Ie.keepDefaultValues&&!dv(ye,r)),isSubmitted:Ie.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:vt?{}:Ie.keepDirtyValues?Ie.keepDefaultValues&&s?mT(r,s):t.dirtyFields:Ie.keepDefaultValues&&ye?mT(r,ye):Ie.keepDirty?t.dirtyFields:{},touchedFields:Ie.keepTouched?t.touchedFields:{},errors:Ie.keepErrors?t.errors:{},isSubmitSuccessful:Ie.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},Xt=(ye,Ie)=>wn(yp(ye)?ye(s):ye,Ie);return{control:{register:_t,unregister:Me,getFieldState:ue,handleSubmit:gt,setError:we,_executeSchema:D,_getWatch:G,_getDirty:B,_updateValid:m,_removeUnmounted:M,_updateFieldArray:v,_updateDisabledField:Re,_getFieldArray:W,_reset:wn,_resetDefaultValues:()=>yp(e.defaultValues)&&e.defaultValues().then(ye=>{Xt(ye,e.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:ye=>{t={...t,...ye}},_disableForm:pt,_subjects:d,_proxyFormState:u,_setErrors:C,get _fields(){return i},get _formValues(){return s},get _state(){return o},set _state(ye){o=ye},get _defaultValues(){return r},get _names(){return a},set _names(ye){a=ye},get _formState(){return t},set _formState(ye){t=ye},get _options(){return e},set _options(ye){e={...e,...ye}}},trigger:te,register:_t,handleSubmit:gt,watch:xe,setValue:ee,getValues:le,reset:Xt,resetField:Ue,clearErrors:de,unregister:Me,setError:we,setFocus:(ye,Ie={})=>{const Ve=Vt(i,ye),wt=Ve&&Ve._f;if(wt){const vt=wt.refs?wt.refs[0]:wt.ref;vt.focus&&(vt.focus(),Ie.shouldSelect&&yp(vt.select)&&vt.select())}},getFieldState:ue}}function SFn(n={}){const e=U.useRef(void 0),t=U.useRef(void 0),[i,r]=U.useState({isDirty:!1,isValidating:!1,isLoading:yp(n.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1,defaultValues:yp(n.defaultValues)?void 0:n.defaultValues});e.current||(e.current={...mct(n),formState:i});const s=e.current.control;return s._options=n,b$({subject:s._subjects.state,next:o=>{wOe(o,s._proxyFormState,s._updateFormState,!0)&&r({...s._formState})}}),U.useEffect(()=>s._disableForm(n.disabled),[s,n.disabled]),U.useEffect(()=>{if(s._proxyFormState.isDirty){const o=s._getDirty();o!==i.isDirty&&s._subjects.state.next({isDirty:o})}},[s,i.isDirty]),U.useEffect(()=>{n.values&&!dv(n.values,t.current)?(s._reset(n.values,s._options.resetOptions),t.current=n.values,r(o=>({...o}))):s._resetDefaultValues()},[n.values,s]),U.useEffect(()=>{n.errors&&s._setErrors(n.errors)},[n.errors,s]),U.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),U.useEffect(()=>{n.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[n.shouldUnregister,s]),e.current.formState=yOe(i,s),e.current}const U0e=(n,e,t)=>{if(n&&"reportValidity"in n){const i=Vt(t,e);n.setCustomValidity(i&&i.message||""),n.reportValidity()}},NOe=(n,e)=>{for(const t in e.fields){const i=e.fields[t];i&&i.ref&&"reportValidity"in i.ref?U0e(i.ref,t,n):i.refs&&i.refs.forEach(r=>U0e(r,t,n))}},_ct=(n,e)=>{e.shouldUseNativeValidation&&NOe(n,e);const t={};for(const i in n){const r=Vt(e.fields,i),s=Object.assign(n[i]||{},{ref:r&&r.ref});if(vct(e.names||Object.keys(n),i)){const o=Object.assign({},Vt(t,i));zr(o,"root",s),zr(t,i,o)}else zr(t,i,s)}return t},vct=(n,e)=>n.some(t=>t.startsWith(e+"."));var bct=function(n,e){for(var t={};n.length;){var i=n[0],r=i.code,s=i.message,o=i.path.join(".");if(!t[o])if("unionErrors"in i){var a=i.unionErrors[0].errors[0];t[o]={message:a.message,type:a.code}}else t[o]={message:s,type:r};if("unionErrors"in i&&i.unionErrors.forEach(function(u){return u.errors.forEach(function(d){return n.push(d)})}),e){var l=t[o].types,c=l&&l[i.code];t[o]=SOe(o,e,t,r,c?[].concat(c,i.message):i.message)}n.shift()}return t},kFn=function(n,e,t){return t===void 0&&(t={}),function(i,r,s){try{return Promise.resolve(function(o,a){try{var l=Promise.resolve(n[t.mode==="sync"?"parse":"parseAsync"](i,e)).then(function(c){return s.shouldUseNativeValidation&&NOe({},s),{errors:{},values:t.raw?i:c}})}catch(c){return a(c)}return l&&l.then?l.then(void 0,a):l}(0,function(o){if(function(a){return Array.isArray(a?.errors)}(o))return{values:{},errors:_ct(bct(o.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw o}))}catch(o){return Promise.reject(o)}}},Ir;(function(n){n.assertEqual=r=>r;function e(r){}n.assertIs=e;function t(r){throw new Error}n.assertNever=t,n.arrayToEnum=r=>{const s={};for(const o of r)s[o]=o;return s},n.getValidEnumValues=r=>{const s=n.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(const a of s)o[a]=r[a];return n.objectValues(o)},n.objectValues=r=>n.objectKeys(r).map(function(s){return r[s]}),n.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const s=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&s.push(o);return s},n.find=(r,s)=>{for(const o of r)if(s(o))return o},n.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}n.joinValues=i,n.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(Ir||(Ir={}));var OY;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(OY||(OY={}));const cn=Ir.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xm=n=>{switch(typeof n){case"undefined":return cn.undefined;case"string":return cn.string;case"number":return isNaN(n)?cn.nan:cn.number;case"boolean":return cn.boolean;case"function":return cn.function;case"bigint":return cn.bigint;case"symbol":return cn.symbol;case"object":return Array.isArray(n)?cn.array:n===null?cn.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?cn.promise:typeof Map<"u"&&n instanceof Map?cn.map:typeof Set<"u"&&n instanceof Set?cn.set:typeof Date<"u"&&n instanceof Date?cn.date:cn.object;default:return cn.unknown}},Dt=Ir.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"]),yct=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class zd extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(s){return s.message},i={_errors:[]},r=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)i._errors.push(t(o));else{let a=i,l=0;for(;lt.message){const t={},i=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):i.push(e(r));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}zd.create=n=>new zd(n);const Qk=(n,e)=>{let t;switch(n.code){case Dt.invalid_type:n.received===cn.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case Dt.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,Ir.jsonStringifyReplacer)}`;break;case Dt.unrecognized_keys:t=`Unrecognized key(s) in object: ${Ir.joinValues(n.keys,", ")}`;break;case Dt.invalid_union:t="Invalid input";break;case Dt.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Ir.joinValues(n.options)}`;break;case Dt.invalid_enum_value:t=`Invalid enum value. Expected ${Ir.joinValues(n.options)}, received '${n.received}'`;break;case Dt.invalid_arguments:t="Invalid function arguments";break;case Dt.invalid_return_type:t="Invalid function return type";break;case Dt.invalid_date:t="Invalid date";break;case Dt.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:Ir.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case Dt.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case Dt.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case Dt.custom:t="Invalid input";break;case Dt.invalid_intersection_types:t="Intersection results could not be merged";break;case Dt.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case Dt.not_finite:t="Number must be finite";break;default:t=e.defaultError,Ir.assertNever(n)}return{message:t}};let ROe=Qk;function wct(n){ROe=n}function p6(){return ROe}const m6=n=>{const{data:e,path:t,errorMaps:i,issueData:r}=n,s=[...t,...r.path||[]],o={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let a="";const l=i.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...r,path:s,message:a}},Cct=[];function Jt(n,e){const t=p6(),i=m6({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Qk?void 0:Qk].filter(r=>!!r)});n.common.issues.push(i)}class Ec{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const r of t){if(r.status==="aborted")return di;r.status==="dirty"&&e.dirty(),i.push(r.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const r of t){const s=await r.key,o=await r.value;i.push({key:s,value:o})}return Ec.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const r of t){const{key:s,value:o}=r;if(s.status==="aborted"||o.status==="aborted")return di;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(i[s.value]=o.value)}return{status:e.value,value:i}}}const di=Object.freeze({status:"aborted"}),pS=n=>({status:"dirty",value:n}),cu=n=>({status:"valid",value:n}),MY=n=>n.status==="aborted",FY=n=>n.status==="dirty",yw=n=>n.status==="valid",FA=n=>typeof Promise<"u"&&n instanceof Promise;function _6(n,e,t,i){if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function POe(n,e,t,i,r){if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var Tn;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Tn||(Tn={}));var yD,wD;class jp{constructor(e,t,i,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const j0e=(n,e)=>{if(yw(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new zd(n.common.issues);return this._error=t,this._error}}};function $i(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:i,description:r}=n;if(e&&(t||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,a)=>{var l,c;const{message:u}=n;return o.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??i)!==null&&l!==void 0?l:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??t)!==null&&c!==void 0?c:a.defaultError}},description:r}}class Gi{get description(){return this._def.description}_getType(e){return Xm(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Xm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ec,ctx:{common:e.parent.common,data:e.data,parsedType:Xm(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(FA(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){var i;const r={common:{issues:[],async:(i=t?.async)!==null&&i!==void 0?i:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xm(e)},s=this._parseSync({data:e,path:r.path,parent:r});return j0e(r,s)}"~validate"(e){var t,i;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xm(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:r});return yw(s)?{value:s.value}:{issues:r.common.issues}}catch(s){!((i=(t=s?.message)===null||t===void 0?void 0:t.toLowerCase())===null||i===void 0)&&i.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>yw(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xm(e)},r=this._parse({data:e,path:i.path,parent:i}),s=await(FA(r)?r:Promise.resolve(r));return j0e(i,s)}refine(e,t){const i=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,s)=>{const o=e(r),a=()=>s.addIssue({code:Dt.custom,...i(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((i,r)=>e(i)?!0:(r.addIssue(typeof t=="function"?t(i,r):t),!1))}_refinement(e){return new xg({schema:this,typeName:li.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:t=>this["~validate"](t)}}optional(){return Fp.create(this,this._def)}nullable(){return bb.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dg.create(this)}promise(){return eE.create(this,this._def)}or(e){return HA.create([this,e],this._def)}and(e){return VA.create(this,e,this._def)}transform(e){return new xg({...$i(this._def),schema:this,typeName:li.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new KA({...$i(this._def),innerType:this,defaultValue:t,typeName:li.ZodDefault})}brand(){return new Joe({typeName:li.ZodBranded,type:this,...$i(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new GA({...$i(this._def),innerType:this,catchValue:t,typeName:li.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return BP.create(this,e)}readonly(){return YA.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xct=/^c[^\s-]{8,}$/i,Sct=/^[0-9a-z]+$/,kct=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ect=/^[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,Lct=/^[a-z0-9_-]{21}$/i,Tct=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Dct=/^[-+]?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)?)??$/,Ict=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Act="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ej;const Nct=/^(?:(?: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])$/,Rct=/^(?:(?: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])$/,Pct=/^(([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]))$/,Oct=/^(([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])$/,Mct=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fct=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OOe="((\\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])))",Bct=new RegExp(`^${OOe}$`);function MOe(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function $ct(n){return new RegExp(`^${MOe(n)}$`)}function FOe(n){let e=`${OOe}T${MOe(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Wct(n,e){return!!((e==="v4"||!e)&&Nct.test(n)||(e==="v6"||!e)&&Pct.test(n))}function Hct(n,e){if(!Tct.test(n))return!1;try{const[t]=n.split("."),i=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||!r.typ||!r.alg||e&&r.alg!==e)}catch{return!1}}function Vct(n,e){return!!((e==="v4"||!e)&&Rct.test(n)||(e==="v6"||!e)&&Oct.test(n))}class ig extends Gi{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==cn.string){const s=this._getOrReturnCtx(e);return Jt(s,{code:Dt.invalid_type,expected:cn.string,received:s.parsedType}),di}const i=new Ec;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(r=this._getOrReturnCtx(e,r),Jt(r,{code:Dt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,a=e.data.lengthe.test(r),{validation:t,code:Dt.invalid_string,...Tn.errToObj(i)})}_addCheck(e){return new ig({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Tn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Tn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Tn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Tn.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Tn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Tn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Tn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Tn.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Tn.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Tn.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Tn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Tn.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Tn.errToObj(e)})}datetime(e){var t,i;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:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(i=e?.local)!==null&&i!==void 0?i:!1,...Tn.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,...Tn.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Tn.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Tn.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Tn.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Tn.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Tn.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Tn.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Tn.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Tn.errToObj(t)})}nonempty(e){return this.min(1,Tn.errToObj(e))}trim(){return new ig({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ig({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ig({...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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new ig({checks:[],typeName:li.ZodString,coerce:(e=n?.coerce)!==null&&e!==void 0?e:!1,...$i(n)})};function zct(n,e){const t=(n.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=t>i?t:i,s=parseInt(n.toFixed(r).replace(".","")),o=parseInt(e.toFixed(r).replace(".",""));return s%o/Math.pow(10,r)}class mb extends Gi{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)!==cn.number){const s=this._getOrReturnCtx(e);return Jt(s,{code:Dt.invalid_type,expected:cn.number,received:s.parsedType}),di}let i;const r=new Ec;for(const s of this._def.checks)s.kind==="int"?Ir.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?zct(e.data,s.value)!==0&&(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.not_finite,message:s.message}),r.dirty()):Ir.assertNever(s);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Tn.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Tn.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Tn.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Tn.toString(t))}setLimit(e,t,i,r){return new mb({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Tn.toString(r)}]})}_addCheck(e){return new mb({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Tn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Tn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Tn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Tn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Tn.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Tn.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Tn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Tn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Tn.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&Ir.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(t===null||i.value>t)&&(t=i.value):i.kind==="max"&&(e===null||i.valuenew mb({checks:[],typeName:li.ZodNumber,coerce:n?.coerce||!1,...$i(n)});class _b extends Gi{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)!==cn.bigint)return this._getInvalidInput(e);let i;const r=new Ec;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Jt(i,{code:Dt.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):Ir.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Jt(t,{code:Dt.invalid_type,expected:cn.bigint,received:t.parsedType}),di}gte(e,t){return this.setLimit("min",e,!0,Tn.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Tn.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Tn.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Tn.toString(t))}setLimit(e,t,i,r){return new _b({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Tn.toString(r)}]})}_addCheck(e){return new _b({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Tn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Tn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Tn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Tn.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Tn.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new _b({checks:[],typeName:li.ZodBigInt,coerce:(e=n?.coerce)!==null&&e!==void 0?e:!1,...$i(n)})};class BA extends Gi{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==cn.boolean){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.boolean,received:i.parsedType}),di}return cu(e.data)}}BA.create=n=>new BA({typeName:li.ZodBoolean,coerce:n?.coerce||!1,...$i(n)});class ww extends Gi{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==cn.date){const s=this._getOrReturnCtx(e);return Jt(s,{code:Dt.invalid_type,expected:cn.date,received:s.parsedType}),di}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Jt(s,{code:Dt.invalid_date}),di}const i=new Ec;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(r=this._getOrReturnCtx(e,r),Jt(r,{code:Dt.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):Ir.assertNever(s);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ww({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Tn.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Tn.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew ww({checks:[],coerce:n?.coerce||!1,typeName:li.ZodDate,...$i(n)});class v6 extends Gi{_parse(e){if(this._getType(e)!==cn.symbol){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.symbol,received:i.parsedType}),di}return cu(e.data)}}v6.create=n=>new v6({typeName:li.ZodSymbol,...$i(n)});class $A extends Gi{_parse(e){if(this._getType(e)!==cn.undefined){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.undefined,received:i.parsedType}),di}return cu(e.data)}}$A.create=n=>new $A({typeName:li.ZodUndefined,...$i(n)});class WA extends Gi{_parse(e){if(this._getType(e)!==cn.null){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.null,received:i.parsedType}),di}return cu(e.data)}}WA.create=n=>new WA({typeName:li.ZodNull,...$i(n)});class Jk extends Gi{constructor(){super(...arguments),this._any=!0}_parse(e){return cu(e.data)}}Jk.create=n=>new Jk({typeName:li.ZodAny,...$i(n)});class Uy extends Gi{constructor(){super(...arguments),this._unknown=!0}_parse(e){return cu(e.data)}}Uy.create=n=>new Uy({typeName:li.ZodUnknown,...$i(n)});class U_ extends Gi{_parse(e){const t=this._getOrReturnCtx(e);return Jt(t,{code:Dt.invalid_type,expected:cn.never,received:t.parsedType}),di}}U_.create=n=>new U_({typeName:li.ZodNever,...$i(n)});class b6 extends Gi{_parse(e){if(this._getType(e)!==cn.undefined){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.void,received:i.parsedType}),di}return cu(e.data)}}b6.create=n=>new b6({typeName:li.ZodVoid,...$i(n)});class dg extends Gi{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),r=this._def;if(t.parsedType!==cn.array)return Jt(t,{code:Dt.invalid_type,expected:cn.array,received:t.parsedType}),di;if(r.exactLength!==null){const o=t.data.length>r.exactLength.value,a=t.data.lengthr.maxLength.value&&(Jt(t,{code:Dt.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>r.type._parseAsync(new jp(t,o,t.path,a)))).then(o=>Ec.mergeArray(i,o));const s=[...t.data].map((o,a)=>r.type._parseSync(new jp(t,o,t.path,a)));return Ec.mergeArray(i,s)}get element(){return this._def.type}min(e,t){return new dg({...this._def,minLength:{value:e,message:Tn.toString(t)}})}max(e,t){return new dg({...this._def,maxLength:{value:e,message:Tn.toString(t)}})}length(e,t){return new dg({...this._def,exactLength:{value:e,message:Tn.toString(t)}})}nonempty(e){return this.min(1,e)}}dg.create=(n,e)=>new dg({type:n,minLength:null,maxLength:null,exactLength:null,typeName:li.ZodArray,...$i(e)});function Kx(n){if(n instanceof _o){const e={};for(const t in n.shape){const i=n.shape[t];e[t]=Fp.create(Kx(i))}return new _o({...n._def,shape:()=>e})}else return n instanceof dg?new dg({...n._def,type:Kx(n.element)}):n instanceof Fp?Fp.create(Kx(n.unwrap())):n instanceof bb?bb.create(Kx(n.unwrap())):n instanceof qp?qp.create(n.items.map(e=>Kx(e))):n}class _o extends Gi{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(),t=Ir.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==cn.object){const c=this._getOrReturnCtx(e);return Jt(c,{code:Dt.invalid_type,expected:cn.object,received:c.parsedType}),di}const{status:i,ctx:r}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof U_&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new jp(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof U_){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")a.length>0&&(Jt(r,{code:Dt.unrecognized_keys,keys:a}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new jp(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Ec.mergeObjectSync(i,c)):Ec.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return Tn.errToObj,new _o({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,i)=>{var r,s,o,a;const l=(o=(s=(r=this._def).errorMap)===null||s===void 0?void 0:s.call(r,t,i).message)!==null&&o!==void 0?o:i.defaultError;return t.code==="unrecognized_keys"?{message:(a=Tn.errToObj(e).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new _o({...this._def,unknownKeys:"strip"})}passthrough(){return new _o({...this._def,unknownKeys:"passthrough"})}extend(e){return new _o({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new _o({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:li.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new _o({...this._def,catchall:e})}pick(e){const t={};return Ir.objectKeys(e).forEach(i=>{e[i]&&this.shape[i]&&(t[i]=this.shape[i])}),new _o({...this._def,shape:()=>t})}omit(e){const t={};return Ir.objectKeys(this.shape).forEach(i=>{e[i]||(t[i]=this.shape[i])}),new _o({...this._def,shape:()=>t})}deepPartial(){return Kx(this)}partial(e){const t={};return Ir.objectKeys(this.shape).forEach(i=>{const r=this.shape[i];e&&!e[i]?t[i]=r:t[i]=r.optional()}),new _o({...this._def,shape:()=>t})}required(e){const t={};return Ir.objectKeys(this.shape).forEach(i=>{if(e&&!e[i])t[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof Fp;)s=s._def.innerType;t[i]=s}}),new _o({...this._def,shape:()=>t})}keyof(){return BOe(Ir.objectKeys(this.shape))}}_o.create=(n,e)=>new _o({shape:()=>n,unknownKeys:"strip",catchall:U_.create(),typeName:li.ZodObject,...$i(e)});_o.strictCreate=(n,e)=>new _o({shape:()=>n,unknownKeys:"strict",catchall:U_.create(),typeName:li.ZodObject,...$i(e)});_o.lazycreate=(n,e)=>new _o({shape:n,unknownKeys:"strip",catchall:U_.create(),typeName:li.ZodObject,...$i(e)});class HA extends Gi{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;function r(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new zd(a.ctx.common.issues));return Jt(t,{code:Dt.invalid_union,unionErrors:o}),di}if(t.common.async)return Promise.all(i.map(async s=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let s;const o=[];for(const l of i){const c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new zd(l));return Jt(t,{code:Dt.invalid_union,unionErrors:a}),di}}get options(){return this._def.options}}HA.create=(n,e)=>new HA({options:n,typeName:li.ZodUnion,...$i(e)});const Mm=n=>n instanceof UA?Mm(n.schema):n instanceof xg?Mm(n.innerType()):n instanceof jA?[n.value]:n instanceof vb?n.options:n instanceof qA?Ir.objectValues(n.enum):n instanceof KA?Mm(n._def.innerType):n instanceof $A?[void 0]:n instanceof WA?[null]:n instanceof Fp?[void 0,...Mm(n.unwrap())]:n instanceof bb?[null,...Mm(n.unwrap())]:n instanceof Joe||n instanceof YA?Mm(n.unwrap()):n instanceof GA?Mm(n._def.innerType):[];class y$ extends Gi{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==cn.object)return Jt(t,{code:Dt.invalid_type,expected:cn.object,received:t.parsedType}),di;const i=this.discriminator,r=t.data[i],s=this.optionsMap.get(r);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(Jt(t,{code:Dt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),di)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){const r=new Map;for(const s of t){const o=Mm(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(r.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,s)}}return new y$({typeName:li.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...$i(i)})}}function BY(n,e){const t=Xm(n),i=Xm(e);if(n===e)return{valid:!0,data:n};if(t===cn.object&&i===cn.object){const r=Ir.objectKeys(e),s=Ir.objectKeys(n).filter(a=>r.indexOf(a)!==-1),o={...n,...e};for(const a of s){const l=BY(n[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===cn.array&&i===cn.array){if(n.length!==e.length)return{valid:!1};const r=[];for(let s=0;s{if(MY(s)||MY(o))return di;const a=BY(s.value,o.value);return a.valid?((FY(s)||FY(o))&&t.dirty(),{status:t.value,value:a.data}):(Jt(i,{code:Dt.invalid_intersection_types}),di)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,o])=>r(s,o)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}VA.create=(n,e,t)=>new VA({left:n,right:e,typeName:li.ZodIntersection,...$i(t)});class qp extends Gi{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==cn.array)return Jt(i,{code:Dt.invalid_type,expected:cn.array,received:i.parsedType}),di;if(i.data.lengththis._def.items.length&&(Jt(i,{code:Dt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...i.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new jp(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(s).then(o=>Ec.mergeArray(t,o)):Ec.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new qp({...this._def,rest:e})}}qp.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qp({items:n,typeName:li.ZodTuple,rest:null,...$i(e)})};class zA extends Gi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==cn.object)return Jt(i,{code:Dt.invalid_type,expected:cn.object,received:i.parsedType}),di;const r=[],s=this._def.keyType,o=this._def.valueType;for(const a in i.data)r.push({key:s._parse(new jp(i,a,i.path,a)),value:o._parse(new jp(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?Ec.mergeObjectAsync(t,r):Ec.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,i){return t instanceof Gi?new zA({keyType:e,valueType:t,typeName:li.ZodRecord,...$i(i)}):new zA({keyType:ig.create(),valueType:e,typeName:li.ZodRecord,...$i(t)})}}class y6 extends Gi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==cn.map)return Jt(i,{code:Dt.invalid_type,expected:cn.map,received:i.parsedType}),di;const r=this._def.keyType,s=this._def.valueType,o=[...i.data.entries()].map(([a,l],c)=>({key:r._parse(new jp(i,a,i.path,[c,"key"])),value:s._parse(new jp(i,l,i.path,[c,"value"]))}));if(i.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return di;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return di;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(c.value,u.value)}return{status:t.value,value:a}}}}y6.create=(n,e,t)=>new y6({valueType:e,keyType:n,typeName:li.ZodMap,...$i(t)});class Cw extends Gi{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==cn.set)return Jt(i,{code:Dt.invalid_type,expected:cn.set,received:i.parsedType}),di;const r=this._def;r.minSize!==null&&i.data.sizer.maxSize.value&&(Jt(i,{code:Dt.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return di;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}const a=[...i.data.values()].map((l,c)=>s._parse(new jp(i,l,i.path,c)));return i.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new Cw({...this._def,minSize:{value:e,message:Tn.toString(t)}})}max(e,t){return new Cw({...this._def,maxSize:{value:e,message:Tn.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Cw.create=(n,e)=>new Cw({valueType:n,minSize:null,maxSize:null,typeName:li.ZodSet,...$i(e)});class ik extends Gi{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==cn.function)return Jt(t,{code:Dt.invalid_type,expected:cn.function,received:t.parsedType}),di;function i(a,l){return m6({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,p6(),Qk].filter(c=>!!c),issueData:{code:Dt.invalid_arguments,argumentsError:l}})}function r(a,l){return m6({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,p6(),Qk].filter(c=>!!c),issueData:{code:Dt.invalid_return_type,returnTypeError:l}})}const s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof eE){const a=this;return cu(async function(...l){const c=new zd([]),u=await a._def.args.parseAsync(l,s).catch(f=>{throw c.addIssue(i(l,f)),c}),d=await Reflect.apply(o,this,u);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw c.addIssue(r(d,f)),c})})}else{const a=this;return cu(function(...l){const c=a._def.args.safeParse(l,s);if(!c.success)throw new zd([i(l,c.error)]);const u=Reflect.apply(o,this,c.data),d=a._def.returns.safeParse(u,s);if(!d.success)throw new zd([r(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ik({...this._def,args:qp.create(e).rest(Uy.create())})}returns(e){return new ik({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new ik({args:e||qp.create([]).rest(Uy.create()),returns:t||Uy.create(),typeName:li.ZodFunction,...$i(i)})}}class UA extends Gi{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}UA.create=(n,e)=>new UA({getter:n,typeName:li.ZodLazy,...$i(e)});class jA extends Gi{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Jt(t,{received:t.data,code:Dt.invalid_literal,expected:this._def.value}),di}return{status:"valid",value:e.data}}get value(){return this._def.value}}jA.create=(n,e)=>new jA({value:n,typeName:li.ZodLiteral,...$i(e)});function BOe(n,e){return new vb({values:n,typeName:li.ZodEnum,...$i(e)})}class vb extends Gi{constructor(){super(...arguments),yD.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),i=this._def.values;return Jt(t,{expected:Ir.joinValues(i),received:t.parsedType,code:Dt.invalid_type}),di}if(_6(this,yD)||POe(this,yD,new Set(this._def.values)),!_6(this,yD).has(e.data)){const t=this._getOrReturnCtx(e),i=this._def.values;return Jt(t,{received:t.data,code:Dt.invalid_enum_value,options:i}),di}return cu(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return vb.create(e,{...this._def,...t})}exclude(e,t=this._def){return vb.create(this.options.filter(i=>!e.includes(i)),{...this._def,...t})}}yD=new WeakMap;vb.create=BOe;class qA extends Gi{constructor(){super(...arguments),wD.set(this,void 0)}_parse(e){const t=Ir.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==cn.string&&i.parsedType!==cn.number){const r=Ir.objectValues(t);return Jt(i,{expected:Ir.joinValues(r),received:i.parsedType,code:Dt.invalid_type}),di}if(_6(this,wD)||POe(this,wD,new Set(Ir.getValidEnumValues(this._def.values))),!_6(this,wD).has(e.data)){const r=Ir.objectValues(t);return Jt(i,{received:i.data,code:Dt.invalid_enum_value,options:r}),di}return cu(e.data)}get enum(){return this._def.values}}wD=new WeakMap;qA.create=(n,e)=>new qA({values:n,typeName:li.ZodNativeEnum,...$i(e)});class eE extends Gi{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==cn.promise&&t.common.async===!1)return Jt(t,{code:Dt.invalid_type,expected:cn.promise,received:t.parsedType}),di;const i=t.parsedType===cn.promise?t.data:Promise.resolve(t.data);return cu(i.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}eE.create=(n,e)=>new eE({type:n,typeName:li.ZodPromise,...$i(e)});class xg extends Gi{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===li.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:o=>{Jt(i,o),o.fatal?t.abort():t.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){const o=r.transform(i.data,s);if(i.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return di;const l=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return l.status==="aborted"?di:l.status==="dirty"||t.value==="dirty"?pS(l.value):l});{if(t.value==="aborted")return di;const a=this._def.schema._parseSync({data:o,path:i.path,parent:i});return a.status==="aborted"?di:a.status==="dirty"||t.value==="dirty"?pS(a.value):a}}if(r.type==="refinement"){const o=a=>{const l=r.refinement(a,s);if(i.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(i.common.async===!1){const a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?di:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?di:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(r.type==="transform")if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!yw(o))return o;const a=r.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>yw(o)?Promise.resolve(r.transform(o.value,s)).then(a=>({status:t.value,value:a})):o);Ir.assertNever(r)}}xg.create=(n,e,t)=>new xg({schema:n,typeName:li.ZodEffects,effect:e,...$i(t)});xg.createWithPreprocess=(n,e,t)=>new xg({schema:e,effect:{type:"preprocess",transform:n},typeName:li.ZodEffects,...$i(t)});class Fp extends Gi{_parse(e){return this._getType(e)===cn.undefined?cu(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fp.create=(n,e)=>new Fp({innerType:n,typeName:li.ZodOptional,...$i(e)});class bb extends Gi{_parse(e){return this._getType(e)===cn.null?cu(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}bb.create=(n,e)=>new bb({innerType:n,typeName:li.ZodNullable,...$i(e)});class KA extends Gi{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===cn.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}KA.create=(n,e)=>new KA({innerType:n,typeName:li.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...$i(e)});class GA extends Gi{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return FA(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new zd(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new zd(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}GA.create=(n,e)=>new GA({innerType:n,typeName:li.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...$i(e)});class w6 extends Gi{_parse(e){if(this._getType(e)!==cn.nan){const i=this._getOrReturnCtx(e);return Jt(i,{code:Dt.invalid_type,expected:cn.nan,received:i.parsedType}),di}return{status:"valid",value:e.data}}}w6.create=n=>new w6({typeName:li.ZodNaN,...$i(n)});const Uct=Symbol("zod_brand");class Joe extends Gi{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}}class BP extends Gi{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?di:s.status==="dirty"?(t.dirty(),pS(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?di:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(e,t){return new BP({in:e,out:t,typeName:li.ZodPipeline})}}class YA extends Gi{_parse(e){const t=this._def.innerType._parse(e),i=r=>(yw(r)&&(r.value=Object.freeze(r.value)),r);return FA(t)?t.then(r=>i(r)):i(t)}unwrap(){return this._def.innerType}}YA.create=(n,e)=>new YA({innerType:n,typeName:li.ZodReadonly,...$i(e)});function $Oe(n,e={},t){return n?Jk.create().superRefine((i,r)=>{var s,o;if(!n(i)){const a=typeof e=="function"?e(i):typeof e=="string"?{message:e}:e,l=(o=(s=a.fatal)!==null&&s!==void 0?s:t)!==null&&o!==void 0?o:!0,c=typeof a=="string"?{message:a}:a;r.addIssue({code:"custom",...c,fatal:l})}}):Jk.create()}const jct={object:_o.lazycreate};var li;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(li||(li={}));const qct=(n,e={message:`Input not instance of ${n.name}`})=>$Oe(t=>t instanceof n,e),WOe=ig.create,HOe=mb.create,Kct=w6.create,Gct=_b.create,VOe=BA.create,Yct=ww.create,Zct=v6.create,Xct=$A.create,Qct=WA.create,Jct=Jk.create,eut=Uy.create,tut=U_.create,nut=b6.create,iut=dg.create,rut=_o.create,sut=_o.strictCreate,out=HA.create,aut=y$.create,lut=VA.create,cut=qp.create,uut=zA.create,dut=y6.create,hut=Cw.create,fut=ik.create,gut=UA.create,put=jA.create,mut=vb.create,_ut=qA.create,vut=eE.create,q0e=xg.create,but=Fp.create,yut=bb.create,wut=xg.createWithPreprocess,Cut=BP.create,xut=()=>WOe().optional(),Sut=()=>HOe().optional(),kut=()=>VOe().optional(),Eut={string:n=>ig.create({...n,coerce:!0}),number:n=>mb.create({...n,coerce:!0}),boolean:n=>BA.create({...n,coerce:!0}),bigint:n=>_b.create({...n,coerce:!0}),date:n=>ww.create({...n,coerce:!0})},Lut=di;var EFn=Object.freeze({__proto__:null,defaultErrorMap:Qk,setErrorMap:wct,getErrorMap:p6,makeIssue:m6,EMPTY_PATH:Cct,addIssueToContext:Jt,ParseStatus:Ec,INVALID:di,DIRTY:pS,OK:cu,isAborted:MY,isDirty:FY,isValid:yw,isAsync:FA,get util(){return Ir},get objectUtil(){return OY},ZodParsedType:cn,getParsedType:Xm,ZodType:Gi,datetimeRegex:FOe,ZodString:ig,ZodNumber:mb,ZodBigInt:_b,ZodBoolean:BA,ZodDate:ww,ZodSymbol:v6,ZodUndefined:$A,ZodNull:WA,ZodAny:Jk,ZodUnknown:Uy,ZodNever:U_,ZodVoid:b6,ZodArray:dg,ZodObject:_o,ZodUnion:HA,ZodDiscriminatedUnion:y$,ZodIntersection:VA,ZodTuple:qp,ZodRecord:zA,ZodMap:y6,ZodSet:Cw,ZodFunction:ik,ZodLazy:UA,ZodLiteral:jA,ZodEnum:vb,ZodNativeEnum:qA,ZodPromise:eE,ZodEffects:xg,ZodTransformer:xg,ZodOptional:Fp,ZodNullable:bb,ZodDefault:KA,ZodCatch:GA,ZodNaN:w6,BRAND:Uct,ZodBranded:Joe,ZodPipeline:BP,ZodReadonly:YA,custom:$Oe,Schema:Gi,ZodSchema:Gi,late:jct,get ZodFirstPartyTypeKind(){return li},coerce:Eut,any:Jct,array:iut,bigint:Gct,boolean:VOe,date:Yct,discriminatedUnion:aut,effect:q0e,enum:mut,function:fut,instanceof:qct,intersection:lut,lazy:gut,literal:put,map:dut,nan:Kct,nativeEnum:_ut,never:tut,null:Qct,nullable:yut,number:HOe,object:rut,oboolean:kut,onumber:Sut,optional:but,ostring:xut,pipeline:Cut,preprocess:wut,promise:vut,record:uut,set:hut,strictObject:sut,string:WOe,symbol:Zct,transformer:q0e,tuple:cut,undefined:Xct,union:out,unknown:eut,void:nut,NEVER:Lut,ZodIssueCode:Dt,quotelessJson:yct,ZodError:zd});const Tut=(n,e,t,i)=>{const r=[t,{code:e,...i||{}}];if(n?.services?.logger?.forward)return n.services.logger.forward(r,"warn","react-i18next::",!0);jy(r[0])&&(r[0]=`react-i18next:: ${r[0]}`),n?.services?.logger?.warn?n.services.logger.warn(...r):console?.warn&&console.warn(...r)},K0e={},$Y=(n,e,t,i)=>{jy(t)&&K0e[t]||(jy(t)&&(K0e[t]=new Date),Tut(n,e,t,i))},zOe=(n,e)=>()=>{if(n.isInitialized)e();else{const t=()=>{setTimeout(()=>{n.off("initialized",t)},0),e()};n.on("initialized",t)}},WY=(n,e,t)=>{n.loadNamespaces(e,zOe(n,t))},G0e=(n,e,t,i)=>{if(jy(t)&&(t=[t]),n.options.preload&&n.options.preload.indexOf(e)>-1)return WY(n,t,i);t.forEach(r=>{n.options.ns.indexOf(r)<0&&n.options.ns.push(r)}),n.loadLanguages(e,zOe(n,i))},Dut=(n,e,t={})=>!e.languages||!e.languages.length?($Y(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(n,{lng:t.lng,precheck:(i,r)=>{if(t.bindI18n?.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!r(i.isLanguageChangingTo,n))return!1}}),jy=n=>typeof n=="string",Iut=n=>typeof n=="object"&&n!==null,Aut=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Nut={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Rut=n=>Nut[n],Put=n=>n.replace(Aut,Rut);let HY={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Put};const Out=(n={})=>{HY={...HY,...n}},Mut=()=>HY;let UOe;const Fut=n=>{UOe=n},But=()=>UOe,LFn={type:"3rdParty",init(n){Out(n.options.react),Fut(n)}},$ut=E.createContext();class Wut{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Hut=(n,e)=>{const t=E.useRef();return E.useEffect(()=>{t.current=n},[n,e]),t.current},jOe=(n,e,t,i)=>n.getFixedT(e,t,i),Vut=(n,e,t,i)=>E.useCallback(jOe(n,e,t,i),[n,e,t,i]),TFn=(n,e={})=>{const{i18n:t}=e,{i18n:i,defaultNS:r}=E.useContext($ut)||{},s=t||i||But();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new Wut),!s){$Y(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const C=(k,L)=>jy(L)?L:Iut(L)&&jy(L.defaultValue)?L.defaultValue:Array.isArray(k)?k[k.length-1]:k,x=[C,{},!1];return x.t=C,x.i18n={},x.ready=!1,x}s.options.react?.wait&&$Y(s,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...Mut(),...s.options.react,...e},{useSuspense:a,keyPrefix:l}=o;let c=n||r||s.options?.defaultNS;c=jy(c)?[c]:c||["translation"],s.reportNamespaces.addUsedNamespaces?.(c);const u=(s.isInitialized||s.initializedStoreOnce)&&c.every(C=>Dut(C,s,o)),d=Vut(s,e.lng||null,o.nsMode==="fallback"?c:c[0],l),h=()=>d,f=()=>jOe(s,e.lng||null,o.nsMode==="fallback"?c:c[0],l),[g,p]=E.useState(h);let m=c.join();e.lng&&(m=`${e.lng}${m}`);const _=Hut(m),v=E.useRef(!0);E.useEffect(()=>{const{bindI18n:C,bindI18nStore:x}=o;v.current=!0,!u&&!a&&(e.lng?G0e(s,e.lng,c,()=>{v.current&&p(f)}):WY(s,c,()=>{v.current&&p(f)})),u&&_&&_!==m&&v.current&&p(f);const k=()=>{v.current&&p(f)};return C&&s?.on(C,k),x&&s?.store.on(x,k),()=>{v.current=!1,s&&C?.split(" ").forEach(L=>s.off(L,k)),x&&s&&x.split(" ").forEach(L=>s.store.off(L,k))}},[s,m]),E.useEffect(()=>{v.current&&u&&p(h)},[s,l,u]);const y=[g,s,u];if(y.t=g,y.i18n=s,y.ready=u,u||!u&&!a)return y;throw new Promise(C=>{e.lng?G0e(s,e.lng,c,()=>C()):WY(s,c,()=>C())})};var zut="Label",qOe=E.forwardRef((n,e)=>ae.jsx(Pn.label,{...n,ref:e,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(n.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));qOe.displayName=zut;var DFn=qOe;function Kt(n,e,{checkForDefaultPrevented:t=!0}={}){return function(r){if(n?.(r),t===!1||!r.defaultPrevented)return e?.(r)}}function Uut(n,e){const t=E.createContext(e),i=s=>{const{children:o,...a}=s,l=E.useMemo(()=>a,Object.values(a));return ae.jsx(t.Provider,{value:l,children:o})};i.displayName=n+"Provider";function r(s){const o=E.useContext(t);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${n}\``)}return[i,r]}function Ac(n,e=[]){let t=[];function i(s,o){const a=E.createContext(o),l=t.length;t=[...t,o];const c=d=>{const{scope:h,children:f,...g}=d,p=h?.[n]?.[l]||a,m=E.useMemo(()=>g,Object.values(g));return ae.jsx(p.Provider,{value:m,children:f})};c.displayName=s+"Provider";function u(d,h){const f=h?.[n]?.[l]||a,g=E.useContext(f);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const r=()=>{const s=t.map(o=>E.createContext(o));return function(a){const l=a?.[n]||s;return E.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return r.scopeName=n,[i,jut(r,...e)]}function jut(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const i=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}var VY=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(Kut);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(zY,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(zY,{...i,ref:e,children:t})});VY.displayName="Slot";var zY=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=Yut(t);return E.cloneElement(t,{...Gut(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});zY.displayName="SlotClone";var qut=({children:n})=>ae.jsx(ae.Fragment,{children:n});function Kut(n){return E.isValidElement(n)&&n.type===qut}function Gut(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function Yut(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function eae(n){const e=n+"CollectionProvider",[t,i]=Ac(e),[r,s]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=f=>{const{scope:g,children:p}=f,m=U.useRef(null),_=U.useRef(new Map).current;return ae.jsx(r,{scope:g,itemMap:_,collectionRef:m,children:p})};o.displayName=e;const a=n+"CollectionSlot",l=U.forwardRef((f,g)=>{const{scope:p,children:m}=f,_=s(a,p),v=gi(g,_.collectionRef);return ae.jsx(VY,{ref:v,children:m})});l.displayName=a;const c=n+"CollectionItemSlot",u="data-radix-collection-item",d=U.forwardRef((f,g)=>{const{scope:p,children:m,..._}=f,v=U.useRef(null),y=gi(g,v),C=s(c,p);return U.useEffect(()=>(C.itemMap.set(v,{ref:v,..._}),()=>void C.itemMap.delete(v))),ae.jsx(VY,{[u]:"",ref:y,children:m})});d.displayName=c;function h(f){const g=s(n+"CollectionConsumer",f);return U.useCallback(()=>{const m=g.collectionRef.current;if(!m)return[];const _=Array.from(m.querySelectorAll(`[${u}]`));return Array.from(g.itemMap.values()).sort((C,x)=>_.indexOf(C.ref.current)-_.indexOf(x.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:l,ItemSlot:d},h,i]}var Zut=globalThis?.document?E.useLayoutEffect:()=>{},Xut=JB.useId||(()=>{}),Qut=0;function Ud(n){const[e,t]=E.useState(Xut());return Zut(()=>{n||t(i=>i??String(Qut++))},[n]),n||(e?`radix-${e}`:"")}function Ua(n){const e=E.useRef(n);return E.useEffect(()=>{e.current=n}),E.useMemo(()=>(...t)=>e.current?.(...t),[])}function Kp({prop:n,defaultProp:e,onChange:t=()=>{}}){const[i,r]=Jut({defaultProp:e,onChange:t}),s=n!==void 0,o=s?n:i,a=Ua(t),l=E.useCallback(c=>{if(s){const d=typeof c=="function"?c(n):c;d!==n&&a(d)}else r(c)},[s,n,r,a]);return[o,l]}function Jut({defaultProp:n,onChange:e}){const t=E.useState(n),[i]=t,r=E.useRef(i),s=Ua(e);return E.useEffect(()=>{r.current!==i&&(s(i),r.current=i)},[i,r,s]),t}var edt=E.createContext(void 0);function $P(n){const e=E.useContext(edt);return n||e||"ltr"}var tj="rovingFocusGroup.onEntryFocus",tdt={bubbles:!1,cancelable:!0},w$="RovingFocusGroup",[UY,KOe,ndt]=eae(w$),[idt,C$]=Ac(w$,[ndt]),[rdt,sdt]=idt(w$),GOe=E.forwardRef((n,e)=>ae.jsx(UY.Provider,{scope:n.__scopeRovingFocusGroup,children:ae.jsx(UY.Slot,{scope:n.__scopeRovingFocusGroup,children:ae.jsx(odt,{...n,ref:e})})}));GOe.displayName=w$;var odt=E.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,orientation:i,loop:r=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=n,h=E.useRef(null),f=gi(e,h),g=$P(s),[p=null,m]=Kp({prop:o,defaultProp:a,onChange:l}),[_,v]=E.useState(!1),y=Ua(c),C=KOe(t),x=E.useRef(!1),[k,L]=E.useState(0);return E.useEffect(()=>{const D=h.current;if(D)return D.addEventListener(tj,y),()=>D.removeEventListener(tj,y)},[y]),ae.jsx(rdt,{scope:t,orientation:i,dir:g,loop:r,currentTabStopId:p,onItemFocus:E.useCallback(D=>m(D),[m]),onItemShiftTab:E.useCallback(()=>v(!0),[]),onFocusableItemAdd:E.useCallback(()=>L(D=>D+1),[]),onFocusableItemRemove:E.useCallback(()=>L(D=>D-1),[]),children:ae.jsx(Pn.div,{tabIndex:_||k===0?-1:0,"data-orientation":i,...d,ref:f,style:{outline:"none",...n.style},onMouseDown:Kt(n.onMouseDown,()=>{x.current=!0}),onFocus:Kt(n.onFocus,D=>{const I=!x.current;if(D.target===D.currentTarget&&I&&!_){const O=new CustomEvent(tj,tdt);if(D.currentTarget.dispatchEvent(O),!O.defaultPrevented){const M=C().filter(q=>q.focusable),B=M.find(q=>q.active),G=M.find(q=>q.id===p),z=[B,G,...M].filter(Boolean).map(q=>q.ref.current);XOe(z,u)}}x.current=!1}),onBlur:Kt(n.onBlur,()=>v(!1))})})}),YOe="RovingFocusGroupItem",ZOe=E.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,focusable:i=!0,active:r=!1,tabStopId:s,...o}=n,a=Ud(),l=s||a,c=sdt(YOe,t),u=c.currentTabStopId===l,d=KOe(t),{onFocusableItemAdd:h,onFocusableItemRemove:f}=c;return E.useEffect(()=>{if(i)return h(),()=>f()},[i,h,f]),ae.jsx(UY.ItemSlot,{scope:t,id:l,focusable:i,active:r,children:ae.jsx(Pn.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...o,ref:e,onMouseDown:Kt(n.onMouseDown,g=>{i?c.onItemFocus(l):g.preventDefault()}),onFocus:Kt(n.onFocus,()=>c.onItemFocus(l)),onKeyDown:Kt(n.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){c.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const p=cdt(g,c.orientation,c.dir);if(p!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let _=d().filter(v=>v.focusable).map(v=>v.ref.current);if(p==="last")_.reverse();else if(p==="prev"||p==="next"){p==="prev"&&_.reverse();const v=_.indexOf(g.currentTarget);_=c.loop?udt(_,v+1):_.slice(v+1)}setTimeout(()=>XOe(_))}})})})});ZOe.displayName=YOe;var adt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ldt(n,e){return e!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function cdt(n,e,t){const i=ldt(n.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return adt[i]}function XOe(n,e=!1){const t=document.activeElement;for(const i of n)if(i===t||(i.focus({preventScroll:e}),document.activeElement!==t))return}function udt(n,e){return n.map((t,i)=>n[(e+i)%n.length])}var QOe=GOe,JOe=ZOe,es=globalThis?.document?E.useLayoutEffect:()=>{};function ddt(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var eMe=n=>{const{present:e,children:t}=n,i=hdt(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,fdt(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};eMe.displayName="Presence";function hdt(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=ddt(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=h4(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=h4(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=h4(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=h4(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function h4(n){return n?.animationName||"none"}function fdt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var tae="Tabs",[gdt,IFn]=Ac(tae,[C$]),tMe=C$(),[pdt,nae]=gdt(tae),nMe=E.forwardRef((n,e)=>{const{__scopeTabs:t,value:i,onValueChange:r,defaultValue:s,orientation:o="horizontal",dir:a,activationMode:l="automatic",...c}=n,u=$P(a),[d,h]=Kp({prop:i,onChange:r,defaultProp:s});return ae.jsx(pdt,{scope:t,baseId:Ud(),value:d,onValueChange:h,orientation:o,dir:u,activationMode:l,children:ae.jsx(Pn.div,{dir:u,"data-orientation":o,...c,ref:e})})});nMe.displayName=tae;var iMe="TabsList",rMe=E.forwardRef((n,e)=>{const{__scopeTabs:t,loop:i=!0,...r}=n,s=nae(iMe,t),o=tMe(t);return ae.jsx(QOe,{asChild:!0,...o,orientation:s.orientation,dir:s.dir,loop:i,children:ae.jsx(Pn.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:e})})});rMe.displayName=iMe;var sMe="TabsTrigger",oMe=E.forwardRef((n,e)=>{const{__scopeTabs:t,value:i,disabled:r=!1,...s}=n,o=nae(sMe,t),a=tMe(t),l=cMe(o.baseId,i),c=uMe(o.baseId,i),u=i===o.value;return ae.jsx(JOe,{asChild:!0,...a,focusable:!r,active:u,children:ae.jsx(Pn.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...s,ref:e,onMouseDown:Kt(n.onMouseDown,d=>{!r&&d.button===0&&d.ctrlKey===!1?o.onValueChange(i):d.preventDefault()}),onKeyDown:Kt(n.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&o.onValueChange(i)}),onFocus:Kt(n.onFocus,()=>{const d=o.activationMode!=="manual";!u&&!r&&d&&o.onValueChange(i)})})})});oMe.displayName=sMe;var aMe="TabsContent",lMe=E.forwardRef((n,e)=>{const{__scopeTabs:t,value:i,forceMount:r,children:s,...o}=n,a=nae(aMe,t),l=cMe(a.baseId,i),c=uMe(a.baseId,i),u=i===a.value,d=E.useRef(u);return E.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),ae.jsx(eMe,{present:r||u,children:({present:h})=>ae.jsx(Pn.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...o,ref:e,style:{...n.style,animationDuration:d.current?"0s":void 0},children:h&&s})})});lMe.displayName=aMe;function cMe(n,e){return`${n}-trigger-${e}`}function uMe(n,e){return`${n}-content-${e}`}var AFn=nMe,NFn=rMe,RFn=oMe,PFn=lMe,HL=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},xw=typeof window>"u"||"Deno"in globalThis;function Rh(){}function mdt(n,e){return typeof n=="function"?n(e):n}function jY(n){return typeof n=="number"&&n>=0&&n!==1/0}function dMe(n,e){return Math.max(n+(e||0)-Date.now(),0)}function rk(n,e){return typeof n=="function"?n(e):n}function Yf(n,e){return typeof n=="function"?n(e):n}function Y0e(n,e){const{type:t="all",exact:i,fetchStatus:r,predicate:s,queryKey:o,stale:a}=n;if(o){if(i){if(e.queryHash!==iae(o,e.options))return!1}else if(!ZA(e.queryKey,o))return!1}if(t!=="all"){const l=e.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||r&&r!==e.state.fetchStatus||s&&!s(e))}function Z0e(n,e){const{exact:t,status:i,predicate:r,mutationKey:s}=n;if(s){if(!e.options.mutationKey)return!1;if(t){if(Sw(e.options.mutationKey)!==Sw(s))return!1}else if(!ZA(e.options.mutationKey,s))return!1}return!(i&&e.state.status!==i||r&&!r(e))}function iae(n,e){return(e?.queryKeyHashFn||Sw)(n)}function Sw(n){return JSON.stringify(n,(e,t)=>qY(t)?Object.keys(t).sort().reduce((i,r)=>(i[r]=t[r],i),{}):t)}function ZA(n,e){return n===e?!0:typeof n!=typeof e?!1:n&&e&&typeof n=="object"&&typeof e=="object"?!Object.keys(e).some(t=>!ZA(n[t],e[t])):!1}function hMe(n,e){if(n===e)return n;const t=X0e(n)&&X0e(e);if(t||qY(n)&&qY(e)){const i=t?n:Object.keys(n),r=i.length,s=t?e:Object.keys(e),o=s.length,a=t?[]:{};let l=0;for(let c=0;c{setTimeout(e,n)})}function KY(n,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(n,e):t.structuralSharing!==!1?hMe(n,e):e}function vdt(n,e,t=0){const i=[...n,e];return t&&i.length>t?i.slice(1):i}function bdt(n,e,t=0){const i=[e,...n];return t&&i.length>t?i.slice(0,-1):i}var rae=Symbol();function fMe(n,e){return!n.queryFn&&e?.initialPromise?()=>e.initialPromise:!n.queryFn||n.queryFn===rae?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}var ydt=class extends HL{#e;#t;#i;constructor(){super(),this.#i=n=>{if(!xw&&window.addEventListener){const e=()=>n();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#i=n,this.#t?.(),this.#t=n(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(n){this.#e!==n&&(this.#e=n,this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(e=>{e(n)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},sae=new ydt,wdt=class extends HL{#e=!0;#t;#i;constructor(){super(),this.#i=n=>{if(!xw&&window.addEventListener){const e=()=>n(!0),t=()=>n(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#i)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(n){this.#i=n,this.#t?.(),this.#t=n(this.setOnline.bind(this))}setOnline(n){this.#e!==n&&(this.#e=n,this.listeners.forEach(t=>{t(n)}))}isOnline(){return this.#e}},x6=new wdt;function GY(){let n,e;const t=new Promise((r,s)=>{n=r,e=s});t.status="pending",t.catch(()=>{});function i(r){Object.assign(t,r),delete t.resolve,delete t.reject}return t.resolve=r=>{i({status:"fulfilled",value:r}),n(r)},t.reject=r=>{i({status:"rejected",reason:r}),e(r)},t}function Cdt(n){return Math.min(1e3*2**n,3e4)}function gMe(n){return(n??"online")==="online"?x6.isOnline():!0}var pMe=class extends Error{constructor(n){super("CancelledError"),this.revert=n?.revert,this.silent=n?.silent}};function nj(n){return n instanceof pMe}function mMe(n){let e=!1,t=0,i=!1,r;const s=GY(),o=p=>{i||(h(new pMe(p)),n.abort?.())},a=()=>{e=!0},l=()=>{e=!1},c=()=>sae.isFocused()&&(n.networkMode==="always"||x6.isOnline())&&n.canRun(),u=()=>gMe(n.networkMode)&&n.canRun(),d=p=>{i||(i=!0,n.onSuccess?.(p),r?.(),s.resolve(p))},h=p=>{i||(i=!0,n.onError?.(p),r?.(),s.reject(p))},f=()=>new Promise(p=>{r=m=>{(i||c())&&p(m)},n.onPause?.()}).then(()=>{r=void 0,i||n.onContinue?.()}),g=()=>{if(i)return;let p;const m=t===0?n.initialPromise:void 0;try{p=m??n.fn()}catch(_){p=Promise.reject(_)}Promise.resolve(p).then(d).catch(_=>{if(i)return;const v=n.retry??(xw?0:3),y=n.retryDelay??Cdt,C=typeof y=="function"?y(t,_):y,x=v===!0||typeof v=="number"&&tc()?void 0:f()).then(()=>{e?h(_):g()})})};return{promise:s,cancel:o,continue:()=>(r?.(),s),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?g():f().then(g),s)}}function xdt(){let n=[],e=0,t=a=>{a()},i=a=>{a()},r=a=>setTimeout(a,0);const s=a=>{e?n.push(a):r(()=>{t(a)})},o=()=>{const a=n;n=[],a.length&&r(()=>{i(()=>{a.forEach(l=>{t(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{t=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{r=a}}}var Ha=xdt(),_Me=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),jY(this.gcTime)&&(this.#e=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(xw?1/0:5*60*1e3))}clearGcTimeout(){this.#e&&(clearTimeout(this.#e),this.#e=void 0)}},Sdt=class extends _Me{#e;#t;#i;#n;#o;#s;constructor(n){super(),this.#s=!1,this.#o=n.defaultOptions,this.setOptions(n.options),this.observers=[],this.#i=n.cache,this.queryKey=n.queryKey,this.queryHash=n.queryHash,this.#e=kdt(this.options),this.state=n.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(n){this.options={...this.#o,...n},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(n,e){const t=KY(this.state.data,n,this.options);return this.#r({data:t,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),t}setState(n,e){this.#r({type:"setState",state:n,setStateOptions:e})}cancel(n){const e=this.#n?.promise;return this.#n?.cancel(n),e?e.then(Rh).catch(Rh):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(n=>Yf(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rae||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(n=0){return this.state.isInvalidated||this.state.data===void 0||!dMe(this.state.dataUpdatedAt,n)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){this.observers.includes(n)&&(this.observers=this.observers.filter(e=>e!==n),this.observers.length||(this.#n&&(this.#s?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#r({type:"invalidate"})}fetch(n,e){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(n&&this.setOptions(n),!this.options.queryFn){const a=this.observers.find(l=>l.options.queryFn);a&&this.setOptions(a.options)}const t=new AbortController,i=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#s=!0,t.signal)})},r=()=>{const a=fMe(this.options,e),l={queryKey:this.queryKey,meta:this.meta};return i(l),this.#s=!1,this.options.persister?this.options.persister(a,l,this):a(l)},s={fetchOptions:e,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:r};i(s),this.options.behavior?.onFetch(s,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#r({type:"fetch",meta:s.fetchOptions?.meta});const o=a=>{nj(a)&&a.silent||this.#r({type:"error",error:a}),nj(a)||(this.#i.config.onError?.(a,this),this.#i.config.onSettled?.(this.state.data,a,this)),this.scheduleGc()};return this.#n=mMe({initialPromise:e?.initialPromise,fn:s.fetchFn,abort:t.abort.bind(t),onSuccess:a=>{if(a===void 0){o(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(a)}catch(l){o(l);return}this.#i.config.onSuccess?.(a,this),this.#i.config.onSettled?.(a,this.state.error,this),this.scheduleGc()},onError:o,onFail:(a,l)=>{this.#r({type:"failed",failureCount:a,error:l})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}),this.#n.start()}#r(n){const e=t=>{switch(n.type){case"failed":return{...t,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...vMe(t.data,this.options),fetchMeta:n.meta??null};case"success":return{...t,data:n.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:n.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=n.error;return nj(i)&&i.revert&&this.#t?{...this.#t,fetchStatus:"idle"}:{...t,error:i,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...n.state}}};this.state=e(this.state),Ha.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:n})})}};function vMe(n,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:gMe(e.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function kdt(n){const e=typeof n.initialData=="function"?n.initialData():n.initialData,t=e!==void 0,i=t?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var Edt=class extends HL{constructor(n={}){super(),this.config=n,this.#e=new Map}#e;build(n,e,t){const i=e.queryKey,r=e.queryHash??iae(i,e);let s=this.get(r);return s||(s=new Sdt({cache:this,queryKey:i,queryHash:r,options:n.defaultQueryOptions(e),state:t,defaultOptions:n.getQueryDefaults(i)}),this.add(s)),s}add(n){this.#e.has(n.queryHash)||(this.#e.set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){const e=this.#e.get(n.queryHash);e&&(n.destroy(),e===n&&this.#e.delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){Ha.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return this.#e.get(n)}getAll(){return[...this.#e.values()]}find(n){const e={exact:!0,...n};return this.getAll().find(t=>Y0e(e,t))}findAll(n={}){const e=this.getAll();return Object.keys(n).length>0?e.filter(t=>Y0e(n,t)):e}notify(n){Ha.batch(()=>{this.listeners.forEach(e=>{e(n)})})}onFocus(){Ha.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){Ha.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},Ldt=class extends _Me{#e;#t;#i;constructor(n){super(),this.mutationId=n.mutationId,this.#t=n.mutationCache,this.#e=[],this.state=n.state||bMe(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){this.#e.includes(n)||(this.#e.push(n),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){this.#e=this.#e.filter(e=>e!==n),this.scheduleGc(),this.#t.notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#t.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(n){this.#i=mMe({fn:()=>this.options.mutationFn?this.options.mutationFn(n):Promise.reject(new Error("No mutationFn found")),onFail:(i,r)=>{this.#n({type:"failed",failureCount:i,error:r})},onPause:()=>{this.#n({type:"pause"})},onContinue:()=>{this.#n({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#t.canRun(this)});const e=this.state.status==="pending",t=!this.#i.canStart();try{if(!e){this.#n({type:"pending",variables:n,isPaused:t}),await this.#t.config.onMutate?.(n,this);const r=await this.options.onMutate?.(n);r!==this.state.context&&this.#n({type:"pending",context:r,variables:n,isPaused:t})}const i=await this.#i.start();return await this.#t.config.onSuccess?.(i,n,this.state.context,this),await this.options.onSuccess?.(i,n,this.state.context),await this.#t.config.onSettled?.(i,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(i,null,n,this.state.context),this.#n({type:"success",data:i}),i}catch(i){try{throw await this.#t.config.onError?.(i,n,this.state.context,this),await this.options.onError?.(i,n,this.state.context),await this.#t.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,i,n,this.state.context),i}finally{this.#n({type:"error",error:i})}}finally{this.#t.runNext(this)}}#n(n){const e=t=>{switch(n.type){case"failed":return{...t,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...t,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:n.error,failureCount:t.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=e(this.state),Ha.batch(()=>{this.#e.forEach(t=>{t.onMutationUpdate(n)}),this.#t.notify({mutation:this,type:"updated",action:n})})}};function bMe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Tdt=class extends HL{constructor(n={}){super(),this.config=n,this.#e=new Map,this.#t=Date.now()}#e;#t;build(n,e,t){const i=new Ldt({mutationCache:this,mutationId:++this.#t,options:n.defaultMutationOptions(e),state:t});return this.add(i),i}add(n){const e=f4(n),t=this.#e.get(e)??[];t.push(n),this.#e.set(e,t),this.notify({type:"added",mutation:n})}remove(n){const e=f4(n);if(this.#e.has(e)){const t=this.#e.get(e)?.filter(i=>i!==n);t&&(t.length===0?this.#e.delete(e):this.#e.set(e,t))}this.notify({type:"removed",mutation:n})}canRun(n){const e=this.#e.get(f4(n))?.find(t=>t.state.status==="pending");return!e||e===n}runNext(n){return this.#e.get(f4(n))?.find(t=>t!==n&&t.state.isPaused)?.continue()??Promise.resolve()}clear(){Ha.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}getAll(){return[...this.#e.values()].flat()}find(n){const e={exact:!0,...n};return this.getAll().find(t=>Z0e(e,t))}findAll(n={}){return this.getAll().filter(e=>Z0e(n,e))}notify(n){Ha.batch(()=>{this.listeners.forEach(e=>{e(n)})})}resumePausedMutations(){const n=this.getAll().filter(e=>e.state.isPaused);return Ha.batch(()=>Promise.all(n.map(e=>e.continue().catch(Rh))))}};function f4(n){return n.options.scope?.id??String(n.mutationId)}function J0e(n){return{onFetch:(e,t)=>{const i=e.options,r=e.fetchOptions?.meta?.fetchMore?.direction,s=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let u=!1;const d=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(e.signal.aborted?u=!0:e.signal.addEventListener("abort",()=>{u=!0}),e.signal)})},h=fMe(e.options,e.fetchOptions),f=async(g,p,m)=>{if(u)return Promise.reject();if(p==null&&g.pages.length)return Promise.resolve(g);const _={queryKey:e.queryKey,pageParam:p,direction:m?"backward":"forward",meta:e.options.meta};d(_);const v=await h(_),{maxPages:y}=e.options,C=m?bdt:vdt;return{pages:C(g.pages,v,y),pageParams:C(g.pageParams,p,y)}};if(r&&s.length){const g=r==="backward",p=g?Ddt:eve,m={pages:s,pageParams:o},_=p(i,m);a=await f(m,_,g)}else{const g=n??s.length;do{const p=l===0?o[0]??i.initialPageParam:eve(i,a);if(l>0&&p==null)break;a=await f(a,p),l++}while(le.options.persister?.(c,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t):e.fetchFn=c}}}function eve(n,{pages:e,pageParams:t}){const i=e.length-1;return e.length>0?n.getNextPageParam(e[i],e,t[i],t):void 0}function Ddt(n,{pages:e,pageParams:t}){return e.length>0?n.getPreviousPageParam?.(e[0],e,t[0],t):void 0}var OFn=class{#e;#t;#i;#n;#o;#s;#r;#a;constructor(n={}){this.#e=n.queryCache||new Edt,this.#t=n.mutationCache||new Tdt,this.#i=n.defaultOptions||{},this.#n=new Map,this.#o=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#r=sae.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=x6.subscribe(async n=>{n&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#r?.(),this.#r=void 0,this.#a?.(),this.#a=void 0)}isFetching(n){return this.#e.findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return this.#t.findAll({...n,status:"pending"}).length}getQueryData(n){const e=this.defaultQueryOptions({queryKey:n});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(n){const e=this.defaultQueryOptions(n),t=this.#e.build(this,e),i=t.state.data;return i===void 0?this.fetchQuery(n):(n.revalidateIfStale&&t.isStaleByTime(rk(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(n){return this.#e.findAll(n).map(({queryKey:e,state:t})=>{const i=t.data;return[e,i]})}setQueryData(n,e,t){const i=this.defaultQueryOptions({queryKey:n}),s=this.#e.get(i.queryHash)?.state.data,o=mdt(e,s);if(o!==void 0)return this.#e.build(this,i).setData(o,{...t,manual:!0})}setQueriesData(n,e,t){return Ha.batch(()=>this.#e.findAll(n).map(({queryKey:i})=>[i,this.setQueryData(i,e,t)]))}getQueryState(n){const e=this.defaultQueryOptions({queryKey:n});return this.#e.get(e.queryHash)?.state}removeQueries(n){const e=this.#e;Ha.batch(()=>{e.findAll(n).forEach(t=>{e.remove(t)})})}resetQueries(n,e){const t=this.#e,i={type:"active",...n};return Ha.batch(()=>(t.findAll(n).forEach(r=>{r.reset()}),this.refetchQueries(i,e)))}cancelQueries(n,e={}){const t={revert:!0,...e},i=Ha.batch(()=>this.#e.findAll(n).map(r=>r.cancel(t)));return Promise.all(i).then(Rh).catch(Rh)}invalidateQueries(n,e={}){return Ha.batch(()=>{if(this.#e.findAll(n).forEach(i=>{i.invalidate()}),n?.refetchType==="none")return Promise.resolve();const t={...n,type:n?.refetchType??n?.type??"active"};return this.refetchQueries(t,e)})}refetchQueries(n,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},i=Ha.batch(()=>this.#e.findAll(n).filter(r=>!r.isDisabled()).map(r=>{let s=r.fetch(void 0,t);return t.throwOnError||(s=s.catch(Rh)),r.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(i).then(Rh)}fetchQuery(n){const e=this.defaultQueryOptions(n);e.retry===void 0&&(e.retry=!1);const t=this.#e.build(this,e);return t.isStaleByTime(rk(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(Rh).catch(Rh)}fetchInfiniteQuery(n){return n.behavior=J0e(n.pages),this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(Rh).catch(Rh)}ensureInfiniteQueryData(n){return n.behavior=J0e(n.pages),this.ensureQueryData(n)}resumePausedMutations(){return x6.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#i}setDefaultOptions(n){this.#i=n}setQueryDefaults(n,e){this.#n.set(Sw(n),{queryKey:n,defaultOptions:e})}getQueryDefaults(n){const e=[...this.#n.values()],t={};return e.forEach(i=>{ZA(n,i.queryKey)&&Object.assign(t,i.defaultOptions)}),t}setMutationDefaults(n,e){this.#o.set(Sw(n),{mutationKey:n,defaultOptions:e})}getMutationDefaults(n){const e=[...this.#o.values()];let t={};return e.forEach(i=>{ZA(n,i.mutationKey)&&(t={...t,...i.defaultOptions})}),t}defaultQueryOptions(n){if(n._defaulted)return n;const e={...this.#i.queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return e.queryHash||(e.queryHash=iae(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===rae&&(e.enabled=!1),e}defaultMutationOptions(n){return n?._defaulted?n:{...this.#i.mutations,...n?.mutationKey&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Idt=class extends HL{constructor(n,e){super(),this.options=e,this.#e=n,this.#a=null,this.#r=GY(),this.options.experimental_prefetchInRender||this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#i=void 0;#n=void 0;#o;#s;#r;#a;#p;#h;#f;#c;#u;#l;#g=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),tve(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return YY(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return YY(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#w(),this.#t.removeObserver(this)}setOptions(n,e){const t=this.options,i=this.#t;if(this.options=this.#e.defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Yf(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#t.setOptions(this.options),t._defaulted&&!C6(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&nve(this.#t,i,this.options,t)&&this.#d(),this.updateResult(e),r&&(this.#t!==i||Yf(this.options.enabled,this.#t)!==Yf(t.enabled,this.#t)||rk(this.options.staleTime,this.#t)!==rk(t.staleTime,this.#t))&&this.#m();const s=this.#_();r&&(this.#t!==i||Yf(this.options.enabled,this.#t)!==Yf(t.enabled,this.#t)||s!==this.#l)&&this.#v(s)}getOptimisticResult(n){const e=this.#e.getQueryCache().build(this.#e,n),t=this.createResult(e,n);return Ndt(this,t)&&(this.#n=t,this.#s=this.options,this.#o=this.#t.state),t}getCurrentResult(){return this.#n}trackResult(n,e){const t={};return Object.keys(n).forEach(i=>{Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(i),e?.(i),n[i])})}),t}trackProp(n){this.#g.add(n)}getCurrentQuery(){return this.#t}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const e=this.#e.defaultQueryOptions(n),t=this.#e.getQueryCache().build(this.#e,e);return t.fetch().then(()=>this.createResult(t,e))}fetch(n){return this.#d({...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#d(n){this.#C();let e=this.#t.fetch(this.options,n);return n?.throwOnError||(e=e.catch(Rh)),e}#m(){this.#y();const n=rk(this.options.staleTime,this.#t);if(xw||this.#n.isStale||!jY(n))return;const t=dMe(this.#n.dataUpdatedAt,n)+1;this.#c=setTimeout(()=>{this.#n.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(n){this.#w(),this.#l=n,!(xw||Yf(this.options.enabled,this.#t)===!1||!jY(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||sae.isFocused())&&this.#d()},this.#l))}#b(){this.#m(),this.#v(this.#_())}#y(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(n,e){const t=this.#t,i=this.options,r=this.#n,s=this.#o,o=this.#s,l=n!==t?n.state:this.#i,{state:c}=n;let u={...c},d=!1,h;if(e._optimisticResults){const L=this.hasListeners(),D=!L&&tve(n,e),I=L&&nve(n,t,e,i);(D||I)&&(u={...u,...vMe(c.data,n.options)}),e._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:g,status:p}=u;if(e.select&&u.data!==void 0)if(r&&u.data===s?.data&&e.select===this.#p)h=this.#h;else try{this.#p=e.select,h=e.select(u.data),h=KY(r?.data,h,e),this.#h=h,this.#a=null}catch(L){this.#a=L}else h=u.data;if(e.placeholderData!==void 0&&h===void 0&&p==="pending"){let L;if(r?.isPlaceholderData&&e.placeholderData===o?.placeholderData)L=r.data;else if(L=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,e.select&&L!==void 0)try{L=e.select(L),this.#a=null}catch(D){this.#a=D}L!==void 0&&(p="success",h=KY(r?.data,L,e),d=!0)}this.#a&&(f=this.#a,h=this.#h,g=Date.now(),p="error");const m=u.fetchStatus==="fetching",_=p==="pending",v=p==="error",y=_&&m,C=h!==void 0,k={status:p,fetchStatus:u.fetchStatus,isPending:_,isSuccess:p==="success",isError:v,isInitialLoading:y,isLoading:y,data:h,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:g,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:m,isRefetching:m&&!_,isLoadingError:v&&!C,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:v&&C,isStale:oae(n,e),refetch:this.refetch,promise:this.#r};if(this.options.experimental_prefetchInRender){const L=O=>{k.status==="error"?O.reject(k.error):k.data!==void 0&&O.resolve(k.data)},D=()=>{const O=this.#r=k.promise=GY();L(O)},I=this.#r;switch(I.status){case"pending":n.queryHash===t.queryHash&&L(I);break;case"fulfilled":(k.status==="error"||k.data!==I.value)&&D();break;case"rejected":(k.status!=="error"||k.error!==I.reason)&&D();break}}return k}updateResult(n){const e=this.#n,t=this.createResult(this.#t,this.options);if(this.#o=this.#t.state,this.#s=this.options,this.#o.data!==void 0&&(this.#f=this.#t),C6(t,e))return;this.#n=t;const i={},r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!this.#g.size)return!0;const a=new Set(o??this.#g);return this.options.throwOnError&&a.add("error"),Object.keys(this.#n).some(l=>{const c=l;return this.#n[c]!==e[c]&&a.has(c)})};n?.listeners!==!1&&r()&&(i.listeners=!0),this.#x({...i,...n})}#C(){const n=this.#e.getQueryCache().build(this.#e,this.options);if(n===this.#t)return;const e=this.#t;this.#t=n,this.#i=n.state,this.hasListeners()&&(e?.removeObserver(this),n.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#x(n){Ha.batch(()=>{n.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Adt(n,e){return Yf(e.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&e.retryOnMount===!1)}function tve(n,e){return Adt(n,e)||n.state.data!==void 0&&YY(n,e,e.refetchOnMount)}function YY(n,e,t){if(Yf(e.enabled,n)!==!1){const i=typeof t=="function"?t(n):t;return i==="always"||i!==!1&&oae(n,e)}return!1}function nve(n,e,t,i){return(n!==e||Yf(i.enabled,n)===!1)&&(!t.suspense||n.state.status!=="error")&&oae(n,t)}function oae(n,e){return Yf(e.enabled,n)!==!1&&n.isStaleByTime(rk(e.staleTime,n))}function Ndt(n,e){return!C6(n.getCurrentResult(),e)}var Rdt=class extends HL{#e;#t=void 0;#i;#n;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#o()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#e.defaultMutationOptions(e),C6(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#i,observer:this}),t?.mutationKey&&this.options.mutationKey&&Sw(t.mutationKey)!==Sw(this.options.mutationKey)?this.reset():this.#i?.state.status==="pending"&&this.#i.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#i?.removeObserver(this)}onMutationUpdate(e){this.#o(),this.#s(e)}getCurrentResult(){return this.#t}reset(){this.#i?.removeObserver(this),this.#i=void 0,this.#o(),this.#s()}mutate(e,t){return this.#n=t,this.#i?.removeObserver(this),this.#i=this.#e.getMutationCache().build(this.#e,this.options),this.#i.addObserver(this),this.#i.execute(e)}#o(){const e=this.#i?.state??bMe();this.#t={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#s(e){Ha.batch(()=>{if(this.#n&&this.hasListeners()){const t=this.#t.variables,i=this.#t.context;e?.type==="success"?(this.#n.onSuccess?.(e.data,t,i),this.#n.onSettled?.(e.data,null,t,i)):e?.type==="error"&&(this.#n.onError?.(e.error,t,i),this.#n.onSettled?.(void 0,e.error,t,i))}this.listeners.forEach(t=>{t(this.#t)})})}},yMe=E.createContext(void 0),wMe=n=>{const e=E.useContext(yMe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},FFn=({client:n,children:e})=>(E.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),ae.jsx(yMe.Provider,{value:n,children:e})),CMe=E.createContext(!1),Pdt=()=>E.useContext(CMe);CMe.Provider;function Odt(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var Mdt=E.createContext(Odt()),Fdt=()=>E.useContext(Mdt);function xMe(n,e){return typeof n=="function"?n(...e):!!n}function ZY(){}var Bdt=(n,e)=>{(n.suspense||n.throwOnError||n.experimental_prefetchInRender)&&(e.isReset()||(n.retryOnMount=!1))},$dt=n=>{E.useEffect(()=>{n.clearReset()},[n])},Wdt=({result:n,errorResetBoundary:e,throwOnError:t,query:i})=>n.isError&&!e.isReset()&&!n.isFetching&&i&&xMe(t,[n.error,i]),Hdt=n=>{n.suspense&&(n.staleTime===void 0&&(n.staleTime=1e3),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3)))},Vdt=(n,e)=>n.isLoading&&n.isFetching&&!e,zdt=(n,e)=>n?.suspense&&e.isPending,ive=(n,e,t)=>e.fetchOptimistic(n).catch(()=>{t.clearReset()});function Udt(n,e,t){const i=wMe(),r=Pdt(),s=Fdt(),o=i.defaultQueryOptions(n);i.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?"isRestoring":"optimistic",Hdt(o),Bdt(o,s),$dt(s);const a=!i.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new e(i,o)),c=l.getOptimisticResult(o);if(E.useSyncExternalStore(E.useCallback(u=>{const d=r?ZY:l.subscribe(Ha.batchCalls(u));return l.updateResult(),d},[l,r]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o,{listeners:!1})},[o,l]),zdt(o,c))throw ive(o,l,s);if(Wdt({result:c,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash)}))throw c.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(o,c),o.experimental_prefetchInRender&&!xw&&Vdt(c,r)&&(a?ive(o,l,s):i.getQueryCache().get(o.queryHash)?.promise)?.catch(ZY).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?c:l.trackResult(c)}function BFn(n,e){return Udt(n,Idt)}function $Fn(n,e){const t=wMe(),[i]=E.useState(()=>new Rdt(t,n));E.useEffect(()=>{i.setOptions(n)},[i,n]);const r=E.useSyncExternalStore(E.useCallback(o=>i.subscribe(Ha.batchCalls(o)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),s=E.useCallback((o,a)=>{i.mutate(o,a).catch(ZY)},[i]);if(r.error&&xMe(i.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:s,mutateAsync:r.mutate}}var SMe={exports:{}};(function(n,e){(function(t,i){n.exports=i()})(Hh,function(){var t=1e3,i=6e4,r=36e5,s="millisecond",o="second",a="minute",l="hour",c="day",u="week",d="month",h="quarter",f="year",g="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,_=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(W){var z=["th","st","nd","rd"],q=W%100;return"["+W+(z[(q-20)%10]||z[q]||z[0])+"]"}},y=function(W,z,q){var ee=String(W);return!ee||ee.length>=z?W:""+Array(z+1-ee.length).join(q)+W},C={s:y,z:function(W){var z=-W.utcOffset(),q=Math.abs(z),ee=Math.floor(q/60),Z=q%60;return(z<=0?"+":"-")+y(ee,2,"0")+":"+y(Z,2,"0")},m:function W(z,q){if(z.date()1)return W(te[0])}else{var le=z.name;k[le]=z,Z=le}return!ee&&Z&&(x=Z),Z||!ee&&x},O=function(W,z){if(D(W))return W.clone();var q=typeof z=="object"?z:{};return q.date=W,q.args=arguments,new B(q)},M=C;M.l=I,M.i=D,M.w=function(W,z){return O(W,{locale:z.$L,utc:z.$u,x:z.$x,$offset:z.$offset})};var B=function(){function W(q){this.$L=I(q.locale,null,!0),this.parse(q),this.$x=this.$x||q.x||{},this[L]=!0}var z=W.prototype;return z.parse=function(q){this.$d=function(ee){var Z=ee.date,j=ee.utc;if(Z===null)return new Date(NaN);if(M.u(Z))return new Date;if(Z instanceof Date)return new Date(Z);if(typeof Z=="string"&&!/Z$/i.test(Z)){var te=Z.match(m);if(te){var le=te[2]-1||0,ue=(te[7]||"0").substring(0,3);return j?new Date(Date.UTC(te[1],le,te[3]||1,te[4]||0,te[5]||0,te[6]||0,ue)):new Date(te[1],le,te[3]||1,te[4]||0,te[5]||0,te[6]||0,ue)}}return new Date(Z)}(q),this.init()},z.init=function(){var q=this.$d;this.$y=q.getFullYear(),this.$M=q.getMonth(),this.$D=q.getDate(),this.$W=q.getDay(),this.$H=q.getHours(),this.$m=q.getMinutes(),this.$s=q.getSeconds(),this.$ms=q.getMilliseconds()},z.$utils=function(){return M},z.isValid=function(){return this.$d.toString()!==p},z.isSame=function(q,ee){var Z=O(q);return this.startOf(ee)<=Z&&Z<=this.endOf(ee)},z.isAfter=function(q,ee){return O(q)1&&arguments[1]!==void 0?arguments[1]:{container:document.body},xe="";return typeof de=="string"?xe=v(de,we):de instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(de?.type)?xe=v(de.value,we):(xe=f()(de),g("copy")),xe},C=y;function x(ue){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?x=function(we){return typeof we}:x=function(we){return we&&typeof Symbol=="function"&&we.constructor===Symbol&&we!==Symbol.prototype?"symbol":typeof we},x(ue)}var k=function(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},we=de.action,xe=we===void 0?"copy":we,Me=de.container,Re=de.target,_t=de.text;if(xe!=="copy"&&xe!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(Re!==void 0)if(Re&&x(Re)==="object"&&Re.nodeType===1){if(xe==="copy"&&Re.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(xe==="cut"&&(Re.hasAttribute("readonly")||Re.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(_t)return C(_t,{container:Me});if(Re)return xe==="cut"?m(Re):C(Re,{container:Me})},L=k;function D(ue){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?D=function(we){return typeof we}:D=function(we){return we&&typeof Symbol=="function"&&we.constructor===Symbol&&we!==Symbol.prototype?"symbol":typeof we},D(ue)}function I(ue,de){if(!(ue instanceof de))throw new TypeError("Cannot call a class as a function")}function O(ue,de){for(var we=0;we"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Z(ue){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(we){return we.__proto__||Object.getPrototypeOf(we)},Z(ue)}function j(ue,de){var we="data-clipboard-".concat(ue);if(de.hasAttribute(we))return de.getAttribute(we)}var te=function(ue){B(we,ue);var de=W(we);function we(xe,Me){var Re;return I(this,we),Re=de.call(this),Re.resolveOptions(Me),Re.listenClick(xe),Re}return M(we,[{key:"resolveOptions",value:function(){var Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof Me.action=="function"?Me.action:this.defaultAction,this.target=typeof Me.target=="function"?Me.target:this.defaultTarget,this.text=typeof Me.text=="function"?Me.text:this.defaultText,this.container=D(Me.container)==="object"?Me.container:document.body}},{key:"listenClick",value:function(Me){var Re=this;this.listener=d()(Me,"click",function(_t){return Re.onClick(_t)})}},{key:"onClick",value:function(Me){var Re=Me.delegateTarget||Me.currentTarget,_t=this.action(Re)||"copy",Qe=L({action:_t,container:this.container,target:this.target(Re),text:this.text(Re)});this.emit(Qe?"success":"error",{action:_t,text:Qe,trigger:Re,clearSelection:function(){Re&&Re.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(Me){return j("action",Me)}},{key:"defaultTarget",value:function(Me){var Re=j("target",Me);if(Re)return document.querySelector(Re)}},{key:"defaultText",value:function(Me){return j("text",Me)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(Me){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return C(Me,Re)}},{key:"cut",value:function(Me){return m(Me)}},{key:"isSupported",value:function(){var Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],Re=typeof Me=="string"?[Me]:Me,_t=!!document.queryCommandSupported;return Re.forEach(function(Qe){_t=_t&&!!document.queryCommandSupported(Qe)}),_t}}]),we}(c()),le=te},828:function(s){var o=9;if(typeof Element<"u"&&!Element.prototype.matches){var a=Element.prototype;a.matches=a.matchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector}function l(c,u){for(;c&&c.nodeType!==o;){if(typeof c.matches=="function"&&c.matches(u))return c;c=c.parentNode}}s.exports=l},438:function(s,o,a){var l=a(828);function c(h,f,g,p,m){var _=d.apply(this,arguments);return h.addEventListener(g,_,m),{destroy:function(){h.removeEventListener(g,_,m)}}}function u(h,f,g,p,m){return typeof h.addEventListener=="function"?c.apply(null,arguments):typeof g=="function"?c.bind(null,document).apply(null,arguments):(typeof h=="string"&&(h=document.querySelectorAll(h)),Array.prototype.map.call(h,function(_){return c(_,f,g,p,m)}))}function d(h,f,g,p){return function(m){m.delegateTarget=l(m.target,f),m.delegateTarget&&p.call(h,m)}}s.exports=u},879:function(s,o){o.node=function(a){return a!==void 0&&a instanceof HTMLElement&&a.nodeType===1},o.nodeList=function(a){var l=Object.prototype.toString.call(a);return a!==void 0&&(l==="[object NodeList]"||l==="[object HTMLCollection]")&&"length"in a&&(a.length===0||o.node(a[0]))},o.string=function(a){return typeof a=="string"||a instanceof String},o.fn=function(a){var l=Object.prototype.toString.call(a);return l==="[object Function]"}},370:function(s,o,a){var l=a(879),c=a(438);function u(g,p,m){if(!g&&!p&&!m)throw new Error("Missing required arguments");if(!l.string(p))throw new TypeError("Second argument must be a String");if(!l.fn(m))throw new TypeError("Third argument must be a Function");if(l.node(g))return d(g,p,m);if(l.nodeList(g))return h(g,p,m);if(l.string(g))return f(g,p,m);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function d(g,p,m){return g.addEventListener(p,m),{destroy:function(){g.removeEventListener(p,m)}}}function h(g,p,m){return Array.prototype.forEach.call(g,function(_){_.addEventListener(p,m)}),{destroy:function(){Array.prototype.forEach.call(g,function(_){_.removeEventListener(p,m)})}}}function f(g,p,m){return c(document.body,g,p,m)}s.exports=u},817:function(s){function o(a){var l;if(a.nodeName==="SELECT")a.focus(),l=a.value;else if(a.nodeName==="INPUT"||a.nodeName==="TEXTAREA"){var c=a.hasAttribute("readonly");c||a.setAttribute("readonly",""),a.select(),a.setSelectionRange(0,a.value.length),c||a.removeAttribute("readonly"),l=a.value}else{a.hasAttribute("contenteditable")&&a.focus();var u=window.getSelection(),d=document.createRange();d.selectNodeContents(a),u.removeAllRanges(),u.addRange(d),l=u.toString()}return l}s.exports=o},279:function(s){function o(){}o.prototype={on:function(a,l,c){var u=this.e||(this.e={});return(u[a]||(u[a]=[])).push({fn:l,ctx:c}),this},once:function(a,l,c){var u=this;function d(){u.off(a,d),l.apply(c,arguments)}return d._=l,this.on(a,d,c)},emit:function(a){var l=[].slice.call(arguments,1),c=((this.e||(this.e={}))[a]||[]).slice(),u=0,d=c.length;for(u;ue=>{const t=Kdt.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Og=n=>(n=n.toLowerCase(),e=>x$(e)===n),S$=n=>e=>typeof e===n,{isArray:VL}=Array,XA=S$("undefined");function Gdt(n){return n!==null&&!XA(n)&&n.constructor!==null&&!XA(n.constructor)&&jd(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const LMe=Og("ArrayBuffer");function Ydt(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&LMe(n.buffer),e}const Zdt=S$("string"),jd=S$("function"),TMe=S$("number"),k$=n=>n!==null&&typeof n=="object",Xdt=n=>n===!0||n===!1,AF=n=>{if(x$(n)!=="object")return!1;const e=aae(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Qdt=Og("Date"),Jdt=Og("File"),eht=Og("Blob"),tht=Og("FileList"),nht=n=>k$(n)&&jd(n.pipe),iht=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||jd(n.append)&&((e=x$(n))==="formdata"||e==="object"&&jd(n.toString)&&n.toString()==="[object FormData]"))},rht=Og("URLSearchParams"),[sht,oht,aht,lht]=["ReadableStream","Request","Response","Headers"].map(Og),cht=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function WP(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let i,r;if(typeof n!="object"&&(n=[n]),VL(n))for(i=0,r=n.length;i0;)if(r=t[i],e===r.toLowerCase())return r;return null}const Ly=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,IMe=n=>!XA(n)&&n!==Ly;function XY(){const{caseless:n}=IMe(this)&&this||{},e={},t=(i,r)=>{const s=n&&DMe(e,r)||r;AF(e[s])&&AF(i)?e[s]=XY(e[s],i):AF(i)?e[s]=XY({},i):VL(i)?e[s]=i.slice():e[s]=i};for(let i=0,r=arguments.length;i(WP(e,(r,s)=>{t&&jd(r)?n[s]=EMe(r,t):n[s]=r},{allOwnKeys:i}),n),dht=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),hht=(n,e,t,i)=>{n.prototype=Object.create(e.prototype,i),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},fht=(n,e,t,i)=>{let r,s,o;const a={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),s=r.length;s-- >0;)o=r[s],(!i||i(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&aae(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},ght=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const i=n.indexOf(e,t);return i!==-1&&i===t},pht=n=>{if(!n)return null;if(VL(n))return n;let e=n.length;if(!TMe(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},mht=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&aae(Uint8Array)),_ht=(n,e)=>{const i=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=i.next())&&!r.done;){const s=r.value;e.call(n,s[0],s[1])}},vht=(n,e)=>{let t;const i=[];for(;(t=n.exec(e))!==null;)i.push(t);return i},bht=Og("HTMLFormElement"),yht=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,i,r){return i.toUpperCase()+r}),rve=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),wht=Og("RegExp"),AMe=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),i={};WP(t,(r,s)=>{let o;(o=e(r,s,n))!==!1&&(i[s]=o||r)}),Object.defineProperties(n,i)},Cht=n=>{AMe(n,(e,t)=>{if(jd(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const i=n[t];if(jd(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},xht=(n,e)=>{const t={},i=r=>{r.forEach(s=>{t[s]=!0})};return VL(n)?i(n):i(String(n).split(e)),t},Sht=()=>{},kht=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e,ij="abcdefghijklmnopqrstuvwxyz",sve="0123456789",NMe={DIGIT:sve,ALPHA:ij,ALPHA_DIGIT:ij+ij.toUpperCase()+sve},Eht=(n=16,e=NMe.ALPHA_DIGIT)=>{let t="";const{length:i}=e;for(;n--;)t+=e[Math.random()*i|0];return t};function Lht(n){return!!(n&&jd(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const Tht=n=>{const e=new Array(10),t=(i,r)=>{if(k$(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[r]=i;const s=VL(i)?[]:{};return WP(i,(o,a)=>{const l=t(o,r+1);!XA(l)&&(s[a]=l)}),e[r]=void 0,s}}return i};return t(n,0)},Dht=Og("AsyncFunction"),Iht=n=>n&&(k$(n)||jd(n))&&jd(n.then)&&jd(n.catch),RMe=((n,e)=>n?setImmediate:e?((t,i)=>(Ly.addEventListener("message",({source:r,data:s})=>{r===Ly&&s===t&&i.length&&i.shift()()},!1),r=>{i.push(r),Ly.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",jd(Ly.postMessage)),Aht=typeof queueMicrotask<"u"?queueMicrotask.bind(Ly):typeof process<"u"&&process.nextTick||RMe,tt={isArray:VL,isArrayBuffer:LMe,isBuffer:Gdt,isFormData:iht,isArrayBufferView:Ydt,isString:Zdt,isNumber:TMe,isBoolean:Xdt,isObject:k$,isPlainObject:AF,isReadableStream:sht,isRequest:oht,isResponse:aht,isHeaders:lht,isUndefined:XA,isDate:Qdt,isFile:Jdt,isBlob:eht,isRegExp:wht,isFunction:jd,isStream:nht,isURLSearchParams:rht,isTypedArray:mht,isFileList:tht,forEach:WP,merge:XY,extend:uht,trim:cht,stripBOM:dht,inherits:hht,toFlatObject:fht,kindOf:x$,kindOfTest:Og,endsWith:ght,toArray:pht,forEachEntry:_ht,matchAll:vht,isHTMLForm:bht,hasOwnProperty:rve,hasOwnProp:rve,reduceDescriptors:AMe,freezeMethods:Cht,toObjectSet:xht,toCamelCase:yht,noop:Sht,toFiniteNumber:kht,findKey:DMe,global:Ly,isContextDefined:IMe,ALPHABET:NMe,generateString:Eht,isSpecCompliantForm:Lht,toJSONObject:Tht,isAsyncFn:Dht,isThenable:Iht,setImmediate:RMe,asap:Aht};function Fi(n,e,t,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}tt.inherits(Fi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:tt.toJSONObject(this.config),code:this.code,status:this.status}}});const PMe=Fi.prototype,OMe={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{OMe[n]={value:n}});Object.defineProperties(Fi,OMe);Object.defineProperty(PMe,"isAxiosError",{value:!0});Fi.from=(n,e,t,i,r,s)=>{const o=Object.create(PMe);return tt.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),Fi.call(o,n.message,e,t,i,r),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const Nht=null;function QY(n){return tt.isPlainObject(n)||tt.isArray(n)}function MMe(n){return tt.endsWith(n,"[]")?n.slice(0,-2):n}function ove(n,e,t){return n?n.concat(e).map(function(r,s){return r=MMe(r),!t&&s?"["+r+"]":r}).join(t?".":""):e}function Rht(n){return tt.isArray(n)&&!n.some(QY)}const Pht=tt.toFlatObject(tt,{},null,function(e){return/^is[A-Z]/.test(e)});function E$(n,e,t){if(!tt.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=tt.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,m){return!tt.isUndefined(m[p])});const i=t.metaTokens,r=t.visitor||u,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&tt.isSpecCompliantForm(e);if(!tt.isFunction(r))throw new TypeError("visitor must be a function");function c(g){if(g===null)return"";if(tt.isDate(g))return g.toISOString();if(!l&&tt.isBlob(g))throw new Fi("Blob is not supported. Use a Buffer instead.");return tt.isArrayBuffer(g)||tt.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function u(g,p,m){let _=g;if(g&&!m&&typeof g=="object"){if(tt.endsWith(p,"{}"))p=i?p:p.slice(0,-2),g=JSON.stringify(g);else if(tt.isArray(g)&&Rht(g)||(tt.isFileList(g)||tt.endsWith(p,"[]"))&&(_=tt.toArray(g)))return p=MMe(p),_.forEach(function(y,C){!(tt.isUndefined(y)||y===null)&&e.append(o===!0?ove([p],C,s):o===null?p:p+"[]",c(y))}),!1}return QY(g)?!0:(e.append(ove(m,p,s),c(g)),!1)}const d=[],h=Object.assign(Pht,{defaultVisitor:u,convertValue:c,isVisitable:QY});function f(g,p){if(!tt.isUndefined(g)){if(d.indexOf(g)!==-1)throw Error("Circular reference detected in "+p.join("."));d.push(g),tt.forEach(g,function(_,v){(!(tt.isUndefined(_)||_===null)&&r.call(e,_,tt.isString(v)?v.trim():v,p,h))===!0&&f(_,p?p.concat(v):[v])}),d.pop()}}if(!tt.isObject(n))throw new TypeError("data must be an object");return f(n),e}function ave(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function lae(n,e){this._pairs=[],n&&E$(n,this,e)}const FMe=lae.prototype;FMe.append=function(e,t){this._pairs.push([e,t])};FMe.toString=function(e){const t=e?function(i){return e.call(this,i,ave)}:ave;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function Oht(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function BMe(n,e,t){if(!e)return n;const i=t&&t.encode||Oht;tt.isFunction(t)&&(t={serialize:t});const r=t&&t.serialize;let s;if(r?s=r(e,t):s=tt.isURLSearchParams(e)?e.toString():new lae(e,t).toString(i),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class lve{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){tt.forEach(this.handlers,function(i){i!==null&&e(i)})}}const $Me={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mht=typeof URLSearchParams<"u"?URLSearchParams:lae,Fht=typeof FormData<"u"?FormData:null,Bht=typeof Blob<"u"?Blob:null,$ht={isBrowser:!0,classes:{URLSearchParams:Mht,FormData:Fht,Blob:Bht},protocols:["http","https","file","blob","url","data"]},cae=typeof window<"u"&&typeof document<"u",JY=typeof navigator=="object"&&navigator||void 0,Wht=cae&&(!JY||["ReactNative","NativeScript","NS"].indexOf(JY.product)<0),Hht=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Vht=cae&&window.location.href||"http://localhost",zht=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cae,hasStandardBrowserEnv:Wht,hasStandardBrowserWebWorkerEnv:Hht,navigator:JY,origin:Vht},Symbol.toStringTag,{value:"Module"})),mc={...zht,...$ht};function Uht(n,e){return E$(n,new mc.classes.URLSearchParams,Object.assign({visitor:function(t,i,r,s){return mc.isNode&&tt.isBuffer(t)?(this.append(i,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function jht(n){return tt.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function qht(n){const e={},t=Object.keys(n);let i;const r=t.length;let s;for(i=0;i=t.length;return o=!o&&tt.isArray(r)?r.length:o,l?(tt.hasOwnProp(r,o)?r[o]=[r[o],i]:r[o]=i,!a):((!r[o]||!tt.isObject(r[o]))&&(r[o]=[]),e(t,i,r[o],s)&&tt.isArray(r[o])&&(r[o]=qht(r[o])),!a)}if(tt.isFormData(n)&&tt.isFunction(n.entries)){const t={};return tt.forEachEntry(n,(i,r)=>{e(jht(i),r,t,0)}),t}return null}function Kht(n,e,t){if(tt.isString(n))try{return(e||JSON.parse)(n),tt.trim(n)}catch(i){if(i.name!=="SyntaxError")throw i}return(0,JSON.stringify)(n)}const HP={transitional:$Me,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,s=tt.isObject(e);if(s&&tt.isHTMLForm(e)&&(e=new FormData(e)),tt.isFormData(e))return r?JSON.stringify(WMe(e)):e;if(tt.isArrayBuffer(e)||tt.isBuffer(e)||tt.isStream(e)||tt.isFile(e)||tt.isBlob(e)||tt.isReadableStream(e))return e;if(tt.isArrayBufferView(e))return e.buffer;if(tt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Uht(e,this.formSerializer).toString();if((a=tt.isFileList(e))||i.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return E$(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),Kht(e)):e}],transformResponse:[function(e){const t=this.transitional||HP.transitional,i=t&&t.forcedJSONParsing,r=this.responseType==="json";if(tt.isResponse(e)||tt.isReadableStream(e))return e;if(e&&tt.isString(e)&&(i&&!this.responseType||r)){const o=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Fi.from(a,Fi.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:mc.classes.FormData,Blob:mc.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};tt.forEach(["delete","get","head","post","put","patch"],n=>{HP.headers[n]={}});const Ght=tt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Yht=n=>{const e={};let t,i,r;return n&&n.split(` -`).forEach(function(o){r=o.indexOf(":"),t=o.substring(0,r).trim().toLowerCase(),i=o.substring(r+1).trim(),!(!t||e[t]&&Ght[t])&&(t==="set-cookie"?e[t]?e[t].push(i):e[t]=[i]:e[t]=e[t]?e[t]+", "+i:i)}),e},cve=Symbol("internals");function vT(n){return n&&String(n).trim().toLowerCase()}function NF(n){return n===!1||n==null?n:tt.isArray(n)?n.map(NF):String(n)}function Zht(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=t.exec(n);)e[i[1]]=i[2];return e}const Xht=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function rj(n,e,t,i,r){if(tt.isFunction(i))return i.call(this,e,t);if(r&&(e=t),!!tt.isString(e)){if(tt.isString(i))return e.indexOf(i)!==-1;if(tt.isRegExp(i))return i.test(e)}}function Qht(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,i)=>t.toUpperCase()+i)}function Jht(n,e){const t=tt.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(n,i+t,{value:function(r,s,o){return this[i].call(this,e,r,s,o)},configurable:!0})})}class Xu{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function s(a,l,c){const u=vT(l);if(!u)throw new Error("header name must be a non-empty string");const d=tt.findKey(r,u);(!d||r[d]===void 0||c===!0||c===void 0&&r[d]!==!1)&&(r[d||l]=NF(a))}const o=(a,l)=>tt.forEach(a,(c,u)=>s(c,u,l));if(tt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(tt.isString(e)&&(e=e.trim())&&!Xht(e))o(Yht(e),t);else if(tt.isHeaders(e))for(const[a,l]of e.entries())s(l,a,i);else e!=null&&s(t,e,i);return this}get(e,t){if(e=vT(e),e){const i=tt.findKey(this,e);if(i){const r=this[i];if(!t)return r;if(t===!0)return Zht(r);if(tt.isFunction(t))return t.call(this,r,i);if(tt.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=vT(e),e){const i=tt.findKey(this,e);return!!(i&&this[i]!==void 0&&(!t||rj(this,this[i],i,t)))}return!1}delete(e,t){const i=this;let r=!1;function s(o){if(o=vT(o),o){const a=tt.findKey(i,o);a&&(!t||rj(i,i[a],a,t))&&(delete i[a],r=!0)}}return tt.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const s=t[i];(!e||rj(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){const t=this,i={};return tt.forEach(this,(r,s)=>{const o=tt.findKey(i,s);if(o){t[o]=NF(r),delete t[s];return}const a=e?Qht(s):String(s).trim();a!==s&&delete t[s],t[a]=NF(r),i[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return tt.forEach(this,(i,r)=>{i!=null&&i!==!1&&(t[r]=e&&tt.isArray(i)?i.join(", "):i)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` + */(function(n,e){(function(i,r){n.exports=r()})(Hh,function(){return function(){var t={686:function(s,o,a){a.d(o,{default:function(){return le}});var l=a(279),c=a.n(l),u=a(370),d=a.n(u),h=a(817),f=a.n(h);function g(ue){try{return document.execCommand(ue)}catch{return!1}}var p=function(de){var we=f()(de);return g("cut"),we},m=p;function _(ue){var de=document.documentElement.getAttribute("dir")==="rtl",we=document.createElement("textarea");we.style.fontSize="12pt",we.style.border="0",we.style.padding="0",we.style.margin="0",we.style.position="absolute",we.style[de?"right":"left"]="-9999px";var xe=window.pageYOffset||document.documentElement.scrollTop;return we.style.top="".concat(xe,"px"),we.setAttribute("readonly",""),we.value=ue,we}var v=function(de,we){var xe=_(de);we.container.appendChild(xe);var Me=f()(xe);return g("copy"),xe.remove(),Me},y=function(de){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},xe="";return typeof de=="string"?xe=v(de,we):de instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(de?.type)?xe=v(de.value,we):(xe=f()(de),g("copy")),xe},C=y;function x(ue){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?x=function(we){return typeof we}:x=function(we){return we&&typeof Symbol=="function"&&we.constructor===Symbol&&we!==Symbol.prototype?"symbol":typeof we},x(ue)}var k=function(){var de=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},we=de.action,xe=we===void 0?"copy":we,Me=de.container,Re=de.target,_t=de.text;if(xe!=="copy"&&xe!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(Re!==void 0)if(Re&&x(Re)==="object"&&Re.nodeType===1){if(xe==="copy"&&Re.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(xe==="cut"&&(Re.hasAttribute("readonly")||Re.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(_t)return C(_t,{container:Me});if(Re)return xe==="cut"?m(Re):C(Re,{container:Me})},L=k;function D(ue){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?D=function(we){return typeof we}:D=function(we){return we&&typeof Symbol=="function"&&we.constructor===Symbol&&we!==Symbol.prototype?"symbol":typeof we},D(ue)}function I(ue,de){if(!(ue instanceof de))throw new TypeError("Cannot call a class as a function")}function O(ue,de){for(var we=0;we"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Z(ue){return Z=Object.setPrototypeOf?Object.getPrototypeOf:function(we){return we.__proto__||Object.getPrototypeOf(we)},Z(ue)}function j(ue,de){var we="data-clipboard-".concat(ue);if(de.hasAttribute(we))return de.getAttribute(we)}var te=function(ue){B(we,ue);var de=W(we);function we(xe,Me){var Re;return I(this,we),Re=de.call(this),Re.resolveOptions(Me),Re.listenClick(xe),Re}return M(we,[{key:"resolveOptions",value:function(){var Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof Me.action=="function"?Me.action:this.defaultAction,this.target=typeof Me.target=="function"?Me.target:this.defaultTarget,this.text=typeof Me.text=="function"?Me.text:this.defaultText,this.container=D(Me.container)==="object"?Me.container:document.body}},{key:"listenClick",value:function(Me){var Re=this;this.listener=d()(Me,"click",function(_t){return Re.onClick(_t)})}},{key:"onClick",value:function(Me){var Re=Me.delegateTarget||Me.currentTarget,_t=this.action(Re)||"copy",Qe=L({action:_t,container:this.container,target:this.target(Re),text:this.text(Re)});this.emit(Qe?"success":"error",{action:_t,text:Qe,trigger:Re,clearSelection:function(){Re&&Re.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(Me){return j("action",Me)}},{key:"defaultTarget",value:function(Me){var Re=j("target",Me);if(Re)return document.querySelector(Re)}},{key:"defaultText",value:function(Me){return j("text",Me)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(Me){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return C(Me,Re)}},{key:"cut",value:function(Me){return m(Me)}},{key:"isSupported",value:function(){var Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],Re=typeof Me=="string"?[Me]:Me,_t=!!document.queryCommandSupported;return Re.forEach(function(Qe){_t=_t&&!!document.queryCommandSupported(Qe)}),_t}}]),we}(c()),le=te},828:function(s){var o=9;if(typeof Element<"u"&&!Element.prototype.matches){var a=Element.prototype;a.matches=a.matchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector}function l(c,u){for(;c&&c.nodeType!==o;){if(typeof c.matches=="function"&&c.matches(u))return c;c=c.parentNode}}s.exports=l},438:function(s,o,a){var l=a(828);function c(h,f,g,p,m){var _=d.apply(this,arguments);return h.addEventListener(g,_,m),{destroy:function(){h.removeEventListener(g,_,m)}}}function u(h,f,g,p,m){return typeof h.addEventListener=="function"?c.apply(null,arguments):typeof g=="function"?c.bind(null,document).apply(null,arguments):(typeof h=="string"&&(h=document.querySelectorAll(h)),Array.prototype.map.call(h,function(_){return c(_,f,g,p,m)}))}function d(h,f,g,p){return function(m){m.delegateTarget=l(m.target,f),m.delegateTarget&&p.call(h,m)}}s.exports=u},879:function(s,o){o.node=function(a){return a!==void 0&&a instanceof HTMLElement&&a.nodeType===1},o.nodeList=function(a){var l=Object.prototype.toString.call(a);return a!==void 0&&(l==="[object NodeList]"||l==="[object HTMLCollection]")&&"length"in a&&(a.length===0||o.node(a[0]))},o.string=function(a){return typeof a=="string"||a instanceof String},o.fn=function(a){var l=Object.prototype.toString.call(a);return l==="[object Function]"}},370:function(s,o,a){var l=a(879),c=a(438);function u(g,p,m){if(!g&&!p&&!m)throw new Error("Missing required arguments");if(!l.string(p))throw new TypeError("Second argument must be a String");if(!l.fn(m))throw new TypeError("Third argument must be a Function");if(l.node(g))return d(g,p,m);if(l.nodeList(g))return h(g,p,m);if(l.string(g))return f(g,p,m);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function d(g,p,m){return g.addEventListener(p,m),{destroy:function(){g.removeEventListener(p,m)}}}function h(g,p,m){return Array.prototype.forEach.call(g,function(_){_.addEventListener(p,m)}),{destroy:function(){Array.prototype.forEach.call(g,function(_){_.removeEventListener(p,m)})}}}function f(g,p,m){return c(document.body,g,p,m)}s.exports=u},817:function(s){function o(a){var l;if(a.nodeName==="SELECT")a.focus(),l=a.value;else if(a.nodeName==="INPUT"||a.nodeName==="TEXTAREA"){var c=a.hasAttribute("readonly");c||a.setAttribute("readonly",""),a.select(),a.setSelectionRange(0,a.value.length),c||a.removeAttribute("readonly"),l=a.value}else{a.hasAttribute("contenteditable")&&a.focus();var u=window.getSelection(),d=document.createRange();d.selectNodeContents(a),u.removeAllRanges(),u.addRange(d),l=u.toString()}return l}s.exports=o},279:function(s){function o(){}o.prototype={on:function(a,l,c){var u=this.e||(this.e={});return(u[a]||(u[a]=[])).push({fn:l,ctx:c}),this},once:function(a,l,c){var u=this;function d(){u.off(a,d),l.apply(c,arguments)}return d._=l,this.on(a,d,c)},emit:function(a){var l=[].slice.call(arguments,1),c=((this.e||(this.e={}))[a]||[]).slice(),u=0,d=c.length;for(u;ue=>{const t=Kdt.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Og=n=>(n=n.toLowerCase(),e=>x$(e)===n),S$=n=>e=>typeof e===n,{isArray:VL}=Array,XA=S$("undefined");function Gdt(n){return n!==null&&!XA(n)&&n.constructor!==null&&!XA(n.constructor)&&jd(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const LMe=Og("ArrayBuffer");function Ydt(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&LMe(n.buffer),e}const Zdt=S$("string"),jd=S$("function"),TMe=S$("number"),k$=n=>n!==null&&typeof n=="object",Xdt=n=>n===!0||n===!1,A5=n=>{if(x$(n)!=="object")return!1;const e=aae(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Qdt=Og("Date"),Jdt=Og("File"),eht=Og("Blob"),tht=Og("FileList"),nht=n=>k$(n)&&jd(n.pipe),iht=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||jd(n.append)&&((e=x$(n))==="formdata"||e==="object"&&jd(n.toString)&&n.toString()==="[object FormData]"))},rht=Og("URLSearchParams"),[sht,oht,aht,lht]=["ReadableStream","Request","Response","Headers"].map(Og),cht=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function WP(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let i,r;if(typeof n!="object"&&(n=[n]),VL(n))for(i=0,r=n.length;i0;)if(r=t[i],e===r.toLowerCase())return r;return null}const Ly=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,IMe=n=>!XA(n)&&n!==Ly;function XY(){const{caseless:n}=IMe(this)&&this||{},e={},t=(i,r)=>{const s=n&&DMe(e,r)||r;A5(e[s])&&A5(i)?e[s]=XY(e[s],i):A5(i)?e[s]=XY({},i):VL(i)?e[s]=i.slice():e[s]=i};for(let i=0,r=arguments.length;i(WP(e,(r,s)=>{t&&jd(r)?n[s]=EMe(r,t):n[s]=r},{allOwnKeys:i}),n),dht=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),hht=(n,e,t,i)=>{n.prototype=Object.create(e.prototype,i),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},fht=(n,e,t,i)=>{let r,s,o;const a={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),s=r.length;s-- >0;)o=r[s],(!i||i(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&aae(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},ght=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const i=n.indexOf(e,t);return i!==-1&&i===t},pht=n=>{if(!n)return null;if(VL(n))return n;let e=n.length;if(!TMe(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},mht=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&aae(Uint8Array)),_ht=(n,e)=>{const i=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=i.next())&&!r.done;){const s=r.value;e.call(n,s[0],s[1])}},vht=(n,e)=>{let t;const i=[];for(;(t=n.exec(e))!==null;)i.push(t);return i},bht=Og("HTMLFormElement"),yht=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,i,r){return i.toUpperCase()+r}),rve=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),wht=Og("RegExp"),AMe=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),i={};WP(t,(r,s)=>{let o;(o=e(r,s,n))!==!1&&(i[s]=o||r)}),Object.defineProperties(n,i)},Cht=n=>{AMe(n,(e,t)=>{if(jd(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const i=n[t];if(jd(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},xht=(n,e)=>{const t={},i=r=>{r.forEach(s=>{t[s]=!0})};return VL(n)?i(n):i(String(n).split(e)),t},Sht=()=>{},kht=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e,ij="abcdefghijklmnopqrstuvwxyz",sve="0123456789",NMe={DIGIT:sve,ALPHA:ij,ALPHA_DIGIT:ij+ij.toUpperCase()+sve},Eht=(n=16,e=NMe.ALPHA_DIGIT)=>{let t="";const{length:i}=e;for(;n--;)t+=e[Math.random()*i|0];return t};function Lht(n){return!!(n&&jd(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const Tht=n=>{const e=new Array(10),t=(i,r)=>{if(k$(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[r]=i;const s=VL(i)?[]:{};return WP(i,(o,a)=>{const l=t(o,r+1);!XA(l)&&(s[a]=l)}),e[r]=void 0,s}}return i};return t(n,0)},Dht=Og("AsyncFunction"),Iht=n=>n&&(k$(n)||jd(n))&&jd(n.then)&&jd(n.catch),RMe=((n,e)=>n?setImmediate:e?((t,i)=>(Ly.addEventListener("message",({source:r,data:s})=>{r===Ly&&s===t&&i.length&&i.shift()()},!1),r=>{i.push(r),Ly.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",jd(Ly.postMessage)),Aht=typeof queueMicrotask<"u"?queueMicrotask.bind(Ly):typeof process<"u"&&process.nextTick||RMe,tt={isArray:VL,isArrayBuffer:LMe,isBuffer:Gdt,isFormData:iht,isArrayBufferView:Ydt,isString:Zdt,isNumber:TMe,isBoolean:Xdt,isObject:k$,isPlainObject:A5,isReadableStream:sht,isRequest:oht,isResponse:aht,isHeaders:lht,isUndefined:XA,isDate:Qdt,isFile:Jdt,isBlob:eht,isRegExp:wht,isFunction:jd,isStream:nht,isURLSearchParams:rht,isTypedArray:mht,isFileList:tht,forEach:WP,merge:XY,extend:uht,trim:cht,stripBOM:dht,inherits:hht,toFlatObject:fht,kindOf:x$,kindOfTest:Og,endsWith:ght,toArray:pht,forEachEntry:_ht,matchAll:vht,isHTMLForm:bht,hasOwnProperty:rve,hasOwnProp:rve,reduceDescriptors:AMe,freezeMethods:Cht,toObjectSet:xht,toCamelCase:yht,noop:Sht,toFiniteNumber:kht,findKey:DMe,global:Ly,isContextDefined:IMe,ALPHABET:NMe,generateString:Eht,isSpecCompliantForm:Lht,toJSONObject:Tht,isAsyncFn:Dht,isThenable:Iht,setImmediate:RMe,asap:Aht};function Fi(n,e,t,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}tt.inherits(Fi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:tt.toJSONObject(this.config),code:this.code,status:this.status}}});const PMe=Fi.prototype,OMe={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{OMe[n]={value:n}});Object.defineProperties(Fi,OMe);Object.defineProperty(PMe,"isAxiosError",{value:!0});Fi.from=(n,e,t,i,r,s)=>{const o=Object.create(PMe);return tt.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),Fi.call(o,n.message,e,t,i,r),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const Nht=null;function QY(n){return tt.isPlainObject(n)||tt.isArray(n)}function MMe(n){return tt.endsWith(n,"[]")?n.slice(0,-2):n}function ove(n,e,t){return n?n.concat(e).map(function(r,s){return r=MMe(r),!t&&s?"["+r+"]":r}).join(t?".":""):e}function Rht(n){return tt.isArray(n)&&!n.some(QY)}const Pht=tt.toFlatObject(tt,{},null,function(e){return/^is[A-Z]/.test(e)});function E$(n,e,t){if(!tt.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=tt.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,m){return!tt.isUndefined(m[p])});const i=t.metaTokens,r=t.visitor||u,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&tt.isSpecCompliantForm(e);if(!tt.isFunction(r))throw new TypeError("visitor must be a function");function c(g){if(g===null)return"";if(tt.isDate(g))return g.toISOString();if(!l&&tt.isBlob(g))throw new Fi("Blob is not supported. Use a Buffer instead.");return tt.isArrayBuffer(g)||tt.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function u(g,p,m){let _=g;if(g&&!m&&typeof g=="object"){if(tt.endsWith(p,"{}"))p=i?p:p.slice(0,-2),g=JSON.stringify(g);else if(tt.isArray(g)&&Rht(g)||(tt.isFileList(g)||tt.endsWith(p,"[]"))&&(_=tt.toArray(g)))return p=MMe(p),_.forEach(function(y,C){!(tt.isUndefined(y)||y===null)&&e.append(o===!0?ove([p],C,s):o===null?p:p+"[]",c(y))}),!1}return QY(g)?!0:(e.append(ove(m,p,s),c(g)),!1)}const d=[],h=Object.assign(Pht,{defaultVisitor:u,convertValue:c,isVisitable:QY});function f(g,p){if(!tt.isUndefined(g)){if(d.indexOf(g)!==-1)throw Error("Circular reference detected in "+p.join("."));d.push(g),tt.forEach(g,function(_,v){(!(tt.isUndefined(_)||_===null)&&r.call(e,_,tt.isString(v)?v.trim():v,p,h))===!0&&f(_,p?p.concat(v):[v])}),d.pop()}}if(!tt.isObject(n))throw new TypeError("data must be an object");return f(n),e}function ave(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function lae(n,e){this._pairs=[],n&&E$(n,this,e)}const FMe=lae.prototype;FMe.append=function(e,t){this._pairs.push([e,t])};FMe.toString=function(e){const t=e?function(i){return e.call(this,i,ave)}:ave;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function Oht(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function BMe(n,e,t){if(!e)return n;const i=t&&t.encode||Oht;tt.isFunction(t)&&(t={serialize:t});const r=t&&t.serialize;let s;if(r?s=r(e,t):s=tt.isURLSearchParams(e)?e.toString():new lae(e,t).toString(i),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class lve{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){tt.forEach(this.handlers,function(i){i!==null&&e(i)})}}const $Me={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mht=typeof URLSearchParams<"u"?URLSearchParams:lae,Fht=typeof FormData<"u"?FormData:null,Bht=typeof Blob<"u"?Blob:null,$ht={isBrowser:!0,classes:{URLSearchParams:Mht,FormData:Fht,Blob:Bht},protocols:["http","https","file","blob","url","data"]},cae=typeof window<"u"&&typeof document<"u",JY=typeof navigator=="object"&&navigator||void 0,Wht=cae&&(!JY||["ReactNative","NativeScript","NS"].indexOf(JY.product)<0),Hht=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Vht=cae&&window.location.href||"http://localhost",zht=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cae,hasStandardBrowserEnv:Wht,hasStandardBrowserWebWorkerEnv:Hht,navigator:JY,origin:Vht},Symbol.toStringTag,{value:"Module"})),mc={...zht,...$ht};function Uht(n,e){return E$(n,new mc.classes.URLSearchParams,Object.assign({visitor:function(t,i,r,s){return mc.isNode&&tt.isBuffer(t)?(this.append(i,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function jht(n){return tt.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function qht(n){const e={},t=Object.keys(n);let i;const r=t.length;let s;for(i=0;i=t.length;return o=!o&&tt.isArray(r)?r.length:o,l?(tt.hasOwnProp(r,o)?r[o]=[r[o],i]:r[o]=i,!a):((!r[o]||!tt.isObject(r[o]))&&(r[o]=[]),e(t,i,r[o],s)&&tt.isArray(r[o])&&(r[o]=qht(r[o])),!a)}if(tt.isFormData(n)&&tt.isFunction(n.entries)){const t={};return tt.forEachEntry(n,(i,r)=>{e(jht(i),r,t,0)}),t}return null}function Kht(n,e,t){if(tt.isString(n))try{return(e||JSON.parse)(n),tt.trim(n)}catch(i){if(i.name!=="SyntaxError")throw i}return(0,JSON.stringify)(n)}const HP={transitional:$Me,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,s=tt.isObject(e);if(s&&tt.isHTMLForm(e)&&(e=new FormData(e)),tt.isFormData(e))return r?JSON.stringify(WMe(e)):e;if(tt.isArrayBuffer(e)||tt.isBuffer(e)||tt.isStream(e)||tt.isFile(e)||tt.isBlob(e)||tt.isReadableStream(e))return e;if(tt.isArrayBufferView(e))return e.buffer;if(tt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Uht(e,this.formSerializer).toString();if((a=tt.isFileList(e))||i.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return E$(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),Kht(e)):e}],transformResponse:[function(e){const t=this.transitional||HP.transitional,i=t&&t.forcedJSONParsing,r=this.responseType==="json";if(tt.isResponse(e)||tt.isReadableStream(e))return e;if(e&&tt.isString(e)&&(i&&!this.responseType||r)){const o=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Fi.from(a,Fi.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:mc.classes.FormData,Blob:mc.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};tt.forEach(["delete","get","head","post","put","patch"],n=>{HP.headers[n]={}});const Ght=tt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Yht=n=>{const e={};let t,i,r;return n&&n.split(` +`).forEach(function(o){r=o.indexOf(":"),t=o.substring(0,r).trim().toLowerCase(),i=o.substring(r+1).trim(),!(!t||e[t]&&Ght[t])&&(t==="set-cookie"?e[t]?e[t].push(i):e[t]=[i]:e[t]=e[t]?e[t]+", "+i:i)}),e},cve=Symbol("internals");function vT(n){return n&&String(n).trim().toLowerCase()}function N5(n){return n===!1||n==null?n:tt.isArray(n)?n.map(N5):String(n)}function Zht(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=t.exec(n);)e[i[1]]=i[2];return e}const Xht=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function rj(n,e,t,i,r){if(tt.isFunction(i))return i.call(this,e,t);if(r&&(e=t),!!tt.isString(e)){if(tt.isString(i))return e.indexOf(i)!==-1;if(tt.isRegExp(i))return i.test(e)}}function Qht(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,i)=>t.toUpperCase()+i)}function Jht(n,e){const t=tt.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(n,i+t,{value:function(r,s,o){return this[i].call(this,e,r,s,o)},configurable:!0})})}class Xu{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function s(a,l,c){const u=vT(l);if(!u)throw new Error("header name must be a non-empty string");const d=tt.findKey(r,u);(!d||r[d]===void 0||c===!0||c===void 0&&r[d]!==!1)&&(r[d||l]=N5(a))}const o=(a,l)=>tt.forEach(a,(c,u)=>s(c,u,l));if(tt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(tt.isString(e)&&(e=e.trim())&&!Xht(e))o(Yht(e),t);else if(tt.isHeaders(e))for(const[a,l]of e.entries())s(l,a,i);else e!=null&&s(t,e,i);return this}get(e,t){if(e=vT(e),e){const i=tt.findKey(this,e);if(i){const r=this[i];if(!t)return r;if(t===!0)return Zht(r);if(tt.isFunction(t))return t.call(this,r,i);if(tt.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=vT(e),e){const i=tt.findKey(this,e);return!!(i&&this[i]!==void 0&&(!t||rj(this,this[i],i,t)))}return!1}delete(e,t){const i=this;let r=!1;function s(o){if(o=vT(o),o){const a=tt.findKey(i,o);a&&(!t||rj(i,i[a],a,t))&&(delete i[a],r=!0)}}return tt.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const s=t[i];(!e||rj(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){const t=this,i={};return tt.forEach(this,(r,s)=>{const o=tt.findKey(i,s);if(o){t[o]=N5(r),delete t[s];return}const a=e?Qht(s):String(s).trim();a!==s&&delete t[s],t[a]=N5(r),i[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return tt.forEach(this,(i,r)=>{i!=null&&i!==!1&&(t[r]=e&&tt.isArray(i)?i.join(", "):i)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[cve]=this[cve]={accessors:{}}).accessors,r=this.prototype;function s(o){const a=vT(o);i[a]||(Jht(r,o),i[a]=!0)}return tt.isArray(e)?e.forEach(s):s(e),this}}Xu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);tt.reduceDescriptors(Xu.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(i){this[t]=i}}});tt.freezeMethods(Xu);function sj(n,e){const t=this||HP,i=e||t,r=Xu.from(i.headers);let s=i.data;return tt.forEach(n,function(a){s=a.call(t,s,r.normalize(),e?e.status:void 0)}),r.normalize(),s}function HMe(n){return!!(n&&n.__CANCEL__)}function zL(n,e,t){Fi.call(this,n??"canceled",Fi.ERR_CANCELED,e,t),this.name="CanceledError"}tt.inherits(zL,Fi,{__CANCEL__:!0});function VMe(n,e,t){const i=t.config.validateStatus;!t.status||!i||i(t.status)?n(t):e(new Fi("Request failed with status code "+t.status,[Fi.ERR_BAD_REQUEST,Fi.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function eft(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function tft(n,e){n=n||10;const t=new Array(n),i=new Array(n);let r=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=i[s];o||(o=c),t[r]=l,i[r]=c;let d=s,h=0;for(;d!==r;)h+=t[d++],d=d%n;if(r=(r+1)%n,r===s&&(s=(s+1)%n),c-o{t=u,r=null,s&&(clearTimeout(s),s=null),n.apply(null,c)};return[(...c)=>{const u=Date.now(),d=u-t;d>=i?o(c,u):(r=c,s||(s=setTimeout(()=>{s=null,o(r)},i-d)))},()=>r&&o(r)]}const S6=(n,e,t=3)=>{let i=0;const r=tft(50,250);return nft(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-i,c=r(l),u=o<=a;i=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(d)},t)},uve=(n,e)=>{const t=n!=null;return[i=>e[0]({lengthComputable:t,total:n,loaded:i}),e[1]]},dve=n=>(...e)=>tt.asap(()=>n(...e)),ift=mc.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,mc.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(mc.origin),mc.navigator&&/(msie|trident)/i.test(mc.navigator.userAgent)):()=>!0,rft=mc.hasStandardBrowserEnv?{write(n,e,t,i,r,s){const o=[n+"="+encodeURIComponent(e)];tt.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),tt.isString(i)&&o.push("path="+i),tt.isString(r)&&o.push("domain="+r),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function sft(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function oft(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function zMe(n,e){return n&&!sft(e)?oft(n,e):e}const hve=n=>n instanceof Xu?{...n}:n;function kw(n,e){e=e||{};const t={};function i(c,u,d,h){return tt.isPlainObject(c)&&tt.isPlainObject(u)?tt.merge.call({caseless:h},c,u):tt.isPlainObject(u)?tt.merge({},u):tt.isArray(u)?u.slice():u}function r(c,u,d,h){if(tt.isUndefined(u)){if(!tt.isUndefined(c))return i(void 0,c,d,h)}else return i(c,u,d,h)}function s(c,u){if(!tt.isUndefined(u))return i(void 0,u)}function o(c,u){if(tt.isUndefined(u)){if(!tt.isUndefined(c))return i(void 0,c)}else return i(void 0,u)}function a(c,u,d){if(d in e)return i(c,u);if(d in n)return i(void 0,c)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u,d)=>r(hve(c),hve(u),d,!0)};return tt.forEach(Object.keys(Object.assign({},n,e)),function(u){const d=l[u]||r,h=d(n[u],e[u],u);tt.isUndefined(h)&&d!==a||(t[u]=h)}),t}const UMe=n=>{const e=kw({},n);let{data:t,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=Xu.from(o),e.url=BMe(zMe(e.baseURL,e.url),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let l;if(tt.isFormData(t)){if(mc.hasStandardBrowserEnv||mc.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((l=o.getContentType())!==!1){const[c,...u]=l?l.split(";").map(d=>d.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...u].join("; "))}}if(mc.hasStandardBrowserEnv&&(i&&tt.isFunction(i)&&(i=i(e)),i||i!==!1&&ift(e.url))){const c=r&&s&&rft.read(s);c&&o.set(r,c)}return e},aft=typeof XMLHttpRequest<"u",lft=aft&&function(n){return new Promise(function(t,i){const r=UMe(n);let s=r.data;const o=Xu.from(r.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=r,u,d,h,f,g;function p(){f&&f(),g&&g(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let m=new XMLHttpRequest;m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout;function _(){if(!m)return;const y=Xu.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:y,config:n,request:m};VMe(function(L){t(L),p()},function(L){i(L),p()},x),m=null}"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(_)},m.onabort=function(){m&&(i(new Fi("Request aborted",Fi.ECONNABORTED,n,m)),m=null)},m.onerror=function(){i(new Fi("Network Error",Fi.ERR_NETWORK,n,m)),m=null},m.ontimeout=function(){let C=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const x=r.transitional||$Me;r.timeoutErrorMessage&&(C=r.timeoutErrorMessage),i(new Fi(C,x.clarifyTimeoutError?Fi.ETIMEDOUT:Fi.ECONNABORTED,n,m)),m=null},s===void 0&&o.setContentType(null),"setRequestHeader"in m&&tt.forEach(o.toJSON(),function(C,x){m.setRequestHeader(x,C)}),tt.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),a&&a!=="json"&&(m.responseType=r.responseType),c&&([h,g]=S6(c,!0),m.addEventListener("progress",h)),l&&m.upload&&([d,f]=S6(l),m.upload.addEventListener("progress",d),m.upload.addEventListener("loadend",f)),(r.cancelToken||r.signal)&&(u=y=>{m&&(i(!y||y.type?new zL(null,n,m):y),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const v=eft(r.url);if(v&&mc.protocols.indexOf(v)===-1){i(new Fi("Unsupported protocol "+v+":",Fi.ERR_BAD_REQUEST,n));return}m.send(s||null)})},cft=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let i=new AbortController,r;const s=function(c){if(!r){r=!0,a();const u=c instanceof Error?c:this.reason;i.abort(u instanceof Fi?u:new zL(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,s(new Fi(`timeout ${e} of ms exceeded`,Fi.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),n=null)};n.forEach(c=>c.addEventListener("abort",s));const{signal:l}=i;return l.unsubscribe=()=>tt.asap(a),l}},uft=function*(n,e){let t=n.byteLength;if(t{const r=dft(n,e);let s=0,o,a=l=>{o||(o=!0,i&&i(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await r.next();if(c){a(),l.close();return}let d=u.byteLength;if(t){let h=s+=d;t(h)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),r.return()}},{highWaterMark:2})},L$=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",jMe=L$&&typeof ReadableStream=="function",fft=L$&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),qMe=(n,...e)=>{try{return!!n(...e)}catch{return!1}},gft=jMe&&qMe(()=>{let n=!1;const e=new Request(mc.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),gve=64*1024,eZ=jMe&&qMe(()=>tt.isReadableStream(new Response("").body)),k6={stream:eZ&&(n=>n.body)};L$&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!k6[e]&&(k6[e]=tt.isFunction(n[e])?t=>t[e]():(t,i)=>{throw new Fi(`Response type '${e}' is not supported`,Fi.ERR_NOT_SUPPORT,i)})})})(new Response);const pft=async n=>{if(n==null)return 0;if(tt.isBlob(n))return n.size;if(tt.isSpecCompliantForm(n))return(await new Request(mc.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(tt.isArrayBufferView(n)||tt.isArrayBuffer(n))return n.byteLength;if(tt.isURLSearchParams(n)&&(n=n+""),tt.isString(n))return(await fft(n)).byteLength},mft=async(n,e)=>{const t=tt.toFiniteNumber(n.getContentLength());return t??pft(e)},_ft=L$&&(async n=>{let{url:e,method:t,data:i,signal:r,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:u,withCredentials:d="same-origin",fetchOptions:h}=UMe(n);c=c?(c+"").toLowerCase():"text";let f=cft([r,s&&s.toAbortSignal()],o),g;const p=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let m;try{if(l&&gft&&t!=="get"&&t!=="head"&&(m=await mft(u,i))!==0){let x=new Request(e,{method:"POST",body:i,duplex:"half"}),k;if(tt.isFormData(i)&&(k=x.headers.get("content-type"))&&u.setContentType(k),x.body){const[L,D]=uve(m,S6(dve(l)));i=fve(x.body,gve,L,D)}}tt.isString(d)||(d=d?"include":"omit");const _="credentials"in Request.prototype;g=new Request(e,{...h,signal:f,method:t.toUpperCase(),headers:u.normalize().toJSON(),body:i,duplex:"half",credentials:_?d:void 0});let v=await fetch(g);const y=eZ&&(c==="stream"||c==="response");if(eZ&&(a||y&&p)){const x={};["status","statusText","headers"].forEach(I=>{x[I]=v[I]});const k=tt.toFiniteNumber(v.headers.get("content-length")),[L,D]=a&&uve(k,S6(dve(a),!0))||[];v=new Response(fve(v.body,gve,L,()=>{D&&D(),p&&p()}),x)}c=c||"text";let C=await k6[tt.findKey(k6,c)||"text"](v,n);return!y&&p&&p(),await new Promise((x,k)=>{VMe(x,k,{data:C,headers:Xu.from(v.headers),status:v.status,statusText:v.statusText,config:n,request:g})})}catch(_){throw p&&p(),_&&_.name==="TypeError"&&/fetch/i.test(_.message)?Object.assign(new Fi("Network Error",Fi.ERR_NETWORK,n,g),{cause:_.cause||_}):Fi.from(_,_&&_.code,n,g)}}),tZ={http:Nht,xhr:lft,fetch:_ft};tt.forEach(tZ,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const pve=n=>`- ${n}`,vft=n=>tt.isFunction(n)||n===null||n===!1,KMe={getAdapter:n=>{n=tt.isArray(n)?n:[n];const{length:e}=n;let t,i;const r={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : `+s.map(pve).join(` -`):" "+pve(s[0]):"as no adapter specified";throw new Fi("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i},adapters:tZ};function oj(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new zL(null,n)}function mve(n){return oj(n),n.headers=Xu.from(n.headers),n.data=sj.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),KMe.getAdapter(n.adapter||HP.adapter)(n).then(function(i){return oj(n),i.data=sj.call(n,n.transformResponse,i),i.headers=Xu.from(i.headers),i},function(i){return HMe(i)||(oj(n),i&&i.response&&(i.response.data=sj.call(n,n.transformResponse,i.response),i.response.headers=Xu.from(i.response.headers))),Promise.reject(i)})}const GMe="1.7.9",T$={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{T$[n]=function(i){return typeof i===n||"a"+(e<1?"n ":" ")+n}});const _ve={};T$.transitional=function(e,t,i){function r(s,o){return"[Axios v"+GMe+"] Transitional option '"+s+"'"+o+(i?". "+i:"")}return(s,o,a)=>{if(e===!1)throw new Fi(r(o," has been removed"+(t?" in "+t:"")),Fi.ERR_DEPRECATED);return t&&!_ve[o]&&(_ve[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};T$.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function bft(n,e,t){if(typeof n!="object")throw new Fi("options must be an object",Fi.ERR_BAD_OPTION_VALUE);const i=Object.keys(n);let r=i.length;for(;r-- >0;){const s=i[r],o=e[s];if(o){const a=n[s],l=a===void 0||o(a,s,n);if(l!==!0)throw new Fi("option "+s+" must be "+l,Fi.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Fi("Unknown option "+s,Fi.ERR_BAD_OPTION)}}const RF={assertOptions:bft,validators:T$},Gg=RF.validators;class qy{constructor(e){this.defaults=e,this.interceptors={request:new lve,response:new lve}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const s=r.stack?r.stack.replace(/^.+\n/,""):"";try{i.stack?s&&!String(i.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(i.stack+=` -`+s):i.stack=s}catch{}}throw i}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=kw(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:s}=t;i!==void 0&&RF.assertOptions(i,{silentJSONParsing:Gg.transitional(Gg.boolean),forcedJSONParsing:Gg.transitional(Gg.boolean),clarifyTimeoutError:Gg.transitional(Gg.boolean)},!1),r!=null&&(tt.isFunction(r)?t.paramsSerializer={serialize:r}:RF.assertOptions(r,{encode:Gg.function,serialize:Gg.function},!0)),RF.assertOptions(t,{baseUrl:Gg.spelling("baseURL"),withXsrfToken:Gg.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&tt.merge(s.common,s[t.method]);s&&tt.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),t.headers=Xu.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(t)===!1||(l=l&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const c=[];this.interceptors.response.forEach(function(p){c.push(p.fulfilled,p.rejected)});let u,d=0,h;if(!l){const g=[mve.bind(this),void 0];for(g.unshift.apply(g,a),g.push.apply(g,c),h=g.length,u=Promise.resolve(t);d{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](r);i._listeners=null}),this.promise.then=r=>{let s;const o=new Promise(a=>{i.subscribe(a),s=a}).then(r);return o.cancel=function(){i.unsubscribe(s)},o},e(function(s,o,a){i.reason||(i.reason=new zL(s,o,a),t(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=i=>{e.abort(i)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new uae(function(r){e=r}),cancel:e}}}function yft(n){return function(t){return n.apply(null,t)}}function wft(n){return tt.isObject(n)&&n.isAxiosError===!0}const nZ={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(nZ).forEach(([n,e])=>{nZ[e]=n});function YMe(n){const e=new qy(n),t=EMe(qy.prototype.request,e);return tt.extend(t,qy.prototype,e,{allOwnKeys:!0}),tt.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return YMe(kw(n,r))},t}const Ga=YMe(HP);Ga.Axios=qy;Ga.CanceledError=zL;Ga.CancelToken=uae;Ga.isCancel=HMe;Ga.VERSION=GMe;Ga.toFormData=E$;Ga.AxiosError=Fi;Ga.Cancel=Ga.CanceledError;Ga.all=function(e){return Promise.all(e)};Ga.spread=yft;Ga.isAxiosError=wft;Ga.mergeConfig=kw;Ga.AxiosHeaders=Xu;Ga.formToJSON=n=>WMe(tt.isHTMLForm(n)?new FormData(n):n);Ga.getAdapter=KMe.getAdapter;Ga.HttpStatusCode=nZ;Ga.default=Ga;var Cft=n=>{switch(n){case"success":return kft;case"info":return Lft;case"warning":return Eft;case"error":return Tft;default:return null}},xft=Array(12).fill(0),Sft=({visible:n,className:e})=>U.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":n},U.createElement("div",{className:"sonner-spinner"},xft.map((t,i)=>U.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),kft=U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},U.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Eft=U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},U.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Lft=U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},U.createElement("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 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Tft=U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},U.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Dft=U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},U.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),U.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ift=()=>{let[n,e]=U.useState(document.hidden);return U.useEffect(()=>{let t=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",t),()=>window.removeEventListener("visibilitychange",t)},[]),n},iZ=1,Aft=class{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{let e=this.subscribers.indexOf(n);this.subscribers.splice(e,1)}),this.publish=n=>{this.subscribers.forEach(e=>e(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var e;let{message:t,...i}=n,r=typeof n?.id=="number"||((e=n.id)==null?void 0:e.length)>0?n.id:iZ++,s=this.toasts.find(a=>a.id===r),o=n.dismissible===void 0?!0:n.dismissible;return s?this.toasts=this.toasts.map(a=>a.id===r?(this.publish({...a,...n,id:r,title:t}),{...a,...n,id:r,dismissible:o,title:t}):a):this.addToast({title:t,...i,dismissible:o,id:r}),r},this.dismiss=n=>(n||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:n,dismiss:!0})),n),this.message=(n,e)=>this.create({...e,message:n}),this.error=(n,e)=>this.create({...e,message:n,type:"error"}),this.success=(n,e)=>this.create({...e,type:"success",message:n}),this.info=(n,e)=>this.create({...e,type:"info",message:n}),this.warning=(n,e)=>this.create({...e,type:"warning",message:n}),this.loading=(n,e)=>this.create({...e,type:"loading",message:n}),this.promise=(n,e)=>{if(!e)return;let t;e.loading!==void 0&&(t=this.create({...e,promise:n,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let i=n instanceof Promise?n:n(),r=t!==void 0,s,o=i.then(async l=>{if(s=["resolve",l],U.isValidElement(l))r=!1,this.create({id:t,type:"default",message:l});else if(Rft(l)&&!l.ok){r=!1;let c=typeof e.error=="function"?await e.error(`HTTP error! status: ${l.status}`):e.error,u=typeof e.description=="function"?await e.description(`HTTP error! status: ${l.status}`):e.description;this.create({id:t,type:"error",message:c,description:u})}else if(e.success!==void 0){r=!1;let c=typeof e.success=="function"?await e.success(l):e.success,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:t,type:"success",message:c,description:u})}}).catch(async l=>{if(s=["reject",l],e.error!==void 0){r=!1;let c=typeof e.error=="function"?await e.error(l):e.error,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:t,type:"error",message:c,description:u})}}).finally(()=>{var l;r&&(this.dismiss(t),t=void 0),(l=e.finally)==null||l.call(e)}),a=()=>new Promise((l,c)=>o.then(()=>s[0]==="reject"?c(s[1]):l(s[1])).catch(c));return typeof t!="string"&&typeof t!="number"?{unwrap:a}:Object.assign(t,{unwrap:a})},this.custom=(n,e)=>{let t=e?.id||iZ++;return this.create({jsx:n(t),id:t,...e}),t},this.subscribers=[],this.toasts=[]}},xd=new Aft,Nft=(n,e)=>{let t=e?.id||iZ++;return xd.addToast({title:n,...e,id:t}),t},Rft=n=>n&&typeof n=="object"&&"ok"in n&&typeof n.ok=="boolean"&&"status"in n&&typeof n.status=="number",Pft=Nft,Oft=()=>xd.toasts,V5n=Object.assign(Pft,{success:xd.success,info:xd.info,warning:xd.warning,error:xd.error,custom:xd.custom,message:xd.message,promise:xd.promise,dismiss:xd.dismiss,loading:xd.loading},{getHistory:Oft});function Mft(n,{insertAt:e}={}){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",e==="top"&&t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(document.createTextNode(n))}Mft(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function g4(n){return n.label!==void 0}var Fft=3,Bft="32px",vve=4e3,$ft=356,Wft=14,Hft=20,Vft=200;function zft(...n){return n.filter(Boolean).join(" ")}var Uft=n=>{var e,t,i,r,s,o,a,l,c,u,d;let{invert:h,toast:f,unstyled:g,interacting:p,setHeights:m,visibleToasts:_,heights:v,index:y,toasts:C,expanded:x,removeToast:k,defaultRichColors:L,closeButton:D,style:I,cancelButtonStyle:O,actionButtonStyle:M,className:B="",descriptionClassName:G="",duration:W,position:z,gap:q,loadingIcon:ee,expandByDefault:Z,classNames:j,icons:te,closeButtonAriaLabel:le="Close toast",pauseWhenPageIsHidden:ue,cn:de}=n,[we,xe]=U.useState(!1),[Me,Re]=U.useState(!1),[_t,Qe]=U.useState(!1),[pt,gt]=U.useState(!1),[Ue,wn]=U.useState(!1),[Xt,jn]=U.useState(0),[ji,ci]=U.useState(0),ye=U.useRef(f.duration||W||vve),Ie=U.useRef(null),Ve=U.useRef(null),wt=y===0,vt=y+1<=_,nt=f.type,$t=f.dismissible!==!1,an=f.className||"",Pi=f.descriptionClassName||"",Xn=U.useMemo(()=>v.findIndex(bn=>bn.toastId===f.id)||0,[v,f.id]),Qi=U.useMemo(()=>{var bn;return(bn=f.closeButton)!=null?bn:D},[f.closeButton,D]);U.useMemo(()=>f.duration||W||vve,[f.duration,W]);let qs=U.useRef(0),Pr=U.useRef(0),Or=U.useRef(0),cr=U.useRef(null),[us,qi]=z.split("-"),Er=U.useMemo(()=>v.reduce((bn,dn,bi)=>bi>=Xn?bn:bn+dn.height,0),[v,Xn]),oo=Ift(),As=f.invert||h,Ft=nt==="loading";Pr.current=U.useMemo(()=>Xn*q+Er,[Xn,Er]),U.useEffect(()=>{xe(!0)},[]),U.useEffect(()=>{let bn=Ve.current;if(bn){let dn=bn.getBoundingClientRect().height;return ci(dn),m(bi=>[{toastId:f.id,height:dn,position:f.position},...bi]),()=>m(bi=>bi.filter(mi=>mi.toastId!==f.id))}},[m,f.id]),U.useLayoutEffect(()=>{if(!we)return;let bn=Ve.current,dn=bn.style.height;bn.style.height="auto";let bi=bn.getBoundingClientRect().height;bn.style.height=dn,ci(bi),m(mi=>mi.find(Yi=>Yi.toastId===f.id)?mi.map(Yi=>Yi.toastId===f.id?{...Yi,height:bi}:Yi):[{toastId:f.id,height:bi,position:f.position},...mi])},[we,f.title,f.description,m,f.id]);let qn=U.useCallback(()=>{Re(!0),jn(Pr.current),m(bn=>bn.filter(dn=>dn.toastId!==f.id)),setTimeout(()=>{k(f)},Vft)},[f,k,m,Pr]);U.useEffect(()=>{if(f.promise&&nt==="loading"||f.duration===1/0||f.type==="loading")return;let bn;return x||p||ue&&oo?(()=>{if(Or.current{var dn;(dn=f.onAutoClose)==null||dn.call(f,f),qn()},ye.current)),()=>clearTimeout(bn)},[x,p,f,nt,ue,oo,qn]),U.useEffect(()=>{f.delete&&qn()},[qn,f.delete]);function pi(){var bn,dn,bi;return te!=null&&te.loading?U.createElement("div",{className:de(j?.loader,(bn=f?.classNames)==null?void 0:bn.loader,"sonner-loader"),"data-visible":nt==="loading"},te.loading):ee?U.createElement("div",{className:de(j?.loader,(dn=f?.classNames)==null?void 0:dn.loader,"sonner-loader"),"data-visible":nt==="loading"},ee):U.createElement(Sft,{className:de(j?.loader,(bi=f?.classNames)==null?void 0:bi.loader),visible:nt==="loading"})}return U.createElement("li",{tabIndex:0,ref:Ve,className:de(B,an,j?.toast,(e=f?.classNames)==null?void 0:e.toast,j?.default,j?.[nt],(t=f?.classNames)==null?void 0:t[nt]),"data-sonner-toast":"","data-rich-colors":(i=f.richColors)!=null?i:L,"data-styled":!(f.jsx||f.unstyled||g),"data-mounted":we,"data-promise":!!f.promise,"data-swiped":Ue,"data-removed":Me,"data-visible":vt,"data-y-position":us,"data-x-position":qi,"data-index":y,"data-front":wt,"data-swiping":_t,"data-dismissible":$t,"data-type":nt,"data-invert":As,"data-swipe-out":pt,"data-expanded":!!(x||Z&&we),style:{"--index":y,"--toasts-before":y,"--z-index":C.length-y,"--offset":`${Me?Xt:Pr.current}px`,"--initial-height":Z?"auto":`${ji}px`,...I,...f.style},onPointerDown:bn=>{Ft||!$t||(Ie.current=new Date,jn(Pr.current),bn.target.setPointerCapture(bn.pointerId),bn.target.tagName!=="BUTTON"&&(Qe(!0),cr.current={x:bn.clientX,y:bn.clientY}))},onPointerUp:()=>{var bn,dn,bi,mi;if(pt||!$t)return;cr.current=null;let Yi=Number(((bn=Ve.current)==null?void 0:bn.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Wn=new Date().getTime()-((dn=Ie.current)==null?void 0:dn.getTime()),pn=Math.abs(Yi)/Wn;if(Math.abs(Yi)>=Hft||pn>.11){jn(Pr.current),(bi=f.onDismiss)==null||bi.call(f,f),qn(),gt(!0),wn(!1);return}(mi=Ve.current)==null||mi.style.setProperty("--swipe-amount","0px"),Qe(!1)},onPointerMove:bn=>{var dn,bi;if(!cr.current||!$t)return;let mi=bn.clientY-cr.current.y,Yi=((dn=window.getSelection())==null?void 0:dn.toString().length)>0,Wn=us==="top"?Math.min(0,mi):Math.max(0,mi);Math.abs(Wn)>0&&wn(!0),!Yi&&((bi=Ve.current)==null||bi.style.setProperty("--swipe-amount",`${Wn}px`))}},Qi&&!f.jsx?U.createElement("button",{"aria-label":le,"data-disabled":Ft,"data-close-button":!0,onClick:Ft||!$t?()=>{}:()=>{var bn;qn(),(bn=f.onDismiss)==null||bn.call(f,f)},className:de(j?.closeButton,(r=f?.classNames)==null?void 0:r.closeButton)},(s=te?.close)!=null?s:Dft):null,f.jsx||U.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:U.createElement(U.Fragment,null,nt||f.icon||f.promise?U.createElement("div",{"data-icon":"",className:de(j?.icon,(o=f?.classNames)==null?void 0:o.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||pi():null,f.type!=="loading"?f.icon||te?.[nt]||Cft(nt):null):null,U.createElement("div",{"data-content":"",className:de(j?.content,(a=f?.classNames)==null?void 0:a.content)},U.createElement("div",{"data-title":"",className:de(j?.title,(l=f?.classNames)==null?void 0:l.title)},typeof f.title=="function"?f.title():f.title),f.description?U.createElement("div",{"data-description":"",className:de(G,Pi,j?.description,(c=f?.classNames)==null?void 0:c.description)},typeof f.description=="function"?f.description():f.description):null),U.isValidElement(f.cancel)?f.cancel:f.cancel&&g4(f.cancel)?U.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||O,onClick:bn=>{var dn,bi;g4(f.cancel)&&$t&&((bi=(dn=f.cancel).onClick)==null||bi.call(dn,bn),qn())},className:de(j?.cancelButton,(u=f?.classNames)==null?void 0:u.cancelButton)},f.cancel.label):null,U.isValidElement(f.action)?f.action:f.action&&g4(f.action)?U.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||M,onClick:bn=>{var dn,bi;g4(f.action)&&((bi=(dn=f.action).onClick)==null||bi.call(dn,bn),!bn.defaultPrevented&&qn())},className:de(j?.actionButton,(d=f?.classNames)==null?void 0:d.actionButton)},f.action.label):null))};function bve(){if(typeof window>"u"||typeof document>"u")return"ltr";let n=document.documentElement.getAttribute("dir");return n==="auto"||!n?window.getComputedStyle(document.documentElement).direction:n}var z5n=E.forwardRef(function(n,e){let{invert:t,position:i="bottom-right",hotkey:r=["altKey","KeyT"],expand:s,closeButton:o,className:a,offset:l,theme:c="light",richColors:u,duration:d,style:h,visibleToasts:f=Fft,toastOptions:g,dir:p=bve(),gap:m=Wft,loadingIcon:_,icons:v,containerAriaLabel:y="Notifications",pauseWhenPageIsHidden:C,cn:x=zft}=n,[k,L]=U.useState([]),D=U.useMemo(()=>Array.from(new Set([i].concat(k.filter(ue=>ue.position).map(ue=>ue.position)))),[k,i]),[I,O]=U.useState([]),[M,B]=U.useState(!1),[G,W]=U.useState(!1),[z,q]=U.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),ee=U.useRef(null),Z=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),j=U.useRef(null),te=U.useRef(!1),le=U.useCallback(ue=>{L(de=>{var we;return(we=de.find(xe=>xe.id===ue.id))!=null&&we.delete||xd.dismiss(ue.id),de.filter(({id:xe})=>xe!==ue.id)})},[]);return U.useEffect(()=>xd.subscribe(ue=>{if(ue.dismiss){L(de=>de.map(we=>we.id===ue.id?{...we,delete:!0}:we));return}setTimeout(()=>{p$.flushSync(()=>{L(de=>{let we=de.findIndex(xe=>xe.id===ue.id);return we!==-1?[...de.slice(0,we),{...de[we],...ue},...de.slice(we+1)]:[ue,...de]})})})}),[]),U.useEffect(()=>{if(c!=="system"){q(c);return}if(c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;let ue=window.matchMedia("(prefers-color-scheme: dark)");try{ue.addEventListener("change",({matches:de})=>{q(de?"dark":"light")})}catch{ue.addListener(({matches:we})=>{try{q(we?"dark":"light")}catch(xe){console.error(xe)}})}},[c]),U.useEffect(()=>{k.length<=1&&B(!1)},[k]),U.useEffect(()=>{let ue=de=>{var we,xe;r.every(Me=>de[Me]||de.code===Me)&&(B(!0),(we=ee.current)==null||we.focus()),de.code==="Escape"&&(document.activeElement===ee.current||(xe=ee.current)!=null&&xe.contains(document.activeElement))&&B(!1)};return document.addEventListener("keydown",ue),()=>document.removeEventListener("keydown",ue)},[r]),U.useEffect(()=>{if(ee.current)return()=>{j.current&&(j.current.focus({preventScroll:!0}),j.current=null,te.current=!1)}},[ee.current]),U.createElement("section",{"aria-label":`${y} ${Z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false"},D.map((ue,de)=>{var we;let[xe,Me]=ue.split("-");return k.length?U.createElement("ol",{key:ue,dir:p==="auto"?bve():p,tabIndex:-1,ref:ee,className:a,"data-sonner-toaster":!0,"data-theme":z,"data-y-position":xe,"data-lifted":M&&k.length>1&&!s,"data-x-position":Me,style:{"--front-toast-height":`${((we=I[0])==null?void 0:we.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||Bft,"--width":`${$ft}px`,"--gap":`${m}px`,...h},onBlur:Re=>{te.current&&!Re.currentTarget.contains(Re.relatedTarget)&&(te.current=!1,j.current&&(j.current.focus({preventScroll:!0}),j.current=null))},onFocus:Re=>{Re.target instanceof HTMLElement&&Re.target.dataset.dismissible==="false"||te.current||(te.current=!0,j.current=Re.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{G||B(!1)},onPointerDown:Re=>{Re.target instanceof HTMLElement&&Re.target.dataset.dismissible==="false"||W(!0)},onPointerUp:()=>W(!1)},k.filter(Re=>!Re.position&&de===0||Re.position===ue).map((Re,_t)=>{var Qe,pt;return U.createElement(Uft,{key:Re.id,icons:v,index:_t,toast:Re,defaultRichColors:u,duration:(Qe=g?.duration)!=null?Qe:d,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:t,visibleToasts:f,closeButton:(pt=g?.closeButton)!=null?pt:o,interacting:G,position:ue,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,removeToast:le,toasts:k.filter(gt=>gt.position==Re.position),heights:I.filter(gt=>gt.position==Re.position),setHeights:O,expandByDefault:s,gap:m,loadingIcon:_,expanded:M,pauseWhenPageIsHidden:C,cn:x})})):null}))}),E6={exports:{}};/** +`):" "+pve(s[0]):"as no adapter specified";throw new Fi("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i},adapters:tZ};function oj(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new zL(null,n)}function mve(n){return oj(n),n.headers=Xu.from(n.headers),n.data=sj.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),KMe.getAdapter(n.adapter||HP.adapter)(n).then(function(i){return oj(n),i.data=sj.call(n,n.transformResponse,i),i.headers=Xu.from(i.headers),i},function(i){return HMe(i)||(oj(n),i&&i.response&&(i.response.data=sj.call(n,n.transformResponse,i.response),i.response.headers=Xu.from(i.response.headers))),Promise.reject(i)})}const GMe="1.7.9",T$={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{T$[n]=function(i){return typeof i===n||"a"+(e<1?"n ":" ")+n}});const _ve={};T$.transitional=function(e,t,i){function r(s,o){return"[Axios v"+GMe+"] Transitional option '"+s+"'"+o+(i?". "+i:"")}return(s,o,a)=>{if(e===!1)throw new Fi(r(o," has been removed"+(t?" in "+t:"")),Fi.ERR_DEPRECATED);return t&&!_ve[o]&&(_ve[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};T$.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function bft(n,e,t){if(typeof n!="object")throw new Fi("options must be an object",Fi.ERR_BAD_OPTION_VALUE);const i=Object.keys(n);let r=i.length;for(;r-- >0;){const s=i[r],o=e[s];if(o){const a=n[s],l=a===void 0||o(a,s,n);if(l!==!0)throw new Fi("option "+s+" must be "+l,Fi.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Fi("Unknown option "+s,Fi.ERR_BAD_OPTION)}}const R5={assertOptions:bft,validators:T$},Gg=R5.validators;class qy{constructor(e){this.defaults=e,this.interceptors={request:new lve,response:new lve}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const s=r.stack?r.stack.replace(/^.+\n/,""):"";try{i.stack?s&&!String(i.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(i.stack+=` +`+s):i.stack=s}catch{}}throw i}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=kw(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:s}=t;i!==void 0&&R5.assertOptions(i,{silentJSONParsing:Gg.transitional(Gg.boolean),forcedJSONParsing:Gg.transitional(Gg.boolean),clarifyTimeoutError:Gg.transitional(Gg.boolean)},!1),r!=null&&(tt.isFunction(r)?t.paramsSerializer={serialize:r}:R5.assertOptions(r,{encode:Gg.function,serialize:Gg.function},!0)),R5.assertOptions(t,{baseUrl:Gg.spelling("baseURL"),withXsrfToken:Gg.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&tt.merge(s.common,s[t.method]);s&&tt.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),t.headers=Xu.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(t)===!1||(l=l&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});const c=[];this.interceptors.response.forEach(function(p){c.push(p.fulfilled,p.rejected)});let u,d=0,h;if(!l){const g=[mve.bind(this),void 0];for(g.unshift.apply(g,a),g.push.apply(g,c),h=g.length,u=Promise.resolve(t);d{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](r);i._listeners=null}),this.promise.then=r=>{let s;const o=new Promise(a=>{i.subscribe(a),s=a}).then(r);return o.cancel=function(){i.unsubscribe(s)},o},e(function(s,o,a){i.reason||(i.reason=new zL(s,o,a),t(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=i=>{e.abort(i)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new uae(function(r){e=r}),cancel:e}}}function yft(n){return function(t){return n.apply(null,t)}}function wft(n){return tt.isObject(n)&&n.isAxiosError===!0}const nZ={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(nZ).forEach(([n,e])=>{nZ[e]=n});function YMe(n){const e=new qy(n),t=EMe(qy.prototype.request,e);return tt.extend(t,qy.prototype,e,{allOwnKeys:!0}),tt.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return YMe(kw(n,r))},t}const Ga=YMe(HP);Ga.Axios=qy;Ga.CanceledError=zL;Ga.CancelToken=uae;Ga.isCancel=HMe;Ga.VERSION=GMe;Ga.toFormData=E$;Ga.AxiosError=Fi;Ga.Cancel=Ga.CanceledError;Ga.all=function(e){return Promise.all(e)};Ga.spread=yft;Ga.isAxiosError=wft;Ga.mergeConfig=kw;Ga.AxiosHeaders=Xu;Ga.formToJSON=n=>WMe(tt.isHTMLForm(n)?new FormData(n):n);Ga.getAdapter=KMe.getAdapter;Ga.HttpStatusCode=nZ;Ga.default=Ga;var Cft=n=>{switch(n){case"success":return kft;case"info":return Lft;case"warning":return Eft;case"error":return Tft;default:return null}},xft=Array(12).fill(0),Sft=({visible:n,className:e})=>U.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":n},U.createElement("div",{className:"sonner-spinner"},xft.map((t,i)=>U.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),kft=U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},U.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Eft=U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},U.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Lft=U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},U.createElement("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 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Tft=U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},U.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Dft=U.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},U.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),U.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ift=()=>{let[n,e]=U.useState(document.hidden);return U.useEffect(()=>{let t=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",t),()=>window.removeEventListener("visibilitychange",t)},[]),n},iZ=1,Aft=class{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{let e=this.subscribers.indexOf(n);this.subscribers.splice(e,1)}),this.publish=n=>{this.subscribers.forEach(e=>e(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var e;let{message:t,...i}=n,r=typeof n?.id=="number"||((e=n.id)==null?void 0:e.length)>0?n.id:iZ++,s=this.toasts.find(a=>a.id===r),o=n.dismissible===void 0?!0:n.dismissible;return s?this.toasts=this.toasts.map(a=>a.id===r?(this.publish({...a,...n,id:r,title:t}),{...a,...n,id:r,dismissible:o,title:t}):a):this.addToast({title:t,...i,dismissible:o,id:r}),r},this.dismiss=n=>(n||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:n,dismiss:!0})),n),this.message=(n,e)=>this.create({...e,message:n}),this.error=(n,e)=>this.create({...e,message:n,type:"error"}),this.success=(n,e)=>this.create({...e,type:"success",message:n}),this.info=(n,e)=>this.create({...e,type:"info",message:n}),this.warning=(n,e)=>this.create({...e,type:"warning",message:n}),this.loading=(n,e)=>this.create({...e,type:"loading",message:n}),this.promise=(n,e)=>{if(!e)return;let t;e.loading!==void 0&&(t=this.create({...e,promise:n,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let i=n instanceof Promise?n:n(),r=t!==void 0,s,o=i.then(async l=>{if(s=["resolve",l],U.isValidElement(l))r=!1,this.create({id:t,type:"default",message:l});else if(Rft(l)&&!l.ok){r=!1;let c=typeof e.error=="function"?await e.error(`HTTP error! status: ${l.status}`):e.error,u=typeof e.description=="function"?await e.description(`HTTP error! status: ${l.status}`):e.description;this.create({id:t,type:"error",message:c,description:u})}else if(e.success!==void 0){r=!1;let c=typeof e.success=="function"?await e.success(l):e.success,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:t,type:"success",message:c,description:u})}}).catch(async l=>{if(s=["reject",l],e.error!==void 0){r=!1;let c=typeof e.error=="function"?await e.error(l):e.error,u=typeof e.description=="function"?await e.description(l):e.description;this.create({id:t,type:"error",message:c,description:u})}}).finally(()=>{var l;r&&(this.dismiss(t),t=void 0),(l=e.finally)==null||l.call(e)}),a=()=>new Promise((l,c)=>o.then(()=>s[0]==="reject"?c(s[1]):l(s[1])).catch(c));return typeof t!="string"&&typeof t!="number"?{unwrap:a}:Object.assign(t,{unwrap:a})},this.custom=(n,e)=>{let t=e?.id||iZ++;return this.create({jsx:n(t),id:t,...e}),t},this.subscribers=[],this.toasts=[]}},xd=new Aft,Nft=(n,e)=>{let t=e?.id||iZ++;return xd.addToast({title:n,...e,id:t}),t},Rft=n=>n&&typeof n=="object"&&"ok"in n&&typeof n.ok=="boolean"&&"status"in n&&typeof n.status=="number",Pft=Nft,Oft=()=>xd.toasts,VFn=Object.assign(Pft,{success:xd.success,info:xd.info,warning:xd.warning,error:xd.error,custom:xd.custom,message:xd.message,promise:xd.promise,dismiss:xd.dismiss,loading:xd.loading},{getHistory:Oft});function Mft(n,{insertAt:e}={}){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",e==="top"&&t.firstChild?t.insertBefore(i,t.firstChild):t.appendChild(i),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(document.createTextNode(n))}Mft(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function g4(n){return n.label!==void 0}var Fft=3,Bft="32px",vve=4e3,$ft=356,Wft=14,Hft=20,Vft=200;function zft(...n){return n.filter(Boolean).join(" ")}var Uft=n=>{var e,t,i,r,s,o,a,l,c,u,d;let{invert:h,toast:f,unstyled:g,interacting:p,setHeights:m,visibleToasts:_,heights:v,index:y,toasts:C,expanded:x,removeToast:k,defaultRichColors:L,closeButton:D,style:I,cancelButtonStyle:O,actionButtonStyle:M,className:B="",descriptionClassName:G="",duration:W,position:z,gap:q,loadingIcon:ee,expandByDefault:Z,classNames:j,icons:te,closeButtonAriaLabel:le="Close toast",pauseWhenPageIsHidden:ue,cn:de}=n,[we,xe]=U.useState(!1),[Me,Re]=U.useState(!1),[_t,Qe]=U.useState(!1),[pt,gt]=U.useState(!1),[Ue,wn]=U.useState(!1),[Xt,jn]=U.useState(0),[ji,ci]=U.useState(0),ye=U.useRef(f.duration||W||vve),Ie=U.useRef(null),Ve=U.useRef(null),wt=y===0,vt=y+1<=_,nt=f.type,$t=f.dismissible!==!1,an=f.className||"",Pi=f.descriptionClassName||"",Xn=U.useMemo(()=>v.findIndex(bn=>bn.toastId===f.id)||0,[v,f.id]),Qi=U.useMemo(()=>{var bn;return(bn=f.closeButton)!=null?bn:D},[f.closeButton,D]);U.useMemo(()=>f.duration||W||vve,[f.duration,W]);let qs=U.useRef(0),Pr=U.useRef(0),Or=U.useRef(0),cr=U.useRef(null),[us,qi]=z.split("-"),Er=U.useMemo(()=>v.reduce((bn,dn,bi)=>bi>=Xn?bn:bn+dn.height,0),[v,Xn]),oo=Ift(),As=f.invert||h,Ft=nt==="loading";Pr.current=U.useMemo(()=>Xn*q+Er,[Xn,Er]),U.useEffect(()=>{xe(!0)},[]),U.useEffect(()=>{let bn=Ve.current;if(bn){let dn=bn.getBoundingClientRect().height;return ci(dn),m(bi=>[{toastId:f.id,height:dn,position:f.position},...bi]),()=>m(bi=>bi.filter(mi=>mi.toastId!==f.id))}},[m,f.id]),U.useLayoutEffect(()=>{if(!we)return;let bn=Ve.current,dn=bn.style.height;bn.style.height="auto";let bi=bn.getBoundingClientRect().height;bn.style.height=dn,ci(bi),m(mi=>mi.find(Yi=>Yi.toastId===f.id)?mi.map(Yi=>Yi.toastId===f.id?{...Yi,height:bi}:Yi):[{toastId:f.id,height:bi,position:f.position},...mi])},[we,f.title,f.description,m,f.id]);let qn=U.useCallback(()=>{Re(!0),jn(Pr.current),m(bn=>bn.filter(dn=>dn.toastId!==f.id)),setTimeout(()=>{k(f)},Vft)},[f,k,m,Pr]);U.useEffect(()=>{if(f.promise&&nt==="loading"||f.duration===1/0||f.type==="loading")return;let bn;return x||p||ue&&oo?(()=>{if(Or.current{var dn;(dn=f.onAutoClose)==null||dn.call(f,f),qn()},ye.current)),()=>clearTimeout(bn)},[x,p,f,nt,ue,oo,qn]),U.useEffect(()=>{f.delete&&qn()},[qn,f.delete]);function pi(){var bn,dn,bi;return te!=null&&te.loading?U.createElement("div",{className:de(j?.loader,(bn=f?.classNames)==null?void 0:bn.loader,"sonner-loader"),"data-visible":nt==="loading"},te.loading):ee?U.createElement("div",{className:de(j?.loader,(dn=f?.classNames)==null?void 0:dn.loader,"sonner-loader"),"data-visible":nt==="loading"},ee):U.createElement(Sft,{className:de(j?.loader,(bi=f?.classNames)==null?void 0:bi.loader),visible:nt==="loading"})}return U.createElement("li",{tabIndex:0,ref:Ve,className:de(B,an,j?.toast,(e=f?.classNames)==null?void 0:e.toast,j?.default,j?.[nt],(t=f?.classNames)==null?void 0:t[nt]),"data-sonner-toast":"","data-rich-colors":(i=f.richColors)!=null?i:L,"data-styled":!(f.jsx||f.unstyled||g),"data-mounted":we,"data-promise":!!f.promise,"data-swiped":Ue,"data-removed":Me,"data-visible":vt,"data-y-position":us,"data-x-position":qi,"data-index":y,"data-front":wt,"data-swiping":_t,"data-dismissible":$t,"data-type":nt,"data-invert":As,"data-swipe-out":pt,"data-expanded":!!(x||Z&&we),style:{"--index":y,"--toasts-before":y,"--z-index":C.length-y,"--offset":`${Me?Xt:Pr.current}px`,"--initial-height":Z?"auto":`${ji}px`,...I,...f.style},onPointerDown:bn=>{Ft||!$t||(Ie.current=new Date,jn(Pr.current),bn.target.setPointerCapture(bn.pointerId),bn.target.tagName!=="BUTTON"&&(Qe(!0),cr.current={x:bn.clientX,y:bn.clientY}))},onPointerUp:()=>{var bn,dn,bi,mi;if(pt||!$t)return;cr.current=null;let Yi=Number(((bn=Ve.current)==null?void 0:bn.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Wn=new Date().getTime()-((dn=Ie.current)==null?void 0:dn.getTime()),pn=Math.abs(Yi)/Wn;if(Math.abs(Yi)>=Hft||pn>.11){jn(Pr.current),(bi=f.onDismiss)==null||bi.call(f,f),qn(),gt(!0),wn(!1);return}(mi=Ve.current)==null||mi.style.setProperty("--swipe-amount","0px"),Qe(!1)},onPointerMove:bn=>{var dn,bi;if(!cr.current||!$t)return;let mi=bn.clientY-cr.current.y,Yi=((dn=window.getSelection())==null?void 0:dn.toString().length)>0,Wn=us==="top"?Math.min(0,mi):Math.max(0,mi);Math.abs(Wn)>0&&wn(!0),!Yi&&((bi=Ve.current)==null||bi.style.setProperty("--swipe-amount",`${Wn}px`))}},Qi&&!f.jsx?U.createElement("button",{"aria-label":le,"data-disabled":Ft,"data-close-button":!0,onClick:Ft||!$t?()=>{}:()=>{var bn;qn(),(bn=f.onDismiss)==null||bn.call(f,f)},className:de(j?.closeButton,(r=f?.classNames)==null?void 0:r.closeButton)},(s=te?.close)!=null?s:Dft):null,f.jsx||U.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:U.createElement(U.Fragment,null,nt||f.icon||f.promise?U.createElement("div",{"data-icon":"",className:de(j?.icon,(o=f?.classNames)==null?void 0:o.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||pi():null,f.type!=="loading"?f.icon||te?.[nt]||Cft(nt):null):null,U.createElement("div",{"data-content":"",className:de(j?.content,(a=f?.classNames)==null?void 0:a.content)},U.createElement("div",{"data-title":"",className:de(j?.title,(l=f?.classNames)==null?void 0:l.title)},typeof f.title=="function"?f.title():f.title),f.description?U.createElement("div",{"data-description":"",className:de(G,Pi,j?.description,(c=f?.classNames)==null?void 0:c.description)},typeof f.description=="function"?f.description():f.description):null),U.isValidElement(f.cancel)?f.cancel:f.cancel&&g4(f.cancel)?U.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||O,onClick:bn=>{var dn,bi;g4(f.cancel)&&$t&&((bi=(dn=f.cancel).onClick)==null||bi.call(dn,bn),qn())},className:de(j?.cancelButton,(u=f?.classNames)==null?void 0:u.cancelButton)},f.cancel.label):null,U.isValidElement(f.action)?f.action:f.action&&g4(f.action)?U.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||M,onClick:bn=>{var dn,bi;g4(f.action)&&((bi=(dn=f.action).onClick)==null||bi.call(dn,bn),!bn.defaultPrevented&&qn())},className:de(j?.actionButton,(d=f?.classNames)==null?void 0:d.actionButton)},f.action.label):null))};function bve(){if(typeof window>"u"||typeof document>"u")return"ltr";let n=document.documentElement.getAttribute("dir");return n==="auto"||!n?window.getComputedStyle(document.documentElement).direction:n}var zFn=E.forwardRef(function(n,e){let{invert:t,position:i="bottom-right",hotkey:r=["altKey","KeyT"],expand:s,closeButton:o,className:a,offset:l,theme:c="light",richColors:u,duration:d,style:h,visibleToasts:f=Fft,toastOptions:g,dir:p=bve(),gap:m=Wft,loadingIcon:_,icons:v,containerAriaLabel:y="Notifications",pauseWhenPageIsHidden:C,cn:x=zft}=n,[k,L]=U.useState([]),D=U.useMemo(()=>Array.from(new Set([i].concat(k.filter(ue=>ue.position).map(ue=>ue.position)))),[k,i]),[I,O]=U.useState([]),[M,B]=U.useState(!1),[G,W]=U.useState(!1),[z,q]=U.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),ee=U.useRef(null),Z=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),j=U.useRef(null),te=U.useRef(!1),le=U.useCallback(ue=>{L(de=>{var we;return(we=de.find(xe=>xe.id===ue.id))!=null&&we.delete||xd.dismiss(ue.id),de.filter(({id:xe})=>xe!==ue.id)})},[]);return U.useEffect(()=>xd.subscribe(ue=>{if(ue.dismiss){L(de=>de.map(we=>we.id===ue.id?{...we,delete:!0}:we));return}setTimeout(()=>{p$.flushSync(()=>{L(de=>{let we=de.findIndex(xe=>xe.id===ue.id);return we!==-1?[...de.slice(0,we),{...de[we],...ue},...de.slice(we+1)]:[ue,...de]})})})}),[]),U.useEffect(()=>{if(c!=="system"){q(c);return}if(c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;let ue=window.matchMedia("(prefers-color-scheme: dark)");try{ue.addEventListener("change",({matches:de})=>{q(de?"dark":"light")})}catch{ue.addListener(({matches:we})=>{try{q(we?"dark":"light")}catch(xe){console.error(xe)}})}},[c]),U.useEffect(()=>{k.length<=1&&B(!1)},[k]),U.useEffect(()=>{let ue=de=>{var we,xe;r.every(Me=>de[Me]||de.code===Me)&&(B(!0),(we=ee.current)==null||we.focus()),de.code==="Escape"&&(document.activeElement===ee.current||(xe=ee.current)!=null&&xe.contains(document.activeElement))&&B(!1)};return document.addEventListener("keydown",ue),()=>document.removeEventListener("keydown",ue)},[r]),U.useEffect(()=>{if(ee.current)return()=>{j.current&&(j.current.focus({preventScroll:!0}),j.current=null,te.current=!1)}},[ee.current]),U.createElement("section",{"aria-label":`${y} ${Z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false"},D.map((ue,de)=>{var we;let[xe,Me]=ue.split("-");return k.length?U.createElement("ol",{key:ue,dir:p==="auto"?bve():p,tabIndex:-1,ref:ee,className:a,"data-sonner-toaster":!0,"data-theme":z,"data-y-position":xe,"data-lifted":M&&k.length>1&&!s,"data-x-position":Me,style:{"--front-toast-height":`${((we=I[0])==null?void 0:we.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||Bft,"--width":`${$ft}px`,"--gap":`${m}px`,...h},onBlur:Re=>{te.current&&!Re.currentTarget.contains(Re.relatedTarget)&&(te.current=!1,j.current&&(j.current.focus({preventScroll:!0}),j.current=null))},onFocus:Re=>{Re.target instanceof HTMLElement&&Re.target.dataset.dismissible==="false"||te.current||(te.current=!0,j.current=Re.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{G||B(!1)},onPointerDown:Re=>{Re.target instanceof HTMLElement&&Re.target.dataset.dismissible==="false"||W(!0)},onPointerUp:()=>W(!1)},k.filter(Re=>!Re.position&&de===0||Re.position===ue).map((Re,_t)=>{var Qe,pt;return U.createElement(Uft,{key:Re.id,icons:v,index:_t,toast:Re,defaultRichColors:u,duration:(Qe=g?.duration)!=null?Qe:d,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:t,visibleToasts:f,closeButton:(pt=g?.closeButton)!=null?pt:o,interacting:G,position:ue,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,removeToast:le,toasts:k.filter(gt=>gt.position==Re.position),heights:I.filter(gt=>gt.position==Re.position),setHeights:O,expandByDefault:s,gap:m,loadingIcon:_,expanded:M,pauseWhenPageIsHidden:C,cn:x})})):null}))}),E6={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -110,7 +110,7 @@ __p += '`),vr&&(xt+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+xt+`return __p -}`;var Ki=jme(function(){return Xr(se,Ln+"return "+xt).apply(t,ve)});if(Ki.source=xt,nU(Ki))throw Ki;return Ki}function Lnt(b){return ts(b).toLowerCase()}function Tnt(b){return ts(b).toUpperCase()}function Dnt(b,S,T){if(b=ts(b),b&&(T||S===t))return epe(b);if(!b||!(S=md(S)))return b;var P=yf(b),X=yf(S),se=tpe(P,X),ve=npe(P,X)+1;return O0(P,se,ve).join("")}function Int(b,S,T){if(b=ts(b),b&&(T||S===t))return b.slice(0,rpe(b)+1);if(!b||!(S=md(S)))return b;var P=yf(b),X=npe(P,yf(S))+1;return O0(P,0,X).join("")}function Ant(b,S,T){if(b=ts(b),b&&(T||S===t))return b.replace(N,"");if(!b||!(S=md(S)))return b;var P=yf(b),X=tpe(P,yf(S));return O0(P,X).join("")}function Nnt(b,S){var T=O,P=M;if(po(S)){var X="separator"in S?S.separator:X;T="length"in S?Hi(S.length):T,P="omission"in S?md(S.omission):P}b=ts(b);var se=b.length;if(qC(b)){var ve=yf(b);se=ve.length}if(T>=se)return b;var Se=T-KC(P);if(Se<1)return P;var Ae=ve?O0(ve,0,Se).join(""):b.slice(0,Se);if(X===t)return Ae+P;if(ve&&(Se+=Ae.length-Se),iU(X)){if(b.slice(Se).search(X)){var ut,ft=Ae;for(X.global||(X=bz(X.source,ts(ht.exec(X))+"g")),X.lastIndex=0;ut=X.exec(ft);)var xt=ut.index;Ae=Ae.slice(0,xt===t?Se:xt)}}else if(b.indexOf(md(X),Se)!=Se){var Qt=Ae.lastIndexOf(X);Qt>-1&&(Ae=Ae.slice(0,Qt))}return Ae+P}function Rnt(b){return b=ts(b),b&&bi.test(b)?b.replace(bn,oXe):b}var Pnt=ex(function(b,S,T){return b+(T?" ":"")+S.toUpperCase()}),oU=qpe("toUpperCase");function Ume(b,S,T){return b=ts(b),S=T?t:S,S===t?tXe(b)?cXe(b):qZe(b):b.match(S)||[]}var jme=Zi(function(b,S){try{return gd(b,t,S)}catch(T){return nU(T)?T:new Li(T)}}),Ont=xm(function(b,S){return ph(S,function(T){T=qg(T),wm(b,T,eU(b[T],b))}),b});function Mnt(b){var S=b==null?0:b.length,T=Qn();return b=S?ao(b,function(P){if(typeof P[1]!="function")throw new mh(o);return[T(P[0]),P[1]]}):[],Zi(function(P){for(var X=-1;++XZ)return[];var T=le,P=Ql(b,le);S=Qn(S),b-=le;for(var X=mz(P,S);++T0||S<0)?new fr(T):(b<0?T=T.takeRight(-b):b&&(T=T.drop(b)),S!==t&&(S=Hi(S),T=S<0?T.dropRight(-S):T.take(S-b)),T)},fr.prototype.takeRightWhile=function(b){return this.reverse().takeWhile(b).reverse()},fr.prototype.toArray=function(){return this.take(le)},Ug(fr.prototype,function(b,S){var T=/^(?:filter|find|map|reject)|While$/.test(S),P=/^(?:head|last)$/.test(S),X=ie[P?"take"+(S=="last"?"Right":""):S],se=P||/^find/.test(S);X&&(ie.prototype[S]=function(){var ve=this.__wrapped__,Se=P?[1]:arguments,Ae=ve instanceof fr,ut=Se[0],ft=Ae||Ii(ve),xt=function(nr){var vr=X.apply(ie,D0([nr],Se));return P&&Qt?vr[0]:vr};ft&&T&&typeof ut=="function"&&ut.length!=1&&(Ae=ft=!1);var Qt=this.__chain__,Ln=!!this.__actions__.length,ei=se&&!Qt,Ki=Ae&&!Ln;if(!se&&ft){ve=Ki?ve:new fr(this);var ti=b.apply(ve,Se);return ti.__actions__.push({func:WM,args:[xt],thisArg:t}),new _h(ti,Qt)}return ei&&Ki?b.apply(this,Se):(ti=this.thru(xt),ei?P?ti.value()[0]:ti.value():ti)})}),ph(["pop","push","shift","sort","splice","unshift"],function(b){var S=hM[b],T=/^(?:push|sort|unshift)$/.test(b)?"tap":"thru",P=/^(?:pop|shift)$/.test(b);ie.prototype[b]=function(){var X=arguments;if(P&&!this.__chain__){var se=this.value();return S.apply(Ii(se)?se:[],X)}return this[T](function(ve){return S.apply(Ii(ve)?ve:[],X)})}}),Ug(fr.prototype,function(b,S){var T=ie[S];if(T){var P=T.name+"";hs.call(XC,P)||(XC[P]=[]),XC[P].push({name:S,func:T})}}),XC[RM(t,_).name]=[{name:"wrapper",func:t}],fr.prototype.clone=AXe,fr.prototype.reverse=NXe,fr.prototype.value=RXe,ie.prototype.at=cet,ie.prototype.chain=uet,ie.prototype.commit=det,ie.prototype.next=het,ie.prototype.plant=get,ie.prototype.reverse=pet,ie.prototype.toJSON=ie.prototype.valueOf=ie.prototype.value=met,ie.prototype.first=ie.prototype.head,z2&&(ie.prototype[z2]=fet),ie},GC=uXe();v1?((v1.exports=GC)._=GC,lz._=GC):xl._=GC}).call(Hh)})(E6,E6.exports);var U5n=E6.exports;function jft(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yve(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function wve(n){for(var e=1;e=0)&&(t[r]=n[r]);return t}function Kft(n,e){if(n==null)return{};var t=qft(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function Gft(n,e){return Yft(n)||Zft(n,e)||Xft(n,e)||Qft()}function Yft(n){if(Array.isArray(n))return n}function Zft(n,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(n)))){var t=[],i=!0,r=!1,s=void 0;try{for(var o=n[Symbol.iterator](),a;!(i=(a=o.next()).done)&&(t.push(a.value),!(e&&t.length===e));i=!0);}catch(l){r=!0,s=l}finally{try{!i&&o.return!=null&&o.return()}finally{if(r)throw s}}return t}}function Xft(n,e){if(n){if(typeof n=="string")return Cve(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Cve(n,e)}}function Cve(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t=se)return b;var Se=T-KC(P);if(Se<1)return P;var Ae=ve?O0(ve,0,Se).join(""):b.slice(0,Se);if(X===t)return Ae+P;if(ve&&(Se+=Ae.length-Se),iU(X)){if(b.slice(Se).search(X)){var ut,ft=Ae;for(X.global||(X=bz(X.source,ts(ht.exec(X))+"g")),X.lastIndex=0;ut=X.exec(ft);)var xt=ut.index;Ae=Ae.slice(0,xt===t?Se:xt)}}else if(b.indexOf(md(X),Se)!=Se){var Qt=Ae.lastIndexOf(X);Qt>-1&&(Ae=Ae.slice(0,Qt))}return Ae+P}function Rnt(b){return b=ts(b),b&&bi.test(b)?b.replace(bn,oXe):b}var Pnt=ex(function(b,S,T){return b+(T?" ":"")+S.toUpperCase()}),oU=qpe("toUpperCase");function Ume(b,S,T){return b=ts(b),S=T?t:S,S===t?tXe(b)?cXe(b):qZe(b):b.match(S)||[]}var jme=Zi(function(b,S){try{return gd(b,t,S)}catch(T){return nU(T)?T:new Li(T)}}),Ont=xm(function(b,S){return ph(S,function(T){T=qg(T),wm(b,T,eU(b[T],b))}),b});function Mnt(b){var S=b==null?0:b.length,T=Qn();return b=S?ao(b,function(P){if(typeof P[1]!="function")throw new mh(o);return[T(P[0]),P[1]]}):[],Zi(function(P){for(var X=-1;++XZ)return[];var T=le,P=Ql(b,le);S=Qn(S),b-=le;for(var X=mz(P,S);++T0||S<0)?new fr(T):(b<0?T=T.takeRight(-b):b&&(T=T.drop(b)),S!==t&&(S=Hi(S),T=S<0?T.dropRight(-S):T.take(S-b)),T)},fr.prototype.takeRightWhile=function(b){return this.reverse().takeWhile(b).reverse()},fr.prototype.toArray=function(){return this.take(le)},Ug(fr.prototype,function(b,S){var T=/^(?:filter|find|map|reject)|While$/.test(S),P=/^(?:head|last)$/.test(S),X=ie[P?"take"+(S=="last"?"Right":""):S],se=P||/^find/.test(S);X&&(ie.prototype[S]=function(){var ve=this.__wrapped__,Se=P?[1]:arguments,Ae=ve instanceof fr,ut=Se[0],ft=Ae||Ii(ve),xt=function(nr){var vr=X.apply(ie,D0([nr],Se));return P&&Qt?vr[0]:vr};ft&&T&&typeof ut=="function"&&ut.length!=1&&(Ae=ft=!1);var Qt=this.__chain__,Ln=!!this.__actions__.length,ei=se&&!Qt,Ki=Ae&&!Ln;if(!se&&ft){ve=Ki?ve:new fr(this);var ti=b.apply(ve,Se);return ti.__actions__.push({func:WM,args:[xt],thisArg:t}),new _h(ti,Qt)}return ei&&Ki?b.apply(this,Se):(ti=this.thru(xt),ei?P?ti.value()[0]:ti.value():ti)})}),ph(["pop","push","shift","sort","splice","unshift"],function(b){var S=hM[b],T=/^(?:push|sort|unshift)$/.test(b)?"tap":"thru",P=/^(?:pop|shift)$/.test(b);ie.prototype[b]=function(){var X=arguments;if(P&&!this.__chain__){var se=this.value();return S.apply(Ii(se)?se:[],X)}return this[T](function(ve){return S.apply(Ii(ve)?ve:[],X)})}}),Ug(fr.prototype,function(b,S){var T=ie[S];if(T){var P=T.name+"";hs.call(XC,P)||(XC[P]=[]),XC[P].push({name:S,func:T})}}),XC[RM(t,_).name]=[{name:"wrapper",func:t}],fr.prototype.clone=AXe,fr.prototype.reverse=NXe,fr.prototype.value=RXe,ie.prototype.at=cet,ie.prototype.chain=uet,ie.prototype.commit=det,ie.prototype.next=het,ie.prototype.plant=get,ie.prototype.reverse=pet,ie.prototype.toJSON=ie.prototype.valueOf=ie.prototype.value=met,ie.prototype.first=ie.prototype.head,z2&&(ie.prototype[z2]=fet),ie},GC=uXe();v1?((v1.exports=GC)._=GC,lz._=GC):xl._=GC}).call(Hh)})(E6,E6.exports);var UFn=E6.exports;function jft(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yve(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function wve(n){for(var e=1;e=0)&&(t[r]=n[r]);return t}function Kft(n,e){if(n==null)return{};var t=qft(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function Gft(n,e){return Yft(n)||Zft(n,e)||Xft(n,e)||Qft()}function Yft(n){if(Array.isArray(n))return n}function Zft(n,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(n)))){var t=[],i=!0,r=!1,s=void 0;try{for(var o=n[Symbol.iterator](),a;!(i=(a=o.next()).done)&&(t.push(a.value),!(e&&t.length===e));i=!0);}catch(l){r=!0,s=l}finally{try{!i&&o.return!=null&&o.return()}finally{if(r)throw s}}return t}}function Xft(n,e){if(n){if(typeof n=="string")return Cve(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Cve(n,e)}}function Cve(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t=n.length?n.apply(this,r):function(){for(var o=arguments.length,a=new Array(o),l=0;l1&&arguments[1]!==void 0?arguments[1]:{};p4.initial(n),p4.handler(e);var t={current:n},i=CD(hgt)(t,e),r=CD(dgt)(t),s=CD(p4.changes)(n),o=CD(ugt)(t);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return p4.selector(c),c(t.current)}function l(c){egt(i,r,s,o)(c)}return[a,l]}function ugt(n,e){return QA(e)?e(n.current):e}function dgt(n,e){return n.current=Sve(Sve({},n.current),e),e}function hgt(n,e,t){return QA(e)?e(n.current):Object.keys(t).forEach(function(i){var r;return(r=e[i])===null||r===void 0?void 0:r.call(e,n.current[i])}),t}var fgt={create:cgt},ggt={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function pgt(n){return function e(){for(var t=this,i=arguments.length,r=new Array(i),s=0;s=n.length?n.apply(this,r):function(){for(var o=arguments.length,a=new Array(o),l=0;l{i.current=!1}:n,e)}var Ad=Wgt;function hI(){}function mS(n,e,t,i){return Hgt(n,i)||Vgt(n,e,t,i)}function Hgt(n,e){return n.editor.getModel(i4e(n,e))}function Vgt(n,e,t,i){return n.editor.createModel(e,t,i?i4e(n,i):void 0)}function i4e(n,e){return n.Uri.parse(e)}function zgt({original:n,modified:e,language:t,originalLanguage:i,modifiedLanguage:r,originalModelPath:s,modifiedModelPath:o,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:u="Loading...",options:d={},height:h="100%",width:f="100%",className:g,wrapperProps:p={},beforeMount:m=hI,onMount:_=hI}){let[v,y]=E.useState(!1),[C,x]=E.useState(!0),k=E.useRef(null),L=E.useRef(null),D=E.useRef(null),I=E.useRef(_),O=E.useRef(m),M=E.useRef(!1);n4e(()=>{let z=e4e.init();return z.then(q=>(L.current=q)&&x(!1)).catch(q=>q?.type!=="cancelation"&&console.error("Monaco initialization: error:",q)),()=>k.current?W():z.cancel()}),Ad(()=>{if(k.current&&L.current){let z=k.current.getOriginalEditor(),q=mS(L.current,n||"",i||t||"text",s||"");q!==z.getModel()&&z.setModel(q)}},[s],v),Ad(()=>{if(k.current&&L.current){let z=k.current.getModifiedEditor(),q=mS(L.current,e||"",r||t||"text",o||"");q!==z.getModel()&&z.setModel(q)}},[o],v),Ad(()=>{let z=k.current.getModifiedEditor();z.getOption(L.current.editor.EditorOption.readOnly)?z.setValue(e||""):e!==z.getValue()&&(z.executeEdits("",[{range:z.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),z.pushUndoStop())},[e],v),Ad(()=>{k.current?.getModel()?.original.setValue(n||"")},[n],v),Ad(()=>{let{original:z,modified:q}=k.current.getModel();L.current.editor.setModelLanguage(z,i||t||"text"),L.current.editor.setModelLanguage(q,r||t||"text")},[t,i,r],v),Ad(()=>{L.current?.editor.setTheme(c)},[c],v),Ad(()=>{k.current?.updateOptions(d)},[d],v);let B=E.useCallback(()=>{if(!L.current)return;O.current(L.current);let z=mS(L.current,n||"",i||t||"text",s||""),q=mS(L.current,e||"",r||t||"text",o||"");k.current?.setModel({original:z,modified:q})},[t,e,r,n,i,s,o]),G=E.useCallback(()=>{!M.current&&D.current&&(k.current=L.current.editor.createDiffEditor(D.current,{automaticLayout:!0,...d}),B(),L.current?.editor.setTheme(c),y(!0),M.current=!0)},[d,c,B]);E.useEffect(()=>{v&&I.current(k.current,L.current)},[v]),E.useEffect(()=>{!C&&!v&&G()},[C,v,G]);function W(){let z=k.current?.getModel();a||z?.original?.dispose(),l||z?.modified?.dispose(),k.current?.dispose()}return U.createElement(t4e,{width:f,height:h,isEditorReady:v,loading:u,_ref:D,className:g,wrapperProps:p})}var Ugt=zgt;E.memo(Ugt);function jgt(n){let e=E.useRef();return E.useEffect(()=>{e.current=n},[n]),e.current}var qgt=jgt,m4=new Map;function Kgt({defaultValue:n,defaultLanguage:e,defaultPath:t,value:i,language:r,path:s,theme:o="light",line:a,loading:l="Loading...",options:c={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:h=!1,width:f="100%",height:g="100%",className:p,wrapperProps:m={},beforeMount:_=hI,onMount:v=hI,onChange:y,onValidate:C=hI}){let[x,k]=E.useState(!1),[L,D]=E.useState(!0),I=E.useRef(null),O=E.useRef(null),M=E.useRef(null),B=E.useRef(v),G=E.useRef(_),W=E.useRef(),z=E.useRef(i),q=qgt(s),ee=E.useRef(!1),Z=E.useRef(!1);n4e(()=>{let le=e4e.init();return le.then(ue=>(I.current=ue)&&D(!1)).catch(ue=>ue?.type!=="cancelation"&&console.error("Monaco initialization: error:",ue)),()=>O.current?te():le.cancel()}),Ad(()=>{let le=mS(I.current,n||i||"",e||r||"",s||t||"");le!==O.current?.getModel()&&(d&&m4.set(q,O.current?.saveViewState()),O.current?.setModel(le),d&&O.current?.restoreViewState(m4.get(s)))},[s],x),Ad(()=>{O.current?.updateOptions(c)},[c],x),Ad(()=>{!O.current||i===void 0||(O.current.getOption(I.current.editor.EditorOption.readOnly)?O.current.setValue(i):i!==O.current.getValue()&&(Z.current=!0,O.current.executeEdits("",[{range:O.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),O.current.pushUndoStop(),Z.current=!1))},[i],x),Ad(()=>{let le=O.current?.getModel();le&&r&&I.current?.editor.setModelLanguage(le,r)},[r],x),Ad(()=>{a!==void 0&&O.current?.revealLine(a)},[a],x),Ad(()=>{I.current?.editor.setTheme(o)},[o],x);let j=E.useCallback(()=>{if(!(!M.current||!I.current)&&!ee.current){G.current(I.current);let le=s||t,ue=mS(I.current,i||n||"",e||r||"",le||"");O.current=I.current?.editor.create(M.current,{model:ue,automaticLayout:!0,...c},u),d&&O.current.restoreViewState(m4.get(le)),I.current.editor.setTheme(o),a!==void 0&&O.current.revealLine(a),k(!0),ee.current=!0}},[n,e,t,i,r,s,c,u,d,o,a]);E.useEffect(()=>{x&&B.current(O.current,I.current)},[x]),E.useEffect(()=>{!L&&!x&&j()},[L,x,j]),z.current=i,E.useEffect(()=>{x&&y&&(W.current?.dispose(),W.current=O.current?.onDidChangeModelContent(le=>{Z.current||y(O.current.getValue(),le)}))},[x,y]),E.useEffect(()=>{if(x){let le=I.current.editor.onDidChangeMarkers(ue=>{let de=O.current.getModel()?.uri;if(de&&ue.find(we=>we.path===de.path)){let we=I.current.editor.getModelMarkers({resource:de});C?.(we)}});return()=>{le?.dispose()}}return()=>{}},[x,C]);function te(){W.current?.dispose(),h?d&&m4.set(s,O.current.saveViewState()):O.current.getModel()?.dispose(),O.current.dispose()}return U.createElement(t4e,{width:f,height:g,isEditorReady:x,loading:l,_ref:M,className:p,wrapperProps:m})}var Ggt=Kgt,j5n=E.memo(Ggt);function yd(n,e=0){return n[n.length-(1+e)]}function Ygt(n){if(n.length===0)throw new Error("Invalid tail call");return[n.slice(0,n.length-1),n[n.length-1]]}function $r(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e||n.length!==e.length)return!1;for(let i=0,r=n.length;it(n[i],e))}function Xgt(n,e){let t=0,i=n-1;for(;t<=i;){const r=(t+i)/2|0,s=e(r);if(s<0)t=r+1;else if(s>0)i=r-1;else return r}return-(t+1)}function rZ(n,e,t){if(n=n|0,n>=e.length)throw new TypeError("invalid index");const i=e[Math.floor(e.length*Math.random())],r=[],s=[],o=[];for(const a of e){const l=t(a,i);l<0?r.push(a):l>0?s.push(a):o.push(a)}return n!!e)}function Lve(n){let e=0;for(let t=0;t0}function j_(n,e=t=>t){const t=new Set;return n.filter(i=>{const r=e(i);return t.has(r)?!1:(t.add(r),!0)})}function hae(n,e){return n.length>0?n[0]:e}function sc(n,e){let t=typeof e=="number"?n:0;typeof e=="number"?t=n:(t=0,e=n);const i=[];if(t<=e)for(let r=t;re;r--)i.push(r);return i}function I$(n,e,t){const i=n.slice(0,e),r=n.slice(e);return i.concat(t,r)}function uj(n,e){const t=n.indexOf(e);t>-1&&(n.splice(t,1),n.unshift(e))}function _4(n,e){const t=n.indexOf(e);t>-1&&(n.splice(t,1),n.push(e))}function sZ(n,e){for(const t of e)n.push(t)}function fae(n){return Array.isArray(n)?n:[n]}function Jgt(n,e,t){const i=o4e(n,e),r=n.length,s=t.length;n.length=r+s;for(let o=r-1;o>=i;o--)n[o+s]=n[o];for(let o=0;o0}n.isGreaterThan=i;function r(s){return s===0}n.isNeitherLessOrGreaterThan=r,n.greaterThan=1,n.lessThan=-1,n.neitherLessOrGreaterThan=0})(eN||(eN={}));function $l(n,e){return(t,i)=>e(n(t),n(i))}function ept(...n){return(e,t)=>{for(const i of n){const r=i(e,t);if(!eN.isNeitherLessOrGreaterThan(r))return r}return eN.neitherLessOrGreaterThan}}const Xh=(n,e)=>n-e,tpt=(n,e)=>Xh(n?1:0,e?1:0);function a4e(n){return(e,t)=>-n(e,t)}class q_{constructor(e){this.items=e,this.firstIdx=0,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(e){let t=this.firstIdx;for(;t=0&&e(this.items[t]);)t--;const i=t===this.lastIdx?null:this.items.slice(t+1,this.lastIdx+1);return this.lastIdx=t,i}peek(){if(this.length!==0)return this.items[this.firstIdx]}dequeue(){const e=this.items[this.firstIdx];return this.firstIdx++,e}takeCount(e){const t=this.items.slice(this.firstIdx,this.firstIdx+e);return this.firstIdx+=e,t}}class T_{static{this.empty=new T_(e=>{})}constructor(e){this.iterate=e}toArray(){const e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new T_(t=>this.iterate(i=>e(i)?t(i):!0))}map(e){return new T_(t=>this.iterate(i=>t(e(i))))}findLast(e){let t;return this.iterate(i=>(e(i)&&(t=i),!0)),t}findLastMaxBy(e){let t,i=!0;return this.iterate(r=>((i||eN.isGreaterThan(e(r,t)))&&(i=!1,t=r),!0)),t}}class T6{constructor(e){this._indexMap=e}static createSortPermutation(e,t){const i=Array.from(e.keys()).sort((r,s)=>t(e[r],e[s]));return new T6(i)}apply(e){return e.map((t,i)=>e[this._indexMap[i]])}inverse(){const e=this._indexMap.slice();for(let t=0;t"u"}function Bp(n){return!Bu(n)}function Bu(n){return ml(n)||n===null}function oi(n,e){if(!n)throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}function Lv(n){if(Bu(n))throw new Error("Assertion Failed: argument is undefined or null");return n}function tN(n){return typeof n=="function"}function ipt(n,e){const t=Math.min(n.length,e.length);for(let i=0;i{e[t]=i&&typeof i=="object"?Qm(i):i}),e}function spt(n){if(!n||typeof n!="object")return n;const e=[n];for(;e.length>0;){const t=e.shift();Object.freeze(t);for(const i in t)if(c4e.call(t,i)){const r=t[i];typeof r=="object"&&!Object.isFrozen(r)&&!npt(r)&&e.push(r)}}return n}const c4e=Object.prototype.hasOwnProperty;function u4e(n,e){return oZ(n,e,new Set)}function oZ(n,e,t){if(Bu(n))return n;const i=e(n);if(typeof i<"u")return i;if(Array.isArray(n)){const r=[];for(const s of n)r.push(oZ(s,e,t));return r}if(Mo(n)){if(t.has(n))throw new Error("Cannot clone recursive data-structure");t.add(n);const r={};for(const s in n)c4e.call(n,s)&&(r[s]=oZ(n[s],e,t));return t.delete(n),r}return n}function A$(n,e,t=!0){return Mo(n)?(Mo(e)&&Object.keys(e).forEach(i=>{i in n?t&&(Mo(n[i])&&Mo(e[i])?A$(n[i],e[i],t):n[i]=e[i]):n[i]=e[i]}),n):e}function ru(n,e){if(n===e)return!0;if(n==null||e===null||e===void 0||typeof n!=typeof e||typeof n!="object"||Array.isArray(n)!==Array.isArray(e))return!1;let t,i;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(t=0;tfunction(){const s=Array.prototype.slice.call(arguments,0);return e(r,s)},i={};for(const r of n)i[r]=t(r);return i}function d4e(){return globalThis._VSCODE_NLS_MESSAGES}function gae(){return globalThis._VSCODE_NLS_LANGUAGE}const lpt=gae()==="pseudo"||typeof document<"u"&&document.location&&document.location.hash.indexOf("pseudo=true")>=0;function D6(n,e){let t;return e.length===0?t=n:t=n.replace(/\{(\d+)\}/g,(i,r)=>{const s=r[0],o=e[s];let a=i;return typeof o=="string"?a=o:(typeof o=="number"||typeof o=="boolean"||o===void 0||o===null)&&(a=String(o)),a}),lpt&&(t="["+t.replace(/[aouei]/g,"$&$&")+"]"),t}function w(n,e,...t){return D6(typeof n=="number"?h4e(n,e):e,t)}function h4e(n,e){const t=d4e()?.[n];if(typeof t!="string"){if(typeof e=="string")return e;throw new Error(`!!! NLS MISSING: ${n} !!!`)}return t}function Gt(n,e,...t){let i;typeof n=="number"?i=h4e(n,e):i=e;const r=D6(i,t);return{value:r,original:e===i?r:D6(e,t)}}const _S="en";let I6=!1,A6=!1,PF=!1,f4e=!1,pae=!1,mae=!1,g4e=!1,v4,OF=_S,Ive=_S,cpt,Fm;const D_=globalThis;let Sd;typeof D_.vscode<"u"&&typeof D_.vscode.process<"u"?Sd=D_.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Sd=process);const upt=typeof Sd?.versions?.electron=="string",dpt=upt&&Sd?.type==="renderer";if(typeof Sd=="object"){I6=Sd.platform==="win32",A6=Sd.platform==="darwin",PF=Sd.platform==="linux",PF&&Sd.env.SNAP&&Sd.env.SNAP_REVISION,Sd.env.CI||Sd.env.BUILD_ARTIFACTSTAGINGDIRECTORY,v4=_S,OF=_S;const n=Sd.env.VSCODE_NLS_CONFIG;if(n)try{const e=JSON.parse(n);v4=e.userLocale,Ive=e.osLocale,OF=e.resolvedLanguage||_S,cpt=e.languagePack?.translationsConfigFile}catch{}f4e=!0}else typeof navigator=="object"&&!dpt?(Fm=navigator.userAgent,I6=Fm.indexOf("Windows")>=0,A6=Fm.indexOf("Macintosh")>=0,mae=(Fm.indexOf("Macintosh")>=0||Fm.indexOf("iPad")>=0||Fm.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,PF=Fm.indexOf("Linux")>=0,g4e=Fm?.indexOf("Mobi")>=0,pae=!0,OF=gae()||_S,v4=navigator.language.toLowerCase(),Ive=v4):console.error("Unable to resolve platform.");const Ta=I6,Rn=A6,zl=PF,hg=f4e,pC=pae,hpt=pae&&typeof D_.importScripts=="function",fpt=hpt?D_.origin:void 0,Sg=mae,p4e=g4e,Gp=Fm,gpt=OF,ppt=typeof D_.postMessage=="function"&&!D_.importScripts,m4e=(()=>{if(ppt){const n=[];D_.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,r=n.length;i{const i=++e;n.push({id:i,callback:t}),D_.postMessage({vscodeScheduleAsyncWork:i},"*")}}return n=>setTimeout(n)})(),eu=A6||mae?2:I6?1:3;let Ave=!0,Nve=!1;function _4e(){if(!Nve){Nve=!0;const n=new Uint8Array(2);n[0]=1,n[1]=2,Ave=new Uint16Array(n.buffer)[0]===513}return Ave}const v4e=!!(Gp&&Gp.indexOf("Chrome")>=0),mpt=!!(Gp&&Gp.indexOf("Firefox")>=0),_pt=!!(!v4e&&Gp&&Gp.indexOf("Safari")>=0),vpt=!!(Gp&&Gp.indexOf("Edg/")>=0),bpt=!!(Gp&&Gp.indexOf("Android")>=0),Va={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}};var zn;(function(n){function e(C){return C&&typeof C=="object"&&typeof C[Symbol.iterator]=="function"}n.is=e;const t=Object.freeze([]);function i(){return t}n.empty=i;function*r(C){yield C}n.single=r;function s(C){return e(C)?C:r(C)}n.wrap=s;function o(C){return C||t}n.from=o;function*a(C){for(let x=C.length-1;x>=0;x--)yield C[x]}n.reverse=a;function l(C){return!C||C[Symbol.iterator]().next().done===!0}n.isEmpty=l;function c(C){return C[Symbol.iterator]().next().value}n.first=c;function u(C,x){let k=0;for(const L of C)if(x(L,k++))return!0;return!1}n.some=u;function d(C,x){for(const k of C)if(x(k))return k}n.find=d;function*h(C,x){for(const k of C)x(k)&&(yield k)}n.filter=h;function*f(C,x){let k=0;for(const L of C)yield x(L,k++)}n.map=f;function*g(C,x){let k=0;for(const L of C)yield*x(L,k++)}n.flatMap=g;function*p(...C){for(const x of C)yield*x}n.concat=p;function m(C,x,k){let L=k;for(const D of C)L=x(L,D);return L}n.reduce=m;function*_(C,x,k=C.length){for(x<0&&(x+=C.length),k<0?k+=C.length:k>C.length&&(k=C.length);x{r||(r=!0,this._remove(i))}}shift(){if(this._first!==mo.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==mo.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==mo.Undefined&&e.next!==mo.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===mo.Undefined&&e.next===mo.Undefined?(this._first=mo.Undefined,this._last=mo.Undefined):e.next===mo.Undefined?(this._last=this._last.prev,this._last.next=mo.Undefined):e.prev===mo.Undefined&&(this._first=this._first.next,this._first.prev=mo.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==mo.Undefined;)yield e.element,e=e.next}}const N6="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function ypt(n=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(const t of N6)n.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}const _ae=ypt();function vae(n){let e=_ae;if(n&&n instanceof RegExp)if(n.global)e=n;else{let t="g";n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.unicode&&(t+="u"),e=new RegExp(n.source,t)}return e.lastIndex=0,e}const b4e=new Rl;b4e.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function nN(n,e,t,i,r){if(e=vae(e),r||(r=zn.first(b4e)),t.length>r.maxLen){let c=n-r.maxLen/2;return c<0?c=0:i+=c,t=t.substring(c,n+r.maxLen/2),nN(n,e,t,i,r)}const s=Date.now(),o=n-1-i;let a=-1,l=null;for(let c=1;!(Date.now()-s>=r.timeBudget);c++){const u=o-r.windowSize*c;e.lastIndex=Math.max(0,u);const d=wpt(e,t,o,a);if(!d&&l||(l=d,u<=0))break;a=u}if(l){const c={word:l[0],startColumn:i+1+l.index,endColumn:i+1+l.index+l[0].length};return e.lastIndex=0,c}return null}function wpt(n,e,t,i){let r;for(;r=n.exec(e);){const s=r.index||0;if(s<=t&&n.lastIndex>=t)return r;if(i>0&&s>i)return null}return null}const tp=8;class y4e{constructor(e){this._values=e}hasChanged(e){return this._values[e]}}class w4e{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}}class Rr{constructor(e,t,i,r){this.id=e,this.name=t,this.defaultValue=i,this.schema=r}applyUpdate(e,t){return N$(e,t)}compute(e,t,i){return i}}class fI{constructor(e,t){this.newValue=e,this.didChange=t}}function N$(n,e){if(typeof n!="object"||typeof e!="object"||!n||!e)return new fI(e,n!==e);if(Array.isArray(n)||Array.isArray(e)){const i=Array.isArray(n)&&Array.isArray(e)&&$r(n,e);return new fI(e,!i)}let t=!1;for(const i in e)if(e.hasOwnProperty(i)){const r=N$(n[i],e[i]);r.didChange&&(n[i]=r.newValue,t=!0)}return new fI(n,t)}class zP{constructor(e){this.schema=void 0,this.id=e,this.name="_never_",this.defaultValue=void 0}applyUpdate(e,t){return N$(e,t)}validate(e){return this.defaultValue}}class UL{constructor(e,t,i,r){this.id=e,this.name=t,this.defaultValue=i,this.schema=r}applyUpdate(e,t){return N$(e,t)}validate(e){return typeof e>"u"?this.defaultValue:e}compute(e,t,i){return i}}function Et(n,e){return typeof n>"u"?e:n==="false"?!1:!!n}class ni extends UL{constructor(e,t,i,r=void 0){typeof r<"u"&&(r.type="boolean",r.default=i),super(e,t,i,r)}validate(e){return Et(e,this.defaultValue)}}function V1(n,e,t,i){if(typeof n>"u")return e;let r=parseInt(n,10);return isNaN(r)?e:(r=Math.max(t,r),r=Math.min(i,r),r|0)}class rr extends UL{static clampedInt(e,t,i,r){return V1(e,t,i,r)}constructor(e,t,i,r,s,o=void 0){typeof o<"u"&&(o.type="integer",o.default=i,o.minimum=r,o.maximum=s),super(e,t,i,o),this.minimum=r,this.maximum=s}validate(e){return rr.clampedInt(e,this.defaultValue,this.minimum,this.maximum)}}function Cpt(n,e,t,i){if(typeof n>"u")return e;const r=Uu.float(n,e);return Uu.clamp(r,t,i)}class Uu extends UL{static clamp(e,t,i){return ei?i:e}static float(e,t){if(typeof e=="number")return e;if(typeof e>"u")return t;const i=parseFloat(e);return isNaN(i)?t:i}constructor(e,t,i,r,s){typeof s<"u"&&(s.type="number",s.default=i),super(e,t,i,s),this.validationFn=r}validate(e){return this.validationFn(Uu.float(e,this.defaultValue))}}class fl extends UL{static string(e,t){return typeof e!="string"?t:e}constructor(e,t,i,r=void 0){typeof r<"u"&&(r.type="string",r.default=i),super(e,t,i,r)}validate(e){return fl.string(e,this.defaultValue)}}function is(n,e,t,i){return typeof n!="string"?e:i&&n in i?i[n]:t.indexOf(n)===-1?e:n}class ns extends UL{constructor(e,t,i,r,s=void 0){typeof s<"u"&&(s.type="string",s.enum=r,s.default=i),super(e,t,i,s),this._allowedValues=r}validate(e){return is(e,this.defaultValue,this._allowedValues)}}class b4 extends Rr{constructor(e,t,i,r,s,o,a=void 0){typeof a<"u"&&(a.type="string",a.enum=s,a.default=r),super(e,t,i,a),this._allowedValues=s,this._convert=o}validate(e){return typeof e!="string"?this.defaultValue:this._allowedValues.indexOf(e)===-1?this.defaultValue:this._convert(e)}}function xpt(n){switch(n){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}class Spt extends Rr{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[w("accessibilitySupport.auto","Use platform APIs to detect when a Screen Reader is attached."),w("accessibilitySupport.on","Optimize for usage with a Screen Reader."),w("accessibilitySupport.off","Assume a screen reader is not attached.")],default:"auto",tags:["accessibility"],description:w("accessibilitySupport","Controls if the UI should run in a mode where it is optimized for screen readers.")})}validate(e){switch(e){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(e,t,i){return i===0?e.accessibilitySupport:i}}class kpt extends Rr{constructor(){const e={insertSpace:!0,ignoreEmptyLines:!0};super(23,"comments",e,{"editor.comments.insertSpace":{type:"boolean",default:e.insertSpace,description:w("comments.insertSpace","Controls whether a space character is inserted when commenting.")},"editor.comments.ignoreEmptyLines":{type:"boolean",default:e.ignoreEmptyLines,description:w("comments.ignoreEmptyLines","Controls if empty lines should be ignored with toggle, add or remove actions for line comments.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{insertSpace:Et(t.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:Et(t.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}}function Ept(n){switch(n){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}var Yo;(function(n){n[n.Line=1]="Line",n[n.Block=2]="Block",n[n.Underline=3]="Underline",n[n.LineThin=4]="LineThin",n[n.BlockOutline=5]="BlockOutline",n[n.UnderlineThin=6]="UnderlineThin"})(Yo||(Yo={}));function Lpt(n){switch(n){case"line":return Yo.Line;case"block":return Yo.Block;case"underline":return Yo.Underline;case"line-thin":return Yo.LineThin;case"block-outline":return Yo.BlockOutline;case"underline-thin":return Yo.UnderlineThin}}class Tpt extends zP{constructor(){super(143)}compute(e,t,i){const r=["monaco-editor"];return t.get(39)&&r.push(t.get(39)),e.extraEditorClassName&&r.push(e.extraEditorClassName),t.get(74)==="default"?r.push("mouse-default"):t.get(74)==="copy"&&r.push("mouse-copy"),t.get(112)&&r.push("showUnused"),t.get(141)&&r.push("showDeprecated"),r.join(" ")}}class Dpt extends ni{constructor(){super(37,"emptySelectionClipboard",!0,{description:w("emptySelectionClipboard","Controls whether copying without a selection copies the current line.")})}compute(e,t,i){return i&&e.emptySelectionClipboard}}class Ipt extends Rr{constructor(){const e={cursorMoveOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0};super(41,"find",e,{"editor.find.cursorMoveOnType":{type:"boolean",default:e.cursorMoveOnType,description:w("find.cursorMoveOnType","Controls whether the cursor should jump to find matches while typing.")},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:e.seedSearchStringFromSelection,enumDescriptions:[w("editor.find.seedSearchStringFromSelection.never","Never seed search string from the editor selection."),w("editor.find.seedSearchStringFromSelection.always","Always seed search string from the editor selection, including word at cursor position."),w("editor.find.seedSearchStringFromSelection.selection","Only seed search string from the editor selection.")],description:w("find.seedSearchStringFromSelection","Controls whether the search string in the Find Widget is seeded from the editor selection.")},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:e.autoFindInSelection,enumDescriptions:[w("editor.find.autoFindInSelection.never","Never turn on Find in Selection automatically (default)."),w("editor.find.autoFindInSelection.always","Always turn on Find in Selection automatically."),w("editor.find.autoFindInSelection.multiline","Turn on Find in Selection automatically when multiple lines of content are selected.")],description:w("find.autoFindInSelection","Controls the condition for turning on Find in Selection automatically.")},"editor.find.globalFindClipboard":{type:"boolean",default:e.globalFindClipboard,description:w("find.globalFindClipboard","Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),included:Rn},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:e.addExtraSpaceOnTop,description:w("find.addExtraSpaceOnTop","Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")},"editor.find.loop":{type:"boolean",default:e.loop,description:w("find.loop","Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{cursorMoveOnType:Et(t.cursorMoveOnType,this.defaultValue.cursorMoveOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":is(t.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":is(t.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:Et(t.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:Et(t.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:Et(t.loop,this.defaultValue.loop)}}}class zh extends Rr{static{this.OFF='"liga" off, "calt" off'}static{this.ON='"liga" on, "calt" on'}constructor(){super(51,"fontLigatures",zh.OFF,{anyOf:[{type:"boolean",description:w("fontLigatures","Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.")},{type:"string",description:w("fontFeatureSettings","Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")}],description:w("fontLigaturesGeneral","Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"||e.length===0?zh.OFF:e==="true"?zh.ON:e:e?zh.ON:zh.OFF}}class i_ extends Rr{static{this.OFF="normal"}static{this.TRANSLATE="translate"}constructor(){super(54,"fontVariations",i_.OFF,{anyOf:[{type:"boolean",description:w("fontVariations","Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property.")},{type:"string",description:w("fontVariationSettings","Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.")}],description:w("fontVariationsGeneral","Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"?i_.OFF:e==="true"?i_.TRANSLATE:e:e?i_.TRANSLATE:i_.OFF}compute(e,t,i){return e.fontInfo.fontVariationSettings}}class Apt extends zP{constructor(){super(50)}compute(e,t,i){return e.fontInfo}}class Npt extends UL{constructor(){super(52,"fontSize",Wl.fontSize,{type:"number",minimum:6,maximum:100,default:Wl.fontSize,description:w("fontSize","Controls the font size in pixels.")})}validate(e){const t=Uu.float(e,this.defaultValue);return t===0?Wl.fontSize:Uu.clamp(t,6,100)}compute(e,t,i){return e.fontInfo.fontSize}}class ay extends Rr{static{this.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"]}static{this.MINIMUM_VALUE=1}static{this.MAXIMUM_VALUE=1e3}constructor(){super(53,"fontWeight",Wl.fontWeight,{anyOf:[{type:"number",minimum:ay.MINIMUM_VALUE,maximum:ay.MAXIMUM_VALUE,errorMessage:w("fontWeightErrorMessage",'Only "normal" and "bold" keywords or numbers between 1 and 1000 are allowed.')},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:ay.SUGGESTION_VALUES}],default:Wl.fontWeight,description:w("fontWeight",'Controls the font weight. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.')})}validate(e){return e==="normal"||e==="bold"?e:String(rr.clampedInt(e,Wl.fontWeight,ay.MINIMUM_VALUE,ay.MAXIMUM_VALUE))}}class Rpt extends Rr{constructor(){const e={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",multipleTests:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:"",alternativeTestsCommand:""},t={type:"string",enum:["peek","gotoAndPeek","goto"],default:e.multiple,enumDescriptions:[w("editor.gotoLocation.multiple.peek","Show Peek view of the results (default)"),w("editor.gotoLocation.multiple.gotoAndPeek","Go to the primary result and show a Peek view"),w("editor.gotoLocation.multiple.goto","Go to the primary result and enable Peek-less navigation to others")]},i=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(58,"gotoLocation",e,{"editor.gotoLocation.multiple":{deprecationMessage:w("editor.gotoLocation.multiple.deprecated","This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.")},"editor.gotoLocation.multipleDefinitions":{description:w("editor.editor.gotoLocation.multipleDefinitions","Controls the behavior the 'Go to Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleTypeDefinitions":{description:w("editor.editor.gotoLocation.multipleTypeDefinitions","Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleDeclarations":{description:w("editor.editor.gotoLocation.multipleDeclarations","Controls the behavior the 'Go to Declaration'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleImplementations":{description:w("editor.editor.gotoLocation.multipleImplemenattions","Controls the behavior the 'Go to Implementations'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleReferences":{description:w("editor.editor.gotoLocation.multipleReferences","Controls the behavior the 'Go to References'-command when multiple target locations exist."),...t},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:e.alternativeDefinitionCommand,enum:i,description:w("alternativeDefinitionCommand","Alternative command id that is being executed when the result of 'Go to Definition' is the current location.")},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:e.alternativeTypeDefinitionCommand,enum:i,description:w("alternativeTypeDefinitionCommand","Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.")},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:e.alternativeDeclarationCommand,enum:i,description:w("alternativeDeclarationCommand","Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.")},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:e.alternativeImplementationCommand,enum:i,description:w("alternativeImplementationCommand","Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.")},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:e.alternativeReferenceCommand,enum:i,description:w("alternativeReferenceCommand","Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{multiple:is(t.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:t.multipleDefinitions??is(t.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:t.multipleTypeDefinitions??is(t.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:t.multipleDeclarations??is(t.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:t.multipleImplementations??is(t.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:t.multipleReferences??is(t.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:t.multipleTests??is(t.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:fl.string(t.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:fl.string(t.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:fl.string(t.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:fl.string(t.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:fl.string(t.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:fl.string(t.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}}class Ppt extends Rr{constructor(){const e={enabled:!0,delay:300,hidingDelay:300,sticky:!0,above:!0};super(60,"hover",e,{"editor.hover.enabled":{type:"boolean",default:e.enabled,description:w("hover.enabled","Controls whether the hover is shown.")},"editor.hover.delay":{type:"number",default:e.delay,minimum:0,maximum:1e4,description:w("hover.delay","Controls the delay in milliseconds after which the hover is shown.")},"editor.hover.sticky":{type:"boolean",default:e.sticky,description:w("hover.sticky","Controls whether the hover should remain visible when mouse is moved over it.")},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:e.hidingDelay,description:w("hover.hidingDelay","Controls the delay in milliseconds after which the hover is hidden. Requires `editor.hover.sticky` to be enabled.")},"editor.hover.above":{type:"boolean",default:e.above,description:w("hover.above","Prefer showing hovers above the line, if there's space.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),delay:rr.clampedInt(t.delay,this.defaultValue.delay,0,1e4),sticky:Et(t.sticky,this.defaultValue.sticky),hidingDelay:rr.clampedInt(t.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:Et(t.above,this.defaultValue.above)}}}class sk extends zP{constructor(){super(146)}compute(e,t,i){return sk.computeLayout(t,{memory:e.memory,outerWidth:e.outerWidth,outerHeight:e.outerHeight,isDominatedByLongLines:e.isDominatedByLongLines,lineHeight:e.fontInfo.lineHeight,viewLineCount:e.viewLineCount,lineNumbersDigitCount:e.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:e.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:e.fontInfo.maxDigitWidth,pixelRatio:e.pixelRatio,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(e){const t=e.height/e.lineHeight,i=Math.floor(e.paddingTop/e.lineHeight);let r=Math.floor(e.paddingBottom/e.lineHeight);e.scrollBeyondLastLine&&(r=Math.max(r,t-1));const s=(i+e.viewLineCount+r)/(e.pixelRatio*e.height),o=Math.floor(e.viewLineCount/s);return{typicalViewportLineCount:t,extraLinesBeforeFirstLine:i,extraLinesBeyondLastLine:r,desiredRatio:s,minimapLineCount:o}}static _computeMinimapLayout(e,t){const i=e.outerWidth,r=e.outerHeight,s=e.pixelRatio;if(!e.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(s*r),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:r};const o=t.stableMinimapLayoutInput,a=o&&e.outerHeight===o.outerHeight&&e.lineHeight===o.lineHeight&&e.typicalHalfwidthCharacterWidth===o.typicalHalfwidthCharacterWidth&&e.pixelRatio===o.pixelRatio&&e.scrollBeyondLastLine===o.scrollBeyondLastLine&&e.paddingTop===o.paddingTop&&e.paddingBottom===o.paddingBottom&&e.minimap.enabled===o.minimap.enabled&&e.minimap.side===o.minimap.side&&e.minimap.size===o.minimap.size&&e.minimap.showSlider===o.minimap.showSlider&&e.minimap.renderCharacters===o.minimap.renderCharacters&&e.minimap.maxColumn===o.minimap.maxColumn&&e.minimap.scale===o.minimap.scale&&e.verticalScrollbarWidth===o.verticalScrollbarWidth&&e.isViewportWrapping===o.isViewportWrapping,l=e.lineHeight,c=e.typicalHalfwidthCharacterWidth,u=e.scrollBeyondLastLine,d=e.minimap.renderCharacters;let h=s>=2?Math.round(e.minimap.scale*2):e.minimap.scale;const f=e.minimap.maxColumn,g=e.minimap.size,p=e.minimap.side,m=e.verticalScrollbarWidth,_=e.viewLineCount,v=e.remainingWidth,y=e.isViewportWrapping,C=d?2:3;let x=Math.floor(s*r);const k=x/s;let L=!1,D=!1,I=C*h,O=h/s,M=1;if(g==="fill"||g==="fit"){const{typicalViewportLineCount:Z,extraLinesBeforeFirstLine:j,extraLinesBeyondLastLine:te,desiredRatio:le,minimapLineCount:ue}=sk.computeContainedMinimapLineCount({viewLineCount:_,scrollBeyondLastLine:u,paddingTop:e.paddingTop,paddingBottom:e.paddingBottom,height:r,lineHeight:l,pixelRatio:s});if(_/ue>1)L=!0,D=!0,h=1,I=1,O=h/s;else{let we=!1,xe=h+1;if(g==="fit"){const Me=Math.ceil((j+_+te)*I);y&&a&&v<=t.stableFitRemainingWidth?(we=!0,xe=t.stableFitMaxMinimapScale):we=Me>x}if(g==="fill"||we){L=!0;const Me=h;I=Math.min(l*s,Math.max(1,Math.floor(1/le))),y&&a&&v<=t.stableFitRemainingWidth&&(xe=t.stableFitMaxMinimapScale),h=Math.min(xe,Math.max(1,Math.floor(I/C))),h>Me&&(M=Math.min(2,h/Me)),O=h/s/M,x=Math.ceil(Math.max(Z,j+_+te)*I),y?(t.stableMinimapLayoutInput=e,t.stableFitRemainingWidth=v,t.stableFitMaxMinimapScale=h):(t.stableMinimapLayoutInput=null,t.stableFitRemainingWidth=0)}}}const B=Math.floor(f*O),G=Math.min(B,Math.max(0,Math.floor((v-m-2)*O/(c+O)))+tp);let W=Math.floor(s*G);const z=W/s;W=Math.floor(W*M);const q=d?1:2,ee=p==="left"?0:i-G-m;return{renderMinimap:q,minimapLeft:ee,minimapWidth:G,minimapHeightIsEditorHeight:L,minimapIsSampling:D,minimapScale:h,minimapLineHeight:I,minimapCanvasInnerWidth:W,minimapCanvasInnerHeight:x,minimapCanvasOuterWidth:z,minimapCanvasOuterHeight:k}}static computeLayout(e,t){const i=t.outerWidth|0,r=t.outerHeight|0,s=t.lineHeight|0,o=t.lineNumbersDigitCount|0,a=t.typicalHalfwidthCharacterWidth,l=t.maxDigitWidth,c=t.pixelRatio,u=t.viewLineCount,d=e.get(138),h=d==="inherit"?e.get(137):d,f=h==="inherit"?e.get(133):h,g=e.get(136),p=t.isDominatedByLongLines,m=e.get(57),_=e.get(68).renderType!==0,v=e.get(69),y=e.get(106),C=e.get(84),x=e.get(73),k=e.get(104),L=k.verticalScrollbarSize,D=k.verticalHasArrows,I=k.arrowSize,O=k.horizontalScrollbarSize,M=e.get(43),B=e.get(111)!=="never";let G=e.get(66);M&&B&&(G+=16);let W=0;if(_){const _t=Math.max(o,v);W=Math.round(_t*l)}let z=0;m&&(z=s*t.glyphMarginDecorationLaneCount);let q=0,ee=q+z,Z=ee+W,j=Z+G;const te=i-z-W-G;let le=!1,ue=!1,de=-1;h==="inherit"&&p?(le=!0,ue=!0):f==="on"||f==="bounded"?ue=!0:f==="wordWrapColumn"&&(de=g);const we=sk._computeMinimapLayout({outerWidth:i,outerHeight:r,lineHeight:s,typicalHalfwidthCharacterWidth:a,pixelRatio:c,scrollBeyondLastLine:y,paddingTop:C.top,paddingBottom:C.bottom,minimap:x,verticalScrollbarWidth:L,viewLineCount:u,remainingWidth:te,isViewportWrapping:ue},t.memory||new w4e);we.renderMinimap!==0&&we.minimapLeft===0&&(q+=we.minimapWidth,ee+=we.minimapWidth,Z+=we.minimapWidth,j+=we.minimapWidth);const xe=te-we.minimapWidth,Me=Math.max(1,Math.floor((xe-L-2)/a)),Re=D?I:0;return ue&&(de=Math.max(1,Me),f==="bounded"&&(de=Math.min(de,g))),{width:i,height:r,glyphMarginLeft:q,glyphMarginWidth:z,glyphMarginDecorationLaneCount:t.glyphMarginDecorationLaneCount,lineNumbersLeft:ee,lineNumbersWidth:W,decorationsLeft:Z,decorationsWidth:G,contentLeft:j,contentWidth:xe,minimap:we,viewportColumn:Me,isWordWrapMinified:le,isViewportWrapping:ue,wrappingColumn:de,verticalScrollbarWidth:L,horizontalScrollbarHeight:O,overviewRuler:{top:Re,width:L,height:r-2*Re,right:0}}}}class Opt extends Rr{constructor(){super(140,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[w("wrappingStrategy.simple","Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."),w("wrappingStrategy.advanced","Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.")],type:"string",enum:["simple","advanced"],default:"simple",description:w("wrappingStrategy","Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.")}})}validate(e){return is(e,"simple",["simple","advanced"])}compute(e,t,i){return t.get(2)===2?"advanced":i}}var Oh;(function(n){n.Off="off",n.OnCode="onCode",n.On="on"})(Oh||(Oh={}));class Mpt extends Rr{constructor(){const e={enabled:Oh.OnCode};super(65,"lightbulb",e,{"editor.lightbulb.enabled":{type:"string",tags:["experimental"],enum:[Oh.Off,Oh.OnCode,Oh.On],default:e.enabled,enumDescriptions:[w("editor.lightbulb.enabled.off","Disable the code action menu."),w("editor.lightbulb.enabled.onCode","Show the code action menu when the cursor is on lines with code."),w("editor.lightbulb.enabled.on","Show the code action menu when the cursor is on lines with code or on empty lines.")],description:w("enabled","Enables the Code Action lightbulb in the editor.")}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{enabled:is(e.enabled,this.defaultValue.enabled,[Oh.Off,Oh.OnCode,Oh.On])}}}class Fpt extends Rr{constructor(){const e={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(116,"stickyScroll",e,{"editor.stickyScroll.enabled":{type:"boolean",default:e.enabled,description:w("editor.stickyScroll.enabled","Shows the nested current scopes during the scroll at the top of the editor."),tags:["experimental"]},"editor.stickyScroll.maxLineCount":{type:"number",default:e.maxLineCount,minimum:1,maximum:20,description:w("editor.stickyScroll.maxLineCount","Defines the maximum number of sticky lines to show.")},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:e.defaultModel,description:w("editor.stickyScroll.defaultModel","Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.")},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:e.scrollWithEditor,description:w("editor.stickyScroll.scrollWithEditor","Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),maxLineCount:rr.clampedInt(t.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:is(t.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:Et(t.scrollWithEditor,this.defaultValue.scrollWithEditor)}}}class Bpt extends Rr{constructor(){const e={enabled:"on",fontSize:0,fontFamily:"",padding:!1};super(142,"inlayHints",e,{"editor.inlayHints.enabled":{type:"string",default:e.enabled,description:w("inlayHints.enable","Enables the inlay hints in the editor."),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[w("editor.inlayHints.on","Inlay hints are enabled"),w("editor.inlayHints.onUnlessPressed","Inlay hints are showing by default and hide when holding {0}",Rn?"Ctrl+Option":"Ctrl+Alt"),w("editor.inlayHints.offUnlessPressed","Inlay hints are hidden by default and show when holding {0}",Rn?"Ctrl+Option":"Ctrl+Alt"),w("editor.inlayHints.off","Inlay hints are disabled")]},"editor.inlayHints.fontSize":{type:"number",default:e.fontSize,markdownDescription:w("inlayHints.fontSize","Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.","`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:e.fontFamily,markdownDescription:w("inlayHints.fontFamily","Controls font family of inlay hints in the editor. When set to empty, the {0} is used.","`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:e.padding,description:w("inlayHints.padding","Enables the padding around the inlay hints in the editor.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return typeof t.enabled=="boolean"&&(t.enabled=t.enabled?"on":"off"),{enabled:is(t.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:rr.clampedInt(t.fontSize,this.defaultValue.fontSize,0,100),fontFamily:fl.string(t.fontFamily,this.defaultValue.fontFamily),padding:Et(t.padding,this.defaultValue.padding)}}}class $pt extends Rr{constructor(){super(66,"lineDecorationsWidth",10)}validate(e){return typeof e=="string"&&/^\d+(\.\d+)?ch$/.test(e)?-parseFloat(e.substring(0,e.length-2)):rr.clampedInt(e,this.defaultValue,0,1e3)}compute(e,t,i){return i<0?rr.clampedInt(-i*e.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):i}}class Wpt extends Uu{constructor(){super(67,"lineHeight",Wl.lineHeight,e=>Uu.clamp(e,0,150),{markdownDescription:w("lineHeight",`Controls the line height. + `},kve=pgt(bgt)(ZMe),ygt={config:_gt},wgt=function(){for(var e=arguments.length,t=new Array(e),i=0;i{i.current=!1}:n,e)}var Ad=Wgt;function hI(){}function mS(n,e,t,i){return Hgt(n,i)||Vgt(n,e,t,i)}function Hgt(n,e){return n.editor.getModel(i4e(n,e))}function Vgt(n,e,t,i){return n.editor.createModel(e,t,i?i4e(n,i):void 0)}function i4e(n,e){return n.Uri.parse(e)}function zgt({original:n,modified:e,language:t,originalLanguage:i,modifiedLanguage:r,originalModelPath:s,modifiedModelPath:o,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:u="Loading...",options:d={},height:h="100%",width:f="100%",className:g,wrapperProps:p={},beforeMount:m=hI,onMount:_=hI}){let[v,y]=E.useState(!1),[C,x]=E.useState(!0),k=E.useRef(null),L=E.useRef(null),D=E.useRef(null),I=E.useRef(_),O=E.useRef(m),M=E.useRef(!1);n4e(()=>{let z=e4e.init();return z.then(q=>(L.current=q)&&x(!1)).catch(q=>q?.type!=="cancelation"&&console.error("Monaco initialization: error:",q)),()=>k.current?W():z.cancel()}),Ad(()=>{if(k.current&&L.current){let z=k.current.getOriginalEditor(),q=mS(L.current,n||"",i||t||"text",s||"");q!==z.getModel()&&z.setModel(q)}},[s],v),Ad(()=>{if(k.current&&L.current){let z=k.current.getModifiedEditor(),q=mS(L.current,e||"",r||t||"text",o||"");q!==z.getModel()&&z.setModel(q)}},[o],v),Ad(()=>{let z=k.current.getModifiedEditor();z.getOption(L.current.editor.EditorOption.readOnly)?z.setValue(e||""):e!==z.getValue()&&(z.executeEdits("",[{range:z.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),z.pushUndoStop())},[e],v),Ad(()=>{k.current?.getModel()?.original.setValue(n||"")},[n],v),Ad(()=>{let{original:z,modified:q}=k.current.getModel();L.current.editor.setModelLanguage(z,i||t||"text"),L.current.editor.setModelLanguage(q,r||t||"text")},[t,i,r],v),Ad(()=>{L.current?.editor.setTheme(c)},[c],v),Ad(()=>{k.current?.updateOptions(d)},[d],v);let B=E.useCallback(()=>{if(!L.current)return;O.current(L.current);let z=mS(L.current,n||"",i||t||"text",s||""),q=mS(L.current,e||"",r||t||"text",o||"");k.current?.setModel({original:z,modified:q})},[t,e,r,n,i,s,o]),G=E.useCallback(()=>{!M.current&&D.current&&(k.current=L.current.editor.createDiffEditor(D.current,{automaticLayout:!0,...d}),B(),L.current?.editor.setTheme(c),y(!0),M.current=!0)},[d,c,B]);E.useEffect(()=>{v&&I.current(k.current,L.current)},[v]),E.useEffect(()=>{!C&&!v&&G()},[C,v,G]);function W(){let z=k.current?.getModel();a||z?.original?.dispose(),l||z?.modified?.dispose(),k.current?.dispose()}return U.createElement(t4e,{width:f,height:h,isEditorReady:v,loading:u,_ref:D,className:g,wrapperProps:p})}var Ugt=zgt;E.memo(Ugt);function jgt(n){let e=E.useRef();return E.useEffect(()=>{e.current=n},[n]),e.current}var qgt=jgt,m4=new Map;function Kgt({defaultValue:n,defaultLanguage:e,defaultPath:t,value:i,language:r,path:s,theme:o="light",line:a,loading:l="Loading...",options:c={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:h=!1,width:f="100%",height:g="100%",className:p,wrapperProps:m={},beforeMount:_=hI,onMount:v=hI,onChange:y,onValidate:C=hI}){let[x,k]=E.useState(!1),[L,D]=E.useState(!0),I=E.useRef(null),O=E.useRef(null),M=E.useRef(null),B=E.useRef(v),G=E.useRef(_),W=E.useRef(),z=E.useRef(i),q=qgt(s),ee=E.useRef(!1),Z=E.useRef(!1);n4e(()=>{let le=e4e.init();return le.then(ue=>(I.current=ue)&&D(!1)).catch(ue=>ue?.type!=="cancelation"&&console.error("Monaco initialization: error:",ue)),()=>O.current?te():le.cancel()}),Ad(()=>{let le=mS(I.current,n||i||"",e||r||"",s||t||"");le!==O.current?.getModel()&&(d&&m4.set(q,O.current?.saveViewState()),O.current?.setModel(le),d&&O.current?.restoreViewState(m4.get(s)))},[s],x),Ad(()=>{O.current?.updateOptions(c)},[c],x),Ad(()=>{!O.current||i===void 0||(O.current.getOption(I.current.editor.EditorOption.readOnly)?O.current.setValue(i):i!==O.current.getValue()&&(Z.current=!0,O.current.executeEdits("",[{range:O.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),O.current.pushUndoStop(),Z.current=!1))},[i],x),Ad(()=>{let le=O.current?.getModel();le&&r&&I.current?.editor.setModelLanguage(le,r)},[r],x),Ad(()=>{a!==void 0&&O.current?.revealLine(a)},[a],x),Ad(()=>{I.current?.editor.setTheme(o)},[o],x);let j=E.useCallback(()=>{if(!(!M.current||!I.current)&&!ee.current){G.current(I.current);let le=s||t,ue=mS(I.current,i||n||"",e||r||"",le||"");O.current=I.current?.editor.create(M.current,{model:ue,automaticLayout:!0,...c},u),d&&O.current.restoreViewState(m4.get(le)),I.current.editor.setTheme(o),a!==void 0&&O.current.revealLine(a),k(!0),ee.current=!0}},[n,e,t,i,r,s,c,u,d,o,a]);E.useEffect(()=>{x&&B.current(O.current,I.current)},[x]),E.useEffect(()=>{!L&&!x&&j()},[L,x,j]),z.current=i,E.useEffect(()=>{x&&y&&(W.current?.dispose(),W.current=O.current?.onDidChangeModelContent(le=>{Z.current||y(O.current.getValue(),le)}))},[x,y]),E.useEffect(()=>{if(x){let le=I.current.editor.onDidChangeMarkers(ue=>{let de=O.current.getModel()?.uri;if(de&&ue.find(we=>we.path===de.path)){let we=I.current.editor.getModelMarkers({resource:de});C?.(we)}});return()=>{le?.dispose()}}return()=>{}},[x,C]);function te(){W.current?.dispose(),h?d&&m4.set(s,O.current.saveViewState()):O.current.getModel()?.dispose(),O.current.dispose()}return U.createElement(t4e,{width:f,height:g,isEditorReady:x,loading:l,_ref:M,className:p,wrapperProps:m})}var Ggt=Kgt,jFn=E.memo(Ggt);function yd(n,e=0){return n[n.length-(1+e)]}function Ygt(n){if(n.length===0)throw new Error("Invalid tail call");return[n.slice(0,n.length-1),n[n.length-1]]}function $r(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e||n.length!==e.length)return!1;for(let i=0,r=n.length;it(n[i],e))}function Xgt(n,e){let t=0,i=n-1;for(;t<=i;){const r=(t+i)/2|0,s=e(r);if(s<0)t=r+1;else if(s>0)i=r-1;else return r}return-(t+1)}function rZ(n,e,t){if(n=n|0,n>=e.length)throw new TypeError("invalid index");const i=e[Math.floor(e.length*Math.random())],r=[],s=[],o=[];for(const a of e){const l=t(a,i);l<0?r.push(a):l>0?s.push(a):o.push(a)}return n!!e)}function Lve(n){let e=0;for(let t=0;t0}function j_(n,e=t=>t){const t=new Set;return n.filter(i=>{const r=e(i);return t.has(r)?!1:(t.add(r),!0)})}function hae(n,e){return n.length>0?n[0]:e}function sc(n,e){let t=typeof e=="number"?n:0;typeof e=="number"?t=n:(t=0,e=n);const i=[];if(t<=e)for(let r=t;re;r--)i.push(r);return i}function I$(n,e,t){const i=n.slice(0,e),r=n.slice(e);return i.concat(t,r)}function uj(n,e){const t=n.indexOf(e);t>-1&&(n.splice(t,1),n.unshift(e))}function _4(n,e){const t=n.indexOf(e);t>-1&&(n.splice(t,1),n.push(e))}function sZ(n,e){for(const t of e)n.push(t)}function fae(n){return Array.isArray(n)?n:[n]}function Jgt(n,e,t){const i=o4e(n,e),r=n.length,s=t.length;n.length=r+s;for(let o=r-1;o>=i;o--)n[o+s]=n[o];for(let o=0;o0}n.isGreaterThan=i;function r(s){return s===0}n.isNeitherLessOrGreaterThan=r,n.greaterThan=1,n.lessThan=-1,n.neitherLessOrGreaterThan=0})(eN||(eN={}));function $l(n,e){return(t,i)=>e(n(t),n(i))}function ept(...n){return(e,t)=>{for(const i of n){const r=i(e,t);if(!eN.isNeitherLessOrGreaterThan(r))return r}return eN.neitherLessOrGreaterThan}}const Xh=(n,e)=>n-e,tpt=(n,e)=>Xh(n?1:0,e?1:0);function a4e(n){return(e,t)=>-n(e,t)}class q_{constructor(e){this.items=e,this.firstIdx=0,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(e){let t=this.firstIdx;for(;t=0&&e(this.items[t]);)t--;const i=t===this.lastIdx?null:this.items.slice(t+1,this.lastIdx+1);return this.lastIdx=t,i}peek(){if(this.length!==0)return this.items[this.firstIdx]}dequeue(){const e=this.items[this.firstIdx];return this.firstIdx++,e}takeCount(e){const t=this.items.slice(this.firstIdx,this.firstIdx+e);return this.firstIdx+=e,t}}class T_{static{this.empty=new T_(e=>{})}constructor(e){this.iterate=e}toArray(){const e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new T_(t=>this.iterate(i=>e(i)?t(i):!0))}map(e){return new T_(t=>this.iterate(i=>t(e(i))))}findLast(e){let t;return this.iterate(i=>(e(i)&&(t=i),!0)),t}findLastMaxBy(e){let t,i=!0;return this.iterate(r=>((i||eN.isGreaterThan(e(r,t)))&&(i=!1,t=r),!0)),t}}class T6{constructor(e){this._indexMap=e}static createSortPermutation(e,t){const i=Array.from(e.keys()).sort((r,s)=>t(e[r],e[s]));return new T6(i)}apply(e){return e.map((t,i)=>e[this._indexMap[i]])}inverse(){const e=this._indexMap.slice();for(let t=0;t"u"}function Bp(n){return!Bu(n)}function Bu(n){return ml(n)||n===null}function oi(n,e){if(!n)throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}function Lv(n){if(Bu(n))throw new Error("Assertion Failed: argument is undefined or null");return n}function tN(n){return typeof n=="function"}function ipt(n,e){const t=Math.min(n.length,e.length);for(let i=0;i{e[t]=i&&typeof i=="object"?Qm(i):i}),e}function spt(n){if(!n||typeof n!="object")return n;const e=[n];for(;e.length>0;){const t=e.shift();Object.freeze(t);for(const i in t)if(c4e.call(t,i)){const r=t[i];typeof r=="object"&&!Object.isFrozen(r)&&!npt(r)&&e.push(r)}}return n}const c4e=Object.prototype.hasOwnProperty;function u4e(n,e){return oZ(n,e,new Set)}function oZ(n,e,t){if(Bu(n))return n;const i=e(n);if(typeof i<"u")return i;if(Array.isArray(n)){const r=[];for(const s of n)r.push(oZ(s,e,t));return r}if(Mo(n)){if(t.has(n))throw new Error("Cannot clone recursive data-structure");t.add(n);const r={};for(const s in n)c4e.call(n,s)&&(r[s]=oZ(n[s],e,t));return t.delete(n),r}return n}function A$(n,e,t=!0){return Mo(n)?(Mo(e)&&Object.keys(e).forEach(i=>{i in n?t&&(Mo(n[i])&&Mo(e[i])?A$(n[i],e[i],t):n[i]=e[i]):n[i]=e[i]}),n):e}function ru(n,e){if(n===e)return!0;if(n==null||e===null||e===void 0||typeof n!=typeof e||typeof n!="object"||Array.isArray(n)!==Array.isArray(e))return!1;let t,i;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(t=0;tfunction(){const s=Array.prototype.slice.call(arguments,0);return e(r,s)},i={};for(const r of n)i[r]=t(r);return i}function d4e(){return globalThis._VSCODE_NLS_MESSAGES}function gae(){return globalThis._VSCODE_NLS_LANGUAGE}const lpt=gae()==="pseudo"||typeof document<"u"&&document.location&&document.location.hash.indexOf("pseudo=true")>=0;function D6(n,e){let t;return e.length===0?t=n:t=n.replace(/\{(\d+)\}/g,(i,r)=>{const s=r[0],o=e[s];let a=i;return typeof o=="string"?a=o:(typeof o=="number"||typeof o=="boolean"||o===void 0||o===null)&&(a=String(o)),a}),lpt&&(t="["+t.replace(/[aouei]/g,"$&$&")+"]"),t}function w(n,e,...t){return D6(typeof n=="number"?h4e(n,e):e,t)}function h4e(n,e){const t=d4e()?.[n];if(typeof t!="string"){if(typeof e=="string")return e;throw new Error(`!!! NLS MISSING: ${n} !!!`)}return t}function Gt(n,e,...t){let i;typeof n=="number"?i=h4e(n,e):i=e;const r=D6(i,t);return{value:r,original:e===i?r:D6(e,t)}}const _S="en";let I6=!1,A6=!1,P5=!1,f4e=!1,pae=!1,mae=!1,g4e=!1,v4,O5=_S,Ive=_S,cpt,Fm;const D_=globalThis;let Sd;typeof D_.vscode<"u"&&typeof D_.vscode.process<"u"?Sd=D_.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Sd=process);const upt=typeof Sd?.versions?.electron=="string",dpt=upt&&Sd?.type==="renderer";if(typeof Sd=="object"){I6=Sd.platform==="win32",A6=Sd.platform==="darwin",P5=Sd.platform==="linux",P5&&Sd.env.SNAP&&Sd.env.SNAP_REVISION,Sd.env.CI||Sd.env.BUILD_ARTIFACTSTAGINGDIRECTORY,v4=_S,O5=_S;const n=Sd.env.VSCODE_NLS_CONFIG;if(n)try{const e=JSON.parse(n);v4=e.userLocale,Ive=e.osLocale,O5=e.resolvedLanguage||_S,cpt=e.languagePack?.translationsConfigFile}catch{}f4e=!0}else typeof navigator=="object"&&!dpt?(Fm=navigator.userAgent,I6=Fm.indexOf("Windows")>=0,A6=Fm.indexOf("Macintosh")>=0,mae=(Fm.indexOf("Macintosh")>=0||Fm.indexOf("iPad")>=0||Fm.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,P5=Fm.indexOf("Linux")>=0,g4e=Fm?.indexOf("Mobi")>=0,pae=!0,O5=gae()||_S,v4=navigator.language.toLowerCase(),Ive=v4):console.error("Unable to resolve platform.");const Ta=I6,Rn=A6,zl=P5,hg=f4e,pC=pae,hpt=pae&&typeof D_.importScripts=="function",fpt=hpt?D_.origin:void 0,Sg=mae,p4e=g4e,Gp=Fm,gpt=O5,ppt=typeof D_.postMessage=="function"&&!D_.importScripts,m4e=(()=>{if(ppt){const n=[];D_.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,r=n.length;i{const i=++e;n.push({id:i,callback:t}),D_.postMessage({vscodeScheduleAsyncWork:i},"*")}}return n=>setTimeout(n)})(),eu=A6||mae?2:I6?1:3;let Ave=!0,Nve=!1;function _4e(){if(!Nve){Nve=!0;const n=new Uint8Array(2);n[0]=1,n[1]=2,Ave=new Uint16Array(n.buffer)[0]===513}return Ave}const v4e=!!(Gp&&Gp.indexOf("Chrome")>=0),mpt=!!(Gp&&Gp.indexOf("Firefox")>=0),_pt=!!(!v4e&&Gp&&Gp.indexOf("Safari")>=0),vpt=!!(Gp&&Gp.indexOf("Edg/")>=0),bpt=!!(Gp&&Gp.indexOf("Android")>=0),Va={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}};var zn;(function(n){function e(C){return C&&typeof C=="object"&&typeof C[Symbol.iterator]=="function"}n.is=e;const t=Object.freeze([]);function i(){return t}n.empty=i;function*r(C){yield C}n.single=r;function s(C){return e(C)?C:r(C)}n.wrap=s;function o(C){return C||t}n.from=o;function*a(C){for(let x=C.length-1;x>=0;x--)yield C[x]}n.reverse=a;function l(C){return!C||C[Symbol.iterator]().next().done===!0}n.isEmpty=l;function c(C){return C[Symbol.iterator]().next().value}n.first=c;function u(C,x){let k=0;for(const L of C)if(x(L,k++))return!0;return!1}n.some=u;function d(C,x){for(const k of C)if(x(k))return k}n.find=d;function*h(C,x){for(const k of C)x(k)&&(yield k)}n.filter=h;function*f(C,x){let k=0;for(const L of C)yield x(L,k++)}n.map=f;function*g(C,x){let k=0;for(const L of C)yield*x(L,k++)}n.flatMap=g;function*p(...C){for(const x of C)yield*x}n.concat=p;function m(C,x,k){let L=k;for(const D of C)L=x(L,D);return L}n.reduce=m;function*_(C,x,k=C.length){for(x<0&&(x+=C.length),k<0?k+=C.length:k>C.length&&(k=C.length);x{r||(r=!0,this._remove(i))}}shift(){if(this._first!==mo.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==mo.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==mo.Undefined&&e.next!==mo.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===mo.Undefined&&e.next===mo.Undefined?(this._first=mo.Undefined,this._last=mo.Undefined):e.next===mo.Undefined?(this._last=this._last.prev,this._last.next=mo.Undefined):e.prev===mo.Undefined&&(this._first=this._first.next,this._first.prev=mo.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==mo.Undefined;)yield e.element,e=e.next}}const N6="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function ypt(n=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(const t of N6)n.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}const _ae=ypt();function vae(n){let e=_ae;if(n&&n instanceof RegExp)if(n.global)e=n;else{let t="g";n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.unicode&&(t+="u"),e=new RegExp(n.source,t)}return e.lastIndex=0,e}const b4e=new Rl;b4e.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function nN(n,e,t,i,r){if(e=vae(e),r||(r=zn.first(b4e)),t.length>r.maxLen){let c=n-r.maxLen/2;return c<0?c=0:i+=c,t=t.substring(c,n+r.maxLen/2),nN(n,e,t,i,r)}const s=Date.now(),o=n-1-i;let a=-1,l=null;for(let c=1;!(Date.now()-s>=r.timeBudget);c++){const u=o-r.windowSize*c;e.lastIndex=Math.max(0,u);const d=wpt(e,t,o,a);if(!d&&l||(l=d,u<=0))break;a=u}if(l){const c={word:l[0],startColumn:i+1+l.index,endColumn:i+1+l.index+l[0].length};return e.lastIndex=0,c}return null}function wpt(n,e,t,i){let r;for(;r=n.exec(e);){const s=r.index||0;if(s<=t&&n.lastIndex>=t)return r;if(i>0&&s>i)return null}return null}const tp=8;class y4e{constructor(e){this._values=e}hasChanged(e){return this._values[e]}}class w4e{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}}class Rr{constructor(e,t,i,r){this.id=e,this.name=t,this.defaultValue=i,this.schema=r}applyUpdate(e,t){return N$(e,t)}compute(e,t,i){return i}}class fI{constructor(e,t){this.newValue=e,this.didChange=t}}function N$(n,e){if(typeof n!="object"||typeof e!="object"||!n||!e)return new fI(e,n!==e);if(Array.isArray(n)||Array.isArray(e)){const i=Array.isArray(n)&&Array.isArray(e)&&$r(n,e);return new fI(e,!i)}let t=!1;for(const i in e)if(e.hasOwnProperty(i)){const r=N$(n[i],e[i]);r.didChange&&(n[i]=r.newValue,t=!0)}return new fI(n,t)}class zP{constructor(e){this.schema=void 0,this.id=e,this.name="_never_",this.defaultValue=void 0}applyUpdate(e,t){return N$(e,t)}validate(e){return this.defaultValue}}class UL{constructor(e,t,i,r){this.id=e,this.name=t,this.defaultValue=i,this.schema=r}applyUpdate(e,t){return N$(e,t)}validate(e){return typeof e>"u"?this.defaultValue:e}compute(e,t,i){return i}}function Et(n,e){return typeof n>"u"?e:n==="false"?!1:!!n}class ni extends UL{constructor(e,t,i,r=void 0){typeof r<"u"&&(r.type="boolean",r.default=i),super(e,t,i,r)}validate(e){return Et(e,this.defaultValue)}}function V1(n,e,t,i){if(typeof n>"u")return e;let r=parseInt(n,10);return isNaN(r)?e:(r=Math.max(t,r),r=Math.min(i,r),r|0)}class rr extends UL{static clampedInt(e,t,i,r){return V1(e,t,i,r)}constructor(e,t,i,r,s,o=void 0){typeof o<"u"&&(o.type="integer",o.default=i,o.minimum=r,o.maximum=s),super(e,t,i,o),this.minimum=r,this.maximum=s}validate(e){return rr.clampedInt(e,this.defaultValue,this.minimum,this.maximum)}}function Cpt(n,e,t,i){if(typeof n>"u")return e;const r=Uu.float(n,e);return Uu.clamp(r,t,i)}class Uu extends UL{static clamp(e,t,i){return ei?i:e}static float(e,t){if(typeof e=="number")return e;if(typeof e>"u")return t;const i=parseFloat(e);return isNaN(i)?t:i}constructor(e,t,i,r,s){typeof s<"u"&&(s.type="number",s.default=i),super(e,t,i,s),this.validationFn=r}validate(e){return this.validationFn(Uu.float(e,this.defaultValue))}}class fl extends UL{static string(e,t){return typeof e!="string"?t:e}constructor(e,t,i,r=void 0){typeof r<"u"&&(r.type="string",r.default=i),super(e,t,i,r)}validate(e){return fl.string(e,this.defaultValue)}}function is(n,e,t,i){return typeof n!="string"?e:i&&n in i?i[n]:t.indexOf(n)===-1?e:n}class ns extends UL{constructor(e,t,i,r,s=void 0){typeof s<"u"&&(s.type="string",s.enum=r,s.default=i),super(e,t,i,s),this._allowedValues=r}validate(e){return is(e,this.defaultValue,this._allowedValues)}}class b4 extends Rr{constructor(e,t,i,r,s,o,a=void 0){typeof a<"u"&&(a.type="string",a.enum=s,a.default=r),super(e,t,i,a),this._allowedValues=s,this._convert=o}validate(e){return typeof e!="string"?this.defaultValue:this._allowedValues.indexOf(e)===-1?this.defaultValue:this._convert(e)}}function xpt(n){switch(n){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}class Spt extends Rr{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[w("accessibilitySupport.auto","Use platform APIs to detect when a Screen Reader is attached."),w("accessibilitySupport.on","Optimize for usage with a Screen Reader."),w("accessibilitySupport.off","Assume a screen reader is not attached.")],default:"auto",tags:["accessibility"],description:w("accessibilitySupport","Controls if the UI should run in a mode where it is optimized for screen readers.")})}validate(e){switch(e){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(e,t,i){return i===0?e.accessibilitySupport:i}}class kpt extends Rr{constructor(){const e={insertSpace:!0,ignoreEmptyLines:!0};super(23,"comments",e,{"editor.comments.insertSpace":{type:"boolean",default:e.insertSpace,description:w("comments.insertSpace","Controls whether a space character is inserted when commenting.")},"editor.comments.ignoreEmptyLines":{type:"boolean",default:e.ignoreEmptyLines,description:w("comments.ignoreEmptyLines","Controls if empty lines should be ignored with toggle, add or remove actions for line comments.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{insertSpace:Et(t.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:Et(t.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}}function Ept(n){switch(n){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}var Yo;(function(n){n[n.Line=1]="Line",n[n.Block=2]="Block",n[n.Underline=3]="Underline",n[n.LineThin=4]="LineThin",n[n.BlockOutline=5]="BlockOutline",n[n.UnderlineThin=6]="UnderlineThin"})(Yo||(Yo={}));function Lpt(n){switch(n){case"line":return Yo.Line;case"block":return Yo.Block;case"underline":return Yo.Underline;case"line-thin":return Yo.LineThin;case"block-outline":return Yo.BlockOutline;case"underline-thin":return Yo.UnderlineThin}}class Tpt extends zP{constructor(){super(143)}compute(e,t,i){const r=["monaco-editor"];return t.get(39)&&r.push(t.get(39)),e.extraEditorClassName&&r.push(e.extraEditorClassName),t.get(74)==="default"?r.push("mouse-default"):t.get(74)==="copy"&&r.push("mouse-copy"),t.get(112)&&r.push("showUnused"),t.get(141)&&r.push("showDeprecated"),r.join(" ")}}class Dpt extends ni{constructor(){super(37,"emptySelectionClipboard",!0,{description:w("emptySelectionClipboard","Controls whether copying without a selection copies the current line.")})}compute(e,t,i){return i&&e.emptySelectionClipboard}}class Ipt extends Rr{constructor(){const e={cursorMoveOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0};super(41,"find",e,{"editor.find.cursorMoveOnType":{type:"boolean",default:e.cursorMoveOnType,description:w("find.cursorMoveOnType","Controls whether the cursor should jump to find matches while typing.")},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:e.seedSearchStringFromSelection,enumDescriptions:[w("editor.find.seedSearchStringFromSelection.never","Never seed search string from the editor selection."),w("editor.find.seedSearchStringFromSelection.always","Always seed search string from the editor selection, including word at cursor position."),w("editor.find.seedSearchStringFromSelection.selection","Only seed search string from the editor selection.")],description:w("find.seedSearchStringFromSelection","Controls whether the search string in the Find Widget is seeded from the editor selection.")},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:e.autoFindInSelection,enumDescriptions:[w("editor.find.autoFindInSelection.never","Never turn on Find in Selection automatically (default)."),w("editor.find.autoFindInSelection.always","Always turn on Find in Selection automatically."),w("editor.find.autoFindInSelection.multiline","Turn on Find in Selection automatically when multiple lines of content are selected.")],description:w("find.autoFindInSelection","Controls the condition for turning on Find in Selection automatically.")},"editor.find.globalFindClipboard":{type:"boolean",default:e.globalFindClipboard,description:w("find.globalFindClipboard","Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),included:Rn},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:e.addExtraSpaceOnTop,description:w("find.addExtraSpaceOnTop","Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")},"editor.find.loop":{type:"boolean",default:e.loop,description:w("find.loop","Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{cursorMoveOnType:Et(t.cursorMoveOnType,this.defaultValue.cursorMoveOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":is(t.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":is(t.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:Et(t.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:Et(t.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:Et(t.loop,this.defaultValue.loop)}}}class zh extends Rr{static{this.OFF='"liga" off, "calt" off'}static{this.ON='"liga" on, "calt" on'}constructor(){super(51,"fontLigatures",zh.OFF,{anyOf:[{type:"boolean",description:w("fontLigatures","Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.")},{type:"string",description:w("fontFeatureSettings","Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")}],description:w("fontLigaturesGeneral","Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"||e.length===0?zh.OFF:e==="true"?zh.ON:e:e?zh.ON:zh.OFF}}class i_ extends Rr{static{this.OFF="normal"}static{this.TRANSLATE="translate"}constructor(){super(54,"fontVariations",i_.OFF,{anyOf:[{type:"boolean",description:w("fontVariations","Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property.")},{type:"string",description:w("fontVariationSettings","Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.")}],description:w("fontVariationsGeneral","Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"?i_.OFF:e==="true"?i_.TRANSLATE:e:e?i_.TRANSLATE:i_.OFF}compute(e,t,i){return e.fontInfo.fontVariationSettings}}class Apt extends zP{constructor(){super(50)}compute(e,t,i){return e.fontInfo}}class Npt extends UL{constructor(){super(52,"fontSize",Wl.fontSize,{type:"number",minimum:6,maximum:100,default:Wl.fontSize,description:w("fontSize","Controls the font size in pixels.")})}validate(e){const t=Uu.float(e,this.defaultValue);return t===0?Wl.fontSize:Uu.clamp(t,6,100)}compute(e,t,i){return e.fontInfo.fontSize}}class ay extends Rr{static{this.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"]}static{this.MINIMUM_VALUE=1}static{this.MAXIMUM_VALUE=1e3}constructor(){super(53,"fontWeight",Wl.fontWeight,{anyOf:[{type:"number",minimum:ay.MINIMUM_VALUE,maximum:ay.MAXIMUM_VALUE,errorMessage:w("fontWeightErrorMessage",'Only "normal" and "bold" keywords or numbers between 1 and 1000 are allowed.')},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:ay.SUGGESTION_VALUES}],default:Wl.fontWeight,description:w("fontWeight",'Controls the font weight. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.')})}validate(e){return e==="normal"||e==="bold"?e:String(rr.clampedInt(e,Wl.fontWeight,ay.MINIMUM_VALUE,ay.MAXIMUM_VALUE))}}class Rpt extends Rr{constructor(){const e={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",multipleTests:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:"",alternativeTestsCommand:""},t={type:"string",enum:["peek","gotoAndPeek","goto"],default:e.multiple,enumDescriptions:[w("editor.gotoLocation.multiple.peek","Show Peek view of the results (default)"),w("editor.gotoLocation.multiple.gotoAndPeek","Go to the primary result and show a Peek view"),w("editor.gotoLocation.multiple.goto","Go to the primary result and enable Peek-less navigation to others")]},i=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(58,"gotoLocation",e,{"editor.gotoLocation.multiple":{deprecationMessage:w("editor.gotoLocation.multiple.deprecated","This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.")},"editor.gotoLocation.multipleDefinitions":{description:w("editor.editor.gotoLocation.multipleDefinitions","Controls the behavior the 'Go to Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleTypeDefinitions":{description:w("editor.editor.gotoLocation.multipleTypeDefinitions","Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleDeclarations":{description:w("editor.editor.gotoLocation.multipleDeclarations","Controls the behavior the 'Go to Declaration'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleImplementations":{description:w("editor.editor.gotoLocation.multipleImplemenattions","Controls the behavior the 'Go to Implementations'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleReferences":{description:w("editor.editor.gotoLocation.multipleReferences","Controls the behavior the 'Go to References'-command when multiple target locations exist."),...t},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:e.alternativeDefinitionCommand,enum:i,description:w("alternativeDefinitionCommand","Alternative command id that is being executed when the result of 'Go to Definition' is the current location.")},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:e.alternativeTypeDefinitionCommand,enum:i,description:w("alternativeTypeDefinitionCommand","Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.")},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:e.alternativeDeclarationCommand,enum:i,description:w("alternativeDeclarationCommand","Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.")},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:e.alternativeImplementationCommand,enum:i,description:w("alternativeImplementationCommand","Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.")},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:e.alternativeReferenceCommand,enum:i,description:w("alternativeReferenceCommand","Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{multiple:is(t.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:t.multipleDefinitions??is(t.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:t.multipleTypeDefinitions??is(t.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:t.multipleDeclarations??is(t.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:t.multipleImplementations??is(t.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:t.multipleReferences??is(t.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:t.multipleTests??is(t.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:fl.string(t.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:fl.string(t.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:fl.string(t.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:fl.string(t.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:fl.string(t.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:fl.string(t.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}}class Ppt extends Rr{constructor(){const e={enabled:!0,delay:300,hidingDelay:300,sticky:!0,above:!0};super(60,"hover",e,{"editor.hover.enabled":{type:"boolean",default:e.enabled,description:w("hover.enabled","Controls whether the hover is shown.")},"editor.hover.delay":{type:"number",default:e.delay,minimum:0,maximum:1e4,description:w("hover.delay","Controls the delay in milliseconds after which the hover is shown.")},"editor.hover.sticky":{type:"boolean",default:e.sticky,description:w("hover.sticky","Controls whether the hover should remain visible when mouse is moved over it.")},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:e.hidingDelay,description:w("hover.hidingDelay","Controls the delay in milliseconds after which the hover is hidden. Requires `editor.hover.sticky` to be enabled.")},"editor.hover.above":{type:"boolean",default:e.above,description:w("hover.above","Prefer showing hovers above the line, if there's space.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),delay:rr.clampedInt(t.delay,this.defaultValue.delay,0,1e4),sticky:Et(t.sticky,this.defaultValue.sticky),hidingDelay:rr.clampedInt(t.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:Et(t.above,this.defaultValue.above)}}}class sk extends zP{constructor(){super(146)}compute(e,t,i){return sk.computeLayout(t,{memory:e.memory,outerWidth:e.outerWidth,outerHeight:e.outerHeight,isDominatedByLongLines:e.isDominatedByLongLines,lineHeight:e.fontInfo.lineHeight,viewLineCount:e.viewLineCount,lineNumbersDigitCount:e.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:e.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:e.fontInfo.maxDigitWidth,pixelRatio:e.pixelRatio,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(e){const t=e.height/e.lineHeight,i=Math.floor(e.paddingTop/e.lineHeight);let r=Math.floor(e.paddingBottom/e.lineHeight);e.scrollBeyondLastLine&&(r=Math.max(r,t-1));const s=(i+e.viewLineCount+r)/(e.pixelRatio*e.height),o=Math.floor(e.viewLineCount/s);return{typicalViewportLineCount:t,extraLinesBeforeFirstLine:i,extraLinesBeyondLastLine:r,desiredRatio:s,minimapLineCount:o}}static _computeMinimapLayout(e,t){const i=e.outerWidth,r=e.outerHeight,s=e.pixelRatio;if(!e.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(s*r),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:r};const o=t.stableMinimapLayoutInput,a=o&&e.outerHeight===o.outerHeight&&e.lineHeight===o.lineHeight&&e.typicalHalfwidthCharacterWidth===o.typicalHalfwidthCharacterWidth&&e.pixelRatio===o.pixelRatio&&e.scrollBeyondLastLine===o.scrollBeyondLastLine&&e.paddingTop===o.paddingTop&&e.paddingBottom===o.paddingBottom&&e.minimap.enabled===o.minimap.enabled&&e.minimap.side===o.minimap.side&&e.minimap.size===o.minimap.size&&e.minimap.showSlider===o.minimap.showSlider&&e.minimap.renderCharacters===o.minimap.renderCharacters&&e.minimap.maxColumn===o.minimap.maxColumn&&e.minimap.scale===o.minimap.scale&&e.verticalScrollbarWidth===o.verticalScrollbarWidth&&e.isViewportWrapping===o.isViewportWrapping,l=e.lineHeight,c=e.typicalHalfwidthCharacterWidth,u=e.scrollBeyondLastLine,d=e.minimap.renderCharacters;let h=s>=2?Math.round(e.minimap.scale*2):e.minimap.scale;const f=e.minimap.maxColumn,g=e.minimap.size,p=e.minimap.side,m=e.verticalScrollbarWidth,_=e.viewLineCount,v=e.remainingWidth,y=e.isViewportWrapping,C=d?2:3;let x=Math.floor(s*r);const k=x/s;let L=!1,D=!1,I=C*h,O=h/s,M=1;if(g==="fill"||g==="fit"){const{typicalViewportLineCount:Z,extraLinesBeforeFirstLine:j,extraLinesBeyondLastLine:te,desiredRatio:le,minimapLineCount:ue}=sk.computeContainedMinimapLineCount({viewLineCount:_,scrollBeyondLastLine:u,paddingTop:e.paddingTop,paddingBottom:e.paddingBottom,height:r,lineHeight:l,pixelRatio:s});if(_/ue>1)L=!0,D=!0,h=1,I=1,O=h/s;else{let we=!1,xe=h+1;if(g==="fit"){const Me=Math.ceil((j+_+te)*I);y&&a&&v<=t.stableFitRemainingWidth?(we=!0,xe=t.stableFitMaxMinimapScale):we=Me>x}if(g==="fill"||we){L=!0;const Me=h;I=Math.min(l*s,Math.max(1,Math.floor(1/le))),y&&a&&v<=t.stableFitRemainingWidth&&(xe=t.stableFitMaxMinimapScale),h=Math.min(xe,Math.max(1,Math.floor(I/C))),h>Me&&(M=Math.min(2,h/Me)),O=h/s/M,x=Math.ceil(Math.max(Z,j+_+te)*I),y?(t.stableMinimapLayoutInput=e,t.stableFitRemainingWidth=v,t.stableFitMaxMinimapScale=h):(t.stableMinimapLayoutInput=null,t.stableFitRemainingWidth=0)}}}const B=Math.floor(f*O),G=Math.min(B,Math.max(0,Math.floor((v-m-2)*O/(c+O)))+tp);let W=Math.floor(s*G);const z=W/s;W=Math.floor(W*M);const q=d?1:2,ee=p==="left"?0:i-G-m;return{renderMinimap:q,minimapLeft:ee,minimapWidth:G,minimapHeightIsEditorHeight:L,minimapIsSampling:D,minimapScale:h,minimapLineHeight:I,minimapCanvasInnerWidth:W,minimapCanvasInnerHeight:x,minimapCanvasOuterWidth:z,minimapCanvasOuterHeight:k}}static computeLayout(e,t){const i=t.outerWidth|0,r=t.outerHeight|0,s=t.lineHeight|0,o=t.lineNumbersDigitCount|0,a=t.typicalHalfwidthCharacterWidth,l=t.maxDigitWidth,c=t.pixelRatio,u=t.viewLineCount,d=e.get(138),h=d==="inherit"?e.get(137):d,f=h==="inherit"?e.get(133):h,g=e.get(136),p=t.isDominatedByLongLines,m=e.get(57),_=e.get(68).renderType!==0,v=e.get(69),y=e.get(106),C=e.get(84),x=e.get(73),k=e.get(104),L=k.verticalScrollbarSize,D=k.verticalHasArrows,I=k.arrowSize,O=k.horizontalScrollbarSize,M=e.get(43),B=e.get(111)!=="never";let G=e.get(66);M&&B&&(G+=16);let W=0;if(_){const _t=Math.max(o,v);W=Math.round(_t*l)}let z=0;m&&(z=s*t.glyphMarginDecorationLaneCount);let q=0,ee=q+z,Z=ee+W,j=Z+G;const te=i-z-W-G;let le=!1,ue=!1,de=-1;h==="inherit"&&p?(le=!0,ue=!0):f==="on"||f==="bounded"?ue=!0:f==="wordWrapColumn"&&(de=g);const we=sk._computeMinimapLayout({outerWidth:i,outerHeight:r,lineHeight:s,typicalHalfwidthCharacterWidth:a,pixelRatio:c,scrollBeyondLastLine:y,paddingTop:C.top,paddingBottom:C.bottom,minimap:x,verticalScrollbarWidth:L,viewLineCount:u,remainingWidth:te,isViewportWrapping:ue},t.memory||new w4e);we.renderMinimap!==0&&we.minimapLeft===0&&(q+=we.minimapWidth,ee+=we.minimapWidth,Z+=we.minimapWidth,j+=we.minimapWidth);const xe=te-we.minimapWidth,Me=Math.max(1,Math.floor((xe-L-2)/a)),Re=D?I:0;return ue&&(de=Math.max(1,Me),f==="bounded"&&(de=Math.min(de,g))),{width:i,height:r,glyphMarginLeft:q,glyphMarginWidth:z,glyphMarginDecorationLaneCount:t.glyphMarginDecorationLaneCount,lineNumbersLeft:ee,lineNumbersWidth:W,decorationsLeft:Z,decorationsWidth:G,contentLeft:j,contentWidth:xe,minimap:we,viewportColumn:Me,isWordWrapMinified:le,isViewportWrapping:ue,wrappingColumn:de,verticalScrollbarWidth:L,horizontalScrollbarHeight:O,overviewRuler:{top:Re,width:L,height:r-2*Re,right:0}}}}class Opt extends Rr{constructor(){super(140,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[w("wrappingStrategy.simple","Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."),w("wrappingStrategy.advanced","Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.")],type:"string",enum:["simple","advanced"],default:"simple",description:w("wrappingStrategy","Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.")}})}validate(e){return is(e,"simple",["simple","advanced"])}compute(e,t,i){return t.get(2)===2?"advanced":i}}var Oh;(function(n){n.Off="off",n.OnCode="onCode",n.On="on"})(Oh||(Oh={}));class Mpt extends Rr{constructor(){const e={enabled:Oh.OnCode};super(65,"lightbulb",e,{"editor.lightbulb.enabled":{type:"string",tags:["experimental"],enum:[Oh.Off,Oh.OnCode,Oh.On],default:e.enabled,enumDescriptions:[w("editor.lightbulb.enabled.off","Disable the code action menu."),w("editor.lightbulb.enabled.onCode","Show the code action menu when the cursor is on lines with code."),w("editor.lightbulb.enabled.on","Show the code action menu when the cursor is on lines with code or on empty lines.")],description:w("enabled","Enables the Code Action lightbulb in the editor.")}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{enabled:is(e.enabled,this.defaultValue.enabled,[Oh.Off,Oh.OnCode,Oh.On])}}}class Fpt extends Rr{constructor(){const e={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(116,"stickyScroll",e,{"editor.stickyScroll.enabled":{type:"boolean",default:e.enabled,description:w("editor.stickyScroll.enabled","Shows the nested current scopes during the scroll at the top of the editor."),tags:["experimental"]},"editor.stickyScroll.maxLineCount":{type:"number",default:e.maxLineCount,minimum:1,maximum:20,description:w("editor.stickyScroll.maxLineCount","Defines the maximum number of sticky lines to show.")},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:e.defaultModel,description:w("editor.stickyScroll.defaultModel","Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.")},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:e.scrollWithEditor,description:w("editor.stickyScroll.scrollWithEditor","Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),maxLineCount:rr.clampedInt(t.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:is(t.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:Et(t.scrollWithEditor,this.defaultValue.scrollWithEditor)}}}class Bpt extends Rr{constructor(){const e={enabled:"on",fontSize:0,fontFamily:"",padding:!1};super(142,"inlayHints",e,{"editor.inlayHints.enabled":{type:"string",default:e.enabled,description:w("inlayHints.enable","Enables the inlay hints in the editor."),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[w("editor.inlayHints.on","Inlay hints are enabled"),w("editor.inlayHints.onUnlessPressed","Inlay hints are showing by default and hide when holding {0}",Rn?"Ctrl+Option":"Ctrl+Alt"),w("editor.inlayHints.offUnlessPressed","Inlay hints are hidden by default and show when holding {0}",Rn?"Ctrl+Option":"Ctrl+Alt"),w("editor.inlayHints.off","Inlay hints are disabled")]},"editor.inlayHints.fontSize":{type:"number",default:e.fontSize,markdownDescription:w("inlayHints.fontSize","Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.","`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:e.fontFamily,markdownDescription:w("inlayHints.fontFamily","Controls font family of inlay hints in the editor. When set to empty, the {0} is used.","`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:e.padding,description:w("inlayHints.padding","Enables the padding around the inlay hints in the editor.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return typeof t.enabled=="boolean"&&(t.enabled=t.enabled?"on":"off"),{enabled:is(t.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:rr.clampedInt(t.fontSize,this.defaultValue.fontSize,0,100),fontFamily:fl.string(t.fontFamily,this.defaultValue.fontFamily),padding:Et(t.padding,this.defaultValue.padding)}}}class $pt extends Rr{constructor(){super(66,"lineDecorationsWidth",10)}validate(e){return typeof e=="string"&&/^\d+(\.\d+)?ch$/.test(e)?-parseFloat(e.substring(0,e.length-2)):rr.clampedInt(e,this.defaultValue,0,1e3)}compute(e,t,i){return i<0?rr.clampedInt(-i*e.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):i}}class Wpt extends Uu{constructor(){super(67,"lineHeight",Wl.lineHeight,e=>Uu.clamp(e,0,150),{markdownDescription:w("lineHeight",`Controls the line height. - Use 0 to automatically compute the line height from the font size. - Values between 0 and 8 will be used as a multiplier with the font size. - Values greater than or equal to 8 will be used as effective values.`)})}compute(e,t,i){return e.fontInfo.lineHeight}}class Hpt extends Rr{constructor(){const e={enabled:!0,size:"proportional",side:"right",showSlider:"mouseover",autohide:!1,renderCharacters:!0,maxColumn:120,scale:1,showRegionSectionHeaders:!0,showMarkSectionHeaders:!0,sectionHeaderFontSize:9,sectionHeaderLetterSpacing:1};super(73,"minimap",e,{"editor.minimap.enabled":{type:"boolean",default:e.enabled,description:w("minimap.enabled","Controls whether the minimap is shown.")},"editor.minimap.autohide":{type:"boolean",default:e.autohide,description:w("minimap.autohide","Controls whether the minimap is hidden automatically.")},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[w("minimap.size.proportional","The minimap has the same size as the editor contents (and might scroll)."),w("minimap.size.fill","The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling)."),w("minimap.size.fit","The minimap will shrink as necessary to never be larger than the editor (no scrolling).")],default:e.size,description:w("minimap.size","Controls the size of the minimap.")},"editor.minimap.side":{type:"string",enum:["left","right"],default:e.side,description:w("minimap.side","Controls the side where to render the minimap.")},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:e.showSlider,description:w("minimap.showSlider","Controls when the minimap slider is shown.")},"editor.minimap.scale":{type:"number",default:e.scale,minimum:1,maximum:3,enum:[1,2,3],description:w("minimap.scale","Scale of content drawn in the minimap: 1, 2 or 3.")},"editor.minimap.renderCharacters":{type:"boolean",default:e.renderCharacters,description:w("minimap.renderCharacters","Render the actual characters on a line as opposed to color blocks.")},"editor.minimap.maxColumn":{type:"number",default:e.maxColumn,description:w("minimap.maxColumn","Limit the width of the minimap to render at most a certain number of columns.")},"editor.minimap.showRegionSectionHeaders":{type:"boolean",default:e.showRegionSectionHeaders,description:w("minimap.showRegionSectionHeaders","Controls whether named regions are shown as section headers in the minimap.")},"editor.minimap.showMarkSectionHeaders":{type:"boolean",default:e.showMarkSectionHeaders,description:w("minimap.showMarkSectionHeaders","Controls whether MARK: comments are shown as section headers in the minimap.")},"editor.minimap.sectionHeaderFontSize":{type:"number",default:e.sectionHeaderFontSize,description:w("minimap.sectionHeaderFontSize","Controls the font size of section headers in the minimap.")},"editor.minimap.sectionHeaderLetterSpacing":{type:"number",default:e.sectionHeaderLetterSpacing,description:w("minimap.sectionHeaderLetterSpacing","Controls the amount of space (in pixels) between characters of section header. This helps the readability of the header in small font sizes.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),autohide:Et(t.autohide,this.defaultValue.autohide),size:is(t.size,this.defaultValue.size,["proportional","fill","fit"]),side:is(t.side,this.defaultValue.side,["right","left"]),showSlider:is(t.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:Et(t.renderCharacters,this.defaultValue.renderCharacters),scale:rr.clampedInt(t.scale,1,1,3),maxColumn:rr.clampedInt(t.maxColumn,this.defaultValue.maxColumn,1,1e4),showRegionSectionHeaders:Et(t.showRegionSectionHeaders,this.defaultValue.showRegionSectionHeaders),showMarkSectionHeaders:Et(t.showMarkSectionHeaders,this.defaultValue.showMarkSectionHeaders),sectionHeaderFontSize:Uu.clamp(t.sectionHeaderFontSize??this.defaultValue.sectionHeaderFontSize,4,32),sectionHeaderLetterSpacing:Uu.clamp(t.sectionHeaderLetterSpacing??this.defaultValue.sectionHeaderLetterSpacing,0,5)}}}function Vpt(n){return n==="ctrlCmd"?Rn?"metaKey":"ctrlKey":"altKey"}class zpt extends Rr{constructor(){super(84,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:w("padding.top","Controls the amount of space between the top edge of the editor and the first line.")},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:w("padding.bottom","Controls the amount of space between the bottom edge of the editor and the last line.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{top:rr.clampedInt(t.top,0,0,1e3),bottom:rr.clampedInt(t.bottom,0,0,1e3)}}}class Upt extends Rr{constructor(){const e={enabled:!0,cycle:!0};super(86,"parameterHints",e,{"editor.parameterHints.enabled":{type:"boolean",default:e.enabled,description:w("parameterHints.enabled","Enables a pop-up that shows parameter documentation and type information as you type.")},"editor.parameterHints.cycle":{type:"boolean",default:e.cycle,description:w("parameterHints.cycle","Controls whether the parameter hints menu cycles or closes when reaching the end of the list.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),cycle:Et(t.cycle,this.defaultValue.cycle)}}}class jpt extends zP{constructor(){super(144)}compute(e,t,i){return e.pixelRatio}}class qpt extends Rr{constructor(){super(88,"placeholder",void 0)}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e:this.defaultValue}}class Kpt extends Rr{constructor(){const e={other:"on",comments:"off",strings:"off"},t=[{type:"boolean"},{type:"string",enum:["on","inline","off"],enumDescriptions:[w("on","Quick suggestions show inside the suggest widget"),w("inline","Quick suggestions show as ghost text"),w("off","Quick suggestions are disabled")]}];super(90,"quickSuggestions",e,{type:"object",additionalProperties:!1,properties:{strings:{anyOf:t,default:e.strings,description:w("quickSuggestions.strings","Enable quick suggestions inside strings.")},comments:{anyOf:t,default:e.comments,description:w("quickSuggestions.comments","Enable quick suggestions inside comments.")},other:{anyOf:t,default:e.other,description:w("quickSuggestions.other","Enable quick suggestions outside of strings and comments.")}},default:e,markdownDescription:w("quickSuggestions","Controls whether suggestions should automatically show up while typing. This can be controlled for typing in comments, strings, and other code. Quick suggestion can be configured to show as ghost text or with the suggest widget. Also be aware of the {0}-setting which controls if suggestions are triggered by special characters.","`#editor.suggestOnTriggerCharacters#`")}),this.defaultValue=e}validate(e){if(typeof e=="boolean"){const c=e?"on":"off";return{comments:c,strings:c,other:c}}if(!e||typeof e!="object")return this.defaultValue;const{other:t,comments:i,strings:r}=e,s=["on","inline","off"];let o,a,l;return typeof t=="boolean"?o=t?"on":"off":o=is(t,this.defaultValue.other,s),typeof i=="boolean"?a=i?"on":"off":a=is(i,this.defaultValue.comments,s),typeof r=="boolean"?l=r?"on":"off":l=is(r,this.defaultValue.strings,s),{other:o,comments:a,strings:l}}}class Gpt extends Rr{constructor(){super(68,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[w("lineNumbers.off","Line numbers are not rendered."),w("lineNumbers.on","Line numbers are rendered as absolute number."),w("lineNumbers.relative","Line numbers are rendered as distance in lines to cursor position."),w("lineNumbers.interval","Line numbers are rendered every 10 lines.")],default:"on",description:w("lineNumbers","Controls the display of line numbers.")})}validate(e){let t=this.defaultValue.renderType,i=this.defaultValue.renderFn;return typeof e<"u"&&(typeof e=="function"?(t=4,i=e):e==="interval"?t=3:e==="relative"?t=2:e==="on"?t=1:t=0),{renderType:t,renderFn:i}}}function R6(n){const e=n.get(99);return e==="editable"?n.get(92):e!=="on"}class Ypt extends Rr{constructor(){const e=[],t={type:"number",description:w("rulers.size","Number of monospace characters at which this editor ruler will render.")};super(103,"rulers",e,{type:"array",items:{anyOf:[t,{type:["object"],properties:{column:t,color:{type:"string",description:w("rulers.color","Color of this editor ruler."),format:"color-hex"}}}]},default:e,description:w("rulers","Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.")})}validate(e){if(Array.isArray(e)){const t=[];for(const i of e)if(typeof i=="number")t.push({column:rr.clampedInt(i,0,0,1e4),color:null});else if(i&&typeof i=="object"){const r=i;t.push({column:rr.clampedInt(r.column,0,0,1e4),color:r.color})}return t.sort((i,r)=>i.column-r.column),t}return this.defaultValue}}class Zpt extends Rr{constructor(){super(93,"readOnlyMessage",void 0)}validate(e){return!e||typeof e!="object"?this.defaultValue:e}}function Rve(n,e){if(typeof n!="string")return e;switch(n){case"hidden":return 2;case"visible":return 3;default:return 1}}let Xpt=class extends Rr{constructor(){const e={vertical:1,horizontal:1,arrowSize:11,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,horizontalScrollbarSize:12,horizontalSliderSize:12,verticalScrollbarSize:14,verticalSliderSize:14,handleMouseWheel:!0,alwaysConsumeMouseWheel:!0,scrollByPage:!1,ignoreHorizontalScrollbarInContentHeight:!1};super(104,"scrollbar",e,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[w("scrollbar.vertical.auto","The vertical scrollbar will be visible only when necessary."),w("scrollbar.vertical.visible","The vertical scrollbar will always be visible."),w("scrollbar.vertical.fit","The vertical scrollbar will always be hidden.")],default:"auto",description:w("scrollbar.vertical","Controls the visibility of the vertical scrollbar.")},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[w("scrollbar.horizontal.auto","The horizontal scrollbar will be visible only when necessary."),w("scrollbar.horizontal.visible","The horizontal scrollbar will always be visible."),w("scrollbar.horizontal.fit","The horizontal scrollbar will always be hidden.")],default:"auto",description:w("scrollbar.horizontal","Controls the visibility of the horizontal scrollbar.")},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:e.verticalScrollbarSize,description:w("scrollbar.verticalScrollbarSize","The width of the vertical scrollbar.")},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:e.horizontalScrollbarSize,description:w("scrollbar.horizontalScrollbarSize","The height of the horizontal scrollbar.")},"editor.scrollbar.scrollByPage":{type:"boolean",default:e.scrollByPage,description:w("scrollbar.scrollByPage","Controls whether clicks scroll by page or jump to click position.")},"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight":{type:"boolean",default:e.ignoreHorizontalScrollbarInContentHeight,description:w("scrollbar.ignoreHorizontalScrollbarInContentHeight","When set, the horizontal scrollbar will not increase the size of the editor's content.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e,i=rr.clampedInt(t.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),r=rr.clampedInt(t.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:rr.clampedInt(t.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:Rve(t.vertical,this.defaultValue.vertical),horizontal:Rve(t.horizontal,this.defaultValue.horizontal),useShadows:Et(t.useShadows,this.defaultValue.useShadows),verticalHasArrows:Et(t.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:Et(t.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:Et(t.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:Et(t.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:i,horizontalSliderSize:rr.clampedInt(t.horizontalSliderSize,i,0,1e3),verticalScrollbarSize:r,verticalSliderSize:rr.clampedInt(t.verticalSliderSize,r,0,1e3),scrollByPage:Et(t.scrollByPage,this.defaultValue.scrollByPage),ignoreHorizontalScrollbarInContentHeight:Et(t.ignoreHorizontalScrollbarInContentHeight,this.defaultValue.ignoreHorizontalScrollbarInContentHeight)}}};const Iu="inUntrustedWorkspace",cc={allowedCharacters:"editor.unicodeHighlight.allowedCharacters",invisibleCharacters:"editor.unicodeHighlight.invisibleCharacters",nonBasicASCII:"editor.unicodeHighlight.nonBasicASCII",ambiguousCharacters:"editor.unicodeHighlight.ambiguousCharacters",includeComments:"editor.unicodeHighlight.includeComments",includeStrings:"editor.unicodeHighlight.includeStrings",allowedLocales:"editor.unicodeHighlight.allowedLocales"};class Qpt extends Rr{constructor(){const e={nonBasicASCII:Iu,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:Iu,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(126,"unicodeHighlight",e,{[cc.nonBasicASCII]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Iu],default:e.nonBasicASCII,description:w("unicodeHighlight.nonBasicASCII","Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.")},[cc.invisibleCharacters]:{restricted:!0,type:"boolean",default:e.invisibleCharacters,description:w("unicodeHighlight.invisibleCharacters","Controls whether characters that just reserve space or have no width at all are highlighted.")},[cc.ambiguousCharacters]:{restricted:!0,type:"boolean",default:e.ambiguousCharacters,description:w("unicodeHighlight.ambiguousCharacters","Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.")},[cc.includeComments]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Iu],default:e.includeComments,description:w("unicodeHighlight.includeComments","Controls whether characters in comments should also be subject to Unicode highlighting.")},[cc.includeStrings]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Iu],default:e.includeStrings,description:w("unicodeHighlight.includeStrings","Controls whether characters in strings should also be subject to Unicode highlighting.")},[cc.allowedCharacters]:{restricted:!0,type:"object",default:e.allowedCharacters,description:w("unicodeHighlight.allowedCharacters","Defines allowed characters that are not being highlighted."),additionalProperties:{type:"boolean"}},[cc.allowedLocales]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:e.allowedLocales,description:w("unicodeHighlight.allowedLocales","Unicode characters that are common in allowed locales are not being highlighted.")}})}applyUpdate(e,t){let i=!1;t.allowedCharacters&&e&&(ru(e.allowedCharacters,t.allowedCharacters)||(e={...e,allowedCharacters:t.allowedCharacters},i=!0)),t.allowedLocales&&e&&(ru(e.allowedLocales,t.allowedLocales)||(e={...e,allowedLocales:t.allowedLocales},i=!0));const r=super.applyUpdate(e,t);return i?new fI(r.newValue,!0):r}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{nonBasicASCII:ok(t.nonBasicASCII,Iu,[!0,!1,Iu]),invisibleCharacters:Et(t.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:Et(t.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:ok(t.includeComments,Iu,[!0,!1,Iu]),includeStrings:ok(t.includeStrings,Iu,[!0,!1,Iu]),allowedCharacters:this.validateBooleanMap(e.allowedCharacters,this.defaultValue.allowedCharacters),allowedLocales:this.validateBooleanMap(e.allowedLocales,this.defaultValue.allowedLocales)}}validateBooleanMap(e,t){if(typeof e!="object"||!e)return t;const i={};for(const[r,s]of Object.entries(e))s===!0&&(i[r]=!0);return i}}class Jpt extends Rr{constructor(){const e={enabled:!0,mode:"subwordSmart",showToolbar:"onHover",suppressSuggestions:!1,keepOnBlur:!1,fontFamily:"default"};super(62,"inlineSuggest",e,{"editor.inlineSuggest.enabled":{type:"boolean",default:e.enabled,description:w("inlineSuggest.enabled","Controls whether to automatically show inline suggestions in the editor.")},"editor.inlineSuggest.showToolbar":{type:"string",default:e.showToolbar,enum:["always","onHover","never"],enumDescriptions:[w("inlineSuggest.showToolbar.always","Show the inline suggestion toolbar whenever an inline suggestion is shown."),w("inlineSuggest.showToolbar.onHover","Show the inline suggestion toolbar when hovering over an inline suggestion."),w("inlineSuggest.showToolbar.never","Never show the inline suggestion toolbar.")],description:w("inlineSuggest.showToolbar","Controls when to show the inline suggestion toolbar.")},"editor.inlineSuggest.suppressSuggestions":{type:"boolean",default:e.suppressSuggestions,description:w("inlineSuggest.suppressSuggestions","Controls how inline suggestions interact with the suggest widget. If enabled, the suggest widget is not shown automatically when inline suggestions are available.")},"editor.inlineSuggest.fontFamily":{type:"string",default:e.fontFamily,description:w("inlineSuggest.fontFamily","Controls the font family of the inline suggestions.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),mode:is(t.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"]),showToolbar:is(t.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),suppressSuggestions:Et(t.suppressSuggestions,this.defaultValue.suppressSuggestions),keepOnBlur:Et(t.keepOnBlur,this.defaultValue.keepOnBlur),fontFamily:fl.string(t.fontFamily,this.defaultValue.fontFamily)}}}class emt extends Rr{constructor(){const e={enabled:!1,showToolbar:"onHover",fontFamily:"default",keepOnBlur:!1};super(63,"experimentalInlineEdit",e,{"editor.experimentalInlineEdit.enabled":{type:"boolean",default:e.enabled,description:w("inlineEdit.enabled","Controls whether to show inline edits in the editor.")},"editor.experimentalInlineEdit.showToolbar":{type:"string",default:e.showToolbar,enum:["always","onHover","never"],enumDescriptions:[w("inlineEdit.showToolbar.always","Show the inline edit toolbar whenever an inline suggestion is shown."),w("inlineEdit.showToolbar.onHover","Show the inline edit toolbar when hovering over an inline suggestion."),w("inlineEdit.showToolbar.never","Never show the inline edit toolbar.")],description:w("inlineEdit.showToolbar","Controls when to show the inline edit toolbar.")},"editor.experimentalInlineEdit.fontFamily":{type:"string",default:e.fontFamily,description:w("inlineEdit.fontFamily","Controls the font family of the inline edit.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),showToolbar:is(t.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),fontFamily:fl.string(t.fontFamily,this.defaultValue.fontFamily),keepOnBlur:Et(t.keepOnBlur,this.defaultValue.keepOnBlur)}}}class tmt extends Rr{constructor(){const e={enabled:Va.bracketPairColorizationOptions.enabled,independentColorPoolPerBracketType:Va.bracketPairColorizationOptions.independentColorPoolPerBracketType};super(15,"bracketPairColorization",e,{"editor.bracketPairColorization.enabled":{type:"boolean",default:e.enabled,markdownDescription:w("bracketPairColorization.enabled","Controls whether bracket pair colorization is enabled or not. Use {0} to override the bracket highlight colors.","`#workbench.colorCustomizations#`")},"editor.bracketPairColorization.independentColorPoolPerBracketType":{type:"boolean",default:e.independentColorPoolPerBracketType,description:w("bracketPairColorization.independentColorPoolPerBracketType","Controls whether each bracket type has its own independent color pool.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),independentColorPoolPerBracketType:Et(t.independentColorPoolPerBracketType,this.defaultValue.independentColorPoolPerBracketType)}}}class nmt extends Rr{constructor(){const e={bracketPairs:!1,bracketPairsHorizontal:"active",highlightActiveBracketPair:!0,indentation:!0,highlightActiveIndentation:!0};super(16,"guides",e,{"editor.guides.bracketPairs":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[w("editor.guides.bracketPairs.true","Enables bracket pair guides."),w("editor.guides.bracketPairs.active","Enables bracket pair guides only for the active bracket pair."),w("editor.guides.bracketPairs.false","Disables bracket pair guides.")],default:e.bracketPairs,description:w("editor.guides.bracketPairs","Controls whether bracket pair guides are enabled or not.")},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[w("editor.guides.bracketPairsHorizontal.true","Enables horizontal guides as addition to vertical bracket pair guides."),w("editor.guides.bracketPairsHorizontal.active","Enables horizontal guides only for the active bracket pair."),w("editor.guides.bracketPairsHorizontal.false","Disables horizontal bracket pair guides.")],default:e.bracketPairsHorizontal,description:w("editor.guides.bracketPairsHorizontal","Controls whether horizontal bracket pair guides are enabled or not.")},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:e.highlightActiveBracketPair,description:w("editor.guides.highlightActiveBracketPair","Controls whether the editor should highlight the active bracket pair.")},"editor.guides.indentation":{type:"boolean",default:e.indentation,description:w("editor.guides.indentation","Controls whether the editor should render indent guides.")},"editor.guides.highlightActiveIndentation":{type:["boolean","string"],enum:[!0,"always",!1],enumDescriptions:[w("editor.guides.highlightActiveIndentation.true","Highlights the active indent guide."),w("editor.guides.highlightActiveIndentation.always","Highlights the active indent guide even if bracket guides are highlighted."),w("editor.guides.highlightActiveIndentation.false","Do not highlight the active indent guide.")],default:e.highlightActiveIndentation,description:w("editor.guides.highlightActiveIndentation","Controls whether the editor should highlight the active indent guide.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{bracketPairs:ok(t.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:ok(t.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:Et(t.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:Et(t.indentation,this.defaultValue.indentation),highlightActiveIndentation:ok(t.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation,[!0,!1,"always"])}}}function ok(n,e,t){const i=t.indexOf(n);return i===-1?e:t[i]}class imt extends Rr{constructor(){const e={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!1,localityBonus:!1,shareSuggestSelections:!1,selectionMode:"always",showIcons:!0,showStatusBar:!1,preview:!1,previewMode:"subwordSmart",showInlineDetails:!0,showMethods:!0,showFunctions:!0,showConstructors:!0,showDeprecated:!0,matchOnWordStartOnly:!0,showFields:!0,showVariables:!0,showClasses:!0,showStructs:!0,showInterfaces:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showConstants:!0,showEnums:!0,showEnumMembers:!0,showKeywords:!0,showWords:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showSnippets:!0,showUsers:!0,showIssues:!0};super(119,"suggest",e,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[w("suggest.insertMode.insert","Insert suggestion without overwriting text right of the cursor."),w("suggest.insertMode.replace","Insert suggestion and overwrite text right of the cursor.")],default:e.insertMode,description:w("suggest.insertMode","Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.")},"editor.suggest.filterGraceful":{type:"boolean",default:e.filterGraceful,description:w("suggest.filterGraceful","Controls whether filtering and sorting suggestions accounts for small typos.")},"editor.suggest.localityBonus":{type:"boolean",default:e.localityBonus,description:w("suggest.localityBonus","Controls whether sorting favors words that appear close to the cursor.")},"editor.suggest.shareSuggestSelections":{type:"boolean",default:e.shareSuggestSelections,markdownDescription:w("suggest.shareSuggestSelections","Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).")},"editor.suggest.selectionMode":{type:"string",enum:["always","never","whenTriggerCharacter","whenQuickSuggestion"],enumDescriptions:[w("suggest.insertMode.always","Always select a suggestion when automatically triggering IntelliSense."),w("suggest.insertMode.never","Never select a suggestion when automatically triggering IntelliSense."),w("suggest.insertMode.whenTriggerCharacter","Select a suggestion only when triggering IntelliSense from a trigger character."),w("suggest.insertMode.whenQuickSuggestion","Select a suggestion only when triggering IntelliSense as you type.")],default:e.selectionMode,markdownDescription:w("suggest.selectionMode","Controls whether a suggestion is selected when the widget shows. Note that this only applies to automatically triggered suggestions ({0} and {1}) and that a suggestion is always selected when explicitly invoked, e.g via `Ctrl+Space`.","`#editor.quickSuggestions#`","`#editor.suggestOnTriggerCharacters#`")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:e.snippetsPreventQuickSuggestions,description:w("suggest.snippetsPreventQuickSuggestions","Controls whether an active snippet prevents quick suggestions.")},"editor.suggest.showIcons":{type:"boolean",default:e.showIcons,description:w("suggest.showIcons","Controls whether to show or hide icons in suggestions.")},"editor.suggest.showStatusBar":{type:"boolean",default:e.showStatusBar,description:w("suggest.showStatusBar","Controls the visibility of the status bar at the bottom of the suggest widget.")},"editor.suggest.preview":{type:"boolean",default:e.preview,description:w("suggest.preview","Controls whether to preview the suggestion outcome in the editor.")},"editor.suggest.showInlineDetails":{type:"boolean",default:e.showInlineDetails,description:w("suggest.showInlineDetails","Controls whether suggest details show inline with the label or only in the details widget.")},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:w("suggest.maxVisibleSuggestions.dep","This setting is deprecated. The suggest widget can now be resized.")},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:w("deprecated","This setting is deprecated, please use separate settings like 'editor.suggest.showKeywords' or 'editor.suggest.showSnippets' instead.")},"editor.suggest.showMethods":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showMethods","When enabled IntelliSense shows `method`-suggestions.")},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showFunctions","When enabled IntelliSense shows `function`-suggestions.")},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showConstructors","When enabled IntelliSense shows `constructor`-suggestions.")},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showDeprecated","When enabled IntelliSense shows `deprecated`-suggestions.")},"editor.suggest.matchOnWordStartOnly":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.matchOnWordStartOnly","When enabled IntelliSense filtering requires that the first character matches on a word start. For example, `c` on `Console` or `WebContext` but _not_ on `description`. When disabled IntelliSense will show more results but still sorts them by match quality.")},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showFields","When enabled IntelliSense shows `field`-suggestions.")},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showVariables","When enabled IntelliSense shows `variable`-suggestions.")},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showClasss","When enabled IntelliSense shows `class`-suggestions.")},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showStructs","When enabled IntelliSense shows `struct`-suggestions.")},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showInterfaces","When enabled IntelliSense shows `interface`-suggestions.")},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showModules","When enabled IntelliSense shows `module`-suggestions.")},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showPropertys","When enabled IntelliSense shows `property`-suggestions.")},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showEvents","When enabled IntelliSense shows `event`-suggestions.")},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showOperators","When enabled IntelliSense shows `operator`-suggestions.")},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showUnits","When enabled IntelliSense shows `unit`-suggestions.")},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showValues","When enabled IntelliSense shows `value`-suggestions.")},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showConstants","When enabled IntelliSense shows `constant`-suggestions.")},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showEnums","When enabled IntelliSense shows `enum`-suggestions.")},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showEnumMembers","When enabled IntelliSense shows `enumMember`-suggestions.")},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showKeywords","When enabled IntelliSense shows `keyword`-suggestions.")},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showTexts","When enabled IntelliSense shows `text`-suggestions.")},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showColors","When enabled IntelliSense shows `color`-suggestions.")},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showFiles","When enabled IntelliSense shows `file`-suggestions.")},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showReferences","When enabled IntelliSense shows `reference`-suggestions.")},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showCustomcolors","When enabled IntelliSense shows `customcolor`-suggestions.")},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showFolders","When enabled IntelliSense shows `folder`-suggestions.")},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showTypeParameters","When enabled IntelliSense shows `typeParameter`-suggestions.")},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showSnippets","When enabled IntelliSense shows `snippet`-suggestions.")},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showUsers","When enabled IntelliSense shows `user`-suggestions.")},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:w("editor.suggest.showIssues","When enabled IntelliSense shows `issues`-suggestions.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{insertMode:is(t.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:Et(t.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:Et(t.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:Et(t.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:Et(t.shareSuggestSelections,this.defaultValue.shareSuggestSelections),selectionMode:is(t.selectionMode,this.defaultValue.selectionMode,["always","never","whenQuickSuggestion","whenTriggerCharacter"]),showIcons:Et(t.showIcons,this.defaultValue.showIcons),showStatusBar:Et(t.showStatusBar,this.defaultValue.showStatusBar),preview:Et(t.preview,this.defaultValue.preview),previewMode:is(t.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:Et(t.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:Et(t.showMethods,this.defaultValue.showMethods),showFunctions:Et(t.showFunctions,this.defaultValue.showFunctions),showConstructors:Et(t.showConstructors,this.defaultValue.showConstructors),showDeprecated:Et(t.showDeprecated,this.defaultValue.showDeprecated),matchOnWordStartOnly:Et(t.matchOnWordStartOnly,this.defaultValue.matchOnWordStartOnly),showFields:Et(t.showFields,this.defaultValue.showFields),showVariables:Et(t.showVariables,this.defaultValue.showVariables),showClasses:Et(t.showClasses,this.defaultValue.showClasses),showStructs:Et(t.showStructs,this.defaultValue.showStructs),showInterfaces:Et(t.showInterfaces,this.defaultValue.showInterfaces),showModules:Et(t.showModules,this.defaultValue.showModules),showProperties:Et(t.showProperties,this.defaultValue.showProperties),showEvents:Et(t.showEvents,this.defaultValue.showEvents),showOperators:Et(t.showOperators,this.defaultValue.showOperators),showUnits:Et(t.showUnits,this.defaultValue.showUnits),showValues:Et(t.showValues,this.defaultValue.showValues),showConstants:Et(t.showConstants,this.defaultValue.showConstants),showEnums:Et(t.showEnums,this.defaultValue.showEnums),showEnumMembers:Et(t.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:Et(t.showKeywords,this.defaultValue.showKeywords),showWords:Et(t.showWords,this.defaultValue.showWords),showColors:Et(t.showColors,this.defaultValue.showColors),showFiles:Et(t.showFiles,this.defaultValue.showFiles),showReferences:Et(t.showReferences,this.defaultValue.showReferences),showFolders:Et(t.showFolders,this.defaultValue.showFolders),showTypeParameters:Et(t.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:Et(t.showSnippets,this.defaultValue.showSnippets),showUsers:Et(t.showUsers,this.defaultValue.showUsers),showIssues:Et(t.showIssues,this.defaultValue.showIssues)}}}class rmt extends Rr{constructor(){super(114,"smartSelect",{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:w("selectLeadingAndTrailingWhitespace","Whether leading and trailing whitespace should always be selected."),default:!0,type:"boolean"},"editor.smartSelect.selectSubwords":{description:w("selectSubwords","Whether subwords (like 'foo' in 'fooBar' or 'foo_bar') should be selected."),default:!0,type:"boolean"}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:Et(e.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace),selectSubwords:Et(e.selectSubwords,this.defaultValue.selectSubwords)}}}class smt extends Rr{constructor(){const e=[];super(131,"wordSegmenterLocales",e,{anyOf:[{description:w("wordSegmenterLocales","Locales to be used for word segmentation when doing word related navigations or operations. Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.)."),type:"string"},{description:w("wordSegmenterLocales","Locales to be used for word segmentation when doing word related navigations or operations. Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.)."),type:"array",items:{type:"string"}}]})}validate(e){if(typeof e=="string"&&(e=[e]),Array.isArray(e)){const t=[];for(const i of e)if(typeof i=="string")try{Intl.Segmenter.supportedLocalesOf(i).length>0&&t.push(i)}catch{}return t}return this.defaultValue}}class omt extends Rr{constructor(){super(139,"wrappingIndent",1,{"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[w("wrappingIndent.none","No indentation. Wrapped lines begin at column 1."),w("wrappingIndent.same","Wrapped lines get the same indentation as the parent."),w("wrappingIndent.indent","Wrapped lines get +1 indentation toward the parent."),w("wrappingIndent.deepIndent","Wrapped lines get +2 indentation toward the parent.")],description:w("wrappingIndent","Controls the indentation of wrapped lines."),default:"same"}})}validate(e){switch(e){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}return 1}compute(e,t,i){return t.get(2)===2?0:i}}class amt extends zP{constructor(){super(147)}compute(e,t,i){const r=t.get(146);return{isDominatedByLongLines:e.isDominatedByLongLines,isWordWrapMinified:r.isWordWrapMinified,isViewportWrapping:r.isViewportWrapping,wrappingColumn:r.wrappingColumn}}}class lmt extends Rr{constructor(){const e={enabled:!0,showDropSelector:"afterDrop"};super(36,"dropIntoEditor",e,{"editor.dropIntoEditor.enabled":{type:"boolean",default:e.enabled,markdownDescription:w("dropIntoEditor.enabled","Controls whether you can drag and drop a file into a text editor by holding down the `Shift` key (instead of opening the file in an editor).")},"editor.dropIntoEditor.showDropSelector":{type:"string",markdownDescription:w("dropIntoEditor.showDropSelector","Controls if a widget is shown when dropping files into the editor. This widget lets you control how the file is dropped."),enum:["afterDrop","never"],enumDescriptions:[w("dropIntoEditor.showDropSelector.afterDrop","Show the drop selector widget after a file is dropped into the editor."),w("dropIntoEditor.showDropSelector.never","Never show the drop selector widget. Instead the default drop provider is always used.")],default:"afterDrop"}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),showDropSelector:is(t.showDropSelector,this.defaultValue.showDropSelector,["afterDrop","never"])}}}class cmt extends Rr{constructor(){const e={enabled:!0,showPasteSelector:"afterPaste"};super(85,"pasteAs",e,{"editor.pasteAs.enabled":{type:"boolean",default:e.enabled,markdownDescription:w("pasteAs.enabled","Controls whether you can paste content in different ways.")},"editor.pasteAs.showPasteSelector":{type:"string",markdownDescription:w("pasteAs.showPasteSelector","Controls if a widget is shown when pasting content in to the editor. This widget lets you control how the file is pasted."),enum:["afterPaste","never"],enumDescriptions:[w("pasteAs.showPasteSelector.afterPaste","Show the paste selector widget after content is pasted into the editor."),w("pasteAs.showPasteSelector.never","Never show the paste selector widget. Instead the default pasting behavior is always used.")],default:"afterPaste"}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Et(t.enabled,this.defaultValue.enabled),showPasteSelector:is(t.showPasteSelector,this.defaultValue.showPasteSelector,["afterPaste","never"])}}}const umt="Consolas, 'Courier New', monospace",dmt="Menlo, Monaco, 'Courier New', monospace",hmt="'Droid Sans Mono', 'monospace', monospace",Wl={fontFamily:Rn?dmt:zl?hmt:umt,fontWeight:"normal",fontSize:Rn?12:14,lineHeight:0,letterSpacing:0},vS=[];function Ke(n){return vS[n.id]=n,n}const Mg={acceptSuggestionOnCommitCharacter:Ke(new ni(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:w("acceptSuggestionOnCommitCharacter","Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.")})),acceptSuggestionOnEnter:Ke(new ns(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",w("acceptSuggestionOnEnterSmart","Only accept a suggestion with `Enter` when it makes a textual change."),""],markdownDescription:w("acceptSuggestionOnEnter","Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.")})),accessibilitySupport:Ke(new Spt),accessibilityPageSize:Ke(new rr(3,"accessibilityPageSize",10,1,1073741824,{description:w("accessibilityPageSize","Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default."),tags:["accessibility"]})),ariaLabel:Ke(new fl(4,"ariaLabel",w("editorViewAccessibleLabel","Editor content"))),ariaRequired:Ke(new ni(5,"ariaRequired",!1,void 0)),screenReaderAnnounceInlineSuggestion:Ke(new ni(8,"screenReaderAnnounceInlineSuggestion",!0,{description:w("screenReaderAnnounceInlineSuggestion","Control whether inline suggestions are announced by a screen reader."),tags:["accessibility"]})),autoClosingBrackets:Ke(new ns(6,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",w("editor.autoClosingBrackets.languageDefined","Use language configurations to determine when to autoclose brackets."),w("editor.autoClosingBrackets.beforeWhitespace","Autoclose brackets only when the cursor is to the left of whitespace."),""],description:w("autoClosingBrackets","Controls whether the editor should automatically close brackets after the user adds an opening bracket.")})),autoClosingComments:Ke(new ns(7,"autoClosingComments","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",w("editor.autoClosingComments.languageDefined","Use language configurations to determine when to autoclose comments."),w("editor.autoClosingComments.beforeWhitespace","Autoclose comments only when the cursor is to the left of whitespace."),""],description:w("autoClosingComments","Controls whether the editor should automatically close comments after the user adds an opening comment.")})),autoClosingDelete:Ke(new ns(9,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",w("editor.autoClosingDelete.auto","Remove adjacent closing quotes or brackets only if they were automatically inserted."),""],description:w("autoClosingDelete","Controls whether the editor should remove adjacent closing quotes or brackets when deleting.")})),autoClosingOvertype:Ke(new ns(10,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",w("editor.autoClosingOvertype.auto","Type over closing quotes or brackets only if they were automatically inserted."),""],description:w("autoClosingOvertype","Controls whether the editor should type over closing quotes or brackets.")})),autoClosingQuotes:Ke(new ns(11,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",w("editor.autoClosingQuotes.languageDefined","Use language configurations to determine when to autoclose quotes."),w("editor.autoClosingQuotes.beforeWhitespace","Autoclose quotes only when the cursor is to the left of whitespace."),""],description:w("autoClosingQuotes","Controls whether the editor should automatically close quotes after the user adds an opening quote.")})),autoIndent:Ke(new b4(12,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],xpt,{enumDescriptions:[w("editor.autoIndent.none","The editor will not insert indentation automatically."),w("editor.autoIndent.keep","The editor will keep the current line's indentation."),w("editor.autoIndent.brackets","The editor will keep the current line's indentation and honor language defined brackets."),w("editor.autoIndent.advanced","The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."),w("editor.autoIndent.full","The editor will keep the current line's indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages.")],description:w("autoIndent","Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.")})),automaticLayout:Ke(new ni(13,"automaticLayout",!1)),autoSurround:Ke(new ns(14,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[w("editor.autoSurround.languageDefined","Use language configurations to determine when to automatically surround selections."),w("editor.autoSurround.quotes","Surround with quotes but not brackets."),w("editor.autoSurround.brackets","Surround with brackets but not quotes."),""],description:w("autoSurround","Controls whether the editor should automatically surround selections when typing quotes or brackets.")})),bracketPairColorization:Ke(new tmt),bracketPairGuides:Ke(new nmt),stickyTabStops:Ke(new ni(117,"stickyTabStops",!1,{description:w("stickyTabStops","Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.")})),codeLens:Ke(new ni(17,"codeLens",!0,{description:w("codeLens","Controls whether the editor shows CodeLens.")})),codeLensFontFamily:Ke(new fl(18,"codeLensFontFamily","",{description:w("codeLensFontFamily","Controls the font family for CodeLens.")})),codeLensFontSize:Ke(new rr(19,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:w("codeLensFontSize","Controls the font size in pixels for CodeLens. When set to 0, 90% of `#editor.fontSize#` is used.")})),colorDecorators:Ke(new ni(20,"colorDecorators",!0,{description:w("colorDecorators","Controls whether the editor should render the inline color decorators and color picker.")})),colorDecoratorActivatedOn:Ke(new ns(149,"colorDecoratorsActivatedOn","clickAndHover",["clickAndHover","hover","click"],{enumDescriptions:[w("editor.colorDecoratorActivatedOn.clickAndHover","Make the color picker appear both on click and hover of the color decorator"),w("editor.colorDecoratorActivatedOn.hover","Make the color picker appear on hover of the color decorator"),w("editor.colorDecoratorActivatedOn.click","Make the color picker appear on click of the color decorator")],description:w("colorDecoratorActivatedOn","Controls the condition to make a color picker appear from a color decorator")})),colorDecoratorsLimit:Ke(new rr(21,"colorDecoratorsLimit",500,1,1e6,{markdownDescription:w("colorDecoratorsLimit","Controls the max number of color decorators that can be rendered in an editor at once.")})),columnSelection:Ke(new ni(22,"columnSelection",!1,{description:w("columnSelection","Enable that the selection with the mouse and keys is doing column selection.")})),comments:Ke(new kpt),contextmenu:Ke(new ni(24,"contextmenu",!0)),copyWithSyntaxHighlighting:Ke(new ni(25,"copyWithSyntaxHighlighting",!0,{description:w("copyWithSyntaxHighlighting","Controls whether syntax highlighting should be copied into the clipboard.")})),cursorBlinking:Ke(new b4(26,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],Ept,{description:w("cursorBlinking","Control the cursor animation style.")})),cursorSmoothCaretAnimation:Ke(new ns(27,"cursorSmoothCaretAnimation","off",["off","explicit","on"],{enumDescriptions:[w("cursorSmoothCaretAnimation.off","Smooth caret animation is disabled."),w("cursorSmoothCaretAnimation.explicit","Smooth caret animation is enabled only when the user moves the cursor with an explicit gesture."),w("cursorSmoothCaretAnimation.on","Smooth caret animation is always enabled.")],description:w("cursorSmoothCaretAnimation","Controls whether the smooth caret animation should be enabled.")})),cursorStyle:Ke(new b4(28,"cursorStyle",Yo.Line,"line",["line","block","underline","line-thin","block-outline","underline-thin"],Lpt,{description:w("cursorStyle","Controls the cursor style.")})),cursorSurroundingLines:Ke(new rr(29,"cursorSurroundingLines",0,0,1073741824,{description:w("cursorSurroundingLines","Controls the minimal number of visible leading lines (minimum 0) and trailing lines (minimum 1) surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.")})),cursorSurroundingLinesStyle:Ke(new ns(30,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[w("cursorSurroundingLinesStyle.default","`cursorSurroundingLines` is enforced only when triggered via the keyboard or API."),w("cursorSurroundingLinesStyle.all","`cursorSurroundingLines` is enforced always.")],markdownDescription:w("cursorSurroundingLinesStyle","Controls when `#editor.cursorSurroundingLines#` should be enforced.")})),cursorWidth:Ke(new rr(31,"cursorWidth",0,0,1073741824,{markdownDescription:w("cursorWidth","Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.")})),disableLayerHinting:Ke(new ni(32,"disableLayerHinting",!1)),disableMonospaceOptimizations:Ke(new ni(33,"disableMonospaceOptimizations",!1)),domReadOnly:Ke(new ni(34,"domReadOnly",!1)),dragAndDrop:Ke(new ni(35,"dragAndDrop",!0,{description:w("dragAndDrop","Controls whether the editor should allow moving selections via drag and drop.")})),emptySelectionClipboard:Ke(new Dpt),dropIntoEditor:Ke(new lmt),stickyScroll:Ke(new Fpt),experimentalWhitespaceRendering:Ke(new ns(38,"experimentalWhitespaceRendering","svg",["svg","font","off"],{enumDescriptions:[w("experimentalWhitespaceRendering.svg","Use a new rendering method with svgs."),w("experimentalWhitespaceRendering.font","Use a new rendering method with font characters."),w("experimentalWhitespaceRendering.off","Use the stable rendering method.")],description:w("experimentalWhitespaceRendering","Controls whether whitespace is rendered with a new, experimental method.")})),extraEditorClassName:Ke(new fl(39,"extraEditorClassName","")),fastScrollSensitivity:Ke(new Uu(40,"fastScrollSensitivity",5,n=>n<=0?5:n,{markdownDescription:w("fastScrollSensitivity","Scrolling speed multiplier when pressing `Alt`.")})),find:Ke(new Ipt),fixedOverflowWidgets:Ke(new ni(42,"fixedOverflowWidgets",!1)),folding:Ke(new ni(43,"folding",!0,{description:w("folding","Controls whether the editor has code folding enabled.")})),foldingStrategy:Ke(new ns(44,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[w("foldingStrategy.auto","Use a language-specific folding strategy if available, else the indentation-based one."),w("foldingStrategy.indentation","Use the indentation-based folding strategy.")],description:w("foldingStrategy","Controls the strategy for computing folding ranges.")})),foldingHighlight:Ke(new ni(45,"foldingHighlight",!0,{description:w("foldingHighlight","Controls whether the editor should highlight folded ranges.")})),foldingImportsByDefault:Ke(new ni(46,"foldingImportsByDefault",!1,{description:w("foldingImportsByDefault","Controls whether the editor automatically collapses import ranges.")})),foldingMaximumRegions:Ke(new rr(47,"foldingMaximumRegions",5e3,10,65e3,{description:w("foldingMaximumRegions","The maximum number of foldable regions. Increasing this value may result in the editor becoming less responsive when the current source has a large number of foldable regions.")})),unfoldOnClickAfterEndOfLine:Ke(new ni(48,"unfoldOnClickAfterEndOfLine",!1,{description:w("unfoldOnClickAfterEndOfLine","Controls whether clicking on the empty content after a folded line will unfold the line.")})),fontFamily:Ke(new fl(49,"fontFamily",Wl.fontFamily,{description:w("fontFamily","Controls the font family.")})),fontInfo:Ke(new Apt),fontLigatures2:Ke(new zh),fontSize:Ke(new Npt),fontWeight:Ke(new ay),fontVariations:Ke(new i_),formatOnPaste:Ke(new ni(55,"formatOnPaste",!1,{description:w("formatOnPaste","Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.")})),formatOnType:Ke(new ni(56,"formatOnType",!1,{description:w("formatOnType","Controls whether the editor should automatically format the line after typing.")})),glyphMargin:Ke(new ni(57,"glyphMargin",!0,{description:w("glyphMargin","Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.")})),gotoLocation:Ke(new Rpt),hideCursorInOverviewRuler:Ke(new ni(59,"hideCursorInOverviewRuler",!1,{description:w("hideCursorInOverviewRuler","Controls whether the cursor should be hidden in the overview ruler.")})),hover:Ke(new Ppt),inDiffEditor:Ke(new ni(61,"inDiffEditor",!1)),letterSpacing:Ke(new Uu(64,"letterSpacing",Wl.letterSpacing,n=>Uu.clamp(n,-5,20),{description:w("letterSpacing","Controls the letter spacing in pixels.")})),lightbulb:Ke(new Mpt),lineDecorationsWidth:Ke(new $pt),lineHeight:Ke(new Wpt),lineNumbers:Ke(new Gpt),lineNumbersMinChars:Ke(new rr(69,"lineNumbersMinChars",5,1,300)),linkedEditing:Ke(new ni(70,"linkedEditing",!1,{description:w("linkedEditing","Controls whether the editor has linked editing enabled. Depending on the language, related symbols such as HTML tags, are updated while editing.")})),links:Ke(new ni(71,"links",!0,{description:w("links","Controls whether the editor should detect links and make them clickable.")})),matchBrackets:Ke(new ns(72,"matchBrackets","always",["always","near","never"],{description:w("matchBrackets","Highlight matching brackets.")})),minimap:Ke(new Hpt),mouseStyle:Ke(new ns(74,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:Ke(new Uu(75,"mouseWheelScrollSensitivity",1,n=>n===0?1:n,{markdownDescription:w("mouseWheelScrollSensitivity","A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")})),mouseWheelZoom:Ke(new ni(76,"mouseWheelZoom",!1,{markdownDescription:Rn?w("mouseWheelZoom.mac","Zoom the font of the editor when using mouse wheel and holding `Cmd`."):w("mouseWheelZoom","Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")})),multiCursorMergeOverlapping:Ke(new ni(77,"multiCursorMergeOverlapping",!0,{description:w("multiCursorMergeOverlapping","Merge multiple cursors when they are overlapping.")})),multiCursorModifier:Ke(new b4(78,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],Vpt,{markdownEnumDescriptions:[w("multiCursorModifier.ctrlCmd","Maps to `Control` on Windows and Linux and to `Command` on macOS."),w("multiCursorModifier.alt","Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],markdownDescription:w({key:"multiCursorModifier",comment:["- `ctrlCmd` refers to a value the setting can take and should not be localized.","- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized."]},"The modifier to be used to add multiple cursors with the mouse. The Go to Definition and Open Link mouse gestures will adapt such that they do not conflict with the [multicursor modifier](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).")})),multiCursorPaste:Ke(new ns(79,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[w("multiCursorPaste.spread","Each cursor pastes a single line of the text."),w("multiCursorPaste.full","Each cursor pastes the full text.")],markdownDescription:w("multiCursorPaste","Controls pasting when the line count of the pasted text matches the cursor count.")})),multiCursorLimit:Ke(new rr(80,"multiCursorLimit",1e4,1,1e5,{markdownDescription:w("multiCursorLimit","Controls the max number of cursors that can be in an active editor at once.")})),occurrencesHighlight:Ke(new ns(81,"occurrencesHighlight","singleFile",["off","singleFile","multiFile"],{markdownEnumDescriptions:[w("occurrencesHighlight.off","Does not highlight occurrences."),w("occurrencesHighlight.singleFile","Highlights occurrences only in the current file."),w("occurrencesHighlight.multiFile","Experimental: Highlights occurrences across all valid open files.")],markdownDescription:w("occurrencesHighlight","Controls whether occurrences should be highlighted across open files.")})),overviewRulerBorder:Ke(new ni(82,"overviewRulerBorder",!0,{description:w("overviewRulerBorder","Controls whether a border should be drawn around the overview ruler.")})),overviewRulerLanes:Ke(new rr(83,"overviewRulerLanes",3,0,3)),padding:Ke(new zpt),pasteAs:Ke(new cmt),parameterHints:Ke(new Upt),peekWidgetDefaultFocus:Ke(new ns(87,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[w("peekWidgetDefaultFocus.tree","Focus the tree when opening peek"),w("peekWidgetDefaultFocus.editor","Focus the editor when opening peek")],description:w("peekWidgetDefaultFocus","Controls whether to focus the inline editor or the tree in the peek widget.")})),placeholder:Ke(new qpt),definitionLinkOpensInPeek:Ke(new ni(89,"definitionLinkOpensInPeek",!1,{description:w("definitionLinkOpensInPeek","Controls whether the Go to Definition mouse gesture always opens the peek widget.")})),quickSuggestions:Ke(new Kpt),quickSuggestionsDelay:Ke(new rr(91,"quickSuggestionsDelay",10,0,1073741824,{description:w("quickSuggestionsDelay","Controls the delay in milliseconds after which quick suggestions will show up.")})),readOnly:Ke(new ni(92,"readOnly",!1)),readOnlyMessage:Ke(new Zpt),renameOnType:Ke(new ni(94,"renameOnType",!1,{description:w("renameOnType","Controls whether the editor auto renames on type."),markdownDeprecationMessage:w("renameOnTypeDeprecate","Deprecated, use `editor.linkedEditing` instead.")})),renderControlCharacters:Ke(new ni(95,"renderControlCharacters",!0,{description:w("renderControlCharacters","Controls whether the editor should render control characters."),restricted:!0})),renderFinalNewline:Ke(new ns(96,"renderFinalNewline",zl?"dimmed":"on",["off","on","dimmed"],{description:w("renderFinalNewline","Render last line number when the file ends with a newline.")})),renderLineHighlight:Ke(new ns(97,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",w("renderLineHighlight.all","Highlights both the gutter and the current line.")],description:w("renderLineHighlight","Controls how the editor should render the current line highlight.")})),renderLineHighlightOnlyWhenFocus:Ke(new ni(98,"renderLineHighlightOnlyWhenFocus",!1,{description:w("renderLineHighlightOnlyWhenFocus","Controls if the editor should render the current line highlight only when the editor is focused.")})),renderValidationDecorations:Ke(new ns(99,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:Ke(new ns(100,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",w("renderWhitespace.boundary","Render whitespace characters except for single spaces between words."),w("renderWhitespace.selection","Render whitespace characters only on selected text."),w("renderWhitespace.trailing","Render only trailing whitespace characters."),""],description:w("renderWhitespace","Controls how the editor should render whitespace characters.")})),revealHorizontalRightPadding:Ke(new rr(101,"revealHorizontalRightPadding",15,0,1e3)),roundedSelection:Ke(new ni(102,"roundedSelection",!0,{description:w("roundedSelection","Controls whether selections should have rounded corners.")})),rulers:Ke(new Ypt),scrollbar:Ke(new Xpt),scrollBeyondLastColumn:Ke(new rr(105,"scrollBeyondLastColumn",4,0,1073741824,{description:w("scrollBeyondLastColumn","Controls the number of extra characters beyond which the editor will scroll horizontally.")})),scrollBeyondLastLine:Ke(new ni(106,"scrollBeyondLastLine",!0,{description:w("scrollBeyondLastLine","Controls whether the editor will scroll beyond the last line.")})),scrollPredominantAxis:Ke(new ni(107,"scrollPredominantAxis",!0,{description:w("scrollPredominantAxis","Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.")})),selectionClipboard:Ke(new ni(108,"selectionClipboard",!0,{description:w("selectionClipboard","Controls whether the Linux primary clipboard should be supported."),included:zl})),selectionHighlight:Ke(new ni(109,"selectionHighlight",!0,{description:w("selectionHighlight","Controls whether the editor should highlight matches similar to the selection.")})),selectOnLineNumbers:Ke(new ni(110,"selectOnLineNumbers",!0)),showFoldingControls:Ke(new ns(111,"showFoldingControls","mouseover",["always","never","mouseover"],{enumDescriptions:[w("showFoldingControls.always","Always show the folding controls."),w("showFoldingControls.never","Never show the folding controls and reduce the gutter size."),w("showFoldingControls.mouseover","Only show the folding controls when the mouse is over the gutter.")],description:w("showFoldingControls","Controls when the folding controls on the gutter are shown.")})),showUnused:Ke(new ni(112,"showUnused",!0,{description:w("showUnused","Controls fading out of unused code.")})),showDeprecated:Ke(new ni(141,"showDeprecated",!0,{description:w("showDeprecated","Controls strikethrough deprecated variables.")})),inlayHints:Ke(new Bpt),snippetSuggestions:Ke(new ns(113,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[w("snippetSuggestions.top","Show snippet suggestions on top of other suggestions."),w("snippetSuggestions.bottom","Show snippet suggestions below other suggestions."),w("snippetSuggestions.inline","Show snippets suggestions with other suggestions."),w("snippetSuggestions.none","Do not show snippet suggestions.")],description:w("snippetSuggestions","Controls whether snippets are shown with other suggestions and how they are sorted.")})),smartSelect:Ke(new rmt),smoothScrolling:Ke(new ni(115,"smoothScrolling",!1,{description:w("smoothScrolling","Controls whether the editor will scroll using an animation.")})),stopRenderingLineAfter:Ke(new rr(118,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:Ke(new imt),inlineSuggest:Ke(new Jpt),inlineEdit:Ke(new emt),inlineCompletionsAccessibilityVerbose:Ke(new ni(150,"inlineCompletionsAccessibilityVerbose",!1,{description:w("inlineCompletionsAccessibilityVerbose","Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown.")})),suggestFontSize:Ke(new rr(120,"suggestFontSize",0,0,1e3,{markdownDescription:w("suggestFontSize","Font size for the suggest widget. When set to {0}, the value of {1} is used.","`0`","`#editor.fontSize#`")})),suggestLineHeight:Ke(new rr(121,"suggestLineHeight",0,0,1e3,{markdownDescription:w("suggestLineHeight","Line height for the suggest widget. When set to {0}, the value of {1} is used. The minimum value is 8.","`0`","`#editor.lineHeight#`")})),suggestOnTriggerCharacters:Ke(new ni(122,"suggestOnTriggerCharacters",!0,{description:w("suggestOnTriggerCharacters","Controls whether suggestions should automatically show up when typing trigger characters.")})),suggestSelection:Ke(new ns(123,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[w("suggestSelection.first","Always select the first suggestion."),w("suggestSelection.recentlyUsed","Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),w("suggestSelection.recentlyUsedByPrefix","Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.")],description:w("suggestSelection","Controls how suggestions are pre-selected when showing the suggest list.")})),tabCompletion:Ke(new ns(124,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[w("tabCompletion.on","Tab complete will insert the best matching suggestion when pressing tab."),w("tabCompletion.off","Disable tab completions."),w("tabCompletion.onlySnippets","Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.")],description:w("tabCompletion","Enables tab completions.")})),tabIndex:Ke(new rr(125,"tabIndex",0,-1,1073741824)),unicodeHighlight:Ke(new Qpt),unusualLineTerminators:Ke(new ns(127,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[w("unusualLineTerminators.auto","Unusual line terminators are automatically removed."),w("unusualLineTerminators.off","Unusual line terminators are ignored."),w("unusualLineTerminators.prompt","Unusual line terminators prompt to be removed.")],description:w("unusualLineTerminators","Remove unusual line terminators that might cause problems.")})),useShadowDOM:Ke(new ni(128,"useShadowDOM",!0)),useTabStops:Ke(new ni(129,"useTabStops",!0,{description:w("useTabStops","Spaces and tabs are inserted and deleted in alignment with tab stops.")})),wordBreak:Ke(new ns(130,"wordBreak","normal",["normal","keepAll"],{markdownEnumDescriptions:[w("wordBreak.normal","Use the default line break rule."),w("wordBreak.keepAll","Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal.")],description:w("wordBreak","Controls the word break rules used for Chinese/Japanese/Korean (CJK) text.")})),wordSegmenterLocales:Ke(new smt),wordSeparators:Ke(new fl(132,"wordSeparators",N6,{description:w("wordSeparators","Characters that will be used as word separators when doing word related navigations or operations.")})),wordWrap:Ke(new ns(133,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[w("wordWrap.off","Lines will never wrap."),w("wordWrap.on","Lines will wrap at the viewport width."),w({key:"wordWrap.wordWrapColumn",comment:["- `editor.wordWrapColumn` refers to a different setting and should not be localized."]},"Lines will wrap at `#editor.wordWrapColumn#`."),w({key:"wordWrap.bounded",comment:["- viewport means the edge of the visible window size.","- `editor.wordWrapColumn` refers to a different setting and should not be localized."]},"Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.")],description:w({key:"wordWrap",comment:["- 'off', 'on', 'wordWrapColumn' and 'bounded' refer to values the setting can take and should not be localized.","- `editor.wordWrapColumn` refers to a different setting and should not be localized."]},"Controls how lines should wrap.")})),wordWrapBreakAfterCharacters:Ke(new fl(134,"wordWrapBreakAfterCharacters"," })]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」")),wordWrapBreakBeforeCharacters:Ke(new fl(135,"wordWrapBreakBeforeCharacters","([{‘“〈《「『【〔([{「£¥$£¥++")),wordWrapColumn:Ke(new rr(136,"wordWrapColumn",80,1,1073741824,{markdownDescription:w({key:"wordWrapColumn",comment:["- `editor.wordWrap` refers to a different setting and should not be localized.","- 'wordWrapColumn' and 'bounded' refer to values the different setting can take and should not be localized."]},"Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.")})),wordWrapOverride1:Ke(new ns(137,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:Ke(new ns(138,"wordWrapOverride2","inherit",["off","on","inherit"])),editorClassName:Ke(new Tpt),defaultColorDecorators:Ke(new ni(148,"defaultColorDecorators",!1,{markdownDescription:w("defaultColorDecorators","Controls whether inline color decorations should be shown using the default document color provider")})),pixelRatio:Ke(new jpt),tabFocusMode:Ke(new ni(145,"tabFocusMode",!1,{markdownDescription:w("tabFocusMode","Controls whether the editor receives tabs or defers them to the workbench for navigation.")})),layoutInfo:Ke(new sk),wrappingInfo:Ke(new amt),wrappingIndent:Ke(new omt),wrappingStrategy:Ke(new Opt)};class fmt{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?tE.isErrorNoTelemetry(e)?new tE(e.message+` @@ -129,27 +129,27 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `+e.stack):e},0)}}emit(e){this.listeners.forEach(t=>{t(e)})}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}}const C4e=new fmt;function rn(n){uh(n)||C4e.onUnexpectedError(n)}function vs(n){uh(n)||C4e.onUnexpectedExternalError(n)}function Pve(n){if(n instanceof Error){const{name:e,message:t}=n,i=n.stacktrace||n.stack;return{$isError:!0,name:e,message:t,stack:i,noTelemetry:tE.isErrorNoTelemetry(n)}}return n}const P6="Canceled";function uh(n){return n instanceof sf?!0:n instanceof Error&&n.name===P6&&n.message===P6}class sf extends Error{constructor(){super(P6),this.name=this.message}}function gmt(){const n=new Error(P6);return n.name=n.message,n}function qd(n){return n?new Error(`Illegal argument: ${n}`):new Error("Illegal argument")}function bae(n){return n?new Error(`Illegal state: ${n}`):new Error("Illegal state")}class pmt extends Error{constructor(e){super("NotSupported"),e&&(this.message=e)}}class tE extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof tE)return e;const t=new tE;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}}class fi extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,fi.prototype)}}function wb(n,e){const t=this;let i=!1,r;return function(){return i||(i=!0,r=n.apply(t,arguments)),r}}function R$(n){return typeof n=="object"&&n!==null&&typeof n.dispose=="function"&&n.dispose.length===0}function er(n){if(zn.is(n)){const e=[];for(const t of n)if(t)try{t.dispose()}catch(i){e.push(i)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(n)?[]:n}else if(n)return n.dispose(),n}function Qh(...n){return Lt(()=>er(n))}function Lt(n){return{dispose:wb(()=>{n()})}}class ke{static{this.DISABLE_DISPOSED_WARNING=!1}constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{er(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?ke.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}deleteAndLeak(e){e&&this._toDispose.has(e)&&this._toDispose.delete(e)}}class me{static{this.None=Object.freeze({dispose(){}})}constructor(){this._store=new ke,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}}class To{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}}class mmt{constructor(e){this._disposable=e,this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter===0&&this._disposable.dispose(),this}}class _mt{constructor(e){this.object=e}dispose(){}}class yae{constructor(){this._store=new Map,this._isDisposed=!1}dispose(){this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{er(this._store.values())}finally{this._store.clear()}}get(e){return this._store.get(e)}set(e,t,i=!1){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),i||this._store.get(e)?.dispose(),this._store.set(e,t)}deleteAndDispose(e){this._store.get(e)?.dispose(),this._store.delete(e)}[Symbol.iterator](){return this._store[Symbol.iterator]()}}const vmt=globalThis.performance&&typeof globalThis.performance.now=="function";class Bo{static create(e){return new Bo(e)}constructor(e){this._now=vmt&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}}var Ge;(function(n){n.None=()=>me.None;function e(G,W){return h(G,()=>{},0,void 0,!0,void 0,W)}n.defer=e;function t(G){return(W,z=null,q)=>{let ee=!1,Z;return Z=G(j=>{if(!ee)return Z?Z.dispose():ee=!0,W.call(z,j)},null,q),ee&&Z.dispose(),Z}}n.once=t;function i(G,W){return n.once(n.filter(G,W))}n.onceIf=i;function r(G,W,z){return u((q,ee=null,Z)=>G(j=>q.call(ee,W(j)),null,Z),z)}n.map=r;function s(G,W,z){return u((q,ee=null,Z)=>G(j=>{W(j),q.call(ee,j)},null,Z),z)}n.forEach=s;function o(G,W,z){return u((q,ee=null,Z)=>G(j=>W(j)&&q.call(ee,j),null,Z),z)}n.filter=o;function a(G){return G}n.signal=a;function l(...G){return(W,z=null,q)=>{const ee=Qh(...G.map(Z=>Z(j=>W.call(z,j))));return d(ee,q)}}n.any=l;function c(G,W,z,q){let ee=z;return r(G,Z=>(ee=W(ee,Z),ee),q)}n.reduce=c;function u(G,W){let z;const q={onWillAddFirstListener(){z=G(ee.fire,ee)},onDidRemoveLastListener(){z?.dispose()}},ee=new fe(q);return W?.add(ee),ee.event}function d(G,W){return W instanceof Array?W.push(G):W&&W.add(G),G}function h(G,W,z=100,q=!1,ee=!1,Z,j){let te,le,ue,de=0,we;const xe={leakWarningThreshold:Z,onWillAddFirstListener(){te=G(Re=>{de++,le=W(le,Re),q&&!ue&&(Me.fire(le),le=void 0),we=()=>{const _t=le;le=void 0,ue=void 0,(!q||de>1)&&Me.fire(_t),de=0},typeof z=="number"?(clearTimeout(ue),ue=setTimeout(we,z)):ue===void 0&&(ue=0,queueMicrotask(we))})},onWillRemoveListener(){ee&&de>0&&we?.()},onDidRemoveLastListener(){we=void 0,te.dispose()}},Me=new fe(xe);return j?.add(Me),Me.event}n.debounce=h;function f(G,W=0,z){return n.debounce(G,(q,ee)=>q?(q.push(ee),q):[ee],W,void 0,!0,void 0,z)}n.accumulate=f;function g(G,W=(q,ee)=>q===ee,z){let q=!0,ee;return o(G,Z=>{const j=q||!W(Z,ee);return q=!1,ee=Z,j},z)}n.latch=g;function p(G,W,z){return[n.filter(G,W,z),n.filter(G,q=>!W(q),z)]}n.split=p;function m(G,W=!1,z=[],q){let ee=z.slice(),Z=G(le=>{ee?ee.push(le):te.fire(le)});q&&q.add(Z);const j=()=>{ee?.forEach(le=>te.fire(le)),ee=null},te=new fe({onWillAddFirstListener(){Z||(Z=G(le=>te.fire(le)),q&&q.add(Z))},onDidAddFirstListener(){ee&&(W?setTimeout(j):j())},onDidRemoveLastListener(){Z&&Z.dispose(),Z=null}});return q&&q.add(te),te.event}n.buffer=m;function _(G,W){return(q,ee,Z)=>{const j=W(new y);return G(function(te){const le=j.evaluate(te);le!==v&&q.call(ee,le)},void 0,Z)}}n.chain=_;const v=Symbol("HaltChainable");class y{constructor(){this.steps=[]}map(W){return this.steps.push(W),this}forEach(W){return this.steps.push(z=>(W(z),z)),this}filter(W){return this.steps.push(z=>W(z)?z:v),this}reduce(W,z){let q=z;return this.steps.push(ee=>(q=W(q,ee),q)),this}latch(W=(z,q)=>z===q){let z=!0,q;return this.steps.push(ee=>{const Z=z||!W(ee,q);return z=!1,q=ee,Z?ee:v}),this}evaluate(W){for(const z of this.steps)if(W=z(W),W===v)break;return W}}function C(G,W,z=q=>q){const q=(...te)=>j.fire(z(...te)),ee=()=>G.on(W,q),Z=()=>G.removeListener(W,q),j=new fe({onWillAddFirstListener:ee,onDidRemoveLastListener:Z});return j.event}n.fromNodeEventEmitter=C;function x(G,W,z=q=>q){const q=(...te)=>j.fire(z(...te)),ee=()=>G.addEventListener(W,q),Z=()=>G.removeEventListener(W,q),j=new fe({onWillAddFirstListener:ee,onDidRemoveLastListener:Z});return j.event}n.fromDOMEventEmitter=x;function k(G){return new Promise(W=>t(G)(W))}n.toPromise=k;function L(G){const W=new fe;return G.then(z=>{W.fire(z)},()=>{W.fire(void 0)}).finally(()=>{W.dispose()}),W.event}n.fromPromise=L;function D(G,W){return G(z=>W.fire(z))}n.forward=D;function I(G,W,z){return W(z),G(q=>W(q))}n.runAndSubscribe=I;class O{constructor(W,z){this._observable=W,this._counter=0,this._hasChanged=!1;const q={onWillAddFirstListener:()=>{W.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{W.removeObserver(this)}};this.emitter=new fe(q),z&&z.add(this.emitter)}beginUpdate(W){this._counter++}handlePossibleChange(W){}handleChange(W,z){this._hasChanged=!0}endUpdate(W){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function M(G,W){return new O(G,W).emitter.event}n.fromObservable=M;function B(G){return(W,z,q)=>{let ee=0,Z=!1;const j={beginUpdate(){ee++},endUpdate(){ee--,ee===0&&(G.reportChanges(),Z&&(Z=!1,W.call(z)))},handlePossibleChange(){},handleChange(){Z=!0}};G.addObserver(j),G.reportChanges();const te={dispose(){G.removeObserver(j)}};return q instanceof ke?q.add(te):Array.isArray(q)&&q.push(te),te}}n.fromObservableLight=B})(Ge||(Ge={}));class O6{static{this.all=new Set}static{this._idPool=0}constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${O6._idPool++}`,O6.all.add(this)}start(e){this._stopWatch=new Bo,this.listenerCount=e}stop(){if(this._stopWatch){const e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}}let bmt=-1;class wae{static{this._idPool=1}constructor(e,t,i=(wae._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){const i=this.threshold;if(i<=0||t{const s=this._stacks.get(e.value)||0;this._stacks.set(e.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(const[i,r]of this._stacks)(!e||t{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){const a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);const l=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],c=new wmt(`${a}. HINT: Stack shows most frequent listener (${l[1]}-times)`,l[0]);return(this._options?.onListenerError||rn)(c),me.None}if(this._disposed)return me.None;t&&(e=e.bind(t));const r=new dj(e);let s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Cae.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof dj?(this._deliveryQueue??=new x4e,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;const o=Lt(()=>{s?.(),this._removeListener(r)});return i instanceof ke?i.add(o):Array.isArray(i)&&i.push(o),o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}const t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;const r=this._deliveryQueue.current===this;if(this._size*Cmt<=t.length){let s=0;for(let o=0;o0}};const xmt=()=>new x4e;class x4e{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}class Ew extends fe{constructor(e){super(e),this._isPaused=0,this._eventQueue=new Rl,this._mergeFn=e?.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){const e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(this._isPaused!==0?this._eventQueue.push(e):super.fire(e))}}class S4e extends Ew{constructor(e){super(e),this._delay=e.delay??100}fire(e){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(e)}}class Smt extends fe{constructor(e){super(e),this._queuedEvents=[],this._mergeFn=e?.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(t=>super.fire(t)),this._queuedEvents=[]}))}}class kmt{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new fe({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){const t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),Lt(wb(()=>{this.hasListeners&&this.unhook(t);const r=this.events.indexOf(t);this.events.splice(r,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(t=>this.emitter.fire(t))}unhook(e){e.listener?.dispose(),e.listener=null}dispose(){this.emitter.dispose();for(const e of this.events)e.listener?.dispose();this.events=[]}}class UP{constructor(){this.data=[]}wrapEvent(e,t,i){return(r,s,o)=>e(a=>{const l=this.data[this.data.length-1];if(!t){l?l.buffers.push(()=>r.call(s,a)):r.call(s,a);return}const c=l;if(!c){r.call(s,t(i,a));return}c.items??=[],c.items.push(a),c.buffers.length===0&&l.buffers.push(()=>{c.reducedResult??=i?c.items.reduce(t,i):c.items.reduce(t),r.call(s,c.reducedResult)})},void 0,o)}bufferEvents(e){const t={buffers:new Array};this.data.push(t);const i=e();return this.data.pop(),t.buffers.forEach(r=>r()),i}}class Ove{constructor(){this.listening=!1,this.inputEvent=Ge.None,this.inputEventListener=me.None,this.emitter=new fe({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}const k4e=Object.freeze(function(n,e){const t=setTimeout(n.bind(e),0);return{dispose(){clearTimeout(t)}}});var yn;(function(n){function e(t){return t===n.None||t===n.Cancelled||t instanceof FF?!0:!t||typeof t!="object"?!1:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}n.isCancellationToken=e,n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ge.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:k4e})})(yn||(yn={}));class FF{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?k4e:(this._emitter||(this._emitter=new fe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}}let Kr=class{constructor(e){this._token=void 0,this._parentListener=void 0,this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new FF),this._token}cancel(){this._token?this._token instanceof FF&&this._token.cancel():this._token=yn.Cancelled}dispose(e=!1){e&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof FF&&this._token.dispose():this._token=yn.None}};function lZ(n){const e=new Kr;return n.add({dispose(){e.cancel()}}),e.token}class xae{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}}const BF=new xae,cZ=new xae,uZ=new xae,E4e=new Array(230),Emt=Object.create(null),Lmt=Object.create(null),Sae=[];for(let n=0;n<=193;n++)Sae[n]=-1;(function(){const n="",e=[[1,0,"None",0,"unknown",0,"VK_UNKNOWN",n,n],[1,1,"Hyper",0,n,0,n,n,n],[1,2,"Super",0,n,0,n,n,n],[1,3,"Fn",0,n,0,n,n,n],[1,4,"FnLock",0,n,0,n,n,n],[1,5,"Suspend",0,n,0,n,n,n],[1,6,"Resume",0,n,0,n,n,n],[1,7,"Turbo",0,n,0,n,n,n],[1,8,"Sleep",0,n,0,"VK_SLEEP",n,n],[1,9,"WakeUp",0,n,0,n,n,n],[0,10,"KeyA",31,"A",65,"VK_A",n,n],[0,11,"KeyB",32,"B",66,"VK_B",n,n],[0,12,"KeyC",33,"C",67,"VK_C",n,n],[0,13,"KeyD",34,"D",68,"VK_D",n,n],[0,14,"KeyE",35,"E",69,"VK_E",n,n],[0,15,"KeyF",36,"F",70,"VK_F",n,n],[0,16,"KeyG",37,"G",71,"VK_G",n,n],[0,17,"KeyH",38,"H",72,"VK_H",n,n],[0,18,"KeyI",39,"I",73,"VK_I",n,n],[0,19,"KeyJ",40,"J",74,"VK_J",n,n],[0,20,"KeyK",41,"K",75,"VK_K",n,n],[0,21,"KeyL",42,"L",76,"VK_L",n,n],[0,22,"KeyM",43,"M",77,"VK_M",n,n],[0,23,"KeyN",44,"N",78,"VK_N",n,n],[0,24,"KeyO",45,"O",79,"VK_O",n,n],[0,25,"KeyP",46,"P",80,"VK_P",n,n],[0,26,"KeyQ",47,"Q",81,"VK_Q",n,n],[0,27,"KeyR",48,"R",82,"VK_R",n,n],[0,28,"KeyS",49,"S",83,"VK_S",n,n],[0,29,"KeyT",50,"T",84,"VK_T",n,n],[0,30,"KeyU",51,"U",85,"VK_U",n,n],[0,31,"KeyV",52,"V",86,"VK_V",n,n],[0,32,"KeyW",53,"W",87,"VK_W",n,n],[0,33,"KeyX",54,"X",88,"VK_X",n,n],[0,34,"KeyY",55,"Y",89,"VK_Y",n,n],[0,35,"KeyZ",56,"Z",90,"VK_Z",n,n],[0,36,"Digit1",22,"1",49,"VK_1",n,n],[0,37,"Digit2",23,"2",50,"VK_2",n,n],[0,38,"Digit3",24,"3",51,"VK_3",n,n],[0,39,"Digit4",25,"4",52,"VK_4",n,n],[0,40,"Digit5",26,"5",53,"VK_5",n,n],[0,41,"Digit6",27,"6",54,"VK_6",n,n],[0,42,"Digit7",28,"7",55,"VK_7",n,n],[0,43,"Digit8",29,"8",56,"VK_8",n,n],[0,44,"Digit9",30,"9",57,"VK_9",n,n],[0,45,"Digit0",21,"0",48,"VK_0",n,n],[1,46,"Enter",3,"Enter",13,"VK_RETURN",n,n],[1,47,"Escape",9,"Escape",27,"VK_ESCAPE",n,n],[1,48,"Backspace",1,"Backspace",8,"VK_BACK",n,n],[1,49,"Tab",2,"Tab",9,"VK_TAB",n,n],[1,50,"Space",10,"Space",32,"VK_SPACE",n,n],[0,51,"Minus",88,"-",189,"VK_OEM_MINUS","-","OEM_MINUS"],[0,52,"Equal",86,"=",187,"VK_OEM_PLUS","=","OEM_PLUS"],[0,53,"BracketLeft",92,"[",219,"VK_OEM_4","[","OEM_4"],[0,54,"BracketRight",94,"]",221,"VK_OEM_6","]","OEM_6"],[0,55,"Backslash",93,"\\",220,"VK_OEM_5","\\","OEM_5"],[0,56,"IntlHash",0,n,0,n,n,n],[0,57,"Semicolon",85,";",186,"VK_OEM_1",";","OEM_1"],[0,58,"Quote",95,"'",222,"VK_OEM_7","'","OEM_7"],[0,59,"Backquote",91,"`",192,"VK_OEM_3","`","OEM_3"],[0,60,"Comma",87,",",188,"VK_OEM_COMMA",",","OEM_COMMA"],[0,61,"Period",89,".",190,"VK_OEM_PERIOD",".","OEM_PERIOD"],[0,62,"Slash",90,"/",191,"VK_OEM_2","/","OEM_2"],[1,63,"CapsLock",8,"CapsLock",20,"VK_CAPITAL",n,n],[1,64,"F1",59,"F1",112,"VK_F1",n,n],[1,65,"F2",60,"F2",113,"VK_F2",n,n],[1,66,"F3",61,"F3",114,"VK_F3",n,n],[1,67,"F4",62,"F4",115,"VK_F4",n,n],[1,68,"F5",63,"F5",116,"VK_F5",n,n],[1,69,"F6",64,"F6",117,"VK_F6",n,n],[1,70,"F7",65,"F7",118,"VK_F7",n,n],[1,71,"F8",66,"F8",119,"VK_F8",n,n],[1,72,"F9",67,"F9",120,"VK_F9",n,n],[1,73,"F10",68,"F10",121,"VK_F10",n,n],[1,74,"F11",69,"F11",122,"VK_F11",n,n],[1,75,"F12",70,"F12",123,"VK_F12",n,n],[1,76,"PrintScreen",0,n,0,n,n,n],[1,77,"ScrollLock",84,"ScrollLock",145,"VK_SCROLL",n,n],[1,78,"Pause",7,"PauseBreak",19,"VK_PAUSE",n,n],[1,79,"Insert",19,"Insert",45,"VK_INSERT",n,n],[1,80,"Home",14,"Home",36,"VK_HOME",n,n],[1,81,"PageUp",11,"PageUp",33,"VK_PRIOR",n,n],[1,82,"Delete",20,"Delete",46,"VK_DELETE",n,n],[1,83,"End",13,"End",35,"VK_END",n,n],[1,84,"PageDown",12,"PageDown",34,"VK_NEXT",n,n],[1,85,"ArrowRight",17,"RightArrow",39,"VK_RIGHT","Right",n],[1,86,"ArrowLeft",15,"LeftArrow",37,"VK_LEFT","Left",n],[1,87,"ArrowDown",18,"DownArrow",40,"VK_DOWN","Down",n],[1,88,"ArrowUp",16,"UpArrow",38,"VK_UP","Up",n],[1,89,"NumLock",83,"NumLock",144,"VK_NUMLOCK",n,n],[1,90,"NumpadDivide",113,"NumPad_Divide",111,"VK_DIVIDE",n,n],[1,91,"NumpadMultiply",108,"NumPad_Multiply",106,"VK_MULTIPLY",n,n],[1,92,"NumpadSubtract",111,"NumPad_Subtract",109,"VK_SUBTRACT",n,n],[1,93,"NumpadAdd",109,"NumPad_Add",107,"VK_ADD",n,n],[1,94,"NumpadEnter",3,n,0,n,n,n],[1,95,"Numpad1",99,"NumPad1",97,"VK_NUMPAD1",n,n],[1,96,"Numpad2",100,"NumPad2",98,"VK_NUMPAD2",n,n],[1,97,"Numpad3",101,"NumPad3",99,"VK_NUMPAD3",n,n],[1,98,"Numpad4",102,"NumPad4",100,"VK_NUMPAD4",n,n],[1,99,"Numpad5",103,"NumPad5",101,"VK_NUMPAD5",n,n],[1,100,"Numpad6",104,"NumPad6",102,"VK_NUMPAD6",n,n],[1,101,"Numpad7",105,"NumPad7",103,"VK_NUMPAD7",n,n],[1,102,"Numpad8",106,"NumPad8",104,"VK_NUMPAD8",n,n],[1,103,"Numpad9",107,"NumPad9",105,"VK_NUMPAD9",n,n],[1,104,"Numpad0",98,"NumPad0",96,"VK_NUMPAD0",n,n],[1,105,"NumpadDecimal",112,"NumPad_Decimal",110,"VK_DECIMAL",n,n],[0,106,"IntlBackslash",97,"OEM_102",226,"VK_OEM_102",n,n],[1,107,"ContextMenu",58,"ContextMenu",93,n,n,n],[1,108,"Power",0,n,0,n,n,n],[1,109,"NumpadEqual",0,n,0,n,n,n],[1,110,"F13",71,"F13",124,"VK_F13",n,n],[1,111,"F14",72,"F14",125,"VK_F14",n,n],[1,112,"F15",73,"F15",126,"VK_F15",n,n],[1,113,"F16",74,"F16",127,"VK_F16",n,n],[1,114,"F17",75,"F17",128,"VK_F17",n,n],[1,115,"F18",76,"F18",129,"VK_F18",n,n],[1,116,"F19",77,"F19",130,"VK_F19",n,n],[1,117,"F20",78,"F20",131,"VK_F20",n,n],[1,118,"F21",79,"F21",132,"VK_F21",n,n],[1,119,"F22",80,"F22",133,"VK_F22",n,n],[1,120,"F23",81,"F23",134,"VK_F23",n,n],[1,121,"F24",82,"F24",135,"VK_F24",n,n],[1,122,"Open",0,n,0,n,n,n],[1,123,"Help",0,n,0,n,n,n],[1,124,"Select",0,n,0,n,n,n],[1,125,"Again",0,n,0,n,n,n],[1,126,"Undo",0,n,0,n,n,n],[1,127,"Cut",0,n,0,n,n,n],[1,128,"Copy",0,n,0,n,n,n],[1,129,"Paste",0,n,0,n,n,n],[1,130,"Find",0,n,0,n,n,n],[1,131,"AudioVolumeMute",117,"AudioVolumeMute",173,"VK_VOLUME_MUTE",n,n],[1,132,"AudioVolumeUp",118,"AudioVolumeUp",175,"VK_VOLUME_UP",n,n],[1,133,"AudioVolumeDown",119,"AudioVolumeDown",174,"VK_VOLUME_DOWN",n,n],[1,134,"NumpadComma",110,"NumPad_Separator",108,"VK_SEPARATOR",n,n],[0,135,"IntlRo",115,"ABNT_C1",193,"VK_ABNT_C1",n,n],[1,136,"KanaMode",0,n,0,n,n,n],[0,137,"IntlYen",0,n,0,n,n,n],[1,138,"Convert",0,n,0,n,n,n],[1,139,"NonConvert",0,n,0,n,n,n],[1,140,"Lang1",0,n,0,n,n,n],[1,141,"Lang2",0,n,0,n,n,n],[1,142,"Lang3",0,n,0,n,n,n],[1,143,"Lang4",0,n,0,n,n,n],[1,144,"Lang5",0,n,0,n,n,n],[1,145,"Abort",0,n,0,n,n,n],[1,146,"Props",0,n,0,n,n,n],[1,147,"NumpadParenLeft",0,n,0,n,n,n],[1,148,"NumpadParenRight",0,n,0,n,n,n],[1,149,"NumpadBackspace",0,n,0,n,n,n],[1,150,"NumpadMemoryStore",0,n,0,n,n,n],[1,151,"NumpadMemoryRecall",0,n,0,n,n,n],[1,152,"NumpadMemoryClear",0,n,0,n,n,n],[1,153,"NumpadMemoryAdd",0,n,0,n,n,n],[1,154,"NumpadMemorySubtract",0,n,0,n,n,n],[1,155,"NumpadClear",131,"Clear",12,"VK_CLEAR",n,n],[1,156,"NumpadClearEntry",0,n,0,n,n,n],[1,0,n,5,"Ctrl",17,"VK_CONTROL",n,n],[1,0,n,4,"Shift",16,"VK_SHIFT",n,n],[1,0,n,6,"Alt",18,"VK_MENU",n,n],[1,0,n,57,"Meta",91,"VK_COMMAND",n,n],[1,157,"ControlLeft",5,n,0,"VK_LCONTROL",n,n],[1,158,"ShiftLeft",4,n,0,"VK_LSHIFT",n,n],[1,159,"AltLeft",6,n,0,"VK_LMENU",n,n],[1,160,"MetaLeft",57,n,0,"VK_LWIN",n,n],[1,161,"ControlRight",5,n,0,"VK_RCONTROL",n,n],[1,162,"ShiftRight",4,n,0,"VK_RSHIFT",n,n],[1,163,"AltRight",6,n,0,"VK_RMENU",n,n],[1,164,"MetaRight",57,n,0,"VK_RWIN",n,n],[1,165,"BrightnessUp",0,n,0,n,n,n],[1,166,"BrightnessDown",0,n,0,n,n,n],[1,167,"MediaPlay",0,n,0,n,n,n],[1,168,"MediaRecord",0,n,0,n,n,n],[1,169,"MediaFastForward",0,n,0,n,n,n],[1,170,"MediaRewind",0,n,0,n,n,n],[1,171,"MediaTrackNext",124,"MediaTrackNext",176,"VK_MEDIA_NEXT_TRACK",n,n],[1,172,"MediaTrackPrevious",125,"MediaTrackPrevious",177,"VK_MEDIA_PREV_TRACK",n,n],[1,173,"MediaStop",126,"MediaStop",178,"VK_MEDIA_STOP",n,n],[1,174,"Eject",0,n,0,n,n,n],[1,175,"MediaPlayPause",127,"MediaPlayPause",179,"VK_MEDIA_PLAY_PAUSE",n,n],[1,176,"MediaSelect",128,"LaunchMediaPlayer",181,"VK_MEDIA_LAUNCH_MEDIA_SELECT",n,n],[1,177,"LaunchMail",129,"LaunchMail",180,"VK_MEDIA_LAUNCH_MAIL",n,n],[1,178,"LaunchApp2",130,"LaunchApp2",183,"VK_MEDIA_LAUNCH_APP2",n,n],[1,179,"LaunchApp1",0,n,0,"VK_MEDIA_LAUNCH_APP1",n,n],[1,180,"SelectTask",0,n,0,n,n,n],[1,181,"LaunchScreenSaver",0,n,0,n,n,n],[1,182,"BrowserSearch",120,"BrowserSearch",170,"VK_BROWSER_SEARCH",n,n],[1,183,"BrowserHome",121,"BrowserHome",172,"VK_BROWSER_HOME",n,n],[1,184,"BrowserBack",122,"BrowserBack",166,"VK_BROWSER_BACK",n,n],[1,185,"BrowserForward",123,"BrowserForward",167,"VK_BROWSER_FORWARD",n,n],[1,186,"BrowserStop",0,n,0,"VK_BROWSER_STOP",n,n],[1,187,"BrowserRefresh",0,n,0,"VK_BROWSER_REFRESH",n,n],[1,188,"BrowserFavorites",0,n,0,"VK_BROWSER_FAVORITES",n,n],[1,189,"ZoomToggle",0,n,0,n,n,n],[1,190,"MailReply",0,n,0,n,n,n],[1,191,"MailForward",0,n,0,n,n,n],[1,192,"MailSend",0,n,0,n,n,n],[1,0,n,114,"KeyInComposition",229,n,n,n],[1,0,n,116,"ABNT_C2",194,"VK_ABNT_C2",n,n],[1,0,n,96,"OEM_8",223,"VK_OEM_8",n,n],[1,0,n,0,n,0,"VK_KANA",n,n],[1,0,n,0,n,0,"VK_HANGUL",n,n],[1,0,n,0,n,0,"VK_JUNJA",n,n],[1,0,n,0,n,0,"VK_FINAL",n,n],[1,0,n,0,n,0,"VK_HANJA",n,n],[1,0,n,0,n,0,"VK_KANJI",n,n],[1,0,n,0,n,0,"VK_CONVERT",n,n],[1,0,n,0,n,0,"VK_NONCONVERT",n,n],[1,0,n,0,n,0,"VK_ACCEPT",n,n],[1,0,n,0,n,0,"VK_MODECHANGE",n,n],[1,0,n,0,n,0,"VK_SELECT",n,n],[1,0,n,0,n,0,"VK_PRINT",n,n],[1,0,n,0,n,0,"VK_EXECUTE",n,n],[1,0,n,0,n,0,"VK_SNAPSHOT",n,n],[1,0,n,0,n,0,"VK_HELP",n,n],[1,0,n,0,n,0,"VK_APPS",n,n],[1,0,n,0,n,0,"VK_PROCESSKEY",n,n],[1,0,n,0,n,0,"VK_PACKET",n,n],[1,0,n,0,n,0,"VK_DBE_SBCSCHAR",n,n],[1,0,n,0,n,0,"VK_DBE_DBCSCHAR",n,n],[1,0,n,0,n,0,"VK_ATTN",n,n],[1,0,n,0,n,0,"VK_CRSEL",n,n],[1,0,n,0,n,0,"VK_EXSEL",n,n],[1,0,n,0,n,0,"VK_EREOF",n,n],[1,0,n,0,n,0,"VK_PLAY",n,n],[1,0,n,0,n,0,"VK_ZOOM",n,n],[1,0,n,0,n,0,"VK_NONAME",n,n],[1,0,n,0,n,0,"VK_PA1",n,n],[1,0,n,0,n,0,"VK_OEM_CLEAR",n,n]],t=[],i=[];for(const r of e){const[s,o,a,l,c,u,d,h,f]=r;if(i[o]||(i[o]=!0,Emt[a]=o,Lmt[a.toLowerCase()]=o,s&&(Sae[o]=l)),!t[l]){if(t[l]=!0,!c)throw new Error(`String representation missing for key code ${l} around scan code ${a}`);BF.define(l,c),cZ.define(l,h||c),uZ.define(l,f||h||c)}u&&(E4e[u]=l)}})();var r_;(function(n){function e(a){return BF.keyCodeToStr(a)}n.toString=e;function t(a){return BF.strToKeyCode(a)}n.fromString=t;function i(a){return cZ.keyCodeToStr(a)}n.toUserSettingsUS=i;function r(a){return uZ.keyCodeToStr(a)}n.toUserSettingsGeneral=r;function s(a){return cZ.strToKeyCode(a)||uZ.strToKeyCode(a)}n.fromUserSettings=s;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return BF.keyCodeToStr(a)}n.toElectronAccelerator=o})(r_||(r_={}));function js(n,e){const t=(e&65535)<<16>>>0;return(n|t)>>>0}var Mve={};let ak;const hj=globalThis.vscode;if(typeof hj<"u"&&typeof hj.process<"u"){const n=hj.process;ak={get platform(){return n.platform},get arch(){return n.arch},get env(){return n.env},cwd(){return n.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?ak={get platform(){return process.platform},get arch(){return process.arch},get env(){return Mve},cwd(){return Mve.VSCODE_CWD||process.cwd()}}:ak={get platform(){return Ta?"win32":Rn?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};const M6=ak.cwd,dZ=ak.env,Tmt=ak.platform,Dmt=65,Imt=97,Amt=90,Nmt=122,ib=46,al=47,Tu=92,H0=58,Rmt=63;class L4e extends Error{constructor(e,t,i){let r;typeof t=="string"&&t.indexOf("not ")===0?(r="must not be",t=t.replace(/^not /,"")):r="must be";const s=e.indexOf(".")!==-1?"property":"argument";let o=`The "${e}" ${s} ${r} of type ${t}`;o+=`. Received type ${typeof i}`,super(o),this.code="ERR_INVALID_ARG_TYPE"}}function Pmt(n,e){if(n===null||typeof n!="object")throw new L4e(e,"Object",n)}function No(n,e){if(typeof n!="string")throw new L4e(e,"string",n)}const g0=Tmt==="win32";function zi(n){return n===al||n===Tu}function hZ(n){return n===al}function V0(n){return n>=Dmt&&n<=Amt||n>=Imt&&n<=Nmt}function F6(n,e,t,i){let r="",s=0,o=-1,a=0,l=0;for(let c=0;c<=n.length;++c){if(c2){const u=r.lastIndexOf(t);u===-1?(r="",s=0):(r=r.slice(0,u),s=r.length-1-r.lastIndexOf(t)),o=c,a=0;continue}else if(r.length!==0){r="",s=0,o=c,a=0;continue}}e&&(r+=r.length>0?`${t}..`:"..",s=2)}else r.length>0?r+=`${t}${n.slice(o+1,c)}`:r=n.slice(o+1,c),s=c-o-1;o=c,a=0}else l===ib&&a!==-1?++a:a=-1}return r}function Omt(n){return n?`${n[0]==="."?"":"."}${n}`:""}function T4e(n,e){Pmt(e,"pathObject");const t=e.dir||e.root,i=e.base||`${e.name||""}${Omt(e.ext)}`;return t?t===e.root?`${t}${i}`:`${t}${n}${i}`:i}const bc={resolve(...n){let e="",t="",i=!1;for(let r=n.length-1;r>=-1;r--){let s;if(r>=0){if(s=n[r],No(s,`paths[${r}]`),s.length===0)continue}else e.length===0?s=M6():(s=dZ[`=${e}`]||M6(),(s===void 0||s.slice(0,2).toLowerCase()!==e.toLowerCase()&&s.charCodeAt(2)===Tu)&&(s=`${e}\\`));const o=s.length;let a=0,l="",c=!1;const u=s.charCodeAt(0);if(o===1)zi(u)&&(a=1,c=!0);else if(zi(u))if(c=!0,zi(s.charCodeAt(1))){let d=2,h=d;for(;d2&&zi(s.charCodeAt(2))&&(c=!0,a=3));if(l.length>0)if(e.length>0){if(l.toLowerCase()!==e.toLowerCase())continue}else e=l;if(i){if(e.length>0)break}else if(t=`${s.slice(a)}\\${t}`,i=c,c&&e.length>0)break}return t=F6(t,!i,"\\",zi),i?`${e}\\${t}`:`${e}${t}`||"."},normalize(n){No(n,"path");const e=n.length;if(e===0)return".";let t=0,i,r=!1;const s=n.charCodeAt(0);if(e===1)return hZ(s)?"\\":n;if(zi(s))if(r=!0,zi(n.charCodeAt(1))){let a=2,l=a;for(;a2&&zi(n.charCodeAt(2))&&(r=!0,t=3));let o=t0&&zi(n.charCodeAt(e-1))&&(o+="\\"),i===void 0?r?`\\${o}`:o:r?`${i}\\${o}`:`${i}${o}`},isAbsolute(n){No(n,"path");const e=n.length;if(e===0)return!1;const t=n.charCodeAt(0);return zi(t)||e>2&&V0(t)&&n.charCodeAt(1)===H0&&zi(n.charCodeAt(2))},join(...n){if(n.length===0)return".";let e,t;for(let s=0;s0&&(e===void 0?e=t=o:e+=`\\${o}`)}if(e===void 0)return".";let i=!0,r=0;if(typeof t=="string"&&zi(t.charCodeAt(0))){++r;const s=t.length;s>1&&zi(t.charCodeAt(1))&&(++r,s>2&&(zi(t.charCodeAt(2))?++r:i=!1))}if(i){for(;r=2&&(e=`\\${e.slice(r)}`)}return bc.normalize(e)},relative(n,e){if(No(n,"from"),No(e,"to"),n===e)return"";const t=bc.resolve(n),i=bc.resolve(e);if(t===i||(n=t.toLowerCase(),e=i.toLowerCase(),n===e))return"";let r=0;for(;rr&&n.charCodeAt(s-1)===Tu;)s--;const o=s-r;let a=0;for(;aa&&e.charCodeAt(l-1)===Tu;)l--;const c=l-a,u=ou){if(e.charCodeAt(a+h)===Tu)return i.slice(a+h+1);if(h===2)return i.slice(a+h)}o>u&&(n.charCodeAt(r+h)===Tu?d=h:h===2&&(d=3)),d===-1&&(d=0)}let f="";for(h=r+d+1;h<=s;++h)(h===s||n.charCodeAt(h)===Tu)&&(f+=f.length===0?"..":"\\..");return a+=d,f.length>0?`${f}${i.slice(a,l)}`:(i.charCodeAt(a)===Tu&&++a,i.slice(a,l))},toNamespacedPath(n){if(typeof n!="string"||n.length===0)return n;const e=bc.resolve(n);if(e.length<=2)return n;if(e.charCodeAt(0)===Tu){if(e.charCodeAt(1)===Tu){const t=e.charCodeAt(2);if(t!==Rmt&&t!==ib)return`\\\\?\\UNC\\${e.slice(2)}`}}else if(V0(e.charCodeAt(0))&&e.charCodeAt(1)===H0&&e.charCodeAt(2)===Tu)return`\\\\?\\${e}`;return n},dirname(n){No(n,"path");const e=n.length;if(e===0)return".";let t=-1,i=0;const r=n.charCodeAt(0);if(e===1)return zi(r)?n:".";if(zi(r)){if(t=i=1,zi(n.charCodeAt(1))){let a=2,l=a;for(;a2&&zi(n.charCodeAt(2))?3:2,i=t);let s=-1,o=!0;for(let a=e-1;a>=i;--a)if(zi(n.charCodeAt(a))){if(!o){s=a;break}}else o=!1;if(s===-1){if(t===-1)return".";s=t}return n.slice(0,s)},basename(n,e){e!==void 0&&No(e,"suffix"),No(n,"path");let t=0,i=-1,r=!0,s;if(n.length>=2&&V0(n.charCodeAt(0))&&n.charCodeAt(1)===H0&&(t=2),e!==void 0&&e.length>0&&e.length<=n.length){if(e===n)return"";let o=e.length-1,a=-1;for(s=n.length-1;s>=t;--s){const l=n.charCodeAt(s);if(zi(l)){if(!r){t=s+1;break}}else a===-1&&(r=!1,a=s+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(i=s):(o=-1,i=a))}return t===i?i=a:i===-1&&(i=n.length),n.slice(t,i)}for(s=n.length-1;s>=t;--s)if(zi(n.charCodeAt(s))){if(!r){t=s+1;break}}else i===-1&&(r=!1,i=s+1);return i===-1?"":n.slice(t,i)},extname(n){No(n,"path");let e=0,t=-1,i=0,r=-1,s=!0,o=0;n.length>=2&&n.charCodeAt(1)===H0&&V0(n.charCodeAt(0))&&(e=i=2);for(let a=n.length-1;a>=e;--a){const l=n.charCodeAt(a);if(zi(l)){if(!s){i=a+1;break}continue}r===-1&&(s=!1,r=a+1),l===ib?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===i+1?"":n.slice(t,r)},format:T4e.bind(null,"\\"),parse(n){No(n,"path");const e={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return e;const t=n.length;let i=0,r=n.charCodeAt(0);if(t===1)return zi(r)?(e.root=e.dir=n,e):(e.base=e.name=n,e);if(zi(r)){if(i=1,zi(n.charCodeAt(1))){let d=2,h=d;for(;d0&&(e.root=n.slice(0,i));let s=-1,o=i,a=-1,l=!0,c=n.length-1,u=0;for(;c>=i;--c){if(r=n.charCodeAt(c),zi(r)){if(!l){o=c+1;break}continue}a===-1&&(l=!1,a=c+1),r===ib?s===-1?s=c:u!==1&&(u=1):s!==-1&&(u=-1)}return a!==-1&&(s===-1||u===0||u===1&&s===a-1&&s===o+1?e.base=e.name=n.slice(o,a):(e.name=n.slice(o,s),e.base=n.slice(o,a),e.ext=n.slice(s,a))),o>0&&o!==i?e.dir=n.slice(0,o-1):e.dir=e.root,e},sep:"\\",delimiter:";",win32:null,posix:null},Mmt=(()=>{if(g0){const n=/\\/g;return()=>{const e=M6().replace(n,"/");return e.slice(e.indexOf("/"))}}return()=>M6()})(),Ms={resolve(...n){let e="",t=!1;for(let i=n.length-1;i>=-1&&!t;i--){const r=i>=0?n[i]:Mmt();No(r,`paths[${i}]`),r.length!==0&&(e=`${r}/${e}`,t=r.charCodeAt(0)===al)}return e=F6(e,!t,"/",hZ),t?`/${e}`:e.length>0?e:"."},normalize(n){if(No(n,"path"),n.length===0)return".";const e=n.charCodeAt(0)===al,t=n.charCodeAt(n.length-1)===al;return n=F6(n,!e,"/",hZ),n.length===0?e?"/":t?"./":".":(t&&(n+="/"),e?`/${n}`:n)},isAbsolute(n){return No(n,"path"),n.length>0&&n.charCodeAt(0)===al},join(...n){if(n.length===0)return".";let e;for(let t=0;t0&&(e===void 0?e=i:e+=`/${i}`)}return e===void 0?".":Ms.normalize(e)},relative(n,e){if(No(n,"from"),No(e,"to"),n===e||(n=Ms.resolve(n),e=Ms.resolve(e),n===e))return"";const t=1,i=n.length,r=i-t,s=1,o=e.length-s,a=ra){if(e.charCodeAt(s+c)===al)return e.slice(s+c+1);if(c===0)return e.slice(s+c)}else r>a&&(n.charCodeAt(t+c)===al?l=c:c===0&&(l=0));let u="";for(c=t+l+1;c<=i;++c)(c===i||n.charCodeAt(c)===al)&&(u+=u.length===0?"..":"/..");return`${u}${e.slice(s+l)}`},toNamespacedPath(n){return n},dirname(n){if(No(n,"path"),n.length===0)return".";const e=n.charCodeAt(0)===al;let t=-1,i=!0;for(let r=n.length-1;r>=1;--r)if(n.charCodeAt(r)===al){if(!i){t=r;break}}else i=!1;return t===-1?e?"/":".":e&&t===1?"//":n.slice(0,t)},basename(n,e){e!==void 0&&No(e,"ext"),No(n,"path");let t=0,i=-1,r=!0,s;if(e!==void 0&&e.length>0&&e.length<=n.length){if(e===n)return"";let o=e.length-1,a=-1;for(s=n.length-1;s>=0;--s){const l=n.charCodeAt(s);if(l===al){if(!r){t=s+1;break}}else a===-1&&(r=!1,a=s+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(i=s):(o=-1,i=a))}return t===i?i=a:i===-1&&(i=n.length),n.slice(t,i)}for(s=n.length-1;s>=0;--s)if(n.charCodeAt(s)===al){if(!r){t=s+1;break}}else i===-1&&(r=!1,i=s+1);return i===-1?"":n.slice(t,i)},extname(n){No(n,"path");let e=-1,t=0,i=-1,r=!0,s=0;for(let o=n.length-1;o>=0;--o){const a=n.charCodeAt(o);if(a===al){if(!r){t=o+1;break}continue}i===-1&&(r=!1,i=o+1),a===ib?e===-1?e=o:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||i===-1||s===0||s===1&&e===i-1&&e===t+1?"":n.slice(e,i)},format:T4e.bind(null,"/"),parse(n){No(n,"path");const e={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return e;const t=n.charCodeAt(0)===al;let i;t?(e.root="/",i=1):i=0;let r=-1,s=0,o=-1,a=!0,l=n.length-1,c=0;for(;l>=i;--l){const u=n.charCodeAt(l);if(u===al){if(!a){s=l+1;break}continue}o===-1&&(a=!1,o=l+1),u===ib?r===-1?r=l:c!==1&&(c=1):r!==-1&&(c=-1)}if(o!==-1){const u=s===0&&t?1:s;r===-1||c===0||c===1&&r===o-1&&r===s+1?e.base=e.name=n.slice(u,o):(e.name=n.slice(u,r),e.base=n.slice(u,o),e.ext=n.slice(r,o))}return s>0?e.dir=n.slice(0,s-1):t&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};Ms.win32=bc.win32=bc;Ms.posix=bc.posix=Ms;const D4e=g0?bc.normalize:Ms.normalize,Fmt=g0?bc.join:Ms.join,Bmt=g0?bc.resolve:Ms.resolve,$mt=g0?bc.relative:Ms.relative,I4e=g0?bc.dirname:Ms.dirname,rb=g0?bc.basename:Ms.basename,Wmt=g0?bc.extname:Ms.extname,fg=g0?bc.sep:Ms.sep,Hmt=/^\w[\w\d+.-]*$/,Vmt=/^\//,zmt=/^\/\//;function Umt(n,e){if(!n.scheme&&e)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${n.authority}", path: "${n.path}", query: "${n.query}", fragment: "${n.fragment}"}`);if(n.scheme&&!Hmt.test(n.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(n.path){if(n.authority){if(!Vmt.test(n.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(zmt.test(n.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function jmt(n,e){return!n&&!e?"file":n}function qmt(n,e){switch(n){case"https":case"http":case"file":e?e[0]!==Zf&&(e=Zf+e):e=Zf;break}return e}const Rs="",Zf="/",Kmt=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;let Pt=class $F{static isUri(e){return e instanceof $F?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="string"&&typeof e.with=="function"&&typeof e.toString=="function":!1}constructor(e,t,i,r,s,o=!1){typeof e=="object"?(this.scheme=e.scheme||Rs,this.authority=e.authority||Rs,this.path=e.path||Rs,this.query=e.query||Rs,this.fragment=e.fragment||Rs):(this.scheme=jmt(e,o),this.authority=t||Rs,this.path=qmt(this.scheme,i||Rs),this.query=r||Rs,this.fragment=s||Rs,Umt(this,o))}get fsPath(){return B6(this,!1)}with(e){if(!e)return this;let{scheme:t,authority:i,path:r,query:s,fragment:o}=e;return t===void 0?t=this.scheme:t===null&&(t=Rs),i===void 0?i=this.authority:i===null&&(i=Rs),r===void 0?r=this.path:r===null&&(r=Rs),s===void 0?s=this.query:s===null&&(s=Rs),o===void 0?o=this.fragment:o===null&&(o=Rs),t===this.scheme&&i===this.authority&&r===this.path&&s===this.query&&o===this.fragment?this:new lx(t,i,r,s,o)}static parse(e,t=!1){const i=Kmt.exec(e);return i?new lx(i[2]||Rs,y4(i[4]||Rs),y4(i[5]||Rs),y4(i[7]||Rs),y4(i[9]||Rs),t):new lx(Rs,Rs,Rs,Rs,Rs)}static file(e){let t=Rs;if(Ta&&(e=e.replace(/\\/g,Zf)),e[0]===Zf&&e[1]===Zf){const i=e.indexOf(Zf,2);i===-1?(t=e.substring(2),e=Zf):(t=e.substring(2,i),e=e.substring(i)||Zf)}return new lx("file",t,e,Rs,Rs)}static from(e,t){return new lx(e.scheme,e.authority,e.path,e.query,e.fragment,t)}static joinPath(e,...t){if(!e.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let i;return Ta&&e.scheme==="file"?i=$F.file(bc.join(B6(e,!0),...t)).path:i=Ms.join(e.path,...t),e.with({path:i})}toString(e=!1){return fZ(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof $F)return e;{const t=new lx(e);return t._formatted=e.external??null,t._fsPath=e._sep===A4e?e.fsPath??null:null,t}}else return e}};const A4e=Ta?1:void 0;let lx=class extends Pt{constructor(){super(...arguments),this._formatted=null,this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=B6(this,!1)),this._fsPath}toString(e=!1){return e?fZ(this,!0):(this._formatted||(this._formatted=fZ(this,!1)),this._formatted)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=A4e),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}};const N4e={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function Fve(n,e,t){let i,r=-1;for(let s=0;s=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||o===45||o===46||o===95||o===126||e&&o===47||t&&o===91||t&&o===93||t&&o===58)r!==-1&&(i+=encodeURIComponent(n.substring(r,s)),r=-1),i!==void 0&&(i+=n.charAt(s));else{i===void 0&&(i=n.substr(0,s));const a=N4e[o];a!==void 0?(r!==-1&&(i+=encodeURIComponent(n.substring(r,s)),r=-1),i+=a):r===-1&&(r=s)}}return r!==-1&&(i+=encodeURIComponent(n.substring(r))),i!==void 0?i:n}function Gmt(n){let e;for(let t=0;t1&&n.scheme==="file"?t=`//${n.authority}${n.path}`:n.path.charCodeAt(0)===47&&(n.path.charCodeAt(1)>=65&&n.path.charCodeAt(1)<=90||n.path.charCodeAt(1)>=97&&n.path.charCodeAt(1)<=122)&&n.path.charCodeAt(2)===58?e?t=n.path.substr(1):t=n.path[1].toLowerCase()+n.path.substr(2):t=n.path,Ta&&(t=t.replace(/\//g,"\\")),t}function fZ(n,e){const t=e?Gmt:Fve;let i="",{scheme:r,authority:s,path:o,query:a,fragment:l}=n;if(r&&(i+=r,i+=":"),(s||r==="file")&&(i+=Zf,i+=Zf),s){let c=s.indexOf("@");if(c!==-1){const u=s.substr(0,c);s=s.substr(c+1),c=u.lastIndexOf(":"),c===-1?i+=t(u,!1,!1):(i+=t(u.substr(0,c),!1,!1),i+=":",i+=t(u.substr(c+1),!1,!0)),i+="@"}s=s.toLowerCase(),c=s.lastIndexOf(":"),c===-1?i+=t(s,!1,!0):(i+=t(s.substr(0,c),!1,!0),i+=s.substr(c))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){const c=o.charCodeAt(1);c>=65&&c<=90&&(o=`/${String.fromCharCode(c+32)}:${o.substr(3)}`)}else if(o.length>=2&&o.charCodeAt(1)===58){const c=o.charCodeAt(0);c>=65&&c<=90&&(o=`${String.fromCharCode(c+32)}:${o.substr(2)}`)}i+=t(o,!0,!1)}return a&&(i+="?",i+=t(a,!1,!1)),l&&(i+="#",i+=e?l:Fve(l,!1,!1)),i}function R4e(n){try{return decodeURIComponent(n)}catch{return n.length>3?n.substr(0,3)+R4e(n.substr(3)):n}}const Bve=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function y4(n){return n.match(Bve)?n.replace(Bve,e=>R4e(e)):n}let he=class z1{constructor(e,t){this.lineNumber=e,this.column=t}with(e=this.lineNumber,t=this.column){return e===this.lineNumber&&t===this.column?this:new z1(e,t)}delta(e=0,t=0){return this.with(this.lineNumber+e,this.column+t)}equals(e){return z1.equals(this,e)}static equals(e,t){return!e&&!t?!0:!!e&&!!t&&e.lineNumber===t.lineNumber&&e.column===t.column}isBefore(e){return z1.isBefore(this,e)}static isBefore(e,t){return e.lineNumberi||e===i&&t>r?(this.startLineNumber=i,this.startColumn=r,this.endLineNumber=e,this.endColumn=t):(this.startLineNumber=e,this.startColumn=t,this.endLineNumber=i,this.endColumn=r)}isEmpty(){return Uo.isEmpty(this)}static isEmpty(e){return e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn}containsPosition(e){return Uo.containsPosition(this,e)}static containsPosition(e,t){return!(t.lineNumbere.endLineNumber||t.lineNumber===e.startLineNumber&&t.columne.endColumn)}static strictContainsPosition(e,t){return!(t.lineNumbere.endLineNumber||t.lineNumber===e.startLineNumber&&t.column<=e.startColumn||t.lineNumber===e.endLineNumber&&t.column>=e.endColumn)}containsRange(e){return Uo.containsRange(this,e)}static containsRange(e,t){return!(t.startLineNumbere.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumne.endColumn)}strictContainsRange(e){return Uo.strictContainsRange(this,e)}static strictContainsRange(e,t){return!(t.startLineNumbere.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumn<=e.startColumn||t.endLineNumber===e.endLineNumber&&t.endColumn>=e.endColumn)}plusRange(e){return Uo.plusRange(this,e)}static plusRange(e,t){let i,r,s,o;return t.startLineNumbere.endLineNumber?(s=t.endLineNumber,o=t.endColumn):t.endLineNumber===e.endLineNumber?(s=t.endLineNumber,o=Math.max(t.endColumn,e.endColumn)):(s=e.endLineNumber,o=e.endColumn),new Uo(i,r,s,o)}intersectRanges(e){return Uo.intersectRanges(this,e)}static intersectRanges(e,t){let i=e.startLineNumber,r=e.startColumn,s=e.endLineNumber,o=e.endColumn;const a=t.startLineNumber,l=t.startColumn,c=t.endLineNumber,u=t.endColumn;return ic?(s=c,o=u):s===c&&(o=Math.min(o,u)),i>s||i===s&&r>o?null:new Uo(i,r,s,o)}equalsRange(e){return Uo.equalsRange(this,e)}static equalsRange(e,t){return!e&&!t?!0:!!e&&!!t&&e.startLineNumber===t.startLineNumber&&e.startColumn===t.startColumn&&e.endLineNumber===t.endLineNumber&&e.endColumn===t.endColumn}getEndPosition(){return Uo.getEndPosition(this)}static getEndPosition(e){return new he(e.endLineNumber,e.endColumn)}getStartPosition(){return Uo.getStartPosition(this)}static getStartPosition(e){return new he(e.startLineNumber,e.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(e,t){return new Uo(this.startLineNumber,this.startColumn,e,t)}setStartPosition(e,t){return new Uo(e,t,this.endLineNumber,this.endColumn)}collapseToStart(){return Uo.collapseToStart(this)}static collapseToStart(e){return new Uo(e.startLineNumber,e.startColumn,e.startLineNumber,e.startColumn)}collapseToEnd(){return Uo.collapseToEnd(this)}static collapseToEnd(e){return new Uo(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn)}delta(e){return new Uo(this.startLineNumber+e,this.startColumn,this.endLineNumber+e,this.endColumn)}static fromPositions(e,t=e){return new Uo(e.lineNumber,e.column,t.lineNumber,t.column)}static lift(e){return e?new Uo(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn):null}static isIRange(e){return e&&typeof e.startLineNumber=="number"&&typeof e.startColumn=="number"&&typeof e.endLineNumber=="number"&&typeof e.endColumn=="number"}static areIntersectingOrTouching(e,t){return!(e.endLineNumbere.startLineNumber}toJSON(){return this}},yt=class Eh extends ${constructor(e,t,i,r){super(e,t,i,r),this.selectionStartLineNumber=e,this.selectionStartColumn=t,this.positionLineNumber=i,this.positionColumn=r}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(e){return Eh.selectionsEqual(this,e)}static selectionsEqual(e,t){return e.selectionStartLineNumber===t.selectionStartLineNumber&&e.selectionStartColumn===t.selectionStartColumn&&e.positionLineNumber===t.positionLineNumber&&e.positionColumn===t.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(e,t){return this.getDirection()===0?new Eh(this.startLineNumber,this.startColumn,e,t):new Eh(e,t,this.startLineNumber,this.startColumn)}getPosition(){return new he(this.positionLineNumber,this.positionColumn)}getSelectionStart(){return new he(this.selectionStartLineNumber,this.selectionStartColumn)}setStartPosition(e,t){return this.getDirection()===0?new Eh(e,t,this.endLineNumber,this.endColumn):new Eh(this.endLineNumber,this.endColumn,e,t)}static fromPositions(e,t=e){return new Eh(e.lineNumber,e.column,t.lineNumber,t.column)}static fromRange(e,t){return t===0?new Eh(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn):new Eh(e.endLineNumber,e.endColumn,e.startLineNumber,e.startColumn)}static liftSelection(e){return new Eh(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn)}static selectionsArrEqual(e,t){if(e&&!t||!e&&t)return!1;if(!e&&!t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i{this._tokenizationSupports.get(e)===t&&(this._tokenizationSupports.delete(e),this.handleChange([e]))})}get(e){return this._tokenizationSupports.get(e)||null}registerFactory(e,t){this._factories.get(e)?.dispose();const i=new Xmt(this,e,t);return this._factories.set(e,i),Lt(()=>{const r=this._factories.get(e);!r||r!==i||(this._factories.delete(e),r.dispose())})}async getOrCreate(e){const t=this.get(e);if(t)return t;const i=this._factories.get(e);return!i||i.isResolved?null:(await i.resolve(),this.get(e))}isResolved(e){if(this.get(e))return!0;const i=this._factories.get(e);return!!(!i||i.isResolved)}setColorMap(e){this._colorMap=e,this._onDidChange.fire({changedLanguages:Array.from(this._tokenizationSupports.keys()),changedColorMap:!0})}getColorMap(){return this._colorMap}getDefaultBackground(){return this._colorMap&&this._colorMap.length>2?this._colorMap[2]:null}};class Xmt extends me{get isResolved(){return this._isResolved}constructor(e,t,i){super(),this._registry=e,this._languageId=t,this._factory=i,this._isDisposed=!1,this._resolvePromise=null,this._isResolved=!1}dispose(){this._isDisposed=!0,super.dispose()}async resolve(){return this._resolvePromise||(this._resolvePromise=this._create()),this._resolvePromise}async _create(){const e=await this._factory.tokenizationSupport;this._isResolved=!0,e&&!this._isDisposed&&this._register(this._registry.register(this._languageId,e))}}let iN=class{constructor(e,t,i){this.offset=e,this.type=t,this.language=i,this._tokenBrand=void 0}toString(){return"("+this.offset+", "+this.type+")"}};class kae{constructor(e,t){this.tokens=e,this.endState=t,this._tokenizationResultBrand=void 0}}class P${constructor(e,t){this.tokens=e,this.endState=t,this._encodedTokenizationResultBrand=void 0}}var Zc;(function(n){n[n.Increase=0]="Increase",n[n.Decrease=1]="Decrease"})(Zc||(Zc={}));var rN;(function(n){const e=new Map;e.set(0,ze.symbolMethod),e.set(1,ze.symbolFunction),e.set(2,ze.symbolConstructor),e.set(3,ze.symbolField),e.set(4,ze.symbolVariable),e.set(5,ze.symbolClass),e.set(6,ze.symbolStruct),e.set(7,ze.symbolInterface),e.set(8,ze.symbolModule),e.set(9,ze.symbolProperty),e.set(10,ze.symbolEvent),e.set(11,ze.symbolOperator),e.set(12,ze.symbolUnit),e.set(13,ze.symbolValue),e.set(15,ze.symbolEnum),e.set(14,ze.symbolConstant),e.set(15,ze.symbolEnum),e.set(16,ze.symbolEnumMember),e.set(17,ze.symbolKeyword),e.set(27,ze.symbolSnippet),e.set(18,ze.symbolText),e.set(19,ze.symbolColor),e.set(20,ze.symbolFile),e.set(21,ze.symbolReference),e.set(22,ze.symbolCustomColor),e.set(23,ze.symbolFolder),e.set(24,ze.symbolTypeParameter),e.set(25,ze.account),e.set(26,ze.issues);function t(s){let o=e.get(s);return o||(console.info("No codicon found for CompletionItemKind "+s),o=ze.symbolProperty),o}n.toIcon=t;const i=new Map;i.set("method",0),i.set("function",1),i.set("constructor",2),i.set("field",3),i.set("variable",4),i.set("class",5),i.set("struct",6),i.set("interface",7),i.set("module",8),i.set("property",9),i.set("event",10),i.set("operator",11),i.set("unit",12),i.set("value",13),i.set("constant",14),i.set("enum",15),i.set("enum-member",16),i.set("enumMember",16),i.set("keyword",17),i.set("snippet",27),i.set("text",18),i.set("color",19),i.set("file",20),i.set("reference",21),i.set("customcolor",22),i.set("folder",23),i.set("type-parameter",24),i.set("typeParameter",24),i.set("account",25),i.set("issue",26);function r(s,o){let a=i.get(s);return typeof a>"u"&&!o&&(a=9),a}n.fromString=r})(rN||(rN={}));var gg;(function(n){n[n.Automatic=0]="Automatic",n[n.Explicit=1]="Explicit"})(gg||(gg={}));class M4e{constructor(e,t,i,r){this.range=e,this.text=t,this.completionKind=i,this.isSnippetText=r}equals(e){return $.lift(this.range).equalsRange(e.range)&&this.text===e.text&&this.completionKind===e.completionKind&&this.isSnippetText===e.isSnippetText}}var sN;(function(n){n[n.Automatic=0]="Automatic",n[n.PasteAs=1]="PasteAs"})(sN||(sN={}));var $p;(function(n){n[n.Invoke=1]="Invoke",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.ContentChange=3]="ContentChange"})($p||($p={}));var nE;(function(n){n[n.Text=0]="Text",n[n.Read=1]="Read",n[n.Write=2]="Write"})(nE||(nE={}));function Qmt(n){return n&&Pt.isUri(n.uri)&&$.isIRange(n.range)&&($.isIRange(n.originSelectionRange)||$.isIRange(n.targetSelectionRange))}const Jmt={17:w("Array","array"),16:w("Boolean","boolean"),4:w("Class","class"),13:w("Constant","constant"),8:w("Constructor","constructor"),9:w("Enum","enumeration"),21:w("EnumMember","enumeration member"),23:w("Event","event"),7:w("Field","field"),0:w("File","file"),11:w("Function","function"),10:w("Interface","interface"),19:w("Key","key"),5:w("Method","method"),1:w("Module","module"),2:w("Namespace","namespace"),20:w("Null","null"),15:w("Number","number"),18:w("Object","object"),24:w("Operator","operator"),3:w("Package","package"),6:w("Property","property"),14:w("String","string"),22:w("Struct","struct"),25:w("TypeParameter","type parameter"),12:w("Variable","variable")};function e_t(n,e){return w("symbolAriaLabel","{0} ({1})",n,Jmt[e])}var $6;(function(n){const e=new Map;e.set(0,ze.symbolFile),e.set(1,ze.symbolModule),e.set(2,ze.symbolNamespace),e.set(3,ze.symbolPackage),e.set(4,ze.symbolClass),e.set(5,ze.symbolMethod),e.set(6,ze.symbolProperty),e.set(7,ze.symbolField),e.set(8,ze.symbolConstructor),e.set(9,ze.symbolEnum),e.set(10,ze.symbolInterface),e.set(11,ze.symbolFunction),e.set(12,ze.symbolVariable),e.set(13,ze.symbolConstant),e.set(14,ze.symbolString),e.set(15,ze.symbolNumber),e.set(16,ze.symbolBoolean),e.set(17,ze.symbolArray),e.set(18,ze.symbolObject),e.set(19,ze.symbolKey),e.set(20,ze.symbolNull),e.set(21,ze.symbolEnumMember),e.set(22,ze.symbolStruct),e.set(23,ze.symbolEvent),e.set(24,ze.symbolOperator),e.set(25,ze.symbolTypeParameter);function t(i){let r=e.get(i);return r||(console.info("No codicon found for SymbolKind "+i),r=ze.symbolProperty),r}n.toIcon=t})($6||($6={}));let jL=class Y0{static{this.Comment=new Y0("comment")}static{this.Imports=new Y0("imports")}static{this.Region=new Y0("region")}static fromValue(e){switch(e){case"comment":return Y0.Comment;case"imports":return Y0.Imports;case"region":return Y0.Region}return new Y0(e)}constructor(e){this.value=e}};var pZ;(function(n){n[n.AIGenerated=1]="AIGenerated"})(pZ||(pZ={}));var oN;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(oN||(oN={}));var mZ;(function(n){function e(t){return!t||typeof t!="object"?!1:typeof t.id=="string"&&typeof t.title=="string"}n.is=e})(mZ||(mZ={}));var W6;(function(n){n[n.Type=1]="Type",n[n.Parameter=2]="Parameter"})(W6||(W6={}));class t_t{constructor(e){this.createSupport=e,this._tokenizationSupport=null}dispose(){this._tokenizationSupport&&this._tokenizationSupport.then(e=>{e&&e.dispose()})}get tokenizationSupport(){return this._tokenizationSupport||(this._tokenizationSupport=this.createSupport()),this._tokenizationSupport}}const rs=new O4e,_Z=new O4e;var H6;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(H6||(H6={}));var vZ;(function(n){n[n.Unknown=0]="Unknown",n[n.Disabled=1]="Disabled",n[n.Enabled=2]="Enabled"})(vZ||(vZ={}));var bZ;(function(n){n[n.Invoke=1]="Invoke",n[n.Auto=2]="Auto"})(bZ||(bZ={}));var yZ;(function(n){n[n.None=0]="None",n[n.KeepWhitespace=1]="KeepWhitespace",n[n.InsertAsSnippet=4]="InsertAsSnippet"})(yZ||(yZ={}));var wZ;(function(n){n[n.Method=0]="Method",n[n.Function=1]="Function",n[n.Constructor=2]="Constructor",n[n.Field=3]="Field",n[n.Variable=4]="Variable",n[n.Class=5]="Class",n[n.Struct=6]="Struct",n[n.Interface=7]="Interface",n[n.Module=8]="Module",n[n.Property=9]="Property",n[n.Event=10]="Event",n[n.Operator=11]="Operator",n[n.Unit=12]="Unit",n[n.Value=13]="Value",n[n.Constant=14]="Constant",n[n.Enum=15]="Enum",n[n.EnumMember=16]="EnumMember",n[n.Keyword=17]="Keyword",n[n.Text=18]="Text",n[n.Color=19]="Color",n[n.File=20]="File",n[n.Reference=21]="Reference",n[n.Customcolor=22]="Customcolor",n[n.Folder=23]="Folder",n[n.TypeParameter=24]="TypeParameter",n[n.User=25]="User",n[n.Issue=26]="Issue",n[n.Snippet=27]="Snippet"})(wZ||(wZ={}));var CZ;(function(n){n[n.Deprecated=1]="Deprecated"})(CZ||(CZ={}));var xZ;(function(n){n[n.Invoke=0]="Invoke",n[n.TriggerCharacter=1]="TriggerCharacter",n[n.TriggerForIncompleteCompletions=2]="TriggerForIncompleteCompletions"})(xZ||(xZ={}));var SZ;(function(n){n[n.EXACT=0]="EXACT",n[n.ABOVE=1]="ABOVE",n[n.BELOW=2]="BELOW"})(SZ||(SZ={}));var kZ;(function(n){n[n.NotSet=0]="NotSet",n[n.ContentFlush=1]="ContentFlush",n[n.RecoverFromMarkers=2]="RecoverFromMarkers",n[n.Explicit=3]="Explicit",n[n.Paste=4]="Paste",n[n.Undo=5]="Undo",n[n.Redo=6]="Redo"})(kZ||(kZ={}));var EZ;(function(n){n[n.LF=1]="LF",n[n.CRLF=2]="CRLF"})(EZ||(EZ={}));var LZ;(function(n){n[n.Text=0]="Text",n[n.Read=1]="Read",n[n.Write=2]="Write"})(LZ||(LZ={}));var TZ;(function(n){n[n.None=0]="None",n[n.Keep=1]="Keep",n[n.Brackets=2]="Brackets",n[n.Advanced=3]="Advanced",n[n.Full=4]="Full"})(TZ||(TZ={}));var DZ;(function(n){n[n.acceptSuggestionOnCommitCharacter=0]="acceptSuggestionOnCommitCharacter",n[n.acceptSuggestionOnEnter=1]="acceptSuggestionOnEnter",n[n.accessibilitySupport=2]="accessibilitySupport",n[n.accessibilityPageSize=3]="accessibilityPageSize",n[n.ariaLabel=4]="ariaLabel",n[n.ariaRequired=5]="ariaRequired",n[n.autoClosingBrackets=6]="autoClosingBrackets",n[n.autoClosingComments=7]="autoClosingComments",n[n.screenReaderAnnounceInlineSuggestion=8]="screenReaderAnnounceInlineSuggestion",n[n.autoClosingDelete=9]="autoClosingDelete",n[n.autoClosingOvertype=10]="autoClosingOvertype",n[n.autoClosingQuotes=11]="autoClosingQuotes",n[n.autoIndent=12]="autoIndent",n[n.automaticLayout=13]="automaticLayout",n[n.autoSurround=14]="autoSurround",n[n.bracketPairColorization=15]="bracketPairColorization",n[n.guides=16]="guides",n[n.codeLens=17]="codeLens",n[n.codeLensFontFamily=18]="codeLensFontFamily",n[n.codeLensFontSize=19]="codeLensFontSize",n[n.colorDecorators=20]="colorDecorators",n[n.colorDecoratorsLimit=21]="colorDecoratorsLimit",n[n.columnSelection=22]="columnSelection",n[n.comments=23]="comments",n[n.contextmenu=24]="contextmenu",n[n.copyWithSyntaxHighlighting=25]="copyWithSyntaxHighlighting",n[n.cursorBlinking=26]="cursorBlinking",n[n.cursorSmoothCaretAnimation=27]="cursorSmoothCaretAnimation",n[n.cursorStyle=28]="cursorStyle",n[n.cursorSurroundingLines=29]="cursorSurroundingLines",n[n.cursorSurroundingLinesStyle=30]="cursorSurroundingLinesStyle",n[n.cursorWidth=31]="cursorWidth",n[n.disableLayerHinting=32]="disableLayerHinting",n[n.disableMonospaceOptimizations=33]="disableMonospaceOptimizations",n[n.domReadOnly=34]="domReadOnly",n[n.dragAndDrop=35]="dragAndDrop",n[n.dropIntoEditor=36]="dropIntoEditor",n[n.emptySelectionClipboard=37]="emptySelectionClipboard",n[n.experimentalWhitespaceRendering=38]="experimentalWhitespaceRendering",n[n.extraEditorClassName=39]="extraEditorClassName",n[n.fastScrollSensitivity=40]="fastScrollSensitivity",n[n.find=41]="find",n[n.fixedOverflowWidgets=42]="fixedOverflowWidgets",n[n.folding=43]="folding",n[n.foldingStrategy=44]="foldingStrategy",n[n.foldingHighlight=45]="foldingHighlight",n[n.foldingImportsByDefault=46]="foldingImportsByDefault",n[n.foldingMaximumRegions=47]="foldingMaximumRegions",n[n.unfoldOnClickAfterEndOfLine=48]="unfoldOnClickAfterEndOfLine",n[n.fontFamily=49]="fontFamily",n[n.fontInfo=50]="fontInfo",n[n.fontLigatures=51]="fontLigatures",n[n.fontSize=52]="fontSize",n[n.fontWeight=53]="fontWeight",n[n.fontVariations=54]="fontVariations",n[n.formatOnPaste=55]="formatOnPaste",n[n.formatOnType=56]="formatOnType",n[n.glyphMargin=57]="glyphMargin",n[n.gotoLocation=58]="gotoLocation",n[n.hideCursorInOverviewRuler=59]="hideCursorInOverviewRuler",n[n.hover=60]="hover",n[n.inDiffEditor=61]="inDiffEditor",n[n.inlineSuggest=62]="inlineSuggest",n[n.inlineEdit=63]="inlineEdit",n[n.letterSpacing=64]="letterSpacing",n[n.lightbulb=65]="lightbulb",n[n.lineDecorationsWidth=66]="lineDecorationsWidth",n[n.lineHeight=67]="lineHeight",n[n.lineNumbers=68]="lineNumbers",n[n.lineNumbersMinChars=69]="lineNumbersMinChars",n[n.linkedEditing=70]="linkedEditing",n[n.links=71]="links",n[n.matchBrackets=72]="matchBrackets",n[n.minimap=73]="minimap",n[n.mouseStyle=74]="mouseStyle",n[n.mouseWheelScrollSensitivity=75]="mouseWheelScrollSensitivity",n[n.mouseWheelZoom=76]="mouseWheelZoom",n[n.multiCursorMergeOverlapping=77]="multiCursorMergeOverlapping",n[n.multiCursorModifier=78]="multiCursorModifier",n[n.multiCursorPaste=79]="multiCursorPaste",n[n.multiCursorLimit=80]="multiCursorLimit",n[n.occurrencesHighlight=81]="occurrencesHighlight",n[n.overviewRulerBorder=82]="overviewRulerBorder",n[n.overviewRulerLanes=83]="overviewRulerLanes",n[n.padding=84]="padding",n[n.pasteAs=85]="pasteAs",n[n.parameterHints=86]="parameterHints",n[n.peekWidgetDefaultFocus=87]="peekWidgetDefaultFocus",n[n.placeholder=88]="placeholder",n[n.definitionLinkOpensInPeek=89]="definitionLinkOpensInPeek",n[n.quickSuggestions=90]="quickSuggestions",n[n.quickSuggestionsDelay=91]="quickSuggestionsDelay",n[n.readOnly=92]="readOnly",n[n.readOnlyMessage=93]="readOnlyMessage",n[n.renameOnType=94]="renameOnType",n[n.renderControlCharacters=95]="renderControlCharacters",n[n.renderFinalNewline=96]="renderFinalNewline",n[n.renderLineHighlight=97]="renderLineHighlight",n[n.renderLineHighlightOnlyWhenFocus=98]="renderLineHighlightOnlyWhenFocus",n[n.renderValidationDecorations=99]="renderValidationDecorations",n[n.renderWhitespace=100]="renderWhitespace",n[n.revealHorizontalRightPadding=101]="revealHorizontalRightPadding",n[n.roundedSelection=102]="roundedSelection",n[n.rulers=103]="rulers",n[n.scrollbar=104]="scrollbar",n[n.scrollBeyondLastColumn=105]="scrollBeyondLastColumn",n[n.scrollBeyondLastLine=106]="scrollBeyondLastLine",n[n.scrollPredominantAxis=107]="scrollPredominantAxis",n[n.selectionClipboard=108]="selectionClipboard",n[n.selectionHighlight=109]="selectionHighlight",n[n.selectOnLineNumbers=110]="selectOnLineNumbers",n[n.showFoldingControls=111]="showFoldingControls",n[n.showUnused=112]="showUnused",n[n.snippetSuggestions=113]="snippetSuggestions",n[n.smartSelect=114]="smartSelect",n[n.smoothScrolling=115]="smoothScrolling",n[n.stickyScroll=116]="stickyScroll",n[n.stickyTabStops=117]="stickyTabStops",n[n.stopRenderingLineAfter=118]="stopRenderingLineAfter",n[n.suggest=119]="suggest",n[n.suggestFontSize=120]="suggestFontSize",n[n.suggestLineHeight=121]="suggestLineHeight",n[n.suggestOnTriggerCharacters=122]="suggestOnTriggerCharacters",n[n.suggestSelection=123]="suggestSelection",n[n.tabCompletion=124]="tabCompletion",n[n.tabIndex=125]="tabIndex",n[n.unicodeHighlighting=126]="unicodeHighlighting",n[n.unusualLineTerminators=127]="unusualLineTerminators",n[n.useShadowDOM=128]="useShadowDOM",n[n.useTabStops=129]="useTabStops",n[n.wordBreak=130]="wordBreak",n[n.wordSegmenterLocales=131]="wordSegmenterLocales",n[n.wordSeparators=132]="wordSeparators",n[n.wordWrap=133]="wordWrap",n[n.wordWrapBreakAfterCharacters=134]="wordWrapBreakAfterCharacters",n[n.wordWrapBreakBeforeCharacters=135]="wordWrapBreakBeforeCharacters",n[n.wordWrapColumn=136]="wordWrapColumn",n[n.wordWrapOverride1=137]="wordWrapOverride1",n[n.wordWrapOverride2=138]="wordWrapOverride2",n[n.wrappingIndent=139]="wrappingIndent",n[n.wrappingStrategy=140]="wrappingStrategy",n[n.showDeprecated=141]="showDeprecated",n[n.inlayHints=142]="inlayHints",n[n.editorClassName=143]="editorClassName",n[n.pixelRatio=144]="pixelRatio",n[n.tabFocusMode=145]="tabFocusMode",n[n.layoutInfo=146]="layoutInfo",n[n.wrappingInfo=147]="wrappingInfo",n[n.defaultColorDecorators=148]="defaultColorDecorators",n[n.colorDecoratorsActivatedOn=149]="colorDecoratorsActivatedOn",n[n.inlineCompletionsAccessibilityVerbose=150]="inlineCompletionsAccessibilityVerbose"})(DZ||(DZ={}));var IZ;(function(n){n[n.TextDefined=0]="TextDefined",n[n.LF=1]="LF",n[n.CRLF=2]="CRLF"})(IZ||(IZ={}));var AZ;(function(n){n[n.LF=0]="LF",n[n.CRLF=1]="CRLF"})(AZ||(AZ={}));var NZ;(function(n){n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=3]="Right"})(NZ||(NZ={}));var RZ;(function(n){n[n.Increase=0]="Increase",n[n.Decrease=1]="Decrease"})(RZ||(RZ={}));var PZ;(function(n){n[n.None=0]="None",n[n.Indent=1]="Indent",n[n.IndentOutdent=2]="IndentOutdent",n[n.Outdent=3]="Outdent"})(PZ||(PZ={}));var OZ;(function(n){n[n.Both=0]="Both",n[n.Right=1]="Right",n[n.Left=2]="Left",n[n.None=3]="None"})(OZ||(OZ={}));var MZ;(function(n){n[n.Type=1]="Type",n[n.Parameter=2]="Parameter"})(MZ||(MZ={}));var FZ;(function(n){n[n.Automatic=0]="Automatic",n[n.Explicit=1]="Explicit"})(FZ||(FZ={}));var BZ;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(BZ||(BZ={}));var $Z;(function(n){n[n.DependsOnKbLayout=-1]="DependsOnKbLayout",n[n.Unknown=0]="Unknown",n[n.Backspace=1]="Backspace",n[n.Tab=2]="Tab",n[n.Enter=3]="Enter",n[n.Shift=4]="Shift",n[n.Ctrl=5]="Ctrl",n[n.Alt=6]="Alt",n[n.PauseBreak=7]="PauseBreak",n[n.CapsLock=8]="CapsLock",n[n.Escape=9]="Escape",n[n.Space=10]="Space",n[n.PageUp=11]="PageUp",n[n.PageDown=12]="PageDown",n[n.End=13]="End",n[n.Home=14]="Home",n[n.LeftArrow=15]="LeftArrow",n[n.UpArrow=16]="UpArrow",n[n.RightArrow=17]="RightArrow",n[n.DownArrow=18]="DownArrow",n[n.Insert=19]="Insert",n[n.Delete=20]="Delete",n[n.Digit0=21]="Digit0",n[n.Digit1=22]="Digit1",n[n.Digit2=23]="Digit2",n[n.Digit3=24]="Digit3",n[n.Digit4=25]="Digit4",n[n.Digit5=26]="Digit5",n[n.Digit6=27]="Digit6",n[n.Digit7=28]="Digit7",n[n.Digit8=29]="Digit8",n[n.Digit9=30]="Digit9",n[n.KeyA=31]="KeyA",n[n.KeyB=32]="KeyB",n[n.KeyC=33]="KeyC",n[n.KeyD=34]="KeyD",n[n.KeyE=35]="KeyE",n[n.KeyF=36]="KeyF",n[n.KeyG=37]="KeyG",n[n.KeyH=38]="KeyH",n[n.KeyI=39]="KeyI",n[n.KeyJ=40]="KeyJ",n[n.KeyK=41]="KeyK",n[n.KeyL=42]="KeyL",n[n.KeyM=43]="KeyM",n[n.KeyN=44]="KeyN",n[n.KeyO=45]="KeyO",n[n.KeyP=46]="KeyP",n[n.KeyQ=47]="KeyQ",n[n.KeyR=48]="KeyR",n[n.KeyS=49]="KeyS",n[n.KeyT=50]="KeyT",n[n.KeyU=51]="KeyU",n[n.KeyV=52]="KeyV",n[n.KeyW=53]="KeyW",n[n.KeyX=54]="KeyX",n[n.KeyY=55]="KeyY",n[n.KeyZ=56]="KeyZ",n[n.Meta=57]="Meta",n[n.ContextMenu=58]="ContextMenu",n[n.F1=59]="F1",n[n.F2=60]="F2",n[n.F3=61]="F3",n[n.F4=62]="F4",n[n.F5=63]="F5",n[n.F6=64]="F6",n[n.F7=65]="F7",n[n.F8=66]="F8",n[n.F9=67]="F9",n[n.F10=68]="F10",n[n.F11=69]="F11",n[n.F12=70]="F12",n[n.F13=71]="F13",n[n.F14=72]="F14",n[n.F15=73]="F15",n[n.F16=74]="F16",n[n.F17=75]="F17",n[n.F18=76]="F18",n[n.F19=77]="F19",n[n.F20=78]="F20",n[n.F21=79]="F21",n[n.F22=80]="F22",n[n.F23=81]="F23",n[n.F24=82]="F24",n[n.NumLock=83]="NumLock",n[n.ScrollLock=84]="ScrollLock",n[n.Semicolon=85]="Semicolon",n[n.Equal=86]="Equal",n[n.Comma=87]="Comma",n[n.Minus=88]="Minus",n[n.Period=89]="Period",n[n.Slash=90]="Slash",n[n.Backquote=91]="Backquote",n[n.BracketLeft=92]="BracketLeft",n[n.Backslash=93]="Backslash",n[n.BracketRight=94]="BracketRight",n[n.Quote=95]="Quote",n[n.OEM_8=96]="OEM_8",n[n.IntlBackslash=97]="IntlBackslash",n[n.Numpad0=98]="Numpad0",n[n.Numpad1=99]="Numpad1",n[n.Numpad2=100]="Numpad2",n[n.Numpad3=101]="Numpad3",n[n.Numpad4=102]="Numpad4",n[n.Numpad5=103]="Numpad5",n[n.Numpad6=104]="Numpad6",n[n.Numpad7=105]="Numpad7",n[n.Numpad8=106]="Numpad8",n[n.Numpad9=107]="Numpad9",n[n.NumpadMultiply=108]="NumpadMultiply",n[n.NumpadAdd=109]="NumpadAdd",n[n.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",n[n.NumpadSubtract=111]="NumpadSubtract",n[n.NumpadDecimal=112]="NumpadDecimal",n[n.NumpadDivide=113]="NumpadDivide",n[n.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",n[n.ABNT_C1=115]="ABNT_C1",n[n.ABNT_C2=116]="ABNT_C2",n[n.AudioVolumeMute=117]="AudioVolumeMute",n[n.AudioVolumeUp=118]="AudioVolumeUp",n[n.AudioVolumeDown=119]="AudioVolumeDown",n[n.BrowserSearch=120]="BrowserSearch",n[n.BrowserHome=121]="BrowserHome",n[n.BrowserBack=122]="BrowserBack",n[n.BrowserForward=123]="BrowserForward",n[n.MediaTrackNext=124]="MediaTrackNext",n[n.MediaTrackPrevious=125]="MediaTrackPrevious",n[n.MediaStop=126]="MediaStop",n[n.MediaPlayPause=127]="MediaPlayPause",n[n.LaunchMediaPlayer=128]="LaunchMediaPlayer",n[n.LaunchMail=129]="LaunchMail",n[n.LaunchApp2=130]="LaunchApp2",n[n.Clear=131]="Clear",n[n.MAX_VALUE=132]="MAX_VALUE"})($Z||($Z={}));var WZ;(function(n){n[n.Hint=1]="Hint",n[n.Info=2]="Info",n[n.Warning=4]="Warning",n[n.Error=8]="Error"})(WZ||(WZ={}));var HZ;(function(n){n[n.Unnecessary=1]="Unnecessary",n[n.Deprecated=2]="Deprecated"})(HZ||(HZ={}));var VZ;(function(n){n[n.Inline=1]="Inline",n[n.Gutter=2]="Gutter"})(VZ||(VZ={}));var zZ;(function(n){n[n.Normal=1]="Normal",n[n.Underlined=2]="Underlined"})(zZ||(zZ={}));var UZ;(function(n){n[n.UNKNOWN=0]="UNKNOWN",n[n.TEXTAREA=1]="TEXTAREA",n[n.GUTTER_GLYPH_MARGIN=2]="GUTTER_GLYPH_MARGIN",n[n.GUTTER_LINE_NUMBERS=3]="GUTTER_LINE_NUMBERS",n[n.GUTTER_LINE_DECORATIONS=4]="GUTTER_LINE_DECORATIONS",n[n.GUTTER_VIEW_ZONE=5]="GUTTER_VIEW_ZONE",n[n.CONTENT_TEXT=6]="CONTENT_TEXT",n[n.CONTENT_EMPTY=7]="CONTENT_EMPTY",n[n.CONTENT_VIEW_ZONE=8]="CONTENT_VIEW_ZONE",n[n.CONTENT_WIDGET=9]="CONTENT_WIDGET",n[n.OVERVIEW_RULER=10]="OVERVIEW_RULER",n[n.SCROLLBAR=11]="SCROLLBAR",n[n.OVERLAY_WIDGET=12]="OVERLAY_WIDGET",n[n.OUTSIDE_EDITOR=13]="OUTSIDE_EDITOR"})(UZ||(UZ={}));var jZ;(function(n){n[n.AIGenerated=1]="AIGenerated"})(jZ||(jZ={}));var qZ;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(qZ||(qZ={}));var KZ;(function(n){n[n.TOP_RIGHT_CORNER=0]="TOP_RIGHT_CORNER",n[n.BOTTOM_RIGHT_CORNER=1]="BOTTOM_RIGHT_CORNER",n[n.TOP_CENTER=2]="TOP_CENTER"})(KZ||(KZ={}));var GZ;(function(n){n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=4]="Right",n[n.Full=7]="Full"})(GZ||(GZ={}));var YZ;(function(n){n[n.Word=0]="Word",n[n.Line=1]="Line",n[n.Suggest=2]="Suggest"})(YZ||(YZ={}));var ZZ;(function(n){n[n.Left=0]="Left",n[n.Right=1]="Right",n[n.None=2]="None",n[n.LeftOfInjectedText=3]="LeftOfInjectedText",n[n.RightOfInjectedText=4]="RightOfInjectedText"})(ZZ||(ZZ={}));var XZ;(function(n){n[n.Off=0]="Off",n[n.On=1]="On",n[n.Relative=2]="Relative",n[n.Interval=3]="Interval",n[n.Custom=4]="Custom"})(XZ||(XZ={}));var QZ;(function(n){n[n.None=0]="None",n[n.Text=1]="Text",n[n.Blocks=2]="Blocks"})(QZ||(QZ={}));var JZ;(function(n){n[n.Smooth=0]="Smooth",n[n.Immediate=1]="Immediate"})(JZ||(JZ={}));var eX;(function(n){n[n.Auto=1]="Auto",n[n.Hidden=2]="Hidden",n[n.Visible=3]="Visible"})(eX||(eX={}));var tX;(function(n){n[n.LTR=0]="LTR",n[n.RTL=1]="RTL"})(tX||(tX={}));var nX;(function(n){n.Off="off",n.OnCode="onCode",n.On="on"})(nX||(nX={}));var iX;(function(n){n[n.Invoke=1]="Invoke",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.ContentChange=3]="ContentChange"})(iX||(iX={}));var rX;(function(n){n[n.File=0]="File",n[n.Module=1]="Module",n[n.Namespace=2]="Namespace",n[n.Package=3]="Package",n[n.Class=4]="Class",n[n.Method=5]="Method",n[n.Property=6]="Property",n[n.Field=7]="Field",n[n.Constructor=8]="Constructor",n[n.Enum=9]="Enum",n[n.Interface=10]="Interface",n[n.Function=11]="Function",n[n.Variable=12]="Variable",n[n.Constant=13]="Constant",n[n.String=14]="String",n[n.Number=15]="Number",n[n.Boolean=16]="Boolean",n[n.Array=17]="Array",n[n.Object=18]="Object",n[n.Key=19]="Key",n[n.Null=20]="Null",n[n.EnumMember=21]="EnumMember",n[n.Struct=22]="Struct",n[n.Event=23]="Event",n[n.Operator=24]="Operator",n[n.TypeParameter=25]="TypeParameter"})(rX||(rX={}));var sX;(function(n){n[n.Deprecated=1]="Deprecated"})(sX||(sX={}));var oX;(function(n){n[n.Hidden=0]="Hidden",n[n.Blink=1]="Blink",n[n.Smooth=2]="Smooth",n[n.Phase=3]="Phase",n[n.Expand=4]="Expand",n[n.Solid=5]="Solid"})(oX||(oX={}));var aX;(function(n){n[n.Line=1]="Line",n[n.Block=2]="Block",n[n.Underline=3]="Underline",n[n.LineThin=4]="LineThin",n[n.BlockOutline=5]="BlockOutline",n[n.UnderlineThin=6]="UnderlineThin"})(aX||(aX={}));var lX;(function(n){n[n.AlwaysGrowsWhenTypingAtEdges=0]="AlwaysGrowsWhenTypingAtEdges",n[n.NeverGrowsWhenTypingAtEdges=1]="NeverGrowsWhenTypingAtEdges",n[n.GrowsOnlyWhenTypingBefore=2]="GrowsOnlyWhenTypingBefore",n[n.GrowsOnlyWhenTypingAfter=3]="GrowsOnlyWhenTypingAfter"})(lX||(lX={}));var cX;(function(n){n[n.None=0]="None",n[n.Same=1]="Same",n[n.Indent=2]="Indent",n[n.DeepIndent=3]="DeepIndent"})(cX||(cX={}));let n_t=class{static{this.CtrlCmd=2048}static{this.Shift=1024}static{this.Alt=512}static{this.WinCtrl=256}static chord(e,t){return js(e,t)}};function F4e(){return{editor:void 0,languages:void 0,CancellationTokenSource:Kr,Emitter:fe,KeyCode:$Z,KeyMod:n_t,Position:he,Range:$,Selection:yt,SelectionDirection:tX,MarkerSeverity:WZ,MarkerTag:HZ,Uri:Pt,Token:iN}}function i_t(n,e){const t=n;typeof t.vscodeWindowId!="number"&&Object.defineProperty(t,"vscodeWindowId",{get:()=>e})}const Xi=window;function B4e(n){return n}class r_t{constructor(e,t){this.lastCache=void 0,this.lastArgKey=void 0,typeof e=="function"?(this._fn=e,this._computeKey=B4e):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){const t=this._computeKey(e);return this.lastArgKey!==t&&(this.lastArgKey=t,this.lastCache=this._fn(e)),this.lastCache}}class $ve{get cachedValues(){return this._map}constructor(e,t){this._map=new Map,this._map2=new Map,typeof e=="function"?(this._fn=e,this._computeKey=B4e):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){const t=this._computeKey(e);if(this._map2.has(t))return this._map2.get(t);const i=this._fn(e);return this._map.set(e,i),this._map2.set(t,i),i}}class kg{constructor(e){this.executor=e,this._didRun=!1}get value(){if(!this._didRun)try{this._value=this.executor()}catch(e){this._error=e}finally{this._didRun=!0}if(this._error)throw this._error;return this._value}get rawValue(){return this._value}}function $4e(n){return!n||typeof n!="string"?!0:n.trim().length===0}const s_t=/{(\d+)}/g;function Lw(n,...e){return e.length===0?n:n.replace(s_t,function(t,i){const r=parseInt(i,10);return isNaN(r)||r<0||r>=e.length?t:e[r]})}function o_t(n){return n.replace(/[<>"'&]/g,e=>{switch(e){case"<":return"<";case">":return">";case'"':return""";case"'":return"'";case"&":return"&"}return e})}function gI(n){return n.replace(/[<>&]/g,function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";default:return e}})}function nd(n){return n.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function a_t(n,e=" "){const t=jP(n,e);return W4e(t,e)}function jP(n,e){if(!n||!e)return n;const t=e.length;if(t===0||n.length===0)return n;let i=0;for(;n.indexOf(e,i)===i;)i=i+t;return n.substring(i)}function W4e(n,e){if(!n||!e)return n;const t=e.length,i=n.length;if(t===0||i===0)return n;let r=i,s=-1;for(;s=n.lastIndexOf(e,r-1),!(s===-1||s+t!==r);){if(s===0)return"";r=s}return n.substring(0,r)}function l_t(n){return n.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function c_t(n){return n.replace(/\*/g,"")}function H4e(n,e,t={}){if(!n)throw new Error("Cannot create regex from empty string");e||(n=nd(n)),t.wholeWord&&(/\B/.test(n.charAt(0))||(n="\\b"+n),/\B/.test(n.charAt(n.length-1))||(n=n+"\\b"));let i="";return t.global&&(i+="g"),t.matchCase||(i+="i"),t.multiline&&(i+="m"),t.unicode&&(i+="u"),new RegExp(n,i)}function u_t(n){return n.source==="^"||n.source==="^$"||n.source==="$"||n.source==="^\\s*$"?!1:!!(n.exec("")&&n.lastIndex===0)}function om(n){return n.split(/\r\n|\r|\n/)}function d_t(n){const e=[],t=n.split(/(\r\n|\r|\n)/);for(let i=0;i=0;t--){const i=n.charCodeAt(t);if(i!==32&&i!==9)return t}return-1}function aN(n,e){return ne?1:0}function Eae(n,e,t=0,i=n.length,r=0,s=e.length){for(;tc)return 1}const o=i-t,a=s-r;return oa?1:0}function uX(n,e){return qP(n,e,0,n.length,0,e.length)}function qP(n,e,t=0,i=n.length,r=0,s=e.length){for(;t=128||c>=128)return Eae(n.toLowerCase(),e.toLowerCase(),t,i,r,s);Tv(l)&&(l-=32),Tv(c)&&(c-=32);const u=l-c;if(u!==0)return u}const o=i-t,a=s-r;return oa?1:0}function w4(n){return n>=48&&n<=57}function Tv(n){return n>=97&&n<=122}function fp(n){return n>=65&&n<=90}function bS(n,e){return n.length===e.length&&qP(n,e)===0}function Lae(n,e){const t=e.length;return e.length>n.length?!1:qP(n,e,0,t)===0}function Cb(n,e){const t=Math.min(n.length,e.length);let i;for(i=0;i1){const i=n.charCodeAt(e-2);if(Co(i))return Tae(i,t)}return t}class Dae{get offset(){return this._offset}constructor(e,t=0){this._str=e,this._len=e.length,this._offset=t}setOffset(e){this._offset=e}prevCodePoint(){const e=h_t(this._str,this._offset);return this._offset-=e>=65536?2:1,e}nextCodePoint(){const e=z6(this._str,this._len,this._offset);return this._offset+=e>=65536?2:1,e}eol(){return this._offset>=this._len}}class U6{get offset(){return this._iterator.offset}constructor(e,t=0){this._iterator=new Dae(e,t)}nextGraphemeLength(){const e=Ty.getInstance(),t=this._iterator,i=t.offset;let r=e.getGraphemeBreakType(t.nextCodePoint());for(;!t.eol();){const s=t.offset,o=e.getGraphemeBreakType(t.nextCodePoint());if(Wve(r,o)){t.setOffset(s);break}r=o}return t.offset-i}prevGraphemeLength(){const e=Ty.getInstance(),t=this._iterator,i=t.offset;let r=e.getGraphemeBreakType(t.prevCodePoint());for(;t.offset>0;){const s=t.offset,o=e.getGraphemeBreakType(t.prevCodePoint());if(Wve(o,r)){t.setOffset(s);break}r=o}return i-t.offset}eol(){return this._iterator.eol()}}function Iae(n,e){return new U6(n,e).nextGraphemeLength()}function V4e(n,e){return new U6(n,e).prevGraphemeLength()}function f_t(n,e){e>0&&Tw(n.charCodeAt(e))&&e--;const t=e+Iae(n,e);return[t-V4e(n,t),t]}let fj;function g_t(){return/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u088E\u08A0-\u08C9\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDC7\uFDF0-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE35\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDD23\uDE80-\uDEA9\uDEAD-\uDF45\uDF51-\uDF81\uDF86-\uDFF6]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD4B-\uDFFF]|\uD83B[\uDC00-\uDEBB])/}function iE(n){return fj||(fj=g_t()),fj.test(n)}const p_t=/^[\t\n\r\x20-\x7E]*$/;function KP(n){return p_t.test(n)}const z4e=/[\u2028\u2029]/;function U4e(n){return z4e.test(n)}function xb(n){return n>=11904&&n<=55215||n>=63744&&n<=64255||n>=65281&&n<=65374}function Aae(n){return n>=127462&&n<=127487||n===8986||n===8987||n===9200||n===9203||n>=9728&&n<=10175||n===11088||n===11093||n>=127744&&n<=128591||n>=128640&&n<=128764||n>=128992&&n<=129008||n>=129280&&n<=129535||n>=129648&&n<=129782}const m_t="\uFEFF";function Nae(n){return!!(n&&n.length>0&&n.charCodeAt(0)===65279)}function __t(n,e=!1){return n?(e&&(n=n.replace(/\\./g,"")),n.toLowerCase()!==n):!1}function j4e(n){return n=n%(2*26),n<26?String.fromCharCode(97+n):String.fromCharCode(65+n-26)}function Wve(n,e){return n===0?e!==5&&e!==7:n===2&&e===3?!1:n===4||n===2||n===3||e===4||e===2||e===3?!0:!(n===8&&(e===8||e===9||e===11||e===12)||(n===11||n===9)&&(e===9||e===10)||(n===12||n===10)&&e===10||e===5||e===13||e===7||n===1||n===13&&e===14||n===6&&e===6)}class Ty{static{this._INSTANCE=null}static getInstance(){return Ty._INSTANCE||(Ty._INSTANCE=new Ty),Ty._INSTANCE}constructor(){this._data=v_t()}getGraphemeBreakType(e){if(e<32)return e===10?3:e===13?2:4;if(e<127)return 0;const t=this._data,i=t.length/3;let r=1;for(;r<=i;)if(et[3*r+1])r=2*r+1;else return t[3*r+2];return 0}}function v_t(){return JSON.parse("[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]")}function b_t(n,e){if(n===0)return 0;const t=y_t(n,e);if(t!==void 0)return t;const i=new Dae(e,n);return i.prevCodePoint(),i.offset}function y_t(n,e){const t=new Dae(e,n);let i=t.prevCodePoint();for(;w_t(i)||i===65039||i===8419;){if(t.offset===0)return;i=t.prevCodePoint()}if(!Aae(i))return;let r=t.offset;return r>0&&t.prevCodePoint()===8205&&(r=t.offset),r}function w_t(n){return 127995<=n&&n<=127999}const q4e=" ";class Dv{static{this.ambiguousCharacterData=new kg(()=>JSON.parse('{"_common":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,8218,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,8242,96,1370,96,1523,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71922,67,71913,67,65315,67,8557,67,8450,67,8493,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71919,87,71910,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,66293,90,71909,90,65338,90,8484,90,8488,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65297,49,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],"_default":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"cs":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"de":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"es":[8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"fr":[65374,126,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"it":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"ja":[8211,45,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65292,44,65307,59],"ko":[8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"pl":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"pt-BR":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"ru":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"tr":[160,32,8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"zh-hans":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41],"zh-hant":[8211,45,65374,126,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65307,59]}'))}static{this.cache=new r_t({getCacheKey:JSON.stringify},e=>{function t(u){const d=new Map;for(let h=0;h!u.startsWith("_")&&u in s);o.length===0&&(o=["_default"]);let a;for(const u of o){const d=t(s[u]);a=r(a,d)}const l=t(s._common),c=i(l,a);return new Dv(c)})}static getInstance(e){return Dv.cache.get(Array.from(e))}static{this._locales=new kg(()=>Object.keys(Dv.ambiguousCharacterData.value).filter(e=>!e.startsWith("_")))}static getLocales(){return Dv._locales.value}constructor(e){this.confusableDictionary=e}isAmbiguous(e){return this.confusableDictionary.has(e)}getPrimaryConfusable(e){return this.confusableDictionary.get(e)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}}class I_{static getRawData(){return JSON.parse("[9,10,11,12,13,32,127,160,173,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8234,8235,8236,8237,8238,8239,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,10240,12288,12644,65024,65025,65026,65027,65028,65029,65030,65031,65032,65033,65034,65035,65036,65037,65038,65039,65279,65440,65520,65521,65522,65523,65524,65525,65526,65527,65528,65532,78844,119155,119156,119157,119158,119159,119160,119161,119162,917504,917505,917506,917507,917508,917509,917510,917511,917512,917513,917514,917515,917516,917517,917518,917519,917520,917521,917522,917523,917524,917525,917526,917527,917528,917529,917530,917531,917532,917533,917534,917535,917536,917537,917538,917539,917540,917541,917542,917543,917544,917545,917546,917547,917548,917549,917550,917551,917552,917553,917554,917555,917556,917557,917558,917559,917560,917561,917562,917563,917564,917565,917566,917567,917568,917569,917570,917571,917572,917573,917574,917575,917576,917577,917578,917579,917580,917581,917582,917583,917584,917585,917586,917587,917588,917589,917590,917591,917592,917593,917594,917595,917596,917597,917598,917599,917600,917601,917602,917603,917604,917605,917606,917607,917608,917609,917610,917611,917612,917613,917614,917615,917616,917617,917618,917619,917620,917621,917622,917623,917624,917625,917626,917627,917628,917629,917630,917631,917760,917761,917762,917763,917764,917765,917766,917767,917768,917769,917770,917771,917772,917773,917774,917775,917776,917777,917778,917779,917780,917781,917782,917783,917784,917785,917786,917787,917788,917789,917790,917791,917792,917793,917794,917795,917796,917797,917798,917799,917800,917801,917802,917803,917804,917805,917806,917807,917808,917809,917810,917811,917812,917813,917814,917815,917816,917817,917818,917819,917820,917821,917822,917823,917824,917825,917826,917827,917828,917829,917830,917831,917832,917833,917834,917835,917836,917837,917838,917839,917840,917841,917842,917843,917844,917845,917846,917847,917848,917849,917850,917851,917852,917853,917854,917855,917856,917857,917858,917859,917860,917861,917862,917863,917864,917865,917866,917867,917868,917869,917870,917871,917872,917873,917874,917875,917876,917877,917878,917879,917880,917881,917882,917883,917884,917885,917886,917887,917888,917889,917890,917891,917892,917893,917894,917895,917896,917897,917898,917899,917900,917901,917902,917903,917904,917905,917906,917907,917908,917909,917910,917911,917912,917913,917914,917915,917916,917917,917918,917919,917920,917921,917922,917923,917924,917925,917926,917927,917928,917929,917930,917931,917932,917933,917934,917935,917936,917937,917938,917939,917940,917941,917942,917943,917944,917945,917946,917947,917948,917949,917950,917951,917952,917953,917954,917955,917956,917957,917958,917959,917960,917961,917962,917963,917964,917965,917966,917967,917968,917969,917970,917971,917972,917973,917974,917975,917976,917977,917978,917979,917980,917981,917982,917983,917984,917985,917986,917987,917988,917989,917990,917991,917992,917993,917994,917995,917996,917997,917998,917999]")}static{this._data=void 0}static getData(){return this._data||(this._data=new Set(I_.getRawData())),this._data}static isInvisibleCharacter(e){return I_.getData().has(e)}static get codePoints(){return I_.getData()}}class Rae{constructor(){this.mapWindowIdToZoomFactor=new Map}static{this.INSTANCE=new Rae}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}getWindowId(e){return e.vscodeWindowId}}function K4e(n,e,t){typeof e=="string"&&(e=n.matchMedia(e)),e.addEventListener("change",t)}function C_t(n){return Rae.INSTANCE.getZoomFactor(n)}const qL=navigator.userAgent,Xd=qL.indexOf("Firefox")>=0,Ky=qL.indexOf("AppleWebKit")>=0,GP=qL.indexOf("Chrome")>=0,K_=!GP&&qL.indexOf("Safari")>=0,G4e=!GP&&!K_&&Ky;qL.indexOf("Electron/")>=0;const Hve=qL.indexOf("Android")>=0;let WF=!1;if(typeof Xi.matchMedia=="function"){const n=Xi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Xi.matchMedia("(display-mode: fullscreen)");WF=n.matches,K4e(Xi,n,({matches:t})=>{WF&&e.matches||(WF=t)})}function x_t(){return WF}const Pae={clipboard:{writeText:hg||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(navigator&&navigator.clipboard&&navigator.clipboard.writeText),readText:hg||!!(navigator&&navigator.clipboard&&navigator.clipboard.readText)},keyboard:hg||x_t()?0:navigator.keyboard||K_?1:2,touch:"ontouchstart"in Xi||navigator.maxTouchPoints>0,pointerEvents:Xi.PointerEvent&&("ontouchstart"in Xi||navigator.maxTouchPoints>0)};function dX(n,e){if(typeof n=="number"){if(n===0)return null;const t=(n&65535)>>>0,i=(n&4294901760)>>>16;return i!==0?new gj([C4(t,e),C4(i,e)]):new gj([C4(t,e)])}else{const t=[];for(let i=0;i{const o=e.token.onCancellationRequested(()=>{o.dispose(),s(new sf)});Promise.resolve(t).then(a=>{o.dispose(),e.dispose(),r(a)},a=>{o.dispose(),e.dispose(),s(a)})});return new class{cancel(){e.cancel(),e.dispose()}then(r,s){return i.then(r,s)}catch(r){return this.then(void 0,r)}finally(r){return i.finally(r)}}}function YP(n,e,t){return new Promise((i,r)=>{const s=e.onCancellationRequested(()=>{s.dispose(),i(t)});n.then(i,r).finally(()=>s.dispose())})}class R_t{constructor(){this.isDisposed=!1,this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(e){if(this.isDisposed)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){const t=()=>{if(this.queuedPromise=null,this.isDisposed)return;const i=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,i};this.queuedPromise=new Promise(i=>{this.activePromise.then(t,t).then(i)})}return new Promise((t,i)=>{this.queuedPromise.then(t,i)})}return this.activePromise=e(),new Promise((t,i)=>{this.activePromise.then(r=>{this.activePromise=null,t(r)},r=>{this.activePromise=null,i(r)})})}dispose(){this.isDisposed=!0}}const P_t=(n,e)=>{let t=!0;const i=setTimeout(()=>{t=!1,e()},n);return{isTriggered:()=>t,dispose:()=>{clearTimeout(i),t=!1}}},O_t=n=>{let e=!0;return queueMicrotask(()=>{e&&(e=!1,n())}),{isTriggered:()=>e,dispose:()=>{e=!1}}};class Qd{constructor(e){this.defaultDelay=e,this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(e,t=this.defaultDelay){this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((r,s)=>{this.doResolve=r,this.doReject=s}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){const r=this.task;return this.task=null,r()}}));const i=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=t===Y4e?O_t(i):P_t(t,i),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new sf),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}}class Z4e{constructor(e){this.delayer=new Qd(e),this.throttler=new R_t}trigger(e,t){return this.delayer.trigger(()=>this.throttler.queue(e),t)}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}}function Y_(n,e){return e?new Promise((t,i)=>{const r=setTimeout(()=>{s.dispose(),t()},n),s=e.onCancellationRequested(()=>{clearTimeout(r),s.dispose(),i(new sf)})}):ko(t=>Y_(n,t))}function Sb(n,e=0,t){const i=setTimeout(()=>{n(),t&&r.dispose()},e),r=Lt(()=>{clearTimeout(i),t?.deleteAndLeak(r)});return t?.add(r),r}function Oae(n,e=i=>!!i,t=null){let i=0;const r=n.length,s=()=>{if(i>=r)return Promise.resolve(t);const o=n[i++];return Promise.resolve(o()).then(l=>e(l)?Promise.resolve(l):s())};return s()}class hf{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new fi("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new fi("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}}class Mae{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new fi("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();const r=i.setInterval(()=>{e()},t);this.disposable=Lt(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}}class Ui{constructor(e,t){this.timeoutToken=-1,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return this.timeoutToken!==-1}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){this.runner?.()}}let X4e,pI;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?pI=(n,e)=>{m4e(()=>{if(t)return;const i=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let t=!1;return{dispose(){t||(t=!0)}}}:pI=(n,e,t)=>{const i=n.requestIdleCallback(e,typeof t=="number"?{timeout:t}:void 0);let r=!1;return{dispose(){r||(r=!0,n.cancelIdleCallback(i))}}},X4e=n=>pI(globalThis,n)})();class Q4e{constructor(e,t){this._didRun=!1,this._executor=()=>{try{this._value=t()}catch(i){this._error=i}finally{this._didRun=!0}},this._handle=pI(e,()=>this._executor())}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}}class M_t extends Q4e{constructor(e){super(globalThis,e)}}class KL{get isRejected(){return this.outcome?.outcome===1}get isSettled(){return!!this.outcome}constructor(){this.p=new Promise((e,t)=>{this.completeCallback=e,this.errorCallback=t})}complete(e){return new Promise(t=>{this.completeCallback(e),this.outcome={outcome:0,value:e},t()})}error(e){return new Promise(t=>{this.errorCallback(e),this.outcome={outcome:1,value:e},t()})}cancel(){return this.error(new sf)}}var fX;(function(n){async function e(i){let r;const s=await Promise.all(i.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return s}n.settled=e;function t(i){return new Promise(async(r,s)=>{try{await i(r,s)}catch(o){s(o)}})}n.withAsyncBody=t})(fX||(fX={}));class to{static fromArray(e){return new to(t=>{t.emitMany(e)})}static fromPromise(e){return new to(async t=>{t.emitMany(await e)})}static fromPromises(e){return new to(async t=>{await Promise.all(e.map(async i=>t.emitOne(await i)))})}static merge(e){return new to(async t=>{await Promise.all(e.map(async i=>{for await(const r of i)t.emitOne(r)}))})}static{this.EMPTY=to.fromArray([])}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new fe,queueMicrotask(async()=>{const i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new to(async i=>{for await(const r of e)i.emitOne(t(r))})}map(e){return to.map(this,e)}static filter(e,t){return new to(async i=>{for await(const r of e)t(r)&&i.emitOne(r)})}filter(e){return to.filter(this,e)}static coalesce(e){return to.filter(e,t=>!!t)}coalesce(){return to.coalesce(this)}static async toPromise(e){const t=[];for await(const i of e)t.push(i);return t}toPromise(){return to.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}}class F_t extends to{constructor(e,t){super(t),this._source=e}cancel(){this._source.cancel()}}function B_t(n){const e=new Kr,t=n(e.token);return new F_t(e,async i=>{const r=e.token.onCancellationRequested(()=>{r.dispose(),e.dispose(),i.reject(new sf)});try{for await(const s of t){if(e.token.isCancellationRequested)return;i.emitOne(s)}r.dispose(),e.dispose()}catch(s){r.dispose(),e.dispose(),i.reject(s)}})}/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */const{entries:J4e,setPrototypeOf:zve,isFrozen:$_t,getPrototypeOf:W_t,getOwnPropertyDescriptor:H_t}=Object;let{freeze:uu,seal:of,create:e3e}=Object,{apply:gX,construct:pX}=typeof Reflect<"u"&&Reflect;uu||(uu=function(e){return e});of||(of=function(e){return e});gX||(gX=function(e,t,i){return e.apply(t,i)});pX||(pX=function(e,t){return new e(...t)});const x4=Jd(Array.prototype.forEach),Uve=Jd(Array.prototype.pop),bT=Jd(Array.prototype.push),HF=Jd(String.prototype.toLowerCase),pj=Jd(String.prototype.toString),jve=Jd(String.prototype.match),yT=Jd(String.prototype.replace),V_t=Jd(String.prototype.indexOf),z_t=Jd(String.prototype.trim),Nf=Jd(Object.prototype.hasOwnProperty),$c=Jd(RegExp.prototype.test),wT=U_t(TypeError);function Jd(n){return function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:HF;zve&&zve(n,null);let i=e.length;for(;i--;){let r=e[i];if(typeof r=="string"){const s=t(r);s!==r&&($_t(e)||(e[i]=s),r=s)}n[r]=!0}return n}function j_t(n){for(let e=0;e/gm),Z_t=of(/\${[\w\W]*}/gm),X_t=of(/^data-[\-\w.\u00B7-\uFFFF]/),Q_t=of(/^aria-[\-\w]+$/),t3e=of(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),J_t=of(/^(?:\w+script|data):/i),e0t=of(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),n3e=of(/^html$/i),t0t=of(/^[a-z][.\w]*(-[.\w]+)+$/i);var Zve=Object.freeze({__proto__:null,MUSTACHE_EXPR:G_t,ERB_EXPR:Y_t,TMPLIT_EXPR:Z_t,DATA_ATTR:X_t,ARIA_ATTR:Q_t,IS_ALLOWED_URI:t3e,IS_SCRIPT_OR_DATA:J_t,ATTR_WHITESPACE:e0t,DOCTYPE_NAME:n3e,CUSTOM_ELEMENT:t0t});const xT={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},n0t=function(){return typeof window>"u"?null:window},i0t=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(i=t.getAttribute(r));const s="dompurify"+(i?"#"+i:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}};function i3e(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n0t();const e=Fe=>i3e(Fe);if(e.version="3.1.7",e.removed=[],!n||!n.document||n.document.nodeType!==xT.document)return e.isSupported=!1,e;let{document:t}=n;const i=t,r=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:f}=n,g=l.prototype,p=CT(g,"cloneNode"),m=CT(g,"remove"),_=CT(g,"nextSibling"),v=CT(g,"childNodes"),y=CT(g,"parentNode");if(typeof o=="function"){const Fe=t.createElement("template");Fe.content&&Fe.content.ownerDocument&&(t=Fe.content.ownerDocument)}let C,x="";const{implementation:k,createNodeIterator:L,createDocumentFragment:D,getElementsByTagName:I}=t,{importNode:O}=i;let M={};e.isSupported=typeof J4e=="function"&&typeof y=="function"&&k&&k.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:G,TMPLIT_EXPR:W,DATA_ATTR:z,ARIA_ATTR:q,IS_SCRIPT_OR_DATA:ee,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:j}=Zve;let{IS_ALLOWED_URI:te}=Zve,le=null;const ue=ir({},[...qve,...mj,..._j,...vj,...Kve]);let de=null;const we=ir({},[...Gve,...bj,...Yve,...S4]);let xe=Object.seal(e3e(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Me=null,Re=null,_t=!0,Qe=!0,pt=!1,gt=!0,Ue=!1,wn=!0,Xt=!1,jn=!1,ji=!1,ci=!1,ye=!1,Ie=!1,Ve=!0,wt=!1;const vt="user-content-";let nt=!0,$t=!1,an={},Pi=null;const Xn=ir({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Qi=null;const qs=ir({},["audio","video","img","source","image","track"]);let Pr=null;const Or=ir({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),cr="http://www.w3.org/1998/Math/MathML",us="http://www.w3.org/2000/svg",qi="http://www.w3.org/1999/xhtml";let Er=qi,oo=!1,As=null;const Ft=ir({},[cr,us,qi],pj);let qn=null;const pi=["application/xhtml+xml","text/html"],bn="text/html";let dn=null,bi=null;const mi=t.createElement("form"),Yi=function(_e){return _e instanceof RegExp||_e instanceof Function},Wn=function(){let _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(bi&&bi===_e)){if((!_e||typeof _e!="object")&&(_e={}),_e=U1(_e),qn=pi.indexOf(_e.PARSER_MEDIA_TYPE)===-1?bn:_e.PARSER_MEDIA_TYPE,dn=qn==="application/xhtml+xml"?pj:HF,le=Nf(_e,"ALLOWED_TAGS")?ir({},_e.ALLOWED_TAGS,dn):ue,de=Nf(_e,"ALLOWED_ATTR")?ir({},_e.ALLOWED_ATTR,dn):we,As=Nf(_e,"ALLOWED_NAMESPACES")?ir({},_e.ALLOWED_NAMESPACES,pj):Ft,Pr=Nf(_e,"ADD_URI_SAFE_ATTR")?ir(U1(Or),_e.ADD_URI_SAFE_ATTR,dn):Or,Qi=Nf(_e,"ADD_DATA_URI_TAGS")?ir(U1(qs),_e.ADD_DATA_URI_TAGS,dn):qs,Pi=Nf(_e,"FORBID_CONTENTS")?ir({},_e.FORBID_CONTENTS,dn):Xn,Me=Nf(_e,"FORBID_TAGS")?ir({},_e.FORBID_TAGS,dn):{},Re=Nf(_e,"FORBID_ATTR")?ir({},_e.FORBID_ATTR,dn):{},an=Nf(_e,"USE_PROFILES")?_e.USE_PROFILES:!1,_t=_e.ALLOW_ARIA_ATTR!==!1,Qe=_e.ALLOW_DATA_ATTR!==!1,pt=_e.ALLOW_UNKNOWN_PROTOCOLS||!1,gt=_e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ue=_e.SAFE_FOR_TEMPLATES||!1,wn=_e.SAFE_FOR_XML!==!1,Xt=_e.WHOLE_DOCUMENT||!1,ci=_e.RETURN_DOM||!1,ye=_e.RETURN_DOM_FRAGMENT||!1,Ie=_e.RETURN_TRUSTED_TYPE||!1,ji=_e.FORCE_BODY||!1,Ve=_e.SANITIZE_DOM!==!1,wt=_e.SANITIZE_NAMED_PROPS||!1,nt=_e.KEEP_CONTENT!==!1,$t=_e.IN_PLACE||!1,te=_e.ALLOWED_URI_REGEXP||t3e,Er=_e.NAMESPACE||qi,xe=_e.CUSTOM_ELEMENT_HANDLING||{},_e.CUSTOM_ELEMENT_HANDLING&&Yi(_e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(xe.tagNameCheck=_e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_e.CUSTOM_ELEMENT_HANDLING&&Yi(_e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(xe.attributeNameCheck=_e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_e.CUSTOM_ELEMENT_HANDLING&&typeof _e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(xe.allowCustomizedBuiltInElements=_e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ue&&(Qe=!1),ye&&(ci=!0),an&&(le=ir({},Kve),de=[],an.html===!0&&(ir(le,qve),ir(de,Gve)),an.svg===!0&&(ir(le,mj),ir(de,bj),ir(de,S4)),an.svgFilters===!0&&(ir(le,_j),ir(de,bj),ir(de,S4)),an.mathMl===!0&&(ir(le,vj),ir(de,Yve),ir(de,S4))),_e.ADD_TAGS&&(le===ue&&(le=U1(le)),ir(le,_e.ADD_TAGS,dn)),_e.ADD_ATTR&&(de===we&&(de=U1(de)),ir(de,_e.ADD_ATTR,dn)),_e.ADD_URI_SAFE_ATTR&&ir(Pr,_e.ADD_URI_SAFE_ATTR,dn),_e.FORBID_CONTENTS&&(Pi===Xn&&(Pi=U1(Pi)),ir(Pi,_e.FORBID_CONTENTS,dn)),nt&&(le["#text"]=!0),Xt&&ir(le,["html","head","body"]),le.table&&(ir(le,["tbody"]),delete Me.tbody),_e.TRUSTED_TYPES_POLICY){if(typeof _e.TRUSTED_TYPES_POLICY.createHTML!="function")throw wT('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw wT('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=_e.TRUSTED_TYPES_POLICY,x=C.createHTML("")}else C===void 0&&(C=i0t(f,r)),C!==null&&typeof x=="string"&&(x=C.createHTML(""));uu&&uu(_e),bi=_e}},pn=ir({},["mi","mo","mn","ms","mtext"]),re=ir({},["annotation-xml"]),oe=ir({},["title","style","font","a","script"]),H=ir({},[...mj,..._j,...q_t]),Y=ir({},[...vj,...K_t]),ne=function(_e){let Ze=y(_e);(!Ze||!Ze.tagName)&&(Ze={namespaceURI:Er,tagName:"template"});const ct=HF(_e.tagName),Ht=HF(Ze.tagName);return As[_e.namespaceURI]?_e.namespaceURI===us?Ze.namespaceURI===qi?ct==="svg":Ze.namespaceURI===cr?ct==="svg"&&(Ht==="annotation-xml"||pn[Ht]):!!H[ct]:_e.namespaceURI===cr?Ze.namespaceURI===qi?ct==="math":Ze.namespaceURI===us?ct==="math"&&re[Ht]:!!Y[ct]:_e.namespaceURI===qi?Ze.namespaceURI===us&&!re[Ht]||Ze.namespaceURI===cr&&!pn[Ht]?!1:!Y[ct]&&(oe[ct]||!H[ct]):!!(qn==="application/xhtml+xml"&&As[_e.namespaceURI]):!1},N=function(_e){bT(e.removed,{element:_e});try{y(_e).removeChild(_e)}catch{m(_e)}},F=function(_e,Ze){try{bT(e.removed,{attribute:Ze.getAttributeNode(_e),from:Ze})}catch{bT(e.removed,{attribute:null,from:Ze})}if(Ze.removeAttribute(_e),_e==="is"&&!de[_e])if(ci||ye)try{N(Ze)}catch{}else try{Ze.setAttribute(_e,"")}catch{}},V=function(_e){let Ze=null,ct=null;if(ji)_e=""+_e;else{const nn=jve(_e,/^[\r\n\t ]+/);ct=nn&&nn[0]}qn==="application/xhtml+xml"&&Er===qi&&(_e=''+_e+"");const Ht=C?C.createHTML(_e):_e;if(Er===qi)try{Ze=new h().parseFromString(Ht,qn)}catch{}if(!Ze||!Ze.documentElement){Ze=k.createDocument(Er,"template",null);try{Ze.documentElement.innerHTML=oo?x:Ht}catch{}}const Zt=Ze.body||Ze.documentElement;return _e&&ct&&Zt.insertBefore(t.createTextNode(ct),Zt.childNodes[0]||null),Er===qi?I.call(Ze,Xt?"html":"body")[0]:Xt?Ze.documentElement:Zt},A=function(_e){return L.call(_e.ownerDocument||_e,_e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},K=function(_e){return _e instanceof d&&(typeof _e.nodeName!="string"||typeof _e.textContent!="string"||typeof _e.removeChild!="function"||!(_e.attributes instanceof u)||typeof _e.removeAttribute!="function"||typeof _e.setAttribute!="function"||typeof _e.namespaceURI!="string"||typeof _e.insertBefore!="function"||typeof _e.hasChildNodes!="function")},ge=function(_e){return typeof a=="function"&&_e instanceof a},pe=function(_e,Ze,ct){M[_e]&&x4(M[_e],Ht=>{Ht.call(e,Ze,ct,bi)})},Ee=function(_e){let Ze=null;if(pe("beforeSanitizeElements",_e,null),K(_e))return N(_e),!0;const ct=dn(_e.nodeName);if(pe("uponSanitizeElement",_e,{tagName:ct,allowedTags:le}),_e.hasChildNodes()&&!ge(_e.firstElementChild)&&$c(/<[/\w]/g,_e.innerHTML)&&$c(/<[/\w]/g,_e.textContent)||_e.nodeType===xT.progressingInstruction||wn&&_e.nodeType===xT.comment&&$c(/<[/\w]/g,_e.data))return N(_e),!0;if(!le[ct]||Me[ct]){if(!Me[ct]&&ht(ct)&&(xe.tagNameCheck instanceof RegExp&&$c(xe.tagNameCheck,ct)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(ct)))return!1;if(nt&&!Pi[ct]){const Ht=y(_e)||_e.parentNode,Zt=v(_e)||_e.childNodes;if(Zt&&Ht){const nn=Zt.length;for(let ln=nn-1;ln>=0;--ln){const Wt=p(Zt[ln],!0);Wt.__removalCount=(_e.__removalCount||0)+1,Ht.insertBefore(Wt,_(_e))}}}return N(_e),!0}return _e instanceof l&&!ne(_e)||(ct==="noscript"||ct==="noembed"||ct==="noframes")&&$c(/<\/no(script|embed|frames)/i,_e.innerHTML)?(N(_e),!0):(Ue&&_e.nodeType===xT.text&&(Ze=_e.textContent,x4([B,G,W],Ht=>{Ze=yT(Ze,Ht," ")}),_e.textContent!==Ze&&(bT(e.removed,{element:_e.cloneNode()}),_e.textContent=Ze)),pe("afterSanitizeElements",_e,null),!1)},Be=function(_e,Ze,ct){if(Ve&&(Ze==="id"||Ze==="name")&&(ct in t||ct in mi))return!1;if(!(Qe&&!Re[Ze]&&$c(z,Ze))){if(!(_t&&$c(q,Ze))){if(!de[Ze]||Re[Ze]){if(!(ht(_e)&&(xe.tagNameCheck instanceof RegExp&&$c(xe.tagNameCheck,_e)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(_e))&&(xe.attributeNameCheck instanceof RegExp&&$c(xe.attributeNameCheck,Ze)||xe.attributeNameCheck instanceof Function&&xe.attributeNameCheck(Ze))||Ze==="is"&&xe.allowCustomizedBuiltInElements&&(xe.tagNameCheck instanceof RegExp&&$c(xe.tagNameCheck,ct)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(ct))))return!1}else if(!Pr[Ze]){if(!$c(te,yT(ct,Z,""))){if(!((Ze==="src"||Ze==="xlink:href"||Ze==="href")&&_e!=="script"&&V_t(ct,"data:")===0&&Qi[_e])){if(!(pt&&!$c(ee,yT(ct,Z,"")))){if(ct)return!1}}}}}}return!0},ht=function(_e){return _e!=="annotation-xml"&&jve(_e,j)},bt=function(_e){pe("beforeSanitizeAttributes",_e,null);const{attributes:Ze}=_e;if(!Ze)return;const ct={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:de};let Ht=Ze.length;for(;Ht--;){const Zt=Ze[Ht],{name:nn,namespaceURI:ln,value:Wt}=Zt,on=dn(nn);let It=nn==="value"?Wt:z_t(Wt);if(ct.attrName=on,ct.attrValue=It,ct.keepAttr=!0,ct.forceKeepAttr=void 0,pe("uponSanitizeAttribute",_e,ct),It=ct.attrValue,ct.forceKeepAttr||(F(nn,_e),!ct.keepAttr))continue;if(!gt&&$c(/\/>/i,It)){F(nn,_e);continue}Ue&&x4([B,G,W],Rt=>{It=yT(It,Rt," ")});const Ct=dn(_e.nodeName);if(Be(Ct,on,It)){if(wt&&(on==="id"||on==="name")&&(F(nn,_e),It=vt+It),wn&&$c(/((--!?|])>)|<\/(style|title)/i,It)){F(nn,_e);continue}if(C&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!ln)switch(f.getAttributeType(Ct,on)){case"TrustedHTML":{It=C.createHTML(It);break}case"TrustedScriptURL":{It=C.createScriptURL(It);break}}try{ln?_e.setAttributeNS(ln,nn,It):_e.setAttribute(nn,It),K(_e)?N(_e):Uve(e.removed)}catch{}}}pe("afterSanitizeAttributes",_e,null)},hn=function Fe(_e){let Ze=null;const ct=A(_e);for(pe("beforeSanitizeShadowDOM",_e,null);Ze=ct.nextNode();)pe("uponSanitizeShadowNode",Ze,null),!Ee(Ze)&&(Ze.content instanceof s&&Fe(Ze.content),bt(Ze));pe("afterSanitizeShadowDOM",_e,null)};return e.sanitize=function(Fe){let _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ze=null,ct=null,Ht=null,Zt=null;if(oo=!Fe,oo&&(Fe=""),typeof Fe!="string"&&!ge(Fe))if(typeof Fe.toString=="function"){if(Fe=Fe.toString(),typeof Fe!="string")throw wT("dirty is not a string, aborting")}else throw wT("toString is not a function");if(!e.isSupported)return Fe;if(jn||Wn(_e),e.removed=[],typeof Fe=="string"&&($t=!1),$t){if(Fe.nodeName){const Wt=dn(Fe.nodeName);if(!le[Wt]||Me[Wt])throw wT("root node is forbidden and cannot be sanitized in-place")}}else if(Fe instanceof a)Ze=V(""),ct=Ze.ownerDocument.importNode(Fe,!0),ct.nodeType===xT.element&&ct.nodeName==="BODY"||ct.nodeName==="HTML"?Ze=ct:Ze.appendChild(ct);else{if(!ci&&!Ue&&!Xt&&Fe.indexOf("<")===-1)return C&&Ie?C.createHTML(Fe):Fe;if(Ze=V(Fe),!Ze)return ci?null:Ie?x:""}Ze&&ji&&N(Ze.firstChild);const nn=A($t?Fe:Ze);for(;Ht=nn.nextNode();)Ee(Ht)||(Ht.content instanceof s&&hn(Ht.content),bt(Ht));if($t)return Fe;if(ci){if(ye)for(Zt=D.call(Ze.ownerDocument);Ze.firstChild;)Zt.appendChild(Ze.firstChild);else Zt=Ze;return(de.shadowroot||de.shadowrootmode)&&(Zt=O.call(i,Zt,!0)),Zt}let ln=Xt?Ze.outerHTML:Ze.innerHTML;return Xt&&le["!doctype"]&&Ze.ownerDocument&&Ze.ownerDocument.doctype&&Ze.ownerDocument.doctype.name&&$c(n3e,Ze.ownerDocument.doctype.name)&&(ln=" -`+ln),Ue&&x4([B,G,W],Wt=>{ln=yT(ln,Wt," ")}),C&&Ie?C.createHTML(ln):ln},e.setConfig=function(){let Fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Wn(Fe),jn=!0},e.clearConfig=function(){bi=null,jn=!1},e.isValidAttribute=function(Fe,_e,Ze){bi||Wn({});const ct=dn(Fe),Ht=dn(_e);return Be(ct,Ht,Ze)},e.addHook=function(Fe,_e){typeof _e=="function"&&(M[Fe]=M[Fe]||[],bT(M[Fe],_e))},e.removeHook=function(Fe){if(M[Fe])return Uve(M[Fe])},e.removeHooks=function(Fe){M[Fe]&&(M[Fe]=[])},e.removeAllHooks=function(){M={}},e}var am=i3e();am.version;am.isSupported;const r3e=am.sanitize;am.setConfig;am.clearConfig;am.isValidAttribute;const s3e=am.addHook,o3e=am.removeHook;am.removeHooks;am.removeAllHooks;var sn;(function(n){n.inMemory="inmemory",n.vscode="vscode",n.internal="private",n.walkThrough="walkThrough",n.walkThroughSnippet="walkThroughSnippet",n.http="http",n.https="https",n.file="file",n.mailto="mailto",n.untitled="untitled",n.data="data",n.command="command",n.vscodeRemote="vscode-remote",n.vscodeRemoteResource="vscode-remote-resource",n.vscodeManagedRemoteResource="vscode-managed-remote-resource",n.vscodeUserData="vscode-userdata",n.vscodeCustomEditor="vscode-custom-editor",n.vscodeNotebookCell="vscode-notebook-cell",n.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",n.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",n.vscodeNotebookCellOutput="vscode-notebook-cell-output",n.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",n.vscodeNotebookMetadata="vscode-notebook-metadata",n.vscodeInteractiveInput="vscode-interactive-input",n.vscodeSettings="vscode-settings",n.vscodeWorkspaceTrust="vscode-workspace-trust",n.vscodeTerminal="vscode-terminal",n.vscodeChatCodeBlock="vscode-chat-code-block",n.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",n.vscodeChatSesssion="vscode-chat-editor",n.webviewPanel="webview-panel",n.vscodeWebview="vscode-webview",n.extension="extension",n.vscodeFileResource="vscode-file",n.tmp="tmp",n.vsls="vsls",n.vscodeSourceControl="vscode-scm",n.commentsInput="comment",n.codeSetting="code-setting",n.outputChannel="output"})(sn||(sn={}));function O$(n,e){return Pt.isUri(n)?bS(n.scheme,e):Lae(n,e+":")}function mX(n,...e){return e.some(t=>O$(n,t))}const r0t="tkn";class s0t{constructor(){this._hosts=Object.create(null),this._ports=Object.create(null),this._connectionTokens=Object.create(null),this._preferredWebSchema="http",this._delegate=null,this._serverRootPath="/"}setPreferredWebSchema(e){this._preferredWebSchema=e}get _remoteResourcesPath(){return Ms.join(this._serverRootPath,sn.vscodeRemoteResource)}rewrite(e){if(this._delegate)try{return this._delegate(e)}catch(a){return rn(a),e}const t=e.authority;let i=this._hosts[t];i&&i.indexOf(":")!==-1&&i.indexOf("[")===-1&&(i=`[${i}]`);const r=this._ports[t],s=this._connectionTokens[t];let o=`path=${encodeURIComponent(e.path)}`;return typeof s=="string"&&(o+=`&${r0t}=${encodeURIComponent(s)}`),Pt.from({scheme:pC?this._preferredWebSchema:sn.vscodeRemoteResource,authority:`${i}:${r}`,path:this._remoteResourcesPath,query:o})}}const a3e=new s0t,o0t="vscode-app";class j6{static{this.FALLBACK_AUTHORITY=o0t}asBrowserUri(e){const t=this.toUri(e);return this.uriToBrowserUri(t)}uriToBrowserUri(e){return e.scheme===sn.vscodeRemote?a3e.rewrite(e):e.scheme===sn.file&&(hg||fpt===`${sn.vscodeFileResource}://${j6.FALLBACK_AUTHORITY}`)?e.with({scheme:sn.vscodeFileResource,authority:e.authority||j6.FALLBACK_AUTHORITY,query:null,fragment:null}):e}toUri(e,t){if(Pt.isUri(e))return e;if(globalThis._VSCODE_FILE_ROOT){const i=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(i))return Pt.joinPath(Pt.parse(i,!0),e);const r=Fmt(i,e);return Pt.file(r)}return Pt.parse(t.toUrl(e))}}const M$=new j6;var _X;(function(n){const e=new Map([["1",{"Cross-Origin-Opener-Policy":"same-origin"}],["2",{"Cross-Origin-Embedder-Policy":"require-corp"}],["3",{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp"}]]);n.CoopAndCoep=Object.freeze(e.get("3"));const t="vscode-coi";function i(s){let o;typeof s=="string"?o=new URL(s).searchParams:s instanceof URL?o=s.searchParams:Pt.isUri(s)&&(o=new URL(s.toString(!0)).searchParams);const a=o?.get(t);if(a)return e.get(a)}n.getHeadersFromQuery=i;function r(s,o,a){if(!globalThis.crossOriginIsolated)return;const l=o&&a?"3":a?"2":"1";s instanceof URLSearchParams?s.set(t,l):s[t]=l}n.addSearchParam=r})(_X||(_X={}));function F$(n){return B$(n,0)}function B$(n,e){switch(typeof n){case"object":return n===null?d_(349,e):Array.isArray(n)?l0t(n,e):c0t(n,e);case"string":return Fae(n,e);case"boolean":return a0t(n,e);case"number":return d_(n,e);case"undefined":return d_(937,e);default:return d_(617,e)}}function d_(n,e){return(e<<5)-e+n|0}function a0t(n,e){return d_(n?433:863,e)}function Fae(n,e){e=d_(149417,e);for(let t=0,i=n.length;tB$(i,t),e)}function c0t(n,e){return e=d_(181387,e),Object.keys(n).sort().reduce((t,i)=>(t=Fae(i,t),B$(n[i],t)),e)}function yj(n,e,t=32){const i=t-e,r=~((1<>>i)>>>0}function Xve(n,e=0,t=n.byteLength,i=0){for(let r=0;rt.toString(16).padStart(2,"0")).join(""):u0t((n>>>0).toString(16),e/4)}class Bae{static{this._bigBlock32=new DataView(new ArrayBuffer(320))}constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){const t=e.length;if(t===0)return;const i=this._buff;let r=this._buffLen,s=this._leftoverHighSurrogate,o,a;for(s!==0?(o=s,a=-1,s=0):(o=e.charCodeAt(0),a=0);;){let l=o;if(Co(o))if(a+1>>6,e[t++]=128|(i&63)>>>0):i<65536?(e[t++]=224|(i&61440)>>>12,e[t++]=128|(i&4032)>>>6,e[t++]=128|(i&63)>>>0):(e[t++]=240|(i&1835008)>>>18,e[t++]=128|(i&258048)>>>12,e[t++]=128|(i&4032)>>>6,e[t++]=128|(i&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),ST(this._h0)+ST(this._h1)+ST(this._h2)+ST(this._h3)+ST(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Xve(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Xve(this._buff));const e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){const e=Bae._bigBlock32,t=this._buffDV;for(let d=0;d<64;d+=4)e.setUint32(d,t.getUint32(d,!1),!1);for(let d=64;d<320;d+=4)e.setUint32(d,yj(e.getUint32(d-12,!1)^e.getUint32(d-32,!1)^e.getUint32(d-56,!1)^e.getUint32(d-64,!1),1),!1);let i=this._h0,r=this._h1,s=this._h2,o=this._h3,a=this._h4,l,c,u;for(let d=0;d<80;d++)d<20?(l=r&s|~r&o,c=1518500249):d<40?(l=r^s^o,c=1859775393):d<60?(l=r&s|r&o|s&o,c=2400959708):(l=r^s^o,c=3395469782),u=yj(i,5)+l+a+c+e.getUint32(d*4,!1)&4294967295,a=o,o=s,s=yj(r,30),r=i,i=u;this._h0=this._h0+i&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}}const{registerWindow:J5n,getWindow:Ot,getDocument:e6n,getWindows:l3e,getWindowsCount:d0t,getWindowId:q6,getWindowById:Qve,hasWindow:t6n,onDidRegisterWindow:$$,onWillUnregisterWindow:h0t,onDidUnregisterWindow:f0t}=function(){const n=new Map;i_t(Xi,1);const e={window:Xi,disposables:new ke};n.set(Xi.vscodeWindowId,e);const t=new fe,i=new fe,r=new fe;function s(o,a){return(typeof o=="number"?n.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(o){if(n.has(o.vscodeWindowId))return me.None;const a=new ke,l={window:o,disposables:a.add(new ke)};return n.set(o.vscodeWindowId,l),a.add(Lt(()=>{n.delete(o.vscodeWindowId),i.fire(o)})),a.add(Ce(o,je.BEFORE_UNLOAD,()=>{r.fire(o)})),t.fire(l),a},getWindows(){return n.values()},getWindowsCount(){return n.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return n.has(o)},getWindowById:s,getWindow(o){const a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;const l=o;return l?.view?l.view.window:Xi},getDocument(o){return Ot(o).document}}}();function Jo(n){for(;n.firstChild;)n.firstChild.remove()}class g0t{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}}function Ce(n,e,t,i){return new g0t(n,e,t,i)}function c3e(n,e){return function(t){return e(new qh(n,t))}}function p0t(n){return function(e){return n(new or(e))}}const Jr=function(e,t,i,r){let s=i;return t==="click"||t==="mousedown"||t==="contextmenu"?s=c3e(Ot(e),i):(t==="keydown"||t==="keypress"||t==="keyup")&&(s=p0t(i)),Ce(e,t,s,r)},m0t=function(e,t,i){const r=c3e(Ot(e),t);return _0t(e,r,i)};function _0t(n,e,t){return Ce(n,Sg&&Pae.pointerEvents?je.POINTER_DOWN:je.MOUSE_DOWN,e,t)}function xD(n,e,t){return pI(n,e,t)}class wj extends Q4e{constructor(e,t){super(e,t)}}let K6,du;class $ae extends Mae{constructor(e){super(),this.defaultTarget=e&&Ot(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}}class Cj{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){rn(e)}}static sort(e,t){return t.priority-e.priority}}(function(){const n=new Map,e=new Map,t=new Map,i=new Map,r=s=>{t.set(s,!1);const o=n.get(s)??[];for(e.set(s,o),n.set(s,[]),i.set(s,!0);o.length>0;)o.sort(Cj.sort),o.shift().execute();i.set(s,!1)};du=(s,o,a=0)=>{const l=q6(s),c=new Cj(o,a);let u=n.get(l);return u||(u=[],n.set(l,u)),u.push(c),t.get(l)||(t.set(l,!0),s.requestAnimationFrame(()=>r(l))),c},K6=(s,o,a)=>{const l=q6(s);if(i.get(l)){const c=new Cj(o,a);let u=e.get(l);return u||(u=[],e.set(l,u)),u.push(c),c}else return du(s,o,a)}})();function W$(n){return Ot(n).getComputedStyle(n,null)}function kb(n,e){const t=Ot(n),i=t.document;if(n!==i.body)return new vi(n.clientWidth,n.clientHeight);if(Sg&&t?.visualViewport)return new vi(t.visualViewport.width,t.visualViewport.height);if(t?.innerWidth&&t.innerHeight)return new vi(t.innerWidth,t.innerHeight);if(i.body&&i.body.clientWidth&&i.body.clientHeight)return new vi(i.body.clientWidth,i.body.clientHeight);if(i.documentElement&&i.documentElement.clientWidth&&i.documentElement.clientHeight)return new vi(i.documentElement.clientWidth,i.documentElement.clientHeight);throw new Error("Unable to figure out browser width and height")}class ws{static convertToPixels(e,t){return parseFloat(t)||0}static getDimension(e,t,i){const r=W$(e),s=r?r.getPropertyValue(t):"0";return ws.convertToPixels(e,s)}static getBorderLeftWidth(e){return ws.getDimension(e,"border-left-width","borderLeftWidth")}static getBorderRightWidth(e){return ws.getDimension(e,"border-right-width","borderRightWidth")}static getBorderTopWidth(e){return ws.getDimension(e,"border-top-width","borderTopWidth")}static getBorderBottomWidth(e){return ws.getDimension(e,"border-bottom-width","borderBottomWidth")}static getPaddingLeft(e){return ws.getDimension(e,"padding-left","paddingLeft")}static getPaddingRight(e){return ws.getDimension(e,"padding-right","paddingRight")}static getPaddingTop(e){return ws.getDimension(e,"padding-top","paddingTop")}static getPaddingBottom(e){return ws.getDimension(e,"padding-bottom","paddingBottom")}static getMarginLeft(e){return ws.getDimension(e,"margin-left","marginLeft")}static getMarginTop(e){return ws.getDimension(e,"margin-top","marginTop")}static getMarginRight(e){return ws.getDimension(e,"margin-right","marginRight")}static getMarginBottom(e){return ws.getDimension(e,"margin-bottom","marginBottom")}}class vi{static{this.None=new vi(0,0)}constructor(e,t){this.width=e,this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new vi(e,t):this}static is(e){return typeof e=="object"&&typeof e.height=="number"&&typeof e.width=="number"}static lift(e){return e instanceof vi?e:new vi(e.width,e.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}}function u3e(n){let e=n.offsetParent,t=n.offsetTop,i=n.offsetLeft;for(;(n=n.parentNode)!==null&&n!==n.ownerDocument.body&&n!==n.ownerDocument.documentElement;){t-=n.scrollTop;const r=h3e(n)?null:W$(n);r&&(i-=r.direction!=="rtl"?n.scrollLeft:-n.scrollLeft),n===e&&(i+=ws.getBorderLeftWidth(n),t+=ws.getBorderTopWidth(n),t+=n.offsetTop,i+=n.offsetLeft,e=n.offsetParent)}return{left:i,top:t}}function v0t(n,e,t){typeof e=="number"&&(n.style.width=`${e}px`),typeof t=="number"&&(n.style.height=`${t}px`)}function ms(n){const e=n.getBoundingClientRect(),t=Ot(n);return{left:e.left+t.scrollX,top:e.top+t.scrollY,width:e.width,height:e.height}}function d3e(n){let e=n,t=1;do{const i=W$(e).zoom;i!=null&&i!=="1"&&(t*=i),e=e.parentElement}while(e!==null&&e!==e.ownerDocument.documentElement);return t}function qc(n){const e=ws.getMarginLeft(n)+ws.getMarginRight(n);return n.offsetWidth+e}function xj(n){const e=ws.getBorderLeftWidth(n)+ws.getBorderRightWidth(n),t=ws.getPaddingLeft(n)+ws.getPaddingRight(n);return n.offsetWidth-e-t}function b0t(n){const e=ws.getBorderTopWidth(n)+ws.getBorderBottomWidth(n),t=ws.getPaddingTop(n)+ws.getPaddingBottom(n);return n.offsetHeight-e-t}function h_(n){const e=ws.getMarginTop(n)+ws.getMarginBottom(n);return n.offsetHeight+e}function xo(n,e){return!!e?.contains(n)}function y0t(n,e,t){for(;n&&n.nodeType===n.ELEMENT_NODE;){if(n.classList.contains(e))return n;if(t){if(typeof t=="string"){if(n.classList.contains(t))return null}else if(n===t)return null}n=n.parentNode}return null}function Sj(n,e,t){return!!y0t(n,e,t)}function h3e(n){return n&&!!n.host&&!!n.mode}function G6(n){return!!Iw(n)}function Iw(n){for(;n.parentNode;){if(n===n.ownerDocument?.body)return null;n=n.parentNode}return h3e(n)?n:null}function ka(){let n=GL().activeElement;for(;n?.shadowRoot;)n=n.shadowRoot.activeElement;return n}function H$(n){return ka()===n}function f3e(n){return xo(ka(),n)}function GL(){return d0t()<=1?Xi.document:Array.from(l3e()).map(({window:e})=>e.document).find(e=>e.hasFocus())??Xi.document}function SD(){return GL().defaultView?.window??Xi}const Wae=new Map;function g3e(){return new w0t}class w0t{constructor(){this._currentCssStyle="",this._styleSheet=void 0}setStyle(e){e!==this._currentCssStyle&&(this._currentCssStyle=e,this._styleSheet?this._styleSheet.innerText=e:this._styleSheet=id(Xi.document.head,t=>t.innerText=e))}dispose(){this._styleSheet&&(this._styleSheet.remove(),this._styleSheet=void 0)}}function id(n=Xi.document.head,e,t){const i=document.createElement("style");if(i.type="text/css",i.media="screen",e?.(i),n.appendChild(i),t&&t.add(Lt(()=>i.remove())),n===Xi.document.head){const r=new Set;Wae.set(i,r);for(const{window:s,disposables:o}of l3e()){if(s===Xi)continue;const a=o.add(C0t(i,r,s));t?.add(a)}}return i}function C0t(n,e,t){const i=new ke,r=n.cloneNode(!0);t.document.head.appendChild(r),i.add(Lt(()=>r.remove()));for(const s of m3e(n))r.sheet?.insertRule(s.cssText,r.sheet?.cssRules.length);return i.add(x0t.observe(n,i,{childList:!0})(()=>{r.textContent=n.textContent})),e.add(r),i.add(Lt(()=>e.delete(r))),i}const x0t=new class{constructor(){this.mutationObservers=new Map}observe(n,e,t){let i=this.mutationObservers.get(n);i||(i=new Map,this.mutationObservers.set(n,i));const r=F$(t);let s=i.get(r);if(s)s.users+=1;else{const o=new fe,a=new MutationObserver(c=>o.fire(c));a.observe(n,t);const l=s={users:1,observer:a,onDidMutate:o.event};e.add(Lt(()=>{l.users-=1,l.users===0&&(o.dispose(),a.disconnect(),i?.delete(r),i?.size===0&&this.mutationObservers.delete(n))})),i.set(r,s)}return s.onDidMutate}};let kj=null;function p3e(){return kj||(kj=id()),kj}function m3e(n){return n?.sheet?.rules?n.sheet.rules:n?.sheet?.cssRules?n.sheet.cssRules:[]}function Y6(n,e,t=p3e()){if(!(!t||!e)){t.sheet?.insertRule(`${n} {${e}}`,0);for(const i of Wae.get(t)??[])Y6(n,e,i)}}function vX(n,e=p3e()){if(!e)return;const t=m3e(e),i=[];for(let r=0;r=0;r--)e.sheet?.deleteRule(i[r]);for(const r of Wae.get(e)??[])vX(n,r)}function S0t(n){return typeof n.selectorText=="string"}function Eo(n){return n instanceof HTMLElement||n instanceof Ot(n).HTMLElement}function Jve(n){return n instanceof HTMLAnchorElement||n instanceof Ot(n).HTMLAnchorElement}function k0t(n){return n instanceof SVGElement||n instanceof Ot(n).SVGElement}function Hae(n){return n instanceof MouseEvent||n instanceof Ot(n).MouseEvent}function Jm(n){return n instanceof KeyboardEvent||n instanceof Ot(n).KeyboardEvent}const je={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Ky?"webkitAnimationStart":"animationstart",ANIMATION_END:Ky?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Ky?"webkitAnimationIteration":"animationiteration"};function E0t(n){const e=n;return!!(e&&typeof e.preventDefault=="function"&&typeof e.stopPropagation=="function")}const Hn={stop:(n,e)=>(n.preventDefault(),e&&n.stopPropagation(),n)};function L0t(n){const e=[];for(let t=0;n&&n.nodeType===n.ELEMENT_NODE;t++)e[t]=n.scrollTop,n=n.parentNode;return e}function T0t(n,e){for(let t=0;n&&n.nodeType===n.ELEMENT_NODE;t++)n.scrollTop!==e[t]&&(n.scrollTop=e[t]),n=n.parentNode}class Z6 extends me{static hasFocusWithin(e){if(Eo(e)){const t=Iw(e),i=t?t.activeElement:e.ownerDocument.activeElement;return xo(i,e)}else{const t=e;return xo(t.document.activeElement,t.document)}}constructor(e){super(),this._onDidFocus=this._register(new fe),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new fe),this.onDidBlur=this._onDidBlur.event;let t=Z6.hasFocusWithin(e),i=!1;const r=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},s=()=>{t&&(i=!0,(Eo(e)?Ot(e):e).setTimeout(()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{Z6.hasFocusWithin(e)!==t&&(t?s():r())},this._register(Ce(e,je.FOCUS,r,!0)),this._register(Ce(e,je.BLUR,s,!0)),Eo(e)&&(this._register(Ce(e,je.FOCUS_IN,()=>this._refreshStateHandler())),this._register(Ce(e,je.FOCUS_OUT,()=>this._refreshStateHandler())))}}function Eg(n){return new Z6(n)}function D0t(n,e){return n.after(e),e}function Ne(n,...e){if(n.append(...e),e.length===1&&typeof e[0]!="string")return e[0]}function Vae(n,e){return n.insertBefore(e,n.firstChild),e}function ea(n,...e){n.innerText="",Ne(n,...e)}const I0t=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var lN;(function(n){n.HTML="http://www.w3.org/1999/xhtml",n.SVG="http://www.w3.org/2000/svg"})(lN||(lN={}));function _3e(n,e,t,...i){const r=I0t.exec(e);if(!r)throw new Error("Bad use of emmet");const s=r[1]||"div";let o;return n!==lN.HTML?o=document.createElementNS(n,s):o=document.createElement(s),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),t&&Object.entries(t).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?o[a]=l:a==="selected"?l&&o.setAttribute(a,"true"):o.setAttribute(a,l))}),o.append(...i),o}function qe(n,e,...t){return _3e(lN.HTML,n,e,...t)}qe.SVG=function(n,e,...t){return _3e(lN.SVG,n,e,...t)};function A0t(n,...e){n?Qc(...e):Al(...e)}function Qc(...n){for(const e of n)e.style.display="",e.removeAttribute("aria-hidden")}function Al(...n){for(const e of n)e.style.display="none",e.setAttribute("aria-hidden","true")}function ebe(n,e){const t=n.devicePixelRatio*e;return Math.max(1,Math.floor(t))/n.devicePixelRatio}function v3e(n){Xi.open(n,"_blank","noopener")}function N0t(n,e){const t=()=>{e(),i=du(n,t)};let i=du(n,t);return Lt(()=>i.dispose())}a3e.setPreferredWebSchema(/^https:/.test(Xi.location.href)?"https":"http");function Z_(n){return n?`url('${M$.uriToBrowserUri(n).toString(!0).replace(/'/g,"%27")}')`:"url('')"}function Ej(n){return`'${n.replace(/'/g,"%27")}'`}function A_(n,e){if(n!==void 0){const t=n.match(/^\s*var\((.+)\)$/);if(t){const i=t[1].split(",",2);return i.length===2&&(e=A_(i[1].trim(),e)),`var(${i[0]}, ${e})`}return n}return e}function R0t(n,e=!1){const t=document.createElement("a");return s3e("afterSanitizeAttributes",i=>{for(const r of["href","src"])if(i.hasAttribute(r)){const s=i.getAttribute(r);if(r==="href"&&s.startsWith("#"))continue;if(t.href=s,!n.includes(t.protocol.replace(/:$/,""))){if(e&&r==="src"&&t.href.startsWith("data:"))continue;i.removeAttribute(r)}}}),Lt(()=>{o3e("afterSanitizeAttributes")})}const P0t=Object.freeze(["a","abbr","b","bdo","blockquote","br","caption","cite","code","col","colgroup","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","label","li","mark","ol","p","pre","q","rp","rt","ruby","samp","small","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","tt","u","ul","var","video","wbr"]);class f_ extends fe{constructor(){super(),this._subscriptions=new ke,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(Ge.runAndSubscribe($$,({window:e,disposables:t})=>this.registerListeners(e,t),{window:Xi,disposables:this._subscriptions}))}registerListeners(e,t){t.add(Ce(e,"keydown",i=>{if(i.defaultPrevented)return;const r=new or(i);if(!(r.keyCode===6&&i.repeat)){if(i.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(i.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(i.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(i.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else if(r.keyCode!==6)this._keyStatus.lastKeyPressed=void 0;else return;this._keyStatus.altKey=i.altKey,this._keyStatus.ctrlKey=i.ctrlKey,this._keyStatus.metaKey=i.metaKey,this._keyStatus.shiftKey=i.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=i,this.fire(this._keyStatus))}},!0)),t.add(Ce(e,"keyup",i=>{i.defaultPrevented||(!i.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!i.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!i.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!i.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=i.altKey,this._keyStatus.ctrlKey=i.ctrlKey,this._keyStatus.metaKey=i.metaKey,this._keyStatus.shiftKey=i.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=i,this.fire(this._keyStatus)))},!0)),t.add(Ce(e.document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(Ce(e.document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(Ce(e.document.body,"mousemove",i=>{i.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),t.add(Ce(e,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return f_.instance||(f_.instance=new f_),f_.instance}dispose(){super.dispose(),this._subscriptions.dispose()}}class O0t extends me{constructor(e,t){super(),this.element=e,this.callbacks=t,this.counter=0,this.dragStartTime=0,this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register(Ce(this.element,je.DRAG_START,e=>{this.callbacks.onDragStart?.(e)})),this.callbacks.onDrag&&this._register(Ce(this.element,je.DRAG,e=>{this.callbacks.onDrag?.(e)})),this._register(Ce(this.element,je.DRAG_ENTER,e=>{this.counter++,this.dragStartTime=e.timeStamp,this.callbacks.onDragEnter?.(e)})),this._register(Ce(this.element,je.DRAG_OVER,e=>{e.preventDefault(),this.callbacks.onDragOver?.(e,e.timeStamp-this.dragStartTime)})),this._register(Ce(this.element,je.DRAG_LEAVE,e=>{this.counter--,this.counter===0&&(this.dragStartTime=0,this.callbacks.onDragLeave?.(e))})),this._register(Ce(this.element,je.DRAG_END,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDragEnd?.(e)})),this._register(Ce(this.element,je.DROP,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDrop?.(e)}))}}const b3e=/(?[\w\-]+)?(?:#(?[\w\-]+))?(?(?:\.(?:[\w\-]+))*)(?:@(?(?:[\w\_])+))?/;function An(n,...e){let t,i;Array.isArray(e[0])?(t={},i=e[0]):(t=e[0]||{},i=e[1]);const r=b3e.exec(n);if(!r||!r.groups)throw new Error("Bad use of h");const s=r.groups.tag||"div",o=document.createElement(s);r.groups.id&&(o.id=r.groups.id);const a=[];if(r.groups.class)for(const c of r.groups.class.split("."))c!==""&&a.push(c);if(t.className!==void 0)for(const c of t.className.split("."))c!==""&&a.push(c);a.length>0&&(o.className=a.join(" "));const l={};if(r.groups.name&&(l[r.groups.name]=o),i)for(const c of i)Eo(c)?o.appendChild(c):typeof c=="string"?o.append(c):"root"in c&&(Object.assign(l,c),o.appendChild(c.root));for(const[c,u]of Object.entries(t))if(c!=="className")if(c==="style")for(const[d,h]of Object.entries(u))o.style.setProperty(X6(d),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?o.tabIndex=u:o.setAttribute(X6(c),u.toString());return l.root=o,l}function cx(n,...e){let t,i;Array.isArray(e[0])?(t={},i=e[0]):(t=e[0]||{},i=e[1]);const r=b3e.exec(n);if(!r||!r.groups)throw new Error("Bad use of h");const s=r.groups.tag||"div",o=document.createElementNS("http://www.w3.org/2000/svg",s);r.groups.id&&(o.id=r.groups.id);const a=[];if(r.groups.class)for(const c of r.groups.class.split("."))c!==""&&a.push(c);if(t.className!==void 0)for(const c of t.className.split("."))c!==""&&a.push(c);a.length>0&&(o.className=a.join(" "));const l={};if(r.groups.name&&(l[r.groups.name]=o),i)for(const c of i)Eo(c)?o.appendChild(c):typeof c=="string"?o.append(c):"root"in c&&(Object.assign(l,c),o.appendChild(c.root));for(const[c,u]of Object.entries(t))if(c!=="className")if(c==="style")for(const[d,h]of Object.entries(u))o.style.setProperty(X6(d),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?o.tabIndex=u:o.setAttribute(X6(c),u.toString());return l.root=o,l}function X6(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}class M0t extends me{constructor(e){super(),this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._listener=()=>this._handleChange(e,!0),this._mediaQueryList=null,this._handleChange(e,!1)}_handleChange(e,t){this._mediaQueryList?.removeEventListener("change",this._listener),this._mediaQueryList=e.matchMedia(`(resolution: ${e.devicePixelRatio}dppx)`),this._mediaQueryList.addEventListener("change",this._listener),t&&this._onDidChange.fire()}}class F0t extends me{get value(){return this._value}constructor(e){super(),this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._value=this._getPixelRatio(e);const t=this._register(new M0t(e));this._register(t.onDidChange(()=>{this._value=this._getPixelRatio(e),this._onDidChange.fire(this._value)}))}_getPixelRatio(e){const t=document.createElement("canvas").getContext("2d"),i=e.devicePixelRatio||1,r=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return i/r}}class B0t{constructor(){this.mapWindowIdToPixelRatioMonitor=new Map}_getOrCreatePixelRatioMonitor(e){const t=q6(e);let i=this.mapWindowIdToPixelRatioMonitor.get(t);return i||(i=new F0t(e),this.mapWindowIdToPixelRatioMonitor.set(t,i),Ge.once(f0t)(({vscodeWindowId:r})=>{r===t&&(i?.dispose(),this.mapWindowIdToPixelRatioMonitor.delete(t))})),i}getInstance(e){return this._getOrCreatePixelRatioMonitor(e)}}const cN=new B0t;class y3e{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingLeft="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){const t=kf(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){const t=kf(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){const t=kf(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){const t=kf(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){const t=kf(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){const t=kf(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){const t=kf(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingLeft(e){const t=kf(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){const t=kf(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){const t=kf(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){const t=kf(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}}function kf(n){return typeof n=="number"?`${n}px`:n}function Ci(n){return new y3e(n)}function ta(n,e){n instanceof y3e?(n.setFontFamily(e.getMassagedFontFamily()),n.setFontWeight(e.fontWeight),n.setFontSize(e.fontSize),n.setFontFeatureSettings(e.fontFeatureSettings),n.setFontVariationSettings(e.fontVariationSettings),n.setLineHeight(e.lineHeight),n.setLetterSpacing(e.letterSpacing)):(n.style.fontFamily=e.getMassagedFontFamily(),n.style.fontWeight=e.fontWeight,n.style.fontSize=e.fontSize+"px",n.style.fontFeatureSettings=e.fontFeatureSettings,n.style.fontVariationSettings=e.fontVariationSettings,n.style.lineHeight=e.lineHeight+"px",n.style.letterSpacing=e.letterSpacing+"px")}class $0t{constructor(e,t){this.chr=e,this.type=t,this.width=0}fulfill(e){this.width=e}}class zae{constructor(e,t){this._bareFontInfo=e,this._requests=t,this._container=null,this._testElements=null}read(e){this._createDomElements(),e.document.body.appendChild(this._container),this._readFromDomElements(),this._container?.remove(),this._container=null,this._testElements=null}_createDomElements(){const e=document.createElement("div");e.style.position="absolute",e.style.top="-50000px",e.style.width="50000px";const t=document.createElement("div");ta(t,this._bareFontInfo),e.appendChild(t);const i=document.createElement("div");ta(i,this._bareFontInfo),i.style.fontWeight="bold",e.appendChild(i);const r=document.createElement("div");ta(r,this._bareFontInfo),r.style.fontStyle="italic",e.appendChild(r);const s=[];for(const o of this._requests){let a;o.type===0&&(a=t),o.type===2&&(a=i),o.type===1&&(a=r),a.appendChild(document.createElement("br"));const l=document.createElement("span");zae._render(l,o),a.appendChild(l),s.push(l)}this._container=e,this._testElements=s}static _render(e,t){if(t.chr===" "){let i=" ";for(let r=0;r<8;r++)i+=i;e.innerText=i}else{let i=t.chr;for(let r=0;r<8;r++)i+=i;e.textContent=i}}_readFromDomElements(){for(let e=0,t=this._requests.length;e{this._evictUntrustedReadingsTimeout=-1,this._evictUntrustedReadings(e)},5e3))}_evictUntrustedReadings(e){const t=this._ensureCache(e),i=t.getValues();let r=!1;for(const s of i)s.isTrusted||(r=!0,t.remove(s));r&&this._onDidChange.fire()}readFontInfo(e,t){const i=this._ensureCache(e);if(!i.has(t)){let r=this._actualReadFontInfo(e,t);(r.typicalHalfwidthCharacterWidth<=2||r.typicalFullwidthCharacterWidth<=2||r.spaceWidth<=2||r.maxDigitWidth<=2)&&(r=new bX({pixelRatio:cN.getInstance(e).value,fontFamily:r.fontFamily,fontWeight:r.fontWeight,fontSize:r.fontSize,fontFeatureSettings:r.fontFeatureSettings,fontVariationSettings:r.fontVariationSettings,lineHeight:r.lineHeight,letterSpacing:r.letterSpacing,isMonospace:r.isMonospace,typicalHalfwidthCharacterWidth:Math.max(r.typicalHalfwidthCharacterWidth,5),typicalFullwidthCharacterWidth:Math.max(r.typicalFullwidthCharacterWidth,5),canUseHalfwidthRightwardsArrow:r.canUseHalfwidthRightwardsArrow,spaceWidth:Math.max(r.spaceWidth,5),middotWidth:Math.max(r.middotWidth,5),wsmiddotWidth:Math.max(r.wsmiddotWidth,5),maxDigitWidth:Math.max(r.maxDigitWidth,5)},!1)),this._writeToCache(e,t,r)}return i.get(t)}_createRequest(e,t,i,r){const s=new $0t(e,t);return i.push(s),r?.push(s),s}_actualReadFontInfo(e,t){const i=[],r=[],s=this._createRequest("n",0,i,r),o=this._createRequest("m",0,i,null),a=this._createRequest(" ",0,i,r),l=this._createRequest("0",0,i,r),c=this._createRequest("1",0,i,r),u=this._createRequest("2",0,i,r),d=this._createRequest("3",0,i,r),h=this._createRequest("4",0,i,r),f=this._createRequest("5",0,i,r),g=this._createRequest("6",0,i,r),p=this._createRequest("7",0,i,r),m=this._createRequest("8",0,i,r),_=this._createRequest("9",0,i,r),v=this._createRequest("→",0,i,r),y=this._createRequest("→",0,i,null),C=this._createRequest("·",0,i,r),x=this._createRequest("⸱",0,i,null),k="|/-_ilm%";for(let M=0,B=k.length;M.001){D=!1;break}}let O=!0;return D&&y.width!==I&&(O=!1),y.width>v.width&&(O=!1),new bX({pixelRatio:cN.getInstance(e).value,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFeatureSettings:t.fontFeatureSettings,fontVariationSettings:t.fontVariationSettings,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,isMonospace:D,typicalHalfwidthCharacterWidth:s.width,typicalFullwidthCharacterWidth:o.width,canUseHalfwidthRightwardsArrow:O,spaceWidth:a.width,middotWidth:C.width,wsmiddotWidth:x.width,maxDigitWidth:L},!0)}}class U0t{constructor(){this._keys=Object.create(null),this._values=Object.create(null)}has(e){const t=e.getId();return!!this._values[t]}get(e){const t=e.getId();return this._values[t]}put(e,t){const i=e.getId();this._keys[i]=e,this._values[i]=t}remove(e){const t=e.getId();delete this._keys[t],delete this._values[t]}getValues(){return Object.keys(this._keys).map(e=>this._values[e])}}const yX=new z0t;var rg;(function(n){n.serviceIds=new Map,n.DI_TARGET="$di$target",n.DI_DEPENDENCIES="$di$dependencies";function e(t){return t[n.DI_DEPENDENCIES]||[]}n.getServiceDependencies=e})(rg||(rg={}));const Tt=On("instantiationService");function j0t(n,e,t){e[rg.DI_TARGET]===e?e[rg.DI_DEPENDENCIES].push({id:n,index:t}):(e[rg.DI_DEPENDENCIES]=[{id:n,index:t}],e[rg.DI_TARGET]=e)}function On(n){if(rg.serviceIds.has(n))return rg.serviceIds.get(n);const e=function(t,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");j0t(e,t,r)};return e.toString=()=>n,rg.serviceIds.set(n,e),e}const ai=On("codeEditorService"),Sr=On("modelService"),Nc=On("textModelService");let su=class extends me{constructor(e,t="",i="",r=!0,s){super(),this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=e,this._label=t,this._cssClass=i,this._enabled=r,this._actionCallback=s}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}async run(e,t){this._actionCallback&&await this._actionCallback(e)}};class Aw extends me{constructor(){super(...arguments),this._onWillRun=this._register(new fe),this.onWillRun=this._onWillRun.event,this._onDidRun=this._register(new fe),this.onDidRun=this._onDidRun.event}async run(e,t){if(!e.enabled)return;this._onWillRun.fire({action:e});let i;try{await this.runAction(e,t)}catch(r){i=r}this._onDidRun.fire({action:e,error:i})}async runAction(e,t){await e.run(t)}}let na=class wX{constructor(){this.id=wX.ID,this.label="",this.tooltip="",this.class="separator",this.enabled=!1,this.checked=!1}static join(...e){let t=[];for(const i of e)i.length&&(t.length?t=[...t,new wX,...i]:t=i);return t}static{this.ID="vs.actions.separator"}async run(){}};class rE{get actions(){return this._actions}constructor(e,t,i,r){this.tooltip="",this.enabled=!0,this.checked=void 0,this.id=e,this.label=t,this.class=r,this._actions=i}async run(){}}class Uae extends su{static{this.ID="vs.actions.empty"}constructor(){super(Uae.ID,w("submenu.empty","(empty)"),void 0,!1)}}function Yy(n){return{id:n.id,label:n.label,tooltip:n.tooltip??n.label,class:n.class,enabled:n.enabled??!0,checked:n.checked,run:async(...e)=>n.run(...e)}}var CX;(function(n){function e(t){return t&&typeof t=="object"&&typeof t.id=="string"}n.isThemeColor=e})(CX||(CX={}));var zt;(function(n){n.iconNameSegment="[A-Za-z0-9]+",n.iconNameExpression="[A-Za-z0-9-]+",n.iconModifierExpression="~[A-Za-z]+",n.iconNameCharacter="[A-Za-z0-9~-]";const e=new RegExp(`^(${n.iconNameExpression})(${n.iconModifierExpression})?$`);function t(h){const f=e.exec(h.id);if(!f)return t(ze.error);const[,g,p]=f,m=["codicon","codicon-"+g];return p&&m.push("codicon-modifier-"+p.substring(1)),m}n.asClassNameArray=t;function i(h){return t(h).join(" ")}n.asClassName=i;function r(h){return"."+t(h).join(".")}n.asCSSSelector=r;function s(h){return h&&typeof h=="object"&&typeof h.id=="string"&&(typeof h.color>"u"||CX.isThemeColor(h.color))}n.isThemeIcon=s;const o=new RegExp(`^\\$\\((${n.iconNameExpression}(?:${n.iconModifierExpression})?)\\)$`);function a(h){const f=o.exec(h);if(!f)return;const[,g]=f;return{id:g}}n.fromString=a;function l(h){return{id:h}}n.fromId=l;function c(h,f){let g=h.id;const p=g.lastIndexOf("~");return p!==-1&&(g=g.substring(0,p)),f&&(g=`${g}~${f}`),{id:g}}n.modify=c;function u(h){const f=h.id.lastIndexOf("~");if(f!==-1)return h.id.substring(f+1)}n.getModifier=u;function d(h,f){return h.id===f.id&&h.color?.id===f.color?.id}n.isEqual=d})(zt||(zt={}));const _r=On("commandService"),Un=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new fe,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(n,e){if(!n)throw new Error("invalid command");if(typeof n=="string"){if(!e)throw new Error("invalid command");return this.registerCommand({id:n,handler:e})}if(n.metadata&&Array.isArray(n.metadata.args)){const o=[];for(const l of n.metadata.args)o.push(l.constraint);const a=n.handler;n.handler=function(l,...c){return ipt(c,o),a(l,...c)}}const{id:t}=n;let i=this._commands.get(t);i||(i=new Rl,this._commands.set(t,i));const r=i.unshift(n),s=Lt(()=>{r(),this._commands.get(t)?.isEmpty()&&this._commands.delete(t)});return this._onDidRegisterCommand.fire(t),s}registerCommandAlias(n,e){return Un.registerCommand(n,(t,...i)=>t.get(_r).executeCommand(e,...i))}getCommand(n){const e=this._commands.get(n);if(!(!e||e.isEmpty()))return zn.first(e)}getCommands(){const n=new Map;for(const e of this._commands.keys()){const t=this.getCommand(e);t&&n.set(e,t)}return n}};Un.registerCommand("noop",()=>{});function Tj(...n){switch(n.length){case 1:return w("contextkey.scanner.hint.didYouMean1","Did you mean {0}?",n[0]);case 2:return w("contextkey.scanner.hint.didYouMean2","Did you mean {0} or {1}?",n[0],n[1]);case 3:return w("contextkey.scanner.hint.didYouMean3","Did you mean {0}, {1} or {2}?",n[0],n[1],n[2]);default:return}}const q0t=w("contextkey.scanner.hint.didYouForgetToOpenOrCloseQuote","Did you forget to open or close the quote?"),K0t=w("contextkey.scanner.hint.didYouForgetToEscapeSlash","Did you forget to escape the '/' (slash) character? Put two backslashes before it to escape, e.g., '\\\\/'.");let kT=class xX{constructor(){this._input="",this._start=0,this._current=0,this._tokens=[],this._errors=[],this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(e){switch(e.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return e.isTripleEq?"===":"==";case 4:return e.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return e.lexeme;case 11:return"true";case 12:return"false";case 13:return"in";case 14:return"not";case 15:return"&&";case 16:return"||";case 17:return e.lexeme;case 18:return e.lexeme;case 19:return e.lexeme;case 20:return"EOF";default:throw bae(`unhandled token type: ${JSON.stringify(e)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(e=>e.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}reset(e){return this._input=e,this._start=0,this._current=0,this._tokens=[],this._errors=[],this}scan(){for(;!this._isAtEnd();)switch(this._start=this._current,this._advance()){case 40:this._addToken(0);break;case 41:this._addToken(1);break;case 33:if(this._match(61)){const t=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:t})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){const t=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:t})}else this._match(126)?this._addToken(9):this._error(Tj("==","=~"));break;case 60:this._addToken(this._match(61)?6:5);break;case 62:this._addToken(this._match(61)?8:7);break;case 38:this._match(38)?this._addToken(15):this._error(Tj("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(Tj("||"));break;case 32:case 13:case 9:case 10:case 160:break;default:this._string()}return this._start=this._current,this._addToken(20),Array.from(this._tokens)}_match(e){return this._isAtEnd()||this._input.charCodeAt(this._current)!==e?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(e){this._tokens.push({type:e,offset:this._start})}_error(e){const t=this._start,i=this._input.substring(this._start,this._current),r={type:19,offset:this._start,lexeme:i};this._errors.push({offset:t,lexeme:i,additionalInfo:e}),this._tokens.push(r)}_string(){this.stringRe.lastIndex=this._start;const e=this.stringRe.exec(this._input);if(e){this._current=this._start+e[0].length;const t=this._input.substring(this._start,this._current),i=xX._keywords.get(t);i?this._addToken(i):this._tokens.push({type:17,lexeme:t,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(q0t);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let e=this._current,t=!1,i=!1;for(;;){if(e>=this._input.length){this._current=e,this._error(K0t);return}const s=this._input.charCodeAt(e);if(t)t=!1;else if(s===47&&!i){e++;break}else s===91?i=!0:s===92?t=!0:s===93&&(i=!1);e++}for(;e=this._input.length}};const Ya=new Map;Ya.set("false",!1);Ya.set("true",!0);Ya.set("isMac",Rn);Ya.set("isLinux",zl);Ya.set("isWindows",Ta);Ya.set("isWeb",pC);Ya.set("isMacNative",Rn&&!pC);Ya.set("isEdge",vpt);Ya.set("isFirefox",mpt);Ya.set("isChrome",v4e);Ya.set("isSafari",_pt);const G0t=Object.prototype.hasOwnProperty,Y0t={regexParsingWithErrorRecovery:!0},Z0t=w("contextkey.parser.error.emptyString","Empty context key expression"),X0t=w("contextkey.parser.error.emptyString.hint","Did you forget to write an expression? You can also put 'false' or 'true' to always evaluate to false or true, respectively."),Q0t=w("contextkey.parser.error.noInAfterNot","'in' after 'not'."),tbe=w("contextkey.parser.error.closingParenthesis","closing parenthesis ')'"),J0t=w("contextkey.parser.error.unexpectedToken","Unexpected token"),evt=w("contextkey.parser.error.unexpectedToken.hint","Did you forget to put && or || before the token?"),tvt=w("contextkey.parser.error.unexpectedEOF","Unexpected end of expression"),nvt=w("contextkey.parser.error.unexpectedEOF.hint","Did you forget to put a context key?");let ivt=class kD{static{this._parseError=new Error}constructor(e=Y0t){this._config=e,this._scanner=new kT,this._tokens=[],this._current=0,this._parsingErrors=[],this._flagsGYRe=/g|y/g}parse(e){if(e===""){this._parsingErrors.push({message:Z0t,offset:0,lexeme:"",additionalInfo:X0t});return}this._tokens=this._scanner.reset(e).scan(),this._current=0,this._parsingErrors=[];try{const t=this._expr();if(!this._isAtEnd()){const i=this._peek(),r=i.type===17?evt:void 0;throw this._parsingErrors.push({message:J0t,offset:i.offset,lexeme:kT.getLexeme(i),additionalInfo:r}),kD._parseError}return t}catch(t){if(t!==kD._parseError)throw t;return}}_expr(){return this._or()}_or(){const e=[this._and()];for(;this._matchOne(16);){const t=this._and();e.push(t)}return e.length===1?e[0]:Le.or(...e)}_and(){const e=[this._term()];for(;this._matchOne(15);){const t=this._term();e.push(t)}return e.length===1?e[0]:Le.and(...e)}_term(){if(this._matchOne(2)){const e=this._peek();switch(e.type){case 11:return this._advance(),Ul.INSTANCE;case 12:return this._advance(),Lc.INSTANCE;case 0:{this._advance();const t=this._expr();return this._consume(1,tbe),t?.negate()}case 17:return this._advance(),_C.create(e.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",e)}}return this._primary()}_primary(){const e=this._peek();switch(e.type){case 11:return this._advance(),Le.true();case 12:return this._advance(),Le.false();case 0:{this._advance();const t=this._expr();return this._consume(1,tbe),t}case 17:{const t=e.lexeme;if(this._advance(),this._matchOne(9)){const r=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),r.type!==10)throw this._errExpectedButGot("REGEX",r);const s=r.lexeme,o=s.lastIndexOf("/"),a=o===s.length-1?void 0:this._removeFlagsGY(s.substring(o+1));let l;try{l=new RegExp(s.substring(1,o),a)}catch{throw this._errExpectedButGot("REGEX",r)}return uN.create(t,l)}switch(r.type){case 10:case 19:{const s=[r.lexeme];this._advance();let o=this._peek(),a=0;for(let h=0;h=0){const c=s.slice(a+1,l),u=s[l+1]==="i"?"i":"";try{o=new RegExp(c,u)}catch{throw this._errExpectedButGot("REGEX",r)}}}if(o===null)throw this._errExpectedButGot("REGEX",r);return uN.create(t,o)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,Q0t);const r=this._value();return Le.notIn(t,r)}switch(this._peek().type){case 3:{this._advance();const r=this._value();if(this._previous().type===18)return Le.equals(t,r);switch(r){case"true":return Le.has(t);case"false":return Le.not(t);default:return Le.equals(t,r)}}case 4:{this._advance();const r=this._value();if(this._previous().type===18)return Le.notEquals(t,r);switch(r){case"true":return Le.not(t);case"false":return Le.has(t);default:return Le.notEquals(t,r)}}case 5:return this._advance(),G$.create(t,this._value());case 6:return this._advance(),Y$.create(t,this._value());case 7:return this._advance(),q$.create(t,this._value());case 8:return this._advance(),K$.create(t,this._value());case 13:return this._advance(),Le.in(t,this._value());default:return Le.has(t)}}case 20:throw this._parsingErrors.push({message:tvt,offset:e.offset,lexeme:"",additionalInfo:nvt}),kD._parseError;default:throw this._errExpectedButGot(`true | false | KEY +`))}}class ymt extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}}class wmt extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}}class dj{constructor(e){this.value=e}}const Cmt=2;let fe=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new wae(e?.onListenerError??rn,this._options?.leakWarningThreshold??bmt):void 0,this._perfMon=this._options?._profName?new O6(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){const a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);const l=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],c=new wmt(`${a}. HINT: Stack shows most frequent listener (${l[1]}-times)`,l[0]);return(this._options?.onListenerError||rn)(c),me.None}if(this._disposed)return me.None;t&&(e=e.bind(t));const r=new dj(e);let s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Cae.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof dj?(this._deliveryQueue??=new x4e,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;const o=Lt(()=>{s?.(),this._removeListener(r)});return i instanceof ke?i.add(o):Array.isArray(i)&&i.push(o),o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}const t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;const r=this._deliveryQueue.current===this;if(this._size*Cmt<=t.length){let s=0;for(let o=0;o0}};const xmt=()=>new x4e;class x4e{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}class Ew extends fe{constructor(e){super(e),this._isPaused=0,this._eventQueue=new Rl,this._mergeFn=e?.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){const e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(this._isPaused!==0?this._eventQueue.push(e):super.fire(e))}}class S4e extends Ew{constructor(e){super(e),this._delay=e.delay??100}fire(e){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(e)}}class Smt extends fe{constructor(e){super(e),this._queuedEvents=[],this._mergeFn=e?.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(t=>super.fire(t)),this._queuedEvents=[]}))}}class kmt{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new fe({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){const t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),Lt(wb(()=>{this.hasListeners&&this.unhook(t);const r=this.events.indexOf(t);this.events.splice(r,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(t=>this.emitter.fire(t))}unhook(e){e.listener?.dispose(),e.listener=null}dispose(){this.emitter.dispose();for(const e of this.events)e.listener?.dispose();this.events=[]}}class UP{constructor(){this.data=[]}wrapEvent(e,t,i){return(r,s,o)=>e(a=>{const l=this.data[this.data.length-1];if(!t){l?l.buffers.push(()=>r.call(s,a)):r.call(s,a);return}const c=l;if(!c){r.call(s,t(i,a));return}c.items??=[],c.items.push(a),c.buffers.length===0&&l.buffers.push(()=>{c.reducedResult??=i?c.items.reduce(t,i):c.items.reduce(t),r.call(s,c.reducedResult)})},void 0,o)}bufferEvents(e){const t={buffers:new Array};this.data.push(t);const i=e();return this.data.pop(),t.buffers.forEach(r=>r()),i}}class Ove{constructor(){this.listening=!1,this.inputEvent=Ge.None,this.inputEventListener=me.None,this.emitter=new fe({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}const k4e=Object.freeze(function(n,e){const t=setTimeout(n.bind(e),0);return{dispose(){clearTimeout(t)}}});var yn;(function(n){function e(t){return t===n.None||t===n.Cancelled||t instanceof F5?!0:!t||typeof t!="object"?!1:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}n.isCancellationToken=e,n.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ge.None}),n.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:k4e})})(yn||(yn={}));class F5{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?k4e:(this._emitter||(this._emitter=new fe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}}let Kr=class{constructor(e){this._token=void 0,this._parentListener=void 0,this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new F5),this._token}cancel(){this._token?this._token instanceof F5&&this._token.cancel():this._token=yn.Cancelled}dispose(e=!1){e&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof F5&&this._token.dispose():this._token=yn.None}};function lZ(n){const e=new Kr;return n.add({dispose(){e.cancel()}}),e.token}class xae{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}}const B5=new xae,cZ=new xae,uZ=new xae,E4e=new Array(230),Emt=Object.create(null),Lmt=Object.create(null),Sae=[];for(let n=0;n<=193;n++)Sae[n]=-1;(function(){const n="",e=[[1,0,"None",0,"unknown",0,"VK_UNKNOWN",n,n],[1,1,"Hyper",0,n,0,n,n,n],[1,2,"Super",0,n,0,n,n,n],[1,3,"Fn",0,n,0,n,n,n],[1,4,"FnLock",0,n,0,n,n,n],[1,5,"Suspend",0,n,0,n,n,n],[1,6,"Resume",0,n,0,n,n,n],[1,7,"Turbo",0,n,0,n,n,n],[1,8,"Sleep",0,n,0,"VK_SLEEP",n,n],[1,9,"WakeUp",0,n,0,n,n,n],[0,10,"KeyA",31,"A",65,"VK_A",n,n],[0,11,"KeyB",32,"B",66,"VK_B",n,n],[0,12,"KeyC",33,"C",67,"VK_C",n,n],[0,13,"KeyD",34,"D",68,"VK_D",n,n],[0,14,"KeyE",35,"E",69,"VK_E",n,n],[0,15,"KeyF",36,"F",70,"VK_F",n,n],[0,16,"KeyG",37,"G",71,"VK_G",n,n],[0,17,"KeyH",38,"H",72,"VK_H",n,n],[0,18,"KeyI",39,"I",73,"VK_I",n,n],[0,19,"KeyJ",40,"J",74,"VK_J",n,n],[0,20,"KeyK",41,"K",75,"VK_K",n,n],[0,21,"KeyL",42,"L",76,"VK_L",n,n],[0,22,"KeyM",43,"M",77,"VK_M",n,n],[0,23,"KeyN",44,"N",78,"VK_N",n,n],[0,24,"KeyO",45,"O",79,"VK_O",n,n],[0,25,"KeyP",46,"P",80,"VK_P",n,n],[0,26,"KeyQ",47,"Q",81,"VK_Q",n,n],[0,27,"KeyR",48,"R",82,"VK_R",n,n],[0,28,"KeyS",49,"S",83,"VK_S",n,n],[0,29,"KeyT",50,"T",84,"VK_T",n,n],[0,30,"KeyU",51,"U",85,"VK_U",n,n],[0,31,"KeyV",52,"V",86,"VK_V",n,n],[0,32,"KeyW",53,"W",87,"VK_W",n,n],[0,33,"KeyX",54,"X",88,"VK_X",n,n],[0,34,"KeyY",55,"Y",89,"VK_Y",n,n],[0,35,"KeyZ",56,"Z",90,"VK_Z",n,n],[0,36,"Digit1",22,"1",49,"VK_1",n,n],[0,37,"Digit2",23,"2",50,"VK_2",n,n],[0,38,"Digit3",24,"3",51,"VK_3",n,n],[0,39,"Digit4",25,"4",52,"VK_4",n,n],[0,40,"Digit5",26,"5",53,"VK_5",n,n],[0,41,"Digit6",27,"6",54,"VK_6",n,n],[0,42,"Digit7",28,"7",55,"VK_7",n,n],[0,43,"Digit8",29,"8",56,"VK_8",n,n],[0,44,"Digit9",30,"9",57,"VK_9",n,n],[0,45,"Digit0",21,"0",48,"VK_0",n,n],[1,46,"Enter",3,"Enter",13,"VK_RETURN",n,n],[1,47,"Escape",9,"Escape",27,"VK_ESCAPE",n,n],[1,48,"Backspace",1,"Backspace",8,"VK_BACK",n,n],[1,49,"Tab",2,"Tab",9,"VK_TAB",n,n],[1,50,"Space",10,"Space",32,"VK_SPACE",n,n],[0,51,"Minus",88,"-",189,"VK_OEM_MINUS","-","OEM_MINUS"],[0,52,"Equal",86,"=",187,"VK_OEM_PLUS","=","OEM_PLUS"],[0,53,"BracketLeft",92,"[",219,"VK_OEM_4","[","OEM_4"],[0,54,"BracketRight",94,"]",221,"VK_OEM_6","]","OEM_6"],[0,55,"Backslash",93,"\\",220,"VK_OEM_5","\\","OEM_5"],[0,56,"IntlHash",0,n,0,n,n,n],[0,57,"Semicolon",85,";",186,"VK_OEM_1",";","OEM_1"],[0,58,"Quote",95,"'",222,"VK_OEM_7","'","OEM_7"],[0,59,"Backquote",91,"`",192,"VK_OEM_3","`","OEM_3"],[0,60,"Comma",87,",",188,"VK_OEM_COMMA",",","OEM_COMMA"],[0,61,"Period",89,".",190,"VK_OEM_PERIOD",".","OEM_PERIOD"],[0,62,"Slash",90,"/",191,"VK_OEM_2","/","OEM_2"],[1,63,"CapsLock",8,"CapsLock",20,"VK_CAPITAL",n,n],[1,64,"F1",59,"F1",112,"VK_F1",n,n],[1,65,"F2",60,"F2",113,"VK_F2",n,n],[1,66,"F3",61,"F3",114,"VK_F3",n,n],[1,67,"F4",62,"F4",115,"VK_F4",n,n],[1,68,"F5",63,"F5",116,"VK_F5",n,n],[1,69,"F6",64,"F6",117,"VK_F6",n,n],[1,70,"F7",65,"F7",118,"VK_F7",n,n],[1,71,"F8",66,"F8",119,"VK_F8",n,n],[1,72,"F9",67,"F9",120,"VK_F9",n,n],[1,73,"F10",68,"F10",121,"VK_F10",n,n],[1,74,"F11",69,"F11",122,"VK_F11",n,n],[1,75,"F12",70,"F12",123,"VK_F12",n,n],[1,76,"PrintScreen",0,n,0,n,n,n],[1,77,"ScrollLock",84,"ScrollLock",145,"VK_SCROLL",n,n],[1,78,"Pause",7,"PauseBreak",19,"VK_PAUSE",n,n],[1,79,"Insert",19,"Insert",45,"VK_INSERT",n,n],[1,80,"Home",14,"Home",36,"VK_HOME",n,n],[1,81,"PageUp",11,"PageUp",33,"VK_PRIOR",n,n],[1,82,"Delete",20,"Delete",46,"VK_DELETE",n,n],[1,83,"End",13,"End",35,"VK_END",n,n],[1,84,"PageDown",12,"PageDown",34,"VK_NEXT",n,n],[1,85,"ArrowRight",17,"RightArrow",39,"VK_RIGHT","Right",n],[1,86,"ArrowLeft",15,"LeftArrow",37,"VK_LEFT","Left",n],[1,87,"ArrowDown",18,"DownArrow",40,"VK_DOWN","Down",n],[1,88,"ArrowUp",16,"UpArrow",38,"VK_UP","Up",n],[1,89,"NumLock",83,"NumLock",144,"VK_NUMLOCK",n,n],[1,90,"NumpadDivide",113,"NumPad_Divide",111,"VK_DIVIDE",n,n],[1,91,"NumpadMultiply",108,"NumPad_Multiply",106,"VK_MULTIPLY",n,n],[1,92,"NumpadSubtract",111,"NumPad_Subtract",109,"VK_SUBTRACT",n,n],[1,93,"NumpadAdd",109,"NumPad_Add",107,"VK_ADD",n,n],[1,94,"NumpadEnter",3,n,0,n,n,n],[1,95,"Numpad1",99,"NumPad1",97,"VK_NUMPAD1",n,n],[1,96,"Numpad2",100,"NumPad2",98,"VK_NUMPAD2",n,n],[1,97,"Numpad3",101,"NumPad3",99,"VK_NUMPAD3",n,n],[1,98,"Numpad4",102,"NumPad4",100,"VK_NUMPAD4",n,n],[1,99,"Numpad5",103,"NumPad5",101,"VK_NUMPAD5",n,n],[1,100,"Numpad6",104,"NumPad6",102,"VK_NUMPAD6",n,n],[1,101,"Numpad7",105,"NumPad7",103,"VK_NUMPAD7",n,n],[1,102,"Numpad8",106,"NumPad8",104,"VK_NUMPAD8",n,n],[1,103,"Numpad9",107,"NumPad9",105,"VK_NUMPAD9",n,n],[1,104,"Numpad0",98,"NumPad0",96,"VK_NUMPAD0",n,n],[1,105,"NumpadDecimal",112,"NumPad_Decimal",110,"VK_DECIMAL",n,n],[0,106,"IntlBackslash",97,"OEM_102",226,"VK_OEM_102",n,n],[1,107,"ContextMenu",58,"ContextMenu",93,n,n,n],[1,108,"Power",0,n,0,n,n,n],[1,109,"NumpadEqual",0,n,0,n,n,n],[1,110,"F13",71,"F13",124,"VK_F13",n,n],[1,111,"F14",72,"F14",125,"VK_F14",n,n],[1,112,"F15",73,"F15",126,"VK_F15",n,n],[1,113,"F16",74,"F16",127,"VK_F16",n,n],[1,114,"F17",75,"F17",128,"VK_F17",n,n],[1,115,"F18",76,"F18",129,"VK_F18",n,n],[1,116,"F19",77,"F19",130,"VK_F19",n,n],[1,117,"F20",78,"F20",131,"VK_F20",n,n],[1,118,"F21",79,"F21",132,"VK_F21",n,n],[1,119,"F22",80,"F22",133,"VK_F22",n,n],[1,120,"F23",81,"F23",134,"VK_F23",n,n],[1,121,"F24",82,"F24",135,"VK_F24",n,n],[1,122,"Open",0,n,0,n,n,n],[1,123,"Help",0,n,0,n,n,n],[1,124,"Select",0,n,0,n,n,n],[1,125,"Again",0,n,0,n,n,n],[1,126,"Undo",0,n,0,n,n,n],[1,127,"Cut",0,n,0,n,n,n],[1,128,"Copy",0,n,0,n,n,n],[1,129,"Paste",0,n,0,n,n,n],[1,130,"Find",0,n,0,n,n,n],[1,131,"AudioVolumeMute",117,"AudioVolumeMute",173,"VK_VOLUME_MUTE",n,n],[1,132,"AudioVolumeUp",118,"AudioVolumeUp",175,"VK_VOLUME_UP",n,n],[1,133,"AudioVolumeDown",119,"AudioVolumeDown",174,"VK_VOLUME_DOWN",n,n],[1,134,"NumpadComma",110,"NumPad_Separator",108,"VK_SEPARATOR",n,n],[0,135,"IntlRo",115,"ABNT_C1",193,"VK_ABNT_C1",n,n],[1,136,"KanaMode",0,n,0,n,n,n],[0,137,"IntlYen",0,n,0,n,n,n],[1,138,"Convert",0,n,0,n,n,n],[1,139,"NonConvert",0,n,0,n,n,n],[1,140,"Lang1",0,n,0,n,n,n],[1,141,"Lang2",0,n,0,n,n,n],[1,142,"Lang3",0,n,0,n,n,n],[1,143,"Lang4",0,n,0,n,n,n],[1,144,"Lang5",0,n,0,n,n,n],[1,145,"Abort",0,n,0,n,n,n],[1,146,"Props",0,n,0,n,n,n],[1,147,"NumpadParenLeft",0,n,0,n,n,n],[1,148,"NumpadParenRight",0,n,0,n,n,n],[1,149,"NumpadBackspace",0,n,0,n,n,n],[1,150,"NumpadMemoryStore",0,n,0,n,n,n],[1,151,"NumpadMemoryRecall",0,n,0,n,n,n],[1,152,"NumpadMemoryClear",0,n,0,n,n,n],[1,153,"NumpadMemoryAdd",0,n,0,n,n,n],[1,154,"NumpadMemorySubtract",0,n,0,n,n,n],[1,155,"NumpadClear",131,"Clear",12,"VK_CLEAR",n,n],[1,156,"NumpadClearEntry",0,n,0,n,n,n],[1,0,n,5,"Ctrl",17,"VK_CONTROL",n,n],[1,0,n,4,"Shift",16,"VK_SHIFT",n,n],[1,0,n,6,"Alt",18,"VK_MENU",n,n],[1,0,n,57,"Meta",91,"VK_COMMAND",n,n],[1,157,"ControlLeft",5,n,0,"VK_LCONTROL",n,n],[1,158,"ShiftLeft",4,n,0,"VK_LSHIFT",n,n],[1,159,"AltLeft",6,n,0,"VK_LMENU",n,n],[1,160,"MetaLeft",57,n,0,"VK_LWIN",n,n],[1,161,"ControlRight",5,n,0,"VK_RCONTROL",n,n],[1,162,"ShiftRight",4,n,0,"VK_RSHIFT",n,n],[1,163,"AltRight",6,n,0,"VK_RMENU",n,n],[1,164,"MetaRight",57,n,0,"VK_RWIN",n,n],[1,165,"BrightnessUp",0,n,0,n,n,n],[1,166,"BrightnessDown",0,n,0,n,n,n],[1,167,"MediaPlay",0,n,0,n,n,n],[1,168,"MediaRecord",0,n,0,n,n,n],[1,169,"MediaFastForward",0,n,0,n,n,n],[1,170,"MediaRewind",0,n,0,n,n,n],[1,171,"MediaTrackNext",124,"MediaTrackNext",176,"VK_MEDIA_NEXT_TRACK",n,n],[1,172,"MediaTrackPrevious",125,"MediaTrackPrevious",177,"VK_MEDIA_PREV_TRACK",n,n],[1,173,"MediaStop",126,"MediaStop",178,"VK_MEDIA_STOP",n,n],[1,174,"Eject",0,n,0,n,n,n],[1,175,"MediaPlayPause",127,"MediaPlayPause",179,"VK_MEDIA_PLAY_PAUSE",n,n],[1,176,"MediaSelect",128,"LaunchMediaPlayer",181,"VK_MEDIA_LAUNCH_MEDIA_SELECT",n,n],[1,177,"LaunchMail",129,"LaunchMail",180,"VK_MEDIA_LAUNCH_MAIL",n,n],[1,178,"LaunchApp2",130,"LaunchApp2",183,"VK_MEDIA_LAUNCH_APP2",n,n],[1,179,"LaunchApp1",0,n,0,"VK_MEDIA_LAUNCH_APP1",n,n],[1,180,"SelectTask",0,n,0,n,n,n],[1,181,"LaunchScreenSaver",0,n,0,n,n,n],[1,182,"BrowserSearch",120,"BrowserSearch",170,"VK_BROWSER_SEARCH",n,n],[1,183,"BrowserHome",121,"BrowserHome",172,"VK_BROWSER_HOME",n,n],[1,184,"BrowserBack",122,"BrowserBack",166,"VK_BROWSER_BACK",n,n],[1,185,"BrowserForward",123,"BrowserForward",167,"VK_BROWSER_FORWARD",n,n],[1,186,"BrowserStop",0,n,0,"VK_BROWSER_STOP",n,n],[1,187,"BrowserRefresh",0,n,0,"VK_BROWSER_REFRESH",n,n],[1,188,"BrowserFavorites",0,n,0,"VK_BROWSER_FAVORITES",n,n],[1,189,"ZoomToggle",0,n,0,n,n,n],[1,190,"MailReply",0,n,0,n,n,n],[1,191,"MailForward",0,n,0,n,n,n],[1,192,"MailSend",0,n,0,n,n,n],[1,0,n,114,"KeyInComposition",229,n,n,n],[1,0,n,116,"ABNT_C2",194,"VK_ABNT_C2",n,n],[1,0,n,96,"OEM_8",223,"VK_OEM_8",n,n],[1,0,n,0,n,0,"VK_KANA",n,n],[1,0,n,0,n,0,"VK_HANGUL",n,n],[1,0,n,0,n,0,"VK_JUNJA",n,n],[1,0,n,0,n,0,"VK_FINAL",n,n],[1,0,n,0,n,0,"VK_HANJA",n,n],[1,0,n,0,n,0,"VK_KANJI",n,n],[1,0,n,0,n,0,"VK_CONVERT",n,n],[1,0,n,0,n,0,"VK_NONCONVERT",n,n],[1,0,n,0,n,0,"VK_ACCEPT",n,n],[1,0,n,0,n,0,"VK_MODECHANGE",n,n],[1,0,n,0,n,0,"VK_SELECT",n,n],[1,0,n,0,n,0,"VK_PRINT",n,n],[1,0,n,0,n,0,"VK_EXECUTE",n,n],[1,0,n,0,n,0,"VK_SNAPSHOT",n,n],[1,0,n,0,n,0,"VK_HELP",n,n],[1,0,n,0,n,0,"VK_APPS",n,n],[1,0,n,0,n,0,"VK_PROCESSKEY",n,n],[1,0,n,0,n,0,"VK_PACKET",n,n],[1,0,n,0,n,0,"VK_DBE_SBCSCHAR",n,n],[1,0,n,0,n,0,"VK_DBE_DBCSCHAR",n,n],[1,0,n,0,n,0,"VK_ATTN",n,n],[1,0,n,0,n,0,"VK_CRSEL",n,n],[1,0,n,0,n,0,"VK_EXSEL",n,n],[1,0,n,0,n,0,"VK_EREOF",n,n],[1,0,n,0,n,0,"VK_PLAY",n,n],[1,0,n,0,n,0,"VK_ZOOM",n,n],[1,0,n,0,n,0,"VK_NONAME",n,n],[1,0,n,0,n,0,"VK_PA1",n,n],[1,0,n,0,n,0,"VK_OEM_CLEAR",n,n]],t=[],i=[];for(const r of e){const[s,o,a,l,c,u,d,h,f]=r;if(i[o]||(i[o]=!0,Emt[a]=o,Lmt[a.toLowerCase()]=o,s&&(Sae[o]=l)),!t[l]){if(t[l]=!0,!c)throw new Error(`String representation missing for key code ${l} around scan code ${a}`);B5.define(l,c),cZ.define(l,h||c),uZ.define(l,f||h||c)}u&&(E4e[u]=l)}})();var r_;(function(n){function e(a){return B5.keyCodeToStr(a)}n.toString=e;function t(a){return B5.strToKeyCode(a)}n.fromString=t;function i(a){return cZ.keyCodeToStr(a)}n.toUserSettingsUS=i;function r(a){return uZ.keyCodeToStr(a)}n.toUserSettingsGeneral=r;function s(a){return cZ.strToKeyCode(a)||uZ.strToKeyCode(a)}n.fromUserSettings=s;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return B5.keyCodeToStr(a)}n.toElectronAccelerator=o})(r_||(r_={}));function js(n,e){const t=(e&65535)<<16>>>0;return(n|t)>>>0}var Mve={};let ak;const hj=globalThis.vscode;if(typeof hj<"u"&&typeof hj.process<"u"){const n=hj.process;ak={get platform(){return n.platform},get arch(){return n.arch},get env(){return n.env},cwd(){return n.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?ak={get platform(){return process.platform},get arch(){return process.arch},get env(){return Mve},cwd(){return Mve.VSCODE_CWD||process.cwd()}}:ak={get platform(){return Ta?"win32":Rn?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};const M6=ak.cwd,dZ=ak.env,Tmt=ak.platform,Dmt=65,Imt=97,Amt=90,Nmt=122,ib=46,al=47,Tu=92,H0=58,Rmt=63;class L4e extends Error{constructor(e,t,i){let r;typeof t=="string"&&t.indexOf("not ")===0?(r="must not be",t=t.replace(/^not /,"")):r="must be";const s=e.indexOf(".")!==-1?"property":"argument";let o=`The "${e}" ${s} ${r} of type ${t}`;o+=`. Received type ${typeof i}`,super(o),this.code="ERR_INVALID_ARG_TYPE"}}function Pmt(n,e){if(n===null||typeof n!="object")throw new L4e(e,"Object",n)}function No(n,e){if(typeof n!="string")throw new L4e(e,"string",n)}const g0=Tmt==="win32";function zi(n){return n===al||n===Tu}function hZ(n){return n===al}function V0(n){return n>=Dmt&&n<=Amt||n>=Imt&&n<=Nmt}function F6(n,e,t,i){let r="",s=0,o=-1,a=0,l=0;for(let c=0;c<=n.length;++c){if(c2){const u=r.lastIndexOf(t);u===-1?(r="",s=0):(r=r.slice(0,u),s=r.length-1-r.lastIndexOf(t)),o=c,a=0;continue}else if(r.length!==0){r="",s=0,o=c,a=0;continue}}e&&(r+=r.length>0?`${t}..`:"..",s=2)}else r.length>0?r+=`${t}${n.slice(o+1,c)}`:r=n.slice(o+1,c),s=c-o-1;o=c,a=0}else l===ib&&a!==-1?++a:a=-1}return r}function Omt(n){return n?`${n[0]==="."?"":"."}${n}`:""}function T4e(n,e){Pmt(e,"pathObject");const t=e.dir||e.root,i=e.base||`${e.name||""}${Omt(e.ext)}`;return t?t===e.root?`${t}${i}`:`${t}${n}${i}`:i}const bc={resolve(...n){let e="",t="",i=!1;for(let r=n.length-1;r>=-1;r--){let s;if(r>=0){if(s=n[r],No(s,`paths[${r}]`),s.length===0)continue}else e.length===0?s=M6():(s=dZ[`=${e}`]||M6(),(s===void 0||s.slice(0,2).toLowerCase()!==e.toLowerCase()&&s.charCodeAt(2)===Tu)&&(s=`${e}\\`));const o=s.length;let a=0,l="",c=!1;const u=s.charCodeAt(0);if(o===1)zi(u)&&(a=1,c=!0);else if(zi(u))if(c=!0,zi(s.charCodeAt(1))){let d=2,h=d;for(;d2&&zi(s.charCodeAt(2))&&(c=!0,a=3));if(l.length>0)if(e.length>0){if(l.toLowerCase()!==e.toLowerCase())continue}else e=l;if(i){if(e.length>0)break}else if(t=`${s.slice(a)}\\${t}`,i=c,c&&e.length>0)break}return t=F6(t,!i,"\\",zi),i?`${e}\\${t}`:`${e}${t}`||"."},normalize(n){No(n,"path");const e=n.length;if(e===0)return".";let t=0,i,r=!1;const s=n.charCodeAt(0);if(e===1)return hZ(s)?"\\":n;if(zi(s))if(r=!0,zi(n.charCodeAt(1))){let a=2,l=a;for(;a2&&zi(n.charCodeAt(2))&&(r=!0,t=3));let o=t0&&zi(n.charCodeAt(e-1))&&(o+="\\"),i===void 0?r?`\\${o}`:o:r?`${i}\\${o}`:`${i}${o}`},isAbsolute(n){No(n,"path");const e=n.length;if(e===0)return!1;const t=n.charCodeAt(0);return zi(t)||e>2&&V0(t)&&n.charCodeAt(1)===H0&&zi(n.charCodeAt(2))},join(...n){if(n.length===0)return".";let e,t;for(let s=0;s0&&(e===void 0?e=t=o:e+=`\\${o}`)}if(e===void 0)return".";let i=!0,r=0;if(typeof t=="string"&&zi(t.charCodeAt(0))){++r;const s=t.length;s>1&&zi(t.charCodeAt(1))&&(++r,s>2&&(zi(t.charCodeAt(2))?++r:i=!1))}if(i){for(;r=2&&(e=`\\${e.slice(r)}`)}return bc.normalize(e)},relative(n,e){if(No(n,"from"),No(e,"to"),n===e)return"";const t=bc.resolve(n),i=bc.resolve(e);if(t===i||(n=t.toLowerCase(),e=i.toLowerCase(),n===e))return"";let r=0;for(;rr&&n.charCodeAt(s-1)===Tu;)s--;const o=s-r;let a=0;for(;aa&&e.charCodeAt(l-1)===Tu;)l--;const c=l-a,u=ou){if(e.charCodeAt(a+h)===Tu)return i.slice(a+h+1);if(h===2)return i.slice(a+h)}o>u&&(n.charCodeAt(r+h)===Tu?d=h:h===2&&(d=3)),d===-1&&(d=0)}let f="";for(h=r+d+1;h<=s;++h)(h===s||n.charCodeAt(h)===Tu)&&(f+=f.length===0?"..":"\\..");return a+=d,f.length>0?`${f}${i.slice(a,l)}`:(i.charCodeAt(a)===Tu&&++a,i.slice(a,l))},toNamespacedPath(n){if(typeof n!="string"||n.length===0)return n;const e=bc.resolve(n);if(e.length<=2)return n;if(e.charCodeAt(0)===Tu){if(e.charCodeAt(1)===Tu){const t=e.charCodeAt(2);if(t!==Rmt&&t!==ib)return`\\\\?\\UNC\\${e.slice(2)}`}}else if(V0(e.charCodeAt(0))&&e.charCodeAt(1)===H0&&e.charCodeAt(2)===Tu)return`\\\\?\\${e}`;return n},dirname(n){No(n,"path");const e=n.length;if(e===0)return".";let t=-1,i=0;const r=n.charCodeAt(0);if(e===1)return zi(r)?n:".";if(zi(r)){if(t=i=1,zi(n.charCodeAt(1))){let a=2,l=a;for(;a2&&zi(n.charCodeAt(2))?3:2,i=t);let s=-1,o=!0;for(let a=e-1;a>=i;--a)if(zi(n.charCodeAt(a))){if(!o){s=a;break}}else o=!1;if(s===-1){if(t===-1)return".";s=t}return n.slice(0,s)},basename(n,e){e!==void 0&&No(e,"suffix"),No(n,"path");let t=0,i=-1,r=!0,s;if(n.length>=2&&V0(n.charCodeAt(0))&&n.charCodeAt(1)===H0&&(t=2),e!==void 0&&e.length>0&&e.length<=n.length){if(e===n)return"";let o=e.length-1,a=-1;for(s=n.length-1;s>=t;--s){const l=n.charCodeAt(s);if(zi(l)){if(!r){t=s+1;break}}else a===-1&&(r=!1,a=s+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(i=s):(o=-1,i=a))}return t===i?i=a:i===-1&&(i=n.length),n.slice(t,i)}for(s=n.length-1;s>=t;--s)if(zi(n.charCodeAt(s))){if(!r){t=s+1;break}}else i===-1&&(r=!1,i=s+1);return i===-1?"":n.slice(t,i)},extname(n){No(n,"path");let e=0,t=-1,i=0,r=-1,s=!0,o=0;n.length>=2&&n.charCodeAt(1)===H0&&V0(n.charCodeAt(0))&&(e=i=2);for(let a=n.length-1;a>=e;--a){const l=n.charCodeAt(a);if(zi(l)){if(!s){i=a+1;break}continue}r===-1&&(s=!1,r=a+1),l===ib?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===i+1?"":n.slice(t,r)},format:T4e.bind(null,"\\"),parse(n){No(n,"path");const e={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return e;const t=n.length;let i=0,r=n.charCodeAt(0);if(t===1)return zi(r)?(e.root=e.dir=n,e):(e.base=e.name=n,e);if(zi(r)){if(i=1,zi(n.charCodeAt(1))){let d=2,h=d;for(;d0&&(e.root=n.slice(0,i));let s=-1,o=i,a=-1,l=!0,c=n.length-1,u=0;for(;c>=i;--c){if(r=n.charCodeAt(c),zi(r)){if(!l){o=c+1;break}continue}a===-1&&(l=!1,a=c+1),r===ib?s===-1?s=c:u!==1&&(u=1):s!==-1&&(u=-1)}return a!==-1&&(s===-1||u===0||u===1&&s===a-1&&s===o+1?e.base=e.name=n.slice(o,a):(e.name=n.slice(o,s),e.base=n.slice(o,a),e.ext=n.slice(s,a))),o>0&&o!==i?e.dir=n.slice(0,o-1):e.dir=e.root,e},sep:"\\",delimiter:";",win32:null,posix:null},Mmt=(()=>{if(g0){const n=/\\/g;return()=>{const e=M6().replace(n,"/");return e.slice(e.indexOf("/"))}}return()=>M6()})(),Ms={resolve(...n){let e="",t=!1;for(let i=n.length-1;i>=-1&&!t;i--){const r=i>=0?n[i]:Mmt();No(r,`paths[${i}]`),r.length!==0&&(e=`${r}/${e}`,t=r.charCodeAt(0)===al)}return e=F6(e,!t,"/",hZ),t?`/${e}`:e.length>0?e:"."},normalize(n){if(No(n,"path"),n.length===0)return".";const e=n.charCodeAt(0)===al,t=n.charCodeAt(n.length-1)===al;return n=F6(n,!e,"/",hZ),n.length===0?e?"/":t?"./":".":(t&&(n+="/"),e?`/${n}`:n)},isAbsolute(n){return No(n,"path"),n.length>0&&n.charCodeAt(0)===al},join(...n){if(n.length===0)return".";let e;for(let t=0;t0&&(e===void 0?e=i:e+=`/${i}`)}return e===void 0?".":Ms.normalize(e)},relative(n,e){if(No(n,"from"),No(e,"to"),n===e||(n=Ms.resolve(n),e=Ms.resolve(e),n===e))return"";const t=1,i=n.length,r=i-t,s=1,o=e.length-s,a=ra){if(e.charCodeAt(s+c)===al)return e.slice(s+c+1);if(c===0)return e.slice(s+c)}else r>a&&(n.charCodeAt(t+c)===al?l=c:c===0&&(l=0));let u="";for(c=t+l+1;c<=i;++c)(c===i||n.charCodeAt(c)===al)&&(u+=u.length===0?"..":"/..");return`${u}${e.slice(s+l)}`},toNamespacedPath(n){return n},dirname(n){if(No(n,"path"),n.length===0)return".";const e=n.charCodeAt(0)===al;let t=-1,i=!0;for(let r=n.length-1;r>=1;--r)if(n.charCodeAt(r)===al){if(!i){t=r;break}}else i=!1;return t===-1?e?"/":".":e&&t===1?"//":n.slice(0,t)},basename(n,e){e!==void 0&&No(e,"ext"),No(n,"path");let t=0,i=-1,r=!0,s;if(e!==void 0&&e.length>0&&e.length<=n.length){if(e===n)return"";let o=e.length-1,a=-1;for(s=n.length-1;s>=0;--s){const l=n.charCodeAt(s);if(l===al){if(!r){t=s+1;break}}else a===-1&&(r=!1,a=s+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(i=s):(o=-1,i=a))}return t===i?i=a:i===-1&&(i=n.length),n.slice(t,i)}for(s=n.length-1;s>=0;--s)if(n.charCodeAt(s)===al){if(!r){t=s+1;break}}else i===-1&&(r=!1,i=s+1);return i===-1?"":n.slice(t,i)},extname(n){No(n,"path");let e=-1,t=0,i=-1,r=!0,s=0;for(let o=n.length-1;o>=0;--o){const a=n.charCodeAt(o);if(a===al){if(!r){t=o+1;break}continue}i===-1&&(r=!1,i=o+1),a===ib?e===-1?e=o:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||i===-1||s===0||s===1&&e===i-1&&e===t+1?"":n.slice(e,i)},format:T4e.bind(null,"/"),parse(n){No(n,"path");const e={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return e;const t=n.charCodeAt(0)===al;let i;t?(e.root="/",i=1):i=0;let r=-1,s=0,o=-1,a=!0,l=n.length-1,c=0;for(;l>=i;--l){const u=n.charCodeAt(l);if(u===al){if(!a){s=l+1;break}continue}o===-1&&(a=!1,o=l+1),u===ib?r===-1?r=l:c!==1&&(c=1):r!==-1&&(c=-1)}if(o!==-1){const u=s===0&&t?1:s;r===-1||c===0||c===1&&r===o-1&&r===s+1?e.base=e.name=n.slice(u,o):(e.name=n.slice(u,r),e.base=n.slice(u,o),e.ext=n.slice(r,o))}return s>0?e.dir=n.slice(0,s-1):t&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};Ms.win32=bc.win32=bc;Ms.posix=bc.posix=Ms;const D4e=g0?bc.normalize:Ms.normalize,Fmt=g0?bc.join:Ms.join,Bmt=g0?bc.resolve:Ms.resolve,$mt=g0?bc.relative:Ms.relative,I4e=g0?bc.dirname:Ms.dirname,rb=g0?bc.basename:Ms.basename,Wmt=g0?bc.extname:Ms.extname,fg=g0?bc.sep:Ms.sep,Hmt=/^\w[\w\d+.-]*$/,Vmt=/^\//,zmt=/^\/\//;function Umt(n,e){if(!n.scheme&&e)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${n.authority}", path: "${n.path}", query: "${n.query}", fragment: "${n.fragment}"}`);if(n.scheme&&!Hmt.test(n.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(n.path){if(n.authority){if(!Vmt.test(n.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(zmt.test(n.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function jmt(n,e){return!n&&!e?"file":n}function qmt(n,e){switch(n){case"https":case"http":case"file":e?e[0]!==Zf&&(e=Zf+e):e=Zf;break}return e}const Rs="",Zf="/",Kmt=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;let Pt=class $5{static isUri(e){return e instanceof $5?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="string"&&typeof e.with=="function"&&typeof e.toString=="function":!1}constructor(e,t,i,r,s,o=!1){typeof e=="object"?(this.scheme=e.scheme||Rs,this.authority=e.authority||Rs,this.path=e.path||Rs,this.query=e.query||Rs,this.fragment=e.fragment||Rs):(this.scheme=jmt(e,o),this.authority=t||Rs,this.path=qmt(this.scheme,i||Rs),this.query=r||Rs,this.fragment=s||Rs,Umt(this,o))}get fsPath(){return B6(this,!1)}with(e){if(!e)return this;let{scheme:t,authority:i,path:r,query:s,fragment:o}=e;return t===void 0?t=this.scheme:t===null&&(t=Rs),i===void 0?i=this.authority:i===null&&(i=Rs),r===void 0?r=this.path:r===null&&(r=Rs),s===void 0?s=this.query:s===null&&(s=Rs),o===void 0?o=this.fragment:o===null&&(o=Rs),t===this.scheme&&i===this.authority&&r===this.path&&s===this.query&&o===this.fragment?this:new lx(t,i,r,s,o)}static parse(e,t=!1){const i=Kmt.exec(e);return i?new lx(i[2]||Rs,y4(i[4]||Rs),y4(i[5]||Rs),y4(i[7]||Rs),y4(i[9]||Rs),t):new lx(Rs,Rs,Rs,Rs,Rs)}static file(e){let t=Rs;if(Ta&&(e=e.replace(/\\/g,Zf)),e[0]===Zf&&e[1]===Zf){const i=e.indexOf(Zf,2);i===-1?(t=e.substring(2),e=Zf):(t=e.substring(2,i),e=e.substring(i)||Zf)}return new lx("file",t,e,Rs,Rs)}static from(e,t){return new lx(e.scheme,e.authority,e.path,e.query,e.fragment,t)}static joinPath(e,...t){if(!e.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let i;return Ta&&e.scheme==="file"?i=$5.file(bc.join(B6(e,!0),...t)).path:i=Ms.join(e.path,...t),e.with({path:i})}toString(e=!1){return fZ(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof $5)return e;{const t=new lx(e);return t._formatted=e.external??null,t._fsPath=e._sep===A4e?e.fsPath??null:null,t}}else return e}};const A4e=Ta?1:void 0;let lx=class extends Pt{constructor(){super(...arguments),this._formatted=null,this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=B6(this,!1)),this._fsPath}toString(e=!1){return e?fZ(this,!0):(this._formatted||(this._formatted=fZ(this,!1)),this._formatted)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=A4e),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}};const N4e={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function Fve(n,e,t){let i,r=-1;for(let s=0;s=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||o===45||o===46||o===95||o===126||e&&o===47||t&&o===91||t&&o===93||t&&o===58)r!==-1&&(i+=encodeURIComponent(n.substring(r,s)),r=-1),i!==void 0&&(i+=n.charAt(s));else{i===void 0&&(i=n.substr(0,s));const a=N4e[o];a!==void 0?(r!==-1&&(i+=encodeURIComponent(n.substring(r,s)),r=-1),i+=a):r===-1&&(r=s)}}return r!==-1&&(i+=encodeURIComponent(n.substring(r))),i!==void 0?i:n}function Gmt(n){let e;for(let t=0;t1&&n.scheme==="file"?t=`//${n.authority}${n.path}`:n.path.charCodeAt(0)===47&&(n.path.charCodeAt(1)>=65&&n.path.charCodeAt(1)<=90||n.path.charCodeAt(1)>=97&&n.path.charCodeAt(1)<=122)&&n.path.charCodeAt(2)===58?e?t=n.path.substr(1):t=n.path[1].toLowerCase()+n.path.substr(2):t=n.path,Ta&&(t=t.replace(/\//g,"\\")),t}function fZ(n,e){const t=e?Gmt:Fve;let i="",{scheme:r,authority:s,path:o,query:a,fragment:l}=n;if(r&&(i+=r,i+=":"),(s||r==="file")&&(i+=Zf,i+=Zf),s){let c=s.indexOf("@");if(c!==-1){const u=s.substr(0,c);s=s.substr(c+1),c=u.lastIndexOf(":"),c===-1?i+=t(u,!1,!1):(i+=t(u.substr(0,c),!1,!1),i+=":",i+=t(u.substr(c+1),!1,!0)),i+="@"}s=s.toLowerCase(),c=s.lastIndexOf(":"),c===-1?i+=t(s,!1,!0):(i+=t(s.substr(0,c),!1,!0),i+=s.substr(c))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){const c=o.charCodeAt(1);c>=65&&c<=90&&(o=`/${String.fromCharCode(c+32)}:${o.substr(3)}`)}else if(o.length>=2&&o.charCodeAt(1)===58){const c=o.charCodeAt(0);c>=65&&c<=90&&(o=`${String.fromCharCode(c+32)}:${o.substr(2)}`)}i+=t(o,!0,!1)}return a&&(i+="?",i+=t(a,!1,!1)),l&&(i+="#",i+=e?l:Fve(l,!1,!1)),i}function R4e(n){try{return decodeURIComponent(n)}catch{return n.length>3?n.substr(0,3)+R4e(n.substr(3)):n}}const Bve=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function y4(n){return n.match(Bve)?n.replace(Bve,e=>R4e(e)):n}let he=class z1{constructor(e,t){this.lineNumber=e,this.column=t}with(e=this.lineNumber,t=this.column){return e===this.lineNumber&&t===this.column?this:new z1(e,t)}delta(e=0,t=0){return this.with(this.lineNumber+e,this.column+t)}equals(e){return z1.equals(this,e)}static equals(e,t){return!e&&!t?!0:!!e&&!!t&&e.lineNumber===t.lineNumber&&e.column===t.column}isBefore(e){return z1.isBefore(this,e)}static isBefore(e,t){return e.lineNumberi||e===i&&t>r?(this.startLineNumber=i,this.startColumn=r,this.endLineNumber=e,this.endColumn=t):(this.startLineNumber=e,this.startColumn=t,this.endLineNumber=i,this.endColumn=r)}isEmpty(){return Uo.isEmpty(this)}static isEmpty(e){return e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn}containsPosition(e){return Uo.containsPosition(this,e)}static containsPosition(e,t){return!(t.lineNumbere.endLineNumber||t.lineNumber===e.startLineNumber&&t.columne.endColumn)}static strictContainsPosition(e,t){return!(t.lineNumbere.endLineNumber||t.lineNumber===e.startLineNumber&&t.column<=e.startColumn||t.lineNumber===e.endLineNumber&&t.column>=e.endColumn)}containsRange(e){return Uo.containsRange(this,e)}static containsRange(e,t){return!(t.startLineNumbere.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumne.endColumn)}strictContainsRange(e){return Uo.strictContainsRange(this,e)}static strictContainsRange(e,t){return!(t.startLineNumbere.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumn<=e.startColumn||t.endLineNumber===e.endLineNumber&&t.endColumn>=e.endColumn)}plusRange(e){return Uo.plusRange(this,e)}static plusRange(e,t){let i,r,s,o;return t.startLineNumbere.endLineNumber?(s=t.endLineNumber,o=t.endColumn):t.endLineNumber===e.endLineNumber?(s=t.endLineNumber,o=Math.max(t.endColumn,e.endColumn)):(s=e.endLineNumber,o=e.endColumn),new Uo(i,r,s,o)}intersectRanges(e){return Uo.intersectRanges(this,e)}static intersectRanges(e,t){let i=e.startLineNumber,r=e.startColumn,s=e.endLineNumber,o=e.endColumn;const a=t.startLineNumber,l=t.startColumn,c=t.endLineNumber,u=t.endColumn;return ic?(s=c,o=u):s===c&&(o=Math.min(o,u)),i>s||i===s&&r>o?null:new Uo(i,r,s,o)}equalsRange(e){return Uo.equalsRange(this,e)}static equalsRange(e,t){return!e&&!t?!0:!!e&&!!t&&e.startLineNumber===t.startLineNumber&&e.startColumn===t.startColumn&&e.endLineNumber===t.endLineNumber&&e.endColumn===t.endColumn}getEndPosition(){return Uo.getEndPosition(this)}static getEndPosition(e){return new he(e.endLineNumber,e.endColumn)}getStartPosition(){return Uo.getStartPosition(this)}static getStartPosition(e){return new he(e.startLineNumber,e.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(e,t){return new Uo(this.startLineNumber,this.startColumn,e,t)}setStartPosition(e,t){return new Uo(e,t,this.endLineNumber,this.endColumn)}collapseToStart(){return Uo.collapseToStart(this)}static collapseToStart(e){return new Uo(e.startLineNumber,e.startColumn,e.startLineNumber,e.startColumn)}collapseToEnd(){return Uo.collapseToEnd(this)}static collapseToEnd(e){return new Uo(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn)}delta(e){return new Uo(this.startLineNumber+e,this.startColumn,this.endLineNumber+e,this.endColumn)}static fromPositions(e,t=e){return new Uo(e.lineNumber,e.column,t.lineNumber,t.column)}static lift(e){return e?new Uo(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn):null}static isIRange(e){return e&&typeof e.startLineNumber=="number"&&typeof e.startColumn=="number"&&typeof e.endLineNumber=="number"&&typeof e.endColumn=="number"}static areIntersectingOrTouching(e,t){return!(e.endLineNumbere.startLineNumber}toJSON(){return this}},yt=class Eh extends ${constructor(e,t,i,r){super(e,t,i,r),this.selectionStartLineNumber=e,this.selectionStartColumn=t,this.positionLineNumber=i,this.positionColumn=r}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(e){return Eh.selectionsEqual(this,e)}static selectionsEqual(e,t){return e.selectionStartLineNumber===t.selectionStartLineNumber&&e.selectionStartColumn===t.selectionStartColumn&&e.positionLineNumber===t.positionLineNumber&&e.positionColumn===t.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(e,t){return this.getDirection()===0?new Eh(this.startLineNumber,this.startColumn,e,t):new Eh(e,t,this.startLineNumber,this.startColumn)}getPosition(){return new he(this.positionLineNumber,this.positionColumn)}getSelectionStart(){return new he(this.selectionStartLineNumber,this.selectionStartColumn)}setStartPosition(e,t){return this.getDirection()===0?new Eh(e,t,this.endLineNumber,this.endColumn):new Eh(this.endLineNumber,this.endColumn,e,t)}static fromPositions(e,t=e){return new Eh(e.lineNumber,e.column,t.lineNumber,t.column)}static fromRange(e,t){return t===0?new Eh(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn):new Eh(e.endLineNumber,e.endColumn,e.startLineNumber,e.startColumn)}static liftSelection(e){return new Eh(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn)}static selectionsArrEqual(e,t){if(e&&!t||!e&&t)return!1;if(!e&&!t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i{this._tokenizationSupports.get(e)===t&&(this._tokenizationSupports.delete(e),this.handleChange([e]))})}get(e){return this._tokenizationSupports.get(e)||null}registerFactory(e,t){this._factories.get(e)?.dispose();const i=new Xmt(this,e,t);return this._factories.set(e,i),Lt(()=>{const r=this._factories.get(e);!r||r!==i||(this._factories.delete(e),r.dispose())})}async getOrCreate(e){const t=this.get(e);if(t)return t;const i=this._factories.get(e);return!i||i.isResolved?null:(await i.resolve(),this.get(e))}isResolved(e){if(this.get(e))return!0;const i=this._factories.get(e);return!!(!i||i.isResolved)}setColorMap(e){this._colorMap=e,this._onDidChange.fire({changedLanguages:Array.from(this._tokenizationSupports.keys()),changedColorMap:!0})}getColorMap(){return this._colorMap}getDefaultBackground(){return this._colorMap&&this._colorMap.length>2?this._colorMap[2]:null}};class Xmt extends me{get isResolved(){return this._isResolved}constructor(e,t,i){super(),this._registry=e,this._languageId=t,this._factory=i,this._isDisposed=!1,this._resolvePromise=null,this._isResolved=!1}dispose(){this._isDisposed=!0,super.dispose()}async resolve(){return this._resolvePromise||(this._resolvePromise=this._create()),this._resolvePromise}async _create(){const e=await this._factory.tokenizationSupport;this._isResolved=!0,e&&!this._isDisposed&&this._register(this._registry.register(this._languageId,e))}}let iN=class{constructor(e,t,i){this.offset=e,this.type=t,this.language=i,this._tokenBrand=void 0}toString(){return"("+this.offset+", "+this.type+")"}};class kae{constructor(e,t){this.tokens=e,this.endState=t,this._tokenizationResultBrand=void 0}}class P${constructor(e,t){this.tokens=e,this.endState=t,this._encodedTokenizationResultBrand=void 0}}var Zc;(function(n){n[n.Increase=0]="Increase",n[n.Decrease=1]="Decrease"})(Zc||(Zc={}));var rN;(function(n){const e=new Map;e.set(0,ze.symbolMethod),e.set(1,ze.symbolFunction),e.set(2,ze.symbolConstructor),e.set(3,ze.symbolField),e.set(4,ze.symbolVariable),e.set(5,ze.symbolClass),e.set(6,ze.symbolStruct),e.set(7,ze.symbolInterface),e.set(8,ze.symbolModule),e.set(9,ze.symbolProperty),e.set(10,ze.symbolEvent),e.set(11,ze.symbolOperator),e.set(12,ze.symbolUnit),e.set(13,ze.symbolValue),e.set(15,ze.symbolEnum),e.set(14,ze.symbolConstant),e.set(15,ze.symbolEnum),e.set(16,ze.symbolEnumMember),e.set(17,ze.symbolKeyword),e.set(27,ze.symbolSnippet),e.set(18,ze.symbolText),e.set(19,ze.symbolColor),e.set(20,ze.symbolFile),e.set(21,ze.symbolReference),e.set(22,ze.symbolCustomColor),e.set(23,ze.symbolFolder),e.set(24,ze.symbolTypeParameter),e.set(25,ze.account),e.set(26,ze.issues);function t(s){let o=e.get(s);return o||(console.info("No codicon found for CompletionItemKind "+s),o=ze.symbolProperty),o}n.toIcon=t;const i=new Map;i.set("method",0),i.set("function",1),i.set("constructor",2),i.set("field",3),i.set("variable",4),i.set("class",5),i.set("struct",6),i.set("interface",7),i.set("module",8),i.set("property",9),i.set("event",10),i.set("operator",11),i.set("unit",12),i.set("value",13),i.set("constant",14),i.set("enum",15),i.set("enum-member",16),i.set("enumMember",16),i.set("keyword",17),i.set("snippet",27),i.set("text",18),i.set("color",19),i.set("file",20),i.set("reference",21),i.set("customcolor",22),i.set("folder",23),i.set("type-parameter",24),i.set("typeParameter",24),i.set("account",25),i.set("issue",26);function r(s,o){let a=i.get(s);return typeof a>"u"&&!o&&(a=9),a}n.fromString=r})(rN||(rN={}));var gg;(function(n){n[n.Automatic=0]="Automatic",n[n.Explicit=1]="Explicit"})(gg||(gg={}));class M4e{constructor(e,t,i,r){this.range=e,this.text=t,this.completionKind=i,this.isSnippetText=r}equals(e){return $.lift(this.range).equalsRange(e.range)&&this.text===e.text&&this.completionKind===e.completionKind&&this.isSnippetText===e.isSnippetText}}var sN;(function(n){n[n.Automatic=0]="Automatic",n[n.PasteAs=1]="PasteAs"})(sN||(sN={}));var $p;(function(n){n[n.Invoke=1]="Invoke",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.ContentChange=3]="ContentChange"})($p||($p={}));var nE;(function(n){n[n.Text=0]="Text",n[n.Read=1]="Read",n[n.Write=2]="Write"})(nE||(nE={}));function Qmt(n){return n&&Pt.isUri(n.uri)&&$.isIRange(n.range)&&($.isIRange(n.originSelectionRange)||$.isIRange(n.targetSelectionRange))}const Jmt={17:w("Array","array"),16:w("Boolean","boolean"),4:w("Class","class"),13:w("Constant","constant"),8:w("Constructor","constructor"),9:w("Enum","enumeration"),21:w("EnumMember","enumeration member"),23:w("Event","event"),7:w("Field","field"),0:w("File","file"),11:w("Function","function"),10:w("Interface","interface"),19:w("Key","key"),5:w("Method","method"),1:w("Module","module"),2:w("Namespace","namespace"),20:w("Null","null"),15:w("Number","number"),18:w("Object","object"),24:w("Operator","operator"),3:w("Package","package"),6:w("Property","property"),14:w("String","string"),22:w("Struct","struct"),25:w("TypeParameter","type parameter"),12:w("Variable","variable")};function e_t(n,e){return w("symbolAriaLabel","{0} ({1})",n,Jmt[e])}var $6;(function(n){const e=new Map;e.set(0,ze.symbolFile),e.set(1,ze.symbolModule),e.set(2,ze.symbolNamespace),e.set(3,ze.symbolPackage),e.set(4,ze.symbolClass),e.set(5,ze.symbolMethod),e.set(6,ze.symbolProperty),e.set(7,ze.symbolField),e.set(8,ze.symbolConstructor),e.set(9,ze.symbolEnum),e.set(10,ze.symbolInterface),e.set(11,ze.symbolFunction),e.set(12,ze.symbolVariable),e.set(13,ze.symbolConstant),e.set(14,ze.symbolString),e.set(15,ze.symbolNumber),e.set(16,ze.symbolBoolean),e.set(17,ze.symbolArray),e.set(18,ze.symbolObject),e.set(19,ze.symbolKey),e.set(20,ze.symbolNull),e.set(21,ze.symbolEnumMember),e.set(22,ze.symbolStruct),e.set(23,ze.symbolEvent),e.set(24,ze.symbolOperator),e.set(25,ze.symbolTypeParameter);function t(i){let r=e.get(i);return r||(console.info("No codicon found for SymbolKind "+i),r=ze.symbolProperty),r}n.toIcon=t})($6||($6={}));let jL=class Y0{static{this.Comment=new Y0("comment")}static{this.Imports=new Y0("imports")}static{this.Region=new Y0("region")}static fromValue(e){switch(e){case"comment":return Y0.Comment;case"imports":return Y0.Imports;case"region":return Y0.Region}return new Y0(e)}constructor(e){this.value=e}};var pZ;(function(n){n[n.AIGenerated=1]="AIGenerated"})(pZ||(pZ={}));var oN;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(oN||(oN={}));var mZ;(function(n){function e(t){return!t||typeof t!="object"?!1:typeof t.id=="string"&&typeof t.title=="string"}n.is=e})(mZ||(mZ={}));var W6;(function(n){n[n.Type=1]="Type",n[n.Parameter=2]="Parameter"})(W6||(W6={}));class t_t{constructor(e){this.createSupport=e,this._tokenizationSupport=null}dispose(){this._tokenizationSupport&&this._tokenizationSupport.then(e=>{e&&e.dispose()})}get tokenizationSupport(){return this._tokenizationSupport||(this._tokenizationSupport=this.createSupport()),this._tokenizationSupport}}const rs=new O4e,_Z=new O4e;var H6;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(H6||(H6={}));var vZ;(function(n){n[n.Unknown=0]="Unknown",n[n.Disabled=1]="Disabled",n[n.Enabled=2]="Enabled"})(vZ||(vZ={}));var bZ;(function(n){n[n.Invoke=1]="Invoke",n[n.Auto=2]="Auto"})(bZ||(bZ={}));var yZ;(function(n){n[n.None=0]="None",n[n.KeepWhitespace=1]="KeepWhitespace",n[n.InsertAsSnippet=4]="InsertAsSnippet"})(yZ||(yZ={}));var wZ;(function(n){n[n.Method=0]="Method",n[n.Function=1]="Function",n[n.Constructor=2]="Constructor",n[n.Field=3]="Field",n[n.Variable=4]="Variable",n[n.Class=5]="Class",n[n.Struct=6]="Struct",n[n.Interface=7]="Interface",n[n.Module=8]="Module",n[n.Property=9]="Property",n[n.Event=10]="Event",n[n.Operator=11]="Operator",n[n.Unit=12]="Unit",n[n.Value=13]="Value",n[n.Constant=14]="Constant",n[n.Enum=15]="Enum",n[n.EnumMember=16]="EnumMember",n[n.Keyword=17]="Keyword",n[n.Text=18]="Text",n[n.Color=19]="Color",n[n.File=20]="File",n[n.Reference=21]="Reference",n[n.Customcolor=22]="Customcolor",n[n.Folder=23]="Folder",n[n.TypeParameter=24]="TypeParameter",n[n.User=25]="User",n[n.Issue=26]="Issue",n[n.Snippet=27]="Snippet"})(wZ||(wZ={}));var CZ;(function(n){n[n.Deprecated=1]="Deprecated"})(CZ||(CZ={}));var xZ;(function(n){n[n.Invoke=0]="Invoke",n[n.TriggerCharacter=1]="TriggerCharacter",n[n.TriggerForIncompleteCompletions=2]="TriggerForIncompleteCompletions"})(xZ||(xZ={}));var SZ;(function(n){n[n.EXACT=0]="EXACT",n[n.ABOVE=1]="ABOVE",n[n.BELOW=2]="BELOW"})(SZ||(SZ={}));var kZ;(function(n){n[n.NotSet=0]="NotSet",n[n.ContentFlush=1]="ContentFlush",n[n.RecoverFromMarkers=2]="RecoverFromMarkers",n[n.Explicit=3]="Explicit",n[n.Paste=4]="Paste",n[n.Undo=5]="Undo",n[n.Redo=6]="Redo"})(kZ||(kZ={}));var EZ;(function(n){n[n.LF=1]="LF",n[n.CRLF=2]="CRLF"})(EZ||(EZ={}));var LZ;(function(n){n[n.Text=0]="Text",n[n.Read=1]="Read",n[n.Write=2]="Write"})(LZ||(LZ={}));var TZ;(function(n){n[n.None=0]="None",n[n.Keep=1]="Keep",n[n.Brackets=2]="Brackets",n[n.Advanced=3]="Advanced",n[n.Full=4]="Full"})(TZ||(TZ={}));var DZ;(function(n){n[n.acceptSuggestionOnCommitCharacter=0]="acceptSuggestionOnCommitCharacter",n[n.acceptSuggestionOnEnter=1]="acceptSuggestionOnEnter",n[n.accessibilitySupport=2]="accessibilitySupport",n[n.accessibilityPageSize=3]="accessibilityPageSize",n[n.ariaLabel=4]="ariaLabel",n[n.ariaRequired=5]="ariaRequired",n[n.autoClosingBrackets=6]="autoClosingBrackets",n[n.autoClosingComments=7]="autoClosingComments",n[n.screenReaderAnnounceInlineSuggestion=8]="screenReaderAnnounceInlineSuggestion",n[n.autoClosingDelete=9]="autoClosingDelete",n[n.autoClosingOvertype=10]="autoClosingOvertype",n[n.autoClosingQuotes=11]="autoClosingQuotes",n[n.autoIndent=12]="autoIndent",n[n.automaticLayout=13]="automaticLayout",n[n.autoSurround=14]="autoSurround",n[n.bracketPairColorization=15]="bracketPairColorization",n[n.guides=16]="guides",n[n.codeLens=17]="codeLens",n[n.codeLensFontFamily=18]="codeLensFontFamily",n[n.codeLensFontSize=19]="codeLensFontSize",n[n.colorDecorators=20]="colorDecorators",n[n.colorDecoratorsLimit=21]="colorDecoratorsLimit",n[n.columnSelection=22]="columnSelection",n[n.comments=23]="comments",n[n.contextmenu=24]="contextmenu",n[n.copyWithSyntaxHighlighting=25]="copyWithSyntaxHighlighting",n[n.cursorBlinking=26]="cursorBlinking",n[n.cursorSmoothCaretAnimation=27]="cursorSmoothCaretAnimation",n[n.cursorStyle=28]="cursorStyle",n[n.cursorSurroundingLines=29]="cursorSurroundingLines",n[n.cursorSurroundingLinesStyle=30]="cursorSurroundingLinesStyle",n[n.cursorWidth=31]="cursorWidth",n[n.disableLayerHinting=32]="disableLayerHinting",n[n.disableMonospaceOptimizations=33]="disableMonospaceOptimizations",n[n.domReadOnly=34]="domReadOnly",n[n.dragAndDrop=35]="dragAndDrop",n[n.dropIntoEditor=36]="dropIntoEditor",n[n.emptySelectionClipboard=37]="emptySelectionClipboard",n[n.experimentalWhitespaceRendering=38]="experimentalWhitespaceRendering",n[n.extraEditorClassName=39]="extraEditorClassName",n[n.fastScrollSensitivity=40]="fastScrollSensitivity",n[n.find=41]="find",n[n.fixedOverflowWidgets=42]="fixedOverflowWidgets",n[n.folding=43]="folding",n[n.foldingStrategy=44]="foldingStrategy",n[n.foldingHighlight=45]="foldingHighlight",n[n.foldingImportsByDefault=46]="foldingImportsByDefault",n[n.foldingMaximumRegions=47]="foldingMaximumRegions",n[n.unfoldOnClickAfterEndOfLine=48]="unfoldOnClickAfterEndOfLine",n[n.fontFamily=49]="fontFamily",n[n.fontInfo=50]="fontInfo",n[n.fontLigatures=51]="fontLigatures",n[n.fontSize=52]="fontSize",n[n.fontWeight=53]="fontWeight",n[n.fontVariations=54]="fontVariations",n[n.formatOnPaste=55]="formatOnPaste",n[n.formatOnType=56]="formatOnType",n[n.glyphMargin=57]="glyphMargin",n[n.gotoLocation=58]="gotoLocation",n[n.hideCursorInOverviewRuler=59]="hideCursorInOverviewRuler",n[n.hover=60]="hover",n[n.inDiffEditor=61]="inDiffEditor",n[n.inlineSuggest=62]="inlineSuggest",n[n.inlineEdit=63]="inlineEdit",n[n.letterSpacing=64]="letterSpacing",n[n.lightbulb=65]="lightbulb",n[n.lineDecorationsWidth=66]="lineDecorationsWidth",n[n.lineHeight=67]="lineHeight",n[n.lineNumbers=68]="lineNumbers",n[n.lineNumbersMinChars=69]="lineNumbersMinChars",n[n.linkedEditing=70]="linkedEditing",n[n.links=71]="links",n[n.matchBrackets=72]="matchBrackets",n[n.minimap=73]="minimap",n[n.mouseStyle=74]="mouseStyle",n[n.mouseWheelScrollSensitivity=75]="mouseWheelScrollSensitivity",n[n.mouseWheelZoom=76]="mouseWheelZoom",n[n.multiCursorMergeOverlapping=77]="multiCursorMergeOverlapping",n[n.multiCursorModifier=78]="multiCursorModifier",n[n.multiCursorPaste=79]="multiCursorPaste",n[n.multiCursorLimit=80]="multiCursorLimit",n[n.occurrencesHighlight=81]="occurrencesHighlight",n[n.overviewRulerBorder=82]="overviewRulerBorder",n[n.overviewRulerLanes=83]="overviewRulerLanes",n[n.padding=84]="padding",n[n.pasteAs=85]="pasteAs",n[n.parameterHints=86]="parameterHints",n[n.peekWidgetDefaultFocus=87]="peekWidgetDefaultFocus",n[n.placeholder=88]="placeholder",n[n.definitionLinkOpensInPeek=89]="definitionLinkOpensInPeek",n[n.quickSuggestions=90]="quickSuggestions",n[n.quickSuggestionsDelay=91]="quickSuggestionsDelay",n[n.readOnly=92]="readOnly",n[n.readOnlyMessage=93]="readOnlyMessage",n[n.renameOnType=94]="renameOnType",n[n.renderControlCharacters=95]="renderControlCharacters",n[n.renderFinalNewline=96]="renderFinalNewline",n[n.renderLineHighlight=97]="renderLineHighlight",n[n.renderLineHighlightOnlyWhenFocus=98]="renderLineHighlightOnlyWhenFocus",n[n.renderValidationDecorations=99]="renderValidationDecorations",n[n.renderWhitespace=100]="renderWhitespace",n[n.revealHorizontalRightPadding=101]="revealHorizontalRightPadding",n[n.roundedSelection=102]="roundedSelection",n[n.rulers=103]="rulers",n[n.scrollbar=104]="scrollbar",n[n.scrollBeyondLastColumn=105]="scrollBeyondLastColumn",n[n.scrollBeyondLastLine=106]="scrollBeyondLastLine",n[n.scrollPredominantAxis=107]="scrollPredominantAxis",n[n.selectionClipboard=108]="selectionClipboard",n[n.selectionHighlight=109]="selectionHighlight",n[n.selectOnLineNumbers=110]="selectOnLineNumbers",n[n.showFoldingControls=111]="showFoldingControls",n[n.showUnused=112]="showUnused",n[n.snippetSuggestions=113]="snippetSuggestions",n[n.smartSelect=114]="smartSelect",n[n.smoothScrolling=115]="smoothScrolling",n[n.stickyScroll=116]="stickyScroll",n[n.stickyTabStops=117]="stickyTabStops",n[n.stopRenderingLineAfter=118]="stopRenderingLineAfter",n[n.suggest=119]="suggest",n[n.suggestFontSize=120]="suggestFontSize",n[n.suggestLineHeight=121]="suggestLineHeight",n[n.suggestOnTriggerCharacters=122]="suggestOnTriggerCharacters",n[n.suggestSelection=123]="suggestSelection",n[n.tabCompletion=124]="tabCompletion",n[n.tabIndex=125]="tabIndex",n[n.unicodeHighlighting=126]="unicodeHighlighting",n[n.unusualLineTerminators=127]="unusualLineTerminators",n[n.useShadowDOM=128]="useShadowDOM",n[n.useTabStops=129]="useTabStops",n[n.wordBreak=130]="wordBreak",n[n.wordSegmenterLocales=131]="wordSegmenterLocales",n[n.wordSeparators=132]="wordSeparators",n[n.wordWrap=133]="wordWrap",n[n.wordWrapBreakAfterCharacters=134]="wordWrapBreakAfterCharacters",n[n.wordWrapBreakBeforeCharacters=135]="wordWrapBreakBeforeCharacters",n[n.wordWrapColumn=136]="wordWrapColumn",n[n.wordWrapOverride1=137]="wordWrapOverride1",n[n.wordWrapOverride2=138]="wordWrapOverride2",n[n.wrappingIndent=139]="wrappingIndent",n[n.wrappingStrategy=140]="wrappingStrategy",n[n.showDeprecated=141]="showDeprecated",n[n.inlayHints=142]="inlayHints",n[n.editorClassName=143]="editorClassName",n[n.pixelRatio=144]="pixelRatio",n[n.tabFocusMode=145]="tabFocusMode",n[n.layoutInfo=146]="layoutInfo",n[n.wrappingInfo=147]="wrappingInfo",n[n.defaultColorDecorators=148]="defaultColorDecorators",n[n.colorDecoratorsActivatedOn=149]="colorDecoratorsActivatedOn",n[n.inlineCompletionsAccessibilityVerbose=150]="inlineCompletionsAccessibilityVerbose"})(DZ||(DZ={}));var IZ;(function(n){n[n.TextDefined=0]="TextDefined",n[n.LF=1]="LF",n[n.CRLF=2]="CRLF"})(IZ||(IZ={}));var AZ;(function(n){n[n.LF=0]="LF",n[n.CRLF=1]="CRLF"})(AZ||(AZ={}));var NZ;(function(n){n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=3]="Right"})(NZ||(NZ={}));var RZ;(function(n){n[n.Increase=0]="Increase",n[n.Decrease=1]="Decrease"})(RZ||(RZ={}));var PZ;(function(n){n[n.None=0]="None",n[n.Indent=1]="Indent",n[n.IndentOutdent=2]="IndentOutdent",n[n.Outdent=3]="Outdent"})(PZ||(PZ={}));var OZ;(function(n){n[n.Both=0]="Both",n[n.Right=1]="Right",n[n.Left=2]="Left",n[n.None=3]="None"})(OZ||(OZ={}));var MZ;(function(n){n[n.Type=1]="Type",n[n.Parameter=2]="Parameter"})(MZ||(MZ={}));var FZ;(function(n){n[n.Automatic=0]="Automatic",n[n.Explicit=1]="Explicit"})(FZ||(FZ={}));var BZ;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(BZ||(BZ={}));var $Z;(function(n){n[n.DependsOnKbLayout=-1]="DependsOnKbLayout",n[n.Unknown=0]="Unknown",n[n.Backspace=1]="Backspace",n[n.Tab=2]="Tab",n[n.Enter=3]="Enter",n[n.Shift=4]="Shift",n[n.Ctrl=5]="Ctrl",n[n.Alt=6]="Alt",n[n.PauseBreak=7]="PauseBreak",n[n.CapsLock=8]="CapsLock",n[n.Escape=9]="Escape",n[n.Space=10]="Space",n[n.PageUp=11]="PageUp",n[n.PageDown=12]="PageDown",n[n.End=13]="End",n[n.Home=14]="Home",n[n.LeftArrow=15]="LeftArrow",n[n.UpArrow=16]="UpArrow",n[n.RightArrow=17]="RightArrow",n[n.DownArrow=18]="DownArrow",n[n.Insert=19]="Insert",n[n.Delete=20]="Delete",n[n.Digit0=21]="Digit0",n[n.Digit1=22]="Digit1",n[n.Digit2=23]="Digit2",n[n.Digit3=24]="Digit3",n[n.Digit4=25]="Digit4",n[n.Digit5=26]="Digit5",n[n.Digit6=27]="Digit6",n[n.Digit7=28]="Digit7",n[n.Digit8=29]="Digit8",n[n.Digit9=30]="Digit9",n[n.KeyA=31]="KeyA",n[n.KeyB=32]="KeyB",n[n.KeyC=33]="KeyC",n[n.KeyD=34]="KeyD",n[n.KeyE=35]="KeyE",n[n.KeyF=36]="KeyF",n[n.KeyG=37]="KeyG",n[n.KeyH=38]="KeyH",n[n.KeyI=39]="KeyI",n[n.KeyJ=40]="KeyJ",n[n.KeyK=41]="KeyK",n[n.KeyL=42]="KeyL",n[n.KeyM=43]="KeyM",n[n.KeyN=44]="KeyN",n[n.KeyO=45]="KeyO",n[n.KeyP=46]="KeyP",n[n.KeyQ=47]="KeyQ",n[n.KeyR=48]="KeyR",n[n.KeyS=49]="KeyS",n[n.KeyT=50]="KeyT",n[n.KeyU=51]="KeyU",n[n.KeyV=52]="KeyV",n[n.KeyW=53]="KeyW",n[n.KeyX=54]="KeyX",n[n.KeyY=55]="KeyY",n[n.KeyZ=56]="KeyZ",n[n.Meta=57]="Meta",n[n.ContextMenu=58]="ContextMenu",n[n.F1=59]="F1",n[n.F2=60]="F2",n[n.F3=61]="F3",n[n.F4=62]="F4",n[n.F5=63]="F5",n[n.F6=64]="F6",n[n.F7=65]="F7",n[n.F8=66]="F8",n[n.F9=67]="F9",n[n.F10=68]="F10",n[n.F11=69]="F11",n[n.F12=70]="F12",n[n.F13=71]="F13",n[n.F14=72]="F14",n[n.F15=73]="F15",n[n.F16=74]="F16",n[n.F17=75]="F17",n[n.F18=76]="F18",n[n.F19=77]="F19",n[n.F20=78]="F20",n[n.F21=79]="F21",n[n.F22=80]="F22",n[n.F23=81]="F23",n[n.F24=82]="F24",n[n.NumLock=83]="NumLock",n[n.ScrollLock=84]="ScrollLock",n[n.Semicolon=85]="Semicolon",n[n.Equal=86]="Equal",n[n.Comma=87]="Comma",n[n.Minus=88]="Minus",n[n.Period=89]="Period",n[n.Slash=90]="Slash",n[n.Backquote=91]="Backquote",n[n.BracketLeft=92]="BracketLeft",n[n.Backslash=93]="Backslash",n[n.BracketRight=94]="BracketRight",n[n.Quote=95]="Quote",n[n.OEM_8=96]="OEM_8",n[n.IntlBackslash=97]="IntlBackslash",n[n.Numpad0=98]="Numpad0",n[n.Numpad1=99]="Numpad1",n[n.Numpad2=100]="Numpad2",n[n.Numpad3=101]="Numpad3",n[n.Numpad4=102]="Numpad4",n[n.Numpad5=103]="Numpad5",n[n.Numpad6=104]="Numpad6",n[n.Numpad7=105]="Numpad7",n[n.Numpad8=106]="Numpad8",n[n.Numpad9=107]="Numpad9",n[n.NumpadMultiply=108]="NumpadMultiply",n[n.NumpadAdd=109]="NumpadAdd",n[n.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",n[n.NumpadSubtract=111]="NumpadSubtract",n[n.NumpadDecimal=112]="NumpadDecimal",n[n.NumpadDivide=113]="NumpadDivide",n[n.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",n[n.ABNT_C1=115]="ABNT_C1",n[n.ABNT_C2=116]="ABNT_C2",n[n.AudioVolumeMute=117]="AudioVolumeMute",n[n.AudioVolumeUp=118]="AudioVolumeUp",n[n.AudioVolumeDown=119]="AudioVolumeDown",n[n.BrowserSearch=120]="BrowserSearch",n[n.BrowserHome=121]="BrowserHome",n[n.BrowserBack=122]="BrowserBack",n[n.BrowserForward=123]="BrowserForward",n[n.MediaTrackNext=124]="MediaTrackNext",n[n.MediaTrackPrevious=125]="MediaTrackPrevious",n[n.MediaStop=126]="MediaStop",n[n.MediaPlayPause=127]="MediaPlayPause",n[n.LaunchMediaPlayer=128]="LaunchMediaPlayer",n[n.LaunchMail=129]="LaunchMail",n[n.LaunchApp2=130]="LaunchApp2",n[n.Clear=131]="Clear",n[n.MAX_VALUE=132]="MAX_VALUE"})($Z||($Z={}));var WZ;(function(n){n[n.Hint=1]="Hint",n[n.Info=2]="Info",n[n.Warning=4]="Warning",n[n.Error=8]="Error"})(WZ||(WZ={}));var HZ;(function(n){n[n.Unnecessary=1]="Unnecessary",n[n.Deprecated=2]="Deprecated"})(HZ||(HZ={}));var VZ;(function(n){n[n.Inline=1]="Inline",n[n.Gutter=2]="Gutter"})(VZ||(VZ={}));var zZ;(function(n){n[n.Normal=1]="Normal",n[n.Underlined=2]="Underlined"})(zZ||(zZ={}));var UZ;(function(n){n[n.UNKNOWN=0]="UNKNOWN",n[n.TEXTAREA=1]="TEXTAREA",n[n.GUTTER_GLYPH_MARGIN=2]="GUTTER_GLYPH_MARGIN",n[n.GUTTER_LINE_NUMBERS=3]="GUTTER_LINE_NUMBERS",n[n.GUTTER_LINE_DECORATIONS=4]="GUTTER_LINE_DECORATIONS",n[n.GUTTER_VIEW_ZONE=5]="GUTTER_VIEW_ZONE",n[n.CONTENT_TEXT=6]="CONTENT_TEXT",n[n.CONTENT_EMPTY=7]="CONTENT_EMPTY",n[n.CONTENT_VIEW_ZONE=8]="CONTENT_VIEW_ZONE",n[n.CONTENT_WIDGET=9]="CONTENT_WIDGET",n[n.OVERVIEW_RULER=10]="OVERVIEW_RULER",n[n.SCROLLBAR=11]="SCROLLBAR",n[n.OVERLAY_WIDGET=12]="OVERLAY_WIDGET",n[n.OUTSIDE_EDITOR=13]="OUTSIDE_EDITOR"})(UZ||(UZ={}));var jZ;(function(n){n[n.AIGenerated=1]="AIGenerated"})(jZ||(jZ={}));var qZ;(function(n){n[n.Invoke=0]="Invoke",n[n.Automatic=1]="Automatic"})(qZ||(qZ={}));var KZ;(function(n){n[n.TOP_RIGHT_CORNER=0]="TOP_RIGHT_CORNER",n[n.BOTTOM_RIGHT_CORNER=1]="BOTTOM_RIGHT_CORNER",n[n.TOP_CENTER=2]="TOP_CENTER"})(KZ||(KZ={}));var GZ;(function(n){n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=4]="Right",n[n.Full=7]="Full"})(GZ||(GZ={}));var YZ;(function(n){n[n.Word=0]="Word",n[n.Line=1]="Line",n[n.Suggest=2]="Suggest"})(YZ||(YZ={}));var ZZ;(function(n){n[n.Left=0]="Left",n[n.Right=1]="Right",n[n.None=2]="None",n[n.LeftOfInjectedText=3]="LeftOfInjectedText",n[n.RightOfInjectedText=4]="RightOfInjectedText"})(ZZ||(ZZ={}));var XZ;(function(n){n[n.Off=0]="Off",n[n.On=1]="On",n[n.Relative=2]="Relative",n[n.Interval=3]="Interval",n[n.Custom=4]="Custom"})(XZ||(XZ={}));var QZ;(function(n){n[n.None=0]="None",n[n.Text=1]="Text",n[n.Blocks=2]="Blocks"})(QZ||(QZ={}));var JZ;(function(n){n[n.Smooth=0]="Smooth",n[n.Immediate=1]="Immediate"})(JZ||(JZ={}));var eX;(function(n){n[n.Auto=1]="Auto",n[n.Hidden=2]="Hidden",n[n.Visible=3]="Visible"})(eX||(eX={}));var tX;(function(n){n[n.LTR=0]="LTR",n[n.RTL=1]="RTL"})(tX||(tX={}));var nX;(function(n){n.Off="off",n.OnCode="onCode",n.On="on"})(nX||(nX={}));var iX;(function(n){n[n.Invoke=1]="Invoke",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.ContentChange=3]="ContentChange"})(iX||(iX={}));var rX;(function(n){n[n.File=0]="File",n[n.Module=1]="Module",n[n.Namespace=2]="Namespace",n[n.Package=3]="Package",n[n.Class=4]="Class",n[n.Method=5]="Method",n[n.Property=6]="Property",n[n.Field=7]="Field",n[n.Constructor=8]="Constructor",n[n.Enum=9]="Enum",n[n.Interface=10]="Interface",n[n.Function=11]="Function",n[n.Variable=12]="Variable",n[n.Constant=13]="Constant",n[n.String=14]="String",n[n.Number=15]="Number",n[n.Boolean=16]="Boolean",n[n.Array=17]="Array",n[n.Object=18]="Object",n[n.Key=19]="Key",n[n.Null=20]="Null",n[n.EnumMember=21]="EnumMember",n[n.Struct=22]="Struct",n[n.Event=23]="Event",n[n.Operator=24]="Operator",n[n.TypeParameter=25]="TypeParameter"})(rX||(rX={}));var sX;(function(n){n[n.Deprecated=1]="Deprecated"})(sX||(sX={}));var oX;(function(n){n[n.Hidden=0]="Hidden",n[n.Blink=1]="Blink",n[n.Smooth=2]="Smooth",n[n.Phase=3]="Phase",n[n.Expand=4]="Expand",n[n.Solid=5]="Solid"})(oX||(oX={}));var aX;(function(n){n[n.Line=1]="Line",n[n.Block=2]="Block",n[n.Underline=3]="Underline",n[n.LineThin=4]="LineThin",n[n.BlockOutline=5]="BlockOutline",n[n.UnderlineThin=6]="UnderlineThin"})(aX||(aX={}));var lX;(function(n){n[n.AlwaysGrowsWhenTypingAtEdges=0]="AlwaysGrowsWhenTypingAtEdges",n[n.NeverGrowsWhenTypingAtEdges=1]="NeverGrowsWhenTypingAtEdges",n[n.GrowsOnlyWhenTypingBefore=2]="GrowsOnlyWhenTypingBefore",n[n.GrowsOnlyWhenTypingAfter=3]="GrowsOnlyWhenTypingAfter"})(lX||(lX={}));var cX;(function(n){n[n.None=0]="None",n[n.Same=1]="Same",n[n.Indent=2]="Indent",n[n.DeepIndent=3]="DeepIndent"})(cX||(cX={}));let n_t=class{static{this.CtrlCmd=2048}static{this.Shift=1024}static{this.Alt=512}static{this.WinCtrl=256}static chord(e,t){return js(e,t)}};function F4e(){return{editor:void 0,languages:void 0,CancellationTokenSource:Kr,Emitter:fe,KeyCode:$Z,KeyMod:n_t,Position:he,Range:$,Selection:yt,SelectionDirection:tX,MarkerSeverity:WZ,MarkerTag:HZ,Uri:Pt,Token:iN}}function i_t(n,e){const t=n;typeof t.vscodeWindowId!="number"&&Object.defineProperty(t,"vscodeWindowId",{get:()=>e})}const Xi=window;function B4e(n){return n}class r_t{constructor(e,t){this.lastCache=void 0,this.lastArgKey=void 0,typeof e=="function"?(this._fn=e,this._computeKey=B4e):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){const t=this._computeKey(e);return this.lastArgKey!==t&&(this.lastArgKey=t,this.lastCache=this._fn(e)),this.lastCache}}class $ve{get cachedValues(){return this._map}constructor(e,t){this._map=new Map,this._map2=new Map,typeof e=="function"?(this._fn=e,this._computeKey=B4e):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){const t=this._computeKey(e);if(this._map2.has(t))return this._map2.get(t);const i=this._fn(e);return this._map.set(e,i),this._map2.set(t,i),i}}class kg{constructor(e){this.executor=e,this._didRun=!1}get value(){if(!this._didRun)try{this._value=this.executor()}catch(e){this._error=e}finally{this._didRun=!0}if(this._error)throw this._error;return this._value}get rawValue(){return this._value}}function $4e(n){return!n||typeof n!="string"?!0:n.trim().length===0}const s_t=/{(\d+)}/g;function Lw(n,...e){return e.length===0?n:n.replace(s_t,function(t,i){const r=parseInt(i,10);return isNaN(r)||r<0||r>=e.length?t:e[r]})}function o_t(n){return n.replace(/[<>"'&]/g,e=>{switch(e){case"<":return"<";case">":return">";case'"':return""";case"'":return"'";case"&":return"&"}return e})}function gI(n){return n.replace(/[<>&]/g,function(e){switch(e){case"<":return"<";case">":return">";case"&":return"&";default:return e}})}function nd(n){return n.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function a_t(n,e=" "){const t=jP(n,e);return W4e(t,e)}function jP(n,e){if(!n||!e)return n;const t=e.length;if(t===0||n.length===0)return n;let i=0;for(;n.indexOf(e,i)===i;)i=i+t;return n.substring(i)}function W4e(n,e){if(!n||!e)return n;const t=e.length,i=n.length;if(t===0||i===0)return n;let r=i,s=-1;for(;s=n.lastIndexOf(e,r-1),!(s===-1||s+t!==r);){if(s===0)return"";r=s}return n.substring(0,r)}function l_t(n){return n.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function c_t(n){return n.replace(/\*/g,"")}function H4e(n,e,t={}){if(!n)throw new Error("Cannot create regex from empty string");e||(n=nd(n)),t.wholeWord&&(/\B/.test(n.charAt(0))||(n="\\b"+n),/\B/.test(n.charAt(n.length-1))||(n=n+"\\b"));let i="";return t.global&&(i+="g"),t.matchCase||(i+="i"),t.multiline&&(i+="m"),t.unicode&&(i+="u"),new RegExp(n,i)}function u_t(n){return n.source==="^"||n.source==="^$"||n.source==="$"||n.source==="^\\s*$"?!1:!!(n.exec("")&&n.lastIndex===0)}function om(n){return n.split(/\r\n|\r|\n/)}function d_t(n){const e=[],t=n.split(/(\r\n|\r|\n)/);for(let i=0;i=0;t--){const i=n.charCodeAt(t);if(i!==32&&i!==9)return t}return-1}function aN(n,e){return ne?1:0}function Eae(n,e,t=0,i=n.length,r=0,s=e.length){for(;tc)return 1}const o=i-t,a=s-r;return oa?1:0}function uX(n,e){return qP(n,e,0,n.length,0,e.length)}function qP(n,e,t=0,i=n.length,r=0,s=e.length){for(;t=128||c>=128)return Eae(n.toLowerCase(),e.toLowerCase(),t,i,r,s);Tv(l)&&(l-=32),Tv(c)&&(c-=32);const u=l-c;if(u!==0)return u}const o=i-t,a=s-r;return oa?1:0}function w4(n){return n>=48&&n<=57}function Tv(n){return n>=97&&n<=122}function fp(n){return n>=65&&n<=90}function bS(n,e){return n.length===e.length&&qP(n,e)===0}function Lae(n,e){const t=e.length;return e.length>n.length?!1:qP(n,e,0,t)===0}function Cb(n,e){const t=Math.min(n.length,e.length);let i;for(i=0;i1){const i=n.charCodeAt(e-2);if(Co(i))return Tae(i,t)}return t}class Dae{get offset(){return this._offset}constructor(e,t=0){this._str=e,this._len=e.length,this._offset=t}setOffset(e){this._offset=e}prevCodePoint(){const e=h_t(this._str,this._offset);return this._offset-=e>=65536?2:1,e}nextCodePoint(){const e=z6(this._str,this._len,this._offset);return this._offset+=e>=65536?2:1,e}eol(){return this._offset>=this._len}}class U6{get offset(){return this._iterator.offset}constructor(e,t=0){this._iterator=new Dae(e,t)}nextGraphemeLength(){const e=Ty.getInstance(),t=this._iterator,i=t.offset;let r=e.getGraphemeBreakType(t.nextCodePoint());for(;!t.eol();){const s=t.offset,o=e.getGraphemeBreakType(t.nextCodePoint());if(Wve(r,o)){t.setOffset(s);break}r=o}return t.offset-i}prevGraphemeLength(){const e=Ty.getInstance(),t=this._iterator,i=t.offset;let r=e.getGraphemeBreakType(t.prevCodePoint());for(;t.offset>0;){const s=t.offset,o=e.getGraphemeBreakType(t.prevCodePoint());if(Wve(o,r)){t.setOffset(s);break}r=o}return i-t.offset}eol(){return this._iterator.eol()}}function Iae(n,e){return new U6(n,e).nextGraphemeLength()}function V4e(n,e){return new U6(n,e).prevGraphemeLength()}function f_t(n,e){e>0&&Tw(n.charCodeAt(e))&&e--;const t=e+Iae(n,e);return[t-V4e(n,t),t]}let fj;function g_t(){return/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u088E\u08A0-\u08C9\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDC7\uFDF0-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE35\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDD23\uDE80-\uDEA9\uDEAD-\uDF45\uDF51-\uDF81\uDF86-\uDFF6]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD4B-\uDFFF]|\uD83B[\uDC00-\uDEBB])/}function iE(n){return fj||(fj=g_t()),fj.test(n)}const p_t=/^[\t\n\r\x20-\x7E]*$/;function KP(n){return p_t.test(n)}const z4e=/[\u2028\u2029]/;function U4e(n){return z4e.test(n)}function xb(n){return n>=11904&&n<=55215||n>=63744&&n<=64255||n>=65281&&n<=65374}function Aae(n){return n>=127462&&n<=127487||n===8986||n===8987||n===9200||n===9203||n>=9728&&n<=10175||n===11088||n===11093||n>=127744&&n<=128591||n>=128640&&n<=128764||n>=128992&&n<=129008||n>=129280&&n<=129535||n>=129648&&n<=129782}const m_t="\uFEFF";function Nae(n){return!!(n&&n.length>0&&n.charCodeAt(0)===65279)}function __t(n,e=!1){return n?(e&&(n=n.replace(/\\./g,"")),n.toLowerCase()!==n):!1}function j4e(n){return n=n%(2*26),n<26?String.fromCharCode(97+n):String.fromCharCode(65+n-26)}function Wve(n,e){return n===0?e!==5&&e!==7:n===2&&e===3?!1:n===4||n===2||n===3||e===4||e===2||e===3?!0:!(n===8&&(e===8||e===9||e===11||e===12)||(n===11||n===9)&&(e===9||e===10)||(n===12||n===10)&&e===10||e===5||e===13||e===7||n===1||n===13&&e===14||n===6&&e===6)}class Ty{static{this._INSTANCE=null}static getInstance(){return Ty._INSTANCE||(Ty._INSTANCE=new Ty),Ty._INSTANCE}constructor(){this._data=v_t()}getGraphemeBreakType(e){if(e<32)return e===10?3:e===13?2:4;if(e<127)return 0;const t=this._data,i=t.length/3;let r=1;for(;r<=i;)if(et[3*r+1])r=2*r+1;else return t[3*r+2];return 0}}function v_t(){return JSON.parse("[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]")}function b_t(n,e){if(n===0)return 0;const t=y_t(n,e);if(t!==void 0)return t;const i=new Dae(e,n);return i.prevCodePoint(),i.offset}function y_t(n,e){const t=new Dae(e,n);let i=t.prevCodePoint();for(;w_t(i)||i===65039||i===8419;){if(t.offset===0)return;i=t.prevCodePoint()}if(!Aae(i))return;let r=t.offset;return r>0&&t.prevCodePoint()===8205&&(r=t.offset),r}function w_t(n){return 127995<=n&&n<=127999}const q4e=" ";class Dv{static{this.ambiguousCharacterData=new kg(()=>JSON.parse('{"_common":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,8218,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,8242,96,1370,96,1523,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71922,67,71913,67,65315,67,8557,67,8450,67,8493,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71919,87,71910,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,66293,90,71909,90,65338,90,8484,90,8488,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65297,49,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],"_default":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"cs":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"de":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"es":[8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"fr":[65374,126,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"it":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"ja":[8211,45,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65292,44,65307,59],"ko":[8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"pl":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"pt-BR":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"ru":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"tr":[160,32,8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"zh-hans":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41],"zh-hant":[8211,45,65374,126,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65307,59]}'))}static{this.cache=new r_t({getCacheKey:JSON.stringify},e=>{function t(u){const d=new Map;for(let h=0;h!u.startsWith("_")&&u in s);o.length===0&&(o=["_default"]);let a;for(const u of o){const d=t(s[u]);a=r(a,d)}const l=t(s._common),c=i(l,a);return new Dv(c)})}static getInstance(e){return Dv.cache.get(Array.from(e))}static{this._locales=new kg(()=>Object.keys(Dv.ambiguousCharacterData.value).filter(e=>!e.startsWith("_")))}static getLocales(){return Dv._locales.value}constructor(e){this.confusableDictionary=e}isAmbiguous(e){return this.confusableDictionary.has(e)}getPrimaryConfusable(e){return this.confusableDictionary.get(e)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}}class I_{static getRawData(){return JSON.parse("[9,10,11,12,13,32,127,160,173,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8234,8235,8236,8237,8238,8239,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,10240,12288,12644,65024,65025,65026,65027,65028,65029,65030,65031,65032,65033,65034,65035,65036,65037,65038,65039,65279,65440,65520,65521,65522,65523,65524,65525,65526,65527,65528,65532,78844,119155,119156,119157,119158,119159,119160,119161,119162,917504,917505,917506,917507,917508,917509,917510,917511,917512,917513,917514,917515,917516,917517,917518,917519,917520,917521,917522,917523,917524,917525,917526,917527,917528,917529,917530,917531,917532,917533,917534,917535,917536,917537,917538,917539,917540,917541,917542,917543,917544,917545,917546,917547,917548,917549,917550,917551,917552,917553,917554,917555,917556,917557,917558,917559,917560,917561,917562,917563,917564,917565,917566,917567,917568,917569,917570,917571,917572,917573,917574,917575,917576,917577,917578,917579,917580,917581,917582,917583,917584,917585,917586,917587,917588,917589,917590,917591,917592,917593,917594,917595,917596,917597,917598,917599,917600,917601,917602,917603,917604,917605,917606,917607,917608,917609,917610,917611,917612,917613,917614,917615,917616,917617,917618,917619,917620,917621,917622,917623,917624,917625,917626,917627,917628,917629,917630,917631,917760,917761,917762,917763,917764,917765,917766,917767,917768,917769,917770,917771,917772,917773,917774,917775,917776,917777,917778,917779,917780,917781,917782,917783,917784,917785,917786,917787,917788,917789,917790,917791,917792,917793,917794,917795,917796,917797,917798,917799,917800,917801,917802,917803,917804,917805,917806,917807,917808,917809,917810,917811,917812,917813,917814,917815,917816,917817,917818,917819,917820,917821,917822,917823,917824,917825,917826,917827,917828,917829,917830,917831,917832,917833,917834,917835,917836,917837,917838,917839,917840,917841,917842,917843,917844,917845,917846,917847,917848,917849,917850,917851,917852,917853,917854,917855,917856,917857,917858,917859,917860,917861,917862,917863,917864,917865,917866,917867,917868,917869,917870,917871,917872,917873,917874,917875,917876,917877,917878,917879,917880,917881,917882,917883,917884,917885,917886,917887,917888,917889,917890,917891,917892,917893,917894,917895,917896,917897,917898,917899,917900,917901,917902,917903,917904,917905,917906,917907,917908,917909,917910,917911,917912,917913,917914,917915,917916,917917,917918,917919,917920,917921,917922,917923,917924,917925,917926,917927,917928,917929,917930,917931,917932,917933,917934,917935,917936,917937,917938,917939,917940,917941,917942,917943,917944,917945,917946,917947,917948,917949,917950,917951,917952,917953,917954,917955,917956,917957,917958,917959,917960,917961,917962,917963,917964,917965,917966,917967,917968,917969,917970,917971,917972,917973,917974,917975,917976,917977,917978,917979,917980,917981,917982,917983,917984,917985,917986,917987,917988,917989,917990,917991,917992,917993,917994,917995,917996,917997,917998,917999]")}static{this._data=void 0}static getData(){return this._data||(this._data=new Set(I_.getRawData())),this._data}static isInvisibleCharacter(e){return I_.getData().has(e)}static get codePoints(){return I_.getData()}}class Rae{constructor(){this.mapWindowIdToZoomFactor=new Map}static{this.INSTANCE=new Rae}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}getWindowId(e){return e.vscodeWindowId}}function K4e(n,e,t){typeof e=="string"&&(e=n.matchMedia(e)),e.addEventListener("change",t)}function C_t(n){return Rae.INSTANCE.getZoomFactor(n)}const qL=navigator.userAgent,Xd=qL.indexOf("Firefox")>=0,Ky=qL.indexOf("AppleWebKit")>=0,GP=qL.indexOf("Chrome")>=0,K_=!GP&&qL.indexOf("Safari")>=0,G4e=!GP&&!K_&&Ky;qL.indexOf("Electron/")>=0;const Hve=qL.indexOf("Android")>=0;let W5=!1;if(typeof Xi.matchMedia=="function"){const n=Xi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Xi.matchMedia("(display-mode: fullscreen)");W5=n.matches,K4e(Xi,n,({matches:t})=>{W5&&e.matches||(W5=t)})}function x_t(){return W5}const Pae={clipboard:{writeText:hg||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(navigator&&navigator.clipboard&&navigator.clipboard.writeText),readText:hg||!!(navigator&&navigator.clipboard&&navigator.clipboard.readText)},keyboard:hg||x_t()?0:navigator.keyboard||K_?1:2,touch:"ontouchstart"in Xi||navigator.maxTouchPoints>0,pointerEvents:Xi.PointerEvent&&("ontouchstart"in Xi||navigator.maxTouchPoints>0)};function dX(n,e){if(typeof n=="number"){if(n===0)return null;const t=(n&65535)>>>0,i=(n&4294901760)>>>16;return i!==0?new gj([C4(t,e),C4(i,e)]):new gj([C4(t,e)])}else{const t=[];for(let i=0;i{const o=e.token.onCancellationRequested(()=>{o.dispose(),s(new sf)});Promise.resolve(t).then(a=>{o.dispose(),e.dispose(),r(a)},a=>{o.dispose(),e.dispose(),s(a)})});return new class{cancel(){e.cancel(),e.dispose()}then(r,s){return i.then(r,s)}catch(r){return this.then(void 0,r)}finally(r){return i.finally(r)}}}function YP(n,e,t){return new Promise((i,r)=>{const s=e.onCancellationRequested(()=>{s.dispose(),i(t)});n.then(i,r).finally(()=>s.dispose())})}class R_t{constructor(){this.isDisposed=!1,this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(e){if(this.isDisposed)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){const t=()=>{if(this.queuedPromise=null,this.isDisposed)return;const i=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,i};this.queuedPromise=new Promise(i=>{this.activePromise.then(t,t).then(i)})}return new Promise((t,i)=>{this.queuedPromise.then(t,i)})}return this.activePromise=e(),new Promise((t,i)=>{this.activePromise.then(r=>{this.activePromise=null,t(r)},r=>{this.activePromise=null,i(r)})})}dispose(){this.isDisposed=!0}}const P_t=(n,e)=>{let t=!0;const i=setTimeout(()=>{t=!1,e()},n);return{isTriggered:()=>t,dispose:()=>{clearTimeout(i),t=!1}}},O_t=n=>{let e=!0;return queueMicrotask(()=>{e&&(e=!1,n())}),{isTriggered:()=>e,dispose:()=>{e=!1}}};class Qd{constructor(e){this.defaultDelay=e,this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(e,t=this.defaultDelay){this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((r,s)=>{this.doResolve=r,this.doReject=s}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){const r=this.task;return this.task=null,r()}}));const i=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=t===Y4e?O_t(i):P_t(t,i),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new sf),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}}class Z4e{constructor(e){this.delayer=new Qd(e),this.throttler=new R_t}trigger(e,t){return this.delayer.trigger(()=>this.throttler.queue(e),t)}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}}function Y_(n,e){return e?new Promise((t,i)=>{const r=setTimeout(()=>{s.dispose(),t()},n),s=e.onCancellationRequested(()=>{clearTimeout(r),s.dispose(),i(new sf)})}):ko(t=>Y_(n,t))}function Sb(n,e=0,t){const i=setTimeout(()=>{n(),t&&r.dispose()},e),r=Lt(()=>{clearTimeout(i),t?.deleteAndLeak(r)});return t?.add(r),r}function Oae(n,e=i=>!!i,t=null){let i=0;const r=n.length,s=()=>{if(i>=r)return Promise.resolve(t);const o=n[i++];return Promise.resolve(o()).then(l=>e(l)?Promise.resolve(l):s())};return s()}class hf{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new fi("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new fi("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}}class Mae{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new fi("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();const r=i.setInterval(()=>{e()},t);this.disposable=Lt(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}}class Ui{constructor(e,t){this.timeoutToken=-1,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=-1)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return this.timeoutToken!==-1}onTimeout(){this.timeoutToken=-1,this.runner&&this.doRun()}doRun(){this.runner?.()}}let X4e,pI;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?pI=(n,e)=>{m4e(()=>{if(t)return;const i=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,i-Date.now())}}))});let t=!1;return{dispose(){t||(t=!0)}}}:pI=(n,e,t)=>{const i=n.requestIdleCallback(e,typeof t=="number"?{timeout:t}:void 0);let r=!1;return{dispose(){r||(r=!0,n.cancelIdleCallback(i))}}},X4e=n=>pI(globalThis,n)})();class Q4e{constructor(e,t){this._didRun=!1,this._executor=()=>{try{this._value=t()}catch(i){this._error=i}finally{this._didRun=!0}},this._handle=pI(e,()=>this._executor())}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}}class M_t extends Q4e{constructor(e){super(globalThis,e)}}class KL{get isRejected(){return this.outcome?.outcome===1}get isSettled(){return!!this.outcome}constructor(){this.p=new Promise((e,t)=>{this.completeCallback=e,this.errorCallback=t})}complete(e){return new Promise(t=>{this.completeCallback(e),this.outcome={outcome:0,value:e},t()})}error(e){return new Promise(t=>{this.errorCallback(e),this.outcome={outcome:1,value:e},t()})}cancel(){return this.error(new sf)}}var fX;(function(n){async function e(i){let r;const s=await Promise.all(i.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return s}n.settled=e;function t(i){return new Promise(async(r,s)=>{try{await i(r,s)}catch(o){s(o)}})}n.withAsyncBody=t})(fX||(fX={}));class to{static fromArray(e){return new to(t=>{t.emitMany(e)})}static fromPromise(e){return new to(async t=>{t.emitMany(await e)})}static fromPromises(e){return new to(async t=>{await Promise.all(e.map(async i=>t.emitOne(await i)))})}static merge(e){return new to(async t=>{await Promise.all(e.map(async i=>{for await(const r of i)t.emitOne(r)}))})}static{this.EMPTY=to.fromArray([])}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new fe,queueMicrotask(async()=>{const i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,t){return new to(async i=>{for await(const r of e)i.emitOne(t(r))})}map(e){return to.map(this,e)}static filter(e,t){return new to(async i=>{for await(const r of e)t(r)&&i.emitOne(r)})}filter(e){return to.filter(this,e)}static coalesce(e){return to.filter(e,t=>!!t)}coalesce(){return to.coalesce(this)}static async toPromise(e){const t=[];for await(const i of e)t.push(i);return t}toPromise(){return to.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}}class F_t extends to{constructor(e,t){super(t),this._source=e}cancel(){this._source.cancel()}}function B_t(n){const e=new Kr,t=n(e.token);return new F_t(e,async i=>{const r=e.token.onCancellationRequested(()=>{r.dispose(),e.dispose(),i.reject(new sf)});try{for await(const s of t){if(e.token.isCancellationRequested)return;i.emitOne(s)}r.dispose(),e.dispose()}catch(s){r.dispose(),e.dispose(),i.reject(s)}})}/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */const{entries:J4e,setPrototypeOf:zve,isFrozen:$_t,getPrototypeOf:W_t,getOwnPropertyDescriptor:H_t}=Object;let{freeze:uu,seal:of,create:e3e}=Object,{apply:gX,construct:pX}=typeof Reflect<"u"&&Reflect;uu||(uu=function(e){return e});of||(of=function(e){return e});gX||(gX=function(e,t,i){return e.apply(t,i)});pX||(pX=function(e,t){return new e(...t)});const x4=Jd(Array.prototype.forEach),Uve=Jd(Array.prototype.pop),bT=Jd(Array.prototype.push),H5=Jd(String.prototype.toLowerCase),pj=Jd(String.prototype.toString),jve=Jd(String.prototype.match),yT=Jd(String.prototype.replace),V_t=Jd(String.prototype.indexOf),z_t=Jd(String.prototype.trim),Nf=Jd(Object.prototype.hasOwnProperty),$c=Jd(RegExp.prototype.test),wT=U_t(TypeError);function Jd(n){return function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r2&&arguments[2]!==void 0?arguments[2]:H5;zve&&zve(n,null);let i=e.length;for(;i--;){let r=e[i];if(typeof r=="string"){const s=t(r);s!==r&&($_t(e)||(e[i]=s),r=s)}n[r]=!0}return n}function j_t(n){for(let e=0;e/gm),Z_t=of(/\${[\w\W]*}/gm),X_t=of(/^data-[\-\w.\u00B7-\uFFFF]/),Q_t=of(/^aria-[\-\w]+$/),t3e=of(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),J_t=of(/^(?:\w+script|data):/i),e0t=of(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),n3e=of(/^html$/i),t0t=of(/^[a-z][.\w]*(-[.\w]+)+$/i);var Zve=Object.freeze({__proto__:null,MUSTACHE_EXPR:G_t,ERB_EXPR:Y_t,TMPLIT_EXPR:Z_t,DATA_ATTR:X_t,ARIA_ATTR:Q_t,IS_ALLOWED_URI:t3e,IS_SCRIPT_OR_DATA:J_t,ATTR_WHITESPACE:e0t,DOCTYPE_NAME:n3e,CUSTOM_ELEMENT:t0t});const xT={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},n0t=function(){return typeof window>"u"?null:window},i0t=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(i=t.getAttribute(r));const s="dompurify"+(i?"#"+i:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}};function i3e(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n0t();const e=Fe=>i3e(Fe);if(e.version="3.1.7",e.removed=[],!n||!n.document||n.document.nodeType!==xT.document)return e.isSupported=!1,e;let{document:t}=n;const i=t,r=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:f}=n,g=l.prototype,p=CT(g,"cloneNode"),m=CT(g,"remove"),_=CT(g,"nextSibling"),v=CT(g,"childNodes"),y=CT(g,"parentNode");if(typeof o=="function"){const Fe=t.createElement("template");Fe.content&&Fe.content.ownerDocument&&(t=Fe.content.ownerDocument)}let C,x="";const{implementation:k,createNodeIterator:L,createDocumentFragment:D,getElementsByTagName:I}=t,{importNode:O}=i;let M={};e.isSupported=typeof J4e=="function"&&typeof y=="function"&&k&&k.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:G,TMPLIT_EXPR:W,DATA_ATTR:z,ARIA_ATTR:q,IS_SCRIPT_OR_DATA:ee,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:j}=Zve;let{IS_ALLOWED_URI:te}=Zve,le=null;const ue=ir({},[...qve,...mj,..._j,...vj,...Kve]);let de=null;const we=ir({},[...Gve,...bj,...Yve,...S4]);let xe=Object.seal(e3e(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Me=null,Re=null,_t=!0,Qe=!0,pt=!1,gt=!0,Ue=!1,wn=!0,Xt=!1,jn=!1,ji=!1,ci=!1,ye=!1,Ie=!1,Ve=!0,wt=!1;const vt="user-content-";let nt=!0,$t=!1,an={},Pi=null;const Xn=ir({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Qi=null;const qs=ir({},["audio","video","img","source","image","track"]);let Pr=null;const Or=ir({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),cr="http://www.w3.org/1998/Math/MathML",us="http://www.w3.org/2000/svg",qi="http://www.w3.org/1999/xhtml";let Er=qi,oo=!1,As=null;const Ft=ir({},[cr,us,qi],pj);let qn=null;const pi=["application/xhtml+xml","text/html"],bn="text/html";let dn=null,bi=null;const mi=t.createElement("form"),Yi=function(_e){return _e instanceof RegExp||_e instanceof Function},Wn=function(){let _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(bi&&bi===_e)){if((!_e||typeof _e!="object")&&(_e={}),_e=U1(_e),qn=pi.indexOf(_e.PARSER_MEDIA_TYPE)===-1?bn:_e.PARSER_MEDIA_TYPE,dn=qn==="application/xhtml+xml"?pj:H5,le=Nf(_e,"ALLOWED_TAGS")?ir({},_e.ALLOWED_TAGS,dn):ue,de=Nf(_e,"ALLOWED_ATTR")?ir({},_e.ALLOWED_ATTR,dn):we,As=Nf(_e,"ALLOWED_NAMESPACES")?ir({},_e.ALLOWED_NAMESPACES,pj):Ft,Pr=Nf(_e,"ADD_URI_SAFE_ATTR")?ir(U1(Or),_e.ADD_URI_SAFE_ATTR,dn):Or,Qi=Nf(_e,"ADD_DATA_URI_TAGS")?ir(U1(qs),_e.ADD_DATA_URI_TAGS,dn):qs,Pi=Nf(_e,"FORBID_CONTENTS")?ir({},_e.FORBID_CONTENTS,dn):Xn,Me=Nf(_e,"FORBID_TAGS")?ir({},_e.FORBID_TAGS,dn):{},Re=Nf(_e,"FORBID_ATTR")?ir({},_e.FORBID_ATTR,dn):{},an=Nf(_e,"USE_PROFILES")?_e.USE_PROFILES:!1,_t=_e.ALLOW_ARIA_ATTR!==!1,Qe=_e.ALLOW_DATA_ATTR!==!1,pt=_e.ALLOW_UNKNOWN_PROTOCOLS||!1,gt=_e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ue=_e.SAFE_FOR_TEMPLATES||!1,wn=_e.SAFE_FOR_XML!==!1,Xt=_e.WHOLE_DOCUMENT||!1,ci=_e.RETURN_DOM||!1,ye=_e.RETURN_DOM_FRAGMENT||!1,Ie=_e.RETURN_TRUSTED_TYPE||!1,ji=_e.FORCE_BODY||!1,Ve=_e.SANITIZE_DOM!==!1,wt=_e.SANITIZE_NAMED_PROPS||!1,nt=_e.KEEP_CONTENT!==!1,$t=_e.IN_PLACE||!1,te=_e.ALLOWED_URI_REGEXP||t3e,Er=_e.NAMESPACE||qi,xe=_e.CUSTOM_ELEMENT_HANDLING||{},_e.CUSTOM_ELEMENT_HANDLING&&Yi(_e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(xe.tagNameCheck=_e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_e.CUSTOM_ELEMENT_HANDLING&&Yi(_e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(xe.attributeNameCheck=_e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_e.CUSTOM_ELEMENT_HANDLING&&typeof _e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(xe.allowCustomizedBuiltInElements=_e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ue&&(Qe=!1),ye&&(ci=!0),an&&(le=ir({},Kve),de=[],an.html===!0&&(ir(le,qve),ir(de,Gve)),an.svg===!0&&(ir(le,mj),ir(de,bj),ir(de,S4)),an.svgFilters===!0&&(ir(le,_j),ir(de,bj),ir(de,S4)),an.mathMl===!0&&(ir(le,vj),ir(de,Yve),ir(de,S4))),_e.ADD_TAGS&&(le===ue&&(le=U1(le)),ir(le,_e.ADD_TAGS,dn)),_e.ADD_ATTR&&(de===we&&(de=U1(de)),ir(de,_e.ADD_ATTR,dn)),_e.ADD_URI_SAFE_ATTR&&ir(Pr,_e.ADD_URI_SAFE_ATTR,dn),_e.FORBID_CONTENTS&&(Pi===Xn&&(Pi=U1(Pi)),ir(Pi,_e.FORBID_CONTENTS,dn)),nt&&(le["#text"]=!0),Xt&&ir(le,["html","head","body"]),le.table&&(ir(le,["tbody"]),delete Me.tbody),_e.TRUSTED_TYPES_POLICY){if(typeof _e.TRUSTED_TYPES_POLICY.createHTML!="function")throw wT('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw wT('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=_e.TRUSTED_TYPES_POLICY,x=C.createHTML("")}else C===void 0&&(C=i0t(f,r)),C!==null&&typeof x=="string"&&(x=C.createHTML(""));uu&&uu(_e),bi=_e}},pn=ir({},["mi","mo","mn","ms","mtext"]),re=ir({},["annotation-xml"]),oe=ir({},["title","style","font","a","script"]),H=ir({},[...mj,..._j,...q_t]),Y=ir({},[...vj,...K_t]),ne=function(_e){let Ze=y(_e);(!Ze||!Ze.tagName)&&(Ze={namespaceURI:Er,tagName:"template"});const ct=H5(_e.tagName),Ht=H5(Ze.tagName);return As[_e.namespaceURI]?_e.namespaceURI===us?Ze.namespaceURI===qi?ct==="svg":Ze.namespaceURI===cr?ct==="svg"&&(Ht==="annotation-xml"||pn[Ht]):!!H[ct]:_e.namespaceURI===cr?Ze.namespaceURI===qi?ct==="math":Ze.namespaceURI===us?ct==="math"&&re[Ht]:!!Y[ct]:_e.namespaceURI===qi?Ze.namespaceURI===us&&!re[Ht]||Ze.namespaceURI===cr&&!pn[Ht]?!1:!Y[ct]&&(oe[ct]||!H[ct]):!!(qn==="application/xhtml+xml"&&As[_e.namespaceURI]):!1},N=function(_e){bT(e.removed,{element:_e});try{y(_e).removeChild(_e)}catch{m(_e)}},F=function(_e,Ze){try{bT(e.removed,{attribute:Ze.getAttributeNode(_e),from:Ze})}catch{bT(e.removed,{attribute:null,from:Ze})}if(Ze.removeAttribute(_e),_e==="is"&&!de[_e])if(ci||ye)try{N(Ze)}catch{}else try{Ze.setAttribute(_e,"")}catch{}},V=function(_e){let Ze=null,ct=null;if(ji)_e=""+_e;else{const nn=jve(_e,/^[\r\n\t ]+/);ct=nn&&nn[0]}qn==="application/xhtml+xml"&&Er===qi&&(_e=''+_e+"");const Ht=C?C.createHTML(_e):_e;if(Er===qi)try{Ze=new h().parseFromString(Ht,qn)}catch{}if(!Ze||!Ze.documentElement){Ze=k.createDocument(Er,"template",null);try{Ze.documentElement.innerHTML=oo?x:Ht}catch{}}const Zt=Ze.body||Ze.documentElement;return _e&&ct&&Zt.insertBefore(t.createTextNode(ct),Zt.childNodes[0]||null),Er===qi?I.call(Ze,Xt?"html":"body")[0]:Xt?Ze.documentElement:Zt},A=function(_e){return L.call(_e.ownerDocument||_e,_e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},K=function(_e){return _e instanceof d&&(typeof _e.nodeName!="string"||typeof _e.textContent!="string"||typeof _e.removeChild!="function"||!(_e.attributes instanceof u)||typeof _e.removeAttribute!="function"||typeof _e.setAttribute!="function"||typeof _e.namespaceURI!="string"||typeof _e.insertBefore!="function"||typeof _e.hasChildNodes!="function")},ge=function(_e){return typeof a=="function"&&_e instanceof a},pe=function(_e,Ze,ct){M[_e]&&x4(M[_e],Ht=>{Ht.call(e,Ze,ct,bi)})},Ee=function(_e){let Ze=null;if(pe("beforeSanitizeElements",_e,null),K(_e))return N(_e),!0;const ct=dn(_e.nodeName);if(pe("uponSanitizeElement",_e,{tagName:ct,allowedTags:le}),_e.hasChildNodes()&&!ge(_e.firstElementChild)&&$c(/<[/\w]/g,_e.innerHTML)&&$c(/<[/\w]/g,_e.textContent)||_e.nodeType===xT.progressingInstruction||wn&&_e.nodeType===xT.comment&&$c(/<[/\w]/g,_e.data))return N(_e),!0;if(!le[ct]||Me[ct]){if(!Me[ct]&&ht(ct)&&(xe.tagNameCheck instanceof RegExp&&$c(xe.tagNameCheck,ct)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(ct)))return!1;if(nt&&!Pi[ct]){const Ht=y(_e)||_e.parentNode,Zt=v(_e)||_e.childNodes;if(Zt&&Ht){const nn=Zt.length;for(let ln=nn-1;ln>=0;--ln){const Wt=p(Zt[ln],!0);Wt.__removalCount=(_e.__removalCount||0)+1,Ht.insertBefore(Wt,_(_e))}}}return N(_e),!0}return _e instanceof l&&!ne(_e)||(ct==="noscript"||ct==="noembed"||ct==="noframes")&&$c(/<\/no(script|embed|frames)/i,_e.innerHTML)?(N(_e),!0):(Ue&&_e.nodeType===xT.text&&(Ze=_e.textContent,x4([B,G,W],Ht=>{Ze=yT(Ze,Ht," ")}),_e.textContent!==Ze&&(bT(e.removed,{element:_e.cloneNode()}),_e.textContent=Ze)),pe("afterSanitizeElements",_e,null),!1)},Be=function(_e,Ze,ct){if(Ve&&(Ze==="id"||Ze==="name")&&(ct in t||ct in mi))return!1;if(!(Qe&&!Re[Ze]&&$c(z,Ze))){if(!(_t&&$c(q,Ze))){if(!de[Ze]||Re[Ze]){if(!(ht(_e)&&(xe.tagNameCheck instanceof RegExp&&$c(xe.tagNameCheck,_e)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(_e))&&(xe.attributeNameCheck instanceof RegExp&&$c(xe.attributeNameCheck,Ze)||xe.attributeNameCheck instanceof Function&&xe.attributeNameCheck(Ze))||Ze==="is"&&xe.allowCustomizedBuiltInElements&&(xe.tagNameCheck instanceof RegExp&&$c(xe.tagNameCheck,ct)||xe.tagNameCheck instanceof Function&&xe.tagNameCheck(ct))))return!1}else if(!Pr[Ze]){if(!$c(te,yT(ct,Z,""))){if(!((Ze==="src"||Ze==="xlink:href"||Ze==="href")&&_e!=="script"&&V_t(ct,"data:")===0&&Qi[_e])){if(!(pt&&!$c(ee,yT(ct,Z,"")))){if(ct)return!1}}}}}}return!0},ht=function(_e){return _e!=="annotation-xml"&&jve(_e,j)},bt=function(_e){pe("beforeSanitizeAttributes",_e,null);const{attributes:Ze}=_e;if(!Ze)return;const ct={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:de};let Ht=Ze.length;for(;Ht--;){const Zt=Ze[Ht],{name:nn,namespaceURI:ln,value:Wt}=Zt,on=dn(nn);let It=nn==="value"?Wt:z_t(Wt);if(ct.attrName=on,ct.attrValue=It,ct.keepAttr=!0,ct.forceKeepAttr=void 0,pe("uponSanitizeAttribute",_e,ct),It=ct.attrValue,ct.forceKeepAttr||(F(nn,_e),!ct.keepAttr))continue;if(!gt&&$c(/\/>/i,It)){F(nn,_e);continue}Ue&&x4([B,G,W],Rt=>{It=yT(It,Rt," ")});const Ct=dn(_e.nodeName);if(Be(Ct,on,It)){if(wt&&(on==="id"||on==="name")&&(F(nn,_e),It=vt+It),wn&&$c(/((--!?|])>)|<\/(style|title)/i,It)){F(nn,_e);continue}if(C&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!ln)switch(f.getAttributeType(Ct,on)){case"TrustedHTML":{It=C.createHTML(It);break}case"TrustedScriptURL":{It=C.createScriptURL(It);break}}try{ln?_e.setAttributeNS(ln,nn,It):_e.setAttribute(nn,It),K(_e)?N(_e):Uve(e.removed)}catch{}}}pe("afterSanitizeAttributes",_e,null)},hn=function Fe(_e){let Ze=null;const ct=A(_e);for(pe("beforeSanitizeShadowDOM",_e,null);Ze=ct.nextNode();)pe("uponSanitizeShadowNode",Ze,null),!Ee(Ze)&&(Ze.content instanceof s&&Fe(Ze.content),bt(Ze));pe("afterSanitizeShadowDOM",_e,null)};return e.sanitize=function(Fe){let _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ze=null,ct=null,Ht=null,Zt=null;if(oo=!Fe,oo&&(Fe=""),typeof Fe!="string"&&!ge(Fe))if(typeof Fe.toString=="function"){if(Fe=Fe.toString(),typeof Fe!="string")throw wT("dirty is not a string, aborting")}else throw wT("toString is not a function");if(!e.isSupported)return Fe;if(jn||Wn(_e),e.removed=[],typeof Fe=="string"&&($t=!1),$t){if(Fe.nodeName){const Wt=dn(Fe.nodeName);if(!le[Wt]||Me[Wt])throw wT("root node is forbidden and cannot be sanitized in-place")}}else if(Fe instanceof a)Ze=V(""),ct=Ze.ownerDocument.importNode(Fe,!0),ct.nodeType===xT.element&&ct.nodeName==="BODY"||ct.nodeName==="HTML"?Ze=ct:Ze.appendChild(ct);else{if(!ci&&!Ue&&!Xt&&Fe.indexOf("<")===-1)return C&&Ie?C.createHTML(Fe):Fe;if(Ze=V(Fe),!Ze)return ci?null:Ie?x:""}Ze&&ji&&N(Ze.firstChild);const nn=A($t?Fe:Ze);for(;Ht=nn.nextNode();)Ee(Ht)||(Ht.content instanceof s&&hn(Ht.content),bt(Ht));if($t)return Fe;if(ci){if(ye)for(Zt=D.call(Ze.ownerDocument);Ze.firstChild;)Zt.appendChild(Ze.firstChild);else Zt=Ze;return(de.shadowroot||de.shadowrootmode)&&(Zt=O.call(i,Zt,!0)),Zt}let ln=Xt?Ze.outerHTML:Ze.innerHTML;return Xt&&le["!doctype"]&&Ze.ownerDocument&&Ze.ownerDocument.doctype&&Ze.ownerDocument.doctype.name&&$c(n3e,Ze.ownerDocument.doctype.name)&&(ln=" +`+ln),Ue&&x4([B,G,W],Wt=>{ln=yT(ln,Wt," ")}),C&&Ie?C.createHTML(ln):ln},e.setConfig=function(){let Fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Wn(Fe),jn=!0},e.clearConfig=function(){bi=null,jn=!1},e.isValidAttribute=function(Fe,_e,Ze){bi||Wn({});const ct=dn(Fe),Ht=dn(_e);return Be(ct,Ht,Ze)},e.addHook=function(Fe,_e){typeof _e=="function"&&(M[Fe]=M[Fe]||[],bT(M[Fe],_e))},e.removeHook=function(Fe){if(M[Fe])return Uve(M[Fe])},e.removeHooks=function(Fe){M[Fe]&&(M[Fe]=[])},e.removeAllHooks=function(){M={}},e}var am=i3e();am.version;am.isSupported;const r3e=am.sanitize;am.setConfig;am.clearConfig;am.isValidAttribute;const s3e=am.addHook,o3e=am.removeHook;am.removeHooks;am.removeAllHooks;var sn;(function(n){n.inMemory="inmemory",n.vscode="vscode",n.internal="private",n.walkThrough="walkThrough",n.walkThroughSnippet="walkThroughSnippet",n.http="http",n.https="https",n.file="file",n.mailto="mailto",n.untitled="untitled",n.data="data",n.command="command",n.vscodeRemote="vscode-remote",n.vscodeRemoteResource="vscode-remote-resource",n.vscodeManagedRemoteResource="vscode-managed-remote-resource",n.vscodeUserData="vscode-userdata",n.vscodeCustomEditor="vscode-custom-editor",n.vscodeNotebookCell="vscode-notebook-cell",n.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",n.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",n.vscodeNotebookCellOutput="vscode-notebook-cell-output",n.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",n.vscodeNotebookMetadata="vscode-notebook-metadata",n.vscodeInteractiveInput="vscode-interactive-input",n.vscodeSettings="vscode-settings",n.vscodeWorkspaceTrust="vscode-workspace-trust",n.vscodeTerminal="vscode-terminal",n.vscodeChatCodeBlock="vscode-chat-code-block",n.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",n.vscodeChatSesssion="vscode-chat-editor",n.webviewPanel="webview-panel",n.vscodeWebview="vscode-webview",n.extension="extension",n.vscodeFileResource="vscode-file",n.tmp="tmp",n.vsls="vsls",n.vscodeSourceControl="vscode-scm",n.commentsInput="comment",n.codeSetting="code-setting",n.outputChannel="output"})(sn||(sn={}));function O$(n,e){return Pt.isUri(n)?bS(n.scheme,e):Lae(n,e+":")}function mX(n,...e){return e.some(t=>O$(n,t))}const r0t="tkn";class s0t{constructor(){this._hosts=Object.create(null),this._ports=Object.create(null),this._connectionTokens=Object.create(null),this._preferredWebSchema="http",this._delegate=null,this._serverRootPath="/"}setPreferredWebSchema(e){this._preferredWebSchema=e}get _remoteResourcesPath(){return Ms.join(this._serverRootPath,sn.vscodeRemoteResource)}rewrite(e){if(this._delegate)try{return this._delegate(e)}catch(a){return rn(a),e}const t=e.authority;let i=this._hosts[t];i&&i.indexOf(":")!==-1&&i.indexOf("[")===-1&&(i=`[${i}]`);const r=this._ports[t],s=this._connectionTokens[t];let o=`path=${encodeURIComponent(e.path)}`;return typeof s=="string"&&(o+=`&${r0t}=${encodeURIComponent(s)}`),Pt.from({scheme:pC?this._preferredWebSchema:sn.vscodeRemoteResource,authority:`${i}:${r}`,path:this._remoteResourcesPath,query:o})}}const a3e=new s0t,o0t="vscode-app";class j6{static{this.FALLBACK_AUTHORITY=o0t}asBrowserUri(e){const t=this.toUri(e);return this.uriToBrowserUri(t)}uriToBrowserUri(e){return e.scheme===sn.vscodeRemote?a3e.rewrite(e):e.scheme===sn.file&&(hg||fpt===`${sn.vscodeFileResource}://${j6.FALLBACK_AUTHORITY}`)?e.with({scheme:sn.vscodeFileResource,authority:e.authority||j6.FALLBACK_AUTHORITY,query:null,fragment:null}):e}toUri(e,t){if(Pt.isUri(e))return e;if(globalThis._VSCODE_FILE_ROOT){const i=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(i))return Pt.joinPath(Pt.parse(i,!0),e);const r=Fmt(i,e);return Pt.file(r)}return Pt.parse(t.toUrl(e))}}const M$=new j6;var _X;(function(n){const e=new Map([["1",{"Cross-Origin-Opener-Policy":"same-origin"}],["2",{"Cross-Origin-Embedder-Policy":"require-corp"}],["3",{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp"}]]);n.CoopAndCoep=Object.freeze(e.get("3"));const t="vscode-coi";function i(s){let o;typeof s=="string"?o=new URL(s).searchParams:s instanceof URL?o=s.searchParams:Pt.isUri(s)&&(o=new URL(s.toString(!0)).searchParams);const a=o?.get(t);if(a)return e.get(a)}n.getHeadersFromQuery=i;function r(s,o,a){if(!globalThis.crossOriginIsolated)return;const l=o&&a?"3":a?"2":"1";s instanceof URLSearchParams?s.set(t,l):s[t]=l}n.addSearchParam=r})(_X||(_X={}));function F$(n){return B$(n,0)}function B$(n,e){switch(typeof n){case"object":return n===null?d_(349,e):Array.isArray(n)?l0t(n,e):c0t(n,e);case"string":return Fae(n,e);case"boolean":return a0t(n,e);case"number":return d_(n,e);case"undefined":return d_(937,e);default:return d_(617,e)}}function d_(n,e){return(e<<5)-e+n|0}function a0t(n,e){return d_(n?433:863,e)}function Fae(n,e){e=d_(149417,e);for(let t=0,i=n.length;tB$(i,t),e)}function c0t(n,e){return e=d_(181387,e),Object.keys(n).sort().reduce((t,i)=>(t=Fae(i,t),B$(n[i],t)),e)}function yj(n,e,t=32){const i=t-e,r=~((1<>>i)>>>0}function Xve(n,e=0,t=n.byteLength,i=0){for(let r=0;rt.toString(16).padStart(2,"0")).join(""):u0t((n>>>0).toString(16),e/4)}class Bae{static{this._bigBlock32=new DataView(new ArrayBuffer(320))}constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){const t=e.length;if(t===0)return;const i=this._buff;let r=this._buffLen,s=this._leftoverHighSurrogate,o,a;for(s!==0?(o=s,a=-1,s=0):(o=e.charCodeAt(0),a=0);;){let l=o;if(Co(o))if(a+1>>6,e[t++]=128|(i&63)>>>0):i<65536?(e[t++]=224|(i&61440)>>>12,e[t++]=128|(i&4032)>>>6,e[t++]=128|(i&63)>>>0):(e[t++]=240|(i&1835008)>>>18,e[t++]=128|(i&258048)>>>12,e[t++]=128|(i&4032)>>>6,e[t++]=128|(i&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),ST(this._h0)+ST(this._h1)+ST(this._h2)+ST(this._h3)+ST(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Xve(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Xve(this._buff));const e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){const e=Bae._bigBlock32,t=this._buffDV;for(let d=0;d<64;d+=4)e.setUint32(d,t.getUint32(d,!1),!1);for(let d=64;d<320;d+=4)e.setUint32(d,yj(e.getUint32(d-12,!1)^e.getUint32(d-32,!1)^e.getUint32(d-56,!1)^e.getUint32(d-64,!1),1),!1);let i=this._h0,r=this._h1,s=this._h2,o=this._h3,a=this._h4,l,c,u;for(let d=0;d<80;d++)d<20?(l=r&s|~r&o,c=1518500249):d<40?(l=r^s^o,c=1859775393):d<60?(l=r&s|r&o|s&o,c=2400959708):(l=r^s^o,c=3395469782),u=yj(i,5)+l+a+c+e.getUint32(d*4,!1)&4294967295,a=o,o=s,s=yj(r,30),r=i,i=u;this._h0=this._h0+i&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}}const{registerWindow:JFn,getWindow:Ot,getDocument:e6n,getWindows:l3e,getWindowsCount:d0t,getWindowId:q6,getWindowById:Qve,hasWindow:t6n,onDidRegisterWindow:$$,onWillUnregisterWindow:h0t,onDidUnregisterWindow:f0t}=function(){const n=new Map;i_t(Xi,1);const e={window:Xi,disposables:new ke};n.set(Xi.vscodeWindowId,e);const t=new fe,i=new fe,r=new fe;function s(o,a){return(typeof o=="number"?n.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(o){if(n.has(o.vscodeWindowId))return me.None;const a=new ke,l={window:o,disposables:a.add(new ke)};return n.set(o.vscodeWindowId,l),a.add(Lt(()=>{n.delete(o.vscodeWindowId),i.fire(o)})),a.add(Ce(o,je.BEFORE_UNLOAD,()=>{r.fire(o)})),t.fire(l),a},getWindows(){return n.values()},getWindowsCount(){return n.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return n.has(o)},getWindowById:s,getWindow(o){const a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;const l=o;return l?.view?l.view.window:Xi},getDocument(o){return Ot(o).document}}}();function Jo(n){for(;n.firstChild;)n.firstChild.remove()}class g0t{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}}function Ce(n,e,t,i){return new g0t(n,e,t,i)}function c3e(n,e){return function(t){return e(new qh(n,t))}}function p0t(n){return function(e){return n(new or(e))}}const Jr=function(e,t,i,r){let s=i;return t==="click"||t==="mousedown"||t==="contextmenu"?s=c3e(Ot(e),i):(t==="keydown"||t==="keypress"||t==="keyup")&&(s=p0t(i)),Ce(e,t,s,r)},m0t=function(e,t,i){const r=c3e(Ot(e),t);return _0t(e,r,i)};function _0t(n,e,t){return Ce(n,Sg&&Pae.pointerEvents?je.POINTER_DOWN:je.MOUSE_DOWN,e,t)}function xD(n,e,t){return pI(n,e,t)}class wj extends Q4e{constructor(e,t){super(e,t)}}let K6,du;class $ae extends Mae{constructor(e){super(),this.defaultTarget=e&&Ot(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}}class Cj{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){rn(e)}}static sort(e,t){return t.priority-e.priority}}(function(){const n=new Map,e=new Map,t=new Map,i=new Map,r=s=>{t.set(s,!1);const o=n.get(s)??[];for(e.set(s,o),n.set(s,[]),i.set(s,!0);o.length>0;)o.sort(Cj.sort),o.shift().execute();i.set(s,!1)};du=(s,o,a=0)=>{const l=q6(s),c=new Cj(o,a);let u=n.get(l);return u||(u=[],n.set(l,u)),u.push(c),t.get(l)||(t.set(l,!0),s.requestAnimationFrame(()=>r(l))),c},K6=(s,o,a)=>{const l=q6(s);if(i.get(l)){const c=new Cj(o,a);let u=e.get(l);return u||(u=[],e.set(l,u)),u.push(c),c}else return du(s,o,a)}})();function W$(n){return Ot(n).getComputedStyle(n,null)}function kb(n,e){const t=Ot(n),i=t.document;if(n!==i.body)return new vi(n.clientWidth,n.clientHeight);if(Sg&&t?.visualViewport)return new vi(t.visualViewport.width,t.visualViewport.height);if(t?.innerWidth&&t.innerHeight)return new vi(t.innerWidth,t.innerHeight);if(i.body&&i.body.clientWidth&&i.body.clientHeight)return new vi(i.body.clientWidth,i.body.clientHeight);if(i.documentElement&&i.documentElement.clientWidth&&i.documentElement.clientHeight)return new vi(i.documentElement.clientWidth,i.documentElement.clientHeight);throw new Error("Unable to figure out browser width and height")}class ws{static convertToPixels(e,t){return parseFloat(t)||0}static getDimension(e,t,i){const r=W$(e),s=r?r.getPropertyValue(t):"0";return ws.convertToPixels(e,s)}static getBorderLeftWidth(e){return ws.getDimension(e,"border-left-width","borderLeftWidth")}static getBorderRightWidth(e){return ws.getDimension(e,"border-right-width","borderRightWidth")}static getBorderTopWidth(e){return ws.getDimension(e,"border-top-width","borderTopWidth")}static getBorderBottomWidth(e){return ws.getDimension(e,"border-bottom-width","borderBottomWidth")}static getPaddingLeft(e){return ws.getDimension(e,"padding-left","paddingLeft")}static getPaddingRight(e){return ws.getDimension(e,"padding-right","paddingRight")}static getPaddingTop(e){return ws.getDimension(e,"padding-top","paddingTop")}static getPaddingBottom(e){return ws.getDimension(e,"padding-bottom","paddingBottom")}static getMarginLeft(e){return ws.getDimension(e,"margin-left","marginLeft")}static getMarginTop(e){return ws.getDimension(e,"margin-top","marginTop")}static getMarginRight(e){return ws.getDimension(e,"margin-right","marginRight")}static getMarginBottom(e){return ws.getDimension(e,"margin-bottom","marginBottom")}}class vi{static{this.None=new vi(0,0)}constructor(e,t){this.width=e,this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new vi(e,t):this}static is(e){return typeof e=="object"&&typeof e.height=="number"&&typeof e.width=="number"}static lift(e){return e instanceof vi?e:new vi(e.width,e.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}}function u3e(n){let e=n.offsetParent,t=n.offsetTop,i=n.offsetLeft;for(;(n=n.parentNode)!==null&&n!==n.ownerDocument.body&&n!==n.ownerDocument.documentElement;){t-=n.scrollTop;const r=h3e(n)?null:W$(n);r&&(i-=r.direction!=="rtl"?n.scrollLeft:-n.scrollLeft),n===e&&(i+=ws.getBorderLeftWidth(n),t+=ws.getBorderTopWidth(n),t+=n.offsetTop,i+=n.offsetLeft,e=n.offsetParent)}return{left:i,top:t}}function v0t(n,e,t){typeof e=="number"&&(n.style.width=`${e}px`),typeof t=="number"&&(n.style.height=`${t}px`)}function ms(n){const e=n.getBoundingClientRect(),t=Ot(n);return{left:e.left+t.scrollX,top:e.top+t.scrollY,width:e.width,height:e.height}}function d3e(n){let e=n,t=1;do{const i=W$(e).zoom;i!=null&&i!=="1"&&(t*=i),e=e.parentElement}while(e!==null&&e!==e.ownerDocument.documentElement);return t}function qc(n){const e=ws.getMarginLeft(n)+ws.getMarginRight(n);return n.offsetWidth+e}function xj(n){const e=ws.getBorderLeftWidth(n)+ws.getBorderRightWidth(n),t=ws.getPaddingLeft(n)+ws.getPaddingRight(n);return n.offsetWidth-e-t}function b0t(n){const e=ws.getBorderTopWidth(n)+ws.getBorderBottomWidth(n),t=ws.getPaddingTop(n)+ws.getPaddingBottom(n);return n.offsetHeight-e-t}function h_(n){const e=ws.getMarginTop(n)+ws.getMarginBottom(n);return n.offsetHeight+e}function xo(n,e){return!!e?.contains(n)}function y0t(n,e,t){for(;n&&n.nodeType===n.ELEMENT_NODE;){if(n.classList.contains(e))return n;if(t){if(typeof t=="string"){if(n.classList.contains(t))return null}else if(n===t)return null}n=n.parentNode}return null}function Sj(n,e,t){return!!y0t(n,e,t)}function h3e(n){return n&&!!n.host&&!!n.mode}function G6(n){return!!Iw(n)}function Iw(n){for(;n.parentNode;){if(n===n.ownerDocument?.body)return null;n=n.parentNode}return h3e(n)?n:null}function ka(){let n=GL().activeElement;for(;n?.shadowRoot;)n=n.shadowRoot.activeElement;return n}function H$(n){return ka()===n}function f3e(n){return xo(ka(),n)}function GL(){return d0t()<=1?Xi.document:Array.from(l3e()).map(({window:e})=>e.document).find(e=>e.hasFocus())??Xi.document}function SD(){return GL().defaultView?.window??Xi}const Wae=new Map;function g3e(){return new w0t}class w0t{constructor(){this._currentCssStyle="",this._styleSheet=void 0}setStyle(e){e!==this._currentCssStyle&&(this._currentCssStyle=e,this._styleSheet?this._styleSheet.innerText=e:this._styleSheet=id(Xi.document.head,t=>t.innerText=e))}dispose(){this._styleSheet&&(this._styleSheet.remove(),this._styleSheet=void 0)}}function id(n=Xi.document.head,e,t){const i=document.createElement("style");if(i.type="text/css",i.media="screen",e?.(i),n.appendChild(i),t&&t.add(Lt(()=>i.remove())),n===Xi.document.head){const r=new Set;Wae.set(i,r);for(const{window:s,disposables:o}of l3e()){if(s===Xi)continue;const a=o.add(C0t(i,r,s));t?.add(a)}}return i}function C0t(n,e,t){const i=new ke,r=n.cloneNode(!0);t.document.head.appendChild(r),i.add(Lt(()=>r.remove()));for(const s of m3e(n))r.sheet?.insertRule(s.cssText,r.sheet?.cssRules.length);return i.add(x0t.observe(n,i,{childList:!0})(()=>{r.textContent=n.textContent})),e.add(r),i.add(Lt(()=>e.delete(r))),i}const x0t=new class{constructor(){this.mutationObservers=new Map}observe(n,e,t){let i=this.mutationObservers.get(n);i||(i=new Map,this.mutationObservers.set(n,i));const r=F$(t);let s=i.get(r);if(s)s.users+=1;else{const o=new fe,a=new MutationObserver(c=>o.fire(c));a.observe(n,t);const l=s={users:1,observer:a,onDidMutate:o.event};e.add(Lt(()=>{l.users-=1,l.users===0&&(o.dispose(),a.disconnect(),i?.delete(r),i?.size===0&&this.mutationObservers.delete(n))})),i.set(r,s)}return s.onDidMutate}};let kj=null;function p3e(){return kj||(kj=id()),kj}function m3e(n){return n?.sheet?.rules?n.sheet.rules:n?.sheet?.cssRules?n.sheet.cssRules:[]}function Y6(n,e,t=p3e()){if(!(!t||!e)){t.sheet?.insertRule(`${n} {${e}}`,0);for(const i of Wae.get(t)??[])Y6(n,e,i)}}function vX(n,e=p3e()){if(!e)return;const t=m3e(e),i=[];for(let r=0;r=0;r--)e.sheet?.deleteRule(i[r]);for(const r of Wae.get(e)??[])vX(n,r)}function S0t(n){return typeof n.selectorText=="string"}function Eo(n){return n instanceof HTMLElement||n instanceof Ot(n).HTMLElement}function Jve(n){return n instanceof HTMLAnchorElement||n instanceof Ot(n).HTMLAnchorElement}function k0t(n){return n instanceof SVGElement||n instanceof Ot(n).SVGElement}function Hae(n){return n instanceof MouseEvent||n instanceof Ot(n).MouseEvent}function Jm(n){return n instanceof KeyboardEvent||n instanceof Ot(n).KeyboardEvent}const je={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Ky?"webkitAnimationStart":"animationstart",ANIMATION_END:Ky?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Ky?"webkitAnimationIteration":"animationiteration"};function E0t(n){const e=n;return!!(e&&typeof e.preventDefault=="function"&&typeof e.stopPropagation=="function")}const Hn={stop:(n,e)=>(n.preventDefault(),e&&n.stopPropagation(),n)};function L0t(n){const e=[];for(let t=0;n&&n.nodeType===n.ELEMENT_NODE;t++)e[t]=n.scrollTop,n=n.parentNode;return e}function T0t(n,e){for(let t=0;n&&n.nodeType===n.ELEMENT_NODE;t++)n.scrollTop!==e[t]&&(n.scrollTop=e[t]),n=n.parentNode}class Z6 extends me{static hasFocusWithin(e){if(Eo(e)){const t=Iw(e),i=t?t.activeElement:e.ownerDocument.activeElement;return xo(i,e)}else{const t=e;return xo(t.document.activeElement,t.document)}}constructor(e){super(),this._onDidFocus=this._register(new fe),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new fe),this.onDidBlur=this._onDidBlur.event;let t=Z6.hasFocusWithin(e),i=!1;const r=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},s=()=>{t&&(i=!0,(Eo(e)?Ot(e):e).setTimeout(()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{Z6.hasFocusWithin(e)!==t&&(t?s():r())},this._register(Ce(e,je.FOCUS,r,!0)),this._register(Ce(e,je.BLUR,s,!0)),Eo(e)&&(this._register(Ce(e,je.FOCUS_IN,()=>this._refreshStateHandler())),this._register(Ce(e,je.FOCUS_OUT,()=>this._refreshStateHandler())))}}function Eg(n){return new Z6(n)}function D0t(n,e){return n.after(e),e}function Ne(n,...e){if(n.append(...e),e.length===1&&typeof e[0]!="string")return e[0]}function Vae(n,e){return n.insertBefore(e,n.firstChild),e}function ea(n,...e){n.innerText="",Ne(n,...e)}const I0t=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var lN;(function(n){n.HTML="http://www.w3.org/1999/xhtml",n.SVG="http://www.w3.org/2000/svg"})(lN||(lN={}));function _3e(n,e,t,...i){const r=I0t.exec(e);if(!r)throw new Error("Bad use of emmet");const s=r[1]||"div";let o;return n!==lN.HTML?o=document.createElementNS(n,s):o=document.createElement(s),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),t&&Object.entries(t).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?o[a]=l:a==="selected"?l&&o.setAttribute(a,"true"):o.setAttribute(a,l))}),o.append(...i),o}function qe(n,e,...t){return _3e(lN.HTML,n,e,...t)}qe.SVG=function(n,e,...t){return _3e(lN.SVG,n,e,...t)};function A0t(n,...e){n?Qc(...e):Al(...e)}function Qc(...n){for(const e of n)e.style.display="",e.removeAttribute("aria-hidden")}function Al(...n){for(const e of n)e.style.display="none",e.setAttribute("aria-hidden","true")}function ebe(n,e){const t=n.devicePixelRatio*e;return Math.max(1,Math.floor(t))/n.devicePixelRatio}function v3e(n){Xi.open(n,"_blank","noopener")}function N0t(n,e){const t=()=>{e(),i=du(n,t)};let i=du(n,t);return Lt(()=>i.dispose())}a3e.setPreferredWebSchema(/^https:/.test(Xi.location.href)?"https":"http");function Z_(n){return n?`url('${M$.uriToBrowserUri(n).toString(!0).replace(/'/g,"%27")}')`:"url('')"}function Ej(n){return`'${n.replace(/'/g,"%27")}'`}function A_(n,e){if(n!==void 0){const t=n.match(/^\s*var\((.+)\)$/);if(t){const i=t[1].split(",",2);return i.length===2&&(e=A_(i[1].trim(),e)),`var(${i[0]}, ${e})`}return n}return e}function R0t(n,e=!1){const t=document.createElement("a");return s3e("afterSanitizeAttributes",i=>{for(const r of["href","src"])if(i.hasAttribute(r)){const s=i.getAttribute(r);if(r==="href"&&s.startsWith("#"))continue;if(t.href=s,!n.includes(t.protocol.replace(/:$/,""))){if(e&&r==="src"&&t.href.startsWith("data:"))continue;i.removeAttribute(r)}}}),Lt(()=>{o3e("afterSanitizeAttributes")})}const P0t=Object.freeze(["a","abbr","b","bdo","blockquote","br","caption","cite","code","col","colgroup","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","label","li","mark","ol","p","pre","q","rp","rt","ruby","samp","small","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","tt","u","ul","var","video","wbr"]);class f_ extends fe{constructor(){super(),this._subscriptions=new ke,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(Ge.runAndSubscribe($$,({window:e,disposables:t})=>this.registerListeners(e,t),{window:Xi,disposables:this._subscriptions}))}registerListeners(e,t){t.add(Ce(e,"keydown",i=>{if(i.defaultPrevented)return;const r=new or(i);if(!(r.keyCode===6&&i.repeat)){if(i.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(i.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(i.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(i.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else if(r.keyCode!==6)this._keyStatus.lastKeyPressed=void 0;else return;this._keyStatus.altKey=i.altKey,this._keyStatus.ctrlKey=i.ctrlKey,this._keyStatus.metaKey=i.metaKey,this._keyStatus.shiftKey=i.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=i,this.fire(this._keyStatus))}},!0)),t.add(Ce(e,"keyup",i=>{i.defaultPrevented||(!i.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!i.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!i.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!i.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=i.altKey,this._keyStatus.ctrlKey=i.ctrlKey,this._keyStatus.metaKey=i.metaKey,this._keyStatus.shiftKey=i.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=i,this.fire(this._keyStatus)))},!0)),t.add(Ce(e.document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(Ce(e.document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(Ce(e.document.body,"mousemove",i=>{i.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),t.add(Ce(e,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return f_.instance||(f_.instance=new f_),f_.instance}dispose(){super.dispose(),this._subscriptions.dispose()}}class O0t extends me{constructor(e,t){super(),this.element=e,this.callbacks=t,this.counter=0,this.dragStartTime=0,this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register(Ce(this.element,je.DRAG_START,e=>{this.callbacks.onDragStart?.(e)})),this.callbacks.onDrag&&this._register(Ce(this.element,je.DRAG,e=>{this.callbacks.onDrag?.(e)})),this._register(Ce(this.element,je.DRAG_ENTER,e=>{this.counter++,this.dragStartTime=e.timeStamp,this.callbacks.onDragEnter?.(e)})),this._register(Ce(this.element,je.DRAG_OVER,e=>{e.preventDefault(),this.callbacks.onDragOver?.(e,e.timeStamp-this.dragStartTime)})),this._register(Ce(this.element,je.DRAG_LEAVE,e=>{this.counter--,this.counter===0&&(this.dragStartTime=0,this.callbacks.onDragLeave?.(e))})),this._register(Ce(this.element,je.DRAG_END,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDragEnd?.(e)})),this._register(Ce(this.element,je.DROP,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDrop?.(e)}))}}const b3e=/(?[\w\-]+)?(?:#(?[\w\-]+))?(?(?:\.(?:[\w\-]+))*)(?:@(?(?:[\w\_])+))?/;function An(n,...e){let t,i;Array.isArray(e[0])?(t={},i=e[0]):(t=e[0]||{},i=e[1]);const r=b3e.exec(n);if(!r||!r.groups)throw new Error("Bad use of h");const s=r.groups.tag||"div",o=document.createElement(s);r.groups.id&&(o.id=r.groups.id);const a=[];if(r.groups.class)for(const c of r.groups.class.split("."))c!==""&&a.push(c);if(t.className!==void 0)for(const c of t.className.split("."))c!==""&&a.push(c);a.length>0&&(o.className=a.join(" "));const l={};if(r.groups.name&&(l[r.groups.name]=o),i)for(const c of i)Eo(c)?o.appendChild(c):typeof c=="string"?o.append(c):"root"in c&&(Object.assign(l,c),o.appendChild(c.root));for(const[c,u]of Object.entries(t))if(c!=="className")if(c==="style")for(const[d,h]of Object.entries(u))o.style.setProperty(X6(d),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?o.tabIndex=u:o.setAttribute(X6(c),u.toString());return l.root=o,l}function cx(n,...e){let t,i;Array.isArray(e[0])?(t={},i=e[0]):(t=e[0]||{},i=e[1]);const r=b3e.exec(n);if(!r||!r.groups)throw new Error("Bad use of h");const s=r.groups.tag||"div",o=document.createElementNS("http://www.w3.org/2000/svg",s);r.groups.id&&(o.id=r.groups.id);const a=[];if(r.groups.class)for(const c of r.groups.class.split("."))c!==""&&a.push(c);if(t.className!==void 0)for(const c of t.className.split("."))c!==""&&a.push(c);a.length>0&&(o.className=a.join(" "));const l={};if(r.groups.name&&(l[r.groups.name]=o),i)for(const c of i)Eo(c)?o.appendChild(c):typeof c=="string"?o.append(c):"root"in c&&(Object.assign(l,c),o.appendChild(c.root));for(const[c,u]of Object.entries(t))if(c!=="className")if(c==="style")for(const[d,h]of Object.entries(u))o.style.setProperty(X6(d),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?o.tabIndex=u:o.setAttribute(X6(c),u.toString());return l.root=o,l}function X6(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}class M0t extends me{constructor(e){super(),this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._listener=()=>this._handleChange(e,!0),this._mediaQueryList=null,this._handleChange(e,!1)}_handleChange(e,t){this._mediaQueryList?.removeEventListener("change",this._listener),this._mediaQueryList=e.matchMedia(`(resolution: ${e.devicePixelRatio}dppx)`),this._mediaQueryList.addEventListener("change",this._listener),t&&this._onDidChange.fire()}}class F0t extends me{get value(){return this._value}constructor(e){super(),this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._value=this._getPixelRatio(e);const t=this._register(new M0t(e));this._register(t.onDidChange(()=>{this._value=this._getPixelRatio(e),this._onDidChange.fire(this._value)}))}_getPixelRatio(e){const t=document.createElement("canvas").getContext("2d"),i=e.devicePixelRatio||1,r=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return i/r}}class B0t{constructor(){this.mapWindowIdToPixelRatioMonitor=new Map}_getOrCreatePixelRatioMonitor(e){const t=q6(e);let i=this.mapWindowIdToPixelRatioMonitor.get(t);return i||(i=new F0t(e),this.mapWindowIdToPixelRatioMonitor.set(t,i),Ge.once(f0t)(({vscodeWindowId:r})=>{r===t&&(i?.dispose(),this.mapWindowIdToPixelRatioMonitor.delete(t))})),i}getInstance(e){return this._getOrCreatePixelRatioMonitor(e)}}const cN=new B0t;class y3e{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingLeft="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){const t=kf(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){const t=kf(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){const t=kf(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){const t=kf(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){const t=kf(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){const t=kf(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){const t=kf(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingLeft(e){const t=kf(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){const t=kf(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){const t=kf(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){const t=kf(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}}function kf(n){return typeof n=="number"?`${n}px`:n}function Ci(n){return new y3e(n)}function ta(n,e){n instanceof y3e?(n.setFontFamily(e.getMassagedFontFamily()),n.setFontWeight(e.fontWeight),n.setFontSize(e.fontSize),n.setFontFeatureSettings(e.fontFeatureSettings),n.setFontVariationSettings(e.fontVariationSettings),n.setLineHeight(e.lineHeight),n.setLetterSpacing(e.letterSpacing)):(n.style.fontFamily=e.getMassagedFontFamily(),n.style.fontWeight=e.fontWeight,n.style.fontSize=e.fontSize+"px",n.style.fontFeatureSettings=e.fontFeatureSettings,n.style.fontVariationSettings=e.fontVariationSettings,n.style.lineHeight=e.lineHeight+"px",n.style.letterSpacing=e.letterSpacing+"px")}class $0t{constructor(e,t){this.chr=e,this.type=t,this.width=0}fulfill(e){this.width=e}}class zae{constructor(e,t){this._bareFontInfo=e,this._requests=t,this._container=null,this._testElements=null}read(e){this._createDomElements(),e.document.body.appendChild(this._container),this._readFromDomElements(),this._container?.remove(),this._container=null,this._testElements=null}_createDomElements(){const e=document.createElement("div");e.style.position="absolute",e.style.top="-50000px",e.style.width="50000px";const t=document.createElement("div");ta(t,this._bareFontInfo),e.appendChild(t);const i=document.createElement("div");ta(i,this._bareFontInfo),i.style.fontWeight="bold",e.appendChild(i);const r=document.createElement("div");ta(r,this._bareFontInfo),r.style.fontStyle="italic",e.appendChild(r);const s=[];for(const o of this._requests){let a;o.type===0&&(a=t),o.type===2&&(a=i),o.type===1&&(a=r),a.appendChild(document.createElement("br"));const l=document.createElement("span");zae._render(l,o),a.appendChild(l),s.push(l)}this._container=e,this._testElements=s}static _render(e,t){if(t.chr===" "){let i=" ";for(let r=0;r<8;r++)i+=i;e.innerText=i}else{let i=t.chr;for(let r=0;r<8;r++)i+=i;e.textContent=i}}_readFromDomElements(){for(let e=0,t=this._requests.length;e{this._evictUntrustedReadingsTimeout=-1,this._evictUntrustedReadings(e)},5e3))}_evictUntrustedReadings(e){const t=this._ensureCache(e),i=t.getValues();let r=!1;for(const s of i)s.isTrusted||(r=!0,t.remove(s));r&&this._onDidChange.fire()}readFontInfo(e,t){const i=this._ensureCache(e);if(!i.has(t)){let r=this._actualReadFontInfo(e,t);(r.typicalHalfwidthCharacterWidth<=2||r.typicalFullwidthCharacterWidth<=2||r.spaceWidth<=2||r.maxDigitWidth<=2)&&(r=new bX({pixelRatio:cN.getInstance(e).value,fontFamily:r.fontFamily,fontWeight:r.fontWeight,fontSize:r.fontSize,fontFeatureSettings:r.fontFeatureSettings,fontVariationSettings:r.fontVariationSettings,lineHeight:r.lineHeight,letterSpacing:r.letterSpacing,isMonospace:r.isMonospace,typicalHalfwidthCharacterWidth:Math.max(r.typicalHalfwidthCharacterWidth,5),typicalFullwidthCharacterWidth:Math.max(r.typicalFullwidthCharacterWidth,5),canUseHalfwidthRightwardsArrow:r.canUseHalfwidthRightwardsArrow,spaceWidth:Math.max(r.spaceWidth,5),middotWidth:Math.max(r.middotWidth,5),wsmiddotWidth:Math.max(r.wsmiddotWidth,5),maxDigitWidth:Math.max(r.maxDigitWidth,5)},!1)),this._writeToCache(e,t,r)}return i.get(t)}_createRequest(e,t,i,r){const s=new $0t(e,t);return i.push(s),r?.push(s),s}_actualReadFontInfo(e,t){const i=[],r=[],s=this._createRequest("n",0,i,r),o=this._createRequest("m",0,i,null),a=this._createRequest(" ",0,i,r),l=this._createRequest("0",0,i,r),c=this._createRequest("1",0,i,r),u=this._createRequest("2",0,i,r),d=this._createRequest("3",0,i,r),h=this._createRequest("4",0,i,r),f=this._createRequest("5",0,i,r),g=this._createRequest("6",0,i,r),p=this._createRequest("7",0,i,r),m=this._createRequest("8",0,i,r),_=this._createRequest("9",0,i,r),v=this._createRequest("→",0,i,r),y=this._createRequest("→",0,i,null),C=this._createRequest("·",0,i,r),x=this._createRequest("⸱",0,i,null),k="|/-_ilm%";for(let M=0,B=k.length;M.001){D=!1;break}}let O=!0;return D&&y.width!==I&&(O=!1),y.width>v.width&&(O=!1),new bX({pixelRatio:cN.getInstance(e).value,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFeatureSettings:t.fontFeatureSettings,fontVariationSettings:t.fontVariationSettings,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,isMonospace:D,typicalHalfwidthCharacterWidth:s.width,typicalFullwidthCharacterWidth:o.width,canUseHalfwidthRightwardsArrow:O,spaceWidth:a.width,middotWidth:C.width,wsmiddotWidth:x.width,maxDigitWidth:L},!0)}}class U0t{constructor(){this._keys=Object.create(null),this._values=Object.create(null)}has(e){const t=e.getId();return!!this._values[t]}get(e){const t=e.getId();return this._values[t]}put(e,t){const i=e.getId();this._keys[i]=e,this._values[i]=t}remove(e){const t=e.getId();delete this._keys[t],delete this._values[t]}getValues(){return Object.keys(this._keys).map(e=>this._values[e])}}const yX=new z0t;var rg;(function(n){n.serviceIds=new Map,n.DI_TARGET="$di$target",n.DI_DEPENDENCIES="$di$dependencies";function e(t){return t[n.DI_DEPENDENCIES]||[]}n.getServiceDependencies=e})(rg||(rg={}));const Tt=On("instantiationService");function j0t(n,e,t){e[rg.DI_TARGET]===e?e[rg.DI_DEPENDENCIES].push({id:n,index:t}):(e[rg.DI_DEPENDENCIES]=[{id:n,index:t}],e[rg.DI_TARGET]=e)}function On(n){if(rg.serviceIds.has(n))return rg.serviceIds.get(n);const e=function(t,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");j0t(e,t,r)};return e.toString=()=>n,rg.serviceIds.set(n,e),e}const ai=On("codeEditorService"),Sr=On("modelService"),Nc=On("textModelService");let su=class extends me{constructor(e,t="",i="",r=!0,s){super(),this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=e,this._label=t,this._cssClass=i,this._enabled=r,this._actionCallback=s}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}async run(e,t){this._actionCallback&&await this._actionCallback(e)}};class Aw extends me{constructor(){super(...arguments),this._onWillRun=this._register(new fe),this.onWillRun=this._onWillRun.event,this._onDidRun=this._register(new fe),this.onDidRun=this._onDidRun.event}async run(e,t){if(!e.enabled)return;this._onWillRun.fire({action:e});let i;try{await this.runAction(e,t)}catch(r){i=r}this._onDidRun.fire({action:e,error:i})}async runAction(e,t){await e.run(t)}}let na=class wX{constructor(){this.id=wX.ID,this.label="",this.tooltip="",this.class="separator",this.enabled=!1,this.checked=!1}static join(...e){let t=[];for(const i of e)i.length&&(t.length?t=[...t,new wX,...i]:t=i);return t}static{this.ID="vs.actions.separator"}async run(){}};class rE{get actions(){return this._actions}constructor(e,t,i,r){this.tooltip="",this.enabled=!0,this.checked=void 0,this.id=e,this.label=t,this.class=r,this._actions=i}async run(){}}class Uae extends su{static{this.ID="vs.actions.empty"}constructor(){super(Uae.ID,w("submenu.empty","(empty)"),void 0,!1)}}function Yy(n){return{id:n.id,label:n.label,tooltip:n.tooltip??n.label,class:n.class,enabled:n.enabled??!0,checked:n.checked,run:async(...e)=>n.run(...e)}}var CX;(function(n){function e(t){return t&&typeof t=="object"&&typeof t.id=="string"}n.isThemeColor=e})(CX||(CX={}));var zt;(function(n){n.iconNameSegment="[A-Za-z0-9]+",n.iconNameExpression="[A-Za-z0-9-]+",n.iconModifierExpression="~[A-Za-z]+",n.iconNameCharacter="[A-Za-z0-9~-]";const e=new RegExp(`^(${n.iconNameExpression})(${n.iconModifierExpression})?$`);function t(h){const f=e.exec(h.id);if(!f)return t(ze.error);const[,g,p]=f,m=["codicon","codicon-"+g];return p&&m.push("codicon-modifier-"+p.substring(1)),m}n.asClassNameArray=t;function i(h){return t(h).join(" ")}n.asClassName=i;function r(h){return"."+t(h).join(".")}n.asCSSSelector=r;function s(h){return h&&typeof h=="object"&&typeof h.id=="string"&&(typeof h.color>"u"||CX.isThemeColor(h.color))}n.isThemeIcon=s;const o=new RegExp(`^\\$\\((${n.iconNameExpression}(?:${n.iconModifierExpression})?)\\)$`);function a(h){const f=o.exec(h);if(!f)return;const[,g]=f;return{id:g}}n.fromString=a;function l(h){return{id:h}}n.fromId=l;function c(h,f){let g=h.id;const p=g.lastIndexOf("~");return p!==-1&&(g=g.substring(0,p)),f&&(g=`${g}~${f}`),{id:g}}n.modify=c;function u(h){const f=h.id.lastIndexOf("~");if(f!==-1)return h.id.substring(f+1)}n.getModifier=u;function d(h,f){return h.id===f.id&&h.color?.id===f.color?.id}n.isEqual=d})(zt||(zt={}));const _r=On("commandService"),Un=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new fe,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(n,e){if(!n)throw new Error("invalid command");if(typeof n=="string"){if(!e)throw new Error("invalid command");return this.registerCommand({id:n,handler:e})}if(n.metadata&&Array.isArray(n.metadata.args)){const o=[];for(const l of n.metadata.args)o.push(l.constraint);const a=n.handler;n.handler=function(l,...c){return ipt(c,o),a(l,...c)}}const{id:t}=n;let i=this._commands.get(t);i||(i=new Rl,this._commands.set(t,i));const r=i.unshift(n),s=Lt(()=>{r(),this._commands.get(t)?.isEmpty()&&this._commands.delete(t)});return this._onDidRegisterCommand.fire(t),s}registerCommandAlias(n,e){return Un.registerCommand(n,(t,...i)=>t.get(_r).executeCommand(e,...i))}getCommand(n){const e=this._commands.get(n);if(!(!e||e.isEmpty()))return zn.first(e)}getCommands(){const n=new Map;for(const e of this._commands.keys()){const t=this.getCommand(e);t&&n.set(e,t)}return n}};Un.registerCommand("noop",()=>{});function Tj(...n){switch(n.length){case 1:return w("contextkey.scanner.hint.didYouMean1","Did you mean {0}?",n[0]);case 2:return w("contextkey.scanner.hint.didYouMean2","Did you mean {0} or {1}?",n[0],n[1]);case 3:return w("contextkey.scanner.hint.didYouMean3","Did you mean {0}, {1} or {2}?",n[0],n[1],n[2]);default:return}}const q0t=w("contextkey.scanner.hint.didYouForgetToOpenOrCloseQuote","Did you forget to open or close the quote?"),K0t=w("contextkey.scanner.hint.didYouForgetToEscapeSlash","Did you forget to escape the '/' (slash) character? Put two backslashes before it to escape, e.g., '\\\\/'.");let kT=class xX{constructor(){this._input="",this._start=0,this._current=0,this._tokens=[],this._errors=[],this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(e){switch(e.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return e.isTripleEq?"===":"==";case 4:return e.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return e.lexeme;case 11:return"true";case 12:return"false";case 13:return"in";case 14:return"not";case 15:return"&&";case 16:return"||";case 17:return e.lexeme;case 18:return e.lexeme;case 19:return e.lexeme;case 20:return"EOF";default:throw bae(`unhandled token type: ${JSON.stringify(e)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(e=>e.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}reset(e){return this._input=e,this._start=0,this._current=0,this._tokens=[],this._errors=[],this}scan(){for(;!this._isAtEnd();)switch(this._start=this._current,this._advance()){case 40:this._addToken(0);break;case 41:this._addToken(1);break;case 33:if(this._match(61)){const t=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:t})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){const t=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:t})}else this._match(126)?this._addToken(9):this._error(Tj("==","=~"));break;case 60:this._addToken(this._match(61)?6:5);break;case 62:this._addToken(this._match(61)?8:7);break;case 38:this._match(38)?this._addToken(15):this._error(Tj("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(Tj("||"));break;case 32:case 13:case 9:case 10:case 160:break;default:this._string()}return this._start=this._current,this._addToken(20),Array.from(this._tokens)}_match(e){return this._isAtEnd()||this._input.charCodeAt(this._current)!==e?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(e){this._tokens.push({type:e,offset:this._start})}_error(e){const t=this._start,i=this._input.substring(this._start,this._current),r={type:19,offset:this._start,lexeme:i};this._errors.push({offset:t,lexeme:i,additionalInfo:e}),this._tokens.push(r)}_string(){this.stringRe.lastIndex=this._start;const e=this.stringRe.exec(this._input);if(e){this._current=this._start+e[0].length;const t=this._input.substring(this._start,this._current),i=xX._keywords.get(t);i?this._addToken(i):this._tokens.push({type:17,lexeme:t,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(q0t);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let e=this._current,t=!1,i=!1;for(;;){if(e>=this._input.length){this._current=e,this._error(K0t);return}const s=this._input.charCodeAt(e);if(t)t=!1;else if(s===47&&!i){e++;break}else s===91?i=!0:s===92?t=!0:s===93&&(i=!1);e++}for(;e=this._input.length}};const Ya=new Map;Ya.set("false",!1);Ya.set("true",!0);Ya.set("isMac",Rn);Ya.set("isLinux",zl);Ya.set("isWindows",Ta);Ya.set("isWeb",pC);Ya.set("isMacNative",Rn&&!pC);Ya.set("isEdge",vpt);Ya.set("isFirefox",mpt);Ya.set("isChrome",v4e);Ya.set("isSafari",_pt);const G0t=Object.prototype.hasOwnProperty,Y0t={regexParsingWithErrorRecovery:!0},Z0t=w("contextkey.parser.error.emptyString","Empty context key expression"),X0t=w("contextkey.parser.error.emptyString.hint","Did you forget to write an expression? You can also put 'false' or 'true' to always evaluate to false or true, respectively."),Q0t=w("contextkey.parser.error.noInAfterNot","'in' after 'not'."),tbe=w("contextkey.parser.error.closingParenthesis","closing parenthesis ')'"),J0t=w("contextkey.parser.error.unexpectedToken","Unexpected token"),evt=w("contextkey.parser.error.unexpectedToken.hint","Did you forget to put && or || before the token?"),tvt=w("contextkey.parser.error.unexpectedEOF","Unexpected end of expression"),nvt=w("contextkey.parser.error.unexpectedEOF.hint","Did you forget to put a context key?");let ivt=class kD{static{this._parseError=new Error}constructor(e=Y0t){this._config=e,this._scanner=new kT,this._tokens=[],this._current=0,this._parsingErrors=[],this._flagsGYRe=/g|y/g}parse(e){if(e===""){this._parsingErrors.push({message:Z0t,offset:0,lexeme:"",additionalInfo:X0t});return}this._tokens=this._scanner.reset(e).scan(),this._current=0,this._parsingErrors=[];try{const t=this._expr();if(!this._isAtEnd()){const i=this._peek(),r=i.type===17?evt:void 0;throw this._parsingErrors.push({message:J0t,offset:i.offset,lexeme:kT.getLexeme(i),additionalInfo:r}),kD._parseError}return t}catch(t){if(t!==kD._parseError)throw t;return}}_expr(){return this._or()}_or(){const e=[this._and()];for(;this._matchOne(16);){const t=this._and();e.push(t)}return e.length===1?e[0]:Le.or(...e)}_and(){const e=[this._term()];for(;this._matchOne(15);){const t=this._term();e.push(t)}return e.length===1?e[0]:Le.and(...e)}_term(){if(this._matchOne(2)){const e=this._peek();switch(e.type){case 11:return this._advance(),Ul.INSTANCE;case 12:return this._advance(),Lc.INSTANCE;case 0:{this._advance();const t=this._expr();return this._consume(1,tbe),t?.negate()}case 17:return this._advance(),_C.create(e.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",e)}}return this._primary()}_primary(){const e=this._peek();switch(e.type){case 11:return this._advance(),Le.true();case 12:return this._advance(),Le.false();case 0:{this._advance();const t=this._expr();return this._consume(1,tbe),t}case 17:{const t=e.lexeme;if(this._advance(),this._matchOne(9)){const r=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),r.type!==10)throw this._errExpectedButGot("REGEX",r);const s=r.lexeme,o=s.lastIndexOf("/"),a=o===s.length-1?void 0:this._removeFlagsGY(s.substring(o+1));let l;try{l=new RegExp(s.substring(1,o),a)}catch{throw this._errExpectedButGot("REGEX",r)}return uN.create(t,l)}switch(r.type){case 10:case 19:{const s=[r.lexeme];this._advance();let o=this._peek(),a=0;for(let h=0;h=0){const c=s.slice(a+1,l),u=s[l+1]==="i"?"i":"";try{o=new RegExp(c,u)}catch{throw this._errExpectedButGot("REGEX",r)}}}if(o===null)throw this._errExpectedButGot("REGEX",r);return uN.create(t,o)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,Q0t);const r=this._value();return Le.notIn(t,r)}switch(this._peek().type){case 3:{this._advance();const r=this._value();if(this._previous().type===18)return Le.equals(t,r);switch(r){case"true":return Le.has(t);case"false":return Le.not(t);default:return Le.equals(t,r)}}case 4:{this._advance();const r=this._value();if(this._previous().type===18)return Le.notEquals(t,r);switch(r){case"true":return Le.not(t);case"false":return Le.has(t);default:return Le.notEquals(t,r)}}case 5:return this._advance(),G$.create(t,this._value());case 6:return this._advance(),Y$.create(t,this._value());case 7:return this._advance(),q$.create(t,this._value());case 8:return this._advance(),K$.create(t,this._value());case 13:return this._advance(),Le.in(t,this._value());default:return Le.has(t)}}case 20:throw this._parsingErrors.push({message:tvt,offset:e.offset,lexeme:"",additionalInfo:nvt}),kD._parseError;default:throw this._errExpectedButGot(`true | false | KEY | KEY '=~' REGEX | KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){const e=this._peek();switch(e.type){case 17:case 18:return this._advance(),e.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(e){return e.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(e){return this._check(e)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(e,t){if(this._check(e))return this._advance();throw this._errExpectedButGot(t,this._peek())}_errExpectedButGot(e,t,i){const r=w("contextkey.parser.error.expectedButGot",`Expected: {0} -Received: '{1}'.`,e,kT.getLexeme(t)),s=t.offset,o=kT.getLexeme(t);return this._parsingErrors.push({message:r,offset:s,lexeme:o,additionalInfo:i}),kD._parseError}_check(e){return this._peek().type===e}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}};class Le{static false(){return Ul.INSTANCE}static true(){return Lc.INSTANCE}static has(e){return mC.create(e)}static equals(e,t){return YL.create(e,t)}static notEquals(e,t){return U$.create(e,t)}static regex(e,t){return uN.create(e,t)}static in(e,t){return V$.create(e,t)}static notIn(e,t){return z$.create(e,t)}static not(e){return _C.create(e)}static and(...e){return Dy.create(e,null,!0)}static or(...e){return s_.create(e,null,!0)}static{this._parser=new ivt({regexParsingWithErrorRecovery:!1})}static deserialize(e){return e==null?void 0:this._parser.parse(e)}}function rvt(n,e){const t=n?n.substituteConstants():void 0,i=e?e.substituteConstants():void 0;return!t&&!i?!0:!t||!i?!1:t.equals(i)}function mI(n,e){return n.cmp(e)}class Ul{static{this.INSTANCE=new Ul}constructor(){this.type=0}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}negate(){return Lc.INSTANCE}}class Lc{static{this.INSTANCE=new Lc}constructor(){this.type=1}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}negate(){return Ul.INSTANCE}}class mC{static create(e,t=null){const i=Ya.get(e);return typeof i=="boolean"?i?Lc.INSTANCE:Ul.INSTANCE:new mC(e,t)}constructor(e,t){this.key=e,this.negated=t,this.type=2}cmp(e){return e.type!==this.type?this.type-e.type:C3e(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){const e=Ya.get(this.key);return typeof e=="boolean"?e?Lc.INSTANCE:Ul.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=_C.create(this.key,this)),this.negated}}class YL{static create(e,t,i=null){if(typeof t=="boolean")return t?mC.create(e,i):_C.create(e,i);const r=Ya.get(e);return typeof r=="boolean"?t===(r?"true":"false")?Lc.INSTANCE:Ul.INSTANCE:new YL(e,t,i)}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=4}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){const e=Ya.get(this.key);if(typeof e=="boolean"){const t=e?"true":"false";return this.value===t?Lc.INSTANCE:Ul.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=U$.create(this.key,this.value,this)),this.negated}}class V${static create(e,t){return new V$(e,t)}constructor(e,t){this.key=e,this.valueKey=t,this.type=10,this.negated=null}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.valueKey),i=e.getValue(this.key);return Array.isArray(t)?t.includes(i):typeof i=="string"&&typeof t=="object"&&t!==null?G0t.call(t,i):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=z$.create(this.key,this.valueKey)),this.negated}}class z${static create(e,t){return new z$(e,t)}constructor(e,t){this.key=e,this.valueKey=t,this.type=11,this._negated=V$.create(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:this._negated.cmp(e._negated)}equals(e){return e.type===this.type?this._negated.equals(e._negated):!1}substituteConstants(){return this}evaluate(e){return!this._negated.evaluate(e)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}negate(){return this._negated}}class U${static create(e,t,i=null){if(typeof t=="boolean")return t?_C.create(e,i):mC.create(e,i);const r=Ya.get(e);return typeof r=="boolean"?t===(r?"true":"false")?Ul.INSTANCE:Lc.INSTANCE:new U$(e,t,i)}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=5}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){const e=Ya.get(this.key);if(typeof e=="boolean"){const t=e?"true":"false";return this.value===t?Ul.INSTANCE:Lc.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=YL.create(this.key,this.value,this)),this.negated}}class _C{static create(e,t=null){const i=Ya.get(e);return typeof i=="boolean"?i?Ul.INSTANCE:Lc.INSTANCE:new _C(e,t)}constructor(e,t){this.key=e,this.negated=t,this.type=3}cmp(e){return e.type!==this.type?this.type-e.type:C3e(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){const e=Ya.get(this.key);return typeof e=="boolean"?e?Ul.INSTANCE:Lc.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=mC.create(this.key,this)),this.negated}}function j$(n,e){if(typeof n=="string"){const t=parseFloat(n);isNaN(t)||(n=t)}return typeof n=="string"||typeof n=="number"?e(n):Ul.INSTANCE}class q${static create(e,t,i=null){return j$(t,r=>new q$(e,r,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=12}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Y$.create(this.key,this.value,this)),this.negated}}class K${static create(e,t,i=null){return j$(t,r=>new K$(e,r,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=13}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=G$.create(this.key,this.value,this)),this.negated}}class G${static create(e,t,i=null){return j$(t,r=>new G$(e,r,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=14}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))new Y$(e,r,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=15}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=q$.create(this.key,this.value,this)),this.negated}}class uN{static create(e,t){return new uN(e,t)}constructor(e,t){this.key=e,this.regexp=t,this.type=7,this.negated=null}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.keye.key)return 1;const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return ti?1:0}equals(e){if(e.type===this.type){const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return this.key===e.key&&t===i}return!1}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1}serialize(){const e=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=jae.create(this)),this.negated}}class jae{static create(e){return new jae(e)}constructor(e){this._actual=e,this.type=8}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type?this._actual.equals(e._actual):!1}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}negate(){return this._actual}}function w3e(n){let e=null;for(let t=0,i=n.length;te.expr.length)return 1;for(let t=0,i=this.expr.length;t1;){const o=r[r.length-1];if(o.type!==9)break;r.pop();const a=r.pop(),l=r.length===0,c=s_.create(o.expr.map(u=>Dy.create([u,a],null,i)),null,l);c&&(r.push(c),r.sort(mI))}if(r.length===1)return r[0];if(i){for(let o=0;oe.serialize()).join(" && ")}keys(){const e=[];for(const t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(const t of this.expr)e.push(t.negate());this.negated=s_.create(e,this,!0)}return this.negated}}class s_{static create(e,t,i){return s_._normalizeArr(e,t,i)}constructor(e,t){this.expr=e,this.negated=t,this.type=9}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.lengthe.expr.length)return 1;for(let t=0,i=this.expr.length;te.serialize()).join(" || ")}keys(){const e=[];for(const t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(const t of this.expr)e.push(t.negate());for(;e.length>1;){const t=e.shift(),i=e.shift(),r=[];for(const s of ibe(t))for(const o of ibe(i))r.push(Dy.create([s,o],null,!1));e.unshift(s_.create(r,null,!1))}this.negated=s_.create(e,this,!0)}return this.negated}}class et extends mC{static{this._info=[]}static all(){return et._info.values()}constructor(e,t,i){super(e,null),this._defaultValue=t,typeof i=="object"?et._info.push({...i,key:e}):i!==!0&&et._info.push({key:e,description:i,type:t!=null?typeof t:void 0})}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return YL.create(this.key,e)}}const jt=On("contextKeyService");function C3e(n,e){return ne?1:0}function vC(n,e,t,i){return nt?1:ei?1:0}function SX(n,e){if(n.type===0||e.type===1)return!0;if(n.type===9)return e.type===9?nbe(n.expr,e.expr):!1;if(e.type===9){for(const t of e.expr)if(SX(n,t))return!0;return!1}if(n.type===6){if(e.type===6)return nbe(e.expr,n.expr);for(const t of n.expr)if(SX(t,e))return!0;return!1}return n.equals(e)}function nbe(n,e){let t=0,i=0;for(;t{a(),this._cachedMergedKeybindings=null})}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=Array.from(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(avt)),this._cachedMergedKeybindings.slice(0)}}const jl=new Kae,ovt={EditorModes:"platform.keybindingsRegistry"};Yr.add(ovt.EditorModes,jl);function avt(n,e){if(n.weight1!==e.weight1)return n.weight1-e.weight1;if(n.command&&e.command){if(n.commande.command)return 1}return n.weight2-e.weight2}var lvt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},sbe=function(n,e){return function(t,i){e(t,i,n)}},VF;function lk(n){return n.command!==void 0}function cvt(n){return n.submenu!==void 0}class ce{static{this._instances=new Map}static{this.CommandPalette=new ce("CommandPalette")}static{this.DebugBreakpointsContext=new ce("DebugBreakpointsContext")}static{this.DebugCallStackContext=new ce("DebugCallStackContext")}static{this.DebugConsoleContext=new ce("DebugConsoleContext")}static{this.DebugVariablesContext=new ce("DebugVariablesContext")}static{this.NotebookVariablesContext=new ce("NotebookVariablesContext")}static{this.DebugHoverContext=new ce("DebugHoverContext")}static{this.DebugWatchContext=new ce("DebugWatchContext")}static{this.DebugToolBar=new ce("DebugToolBar")}static{this.DebugToolBarStop=new ce("DebugToolBarStop")}static{this.DebugCallStackToolbar=new ce("DebugCallStackToolbar")}static{this.DebugCreateConfiguration=new ce("DebugCreateConfiguration")}static{this.EditorContext=new ce("EditorContext")}static{this.SimpleEditorContext=new ce("SimpleEditorContext")}static{this.EditorContent=new ce("EditorContent")}static{this.EditorLineNumberContext=new ce("EditorLineNumberContext")}static{this.EditorContextCopy=new ce("EditorContextCopy")}static{this.EditorContextPeek=new ce("EditorContextPeek")}static{this.EditorContextShare=new ce("EditorContextShare")}static{this.EditorTitle=new ce("EditorTitle")}static{this.EditorTitleRun=new ce("EditorTitleRun")}static{this.EditorTitleContext=new ce("EditorTitleContext")}static{this.EditorTitleContextShare=new ce("EditorTitleContextShare")}static{this.EmptyEditorGroup=new ce("EmptyEditorGroup")}static{this.EmptyEditorGroupContext=new ce("EmptyEditorGroupContext")}static{this.EditorTabsBarContext=new ce("EditorTabsBarContext")}static{this.EditorTabsBarShowTabsSubmenu=new ce("EditorTabsBarShowTabsSubmenu")}static{this.EditorTabsBarShowTabsZenModeSubmenu=new ce("EditorTabsBarShowTabsZenModeSubmenu")}static{this.EditorActionsPositionSubmenu=new ce("EditorActionsPositionSubmenu")}static{this.ExplorerContext=new ce("ExplorerContext")}static{this.ExplorerContextShare=new ce("ExplorerContextShare")}static{this.ExtensionContext=new ce("ExtensionContext")}static{this.GlobalActivity=new ce("GlobalActivity")}static{this.CommandCenter=new ce("CommandCenter")}static{this.CommandCenterCenter=new ce("CommandCenterCenter")}static{this.LayoutControlMenuSubmenu=new ce("LayoutControlMenuSubmenu")}static{this.LayoutControlMenu=new ce("LayoutControlMenu")}static{this.MenubarMainMenu=new ce("MenubarMainMenu")}static{this.MenubarAppearanceMenu=new ce("MenubarAppearanceMenu")}static{this.MenubarDebugMenu=new ce("MenubarDebugMenu")}static{this.MenubarEditMenu=new ce("MenubarEditMenu")}static{this.MenubarCopy=new ce("MenubarCopy")}static{this.MenubarFileMenu=new ce("MenubarFileMenu")}static{this.MenubarGoMenu=new ce("MenubarGoMenu")}static{this.MenubarHelpMenu=new ce("MenubarHelpMenu")}static{this.MenubarLayoutMenu=new ce("MenubarLayoutMenu")}static{this.MenubarNewBreakpointMenu=new ce("MenubarNewBreakpointMenu")}static{this.PanelAlignmentMenu=new ce("PanelAlignmentMenu")}static{this.PanelPositionMenu=new ce("PanelPositionMenu")}static{this.ActivityBarPositionMenu=new ce("ActivityBarPositionMenu")}static{this.MenubarPreferencesMenu=new ce("MenubarPreferencesMenu")}static{this.MenubarRecentMenu=new ce("MenubarRecentMenu")}static{this.MenubarSelectionMenu=new ce("MenubarSelectionMenu")}static{this.MenubarShare=new ce("MenubarShare")}static{this.MenubarSwitchEditorMenu=new ce("MenubarSwitchEditorMenu")}static{this.MenubarSwitchGroupMenu=new ce("MenubarSwitchGroupMenu")}static{this.MenubarTerminalMenu=new ce("MenubarTerminalMenu")}static{this.MenubarViewMenu=new ce("MenubarViewMenu")}static{this.MenubarHomeMenu=new ce("MenubarHomeMenu")}static{this.OpenEditorsContext=new ce("OpenEditorsContext")}static{this.OpenEditorsContextShare=new ce("OpenEditorsContextShare")}static{this.ProblemsPanelContext=new ce("ProblemsPanelContext")}static{this.SCMInputBox=new ce("SCMInputBox")}static{this.SCMChangesSeparator=new ce("SCMChangesSeparator")}static{this.SCMChangesContext=new ce("SCMChangesContext")}static{this.SCMIncomingChanges=new ce("SCMIncomingChanges")}static{this.SCMIncomingChangesContext=new ce("SCMIncomingChangesContext")}static{this.SCMIncomingChangesSetting=new ce("SCMIncomingChangesSetting")}static{this.SCMOutgoingChanges=new ce("SCMOutgoingChanges")}static{this.SCMOutgoingChangesContext=new ce("SCMOutgoingChangesContext")}static{this.SCMOutgoingChangesSetting=new ce("SCMOutgoingChangesSetting")}static{this.SCMIncomingChangesAllChangesContext=new ce("SCMIncomingChangesAllChangesContext")}static{this.SCMIncomingChangesHistoryItemContext=new ce("SCMIncomingChangesHistoryItemContext")}static{this.SCMOutgoingChangesAllChangesContext=new ce("SCMOutgoingChangesAllChangesContext")}static{this.SCMOutgoingChangesHistoryItemContext=new ce("SCMOutgoingChangesHistoryItemContext")}static{this.SCMChangeContext=new ce("SCMChangeContext")}static{this.SCMResourceContext=new ce("SCMResourceContext")}static{this.SCMResourceContextShare=new ce("SCMResourceContextShare")}static{this.SCMResourceFolderContext=new ce("SCMResourceFolderContext")}static{this.SCMResourceGroupContext=new ce("SCMResourceGroupContext")}static{this.SCMSourceControl=new ce("SCMSourceControl")}static{this.SCMSourceControlInline=new ce("SCMSourceControlInline")}static{this.SCMSourceControlTitle=new ce("SCMSourceControlTitle")}static{this.SCMHistoryTitle=new ce("SCMHistoryTitle")}static{this.SCMTitle=new ce("SCMTitle")}static{this.SearchContext=new ce("SearchContext")}static{this.SearchActionMenu=new ce("SearchActionContext")}static{this.StatusBarWindowIndicatorMenu=new ce("StatusBarWindowIndicatorMenu")}static{this.StatusBarRemoteIndicatorMenu=new ce("StatusBarRemoteIndicatorMenu")}static{this.StickyScrollContext=new ce("StickyScrollContext")}static{this.TestItem=new ce("TestItem")}static{this.TestItemGutter=new ce("TestItemGutter")}static{this.TestProfilesContext=new ce("TestProfilesContext")}static{this.TestMessageContext=new ce("TestMessageContext")}static{this.TestMessageContent=new ce("TestMessageContent")}static{this.TestPeekElement=new ce("TestPeekElement")}static{this.TestPeekTitle=new ce("TestPeekTitle")}static{this.TestCallStack=new ce("TestCallStack")}static{this.TouchBarContext=new ce("TouchBarContext")}static{this.TitleBarContext=new ce("TitleBarContext")}static{this.TitleBarTitleContext=new ce("TitleBarTitleContext")}static{this.TunnelContext=new ce("TunnelContext")}static{this.TunnelPrivacy=new ce("TunnelPrivacy")}static{this.TunnelProtocol=new ce("TunnelProtocol")}static{this.TunnelPortInline=new ce("TunnelInline")}static{this.TunnelTitle=new ce("TunnelTitle")}static{this.TunnelLocalAddressInline=new ce("TunnelLocalAddressInline")}static{this.TunnelOriginInline=new ce("TunnelOriginInline")}static{this.ViewItemContext=new ce("ViewItemContext")}static{this.ViewContainerTitle=new ce("ViewContainerTitle")}static{this.ViewContainerTitleContext=new ce("ViewContainerTitleContext")}static{this.ViewTitle=new ce("ViewTitle")}static{this.ViewTitleContext=new ce("ViewTitleContext")}static{this.CommentEditorActions=new ce("CommentEditorActions")}static{this.CommentThreadTitle=new ce("CommentThreadTitle")}static{this.CommentThreadActions=new ce("CommentThreadActions")}static{this.CommentThreadAdditionalActions=new ce("CommentThreadAdditionalActions")}static{this.CommentThreadTitleContext=new ce("CommentThreadTitleContext")}static{this.CommentThreadCommentContext=new ce("CommentThreadCommentContext")}static{this.CommentTitle=new ce("CommentTitle")}static{this.CommentActions=new ce("CommentActions")}static{this.CommentsViewThreadActions=new ce("CommentsViewThreadActions")}static{this.InteractiveToolbar=new ce("InteractiveToolbar")}static{this.InteractiveCellTitle=new ce("InteractiveCellTitle")}static{this.InteractiveCellDelete=new ce("InteractiveCellDelete")}static{this.InteractiveCellExecute=new ce("InteractiveCellExecute")}static{this.InteractiveInputExecute=new ce("InteractiveInputExecute")}static{this.InteractiveInputConfig=new ce("InteractiveInputConfig")}static{this.ReplInputExecute=new ce("ReplInputExecute")}static{this.IssueReporter=new ce("IssueReporter")}static{this.NotebookToolbar=new ce("NotebookToolbar")}static{this.NotebookStickyScrollContext=new ce("NotebookStickyScrollContext")}static{this.NotebookCellTitle=new ce("NotebookCellTitle")}static{this.NotebookCellDelete=new ce("NotebookCellDelete")}static{this.NotebookCellInsert=new ce("NotebookCellInsert")}static{this.NotebookCellBetween=new ce("NotebookCellBetween")}static{this.NotebookCellListTop=new ce("NotebookCellTop")}static{this.NotebookCellExecute=new ce("NotebookCellExecute")}static{this.NotebookCellExecuteGoTo=new ce("NotebookCellExecuteGoTo")}static{this.NotebookCellExecutePrimary=new ce("NotebookCellExecutePrimary")}static{this.NotebookDiffCellInputTitle=new ce("NotebookDiffCellInputTitle")}static{this.NotebookDiffCellMetadataTitle=new ce("NotebookDiffCellMetadataTitle")}static{this.NotebookDiffCellOutputsTitle=new ce("NotebookDiffCellOutputsTitle")}static{this.NotebookOutputToolbar=new ce("NotebookOutputToolbar")}static{this.NotebookOutlineFilter=new ce("NotebookOutlineFilter")}static{this.NotebookOutlineActionMenu=new ce("NotebookOutlineActionMenu")}static{this.NotebookEditorLayoutConfigure=new ce("NotebookEditorLayoutConfigure")}static{this.NotebookKernelSource=new ce("NotebookKernelSource")}static{this.BulkEditTitle=new ce("BulkEditTitle")}static{this.BulkEditContext=new ce("BulkEditContext")}static{this.TimelineItemContext=new ce("TimelineItemContext")}static{this.TimelineTitle=new ce("TimelineTitle")}static{this.TimelineTitleContext=new ce("TimelineTitleContext")}static{this.TimelineFilterSubMenu=new ce("TimelineFilterSubMenu")}static{this.AccountsContext=new ce("AccountsContext")}static{this.SidebarTitle=new ce("SidebarTitle")}static{this.PanelTitle=new ce("PanelTitle")}static{this.AuxiliaryBarTitle=new ce("AuxiliaryBarTitle")}static{this.AuxiliaryBarHeader=new ce("AuxiliaryBarHeader")}static{this.TerminalInstanceContext=new ce("TerminalInstanceContext")}static{this.TerminalEditorInstanceContext=new ce("TerminalEditorInstanceContext")}static{this.TerminalNewDropdownContext=new ce("TerminalNewDropdownContext")}static{this.TerminalTabContext=new ce("TerminalTabContext")}static{this.TerminalTabEmptyAreaContext=new ce("TerminalTabEmptyAreaContext")}static{this.TerminalStickyScrollContext=new ce("TerminalStickyScrollContext")}static{this.WebviewContext=new ce("WebviewContext")}static{this.InlineCompletionsActions=new ce("InlineCompletionsActions")}static{this.InlineEditsActions=new ce("InlineEditsActions")}static{this.InlineEditActions=new ce("InlineEditActions")}static{this.NewFile=new ce("NewFile")}static{this.MergeInput1Toolbar=new ce("MergeToolbar1Toolbar")}static{this.MergeInput2Toolbar=new ce("MergeToolbar2Toolbar")}static{this.MergeBaseToolbar=new ce("MergeBaseToolbar")}static{this.MergeInputResultToolbar=new ce("MergeToolbarResultToolbar")}static{this.InlineSuggestionToolbar=new ce("InlineSuggestionToolbar")}static{this.InlineEditToolbar=new ce("InlineEditToolbar")}static{this.ChatContext=new ce("ChatContext")}static{this.ChatCodeBlock=new ce("ChatCodeblock")}static{this.ChatCompareBlock=new ce("ChatCompareBlock")}static{this.ChatMessageTitle=new ce("ChatMessageTitle")}static{this.ChatExecute=new ce("ChatExecute")}static{this.ChatExecuteSecondary=new ce("ChatExecuteSecondary")}static{this.ChatInputSide=new ce("ChatInputSide")}static{this.AccessibleView=new ce("AccessibleView")}static{this.MultiDiffEditorFileToolbar=new ce("MultiDiffEditorFileToolbar")}static{this.DiffEditorHunkToolbar=new ce("DiffEditorHunkToolbar")}static{this.DiffEditorSelectionToolbar=new ce("DiffEditorSelectionToolbar")}constructor(e){if(ce._instances.has(e))throw new TypeError(`MenuId with identifier '${e}' already exists. Use MenuId.for(ident) or a unique identifier`);ce._instances.set(e,this),this.id=e}}const ld=On("menuService");class hv{static{this._all=new Map}static for(e){let t=this._all.get(e);return t||(t=new hv(e),this._all.set(e,t)),t}static merge(e){const t=new Set;for(const i of e)i instanceof hv&&t.add(i.id);return t}constructor(e){this.id=e,this.has=t=>t===e}}const Fo=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Smt({merge:hv.merge}),this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(n){return this._commands.set(n.id,n),this._onDidChangeMenu.fire(hv.for(ce.CommandPalette)),Lt(()=>{this._commands.delete(n.id)&&this._onDidChangeMenu.fire(hv.for(ce.CommandPalette))})}getCommand(n){return this._commands.get(n)}getCommands(){const n=new Map;return this._commands.forEach((e,t)=>n.set(t,e)),n}appendMenuItem(n,e){let t=this._menuItems.get(n);t||(t=new Rl,this._menuItems.set(n,t));const i=t.push(e);return this._onDidChangeMenu.fire(hv.for(n)),Lt(()=>{i(),this._onDidChangeMenu.fire(hv.for(n))})}appendMenuItems(n){const e=new ke;for(const{id:t,item:i}of n)e.add(this.appendMenuItem(t,i));return e}getMenuItems(n){let e;return this._menuItems.has(n)?e=[...this._menuItems.get(n)]:e=[],n===ce.CommandPalette&&this._appendImplicitItems(e),e}_appendImplicitItems(n){const e=new Set;for(const t of n)lk(t)&&(e.add(t.command.id),t.alt&&e.add(t.alt.id));this._commands.forEach((t,i)=>{e.has(i)||n.push({command:t})})}};class ck extends rE{constructor(e,t,i){super(`submenuitem.${e.submenu.id}`,typeof e.title=="string"?e.title:e.title.value,i,"submenu"),this.item=e,this.hideActions=t}}let ou=VF=class{static label(e,t){return t?.renderShortTitle&&e.shortTitle?typeof e.shortTitle=="string"?e.shortTitle:e.shortTitle.value:typeof e.title=="string"?e.title:e.title.value}constructor(e,t,i,r,s,o,a){this.hideActions=r,this.menuKeybinding=s,this._commandService=a,this.id=e.id,this.label=VF.label(e,i),this.tooltip=(typeof e.tooltip=="string"?e.tooltip:e.tooltip?.value)??"",this.enabled=!e.precondition||o.contextMatchesRules(e.precondition),this.checked=void 0;let l;if(e.toggled){const c=e.toggled.condition?e.toggled:{condition:e.toggled};this.checked=o.contextMatchesRules(c.condition),this.checked&&c.tooltip&&(this.tooltip=typeof c.tooltip=="string"?c.tooltip:c.tooltip.value),this.checked&&zt.isThemeIcon(c.icon)&&(l=c.icon),this.checked&&c.title&&(this.label=typeof c.title=="string"?c.title:c.title.value)}l||(l=zt.isThemeIcon(e.icon)?e.icon:void 0),this.item=e,this.alt=t?new VF(t,void 0,i,r,void 0,o,a):void 0,this._options=i,this.class=l&&zt.asClassName(l)}run(...e){let t=[];return this._options?.arg&&(t=[...t,this._options.arg]),this._options?.shouldForwardArgs&&(t=[...t,...e]),this._commandService.executeCommand(this.id,...t)}};ou=VF=lvt([sbe(5,jt),sbe(6,_r)],ou);class Gl{constructor(e){this.desc=e}}function lr(n){const e=[],t=new n,{f1:i,menu:r,keybinding:s,...o}=t.desc;if(Un.getCommand(o.id))throw new Error(`Cannot register two commands with the same id: ${o.id}`);if(e.push(Un.registerCommand({id:o.id,handler:(a,...l)=>t.run(a,...l),metadata:o.metadata})),Array.isArray(r))for(const a of r)e.push(Fo.appendMenuItem(a.id,{command:{...o,precondition:a.precondition===null?void 0:o.precondition},...a}));else r&&e.push(Fo.appendMenuItem(r.id,{command:{...o,precondition:r.precondition===null?void 0:o.precondition},...r}));if(i&&(e.push(Fo.appendMenuItem(ce.CommandPalette,{command:o,when:o.precondition})),e.push(Fo.addCommand(o))),Array.isArray(s))for(const a of s)e.push(jl.registerKeybindingRule({...a,id:o.id,when:o.precondition?Le.and(o.precondition,a.when):a.when}));else s&&e.push(jl.registerKeybindingRule({...s,id:o.id,when:o.precondition?Le.and(o.precondition,s.when):s.when}));return{dispose(){er(e)}}}const Qa=On("telemetryService"),Da=On("logService");var dc;(function(n){n[n.Off=0]="Off",n[n.Trace=1]="Trace",n[n.Debug=2]="Debug",n[n.Info=3]="Info",n[n.Warning=4]="Warning",n[n.Error=5]="Error"})(dc||(dc={}));const x3e=dc.Info;class S3e extends me{constructor(){super(...arguments),this.level=x3e,this._onDidChangeLogLevel=this._register(new fe),this.onDidChangeLogLevel=this._onDidChangeLogLevel.event}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(e){return this.level!==dc.Off&&this.level<=e}}class uvt extends S3e{constructor(e=x3e,t=!0){super(),this.useColors=t,this.setLevel(e)}trace(e,...t){this.checkLogLevel(dc.Trace)&&(this.useColors?console.log("%cTRACE","color: #888",e,...t):console.log(e,...t))}debug(e,...t){this.checkLogLevel(dc.Debug)&&(this.useColors?console.log("%cDEBUG","background: #eee; color: #888",e,...t):console.log(e,...t))}info(e,...t){this.checkLogLevel(dc.Info)&&(this.useColors?console.log("%c INFO","color: #33f",e,...t):console.log(e,...t))}warn(e,...t){this.checkLogLevel(dc.Warning)&&(this.useColors?console.log("%c WARN","color: #993",e,...t):console.log(e,...t))}error(e,...t){this.checkLogLevel(dc.Error)&&(this.useColors?console.log("%c ERR","color: #f33",e,...t):console.error(e,...t))}}class dvt extends S3e{constructor(e){super(),this.loggers=e,e.length&&this.setLevel(e[0].getLevel())}setLevel(e){for(const t of this.loggers)t.setLevel(e);super.setLevel(e)}trace(e,...t){for(const i of this.loggers)i.trace(e,...t)}debug(e,...t){for(const i of this.loggers)i.debug(e,...t)}info(e,...t){for(const i of this.loggers)i.info(e,...t)}warn(e,...t){for(const i of this.loggers)i.warn(e,...t)}error(e,...t){for(const i of this.loggers)i.error(e,...t)}dispose(){for(const e of this.loggers)e.dispose();super.dispose()}}function hvt(n){switch(n){case dc.Trace:return"trace";case dc.Debug:return"debug";case dc.Info:return"info";case dc.Warning:return"warn";case dc.Error:return"error";case dc.Off:return"off"}}new et("logLevel",hvt(dc.Info));let X$=class{constructor(e){this.id=e.id,this.precondition=e.precondition,this._kbOpts=e.kbOpts,this._menuOpts=e.menuOpts,this.metadata=e.metadata}register(){if(Array.isArray(this._menuOpts)?this._menuOpts.forEach(this._registerMenuItem,this):this._menuOpts&&this._registerMenuItem(this._menuOpts),this._kbOpts){const e=Array.isArray(this._kbOpts)?this._kbOpts:[this._kbOpts];for(const t of e){let i=t.kbExpr;this.precondition&&(i?i=Le.and(i,this.precondition):i=this.precondition);const r={id:this.id,weight:t.weight,args:t.args,when:i,primary:t.primary,secondary:t.secondary,win:t.win,linux:t.linux,mac:t.mac};jl.registerKeybindingRule(r)}}Un.registerCommand({id:this.id,handler:(e,t)=>this.runCommand(e,t),metadata:this.metadata})}_registerMenuItem(e){Fo.appendMenuItem(e.menuId,{group:e.group,command:{id:this.id,title:e.title,icon:e.icon,precondition:this.precondition},when:e.when,order:e.order})}};class ZL extends X${constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t,i,r){return this._implementations.push({priority:e,name:t,implementation:i,when:r}),this._implementations.sort((s,o)=>o.priority-s.priority),{dispose:()=>{for(let s=0;s{if(a.get(jt).contextMatchesRules(i??void 0))return r(a,o,t)})}runCommand(e,t){return fo.runEditorCommand(e,t,this.precondition,(i,r,s)=>this.runEditorCommand(i,r,s))}}class ot extends fo{static convertOptions(e){let t;Array.isArray(e.menuOpts)?t=e.menuOpts:e.menuOpts?t=[e.menuOpts]:t=[];function i(r){return r.menuId||(r.menuId=ce.EditorContext),r.title||(r.title=e.label),r.when=Le.and(e.precondition,r.when),r}return Array.isArray(e.contextMenuOpts)?t.push(...e.contextMenuOpts.map(i)):e.contextMenuOpts&&t.push(i(e.contextMenuOpts)),e.menuOpts=t,e}constructor(e){super(ot.convertOptions(e)),this.label=e.label,this.alias=e.alias}runEditorCommand(e,t,i){return this.reportTelemetry(e,t),this.run(e,t,i||{})}reportTelemetry(e,t){e.get(Qa).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}}class E3e extends ot{constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t){return this._implementations.push([e,t]),this._implementations.sort((i,r)=>r[0]-i[0]),{dispose:()=>{for(let i=0;i{const o=s.get(jt),a=s.get(Da);if(!o.contextMatchesRules(this.desc.precondition??void 0)){a.debug("[EditorAction2] NOT running command because its precondition is FALSE",this.desc.id,this.desc.precondition?.serialize());return}return this.runEditorCommand(s,r,...t)})}}function Rc(n,e){Un.registerCommand(n,function(t,...i){const r=t.get(Tt),[s,o]=i;oi(Pt.isUri(s)),oi(he.isIPosition(o));const a=t.get(Sr).getModel(s);if(a){const l=he.lift(o);return r.invokeFunction(e,a,l,...i.slice(2))}return t.get(Nc).createModelReference(s).then(l=>new Promise((c,u)=>{try{const d=r.invokeFunction(e,l.object.textEditorModel,he.lift(o),i.slice(2));c(d)}catch(d){u(d)}}).finally(()=>{l.dispose()}))})}function Je(n){return Od.INSTANCE.registerEditorCommand(n),n}function Pe(n){const e=new n;return Od.INSTANCE.registerEditorAction(e),e}function L3e(n){return Od.INSTANCE.registerEditorAction(n),n}function fvt(n){Od.INSTANCE.registerEditorAction(n)}function Zn(n,e,t){Od.INSTANCE.registerEditorContribution(n,e,t)}var Zy;(function(n){function e(o){return Od.INSTANCE.getEditorCommand(o)}n.getEditorCommand=e;function t(){return Od.INSTANCE.getEditorActions()}n.getEditorActions=t;function i(){return Od.INSTANCE.getEditorContributions()}n.getEditorContributions=i;function r(o){return Od.INSTANCE.getEditorContributions().filter(a=>o.indexOf(a.id)>=0)}n.getSomeEditorContributions=r;function s(){return Od.INSTANCE.getDiffEditorContributions()}n.getDiffEditorContributions=s})(Zy||(Zy={}));const gvt={EditorCommonContributions:"editor.contributions"};class Od{static{this.INSTANCE=new Od}constructor(){this.editorContributions=[],this.diffEditorContributions=[],this.editorActions=[],this.editorCommands=Object.create(null)}registerEditorContribution(e,t,i){this.editorContributions.push({id:e,ctor:t,instantiation:i})}getEditorContributions(){return this.editorContributions.slice(0)}getDiffEditorContributions(){return this.diffEditorContributions.slice(0)}registerEditorAction(e){e.register(),this.editorActions.push(e)}getEditorActions(){return this.editorActions}registerEditorCommand(e){e.register(),this.editorCommands[e.id]=e}getEditorCommand(e){return this.editorCommands[e]||null}}Yr.add(gvt.EditorCommonContributions,Od.INSTANCE);function ZP(n){return n.register(),n}const T3e=ZP(new ZL({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2104},menuOpts:[{menuId:ce.MenubarEditMenu,group:"1_do",title:w({key:"miUndo",comment:["&& denotes a mnemonic"]},"&&Undo"),order:1},{menuId:ce.CommandPalette,group:"",title:w("undo","Undo"),order:1}]}));ZP(new k3e(T3e,{id:"default:undo",precondition:void 0}));const D3e=ZP(new ZL({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2103,secondary:[3128],mac:{primary:3128}},menuOpts:[{menuId:ce.MenubarEditMenu,group:"1_do",title:w({key:"miRedo",comment:["&& denotes a mnemonic"]},"&&Redo"),order:2},{menuId:ce.CommandPalette,group:"",title:w("redo","Redo"),order:1}]}));ZP(new k3e(D3e,{id:"default:redo",precondition:void 0}));const pvt=ZP(new ZL({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2079},menuOpts:[{menuId:ce.MenubarSelectionMenu,group:"1_basic",title:w({key:"miSelectAll",comment:["&& denotes a mnemonic"]},"&&Select All"),order:1},{menuId:ce.CommandPalette,group:"",title:w("selectAll","Select All"),order:1}]})),obe="default",mvt="$initialize";let abe=!1;function kX(n){pC&&(abe||(abe=!0,console.warn("Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq")),console.warn(n.message))}class _vt{constructor(e,t,i,r,s){this.vsWorker=e,this.req=t,this.channel=i,this.method=r,this.args=s,this.type=0}}class lbe{constructor(e,t,i,r){this.vsWorker=e,this.seq=t,this.res=i,this.err=r,this.type=1}}class vvt{constructor(e,t,i,r,s){this.vsWorker=e,this.req=t,this.channel=i,this.eventName=r,this.arg=s,this.type=2}}class bvt{constructor(e,t,i){this.vsWorker=e,this.req=t,this.event=i,this.type=3}}class yvt{constructor(e,t){this.vsWorker=e,this.req=t,this.type=4}}class wvt{constructor(e){this._workerId=-1,this._handler=e,this._lastSentReq=0,this._pendingReplies=Object.create(null),this._pendingEmitters=new Map,this._pendingEvents=new Map}setWorkerId(e){this._workerId=e}sendMessage(e,t,i){const r=String(++this._lastSentReq);return new Promise((s,o)=>{this._pendingReplies[r]={resolve:s,reject:o},this._send(new _vt(this._workerId,r,e,t,i))})}listen(e,t,i){let r=null;const s=new fe({onWillAddFirstListener:()=>{r=String(++this._lastSentReq),this._pendingEmitters.set(r,s),this._send(new vvt(this._workerId,r,e,t,i))},onDidRemoveLastListener:()=>{this._pendingEmitters.delete(r),this._send(new yvt(this._workerId,r)),r=null}});return s.event}handleMessage(e){!e||!e.vsWorker||this._workerId!==-1&&e.vsWorker!==this._workerId||this._handleMessage(e)}createProxyToRemoteChannel(e,t){const i={get:(r,s)=>(typeof s=="string"&&!r[s]&&(A3e(s)?r[s]=o=>this.listen(e,s,o):I3e(s)?r[s]=this.listen(e,s,void 0):s.charCodeAt(0)===36&&(r[s]=async(...o)=>(await t?.(),this.sendMessage(e,s,o)))),r[s])};return new Proxy(Object.create(null),i)}_handleMessage(e){switch(e.type){case 1:return this._handleReplyMessage(e);case 0:return this._handleRequestMessage(e);case 2:return this._handleSubscribeEventMessage(e);case 3:return this._handleEventMessage(e);case 4:return this._handleUnsubscribeEventMessage(e)}}_handleReplyMessage(e){if(!this._pendingReplies[e.seq]){console.warn("Got reply to unknown seq");return}const t=this._pendingReplies[e.seq];if(delete this._pendingReplies[e.seq],e.err){let i=e.err;e.err.$isError&&(i=new Error,i.name=e.err.name,i.message=e.err.message,i.stack=e.err.stack),t.reject(i);return}t.resolve(e.res)}_handleRequestMessage(e){const t=e.req;this._handler.handleMessage(e.channel,e.method,e.args).then(r=>{this._send(new lbe(this._workerId,t,r,void 0))},r=>{r.detail instanceof Error&&(r.detail=Pve(r.detail)),this._send(new lbe(this._workerId,t,void 0,Pve(r)))})}_handleSubscribeEventMessage(e){const t=e.req,i=this._handler.handleEvent(e.channel,e.eventName,e.arg)(r=>{this._send(new bvt(this._workerId,t,r))});this._pendingEvents.set(t,i)}_handleEventMessage(e){if(!this._pendingEmitters.has(e.req)){console.warn("Got event for unknown req");return}this._pendingEmitters.get(e.req).fire(e.event)}_handleUnsubscribeEventMessage(e){if(!this._pendingEvents.has(e.req)){console.warn("Got unsubscribe for unknown req");return}this._pendingEvents.get(e.req).dispose(),this._pendingEvents.delete(e.req)}_send(e){const t=[];if(e.type===0)for(let i=0;i{this._protocol.handleMessage(s)},s=>{rn(s)})),this._protocol=new wvt({sendMessage:(s,o)=>{this._worker.postMessage(s,o)},handleMessage:(s,o,a)=>this._handleMessage(s,o,a),handleEvent:(s,o,a)=>this._handleEvent(s,o,a)}),this._protocol.setWorkerId(this._worker.getId());let i=null;const r=globalThis.require;typeof r<"u"&&typeof r.getConfig=="function"?i=r.getConfig():typeof globalThis.requirejs<"u"&&(i=globalThis.requirejs.s.contexts._.config),this._onModuleLoaded=this._protocol.sendMessage(obe,mvt,[this._worker.getId(),JSON.parse(JSON.stringify(i)),t.amdModuleId]),this.proxy=this._protocol.createProxyToRemoteChannel(obe,async()=>{await this._onModuleLoaded}),this._onModuleLoaded.catch(s=>{this._onError("Worker failed to load "+t.amdModuleId,s)})}_handleMessage(e,t,i){const r=this._localChannels.get(e);if(!r)return Promise.reject(new Error(`Missing channel ${e} on main thread`));if(typeof r[t]!="function")return Promise.reject(new Error(`Missing method ${t} on main thread channel ${e}`));try{return Promise.resolve(r[t].apply(r,i))}catch(s){return Promise.reject(s)}}_handleEvent(e,t,i){const r=this._localChannels.get(e);if(!r)throw new Error(`Missing channel ${e} on main thread`);if(A3e(t)){const s=r[t].call(r,i);if(typeof s!="function")throw new Error(`Missing dynamic event ${t} on main thread channel ${e}.`);return s}if(I3e(t)){const s=r[t];if(typeof s!="function")throw new Error(`Missing event ${t} on main thread channel ${e}.`);return s}throw new Error(`Malformed event name ${t}`)}setChannel(e,t){this._localChannels.set(e,t)}_onError(e,t){console.error(e),console.info(t)}}function I3e(n){return n[0]==="o"&&n[1]==="n"&&fp(n.charCodeAt(2))}function A3e(n){return/^onDynamic/.test(n)&&fp(n.charCodeAt(9))}function p0(n,e){const t=globalThis.MonacoEnvironment;if(t?.createTrustedTypesPolicy)try{return t.createTrustedTypesPolicy(n,e)}catch(i){rn(i);return}try{return globalThis.trustedTypes?.createPolicy(n,e)}catch(i){rn(i);return}}let yS;typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope"&&globalThis.workerttPolicy!==void 0?yS=globalThis.workerttPolicy:yS=p0("defaultWorkerFactory",{createScriptURL:n=>n});function xvt(n,e){const t=globalThis.MonacoEnvironment;if(t){if(typeof t.getWorker=="function")return t.getWorker("workerMain.js",e);if(typeof t.getWorkerUrl=="function"){const i=t.getWorkerUrl("workerMain.js",e);return new Worker(yS?yS.createScriptURL(i):i,{name:e,type:"module"})}}if(n){const i=Svt(e,n.toString(!0)),r=new Worker(yS?yS.createScriptURL(i):i,{name:e,type:"module"});return kvt(r)}throw new Error("You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker")}function Svt(n,e,t){if(!(/^((http:)|(https:)|(file:)|(vscode-file:))/.test(e)&&e.substring(0,globalThis.origin.length)!==globalThis.origin)){const s=e.lastIndexOf("?"),o=e.lastIndexOf("#",s),a=s>0?new URLSearchParams(e.substring(s+1,~o?o:void 0)):new URLSearchParams;_X.addSearchParam(a,!0,!0),a.toString()?e=`${e}?${a.toString()}#${n}`:e=`${e}#${n}`}const r=new Blob([rf([`/*${n}*/`,void 0,`globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(d4e())};`,`globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(gae())};`,`globalThis._VSCODE_FILE_ROOT = '${globalThis._VSCODE_FILE_ROOT}';`,"const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });","globalThis.workerttPolicy = ttPolicy;",`await import(ttPolicy?.createScriptURL('${e}') ?? '${e}');`,"globalThis.postMessage({ type: 'vscode-worker-ready' });",`/*${n}*/`]).join("")],{type:"application/javascript"});return URL.createObjectURL(r)}function kvt(n){return new Promise((e,t)=>{n.onmessage=function(i){i.data.type==="vscode-worker-ready"&&(n.onmessage=null,e(n))},n.onerror=t})}function Evt(n){return typeof n.then=="function"}class Lvt extends me{constructor(e,t,i,r,s,o){super(),this.id=i,this.label=r;const a=xvt(e,r);Evt(a)?this.worker=a:this.worker=Promise.resolve(a),this.postMessage(t,[]),this.worker.then(l=>{l.onmessage=function(c){s(c.data)},l.onmessageerror=o,typeof l.addEventListener=="function"&&l.addEventListener("error",o)}),this._register(Lt(()=>{this.worker?.then(l=>{l.onmessage=null,l.onmessageerror=null,l.removeEventListener("error",o),l.terminate()}),this.worker=null}))}getId(){return this.id}postMessage(e,t){this.worker?.then(i=>{try{i.postMessage(e,t)}catch(r){rn(r),rn(new Error(`FAILED to post message to '${this.label}'-worker`,{cause:r}))}})}}class Tvt{constructor(e,t){this.amdModuleId=e,this.label=t,this.esmModuleLocation=M$.asBrowserUri(`${e}.esm.js`)}}class Gae{static{this.LAST_WORKER_ID=0}constructor(){this._webWorkerFailedBeforeError=!1}create(e,t,i){const r=++Gae.LAST_WORKER_ID;if(this._webWorkerFailedBeforeError)throw this._webWorkerFailedBeforeError;return new Lvt(e.esmModuleLocation,e.amdModuleId,r,e.label||"anonymous"+r,t,s=>{kX(s),this._webWorkerFailedBeforeError=s,i(s)})}}function Dvt(n,e){const t=typeof n=="string"?new Tvt(n,e):n;return new Cvt(new Gae,t)}var zs;(function(n){n[n.None=0]="None",n[n.Indent=1]="Indent",n[n.IndentOutdent=2]="IndentOutdent",n[n.Outdent=3]="Outdent"})(zs||(zs={}));class Ij{constructor(e){if(this._neutralCharacter=null,this._neutralCharacterSearched=!1,this.open=e.open,this.close=e.close,this._inString=!0,this._inComment=!0,this._inRegEx=!0,Array.isArray(e.notIn))for(let t=0,i=e.notIn.length;t +Received: '{1}'.`,e,kT.getLexeme(t)),s=t.offset,o=kT.getLexeme(t);return this._parsingErrors.push({message:r,offset:s,lexeme:o,additionalInfo:i}),kD._parseError}_check(e){return this._peek().type===e}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}};class Le{static false(){return Ul.INSTANCE}static true(){return Lc.INSTANCE}static has(e){return mC.create(e)}static equals(e,t){return YL.create(e,t)}static notEquals(e,t){return U$.create(e,t)}static regex(e,t){return uN.create(e,t)}static in(e,t){return V$.create(e,t)}static notIn(e,t){return z$.create(e,t)}static not(e){return _C.create(e)}static and(...e){return Dy.create(e,null,!0)}static or(...e){return s_.create(e,null,!0)}static{this._parser=new ivt({regexParsingWithErrorRecovery:!1})}static deserialize(e){return e==null?void 0:this._parser.parse(e)}}function rvt(n,e){const t=n?n.substituteConstants():void 0,i=e?e.substituteConstants():void 0;return!t&&!i?!0:!t||!i?!1:t.equals(i)}function mI(n,e){return n.cmp(e)}class Ul{static{this.INSTANCE=new Ul}constructor(){this.type=0}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}negate(){return Lc.INSTANCE}}class Lc{static{this.INSTANCE=new Lc}constructor(){this.type=1}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}negate(){return Ul.INSTANCE}}class mC{static create(e,t=null){const i=Ya.get(e);return typeof i=="boolean"?i?Lc.INSTANCE:Ul.INSTANCE:new mC(e,t)}constructor(e,t){this.key=e,this.negated=t,this.type=2}cmp(e){return e.type!==this.type?this.type-e.type:C3e(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){const e=Ya.get(this.key);return typeof e=="boolean"?e?Lc.INSTANCE:Ul.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=_C.create(this.key,this)),this.negated}}class YL{static create(e,t,i=null){if(typeof t=="boolean")return t?mC.create(e,i):_C.create(e,i);const r=Ya.get(e);return typeof r=="boolean"?t===(r?"true":"false")?Lc.INSTANCE:Ul.INSTANCE:new YL(e,t,i)}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=4}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){const e=Ya.get(this.key);if(typeof e=="boolean"){const t=e?"true":"false";return this.value===t?Lc.INSTANCE:Ul.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=U$.create(this.key,this.value,this)),this.negated}}class V${static create(e,t){return new V$(e,t)}constructor(e,t){this.key=e,this.valueKey=t,this.type=10,this.negated=null}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.valueKey),i=e.getValue(this.key);return Array.isArray(t)?t.includes(i):typeof i=="string"&&typeof t=="object"&&t!==null?G0t.call(t,i):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=z$.create(this.key,this.valueKey)),this.negated}}class z${static create(e,t){return new z$(e,t)}constructor(e,t){this.key=e,this.valueKey=t,this.type=11,this._negated=V$.create(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:this._negated.cmp(e._negated)}equals(e){return e.type===this.type?this._negated.equals(e._negated):!1}substituteConstants(){return this}evaluate(e){return!this._negated.evaluate(e)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}negate(){return this._negated}}class U${static create(e,t,i=null){if(typeof t=="boolean")return t?_C.create(e,i):mC.create(e,i);const r=Ya.get(e);return typeof r=="boolean"?t===(r?"true":"false")?Ul.INSTANCE:Lc.INSTANCE:new U$(e,t,i)}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=5}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){const e=Ya.get(this.key);if(typeof e=="boolean"){const t=e?"true":"false";return this.value===t?Ul.INSTANCE:Lc.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=YL.create(this.key,this.value,this)),this.negated}}class _C{static create(e,t=null){const i=Ya.get(e);return typeof i=="boolean"?i?Ul.INSTANCE:Lc.INSTANCE:new _C(e,t)}constructor(e,t){this.key=e,this.negated=t,this.type=3}cmp(e){return e.type!==this.type?this.type-e.type:C3e(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){const e=Ya.get(this.key);return typeof e=="boolean"?e?Ul.INSTANCE:Lc.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=mC.create(this.key,this)),this.negated}}function j$(n,e){if(typeof n=="string"){const t=parseFloat(n);isNaN(t)||(n=t)}return typeof n=="string"||typeof n=="number"?e(n):Ul.INSTANCE}class q${static create(e,t,i=null){return j$(t,r=>new q$(e,r,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=12}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Y$.create(this.key,this.value,this)),this.negated}}class K${static create(e,t,i=null){return j$(t,r=>new K$(e,r,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=13}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=G$.create(this.key,this.value,this)),this.negated}}class G${static create(e,t,i=null){return j$(t,r=>new G$(e,r,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=14}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))new Y$(e,r,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=15}cmp(e){return e.type!==this.type?this.type-e.type:vC(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=q$.create(this.key,this.value,this)),this.negated}}class uN{static create(e,t){return new uN(e,t)}constructor(e,t){this.key=e,this.regexp=t,this.type=7,this.negated=null}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.keye.key)return 1;const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return ti?1:0}equals(e){if(e.type===this.type){const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return this.key===e.key&&t===i}return!1}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1}serialize(){const e=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=jae.create(this)),this.negated}}class jae{static create(e){return new jae(e)}constructor(e){this._actual=e,this.type=8}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type?this._actual.equals(e._actual):!1}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}negate(){return this._actual}}function w3e(n){let e=null;for(let t=0,i=n.length;te.expr.length)return 1;for(let t=0,i=this.expr.length;t1;){const o=r[r.length-1];if(o.type!==9)break;r.pop();const a=r.pop(),l=r.length===0,c=s_.create(o.expr.map(u=>Dy.create([u,a],null,i)),null,l);c&&(r.push(c),r.sort(mI))}if(r.length===1)return r[0];if(i){for(let o=0;oe.serialize()).join(" && ")}keys(){const e=[];for(const t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(const t of this.expr)e.push(t.negate());this.negated=s_.create(e,this,!0)}return this.negated}}class s_{static create(e,t,i){return s_._normalizeArr(e,t,i)}constructor(e,t){this.expr=e,this.negated=t,this.type=9}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.lengthe.expr.length)return 1;for(let t=0,i=this.expr.length;te.serialize()).join(" || ")}keys(){const e=[];for(const t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(const t of this.expr)e.push(t.negate());for(;e.length>1;){const t=e.shift(),i=e.shift(),r=[];for(const s of ibe(t))for(const o of ibe(i))r.push(Dy.create([s,o],null,!1));e.unshift(s_.create(r,null,!1))}this.negated=s_.create(e,this,!0)}return this.negated}}class et extends mC{static{this._info=[]}static all(){return et._info.values()}constructor(e,t,i){super(e,null),this._defaultValue=t,typeof i=="object"?et._info.push({...i,key:e}):i!==!0&&et._info.push({key:e,description:i,type:t!=null?typeof t:void 0})}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return YL.create(this.key,e)}}const jt=On("contextKeyService");function C3e(n,e){return ne?1:0}function vC(n,e,t,i){return nt?1:ei?1:0}function SX(n,e){if(n.type===0||e.type===1)return!0;if(n.type===9)return e.type===9?nbe(n.expr,e.expr):!1;if(e.type===9){for(const t of e.expr)if(SX(n,t))return!0;return!1}if(n.type===6){if(e.type===6)return nbe(e.expr,n.expr);for(const t of n.expr)if(SX(t,e))return!0;return!1}return n.equals(e)}function nbe(n,e){let t=0,i=0;for(;t{a(),this._cachedMergedKeybindings=null})}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=Array.from(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(avt)),this._cachedMergedKeybindings.slice(0)}}const jl=new Kae,ovt={EditorModes:"platform.keybindingsRegistry"};Yr.add(ovt.EditorModes,jl);function avt(n,e){if(n.weight1!==e.weight1)return n.weight1-e.weight1;if(n.command&&e.command){if(n.commande.command)return 1}return n.weight2-e.weight2}var lvt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},sbe=function(n,e){return function(t,i){e(t,i,n)}},V5;function lk(n){return n.command!==void 0}function cvt(n){return n.submenu!==void 0}class ce{static{this._instances=new Map}static{this.CommandPalette=new ce("CommandPalette")}static{this.DebugBreakpointsContext=new ce("DebugBreakpointsContext")}static{this.DebugCallStackContext=new ce("DebugCallStackContext")}static{this.DebugConsoleContext=new ce("DebugConsoleContext")}static{this.DebugVariablesContext=new ce("DebugVariablesContext")}static{this.NotebookVariablesContext=new ce("NotebookVariablesContext")}static{this.DebugHoverContext=new ce("DebugHoverContext")}static{this.DebugWatchContext=new ce("DebugWatchContext")}static{this.DebugToolBar=new ce("DebugToolBar")}static{this.DebugToolBarStop=new ce("DebugToolBarStop")}static{this.DebugCallStackToolbar=new ce("DebugCallStackToolbar")}static{this.DebugCreateConfiguration=new ce("DebugCreateConfiguration")}static{this.EditorContext=new ce("EditorContext")}static{this.SimpleEditorContext=new ce("SimpleEditorContext")}static{this.EditorContent=new ce("EditorContent")}static{this.EditorLineNumberContext=new ce("EditorLineNumberContext")}static{this.EditorContextCopy=new ce("EditorContextCopy")}static{this.EditorContextPeek=new ce("EditorContextPeek")}static{this.EditorContextShare=new ce("EditorContextShare")}static{this.EditorTitle=new ce("EditorTitle")}static{this.EditorTitleRun=new ce("EditorTitleRun")}static{this.EditorTitleContext=new ce("EditorTitleContext")}static{this.EditorTitleContextShare=new ce("EditorTitleContextShare")}static{this.EmptyEditorGroup=new ce("EmptyEditorGroup")}static{this.EmptyEditorGroupContext=new ce("EmptyEditorGroupContext")}static{this.EditorTabsBarContext=new ce("EditorTabsBarContext")}static{this.EditorTabsBarShowTabsSubmenu=new ce("EditorTabsBarShowTabsSubmenu")}static{this.EditorTabsBarShowTabsZenModeSubmenu=new ce("EditorTabsBarShowTabsZenModeSubmenu")}static{this.EditorActionsPositionSubmenu=new ce("EditorActionsPositionSubmenu")}static{this.ExplorerContext=new ce("ExplorerContext")}static{this.ExplorerContextShare=new ce("ExplorerContextShare")}static{this.ExtensionContext=new ce("ExtensionContext")}static{this.GlobalActivity=new ce("GlobalActivity")}static{this.CommandCenter=new ce("CommandCenter")}static{this.CommandCenterCenter=new ce("CommandCenterCenter")}static{this.LayoutControlMenuSubmenu=new ce("LayoutControlMenuSubmenu")}static{this.LayoutControlMenu=new ce("LayoutControlMenu")}static{this.MenubarMainMenu=new ce("MenubarMainMenu")}static{this.MenubarAppearanceMenu=new ce("MenubarAppearanceMenu")}static{this.MenubarDebugMenu=new ce("MenubarDebugMenu")}static{this.MenubarEditMenu=new ce("MenubarEditMenu")}static{this.MenubarCopy=new ce("MenubarCopy")}static{this.MenubarFileMenu=new ce("MenubarFileMenu")}static{this.MenubarGoMenu=new ce("MenubarGoMenu")}static{this.MenubarHelpMenu=new ce("MenubarHelpMenu")}static{this.MenubarLayoutMenu=new ce("MenubarLayoutMenu")}static{this.MenubarNewBreakpointMenu=new ce("MenubarNewBreakpointMenu")}static{this.PanelAlignmentMenu=new ce("PanelAlignmentMenu")}static{this.PanelPositionMenu=new ce("PanelPositionMenu")}static{this.ActivityBarPositionMenu=new ce("ActivityBarPositionMenu")}static{this.MenubarPreferencesMenu=new ce("MenubarPreferencesMenu")}static{this.MenubarRecentMenu=new ce("MenubarRecentMenu")}static{this.MenubarSelectionMenu=new ce("MenubarSelectionMenu")}static{this.MenubarShare=new ce("MenubarShare")}static{this.MenubarSwitchEditorMenu=new ce("MenubarSwitchEditorMenu")}static{this.MenubarSwitchGroupMenu=new ce("MenubarSwitchGroupMenu")}static{this.MenubarTerminalMenu=new ce("MenubarTerminalMenu")}static{this.MenubarViewMenu=new ce("MenubarViewMenu")}static{this.MenubarHomeMenu=new ce("MenubarHomeMenu")}static{this.OpenEditorsContext=new ce("OpenEditorsContext")}static{this.OpenEditorsContextShare=new ce("OpenEditorsContextShare")}static{this.ProblemsPanelContext=new ce("ProblemsPanelContext")}static{this.SCMInputBox=new ce("SCMInputBox")}static{this.SCMChangesSeparator=new ce("SCMChangesSeparator")}static{this.SCMChangesContext=new ce("SCMChangesContext")}static{this.SCMIncomingChanges=new ce("SCMIncomingChanges")}static{this.SCMIncomingChangesContext=new ce("SCMIncomingChangesContext")}static{this.SCMIncomingChangesSetting=new ce("SCMIncomingChangesSetting")}static{this.SCMOutgoingChanges=new ce("SCMOutgoingChanges")}static{this.SCMOutgoingChangesContext=new ce("SCMOutgoingChangesContext")}static{this.SCMOutgoingChangesSetting=new ce("SCMOutgoingChangesSetting")}static{this.SCMIncomingChangesAllChangesContext=new ce("SCMIncomingChangesAllChangesContext")}static{this.SCMIncomingChangesHistoryItemContext=new ce("SCMIncomingChangesHistoryItemContext")}static{this.SCMOutgoingChangesAllChangesContext=new ce("SCMOutgoingChangesAllChangesContext")}static{this.SCMOutgoingChangesHistoryItemContext=new ce("SCMOutgoingChangesHistoryItemContext")}static{this.SCMChangeContext=new ce("SCMChangeContext")}static{this.SCMResourceContext=new ce("SCMResourceContext")}static{this.SCMResourceContextShare=new ce("SCMResourceContextShare")}static{this.SCMResourceFolderContext=new ce("SCMResourceFolderContext")}static{this.SCMResourceGroupContext=new ce("SCMResourceGroupContext")}static{this.SCMSourceControl=new ce("SCMSourceControl")}static{this.SCMSourceControlInline=new ce("SCMSourceControlInline")}static{this.SCMSourceControlTitle=new ce("SCMSourceControlTitle")}static{this.SCMHistoryTitle=new ce("SCMHistoryTitle")}static{this.SCMTitle=new ce("SCMTitle")}static{this.SearchContext=new ce("SearchContext")}static{this.SearchActionMenu=new ce("SearchActionContext")}static{this.StatusBarWindowIndicatorMenu=new ce("StatusBarWindowIndicatorMenu")}static{this.StatusBarRemoteIndicatorMenu=new ce("StatusBarRemoteIndicatorMenu")}static{this.StickyScrollContext=new ce("StickyScrollContext")}static{this.TestItem=new ce("TestItem")}static{this.TestItemGutter=new ce("TestItemGutter")}static{this.TestProfilesContext=new ce("TestProfilesContext")}static{this.TestMessageContext=new ce("TestMessageContext")}static{this.TestMessageContent=new ce("TestMessageContent")}static{this.TestPeekElement=new ce("TestPeekElement")}static{this.TestPeekTitle=new ce("TestPeekTitle")}static{this.TestCallStack=new ce("TestCallStack")}static{this.TouchBarContext=new ce("TouchBarContext")}static{this.TitleBarContext=new ce("TitleBarContext")}static{this.TitleBarTitleContext=new ce("TitleBarTitleContext")}static{this.TunnelContext=new ce("TunnelContext")}static{this.TunnelPrivacy=new ce("TunnelPrivacy")}static{this.TunnelProtocol=new ce("TunnelProtocol")}static{this.TunnelPortInline=new ce("TunnelInline")}static{this.TunnelTitle=new ce("TunnelTitle")}static{this.TunnelLocalAddressInline=new ce("TunnelLocalAddressInline")}static{this.TunnelOriginInline=new ce("TunnelOriginInline")}static{this.ViewItemContext=new ce("ViewItemContext")}static{this.ViewContainerTitle=new ce("ViewContainerTitle")}static{this.ViewContainerTitleContext=new ce("ViewContainerTitleContext")}static{this.ViewTitle=new ce("ViewTitle")}static{this.ViewTitleContext=new ce("ViewTitleContext")}static{this.CommentEditorActions=new ce("CommentEditorActions")}static{this.CommentThreadTitle=new ce("CommentThreadTitle")}static{this.CommentThreadActions=new ce("CommentThreadActions")}static{this.CommentThreadAdditionalActions=new ce("CommentThreadAdditionalActions")}static{this.CommentThreadTitleContext=new ce("CommentThreadTitleContext")}static{this.CommentThreadCommentContext=new ce("CommentThreadCommentContext")}static{this.CommentTitle=new ce("CommentTitle")}static{this.CommentActions=new ce("CommentActions")}static{this.CommentsViewThreadActions=new ce("CommentsViewThreadActions")}static{this.InteractiveToolbar=new ce("InteractiveToolbar")}static{this.InteractiveCellTitle=new ce("InteractiveCellTitle")}static{this.InteractiveCellDelete=new ce("InteractiveCellDelete")}static{this.InteractiveCellExecute=new ce("InteractiveCellExecute")}static{this.InteractiveInputExecute=new ce("InteractiveInputExecute")}static{this.InteractiveInputConfig=new ce("InteractiveInputConfig")}static{this.ReplInputExecute=new ce("ReplInputExecute")}static{this.IssueReporter=new ce("IssueReporter")}static{this.NotebookToolbar=new ce("NotebookToolbar")}static{this.NotebookStickyScrollContext=new ce("NotebookStickyScrollContext")}static{this.NotebookCellTitle=new ce("NotebookCellTitle")}static{this.NotebookCellDelete=new ce("NotebookCellDelete")}static{this.NotebookCellInsert=new ce("NotebookCellInsert")}static{this.NotebookCellBetween=new ce("NotebookCellBetween")}static{this.NotebookCellListTop=new ce("NotebookCellTop")}static{this.NotebookCellExecute=new ce("NotebookCellExecute")}static{this.NotebookCellExecuteGoTo=new ce("NotebookCellExecuteGoTo")}static{this.NotebookCellExecutePrimary=new ce("NotebookCellExecutePrimary")}static{this.NotebookDiffCellInputTitle=new ce("NotebookDiffCellInputTitle")}static{this.NotebookDiffCellMetadataTitle=new ce("NotebookDiffCellMetadataTitle")}static{this.NotebookDiffCellOutputsTitle=new ce("NotebookDiffCellOutputsTitle")}static{this.NotebookOutputToolbar=new ce("NotebookOutputToolbar")}static{this.NotebookOutlineFilter=new ce("NotebookOutlineFilter")}static{this.NotebookOutlineActionMenu=new ce("NotebookOutlineActionMenu")}static{this.NotebookEditorLayoutConfigure=new ce("NotebookEditorLayoutConfigure")}static{this.NotebookKernelSource=new ce("NotebookKernelSource")}static{this.BulkEditTitle=new ce("BulkEditTitle")}static{this.BulkEditContext=new ce("BulkEditContext")}static{this.TimelineItemContext=new ce("TimelineItemContext")}static{this.TimelineTitle=new ce("TimelineTitle")}static{this.TimelineTitleContext=new ce("TimelineTitleContext")}static{this.TimelineFilterSubMenu=new ce("TimelineFilterSubMenu")}static{this.AccountsContext=new ce("AccountsContext")}static{this.SidebarTitle=new ce("SidebarTitle")}static{this.PanelTitle=new ce("PanelTitle")}static{this.AuxiliaryBarTitle=new ce("AuxiliaryBarTitle")}static{this.AuxiliaryBarHeader=new ce("AuxiliaryBarHeader")}static{this.TerminalInstanceContext=new ce("TerminalInstanceContext")}static{this.TerminalEditorInstanceContext=new ce("TerminalEditorInstanceContext")}static{this.TerminalNewDropdownContext=new ce("TerminalNewDropdownContext")}static{this.TerminalTabContext=new ce("TerminalTabContext")}static{this.TerminalTabEmptyAreaContext=new ce("TerminalTabEmptyAreaContext")}static{this.TerminalStickyScrollContext=new ce("TerminalStickyScrollContext")}static{this.WebviewContext=new ce("WebviewContext")}static{this.InlineCompletionsActions=new ce("InlineCompletionsActions")}static{this.InlineEditsActions=new ce("InlineEditsActions")}static{this.InlineEditActions=new ce("InlineEditActions")}static{this.NewFile=new ce("NewFile")}static{this.MergeInput1Toolbar=new ce("MergeToolbar1Toolbar")}static{this.MergeInput2Toolbar=new ce("MergeToolbar2Toolbar")}static{this.MergeBaseToolbar=new ce("MergeBaseToolbar")}static{this.MergeInputResultToolbar=new ce("MergeToolbarResultToolbar")}static{this.InlineSuggestionToolbar=new ce("InlineSuggestionToolbar")}static{this.InlineEditToolbar=new ce("InlineEditToolbar")}static{this.ChatContext=new ce("ChatContext")}static{this.ChatCodeBlock=new ce("ChatCodeblock")}static{this.ChatCompareBlock=new ce("ChatCompareBlock")}static{this.ChatMessageTitle=new ce("ChatMessageTitle")}static{this.ChatExecute=new ce("ChatExecute")}static{this.ChatExecuteSecondary=new ce("ChatExecuteSecondary")}static{this.ChatInputSide=new ce("ChatInputSide")}static{this.AccessibleView=new ce("AccessibleView")}static{this.MultiDiffEditorFileToolbar=new ce("MultiDiffEditorFileToolbar")}static{this.DiffEditorHunkToolbar=new ce("DiffEditorHunkToolbar")}static{this.DiffEditorSelectionToolbar=new ce("DiffEditorSelectionToolbar")}constructor(e){if(ce._instances.has(e))throw new TypeError(`MenuId with identifier '${e}' already exists. Use MenuId.for(ident) or a unique identifier`);ce._instances.set(e,this),this.id=e}}const ld=On("menuService");class hv{static{this._all=new Map}static for(e){let t=this._all.get(e);return t||(t=new hv(e),this._all.set(e,t)),t}static merge(e){const t=new Set;for(const i of e)i instanceof hv&&t.add(i.id);return t}constructor(e){this.id=e,this.has=t=>t===e}}const Fo=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Smt({merge:hv.merge}),this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(n){return this._commands.set(n.id,n),this._onDidChangeMenu.fire(hv.for(ce.CommandPalette)),Lt(()=>{this._commands.delete(n.id)&&this._onDidChangeMenu.fire(hv.for(ce.CommandPalette))})}getCommand(n){return this._commands.get(n)}getCommands(){const n=new Map;return this._commands.forEach((e,t)=>n.set(t,e)),n}appendMenuItem(n,e){let t=this._menuItems.get(n);t||(t=new Rl,this._menuItems.set(n,t));const i=t.push(e);return this._onDidChangeMenu.fire(hv.for(n)),Lt(()=>{i(),this._onDidChangeMenu.fire(hv.for(n))})}appendMenuItems(n){const e=new ke;for(const{id:t,item:i}of n)e.add(this.appendMenuItem(t,i));return e}getMenuItems(n){let e;return this._menuItems.has(n)?e=[...this._menuItems.get(n)]:e=[],n===ce.CommandPalette&&this._appendImplicitItems(e),e}_appendImplicitItems(n){const e=new Set;for(const t of n)lk(t)&&(e.add(t.command.id),t.alt&&e.add(t.alt.id));this._commands.forEach((t,i)=>{e.has(i)||n.push({command:t})})}};class ck extends rE{constructor(e,t,i){super(`submenuitem.${e.submenu.id}`,typeof e.title=="string"?e.title:e.title.value,i,"submenu"),this.item=e,this.hideActions=t}}let ou=V5=class{static label(e,t){return t?.renderShortTitle&&e.shortTitle?typeof e.shortTitle=="string"?e.shortTitle:e.shortTitle.value:typeof e.title=="string"?e.title:e.title.value}constructor(e,t,i,r,s,o,a){this.hideActions=r,this.menuKeybinding=s,this._commandService=a,this.id=e.id,this.label=V5.label(e,i),this.tooltip=(typeof e.tooltip=="string"?e.tooltip:e.tooltip?.value)??"",this.enabled=!e.precondition||o.contextMatchesRules(e.precondition),this.checked=void 0;let l;if(e.toggled){const c=e.toggled.condition?e.toggled:{condition:e.toggled};this.checked=o.contextMatchesRules(c.condition),this.checked&&c.tooltip&&(this.tooltip=typeof c.tooltip=="string"?c.tooltip:c.tooltip.value),this.checked&&zt.isThemeIcon(c.icon)&&(l=c.icon),this.checked&&c.title&&(this.label=typeof c.title=="string"?c.title:c.title.value)}l||(l=zt.isThemeIcon(e.icon)?e.icon:void 0),this.item=e,this.alt=t?new V5(t,void 0,i,r,void 0,o,a):void 0,this._options=i,this.class=l&&zt.asClassName(l)}run(...e){let t=[];return this._options?.arg&&(t=[...t,this._options.arg]),this._options?.shouldForwardArgs&&(t=[...t,...e]),this._commandService.executeCommand(this.id,...t)}};ou=V5=lvt([sbe(5,jt),sbe(6,_r)],ou);class Gl{constructor(e){this.desc=e}}function lr(n){const e=[],t=new n,{f1:i,menu:r,keybinding:s,...o}=t.desc;if(Un.getCommand(o.id))throw new Error(`Cannot register two commands with the same id: ${o.id}`);if(e.push(Un.registerCommand({id:o.id,handler:(a,...l)=>t.run(a,...l),metadata:o.metadata})),Array.isArray(r))for(const a of r)e.push(Fo.appendMenuItem(a.id,{command:{...o,precondition:a.precondition===null?void 0:o.precondition},...a}));else r&&e.push(Fo.appendMenuItem(r.id,{command:{...o,precondition:r.precondition===null?void 0:o.precondition},...r}));if(i&&(e.push(Fo.appendMenuItem(ce.CommandPalette,{command:o,when:o.precondition})),e.push(Fo.addCommand(o))),Array.isArray(s))for(const a of s)e.push(jl.registerKeybindingRule({...a,id:o.id,when:o.precondition?Le.and(o.precondition,a.when):a.when}));else s&&e.push(jl.registerKeybindingRule({...s,id:o.id,when:o.precondition?Le.and(o.precondition,s.when):s.when}));return{dispose(){er(e)}}}const Qa=On("telemetryService"),Da=On("logService");var dc;(function(n){n[n.Off=0]="Off",n[n.Trace=1]="Trace",n[n.Debug=2]="Debug",n[n.Info=3]="Info",n[n.Warning=4]="Warning",n[n.Error=5]="Error"})(dc||(dc={}));const x3e=dc.Info;class S3e extends me{constructor(){super(...arguments),this.level=x3e,this._onDidChangeLogLevel=this._register(new fe),this.onDidChangeLogLevel=this._onDidChangeLogLevel.event}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(e){return this.level!==dc.Off&&this.level<=e}}class uvt extends S3e{constructor(e=x3e,t=!0){super(),this.useColors=t,this.setLevel(e)}trace(e,...t){this.checkLogLevel(dc.Trace)&&(this.useColors?console.log("%cTRACE","color: #888",e,...t):console.log(e,...t))}debug(e,...t){this.checkLogLevel(dc.Debug)&&(this.useColors?console.log("%cDEBUG","background: #eee; color: #888",e,...t):console.log(e,...t))}info(e,...t){this.checkLogLevel(dc.Info)&&(this.useColors?console.log("%c INFO","color: #33f",e,...t):console.log(e,...t))}warn(e,...t){this.checkLogLevel(dc.Warning)&&(this.useColors?console.log("%c WARN","color: #993",e,...t):console.log(e,...t))}error(e,...t){this.checkLogLevel(dc.Error)&&(this.useColors?console.log("%c ERR","color: #f33",e,...t):console.error(e,...t))}}class dvt extends S3e{constructor(e){super(),this.loggers=e,e.length&&this.setLevel(e[0].getLevel())}setLevel(e){for(const t of this.loggers)t.setLevel(e);super.setLevel(e)}trace(e,...t){for(const i of this.loggers)i.trace(e,...t)}debug(e,...t){for(const i of this.loggers)i.debug(e,...t)}info(e,...t){for(const i of this.loggers)i.info(e,...t)}warn(e,...t){for(const i of this.loggers)i.warn(e,...t)}error(e,...t){for(const i of this.loggers)i.error(e,...t)}dispose(){for(const e of this.loggers)e.dispose();super.dispose()}}function hvt(n){switch(n){case dc.Trace:return"trace";case dc.Debug:return"debug";case dc.Info:return"info";case dc.Warning:return"warn";case dc.Error:return"error";case dc.Off:return"off"}}new et("logLevel",hvt(dc.Info));let X$=class{constructor(e){this.id=e.id,this.precondition=e.precondition,this._kbOpts=e.kbOpts,this._menuOpts=e.menuOpts,this.metadata=e.metadata}register(){if(Array.isArray(this._menuOpts)?this._menuOpts.forEach(this._registerMenuItem,this):this._menuOpts&&this._registerMenuItem(this._menuOpts),this._kbOpts){const e=Array.isArray(this._kbOpts)?this._kbOpts:[this._kbOpts];for(const t of e){let i=t.kbExpr;this.precondition&&(i?i=Le.and(i,this.precondition):i=this.precondition);const r={id:this.id,weight:t.weight,args:t.args,when:i,primary:t.primary,secondary:t.secondary,win:t.win,linux:t.linux,mac:t.mac};jl.registerKeybindingRule(r)}}Un.registerCommand({id:this.id,handler:(e,t)=>this.runCommand(e,t),metadata:this.metadata})}_registerMenuItem(e){Fo.appendMenuItem(e.menuId,{group:e.group,command:{id:this.id,title:e.title,icon:e.icon,precondition:this.precondition},when:e.when,order:e.order})}};class ZL extends X${constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t,i,r){return this._implementations.push({priority:e,name:t,implementation:i,when:r}),this._implementations.sort((s,o)=>o.priority-s.priority),{dispose:()=>{for(let s=0;s{if(a.get(jt).contextMatchesRules(i??void 0))return r(a,o,t)})}runCommand(e,t){return fo.runEditorCommand(e,t,this.precondition,(i,r,s)=>this.runEditorCommand(i,r,s))}}class ot extends fo{static convertOptions(e){let t;Array.isArray(e.menuOpts)?t=e.menuOpts:e.menuOpts?t=[e.menuOpts]:t=[];function i(r){return r.menuId||(r.menuId=ce.EditorContext),r.title||(r.title=e.label),r.when=Le.and(e.precondition,r.when),r}return Array.isArray(e.contextMenuOpts)?t.push(...e.contextMenuOpts.map(i)):e.contextMenuOpts&&t.push(i(e.contextMenuOpts)),e.menuOpts=t,e}constructor(e){super(ot.convertOptions(e)),this.label=e.label,this.alias=e.alias}runEditorCommand(e,t,i){return this.reportTelemetry(e,t),this.run(e,t,i||{})}reportTelemetry(e,t){e.get(Qa).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}}class E3e extends ot{constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t){return this._implementations.push([e,t]),this._implementations.sort((i,r)=>r[0]-i[0]),{dispose:()=>{for(let i=0;i{const o=s.get(jt),a=s.get(Da);if(!o.contextMatchesRules(this.desc.precondition??void 0)){a.debug("[EditorAction2] NOT running command because its precondition is FALSE",this.desc.id,this.desc.precondition?.serialize());return}return this.runEditorCommand(s,r,...t)})}}function Rc(n,e){Un.registerCommand(n,function(t,...i){const r=t.get(Tt),[s,o]=i;oi(Pt.isUri(s)),oi(he.isIPosition(o));const a=t.get(Sr).getModel(s);if(a){const l=he.lift(o);return r.invokeFunction(e,a,l,...i.slice(2))}return t.get(Nc).createModelReference(s).then(l=>new Promise((c,u)=>{try{const d=r.invokeFunction(e,l.object.textEditorModel,he.lift(o),i.slice(2));c(d)}catch(d){u(d)}}).finally(()=>{l.dispose()}))})}function Je(n){return Od.INSTANCE.registerEditorCommand(n),n}function Pe(n){const e=new n;return Od.INSTANCE.registerEditorAction(e),e}function L3e(n){return Od.INSTANCE.registerEditorAction(n),n}function fvt(n){Od.INSTANCE.registerEditorAction(n)}function Zn(n,e,t){Od.INSTANCE.registerEditorContribution(n,e,t)}var Zy;(function(n){function e(o){return Od.INSTANCE.getEditorCommand(o)}n.getEditorCommand=e;function t(){return Od.INSTANCE.getEditorActions()}n.getEditorActions=t;function i(){return Od.INSTANCE.getEditorContributions()}n.getEditorContributions=i;function r(o){return Od.INSTANCE.getEditorContributions().filter(a=>o.indexOf(a.id)>=0)}n.getSomeEditorContributions=r;function s(){return Od.INSTANCE.getDiffEditorContributions()}n.getDiffEditorContributions=s})(Zy||(Zy={}));const gvt={EditorCommonContributions:"editor.contributions"};class Od{static{this.INSTANCE=new Od}constructor(){this.editorContributions=[],this.diffEditorContributions=[],this.editorActions=[],this.editorCommands=Object.create(null)}registerEditorContribution(e,t,i){this.editorContributions.push({id:e,ctor:t,instantiation:i})}getEditorContributions(){return this.editorContributions.slice(0)}getDiffEditorContributions(){return this.diffEditorContributions.slice(0)}registerEditorAction(e){e.register(),this.editorActions.push(e)}getEditorActions(){return this.editorActions}registerEditorCommand(e){e.register(),this.editorCommands[e.id]=e}getEditorCommand(e){return this.editorCommands[e]||null}}Yr.add(gvt.EditorCommonContributions,Od.INSTANCE);function ZP(n){return n.register(),n}const T3e=ZP(new ZL({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2104},menuOpts:[{menuId:ce.MenubarEditMenu,group:"1_do",title:w({key:"miUndo",comment:["&& denotes a mnemonic"]},"&&Undo"),order:1},{menuId:ce.CommandPalette,group:"",title:w("undo","Undo"),order:1}]}));ZP(new k3e(T3e,{id:"default:undo",precondition:void 0}));const D3e=ZP(new ZL({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2103,secondary:[3128],mac:{primary:3128}},menuOpts:[{menuId:ce.MenubarEditMenu,group:"1_do",title:w({key:"miRedo",comment:["&& denotes a mnemonic"]},"&&Redo"),order:2},{menuId:ce.CommandPalette,group:"",title:w("redo","Redo"),order:1}]}));ZP(new k3e(D3e,{id:"default:redo",precondition:void 0}));const pvt=ZP(new ZL({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2079},menuOpts:[{menuId:ce.MenubarSelectionMenu,group:"1_basic",title:w({key:"miSelectAll",comment:["&& denotes a mnemonic"]},"&&Select All"),order:1},{menuId:ce.CommandPalette,group:"",title:w("selectAll","Select All"),order:1}]})),obe="default",mvt="$initialize";let abe=!1;function kX(n){pC&&(abe||(abe=!0,console.warn("Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq")),console.warn(n.message))}class _vt{constructor(e,t,i,r,s){this.vsWorker=e,this.req=t,this.channel=i,this.method=r,this.args=s,this.type=0}}class lbe{constructor(e,t,i,r){this.vsWorker=e,this.seq=t,this.res=i,this.err=r,this.type=1}}class vvt{constructor(e,t,i,r,s){this.vsWorker=e,this.req=t,this.channel=i,this.eventName=r,this.arg=s,this.type=2}}class bvt{constructor(e,t,i){this.vsWorker=e,this.req=t,this.event=i,this.type=3}}class yvt{constructor(e,t){this.vsWorker=e,this.req=t,this.type=4}}class wvt{constructor(e){this._workerId=-1,this._handler=e,this._lastSentReq=0,this._pendingReplies=Object.create(null),this._pendingEmitters=new Map,this._pendingEvents=new Map}setWorkerId(e){this._workerId=e}sendMessage(e,t,i){const r=String(++this._lastSentReq);return new Promise((s,o)=>{this._pendingReplies[r]={resolve:s,reject:o},this._send(new _vt(this._workerId,r,e,t,i))})}listen(e,t,i){let r=null;const s=new fe({onWillAddFirstListener:()=>{r=String(++this._lastSentReq),this._pendingEmitters.set(r,s),this._send(new vvt(this._workerId,r,e,t,i))},onDidRemoveLastListener:()=>{this._pendingEmitters.delete(r),this._send(new yvt(this._workerId,r)),r=null}});return s.event}handleMessage(e){!e||!e.vsWorker||this._workerId!==-1&&e.vsWorker!==this._workerId||this._handleMessage(e)}createProxyToRemoteChannel(e,t){const i={get:(r,s)=>(typeof s=="string"&&!r[s]&&(A3e(s)?r[s]=o=>this.listen(e,s,o):I3e(s)?r[s]=this.listen(e,s,void 0):s.charCodeAt(0)===36&&(r[s]=async(...o)=>(await t?.(),this.sendMessage(e,s,o)))),r[s])};return new Proxy(Object.create(null),i)}_handleMessage(e){switch(e.type){case 1:return this._handleReplyMessage(e);case 0:return this._handleRequestMessage(e);case 2:return this._handleSubscribeEventMessage(e);case 3:return this._handleEventMessage(e);case 4:return this._handleUnsubscribeEventMessage(e)}}_handleReplyMessage(e){if(!this._pendingReplies[e.seq]){console.warn("Got reply to unknown seq");return}const t=this._pendingReplies[e.seq];if(delete this._pendingReplies[e.seq],e.err){let i=e.err;e.err.$isError&&(i=new Error,i.name=e.err.name,i.message=e.err.message,i.stack=e.err.stack),t.reject(i);return}t.resolve(e.res)}_handleRequestMessage(e){const t=e.req;this._handler.handleMessage(e.channel,e.method,e.args).then(r=>{this._send(new lbe(this._workerId,t,r,void 0))},r=>{r.detail instanceof Error&&(r.detail=Pve(r.detail)),this._send(new lbe(this._workerId,t,void 0,Pve(r)))})}_handleSubscribeEventMessage(e){const t=e.req,i=this._handler.handleEvent(e.channel,e.eventName,e.arg)(r=>{this._send(new bvt(this._workerId,t,r))});this._pendingEvents.set(t,i)}_handleEventMessage(e){if(!this._pendingEmitters.has(e.req)){console.warn("Got event for unknown req");return}this._pendingEmitters.get(e.req).fire(e.event)}_handleUnsubscribeEventMessage(e){if(!this._pendingEvents.has(e.req)){console.warn("Got unsubscribe for unknown req");return}this._pendingEvents.get(e.req).dispose(),this._pendingEvents.delete(e.req)}_send(e){const t=[];if(e.type===0)for(let i=0;i{this._protocol.handleMessage(s)},s=>{rn(s)})),this._protocol=new wvt({sendMessage:(s,o)=>{this._worker.postMessage(s,o)},handleMessage:(s,o,a)=>this._handleMessage(s,o,a),handleEvent:(s,o,a)=>this._handleEvent(s,o,a)}),this._protocol.setWorkerId(this._worker.getId());let i=null;const r=globalThis.require;typeof r<"u"&&typeof r.getConfig=="function"?i=r.getConfig():typeof globalThis.requirejs<"u"&&(i=globalThis.requirejs.s.contexts._.config),this._onModuleLoaded=this._protocol.sendMessage(obe,mvt,[this._worker.getId(),JSON.parse(JSON.stringify(i)),t.amdModuleId]),this.proxy=this._protocol.createProxyToRemoteChannel(obe,async()=>{await this._onModuleLoaded}),this._onModuleLoaded.catch(s=>{this._onError("Worker failed to load "+t.amdModuleId,s)})}_handleMessage(e,t,i){const r=this._localChannels.get(e);if(!r)return Promise.reject(new Error(`Missing channel ${e} on main thread`));if(typeof r[t]!="function")return Promise.reject(new Error(`Missing method ${t} on main thread channel ${e}`));try{return Promise.resolve(r[t].apply(r,i))}catch(s){return Promise.reject(s)}}_handleEvent(e,t,i){const r=this._localChannels.get(e);if(!r)throw new Error(`Missing channel ${e} on main thread`);if(A3e(t)){const s=r[t].call(r,i);if(typeof s!="function")throw new Error(`Missing dynamic event ${t} on main thread channel ${e}.`);return s}if(I3e(t)){const s=r[t];if(typeof s!="function")throw new Error(`Missing event ${t} on main thread channel ${e}.`);return s}throw new Error(`Malformed event name ${t}`)}setChannel(e,t){this._localChannels.set(e,t)}_onError(e,t){console.error(e),console.info(t)}}function I3e(n){return n[0]==="o"&&n[1]==="n"&&fp(n.charCodeAt(2))}function A3e(n){return/^onDynamic/.test(n)&&fp(n.charCodeAt(9))}function p0(n,e){const t=globalThis.MonacoEnvironment;if(t?.createTrustedTypesPolicy)try{return t.createTrustedTypesPolicy(n,e)}catch(i){rn(i);return}try{return globalThis.trustedTypes?.createPolicy(n,e)}catch(i){rn(i);return}}let yS;typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope"&&globalThis.workerttPolicy!==void 0?yS=globalThis.workerttPolicy:yS=p0("defaultWorkerFactory",{createScriptURL:n=>n});function xvt(n,e){const t=globalThis.MonacoEnvironment;if(t){if(typeof t.getWorker=="function")return t.getWorker("workerMain.js",e);if(typeof t.getWorkerUrl=="function"){const i=t.getWorkerUrl("workerMain.js",e);return new Worker(yS?yS.createScriptURL(i):i,{name:e,type:"module"})}}if(n){const i=Svt(e,n.toString(!0)),r=new Worker(yS?yS.createScriptURL(i):i,{name:e,type:"module"});return kvt(r)}throw new Error("You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker")}function Svt(n,e,t){if(!(/^((http:)|(https:)|(file:)|(vscode-file:))/.test(e)&&e.substring(0,globalThis.origin.length)!==globalThis.origin)){const s=e.lastIndexOf("?"),o=e.lastIndexOf("#",s),a=s>0?new URLSearchParams(e.substring(s+1,~o?o:void 0)):new URLSearchParams;_X.addSearchParam(a,!0,!0),a.toString()?e=`${e}?${a.toString()}#${n}`:e=`${e}#${n}`}const r=new Blob([rf([`/*${n}*/`,void 0,`globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(d4e())};`,`globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(gae())};`,`globalThis._VSCODE_FILE_ROOT = '${globalThis._VSCODE_FILE_ROOT}';`,"const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });","globalThis.workerttPolicy = ttPolicy;",`await import(ttPolicy?.createScriptURL('${e}') ?? '${e}');`,"globalThis.postMessage({ type: 'vscode-worker-ready' });",`/*${n}*/`]).join("")],{type:"application/javascript"});return URL.createObjectURL(r)}function kvt(n){return new Promise((e,t)=>{n.onmessage=function(i){i.data.type==="vscode-worker-ready"&&(n.onmessage=null,e(n))},n.onerror=t})}function Evt(n){return typeof n.then=="function"}class Lvt extends me{constructor(e,t,i,r,s,o){super(),this.id=i,this.label=r;const a=xvt(e,r);Evt(a)?this.worker=a:this.worker=Promise.resolve(a),this.postMessage(t,[]),this.worker.then(l=>{l.onmessage=function(c){s(c.data)},l.onmessageerror=o,typeof l.addEventListener=="function"&&l.addEventListener("error",o)}),this._register(Lt(()=>{this.worker?.then(l=>{l.onmessage=null,l.onmessageerror=null,l.removeEventListener("error",o),l.terminate()}),this.worker=null}))}getId(){return this.id}postMessage(e,t){this.worker?.then(i=>{try{i.postMessage(e,t)}catch(r){rn(r),rn(new Error(`FAILED to post message to '${this.label}'-worker`,{cause:r}))}})}}class Tvt{constructor(e,t){this.amdModuleId=e,this.label=t,this.esmModuleLocation=M$.asBrowserUri(`${e}.esm.js`)}}class Gae{static{this.LAST_WORKER_ID=0}constructor(){this._webWorkerFailedBeforeError=!1}create(e,t,i){const r=++Gae.LAST_WORKER_ID;if(this._webWorkerFailedBeforeError)throw this._webWorkerFailedBeforeError;return new Lvt(e.esmModuleLocation,e.amdModuleId,r,e.label||"anonymous"+r,t,s=>{kX(s),this._webWorkerFailedBeforeError=s,i(s)})}}function Dvt(n,e){const t=typeof n=="string"?new Tvt(n,e):n;return new Cvt(new Gae,t)}var zs;(function(n){n[n.None=0]="None",n[n.Indent=1]="Indent",n[n.IndentOutdent=2]="IndentOutdent",n[n.Outdent=3]="Outdent"})(zs||(zs={}));class Ij{constructor(e){if(this._neutralCharacter=null,this._neutralCharacterSearched=!1,this.open=e.open,this.close=e.close,this._inString=!0,this._inComment=!0,this._inRegEx=!0,Array.isArray(e.notIn))for(let t=0,i=e.notIn.length;t `}static{this.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS=`'"\`;:.,=}])> - `}constructor(e){if(e.autoClosingPairs?this._autoClosingPairs=e.autoClosingPairs.map(t=>new Ij(t)):e.brackets?this._autoClosingPairs=e.brackets.map(t=>new Ij({open:t[0],close:t[1]})):this._autoClosingPairs=[],e.__electricCharacterSupport&&e.__electricCharacterSupport.docComment){const t=e.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new Ij({open:t.open,close:t.close||""}))}this._autoCloseBeforeForQuotes=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:Q6.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES,this._autoCloseBeforeForBrackets=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:Q6.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS,this._surroundingPairs=e.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(e){return e?this._autoCloseBeforeForQuotes:this._autoCloseBeforeForBrackets}getSurroundingPairs(){return this._surroundingPairs}}function Iy(n,e){const t=n.getCount(),i=n.findTokenIndexAtOffset(e),r=n.getLanguageId(i);let s=i;for(;s+10&&n.getLanguageId(o-1)===r;)o--;return new Avt(n,r,o,s+1,n.getStartOffset(o),n.getEndOffset(s))}class Avt{constructor(e,t,i,r,s,o){this._scopedLineTokensBrand=void 0,this._actual=e,this.languageId=t,this._firstTokenIndex=i,this._lastTokenIndex=r,this.firstCharOffset=s,this._lastCharOffset=o,this.languageIdCodec=e.languageIdCodec}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getLineLength(){return this._lastCharOffset-this.firstCharOffset}getActualLineContentBefore(e){return this._actual.getLineContent().substring(0,this.firstCharOffset+e)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(e){return this._actual.findTokenIndexAtOffset(e+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(e){return this._actual.getStandardTokenType(e+this._firstTokenIndex)}toIViewLineTokens(){return this._actual.sliceAndInflate(this.firstCharOffset,this._lastCharOffset,0)}}function np(n){return(n&3)!==0}const cbe=typeof Buffer<"u";let Aj;class Q${static wrap(e){return cbe&&!Buffer.isBuffer(e)&&(e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)),new Q$(e)}constructor(e){this.buffer=e,this.byteLength=this.buffer.byteLength}toString(){return cbe?this.buffer.toString():(Aj||(Aj=new TextDecoder),Aj.decode(this.buffer))}}function Nvt(n,e){return n[e+0]<<0>>>0|n[e+1]<<8>>>0}function Rvt(n,e,t){n[t+0]=e&255,e=e>>>8,n[t+1]=e&255}function $f(n,e){return n[e]*2**24+n[e+1]*2**16+n[e+2]*2**8+n[e+3]}function Wf(n,e,t){n[t+3]=e,e=e>>>8,n[t+2]=e,e=e>>>8,n[t+1]=e,e=e>>>8,n[t]=e}function ube(n,e){return n[e]}function dbe(n,e,t){n[t]=e}let Nj;function N3e(){return Nj||(Nj=new TextDecoder("UTF-16LE")),Nj}let Rj;function Pvt(){return Rj||(Rj=new TextDecoder("UTF-16BE")),Rj}let Pj;function R3e(){return Pj||(Pj=_4e()?N3e():Pvt()),Pj}function Ovt(n,e,t){const i=new Uint16Array(n.buffer,e,t);return t>0&&(i[0]===65279||i[0]===65534)?Mvt(n,e,t):N3e().decode(i)}function Mvt(n,e,t){const i=[];let r=0;for(let s=0;s=this._capacity){this._flushBuffer(),this._completedStrings[this._completedStrings.length]=e;return}for(let i=0;i[o[0].toLowerCase(),o[1].toLowerCase()]);const t=[];for(let o=0;o{const[l,c]=o,[u,d]=a;return l===u||l===d||c===u||c===d},r=(o,a)=>{const l=Math.min(o,a),c=Math.max(o,a);for(let u=0;u0&&s.push({open:a,close:l})}return s}class Bvt{constructor(e,t){this._richEditBracketsBrand=void 0;const i=Fvt(t);this.brackets=i.map((r,s)=>new J6(e,s,r.open,r.close,$vt(r.open,r.close,i,s),Wvt(r.open,r.close,i,s))),this.forwardRegex=Hvt(this.brackets),this.reversedRegex=Vvt(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(const r of this.brackets){for(const s of r.open)this.textIsBracket[s]=r,this.textIsOpenBracket[s]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,s.length);for(const s of r.close)this.textIsBracket[s]=r,this.textIsOpenBracket[s]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,s.length)}}}function P3e(n,e,t,i){for(let r=0,s=e.length;r=0&&i.push(a);for(const a of o.close)a.indexOf(n)>=0&&i.push(a)}}function O3e(n,e){return n.length-e.length}function J$(n){if(n.length<=1)return n;const e=[],t=new Set;for(const i of n)t.has(i)||(e.push(i),t.add(i));return e}function $vt(n,e,t,i){let r=[];r=r.concat(n),r=r.concat(e);for(let s=0,o=r.length;s=0;o--)r[s++]=i.charCodeAt(o);return R3e().decode(r)}let e=null,t=null;return function(r){return e!==r&&(e=r,t=n(e)),t}}();class Lh{static _findPrevBracketInText(e,t,i,r){const s=i.match(e);if(!s)return null;const o=i.length-(s.index||0),a=s[0].length,l=r+o;return new $(t,l-a+1,t,l+1)}static findPrevBracketInRange(e,t,i,r,s){const a=Yae(i).substring(i.length-s,i.length-r);return this._findPrevBracketInText(e,t,a,r)}static findNextBracketInText(e,t,i,r){const s=i.match(e);if(!s)return null;const o=s.index||0,a=s[0].length;if(a===0)return null;const l=r+o;return new $(t,l+1,t,l+1+a)}static findNextBracketInRange(e,t,i,r,s){const o=i.substring(r,s);return this.findNextBracketInText(e,t,o,r)}}class Uvt{constructor(e){this._richEditBrackets=e}getElectricCharacters(){const e=[];if(this._richEditBrackets)for(const t of this._richEditBrackets.brackets)for(const i of t.close){const r=i.charAt(i.length-1);e.push(r)}return j_(e)}onElectricCharacter(e,t,i){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;const r=t.findTokenIndexAtOffset(i-1);if(np(t.getStandardTokenType(r)))return null;const s=this._richEditBrackets.reversedRegex,o=t.getLineContent().substring(0,i-1)+e,a=Lh.findPrevBracketInRange(s,1,o,0,o.length);if(!a)return null;const l=o.substring(a.startColumn-1,a.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[l])return null;const u=t.getActualLineContentBefore(a.startColumn-1);return/^\s*$/.test(u)?{matchOpenBracket:l}:null}}function k4(n){return n.global&&(n.lastIndex=0),!0}class jvt{constructor(e){this._indentationRules=e}shouldIncrease(e){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&k4(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(e))}shouldDecrease(e){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&k4(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(e))}shouldIndentNextLine(e){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&k4(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(e))}shouldIgnore(e){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&k4(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(e))}getIndentMetadata(e){let t=0;return this.shouldIncrease(e)&&(t+=1),this.shouldDecrease(e)&&(t+=2),this.shouldIndentNextLine(e)&&(t+=4),this.shouldIgnore(e)&&(t+=8),t}}class wS{constructor(e){e=e||{},e.brackets=e.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],e.brackets.forEach(t=>{const i=wS._createOpenBracketRegExp(t[0]),r=wS._createCloseBracketRegExp(t[1]);i&&r&&this._brackets.push({open:t[0],openRegExp:i,close:t[1],closeRegExp:r})}),this._regExpRules=e.onEnterRules||[]}onEnter(e,t,i,r){if(e>=3)for(let s=0,o=this._regExpRules.length;sc.reg?(c.reg.lastIndex=0,c.reg.test(c.text)):!0))return a.action}if(e>=2&&i.length>0&&r.length>0)for(let s=0,o=this._brackets.length;s=2&&i.length>0){for(let s=0,o=this._brackets.length;s"u"?t:s}function Kvt(n){return n.replace(/[\[\]]/g,"")}const Hr=On("languageService");class gp{constructor(e,t=[],i=!1){this.ctor=e,this.staticArguments=t,this.supportsDelayedInstantiation=i}}const B3e=[];function Vn(n,e,t){e instanceof gp||(e=new gp(e,[],!!t)),B3e.push([n,e])}function fbe(){return B3e}const ps=Object.freeze({text:"text/plain",binary:"application/octet-stream",unknown:"application/unknown",markdown:"text/markdown",latex:"text/latex",uriList:"text/uri-list"}),eW={JSONContribution:"base.contributions.json"};function Gvt(n){return n.length>0&&n.charAt(n.length-1)==="#"?n.substring(0,n.length-1):n}class Yvt{constructor(){this._onDidChangeSchema=new fe,this.schemasById={}}registerSchema(e,t){this.schemasById[Gvt(e)]=t,this._onDidChangeSchema.fire(e)}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}}const Zvt=new Yvt;Yr.add(eW.JSONContribution,Zvt);const ff={Configuration:"base.contributions.configuration"},LT="vscode://schemas/settings/resourceLanguage",gbe=Yr.as(eW.JSONContribution);class Xvt{constructor(){this.registeredConfigurationDefaults=[],this.overrideIdentifiers=new Set,this._onDidSchemaChange=new fe,this._onDidUpdateConfiguration=new fe,this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:w("defaultLanguageConfigurationOverrides.title","Default Language Configuration Overrides"),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.excludedConfigurationProperties={},gbe.registerSchema(LT,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){this.registerConfigurations([e],t)}registerConfigurations(e,t=!0){const i=new Set;this.doRegisterConfigurations(e,t,i),gbe.registerSchema(LT,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:i})}registerDefaultConfigurations(e){const t=new Set;this.doRegisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doRegisterDefaultConfigurations(e,t){this.registeredConfigurationDefaults.push(...e);const i=[];for(const{overrides:r,source:s}of e)for(const o in r){t.add(o);const a=this.configurationDefaultsOverrides.get(o)??this.configurationDefaultsOverrides.set(o,{configurationDefaultOverrides:[]}).get(o),l=r[o];if(a.configurationDefaultOverrides.push({value:l,source:s}),Eb.test(o)){const c=this.mergeDefaultConfigurationsForOverrideIdentifier(o,l,s,a.configurationDefaultOverrideValue);if(!c)continue;a.configurationDefaultOverrideValue=c,this.updateDefaultOverrideProperty(o,c,s),i.push(...e8(o))}else{const c=this.mergeDefaultConfigurationsForConfigurationProperty(o,l,s,a.configurationDefaultOverrideValue);if(!c)continue;a.configurationDefaultOverrideValue=c;const u=this.configurationProperties[o];u&&(this.updatePropertyDefaultValue(o,u),this.updateSchema(o,u))}}this.doRegisterOverrideIdentifiers(i)}updateDefaultOverrideProperty(e,t,i){const r={type:"object",default:t.value,description:w("defaultLanguageConfiguration.description","Configure settings to be overridden for the {0} language.",Kvt(e)),$ref:LT,defaultDefaultValue:t.value,source:i,defaultValueSource:i};this.configurationProperties[e]=r,this.defaultLanguageConfigurationOverridesNode.properties[e]=r}mergeDefaultConfigurationsForOverrideIdentifier(e,t,i,r){const s=r?.value||{},o=r?.source??new Map;if(!(o instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(const a of Object.keys(t)){const l=t[a];if(Mo(l)&&(ml(s[a])||Mo(s[a]))){if(s[a]={...s[a]??{},...l},i)for(const u in l)o.set(`${a}.${u}`,i)}else s[a]=l,i?o.set(a,i):o.delete(a)}return{value:s,source:o}}mergeDefaultConfigurationsForConfigurationProperty(e,t,i,r){const s=this.configurationProperties[e],o=r?.value??s?.defaultDefaultValue;let a=i;if(Mo(t)&&(s!==void 0&&s.type==="object"||s===void 0&&(ml(o)||Mo(o)))){if(a=r?.source??new Map,!(a instanceof Map)){console.error("defaultValueSource is not a Map");return}for(const c in t)i&&a.set(`${e}.${c}`,i);t={...Mo(o)?o:{},...t}}return{value:t,source:a}}registerOverrideIdentifiers(e){this.doRegisterOverrideIdentifiers(e),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(e){for(const t of e)this.overrideIdentifiers.add(t);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,t,i){e.forEach(r=>{this.validateAndRegisterProperties(r,t,r.extensionInfo,r.restrictedProperties,void 0,i),this.configurationContributors.push(r),this.registerJSONConfiguration(r)})}validateAndRegisterProperties(e,t=!0,i,r,s=3,o){s=Bu(e.scope)?s:e.scope;const a=e.properties;if(a)for(const c in a){const u=a[c];if(t&&ebt(c,u)){delete a[c];continue}if(u.source=i,u.defaultDefaultValue=a[c].default,this.updatePropertyDefaultValue(c,u),Eb.test(c)?u.scope=void 0:(u.scope=Bu(u.scope)?s:u.scope,u.restricted=Bu(u.restricted)?!!r?.includes(c):u.restricted),a[c].hasOwnProperty("included")&&!a[c].included){this.excludedConfigurationProperties[c]=a[c],delete a[c];continue}else this.configurationProperties[c]=a[c],a[c].policy?.name&&this.policyConfigurations.set(a[c].policy.name,c);!a[c].deprecationMessage&&a[c].markdownDeprecationMessage&&(a[c].deprecationMessage=a[c].markdownDeprecationMessage),o.add(c)}const l=e.allOf;if(l)for(const c of l)this.validateAndRegisterProperties(c,t,i,r,s,o)}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}registerJSONConfiguration(e){const t=i=>{const r=i.properties;if(r)for(const o in r)this.updateSchema(o,r[o]);i.allOf?.forEach(t)};t(e)}updateSchema(e,t){switch(t.scope){case 1:break;case 2:break;case 6:break;case 3:break;case 4:break;case 5:this.resourceLanguageSettingsSchema.properties[e]=t;break}}updateOverridePropertyPatternKey(){for(const e of this.overrideIdentifiers.values()){const t=`[${e}]`,i={type:"object",description:w("overrideSettings.defaultDescription","Configure editor settings to be overridden for a language."),errorMessage:w("overrideSettings.errorMessage","This setting does not support per-language configuration."),$ref:LT};this.updatePropertyDefaultValue(t,i)}}registerOverridePropertyPatternKey(){w("overrideSettings.defaultDescription","Configure editor settings to be overridden for a language."),w("overrideSettings.errorMessage","This setting does not support per-language configuration."),this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){const i=this.configurationDefaultsOverrides.get(e)?.configurationDefaultOverrideValue;let r,s;i&&(!t.disallowConfigurationDefault||!i.source)&&(r=i.value,s=i.source),ml(r)&&(r=t.defaultDefaultValue,s=void 0),ml(r)&&(r=Jvt(t.type)),t.default=r,t.defaultValueSource=s}}const $3e="\\[([^\\]]+)\\]",pbe=new RegExp($3e,"g"),Qvt=`^(${$3e})+$`,Eb=new RegExp(Qvt);function e8(n){const e=[];if(Eb.test(n)){let t=pbe.exec(n);for(;t?.length;){const i=t[1].trim();i&&e.push(i),t=pbe.exec(n)}}return j_(e)}function Jvt(n){switch(Array.isArray(n)?n[0]:n){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}const zF=new Xvt;Yr.add(ff.Configuration,zF);function ebt(n,e){return n.trim()?Eb.test(n)?w("config.property.languageDefault","Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",n):zF.getConfigurationProperties()[n]!==void 0?w("config.property.duplicate","Cannot register '{0}'. This property is already registered.",n):e.policy?.name&&zF.getPolicyConfigurations().get(e.policy?.name)!==void 0?w("config.policy.duplicate","Cannot register '{0}'. The associated policy {1} is already registered with {2}.",n,e.policy?.name,zF.getPolicyConfigurations().get(e.policy?.name)):null:w("config.property.empty","Cannot register an empty property")}const tbt={ModesRegistry:"editor.modesRegistry"};class nbt{constructor(){this._onDidChangeLanguages=new fe,this.onDidChangeLanguages=this._onDidChangeLanguages.event,this._languages=[]}registerLanguage(e){return this._languages.push(e),this._onDidChangeLanguages.fire(void 0),{dispose:()=>{for(let t=0,i=this._languages.length;t{const l=new Set;return{info:new sbt(this,a,l),closing:l}}),s=new $ve(a=>{const l=new Set,c=new Set;return{info:new obt(this,a,l,c),opening:l,openingColorized:c}});for(const[a,l]of i){const c=r.get(a),u=s.get(l);c.closing.add(u.info),u.opening.add(c.info)}const o=t.colorizedBracketPairs?mbe(t.colorizedBracketPairs):i.filter(a=>!(a[0]==="<"&&a[1]===">"));for(const[a,l]of o){const c=r.get(a),u=s.get(l);c.closing.add(u.info),u.openingColorized.add(c.info),u.opening.add(c.info)}this._openingBrackets=new Map([...r.cachedValues].map(([a,l])=>[a,l.info])),this._closingBrackets=new Map([...s.cachedValues].map(([a,l])=>[a,l.info]))}get openingBrackets(){return[...this._openingBrackets.values()]}get closingBrackets(){return[...this._closingBrackets.values()]}getOpeningBracketInfo(e){return this._openingBrackets.get(e)}getClosingBracketInfo(e){return this._closingBrackets.get(e)}getBracketInfo(e){return this.getOpeningBracketInfo(e)||this.getClosingBracketInfo(e)}getBracketRegExp(e){const t=Array.from([...this._openingBrackets.keys(),...this._closingBrackets.keys()]);return XP(t,e)}}function mbe(n){return n.filter(([e,t])=>e!==""&&t!=="")}class W3e{constructor(e,t){this.config=e,this.bracketText=t}get languageId(){return this.config.languageId}}class sbt extends W3e{constructor(e,t,i){super(e,t),this.openedBrackets=i,this.isOpeningBracket=!0}}class obt extends W3e{constructor(e,t,i,r){super(e,t),this.openingBrackets=i,this.openingColorizedBrackets=r,this.isOpeningBracket=!1}closes(e){return e.config!==this.config?!1:this.openingBrackets.has(e)}closesColorized(e){return e.config!==this.config?!1:this.openingColorizedBrackets.has(e)}getOpeningBrackets(){return[...this.openingBrackets]}}var abt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},_be=function(n,e){return function(t,i){e(t,i,n)}};class Oj{constructor(e){this.languageId=e}affects(e){return this.languageId?this.languageId===e:!0}}const Zr=On("languageConfigurationService");let LX=class extends me{constructor(e,t){super(),this.configurationService=e,this.languageService=t,this._registry=this._register(new dbt),this.onDidChangeEmitter=this._register(new fe),this.onDidChange=this.onDidChangeEmitter.event,this.configurations=new Map;const i=new Set(Object.values(TX));this._register(this.configurationService.onDidChangeConfiguration(r=>{const s=r.change.keys.some(a=>i.has(a)),o=r.change.overrides.filter(([a,l])=>l.some(c=>i.has(c))).map(([a])=>a);if(s)this.configurations.clear(),this.onDidChangeEmitter.fire(new Oj(void 0));else for(const a of o)this.languageService.isRegisteredLanguageId(a)&&(this.configurations.delete(a),this.onDidChangeEmitter.fire(new Oj(a)))})),this._register(this._registry.onDidChange(r=>{this.configurations.delete(r.languageId),this.onDidChangeEmitter.fire(new Oj(r.languageId))}))}register(e,t,i){return this._registry.register(e,t,i)}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=lbt(e,this._registry,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};LX=abt([_be(0,kn),_be(1,Hr)],LX);function lbt(n,e,t,i){let r=e.getLanguageConfiguration(n);if(!r){if(!i.isRegisteredLanguageId(n))return new uk(n,{});r=new uk(n,{})}const s=cbt(r.languageId,t),o=V3e([r.underlyingConfig,s]);return new uk(r.languageId,o)}const TX={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};function cbt(n,e){const t=e.getValue(TX.brackets,{overrideIdentifier:n}),i=e.getValue(TX.colorizedBracketPairs,{overrideIdentifier:n});return{brackets:vbe(t),colorizedBracketPairs:vbe(i)}}function vbe(n){if(Array.isArray(n))return n.map(e=>{if(!(!Array.isArray(e)||e.length!==2))return[e[0],e[1]]}).filter(e=>!!e)}function H3e(n,e,t){const i=n.getLineContent(e);let r=Ji(i);return r.length>t-1&&(r=r.substring(0,t-1)),r}class ubt{constructor(e){this.languageId=e,this._resolved=null,this._entries=[],this._order=0,this._resolved=null}register(e,t){const i=new bbe(e,t,++this._order);return this._entries.push(i),this._resolved=null,Lt(()=>{for(let r=0;re.configuration)))}}function V3e(n){let e={comments:void 0,brackets:void 0,wordPattern:void 0,indentationRules:void 0,onEnterRules:void 0,autoClosingPairs:void 0,surroundingPairs:void 0,autoCloseBefore:void 0,folding:void 0,colorizedBracketPairs:void 0,__electricCharacterSupport:void 0};for(const t of n)e={comments:t.comments||e.comments,brackets:t.brackets||e.brackets,wordPattern:t.wordPattern||e.wordPattern,indentationRules:t.indentationRules||e.indentationRules,onEnterRules:t.onEnterRules||e.onEnterRules,autoClosingPairs:t.autoClosingPairs||e.autoClosingPairs,surroundingPairs:t.surroundingPairs||e.surroundingPairs,autoCloseBefore:t.autoCloseBefore||e.autoCloseBefore,folding:t.folding||e.folding,colorizedBracketPairs:t.colorizedBracketPairs||e.colorizedBracketPairs,__electricCharacterSupport:t.__electricCharacterSupport||e.__electricCharacterSupport};return e}class bbe{constructor(e,t,i){this.configuration=e,this.priority=t,this.order=i}static cmp(e,t){return e.priority===t.priority?e.order-t.order:e.priority-t.priority}}class ybe{constructor(e){this.languageId=e}}class dbt extends me{constructor(){super(),this._entries=new Map,this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._register(this.register(Hl,{brackets:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],colorizedBracketPairs:[],folding:{offSide:!0}},0))}register(e,t,i=0){let r=this._entries.get(e);r||(r=new ubt(e),this._entries.set(e,r));const s=r.register(t,i);return this._onDidChange.fire(new ybe(e)),Lt(()=>{s.dispose(),this._onDidChange.fire(new ybe(e))})}getLanguageConfiguration(e){return this._entries.get(e)?.getResolvedConfiguration()||null}}class uk{constructor(e,t){this.languageId=e,this.underlyingConfig=t,this._brackets=null,this._electricCharacter=null,this._onEnterSupport=this.underlyingConfig.brackets||this.underlyingConfig.indentationRules||this.underlyingConfig.onEnterRules?new wS(this.underlyingConfig):null,this.comments=uk._handleComments(this.underlyingConfig),this.characterPair=new Q6(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||_ae,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new jvt(this.underlyingConfig.indentationRules):this.indentRulesSupport=null,this.foldingRules=this.underlyingConfig.folding||{},this.bracketsNew=new rbt(e,this.underlyingConfig)}getWordDefinition(){return vae(this.wordDefinition)}get brackets(){return!this._brackets&&this.underlyingConfig.brackets&&(this._brackets=new Bvt(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new Uvt(this.brackets)),this._electricCharacter}onEnter(e,t,i,r){return this._onEnterSupport?this._onEnterSupport.onEnter(e,t,i,r):null}getAutoClosingPairs(){return new Ivt(this.characterPair.getAutoClosingPairs())}getAutoCloseBeforeSet(e){return this.characterPair.getAutoCloseBeforeSet(e)}getSurroundingPairs(){return this.characterPair.getSurroundingPairs()}static _handleComments(e){const t=e.comments;if(!t)return null;const i={};if(t.lineComment&&(i.lineCommentToken=t.lineComment),t.blockComment){const[r,s]=t.blockComment;i.blockCommentStartToken=r,i.blockCommentEndToken=s}return i}}Vn(Zr,LX,1);class Z0{constructor(e,t,i,r){this.originalStart=e,this.originalLength=t,this.modifiedStart=i,this.modifiedLength=r}getOriginalEnd(){return this.originalStart+this.originalLength}getModifiedEnd(){return this.modifiedStart+this.modifiedLength}}class wbe{constructor(e){this.source=e}getElements(){const e=this.source,t=new Int32Array(e.length);for(let i=0,r=e.length;i0||this.m_modifiedCount>0)&&this.m_changes.push(new Z0(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_originalCount++}AddModifiedElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}}class wp{constructor(e,t,i=null){this.ContinueProcessingPredicate=i,this._originalSequence=e,this._modifiedSequence=t;const[r,s,o]=wp._getElements(e),[a,l,c]=wp._getElements(t);this._hasStrings=o&&c,this._originalStringElements=r,this._originalElementsOrHash=s,this._modifiedStringElements=a,this._modifiedElementsOrHash=l,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(e){return e.length>0&&typeof e[0]=="string"}static _getElements(e){const t=e.getElements();if(wp._isStringArray(t)){const i=new Int32Array(t.length);for(let r=0,s=t.length;r=e&&r>=i&&this.ElementsAreEqual(t,r);)t--,r--;if(e>t||i>r){let d;return i<=r?(ux.Assert(e===t+1,"originalStart should only be one more than originalEnd"),d=[new Z0(e,0,i,r-i+1)]):e<=t?(ux.Assert(i===r+1,"modifiedStart should only be one more than modifiedEnd"),d=[new Z0(e,t-e+1,i,0)]):(ux.Assert(e===t+1,"originalStart should only be one more than originalEnd"),ux.Assert(i===r+1,"modifiedStart should only be one more than modifiedEnd"),d=[]),d}const o=[0],a=[0],l=this.ComputeRecursionPoint(e,t,i,r,o,a,s),c=o[0],u=a[0];if(l!==null)return l;if(!s[0]){const d=this.ComputeDiffRecursive(e,c,i,u,s);let h=[];return s[0]?h=[new Z0(c+1,t-(c+1)+1,u+1,r-(u+1)+1)]:h=this.ComputeDiffRecursive(c+1,t,u+1,r,s),this.ConcatenateChanges(d,h)}return[new Z0(e,t-e+1,i,r-i+1)]}WALKTRACE(e,t,i,r,s,o,a,l,c,u,d,h,f,g,p,m,_,v){let y=null,C=null,x=new Cbe,k=t,L=i,D=f[0]-m[0]-r,I=-1073741824,O=this.m_forwardHistory.length-1;do{const M=D+e;M===k||M=0&&(c=this.m_forwardHistory[O],e=c[0],k=1,L=c.length-1)}while(--O>=-1);if(y=x.getReverseChanges(),v[0]){let M=f[0]+1,B=m[0]+1;if(y!==null&&y.length>0){const G=y[y.length-1];M=Math.max(M,G.getOriginalEnd()),B=Math.max(B,G.getModifiedEnd())}C=[new Z0(M,h-M+1,B,p-B+1)]}else{x=new Cbe,k=o,L=a,D=f[0]-m[0]-l,I=1073741824,O=_?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{const M=D+s;M===k||M=u[M+1]?(d=u[M+1]-1,g=d-D-l,d>I&&x.MarkNextChange(),I=d+1,x.AddOriginalElement(d+1,g+1),D=M+1-s):(d=u[M-1],g=d-D-l,d>I&&x.MarkNextChange(),I=d,x.AddModifiedElement(d+1,g+1),D=M-1-s),O>=0&&(u=this.m_reverseHistory[O],s=u[0],k=1,L=u.length-1)}while(--O>=-1);C=x.getChanges()}return this.ConcatenateChanges(y,C)}ComputeRecursionPoint(e,t,i,r,s,o,a){let l=0,c=0,u=0,d=0,h=0,f=0;e--,i--,s[0]=0,o[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];const g=t-e+(r-i),p=g+1,m=new Int32Array(p),_=new Int32Array(p),v=r-i,y=t-e,C=e-i,x=t-r,L=(y-v)%2===0;m[v]=e,_[y]=t,a[0]=!1;for(let D=1;D<=g/2+1;D++){let I=0,O=0;u=this.ClipDiagonalBound(v-D,D,v,p),d=this.ClipDiagonalBound(v+D,D,v,p);for(let B=u;B<=d;B+=2){B===u||BI+O&&(I=l,O=c),!L&&Math.abs(B-y)<=D-1&&l>=_[B])return s[0]=l,o[0]=c,G<=_[B]&&D<=1448?this.WALKTRACE(v,u,d,C,y,h,f,x,m,_,l,t,s,c,r,o,L,a):null}const M=(I-e+(O-i)-D)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(I,M))return a[0]=!0,s[0]=I,o[0]=O,M>0&&D<=1448?this.WALKTRACE(v,u,d,C,y,h,f,x,m,_,l,t,s,c,r,o,L,a):(e++,i++,[new Z0(e,t-e+1,i,r-i+1)]);h=this.ClipDiagonalBound(y-D,D,y,p),f=this.ClipDiagonalBound(y+D,D,y,p);for(let B=h;B<=f;B+=2){B===h||B=_[B+1]?l=_[B+1]-1:l=_[B-1],c=l-(B-y)-x;const G=l;for(;l>e&&c>i&&this.ElementsAreEqual(l,c);)l--,c--;if(_[B]=l,L&&Math.abs(B-v)<=D&&l<=m[B])return s[0]=l,o[0]=c,G>=m[B]&&D<=1448?this.WALKTRACE(v,u,d,C,y,h,f,x,m,_,l,t,s,c,r,o,L,a):null}if(D<=1447){let B=new Int32Array(d-u+2);B[0]=v-u+1,dx.Copy2(m,u,B,1,d-u+1),this.m_forwardHistory.push(B),B=new Int32Array(f-h+2),B[0]=y-h+1,dx.Copy2(_,h,B,1,f-h+1),this.m_reverseHistory.push(B)}}return this.WALKTRACE(v,u,d,C,y,h,f,x,m,_,l,t,s,c,r,o,L,a)}PrettifyChanges(e){for(let t=0;t0,a=i.modifiedLength>0;for(;i.originalStart+i.originalLength=0;t--){const i=e[t];let r=0,s=0;if(t>0){const d=e[t-1];r=d.originalStart+d.originalLength,s=d.modifiedStart+d.modifiedLength}const o=i.originalLength>0,a=i.modifiedLength>0;let l=0,c=this._boundaryScore(i.originalStart,i.originalLength,i.modifiedStart,i.modifiedLength);for(let d=1;;d++){const h=i.originalStart-d,f=i.modifiedStart-d;if(hc&&(c=p,l=d)}i.originalStart-=l,i.modifiedStart-=l;const u=[null];if(t>0&&this.ChangesOverlap(e[t-1],e[t],u)){e[t-1]=u[0],e.splice(t,1),t++;continue}}if(this._hasStrings)for(let t=1,i=e.length;t0&&f>l&&(l=f,c=d,u=h)}return l>0?[c,u]:null}_contiguousSequenceScore(e,t,i){let r=0;for(let s=0;s=this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[e])}_OriginalRegionIsBoundary(e,t){if(this._OriginalIsBoundary(e)||this._OriginalIsBoundary(e-1))return!0;if(t>0){const i=e+t;if(this._OriginalIsBoundary(i-1)||this._OriginalIsBoundary(i))return!0}return!1}_ModifiedIsBoundary(e){return e<=0||e>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[e])}_ModifiedRegionIsBoundary(e,t){if(this._ModifiedIsBoundary(e)||this._ModifiedIsBoundary(e-1))return!0;if(t>0){const i=e+t;if(this._ModifiedIsBoundary(i-1)||this._ModifiedIsBoundary(i))return!0}return!1}_boundaryScore(e,t,i,r){const s=this._OriginalRegionIsBoundary(e,t)?1:0,o=this._ModifiedRegionIsBoundary(i,r)?1:0;return s+o}ConcatenateChanges(e,t){const i=[];if(e.length===0||t.length===0)return t.length>0?t:e;if(this.ChangesOverlap(e[e.length-1],t[0],i)){const r=new Array(e.length+t.length-1);return dx.Copy(e,0,r,0,e.length-1),r[e.length-1]=i[0],dx.Copy(t,1,r,e.length,t.length-1),r}else{const r=new Array(e.length+t.length);return dx.Copy(e,0,r,0,e.length),dx.Copy(t,0,r,e.length,t.length),r}}ChangesOverlap(e,t,i){if(ux.Assert(e.originalStart<=t.originalStart,"Left change is not less than or equal to right change"),ux.Assert(e.modifiedStart<=t.modifiedStart,"Left change is not less than or equal to right change"),e.originalStart+e.originalLength>=t.originalStart||e.modifiedStart+e.modifiedLength>=t.modifiedStart){const r=e.originalStart;let s=e.originalLength;const o=e.modifiedStart;let a=e.modifiedLength;return e.originalStart+e.originalLength>=t.originalStart&&(s=t.originalStart+t.originalLength-e.originalStart),e.modifiedStart+e.modifiedLength>=t.modifiedStart&&(a=t.modifiedStart+t.modifiedLength-e.modifiedStart),i[0]=new Z0(r,s,o,a),!0}else return i[0]=null,!1}ClipDiagonalBound(e,t,i,r){if(e>=0&&e255?255:n|0}function hx(n){return n<0?0:n>4294967295?4294967295:n|0}class QL{constructor(e){const t=t8(e);this._defaultValue=t,this._asciiMap=QL._createAsciiMap(t),this._map=new Map}static _createAsciiMap(e){const t=new Uint8Array(256);return t.fill(e),t}set(e,t){const i=t8(t);e>=0&&e<256?this._asciiMap[e]=i:this._map.set(e,i)}get(e){return e>=0&&e<256?this._asciiMap[e]:this._map.get(e)||this._defaultValue}clear(){this._asciiMap.fill(this._defaultValue),this._map.clear()}}class n8{constructor(){this._actual=new QL(0)}add(e){this._actual.set(e,1)}has(e){return this._actual.get(e)===1}clear(){return this._actual.clear()}}class fbt{constructor(e,t,i){const r=new Uint8Array(e*t);for(let s=0,o=e*t;st&&(t=l),a>i&&(i=a),c>i&&(i=c)}t++,i++;const r=new fbt(i,t,0);for(let s=0,o=e.length;s=this._maxCharCode?0:this._states.get(e,t)}}let Mj=null;function pbt(){return Mj===null&&(Mj=new gbt([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),Mj}let TT=null;function mbt(){if(TT===null){TT=new QL(0);const n=` <>'"、。。、,.:;‘〈「『〔([{「」}])〕』」〉’`~…`;for(let t=0;tr);if(r>0){const a=t.charCodeAt(r-1),l=t.charCodeAt(o);(a===40&&l===41||a===91&&l===93||a===123&&l===125)&&o--}return{range:{startLineNumber:i,startColumn:r+1,endLineNumber:i,endColumn:o+2},url:t.substring(r,o+1)}}static computeLinks(e,t=pbt()){const i=mbt(),r=[];for(let s=1,o=e.getLineCount();s<=o;s++){const a=e.getLineContent(s),l=a.length;let c=0,u=0,d=0,h=1,f=!1,g=!1,p=!1,m=!1;for(;c=0?(r+=i?1:-1,r<0?r=e.length-1:r%=e.length,e[r]):null}}class r8{static{this.CHANNEL_NAME="editorWorkerHost"}static getChannel(e){return e.getChannel(r8.CHANNEL_NAME)}static setChannel(e,t){e.setChannel(r8.CHANNEL_NAME,t)}}var xbe,Sbe;class vbt{constructor(e,t){this.uri=e,this.value=t}}function bbt(n){return Array.isArray(n)}class so{static{this.defaultToKey=e=>e.toString()}constructor(e,t){if(this[xbe]="ResourceMap",e instanceof so)this.map=new Map(e.map),this.toKey=t??so.defaultToKey;else if(bbt(e)){this.map=new Map,this.toKey=t??so.defaultToKey;for(const[i,r]of e)this.set(i,r)}else this.map=new Map,this.toKey=e??so.defaultToKey}set(e,t){return this.map.set(this.toKey(e),new vbt(e,t)),this}get(e){return this.map.get(this.toKey(e))?.value}has(e){return this.map.has(this.toKey(e))}get size(){return this.map.size}clear(){this.map.clear()}delete(e){return this.map.delete(this.toKey(e))}forEach(e,t){typeof t<"u"&&(e=e.bind(t));for(const[i,r]of this.map)e(r.value,r.uri,this)}*values(){for(const e of this.map.values())yield e.value}*keys(){for(const e of this.map.values())yield e.uri}*entries(){for(const e of this.map.values())yield[e.uri,e.value]}*[(xbe=Symbol.toStringTag,Symbol.iterator)](){for(const[,e]of this.map)yield[e.uri,e.value]}}class ybt{constructor(){this[Sbe]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,t=0){const i=this._map.get(e);if(i)return t!==0&&this.touch(i,t),i.value}set(e,t,i=0){let r=this._map.get(e);if(r)r.value=t,i!==0&&this.touch(r,i);else{switch(r={key:e,value:t,next:void 0,previous:void 0},i){case 0:this.addItemLast(r);break;case 1:this.addItemFirst(r);break;case 2:this.addItemLast(r);break;default:this.addItemLast(r);break}this._map.set(e,r),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const i=this._state;let r=this._head;for(;r;){if(t?e.bind(t)(r.value,r.key,this):e(r.value,r.key,this),this._state!==i)throw new Error("LinkedMap got modified during iteration.");r=r.next}}keys(){const e=this,t=this._state;let i=this._head;const r={[Symbol.iterator](){return r},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:i.key,done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return r}values(){const e=this,t=this._state;let i=this._head;const r={[Symbol.iterator](){return r},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:i.value,done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return r}entries(){const e=this,t=this._state;let i=this._head;const r={[Symbol.iterator](){return r},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:[i.key,i.value],done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return r}[(Sbe=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,i=this.size;for(;t&&i>e;)this._map.delete(t.key),t=t.next,i--;this._head=t,this._size=i,t&&(t.previous=void 0),this._state++}trimNew(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._tail,i=this.size;for(;t&&i>e;)this._map.delete(t.key),t=t.previous,i--;this._tail=t,this._size=i,t&&(t.next=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const t=e.next,i=e.previous;if(!t||!i)throw new Error("Invalid list");t.previous=i,i.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==1&&t!==2)){if(t===1){if(e===this._head)return;const i=e.next,r=e.previous;e===this._tail?(r.next=void 0,this._tail=r):(i.previous=r,r.next=i),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===2){if(e===this._tail)return;const i=e.next,r=e.previous;e===this._head?(i.previous=void 0,this._head=i):(i.previous=r,r.next=i),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){const e=[];return this.forEach((t,i)=>{e.push([i,t])}),e}fromJSON(e){this.clear();for(const[t,i]of e)this.set(t,i)}}class wbt extends ybt{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get(e,t=2){return super.get(e,t)}peek(e){return super.get(e,0)}set(e,t){return super.set(e,t,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}}class lm extends wbt{constructor(e,t=1){super(e,t)}trim(e){this.trimOld(e)}set(e,t){return super.set(e,t),this.checkTrim(),this}}class Cbt{constructor(e){if(this._m1=new Map,this._m2=new Map,e)for(const[t,i]of e)this.set(t,i)}clear(){this._m1.clear(),this._m2.clear()}set(e,t){this._m1.set(e,t),this._m2.set(t,e)}get(e){return this._m1.get(e)}getKey(e){return this._m2.get(e)}delete(e){const t=this._m1.get(e);return t===void 0?!1:(this._m1.delete(e),this._m2.delete(t),!0)}keys(){return this._m1.keys()}values(){return this._m1.values()}}class Xae{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){const i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){const i=this.map.get(e);i&&i.forEach(t)}get(e){const t=this.map.get(e);return t||new Set}}class xbt extends QL{constructor(e,t){super(0),this._segmenter=null,this._cachedLine=null,this._cachedSegments=[],this.intlSegmenterLocales=t,this.intlSegmenterLocales.length>0?this._segmenter=new Intl.Segmenter(this.intlSegmenterLocales,{granularity:"word"}):this._segmenter=null;for(let i=0,r=e.length;it)break;i=r}return i}findNextIntlWordAtOrAfterOffset(e,t){for(const i of this._getIntlSegmenterWordsOnLine(e))if(!(i.indexnew Ij(t)):e.brackets?this._autoClosingPairs=e.brackets.map(t=>new Ij({open:t[0],close:t[1]})):this._autoClosingPairs=[],e.__electricCharacterSupport&&e.__electricCharacterSupport.docComment){const t=e.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new Ij({open:t.open,close:t.close||""}))}this._autoCloseBeforeForQuotes=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:Q6.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES,this._autoCloseBeforeForBrackets=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:Q6.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS,this._surroundingPairs=e.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(e){return e?this._autoCloseBeforeForQuotes:this._autoCloseBeforeForBrackets}getSurroundingPairs(){return this._surroundingPairs}}function Iy(n,e){const t=n.getCount(),i=n.findTokenIndexAtOffset(e),r=n.getLanguageId(i);let s=i;for(;s+10&&n.getLanguageId(o-1)===r;)o--;return new Avt(n,r,o,s+1,n.getStartOffset(o),n.getEndOffset(s))}class Avt{constructor(e,t,i,r,s,o){this._scopedLineTokensBrand=void 0,this._actual=e,this.languageId=t,this._firstTokenIndex=i,this._lastTokenIndex=r,this.firstCharOffset=s,this._lastCharOffset=o,this.languageIdCodec=e.languageIdCodec}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getLineLength(){return this._lastCharOffset-this.firstCharOffset}getActualLineContentBefore(e){return this._actual.getLineContent().substring(0,this.firstCharOffset+e)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(e){return this._actual.findTokenIndexAtOffset(e+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(e){return this._actual.getStandardTokenType(e+this._firstTokenIndex)}toIViewLineTokens(){return this._actual.sliceAndInflate(this.firstCharOffset,this._lastCharOffset,0)}}function np(n){return(n&3)!==0}const cbe=typeof Buffer<"u";let Aj;class Q${static wrap(e){return cbe&&!Buffer.isBuffer(e)&&(e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)),new Q$(e)}constructor(e){this.buffer=e,this.byteLength=this.buffer.byteLength}toString(){return cbe?this.buffer.toString():(Aj||(Aj=new TextDecoder),Aj.decode(this.buffer))}}function Nvt(n,e){return n[e+0]<<0>>>0|n[e+1]<<8>>>0}function Rvt(n,e,t){n[t+0]=e&255,e=e>>>8,n[t+1]=e&255}function $f(n,e){return n[e]*2**24+n[e+1]*2**16+n[e+2]*2**8+n[e+3]}function Wf(n,e,t){n[t+3]=e,e=e>>>8,n[t+2]=e,e=e>>>8,n[t+1]=e,e=e>>>8,n[t]=e}function ube(n,e){return n[e]}function dbe(n,e,t){n[t]=e}let Nj;function N3e(){return Nj||(Nj=new TextDecoder("UTF-16LE")),Nj}let Rj;function Pvt(){return Rj||(Rj=new TextDecoder("UTF-16BE")),Rj}let Pj;function R3e(){return Pj||(Pj=_4e()?N3e():Pvt()),Pj}function Ovt(n,e,t){const i=new Uint16Array(n.buffer,e,t);return t>0&&(i[0]===65279||i[0]===65534)?Mvt(n,e,t):N3e().decode(i)}function Mvt(n,e,t){const i=[];let r=0;for(let s=0;s=this._capacity){this._flushBuffer(),this._completedStrings[this._completedStrings.length]=e;return}for(let i=0;i[o[0].toLowerCase(),o[1].toLowerCase()]);const t=[];for(let o=0;o{const[l,c]=o,[u,d]=a;return l===u||l===d||c===u||c===d},r=(o,a)=>{const l=Math.min(o,a),c=Math.max(o,a);for(let u=0;u0&&s.push({open:a,close:l})}return s}class Bvt{constructor(e,t){this._richEditBracketsBrand=void 0;const i=Fvt(t);this.brackets=i.map((r,s)=>new J6(e,s,r.open,r.close,$vt(r.open,r.close,i,s),Wvt(r.open,r.close,i,s))),this.forwardRegex=Hvt(this.brackets),this.reversedRegex=Vvt(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(const r of this.brackets){for(const s of r.open)this.textIsBracket[s]=r,this.textIsOpenBracket[s]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,s.length);for(const s of r.close)this.textIsBracket[s]=r,this.textIsOpenBracket[s]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,s.length)}}}function P3e(n,e,t,i){for(let r=0,s=e.length;r=0&&i.push(a);for(const a of o.close)a.indexOf(n)>=0&&i.push(a)}}function O3e(n,e){return n.length-e.length}function J$(n){if(n.length<=1)return n;const e=[],t=new Set;for(const i of n)t.has(i)||(e.push(i),t.add(i));return e}function $vt(n,e,t,i){let r=[];r=r.concat(n),r=r.concat(e);for(let s=0,o=r.length;s=0;o--)r[s++]=i.charCodeAt(o);return R3e().decode(r)}let e=null,t=null;return function(r){return e!==r&&(e=r,t=n(e)),t}}();class Lh{static _findPrevBracketInText(e,t,i,r){const s=i.match(e);if(!s)return null;const o=i.length-(s.index||0),a=s[0].length,l=r+o;return new $(t,l-a+1,t,l+1)}static findPrevBracketInRange(e,t,i,r,s){const a=Yae(i).substring(i.length-s,i.length-r);return this._findPrevBracketInText(e,t,a,r)}static findNextBracketInText(e,t,i,r){const s=i.match(e);if(!s)return null;const o=s.index||0,a=s[0].length;if(a===0)return null;const l=r+o;return new $(t,l+1,t,l+1+a)}static findNextBracketInRange(e,t,i,r,s){const o=i.substring(r,s);return this.findNextBracketInText(e,t,o,r)}}class Uvt{constructor(e){this._richEditBrackets=e}getElectricCharacters(){const e=[];if(this._richEditBrackets)for(const t of this._richEditBrackets.brackets)for(const i of t.close){const r=i.charAt(i.length-1);e.push(r)}return j_(e)}onElectricCharacter(e,t,i){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;const r=t.findTokenIndexAtOffset(i-1);if(np(t.getStandardTokenType(r)))return null;const s=this._richEditBrackets.reversedRegex,o=t.getLineContent().substring(0,i-1)+e,a=Lh.findPrevBracketInRange(s,1,o,0,o.length);if(!a)return null;const l=o.substring(a.startColumn-1,a.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[l])return null;const u=t.getActualLineContentBefore(a.startColumn-1);return/^\s*$/.test(u)?{matchOpenBracket:l}:null}}function k4(n){return n.global&&(n.lastIndex=0),!0}class jvt{constructor(e){this._indentationRules=e}shouldIncrease(e){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&k4(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(e))}shouldDecrease(e){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&k4(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(e))}shouldIndentNextLine(e){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&k4(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(e))}shouldIgnore(e){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&k4(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(e))}getIndentMetadata(e){let t=0;return this.shouldIncrease(e)&&(t+=1),this.shouldDecrease(e)&&(t+=2),this.shouldIndentNextLine(e)&&(t+=4),this.shouldIgnore(e)&&(t+=8),t}}class wS{constructor(e){e=e||{},e.brackets=e.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],e.brackets.forEach(t=>{const i=wS._createOpenBracketRegExp(t[0]),r=wS._createCloseBracketRegExp(t[1]);i&&r&&this._brackets.push({open:t[0],openRegExp:i,close:t[1],closeRegExp:r})}),this._regExpRules=e.onEnterRules||[]}onEnter(e,t,i,r){if(e>=3)for(let s=0,o=this._regExpRules.length;sc.reg?(c.reg.lastIndex=0,c.reg.test(c.text)):!0))return a.action}if(e>=2&&i.length>0&&r.length>0)for(let s=0,o=this._brackets.length;s=2&&i.length>0){for(let s=0,o=this._brackets.length;s"u"?t:s}function Kvt(n){return n.replace(/[\[\]]/g,"")}const Hr=On("languageService");class gp{constructor(e,t=[],i=!1){this.ctor=e,this.staticArguments=t,this.supportsDelayedInstantiation=i}}const B3e=[];function Vn(n,e,t){e instanceof gp||(e=new gp(e,[],!!t)),B3e.push([n,e])}function fbe(){return B3e}const ps=Object.freeze({text:"text/plain",binary:"application/octet-stream",unknown:"application/unknown",markdown:"text/markdown",latex:"text/latex",uriList:"text/uri-list"}),eW={JSONContribution:"base.contributions.json"};function Gvt(n){return n.length>0&&n.charAt(n.length-1)==="#"?n.substring(0,n.length-1):n}class Yvt{constructor(){this._onDidChangeSchema=new fe,this.schemasById={}}registerSchema(e,t){this.schemasById[Gvt(e)]=t,this._onDidChangeSchema.fire(e)}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}}const Zvt=new Yvt;Yr.add(eW.JSONContribution,Zvt);const ff={Configuration:"base.contributions.configuration"},LT="vscode://schemas/settings/resourceLanguage",gbe=Yr.as(eW.JSONContribution);class Xvt{constructor(){this.registeredConfigurationDefaults=[],this.overrideIdentifiers=new Set,this._onDidSchemaChange=new fe,this._onDidUpdateConfiguration=new fe,this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:w("defaultLanguageConfigurationOverrides.title","Default Language Configuration Overrides"),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.excludedConfigurationProperties={},gbe.registerSchema(LT,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){this.registerConfigurations([e],t)}registerConfigurations(e,t=!0){const i=new Set;this.doRegisterConfigurations(e,t,i),gbe.registerSchema(LT,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:i})}registerDefaultConfigurations(e){const t=new Set;this.doRegisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doRegisterDefaultConfigurations(e,t){this.registeredConfigurationDefaults.push(...e);const i=[];for(const{overrides:r,source:s}of e)for(const o in r){t.add(o);const a=this.configurationDefaultsOverrides.get(o)??this.configurationDefaultsOverrides.set(o,{configurationDefaultOverrides:[]}).get(o),l=r[o];if(a.configurationDefaultOverrides.push({value:l,source:s}),Eb.test(o)){const c=this.mergeDefaultConfigurationsForOverrideIdentifier(o,l,s,a.configurationDefaultOverrideValue);if(!c)continue;a.configurationDefaultOverrideValue=c,this.updateDefaultOverrideProperty(o,c,s),i.push(...e8(o))}else{const c=this.mergeDefaultConfigurationsForConfigurationProperty(o,l,s,a.configurationDefaultOverrideValue);if(!c)continue;a.configurationDefaultOverrideValue=c;const u=this.configurationProperties[o];u&&(this.updatePropertyDefaultValue(o,u),this.updateSchema(o,u))}}this.doRegisterOverrideIdentifiers(i)}updateDefaultOverrideProperty(e,t,i){const r={type:"object",default:t.value,description:w("defaultLanguageConfiguration.description","Configure settings to be overridden for the {0} language.",Kvt(e)),$ref:LT,defaultDefaultValue:t.value,source:i,defaultValueSource:i};this.configurationProperties[e]=r,this.defaultLanguageConfigurationOverridesNode.properties[e]=r}mergeDefaultConfigurationsForOverrideIdentifier(e,t,i,r){const s=r?.value||{},o=r?.source??new Map;if(!(o instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(const a of Object.keys(t)){const l=t[a];if(Mo(l)&&(ml(s[a])||Mo(s[a]))){if(s[a]={...s[a]??{},...l},i)for(const u in l)o.set(`${a}.${u}`,i)}else s[a]=l,i?o.set(a,i):o.delete(a)}return{value:s,source:o}}mergeDefaultConfigurationsForConfigurationProperty(e,t,i,r){const s=this.configurationProperties[e],o=r?.value??s?.defaultDefaultValue;let a=i;if(Mo(t)&&(s!==void 0&&s.type==="object"||s===void 0&&(ml(o)||Mo(o)))){if(a=r?.source??new Map,!(a instanceof Map)){console.error("defaultValueSource is not a Map");return}for(const c in t)i&&a.set(`${e}.${c}`,i);t={...Mo(o)?o:{},...t}}return{value:t,source:a}}registerOverrideIdentifiers(e){this.doRegisterOverrideIdentifiers(e),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(e){for(const t of e)this.overrideIdentifiers.add(t);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,t,i){e.forEach(r=>{this.validateAndRegisterProperties(r,t,r.extensionInfo,r.restrictedProperties,void 0,i),this.configurationContributors.push(r),this.registerJSONConfiguration(r)})}validateAndRegisterProperties(e,t=!0,i,r,s=3,o){s=Bu(e.scope)?s:e.scope;const a=e.properties;if(a)for(const c in a){const u=a[c];if(t&&ebt(c,u)){delete a[c];continue}if(u.source=i,u.defaultDefaultValue=a[c].default,this.updatePropertyDefaultValue(c,u),Eb.test(c)?u.scope=void 0:(u.scope=Bu(u.scope)?s:u.scope,u.restricted=Bu(u.restricted)?!!r?.includes(c):u.restricted),a[c].hasOwnProperty("included")&&!a[c].included){this.excludedConfigurationProperties[c]=a[c],delete a[c];continue}else this.configurationProperties[c]=a[c],a[c].policy?.name&&this.policyConfigurations.set(a[c].policy.name,c);!a[c].deprecationMessage&&a[c].markdownDeprecationMessage&&(a[c].deprecationMessage=a[c].markdownDeprecationMessage),o.add(c)}const l=e.allOf;if(l)for(const c of l)this.validateAndRegisterProperties(c,t,i,r,s,o)}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}registerJSONConfiguration(e){const t=i=>{const r=i.properties;if(r)for(const o in r)this.updateSchema(o,r[o]);i.allOf?.forEach(t)};t(e)}updateSchema(e,t){switch(t.scope){case 1:break;case 2:break;case 6:break;case 3:break;case 4:break;case 5:this.resourceLanguageSettingsSchema.properties[e]=t;break}}updateOverridePropertyPatternKey(){for(const e of this.overrideIdentifiers.values()){const t=`[${e}]`,i={type:"object",description:w("overrideSettings.defaultDescription","Configure editor settings to be overridden for a language."),errorMessage:w("overrideSettings.errorMessage","This setting does not support per-language configuration."),$ref:LT};this.updatePropertyDefaultValue(t,i)}}registerOverridePropertyPatternKey(){w("overrideSettings.defaultDescription","Configure editor settings to be overridden for a language."),w("overrideSettings.errorMessage","This setting does not support per-language configuration."),this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){const i=this.configurationDefaultsOverrides.get(e)?.configurationDefaultOverrideValue;let r,s;i&&(!t.disallowConfigurationDefault||!i.source)&&(r=i.value,s=i.source),ml(r)&&(r=t.defaultDefaultValue,s=void 0),ml(r)&&(r=Jvt(t.type)),t.default=r,t.defaultValueSource=s}}const $3e="\\[([^\\]]+)\\]",pbe=new RegExp($3e,"g"),Qvt=`^(${$3e})+$`,Eb=new RegExp(Qvt);function e8(n){const e=[];if(Eb.test(n)){let t=pbe.exec(n);for(;t?.length;){const i=t[1].trim();i&&e.push(i),t=pbe.exec(n)}}return j_(e)}function Jvt(n){switch(Array.isArray(n)?n[0]:n){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}const z5=new Xvt;Yr.add(ff.Configuration,z5);function ebt(n,e){return n.trim()?Eb.test(n)?w("config.property.languageDefault","Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",n):z5.getConfigurationProperties()[n]!==void 0?w("config.property.duplicate","Cannot register '{0}'. This property is already registered.",n):e.policy?.name&&z5.getPolicyConfigurations().get(e.policy?.name)!==void 0?w("config.policy.duplicate","Cannot register '{0}'. The associated policy {1} is already registered with {2}.",n,e.policy?.name,z5.getPolicyConfigurations().get(e.policy?.name)):null:w("config.property.empty","Cannot register an empty property")}const tbt={ModesRegistry:"editor.modesRegistry"};class nbt{constructor(){this._onDidChangeLanguages=new fe,this.onDidChangeLanguages=this._onDidChangeLanguages.event,this._languages=[]}registerLanguage(e){return this._languages.push(e),this._onDidChangeLanguages.fire(void 0),{dispose:()=>{for(let t=0,i=this._languages.length;t{const l=new Set;return{info:new sbt(this,a,l),closing:l}}),s=new $ve(a=>{const l=new Set,c=new Set;return{info:new obt(this,a,l,c),opening:l,openingColorized:c}});for(const[a,l]of i){const c=r.get(a),u=s.get(l);c.closing.add(u.info),u.opening.add(c.info)}const o=t.colorizedBracketPairs?mbe(t.colorizedBracketPairs):i.filter(a=>!(a[0]==="<"&&a[1]===">"));for(const[a,l]of o){const c=r.get(a),u=s.get(l);c.closing.add(u.info),u.openingColorized.add(c.info),u.opening.add(c.info)}this._openingBrackets=new Map([...r.cachedValues].map(([a,l])=>[a,l.info])),this._closingBrackets=new Map([...s.cachedValues].map(([a,l])=>[a,l.info]))}get openingBrackets(){return[...this._openingBrackets.values()]}get closingBrackets(){return[...this._closingBrackets.values()]}getOpeningBracketInfo(e){return this._openingBrackets.get(e)}getClosingBracketInfo(e){return this._closingBrackets.get(e)}getBracketInfo(e){return this.getOpeningBracketInfo(e)||this.getClosingBracketInfo(e)}getBracketRegExp(e){const t=Array.from([...this._openingBrackets.keys(),...this._closingBrackets.keys()]);return XP(t,e)}}function mbe(n){return n.filter(([e,t])=>e!==""&&t!=="")}class W3e{constructor(e,t){this.config=e,this.bracketText=t}get languageId(){return this.config.languageId}}class sbt extends W3e{constructor(e,t,i){super(e,t),this.openedBrackets=i,this.isOpeningBracket=!0}}class obt extends W3e{constructor(e,t,i,r){super(e,t),this.openingBrackets=i,this.openingColorizedBrackets=r,this.isOpeningBracket=!1}closes(e){return e.config!==this.config?!1:this.openingBrackets.has(e)}closesColorized(e){return e.config!==this.config?!1:this.openingColorizedBrackets.has(e)}getOpeningBrackets(){return[...this.openingBrackets]}}var abt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},_be=function(n,e){return function(t,i){e(t,i,n)}};class Oj{constructor(e){this.languageId=e}affects(e){return this.languageId?this.languageId===e:!0}}const Zr=On("languageConfigurationService");let LX=class extends me{constructor(e,t){super(),this.configurationService=e,this.languageService=t,this._registry=this._register(new dbt),this.onDidChangeEmitter=this._register(new fe),this.onDidChange=this.onDidChangeEmitter.event,this.configurations=new Map;const i=new Set(Object.values(TX));this._register(this.configurationService.onDidChangeConfiguration(r=>{const s=r.change.keys.some(a=>i.has(a)),o=r.change.overrides.filter(([a,l])=>l.some(c=>i.has(c))).map(([a])=>a);if(s)this.configurations.clear(),this.onDidChangeEmitter.fire(new Oj(void 0));else for(const a of o)this.languageService.isRegisteredLanguageId(a)&&(this.configurations.delete(a),this.onDidChangeEmitter.fire(new Oj(a)))})),this._register(this._registry.onDidChange(r=>{this.configurations.delete(r.languageId),this.onDidChangeEmitter.fire(new Oj(r.languageId))}))}register(e,t,i){return this._registry.register(e,t,i)}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=lbt(e,this._registry,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};LX=abt([_be(0,En),_be(1,Hr)],LX);function lbt(n,e,t,i){let r=e.getLanguageConfiguration(n);if(!r){if(!i.isRegisteredLanguageId(n))return new uk(n,{});r=new uk(n,{})}const s=cbt(r.languageId,t),o=V3e([r.underlyingConfig,s]);return new uk(r.languageId,o)}const TX={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};function cbt(n,e){const t=e.getValue(TX.brackets,{overrideIdentifier:n}),i=e.getValue(TX.colorizedBracketPairs,{overrideIdentifier:n});return{brackets:vbe(t),colorizedBracketPairs:vbe(i)}}function vbe(n){if(Array.isArray(n))return n.map(e=>{if(!(!Array.isArray(e)||e.length!==2))return[e[0],e[1]]}).filter(e=>!!e)}function H3e(n,e,t){const i=n.getLineContent(e);let r=Ji(i);return r.length>t-1&&(r=r.substring(0,t-1)),r}class ubt{constructor(e){this.languageId=e,this._resolved=null,this._entries=[],this._order=0,this._resolved=null}register(e,t){const i=new bbe(e,t,++this._order);return this._entries.push(i),this._resolved=null,Lt(()=>{for(let r=0;re.configuration)))}}function V3e(n){let e={comments:void 0,brackets:void 0,wordPattern:void 0,indentationRules:void 0,onEnterRules:void 0,autoClosingPairs:void 0,surroundingPairs:void 0,autoCloseBefore:void 0,folding:void 0,colorizedBracketPairs:void 0,__electricCharacterSupport:void 0};for(const t of n)e={comments:t.comments||e.comments,brackets:t.brackets||e.brackets,wordPattern:t.wordPattern||e.wordPattern,indentationRules:t.indentationRules||e.indentationRules,onEnterRules:t.onEnterRules||e.onEnterRules,autoClosingPairs:t.autoClosingPairs||e.autoClosingPairs,surroundingPairs:t.surroundingPairs||e.surroundingPairs,autoCloseBefore:t.autoCloseBefore||e.autoCloseBefore,folding:t.folding||e.folding,colorizedBracketPairs:t.colorizedBracketPairs||e.colorizedBracketPairs,__electricCharacterSupport:t.__electricCharacterSupport||e.__electricCharacterSupport};return e}class bbe{constructor(e,t,i){this.configuration=e,this.priority=t,this.order=i}static cmp(e,t){return e.priority===t.priority?e.order-t.order:e.priority-t.priority}}class ybe{constructor(e){this.languageId=e}}class dbt extends me{constructor(){super(),this._entries=new Map,this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._register(this.register(Hl,{brackets:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],colorizedBracketPairs:[],folding:{offSide:!0}},0))}register(e,t,i=0){let r=this._entries.get(e);r||(r=new ubt(e),this._entries.set(e,r));const s=r.register(t,i);return this._onDidChange.fire(new ybe(e)),Lt(()=>{s.dispose(),this._onDidChange.fire(new ybe(e))})}getLanguageConfiguration(e){return this._entries.get(e)?.getResolvedConfiguration()||null}}class uk{constructor(e,t){this.languageId=e,this.underlyingConfig=t,this._brackets=null,this._electricCharacter=null,this._onEnterSupport=this.underlyingConfig.brackets||this.underlyingConfig.indentationRules||this.underlyingConfig.onEnterRules?new wS(this.underlyingConfig):null,this.comments=uk._handleComments(this.underlyingConfig),this.characterPair=new Q6(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||_ae,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new jvt(this.underlyingConfig.indentationRules):this.indentRulesSupport=null,this.foldingRules=this.underlyingConfig.folding||{},this.bracketsNew=new rbt(e,this.underlyingConfig)}getWordDefinition(){return vae(this.wordDefinition)}get brackets(){return!this._brackets&&this.underlyingConfig.brackets&&(this._brackets=new Bvt(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new Uvt(this.brackets)),this._electricCharacter}onEnter(e,t,i,r){return this._onEnterSupport?this._onEnterSupport.onEnter(e,t,i,r):null}getAutoClosingPairs(){return new Ivt(this.characterPair.getAutoClosingPairs())}getAutoCloseBeforeSet(e){return this.characterPair.getAutoCloseBeforeSet(e)}getSurroundingPairs(){return this.characterPair.getSurroundingPairs()}static _handleComments(e){const t=e.comments;if(!t)return null;const i={};if(t.lineComment&&(i.lineCommentToken=t.lineComment),t.blockComment){const[r,s]=t.blockComment;i.blockCommentStartToken=r,i.blockCommentEndToken=s}return i}}Vn(Zr,LX,1);class Z0{constructor(e,t,i,r){this.originalStart=e,this.originalLength=t,this.modifiedStart=i,this.modifiedLength=r}getOriginalEnd(){return this.originalStart+this.originalLength}getModifiedEnd(){return this.modifiedStart+this.modifiedLength}}class wbe{constructor(e){this.source=e}getElements(){const e=this.source,t=new Int32Array(e.length);for(let i=0,r=e.length;i0||this.m_modifiedCount>0)&&this.m_changes.push(new Z0(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_originalCount++}AddModifiedElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}}class wp{constructor(e,t,i=null){this.ContinueProcessingPredicate=i,this._originalSequence=e,this._modifiedSequence=t;const[r,s,o]=wp._getElements(e),[a,l,c]=wp._getElements(t);this._hasStrings=o&&c,this._originalStringElements=r,this._originalElementsOrHash=s,this._modifiedStringElements=a,this._modifiedElementsOrHash=l,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(e){return e.length>0&&typeof e[0]=="string"}static _getElements(e){const t=e.getElements();if(wp._isStringArray(t)){const i=new Int32Array(t.length);for(let r=0,s=t.length;r=e&&r>=i&&this.ElementsAreEqual(t,r);)t--,r--;if(e>t||i>r){let d;return i<=r?(ux.Assert(e===t+1,"originalStart should only be one more than originalEnd"),d=[new Z0(e,0,i,r-i+1)]):e<=t?(ux.Assert(i===r+1,"modifiedStart should only be one more than modifiedEnd"),d=[new Z0(e,t-e+1,i,0)]):(ux.Assert(e===t+1,"originalStart should only be one more than originalEnd"),ux.Assert(i===r+1,"modifiedStart should only be one more than modifiedEnd"),d=[]),d}const o=[0],a=[0],l=this.ComputeRecursionPoint(e,t,i,r,o,a,s),c=o[0],u=a[0];if(l!==null)return l;if(!s[0]){const d=this.ComputeDiffRecursive(e,c,i,u,s);let h=[];return s[0]?h=[new Z0(c+1,t-(c+1)+1,u+1,r-(u+1)+1)]:h=this.ComputeDiffRecursive(c+1,t,u+1,r,s),this.ConcatenateChanges(d,h)}return[new Z0(e,t-e+1,i,r-i+1)]}WALKTRACE(e,t,i,r,s,o,a,l,c,u,d,h,f,g,p,m,_,v){let y=null,C=null,x=new Cbe,k=t,L=i,D=f[0]-m[0]-r,I=-1073741824,O=this.m_forwardHistory.length-1;do{const M=D+e;M===k||M=0&&(c=this.m_forwardHistory[O],e=c[0],k=1,L=c.length-1)}while(--O>=-1);if(y=x.getReverseChanges(),v[0]){let M=f[0]+1,B=m[0]+1;if(y!==null&&y.length>0){const G=y[y.length-1];M=Math.max(M,G.getOriginalEnd()),B=Math.max(B,G.getModifiedEnd())}C=[new Z0(M,h-M+1,B,p-B+1)]}else{x=new Cbe,k=o,L=a,D=f[0]-m[0]-l,I=1073741824,O=_?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{const M=D+s;M===k||M=u[M+1]?(d=u[M+1]-1,g=d-D-l,d>I&&x.MarkNextChange(),I=d+1,x.AddOriginalElement(d+1,g+1),D=M+1-s):(d=u[M-1],g=d-D-l,d>I&&x.MarkNextChange(),I=d,x.AddModifiedElement(d+1,g+1),D=M-1-s),O>=0&&(u=this.m_reverseHistory[O],s=u[0],k=1,L=u.length-1)}while(--O>=-1);C=x.getChanges()}return this.ConcatenateChanges(y,C)}ComputeRecursionPoint(e,t,i,r,s,o,a){let l=0,c=0,u=0,d=0,h=0,f=0;e--,i--,s[0]=0,o[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];const g=t-e+(r-i),p=g+1,m=new Int32Array(p),_=new Int32Array(p),v=r-i,y=t-e,C=e-i,x=t-r,L=(y-v)%2===0;m[v]=e,_[y]=t,a[0]=!1;for(let D=1;D<=g/2+1;D++){let I=0,O=0;u=this.ClipDiagonalBound(v-D,D,v,p),d=this.ClipDiagonalBound(v+D,D,v,p);for(let B=u;B<=d;B+=2){B===u||BI+O&&(I=l,O=c),!L&&Math.abs(B-y)<=D-1&&l>=_[B])return s[0]=l,o[0]=c,G<=_[B]&&D<=1448?this.WALKTRACE(v,u,d,C,y,h,f,x,m,_,l,t,s,c,r,o,L,a):null}const M=(I-e+(O-i)-D)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(I,M))return a[0]=!0,s[0]=I,o[0]=O,M>0&&D<=1448?this.WALKTRACE(v,u,d,C,y,h,f,x,m,_,l,t,s,c,r,o,L,a):(e++,i++,[new Z0(e,t-e+1,i,r-i+1)]);h=this.ClipDiagonalBound(y-D,D,y,p),f=this.ClipDiagonalBound(y+D,D,y,p);for(let B=h;B<=f;B+=2){B===h||B=_[B+1]?l=_[B+1]-1:l=_[B-1],c=l-(B-y)-x;const G=l;for(;l>e&&c>i&&this.ElementsAreEqual(l,c);)l--,c--;if(_[B]=l,L&&Math.abs(B-v)<=D&&l<=m[B])return s[0]=l,o[0]=c,G>=m[B]&&D<=1448?this.WALKTRACE(v,u,d,C,y,h,f,x,m,_,l,t,s,c,r,o,L,a):null}if(D<=1447){let B=new Int32Array(d-u+2);B[0]=v-u+1,dx.Copy2(m,u,B,1,d-u+1),this.m_forwardHistory.push(B),B=new Int32Array(f-h+2),B[0]=y-h+1,dx.Copy2(_,h,B,1,f-h+1),this.m_reverseHistory.push(B)}}return this.WALKTRACE(v,u,d,C,y,h,f,x,m,_,l,t,s,c,r,o,L,a)}PrettifyChanges(e){for(let t=0;t0,a=i.modifiedLength>0;for(;i.originalStart+i.originalLength=0;t--){const i=e[t];let r=0,s=0;if(t>0){const d=e[t-1];r=d.originalStart+d.originalLength,s=d.modifiedStart+d.modifiedLength}const o=i.originalLength>0,a=i.modifiedLength>0;let l=0,c=this._boundaryScore(i.originalStart,i.originalLength,i.modifiedStart,i.modifiedLength);for(let d=1;;d++){const h=i.originalStart-d,f=i.modifiedStart-d;if(hc&&(c=p,l=d)}i.originalStart-=l,i.modifiedStart-=l;const u=[null];if(t>0&&this.ChangesOverlap(e[t-1],e[t],u)){e[t-1]=u[0],e.splice(t,1),t++;continue}}if(this._hasStrings)for(let t=1,i=e.length;t0&&f>l&&(l=f,c=d,u=h)}return l>0?[c,u]:null}_contiguousSequenceScore(e,t,i){let r=0;for(let s=0;s=this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[e])}_OriginalRegionIsBoundary(e,t){if(this._OriginalIsBoundary(e)||this._OriginalIsBoundary(e-1))return!0;if(t>0){const i=e+t;if(this._OriginalIsBoundary(i-1)||this._OriginalIsBoundary(i))return!0}return!1}_ModifiedIsBoundary(e){return e<=0||e>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[e])}_ModifiedRegionIsBoundary(e,t){if(this._ModifiedIsBoundary(e)||this._ModifiedIsBoundary(e-1))return!0;if(t>0){const i=e+t;if(this._ModifiedIsBoundary(i-1)||this._ModifiedIsBoundary(i))return!0}return!1}_boundaryScore(e,t,i,r){const s=this._OriginalRegionIsBoundary(e,t)?1:0,o=this._ModifiedRegionIsBoundary(i,r)?1:0;return s+o}ConcatenateChanges(e,t){const i=[];if(e.length===0||t.length===0)return t.length>0?t:e;if(this.ChangesOverlap(e[e.length-1],t[0],i)){const r=new Array(e.length+t.length-1);return dx.Copy(e,0,r,0,e.length-1),r[e.length-1]=i[0],dx.Copy(t,1,r,e.length,t.length-1),r}else{const r=new Array(e.length+t.length);return dx.Copy(e,0,r,0,e.length),dx.Copy(t,0,r,e.length,t.length),r}}ChangesOverlap(e,t,i){if(ux.Assert(e.originalStart<=t.originalStart,"Left change is not less than or equal to right change"),ux.Assert(e.modifiedStart<=t.modifiedStart,"Left change is not less than or equal to right change"),e.originalStart+e.originalLength>=t.originalStart||e.modifiedStart+e.modifiedLength>=t.modifiedStart){const r=e.originalStart;let s=e.originalLength;const o=e.modifiedStart;let a=e.modifiedLength;return e.originalStart+e.originalLength>=t.originalStart&&(s=t.originalStart+t.originalLength-e.originalStart),e.modifiedStart+e.modifiedLength>=t.modifiedStart&&(a=t.modifiedStart+t.modifiedLength-e.modifiedStart),i[0]=new Z0(r,s,o,a),!0}else return i[0]=null,!1}ClipDiagonalBound(e,t,i,r){if(e>=0&&e255?255:n|0}function hx(n){return n<0?0:n>4294967295?4294967295:n|0}class QL{constructor(e){const t=t8(e);this._defaultValue=t,this._asciiMap=QL._createAsciiMap(t),this._map=new Map}static _createAsciiMap(e){const t=new Uint8Array(256);return t.fill(e),t}set(e,t){const i=t8(t);e>=0&&e<256?this._asciiMap[e]=i:this._map.set(e,i)}get(e){return e>=0&&e<256?this._asciiMap[e]:this._map.get(e)||this._defaultValue}clear(){this._asciiMap.fill(this._defaultValue),this._map.clear()}}class n8{constructor(){this._actual=new QL(0)}add(e){this._actual.set(e,1)}has(e){return this._actual.get(e)===1}clear(){return this._actual.clear()}}class fbt{constructor(e,t,i){const r=new Uint8Array(e*t);for(let s=0,o=e*t;st&&(t=l),a>i&&(i=a),c>i&&(i=c)}t++,i++;const r=new fbt(i,t,0);for(let s=0,o=e.length;s=this._maxCharCode?0:this._states.get(e,t)}}let Mj=null;function pbt(){return Mj===null&&(Mj=new gbt([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),Mj}let TT=null;function mbt(){if(TT===null){TT=new QL(0);const n=` <>'"、。。、,.:;‘〈「『〔([{「」}])〕』」〉’`~…`;for(let t=0;tr);if(r>0){const a=t.charCodeAt(r-1),l=t.charCodeAt(o);(a===40&&l===41||a===91&&l===93||a===123&&l===125)&&o--}return{range:{startLineNumber:i,startColumn:r+1,endLineNumber:i,endColumn:o+2},url:t.substring(r,o+1)}}static computeLinks(e,t=pbt()){const i=mbt(),r=[];for(let s=1,o=e.getLineCount();s<=o;s++){const a=e.getLineContent(s),l=a.length;let c=0,u=0,d=0,h=1,f=!1,g=!1,p=!1,m=!1;for(;c=0?(r+=i?1:-1,r<0?r=e.length-1:r%=e.length,e[r]):null}}class r8{static{this.CHANNEL_NAME="editorWorkerHost"}static getChannel(e){return e.getChannel(r8.CHANNEL_NAME)}static setChannel(e,t){e.setChannel(r8.CHANNEL_NAME,t)}}var xbe,Sbe;class vbt{constructor(e,t){this.uri=e,this.value=t}}function bbt(n){return Array.isArray(n)}class so{static{this.defaultToKey=e=>e.toString()}constructor(e,t){if(this[xbe]="ResourceMap",e instanceof so)this.map=new Map(e.map),this.toKey=t??so.defaultToKey;else if(bbt(e)){this.map=new Map,this.toKey=t??so.defaultToKey;for(const[i,r]of e)this.set(i,r)}else this.map=new Map,this.toKey=e??so.defaultToKey}set(e,t){return this.map.set(this.toKey(e),new vbt(e,t)),this}get(e){return this.map.get(this.toKey(e))?.value}has(e){return this.map.has(this.toKey(e))}get size(){return this.map.size}clear(){this.map.clear()}delete(e){return this.map.delete(this.toKey(e))}forEach(e,t){typeof t<"u"&&(e=e.bind(t));for(const[i,r]of this.map)e(r.value,r.uri,this)}*values(){for(const e of this.map.values())yield e.value}*keys(){for(const e of this.map.values())yield e.uri}*entries(){for(const e of this.map.values())yield[e.uri,e.value]}*[(xbe=Symbol.toStringTag,Symbol.iterator)](){for(const[,e]of this.map)yield[e.uri,e.value]}}class ybt{constructor(){this[Sbe]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,t=0){const i=this._map.get(e);if(i)return t!==0&&this.touch(i,t),i.value}set(e,t,i=0){let r=this._map.get(e);if(r)r.value=t,i!==0&&this.touch(r,i);else{switch(r={key:e,value:t,next:void 0,previous:void 0},i){case 0:this.addItemLast(r);break;case 1:this.addItemFirst(r);break;case 2:this.addItemLast(r);break;default:this.addItemLast(r);break}this._map.set(e,r),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const i=this._state;let r=this._head;for(;r;){if(t?e.bind(t)(r.value,r.key,this):e(r.value,r.key,this),this._state!==i)throw new Error("LinkedMap got modified during iteration.");r=r.next}}keys(){const e=this,t=this._state;let i=this._head;const r={[Symbol.iterator](){return r},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:i.key,done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return r}values(){const e=this,t=this._state;let i=this._head;const r={[Symbol.iterator](){return r},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:i.value,done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return r}entries(){const e=this,t=this._state;let i=this._head;const r={[Symbol.iterator](){return r},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:[i.key,i.value],done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return r}[(Sbe=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,i=this.size;for(;t&&i>e;)this._map.delete(t.key),t=t.next,i--;this._head=t,this._size=i,t&&(t.previous=void 0),this._state++}trimNew(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._tail,i=this.size;for(;t&&i>e;)this._map.delete(t.key),t=t.previous,i--;this._tail=t,this._size=i,t&&(t.next=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const t=e.next,i=e.previous;if(!t||!i)throw new Error("Invalid list");t.previous=i,i.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==1&&t!==2)){if(t===1){if(e===this._head)return;const i=e.next,r=e.previous;e===this._tail?(r.next=void 0,this._tail=r):(i.previous=r,r.next=i),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===2){if(e===this._tail)return;const i=e.next,r=e.previous;e===this._head?(i.previous=void 0,this._head=i):(i.previous=r,r.next=i),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){const e=[];return this.forEach((t,i)=>{e.push([i,t])}),e}fromJSON(e){this.clear();for(const[t,i]of e)this.set(t,i)}}class wbt extends ybt{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get(e,t=2){return super.get(e,t)}peek(e){return super.get(e,0)}set(e,t){return super.set(e,t,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}}class lm extends wbt{constructor(e,t=1){super(e,t)}trim(e){this.trimOld(e)}set(e,t){return super.set(e,t),this.checkTrim(),this}}class Cbt{constructor(e){if(this._m1=new Map,this._m2=new Map,e)for(const[t,i]of e)this.set(t,i)}clear(){this._m1.clear(),this._m2.clear()}set(e,t){this._m1.set(e,t),this._m2.set(t,e)}get(e){return this._m1.get(e)}getKey(e){return this._m2.get(e)}delete(e){const t=this._m1.get(e);return t===void 0?!1:(this._m1.delete(e),this._m2.delete(t),!0)}keys(){return this._m1.keys()}values(){return this._m1.values()}}class Xae{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){const i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){const i=this.map.get(e);i&&i.forEach(t)}get(e){const t=this.map.get(e);return t||new Set}}class xbt extends QL{constructor(e,t){super(0),this._segmenter=null,this._cachedLine=null,this._cachedSegments=[],this.intlSegmenterLocales=t,this.intlSegmenterLocales.length>0?this._segmenter=new Intl.Segmenter(this.intlSegmenterLocales,{granularity:"word"}):this._segmenter=null;for(let i=0,r=e.length;it)break;i=r}return i}findNextIntlWordAtOrAfterOffset(e,t){for(const i of this._getIntlSegmenterWordsOnLine(e))if(!(i.index=0;let t=null;try{t=H4e(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:e,global:!0,unicode:!0})}catch{return null}if(!t)return null;let i=!this.isRegex&&!e;return i&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(i=this.matchCase),new kbt(t,this.wordSeparators?eh(this.wordSeparators,[]):null,i?this.searchString:null)}}function Tbt(n){if(!n||n.length===0)return!1;for(let e=0,t=n.length;e=t)break;const r=n.charCodeAt(e);if(r===110||r===114||r===87)return!0}}return!1}function ly(n,e,t){if(!t)return new dN(n,null);const i=[];for(let r=0,s=e.length;r>0);t[s]>=e?r=s-1:t[s+1]>=e?(i=s,r=s):i=s+1}return i+1}}class E4{static findMatches(e,t,i,r,s){const o=t.parseSearchRequest();return o?o.regex.multiline?this._doFindMatchesMultiline(e,i,new CS(o.wordSeparators,o.regex),r,s):this._doFindMatchesLineByLine(e,i,o,r,s):[]}static _getMultilineMatchRange(e,t,i,r,s,o){let a,l=0;r?(l=r.findLineFeedCountBeforeOffset(s),a=t+s+l):a=t+s;let c;if(r){const f=r.findLineFeedCountBeforeOffset(s+o.length)-l;c=a+o.length+f}else c=a+o.length;const u=e.getPositionAt(a),d=e.getPositionAt(c);return new $(u.lineNumber,u.column,d.lineNumber,d.column)}static _doFindMatchesMultiline(e,t,i,r,s){const o=e.getOffsetAt(t.getStartPosition()),a=e.getValueInRange(t,1),l=e.getEOL()===`\r `?new Ebe(a):null,c=[];let u=0,d;for(i.reset(0);d=i.next(a);)if(c[u++]=ly(this._getMultilineMatchRange(e,o,a,l,d.index,d[0]),d,r),u>=s)return c;return c}static _doFindMatchesLineByLine(e,t,i,r,s){const o=[];let a=0;if(t.startLineNumber===t.endLineNumber){const c=e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1);return a=this._findMatchesInLine(i,c,t.startLineNumber,t.startColumn-1,a,o,r,s),o}const l=e.getLineContent(t.startLineNumber).substring(t.startColumn-1);a=this._findMatchesInLine(i,l,t.startLineNumber,t.startColumn-1,a,o,r,s);for(let c=t.startLineNumber+1;c=l))return s;return s}const u=new CS(e.wordSeparators,e.regex);let d;u.reset(0);do if(d=u.next(t),d&&(o[s++]=ly(new $(i,d.index+1+r,i,d.index+1+d[0].length+r),d,a),s>=l))return s;while(d);return s}static findNextMatch(e,t,i,r){const s=t.parseSearchRequest();if(!s)return null;const o=new CS(s.wordSeparators,s.regex);return s.regex.multiline?this._doFindNextMatchMultiline(e,i,o,r):this._doFindNextMatchLineByLine(e,i,o,r)}static _doFindNextMatchMultiline(e,t,i,r){const s=new he(t.lineNumber,1),o=e.getOffsetAt(s),a=e.getLineCount(),l=e.getValueInRange(new $(s.lineNumber,s.column,a,e.getLineMaxColumn(a)),1),c=e.getEOL()===`\r `?new Ebe(l):null;i.reset(t.column-1);const u=i.next(l);return u?ly(this._getMultilineMatchRange(e,o,l,c,u.index,u[0]),u,r):t.lineNumber!==1||t.column!==1?this._doFindNextMatchMultiline(e,new he(1,1),i,r):null}static _doFindNextMatchLineByLine(e,t,i,r){const s=e.getLineCount(),o=t.lineNumber,a=e.getLineContent(o),l=this._findFirstMatchInLine(i,a,o,t.column,r);if(l)return l;for(let c=1;c<=s;c++){const u=(o+c-1)%s,d=e.getLineContent(u+1),h=this._findFirstMatchInLine(i,d,u+1,1,r);if(h)return h}return null}static _findFirstMatchInLine(e,t,i,r,s){e.reset(r-1);const o=e.next(t);return o?ly(new $(i,o.index+1,i,o.index+1+o[0].length),o,s):null}static findPreviousMatch(e,t,i,r){const s=t.parseSearchRequest();if(!s)return null;const o=new CS(s.wordSeparators,s.regex);return s.regex.multiline?this._doFindPreviousMatchMultiline(e,i,o,r):this._doFindPreviousMatchLineByLine(e,i,o,r)}static _doFindPreviousMatchMultiline(e,t,i,r){const s=this._doFindMatchesMultiline(e,new $(1,1,t.lineNumber,t.column),i,r,10*Lbt);if(s.length>0)return s[s.length-1];const o=e.getLineCount();return t.lineNumber!==o||t.column!==e.getLineMaxColumn(o)?this._doFindPreviousMatchMultiline(e,new he(o,e.getLineMaxColumn(o)),i,r):null}static _doFindPreviousMatchLineByLine(e,t,i,r){const s=e.getLineCount(),o=t.lineNumber,a=e.getLineContent(o).substring(0,t.column-1),l=this._findLastMatchInLine(i,a,o,r);if(l)return l;for(let c=1;c<=s;c++){const u=(s+o-c-1)%s,d=e.getLineContent(u+1),h=this._findLastMatchInLine(i,d,u+1,r);if(h)return h}return null}static _findLastMatchInLine(e,t,i,r){let s=null,o;for(e.reset(0);o=e.next(t);)s=ly(new $(i,o.index+1,i,o.index+1+o[0].length),o,r);return s}}function Dbt(n,e,t,i,r){if(i===0)return!0;const s=e.charCodeAt(i-1);if(n.get(s)!==0||s===13||s===10)return!0;if(r>0){const o=e.charCodeAt(i);if(n.get(o)!==0)return!0}return!1}function Ibt(n,e,t,i,r){if(i+r===t)return!0;const s=e.charCodeAt(i+r);if(n.get(s)!==0||s===13||s===10)return!0;if(r>0){const o=e.charCodeAt(i+r-1);if(n.get(o)!==0)return!0}return!1}function Qae(n,e,t,i,r){return Dbt(n,e,t,i,r)&&Ibt(n,e,t,i,r)}class CS{constructor(e,t){this._wordSeparators=e,this._searchRegex=t,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(e){this._searchRegex.lastIndex=e,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(e){const t=e.length;let i;do{if(this._prevMatchStartIndex+this._prevMatchLength===t||(i=this._searchRegex.exec(e),!i))return null;const r=i.index,s=i[0].length;if(r===this._prevMatchStartIndex&&s===this._prevMatchLength){if(s===0){z6(e,t,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=r,this._prevMatchLength=s,!this._wordSeparators||Qae(this._wordSeparators,e,t,r,s))return i}while(i);return null}}class Jae{static computeUnicodeHighlights(e,t,i){const r=i?i.startLineNumber:1,s=i?i.endLineNumber:e.getLineCount(),o=new Lbe(t),a=o.getCandidateCodePoints();let l;a==="allNonBasicAscii"?l=new RegExp("[^\\t\\n\\r\\x20-\\x7E]","g"):l=new RegExp(`${Abt(Array.from(a))}`,"g");const c=new CS(null,l),u=[];let d=!1,h,f=0,g=0,p=0;e:for(let m=r,_=s;m<=_;m++){const v=e.getLineContent(m),y=v.length;c.reset(0);do if(h=c.next(v),h){let C=h.index,x=h.index+h[0].length;if(C>0){const I=v.charCodeAt(C-1);Co(I)&&C--}if(x+1=1e3){d=!0;break e}u.push(new $(m,C+1,m,x+1))}}while(h)}return{ranges:u,hasMore:d,ambiguousCharacterCount:f,invisibleCharacterCount:g,nonBasicAsciiCharacterCount:p}}static computeUnicodeHighlightReason(e,t){const i=new Lbe(t);switch(i.shouldHighlightNonBasicASCII(e,null)){case 0:return null;case 2:return{kind:1};case 3:{const s=e.codePointAt(0),o=i.ambiguousCharacters.getPrimaryConfusable(s),a=Dv.getLocales().filter(l=>!Dv.getInstance(new Set([...t.allowedLocales,l])).isAmbiguous(s));return{kind:0,confusableWith:String.fromCodePoint(o),notAmbiguousInLocales:a}}case 1:return{kind:2}}}}function Abt(n,e){return`[${nd(n.map(i=>String.fromCodePoint(i)).join(""))}]`}class Lbe{constructor(e){this.options=e,this.allowedCodePoints=new Set(e.allowedCodePoints),this.ambiguousCharacters=Dv.getInstance(new Set(e.allowedLocales))}getCandidateCodePoints(){if(this.options.nonBasicASCII)return"allNonBasicAscii";const e=new Set;if(this.options.invisibleCharacters)for(const t of I_.codePoints)Tbe(String.fromCodePoint(t))||e.add(t);if(this.options.ambiguousCharacters)for(const t of this.ambiguousCharacters.getConfusableCodePoints())e.add(t);for(const t of this.allowedCodePoints)e.delete(t);return e}shouldHighlightNonBasicASCII(e,t){const i=e.codePointAt(0);if(this.allowedCodePoints.has(i))return 0;if(this.options.nonBasicASCII)return 1;let r=!1,s=!1;if(t)for(const o of t){const a=o.codePointAt(0),l=KP(o);r=r||l,!l&&!this.ambiguousCharacters.isAmbiguous(a)&&!I_.isInvisibleCharacter(a)&&(s=!0)}return!r&&s?0:this.options.invisibleCharacters&&!Tbe(e)&&I_.isInvisibleCharacter(i)?2:this.options.ambiguousCharacters&&this.ambiguousCharacters.isAmbiguous(i)?3:0}}function Tbe(n){return n===" "||n===` -`||n===" "}class jF{constructor(e,t,i){this.changes=e,this.moves=t,this.hitTimeout=i}}class U3e{constructor(e,t){this.lineRangeMapping=e,this.changes=t}}class Dn{static addRange(e,t){let i=0;for(;it))return new Dn(e,t)}static ofLength(e){return new Dn(0,e)}static ofStartAndLength(e,t){return new Dn(e,e+t)}constructor(e,t){if(this.start=e,this.endExclusive=t,e>t)throw new fi(`Invalid range: ${this.toString()}`)}get isEmpty(){return this.start===this.endExclusive}delta(e){return new Dn(this.start+e,this.endExclusive+e)}deltaStart(e){return new Dn(this.start+e,this.endExclusive)}deltaEnd(e){return new Dn(this.start,this.endExclusive+e)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}contains(e){return this.start<=e&&e=e.endExclusive}slice(e){return e.slice(this.start,this.endExclusive)}substring(e){return e.substring(this.start,this.endExclusive)}clip(e){if(this.isEmpty)throw new fi(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,e))}clipCyclic(e){if(this.isEmpty)throw new fi(`Invalid clipping range: ${this.toString()}`);return e=this.endExclusive?this.start+(e-this.start)%this.length:e}forEach(e){for(let t=this.start;te.toString()).join(", ")}intersectsStrict(e){let t=0;for(;te+t.length,0)}}function hN(n,e){const t=Nbt(n,e);if(t!==-1)return n[t]}function Nbt(n,e,t=n.length-1){for(let i=t;i>=0;i--){const r=n[i];if(e(r))return i}return-1}function oE(n,e){const t=fN(n,e);return t===-1?void 0:n[t]}function fN(n,e,t=0,i=n.length){let r=t,s=i;for(;r0&&(t=r)}return t}function Pbt(n,e){if(n.length===0)return;let t=n[0];for(let i=1;i=0&&(t=r)}return t}function Obt(n,e){return tle(n,(t,i)=>-e(t,i))}function Mbt(n,e){if(n.length===0)return-1;let t=0;for(let i=1;i0&&(t=i)}return t}function Fbt(n,e){for(const t of n){const i=e(t);if(i!==void 0)return i}}let gn=class Bm{static fromRangeInclusive(e){return new Bm(e.startLineNumber,e.endLineNumber+1)}static joinMany(e){if(e.length===0)return[];let t=new Md(e[0].slice());for(let i=1;it)throw new fi(`startLineNumber ${e} cannot be after endLineNumberExclusive ${t}`);this.startLineNumber=e,this.endLineNumberExclusive=t}contains(e){return this.startLineNumber<=e&&er.endLineNumberExclusive>=e.startLineNumber),i=fN(this._normalizedRanges,r=>r.startLineNumber<=e.endLineNumberExclusive)+1;if(t===i)this._normalizedRanges.splice(t,0,e);else if(t===i-1){const r=this._normalizedRanges[t];this._normalizedRanges[t]=r.join(e)}else{const r=this._normalizedRanges[t].join(this._normalizedRanges[i-1]).join(e);this._normalizedRanges.splice(t,i-t,r)}}contains(e){const t=oE(this._normalizedRanges,i=>i.startLineNumber<=e);return!!t&&t.endLineNumberExclusive>e}intersects(e){const t=oE(this._normalizedRanges,i=>i.startLineNumbere.startLineNumber}getUnion(e){if(this._normalizedRanges.length===0)return e;if(e._normalizedRanges.length===0)return this;const t=[];let i=0,r=0,s=null;for(;i=o.startLineNumber?s=new gn(s.startLineNumber,Math.max(s.endLineNumberExclusive,o.endLineNumberExclusive)):(t.push(s),s=o)}return s!==null&&t.push(s),new Md(t)}subtractFrom(e){const t=gN(this._normalizedRanges,o=>o.endLineNumberExclusive>=e.startLineNumber),i=fN(this._normalizedRanges,o=>o.startLineNumber<=e.endLineNumberExclusive)+1;if(t===i)return new Md([e]);const r=[];let s=e.startLineNumber;for(let o=t;os&&r.push(new gn(s,a.startLineNumber)),s=a.endLineNumberExclusive}return se.toString()).join(", ")}getIntersection(e){const t=[];let i=0,r=0;for(;it.delta(e)))}}class _c{static{this.zero=new _c(0,0)}static betweenPositions(e,t){return e.lineNumber===t.lineNumber?new _c(0,t.column-e.column):new _c(t.lineNumber-e.lineNumber,t.column-1)}static ofRange(e){return _c.betweenPositions(e.getStartPosition(),e.getEndPosition())}static ofText(e){let t=0,i=0;for(const r of e)r===` +`||n===" "}class j5{constructor(e,t,i){this.changes=e,this.moves=t,this.hitTimeout=i}}class U3e{constructor(e,t){this.lineRangeMapping=e,this.changes=t}}class Dn{static addRange(e,t){let i=0;for(;it))return new Dn(e,t)}static ofLength(e){return new Dn(0,e)}static ofStartAndLength(e,t){return new Dn(e,e+t)}constructor(e,t){if(this.start=e,this.endExclusive=t,e>t)throw new fi(`Invalid range: ${this.toString()}`)}get isEmpty(){return this.start===this.endExclusive}delta(e){return new Dn(this.start+e,this.endExclusive+e)}deltaStart(e){return new Dn(this.start+e,this.endExclusive)}deltaEnd(e){return new Dn(this.start,this.endExclusive+e)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}contains(e){return this.start<=e&&e=e.endExclusive}slice(e){return e.slice(this.start,this.endExclusive)}substring(e){return e.substring(this.start,this.endExclusive)}clip(e){if(this.isEmpty)throw new fi(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,e))}clipCyclic(e){if(this.isEmpty)throw new fi(`Invalid clipping range: ${this.toString()}`);return e=this.endExclusive?this.start+(e-this.start)%this.length:e}forEach(e){for(let t=this.start;te.toString()).join(", ")}intersectsStrict(e){let t=0;for(;te+t.length,0)}}function hN(n,e){const t=Nbt(n,e);if(t!==-1)return n[t]}function Nbt(n,e,t=n.length-1){for(let i=t;i>=0;i--){const r=n[i];if(e(r))return i}return-1}function oE(n,e){const t=fN(n,e);return t===-1?void 0:n[t]}function fN(n,e,t=0,i=n.length){let r=t,s=i;for(;r0&&(t=r)}return t}function Pbt(n,e){if(n.length===0)return;let t=n[0];for(let i=1;i=0&&(t=r)}return t}function Obt(n,e){return tle(n,(t,i)=>-e(t,i))}function Mbt(n,e){if(n.length===0)return-1;let t=0;for(let i=1;i0&&(t=i)}return t}function Fbt(n,e){for(const t of n){const i=e(t);if(i!==void 0)return i}}let gn=class Bm{static fromRangeInclusive(e){return new Bm(e.startLineNumber,e.endLineNumber+1)}static joinMany(e){if(e.length===0)return[];let t=new Md(e[0].slice());for(let i=1;it)throw new fi(`startLineNumber ${e} cannot be after endLineNumberExclusive ${t}`);this.startLineNumber=e,this.endLineNumberExclusive=t}contains(e){return this.startLineNumber<=e&&er.endLineNumberExclusive>=e.startLineNumber),i=fN(this._normalizedRanges,r=>r.startLineNumber<=e.endLineNumberExclusive)+1;if(t===i)this._normalizedRanges.splice(t,0,e);else if(t===i-1){const r=this._normalizedRanges[t];this._normalizedRanges[t]=r.join(e)}else{const r=this._normalizedRanges[t].join(this._normalizedRanges[i-1]).join(e);this._normalizedRanges.splice(t,i-t,r)}}contains(e){const t=oE(this._normalizedRanges,i=>i.startLineNumber<=e);return!!t&&t.endLineNumberExclusive>e}intersects(e){const t=oE(this._normalizedRanges,i=>i.startLineNumbere.startLineNumber}getUnion(e){if(this._normalizedRanges.length===0)return e;if(e._normalizedRanges.length===0)return this;const t=[];let i=0,r=0,s=null;for(;i=o.startLineNumber?s=new gn(s.startLineNumber,Math.max(s.endLineNumberExclusive,o.endLineNumberExclusive)):(t.push(s),s=o)}return s!==null&&t.push(s),new Md(t)}subtractFrom(e){const t=gN(this._normalizedRanges,o=>o.endLineNumberExclusive>=e.startLineNumber),i=fN(this._normalizedRanges,o=>o.startLineNumber<=e.endLineNumberExclusive)+1;if(t===i)return new Md([e]);const r=[];let s=e.startLineNumber;for(let o=t;os&&r.push(new gn(s,a.startLineNumber)),s=a.endLineNumberExclusive}return se.toString()).join(", ")}getIntersection(e){const t=[];let i=0,r=0;for(;it.delta(e)))}}class _c{static{this.zero=new _c(0,0)}static betweenPositions(e,t){return e.lineNumber===t.lineNumber?new _c(0,t.column-e.column):new _c(t.lineNumber-e.lineNumber,t.column-1)}static ofRange(e){return _c.betweenPositions(e.getStartPosition(),e.getEndPosition())}static ofText(e){let t=0,i=0;for(const r of e)r===` `?(t++,i=0):i++;return new _c(t,i)}constructor(e,t){this.lineCount=e,this.columnCount=t}isGreaterThanOrEqualTo(e){return this.lineCount!==e.lineCount?this.lineCount>e.lineCount:this.columnCount>=e.columnCount}createRange(e){return this.lineCount===0?new $(e.lineNumber,e.column,e.lineNumber,e.column+this.columnCount):new $(e.lineNumber,e.column,e.lineNumber+this.lineCount,this.columnCount+1)}addToPosition(e){return this.lineCount===0?new he(e.lineNumber,e.column+this.columnCount):new he(e.lineNumber+this.lineCount,this.columnCount+1)}toString(){return`${this.lineCount},${this.columnCount}`}}class Bbt{constructor(e){this.text=e,this.lineStartOffsetByLineIdx=[],this.lineStartOffsetByLineIdx.push(0);for(let t=0;tqae(e,(t,i)=>t.range.getEndPosition().isBeforeOrEqual(i.range.getStartPosition())))}apply(e){let t="",i=new he(1,1);for(const s of this.edits){const o=s.range,a=o.getStartPosition(),l=o.getEndPosition(),c=Dbe(i,a);c.isEmpty()||(t+=e.getValueOfRange(c)),t+=s.text,i=l}const r=Dbe(i,e.endPositionExclusive);return r.isEmpty()||(t+=e.getValueOfRange(r)),t}applyToString(e){const t=new $bt(e);return this.apply(t)}getNewRanges(){const e=[];let t=0,i=0,r=0;for(const s of this.edits){const o=_c.ofText(s.text),a=he.lift({lineNumber:s.range.startLineNumber+i,column:s.range.startColumn+(s.range.startLineNumber===t?r:0)}),l=o.createRange(a);e.push(l),i=l.endLineNumber-s.range.endLineNumber,r=l.endColumn-s.range.endColumn,t=s.range.endLineNumber}return e}};class Yp{constructor(e,t){this.range=e,this.text=t}toSingleEditOperation(){return{range:this.range,text:this.text}}}function Dbe(n,e){if(n.lineNumber===e.lineNumber&&n.column===Number.MAX_SAFE_INTEGER)return $.fromPositions(e,e);if(!n.isBeforeOrEqual(e))throw new fi("start must be before end");return new $(n.lineNumber,n.column,e.lineNumber,e.column)}class j3e{get endPositionExclusive(){return this.length.addToPosition(new he(1,1))}}class $bt extends j3e{constructor(e){super(),this.value=e,this._t=new Bbt(this.value)}getValueOfRange(e){return this._t.getOffsetRange(e).substring(this.value)}get length(){return this._t.textLength}}class gl{static inverse(e,t,i){const r=[];let s=1,o=1;for(const l of e){const c=new gl(new gn(s,l.original.startLineNumber),new gn(o,l.modified.startLineNumber));c.modified.isEmpty||r.push(c),s=l.original.endLineNumberExclusive,o=l.modified.endLineNumberExclusive}const a=new gl(new gn(s,t+1),new gn(o,i+1));return a.modified.isEmpty||r.push(a),r}static clip(e,t,i){const r=[];for(const s of e){const o=s.original.intersect(t),a=s.modified.intersect(i);o&&!o.isEmpty&&a&&!a.isEmpty&&r.push(new gl(o,a))}return r}constructor(e,t){this.original=e,this.modified=t}toString(){return`{${this.original.toString()}->${this.modified.toString()}}`}flip(){return new gl(this.modified,this.original)}join(e){return new gl(this.original.join(e.original),this.modified.join(e.modified))}toRangeMapping(){const e=this.original.toInclusiveRange(),t=this.modified.toInclusiveRange();if(e&&t)return new Mu(e,t);if(this.original.startLineNumber===1||this.modified.startLineNumber===1){if(!(this.modified.startLineNumber===1&&this.original.startLineNumber===1))throw new fi("not a valid diff");return new Mu(new $(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new $(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1))}else return new Mu(new $(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),new $(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER))}toRangeMapping2(e,t){if(Ibe(this.original.endLineNumberExclusive,e)&&Ibe(this.modified.endLineNumberExclusive,t))return new Mu(new $(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new $(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1));if(!this.original.isEmpty&&!this.modified.isEmpty)return new Mu($.fromPositions(new he(this.original.startLineNumber,1),fx(new he(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)),$.fromPositions(new he(this.modified.startLineNumber,1),fx(new he(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),t)));if(this.original.startLineNumber>1&&this.modified.startLineNumber>1)return new Mu($.fromPositions(fx(new he(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER),e),fx(new he(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)),$.fromPositions(fx(new he(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER),t),fx(new he(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),t)));throw new fi}}function fx(n,e){if(n.lineNumber<1)return new he(1,1);if(n.lineNumber>e.length)return new he(e.length,e[e.length-1].length+1);const t=e[n.lineNumber-1];return n.column>t.length+1?new he(n.lineNumber,t.length+1):n}function Ibe(n,e){return n>=1&&n<=e.length}class Ju extends gl{static fromRangeMappings(e){const t=gn.join(e.map(r=>gn.fromRangeInclusive(r.originalRange))),i=gn.join(e.map(r=>gn.fromRangeInclusive(r.modifiedRange)));return new Ju(t,i,e)}constructor(e,t,i){super(e,t),this.innerChanges=i}flip(){return new Ju(this.modified,this.original,this.innerChanges?.map(e=>e.flip()))}withInnerChangesFromLineRanges(){return new Ju(this.original,this.modified,[this.toRangeMapping()])}}class Mu{static assertSorted(e){for(let t=1;t${this.modifiedRange.toString()}}`}flip(){return new Mu(this.modifiedRange,this.originalRange)}toTextEdit(e){const t=e.getValueOfRange(this.modifiedRange);return new Yp(this.originalRange,t)}}const Wbt=3;class Hbt{computeDiff(e,t,i){const s=new Ubt(e,t,{maxComputationTime:i.maxComputationTimeMs,shouldIgnoreTrimWhitespace:i.ignoreTrimWhitespace,shouldComputeCharChanges:!0,shouldMakePrettyDiff:!0,shouldPostProcessCharChanges:!0}).computeDiff(),o=[];let a=null;for(const l of s.changes){let c;l.originalEndLineNumber===0?c=new gn(l.originalStartLineNumber+1,l.originalStartLineNumber+1):c=new gn(l.originalStartLineNumber,l.originalEndLineNumber+1);let u;l.modifiedEndLineNumber===0?u=new gn(l.modifiedStartLineNumber+1,l.modifiedStartLineNumber+1):u=new gn(l.modifiedStartLineNumber,l.modifiedEndLineNumber+1);let d=new Ju(c,u,l.charChanges?.map(h=>new Mu(new $(h.originalStartLineNumber,h.originalStartColumn,h.originalEndLineNumber,h.originalEndColumn),new $(h.modifiedStartLineNumber,h.modifiedStartColumn,h.modifiedEndLineNumber,h.modifiedEndColumn))));a&&(a.modified.endLineNumberExclusive===d.modified.startLineNumber||a.original.endLineNumberExclusive===d.original.startLineNumber)&&(d=new Ju(a.original.join(d.original),a.modified.join(d.modified),a.innerChanges&&d.innerChanges?a.innerChanges.concat(d.innerChanges):void 0),o.pop()),o.push(d),a=d}return Nw(()=>qae(o,(l,c)=>c.original.startLineNumber-l.original.endLineNumberExclusive===c.modified.startLineNumber-l.modified.endLineNumberExclusive&&l.original.endLineNumberExclusive(e===10?"\\n":String.fromCharCode(e))+`-(${this._lineNumbers[t]},${this._columns[t]})`).join(", ")+"]"}_assertIndex(e,t){if(e<0||e>=t.length)throw new Error("Illegal index")}getElements(){return this._charCodes}getStartLineNumber(e){return e>0&&e===this._lineNumbers.length?this.getEndLineNumber(e-1):(this._assertIndex(e,this._lineNumbers),this._lineNumbers[e])}getEndLineNumber(e){return e===-1?this.getStartLineNumber(e+1):(this._assertIndex(e,this._lineNumbers),this._charCodes[e]===10?this._lineNumbers[e]+1:this._lineNumbers[e])}getStartColumn(e){return e>0&&e===this._columns.length?this.getEndColumn(e-1):(this._assertIndex(e,this._columns),this._columns[e])}getEndColumn(e){return e===-1?this.getStartColumn(e+1):(this._assertIndex(e,this._columns),this._charCodes[e]===10?1:this._columns[e]+1)}}class dk{constructor(e,t,i,r,s,o,a,l){this.originalStartLineNumber=e,this.originalStartColumn=t,this.originalEndLineNumber=i,this.originalEndColumn=r,this.modifiedStartLineNumber=s,this.modifiedStartColumn=o,this.modifiedEndLineNumber=a,this.modifiedEndColumn=l}static createFromDiffChange(e,t,i){const r=t.getStartLineNumber(e.originalStart),s=t.getStartColumn(e.originalStart),o=t.getEndLineNumber(e.originalStart+e.originalLength-1),a=t.getEndColumn(e.originalStart+e.originalLength-1),l=i.getStartLineNumber(e.modifiedStart),c=i.getStartColumn(e.modifiedStart),u=i.getEndLineNumber(e.modifiedStart+e.modifiedLength-1),d=i.getEndColumn(e.modifiedStart+e.modifiedLength-1);return new dk(r,s,o,a,l,c,u,d)}}function zbt(n){if(n.length<=1)return n;const e=[n[0]];let t=e[0];for(let i=1,r=n.length;i0&&t.originalLength<20&&t.modifiedLength>0&&t.modifiedLength<20&&s()){const f=i.createCharSequence(e,t.originalStart,t.originalStart+t.originalLength-1),g=r.createCharSequence(e,t.modifiedStart,t.modifiedStart+t.modifiedLength-1);if(f.getElements().length>0&&g.getElements().length>0){let p=q3e(f,g,s,!0).changes;a&&(p=zbt(p)),h=[];for(let m=0,_=p.length;m<_;m++)h.push(dk.createFromDiffChange(p[m],f,g))}}return new _I(l,c,u,d,h)}}class Ubt{constructor(e,t,i){this.shouldComputeCharChanges=i.shouldComputeCharChanges,this.shouldPostProcessCharChanges=i.shouldPostProcessCharChanges,this.shouldIgnoreTrimWhitespace=i.shouldIgnoreTrimWhitespace,this.shouldMakePrettyDiff=i.shouldMakePrettyDiff,this.originalLines=e,this.modifiedLines=t,this.original=new Abe(e),this.modified=new Abe(t),this.continueLineDiff=Nbe(i.maxComputationTime),this.continueCharDiff=Nbe(i.maxComputationTime===0?0:Math.min(i.maxComputationTime,5e3))}computeDiff(){if(this.original.lines.length===1&&this.original.lines[0].length===0)return this.modified.lines.length===1&&this.modified.lines[0].length===0?{quitEarly:!1,changes:[]}:{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:1,modifiedStartLineNumber:1,modifiedEndLineNumber:this.modified.lines.length,charChanges:void 0}]};if(this.modified.lines.length===1&&this.modified.lines[0].length===0)return{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:this.original.lines.length,modifiedStartLineNumber:1,modifiedEndLineNumber:1,charChanges:void 0}]};const e=q3e(this.original,this.modified,this.continueLineDiff,this.shouldMakePrettyDiff),t=e.changes,i=e.quitEarly;if(this.shouldIgnoreTrimWhitespace){const a=[];for(let l=0,c=t.length;l1&&p>1;){const m=h.charCodeAt(g-2),_=f.charCodeAt(p-2);if(m!==_)break;g--,p--}(g>1||p>1)&&this._pushTrimWhitespaceCharChange(r,s+1,1,g,o+1,1,p)}{let g=IX(h,1),p=IX(f,1);const m=h.length+1,_=f.length+1;for(;g!0;const e=Date.now();return()=>Date.now()-e{i.push(wo.fromOffsetPairs(r?r.getEndExclusives():sg.zero,s?s.getStarts():new sg(t,(r?r.seq2Range.endExclusive-r.seq1Range.endExclusive:0)+t)))}),i}static fromOffsetPairs(e,t){return new wo(new Dn(e.offset1,t.offset1),new Dn(e.offset2,t.offset2))}static assertSorted(e){let t;for(const i of e){if(t&&!(t.seq1Range.endExclusive<=i.seq1Range.start&&t.seq2Range.endExclusive<=i.seq2Range.start))throw new fi("Sequence diffs must be sorted");t=i}}constructor(e,t){this.seq1Range=e,this.seq2Range=t}swap(){return new wo(this.seq2Range,this.seq1Range)}toString(){return`${this.seq1Range} <-> ${this.seq2Range}`}join(e){return new wo(this.seq1Range.join(e.seq1Range),this.seq2Range.join(e.seq2Range))}delta(e){return e===0?this:new wo(this.seq1Range.delta(e),this.seq2Range.delta(e))}deltaStart(e){return e===0?this:new wo(this.seq1Range.deltaStart(e),this.seq2Range.deltaStart(e))}deltaEnd(e){return e===0?this:new wo(this.seq1Range.deltaEnd(e),this.seq2Range.deltaEnd(e))}intersect(e){const t=this.seq1Range.intersect(e.seq1Range),i=this.seq2Range.intersect(e.seq2Range);if(!(!t||!i))return new wo(t,i)}getStarts(){return new sg(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new sg(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}}class sg{static{this.zero=new sg(0,0)}static{this.max=new sg(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}constructor(e,t){this.offset1=e,this.offset2=t}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(e){return e===0?this:new sg(this.offset1+e,this.offset2+e)}equals(e){return this.offset1===e.offset1&&this.offset2===e.offset2}}class QP{static{this.instance=new QP}isValid(){return!0}}class jbt{constructor(e){if(this.timeout=e,this.startTime=Date.now(),this.valid=!0,e<=0)throw new fi("timeout must be positive")}isValid(){if(!(Date.now()-this.startTimeqae(e,(t,i)=>t.range.getEndPosition().isBeforeOrEqual(i.range.getStartPosition())))}apply(e){let t="",i=new he(1,1);for(const s of this.edits){const o=s.range,a=o.getStartPosition(),l=o.getEndPosition(),c=Dbe(i,a);c.isEmpty()||(t+=e.getValueOfRange(c)),t+=s.text,i=l}const r=Dbe(i,e.endPositionExclusive);return r.isEmpty()||(t+=e.getValueOfRange(r)),t}applyToString(e){const t=new $bt(e);return this.apply(t)}getNewRanges(){const e=[];let t=0,i=0,r=0;for(const s of this.edits){const o=_c.ofText(s.text),a=he.lift({lineNumber:s.range.startLineNumber+i,column:s.range.startColumn+(s.range.startLineNumber===t?r:0)}),l=o.createRange(a);e.push(l),i=l.endLineNumber-s.range.endLineNumber,r=l.endColumn-s.range.endColumn,t=s.range.endLineNumber}return e}};class Yp{constructor(e,t){this.range=e,this.text=t}toSingleEditOperation(){return{range:this.range,text:this.text}}}function Dbe(n,e){if(n.lineNumber===e.lineNumber&&n.column===Number.MAX_SAFE_INTEGER)return $.fromPositions(e,e);if(!n.isBeforeOrEqual(e))throw new fi("start must be before end");return new $(n.lineNumber,n.column,e.lineNumber,e.column)}class j3e{get endPositionExclusive(){return this.length.addToPosition(new he(1,1))}}class $bt extends j3e{constructor(e){super(),this.value=e,this._t=new Bbt(this.value)}getValueOfRange(e){return this._t.getOffsetRange(e).substring(this.value)}get length(){return this._t.textLength}}class gl{static inverse(e,t,i){const r=[];let s=1,o=1;for(const l of e){const c=new gl(new gn(s,l.original.startLineNumber),new gn(o,l.modified.startLineNumber));c.modified.isEmpty||r.push(c),s=l.original.endLineNumberExclusive,o=l.modified.endLineNumberExclusive}const a=new gl(new gn(s,t+1),new gn(o,i+1));return a.modified.isEmpty||r.push(a),r}static clip(e,t,i){const r=[];for(const s of e){const o=s.original.intersect(t),a=s.modified.intersect(i);o&&!o.isEmpty&&a&&!a.isEmpty&&r.push(new gl(o,a))}return r}constructor(e,t){this.original=e,this.modified=t}toString(){return`{${this.original.toString()}->${this.modified.toString()}}`}flip(){return new gl(this.modified,this.original)}join(e){return new gl(this.original.join(e.original),this.modified.join(e.modified))}toRangeMapping(){const e=this.original.toInclusiveRange(),t=this.modified.toInclusiveRange();if(e&&t)return new Mu(e,t);if(this.original.startLineNumber===1||this.modified.startLineNumber===1){if(!(this.modified.startLineNumber===1&&this.original.startLineNumber===1))throw new fi("not a valid diff");return new Mu(new $(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new $(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1))}else return new Mu(new $(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),new $(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER))}toRangeMapping2(e,t){if(Ibe(this.original.endLineNumberExclusive,e)&&Ibe(this.modified.endLineNumberExclusive,t))return new Mu(new $(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new $(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1));if(!this.original.isEmpty&&!this.modified.isEmpty)return new Mu($.fromPositions(new he(this.original.startLineNumber,1),fx(new he(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)),$.fromPositions(new he(this.modified.startLineNumber,1),fx(new he(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),t)));if(this.original.startLineNumber>1&&this.modified.startLineNumber>1)return new Mu($.fromPositions(fx(new he(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER),e),fx(new he(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)),$.fromPositions(fx(new he(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER),t),fx(new he(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),t)));throw new fi}}function fx(n,e){if(n.lineNumber<1)return new he(1,1);if(n.lineNumber>e.length)return new he(e.length,e[e.length-1].length+1);const t=e[n.lineNumber-1];return n.column>t.length+1?new he(n.lineNumber,t.length+1):n}function Ibe(n,e){return n>=1&&n<=e.length}class Ju extends gl{static fromRangeMappings(e){const t=gn.join(e.map(r=>gn.fromRangeInclusive(r.originalRange))),i=gn.join(e.map(r=>gn.fromRangeInclusive(r.modifiedRange)));return new Ju(t,i,e)}constructor(e,t,i){super(e,t),this.innerChanges=i}flip(){return new Ju(this.modified,this.original,this.innerChanges?.map(e=>e.flip()))}withInnerChangesFromLineRanges(){return new Ju(this.original,this.modified,[this.toRangeMapping()])}}class Mu{static assertSorted(e){for(let t=1;t${this.modifiedRange.toString()}}`}flip(){return new Mu(this.modifiedRange,this.originalRange)}toTextEdit(e){const t=e.getValueOfRange(this.modifiedRange);return new Yp(this.originalRange,t)}}const Wbt=3;class Hbt{computeDiff(e,t,i){const s=new Ubt(e,t,{maxComputationTime:i.maxComputationTimeMs,shouldIgnoreTrimWhitespace:i.ignoreTrimWhitespace,shouldComputeCharChanges:!0,shouldMakePrettyDiff:!0,shouldPostProcessCharChanges:!0}).computeDiff(),o=[];let a=null;for(const l of s.changes){let c;l.originalEndLineNumber===0?c=new gn(l.originalStartLineNumber+1,l.originalStartLineNumber+1):c=new gn(l.originalStartLineNumber,l.originalEndLineNumber+1);let u;l.modifiedEndLineNumber===0?u=new gn(l.modifiedStartLineNumber+1,l.modifiedStartLineNumber+1):u=new gn(l.modifiedStartLineNumber,l.modifiedEndLineNumber+1);let d=new Ju(c,u,l.charChanges?.map(h=>new Mu(new $(h.originalStartLineNumber,h.originalStartColumn,h.originalEndLineNumber,h.originalEndColumn),new $(h.modifiedStartLineNumber,h.modifiedStartColumn,h.modifiedEndLineNumber,h.modifiedEndColumn))));a&&(a.modified.endLineNumberExclusive===d.modified.startLineNumber||a.original.endLineNumberExclusive===d.original.startLineNumber)&&(d=new Ju(a.original.join(d.original),a.modified.join(d.modified),a.innerChanges&&d.innerChanges?a.innerChanges.concat(d.innerChanges):void 0),o.pop()),o.push(d),a=d}return Nw(()=>qae(o,(l,c)=>c.original.startLineNumber-l.original.endLineNumberExclusive===c.modified.startLineNumber-l.modified.endLineNumberExclusive&&l.original.endLineNumberExclusive(e===10?"\\n":String.fromCharCode(e))+`-(${this._lineNumbers[t]},${this._columns[t]})`).join(", ")+"]"}_assertIndex(e,t){if(e<0||e>=t.length)throw new Error("Illegal index")}getElements(){return this._charCodes}getStartLineNumber(e){return e>0&&e===this._lineNumbers.length?this.getEndLineNumber(e-1):(this._assertIndex(e,this._lineNumbers),this._lineNumbers[e])}getEndLineNumber(e){return e===-1?this.getStartLineNumber(e+1):(this._assertIndex(e,this._lineNumbers),this._charCodes[e]===10?this._lineNumbers[e]+1:this._lineNumbers[e])}getStartColumn(e){return e>0&&e===this._columns.length?this.getEndColumn(e-1):(this._assertIndex(e,this._columns),this._columns[e])}getEndColumn(e){return e===-1?this.getStartColumn(e+1):(this._assertIndex(e,this._columns),this._charCodes[e]===10?1:this._columns[e]+1)}}class dk{constructor(e,t,i,r,s,o,a,l){this.originalStartLineNumber=e,this.originalStartColumn=t,this.originalEndLineNumber=i,this.originalEndColumn=r,this.modifiedStartLineNumber=s,this.modifiedStartColumn=o,this.modifiedEndLineNumber=a,this.modifiedEndColumn=l}static createFromDiffChange(e,t,i){const r=t.getStartLineNumber(e.originalStart),s=t.getStartColumn(e.originalStart),o=t.getEndLineNumber(e.originalStart+e.originalLength-1),a=t.getEndColumn(e.originalStart+e.originalLength-1),l=i.getStartLineNumber(e.modifiedStart),c=i.getStartColumn(e.modifiedStart),u=i.getEndLineNumber(e.modifiedStart+e.modifiedLength-1),d=i.getEndColumn(e.modifiedStart+e.modifiedLength-1);return new dk(r,s,o,a,l,c,u,d)}}function zbt(n){if(n.length<=1)return n;const e=[n[0]];let t=e[0];for(let i=1,r=n.length;i0&&t.originalLength<20&&t.modifiedLength>0&&t.modifiedLength<20&&s()){const f=i.createCharSequence(e,t.originalStart,t.originalStart+t.originalLength-1),g=r.createCharSequence(e,t.modifiedStart,t.modifiedStart+t.modifiedLength-1);if(f.getElements().length>0&&g.getElements().length>0){let p=q3e(f,g,s,!0).changes;a&&(p=zbt(p)),h=[];for(let m=0,_=p.length;m<_;m++)h.push(dk.createFromDiffChange(p[m],f,g))}}return new _I(l,c,u,d,h)}}class Ubt{constructor(e,t,i){this.shouldComputeCharChanges=i.shouldComputeCharChanges,this.shouldPostProcessCharChanges=i.shouldPostProcessCharChanges,this.shouldIgnoreTrimWhitespace=i.shouldIgnoreTrimWhitespace,this.shouldMakePrettyDiff=i.shouldMakePrettyDiff,this.originalLines=e,this.modifiedLines=t,this.original=new Abe(e),this.modified=new Abe(t),this.continueLineDiff=Nbe(i.maxComputationTime),this.continueCharDiff=Nbe(i.maxComputationTime===0?0:Math.min(i.maxComputationTime,5e3))}computeDiff(){if(this.original.lines.length===1&&this.original.lines[0].length===0)return this.modified.lines.length===1&&this.modified.lines[0].length===0?{quitEarly:!1,changes:[]}:{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:1,modifiedStartLineNumber:1,modifiedEndLineNumber:this.modified.lines.length,charChanges:void 0}]};if(this.modified.lines.length===1&&this.modified.lines[0].length===0)return{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:this.original.lines.length,modifiedStartLineNumber:1,modifiedEndLineNumber:1,charChanges:void 0}]};const e=q3e(this.original,this.modified,this.continueLineDiff,this.shouldMakePrettyDiff),t=e.changes,i=e.quitEarly;if(this.shouldIgnoreTrimWhitespace){const a=[];for(let l=0,c=t.length;l1&&p>1;){const m=h.charCodeAt(g-2),_=f.charCodeAt(p-2);if(m!==_)break;g--,p--}(g>1||p>1)&&this._pushTrimWhitespaceCharChange(r,s+1,1,g,o+1,1,p)}{let g=IX(h,1),p=IX(f,1);const m=h.length+1,_=f.length+1;for(;g!0;const e=Date.now();return()=>Date.now()-e{i.push(wo.fromOffsetPairs(r?r.getEndExclusives():sg.zero,s?s.getStarts():new sg(t,(r?r.seq2Range.endExclusive-r.seq1Range.endExclusive:0)+t)))}),i}static fromOffsetPairs(e,t){return new wo(new Dn(e.offset1,t.offset1),new Dn(e.offset2,t.offset2))}static assertSorted(e){let t;for(const i of e){if(t&&!(t.seq1Range.endExclusive<=i.seq1Range.start&&t.seq2Range.endExclusive<=i.seq2Range.start))throw new fi("Sequence diffs must be sorted");t=i}}constructor(e,t){this.seq1Range=e,this.seq2Range=t}swap(){return new wo(this.seq2Range,this.seq1Range)}toString(){return`${this.seq1Range} <-> ${this.seq2Range}`}join(e){return new wo(this.seq1Range.join(e.seq1Range),this.seq2Range.join(e.seq2Range))}delta(e){return e===0?this:new wo(this.seq1Range.delta(e),this.seq2Range.delta(e))}deltaStart(e){return e===0?this:new wo(this.seq1Range.deltaStart(e),this.seq2Range.deltaStart(e))}deltaEnd(e){return e===0?this:new wo(this.seq1Range.deltaEnd(e),this.seq2Range.deltaEnd(e))}intersect(e){const t=this.seq1Range.intersect(e.seq1Range),i=this.seq2Range.intersect(e.seq2Range);if(!(!t||!i))return new wo(t,i)}getStarts(){return new sg(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new sg(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}}class sg{static{this.zero=new sg(0,0)}static{this.max=new sg(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}constructor(e,t){this.offset1=e,this.offset2=t}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(e){return e===0?this:new sg(this.offset1+e,this.offset2+e)}equals(e){return this.offset1===e.offset1&&this.offset2===e.offset2}}class QP{static{this.instance=new QP}isValid(){return!0}}class jbt{constructor(e){if(this.timeout=e,this.startTime=Date.now(),this.valid=!0,e<=0)throw new fi("timeout must be positive")}isValid(){if(!(Date.now()-this.startTime0&&p>0&&o.get(g-1,p-1)===3&&(v+=a.get(g-1,p-1)),v+=r?r(g,p):1):v=-1;const y=Math.max(m,_,v);if(y===v){const C=g>0&&p>0?a.get(g-1,p-1):0;a.set(g,p,C+1),o.set(g,p,3)}else y===m?(a.set(g,p,0),o.set(g,p,1)):y===_&&(a.set(g,p,0),o.set(g,p,2));s.set(g,p,y)}const l=[];let c=e.length,u=t.length;function d(g,p){(g+1!==c||p+1!==u)&&l.push(new wo(new Dn(g+1,c),new Dn(p+1,u))),c=g,u=p}let h=e.length-1,f=t.length-1;for(;h>=0&&f>=0;)o.get(h,f)===3?(d(h,f),h--,f--):o.get(h,f)===1?h--:f--;return d(-1,-1),l.reverse(),new N_(l,!1)}}class K3e{compute(e,t,i=QP.instance){if(e.length===0||t.length===0)return N_.trivial(e,t);const r=e,s=t;function o(p,m){for(;pr.length||C>s.length)continue;const x=o(y,C);l.set(u,x);const k=y===_?c.get(u+1):c.get(u-1);if(c.set(u,x!==y?new Rbe(k,y,C,x-y):k),l.get(u)===r.length&&l.get(u)-u===s.length)break e}}let d=c.get(u);const h=[];let f=r.length,g=s.length;for(;;){const p=d?d.x+d.length:0,m=d?d.y+d.length:0;if((p!==f||m!==g)&&h.push(new wo(new Dn(p,f),new Dn(m,g))),!d)break;f=d.x,g=d.y,d=d.prev}return h.reverse(),new N_(h,!1)}}class Rbe{constructor(e,t,i,r){this.prev=e,this.x=t,this.y=i,this.length=r}}class Kbt{constructor(){this.positiveArr=new Int32Array(10),this.negativeArr=new Int32Array(10)}get(e){return e<0?(e=-e-1,this.negativeArr[e]):this.positiveArr[e]}set(e,t){if(e<0){if(e=-e-1,e>=this.negativeArr.length){const i=this.negativeArr;this.negativeArr=new Int32Array(i.length*2),this.negativeArr.set(i)}this.negativeArr[e]=t}else{if(e>=this.positiveArr.length){const i=this.positiveArr;this.positiveArr=new Int32Array(i.length*2),this.positiveArr.set(i)}this.positiveArr[e]=t}}}class Gbt{constructor(){this.positiveArr=[],this.negativeArr=[]}get(e){return e<0?(e=-e-1,this.negativeArr[e]):this.positiveArr[e]}set(e,t){e<0?(e=-e-1,this.negativeArr[e]=t):this.positiveArr[e]=t}}class s8{constructor(e,t,i){this.lines=e,this.range=t,this.considerWhitespaceChanges=i,this.elements=[],this.firstElementOffsetByLineIdx=[],this.lineStartOffsets=[],this.trimmedWsLengthsByLineIdx=[],this.firstElementOffsetByLineIdx.push(0);for(let r=this.range.startLineNumber;r<=this.range.endLineNumber;r++){let s=e[r-1],o=0;r===this.range.startLineNumber&&this.range.startColumn>1&&(o=this.range.startColumn-1,s=s.substring(o)),this.lineStartOffsets.push(o);let a=0;if(!i){const c=s.trimStart();a=s.length-c.length,s=c.trimEnd()}this.trimmedWsLengthsByLineIdx.push(a);const l=r===this.range.endLineNumber?Math.min(this.range.endColumn-1-o-a,s.length):s.length;for(let c=0;cString.fromCharCode(t)).join("")}getElement(e){return this.elements[e]}get length(){return this.elements.length}getBoundaryScore(e){const t=Obe(e>0?this.elements[e-1]:-1),i=Obe(es<=e),r=e-this.firstElementOffsetByLineIdx[i];return new he(this.range.startLineNumber+i,1+this.lineStartOffsets[i]+r+(r===0&&t==="left"?0:this.trimmedWsLengthsByLineIdx[i]))}translateRange(e){const t=this.translateOffset(e.start,"right"),i=this.translateOffset(e.endExclusive,"left");return i.isBefore(t)?$.fromPositions(i,i):$.fromPositions(t,i)}findWordContaining(e){if(e<0||e>=this.elements.length||!$j(this.elements[e]))return;let t=e;for(;t>0&&$j(this.elements[t-1]);)t--;let i=e;for(;ir<=e.start)??0,i=Rbt(this.firstElementOffsetByLineIdx,r=>e.endExclusive<=r)??this.elements.length;return new Dn(t,i)}}function $j(n){return n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57}const Ybt={0:0,1:0,2:0,3:10,4:2,5:30,6:3,7:10,8:10};function Pbe(n){return Ybt[n]}function Obe(n){return n===10?8:n===13?7:AX(n)?6:n>=97&&n<=122?0:n>=65&&n<=90?1:n>=48&&n<=57?2:n===-1?3:n===44||n===59?5:4}function Zbt(n,e,t,i,r,s){let{moves:o,excludedChanges:a}=Qbt(n,e,t,s);if(!s.isValid())return[];const l=n.filter(u=>!a.has(u)),c=Jbt(l,i,r,e,t,s);return sZ(o,c),o=e1t(o),o=o.filter(u=>{const d=u.original.toOffsetRange().slice(e).map(f=>f.trim());return d.join(` `).length>=15&&Xbt(d,f=>f.length>=2)>=2}),o=t1t(n,o),o}function Xbt(n,e){let t=0;for(const i of n)e(i)&&t++;return t}function Qbt(n,e,t,i){const r=[],s=n.filter(l=>l.modified.isEmpty&&l.original.length>=3).map(l=>new pN(l.original,e,l)),o=new Set(n.filter(l=>l.original.isEmpty&&l.modified.length>=3).map(l=>new pN(l.modified,t,l))),a=new Set;for(const l of s){let c=-1,u;for(const d of o){const h=l.computeSimilarity(d);h>c&&(c=h,u=d)}if(c>.9&&u&&(o.delete(u),r.push(new gl(l.range,u.range)),a.add(l.source),a.add(u.source)),!i.isValid())return{moves:r,excludedChanges:a}}return{moves:r,excludedChanges:a}}function Jbt(n,e,t,i,r,s){const o=[],a=new Xae;for(const h of n)for(let f=h.original.startLineNumber;fh.modified.startLineNumber,Xh));for(const h of n){let f=[];for(let g=h.modified.startLineNumber;g{for(const C of f)if(C.originalLineRange.endLineNumberExclusive+1===v.endLineNumberExclusive&&C.modifiedLineRange.endLineNumberExclusive+1===m.endLineNumberExclusive){C.originalLineRange=new gn(C.originalLineRange.startLineNumber,v.endLineNumberExclusive),C.modifiedLineRange=new gn(C.modifiedLineRange.startLineNumber,m.endLineNumberExclusive),_.push(C);return}const y={modifiedLineRange:m,originalLineRange:v};l.push(y),_.push(y)}),f=_}if(!s.isValid())return[]}l.sort(a4e($l(h=>h.modifiedLineRange.length,Xh)));const c=new Md,u=new Md;for(const h of l){const f=h.modifiedLineRange.startLineNumber-h.originalLineRange.startLineNumber,g=c.subtractFrom(h.modifiedLineRange),p=u.subtractFrom(h.originalLineRange).getWithDelta(f),m=g.getIntersection(p);for(const _ of m.ranges){if(_.length<3)continue;const v=_,y=_.delta(-f);o.push(new gl(y,v)),c.addRange(v),u.addRange(y)}}o.sort($l(h=>h.original.startLineNumber,Xh));const d=new tW(n);for(let h=0;hk.original.startLineNumber<=f.original.startLineNumber),p=oE(n,k=>k.modified.startLineNumber<=f.modified.startLineNumber),m=Math.max(f.original.startLineNumber-g.original.startLineNumber,f.modified.startLineNumber-p.modified.startLineNumber),_=d.findLastMonotonous(k=>k.original.startLineNumberk.modified.startLineNumberi.length||L>r.length||c.contains(L)||u.contains(k)||!Mbe(i[k-1],r[L-1],s))break}C>0&&(u.addRange(new gn(f.original.startLineNumber-C,f.original.startLineNumber)),c.addRange(new gn(f.modified.startLineNumber-C,f.modified.startLineNumber)));let x;for(x=0;xi.length||L>r.length||c.contains(L)||u.contains(k)||!Mbe(i[k-1],r[L-1],s))break}x>0&&(u.addRange(new gn(f.original.endLineNumberExclusive,f.original.endLineNumberExclusive+x)),c.addRange(new gn(f.modified.endLineNumberExclusive,f.modified.endLineNumberExclusive+x))),(C>0||x>0)&&(o[h]=new gl(new gn(f.original.startLineNumber-C,f.original.endLineNumberExclusive+x),new gn(f.modified.startLineNumber-C,f.modified.endLineNumberExclusive+x)))}return o}function Mbe(n,e,t){if(n.trim()===e.trim())return!0;if(n.length>300&&e.length>300)return!1;const r=new K3e().compute(new s8([n],new $(1,1,1,n.length),!1),new s8([e],new $(1,1,1,e.length),!1),t);let s=0;const o=wo.invert(r.diffs,n.length);for(const u of o)u.seq1Range.forEach(d=>{AX(n.charCodeAt(d))||s++});function a(u){let d=0;for(let h=0;he.length?n:e);return s/l>.6&&l>10}function e1t(n){if(n.length===0)return n;n.sort($l(t=>t.original.startLineNumber,Xh));const e=[n[0]];for(let t=1;t=0&&o>=0&&s+o<=2){e[e.length-1]=i.join(r);continue}e.push(r)}return e}function t1t(n,e){const t=new tW(n);return e=e.filter(i=>{const r=t.findLastMonotonous(a=>a.original.startLineNumbera.modified.startLineNumber0&&(a=a.delta(c))}r.push(a)}return i.length>0&&r.push(i[i.length-1]),r}function n1t(n,e,t){if(!n.getBoundaryScore||!e.getBoundaryScore)return t;for(let i=0;i0?t[i-1]:void 0,s=t[i],o=i+1=i.start&&n.seq2Range.start-o>=r.start&&t.isStronglyEqual(n.seq2Range.start-o,n.seq2Range.endExclusive-o)&&o<100;)o++;o--;let a=0;for(;n.seq1Range.start+ac&&(c=g,l=u)}return n.delta(l)}function i1t(n,e,t){const i=[];for(const r of t){const s=i[i.length-1];if(!s){i.push(r);continue}r.seq1Range.start-s.seq1Range.endExclusive<=2||r.seq2Range.start-s.seq2Range.endExclusive<=2?i[i.length-1]=new wo(s.seq1Range.join(r.seq1Range),s.seq2Range.join(r.seq2Range)):i.push(r)}return i}function r1t(n,e,t){const i=wo.invert(t,n.length),r=[];let s=new sg(0,0);function o(l,c){if(l.offset10;){const m=i[0];if(!(m.seq1Range.intersects(h.seq1Range)||m.seq2Range.intersects(h.seq2Range)))break;const v=n.findWordContaining(m.seq1Range.start),y=e.findWordContaining(m.seq2Range.start),C=new wo(v,y),x=C.intersect(m);if(g+=x.seq1Range.length,p+=x.seq2Range.length,h=h.join(C),h.seq1Range.endExclusive>=m.seq1Range.endExclusive)i.shift();else break}g+p<(h.seq1Range.length+h.seq2Range.length)*2/3&&r.push(h),s=h.getEndExclusives()}for(;i.length>0;){const l=i.shift();l.seq1Range.isEmpty||(o(l.getStarts(),l),o(l.getEndExclusives().delta(-1),l))}return s1t(t,r)}function s1t(n,e){const t=[];for(;n.length>0||e.length>0;){const i=n[0],r=e[0];let s;i&&(!r||i.seq1Range.start0&&t[t.length-1].seq1Range.endExclusive>=s.seq1Range.start?t[t.length-1]=t[t.length-1].join(s):t.push(s)}return t}function o1t(n,e,t){let i=t;if(i.length===0)return i;let r=0,s;do{s=!1;const o=[i[0]];for(let a=1;a5||f.seq1Range.length+f.seq2Range.length>5)};const l=i[a],c=o[o.length-1];u(c,l)?(s=!0,o[o.length-1]=o[o.length-1].join(l)):o.push(l)}i=o}while(r++<10&&s);return i}function a1t(n,e,t){let i=t;if(i.length===0)return i;let r=0,s;do{s=!1;const a=[i[0]];for(let l=1;l5||p.length>500)return!1;const _=n.getText(p).trim();if(_.length>20||_.split(/\r\n|\r|\n/).length>1)return!1;const v=n.countLinesIn(f.seq1Range),y=f.seq1Range.length,C=e.countLinesIn(f.seq2Range),x=f.seq2Range.length,k=n.countLinesIn(g.seq1Range),L=g.seq1Range.length,D=e.countLinesIn(g.seq2Range),I=g.seq2Range.length,O=2*40+50;function M(B){return Math.min(B,O)}return Math.pow(Math.pow(M(v*40+y),1.5)+Math.pow(M(C*40+x),1.5),1.5)+Math.pow(Math.pow(M(k*40+L),1.5)+Math.pow(M(D*40+I),1.5),1.5)>(O**1.5)**1.5*1.3};const c=i[l],u=a[a.length-1];d(u,c)?(s=!0,a[a.length-1]=a[a.length-1].join(c)):a.push(c)}i=a}while(r++<10&&s);const o=[];return Qgt(i,(a,l,c)=>{let u=l;function d(_){return _.length>0&&_.trim().length<=3&&l.seq1Range.length+l.seq2Range.length>100}const h=n.extendToFullLines(l.seq1Range),f=n.getText(new Dn(h.start,l.seq1Range.start));d(f)&&(u=u.deltaStart(-f.length));const g=n.getText(new Dn(l.seq1Range.endExclusive,h.endExclusive));d(g)&&(u=u.deltaEnd(g.length));const p=wo.fromOffsetPairs(a?a.getEndExclusives():sg.zero,c?c.getStarts():sg.max),m=u.intersect(p);o.length>0&&m.getStarts().equals(o[o.length-1].getEndExclusives())?o[o.length-1]=o[o.length-1].join(m):o.push(m)}),o}class $be{constructor(e,t){this.trimmedHash=e,this.lines=t}getElement(e){return this.trimmedHash[e]}get length(){return this.trimmedHash.length}getBoundaryScore(e){const t=e===0?0:Wbe(this.lines[e-1]),i=e===this.lines.length?0:Wbe(this.lines[e]);return 1e3-(t+i)}getText(e){return this.lines.slice(e.start,e.endExclusive).join(` -`)}isStronglyEqual(e,t){return this.lines[e]===this.lines[t]}}function Wbe(n){let e=0;for(;ex===k))return new jF([],[],!1);if(e.length===1&&e[0].length===0||t.length===1&&t[0].length===0)return new jF([new Ju(new gn(1,e.length+1),new gn(1,t.length+1),[new Mu(new $(1,1,e.length,e[e.length-1].length+1),new $(1,1,t.length,t[t.length-1].length+1))])],[],!1);const r=i.maxComputationTimeMs===0?QP.instance:new jbt(i.maxComputationTimeMs),s=!i.ignoreTrimWhitespace,o=new Map;function a(x){let k=o.get(x);return k===void 0&&(k=o.size,o.set(x,k)),k}const l=e.map(x=>a(x.trim())),c=t.map(x=>a(x.trim())),u=new $be(l,e),d=new $be(c,t),h=u.length+d.length<1700?this.dynamicProgrammingDiffing.compute(u,d,r,(x,k)=>e[x]===t[k]?t[k].length===0?.1:1+Math.log(1+t[k].length):.99):this.myersDiffingAlgorithm.compute(u,d,r);let f=h.diffs,g=h.hitTimeout;f=NX(u,d,f),f=o1t(u,d,f);const p=[],m=x=>{if(s)for(let k=0;kx.seq1Range.start-_===x.seq2Range.start-v);const k=x.seq1Range.start-_;m(k),_=x.seq1Range.endExclusive,v=x.seq2Range.endExclusive;const L=this.refineDiff(e,t,x,r,s);L.hitTimeout&&(g=!0);for(const D of L.mappings)p.push(D)}m(e.length-_);const y=Hbe(p,e,t);let C=[];return i.computeMoves&&(C=this.computeMoves(y,e,t,l,c,r,s)),Nw(()=>{function x(L,D){if(L.lineNumber<1||L.lineNumber>D.length)return!1;const I=D[L.lineNumber-1];return!(L.column<1||L.column>I.length+1)}function k(L,D){return!(L.startLineNumber<1||L.startLineNumber>D.length+1||L.endLineNumberExclusive<1||L.endLineNumberExclusive>D.length+1)}for(const L of y){if(!L.innerChanges)return!1;for(const D of L.innerChanges)if(!(x(D.modifiedRange.getStartPosition(),t)&&x(D.modifiedRange.getEndPosition(),t)&&x(D.originalRange.getStartPosition(),e)&&x(D.originalRange.getEndPosition(),e)))return!1;if(!k(L.modified,t)||!k(L.original,e))return!1}return!0}),new jF(y,C,g)}computeMoves(e,t,i,r,s,o,a){return Zbt(e,t,i,r,s,o).map(u=>{const d=this.refineDiff(t,i,new wo(u.original.toOffsetRange(),u.modified.toOffsetRange()),o,a),h=Hbe(d.mappings,t,i,!0);return new U3e(u,h)})}refineDiff(e,t,i,r,s){const a=c1t(i).toRangeMapping2(e,t),l=new s8(e,a.originalRange,s),c=new s8(t,a.modifiedRange,s),u=l.length+c.length<500?this.dynamicProgrammingDiffing.compute(l,c,r):this.myersDiffingAlgorithm.compute(l,c,r);let d=u.diffs;return d=NX(l,c,d),d=r1t(l,c,d),d=i1t(l,c,d),d=a1t(l,c,d),{mappings:d.map(f=>new Mu(l.translateRange(f.seq1Range),c.translateRange(f.seq2Range))),hitTimeout:u.hitTimeout}}}function Hbe(n,e,t,i=!1){const r=[];for(const s of dae(n.map(o=>l1t(o,e,t)),(o,a)=>o.original.overlapOrTouch(a.original)||o.modified.overlapOrTouch(a.modified))){const o=s[0],a=s[s.length-1];r.push(new Ju(o.original.join(a.original),o.modified.join(a.modified),s.map(l=>l.innerChanges[0])))}return Nw(()=>!i&&r.length>0&&(r[0].modified.startLineNumber!==r[0].original.startLineNumber||t.length-r[r.length-1].modified.endLineNumberExclusive!==e.length-r[r.length-1].original.endLineNumberExclusive)?!1:qae(r,(s,o)=>o.original.startLineNumber-s.original.endLineNumberExclusive===o.modified.startLineNumber-s.modified.endLineNumberExclusive&&s.original.endLineNumberExclusive=t[n.modifiedRange.startLineNumber-1].length&&n.originalRange.startColumn-1>=e[n.originalRange.startLineNumber-1].length&&n.originalRange.startLineNumber<=n.originalRange.endLineNumber+r&&n.modifiedRange.startLineNumber<=n.modifiedRange.endLineNumber+r&&(i=1);const s=new gn(n.originalRange.startLineNumber+i,n.originalRange.endLineNumber+1+r),o=new gn(n.modifiedRange.startLineNumber+i,n.modifiedRange.endLineNumber+1+r);return new Ju(s,o,[n])}function c1t(n){return new gl(new gn(n.seq1Range.start+1,n.seq1Range.endExclusive+1),new gn(n.seq2Range.start+1,n.seq2Range.endExclusive+1))}const Vbe={getLegacy:()=>new Hbt,getDefault:()=>new G3e};function sb(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}class Jn{constructor(e,t,i,r=1){this._rgbaBrand=void 0,this.r=Math.min(255,Math.max(0,e))|0,this.g=Math.min(255,Math.max(0,t))|0,this.b=Math.min(255,Math.max(0,i))|0,this.a=sb(Math.max(Math.min(1,r),0),3)}static equals(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}}class Bh{constructor(e,t,i,r){this._hslaBrand=void 0,this.h=Math.max(Math.min(360,e),0)|0,this.s=sb(Math.max(Math.min(1,t),0),3),this.l=sb(Math.max(Math.min(1,i),0),3),this.a=sb(Math.max(Math.min(1,r),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.l===t.l&&e.a===t.a}static fromRGBA(e){const t=e.r/255,i=e.g/255,r=e.b/255,s=e.a,o=Math.max(t,i,r),a=Math.min(t,i,r);let l=0,c=0;const u=(a+o)/2,d=o-a;if(d>0){switch(c=Math.min(u<=.5?d/(2*u):d/(2-2*u),1),o){case t:l=(i-r)/d+(i1&&(i-=1),i<1/6?e+(t-e)*6*i:i<1/2?t:i<2/3?e+(t-e)*(2/3-i)*6:e}static toRGBA(e){const t=e.h/360,{s:i,l:r,a:s}=e;let o,a,l;if(i===0)o=a=l=r;else{const c=r<.5?r*(1+i):r+i-r*i,u=2*r-c;o=Bh._hue2rgb(u,c,t+1/3),a=Bh._hue2rgb(u,c,t),l=Bh._hue2rgb(u,c,t-1/3)}return new Jn(Math.round(o*255),Math.round(a*255),Math.round(l*255),s)}}class Lp{constructor(e,t,i,r){this._hsvaBrand=void 0,this.h=Math.max(Math.min(360,e),0)|0,this.s=sb(Math.max(Math.min(1,t),0),3),this.v=sb(Math.max(Math.min(1,i),0),3),this.a=sb(Math.max(Math.min(1,r),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.v===t.v&&e.a===t.a}static fromRGBA(e){const t=e.r/255,i=e.g/255,r=e.b/255,s=Math.max(t,i,r),o=Math.min(t,i,r),a=s-o,l=s===0?0:a/s;let c;return a===0?c=0:s===t?c=((i-r)/a%6+6)%6:s===i?c=(r-t)/a+2:c=(t-i)/a+4,new Lp(Math.round(c*60),l,s,e.a)}static toRGBA(e){const{h:t,s:i,v:r,a:s}=e,o=r*i,a=o*(1-Math.abs(t/60%2-1)),l=r-o;let[c,u,d]=[0,0,0];return t<60?(c=o,u=a):t<120?(c=a,u=o):t<180?(u=o,d=a):t<240?(u=a,d=o):t<300?(c=a,d=o):t<=360&&(c=o,d=a),c=Math.round((c+l)*255),u=Math.round((u+l)*255),d=Math.round((d+l)*255),new Jn(c,u,d,s)}}let Te=class aa{static fromHex(e){return aa.Format.CSS.parseHex(e)||aa.red}static equals(e,t){return!e&&!t?!0:!e||!t?!1:e.equals(t)}get hsla(){return this._hsla?this._hsla:Bh.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:Lp.fromRGBA(this.rgba)}constructor(e){if(e)if(e instanceof Jn)this.rgba=e;else if(e instanceof Bh)this._hsla=e,this.rgba=Bh.toRGBA(e);else if(e instanceof Lp)this._hsva=e,this.rgba=Lp.toRGBA(e);else throw new Error("Invalid color ctor argument");else throw new Error("Color needs a value")}equals(e){return!!e&&Jn.equals(this.rgba,e.rgba)&&Bh.equals(this.hsla,e.hsla)&&Lp.equals(this.hsva,e.hsva)}getRelativeLuminance(){const e=aa._relativeLuminanceForComponent(this.rgba.r),t=aa._relativeLuminanceForComponent(this.rgba.g),i=aa._relativeLuminanceForComponent(this.rgba.b),r=.2126*e+.7152*t+.0722*i;return sb(r,4)}static _relativeLuminanceForComponent(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}isLighter(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3>=128}isLighterThan(e){const t=this.getRelativeLuminance(),i=e.getRelativeLuminance();return t>i}isDarkerThan(e){const t=this.getRelativeLuminance(),i=e.getRelativeLuminance();return t0)for(const r of i){const s=r.filter(c=>c!==void 0),o=s[1],a=s[2];if(!a)continue;let l;if(o==="rgb"){const c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*\)$/gm;l=zbe(DT(n,r),IT(a,c),!1)}else if(o==="rgba"){const c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\s*\)$/gm;l=zbe(DT(n,r),IT(a,c),!0)}else if(o==="hsl"){const c=/^\(\s*(36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*\)$/gm;l=Ube(DT(n,r),IT(a,c),!1)}else if(o==="hsla"){const c=/^\(\s*(36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*,\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\s*\)$/gm;l=Ube(DT(n,r),IT(a,c),!0)}else o==="#"&&(l=u1t(DT(n,r),o+a));l&&e.push(l)}return e}function h1t(n){return!n||typeof n.getValue!="function"||typeof n.positionAt!="function"?[]:d1t(n)}const jbe=new RegExp("\\bMARK:\\s*(.*)$","d"),f1t=/^-+|-+$/g;function g1t(n,e){let t=[];if(e.findRegionSectionHeaders&&e.foldingRules?.markers){const i=p1t(n,e);t=t.concat(i)}if(e.findMarkSectionHeaders){const i=m1t(n);t=t.concat(i)}return t}function p1t(n,e){const t=[],i=n.getLineCount();for(let r=1;r<=i;r++){const s=n.getLineContent(r),o=s.match(e.foldingRules.markers.start);if(o){const a={startLineNumber:r,startColumn:o[0].length+1,endLineNumber:r,endColumn:s.length+1};if(a.endColumn>a.startColumn){const l={range:a,...Z3e(s.substring(o[0].length)),shouldBeInComments:!1};(l.text||l.hasSeparatorLine)&&t.push(l)}}}return t}function m1t(n){const e=[],t=n.getLineCount();for(let i=1;i<=t;i++){const r=n.getLineContent(i);_1t(r,i,e)}return e}function _1t(n,e,t){jbe.lastIndex=0;const i=jbe.exec(n);if(i){const r=i.indices[1][0]+1,s=i.indices[1][1]+1,o={startLineNumber:e,startColumn:r,endLineNumber:e,endColumn:s};if(o.endColumn>o.startColumn){const a={range:o,...Z3e(i[1]),shouldBeInComments:!0};(a.text||a.hasSeparatorLine)&&t.push(a)}}}function Z3e(n){n=n.trim();const e=n.startsWith("-");return n=n.replace(f1t,""),{text:n,hasSeparatorLine:e}}class v1t{constructor(e){this.values=e,this.prefixSum=new Uint32Array(e.length),this.prefixSumValidIndex=new Int32Array(1),this.prefixSumValidIndex[0]=-1}insertValues(e,t){e=hx(e);const i=this.values,r=this.prefixSum,s=t.length;return s===0?!1:(this.values=new Uint32Array(i.length+s),this.values.set(i.subarray(0,e),0),this.values.set(i.subarray(e),e+s),this.values.set(t,e),e-1=0&&this.prefixSum.set(r.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}setValue(e,t){return e=hx(e),t=hx(t),this.values[e]===t?!1:(this.values[e]=t,e-1=i.length)return!1;const s=i.length-e;return t>=s&&(t=s),t===0?!1:(this.values=new Uint32Array(i.length-t),this.values.set(i.subarray(0,e),0),this.values.set(i.subarray(e+t),e),this.prefixSum=new Uint32Array(this.values.length),e-1=0&&this.prefixSum.set(r.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}getTotalSum(){return this.values.length===0?0:this._getPrefixSum(this.values.length-1)}getPrefixSum(e){return e<0?0:(e=hx(e),this._getPrefixSum(e))}_getPrefixSum(e){if(e<=this.prefixSumValidIndex[0])return this.prefixSum[e];let t=this.prefixSumValidIndex[0]+1;t===0&&(this.prefixSum[0]=this.values[0],t++),e>=this.values.length&&(e=this.values.length-1);for(let i=t;i<=e;i++)this.prefixSum[i]=this.prefixSum[i-1]+this.values[i];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],e),this.prefixSum[e]}getIndexOf(e){e=Math.floor(e),this.getTotalSum();let t=0,i=this.values.length-1,r=0,s=0,o=0;for(;t<=i;)if(r=t+(i-t)/2|0,s=this.prefixSum[r],o=s-this.values[r],e=s)t=r+1;else break;return new X3e(r,e-o)}}class b1t{constructor(e){this._values=e,this._isValid=!1,this._validEndIndex=-1,this._prefixSum=[],this._indexBySum=[]}getTotalSum(){return this._ensureValid(),this._indexBySum.length}getPrefixSum(e){return this._ensureValid(),e===0?0:this._prefixSum[e-1]}getIndexOf(e){this._ensureValid();const t=this._indexBySum[e],i=t>0?this._prefixSum[t-1]:0;return new X3e(t,e-i)}removeValues(e,t){this._values.splice(e,t),this._invalidate(e)}insertValues(e,t){this._values=I$(this._values,e,t),this._invalidate(e)}_invalidate(e){this._isValid=!1,this._validEndIndex=Math.min(this._validEndIndex,e-1)}_ensureValid(){if(!this._isValid){for(let e=this._validEndIndex+1,t=this._values.length;e0?this._prefixSum[e-1]:0;this._prefixSum[e]=r+i;for(let s=0;sthis._checkStopModelSync(),Math.round(qbe/2)),this._register(r)}}dispose(){for(const e in this._syncedModels)er(this._syncedModels[e]);this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),super.dispose()}ensureSyncedResources(e,t=!1){for(const i of e){const r=i.toString();this._syncedModels[r]||this._beginModelSync(i,t),this._syncedModels[r]&&(this._syncedModelsLastUsedTime[r]=new Date().getTime())}}_checkStopModelSync(){const e=new Date().getTime(),t=[];for(const i in this._syncedModelsLastUsedTime)e-this._syncedModelsLastUsedTime[i]>qbe&&t.push(i);for(const i of t)this._stopModelSync(i)}_beginModelSync(e,t){const i=this._modelService.getModel(e);if(!i||!t&&i.isTooLargeForSyncing())return;const r=e.toString();this._proxy.$acceptNewModel({url:i.uri.toString(),lines:i.getLinesContent(),EOL:i.getEOL(),versionId:i.getVersionId()});const s=new ke;s.add(i.onDidChangeContent(o=>{this._proxy.$acceptModelChanged(r.toString(),o)})),s.add(i.onWillDispose(()=>{this._stopModelSync(r)})),s.add(Lt(()=>{this._proxy.$acceptRemovedModel(r)})),this._syncedModels[r]=s}_stopModelSync(e){const t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],er(t)}}class C1t{constructor(){this._models=Object.create(null)}getModel(e){return this._models[e]}getModels(){const e=[];return Object.keys(this._models).forEach(t=>e.push(this._models[t])),e}$acceptNewModel(e){this._models[e.url]=new x1t(Pt.parse(e.url),e.lines,e.EOL,e.versionId)}$acceptModelChanged(e,t){if(!this._models[e])return;this._models[e].onEvents(t)}$acceptRemovedModel(e){this._models[e]&&delete this._models[e]}}class x1t extends y1t{get uri(){return this._uri}get eol(){return this._eol}getValue(){return this.getText()}findMatches(e){const t=[];for(let i=0;ithis._lines.length)t=this._lines.length,i=this._lines[t-1].length+1,r=!0;else{const s=this._lines[t-1].length+1;i<1?(i=1,r=!0):i>s&&(i=s,r=!0)}return r?{lineNumber:t,column:i}:e}}class S1t{constructor(){this._workerTextModelSyncServer=new C1t}dispose(){}_getModel(e){return this._workerTextModelSyncServer.getModel(e)}_getModels(){return this._workerTextModelSyncServer.getModels()}$acceptNewModel(e){this._workerTextModelSyncServer.$acceptNewModel(e)}$acceptModelChanged(e,t){this._workerTextModelSyncServer.$acceptModelChanged(e,t)}$acceptRemovedModel(e){this._workerTextModelSyncServer.$acceptRemovedModel(e)}async $computeUnicodeHighlights(e,t,i){const r=this._getModel(e);return r?Jae.computeUnicodeHighlights(r,t,i):{ranges:[],hasMore:!1,ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0}}async $findSectionHeaders(e,t){const i=this._getModel(e);return i?g1t(i,t):[]}async $computeDiff(e,t,i,r){const s=this._getModel(e),o=this._getModel(t);return!s||!o?null:qF.computeDiff(s,o,i,r)}static computeDiff(e,t,i,r){const s=r==="advanced"?Vbe.getDefault():Vbe.getLegacy(),o=e.getLinesContent(),a=t.getLinesContent(),l=s.computeDiff(o,a,i),c=l.changes.length>0?!1:this._modelsAreIdentical(e,t);function u(d){return d.map(h=>[h.original.startLineNumber,h.original.endLineNumberExclusive,h.modified.startLineNumber,h.modified.endLineNumberExclusive,h.innerChanges?.map(f=>[f.originalRange.startLineNumber,f.originalRange.startColumn,f.originalRange.endLineNumber,f.originalRange.endColumn,f.modifiedRange.startLineNumber,f.modifiedRange.startColumn,f.modifiedRange.endLineNumber,f.modifiedRange.endColumn])])}return{identical:c,quitEarly:l.hitTimeout,changes:u(l.changes),moves:l.moves.map(d=>[d.lineRangeMapping.original.startLineNumber,d.lineRangeMapping.original.endLineNumberExclusive,d.lineRangeMapping.modified.startLineNumber,d.lineRangeMapping.modified.endLineNumberExclusive,u(d.changes)])}}static _modelsAreIdentical(e,t){const i=e.getLineCount(),r=t.getLineCount();if(i!==r)return!1;for(let s=1;s<=i;s++){const o=e.getLineContent(s),a=t.getLineContent(s);if(o!==a)return!1}return!0}static{this._diffLimit=1e5}async $computeMoreMinimalEdits(e,t,i){const r=this._getModel(e);if(!r)return t;const s=[];let o;t=t.slice(0).sort((l,c)=>{if(l.range&&c.range)return $.compareRangesUsingStarts(l.range,c.range);const u=l.range?0:1,d=c.range?0:1;return u-d});let a=0;for(let l=1;lqF._diffLimit){s.push({range:l,text:c});continue}const h=hbt(d,c,i),f=r.offsetAt($.lift(l).getStartPosition());for(const g of h){const p=r.positionAt(f+g.originalStart),m=r.positionAt(f+g.originalStart+g.originalLength),_={text:c.substr(g.modifiedStart,g.modifiedLength),range:{startLineNumber:p.lineNumber,startColumn:p.column,endLineNumber:m.lineNumber,endColumn:m.column}};r.getValueInRange(_.range)!==_.text&&s.push(_)}}return typeof o=="number"&&s.push({eol:o,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),s}async $computeLinks(e){const t=this._getModel(e);return t?_bt(t):null}async $computeDefaultDocumentColors(e){const t=this._getModel(e);return t?h1t(t):null}static{this._suggestionsLimit=1e4}async $textualSuggest(e,t,i,r){const s=new Bo,o=new RegExp(i,r),a=new Set;e:for(const l of e){const c=this._getModel(l);if(c){for(const u of c.words(o))if(!(u===t||!isNaN(Number(u)))&&(a.add(u),a.size>qF._suggestionsLimit))break e}}return{words:Array.from(a),duration:s.elapsed()}}async $computeWordRanges(e,t,i,r){const s=this._getModel(e);if(!s)return Object.create(null);const o=new RegExp(i,r),a=Object.create(null);for(let l=t.startLineNumber;lthis._host.$fhr(a,l)),getMirrorModels:()=>this._getModels()};return this._foreignModuleFactory?(this._foreignModule=this._foreignModuleFactory(o,t),Promise.resolve(aZ(this._foreignModule))):new Promise((a,l)=>{const c=u=>{this._foreignModule=u.create(o,t),a(aZ(this._foreignModule))};{const u=M$.asBrowserUri(`${e}.js`).toString(!0);At(()=>import(`${u}`),[],import.meta.url).then(c).catch(l)}})}$fmr(e,t){if(!this._foreignModule||typeof this._foreignModule[e]!="function")return Promise.reject(new Error("Missing requestHandler or method: "+e));try{return Promise.resolve(this._foreignModule[e].apply(this._foreignModule,t))}catch(i){return Promise.reject(i)}}}typeof importScripts=="function"&&(globalThis.monaco=F4e());const nW=On("textResourceConfigurationService"),Q3e=On("textResourcePropertiesService"),dt=On("ILanguageFeaturesService");var rle=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},cy=function(n,e){return function(t,i){e(t,i,n)}};const Kbe=5*60*1e3;function uy(n,e){const t=n.getModel(e);return!(!t||t.isTooLargeForSyncing())}let RX=class extends me{constructor(e,t,i,r,s,o){super(),this._languageConfigurationService=s,this._modelService=t,this._workerManager=this._register(new PX(e,this._modelService)),this._logService=r,this._register(o.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:async(a,l)=>{if(!uy(this._modelService,a.uri))return Promise.resolve({links:[]});const u=await(await this._workerWithResources([a.uri])).$computeLinks(a.uri.toString());return u&&{links:u}}})),this._register(o.completionProvider.register("*",new k1t(this._workerManager,i,this._modelService,this._languageConfigurationService)))}dispose(){super.dispose()}canComputeUnicodeHighlights(e){return uy(this._modelService,e)}async computedUnicodeHighlights(e,t,i){return(await this._workerWithResources([e])).$computeUnicodeHighlights(e.toString(),t,i)}async computeDiff(e,t,i,r){const o=await(await this._workerWithResources([e,t],!0)).$computeDiff(e.toString(),t.toString(),i,r);if(!o)return null;return{identical:o.identical,quitEarly:o.quitEarly,changes:l(o.changes),moves:o.moves.map(c=>new U3e(new gl(new gn(c[0],c[1]),new gn(c[2],c[3])),l(c[4])))};function l(c){return c.map(u=>new Ju(new gn(u[0],u[1]),new gn(u[2],u[3]),u[4]?.map(d=>new Mu(new $(d[0],d[1],d[2],d[3]),new $(d[4],d[5],d[6],d[7])))))}}async computeMoreMinimalEdits(e,t,i=!1){if(bl(t)){if(!uy(this._modelService,e))return Promise.resolve(t);const r=Bo.create(),s=this._workerWithResources([e]).then(o=>o.$computeMoreMinimalEdits(e.toString(),t,i));return s.finally(()=>this._logService.trace("FORMAT#computeMoreMinimalEdits",e.toString(!0),r.elapsed())),Promise.race([s,Y_(1e3).then(()=>t)])}else return Promise.resolve(void 0)}canNavigateValueSet(e){return uy(this._modelService,e)}async navigateValueSet(e,t,i){const r=this._modelService.getModel(e);if(!r)return null;const s=this._languageConfigurationService.getLanguageConfiguration(r.getLanguageId()).getWordDefinition(),o=s.source,a=s.flags;return(await this._workerWithResources([e])).$navigateValueSet(e.toString(),t,i,o,a)}canComputeWordRanges(e){return uy(this._modelService,e)}async computeWordRanges(e,t){const i=this._modelService.getModel(e);if(!i)return Promise.resolve(null);const r=this._languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition(),s=r.source,o=r.flags;return(await this._workerWithResources([e])).$computeWordRanges(e.toString(),t,s,o)}async findSectionHeaders(e,t){return(await this._workerWithResources([e])).$findSectionHeaders(e.toString(),t)}async computeDefaultDocumentColors(e){return(await this._workerWithResources([e])).$computeDefaultDocumentColors(e.toString())}async _workerWithResources(e,t=!1){return await(await this._workerManager.withWorker()).workerWithSyncedResources(e,t)}};RX=rle([cy(1,Sr),cy(2,nW),cy(3,Da),cy(4,Zr),cy(5,dt)],RX);class k1t{constructor(e,t,i,r){this.languageConfigurationService=r,this._debugDisplayName="wordbasedCompletions",this._workerManager=e,this._configurationService=t,this._modelService=i}async provideCompletionItems(e,t){const i=this._configurationService.getValue(e.uri,t,"editor");if(i.wordBasedSuggestions==="off")return;const r=[];if(i.wordBasedSuggestions==="currentDocument")uy(this._modelService,e.uri)&&r.push(e.uri);else for(const d of this._modelService.getModels())uy(this._modelService,d.uri)&&(d===e?r.unshift(d.uri):(i.wordBasedSuggestions==="allDocuments"||d.getLanguageId()===e.getLanguageId())&&r.push(d.uri));if(r.length===0)return;const s=this.languageConfigurationService.getLanguageConfiguration(e.getLanguageId()).getWordDefinition(),o=e.getWordAtPosition(t),a=o?new $(t.lineNumber,o.startColumn,t.lineNumber,o.endColumn):$.fromPositions(t),l=a.setEndPosition(t.lineNumber,t.column),u=await(await this._workerManager.withWorker()).textualSuggest(r,o?.word,s);if(u)return{duration:u.duration,suggestions:u.words.map(d=>({kind:18,label:d,insertText:d,range:{insert:l,replace:a}}))}}}let PX=class extends me{constructor(e,t){super(),this._workerDescriptor=e,this._modelService=t,this._editorWorkerClient=null,this._lastWorkerUsedTime=new Date().getTime(),this._register(new $ae).cancelAndSet(()=>this._checkStopIdleWorker(),Math.round(Kbe/2),Xi),this._register(this._modelService.onModelRemoved(r=>this._checkStopEmptyWorker()))}dispose(){this._editorWorkerClient&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null),super.dispose()}_checkStopEmptyWorker(){if(!this._editorWorkerClient)return;this._modelService.getModels().length===0&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}_checkStopIdleWorker(){if(!this._editorWorkerClient)return;new Date().getTime()-this._lastWorkerUsedTime>Kbe&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=new Date().getTime(),this._editorWorkerClient||(this._editorWorkerClient=new o8(this._workerDescriptor,!1,this._modelService)),Promise.resolve(this._editorWorkerClient)}};PX=rle([cy(1,Sr)],PX);class E1t{constructor(e){this._instance=e,this.proxy=this._instance}dispose(){this._instance.dispose()}setChannel(e,t){throw new Error("Not supported")}}let o8=class extends me{constructor(e,t,i){super(),this._workerDescriptor=e,this._disposed=!1,this._modelService=i,this._keepIdleModels=t,this._worker=null,this._modelManager=null}fhr(e,t){throw new Error("Not implemented!")}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(Dvt(this._workerDescriptor)),r8.setChannel(this._worker,this._createEditorWorkerHost())}catch(e){kX(e),this._worker=this._createFallbackLocalWorker()}return this._worker}async _getProxy(){try{const e=this._getOrCreateWorker().proxy;return await e.$ping(),e}catch(e){return kX(e),this._worker=this._createFallbackLocalWorker(),this._worker.proxy}}_createFallbackLocalWorker(){return new E1t(new qF(this._createEditorWorkerHost(),null))}_createEditorWorkerHost(){return{$fhr:(e,t)=>this.fhr(e,t)}}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new w1t(e,this._modelService,this._keepIdleModels))),this._modelManager}async workerWithSyncedResources(e,t=!1){if(this._disposed)return Promise.reject(gmt());const i=await this._getProxy();return this._getOrCreateModelManager(i).ensureSyncedResources(e,t),i}async textualSuggest(e,t,i){const r=await this.workerWithSyncedResources(e),s=i.source,o=i.flags;return r.$textualSuggest(e.map(a=>a.toString()),t,s,o)}dispose(){super.dispose(),this._disposed=!0}};o8=rle([cy(2,Sr)],o8);var Wd;(function(n){n.DARK="dark",n.LIGHT="light",n.HIGH_CONTRAST_DARK="hcDark",n.HIGH_CONTRAST_LIGHT="hcLight"})(Wd||(Wd={}));function mg(n){return n===Wd.HIGH_CONTRAST_DARK||n===Wd.HIGH_CONTRAST_LIGHT}function aE(n){return n===Wd.DARK||n===Wd.HIGH_CONTRAST_DARK}const go=On("themeService");function ss(n){return{id:n}}function OX(n){switch(n){case Wd.DARK:return"vs-dark";case Wd.HIGH_CONTRAST_DARK:return"hc-black";case Wd.HIGH_CONTRAST_LIGHT:return"hc-light";default:return"vs"}}const J3e={ThemingContribution:"base.contributions.theming"};class L1t{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new fe}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),Lt(()=>{const t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)})}getThemingParticipants(){return this.themingParticipants}}const eFe=new L1t;Yr.add(J3e.ThemingContribution,eFe);function dh(n){return eFe.onColorThemeChange(n)}class T1t extends me{constructor(e){super(),this.themeService=e,this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(t=>this.onThemeChange(t)))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}}var D1t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},I1t=function(n,e){return function(t,i){e(t,i,n)}};let MX=class extends me{constructor(e){super(),this._themeService=e,this._onWillCreateCodeEditor=this._register(new fe),this._onCodeEditorAdd=this._register(new fe),this.onCodeEditorAdd=this._onCodeEditorAdd.event,this._onCodeEditorRemove=this._register(new fe),this.onCodeEditorRemove=this._onCodeEditorRemove.event,this._onWillCreateDiffEditor=this._register(new fe),this._onDiffEditorAdd=this._register(new fe),this.onDiffEditorAdd=this._onDiffEditorAdd.event,this._onDiffEditorRemove=this._register(new fe),this.onDiffEditorRemove=this._onDiffEditorRemove.event,this._decorationOptionProviders=new Map,this._codeEditorOpenHandlers=new Rl,this._modelProperties=new Map,this._codeEditors=Object.create(null),this._diffEditors=Object.create(null),this._globalStyleSheet=null}willCreateCodeEditor(){this._onWillCreateCodeEditor.fire()}addCodeEditor(e){this._codeEditors[e.getId()]=e,this._onCodeEditorAdd.fire(e)}removeCodeEditor(e){delete this._codeEditors[e.getId()]&&this._onCodeEditorRemove.fire(e)}listCodeEditors(){return Object.keys(this._codeEditors).map(e=>this._codeEditors[e])}willCreateDiffEditor(){this._onWillCreateDiffEditor.fire()}addDiffEditor(e){this._diffEditors[e.getId()]=e,this._onDiffEditorAdd.fire(e)}listDiffEditors(){return Object.keys(this._diffEditors).map(e=>this._diffEditors[e])}getFocusedCodeEditor(){let e=null;const t=this.listCodeEditors();for(const i of t){if(i.hasTextFocus())return i;i.hasWidgetFocus()&&(e=i)}return e}removeDecorationType(e){const t=this._decorationOptionProviders.get(e);t&&(t.refCount--,t.refCount<=0&&(this._decorationOptionProviders.delete(e),t.dispose(),this.listCodeEditors().forEach(i=>i.removeDecorationsByType(e))))}setModelProperty(e,t,i){const r=e.toString();let s;this._modelProperties.has(r)?s=this._modelProperties.get(r):(s=new Map,this._modelProperties.set(r,s)),s.set(t,i)}getModelProperty(e,t){const i=e.toString();if(this._modelProperties.has(i))return this._modelProperties.get(i).get(t)}async openCodeEditor(e,t,i){for(const r of this._codeEditorOpenHandlers){const s=await r(e,t,i);if(s!==null)return s}return null}registerCodeEditorOpenHandler(e){const t=this._codeEditorOpenHandlers.unshift(e);return Lt(t)}};MX=D1t([I1t(0,go)],MX);var A1t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Gbe=function(n,e){return function(t,i){e(t,i,n)}};let a8=class extends MX{constructor(e,t){super(t),this._register(this.onCodeEditorAdd(()=>this._checkContextKey())),this._register(this.onCodeEditorRemove(()=>this._checkContextKey())),this._editorIsOpen=e.createKey("editorIsOpen",!1),this._activeCodeEditor=null,this._register(this.registerCodeEditorOpenHandler(async(i,r,s)=>r?this.doOpenEditor(r,i):null))}_checkContextKey(){let e=!1;for(const t of this.listCodeEditors())if(!t.isSimpleWidget){e=!0;break}this._editorIsOpen.set(e)}setActiveCodeEditor(e){this._activeCodeEditor=e}getActiveCodeEditor(){return this._activeCodeEditor}doOpenEditor(e,t){if(!this.findModel(e,t.resource)){if(t.resource){const s=t.resource.scheme;if(s===sn.http||s===sn.https)return v3e(t.resource.toString()),e}return null}const r=t.options?t.options.selection:null;if(r)if(typeof r.endLineNumber=="number"&&typeof r.endColumn=="number")e.setSelection(r),e.revealRangeInCenter(r,1);else{const s={lineNumber:r.startLineNumber,column:r.startColumn};e.setPosition(s),e.revealPositionInCenter(s,1)}return e}findModel(e,t){const i=e.getModel();return i&&i.uri.toString()!==t.toString()?null:i}};a8=A1t([Gbe(0,jt),Gbe(1,go)],a8);Vn(ai,a8,0);const Zb=On("layoutService");var tFe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},nFe=function(n,e){return function(t,i){e(t,i,n)}};let l8=class{get mainContainer(){return hae(this._codeEditorService.listCodeEditors())?.getContainerDomNode()??Xi.document.body}get activeContainer(){return(this._codeEditorService.getFocusedCodeEditor()??this._codeEditorService.getActiveCodeEditor())?.getContainerDomNode()??this.mainContainer}get mainContainerDimension(){return kb(this.mainContainer)}get activeContainerDimension(){return kb(this.activeContainer)}get containers(){return rf(this._codeEditorService.listCodeEditors().map(e=>e.getContainerDomNode()))}getContainer(){return this.activeContainer}whenContainerStylesLoaded(){}focus(){this._codeEditorService.getFocusedCodeEditor()?.focus()}constructor(e){this._codeEditorService=e,this.onDidLayoutMainContainer=Ge.None,this.onDidLayoutActiveContainer=Ge.None,this.onDidLayoutContainer=Ge.None,this.onDidChangeActiveContainer=Ge.None,this.onDidAddContainer=Ge.None,this.mainContainerOffset={top:0,quickPickTop:0},this.activeContainerOffset={top:0,quickPickTop:0}}};l8=tFe([nFe(0,ai)],l8);let FX=class extends l8{get mainContainer(){return this._container}constructor(e,t){super(t),this._container=e}};FX=tFe([nFe(1,ai)],FX);Vn(Zb,l8,1);var mN;(function(n){n[n.Ignore=0]="Ignore",n[n.Info=1]="Info",n[n.Warning=2]="Warning",n[n.Error=3]="Error"})(mN||(mN={}));(function(n){const e="error",t="warning",i="warn",r="info",s="ignore";function o(l){return l?bS(e,l)?n.Error:bS(t,l)||bS(i,l)?n.Warning:bS(r,l)?n.Info:n.Ignore:n.Ignore}n.fromValue=o;function a(l){switch(l){case n.Error:return e;case n.Warning:return t;case n.Info:return r;default:return s}}n.toString=a})(mN||(mN={}));const Ss=mN,JP=On("dialogService");var iW=Ss;const Ts=On("notificationService");class N1t{}const sle=On("undoRedoService");class iFe{constructor(e,t){this.resource=e,this.elements=t}}class c8{static{this._ID=0}constructor(){this.id=c8._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}static{this.None=new c8}}class fv{static{this._ID=0}constructor(){this.id=fv._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}static{this.None=new fv}}var R1t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ybe=function(n,e){return function(t,i){e(t,i,n)}};function L4(n){return n.scheme===sn.file?n.fsPath:n.path}let rFe=0;class T4{constructor(e,t,i,r,s,o,a){this.id=++rFe,this.type=0,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabel=t,this.strResource=i,this.resourceLabels=[this.resourceLabel],this.strResources=[this.strResource],this.groupId=r,this.groupOrder=s,this.sourceId=o,this.sourceOrder=a,this.isValid=!0}setValid(e){this.isValid=e}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.isValid?" VALID":"INVALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class Zbe{constructor(e,t){this.resourceLabel=e,this.reason=t}}class Xbe{constructor(){this.elements=new Map}createMessage(){const e=[],t=[];for(const[,r]of this.elements)(r.reason===0?e:t).push(r.resourceLabel);const i=[];return e.length>0&&i.push(w({key:"externalRemoval",comment:["{0} is a list of filenames"]},"The following files have been closed and modified on disk: {0}.",e.join(", "))),t.length>0&&i.push(w({key:"noParallelUniverses",comment:["{0} is a list of filenames"]},"The following files have been modified in an incompatible way: {0}.",t.join(", "))),i.join(` -`)}get size(){return this.elements.size}has(e){return this.elements.has(e)}set(e,t){this.elements.set(e,t)}delete(e){return this.elements.delete(e)}}class P1t{constructor(e,t,i,r,s,o,a){this.id=++rFe,this.type=1,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabels=t,this.strResources=i,this.groupId=r,this.groupOrder=s,this.sourceId=o,this.sourceOrder=a,this.removedResources=null,this.invalidatedResources=null}canSplit(){return typeof this.actual.split=="function"}removeResource(e,t,i){this.removedResources||(this.removedResources=new Xbe),this.removedResources.has(t)||this.removedResources.set(t,new Zbe(e,i))}setValid(e,t,i){i?this.invalidatedResources&&(this.invalidatedResources.delete(t),this.invalidatedResources.size===0&&(this.invalidatedResources=null)):(this.invalidatedResources||(this.invalidatedResources=new Xbe),this.invalidatedResources.has(t)||this.invalidatedResources.set(t,new Zbe(e,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":" VALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class sFe{constructor(e,t){this.resourceLabel=e,this.strResource=t,this._past=[],this._future=[],this.locked=!1,this.versionId=1}dispose(){for(const e of this._past)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);for(const e of this._future)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);this.versionId++}toString(){const e=[];e.push(`* ${this.strResource}:`);for(let t=0;t=0;t--)e.push(` * [REDO] ${this._future[t]}`);return e.join(` -`)}flushAllElements(){this._past=[],this._future=[],this.versionId++}_setElementValidFlag(e,t){e.type===1?e.setValid(this.resourceLabel,this.strResource,t):e.setValid(t)}setElementsValidFlag(e,t){for(const i of this._past)t(i.actual)&&this._setElementValidFlag(i,e);for(const i of this._future)t(i.actual)&&this._setElementValidFlag(i,e)}pushElement(e){for(const t of this._future)t.type===1&&t.removeResource(this.resourceLabel,this.strResource,1);this._future=[],this._past.push(e),this.versionId++}createSnapshot(e){const t=[];for(let i=0,r=this._past.length;i=0;i--)t.push(this._future[i].id);return new iFe(e,t)}restoreSnapshot(e){const t=e.elements.length;let i=!0,r=0,s=-1;for(let a=0,l=this._past.length;a=t||c.id!==e.elements[r])&&(i=!1,s=0),!i&&c.type===1&&c.removeResource(this.resourceLabel,this.strResource,0)}let o=-1;for(let a=this._future.length-1;a>=0;a--,r++){const l=this._future[a];i&&(r>=t||l.id!==e.elements[r])&&(i=!1,o=a),!i&&l.type===1&&l.removeResource(this.resourceLabel,this.strResource,0)}s!==-1&&(this._past=this._past.slice(0,s)),o!==-1&&(this._future=this._future.slice(o+1)),this.versionId++}getElements(){const e=[],t=[];for(const i of this._past)e.push(i.actual);for(const i of this._future)t.push(i.actual);return{past:e,future:t}}getClosestPastElement(){return this._past.length===0?null:this._past[this._past.length-1]}getSecondClosestPastElement(){return this._past.length<2?null:this._past[this._past.length-2]}getClosestFutureElement(){return this._future.length===0?null:this._future[this._future.length-1]}hasPastElements(){return this._past.length>0}hasFutureElements(){return this._future.length>0}splitPastWorkspaceElement(e,t){for(let i=this._past.length-1;i>=0;i--)if(this._past[i]===e){t.has(this.strResource)?this._past[i]=t.get(this.strResource):this._past.splice(i,1);break}this.versionId++}splitFutureWorkspaceElement(e,t){for(let i=this._future.length-1;i>=0;i--)if(this._future[i]===e){t.has(this.strResource)?this._future[i]=t.get(this.strResource):this._future.splice(i,1);break}this.versionId++}moveBackward(e){this._past.pop(),this._future.push(e),this.versionId++}moveForward(e){this._future.pop(),this._past.push(e),this.versionId++}}class Wj{constructor(e){this.editStacks=e,this._versionIds=[];for(let t=0,i=this.editStacks.length;tt.sourceOrder)&&(t=o,i=r)}return[t,i]}canUndo(e){if(e instanceof fv){const[,i]=this._findClosestUndoElementWithSource(e.id);return!!i}const t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).hasPastElements():!1}_onError(e,t){rn(e);for(const i of t.strResources)this.removeElements(i);this._notificationService.error(e)}_acquireLocks(e){for(const t of e.editStacks)if(t.locked)throw new Error("Cannot acquire edit stack lock");for(const t of e.editStacks)t.locked=!0;return()=>{for(const t of e.editStacks)t.locked=!1}}_safeInvokeWithLocks(e,t,i,r,s){const o=this._acquireLocks(i);let a;try{a=t()}catch(l){return o(),r.dispose(),this._onError(l,e)}return a?a.then(()=>(o(),r.dispose(),s()),l=>(o(),r.dispose(),this._onError(l,e))):(o(),r.dispose(),s())}async _invokeWorkspacePrepare(e){if(typeof e.actual.prepareUndoRedo>"u")return me.None;const t=e.actual.prepareUndoRedo();return typeof t>"u"?me.None:t}_invokeResourcePrepare(e,t){if(e.actual.type!==1||typeof e.actual.prepareUndoRedo>"u")return t(me.None);const i=e.actual.prepareUndoRedo();return i?R$(i)?t(i):i.then(r=>t(r)):t(me.None)}_getAffectedEditStacks(e){const t=[];for(const i of e.strResources)t.push(this._editStacks.get(i)||oFe);return new Wj(t)}_tryToSplitAndUndo(e,t,i,r){if(t.canSplit())return this._splitPastWorkspaceElement(t,i),this._notificationService.warn(r),new D4(this._undo(e,0,!0));for(const s of t.strResources)this.removeElements(s);return this._notificationService.warn(r),new D4}_checkWorkspaceUndo(e,t,i,r){if(t.removedResources)return this._tryToSplitAndUndo(e,t,t.removedResources,w({key:"cannotWorkspaceUndo",comment:["{0} is a label for an operation. {1} is another message."]},"Could not undo '{0}' across all files. {1}",t.label,t.removedResources.createMessage()));if(r&&t.invalidatedResources)return this._tryToSplitAndUndo(e,t,t.invalidatedResources,w({key:"cannotWorkspaceUndo",comment:["{0} is a label for an operation. {1} is another message."]},"Could not undo '{0}' across all files. {1}",t.label,t.invalidatedResources.createMessage()));const s=[];for(const a of i.editStacks)a.getClosestPastElement()!==t&&s.push(a.resourceLabel);if(s.length>0)return this._tryToSplitAndUndo(e,t,null,w({key:"cannotWorkspaceUndoDueToChanges",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because changes were made to {1}",t.label,s.join(", ")));const o=[];for(const a of i.editStacks)a.locked&&o.push(a.resourceLabel);return o.length>0?this._tryToSplitAndUndo(e,t,null,w({key:"cannotWorkspaceUndoDueToInProgressUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,o.join(", "))):i.isValid()?null:this._tryToSplitAndUndo(e,t,null,w({key:"cannotWorkspaceUndoDueToInMeantimeUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceUndo(e,t,i){const r=this._getAffectedEditStacks(t),s=this._checkWorkspaceUndo(e,t,r,!1);return s?s.returnValue:this._confirmAndExecuteWorkspaceUndo(e,t,r,i)}_isPartOfUndoGroup(e){if(!e.groupId)return!1;for(const[,t]of this._editStacks){const i=t.getClosestPastElement();if(i){if(i===e){const r=t.getSecondClosestPastElement();if(r&&r.groupId===e.groupId)return!0}if(i.groupId===e.groupId)return!0}}return!1}async _confirmAndExecuteWorkspaceUndo(e,t,i,r){if(t.canSplit()&&!this._isPartOfUndoGroup(t)){let a;(function(u){u[u.All=0]="All",u[u.This=1]="This",u[u.Cancel=2]="Cancel"})(a||(a={}));const{result:l}=await this._dialogService.prompt({type:Ss.Info,message:w("confirmWorkspace","Would you like to undo '{0}' across all files?",t.label),buttons:[{label:w({key:"ok",comment:["{0} denotes a number that is > 1, && denotes a mnemonic"]},"&&Undo in {0} Files",i.editStacks.length),run:()=>a.All},{label:w({key:"nok",comment:["&& denotes a mnemonic"]},"Undo this &&File"),run:()=>a.This}],cancelButton:{run:()=>a.Cancel}});if(l===a.Cancel)return;if(l===a.This)return this._splitPastWorkspaceElement(t,null),this._undo(e,0,!0);const c=this._checkWorkspaceUndo(e,t,i,!1);if(c)return c.returnValue;r=!0}let s;try{s=await this._invokeWorkspacePrepare(t)}catch(a){return this._onError(a,t)}const o=this._checkWorkspaceUndo(e,t,i,!0);if(o)return s.dispose(),o.returnValue;for(const a of i.editStacks)a.moveBackward(t);return this._safeInvokeWithLocks(t,()=>t.actual.undo(),i,s,()=>this._continueUndoInGroup(t.groupId,r))}_resourceUndo(e,t,i){if(!t.isValid){e.flushAllElements();return}if(e.locked){const r=w({key:"cannotResourceUndoDueToInProgressUndoRedo",comment:["{0} is a label for an operation."]},"Could not undo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(r);return}return this._invokeResourcePrepare(t,r=>(e.moveBackward(t),this._safeInvokeWithLocks(t,()=>t.actual.undo(),new Wj([e]),r,()=>this._continueUndoInGroup(t.groupId,i))))}_findClosestUndoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(const[r,s]of this._editStacks){const o=s.getClosestPastElement();o&&o.groupId===e&&(!t||o.groupOrder>t.groupOrder)&&(t=o,i=r)}return[t,i]}_continueUndoInGroup(e,t){if(!e)return;const[,i]=this._findClosestUndoElementInGroup(e);if(i)return this._undo(i,0,t)}undo(e){if(e instanceof fv){const[,t]=this._findClosestUndoElementWithSource(e.id);return t?this._undo(t,e.id,!1):void 0}return typeof e=="string"?this._undo(e,0,!1):this._undo(this.getUriComparisonKey(e),0,!1)}_undo(e,t=0,i){if(!this._editStacks.has(e))return;const r=this._editStacks.get(e),s=r.getClosestPastElement();if(!s)return;if(s.groupId){const[a,l]=this._findClosestUndoElementInGroup(s.groupId);if(s!==a&&l)return this._undo(l,t,i)}if((s.sourceId!==t||s.confirmBeforeUndo)&&!i)return this._confirmAndContinueUndo(e,t,s);try{return s.type===1?this._workspaceUndo(e,s,i):this._resourceUndo(r,s,i)}finally{}}async _confirmAndContinueUndo(e,t,i){if((await this._dialogService.confirm({message:w("confirmDifferentSource","Would you like to undo '{0}'?",i.label),primaryButton:w({key:"confirmDifferentSource.yes",comment:["&& denotes a mnemonic"]},"&&Yes"),cancelButton:w("confirmDifferentSource.no","No")})).confirmed)return this._undo(e,t,!0)}_findClosestRedoElementWithSource(e){if(!e)return[null,null];let t=null,i=null;for(const[r,s]of this._editStacks){const o=s.getClosestFutureElement();o&&o.sourceId===e&&(!t||o.sourceOrder0)return this._tryToSplitAndRedo(e,t,null,w({key:"cannotWorkspaceRedoDueToChanges",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because changes were made to {1}",t.label,s.join(", ")));const o=[];for(const a of i.editStacks)a.locked&&o.push(a.resourceLabel);return o.length>0?this._tryToSplitAndRedo(e,t,null,w({key:"cannotWorkspaceRedoDueToInProgressUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,o.join(", "))):i.isValid()?null:this._tryToSplitAndRedo(e,t,null,w({key:"cannotWorkspaceRedoDueToInMeantimeUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceRedo(e,t){const i=this._getAffectedEditStacks(t),r=this._checkWorkspaceRedo(e,t,i,!1);return r?r.returnValue:this._executeWorkspaceRedo(e,t,i)}async _executeWorkspaceRedo(e,t,i){let r;try{r=await this._invokeWorkspacePrepare(t)}catch(o){return this._onError(o,t)}const s=this._checkWorkspaceRedo(e,t,i,!0);if(s)return r.dispose(),s.returnValue;for(const o of i.editStacks)o.moveForward(t);return this._safeInvokeWithLocks(t,()=>t.actual.redo(),i,r,()=>this._continueRedoInGroup(t.groupId))}_resourceRedo(e,t){if(!t.isValid){e.flushAllElements();return}if(e.locked){const i=w({key:"cannotResourceRedoDueToInProgressUndoRedo",comment:["{0} is a label for an operation."]},"Could not redo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(i);return}return this._invokeResourcePrepare(t,i=>(e.moveForward(t),this._safeInvokeWithLocks(t,()=>t.actual.redo(),new Wj([e]),i,()=>this._continueRedoInGroup(t.groupId))))}_findClosestRedoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(const[r,s]of this._editStacks){const o=s.getClosestFutureElement();o&&o.groupId===e&&(!t||o.groupOrder=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Qbe=function(n,e){return function(t,i){e(t,i,n)}};const cd=On("ILanguageFeatureDebounceService");var u8;(function(n){const e=new WeakMap;let t=0;function i(r){let s=e.get(r);return s===void 0&&(s=++t,e.set(r,s)),s}n.of=i})(u8||(u8={}));class F1t{constructor(e){this._default=e}get(e){return this._default}update(e,t){return this._default}default(){return this._default}}class B1t{constructor(e,t,i,r,s,o){this._logService=e,this._name=t,this._registry=i,this._default=r,this._min=s,this._max=o,this._cache=new lm(50,.7)}_key(e){return e.id+this._registry.all(e).reduce((t,i)=>B$(u8.of(i),t),0)}get(e){const t=this._key(e),i=this._cache.get(t);return i?Il(i.value,this._min,this._max):this.default()}update(e,t){const i=this._key(e);let r=this._cache.get(i);r||(r=new O1t(6),this._cache.set(i,r));const s=Il(r.update(t),this._min,this._max);return O$(e.uri,"output")||this._logService.trace(`[DEBOUNCE: ${this._name}] for ${e.uri.toString()} is ${s}ms`),s}_overall(){const e=new aFe;for(const[,t]of this._cache)e.update(t.value);return e.value}default(){const e=this._overall()|0||this._default;return Il(e,this._min,this._max)}}let $X=class{constructor(e,t){this._logService=e,this._data=new Map,this._isDev=t.isExtensionDevelopment||!t.isBuilt}for(e,t,i){const r=i?.min??50,s=i?.max??r**2,o=i?.key??void 0,a=`${u8.of(e)},${r}${o?","+o:""}`;let l=this._data.get(a);return l||(this._isDev?(this._logService.debug(`[DEBOUNCE: ${t}] is disabled in developed mode`),l=new F1t(r*1.5)):l=new B1t(this._logService,t,e,this._overallAverage()|0||r*1.5,r,s),this._data.set(a,l)),l}_overallAverage(){const e=new aFe;for(const t of this._data.values())e.update(t.default());return e.value}};$X=M1t([Qbe(0,Da),Qbe(1,ole)],$X);Vn(cd,$X,1);class hc{static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static getClassNameFromMetadata(e){let i="mtk"+this.getForeground(e);const r=this.getFontStyle(e);return r&1&&(i+=" mtki"),r&2&&(i+=" mtkb"),r&4&&(i+=" mtku"),r&8&&(i+=" mtks"),i}static getInlineStyleFromMetadata(e,t){const i=this.getForeground(e),r=this.getFontStyle(e);let s=`color: ${t[i]};`;r&1&&(s+="font-style: italic;"),r&2&&(s+="font-weight: bold;");let o="";return r&4&&(o+=" underline"),r&8&&(o+=" line-through"),o&&(s+=`text-decoration:${o};`),s}static getPresentationFromMetadata(e){const t=this.getForeground(e),i=this.getFontStyle(e);return{foreground:t,italic:!!(i&1),bold:!!(i&2),underline:!!(i&4),strikethrough:!!(i&8)}}}function Lb(n){let e=0,t=0,i=0,r=0;for(let s=0,o=n.length;s0?t.charCodeAt(0):0)}acceptEdit(e,t,i,r,s){this._acceptDeleteRange(e),this._acceptInsertText(new he(e.startLineNumber,e.startColumn),t,i,r,s),this._updateEndLineNumber()}_acceptDeleteRange(e){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return;const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber;if(i<0){const s=i-t;this._startLineNumber-=s;return}const r=this._tokens.getMaxDeltaLine();if(!(t>=r+1)){if(t<0&&i>=r+1){this._startLineNumber=0,this._tokens.clear();return}if(t<0){const s=-t;this._startLineNumber-=s,this._tokens.acceptDeleteRange(e.startColumn-1,0,0,i,e.endColumn-1)}else this._tokens.acceptDeleteRange(0,t,e.startColumn-1,i,e.endColumn-1)}}_acceptInsertText(e,t,i,r,s){if(t===0&&i===0)return;const o=e.lineNumber-this._startLineNumber;if(o<0){this._startLineNumber+=t;return}const a=this._tokens.getMaxDeltaLine();o>=a+1||this._tokens.acceptInsertText(o,e.column-1,t,i,r,s)}}class d8{constructor(e){this._tokens=e,this._tokenCount=e.length/4}toString(e){const t=[];for(let i=0;ie)i=r-1;else{let o=r;for(;o>t&&this._getDeltaLine(o-1)===e;)o--;let a=r;for(;ae||h===e&&g>=t)&&(he||g===e&&m>=t){if(gs?p-=s-i:p=i;else if(f===t&&g===i)if(f===r&&p>s)p-=s-i;else{u=!0;continue}else if(fs)f=t,g=i,p=g+(p-s);else{u=!0;continue}else if(f>r){if(l===0&&!u){c=a;break}f-=l}else if(f===r&&g>=s)e&&f===0&&(g+=e,p+=e),f-=l,g-=s-i,p-=s-i;else throw new Error("Not possible!");const _=4*c;o[_]=f,o[_+1]=g,o[_+2]=p,o[_+3]=m,c++}this._tokenCount=c}acceptInsertText(e,t,i,r,s,o){const a=i===0&&r===1&&(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122),l=this._tokens,c=this._tokenCount;for(let u=0;u=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Hj=function(n,e){return function(t,i){e(t,i,n)}};let WX=class{constructor(e,t,i,r){this._legend=e,this._themeService=t,this._languageService=i,this._logService=r,this._hasWarnedOverlappingTokens=!1,this._hasWarnedInvalidLengthTokens=!1,this._hasWarnedInvalidEditStart=!1,this._hashTable=new rv}getMetadata(e,t,i){const r=this._languageService.languageIdCodec.encodeLanguageId(i),s=this._hashTable.get(e,t,r);let o;if(s)o=s.metadata;else{let a=this._legend.tokenTypes[e];const l=[];if(a){let c=t;for(let d=0;c>0&&d>1;const u=this._themeService.getColorTheme().getTokenStyleMetadata(a,l,i);if(typeof u>"u")o=2147483647;else{if(o=0,typeof u.italic<"u"){const d=(u.italic?1:0)<<11;o|=d|1}if(typeof u.bold<"u"){const d=(u.bold?2:0)<<11;o|=d|2}if(typeof u.underline<"u"){const d=(u.underline?4:0)<<11;o|=d|4}if(typeof u.strikethrough<"u"){const d=(u.strikethrough?8:0)<<11;o|=d|8}if(u.foreground){const d=u.foreground<<15;o|=d|16}o===0&&(o=2147483647)}}else o=2147483647,a="not-in-legend";this._hashTable.add(e,t,r,o)}return o}warnOverlappingSemanticTokens(e,t){this._hasWarnedOverlappingTokens||(this._hasWarnedOverlappingTokens=!0,this._logService.warn(`Overlapping semantic tokens detected at lineNumber ${e}, column ${t}`))}warnInvalidLengthSemanticTokens(e,t){this._hasWarnedInvalidLengthTokens||(this._hasWarnedInvalidLengthTokens=!0,this._logService.warn(`Semantic token with invalid length detected at lineNumber ${e}, column ${t}`))}warnInvalidEditStart(e,t,i,r,s){this._hasWarnedInvalidEditStart||(this._hasWarnedInvalidEditStart=!0,this._logService.warn(`Invalid semantic tokens edit detected (previousResultId: ${e}, resultId: ${t}) at edit #${i}: The provided start offset ${r} is outside the previous data (length ${s}).`))}};WX=$1t([Hj(1,go),Hj(2,Hr),Hj(3,Da)],WX);function lFe(n,e,t){const i=n.data,r=n.data.length/5|0,s=Math.max(Math.ceil(r/1024),400),o=[];let a=0,l=1,c=0;for(;au&&i[5*v]===0;)v--;if(v-1===u){let y=d;for(;y+1k)e.warnOverlappingSemanticTokens(x,k+1);else{const M=e.getMetadata(I,O,t);M!==2147483647&&(g===0&&(g=x),h[f]=x-g,h[f+1]=k,h[f+2]=D,h[f+3]=M,f+=4,p=x,m=D)}l=x,c=k,a++}f!==h.length&&(h=h.subarray(0,f));const _=vI.create(g,h);o.push(_)}return o}class W1t{constructor(e,t,i,r){this.tokenTypeIndex=e,this.tokenModifierSet=t,this.languageId=i,this.metadata=r,this.next=null}}class rv{static{this._SIZES=[3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143]}constructor(){this._elementsCount=0,this._currentLengthIndex=0,this._currentLength=rv._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1=this._growCount){const s=this._elements;this._currentLengthIndex++,this._currentLength=rv._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Vj=function(n,e){return function(t,i){e(t,i,n)}};let HX=class extends me{constructor(e,t,i){super(),this._themeService=e,this._logService=t,this._languageService=i,this._caches=new WeakMap,this._register(this._themeService.onDidColorThemeChange(()=>{this._caches=new WeakMap}))}getStyling(e){return this._caches.has(e)||this._caches.set(e,new WX(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}};HX=H1t([Vj(0,go),Vj(1,Da),Vj(2,Hr)],HX);Vn(rW,HX,1);function z0(n){return n===47||n===92}function cFe(n){return n.replace(/[\\/]/g,Ms.sep)}function V1t(n){return n.indexOf("/")===-1&&(n=cFe(n)),/^[a-zA-Z]:(\/|$)/.test(n)&&(n="/"+n),n}function e1e(n,e=Ms.sep){if(!n)return"";const t=n.length,i=n.charCodeAt(0);if(z0(i)){if(z0(n.charCodeAt(1))&&!z0(n.charCodeAt(2))){let s=3;const o=s;for(;sn.length)return!1;if(t){if(!Lae(n,e))return!1;if(e.length===n.length)return!0;let s=e.length;return e.charAt(e.length-1)===i&&s--,n.charAt(s)===i}return e.charAt(e.length-1)!==i&&(e+=i),n.indexOf(e)===0}function uFe(n){return n>=65&&n<=90||n>=97&&n<=122}function z1t(n,e=Ta){return e?uFe(n.charCodeAt(0))&&n.charCodeAt(1)===58:!1}const I4="**",t1e="/",KF="[/\\\\]",GF="[^/\\\\]",U1t=/\//g;function n1e(n,e){switch(n){case 0:return"";case 1:return`${GF}*?`;default:return`(?:${KF}|${GF}+${KF}${e?`|${KF}${GF}+`:""})*?`}}function i1e(n,e){if(!n)return[];const t=[];let i=!1,r=!1,s="";for(const o of n){switch(o){case e:if(!i&&!r){t.push(s),s="";continue}break;case"{":i=!0;break;case"}":i=!1;break;case"[":r=!0;break;case"]":r=!1;break}s+=o}return s&&t.push(s),t}function dFe(n){if(!n)return"";let e="";const t=i1e(n,t1e);if(t.every(i=>i===I4))e=".*";else{let i=!1;t.forEach((r,s)=>{if(r===I4){if(i)return;e+=n1e(2,s===t.length-1)}else{let o=!1,a="",l=!1,c="";for(const u of r){if(u!=="}"&&o){a+=u;continue}if(l&&(u!=="]"||!c)){let d;u==="-"?d=u:(u==="^"||u==="!")&&!c?d="^":u===t1e?d="":d=nd(u),c+=d;continue}switch(u){case"{":o=!0;continue;case"[":l=!0;continue;case"}":{const h=`(?:${i1e(a,",").map(f=>dFe(f)).join("|")})`;e+=h,o=!1,a="";break}case"]":{e+="["+c+"]",l=!1,c="";break}case"?":e+=GF;continue;case"*":e+=n1e(1);continue;default:e+=nd(u)}}sale(a,e)).filter(a=>a!==Wp),n),i=t.length;if(!i)return Wp;if(i===1)return t[0];const r=function(a,l){for(let c=0,u=t.length;c!!a.allBasenames);s&&(r.allBasenames=s.allBasenames);const o=t.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return o.length&&(r.allPaths=o),r}function a1e(n,e,t){const i=fg===Ms.sep,r=i?n:n.replace(U1t,fg),s=fg+r,o=Ms.sep+n;let a;return t?a=function(l,c){return typeof l=="string"&&(l===r||l.endsWith(s)||!i&&(l===n||l.endsWith(o)))?e:null}:a=function(l,c){return typeof l=="string"&&(l===r||!i&&l===n)?e:null},a.allPaths=[(t?"*/":"./")+n],a}function eyt(n){try{const e=new RegExp(`^${dFe(n)}$`);return function(t){return e.lastIndex=0,typeof t=="string"&&e.test(t)?n:null}}catch{return Wp}}function tyt(n,e,t){return!n||typeof e!="string"?!1:hFe(n)(e,void 0,t)}function hFe(n,e={}){if(!n)return s1e;if(typeof n=="string"||nyt(n)){const t=ale(n,e);if(t===Wp)return s1e;const i=function(r,s){return!!t(r,s)};return t.allBasenames&&(i.allBasenames=t.allBasenames),t.allPaths&&(i.allPaths=t.allPaths),i}return iyt(n,e)}function nyt(n){const e=n;return e?typeof e.base=="string"&&typeof e.pattern=="string":!1}function iyt(n,e){const t=fFe(Object.getOwnPropertyNames(n).map(a=>ryt(a,n[a],e)).filter(a=>a!==Wp)),i=t.length;if(!i)return Wp;if(!t.some(a=>!!a.requiresSiblings)){if(i===1)return t[0];const a=function(u,d){let h;for(let f=0,g=t.length;f{for(const f of h){const g=await f;if(typeof g=="string")return g}return null})():null},l=t.find(u=>!!u.allBasenames);l&&(a.allBasenames=l.allBasenames);const c=t.reduce((u,d)=>d.allPaths?u.concat(d.allPaths):u,[]);return c.length&&(a.allPaths=c),a}const r=function(a,l,c){let u,d;for(let h=0,f=t.length;h{for(const h of d){const f=await h;if(typeof f=="string")return f}return null})():null},s=t.find(a=>!!a.allBasenames);s&&(r.allBasenames=s.allBasenames);const o=t.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return o.length&&(r.allPaths=o),r}function ryt(n,e,t){if(e===!1)return Wp;const i=ale(n,t);if(i===Wp)return Wp;if(typeof e=="boolean")return i;if(e){const r=e.when;if(typeof r=="string"){const s=(o,a,l,c)=>{if(!c||!i(o,a))return null;const u=r.replace("$(basename)",()=>l),d=c(u);return hX(d)?d.then(h=>h?n:null):d?n:null};return s.requiresSiblings=!0,s}}return i}function fFe(n,e){const t=n.filter(a=>!!a.basenames);if(t.length<2)return n;const i=t.reduce((a,l)=>{const c=l.basenames;return c?a.concat(c):a},[]);let r;if(e){r=[];for(let a=0,l=i.length;a{const c=l.patterns;return c?a.concat(c):a},[]);const s=function(a,l){if(typeof a!="string")return null;if(!l){let u;for(u=a.length;u>0;u--){const d=a.charCodeAt(u-1);if(d===47||d===92)break}l=a.substr(u)}const c=i.indexOf(l);return c!==-1?r[c]:null};s.basenames=i,s.patterns=r,s.allBasenames=i;const o=n.filter(a=>!a.basenames);return o.push(s),o}function lle(n,e,t,i,r,s){if(Array.isArray(n)){let o=0;for(const a of n){const l=lle(a,e,t,i,r,s);if(l===10)return l;l>o&&(o=l)}return o}else{if(typeof n=="string")return i?n==="*"?5:n===t?10:0:0;if(n){const{language:o,pattern:a,scheme:l,hasAccessToAllModels:c,notebookType:u}=n;if(!i&&!c)return 0;u&&r&&(e=r);let d=0;if(l)if(l===e.scheme)d=10;else if(l==="*")d=5;else return 0;if(o)if(o===t)d=10;else if(o==="*")d=Math.max(d,5);else return 0;if(u)if(u===s)d=10;else if(u==="*"&&s!==void 0)d=Math.max(d,5);else return 0;if(a){let h;if(typeof a=="string"?h=a:h={...a,base:D4e(a.base)},h===e.fsPath||tyt(h,e.fsPath))d=10;else return 0}return d}else return 0}}function gFe(n){return typeof n=="string"?!1:Array.isArray(n)?n.every(gFe):!!n.exclusive}class l1e{constructor(e,t,i,r,s){this.uri=e,this.languageId=t,this.notebookUri=i,this.notebookType=r,this.recursive=s}equals(e){return this.notebookType===e.notebookType&&this.languageId===e.languageId&&this.uri.toString()===e.uri.toString()&&this.notebookUri?.toString()===e.notebookUri?.toString()&&this.recursive===e.recursive}}class Vr{constructor(e){this._notebookInfoResolver=e,this._clock=0,this._entries=[],this._onDidChange=new fe,this.onDidChange=this._onDidChange.event}register(e,t){let i={selector:e,provider:t,_score:-1,_time:this._clock++};return this._entries.push(i),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),Lt(()=>{if(i){const r=this._entries.indexOf(i);r>=0&&(this._entries.splice(r,1),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),i=void 0)}})}has(e){return this.all(e).length>0}all(e){if(!e)return[];this._updateScores(e,!1);const t=[];for(const i of this._entries)i._score>0&&t.push(i.provider);return t}ordered(e,t=!1){const i=[];return this._orderedForEach(e,t,r=>i.push(r.provider)),i}orderedGroups(e){const t=[];let i,r;return this._orderedForEach(e,!1,s=>{i&&r===s._score?i.push(s.provider):(r=s._score,i=[s.provider],t.push(i))}),t}_orderedForEach(e,t,i){this._updateScores(e,t);for(const r of this._entries)r._score>0&&i(r)}_updateScores(e,t){const i=this._notebookInfoResolver?.(e.uri),r=i?new l1e(e.uri,e.getLanguageId(),i.uri,i.type,t):new l1e(e.uri,e.getLanguageId(),void 0,void 0,t);if(!this._lastCandidate?.equals(r)){this._lastCandidate=r;for(const s of this._entries)if(s._score=lle(s.selector,r.uri,r.languageId,z3e(e),r.notebookUri,r.notebookType),gFe(s.selector)&&s._score>0)if(t)s._score=0;else{for(const o of this._entries)o._score=0;s._score=1e3;break}this._entries.sort(Vr._compareByScoreAndTime)}}static _compareByScoreAndTime(e,t){return e._scoret._score?-1:ED(e.selector)&&!ED(t.selector)?1:!ED(e.selector)&&ED(t.selector)?-1:e._timet._time?-1:0}}function ED(n){return typeof n=="string"?!1:Array.isArray(n)?n.some(ED):!!n.isBuiltin}class syt{constructor(){this.referenceProvider=new Vr(this._score.bind(this)),this.renameProvider=new Vr(this._score.bind(this)),this.newSymbolNamesProvider=new Vr(this._score.bind(this)),this.codeActionProvider=new Vr(this._score.bind(this)),this.definitionProvider=new Vr(this._score.bind(this)),this.typeDefinitionProvider=new Vr(this._score.bind(this)),this.declarationProvider=new Vr(this._score.bind(this)),this.implementationProvider=new Vr(this._score.bind(this)),this.documentSymbolProvider=new Vr(this._score.bind(this)),this.inlayHintsProvider=new Vr(this._score.bind(this)),this.colorProvider=new Vr(this._score.bind(this)),this.codeLensProvider=new Vr(this._score.bind(this)),this.documentFormattingEditProvider=new Vr(this._score.bind(this)),this.documentRangeFormattingEditProvider=new Vr(this._score.bind(this)),this.onTypeFormattingEditProvider=new Vr(this._score.bind(this)),this.signatureHelpProvider=new Vr(this._score.bind(this)),this.hoverProvider=new Vr(this._score.bind(this)),this.documentHighlightProvider=new Vr(this._score.bind(this)),this.multiDocumentHighlightProvider=new Vr(this._score.bind(this)),this.selectionRangeProvider=new Vr(this._score.bind(this)),this.foldingRangeProvider=new Vr(this._score.bind(this)),this.linkProvider=new Vr(this._score.bind(this)),this.inlineCompletionsProvider=new Vr(this._score.bind(this)),this.inlineEditProvider=new Vr(this._score.bind(this)),this.completionProvider=new Vr(this._score.bind(this)),this.linkedEditingRangeProvider=new Vr(this._score.bind(this)),this.documentRangeSemanticTokensProvider=new Vr(this._score.bind(this)),this.documentSemanticTokensProvider=new Vr(this._score.bind(this)),this.documentDropEditProvider=new Vr(this._score.bind(this)),this.documentPasteEditProvider=new Vr(this._score.bind(this))}_score(e){return this._notebookTypeResolver?.(e)}}Vn(dt,syt,1);function cle(n){return`--vscode-${n.replace(/\./g,"-")}`}function it(n){return`var(${cle(n)})`}function oyt(n,e){return`var(${cle(n)}, ${e})`}function ayt(n){return n!==null&&typeof n=="object"&&"light"in n&&"dark"in n}const pFe={ColorContribution:"base.contributions.colors"},lyt="default";class cyt{constructor(){this._onDidChangeSchema=new fe,this.onDidChangeSchema=this._onDidChangeSchema.event,this.colorSchema={type:"object",properties:{}},this.colorReferenceSchema={type:"string",enum:[],enumDescriptions:[]},this.colorsById={}}registerColor(e,t,i,r=!1,s){const o={id:e,description:i,defaults:t,needsTransparency:r,deprecationMessage:s};this.colorsById[e]=o;const a={type:"string",format:"color-hex",defaultSnippets:[{body:"${1:#ff0000}"}]};return s&&(a.deprecationMessage=s),r&&(a.pattern="^#(?:(?[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$",a.patternErrorMessage=w("transparecyRequired","This color must be transparent or it will obscure content")),this.colorSchema.properties[e]={description:i,oneOf:[a,{type:"string",const:lyt,description:w("useDefault","Use the default color.")}]},this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(i),this._onDidChangeSchema.fire(),e}getColors(){return Object.keys(this.colorsById).map(e=>this.colorsById[e])}resolveDefaultColor(e,t){const i=this.colorsById[e];if(i?.defaults){const r=ayt(i.defaults)?i.defaults[t.type]:i.defaults;return Lf(r,t)}}getColorSchema(){return this.colorSchema}toString(){const e=(t,i)=>{const r=t.indexOf(".")===-1?0:1,s=i.indexOf(".")===-1?0:1;return r!==s?r-s:t.localeCompare(i)};return Object.keys(this.colorsById).sort(e).map(t=>`- \`${t}\`: ${this.colorsById[t].description}`).join(` -`)}}const sW=new cyt;Yr.add(pFe.ColorContribution,sW);function J(n,e,t,i,r){return sW.registerColor(n,e,t,i,r)}function uyt(n,e){switch(n.op){case 0:return Lf(n.value,e)?.darken(n.factor);case 1:return Lf(n.value,e)?.lighten(n.factor);case 2:return Lf(n.value,e)?.transparent(n.factor);case 3:{const t=Lf(n.background,e);return t?Lf(n.value,e)?.makeOpaque(t):Lf(n.value,e)}case 4:for(const t of n.values){const i=Lf(t,e);if(i)return i}return;case 6:return Lf(e.defines(n.if)?n.then:n.else,e);case 5:{const t=Lf(n.value,e);if(!t)return;const i=Lf(n.background,e);return i?t.isDarkerThan(i)?Te.getLighterColor(t,i,n.factor).transparent(n.transparency):Te.getDarkerColor(t,i,n.factor).transparent(n.transparency):t.transparent(n.factor*n.transparency)}default:throw Z$()}}function bC(n,e){return{op:0,value:n,factor:e}}function _g(n,e){return{op:1,value:n,factor:e}}function xn(n,e){return{op:2,value:n,factor:e}}function _N(...n){return{op:4,values:n}}function dyt(n,e,t){return{op:6,if:n,then:e,else:t}}function c1e(n,e,t,i){return{op:5,value:n,background:e,factor:t,transparency:i}}function Lf(n,e){if(n!==null){if(typeof n=="string")return n[0]==="#"?Te.fromHex(n):e.getColor(n);if(n instanceof Te)return n;if(typeof n=="object")return uyt(n,e)}}const mFe="vscode://schemas/workbench-colors",_Fe=Yr.as(eW.JSONContribution);_Fe.registerSchema(mFe,sW.getColorSchema());const u1e=new Ui(()=>_Fe.notifySchemaChanged(mFe),200);sW.onDidChangeSchema(()=>{u1e.isScheduled()||u1e.schedule()});const In=J("foreground",{dark:"#CCCCCC",light:"#616161",hcDark:"#FFFFFF",hcLight:"#292929"},w("foreground","Overall foreground color. This color is only used if not overridden by a component."));J("disabledForeground",{dark:"#CCCCCC80",light:"#61616180",hcDark:"#A5A5A5",hcLight:"#7F7F7F"},w("disabledForeground","Overall foreground for disabled elements. This color is only used if not overridden by a component."));J("errorForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#B5200D"},w("errorForeground","Overall foreground color for error messages. This color is only used if not overridden by a component."));J("descriptionForeground",{light:"#717171",dark:xn(In,.7),hcDark:xn(In,.7),hcLight:xn(In,.7)},w("descriptionForeground","Foreground color for description text providing additional information, for example for a label."));const h8=J("icon.foreground",{dark:"#C5C5C5",light:"#424242",hcDark:"#FFFFFF",hcLight:"#292929"},w("iconForeground","The default color for icons in the workbench.")),Zp=J("focusBorder",{dark:"#007FD4",light:"#0090F1",hcDark:"#F38518",hcLight:"#006BBD"},w("focusBorder","Overall border color for focused elements. This color is only used if not overridden by a component.")),Yn=J("contrastBorder",{light:null,dark:null,hcDark:"#6FC3DF",hcLight:"#0F4A85"},w("contrastBorder","An extra border around elements to separate them from others for greater contrast.")),Ar=J("contrastActiveBorder",{light:null,dark:null,hcDark:Zp,hcLight:Zp},w("activeContrastBorder","An extra border around active elements to separate them from others for greater contrast."));J("selection.background",null,w("selectionBackground","The background color of text selections in the workbench (e.g. for input fields or text areas). Note that this does not apply to selections within the editor."));const hyt=J("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},w("textLinkForeground","Foreground color for links in text."));J("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},w("textLinkActiveForeground","Foreground color for links in text when clicked on and on mouse hover."));J("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hcDark:Te.black,hcLight:"#292929"},w("textSeparatorForeground","Color for text separators."));J("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hcDark:"#000000",hcLight:"#FFFFFF"},w("textPreformatForeground","Foreground color for preformatted text segments."));J("textPreformat.background",{light:"#0000001A",dark:"#FFFFFF1A",hcDark:"#FFFFFF",hcLight:"#09345f"},w("textPreformatBackground","Background color for preformatted text segments."));J("textBlockQuote.background",{light:"#f2f2f2",dark:"#222222",hcDark:null,hcLight:"#F2F2F2"},w("textBlockQuoteBackground","Background color for block quotes in text."));J("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hcDark:Te.white,hcLight:"#292929"},w("textBlockQuoteBorder","Border color for block quotes in text."));J("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hcDark:Te.black,hcLight:"#F2F2F2"},w("textCodeBlockBackground","Background color for code blocks in text."));J("sash.hoverBorder",Zp,w("sashActiveBorder","Border color of active sashes."));const YF=J("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:Te.black,hcLight:"#0F4A85"},w("badgeBackground","Badge background color. Badges are small information labels, e.g. for search results count.")),fyt=J("badge.foreground",{dark:Te.white,light:"#333",hcDark:Te.white,hcLight:Te.white},w("badgeForeground","Badge foreground color. Badges are small information labels, e.g. for search results count.")),ule=J("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hcDark:null,hcLight:null},w("scrollbarShadow","Scrollbar shadow to indicate that the view is scrolled.")),vFe=J("scrollbarSlider.background",{dark:Te.fromHex("#797979").transparent(.4),light:Te.fromHex("#646464").transparent(.4),hcDark:xn(Yn,.6),hcLight:xn(Yn,.4)},w("scrollbarSliderBackground","Scrollbar slider background color.")),bFe=J("scrollbarSlider.hoverBackground",{dark:Te.fromHex("#646464").transparent(.7),light:Te.fromHex("#646464").transparent(.7),hcDark:xn(Yn,.8),hcLight:xn(Yn,.8)},w("scrollbarSliderHoverBackground","Scrollbar slider background color when hovering.")),yFe=J("scrollbarSlider.activeBackground",{dark:Te.fromHex("#BFBFBF").transparent(.4),light:Te.fromHex("#000000").transparent(.6),hcDark:Yn,hcLight:Yn},w("scrollbarSliderActiveBackground","Scrollbar slider background color when clicked on.")),gyt=J("progressBar.background",{dark:Te.fromHex("#0E70C0"),light:Te.fromHex("#0E70C0"),hcDark:Yn,hcLight:Yn},w("progressBarBackground","Background color of the progress bar that can show for long running operations.")),lf=J("editor.background",{light:"#ffffff",dark:"#1E1E1E",hcDark:Te.black,hcLight:Te.white},w("editorBackground","Editor background color.")),cm=J("editor.foreground",{light:"#333333",dark:"#BBBBBB",hcDark:Te.white,hcLight:In},w("editorForeground","Editor default foreground color."));J("editorStickyScroll.background",lf,w("editorStickyScrollBackground","Background color of sticky scroll in the editor"));J("editorStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:null,hcLight:Te.fromHex("#0F4A85").transparent(.1)},w("editorStickyScrollHoverBackground","Background color of sticky scroll on hover in the editor"));J("editorStickyScroll.border",{dark:null,light:null,hcDark:Yn,hcLight:Yn},w("editorStickyScrollBorder","Border color of sticky scroll in the editor"));J("editorStickyScroll.shadow",ule,w("editorStickyScrollShadow"," Shadow color of sticky scroll in the editor"));const ju=J("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#0C141F",hcLight:Te.white},w("editorWidgetBackground","Background color of editor widgets, such as find/replace.")),oW=J("editorWidget.foreground",In,w("editorWidgetForeground","Foreground color of editor widgets, such as find/replace.")),dle=J("editorWidget.border",{dark:"#454545",light:"#C8C8C8",hcDark:Yn,hcLight:Yn},w("editorWidgetBorder","Border color of editor widgets. The color is only used if the widget chooses to have a border and if the color is not overridden by a widget."));J("editorWidget.resizeBorder",null,w("editorWidgetResizeBorder","Border color of the resize bar of editor widgets. The color is only used if the widget chooses to have a resize border and if the color is not overridden by a widget."));J("editorError.background",null,w("editorError.background","Background color of error text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0);const aW=J("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F48771",hcLight:"#B5200D"},w("editorError.foreground","Foreground color of error squigglies in the editor.")),pyt=J("editorError.border",{dark:null,light:null,hcDark:Te.fromHex("#E47777").transparent(.8),hcLight:"#B5200D"},w("errorBorder","If set, color of double underlines for errors in the editor.")),myt=J("editorWarning.background",null,w("editorWarning.background","Background color of warning text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),X_=J("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hcDark:"#FFD370",hcLight:"#895503"},w("editorWarning.foreground","Foreground color of warning squigglies in the editor.")),vN=J("editorWarning.border",{dark:null,light:null,hcDark:Te.fromHex("#FFCC00").transparent(.8),hcLight:Te.fromHex("#FFCC00").transparent(.8)},w("warningBorder","If set, color of double underlines for warnings in the editor."));J("editorInfo.background",null,w("editorInfo.background","Background color of info text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0);const Xp=J("editorInfo.foreground",{dark:"#3794FF",light:"#1a85ff",hcDark:"#3794FF",hcLight:"#1a85ff"},w("editorInfo.foreground","Foreground color of info squigglies in the editor.")),bN=J("editorInfo.border",{dark:null,light:null,hcDark:Te.fromHex("#3794FF").transparent(.8),hcLight:"#292929"},w("infoBorder","If set, color of double underlines for infos in the editor.")),_yt=J("editorHint.foreground",{dark:Te.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hcDark:null,hcLight:null},w("editorHint.foreground","Foreground color of hint squigglies in the editor."));J("editorHint.border",{dark:null,light:null,hcDark:Te.fromHex("#eeeeee").transparent(.8),hcLight:"#292929"},w("hintBorder","If set, color of double underlines for hints in the editor."));const vyt=J("editorLink.activeForeground",{dark:"#4E94CE",light:Te.blue,hcDark:Te.cyan,hcLight:"#292929"},w("activeLinkForeground","Color of active links.")),Iv=J("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hcDark:"#f3f518",hcLight:"#0F4A85"},w("editorSelectionBackground","Color of the editor selection.")),byt=J("editor.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:Te.white},w("editorSelectionForeground","Color of the selected text for high contrast.")),wFe=J("editor.inactiveSelectionBackground",{light:xn(Iv,.5),dark:xn(Iv,.5),hcDark:xn(Iv,.7),hcLight:xn(Iv,.5)},w("editorInactiveSelection","Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations."),!0),hle=J("editor.selectionHighlightBackground",{light:c1e(Iv,lf,.3,.6),dark:c1e(Iv,lf,.3,.6),hcDark:null,hcLight:null},w("editorSelectionHighlight","Color for regions with the same content as the selection. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.selectionHighlightBorder",{light:null,dark:null,hcDark:Ar,hcLight:Ar},w("editorSelectionHighlightBorder","Border color for regions with the same content as the selection."));J("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hcDark:null,hcLight:null},w("editorFindMatch","Color of the current search match."));const yyt=J("editor.findMatchForeground",null,w("editorFindMatchForeground","Text color of the current search match.")),g_=J("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hcDark:null,hcLight:null},w("findMatchHighlight","Color of the other search matches. The color must not be opaque so as not to hide underlying decorations."),!0),wyt=J("editor.findMatchHighlightForeground",null,w("findMatchHighlightForeground","Foreground color of the other search matches."),!0);J("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hcDark:null,hcLight:null},w("findRangeHighlight","Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.findMatchBorder",{light:null,dark:null,hcDark:Ar,hcLight:Ar},w("editorFindMatchBorder","Border color of the current search match."));const Av=J("editor.findMatchHighlightBorder",{light:null,dark:null,hcDark:Ar,hcLight:Ar},w("findMatchHighlightBorder","Border color of the other search matches.")),Cyt=J("editor.findRangeHighlightBorder",{dark:null,light:null,hcDark:xn(Ar,.4),hcLight:xn(Ar,.4)},w("findRangeHighlightBorder","Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hcDark:"#ADD6FF26",hcLight:null},w("hoverHighlight","Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations."),!0);const f8=J("editorHoverWidget.background",ju,w("hoverBackground","Background color of the editor hover."));J("editorHoverWidget.foreground",oW,w("hoverForeground","Foreground color of the editor hover."));const CFe=J("editorHoverWidget.border",dle,w("hoverBorder","Border color of the editor hover."));J("editorHoverWidget.statusBarBackground",{dark:_g(f8,.2),light:bC(f8,.05),hcDark:ju,hcLight:ju},w("statusBarBackground","Background color of the editor hover status bar."));const fle=J("editorInlayHint.foreground",{dark:"#969696",light:"#969696",hcDark:Te.white,hcLight:Te.black},w("editorInlayHintForeground","Foreground color of inline hints")),gle=J("editorInlayHint.background",{dark:xn(YF,.1),light:xn(YF,.1),hcDark:xn(Te.white,.1),hcLight:xn(YF,.1)},w("editorInlayHintBackground","Background color of inline hints")),xyt=J("editorInlayHint.typeForeground",fle,w("editorInlayHintForegroundTypes","Foreground color of inline hints for types")),Syt=J("editorInlayHint.typeBackground",gle,w("editorInlayHintBackgroundTypes","Background color of inline hints for types")),kyt=J("editorInlayHint.parameterForeground",fle,w("editorInlayHintForegroundParameter","Foreground color of inline hints for parameters")),Eyt=J("editorInlayHint.parameterBackground",gle,w("editorInlayHintBackgroundParameter","Background color of inline hints for parameters")),Lyt=J("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hcDark:"#FFCC00",hcLight:"#007ACC"},w("editorLightBulbForeground","The color used for the lightbulb actions icon."));J("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("editorLightBulbAutoFixForeground","The color used for the lightbulb auto fix actions icon."));J("editorLightBulbAi.foreground",Lyt,w("editorLightBulbAiForeground","The color used for the lightbulb AI icon."));J("editor.snippetTabstopHighlightBackground",{dark:new Te(new Jn(124,124,124,.3)),light:new Te(new Jn(10,50,100,.2)),hcDark:new Te(new Jn(124,124,124,.3)),hcLight:new Te(new Jn(10,50,100,.2))},w("snippetTabstopHighlightBackground","Highlight background color of a snippet tabstop."));J("editor.snippetTabstopHighlightBorder",null,w("snippetTabstopHighlightBorder","Highlight border color of a snippet tabstop."));J("editor.snippetFinalTabstopHighlightBackground",null,w("snippetFinalTabstopHighlightBackground","Highlight background color of the final tabstop of a snippet."));J("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new Te(new Jn(10,50,100,.5)),hcDark:"#525252",hcLight:"#292929"},w("snippetFinalTabstopHighlightBorder","Highlight border color of the final tabstop of a snippet."));const zX=new Te(new Jn(155,185,85,.2)),UX=new Te(new Jn(255,0,0,.2)),Tyt=J("diffEditor.insertedTextBackground",{dark:"#9ccc2c33",light:"#9ccc2c40",hcDark:null,hcLight:null},w("diffEditorInserted","Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),Dyt=J("diffEditor.removedTextBackground",{dark:"#ff000033",light:"#ff000033",hcDark:null,hcLight:null},w("diffEditorRemoved","Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations."),!0);J("diffEditor.insertedLineBackground",{dark:zX,light:zX,hcDark:null,hcLight:null},w("diffEditorInsertedLines","Background color for lines that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0);J("diffEditor.removedLineBackground",{dark:UX,light:UX,hcDark:null,hcLight:null},w("diffEditorRemovedLines","Background color for lines that got removed. The color must not be opaque so as not to hide underlying decorations."),!0);J("diffEditorGutter.insertedLineBackground",null,w("diffEditorInsertedLineGutter","Background color for the margin where lines got inserted."));J("diffEditorGutter.removedLineBackground",null,w("diffEditorRemovedLineGutter","Background color for the margin where lines got removed."));const Iyt=J("diffEditorOverview.insertedForeground",null,w("diffEditorOverviewInserted","Diff overview ruler foreground for inserted content.")),Ayt=J("diffEditorOverview.removedForeground",null,w("diffEditorOverviewRemoved","Diff overview ruler foreground for removed content."));J("diffEditor.insertedTextBorder",{dark:null,light:null,hcDark:"#33ff2eff",hcLight:"#374E06"},w("diffEditorInsertedOutline","Outline color for the text that got inserted."));J("diffEditor.removedTextBorder",{dark:null,light:null,hcDark:"#FF008F",hcLight:"#AD0707"},w("diffEditorRemovedOutline","Outline color for text that got removed."));J("diffEditor.border",{dark:null,light:null,hcDark:Yn,hcLight:Yn},w("diffEditorBorder","Border color between the two text editors."));J("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hcDark:null,hcLight:null},w("diffDiagonalFill","Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views."));J("diffEditor.unchangedRegionBackground","sideBar.background",w("diffEditor.unchangedRegionBackground","The background color of unchanged blocks in the diff editor."));J("diffEditor.unchangedRegionForeground","foreground",w("diffEditor.unchangedRegionForeground","The foreground color of unchanged blocks in the diff editor."));J("diffEditor.unchangedCodeBackground",{dark:"#74747429",light:"#b8b8b829",hcDark:null,hcLight:null},w("diffEditor.unchangedCodeBackground","The background color of unchanged code in the diff editor."));const JL=J("widget.shadow",{dark:xn(Te.black,.36),light:xn(Te.black,.16),hcDark:null,hcLight:null},w("widgetShadow","Shadow color of widgets such as find/replace inside the editor.")),xFe=J("widget.border",{dark:null,light:null,hcDark:Yn,hcLight:Yn},w("widgetBorder","Border color of widgets such as find/replace inside the editor.")),d1e=J("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hcDark:null,hcLight:null},w("toolbarHoverBackground","Toolbar background when hovering over actions using the mouse"));J("toolbar.hoverOutline",{dark:null,light:null,hcDark:Ar,hcLight:Ar},w("toolbarHoverOutline","Toolbar outline when hovering over actions using the mouse"));J("toolbar.activeBackground",{dark:_g(d1e,.1),light:bC(d1e,.1),hcDark:null,hcLight:null},w("toolbarActiveBackground","Toolbar background when holding the mouse over actions"));const Nyt=J("breadcrumb.foreground",xn(In,.8),w("breadcrumbsFocusForeground","Color of focused breadcrumb items.")),Ryt=J("breadcrumb.background",lf,w("breadcrumbsBackground","Background color of breadcrumb items.")),h1e=J("breadcrumb.focusForeground",{light:bC(In,.2),dark:_g(In,.1),hcDark:_g(In,.1),hcLight:_g(In,.1)},w("breadcrumbsFocusForeground","Color of focused breadcrumb items.")),Pyt=J("breadcrumb.activeSelectionForeground",{light:bC(In,.2),dark:_g(In,.1),hcDark:_g(In,.1),hcLight:_g(In,.1)},w("breadcrumbsSelectedForeground","Color of selected breadcrumb items."));J("breadcrumbPicker.background",ju,w("breadcrumbsSelectedBackground","Background color of breadcrumb item picker."));const SFe=.5,f1e=Te.fromHex("#40C8AE").transparent(SFe),g1e=Te.fromHex("#40A6FF").transparent(SFe),p1e=Te.fromHex("#606060").transparent(.4),ple=.4,lE=1,jX=J("merge.currentHeaderBackground",{dark:f1e,light:f1e,hcDark:null,hcLight:null},w("mergeCurrentHeaderBackground","Current header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);J("merge.currentContentBackground",xn(jX,ple),w("mergeCurrentContentBackground","Current content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const qX=J("merge.incomingHeaderBackground",{dark:g1e,light:g1e,hcDark:null,hcLight:null},w("mergeIncomingHeaderBackground","Incoming header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);J("merge.incomingContentBackground",xn(qX,ple),w("mergeIncomingContentBackground","Incoming content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const KX=J("merge.commonHeaderBackground",{dark:p1e,light:p1e,hcDark:null,hcLight:null},w("mergeCommonHeaderBackground","Common ancestor header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);J("merge.commonContentBackground",xn(KX,ple),w("mergeCommonContentBackground","Common ancestor content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const cE=J("merge.border",{dark:null,light:null,hcDark:"#C3DF6F",hcLight:"#007ACC"},w("mergeBorder","Border color on headers and the splitter in inline merge-conflicts."));J("editorOverviewRuler.currentContentForeground",{dark:xn(jX,lE),light:xn(jX,lE),hcDark:cE,hcLight:cE},w("overviewRulerCurrentContentForeground","Current overview ruler foreground for inline merge-conflicts."));J("editorOverviewRuler.incomingContentForeground",{dark:xn(qX,lE),light:xn(qX,lE),hcDark:cE,hcLight:cE},w("overviewRulerIncomingContentForeground","Incoming overview ruler foreground for inline merge-conflicts."));J("editorOverviewRuler.commonContentForeground",{dark:xn(KX,lE),light:xn(KX,lE),hcDark:cE,hcLight:cE},w("overviewRulerCommonContentForeground","Common ancestor overview ruler foreground for inline merge-conflicts."));const Uj=J("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hcDark:"#AB5A00",hcLight:"#AB5A00"},w("overviewRulerFindMatchForeground","Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations."),!0),kFe=J("editorOverviewRuler.selectionHighlightForeground","#A0A0A0CC",w("overviewRulerSelectionHighlightForeground","Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations."),!0),Oyt=J("problemsErrorIcon.foreground",aW,w("problemsErrorIconForeground","The color used for the problems error icon.")),Myt=J("problemsWarningIcon.foreground",X_,w("problemsWarningIconForeground","The color used for the problems warning icon.")),Fyt=J("problemsInfoIcon.foreground",Xp,w("problemsInfoIconForeground","The color used for the problems info icon.")),GX=J("minimap.findMatchHighlight",{light:"#d18616",dark:"#d18616",hcDark:"#AB5A00",hcLight:"#0F4A85"},w("minimapFindMatchHighlight","Minimap marker color for find matches."),!0),lW=J("minimap.selectionOccurrenceHighlight",{light:"#c9c9c9",dark:"#676767",hcDark:"#ffffff",hcLight:"#0F4A85"},w("minimapSelectionOccurrenceHighlight","Minimap marker color for repeating editor selections."),!0),m1e=J("minimap.selectionHighlight",{light:"#ADD6FF",dark:"#264F78",hcDark:"#ffffff",hcLight:"#0F4A85"},w("minimapSelectionHighlight","Minimap marker color for the editor selection."),!0),Byt=J("minimap.infoHighlight",{dark:Xp,light:Xp,hcDark:bN,hcLight:bN},w("minimapInfo","Minimap marker color for infos.")),$yt=J("minimap.warningHighlight",{dark:X_,light:X_,hcDark:vN,hcLight:vN},w("overviewRuleWarning","Minimap marker color for warnings.")),Wyt=J("minimap.errorHighlight",{dark:new Te(new Jn(255,18,18,.7)),light:new Te(new Jn(255,18,18,.7)),hcDark:new Te(new Jn(255,50,50,1)),hcLight:"#B5200D"},w("minimapError","Minimap marker color for errors.")),Hyt=J("minimap.background",null,w("minimapBackground","Minimap background color.")),Vyt=J("minimap.foregroundOpacity",Te.fromHex("#000f"),w("minimapForegroundOpacity",'Opacity of foreground elements rendered in the minimap. For example, "#000000c0" will render the elements with 75% opacity.'));J("minimapSlider.background",xn(vFe,.5),w("minimapSliderBackground","Minimap slider background color."));J("minimapSlider.hoverBackground",xn(bFe,.5),w("minimapSliderHoverBackground","Minimap slider background color when hovering."));J("minimapSlider.activeBackground",xn(yFe,.5),w("minimapSliderActiveBackground","Minimap slider background color when clicked on."));J("charts.foreground",In,w("chartsForeground","The foreground color used in charts."));J("charts.lines",xn(In,.5),w("chartsLines","The color used for horizontal lines in charts."));J("charts.red",aW,w("chartsRed","The red color used in chart visualizations."));J("charts.blue",Xp,w("chartsBlue","The blue color used in chart visualizations."));J("charts.yellow",X_,w("chartsYellow","The yellow color used in chart visualizations."));J("charts.orange",GX,w("chartsOrange","The orange color used in chart visualizations."));J("charts.green",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#374e06"},w("chartsGreen","The green color used in chart visualizations."));J("charts.purple",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("chartsPurple","The purple color used in chart visualizations."));const YX=J("input.background",{dark:"#3C3C3C",light:Te.white,hcDark:Te.black,hcLight:Te.white},w("inputBoxBackground","Input box background.")),EFe=J("input.foreground",In,w("inputBoxForeground","Input box foreground.")),LFe=J("input.border",{dark:null,light:null,hcDark:Yn,hcLight:Yn},w("inputBoxBorder","Input box border.")),cW=J("inputOption.activeBorder",{dark:"#007ACC",light:"#007ACC",hcDark:Yn,hcLight:Yn},w("inputBoxActiveOptionBorder","Border color of activated options in input fields.")),zyt=J("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hcDark:null,hcLight:null},w("inputOption.hoverBackground","Background color of activated options in input fields.")),eO=J("inputOption.activeBackground",{dark:xn(Zp,.4),light:xn(Zp,.2),hcDark:Te.transparent,hcLight:Te.transparent},w("inputOption.activeBackground","Background hover color of options in input fields.")),uW=J("inputOption.activeForeground",{dark:Te.white,light:Te.black,hcDark:In,hcLight:In},w("inputOption.activeForeground","Foreground color of activated options in input fields."));J("input.placeholderForeground",{light:xn(In,.5),dark:xn(In,.5),hcDark:xn(In,.7),hcLight:xn(In,.7)},w("inputPlaceholderForeground","Input box foreground color for placeholder text."));const Uyt=J("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hcDark:Te.black,hcLight:Te.white},w("inputValidationInfoBackground","Input validation background color for information severity.")),jyt=J("inputValidation.infoForeground",{dark:null,light:null,hcDark:null,hcLight:In},w("inputValidationInfoForeground","Input validation foreground color for information severity.")),qyt=J("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hcDark:Yn,hcLight:Yn},w("inputValidationInfoBorder","Input validation border color for information severity.")),Kyt=J("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hcDark:Te.black,hcLight:Te.white},w("inputValidationWarningBackground","Input validation background color for warning severity.")),Gyt=J("inputValidation.warningForeground",{dark:null,light:null,hcDark:null,hcLight:In},w("inputValidationWarningForeground","Input validation foreground color for warning severity.")),Yyt=J("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hcDark:Yn,hcLight:Yn},w("inputValidationWarningBorder","Input validation border color for warning severity.")),Zyt=J("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hcDark:Te.black,hcLight:Te.white},w("inputValidationErrorBackground","Input validation background color for error severity.")),Xyt=J("inputValidation.errorForeground",{dark:null,light:null,hcDark:null,hcLight:In},w("inputValidationErrorForeground","Input validation foreground color for error severity.")),Qyt=J("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hcDark:Yn,hcLight:Yn},w("inputValidationErrorBorder","Input validation border color for error severity.")),dW=J("dropdown.background",{dark:"#3C3C3C",light:Te.white,hcDark:Te.black,hcLight:Te.white},w("dropdownBackground","Dropdown background.")),Jyt=J("dropdown.listBackground",{dark:null,light:null,hcDark:Te.black,hcLight:Te.white},w("dropdownListBackground","Dropdown list background.")),mle=J("dropdown.foreground",{dark:"#F0F0F0",light:In,hcDark:Te.white,hcLight:In},w("dropdownForeground","Dropdown foreground.")),_le=J("dropdown.border",{dark:dW,light:"#CECECE",hcDark:Yn,hcLight:Yn},w("dropdownBorder","Dropdown border.")),TFe=J("button.foreground",Te.white,w("buttonForeground","Button foreground color.")),ewt=J("button.separator",xn(TFe,.4),w("buttonSeparator","Button separator color.")),LD=J("button.background",{dark:"#0E639C",light:"#007ACC",hcDark:null,hcLight:"#0F4A85"},w("buttonBackground","Button background color.")),twt=J("button.hoverBackground",{dark:_g(LD,.2),light:bC(LD,.2),hcDark:LD,hcLight:LD},w("buttonHoverBackground","Button background color when hovering.")),nwt=J("button.border",Yn,w("buttonBorder","Button border color.")),iwt=J("button.secondaryForeground",{dark:Te.white,light:Te.white,hcDark:Te.white,hcLight:In},w("buttonSecondaryForeground","Secondary button foreground color.")),ZX=J("button.secondaryBackground",{dark:"#3A3D41",light:"#5F6A79",hcDark:null,hcLight:Te.white},w("buttonSecondaryBackground","Secondary button background color.")),rwt=J("button.secondaryHoverBackground",{dark:_g(ZX,.2),light:bC(ZX,.2),hcDark:null,hcLight:null},w("buttonSecondaryHoverBackground","Secondary button background color when hovering.")),TD=J("radio.activeForeground",uW,w("radioActiveForeground","Foreground color of active radio option.")),swt=J("radio.activeBackground",eO,w("radioBackground","Background color of active radio option.")),owt=J("radio.activeBorder",cW,w("radioActiveBorder","Border color of the active radio option.")),awt=J("radio.inactiveForeground",null,w("radioInactiveForeground","Foreground color of inactive radio option.")),lwt=J("radio.inactiveBackground",null,w("radioInactiveBackground","Background color of inactive radio option.")),cwt=J("radio.inactiveBorder",{light:xn(TD,.2),dark:xn(TD,.2),hcDark:xn(TD,.4),hcLight:xn(TD,.2)},w("radioInactiveBorder","Border color of the inactive radio option.")),uwt=J("radio.inactiveHoverBackground",zyt,w("radioHoverBackground","Background color of inactive active radio option when hovering.")),dwt=J("checkbox.background",dW,w("checkbox.background","Background color of checkbox widget."));J("checkbox.selectBackground",ju,w("checkbox.select.background","Background color of checkbox widget when the element it's in is selected."));const hwt=J("checkbox.foreground",mle,w("checkbox.foreground","Foreground color of checkbox widget.")),fwt=J("checkbox.border",_le,w("checkbox.border","Border color of checkbox widget."));J("checkbox.selectBorder",h8,w("checkbox.select.border","Border color of checkbox widget when the element it's in is selected."));const gwt=J("keybindingLabel.background",{dark:new Te(new Jn(128,128,128,.17)),light:new Te(new Jn(221,221,221,.4)),hcDark:Te.transparent,hcLight:Te.transparent},w("keybindingLabelBackground","Keybinding label background color. The keybinding label is used to represent a keyboard shortcut.")),pwt=J("keybindingLabel.foreground",{dark:Te.fromHex("#CCCCCC"),light:Te.fromHex("#555555"),hcDark:Te.white,hcLight:In},w("keybindingLabelForeground","Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut.")),mwt=J("keybindingLabel.border",{dark:new Te(new Jn(51,51,51,.6)),light:new Te(new Jn(204,204,204,.4)),hcDark:new Te(new Jn(111,195,223)),hcLight:Yn},w("keybindingLabelBorder","Keybinding label border color. The keybinding label is used to represent a keyboard shortcut.")),_wt=J("keybindingLabel.bottomBorder",{dark:new Te(new Jn(68,68,68,.6)),light:new Te(new Jn(187,187,187,.4)),hcDark:new Te(new Jn(111,195,223)),hcLight:In},w("keybindingLabelBottomBorder","Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut.")),vwt=J("list.focusBackground",null,w("listFocusBackground","List/Tree background color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),bwt=J("list.focusForeground",null,w("listFocusForeground","List/Tree foreground color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),ywt=J("list.focusOutline",{dark:Zp,light:Zp,hcDark:Ar,hcLight:Ar},w("listFocusOutline","List/Tree outline color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),wwt=J("list.focusAndSelectionOutline",null,w("listFocusAndSelectionOutline","List/Tree outline color for the focused item when the list/tree is active and selected. An active list/tree has keyboard focus, an inactive does not.")),Rw=J("list.activeSelectionBackground",{dark:"#04395E",light:"#0060C0",hcDark:null,hcLight:Te.fromHex("#0F4A85").transparent(.1)},w("listActiveSelectionBackground","List/Tree background color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),yN=J("list.activeSelectionForeground",{dark:Te.white,light:Te.white,hcDark:null,hcLight:null},w("listActiveSelectionForeground","List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),DFe=J("list.activeSelectionIconForeground",null,w("listActiveSelectionIconForeground","List/Tree icon foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),Cwt=J("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hcDark:null,hcLight:Te.fromHex("#0F4A85").transparent(.1)},w("listInactiveSelectionBackground","List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),xwt=J("list.inactiveSelectionForeground",null,w("listInactiveSelectionForeground","List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),Swt=J("list.inactiveSelectionIconForeground",null,w("listInactiveSelectionIconForeground","List/Tree icon foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),kwt=J("list.inactiveFocusBackground",null,w("listInactiveFocusBackground","List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),Ewt=J("list.inactiveFocusOutline",null,w("listInactiveFocusOutline","List/Tree outline color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),IFe=J("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:Te.white.transparent(.1),hcLight:Te.fromHex("#0F4A85").transparent(.1)},w("listHoverBackground","List/Tree background when hovering over items using the mouse.")),AFe=J("list.hoverForeground",null,w("listHoverForeground","List/Tree foreground when hovering over items using the mouse.")),Lwt=J("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hcDark:null,hcLight:null},w("listDropBackground","List/Tree drag and drop background when moving items over other items when using the mouse.")),Twt=J("list.dropBetweenBackground",{dark:h8,light:h8,hcDark:null,hcLight:null},w("listDropBetweenBackground","List/Tree drag and drop border color when moving items between items when using the mouse.")),xS=J("list.highlightForeground",{dark:"#2AAAFF",light:"#0066BF",hcDark:Zp,hcLight:Zp},w("highlight","List/Tree foreground color of the match highlights when searching inside the list/tree.")),Dwt=J("list.focusHighlightForeground",{dark:xS,light:dyt(Rw,xS,"#BBE7FF"),hcDark:xS,hcLight:xS},w("listFocusHighlightForeground","List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree."));J("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hcDark:"#B89500",hcLight:"#B5200D"},w("invalidItemForeground","List/Tree foreground color for invalid items, for example an unresolved root in explorer."));J("list.errorForeground",{dark:"#F88070",light:"#B01011",hcDark:null,hcLight:null},w("listErrorForeground","Foreground color of list items containing errors."));J("list.warningForeground",{dark:"#CCA700",light:"#855F00",hcDark:null,hcLight:null},w("listWarningForeground","Foreground color of list items containing warnings."));const Iwt=J("listFilterWidget.background",{light:bC(ju,0),dark:_g(ju,0),hcDark:ju,hcLight:ju},w("listFilterWidgetBackground","Background color of the type filter widget in lists and trees.")),Awt=J("listFilterWidget.outline",{dark:Te.transparent,light:Te.transparent,hcDark:"#f38518",hcLight:"#007ACC"},w("listFilterWidgetOutline","Outline color of the type filter widget in lists and trees.")),Nwt=J("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hcDark:Yn,hcLight:Yn},w("listFilterWidgetNoMatchesOutline","Outline color of the type filter widget in lists and trees, when there are no matches.")),Rwt=J("listFilterWidget.shadow",JL,w("listFilterWidgetShadow","Shadow color of the type filter widget in lists and trees."));J("list.filterMatchBackground",{dark:g_,light:g_,hcDark:null,hcLight:null},w("listFilterMatchHighlight","Background color of the filtered match."));J("list.filterMatchBorder",{dark:Av,light:Av,hcDark:Yn,hcLight:Ar},w("listFilterMatchHighlightBorder","Border color of the filtered match."));J("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hcDark:"#A7A8A9",hcLight:"#666666"},w("listDeemphasizedForeground","List/Tree foreground color for items that are deemphasized."));const NFe=J("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},w("treeIndentGuidesStroke","Tree stroke color for the indentation guides.")),Pwt=J("tree.inactiveIndentGuidesStroke",xn(NFe,.4),w("treeInactiveIndentGuidesStroke","Tree stroke color for the indentation guides that are not active.")),Owt=J("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hcDark:null,hcLight:null},w("tableColumnsBorder","Table border color between columns.")),Mwt=J("tree.tableOddRowsBackground",{dark:xn(In,.04),light:xn(In,.04),hcDark:null,hcLight:null},w("tableOddRowsBackgroundColor","Background color for odd table rows."));J("editorActionList.background",ju,w("editorActionListBackground","Action List background color."));J("editorActionList.foreground",oW,w("editorActionListForeground","Action List foreground color."));J("editorActionList.focusForeground",yN,w("editorActionListFocusForeground","Action List foreground color for the focused item."));J("editorActionList.focusBackground",Rw,w("editorActionListFocusBackground","Action List background color for the focused item."));const Fwt=J("menu.border",{dark:null,light:null,hcDark:Yn,hcLight:Yn},w("menuBorder","Border color of menus.")),Bwt=J("menu.foreground",mle,w("menuForeground","Foreground color of menu items.")),$wt=J("menu.background",dW,w("menuBackground","Background color of menu items.")),Wwt=J("menu.selectionForeground",yN,w("menuSelectionForeground","Foreground color of the selected menu item in menus.")),Hwt=J("menu.selectionBackground",Rw,w("menuSelectionBackground","Background color of the selected menu item in menus.")),Vwt=J("menu.selectionBorder",{dark:null,light:null,hcDark:Ar,hcLight:Ar},w("menuSelectionBorder","Border color of the selected menu item in menus.")),zwt=J("menu.separatorBackground",{dark:"#606060",light:"#D4D4D4",hcDark:Yn,hcLight:Yn},w("menuSeparatorBackground","Color of a separator menu item in menus.")),_1e=J("quickInput.background",ju,w("pickerBackground","Quick picker background color. The quick picker widget is the container for pickers like the command palette.")),Uwt=J("quickInput.foreground",oW,w("pickerForeground","Quick picker foreground color. The quick picker widget is the container for pickers like the command palette.")),jwt=J("quickInputTitle.background",{dark:new Te(new Jn(255,255,255,.105)),light:new Te(new Jn(0,0,0,.06)),hcDark:"#000000",hcLight:Te.white},w("pickerTitleBackground","Quick picker title background color. The quick picker widget is the container for pickers like the command palette.")),RFe=J("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hcDark:Te.white,hcLight:"#0F4A85"},w("pickerGroupForeground","Quick picker color for grouping labels.")),qwt=J("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hcDark:Te.white,hcLight:"#0F4A85"},w("pickerGroupBorder","Quick picker color for grouping borders.")),v1e=J("quickInput.list.focusBackground",null,"",void 0,w("quickInput.list.focusBackground deprecation","Please use quickInputList.focusBackground instead")),wN=J("quickInputList.focusForeground",yN,w("quickInput.listFocusForeground","Quick picker foreground color for the focused item.")),vle=J("quickInputList.focusIconForeground",DFe,w("quickInput.listFocusIconForeground","Quick picker icon foreground color for the focused item.")),CN=J("quickInputList.focusBackground",{dark:_N(v1e,Rw),light:_N(v1e,Rw),hcDark:null,hcLight:null},w("quickInput.listFocusBackground","Quick picker background color for the focused item."));J("search.resultsInfoForeground",{light:In,dark:xn(In,.65),hcDark:In,hcLight:In},w("search.resultsInfoForeground","Color of the text in the search viewlet's completion message."));J("searchEditor.findMatchBackground",{light:xn(g_,.66),dark:xn(g_,.66),hcDark:g_,hcLight:g_},w("searchEditor.queryMatch","Color of the Search Editor query matches."));J("searchEditor.findMatchBorder",{light:xn(Av,.66),dark:xn(Av,.66),hcDark:Av,hcLight:Av},w("searchEditor.editorFindMatchBorder","Border color of the Search Editor query matches."));var Kwt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},b1e=function(n,e){return function(t,i){e(t,i,n)}};const um=On("hoverService");let uE=class extends me{get delay(){return this.isInstantlyHovering()?0:this._delay}constructor(e,t,i={},r,s){super(),this.placement=e,this.instantHover=t,this.overrideOptions=i,this.configurationService=r,this.hoverService=s,this.lastHoverHideTime=0,this.timeLimit=200,this.hoverDisposables=this._register(new ke),this._delay=this.configurationService.getValue("workbench.hover.delay"),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("workbench.hover.delay")&&(this._delay=this.configurationService.getValue("workbench.hover.delay"))}))}showHover(e,t){const i=typeof this.overrideOptions=="function"?this.overrideOptions(e,t):this.overrideOptions;this.hoverDisposables.clear();const r=Eo(e.target)?[e.target]:e.target.targetElements;for(const o of r)this.hoverDisposables.add(Jr(o,"keydown",a=>{a.equals(9)&&this.hoverService.hideHover()}));const s=Eo(e.content)?void 0:e.content.toString();return this.hoverService.showHover({...e,...i,persistence:{hideOnKeyDown:!0,...i.persistence},id:s,appearance:{...e.appearance,compact:!0,skipFadeInAnimation:this.isInstantlyHovering(),...i.appearance}},t)}isInstantlyHovering(){return this.instantHover&&Date.now()-this.lastHoverHideTime{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Ot(e)}this._hooks.add(Ce(o,je.POINTER_MOVE,a=>{if(a.buttons!==i){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(Ce(o,je.POINTER_UP,a=>this.stopMonitoring(!0)))}}function Ds(n,e,t){let i=null,r=null;if(typeof t.value=="function"?(i="value",r=t.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(i="get",r=t.get),!r)throw new Error("not supported");const s=`$memoize$${e}`;t[i]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[s]}}var Gwt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gr;(function(n){n.Tap="-monaco-gesturetap",n.Change="-monaco-gesturechange",n.Start="-monaco-gesturestart",n.End="-monaco-gesturesend",n.Contextmenu="-monaco-gesturecontextmenu"})(gr||(gr={}));class Fr extends me{static{this.SCROLL_FRICTION=-.005}static{this.HOLD_DELAY=700}static{this.CLEAR_TAP_COUNT_TIME=400}constructor(){super(),this.dispatched=!1,this.targets=new Rl,this.ignoreTargets=new Rl,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ge.runAndSubscribe($$,({window:e,disposables:t})=>{t.add(Ce(e.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),t.add(Ce(e.document,"touchend",i=>this.onTouchEnd(e,i))),t.add(Ce(e.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Xi,disposables:this._store}))}static addTarget(e){if(!Fr.isTouchDevice())return me.None;Fr.INSTANCE||(Fr.INSTANCE=new Fr);const t=Fr.INSTANCE.targets.push(e);return Lt(t)}static ignoreTarget(e){if(!Fr.isTouchDevice())return me.None;Fr.INSTANCE||(Fr.INSTANCE=new Fr);const t=Fr.INSTANCE.ignoreTargets.push(e);return Lt(t)}static isTouchDevice(){return"ontouchstart"in Xi||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){const t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=e.targetTouches.length;i=Fr.HOLD_DELAY&&Math.abs(l.initialPageX-yd(l.rollingPageX))<30&&Math.abs(l.initialPageY-yd(l.rollingPageY))<30){const u=this.newGestureEvent(gr.Contextmenu,l.initialTarget);u.pageX=yd(l.rollingPageX),u.pageY=yd(l.rollingPageY),this.dispatchEvent(u)}else if(r===1){const u=yd(l.rollingPageX),d=yd(l.rollingPageY),h=yd(l.rollingTimestamps)-l.rollingTimestamps[0],f=u-l.rollingPageX[0],g=d-l.rollingPageY[0],p=[...this.targets].filter(m=>l.initialTarget instanceof Node&&m.contains(l.initialTarget));this.inertia(e,p,i,Math.abs(f)/h,f>0?1:-1,u,Math.abs(g)/h,g>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(gr.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){const i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(e){if(e.type===gr.Tap){const t=new Date().getTime();let i=0;t-this._lastSetTapCountTime>Fr.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=t,e.tapCount=i}else(e.type===gr.Change||e.type===gr.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(const i of this.ignoreTargets)if(i.contains(e.initialTarget))return;const t=[];for(const i of this.targets)if(i.contains(e.initialTarget)){let r=0,s=e.initialTarget;for(;s&&s!==i;)r++,s=s.parentElement;t.push([r,i])}t.sort((i,r)=>i[0]-r[0]);for(const[i,r]of t)r.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,i,r,s,o,a,l,c){this.handle=du(e,()=>{const u=Date.now(),d=u-i;let h=0,f=0,g=!0;r+=Fr.SCROLL_FRICTION*d,a+=Fr.SCROLL_FRICTION*d,r>0&&(g=!1,h=s*r*d),a>0&&(g=!1,f=l*a*d);const p=this.newGestureEvent(gr.Change);p.translationX=h,p.translationY=f,t.forEach(m=>m.dispatchEvent(p)),g||this.inertia(e,t,u,r,s,o+h,a,l,c+f)})}onTouchMove(e){const t=Date.now();for(let i=0,r=e.changedTouches.length;i3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}}Gwt([Ds],Fr,"isTouchDevice",null);let ud=class extends me{onclick(e,t){this._register(Ce(e,je.CLICK,i=>t(new qh(Ot(e),i))))}onmousedown(e,t){this._register(Ce(e,je.MOUSE_DOWN,i=>t(new qh(Ot(e),i))))}onmouseover(e,t){this._register(Ce(e,je.MOUSE_OVER,i=>t(new qh(Ot(e),i))))}onmouseleave(e,t){this._register(Ce(e,je.MOUSE_LEAVE,i=>t(new qh(Ot(e),i))))}onkeydown(e,t){this._register(Ce(e,je.KEY_DOWN,i=>t(new or(i))))}onkeyup(e,t){this._register(Ce(e,je.KEY_UP,i=>t(new or(i))))}oninput(e,t){this._register(Ce(e,je.INPUT,t))}onblur(e,t){this._register(Ce(e,je.BLUR,t))}onfocus(e,t){this._register(Ce(e,je.FOCUS,t))}ignoreGesture(e){return Fr.ignoreTarget(e)}};const dE=11;class Ywt extends ud{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.classList.add(...zt.asClassNameArray(e.icon)),this.domNode.style.position="absolute",this.domNode.style.width=dE+"px",this.domNode.style.height=dE+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new e2),this._register(Jr(this.bgDomNode,je.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Jr(this.domNode,je.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new $ae),this._pointerdownScheduleRepeatTimer=this._register(new hf)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ot(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}}class Zwt extends me{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new hf)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){const e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}}const Xwt=140;class PFe extends ud{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Zwt(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new e2),this._shouldRender=!0,this.domNode=Ci(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Ce(this.domNode.domNode,je.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){const t=this._register(new Ywt(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=Ci(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ce(this.slider.domNode,je.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){const t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);i<=s&&s<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{const s=ms(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}const r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{const o=this._sliderOrthogonalPointerPosition(s),a=Math.abs(o-i);if(Ta&&a>Xwt){this._setDesiredScrollPositionNow(r.getScrollPosition());return}const c=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(c))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){const t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}}const Qwt=20;class hE{constructor(e,t,i,r,s,o){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new hE(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){const t=Math.round(e);return this._visibleSize!==t?(this._visibleSize=t,this._refreshComputedValues(),!0):!1}setScrollSize(e){const t=Math.round(e);return this._scrollSize!==t?(this._scrollSize=t,this._refreshComputedValues(),!0):!1}setScrollPosition(e){const t=Math.round(e);return this._scrollPosition!==t?(this._scrollPosition=t,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,r,s){const o=Math.max(0,i-e),a=Math.max(0,o-2*t),l=r>0&&r>i;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};const c=Math.round(Math.max(Qwt,Math.floor(i*a/r))),u=(a-c)/(r-i),d=s*u;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){const e=hE._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize;let i=this._scrollPosition;return tthis._host.onMouseWheel(new Dw(null,1,0))}),this._createArrow({className:"scra",icon:ze.scrollbarButtonRight,top:a,left:void 0,bottom:void 0,right:o,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Dw(null,-1,0))})}this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}}class eCt extends PFe{constructor(e,t,i){const r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new hE(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows){const o=(t.arrowSize-dE)/2,a=(t.verticalScrollbarSize-dE)/2;this._createArrow({className:"scra",icon:ze.scrollbarButtonUp,top:o,left:a,bottom:void 0,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Dw(null,0,1))}),this._createArrow({className:"scra",icon:ze.scrollbarButtonDown,top:void 0,left:a,bottom:o,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Dw(null,0,-1))})}this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}}class g8{constructor(e,t,i,r,s,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t=t|0,i=i|0,r=r|0,s=s|0,o=o|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,t<0&&(t=0),r+t>i&&(r=i-t),r<0&&(r=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=t,this.scrollWidth=i,this.scrollLeft=r,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,t){return new g8(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new g8(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){const i=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}}class t2 extends me{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new g8(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){const i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){const t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};const i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;t?r=new xN(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{const i=this._state.withScrollPosition(e);this._smoothScrolling=xN.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;const e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){const i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}}class y1e{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}}function jj(n,e){const t=e-n;return function(i){return n+t*iCt(i)}}function tCt(n,e,t){return function(i){return i2.5*i){let s,o;return e0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(i+=.25),t){const r=Math.abs(e.deltaX),s=Math.abs(e.deltaY),o=Math.abs(t.deltaX),a=Math.abs(t.deltaY),l=Math.max(Math.min(r,o),1),c=Math.max(Math.min(s,a),1),u=Math.max(r,o),d=Math.max(s,a);u%l===0&&d%c===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}}class ble extends ud{get options(){return this._options}constructor(e,t,i){super(),this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new fe),e.style.overflow="hidden",this._options=oCt(t),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));const r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new eCt(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Jwt(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="monaco-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.style.overflow="hidden",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ci(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ci(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ci(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new hf),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=er(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Rn&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Dw(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=er(this._mouseWheelToDispose),e)){const i=r=>{this._onMouseWheel(new Dw(r))};this._mouseWheelToDispose.push(Ce(this._listenOnDomNode,je.MOUSE_WHEEL,i,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;const t=hW.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);const a=!Rn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);const l=this._scrollable.getFutureScrollPosition();let c={};if(s){const u=w1e*s,d=l.scrollTop-(u<0?Math.floor(u):Math.ceil(u));this._verticalScrollbar.writeScrollPosition(c,d)}if(o){const u=w1e*o,d=l.scrollLeft-(u<0?Math.floor(u):Math.ceil(u));this._horizontalScrollbar.writeScrollPosition(c,d)}c=this._scrollable.validateScrollPosition(c),(l.scrollLeft!==c.scrollLeft||l.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){const e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,r=i?" left":"",s=t?" top":"",o=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),rCt)}}class OFe extends ble{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;const i=new t2({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:r=>du(Ot(e),r)});super(e,t,i),this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}}class fW extends ble{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}}class tO extends ble{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;const i=new t2({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:r=>du(Ot(e),r)});super(e,t,i),this._register(i),this._element=e,this._register(this.onScroll(r=>{r.scrollTopChanged&&(this._element.scrollTop=r.scrollTop),r.scrollLeftChanged&&(this._element.scrollLeft=r.scrollLeft)})),this.scanDomNode()}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}}function oCt(n){const e={lazyRender:typeof n.lazyRender<"u"?n.lazyRender:!1,className:typeof n.className<"u"?n.className:"",useShadows:typeof n.useShadows<"u"?n.useShadows:!0,handleMouseWheel:typeof n.handleMouseWheel<"u"?n.handleMouseWheel:!0,flipAxes:typeof n.flipAxes<"u"?n.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof n.consumeMouseWheelIfScrollbarIsNeeded<"u"?n.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof n.alwaysConsumeMouseWheel<"u"?n.alwaysConsumeMouseWheel:!1,scrollYToX:typeof n.scrollYToX<"u"?n.scrollYToX:!1,mouseWheelScrollSensitivity:typeof n.mouseWheelScrollSensitivity<"u"?n.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof n.fastScrollSensitivity<"u"?n.fastScrollSensitivity:5,scrollPredominantAxis:typeof n.scrollPredominantAxis<"u"?n.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof n.mouseWheelSmoothScroll<"u"?n.mouseWheelSmoothScroll:!0,arrowSize:typeof n.arrowSize<"u"?n.arrowSize:11,listenOnDomNode:typeof n.listenOnDomNode<"u"?n.listenOnDomNode:null,horizontal:typeof n.horizontal<"u"?n.horizontal:1,horizontalScrollbarSize:typeof n.horizontalScrollbarSize<"u"?n.horizontalScrollbarSize:10,horizontalSliderSize:typeof n.horizontalSliderSize<"u"?n.horizontalSliderSize:0,horizontalHasArrows:typeof n.horizontalHasArrows<"u"?n.horizontalHasArrows:!1,vertical:typeof n.vertical<"u"?n.vertical:1,verticalScrollbarSize:typeof n.verticalScrollbarSize<"u"?n.verticalScrollbarSize:10,verticalHasArrows:typeof n.verticalHasArrows<"u"?n.verticalHasArrows:!1,verticalSliderSize:typeof n.verticalSliderSize<"u"?n.verticalSliderSize:0,scrollByPage:typeof n.scrollByPage<"u"?n.scrollByPage:!1};return e.horizontalSliderSize=typeof n.horizontalSliderSize<"u"?n.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof n.verticalSliderSize<"u"?n.verticalSliderSize:e.verticalScrollbarSize,Rn&&(e.className+=" mac"),e}const A4=qe;let yle=class extends me{constructor(){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new tO(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}};class gW extends me{static render(e,t,i){return new gW(e,t,i)}constructor(e,t,i){super(),this.actionLabel=t.label,this.actionKeybindingLabel=i,this.actionContainer=Ne(e,A4("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=Ne(this.actionContainer,A4("a.action")),this.action.setAttribute("role","button"),t.iconClass&&Ne(this.action,A4(`span.icon.${t.iconClass}`));const r=Ne(this.action,A4("span"));r.textContent=i?`${t.label} (${i})`:t.label,this._store.add(new FFe(this.actionContainer,t.run)),this._store.add(new BFe(this.actionContainer,t.run,[3,10])),this.setEnabled(!0)}setEnabled(e){e?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}}function MFe(n,e){return n&&e?w("acessibleViewHint","Inspect this in the accessible view with {0}.",e):n?w("acessibleViewHintNoKbOpen","Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."):""}class FFe extends me{constructor(e,t){super(),this._register(Ce(e,je.CLICK,i=>{i.stopPropagation(),i.preventDefault(),t(e)}))}}class BFe extends me{constructor(e,t,i){super(),this._register(Ce(e,je.KEY_DOWN,r=>{const s=new or(r);i.some(o=>s.equals(o))&&(r.stopPropagation(),r.preventDefault(),t(e))}))}}const Pc=On("openerService");function aCt(n){let e;const t=/^L?(\d+)(?:,(\d+))?(-L?(\d+)(?:,(\d+))?)?/.exec(n.fragment);return t&&(e={startLineNumber:parseInt(t[1]),startColumn:t[2]?parseInt(t[2]):1,endLineNumber:t[4]?parseInt(t[4]):void 0,endColumn:t[4]?t[5]?parseInt(t[5]):1:void 0},n=n.with({fragment:""})),{selection:e,uri:n}}class $n{get event(){return this.emitter.event}constructor(e,t,i){const r=s=>this.emitter.fire(s);this.emitter=new fe({onWillAddFirstListener:()=>e.addEventListener(t,r,i),onDidRemoveLastListener:()=>e.removeEventListener(t,r,i)})}dispose(){this.emitter.dispose()}}function lCt(n,e={}){const t=wle(e);return t.textContent=n,t}function cCt(n,e={}){const t=wle(e);return $Fe(t,dCt(n,!!e.renderCodeSegments),e.actionHandler,e.renderCodeSegments),t}function wle(n){const e=n.inline?"span":"div",t=document.createElement(e);return n.className&&(t.className=n.className),t}class uCt{constructor(e){this.source=e,this.index=0}eos(){return this.index>=this.source.length}next(){const e=this.peek();return this.advance(),e}peek(){return this.source[this.index]}advance(){this.index++}}function $Fe(n,e,t,i){let r;if(e.type===2)r=document.createTextNode(e.content||"");else if(e.type===3)r=document.createElement("b");else if(e.type===4)r=document.createElement("i");else if(e.type===7&&i)r=document.createElement("code");else if(e.type===5&&t){const s=document.createElement("a");t.disposables.add(Jr(s,"click",o=>{t.callback(String(e.index),o)})),r=s}else e.type===8?r=document.createElement("br"):e.type===1&&(r=n);r&&n!==r&&n.appendChild(r),r&&Array.isArray(e.children)&&e.children.forEach(s=>{$Fe(r,s,t,i)})}function dCt(n,e){const t={type:1,children:[]};let i=0,r=t;const s=[],o=new uCt(n);for(;!o.eos();){let a=o.next();const l=a==="\\"&&XX(o.peek(),e)!==0;if(l&&(a=o.next()),!l&&hCt(a,e)&&a===o.peek()){o.advance(),r.type===2&&(r=s.pop());const c=XX(a,e);if(r.type===c||r.type===5&&c===6)r=s.pop();else{const u={type:c,children:[]};c===5&&(u.index=i,i++),r.children.push(u),s.push(r),r=u}}else if(a===` -`)r.type===2&&(r=s.pop()),r.children.push({type:8});else if(r.type!==2){const c={type:2,content:a};r.children.push(c),s.push(r),r=c}else r.content+=a}return r.type===2&&(r=s.pop()),t}function hCt(n,e){return XX(n,e)!==0}function XX(n,e){switch(n){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return e?7:0;default:return 0}}const fCt=new RegExp(`(\\\\)?\\$\\((${zt.iconNameExpression}(?:${zt.iconModifierExpression})?)\\)`,"g");function ob(n){const e=new Array;let t,i=0,r=0;for(;(t=fCt.exec(n))!==null;){r=t.index||0,i0)return new Uint32Array(e)}let Au=0;const gv=new Uint32Array(10);function pCt(n){if(Au=0,Yg(n,qj,4352),Au>0||(Yg(n,Kj,4449),Au>0)||(Yg(n,Gj,4520),Au>0)||(Yg(n,L1,12593),Au))return gv.subarray(0,Au);if(n>=44032&&n<=55203){const e=n-44032,t=e%588,i=Math.floor(e/588),r=Math.floor(t/28),s=t%28-1;if(i=0&&(s0)return gv.subarray(0,Au)}}function Yg(n,e,t){n>=t&&n>8&&(gv[Au++]=n>>8&255),n>>16&&(gv[Au++]=n>>16&255))}const qj=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),Kj=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),Gj=new Uint16Array([114,82,29810,115,30579,26483,101,102,29286,24934,29030,29798,30822,30310,26470,97,113,29809,116,84,100,119,99,122,120,118,103]),L1=new Uint16Array([114,82,29810,115,30579,26483,101,69,102,29286,24934,29030,29798,30822,30310,26470,97,113,81,29809,116,84,100,119,87,99,122,120,118,103,107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]);function Cle(...n){return function(e,t){for(let i=0,r=n.length;i0?[{start:0,end:e.length}]:[]:null}function HFe(n,e){const t=e.toLowerCase().indexOf(n.toLowerCase());return t===-1?null:[{start:t,end:t+n.length}]}function VFe(n,e){return QX(n.toLowerCase(),e.toLowerCase(),0,0)}function QX(n,e,t,i){if(t===n.length)return[];if(i===e.length)return null;if(n[t]===e[i]){let r=null;return(r=QX(n,e,t+1,i+1))?kle({start:i,end:i+1},r):null}return QX(n,e,t,i+1)}function xle(n){return 97<=n&&n<=122}function pW(n){return 65<=n&&n<=90}function Sle(n){return 48<=n&&n<=57}function zFe(n){return n===32||n===9||n===10||n===13}const UFe=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(n=>UFe.add(n.charCodeAt(0)));function p8(n){return zFe(n)||UFe.has(n)}function C1e(n,e){return n===e||p8(n)&&p8(e)}const Yj=new Map;function x1e(n){if(Yj.has(n))return Yj.get(n);let e;const t=gCt(n);return t&&(e=t),Yj.set(n,e),e}function jFe(n){return xle(n)||pW(n)||Sle(n)}function kle(n,e){return e.length===0?e=[n]:n.end===e[0].start?e[0].start=n.start:e.unshift(n),e}function qFe(n,e){for(let t=e;t0&&!jFe(n.charCodeAt(t-1)))return t}return n.length}function JX(n,e,t,i){if(t===n.length)return[];if(i===e.length)return null;if(n[t]!==e[i].toLowerCase())return null;{let r=null,s=i+1;for(r=JX(n,e,t+1,i+1);!r&&(s=qFe(e,s)).6}function bCt(n){const{upperPercent:e,lowerPercent:t,alphaPercent:i,numericPercent:r}=n;return t>.2&&e<.8&&i>.6&&r<.2}function yCt(n){let e=0,t=0,i=0,r=0;for(let s=0;s60&&(e=e.substring(0,60));const t=_Ct(e);if(!bCt(t)){if(!vCt(t))return null;e=e.toLowerCase()}let i=null,r=0;for(n=n.toLowerCase();r0&&p8(n.charCodeAt(t-1)))return t;return n.length}const CCt=Cle(SN,KFe,HFe),xCt=Cle(SN,KFe,VFe),S1e=new lm(1e4);function k1e(n,e,t=!1){if(typeof n!="string"||typeof e!="string")return null;let i=S1e.get(n);i||(i=new RegExp(l_t(n),"i"),S1e.set(n,i));const r=i.exec(e);return r?[{start:r.index,end:r.index+r[0].length}]:t?xCt(n,e):CCt(n,e)}function SCt(n,e){const t=Ow(n,n.toLowerCase(),0,e,e.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return t?nO(t):null}function kCt(n,e,t,i,r,s){const o=Math.min(13,n.length);for(;t"u")return[];const e=[],t=n[1];for(let i=n.length-1;i>1;i--){const r=n[i]+t,s=e[e.length-1];s&&s.end===r?s.end=r+1:e.push({start:r,end:r+1})}return e}const Nv=128;function Ele(){const n=[],e=[];for(let t=0;t<=Nv;t++)e[t]=0;for(let t=0;t<=Nv;t++)n.push(e.slice(0));return n}function YFe(n){const e=[];for(let t=0;t<=n;t++)e[t]=0;return e}const ZFe=YFe(2*Nv),tQ=YFe(2*Nv),Im=Ele(),T1=Ele(),N4=Ele();function R4(n,e){if(e<0||e>=n.length)return!1;const t=n.codePointAt(e);switch(t){case 95:case 45:case 46:case 32:case 47:case 92:case 39:case 34:case 58:case 36:case 60:case 62:case 40:case 41:case 91:case 93:case 123:case 125:return!0;case void 0:return!1;default:return!!Aae(t)}}function E1e(n,e){if(e<0||e>=n.length)return!1;switch(n.charCodeAt(e)){case 32:case 9:return!0;default:return!1}}function ZF(n,e,t){return e[n]!==t[n]}function ECt(n,e,t,i,r,s,o=!1){for(;eNv?Nv:n.length,l=i.length>Nv?Nv:i.length;if(t>=a||s>=l||a-t>l-s||!ECt(e,t,a,r,s,l,!0))return;LCt(a,l,t,s,e,r);let c=1,u=1,d=t,h=s;const f=[!1];for(c=1,d=t;dv,I=D?T1[c][u-1]+(Im[c][u-1]>0?-5:0):0,O=h>v+1&&Im[c][u-1]>0,M=O?T1[c][u-2]+(Im[c][u-2]>0?-5:0):0;if(O&&(!D||M>=I)&&(!k||M>=L))T1[c][u]=M,N4[c][u]=3,Im[c][u]=0;else if(D&&(!k||I>=L))T1[c][u]=I,N4[c][u]=2,Im[c][u]=0;else if(k)T1[c][u]=L,N4[c][u]=1,Im[c][u]=Im[c-1][u-1]+1;else throw new Error("not possible")}}if(!f[0]&&!o.firstMatchCanBeWeak)return;c--,u--;const g=[T1[c][u],s];let p=0,m=0;for(;c>=1;){let v=u;do{const y=N4[c][v];if(y===3)v=v-2;else if(y===2)v=v-1;else break}while(v>=1);p>1&&e[t+c-1]===r[s+u-1]&&!ZF(v+s-1,i,r)&&p+1>Im[c][v]&&(v=u),v===u?p++:p=1,m||(m=v),c--,u=v-1,g.push(u)}l-s===a&&o.boostFullMatch&&(g[0]+=2);const _=m-a;return g[0]-=_,g}function LCt(n,e,t,i,r,s){let o=n-1,a=e-1;for(;o>=t&&a>=i;)r[o]===s[a]&&(tQ[o]=a,o--),a--}function TCt(n,e,t,i,r,s,o,a,l,c,u){if(e[t]!==s[o])return Number.MIN_SAFE_INTEGER;let d=1,h=!1;return o===t-i?d=n[t]===r[o]?7:5:ZF(o,r,s)&&(o===0||!ZF(o-1,r,s))?(d=n[t]===r[o]?7:5,h=!0):R4(s,o)&&(o===0||!R4(s,o-1))?d=5:(R4(s,o-1)||E1e(s,o-1))&&(d=5,h=!0),d>1&&t===i&&(u[0]=!0),h||(h=ZF(o,r,s)||R4(s,o-1)||E1e(s,o-1)),t===i?o>l&&(d-=h?3:5):c?d+=h?2:0:d+=h?0:1,o+1===a&&(d-=h?3:5),d}function DCt(n,e,t,i,r,s,o){return ICt(n,e,t,i,r,s,!0,o)}function ICt(n,e,t,i,r,s,o,a){let l=Ow(n,e,t,i,r,s,a);if(l&&!o)return l;if(n.length>=3){const c=Math.min(7,n.length-1);for(let u=t+1;ul[0])&&(l=h))}}}return l}function ACt(n,e){if(e+1>=n.length)return;const t=n[e],i=n[e+1];if(t!==i)return n.slice(0,e)+i+t+n.slice(e+2)}const NCt="$(",Tle=new RegExp(`\\$\\(${zt.iconNameExpression}(?:${zt.iconModifierExpression})?\\)`,"g"),RCt=new RegExp(`(\\\\)?${Tle.source}`,"g");function PCt(n){return n.replace(RCt,(e,t)=>t?e:`\\${e}`)}const OCt=new RegExp(`\\\\${Tle.source}`,"g");function MCt(n){return n.replace(OCt,e=>`\\${e}`)}const FCt=new RegExp(`(\\s)?(\\\\)?${Tle.source}(\\s)?`,"g");function Dle(n){return n.indexOf(NCt)===-1?n:n.replace(FCt,(e,t,i,r)=>i?e:t||r||"")}function BCt(n){return n?n.replace(/\$\((.*?)\)/g,(e,t)=>` ${t} `).trim():""}const Zj=new RegExp(`\\$\\(${zt.iconNameCharacter}+\\)`,"g");function DD(n){Zj.lastIndex=0;let e="";const t=[];let i=0;for(;;){const r=Zj.lastIndex,s=Zj.exec(n),o=n.substring(r,s?.index);if(o.length>0){e+=o;for(let a=0;ae1e(i).length&&i[i.length-1]===t}else{const i=e.path;return i.length>1&&i.charCodeAt(i.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(e.fsPath)}}removeTrailingPathSeparator(e,t=fg){return D1e(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=fg){let i=!1;if(e.scheme===sn.file){const r=ip(e);i=r!==void 0&&r.length===e1e(r).length&&r[r.length-1]===t}else{t="/";const r=e.path;i=r.length===1&&r.charCodeAt(r.length-1)===47}return!i&&!D1e(e,t)?e.with({path:e.path+"/"}):e}}const Nr=new $Ct(()=>!1),kN=Nr.isEqual.bind(Nr);Nr.isEqualOrParent.bind(Nr);Nr.getComparisonKey.bind(Nr);const WCt=Nr.basenameOrAuthority.bind(Nr),th=Nr.basename.bind(Nr),HCt=Nr.extname.bind(Nr),mW=Nr.dirname.bind(Nr),VCt=Nr.joinPath.bind(Nr),zCt=Nr.normalizePath.bind(Nr),UCt=Nr.relativePath.bind(Nr),L1e=Nr.resolvePath.bind(Nr);Nr.isAbsolutePath.bind(Nr);const T1e=Nr.isEqualAuthority.bind(Nr),D1e=Nr.hasTrailingPathSeparator.bind(Nr);Nr.removeTrailingPathSeparator.bind(Nr);Nr.addTrailingPathSeparator.bind(Nr);var Tb;(function(n){n.META_DATA_LABEL="label",n.META_DATA_DESCRIPTION="description",n.META_DATA_SIZE="size",n.META_DATA_MIME="mime";function e(t){const i=new Map;t.path.substring(t.path.indexOf(";")+1,t.path.lastIndexOf(";")).split(";").forEach(o=>{const[a,l]=o.split(":");a&&l&&i.set(a,l)});const s=t.path.substring(0,t.path.indexOf(";"));return s&&i.set(n.META_DATA_MIME,s),i}n.parseMetaData=e})(Tb||(Tb={}));class za{constructor(e="",t=!1){if(this.value=e,typeof this.value!="string")throw qd("value");typeof t=="boolean"?(this.isTrusted=t,this.supportThemeIcons=!1,this.supportHtml=!1):(this.isTrusted=t.isTrusted??void 0,this.supportThemeIcons=t.supportThemeIcons??!1,this.supportHtml=t.supportHtml??!1)}appendText(e,t=0){return this.value+=qCt(this.supportThemeIcons?PCt(e):e).replace(/([ \t]+)/g,(i,r)=>" ".repeat(r.length)).replace(/\>/gm,"\\>").replace(/\n/g,t===1?`\\ +`)}isStronglyEqual(e,t){return this.lines[e]===this.lines[t]}}function Wbe(n){let e=0;for(;ex===k))return new j5([],[],!1);if(e.length===1&&e[0].length===0||t.length===1&&t[0].length===0)return new j5([new Ju(new gn(1,e.length+1),new gn(1,t.length+1),[new Mu(new $(1,1,e.length,e[e.length-1].length+1),new $(1,1,t.length,t[t.length-1].length+1))])],[],!1);const r=i.maxComputationTimeMs===0?QP.instance:new jbt(i.maxComputationTimeMs),s=!i.ignoreTrimWhitespace,o=new Map;function a(x){let k=o.get(x);return k===void 0&&(k=o.size,o.set(x,k)),k}const l=e.map(x=>a(x.trim())),c=t.map(x=>a(x.trim())),u=new $be(l,e),d=new $be(c,t),h=u.length+d.length<1700?this.dynamicProgrammingDiffing.compute(u,d,r,(x,k)=>e[x]===t[k]?t[k].length===0?.1:1+Math.log(1+t[k].length):.99):this.myersDiffingAlgorithm.compute(u,d,r);let f=h.diffs,g=h.hitTimeout;f=NX(u,d,f),f=o1t(u,d,f);const p=[],m=x=>{if(s)for(let k=0;kx.seq1Range.start-_===x.seq2Range.start-v);const k=x.seq1Range.start-_;m(k),_=x.seq1Range.endExclusive,v=x.seq2Range.endExclusive;const L=this.refineDiff(e,t,x,r,s);L.hitTimeout&&(g=!0);for(const D of L.mappings)p.push(D)}m(e.length-_);const y=Hbe(p,e,t);let C=[];return i.computeMoves&&(C=this.computeMoves(y,e,t,l,c,r,s)),Nw(()=>{function x(L,D){if(L.lineNumber<1||L.lineNumber>D.length)return!1;const I=D[L.lineNumber-1];return!(L.column<1||L.column>I.length+1)}function k(L,D){return!(L.startLineNumber<1||L.startLineNumber>D.length+1||L.endLineNumberExclusive<1||L.endLineNumberExclusive>D.length+1)}for(const L of y){if(!L.innerChanges)return!1;for(const D of L.innerChanges)if(!(x(D.modifiedRange.getStartPosition(),t)&&x(D.modifiedRange.getEndPosition(),t)&&x(D.originalRange.getStartPosition(),e)&&x(D.originalRange.getEndPosition(),e)))return!1;if(!k(L.modified,t)||!k(L.original,e))return!1}return!0}),new j5(y,C,g)}computeMoves(e,t,i,r,s,o,a){return Zbt(e,t,i,r,s,o).map(u=>{const d=this.refineDiff(t,i,new wo(u.original.toOffsetRange(),u.modified.toOffsetRange()),o,a),h=Hbe(d.mappings,t,i,!0);return new U3e(u,h)})}refineDiff(e,t,i,r,s){const a=c1t(i).toRangeMapping2(e,t),l=new s8(e,a.originalRange,s),c=new s8(t,a.modifiedRange,s),u=l.length+c.length<500?this.dynamicProgrammingDiffing.compute(l,c,r):this.myersDiffingAlgorithm.compute(l,c,r);let d=u.diffs;return d=NX(l,c,d),d=r1t(l,c,d),d=i1t(l,c,d),d=a1t(l,c,d),{mappings:d.map(f=>new Mu(l.translateRange(f.seq1Range),c.translateRange(f.seq2Range))),hitTimeout:u.hitTimeout}}}function Hbe(n,e,t,i=!1){const r=[];for(const s of dae(n.map(o=>l1t(o,e,t)),(o,a)=>o.original.overlapOrTouch(a.original)||o.modified.overlapOrTouch(a.modified))){const o=s[0],a=s[s.length-1];r.push(new Ju(o.original.join(a.original),o.modified.join(a.modified),s.map(l=>l.innerChanges[0])))}return Nw(()=>!i&&r.length>0&&(r[0].modified.startLineNumber!==r[0].original.startLineNumber||t.length-r[r.length-1].modified.endLineNumberExclusive!==e.length-r[r.length-1].original.endLineNumberExclusive)?!1:qae(r,(s,o)=>o.original.startLineNumber-s.original.endLineNumberExclusive===o.modified.startLineNumber-s.modified.endLineNumberExclusive&&s.original.endLineNumberExclusive=t[n.modifiedRange.startLineNumber-1].length&&n.originalRange.startColumn-1>=e[n.originalRange.startLineNumber-1].length&&n.originalRange.startLineNumber<=n.originalRange.endLineNumber+r&&n.modifiedRange.startLineNumber<=n.modifiedRange.endLineNumber+r&&(i=1);const s=new gn(n.originalRange.startLineNumber+i,n.originalRange.endLineNumber+1+r),o=new gn(n.modifiedRange.startLineNumber+i,n.modifiedRange.endLineNumber+1+r);return new Ju(s,o,[n])}function c1t(n){return new gl(new gn(n.seq1Range.start+1,n.seq1Range.endExclusive+1),new gn(n.seq2Range.start+1,n.seq2Range.endExclusive+1))}const Vbe={getLegacy:()=>new Hbt,getDefault:()=>new G3e};function sb(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}class Jn{constructor(e,t,i,r=1){this._rgbaBrand=void 0,this.r=Math.min(255,Math.max(0,e))|0,this.g=Math.min(255,Math.max(0,t))|0,this.b=Math.min(255,Math.max(0,i))|0,this.a=sb(Math.max(Math.min(1,r),0),3)}static equals(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}}class Bh{constructor(e,t,i,r){this._hslaBrand=void 0,this.h=Math.max(Math.min(360,e),0)|0,this.s=sb(Math.max(Math.min(1,t),0),3),this.l=sb(Math.max(Math.min(1,i),0),3),this.a=sb(Math.max(Math.min(1,r),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.l===t.l&&e.a===t.a}static fromRGBA(e){const t=e.r/255,i=e.g/255,r=e.b/255,s=e.a,o=Math.max(t,i,r),a=Math.min(t,i,r);let l=0,c=0;const u=(a+o)/2,d=o-a;if(d>0){switch(c=Math.min(u<=.5?d/(2*u):d/(2-2*u),1),o){case t:l=(i-r)/d+(i1&&(i-=1),i<1/6?e+(t-e)*6*i:i<1/2?t:i<2/3?e+(t-e)*(2/3-i)*6:e}static toRGBA(e){const t=e.h/360,{s:i,l:r,a:s}=e;let o,a,l;if(i===0)o=a=l=r;else{const c=r<.5?r*(1+i):r+i-r*i,u=2*r-c;o=Bh._hue2rgb(u,c,t+1/3),a=Bh._hue2rgb(u,c,t),l=Bh._hue2rgb(u,c,t-1/3)}return new Jn(Math.round(o*255),Math.round(a*255),Math.round(l*255),s)}}class Lp{constructor(e,t,i,r){this._hsvaBrand=void 0,this.h=Math.max(Math.min(360,e),0)|0,this.s=sb(Math.max(Math.min(1,t),0),3),this.v=sb(Math.max(Math.min(1,i),0),3),this.a=sb(Math.max(Math.min(1,r),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.v===t.v&&e.a===t.a}static fromRGBA(e){const t=e.r/255,i=e.g/255,r=e.b/255,s=Math.max(t,i,r),o=Math.min(t,i,r),a=s-o,l=s===0?0:a/s;let c;return a===0?c=0:s===t?c=((i-r)/a%6+6)%6:s===i?c=(r-t)/a+2:c=(t-i)/a+4,new Lp(Math.round(c*60),l,s,e.a)}static toRGBA(e){const{h:t,s:i,v:r,a:s}=e,o=r*i,a=o*(1-Math.abs(t/60%2-1)),l=r-o;let[c,u,d]=[0,0,0];return t<60?(c=o,u=a):t<120?(c=a,u=o):t<180?(u=o,d=a):t<240?(u=a,d=o):t<300?(c=a,d=o):t<=360&&(c=o,d=a),c=Math.round((c+l)*255),u=Math.round((u+l)*255),d=Math.round((d+l)*255),new Jn(c,u,d,s)}}let Te=class aa{static fromHex(e){return aa.Format.CSS.parseHex(e)||aa.red}static equals(e,t){return!e&&!t?!0:!e||!t?!1:e.equals(t)}get hsla(){return this._hsla?this._hsla:Bh.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:Lp.fromRGBA(this.rgba)}constructor(e){if(e)if(e instanceof Jn)this.rgba=e;else if(e instanceof Bh)this._hsla=e,this.rgba=Bh.toRGBA(e);else if(e instanceof Lp)this._hsva=e,this.rgba=Lp.toRGBA(e);else throw new Error("Invalid color ctor argument");else throw new Error("Color needs a value")}equals(e){return!!e&&Jn.equals(this.rgba,e.rgba)&&Bh.equals(this.hsla,e.hsla)&&Lp.equals(this.hsva,e.hsva)}getRelativeLuminance(){const e=aa._relativeLuminanceForComponent(this.rgba.r),t=aa._relativeLuminanceForComponent(this.rgba.g),i=aa._relativeLuminanceForComponent(this.rgba.b),r=.2126*e+.7152*t+.0722*i;return sb(r,4)}static _relativeLuminanceForComponent(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}isLighter(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3>=128}isLighterThan(e){const t=this.getRelativeLuminance(),i=e.getRelativeLuminance();return t>i}isDarkerThan(e){const t=this.getRelativeLuminance(),i=e.getRelativeLuminance();return t0)for(const r of i){const s=r.filter(c=>c!==void 0),o=s[1],a=s[2];if(!a)continue;let l;if(o==="rgb"){const c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*\)$/gm;l=zbe(DT(n,r),IT(a,c),!1)}else if(o==="rgba"){const c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\s*\)$/gm;l=zbe(DT(n,r),IT(a,c),!0)}else if(o==="hsl"){const c=/^\(\s*(36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*\)$/gm;l=Ube(DT(n,r),IT(a,c),!1)}else if(o==="hsla"){const c=/^\(\s*(36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*,\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*,\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\s*\)$/gm;l=Ube(DT(n,r),IT(a,c),!0)}else o==="#"&&(l=u1t(DT(n,r),o+a));l&&e.push(l)}return e}function h1t(n){return!n||typeof n.getValue!="function"||typeof n.positionAt!="function"?[]:d1t(n)}const jbe=new RegExp("\\bMARK:\\s*(.*)$","d"),f1t=/^-+|-+$/g;function g1t(n,e){let t=[];if(e.findRegionSectionHeaders&&e.foldingRules?.markers){const i=p1t(n,e);t=t.concat(i)}if(e.findMarkSectionHeaders){const i=m1t(n);t=t.concat(i)}return t}function p1t(n,e){const t=[],i=n.getLineCount();for(let r=1;r<=i;r++){const s=n.getLineContent(r),o=s.match(e.foldingRules.markers.start);if(o){const a={startLineNumber:r,startColumn:o[0].length+1,endLineNumber:r,endColumn:s.length+1};if(a.endColumn>a.startColumn){const l={range:a,...Z3e(s.substring(o[0].length)),shouldBeInComments:!1};(l.text||l.hasSeparatorLine)&&t.push(l)}}}return t}function m1t(n){const e=[],t=n.getLineCount();for(let i=1;i<=t;i++){const r=n.getLineContent(i);_1t(r,i,e)}return e}function _1t(n,e,t){jbe.lastIndex=0;const i=jbe.exec(n);if(i){const r=i.indices[1][0]+1,s=i.indices[1][1]+1,o={startLineNumber:e,startColumn:r,endLineNumber:e,endColumn:s};if(o.endColumn>o.startColumn){const a={range:o,...Z3e(i[1]),shouldBeInComments:!0};(a.text||a.hasSeparatorLine)&&t.push(a)}}}function Z3e(n){n=n.trim();const e=n.startsWith("-");return n=n.replace(f1t,""),{text:n,hasSeparatorLine:e}}class v1t{constructor(e){this.values=e,this.prefixSum=new Uint32Array(e.length),this.prefixSumValidIndex=new Int32Array(1),this.prefixSumValidIndex[0]=-1}insertValues(e,t){e=hx(e);const i=this.values,r=this.prefixSum,s=t.length;return s===0?!1:(this.values=new Uint32Array(i.length+s),this.values.set(i.subarray(0,e),0),this.values.set(i.subarray(e),e+s),this.values.set(t,e),e-1=0&&this.prefixSum.set(r.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}setValue(e,t){return e=hx(e),t=hx(t),this.values[e]===t?!1:(this.values[e]=t,e-1=i.length)return!1;const s=i.length-e;return t>=s&&(t=s),t===0?!1:(this.values=new Uint32Array(i.length-t),this.values.set(i.subarray(0,e),0),this.values.set(i.subarray(e+t),e),this.prefixSum=new Uint32Array(this.values.length),e-1=0&&this.prefixSum.set(r.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}getTotalSum(){return this.values.length===0?0:this._getPrefixSum(this.values.length-1)}getPrefixSum(e){return e<0?0:(e=hx(e),this._getPrefixSum(e))}_getPrefixSum(e){if(e<=this.prefixSumValidIndex[0])return this.prefixSum[e];let t=this.prefixSumValidIndex[0]+1;t===0&&(this.prefixSum[0]=this.values[0],t++),e>=this.values.length&&(e=this.values.length-1);for(let i=t;i<=e;i++)this.prefixSum[i]=this.prefixSum[i-1]+this.values[i];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],e),this.prefixSum[e]}getIndexOf(e){e=Math.floor(e),this.getTotalSum();let t=0,i=this.values.length-1,r=0,s=0,o=0;for(;t<=i;)if(r=t+(i-t)/2|0,s=this.prefixSum[r],o=s-this.values[r],e=s)t=r+1;else break;return new X3e(r,e-o)}}class b1t{constructor(e){this._values=e,this._isValid=!1,this._validEndIndex=-1,this._prefixSum=[],this._indexBySum=[]}getTotalSum(){return this._ensureValid(),this._indexBySum.length}getPrefixSum(e){return this._ensureValid(),e===0?0:this._prefixSum[e-1]}getIndexOf(e){this._ensureValid();const t=this._indexBySum[e],i=t>0?this._prefixSum[t-1]:0;return new X3e(t,e-i)}removeValues(e,t){this._values.splice(e,t),this._invalidate(e)}insertValues(e,t){this._values=I$(this._values,e,t),this._invalidate(e)}_invalidate(e){this._isValid=!1,this._validEndIndex=Math.min(this._validEndIndex,e-1)}_ensureValid(){if(!this._isValid){for(let e=this._validEndIndex+1,t=this._values.length;e0?this._prefixSum[e-1]:0;this._prefixSum[e]=r+i;for(let s=0;sthis._checkStopModelSync(),Math.round(qbe/2)),this._register(r)}}dispose(){for(const e in this._syncedModels)er(this._syncedModels[e]);this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),super.dispose()}ensureSyncedResources(e,t=!1){for(const i of e){const r=i.toString();this._syncedModels[r]||this._beginModelSync(i,t),this._syncedModels[r]&&(this._syncedModelsLastUsedTime[r]=new Date().getTime())}}_checkStopModelSync(){const e=new Date().getTime(),t=[];for(const i in this._syncedModelsLastUsedTime)e-this._syncedModelsLastUsedTime[i]>qbe&&t.push(i);for(const i of t)this._stopModelSync(i)}_beginModelSync(e,t){const i=this._modelService.getModel(e);if(!i||!t&&i.isTooLargeForSyncing())return;const r=e.toString();this._proxy.$acceptNewModel({url:i.uri.toString(),lines:i.getLinesContent(),EOL:i.getEOL(),versionId:i.getVersionId()});const s=new ke;s.add(i.onDidChangeContent(o=>{this._proxy.$acceptModelChanged(r.toString(),o)})),s.add(i.onWillDispose(()=>{this._stopModelSync(r)})),s.add(Lt(()=>{this._proxy.$acceptRemovedModel(r)})),this._syncedModels[r]=s}_stopModelSync(e){const t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],er(t)}}class C1t{constructor(){this._models=Object.create(null)}getModel(e){return this._models[e]}getModels(){const e=[];return Object.keys(this._models).forEach(t=>e.push(this._models[t])),e}$acceptNewModel(e){this._models[e.url]=new x1t(Pt.parse(e.url),e.lines,e.EOL,e.versionId)}$acceptModelChanged(e,t){if(!this._models[e])return;this._models[e].onEvents(t)}$acceptRemovedModel(e){this._models[e]&&delete this._models[e]}}class x1t extends y1t{get uri(){return this._uri}get eol(){return this._eol}getValue(){return this.getText()}findMatches(e){const t=[];for(let i=0;ithis._lines.length)t=this._lines.length,i=this._lines[t-1].length+1,r=!0;else{const s=this._lines[t-1].length+1;i<1?(i=1,r=!0):i>s&&(i=s,r=!0)}return r?{lineNumber:t,column:i}:e}}class S1t{constructor(){this._workerTextModelSyncServer=new C1t}dispose(){}_getModel(e){return this._workerTextModelSyncServer.getModel(e)}_getModels(){return this._workerTextModelSyncServer.getModels()}$acceptNewModel(e){this._workerTextModelSyncServer.$acceptNewModel(e)}$acceptModelChanged(e,t){this._workerTextModelSyncServer.$acceptModelChanged(e,t)}$acceptRemovedModel(e){this._workerTextModelSyncServer.$acceptRemovedModel(e)}async $computeUnicodeHighlights(e,t,i){const r=this._getModel(e);return r?Jae.computeUnicodeHighlights(r,t,i):{ranges:[],hasMore:!1,ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0}}async $findSectionHeaders(e,t){const i=this._getModel(e);return i?g1t(i,t):[]}async $computeDiff(e,t,i,r){const s=this._getModel(e),o=this._getModel(t);return!s||!o?null:q5.computeDiff(s,o,i,r)}static computeDiff(e,t,i,r){const s=r==="advanced"?Vbe.getDefault():Vbe.getLegacy(),o=e.getLinesContent(),a=t.getLinesContent(),l=s.computeDiff(o,a,i),c=l.changes.length>0?!1:this._modelsAreIdentical(e,t);function u(d){return d.map(h=>[h.original.startLineNumber,h.original.endLineNumberExclusive,h.modified.startLineNumber,h.modified.endLineNumberExclusive,h.innerChanges?.map(f=>[f.originalRange.startLineNumber,f.originalRange.startColumn,f.originalRange.endLineNumber,f.originalRange.endColumn,f.modifiedRange.startLineNumber,f.modifiedRange.startColumn,f.modifiedRange.endLineNumber,f.modifiedRange.endColumn])])}return{identical:c,quitEarly:l.hitTimeout,changes:u(l.changes),moves:l.moves.map(d=>[d.lineRangeMapping.original.startLineNumber,d.lineRangeMapping.original.endLineNumberExclusive,d.lineRangeMapping.modified.startLineNumber,d.lineRangeMapping.modified.endLineNumberExclusive,u(d.changes)])}}static _modelsAreIdentical(e,t){const i=e.getLineCount(),r=t.getLineCount();if(i!==r)return!1;for(let s=1;s<=i;s++){const o=e.getLineContent(s),a=t.getLineContent(s);if(o!==a)return!1}return!0}static{this._diffLimit=1e5}async $computeMoreMinimalEdits(e,t,i){const r=this._getModel(e);if(!r)return t;const s=[];let o;t=t.slice(0).sort((l,c)=>{if(l.range&&c.range)return $.compareRangesUsingStarts(l.range,c.range);const u=l.range?0:1,d=c.range?0:1;return u-d});let a=0;for(let l=1;lq5._diffLimit){s.push({range:l,text:c});continue}const h=hbt(d,c,i),f=r.offsetAt($.lift(l).getStartPosition());for(const g of h){const p=r.positionAt(f+g.originalStart),m=r.positionAt(f+g.originalStart+g.originalLength),_={text:c.substr(g.modifiedStart,g.modifiedLength),range:{startLineNumber:p.lineNumber,startColumn:p.column,endLineNumber:m.lineNumber,endColumn:m.column}};r.getValueInRange(_.range)!==_.text&&s.push(_)}}return typeof o=="number"&&s.push({eol:o,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),s}async $computeLinks(e){const t=this._getModel(e);return t?_bt(t):null}async $computeDefaultDocumentColors(e){const t=this._getModel(e);return t?h1t(t):null}static{this._suggestionsLimit=1e4}async $textualSuggest(e,t,i,r){const s=new Bo,o=new RegExp(i,r),a=new Set;e:for(const l of e){const c=this._getModel(l);if(c){for(const u of c.words(o))if(!(u===t||!isNaN(Number(u)))&&(a.add(u),a.size>q5._suggestionsLimit))break e}}return{words:Array.from(a),duration:s.elapsed()}}async $computeWordRanges(e,t,i,r){const s=this._getModel(e);if(!s)return Object.create(null);const o=new RegExp(i,r),a=Object.create(null);for(let l=t.startLineNumber;lthis._host.$fhr(a,l)),getMirrorModels:()=>this._getModels()};return this._foreignModuleFactory?(this._foreignModule=this._foreignModuleFactory(o,t),Promise.resolve(aZ(this._foreignModule))):new Promise((a,l)=>{const c=u=>{this._foreignModule=u.create(o,t),a(aZ(this._foreignModule))};{const u=M$.asBrowserUri(`${e}.js`).toString(!0);At(()=>import(`${u}`),[],import.meta.url).then(c).catch(l)}})}$fmr(e,t){if(!this._foreignModule||typeof this._foreignModule[e]!="function")return Promise.reject(new Error("Missing requestHandler or method: "+e));try{return Promise.resolve(this._foreignModule[e].apply(this._foreignModule,t))}catch(i){return Promise.reject(i)}}}typeof importScripts=="function"&&(globalThis.monaco=F4e());const nW=On("textResourceConfigurationService"),Q3e=On("textResourcePropertiesService"),dt=On("ILanguageFeaturesService");var rle=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},cy=function(n,e){return function(t,i){e(t,i,n)}};const Kbe=5*60*1e3;function uy(n,e){const t=n.getModel(e);return!(!t||t.isTooLargeForSyncing())}let RX=class extends me{constructor(e,t,i,r,s,o){super(),this._languageConfigurationService=s,this._modelService=t,this._workerManager=this._register(new PX(e,this._modelService)),this._logService=r,this._register(o.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:async(a,l)=>{if(!uy(this._modelService,a.uri))return Promise.resolve({links:[]});const u=await(await this._workerWithResources([a.uri])).$computeLinks(a.uri.toString());return u&&{links:u}}})),this._register(o.completionProvider.register("*",new k1t(this._workerManager,i,this._modelService,this._languageConfigurationService)))}dispose(){super.dispose()}canComputeUnicodeHighlights(e){return uy(this._modelService,e)}async computedUnicodeHighlights(e,t,i){return(await this._workerWithResources([e])).$computeUnicodeHighlights(e.toString(),t,i)}async computeDiff(e,t,i,r){const o=await(await this._workerWithResources([e,t],!0)).$computeDiff(e.toString(),t.toString(),i,r);if(!o)return null;return{identical:o.identical,quitEarly:o.quitEarly,changes:l(o.changes),moves:o.moves.map(c=>new U3e(new gl(new gn(c[0],c[1]),new gn(c[2],c[3])),l(c[4])))};function l(c){return c.map(u=>new Ju(new gn(u[0],u[1]),new gn(u[2],u[3]),u[4]?.map(d=>new Mu(new $(d[0],d[1],d[2],d[3]),new $(d[4],d[5],d[6],d[7])))))}}async computeMoreMinimalEdits(e,t,i=!1){if(bl(t)){if(!uy(this._modelService,e))return Promise.resolve(t);const r=Bo.create(),s=this._workerWithResources([e]).then(o=>o.$computeMoreMinimalEdits(e.toString(),t,i));return s.finally(()=>this._logService.trace("FORMAT#computeMoreMinimalEdits",e.toString(!0),r.elapsed())),Promise.race([s,Y_(1e3).then(()=>t)])}else return Promise.resolve(void 0)}canNavigateValueSet(e){return uy(this._modelService,e)}async navigateValueSet(e,t,i){const r=this._modelService.getModel(e);if(!r)return null;const s=this._languageConfigurationService.getLanguageConfiguration(r.getLanguageId()).getWordDefinition(),o=s.source,a=s.flags;return(await this._workerWithResources([e])).$navigateValueSet(e.toString(),t,i,o,a)}canComputeWordRanges(e){return uy(this._modelService,e)}async computeWordRanges(e,t){const i=this._modelService.getModel(e);if(!i)return Promise.resolve(null);const r=this._languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition(),s=r.source,o=r.flags;return(await this._workerWithResources([e])).$computeWordRanges(e.toString(),t,s,o)}async findSectionHeaders(e,t){return(await this._workerWithResources([e])).$findSectionHeaders(e.toString(),t)}async computeDefaultDocumentColors(e){return(await this._workerWithResources([e])).$computeDefaultDocumentColors(e.toString())}async _workerWithResources(e,t=!1){return await(await this._workerManager.withWorker()).workerWithSyncedResources(e,t)}};RX=rle([cy(1,Sr),cy(2,nW),cy(3,Da),cy(4,Zr),cy(5,dt)],RX);class k1t{constructor(e,t,i,r){this.languageConfigurationService=r,this._debugDisplayName="wordbasedCompletions",this._workerManager=e,this._configurationService=t,this._modelService=i}async provideCompletionItems(e,t){const i=this._configurationService.getValue(e.uri,t,"editor");if(i.wordBasedSuggestions==="off")return;const r=[];if(i.wordBasedSuggestions==="currentDocument")uy(this._modelService,e.uri)&&r.push(e.uri);else for(const d of this._modelService.getModels())uy(this._modelService,d.uri)&&(d===e?r.unshift(d.uri):(i.wordBasedSuggestions==="allDocuments"||d.getLanguageId()===e.getLanguageId())&&r.push(d.uri));if(r.length===0)return;const s=this.languageConfigurationService.getLanguageConfiguration(e.getLanguageId()).getWordDefinition(),o=e.getWordAtPosition(t),a=o?new $(t.lineNumber,o.startColumn,t.lineNumber,o.endColumn):$.fromPositions(t),l=a.setEndPosition(t.lineNumber,t.column),u=await(await this._workerManager.withWorker()).textualSuggest(r,o?.word,s);if(u)return{duration:u.duration,suggestions:u.words.map(d=>({kind:18,label:d,insertText:d,range:{insert:l,replace:a}}))}}}let PX=class extends me{constructor(e,t){super(),this._workerDescriptor=e,this._modelService=t,this._editorWorkerClient=null,this._lastWorkerUsedTime=new Date().getTime(),this._register(new $ae).cancelAndSet(()=>this._checkStopIdleWorker(),Math.round(Kbe/2),Xi),this._register(this._modelService.onModelRemoved(r=>this._checkStopEmptyWorker()))}dispose(){this._editorWorkerClient&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null),super.dispose()}_checkStopEmptyWorker(){if(!this._editorWorkerClient)return;this._modelService.getModels().length===0&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}_checkStopIdleWorker(){if(!this._editorWorkerClient)return;new Date().getTime()-this._lastWorkerUsedTime>Kbe&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=new Date().getTime(),this._editorWorkerClient||(this._editorWorkerClient=new o8(this._workerDescriptor,!1,this._modelService)),Promise.resolve(this._editorWorkerClient)}};PX=rle([cy(1,Sr)],PX);class E1t{constructor(e){this._instance=e,this.proxy=this._instance}dispose(){this._instance.dispose()}setChannel(e,t){throw new Error("Not supported")}}let o8=class extends me{constructor(e,t,i){super(),this._workerDescriptor=e,this._disposed=!1,this._modelService=i,this._keepIdleModels=t,this._worker=null,this._modelManager=null}fhr(e,t){throw new Error("Not implemented!")}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(Dvt(this._workerDescriptor)),r8.setChannel(this._worker,this._createEditorWorkerHost())}catch(e){kX(e),this._worker=this._createFallbackLocalWorker()}return this._worker}async _getProxy(){try{const e=this._getOrCreateWorker().proxy;return await e.$ping(),e}catch(e){return kX(e),this._worker=this._createFallbackLocalWorker(),this._worker.proxy}}_createFallbackLocalWorker(){return new E1t(new q5(this._createEditorWorkerHost(),null))}_createEditorWorkerHost(){return{$fhr:(e,t)=>this.fhr(e,t)}}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new w1t(e,this._modelService,this._keepIdleModels))),this._modelManager}async workerWithSyncedResources(e,t=!1){if(this._disposed)return Promise.reject(gmt());const i=await this._getProxy();return this._getOrCreateModelManager(i).ensureSyncedResources(e,t),i}async textualSuggest(e,t,i){const r=await this.workerWithSyncedResources(e),s=i.source,o=i.flags;return r.$textualSuggest(e.map(a=>a.toString()),t,s,o)}dispose(){super.dispose(),this._disposed=!0}};o8=rle([cy(2,Sr)],o8);var Wd;(function(n){n.DARK="dark",n.LIGHT="light",n.HIGH_CONTRAST_DARK="hcDark",n.HIGH_CONTRAST_LIGHT="hcLight"})(Wd||(Wd={}));function mg(n){return n===Wd.HIGH_CONTRAST_DARK||n===Wd.HIGH_CONTRAST_LIGHT}function aE(n){return n===Wd.DARK||n===Wd.HIGH_CONTRAST_DARK}const go=On("themeService");function ss(n){return{id:n}}function OX(n){switch(n){case Wd.DARK:return"vs-dark";case Wd.HIGH_CONTRAST_DARK:return"hc-black";case Wd.HIGH_CONTRAST_LIGHT:return"hc-light";default:return"vs"}}const J3e={ThemingContribution:"base.contributions.theming"};class L1t{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new fe}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),Lt(()=>{const t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)})}getThemingParticipants(){return this.themingParticipants}}const e5e=new L1t;Yr.add(J3e.ThemingContribution,e5e);function dh(n){return e5e.onColorThemeChange(n)}class T1t extends me{constructor(e){super(),this.themeService=e,this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(t=>this.onThemeChange(t)))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}}var D1t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},I1t=function(n,e){return function(t,i){e(t,i,n)}};let MX=class extends me{constructor(e){super(),this._themeService=e,this._onWillCreateCodeEditor=this._register(new fe),this._onCodeEditorAdd=this._register(new fe),this.onCodeEditorAdd=this._onCodeEditorAdd.event,this._onCodeEditorRemove=this._register(new fe),this.onCodeEditorRemove=this._onCodeEditorRemove.event,this._onWillCreateDiffEditor=this._register(new fe),this._onDiffEditorAdd=this._register(new fe),this.onDiffEditorAdd=this._onDiffEditorAdd.event,this._onDiffEditorRemove=this._register(new fe),this.onDiffEditorRemove=this._onDiffEditorRemove.event,this._decorationOptionProviders=new Map,this._codeEditorOpenHandlers=new Rl,this._modelProperties=new Map,this._codeEditors=Object.create(null),this._diffEditors=Object.create(null),this._globalStyleSheet=null}willCreateCodeEditor(){this._onWillCreateCodeEditor.fire()}addCodeEditor(e){this._codeEditors[e.getId()]=e,this._onCodeEditorAdd.fire(e)}removeCodeEditor(e){delete this._codeEditors[e.getId()]&&this._onCodeEditorRemove.fire(e)}listCodeEditors(){return Object.keys(this._codeEditors).map(e=>this._codeEditors[e])}willCreateDiffEditor(){this._onWillCreateDiffEditor.fire()}addDiffEditor(e){this._diffEditors[e.getId()]=e,this._onDiffEditorAdd.fire(e)}listDiffEditors(){return Object.keys(this._diffEditors).map(e=>this._diffEditors[e])}getFocusedCodeEditor(){let e=null;const t=this.listCodeEditors();for(const i of t){if(i.hasTextFocus())return i;i.hasWidgetFocus()&&(e=i)}return e}removeDecorationType(e){const t=this._decorationOptionProviders.get(e);t&&(t.refCount--,t.refCount<=0&&(this._decorationOptionProviders.delete(e),t.dispose(),this.listCodeEditors().forEach(i=>i.removeDecorationsByType(e))))}setModelProperty(e,t,i){const r=e.toString();let s;this._modelProperties.has(r)?s=this._modelProperties.get(r):(s=new Map,this._modelProperties.set(r,s)),s.set(t,i)}getModelProperty(e,t){const i=e.toString();if(this._modelProperties.has(i))return this._modelProperties.get(i).get(t)}async openCodeEditor(e,t,i){for(const r of this._codeEditorOpenHandlers){const s=await r(e,t,i);if(s!==null)return s}return null}registerCodeEditorOpenHandler(e){const t=this._codeEditorOpenHandlers.unshift(e);return Lt(t)}};MX=D1t([I1t(0,go)],MX);var A1t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Gbe=function(n,e){return function(t,i){e(t,i,n)}};let a8=class extends MX{constructor(e,t){super(t),this._register(this.onCodeEditorAdd(()=>this._checkContextKey())),this._register(this.onCodeEditorRemove(()=>this._checkContextKey())),this._editorIsOpen=e.createKey("editorIsOpen",!1),this._activeCodeEditor=null,this._register(this.registerCodeEditorOpenHandler(async(i,r,s)=>r?this.doOpenEditor(r,i):null))}_checkContextKey(){let e=!1;for(const t of this.listCodeEditors())if(!t.isSimpleWidget){e=!0;break}this._editorIsOpen.set(e)}setActiveCodeEditor(e){this._activeCodeEditor=e}getActiveCodeEditor(){return this._activeCodeEditor}doOpenEditor(e,t){if(!this.findModel(e,t.resource)){if(t.resource){const s=t.resource.scheme;if(s===sn.http||s===sn.https)return v3e(t.resource.toString()),e}return null}const r=t.options?t.options.selection:null;if(r)if(typeof r.endLineNumber=="number"&&typeof r.endColumn=="number")e.setSelection(r),e.revealRangeInCenter(r,1);else{const s={lineNumber:r.startLineNumber,column:r.startColumn};e.setPosition(s),e.revealPositionInCenter(s,1)}return e}findModel(e,t){const i=e.getModel();return i&&i.uri.toString()!==t.toString()?null:i}};a8=A1t([Gbe(0,jt),Gbe(1,go)],a8);Vn(ai,a8,0);const Zb=On("layoutService");var t5e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},n5e=function(n,e){return function(t,i){e(t,i,n)}};let l8=class{get mainContainer(){return hae(this._codeEditorService.listCodeEditors())?.getContainerDomNode()??Xi.document.body}get activeContainer(){return(this._codeEditorService.getFocusedCodeEditor()??this._codeEditorService.getActiveCodeEditor())?.getContainerDomNode()??this.mainContainer}get mainContainerDimension(){return kb(this.mainContainer)}get activeContainerDimension(){return kb(this.activeContainer)}get containers(){return rf(this._codeEditorService.listCodeEditors().map(e=>e.getContainerDomNode()))}getContainer(){return this.activeContainer}whenContainerStylesLoaded(){}focus(){this._codeEditorService.getFocusedCodeEditor()?.focus()}constructor(e){this._codeEditorService=e,this.onDidLayoutMainContainer=Ge.None,this.onDidLayoutActiveContainer=Ge.None,this.onDidLayoutContainer=Ge.None,this.onDidChangeActiveContainer=Ge.None,this.onDidAddContainer=Ge.None,this.mainContainerOffset={top:0,quickPickTop:0},this.activeContainerOffset={top:0,quickPickTop:0}}};l8=t5e([n5e(0,ai)],l8);let FX=class extends l8{get mainContainer(){return this._container}constructor(e,t){super(t),this._container=e}};FX=t5e([n5e(1,ai)],FX);Vn(Zb,l8,1);var mN;(function(n){n[n.Ignore=0]="Ignore",n[n.Info=1]="Info",n[n.Warning=2]="Warning",n[n.Error=3]="Error"})(mN||(mN={}));(function(n){const e="error",t="warning",i="warn",r="info",s="ignore";function o(l){return l?bS(e,l)?n.Error:bS(t,l)||bS(i,l)?n.Warning:bS(r,l)?n.Info:n.Ignore:n.Ignore}n.fromValue=o;function a(l){switch(l){case n.Error:return e;case n.Warning:return t;case n.Info:return r;default:return s}}n.toString=a})(mN||(mN={}));const Ss=mN,JP=On("dialogService");var iW=Ss;const Ts=On("notificationService");class N1t{}const sle=On("undoRedoService");class i5e{constructor(e,t){this.resource=e,this.elements=t}}class c8{static{this._ID=0}constructor(){this.id=c8._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}static{this.None=new c8}}class fv{static{this._ID=0}constructor(){this.id=fv._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}static{this.None=new fv}}var R1t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ybe=function(n,e){return function(t,i){e(t,i,n)}};function L4(n){return n.scheme===sn.file?n.fsPath:n.path}let r5e=0;class T4{constructor(e,t,i,r,s,o,a){this.id=++r5e,this.type=0,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabel=t,this.strResource=i,this.resourceLabels=[this.resourceLabel],this.strResources=[this.strResource],this.groupId=r,this.groupOrder=s,this.sourceId=o,this.sourceOrder=a,this.isValid=!0}setValid(e){this.isValid=e}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.isValid?" VALID":"INVALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class Zbe{constructor(e,t){this.resourceLabel=e,this.reason=t}}class Xbe{constructor(){this.elements=new Map}createMessage(){const e=[],t=[];for(const[,r]of this.elements)(r.reason===0?e:t).push(r.resourceLabel);const i=[];return e.length>0&&i.push(w({key:"externalRemoval",comment:["{0} is a list of filenames"]},"The following files have been closed and modified on disk: {0}.",e.join(", "))),t.length>0&&i.push(w({key:"noParallelUniverses",comment:["{0} is a list of filenames"]},"The following files have been modified in an incompatible way: {0}.",t.join(", "))),i.join(` +`)}get size(){return this.elements.size}has(e){return this.elements.has(e)}set(e,t){this.elements.set(e,t)}delete(e){return this.elements.delete(e)}}class P1t{constructor(e,t,i,r,s,o,a){this.id=++r5e,this.type=1,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabels=t,this.strResources=i,this.groupId=r,this.groupOrder=s,this.sourceId=o,this.sourceOrder=a,this.removedResources=null,this.invalidatedResources=null}canSplit(){return typeof this.actual.split=="function"}removeResource(e,t,i){this.removedResources||(this.removedResources=new Xbe),this.removedResources.has(t)||this.removedResources.set(t,new Zbe(e,i))}setValid(e,t,i){i?this.invalidatedResources&&(this.invalidatedResources.delete(t),this.invalidatedResources.size===0&&(this.invalidatedResources=null)):(this.invalidatedResources||(this.invalidatedResources=new Xbe),this.invalidatedResources.has(t)||this.invalidatedResources.set(t,new Zbe(e,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":" VALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class s5e{constructor(e,t){this.resourceLabel=e,this.strResource=t,this._past=[],this._future=[],this.locked=!1,this.versionId=1}dispose(){for(const e of this._past)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);for(const e of this._future)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);this.versionId++}toString(){const e=[];e.push(`* ${this.strResource}:`);for(let t=0;t=0;t--)e.push(` * [REDO] ${this._future[t]}`);return e.join(` +`)}flushAllElements(){this._past=[],this._future=[],this.versionId++}_setElementValidFlag(e,t){e.type===1?e.setValid(this.resourceLabel,this.strResource,t):e.setValid(t)}setElementsValidFlag(e,t){for(const i of this._past)t(i.actual)&&this._setElementValidFlag(i,e);for(const i of this._future)t(i.actual)&&this._setElementValidFlag(i,e)}pushElement(e){for(const t of this._future)t.type===1&&t.removeResource(this.resourceLabel,this.strResource,1);this._future=[],this._past.push(e),this.versionId++}createSnapshot(e){const t=[];for(let i=0,r=this._past.length;i=0;i--)t.push(this._future[i].id);return new i5e(e,t)}restoreSnapshot(e){const t=e.elements.length;let i=!0,r=0,s=-1;for(let a=0,l=this._past.length;a=t||c.id!==e.elements[r])&&(i=!1,s=0),!i&&c.type===1&&c.removeResource(this.resourceLabel,this.strResource,0)}let o=-1;for(let a=this._future.length-1;a>=0;a--,r++){const l=this._future[a];i&&(r>=t||l.id!==e.elements[r])&&(i=!1,o=a),!i&&l.type===1&&l.removeResource(this.resourceLabel,this.strResource,0)}s!==-1&&(this._past=this._past.slice(0,s)),o!==-1&&(this._future=this._future.slice(o+1)),this.versionId++}getElements(){const e=[],t=[];for(const i of this._past)e.push(i.actual);for(const i of this._future)t.push(i.actual);return{past:e,future:t}}getClosestPastElement(){return this._past.length===0?null:this._past[this._past.length-1]}getSecondClosestPastElement(){return this._past.length<2?null:this._past[this._past.length-2]}getClosestFutureElement(){return this._future.length===0?null:this._future[this._future.length-1]}hasPastElements(){return this._past.length>0}hasFutureElements(){return this._future.length>0}splitPastWorkspaceElement(e,t){for(let i=this._past.length-1;i>=0;i--)if(this._past[i]===e){t.has(this.strResource)?this._past[i]=t.get(this.strResource):this._past.splice(i,1);break}this.versionId++}splitFutureWorkspaceElement(e,t){for(let i=this._future.length-1;i>=0;i--)if(this._future[i]===e){t.has(this.strResource)?this._future[i]=t.get(this.strResource):this._future.splice(i,1);break}this.versionId++}moveBackward(e){this._past.pop(),this._future.push(e),this.versionId++}moveForward(e){this._future.pop(),this._past.push(e),this.versionId++}}class Wj{constructor(e){this.editStacks=e,this._versionIds=[];for(let t=0,i=this.editStacks.length;tt.sourceOrder)&&(t=o,i=r)}return[t,i]}canUndo(e){if(e instanceof fv){const[,i]=this._findClosestUndoElementWithSource(e.id);return!!i}const t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).hasPastElements():!1}_onError(e,t){rn(e);for(const i of t.strResources)this.removeElements(i);this._notificationService.error(e)}_acquireLocks(e){for(const t of e.editStacks)if(t.locked)throw new Error("Cannot acquire edit stack lock");for(const t of e.editStacks)t.locked=!0;return()=>{for(const t of e.editStacks)t.locked=!1}}_safeInvokeWithLocks(e,t,i,r,s){const o=this._acquireLocks(i);let a;try{a=t()}catch(l){return o(),r.dispose(),this._onError(l,e)}return a?a.then(()=>(o(),r.dispose(),s()),l=>(o(),r.dispose(),this._onError(l,e))):(o(),r.dispose(),s())}async _invokeWorkspacePrepare(e){if(typeof e.actual.prepareUndoRedo>"u")return me.None;const t=e.actual.prepareUndoRedo();return typeof t>"u"?me.None:t}_invokeResourcePrepare(e,t){if(e.actual.type!==1||typeof e.actual.prepareUndoRedo>"u")return t(me.None);const i=e.actual.prepareUndoRedo();return i?R$(i)?t(i):i.then(r=>t(r)):t(me.None)}_getAffectedEditStacks(e){const t=[];for(const i of e.strResources)t.push(this._editStacks.get(i)||o5e);return new Wj(t)}_tryToSplitAndUndo(e,t,i,r){if(t.canSplit())return this._splitPastWorkspaceElement(t,i),this._notificationService.warn(r),new D4(this._undo(e,0,!0));for(const s of t.strResources)this.removeElements(s);return this._notificationService.warn(r),new D4}_checkWorkspaceUndo(e,t,i,r){if(t.removedResources)return this._tryToSplitAndUndo(e,t,t.removedResources,w({key:"cannotWorkspaceUndo",comment:["{0} is a label for an operation. {1} is another message."]},"Could not undo '{0}' across all files. {1}",t.label,t.removedResources.createMessage()));if(r&&t.invalidatedResources)return this._tryToSplitAndUndo(e,t,t.invalidatedResources,w({key:"cannotWorkspaceUndo",comment:["{0} is a label for an operation. {1} is another message."]},"Could not undo '{0}' across all files. {1}",t.label,t.invalidatedResources.createMessage()));const s=[];for(const a of i.editStacks)a.getClosestPastElement()!==t&&s.push(a.resourceLabel);if(s.length>0)return this._tryToSplitAndUndo(e,t,null,w({key:"cannotWorkspaceUndoDueToChanges",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because changes were made to {1}",t.label,s.join(", ")));const o=[];for(const a of i.editStacks)a.locked&&o.push(a.resourceLabel);return o.length>0?this._tryToSplitAndUndo(e,t,null,w({key:"cannotWorkspaceUndoDueToInProgressUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,o.join(", "))):i.isValid()?null:this._tryToSplitAndUndo(e,t,null,w({key:"cannotWorkspaceUndoDueToInMeantimeUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not undo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceUndo(e,t,i){const r=this._getAffectedEditStacks(t),s=this._checkWorkspaceUndo(e,t,r,!1);return s?s.returnValue:this._confirmAndExecuteWorkspaceUndo(e,t,r,i)}_isPartOfUndoGroup(e){if(!e.groupId)return!1;for(const[,t]of this._editStacks){const i=t.getClosestPastElement();if(i){if(i===e){const r=t.getSecondClosestPastElement();if(r&&r.groupId===e.groupId)return!0}if(i.groupId===e.groupId)return!0}}return!1}async _confirmAndExecuteWorkspaceUndo(e,t,i,r){if(t.canSplit()&&!this._isPartOfUndoGroup(t)){let a;(function(u){u[u.All=0]="All",u[u.This=1]="This",u[u.Cancel=2]="Cancel"})(a||(a={}));const{result:l}=await this._dialogService.prompt({type:Ss.Info,message:w("confirmWorkspace","Would you like to undo '{0}' across all files?",t.label),buttons:[{label:w({key:"ok",comment:["{0} denotes a number that is > 1, && denotes a mnemonic"]},"&&Undo in {0} Files",i.editStacks.length),run:()=>a.All},{label:w({key:"nok",comment:["&& denotes a mnemonic"]},"Undo this &&File"),run:()=>a.This}],cancelButton:{run:()=>a.Cancel}});if(l===a.Cancel)return;if(l===a.This)return this._splitPastWorkspaceElement(t,null),this._undo(e,0,!0);const c=this._checkWorkspaceUndo(e,t,i,!1);if(c)return c.returnValue;r=!0}let s;try{s=await this._invokeWorkspacePrepare(t)}catch(a){return this._onError(a,t)}const o=this._checkWorkspaceUndo(e,t,i,!0);if(o)return s.dispose(),o.returnValue;for(const a of i.editStacks)a.moveBackward(t);return this._safeInvokeWithLocks(t,()=>t.actual.undo(),i,s,()=>this._continueUndoInGroup(t.groupId,r))}_resourceUndo(e,t,i){if(!t.isValid){e.flushAllElements();return}if(e.locked){const r=w({key:"cannotResourceUndoDueToInProgressUndoRedo",comment:["{0} is a label for an operation."]},"Could not undo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(r);return}return this._invokeResourcePrepare(t,r=>(e.moveBackward(t),this._safeInvokeWithLocks(t,()=>t.actual.undo(),new Wj([e]),r,()=>this._continueUndoInGroup(t.groupId,i))))}_findClosestUndoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(const[r,s]of this._editStacks){const o=s.getClosestPastElement();o&&o.groupId===e&&(!t||o.groupOrder>t.groupOrder)&&(t=o,i=r)}return[t,i]}_continueUndoInGroup(e,t){if(!e)return;const[,i]=this._findClosestUndoElementInGroup(e);if(i)return this._undo(i,0,t)}undo(e){if(e instanceof fv){const[,t]=this._findClosestUndoElementWithSource(e.id);return t?this._undo(t,e.id,!1):void 0}return typeof e=="string"?this._undo(e,0,!1):this._undo(this.getUriComparisonKey(e),0,!1)}_undo(e,t=0,i){if(!this._editStacks.has(e))return;const r=this._editStacks.get(e),s=r.getClosestPastElement();if(!s)return;if(s.groupId){const[a,l]=this._findClosestUndoElementInGroup(s.groupId);if(s!==a&&l)return this._undo(l,t,i)}if((s.sourceId!==t||s.confirmBeforeUndo)&&!i)return this._confirmAndContinueUndo(e,t,s);try{return s.type===1?this._workspaceUndo(e,s,i):this._resourceUndo(r,s,i)}finally{}}async _confirmAndContinueUndo(e,t,i){if((await this._dialogService.confirm({message:w("confirmDifferentSource","Would you like to undo '{0}'?",i.label),primaryButton:w({key:"confirmDifferentSource.yes",comment:["&& denotes a mnemonic"]},"&&Yes"),cancelButton:w("confirmDifferentSource.no","No")})).confirmed)return this._undo(e,t,!0)}_findClosestRedoElementWithSource(e){if(!e)return[null,null];let t=null,i=null;for(const[r,s]of this._editStacks){const o=s.getClosestFutureElement();o&&o.sourceId===e&&(!t||o.sourceOrder0)return this._tryToSplitAndRedo(e,t,null,w({key:"cannotWorkspaceRedoDueToChanges",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because changes were made to {1}",t.label,s.join(", ")));const o=[];for(const a of i.editStacks)a.locked&&o.push(a.resourceLabel);return o.length>0?this._tryToSplitAndRedo(e,t,null,w({key:"cannotWorkspaceRedoDueToInProgressUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,o.join(", "))):i.isValid()?null:this._tryToSplitAndRedo(e,t,null,w({key:"cannotWorkspaceRedoDueToInMeantimeUndoRedo",comment:["{0} is a label for an operation. {1} is a list of filenames."]},"Could not redo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceRedo(e,t){const i=this._getAffectedEditStacks(t),r=this._checkWorkspaceRedo(e,t,i,!1);return r?r.returnValue:this._executeWorkspaceRedo(e,t,i)}async _executeWorkspaceRedo(e,t,i){let r;try{r=await this._invokeWorkspacePrepare(t)}catch(o){return this._onError(o,t)}const s=this._checkWorkspaceRedo(e,t,i,!0);if(s)return r.dispose(),s.returnValue;for(const o of i.editStacks)o.moveForward(t);return this._safeInvokeWithLocks(t,()=>t.actual.redo(),i,r,()=>this._continueRedoInGroup(t.groupId))}_resourceRedo(e,t){if(!t.isValid){e.flushAllElements();return}if(e.locked){const i=w({key:"cannotResourceRedoDueToInProgressUndoRedo",comment:["{0} is a label for an operation."]},"Could not redo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(i);return}return this._invokeResourcePrepare(t,i=>(e.moveForward(t),this._safeInvokeWithLocks(t,()=>t.actual.redo(),new Wj([e]),i,()=>this._continueRedoInGroup(t.groupId))))}_findClosestRedoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(const[r,s]of this._editStacks){const o=s.getClosestFutureElement();o&&o.groupId===e&&(!t||o.groupOrder=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Qbe=function(n,e){return function(t,i){e(t,i,n)}};const cd=On("ILanguageFeatureDebounceService");var u8;(function(n){const e=new WeakMap;let t=0;function i(r){let s=e.get(r);return s===void 0&&(s=++t,e.set(r,s)),s}n.of=i})(u8||(u8={}));class F1t{constructor(e){this._default=e}get(e){return this._default}update(e,t){return this._default}default(){return this._default}}class B1t{constructor(e,t,i,r,s,o){this._logService=e,this._name=t,this._registry=i,this._default=r,this._min=s,this._max=o,this._cache=new lm(50,.7)}_key(e){return e.id+this._registry.all(e).reduce((t,i)=>B$(u8.of(i),t),0)}get(e){const t=this._key(e),i=this._cache.get(t);return i?Il(i.value,this._min,this._max):this.default()}update(e,t){const i=this._key(e);let r=this._cache.get(i);r||(r=new O1t(6),this._cache.set(i,r));const s=Il(r.update(t),this._min,this._max);return O$(e.uri,"output")||this._logService.trace(`[DEBOUNCE: ${this._name}] for ${e.uri.toString()} is ${s}ms`),s}_overall(){const e=new a5e;for(const[,t]of this._cache)e.update(t.value);return e.value}default(){const e=this._overall()|0||this._default;return Il(e,this._min,this._max)}}let $X=class{constructor(e,t){this._logService=e,this._data=new Map,this._isDev=t.isExtensionDevelopment||!t.isBuilt}for(e,t,i){const r=i?.min??50,s=i?.max??r**2,o=i?.key??void 0,a=`${u8.of(e)},${r}${o?","+o:""}`;let l=this._data.get(a);return l||(this._isDev?(this._logService.debug(`[DEBOUNCE: ${t}] is disabled in developed mode`),l=new F1t(r*1.5)):l=new B1t(this._logService,t,e,this._overallAverage()|0||r*1.5,r,s),this._data.set(a,l)),l}_overallAverage(){const e=new a5e;for(const t of this._data.values())e.update(t.default());return e.value}};$X=M1t([Qbe(0,Da),Qbe(1,ole)],$X);Vn(cd,$X,1);class hc{static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static getClassNameFromMetadata(e){let i="mtk"+this.getForeground(e);const r=this.getFontStyle(e);return r&1&&(i+=" mtki"),r&2&&(i+=" mtkb"),r&4&&(i+=" mtku"),r&8&&(i+=" mtks"),i}static getInlineStyleFromMetadata(e,t){const i=this.getForeground(e),r=this.getFontStyle(e);let s=`color: ${t[i]};`;r&1&&(s+="font-style: italic;"),r&2&&(s+="font-weight: bold;");let o="";return r&4&&(o+=" underline"),r&8&&(o+=" line-through"),o&&(s+=`text-decoration:${o};`),s}static getPresentationFromMetadata(e){const t=this.getForeground(e),i=this.getFontStyle(e);return{foreground:t,italic:!!(i&1),bold:!!(i&2),underline:!!(i&4),strikethrough:!!(i&8)}}}function Lb(n){let e=0,t=0,i=0,r=0;for(let s=0,o=n.length;s0?t.charCodeAt(0):0)}acceptEdit(e,t,i,r,s){this._acceptDeleteRange(e),this._acceptInsertText(new he(e.startLineNumber,e.startColumn),t,i,r,s),this._updateEndLineNumber()}_acceptDeleteRange(e){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return;const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber;if(i<0){const s=i-t;this._startLineNumber-=s;return}const r=this._tokens.getMaxDeltaLine();if(!(t>=r+1)){if(t<0&&i>=r+1){this._startLineNumber=0,this._tokens.clear();return}if(t<0){const s=-t;this._startLineNumber-=s,this._tokens.acceptDeleteRange(e.startColumn-1,0,0,i,e.endColumn-1)}else this._tokens.acceptDeleteRange(0,t,e.startColumn-1,i,e.endColumn-1)}}_acceptInsertText(e,t,i,r,s){if(t===0&&i===0)return;const o=e.lineNumber-this._startLineNumber;if(o<0){this._startLineNumber+=t;return}const a=this._tokens.getMaxDeltaLine();o>=a+1||this._tokens.acceptInsertText(o,e.column-1,t,i,r,s)}}class d8{constructor(e){this._tokens=e,this._tokenCount=e.length/4}toString(e){const t=[];for(let i=0;ie)i=r-1;else{let o=r;for(;o>t&&this._getDeltaLine(o-1)===e;)o--;let a=r;for(;ae||h===e&&g>=t)&&(he||g===e&&m>=t){if(gs?p-=s-i:p=i;else if(f===t&&g===i)if(f===r&&p>s)p-=s-i;else{u=!0;continue}else if(fs)f=t,g=i,p=g+(p-s);else{u=!0;continue}else if(f>r){if(l===0&&!u){c=a;break}f-=l}else if(f===r&&g>=s)e&&f===0&&(g+=e,p+=e),f-=l,g-=s-i,p-=s-i;else throw new Error("Not possible!");const _=4*c;o[_]=f,o[_+1]=g,o[_+2]=p,o[_+3]=m,c++}this._tokenCount=c}acceptInsertText(e,t,i,r,s,o){const a=i===0&&r===1&&(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122),l=this._tokens,c=this._tokenCount;for(let u=0;u=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Hj=function(n,e){return function(t,i){e(t,i,n)}};let WX=class{constructor(e,t,i,r){this._legend=e,this._themeService=t,this._languageService=i,this._logService=r,this._hasWarnedOverlappingTokens=!1,this._hasWarnedInvalidLengthTokens=!1,this._hasWarnedInvalidEditStart=!1,this._hashTable=new rv}getMetadata(e,t,i){const r=this._languageService.languageIdCodec.encodeLanguageId(i),s=this._hashTable.get(e,t,r);let o;if(s)o=s.metadata;else{let a=this._legend.tokenTypes[e];const l=[];if(a){let c=t;for(let d=0;c>0&&d>1;const u=this._themeService.getColorTheme().getTokenStyleMetadata(a,l,i);if(typeof u>"u")o=2147483647;else{if(o=0,typeof u.italic<"u"){const d=(u.italic?1:0)<<11;o|=d|1}if(typeof u.bold<"u"){const d=(u.bold?2:0)<<11;o|=d|2}if(typeof u.underline<"u"){const d=(u.underline?4:0)<<11;o|=d|4}if(typeof u.strikethrough<"u"){const d=(u.strikethrough?8:0)<<11;o|=d|8}if(u.foreground){const d=u.foreground<<15;o|=d|16}o===0&&(o=2147483647)}}else o=2147483647,a="not-in-legend";this._hashTable.add(e,t,r,o)}return o}warnOverlappingSemanticTokens(e,t){this._hasWarnedOverlappingTokens||(this._hasWarnedOverlappingTokens=!0,this._logService.warn(`Overlapping semantic tokens detected at lineNumber ${e}, column ${t}`))}warnInvalidLengthSemanticTokens(e,t){this._hasWarnedInvalidLengthTokens||(this._hasWarnedInvalidLengthTokens=!0,this._logService.warn(`Semantic token with invalid length detected at lineNumber ${e}, column ${t}`))}warnInvalidEditStart(e,t,i,r,s){this._hasWarnedInvalidEditStart||(this._hasWarnedInvalidEditStart=!0,this._logService.warn(`Invalid semantic tokens edit detected (previousResultId: ${e}, resultId: ${t}) at edit #${i}: The provided start offset ${r} is outside the previous data (length ${s}).`))}};WX=$1t([Hj(1,go),Hj(2,Hr),Hj(3,Da)],WX);function l5e(n,e,t){const i=n.data,r=n.data.length/5|0,s=Math.max(Math.ceil(r/1024),400),o=[];let a=0,l=1,c=0;for(;au&&i[5*v]===0;)v--;if(v-1===u){let y=d;for(;y+1k)e.warnOverlappingSemanticTokens(x,k+1);else{const M=e.getMetadata(I,O,t);M!==2147483647&&(g===0&&(g=x),h[f]=x-g,h[f+1]=k,h[f+2]=D,h[f+3]=M,f+=4,p=x,m=D)}l=x,c=k,a++}f!==h.length&&(h=h.subarray(0,f));const _=vI.create(g,h);o.push(_)}return o}class W1t{constructor(e,t,i,r){this.tokenTypeIndex=e,this.tokenModifierSet=t,this.languageId=i,this.metadata=r,this.next=null}}class rv{static{this._SIZES=[3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143]}constructor(){this._elementsCount=0,this._currentLengthIndex=0,this._currentLength=rv._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1=this._growCount){const s=this._elements;this._currentLengthIndex++,this._currentLength=rv._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Vj=function(n,e){return function(t,i){e(t,i,n)}};let HX=class extends me{constructor(e,t,i){super(),this._themeService=e,this._logService=t,this._languageService=i,this._caches=new WeakMap,this._register(this._themeService.onDidColorThemeChange(()=>{this._caches=new WeakMap}))}getStyling(e){return this._caches.has(e)||this._caches.set(e,new WX(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}};HX=H1t([Vj(0,go),Vj(1,Da),Vj(2,Hr)],HX);Vn(rW,HX,1);function z0(n){return n===47||n===92}function c5e(n){return n.replace(/[\\/]/g,Ms.sep)}function V1t(n){return n.indexOf("/")===-1&&(n=c5e(n)),/^[a-zA-Z]:(\/|$)/.test(n)&&(n="/"+n),n}function e1e(n,e=Ms.sep){if(!n)return"";const t=n.length,i=n.charCodeAt(0);if(z0(i)){if(z0(n.charCodeAt(1))&&!z0(n.charCodeAt(2))){let s=3;const o=s;for(;sn.length)return!1;if(t){if(!Lae(n,e))return!1;if(e.length===n.length)return!0;let s=e.length;return e.charAt(e.length-1)===i&&s--,n.charAt(s)===i}return e.charAt(e.length-1)!==i&&(e+=i),n.indexOf(e)===0}function u5e(n){return n>=65&&n<=90||n>=97&&n<=122}function z1t(n,e=Ta){return e?u5e(n.charCodeAt(0))&&n.charCodeAt(1)===58:!1}const I4="**",t1e="/",K5="[/\\\\]",G5="[^/\\\\]",U1t=/\//g;function n1e(n,e){switch(n){case 0:return"";case 1:return`${G5}*?`;default:return`(?:${K5}|${G5}+${K5}${e?`|${K5}${G5}+`:""})*?`}}function i1e(n,e){if(!n)return[];const t=[];let i=!1,r=!1,s="";for(const o of n){switch(o){case e:if(!i&&!r){t.push(s),s="";continue}break;case"{":i=!0;break;case"}":i=!1;break;case"[":r=!0;break;case"]":r=!1;break}s+=o}return s&&t.push(s),t}function d5e(n){if(!n)return"";let e="";const t=i1e(n,t1e);if(t.every(i=>i===I4))e=".*";else{let i=!1;t.forEach((r,s)=>{if(r===I4){if(i)return;e+=n1e(2,s===t.length-1)}else{let o=!1,a="",l=!1,c="";for(const u of r){if(u!=="}"&&o){a+=u;continue}if(l&&(u!=="]"||!c)){let d;u==="-"?d=u:(u==="^"||u==="!")&&!c?d="^":u===t1e?d="":d=nd(u),c+=d;continue}switch(u){case"{":o=!0;continue;case"[":l=!0;continue;case"}":{const h=`(?:${i1e(a,",").map(f=>d5e(f)).join("|")})`;e+=h,o=!1,a="";break}case"]":{e+="["+c+"]",l=!1,c="";break}case"?":e+=G5;continue;case"*":e+=n1e(1);continue;default:e+=nd(u)}}sale(a,e)).filter(a=>a!==Wp),n),i=t.length;if(!i)return Wp;if(i===1)return t[0];const r=function(a,l){for(let c=0,u=t.length;c!!a.allBasenames);s&&(r.allBasenames=s.allBasenames);const o=t.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return o.length&&(r.allPaths=o),r}function a1e(n,e,t){const i=fg===Ms.sep,r=i?n:n.replace(U1t,fg),s=fg+r,o=Ms.sep+n;let a;return t?a=function(l,c){return typeof l=="string"&&(l===r||l.endsWith(s)||!i&&(l===n||l.endsWith(o)))?e:null}:a=function(l,c){return typeof l=="string"&&(l===r||!i&&l===n)?e:null},a.allPaths=[(t?"*/":"./")+n],a}function eyt(n){try{const e=new RegExp(`^${d5e(n)}$`);return function(t){return e.lastIndex=0,typeof t=="string"&&e.test(t)?n:null}}catch{return Wp}}function tyt(n,e,t){return!n||typeof e!="string"?!1:h5e(n)(e,void 0,t)}function h5e(n,e={}){if(!n)return s1e;if(typeof n=="string"||nyt(n)){const t=ale(n,e);if(t===Wp)return s1e;const i=function(r,s){return!!t(r,s)};return t.allBasenames&&(i.allBasenames=t.allBasenames),t.allPaths&&(i.allPaths=t.allPaths),i}return iyt(n,e)}function nyt(n){const e=n;return e?typeof e.base=="string"&&typeof e.pattern=="string":!1}function iyt(n,e){const t=f5e(Object.getOwnPropertyNames(n).map(a=>ryt(a,n[a],e)).filter(a=>a!==Wp)),i=t.length;if(!i)return Wp;if(!t.some(a=>!!a.requiresSiblings)){if(i===1)return t[0];const a=function(u,d){let h;for(let f=0,g=t.length;f{for(const f of h){const g=await f;if(typeof g=="string")return g}return null})():null},l=t.find(u=>!!u.allBasenames);l&&(a.allBasenames=l.allBasenames);const c=t.reduce((u,d)=>d.allPaths?u.concat(d.allPaths):u,[]);return c.length&&(a.allPaths=c),a}const r=function(a,l,c){let u,d;for(let h=0,f=t.length;h{for(const h of d){const f=await h;if(typeof f=="string")return f}return null})():null},s=t.find(a=>!!a.allBasenames);s&&(r.allBasenames=s.allBasenames);const o=t.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return o.length&&(r.allPaths=o),r}function ryt(n,e,t){if(e===!1)return Wp;const i=ale(n,t);if(i===Wp)return Wp;if(typeof e=="boolean")return i;if(e){const r=e.when;if(typeof r=="string"){const s=(o,a,l,c)=>{if(!c||!i(o,a))return null;const u=r.replace("$(basename)",()=>l),d=c(u);return hX(d)?d.then(h=>h?n:null):d?n:null};return s.requiresSiblings=!0,s}}return i}function f5e(n,e){const t=n.filter(a=>!!a.basenames);if(t.length<2)return n;const i=t.reduce((a,l)=>{const c=l.basenames;return c?a.concat(c):a},[]);let r;if(e){r=[];for(let a=0,l=i.length;a{const c=l.patterns;return c?a.concat(c):a},[]);const s=function(a,l){if(typeof a!="string")return null;if(!l){let u;for(u=a.length;u>0;u--){const d=a.charCodeAt(u-1);if(d===47||d===92)break}l=a.substr(u)}const c=i.indexOf(l);return c!==-1?r[c]:null};s.basenames=i,s.patterns=r,s.allBasenames=i;const o=n.filter(a=>!a.basenames);return o.push(s),o}function lle(n,e,t,i,r,s){if(Array.isArray(n)){let o=0;for(const a of n){const l=lle(a,e,t,i,r,s);if(l===10)return l;l>o&&(o=l)}return o}else{if(typeof n=="string")return i?n==="*"?5:n===t?10:0:0;if(n){const{language:o,pattern:a,scheme:l,hasAccessToAllModels:c,notebookType:u}=n;if(!i&&!c)return 0;u&&r&&(e=r);let d=0;if(l)if(l===e.scheme)d=10;else if(l==="*")d=5;else return 0;if(o)if(o===t)d=10;else if(o==="*")d=Math.max(d,5);else return 0;if(u)if(u===s)d=10;else if(u==="*"&&s!==void 0)d=Math.max(d,5);else return 0;if(a){let h;if(typeof a=="string"?h=a:h={...a,base:D4e(a.base)},h===e.fsPath||tyt(h,e.fsPath))d=10;else return 0}return d}else return 0}}function g5e(n){return typeof n=="string"?!1:Array.isArray(n)?n.every(g5e):!!n.exclusive}class l1e{constructor(e,t,i,r,s){this.uri=e,this.languageId=t,this.notebookUri=i,this.notebookType=r,this.recursive=s}equals(e){return this.notebookType===e.notebookType&&this.languageId===e.languageId&&this.uri.toString()===e.uri.toString()&&this.notebookUri?.toString()===e.notebookUri?.toString()&&this.recursive===e.recursive}}class Vr{constructor(e){this._notebookInfoResolver=e,this._clock=0,this._entries=[],this._onDidChange=new fe,this.onDidChange=this._onDidChange.event}register(e,t){let i={selector:e,provider:t,_score:-1,_time:this._clock++};return this._entries.push(i),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),Lt(()=>{if(i){const r=this._entries.indexOf(i);r>=0&&(this._entries.splice(r,1),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),i=void 0)}})}has(e){return this.all(e).length>0}all(e){if(!e)return[];this._updateScores(e,!1);const t=[];for(const i of this._entries)i._score>0&&t.push(i.provider);return t}ordered(e,t=!1){const i=[];return this._orderedForEach(e,t,r=>i.push(r.provider)),i}orderedGroups(e){const t=[];let i,r;return this._orderedForEach(e,!1,s=>{i&&r===s._score?i.push(s.provider):(r=s._score,i=[s.provider],t.push(i))}),t}_orderedForEach(e,t,i){this._updateScores(e,t);for(const r of this._entries)r._score>0&&i(r)}_updateScores(e,t){const i=this._notebookInfoResolver?.(e.uri),r=i?new l1e(e.uri,e.getLanguageId(),i.uri,i.type,t):new l1e(e.uri,e.getLanguageId(),void 0,void 0,t);if(!this._lastCandidate?.equals(r)){this._lastCandidate=r;for(const s of this._entries)if(s._score=lle(s.selector,r.uri,r.languageId,z3e(e),r.notebookUri,r.notebookType),g5e(s.selector)&&s._score>0)if(t)s._score=0;else{for(const o of this._entries)o._score=0;s._score=1e3;break}this._entries.sort(Vr._compareByScoreAndTime)}}static _compareByScoreAndTime(e,t){return e._scoret._score?-1:ED(e.selector)&&!ED(t.selector)?1:!ED(e.selector)&&ED(t.selector)?-1:e._timet._time?-1:0}}function ED(n){return typeof n=="string"?!1:Array.isArray(n)?n.some(ED):!!n.isBuiltin}class syt{constructor(){this.referenceProvider=new Vr(this._score.bind(this)),this.renameProvider=new Vr(this._score.bind(this)),this.newSymbolNamesProvider=new Vr(this._score.bind(this)),this.codeActionProvider=new Vr(this._score.bind(this)),this.definitionProvider=new Vr(this._score.bind(this)),this.typeDefinitionProvider=new Vr(this._score.bind(this)),this.declarationProvider=new Vr(this._score.bind(this)),this.implementationProvider=new Vr(this._score.bind(this)),this.documentSymbolProvider=new Vr(this._score.bind(this)),this.inlayHintsProvider=new Vr(this._score.bind(this)),this.colorProvider=new Vr(this._score.bind(this)),this.codeLensProvider=new Vr(this._score.bind(this)),this.documentFormattingEditProvider=new Vr(this._score.bind(this)),this.documentRangeFormattingEditProvider=new Vr(this._score.bind(this)),this.onTypeFormattingEditProvider=new Vr(this._score.bind(this)),this.signatureHelpProvider=new Vr(this._score.bind(this)),this.hoverProvider=new Vr(this._score.bind(this)),this.documentHighlightProvider=new Vr(this._score.bind(this)),this.multiDocumentHighlightProvider=new Vr(this._score.bind(this)),this.selectionRangeProvider=new Vr(this._score.bind(this)),this.foldingRangeProvider=new Vr(this._score.bind(this)),this.linkProvider=new Vr(this._score.bind(this)),this.inlineCompletionsProvider=new Vr(this._score.bind(this)),this.inlineEditProvider=new Vr(this._score.bind(this)),this.completionProvider=new Vr(this._score.bind(this)),this.linkedEditingRangeProvider=new Vr(this._score.bind(this)),this.documentRangeSemanticTokensProvider=new Vr(this._score.bind(this)),this.documentSemanticTokensProvider=new Vr(this._score.bind(this)),this.documentDropEditProvider=new Vr(this._score.bind(this)),this.documentPasteEditProvider=new Vr(this._score.bind(this))}_score(e){return this._notebookTypeResolver?.(e)}}Vn(dt,syt,1);function cle(n){return`--vscode-${n.replace(/\./g,"-")}`}function it(n){return`var(${cle(n)})`}function oyt(n,e){return`var(${cle(n)}, ${e})`}function ayt(n){return n!==null&&typeof n=="object"&&"light"in n&&"dark"in n}const p5e={ColorContribution:"base.contributions.colors"},lyt="default";class cyt{constructor(){this._onDidChangeSchema=new fe,this.onDidChangeSchema=this._onDidChangeSchema.event,this.colorSchema={type:"object",properties:{}},this.colorReferenceSchema={type:"string",enum:[],enumDescriptions:[]},this.colorsById={}}registerColor(e,t,i,r=!1,s){const o={id:e,description:i,defaults:t,needsTransparency:r,deprecationMessage:s};this.colorsById[e]=o;const a={type:"string",format:"color-hex",defaultSnippets:[{body:"${1:#ff0000}"}]};return s&&(a.deprecationMessage=s),r&&(a.pattern="^#(?:(?[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$",a.patternErrorMessage=w("transparecyRequired","This color must be transparent or it will obscure content")),this.colorSchema.properties[e]={description:i,oneOf:[a,{type:"string",const:lyt,description:w("useDefault","Use the default color.")}]},this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(i),this._onDidChangeSchema.fire(),e}getColors(){return Object.keys(this.colorsById).map(e=>this.colorsById[e])}resolveDefaultColor(e,t){const i=this.colorsById[e];if(i?.defaults){const r=ayt(i.defaults)?i.defaults[t.type]:i.defaults;return Lf(r,t)}}getColorSchema(){return this.colorSchema}toString(){const e=(t,i)=>{const r=t.indexOf(".")===-1?0:1,s=i.indexOf(".")===-1?0:1;return r!==s?r-s:t.localeCompare(i)};return Object.keys(this.colorsById).sort(e).map(t=>`- \`${t}\`: ${this.colorsById[t].description}`).join(` +`)}}const sW=new cyt;Yr.add(p5e.ColorContribution,sW);function J(n,e,t,i,r){return sW.registerColor(n,e,t,i,r)}function uyt(n,e){switch(n.op){case 0:return Lf(n.value,e)?.darken(n.factor);case 1:return Lf(n.value,e)?.lighten(n.factor);case 2:return Lf(n.value,e)?.transparent(n.factor);case 3:{const t=Lf(n.background,e);return t?Lf(n.value,e)?.makeOpaque(t):Lf(n.value,e)}case 4:for(const t of n.values){const i=Lf(t,e);if(i)return i}return;case 6:return Lf(e.defines(n.if)?n.then:n.else,e);case 5:{const t=Lf(n.value,e);if(!t)return;const i=Lf(n.background,e);return i?t.isDarkerThan(i)?Te.getLighterColor(t,i,n.factor).transparent(n.transparency):Te.getDarkerColor(t,i,n.factor).transparent(n.transparency):t.transparent(n.factor*n.transparency)}default:throw Z$()}}function bC(n,e){return{op:0,value:n,factor:e}}function _g(n,e){return{op:1,value:n,factor:e}}function Sn(n,e){return{op:2,value:n,factor:e}}function _N(...n){return{op:4,values:n}}function dyt(n,e,t){return{op:6,if:n,then:e,else:t}}function c1e(n,e,t,i){return{op:5,value:n,background:e,factor:t,transparency:i}}function Lf(n,e){if(n!==null){if(typeof n=="string")return n[0]==="#"?Te.fromHex(n):e.getColor(n);if(n instanceof Te)return n;if(typeof n=="object")return uyt(n,e)}}const m5e="vscode://schemas/workbench-colors",_5e=Yr.as(eW.JSONContribution);_5e.registerSchema(m5e,sW.getColorSchema());const u1e=new Ui(()=>_5e.notifySchemaChanged(m5e),200);sW.onDidChangeSchema(()=>{u1e.isScheduled()||u1e.schedule()});const In=J("foreground",{dark:"#CCCCCC",light:"#616161",hcDark:"#FFFFFF",hcLight:"#292929"},w("foreground","Overall foreground color. This color is only used if not overridden by a component."));J("disabledForeground",{dark:"#CCCCCC80",light:"#61616180",hcDark:"#A5A5A5",hcLight:"#7F7F7F"},w("disabledForeground","Overall foreground for disabled elements. This color is only used if not overridden by a component."));J("errorForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#B5200D"},w("errorForeground","Overall foreground color for error messages. This color is only used if not overridden by a component."));J("descriptionForeground",{light:"#717171",dark:Sn(In,.7),hcDark:Sn(In,.7),hcLight:Sn(In,.7)},w("descriptionForeground","Foreground color for description text providing additional information, for example for a label."));const h8=J("icon.foreground",{dark:"#C5C5C5",light:"#424242",hcDark:"#FFFFFF",hcLight:"#292929"},w("iconForeground","The default color for icons in the workbench.")),Zp=J("focusBorder",{dark:"#007FD4",light:"#0090F1",hcDark:"#F38518",hcLight:"#006BBD"},w("focusBorder","Overall border color for focused elements. This color is only used if not overridden by a component.")),Yn=J("contrastBorder",{light:null,dark:null,hcDark:"#6FC3DF",hcLight:"#0F4A85"},w("contrastBorder","An extra border around elements to separate them from others for greater contrast.")),Ar=J("contrastActiveBorder",{light:null,dark:null,hcDark:Zp,hcLight:Zp},w("activeContrastBorder","An extra border around active elements to separate them from others for greater contrast."));J("selection.background",null,w("selectionBackground","The background color of text selections in the workbench (e.g. for input fields or text areas). Note that this does not apply to selections within the editor."));const hyt=J("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},w("textLinkForeground","Foreground color for links in text."));J("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},w("textLinkActiveForeground","Foreground color for links in text when clicked on and on mouse hover."));J("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hcDark:Te.black,hcLight:"#292929"},w("textSeparatorForeground","Color for text separators."));J("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hcDark:"#000000",hcLight:"#FFFFFF"},w("textPreformatForeground","Foreground color for preformatted text segments."));J("textPreformat.background",{light:"#0000001A",dark:"#FFFFFF1A",hcDark:"#FFFFFF",hcLight:"#09345f"},w("textPreformatBackground","Background color for preformatted text segments."));J("textBlockQuote.background",{light:"#f2f2f2",dark:"#222222",hcDark:null,hcLight:"#F2F2F2"},w("textBlockQuoteBackground","Background color for block quotes in text."));J("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hcDark:Te.white,hcLight:"#292929"},w("textBlockQuoteBorder","Border color for block quotes in text."));J("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hcDark:Te.black,hcLight:"#F2F2F2"},w("textCodeBlockBackground","Background color for code blocks in text."));J("sash.hoverBorder",Zp,w("sashActiveBorder","Border color of active sashes."));const Y5=J("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:Te.black,hcLight:"#0F4A85"},w("badgeBackground","Badge background color. Badges are small information labels, e.g. for search results count.")),fyt=J("badge.foreground",{dark:Te.white,light:"#333",hcDark:Te.white,hcLight:Te.white},w("badgeForeground","Badge foreground color. Badges are small information labels, e.g. for search results count.")),ule=J("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hcDark:null,hcLight:null},w("scrollbarShadow","Scrollbar shadow to indicate that the view is scrolled.")),v5e=J("scrollbarSlider.background",{dark:Te.fromHex("#797979").transparent(.4),light:Te.fromHex("#646464").transparent(.4),hcDark:Sn(Yn,.6),hcLight:Sn(Yn,.4)},w("scrollbarSliderBackground","Scrollbar slider background color.")),b5e=J("scrollbarSlider.hoverBackground",{dark:Te.fromHex("#646464").transparent(.7),light:Te.fromHex("#646464").transparent(.7),hcDark:Sn(Yn,.8),hcLight:Sn(Yn,.8)},w("scrollbarSliderHoverBackground","Scrollbar slider background color when hovering.")),y5e=J("scrollbarSlider.activeBackground",{dark:Te.fromHex("#BFBFBF").transparent(.4),light:Te.fromHex("#000000").transparent(.6),hcDark:Yn,hcLight:Yn},w("scrollbarSliderActiveBackground","Scrollbar slider background color when clicked on.")),gyt=J("progressBar.background",{dark:Te.fromHex("#0E70C0"),light:Te.fromHex("#0E70C0"),hcDark:Yn,hcLight:Yn},w("progressBarBackground","Background color of the progress bar that can show for long running operations.")),lf=J("editor.background",{light:"#ffffff",dark:"#1E1E1E",hcDark:Te.black,hcLight:Te.white},w("editorBackground","Editor background color.")),cm=J("editor.foreground",{light:"#333333",dark:"#BBBBBB",hcDark:Te.white,hcLight:In},w("editorForeground","Editor default foreground color."));J("editorStickyScroll.background",lf,w("editorStickyScrollBackground","Background color of sticky scroll in the editor"));J("editorStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:null,hcLight:Te.fromHex("#0F4A85").transparent(.1)},w("editorStickyScrollHoverBackground","Background color of sticky scroll on hover in the editor"));J("editorStickyScroll.border",{dark:null,light:null,hcDark:Yn,hcLight:Yn},w("editorStickyScrollBorder","Border color of sticky scroll in the editor"));J("editorStickyScroll.shadow",ule,w("editorStickyScrollShadow"," Shadow color of sticky scroll in the editor"));const ju=J("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#0C141F",hcLight:Te.white},w("editorWidgetBackground","Background color of editor widgets, such as find/replace.")),oW=J("editorWidget.foreground",In,w("editorWidgetForeground","Foreground color of editor widgets, such as find/replace.")),dle=J("editorWidget.border",{dark:"#454545",light:"#C8C8C8",hcDark:Yn,hcLight:Yn},w("editorWidgetBorder","Border color of editor widgets. The color is only used if the widget chooses to have a border and if the color is not overridden by a widget."));J("editorWidget.resizeBorder",null,w("editorWidgetResizeBorder","Border color of the resize bar of editor widgets. The color is only used if the widget chooses to have a resize border and if the color is not overridden by a widget."));J("editorError.background",null,w("editorError.background","Background color of error text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0);const aW=J("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F48771",hcLight:"#B5200D"},w("editorError.foreground","Foreground color of error squigglies in the editor.")),pyt=J("editorError.border",{dark:null,light:null,hcDark:Te.fromHex("#E47777").transparent(.8),hcLight:"#B5200D"},w("errorBorder","If set, color of double underlines for errors in the editor.")),myt=J("editorWarning.background",null,w("editorWarning.background","Background color of warning text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),X_=J("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hcDark:"#FFD370",hcLight:"#895503"},w("editorWarning.foreground","Foreground color of warning squigglies in the editor.")),vN=J("editorWarning.border",{dark:null,light:null,hcDark:Te.fromHex("#FFCC00").transparent(.8),hcLight:Te.fromHex("#FFCC00").transparent(.8)},w("warningBorder","If set, color of double underlines for warnings in the editor."));J("editorInfo.background",null,w("editorInfo.background","Background color of info text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0);const Xp=J("editorInfo.foreground",{dark:"#3794FF",light:"#1a85ff",hcDark:"#3794FF",hcLight:"#1a85ff"},w("editorInfo.foreground","Foreground color of info squigglies in the editor.")),bN=J("editorInfo.border",{dark:null,light:null,hcDark:Te.fromHex("#3794FF").transparent(.8),hcLight:"#292929"},w("infoBorder","If set, color of double underlines for infos in the editor.")),_yt=J("editorHint.foreground",{dark:Te.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hcDark:null,hcLight:null},w("editorHint.foreground","Foreground color of hint squigglies in the editor."));J("editorHint.border",{dark:null,light:null,hcDark:Te.fromHex("#eeeeee").transparent(.8),hcLight:"#292929"},w("hintBorder","If set, color of double underlines for hints in the editor."));const vyt=J("editorLink.activeForeground",{dark:"#4E94CE",light:Te.blue,hcDark:Te.cyan,hcLight:"#292929"},w("activeLinkForeground","Color of active links.")),Iv=J("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hcDark:"#f3f518",hcLight:"#0F4A85"},w("editorSelectionBackground","Color of the editor selection.")),byt=J("editor.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:Te.white},w("editorSelectionForeground","Color of the selected text for high contrast.")),w5e=J("editor.inactiveSelectionBackground",{light:Sn(Iv,.5),dark:Sn(Iv,.5),hcDark:Sn(Iv,.7),hcLight:Sn(Iv,.5)},w("editorInactiveSelection","Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations."),!0),hle=J("editor.selectionHighlightBackground",{light:c1e(Iv,lf,.3,.6),dark:c1e(Iv,lf,.3,.6),hcDark:null,hcLight:null},w("editorSelectionHighlight","Color for regions with the same content as the selection. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.selectionHighlightBorder",{light:null,dark:null,hcDark:Ar,hcLight:Ar},w("editorSelectionHighlightBorder","Border color for regions with the same content as the selection."));J("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hcDark:null,hcLight:null},w("editorFindMatch","Color of the current search match."));const yyt=J("editor.findMatchForeground",null,w("editorFindMatchForeground","Text color of the current search match.")),g_=J("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hcDark:null,hcLight:null},w("findMatchHighlight","Color of the other search matches. The color must not be opaque so as not to hide underlying decorations."),!0),wyt=J("editor.findMatchHighlightForeground",null,w("findMatchHighlightForeground","Foreground color of the other search matches."),!0);J("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hcDark:null,hcLight:null},w("findRangeHighlight","Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.findMatchBorder",{light:null,dark:null,hcDark:Ar,hcLight:Ar},w("editorFindMatchBorder","Border color of the current search match."));const Av=J("editor.findMatchHighlightBorder",{light:null,dark:null,hcDark:Ar,hcLight:Ar},w("findMatchHighlightBorder","Border color of the other search matches.")),Cyt=J("editor.findRangeHighlightBorder",{dark:null,light:null,hcDark:Sn(Ar,.4),hcLight:Sn(Ar,.4)},w("findRangeHighlightBorder","Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hcDark:"#ADD6FF26",hcLight:null},w("hoverHighlight","Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations."),!0);const f8=J("editorHoverWidget.background",ju,w("hoverBackground","Background color of the editor hover."));J("editorHoverWidget.foreground",oW,w("hoverForeground","Foreground color of the editor hover."));const C5e=J("editorHoverWidget.border",dle,w("hoverBorder","Border color of the editor hover."));J("editorHoverWidget.statusBarBackground",{dark:_g(f8,.2),light:bC(f8,.05),hcDark:ju,hcLight:ju},w("statusBarBackground","Background color of the editor hover status bar."));const fle=J("editorInlayHint.foreground",{dark:"#969696",light:"#969696",hcDark:Te.white,hcLight:Te.black},w("editorInlayHintForeground","Foreground color of inline hints")),gle=J("editorInlayHint.background",{dark:Sn(Y5,.1),light:Sn(Y5,.1),hcDark:Sn(Te.white,.1),hcLight:Sn(Y5,.1)},w("editorInlayHintBackground","Background color of inline hints")),xyt=J("editorInlayHint.typeForeground",fle,w("editorInlayHintForegroundTypes","Foreground color of inline hints for types")),Syt=J("editorInlayHint.typeBackground",gle,w("editorInlayHintBackgroundTypes","Background color of inline hints for types")),kyt=J("editorInlayHint.parameterForeground",fle,w("editorInlayHintForegroundParameter","Foreground color of inline hints for parameters")),Eyt=J("editorInlayHint.parameterBackground",gle,w("editorInlayHintBackgroundParameter","Background color of inline hints for parameters")),Lyt=J("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hcDark:"#FFCC00",hcLight:"#007ACC"},w("editorLightBulbForeground","The color used for the lightbulb actions icon."));J("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("editorLightBulbAutoFixForeground","The color used for the lightbulb auto fix actions icon."));J("editorLightBulbAi.foreground",Lyt,w("editorLightBulbAiForeground","The color used for the lightbulb AI icon."));J("editor.snippetTabstopHighlightBackground",{dark:new Te(new Jn(124,124,124,.3)),light:new Te(new Jn(10,50,100,.2)),hcDark:new Te(new Jn(124,124,124,.3)),hcLight:new Te(new Jn(10,50,100,.2))},w("snippetTabstopHighlightBackground","Highlight background color of a snippet tabstop."));J("editor.snippetTabstopHighlightBorder",null,w("snippetTabstopHighlightBorder","Highlight border color of a snippet tabstop."));J("editor.snippetFinalTabstopHighlightBackground",null,w("snippetFinalTabstopHighlightBackground","Highlight background color of the final tabstop of a snippet."));J("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new Te(new Jn(10,50,100,.5)),hcDark:"#525252",hcLight:"#292929"},w("snippetFinalTabstopHighlightBorder","Highlight border color of the final tabstop of a snippet."));const zX=new Te(new Jn(155,185,85,.2)),UX=new Te(new Jn(255,0,0,.2)),Tyt=J("diffEditor.insertedTextBackground",{dark:"#9ccc2c33",light:"#9ccc2c40",hcDark:null,hcLight:null},w("diffEditorInserted","Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),Dyt=J("diffEditor.removedTextBackground",{dark:"#ff000033",light:"#ff000033",hcDark:null,hcLight:null},w("diffEditorRemoved","Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations."),!0);J("diffEditor.insertedLineBackground",{dark:zX,light:zX,hcDark:null,hcLight:null},w("diffEditorInsertedLines","Background color for lines that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0);J("diffEditor.removedLineBackground",{dark:UX,light:UX,hcDark:null,hcLight:null},w("diffEditorRemovedLines","Background color for lines that got removed. The color must not be opaque so as not to hide underlying decorations."),!0);J("diffEditorGutter.insertedLineBackground",null,w("diffEditorInsertedLineGutter","Background color for the margin where lines got inserted."));J("diffEditorGutter.removedLineBackground",null,w("diffEditorRemovedLineGutter","Background color for the margin where lines got removed."));const Iyt=J("diffEditorOverview.insertedForeground",null,w("diffEditorOverviewInserted","Diff overview ruler foreground for inserted content.")),Ayt=J("diffEditorOverview.removedForeground",null,w("diffEditorOverviewRemoved","Diff overview ruler foreground for removed content."));J("diffEditor.insertedTextBorder",{dark:null,light:null,hcDark:"#33ff2eff",hcLight:"#374E06"},w("diffEditorInsertedOutline","Outline color for the text that got inserted."));J("diffEditor.removedTextBorder",{dark:null,light:null,hcDark:"#FF008F",hcLight:"#AD0707"},w("diffEditorRemovedOutline","Outline color for text that got removed."));J("diffEditor.border",{dark:null,light:null,hcDark:Yn,hcLight:Yn},w("diffEditorBorder","Border color between the two text editors."));J("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hcDark:null,hcLight:null},w("diffDiagonalFill","Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views."));J("diffEditor.unchangedRegionBackground","sideBar.background",w("diffEditor.unchangedRegionBackground","The background color of unchanged blocks in the diff editor."));J("diffEditor.unchangedRegionForeground","foreground",w("diffEditor.unchangedRegionForeground","The foreground color of unchanged blocks in the diff editor."));J("diffEditor.unchangedCodeBackground",{dark:"#74747429",light:"#b8b8b829",hcDark:null,hcLight:null},w("diffEditor.unchangedCodeBackground","The background color of unchanged code in the diff editor."));const JL=J("widget.shadow",{dark:Sn(Te.black,.36),light:Sn(Te.black,.16),hcDark:null,hcLight:null},w("widgetShadow","Shadow color of widgets such as find/replace inside the editor.")),x5e=J("widget.border",{dark:null,light:null,hcDark:Yn,hcLight:Yn},w("widgetBorder","Border color of widgets such as find/replace inside the editor.")),d1e=J("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hcDark:null,hcLight:null},w("toolbarHoverBackground","Toolbar background when hovering over actions using the mouse"));J("toolbar.hoverOutline",{dark:null,light:null,hcDark:Ar,hcLight:Ar},w("toolbarHoverOutline","Toolbar outline when hovering over actions using the mouse"));J("toolbar.activeBackground",{dark:_g(d1e,.1),light:bC(d1e,.1),hcDark:null,hcLight:null},w("toolbarActiveBackground","Toolbar background when holding the mouse over actions"));const Nyt=J("breadcrumb.foreground",Sn(In,.8),w("breadcrumbsFocusForeground","Color of focused breadcrumb items.")),Ryt=J("breadcrumb.background",lf,w("breadcrumbsBackground","Background color of breadcrumb items.")),h1e=J("breadcrumb.focusForeground",{light:bC(In,.2),dark:_g(In,.1),hcDark:_g(In,.1),hcLight:_g(In,.1)},w("breadcrumbsFocusForeground","Color of focused breadcrumb items.")),Pyt=J("breadcrumb.activeSelectionForeground",{light:bC(In,.2),dark:_g(In,.1),hcDark:_g(In,.1),hcLight:_g(In,.1)},w("breadcrumbsSelectedForeground","Color of selected breadcrumb items."));J("breadcrumbPicker.background",ju,w("breadcrumbsSelectedBackground","Background color of breadcrumb item picker."));const S5e=.5,f1e=Te.fromHex("#40C8AE").transparent(S5e),g1e=Te.fromHex("#40A6FF").transparent(S5e),p1e=Te.fromHex("#606060").transparent(.4),ple=.4,lE=1,jX=J("merge.currentHeaderBackground",{dark:f1e,light:f1e,hcDark:null,hcLight:null},w("mergeCurrentHeaderBackground","Current header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);J("merge.currentContentBackground",Sn(jX,ple),w("mergeCurrentContentBackground","Current content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const qX=J("merge.incomingHeaderBackground",{dark:g1e,light:g1e,hcDark:null,hcLight:null},w("mergeIncomingHeaderBackground","Incoming header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);J("merge.incomingContentBackground",Sn(qX,ple),w("mergeIncomingContentBackground","Incoming content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const KX=J("merge.commonHeaderBackground",{dark:p1e,light:p1e,hcDark:null,hcLight:null},w("mergeCommonHeaderBackground","Common ancestor header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);J("merge.commonContentBackground",Sn(KX,ple),w("mergeCommonContentBackground","Common ancestor content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const cE=J("merge.border",{dark:null,light:null,hcDark:"#C3DF6F",hcLight:"#007ACC"},w("mergeBorder","Border color on headers and the splitter in inline merge-conflicts."));J("editorOverviewRuler.currentContentForeground",{dark:Sn(jX,lE),light:Sn(jX,lE),hcDark:cE,hcLight:cE},w("overviewRulerCurrentContentForeground","Current overview ruler foreground for inline merge-conflicts."));J("editorOverviewRuler.incomingContentForeground",{dark:Sn(qX,lE),light:Sn(qX,lE),hcDark:cE,hcLight:cE},w("overviewRulerIncomingContentForeground","Incoming overview ruler foreground for inline merge-conflicts."));J("editorOverviewRuler.commonContentForeground",{dark:Sn(KX,lE),light:Sn(KX,lE),hcDark:cE,hcLight:cE},w("overviewRulerCommonContentForeground","Common ancestor overview ruler foreground for inline merge-conflicts."));const Uj=J("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hcDark:"#AB5A00",hcLight:"#AB5A00"},w("overviewRulerFindMatchForeground","Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations."),!0),k5e=J("editorOverviewRuler.selectionHighlightForeground","#A0A0A0CC",w("overviewRulerSelectionHighlightForeground","Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations."),!0),Oyt=J("problemsErrorIcon.foreground",aW,w("problemsErrorIconForeground","The color used for the problems error icon.")),Myt=J("problemsWarningIcon.foreground",X_,w("problemsWarningIconForeground","The color used for the problems warning icon.")),Fyt=J("problemsInfoIcon.foreground",Xp,w("problemsInfoIconForeground","The color used for the problems info icon.")),GX=J("minimap.findMatchHighlight",{light:"#d18616",dark:"#d18616",hcDark:"#AB5A00",hcLight:"#0F4A85"},w("minimapFindMatchHighlight","Minimap marker color for find matches."),!0),lW=J("minimap.selectionOccurrenceHighlight",{light:"#c9c9c9",dark:"#676767",hcDark:"#ffffff",hcLight:"#0F4A85"},w("minimapSelectionOccurrenceHighlight","Minimap marker color for repeating editor selections."),!0),m1e=J("minimap.selectionHighlight",{light:"#ADD6FF",dark:"#264F78",hcDark:"#ffffff",hcLight:"#0F4A85"},w("minimapSelectionHighlight","Minimap marker color for the editor selection."),!0),Byt=J("minimap.infoHighlight",{dark:Xp,light:Xp,hcDark:bN,hcLight:bN},w("minimapInfo","Minimap marker color for infos.")),$yt=J("minimap.warningHighlight",{dark:X_,light:X_,hcDark:vN,hcLight:vN},w("overviewRuleWarning","Minimap marker color for warnings.")),Wyt=J("minimap.errorHighlight",{dark:new Te(new Jn(255,18,18,.7)),light:new Te(new Jn(255,18,18,.7)),hcDark:new Te(new Jn(255,50,50,1)),hcLight:"#B5200D"},w("minimapError","Minimap marker color for errors.")),Hyt=J("minimap.background",null,w("minimapBackground","Minimap background color.")),Vyt=J("minimap.foregroundOpacity",Te.fromHex("#000f"),w("minimapForegroundOpacity",'Opacity of foreground elements rendered in the minimap. For example, "#000000c0" will render the elements with 75% opacity.'));J("minimapSlider.background",Sn(v5e,.5),w("minimapSliderBackground","Minimap slider background color."));J("minimapSlider.hoverBackground",Sn(b5e,.5),w("minimapSliderHoverBackground","Minimap slider background color when hovering."));J("minimapSlider.activeBackground",Sn(y5e,.5),w("minimapSliderActiveBackground","Minimap slider background color when clicked on."));J("charts.foreground",In,w("chartsForeground","The foreground color used in charts."));J("charts.lines",Sn(In,.5),w("chartsLines","The color used for horizontal lines in charts."));J("charts.red",aW,w("chartsRed","The red color used in chart visualizations."));J("charts.blue",Xp,w("chartsBlue","The blue color used in chart visualizations."));J("charts.yellow",X_,w("chartsYellow","The yellow color used in chart visualizations."));J("charts.orange",GX,w("chartsOrange","The orange color used in chart visualizations."));J("charts.green",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#374e06"},w("chartsGreen","The green color used in chart visualizations."));J("charts.purple",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("chartsPurple","The purple color used in chart visualizations."));const YX=J("input.background",{dark:"#3C3C3C",light:Te.white,hcDark:Te.black,hcLight:Te.white},w("inputBoxBackground","Input box background.")),E5e=J("input.foreground",In,w("inputBoxForeground","Input box foreground.")),L5e=J("input.border",{dark:null,light:null,hcDark:Yn,hcLight:Yn},w("inputBoxBorder","Input box border.")),cW=J("inputOption.activeBorder",{dark:"#007ACC",light:"#007ACC",hcDark:Yn,hcLight:Yn},w("inputBoxActiveOptionBorder","Border color of activated options in input fields.")),zyt=J("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hcDark:null,hcLight:null},w("inputOption.hoverBackground","Background color of activated options in input fields.")),eO=J("inputOption.activeBackground",{dark:Sn(Zp,.4),light:Sn(Zp,.2),hcDark:Te.transparent,hcLight:Te.transparent},w("inputOption.activeBackground","Background hover color of options in input fields.")),uW=J("inputOption.activeForeground",{dark:Te.white,light:Te.black,hcDark:In,hcLight:In},w("inputOption.activeForeground","Foreground color of activated options in input fields."));J("input.placeholderForeground",{light:Sn(In,.5),dark:Sn(In,.5),hcDark:Sn(In,.7),hcLight:Sn(In,.7)},w("inputPlaceholderForeground","Input box foreground color for placeholder text."));const Uyt=J("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hcDark:Te.black,hcLight:Te.white},w("inputValidationInfoBackground","Input validation background color for information severity.")),jyt=J("inputValidation.infoForeground",{dark:null,light:null,hcDark:null,hcLight:In},w("inputValidationInfoForeground","Input validation foreground color for information severity.")),qyt=J("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hcDark:Yn,hcLight:Yn},w("inputValidationInfoBorder","Input validation border color for information severity.")),Kyt=J("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hcDark:Te.black,hcLight:Te.white},w("inputValidationWarningBackground","Input validation background color for warning severity.")),Gyt=J("inputValidation.warningForeground",{dark:null,light:null,hcDark:null,hcLight:In},w("inputValidationWarningForeground","Input validation foreground color for warning severity.")),Yyt=J("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hcDark:Yn,hcLight:Yn},w("inputValidationWarningBorder","Input validation border color for warning severity.")),Zyt=J("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hcDark:Te.black,hcLight:Te.white},w("inputValidationErrorBackground","Input validation background color for error severity.")),Xyt=J("inputValidation.errorForeground",{dark:null,light:null,hcDark:null,hcLight:In},w("inputValidationErrorForeground","Input validation foreground color for error severity.")),Qyt=J("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hcDark:Yn,hcLight:Yn},w("inputValidationErrorBorder","Input validation border color for error severity.")),dW=J("dropdown.background",{dark:"#3C3C3C",light:Te.white,hcDark:Te.black,hcLight:Te.white},w("dropdownBackground","Dropdown background.")),Jyt=J("dropdown.listBackground",{dark:null,light:null,hcDark:Te.black,hcLight:Te.white},w("dropdownListBackground","Dropdown list background.")),mle=J("dropdown.foreground",{dark:"#F0F0F0",light:In,hcDark:Te.white,hcLight:In},w("dropdownForeground","Dropdown foreground.")),_le=J("dropdown.border",{dark:dW,light:"#CECECE",hcDark:Yn,hcLight:Yn},w("dropdownBorder","Dropdown border.")),T5e=J("button.foreground",Te.white,w("buttonForeground","Button foreground color.")),ewt=J("button.separator",Sn(T5e,.4),w("buttonSeparator","Button separator color.")),LD=J("button.background",{dark:"#0E639C",light:"#007ACC",hcDark:null,hcLight:"#0F4A85"},w("buttonBackground","Button background color.")),twt=J("button.hoverBackground",{dark:_g(LD,.2),light:bC(LD,.2),hcDark:LD,hcLight:LD},w("buttonHoverBackground","Button background color when hovering.")),nwt=J("button.border",Yn,w("buttonBorder","Button border color.")),iwt=J("button.secondaryForeground",{dark:Te.white,light:Te.white,hcDark:Te.white,hcLight:In},w("buttonSecondaryForeground","Secondary button foreground color.")),ZX=J("button.secondaryBackground",{dark:"#3A3D41",light:"#5F6A79",hcDark:null,hcLight:Te.white},w("buttonSecondaryBackground","Secondary button background color.")),rwt=J("button.secondaryHoverBackground",{dark:_g(ZX,.2),light:bC(ZX,.2),hcDark:null,hcLight:null},w("buttonSecondaryHoverBackground","Secondary button background color when hovering.")),TD=J("radio.activeForeground",uW,w("radioActiveForeground","Foreground color of active radio option.")),swt=J("radio.activeBackground",eO,w("radioBackground","Background color of active radio option.")),owt=J("radio.activeBorder",cW,w("radioActiveBorder","Border color of the active radio option.")),awt=J("radio.inactiveForeground",null,w("radioInactiveForeground","Foreground color of inactive radio option.")),lwt=J("radio.inactiveBackground",null,w("radioInactiveBackground","Background color of inactive radio option.")),cwt=J("radio.inactiveBorder",{light:Sn(TD,.2),dark:Sn(TD,.2),hcDark:Sn(TD,.4),hcLight:Sn(TD,.2)},w("radioInactiveBorder","Border color of the inactive radio option.")),uwt=J("radio.inactiveHoverBackground",zyt,w("radioHoverBackground","Background color of inactive active radio option when hovering.")),dwt=J("checkbox.background",dW,w("checkbox.background","Background color of checkbox widget."));J("checkbox.selectBackground",ju,w("checkbox.select.background","Background color of checkbox widget when the element it's in is selected."));const hwt=J("checkbox.foreground",mle,w("checkbox.foreground","Foreground color of checkbox widget.")),fwt=J("checkbox.border",_le,w("checkbox.border","Border color of checkbox widget."));J("checkbox.selectBorder",h8,w("checkbox.select.border","Border color of checkbox widget when the element it's in is selected."));const gwt=J("keybindingLabel.background",{dark:new Te(new Jn(128,128,128,.17)),light:new Te(new Jn(221,221,221,.4)),hcDark:Te.transparent,hcLight:Te.transparent},w("keybindingLabelBackground","Keybinding label background color. The keybinding label is used to represent a keyboard shortcut.")),pwt=J("keybindingLabel.foreground",{dark:Te.fromHex("#CCCCCC"),light:Te.fromHex("#555555"),hcDark:Te.white,hcLight:In},w("keybindingLabelForeground","Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut.")),mwt=J("keybindingLabel.border",{dark:new Te(new Jn(51,51,51,.6)),light:new Te(new Jn(204,204,204,.4)),hcDark:new Te(new Jn(111,195,223)),hcLight:Yn},w("keybindingLabelBorder","Keybinding label border color. The keybinding label is used to represent a keyboard shortcut.")),_wt=J("keybindingLabel.bottomBorder",{dark:new Te(new Jn(68,68,68,.6)),light:new Te(new Jn(187,187,187,.4)),hcDark:new Te(new Jn(111,195,223)),hcLight:In},w("keybindingLabelBottomBorder","Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut.")),vwt=J("list.focusBackground",null,w("listFocusBackground","List/Tree background color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),bwt=J("list.focusForeground",null,w("listFocusForeground","List/Tree foreground color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),ywt=J("list.focusOutline",{dark:Zp,light:Zp,hcDark:Ar,hcLight:Ar},w("listFocusOutline","List/Tree outline color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),wwt=J("list.focusAndSelectionOutline",null,w("listFocusAndSelectionOutline","List/Tree outline color for the focused item when the list/tree is active and selected. An active list/tree has keyboard focus, an inactive does not.")),Rw=J("list.activeSelectionBackground",{dark:"#04395E",light:"#0060C0",hcDark:null,hcLight:Te.fromHex("#0F4A85").transparent(.1)},w("listActiveSelectionBackground","List/Tree background color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),yN=J("list.activeSelectionForeground",{dark:Te.white,light:Te.white,hcDark:null,hcLight:null},w("listActiveSelectionForeground","List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),D5e=J("list.activeSelectionIconForeground",null,w("listActiveSelectionIconForeground","List/Tree icon foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),Cwt=J("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hcDark:null,hcLight:Te.fromHex("#0F4A85").transparent(.1)},w("listInactiveSelectionBackground","List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),xwt=J("list.inactiveSelectionForeground",null,w("listInactiveSelectionForeground","List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),Swt=J("list.inactiveSelectionIconForeground",null,w("listInactiveSelectionIconForeground","List/Tree icon foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),kwt=J("list.inactiveFocusBackground",null,w("listInactiveFocusBackground","List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),Ewt=J("list.inactiveFocusOutline",null,w("listInactiveFocusOutline","List/Tree outline color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),I5e=J("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:Te.white.transparent(.1),hcLight:Te.fromHex("#0F4A85").transparent(.1)},w("listHoverBackground","List/Tree background when hovering over items using the mouse.")),A5e=J("list.hoverForeground",null,w("listHoverForeground","List/Tree foreground when hovering over items using the mouse.")),Lwt=J("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hcDark:null,hcLight:null},w("listDropBackground","List/Tree drag and drop background when moving items over other items when using the mouse.")),Twt=J("list.dropBetweenBackground",{dark:h8,light:h8,hcDark:null,hcLight:null},w("listDropBetweenBackground","List/Tree drag and drop border color when moving items between items when using the mouse.")),xS=J("list.highlightForeground",{dark:"#2AAAFF",light:"#0066BF",hcDark:Zp,hcLight:Zp},w("highlight","List/Tree foreground color of the match highlights when searching inside the list/tree.")),Dwt=J("list.focusHighlightForeground",{dark:xS,light:dyt(Rw,xS,"#BBE7FF"),hcDark:xS,hcLight:xS},w("listFocusHighlightForeground","List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree."));J("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hcDark:"#B89500",hcLight:"#B5200D"},w("invalidItemForeground","List/Tree foreground color for invalid items, for example an unresolved root in explorer."));J("list.errorForeground",{dark:"#F88070",light:"#B01011",hcDark:null,hcLight:null},w("listErrorForeground","Foreground color of list items containing errors."));J("list.warningForeground",{dark:"#CCA700",light:"#855F00",hcDark:null,hcLight:null},w("listWarningForeground","Foreground color of list items containing warnings."));const Iwt=J("listFilterWidget.background",{light:bC(ju,0),dark:_g(ju,0),hcDark:ju,hcLight:ju},w("listFilterWidgetBackground","Background color of the type filter widget in lists and trees.")),Awt=J("listFilterWidget.outline",{dark:Te.transparent,light:Te.transparent,hcDark:"#f38518",hcLight:"#007ACC"},w("listFilterWidgetOutline","Outline color of the type filter widget in lists and trees.")),Nwt=J("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hcDark:Yn,hcLight:Yn},w("listFilterWidgetNoMatchesOutline","Outline color of the type filter widget in lists and trees, when there are no matches.")),Rwt=J("listFilterWidget.shadow",JL,w("listFilterWidgetShadow","Shadow color of the type filter widget in lists and trees."));J("list.filterMatchBackground",{dark:g_,light:g_,hcDark:null,hcLight:null},w("listFilterMatchHighlight","Background color of the filtered match."));J("list.filterMatchBorder",{dark:Av,light:Av,hcDark:Yn,hcLight:Ar},w("listFilterMatchHighlightBorder","Border color of the filtered match."));J("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hcDark:"#A7A8A9",hcLight:"#666666"},w("listDeemphasizedForeground","List/Tree foreground color for items that are deemphasized."));const N5e=J("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},w("treeIndentGuidesStroke","Tree stroke color for the indentation guides.")),Pwt=J("tree.inactiveIndentGuidesStroke",Sn(N5e,.4),w("treeInactiveIndentGuidesStroke","Tree stroke color for the indentation guides that are not active.")),Owt=J("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hcDark:null,hcLight:null},w("tableColumnsBorder","Table border color between columns.")),Mwt=J("tree.tableOddRowsBackground",{dark:Sn(In,.04),light:Sn(In,.04),hcDark:null,hcLight:null},w("tableOddRowsBackgroundColor","Background color for odd table rows."));J("editorActionList.background",ju,w("editorActionListBackground","Action List background color."));J("editorActionList.foreground",oW,w("editorActionListForeground","Action List foreground color."));J("editorActionList.focusForeground",yN,w("editorActionListFocusForeground","Action List foreground color for the focused item."));J("editorActionList.focusBackground",Rw,w("editorActionListFocusBackground","Action List background color for the focused item."));const Fwt=J("menu.border",{dark:null,light:null,hcDark:Yn,hcLight:Yn},w("menuBorder","Border color of menus.")),Bwt=J("menu.foreground",mle,w("menuForeground","Foreground color of menu items.")),$wt=J("menu.background",dW,w("menuBackground","Background color of menu items.")),Wwt=J("menu.selectionForeground",yN,w("menuSelectionForeground","Foreground color of the selected menu item in menus.")),Hwt=J("menu.selectionBackground",Rw,w("menuSelectionBackground","Background color of the selected menu item in menus.")),Vwt=J("menu.selectionBorder",{dark:null,light:null,hcDark:Ar,hcLight:Ar},w("menuSelectionBorder","Border color of the selected menu item in menus.")),zwt=J("menu.separatorBackground",{dark:"#606060",light:"#D4D4D4",hcDark:Yn,hcLight:Yn},w("menuSeparatorBackground","Color of a separator menu item in menus.")),_1e=J("quickInput.background",ju,w("pickerBackground","Quick picker background color. The quick picker widget is the container for pickers like the command palette.")),Uwt=J("quickInput.foreground",oW,w("pickerForeground","Quick picker foreground color. The quick picker widget is the container for pickers like the command palette.")),jwt=J("quickInputTitle.background",{dark:new Te(new Jn(255,255,255,.105)),light:new Te(new Jn(0,0,0,.06)),hcDark:"#000000",hcLight:Te.white},w("pickerTitleBackground","Quick picker title background color. The quick picker widget is the container for pickers like the command palette.")),R5e=J("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hcDark:Te.white,hcLight:"#0F4A85"},w("pickerGroupForeground","Quick picker color for grouping labels.")),qwt=J("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hcDark:Te.white,hcLight:"#0F4A85"},w("pickerGroupBorder","Quick picker color for grouping borders.")),v1e=J("quickInput.list.focusBackground",null,"",void 0,w("quickInput.list.focusBackground deprecation","Please use quickInputList.focusBackground instead")),wN=J("quickInputList.focusForeground",yN,w("quickInput.listFocusForeground","Quick picker foreground color for the focused item.")),vle=J("quickInputList.focusIconForeground",D5e,w("quickInput.listFocusIconForeground","Quick picker icon foreground color for the focused item.")),CN=J("quickInputList.focusBackground",{dark:_N(v1e,Rw),light:_N(v1e,Rw),hcDark:null,hcLight:null},w("quickInput.listFocusBackground","Quick picker background color for the focused item."));J("search.resultsInfoForeground",{light:In,dark:Sn(In,.65),hcDark:In,hcLight:In},w("search.resultsInfoForeground","Color of the text in the search viewlet's completion message."));J("searchEditor.findMatchBackground",{light:Sn(g_,.66),dark:Sn(g_,.66),hcDark:g_,hcLight:g_},w("searchEditor.queryMatch","Color of the Search Editor query matches."));J("searchEditor.findMatchBorder",{light:Sn(Av,.66),dark:Sn(Av,.66),hcDark:Av,hcLight:Av},w("searchEditor.editorFindMatchBorder","Border color of the Search Editor query matches."));var Kwt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},b1e=function(n,e){return function(t,i){e(t,i,n)}};const um=On("hoverService");let uE=class extends me{get delay(){return this.isInstantlyHovering()?0:this._delay}constructor(e,t,i={},r,s){super(),this.placement=e,this.instantHover=t,this.overrideOptions=i,this.configurationService=r,this.hoverService=s,this.lastHoverHideTime=0,this.timeLimit=200,this.hoverDisposables=this._register(new ke),this._delay=this.configurationService.getValue("workbench.hover.delay"),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("workbench.hover.delay")&&(this._delay=this.configurationService.getValue("workbench.hover.delay"))}))}showHover(e,t){const i=typeof this.overrideOptions=="function"?this.overrideOptions(e,t):this.overrideOptions;this.hoverDisposables.clear();const r=Eo(e.target)?[e.target]:e.target.targetElements;for(const o of r)this.hoverDisposables.add(Jr(o,"keydown",a=>{a.equals(9)&&this.hoverService.hideHover()}));const s=Eo(e.content)?void 0:e.content.toString();return this.hoverService.showHover({...e,...i,persistence:{hideOnKeyDown:!0,...i.persistence},id:s,appearance:{...e.appearance,compact:!0,skipFadeInAnimation:this.isInstantlyHovering(),...i.appearance}},t)}isInstantlyHovering(){return this.instantHover&&Date.now()-this.lastHoverHideTime{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Ot(e)}this._hooks.add(Ce(o,je.POINTER_MOVE,a=>{if(a.buttons!==i){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(Ce(o,je.POINTER_UP,a=>this.stopMonitoring(!0)))}}function Ds(n,e,t){let i=null,r=null;if(typeof t.value=="function"?(i="value",r=t.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(i="get",r=t.get),!r)throw new Error("not supported");const s=`$memoize$${e}`;t[i]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[s]}}var Gwt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gr;(function(n){n.Tap="-monaco-gesturetap",n.Change="-monaco-gesturechange",n.Start="-monaco-gesturestart",n.End="-monaco-gesturesend",n.Contextmenu="-monaco-gesturecontextmenu"})(gr||(gr={}));class Fr extends me{static{this.SCROLL_FRICTION=-.005}static{this.HOLD_DELAY=700}static{this.CLEAR_TAP_COUNT_TIME=400}constructor(){super(),this.dispatched=!1,this.targets=new Rl,this.ignoreTargets=new Rl,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ge.runAndSubscribe($$,({window:e,disposables:t})=>{t.add(Ce(e.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),t.add(Ce(e.document,"touchend",i=>this.onTouchEnd(e,i))),t.add(Ce(e.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Xi,disposables:this._store}))}static addTarget(e){if(!Fr.isTouchDevice())return me.None;Fr.INSTANCE||(Fr.INSTANCE=new Fr);const t=Fr.INSTANCE.targets.push(e);return Lt(t)}static ignoreTarget(e){if(!Fr.isTouchDevice())return me.None;Fr.INSTANCE||(Fr.INSTANCE=new Fr);const t=Fr.INSTANCE.ignoreTargets.push(e);return Lt(t)}static isTouchDevice(){return"ontouchstart"in Xi||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){const t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,r=e.targetTouches.length;i=Fr.HOLD_DELAY&&Math.abs(l.initialPageX-yd(l.rollingPageX))<30&&Math.abs(l.initialPageY-yd(l.rollingPageY))<30){const u=this.newGestureEvent(gr.Contextmenu,l.initialTarget);u.pageX=yd(l.rollingPageX),u.pageY=yd(l.rollingPageY),this.dispatchEvent(u)}else if(r===1){const u=yd(l.rollingPageX),d=yd(l.rollingPageY),h=yd(l.rollingTimestamps)-l.rollingTimestamps[0],f=u-l.rollingPageX[0],g=d-l.rollingPageY[0],p=[...this.targets].filter(m=>l.initialTarget instanceof Node&&m.contains(l.initialTarget));this.inertia(e,p,i,Math.abs(f)/h,f>0?1:-1,u,Math.abs(g)/h,g>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(gr.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){const i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(e){if(e.type===gr.Tap){const t=new Date().getTime();let i=0;t-this._lastSetTapCountTime>Fr.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=t,e.tapCount=i}else(e.type===gr.Change||e.type===gr.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(const i of this.ignoreTargets)if(i.contains(e.initialTarget))return;const t=[];for(const i of this.targets)if(i.contains(e.initialTarget)){let r=0,s=e.initialTarget;for(;s&&s!==i;)r++,s=s.parentElement;t.push([r,i])}t.sort((i,r)=>i[0]-r[0]);for(const[i,r]of t)r.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,i,r,s,o,a,l,c){this.handle=du(e,()=>{const u=Date.now(),d=u-i;let h=0,f=0,g=!0;r+=Fr.SCROLL_FRICTION*d,a+=Fr.SCROLL_FRICTION*d,r>0&&(g=!1,h=s*r*d),a>0&&(g=!1,f=l*a*d);const p=this.newGestureEvent(gr.Change);p.translationX=h,p.translationY=f,t.forEach(m=>m.dispatchEvent(p)),g||this.inertia(e,t,u,r,s,o+h,a,l,c+f)})}onTouchMove(e){const t=Date.now();for(let i=0,r=e.changedTouches.length;i3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}}Gwt([Ds],Fr,"isTouchDevice",null);let ud=class extends me{onclick(e,t){this._register(Ce(e,je.CLICK,i=>t(new qh(Ot(e),i))))}onmousedown(e,t){this._register(Ce(e,je.MOUSE_DOWN,i=>t(new qh(Ot(e),i))))}onmouseover(e,t){this._register(Ce(e,je.MOUSE_OVER,i=>t(new qh(Ot(e),i))))}onmouseleave(e,t){this._register(Ce(e,je.MOUSE_LEAVE,i=>t(new qh(Ot(e),i))))}onkeydown(e,t){this._register(Ce(e,je.KEY_DOWN,i=>t(new or(i))))}onkeyup(e,t){this._register(Ce(e,je.KEY_UP,i=>t(new or(i))))}oninput(e,t){this._register(Ce(e,je.INPUT,t))}onblur(e,t){this._register(Ce(e,je.BLUR,t))}onfocus(e,t){this._register(Ce(e,je.FOCUS,t))}ignoreGesture(e){return Fr.ignoreTarget(e)}};const dE=11;class Ywt extends ud{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.classList.add(...zt.asClassNameArray(e.icon)),this.domNode.style.position="absolute",this.domNode.style.width=dE+"px",this.domNode.style.height=dE+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new e2),this._register(Jr(this.bgDomNode,je.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Jr(this.domNode,je.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new $ae),this._pointerdownScheduleRepeatTimer=this._register(new hf)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ot(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}}class Zwt extends me{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new hf)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){const e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}}const Xwt=140;class P5e extends ud{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Zwt(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new e2),this._shouldRender=!0,this.domNode=Ci(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Ce(this.domNode.domNode,je.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){const t=this._register(new Ywt(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=Ci(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ce(this.slider.domNode,je.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){const t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);i<=s&&s<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{const s=ms(this.domNode.domNode);t=e.pageX-s.left,i=e.pageY-s.top}const r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{const o=this._sliderOrthogonalPointerPosition(s),a=Math.abs(o-i);if(Ta&&a>Xwt){this._setDesiredScrollPositionNow(r.getScrollPosition());return}const c=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(c))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){const t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}}const Qwt=20;class hE{constructor(e,t,i,r,s,o){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new hE(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){const t=Math.round(e);return this._visibleSize!==t?(this._visibleSize=t,this._refreshComputedValues(),!0):!1}setScrollSize(e){const t=Math.round(e);return this._scrollSize!==t?(this._scrollSize=t,this._refreshComputedValues(),!0):!1}setScrollPosition(e){const t=Math.round(e);return this._scrollPosition!==t?(this._scrollPosition=t,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,r,s){const o=Math.max(0,i-e),a=Math.max(0,o-2*t),l=r>0&&r>i;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};const c=Math.round(Math.max(Qwt,Math.floor(i*a/r))),u=(a-c)/(r-i),d=s*u;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){const e=hE._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize;let i=this._scrollPosition;return tthis._host.onMouseWheel(new Dw(null,1,0))}),this._createArrow({className:"scra",icon:ze.scrollbarButtonRight,top:a,left:void 0,bottom:void 0,right:o,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Dw(null,-1,0))})}this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}}class eCt extends P5e{constructor(e,t,i){const r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new hE(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows){const o=(t.arrowSize-dE)/2,a=(t.verticalScrollbarSize-dE)/2;this._createArrow({className:"scra",icon:ze.scrollbarButtonUp,top:o,left:a,bottom:void 0,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Dw(null,0,1))}),this._createArrow({className:"scra",icon:ze.scrollbarButtonDown,top:void 0,left:a,bottom:o,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Dw(null,0,-1))})}this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}}class g8{constructor(e,t,i,r,s,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t=t|0,i=i|0,r=r|0,s=s|0,o=o|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,t<0&&(t=0),r+t>i&&(r=i-t),r<0&&(r=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=t,this.scrollWidth=i,this.scrollLeft=r,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,t){return new g8(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new g8(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){const i=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:r,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}}class t2 extends me{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new g8(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){const i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){const t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};const i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;t?r=new xN(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{const i=this._state.withScrollPosition(e);this._smoothScrolling=xN.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;const e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){const i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}}class y1e{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}}function jj(n,e){const t=e-n;return function(i){return n+t*iCt(i)}}function tCt(n,e,t){return function(i){return i2.5*i){let s,o;return e0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(i+=.25),t){const r=Math.abs(e.deltaX),s=Math.abs(e.deltaY),o=Math.abs(t.deltaX),a=Math.abs(t.deltaY),l=Math.max(Math.min(r,o),1),c=Math.max(Math.min(s,a),1),u=Math.max(r,o),d=Math.max(s,a);u%l===0&&d%c===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}}class ble extends ud{get options(){return this._options}constructor(e,t,i){super(),this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new fe),e.style.overflow="hidden",this._options=oCt(t),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));const r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new eCt(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Jwt(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="monaco-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.style.overflow="hidden",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ci(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ci(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ci(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new hf),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=er(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Rn&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Dw(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=er(this._mouseWheelToDispose),e)){const i=r=>{this._onMouseWheel(new Dw(r))};this._mouseWheelToDispose.push(Ce(this._listenOnDomNode,je.MOUSE_WHEEL,i,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;const t=hW.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);const a=!Rn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);const l=this._scrollable.getFutureScrollPosition();let c={};if(s){const u=w1e*s,d=l.scrollTop-(u<0?Math.floor(u):Math.ceil(u));this._verticalScrollbar.writeScrollPosition(c,d)}if(o){const u=w1e*o,d=l.scrollLeft-(u<0?Math.floor(u):Math.ceil(u));this._horizontalScrollbar.writeScrollPosition(c,d)}c=this._scrollable.validateScrollPosition(c),(l.scrollLeft!==c.scrollLeft||l.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){const e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,r=i?" left":"",s=t?" top":"",o=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),rCt)}}class O5e extends ble{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;const i=new t2({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:r=>du(Ot(e),r)});super(e,t,i),this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}}class fW extends ble{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}}class tO extends ble{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;const i=new t2({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:r=>du(Ot(e),r)});super(e,t,i),this._register(i),this._element=e,this._register(this.onScroll(r=>{r.scrollTopChanged&&(this._element.scrollTop=r.scrollTop),r.scrollLeftChanged&&(this._element.scrollLeft=r.scrollLeft)})),this.scanDomNode()}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}}function oCt(n){const e={lazyRender:typeof n.lazyRender<"u"?n.lazyRender:!1,className:typeof n.className<"u"?n.className:"",useShadows:typeof n.useShadows<"u"?n.useShadows:!0,handleMouseWheel:typeof n.handleMouseWheel<"u"?n.handleMouseWheel:!0,flipAxes:typeof n.flipAxes<"u"?n.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof n.consumeMouseWheelIfScrollbarIsNeeded<"u"?n.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof n.alwaysConsumeMouseWheel<"u"?n.alwaysConsumeMouseWheel:!1,scrollYToX:typeof n.scrollYToX<"u"?n.scrollYToX:!1,mouseWheelScrollSensitivity:typeof n.mouseWheelScrollSensitivity<"u"?n.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof n.fastScrollSensitivity<"u"?n.fastScrollSensitivity:5,scrollPredominantAxis:typeof n.scrollPredominantAxis<"u"?n.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof n.mouseWheelSmoothScroll<"u"?n.mouseWheelSmoothScroll:!0,arrowSize:typeof n.arrowSize<"u"?n.arrowSize:11,listenOnDomNode:typeof n.listenOnDomNode<"u"?n.listenOnDomNode:null,horizontal:typeof n.horizontal<"u"?n.horizontal:1,horizontalScrollbarSize:typeof n.horizontalScrollbarSize<"u"?n.horizontalScrollbarSize:10,horizontalSliderSize:typeof n.horizontalSliderSize<"u"?n.horizontalSliderSize:0,horizontalHasArrows:typeof n.horizontalHasArrows<"u"?n.horizontalHasArrows:!1,vertical:typeof n.vertical<"u"?n.vertical:1,verticalScrollbarSize:typeof n.verticalScrollbarSize<"u"?n.verticalScrollbarSize:10,verticalHasArrows:typeof n.verticalHasArrows<"u"?n.verticalHasArrows:!1,verticalSliderSize:typeof n.verticalSliderSize<"u"?n.verticalSliderSize:0,scrollByPage:typeof n.scrollByPage<"u"?n.scrollByPage:!1};return e.horizontalSliderSize=typeof n.horizontalSliderSize<"u"?n.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof n.verticalSliderSize<"u"?n.verticalSliderSize:e.verticalScrollbarSize,Rn&&(e.className+=" mac"),e}const A4=qe;let yle=class extends me{constructor(){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new tO(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}};class gW extends me{static render(e,t,i){return new gW(e,t,i)}constructor(e,t,i){super(),this.actionLabel=t.label,this.actionKeybindingLabel=i,this.actionContainer=Ne(e,A4("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=Ne(this.actionContainer,A4("a.action")),this.action.setAttribute("role","button"),t.iconClass&&Ne(this.action,A4(`span.icon.${t.iconClass}`));const r=Ne(this.action,A4("span"));r.textContent=i?`${t.label} (${i})`:t.label,this._store.add(new F5e(this.actionContainer,t.run)),this._store.add(new B5e(this.actionContainer,t.run,[3,10])),this.setEnabled(!0)}setEnabled(e){e?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}}function M5e(n,e){return n&&e?w("acessibleViewHint","Inspect this in the accessible view with {0}.",e):n?w("acessibleViewHintNoKbOpen","Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."):""}class F5e extends me{constructor(e,t){super(),this._register(Ce(e,je.CLICK,i=>{i.stopPropagation(),i.preventDefault(),t(e)}))}}class B5e extends me{constructor(e,t,i){super(),this._register(Ce(e,je.KEY_DOWN,r=>{const s=new or(r);i.some(o=>s.equals(o))&&(r.stopPropagation(),r.preventDefault(),t(e))}))}}const Pc=On("openerService");function aCt(n){let e;const t=/^L?(\d+)(?:,(\d+))?(-L?(\d+)(?:,(\d+))?)?/.exec(n.fragment);return t&&(e={startLineNumber:parseInt(t[1]),startColumn:t[2]?parseInt(t[2]):1,endLineNumber:t[4]?parseInt(t[4]):void 0,endColumn:t[4]?t[5]?parseInt(t[5]):1:void 0},n=n.with({fragment:""})),{selection:e,uri:n}}class $n{get event(){return this.emitter.event}constructor(e,t,i){const r=s=>this.emitter.fire(s);this.emitter=new fe({onWillAddFirstListener:()=>e.addEventListener(t,r,i),onDidRemoveLastListener:()=>e.removeEventListener(t,r,i)})}dispose(){this.emitter.dispose()}}function lCt(n,e={}){const t=wle(e);return t.textContent=n,t}function cCt(n,e={}){const t=wle(e);return $5e(t,dCt(n,!!e.renderCodeSegments),e.actionHandler,e.renderCodeSegments),t}function wle(n){const e=n.inline?"span":"div",t=document.createElement(e);return n.className&&(t.className=n.className),t}class uCt{constructor(e){this.source=e,this.index=0}eos(){return this.index>=this.source.length}next(){const e=this.peek();return this.advance(),e}peek(){return this.source[this.index]}advance(){this.index++}}function $5e(n,e,t,i){let r;if(e.type===2)r=document.createTextNode(e.content||"");else if(e.type===3)r=document.createElement("b");else if(e.type===4)r=document.createElement("i");else if(e.type===7&&i)r=document.createElement("code");else if(e.type===5&&t){const s=document.createElement("a");t.disposables.add(Jr(s,"click",o=>{t.callback(String(e.index),o)})),r=s}else e.type===8?r=document.createElement("br"):e.type===1&&(r=n);r&&n!==r&&n.appendChild(r),r&&Array.isArray(e.children)&&e.children.forEach(s=>{$5e(r,s,t,i)})}function dCt(n,e){const t={type:1,children:[]};let i=0,r=t;const s=[],o=new uCt(n);for(;!o.eos();){let a=o.next();const l=a==="\\"&&XX(o.peek(),e)!==0;if(l&&(a=o.next()),!l&&hCt(a,e)&&a===o.peek()){o.advance(),r.type===2&&(r=s.pop());const c=XX(a,e);if(r.type===c||r.type===5&&c===6)r=s.pop();else{const u={type:c,children:[]};c===5&&(u.index=i,i++),r.children.push(u),s.push(r),r=u}}else if(a===` +`)r.type===2&&(r=s.pop()),r.children.push({type:8});else if(r.type!==2){const c={type:2,content:a};r.children.push(c),s.push(r),r=c}else r.content+=a}return r.type===2&&(r=s.pop()),t}function hCt(n,e){return XX(n,e)!==0}function XX(n,e){switch(n){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return e?7:0;default:return 0}}const fCt=new RegExp(`(\\\\)?\\$\\((${zt.iconNameExpression}(?:${zt.iconModifierExpression})?)\\)`,"g");function ob(n){const e=new Array;let t,i=0,r=0;for(;(t=fCt.exec(n))!==null;){r=t.index||0,i0)return new Uint32Array(e)}let Au=0;const gv=new Uint32Array(10);function pCt(n){if(Au=0,Yg(n,qj,4352),Au>0||(Yg(n,Kj,4449),Au>0)||(Yg(n,Gj,4520),Au>0)||(Yg(n,L1,12593),Au))return gv.subarray(0,Au);if(n>=44032&&n<=55203){const e=n-44032,t=e%588,i=Math.floor(e/588),r=Math.floor(t/28),s=t%28-1;if(i=0&&(s0)return gv.subarray(0,Au)}}function Yg(n,e,t){n>=t&&n>8&&(gv[Au++]=n>>8&255),n>>16&&(gv[Au++]=n>>16&255))}const qj=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),Kj=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),Gj=new Uint16Array([114,82,29810,115,30579,26483,101,102,29286,24934,29030,29798,30822,30310,26470,97,113,29809,116,84,100,119,99,122,120,118,103]),L1=new Uint16Array([114,82,29810,115,30579,26483,101,69,102,29286,24934,29030,29798,30822,30310,26470,97,113,81,29809,116,84,100,119,87,99,122,120,118,103,107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]);function Cle(...n){return function(e,t){for(let i=0,r=n.length;i0?[{start:0,end:e.length}]:[]:null}function H5e(n,e){const t=e.toLowerCase().indexOf(n.toLowerCase());return t===-1?null:[{start:t,end:t+n.length}]}function V5e(n,e){return QX(n.toLowerCase(),e.toLowerCase(),0,0)}function QX(n,e,t,i){if(t===n.length)return[];if(i===e.length)return null;if(n[t]===e[i]){let r=null;return(r=QX(n,e,t+1,i+1))?kle({start:i,end:i+1},r):null}return QX(n,e,t,i+1)}function xle(n){return 97<=n&&n<=122}function pW(n){return 65<=n&&n<=90}function Sle(n){return 48<=n&&n<=57}function z5e(n){return n===32||n===9||n===10||n===13}const U5e=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(n=>U5e.add(n.charCodeAt(0)));function p8(n){return z5e(n)||U5e.has(n)}function C1e(n,e){return n===e||p8(n)&&p8(e)}const Yj=new Map;function x1e(n){if(Yj.has(n))return Yj.get(n);let e;const t=gCt(n);return t&&(e=t),Yj.set(n,e),e}function j5e(n){return xle(n)||pW(n)||Sle(n)}function kle(n,e){return e.length===0?e=[n]:n.end===e[0].start?e[0].start=n.start:e.unshift(n),e}function q5e(n,e){for(let t=e;t0&&!j5e(n.charCodeAt(t-1)))return t}return n.length}function JX(n,e,t,i){if(t===n.length)return[];if(i===e.length)return null;if(n[t]!==e[i].toLowerCase())return null;{let r=null,s=i+1;for(r=JX(n,e,t+1,i+1);!r&&(s=q5e(e,s)).6}function bCt(n){const{upperPercent:e,lowerPercent:t,alphaPercent:i,numericPercent:r}=n;return t>.2&&e<.8&&i>.6&&r<.2}function yCt(n){let e=0,t=0,i=0,r=0;for(let s=0;s60&&(e=e.substring(0,60));const t=_Ct(e);if(!bCt(t)){if(!vCt(t))return null;e=e.toLowerCase()}let i=null,r=0;for(n=n.toLowerCase();r0&&p8(n.charCodeAt(t-1)))return t;return n.length}const CCt=Cle(SN,K5e,H5e),xCt=Cle(SN,K5e,V5e),S1e=new lm(1e4);function k1e(n,e,t=!1){if(typeof n!="string"||typeof e!="string")return null;let i=S1e.get(n);i||(i=new RegExp(l_t(n),"i"),S1e.set(n,i));const r=i.exec(e);return r?[{start:r.index,end:r.index+r[0].length}]:t?xCt(n,e):CCt(n,e)}function SCt(n,e){const t=Ow(n,n.toLowerCase(),0,e,e.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return t?nO(t):null}function kCt(n,e,t,i,r,s){const o=Math.min(13,n.length);for(;t"u")return[];const e=[],t=n[1];for(let i=n.length-1;i>1;i--){const r=n[i]+t,s=e[e.length-1];s&&s.end===r?s.end=r+1:e.push({start:r,end:r+1})}return e}const Nv=128;function Ele(){const n=[],e=[];for(let t=0;t<=Nv;t++)e[t]=0;for(let t=0;t<=Nv;t++)n.push(e.slice(0));return n}function Y5e(n){const e=[];for(let t=0;t<=n;t++)e[t]=0;return e}const Z5e=Y5e(2*Nv),tQ=Y5e(2*Nv),Im=Ele(),T1=Ele(),N4=Ele();function R4(n,e){if(e<0||e>=n.length)return!1;const t=n.codePointAt(e);switch(t){case 95:case 45:case 46:case 32:case 47:case 92:case 39:case 34:case 58:case 36:case 60:case 62:case 40:case 41:case 91:case 93:case 123:case 125:return!0;case void 0:return!1;default:return!!Aae(t)}}function E1e(n,e){if(e<0||e>=n.length)return!1;switch(n.charCodeAt(e)){case 32:case 9:return!0;default:return!1}}function Z5(n,e,t){return e[n]!==t[n]}function ECt(n,e,t,i,r,s,o=!1){for(;eNv?Nv:n.length,l=i.length>Nv?Nv:i.length;if(t>=a||s>=l||a-t>l-s||!ECt(e,t,a,r,s,l,!0))return;LCt(a,l,t,s,e,r);let c=1,u=1,d=t,h=s;const f=[!1];for(c=1,d=t;dv,I=D?T1[c][u-1]+(Im[c][u-1]>0?-5:0):0,O=h>v+1&&Im[c][u-1]>0,M=O?T1[c][u-2]+(Im[c][u-2]>0?-5:0):0;if(O&&(!D||M>=I)&&(!k||M>=L))T1[c][u]=M,N4[c][u]=3,Im[c][u]=0;else if(D&&(!k||I>=L))T1[c][u]=I,N4[c][u]=2,Im[c][u]=0;else if(k)T1[c][u]=L,N4[c][u]=1,Im[c][u]=Im[c-1][u-1]+1;else throw new Error("not possible")}}if(!f[0]&&!o.firstMatchCanBeWeak)return;c--,u--;const g=[T1[c][u],s];let p=0,m=0;for(;c>=1;){let v=u;do{const y=N4[c][v];if(y===3)v=v-2;else if(y===2)v=v-1;else break}while(v>=1);p>1&&e[t+c-1]===r[s+u-1]&&!Z5(v+s-1,i,r)&&p+1>Im[c][v]&&(v=u),v===u?p++:p=1,m||(m=v),c--,u=v-1,g.push(u)}l-s===a&&o.boostFullMatch&&(g[0]+=2);const _=m-a;return g[0]-=_,g}function LCt(n,e,t,i,r,s){let o=n-1,a=e-1;for(;o>=t&&a>=i;)r[o]===s[a]&&(tQ[o]=a,o--),a--}function TCt(n,e,t,i,r,s,o,a,l,c,u){if(e[t]!==s[o])return Number.MIN_SAFE_INTEGER;let d=1,h=!1;return o===t-i?d=n[t]===r[o]?7:5:Z5(o,r,s)&&(o===0||!Z5(o-1,r,s))?(d=n[t]===r[o]?7:5,h=!0):R4(s,o)&&(o===0||!R4(s,o-1))?d=5:(R4(s,o-1)||E1e(s,o-1))&&(d=5,h=!0),d>1&&t===i&&(u[0]=!0),h||(h=Z5(o,r,s)||R4(s,o-1)||E1e(s,o-1)),t===i?o>l&&(d-=h?3:5):c?d+=h?2:0:d+=h?0:1,o+1===a&&(d-=h?3:5),d}function DCt(n,e,t,i,r,s,o){return ICt(n,e,t,i,r,s,!0,o)}function ICt(n,e,t,i,r,s,o,a){let l=Ow(n,e,t,i,r,s,a);if(l&&!o)return l;if(n.length>=3){const c=Math.min(7,n.length-1);for(let u=t+1;ul[0])&&(l=h))}}}return l}function ACt(n,e){if(e+1>=n.length)return;const t=n[e],i=n[e+1];if(t!==i)return n.slice(0,e)+i+t+n.slice(e+2)}const NCt="$(",Tle=new RegExp(`\\$\\(${zt.iconNameExpression}(?:${zt.iconModifierExpression})?\\)`,"g"),RCt=new RegExp(`(\\\\)?${Tle.source}`,"g");function PCt(n){return n.replace(RCt,(e,t)=>t?e:`\\${e}`)}const OCt=new RegExp(`\\\\${Tle.source}`,"g");function MCt(n){return n.replace(OCt,e=>`\\${e}`)}const FCt=new RegExp(`(\\s)?(\\\\)?${Tle.source}(\\s)?`,"g");function Dle(n){return n.indexOf(NCt)===-1?n:n.replace(FCt,(e,t,i,r)=>i?e:t||r||"")}function BCt(n){return n?n.replace(/\$\((.*?)\)/g,(e,t)=>` ${t} `).trim():""}const Zj=new RegExp(`\\$\\(${zt.iconNameCharacter}+\\)`,"g");function DD(n){Zj.lastIndex=0;let e="";const t=[];let i=0;for(;;){const r=Zj.lastIndex,s=Zj.exec(n),o=n.substring(r,s?.index);if(o.length>0){e+=o;for(let a=0;ae1e(i).length&&i[i.length-1]===t}else{const i=e.path;return i.length>1&&i.charCodeAt(i.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(e.fsPath)}}removeTrailingPathSeparator(e,t=fg){return D1e(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=fg){let i=!1;if(e.scheme===sn.file){const r=ip(e);i=r!==void 0&&r.length===e1e(r).length&&r[r.length-1]===t}else{t="/";const r=e.path;i=r.length===1&&r.charCodeAt(r.length-1)===47}return!i&&!D1e(e,t)?e.with({path:e.path+"/"}):e}}const Nr=new $Ct(()=>!1),kN=Nr.isEqual.bind(Nr);Nr.isEqualOrParent.bind(Nr);Nr.getComparisonKey.bind(Nr);const WCt=Nr.basenameOrAuthority.bind(Nr),th=Nr.basename.bind(Nr),HCt=Nr.extname.bind(Nr),mW=Nr.dirname.bind(Nr),VCt=Nr.joinPath.bind(Nr),zCt=Nr.normalizePath.bind(Nr),UCt=Nr.relativePath.bind(Nr),L1e=Nr.resolvePath.bind(Nr);Nr.isAbsolutePath.bind(Nr);const T1e=Nr.isEqualAuthority.bind(Nr),D1e=Nr.hasTrailingPathSeparator.bind(Nr);Nr.removeTrailingPathSeparator.bind(Nr);Nr.addTrailingPathSeparator.bind(Nr);var Tb;(function(n){n.META_DATA_LABEL="label",n.META_DATA_DESCRIPTION="description",n.META_DATA_SIZE="size",n.META_DATA_MIME="mime";function e(t){const i=new Map;t.path.substring(t.path.indexOf(";")+1,t.path.lastIndexOf(";")).split(";").forEach(o=>{const[a,l]=o.split(":");a&&l&&i.set(a,l)});const s=t.path.substring(0,t.path.indexOf(";"));return s&&i.set(n.META_DATA_MIME,s),i}n.parseMetaData=e})(Tb||(Tb={}));class za{constructor(e="",t=!1){if(this.value=e,typeof this.value!="string")throw qd("value");typeof t=="boolean"?(this.isTrusted=t,this.supportThemeIcons=!1,this.supportHtml=!1):(this.isTrusted=t.isTrusted??void 0,this.supportThemeIcons=t.supportThemeIcons??!1,this.supportHtml=t.supportHtml??!1)}appendText(e,t=0){return this.value+=qCt(this.supportThemeIcons?PCt(e):e).replace(/([ \t]+)/g,(i,r)=>" ".repeat(r.length)).replace(/\>/gm,"\\>").replace(/\n/g,t===1?`\\ `:` `),this}appendMarkdown(e){return this.value+=e,this}appendCodeblock(e,t){return this.value+=` @@ -210,7 +210,7 @@ ${re} `}tablecell(re){const oe=this.parser.parseInline(re.tokens),H=re.header?"th":"td";return(re.align?`<${H} align="${re.align}">`:`<${H}>`)+oe+` `}strong({tokens:re}){return`${this.parser.parseInline(re)}`}em({tokens:re}){return`${this.parser.parseInline(re)}`}codespan({text:re}){return`${re}`}br(re){return"
"}del({tokens:re}){return`${this.parser.parseInline(re)}`}link({href:re,title:oe,tokens:H}){const Y=this.parser.parseInline(H),ne=f(re);if(ne===null)return Y;re=ne;let N='",N}image({href:re,title:oe,text:H}){const Y=f(re);if(Y===null)return H;re=Y;let ne=`${H}{const F=ne[N].flat(1/0);H=H.concat(this.walkTokens(F,oe))}):ne.tokens&&(H=H.concat(this.walkTokens(ne.tokens,oe)))}}return H}use(...re){const oe=this.defaults.extensions||{renderers:{},childTokens:{}};return re.forEach(H=>{const Y={...H};if(Y.async=this.defaults.async||Y.async||!1,H.extensions&&(H.extensions.forEach(ne=>{if(!ne.name)throw new Error("extension name required");if("renderer"in ne){const N=oe.renderers[ne.name];N?oe.renderers[ne.name]=function(...F){let V=ne.renderer.apply(this,F);return V===!1&&(V=N.apply(this,F)),V}:oe.renderers[ne.name]=ne.renderer}if("tokenizer"in ne){if(!ne.level||ne.level!=="block"&&ne.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const N=oe[ne.level];N?N.unshift(ne.tokenizer):oe[ne.level]=[ne.tokenizer],ne.start&&(ne.level==="block"?oe.startBlock?oe.startBlock.push(ne.start):oe.startBlock=[ne.start]:ne.level==="inline"&&(oe.startInline?oe.startInline.push(ne.start):oe.startInline=[ne.start]))}"childTokens"in ne&&ne.childTokens&&(oe.childTokens[ne.name]=ne.childTokens)}),Y.extensions=oe),H.renderer){const ne=this.defaults.renderer||new cr(this.defaults);for(const N in H.renderer){if(!(N in ne))throw new Error(`renderer '${N}' does not exist`);if(["options","parser"].includes(N))continue;const F=N,V=H.renderer[F],A=ne[F];ne[F]=(...K)=>{let ge=V.apply(ne,K);return ge===!1&&(ge=A.apply(ne,K)),ge||""}}Y.renderer=ne}if(H.tokenizer){const ne=this.defaults.tokenizer||new C(this.defaults);for(const N in H.tokenizer){if(!(N in ne))throw new Error(`tokenizer '${N}' does not exist`);if(["options","rules","lexer"].includes(N))continue;const F=N,V=H.tokenizer[F],A=ne[F];ne[F]=(...K)=>{let ge=V.apply(ne,K);return ge===!1&&(ge=A.apply(ne,K)),ge}}Y.tokenizer=ne}if(H.hooks){const ne=this.defaults.hooks||new Er;for(const N in H.hooks){if(!(N in ne))throw new Error(`hook '${N}' does not exist`);if(N==="options")continue;const F=N,V=H.hooks[F],A=ne[F];Er.passThroughHooks.has(N)?ne[F]=K=>{if(this.defaults.async)return Promise.resolve(V.call(ne,K)).then(pe=>A.call(ne,pe));const ge=V.call(ne,K);return A.call(ne,ge)}:ne[F]=(...K)=>{let ge=V.apply(ne,K);return ge===!1&&(ge=A.apply(ne,K)),ge}}Y.hooks=ne}if(H.walkTokens){const ne=this.defaults.walkTokens,N=H.walkTokens;Y.walkTokens=function(F){let V=[];return V.push(N.call(this,F)),ne&&(V=V.concat(ne.call(this,F))),V}}this.defaults={...this.defaults,...Y}}),this}setOptions(re){return this.defaults={...this.defaults,...re},this}lexer(re,oe){return Or.lex(re,oe??this.defaults)}parser(re,oe){return qi.parse(re,oe??this.defaults)}parseMarkdown(re,oe){return(Y,ne)=>{const N={...ne},F={...this.defaults,...N},V=this.onError(!!F.silent,!!F.async);if(this.defaults.async===!0&&N.async===!1)return V(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof Y>"u"||Y===null)return V(new Error("marked(): input parameter is undefined or null"));if(typeof Y!="string")return V(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Y)+", string expected"));if(F.hooks&&(F.hooks.options=F),F.async)return Promise.resolve(F.hooks?F.hooks.preprocess(Y):Y).then(A=>re(A,F)).then(A=>F.hooks?F.hooks.processAllTokens(A):A).then(A=>F.walkTokens?Promise.all(this.walkTokens(A,F.walkTokens)).then(()=>A):A).then(A=>oe(A,F)).then(A=>F.hooks?F.hooks.postprocess(A):A).catch(V);try{F.hooks&&(Y=F.hooks.preprocess(Y));let A=re(Y,F);F.hooks&&(A=F.hooks.processAllTokens(A)),F.walkTokens&&this.walkTokens(A,F.walkTokens);let K=oe(A,F);return F.hooks&&(K=F.hooks.postprocess(K)),K}catch(A){return V(A)}}}onError(re,oe){return H=>{if(H.message+=` -Please report this to https://github.com/markedjs/marked.`,re){const Y="

An error occurred:

"+u(H.message+"",!0)+"
";return oe?Promise.resolve(Y):Y}if(oe)return Promise.reject(H);throw H}}}const As=new oo;function Ft(pn,re){return As.parse(pn,re)}Ft.options=Ft.setOptions=function(pn){return As.setOptions(pn),Ft.defaults=As.defaults,i(Ft.defaults),Ft},Ft.getDefaults=t,Ft.defaults=e.defaults,Ft.use=function(...pn){return As.use(...pn),Ft.defaults=As.defaults,i(Ft.defaults),Ft},Ft.walkTokens=function(pn,re){return As.walkTokens(pn,re)},Ft.parseInline=As.parseInline,Ft.Parser=qi,Ft.parser=qi.parse,Ft.Renderer=cr,Ft.TextRenderer=us,Ft.Lexer=Or,Ft.lexer=Or.lex,Ft.Tokenizer=C,Ft.Hooks=Er,Ft.parse=Ft;const qn=Ft.options,pi=Ft.setOptions,bn=Ft.use,dn=Ft.walkTokens,bi=Ft.parseInline,mi=Ft,Yi=qi.parse,Wn=Or.lex;e.Hooks=Er,e.Lexer=Or,e.Marked=oo,e.Parser=qi,e.Renderer=cr,e.TextRenderer=us,e.Tokenizer=C,e.getDefaults=t,e.lexer=Wn,e.marked=Ft,e.options=qn,e.parse=mi,e.parseInline=bi,e.parser=Yi,e.setOptions=pi,e.use=bn,e.walkTokens=dn})})();Ja.Hooks||exports.Hooks;Ja.Lexer||exports.Lexer;Ja.Marked||exports.Marked;Ja.Parser||exports.Parser;var XFe=Ja.Renderer||exports.Renderer;Ja.TextRenderer||exports.TextRenderer;Ja.Tokenizer||exports.Tokenizer;var YCt=Ja.defaults||exports.defaults;Ja.getDefaults||exports.getDefaults;var _W=Ja.lexer||exports.lexer;Ja.marked||exports.marked;Ja.options||exports.options;var QFe=Ja.parse||exports.parse;Ja.parseInline||exports.parseInline;var ZCt=Ja.parser||exports.parser;Ja.setOptions||exports.setOptions;Ja.use||exports.use;Ja.walkTokens||exports.walkTokens;function XCt(n){return JSON.stringify(n,QCt)}function iQ(n){let e=JSON.parse(n);return e=rQ(e),e}function QCt(n,e){return e instanceof RegExp?{$mid:2,source:e.source,flags:e.flags}:e}function rQ(n,e=0){if(!n||e>200)return n;if(typeof n=="object"){switch(n.$mid){case 1:return Pt.revive(n);case 2:return new RegExp(n.source,n.flags);case 17:return new Date(n.source)}if(n instanceof Q$||n instanceof Uint8Array)return n;if(Array.isArray(n))for(let t=0;t{let i=[],r=[];return n&&({href:n,dimensions:i}=GCt(n),r.push(`src="${P4(n)}"`)),t&&r.push(`alt="${P4(t)}"`),e&&r.push(`title="${P4(e)}"`),i.length&&(r=r.concat(i)),""},paragraph({tokens:n}){return`

${this.parser.parseInline(n)}

`},link({href:n,title:e,tokens:t}){let i=this.parser.parseInline(t);return typeof n!="string"?"":(n===i&&(i=Qj(i)),e=typeof e=="string"?P4(Qj(e)):"",n=Qj(n),n=n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),`
${i}`)}});function vW(n,e={},t={}){const i=new ke;let r=!1;const s=wle(e),o=function(p){let m;try{m=iQ(decodeURIComponent(p))}catch{}return m?(m=u4e(m,_=>{if(n.uris&&n.uris[_])return Pt.revive(n.uris[_])}),encodeURIComponent(JSON.stringify(m))):p},a=function(p,m){const _=n.uris&&n.uris[p];let v=Pt.revive(_);return m?p.startsWith(sn.data+":")?p:(v||(v=Pt.parse(p)),M$.uriToBrowserUri(v).toString(!0)):!v||Pt.parse(p).toString()===v.toString()?p:(v.query&&(v=v.with({query:o(v.query)})),v.toString())},l=new XFe;l.image=Jj.image,l.link=Jj.link,l.paragraph=Jj.paragraph;const c=[],u=[];if(e.codeBlockRendererSync?l.code=({text:p,lang:m})=>{const _=nQ.nextId(),v=e.codeBlockRendererSync(I1e(m),p);return u.push([_,v]),`
${gI(p)}
`}:e.codeBlockRenderer&&(l.code=({text:p,lang:m})=>{const _=nQ.nextId(),v=e.codeBlockRenderer(I1e(m),p);return c.push(v.then(y=>[_,y])),`
${gI(p)}
`}),e.actionHandler){const p=function(v){let y=v.target;if(!(y.tagName!=="A"&&(y=y.parentElement,!y||y.tagName!=="A")))try{let C=y.dataset.href;C&&(n.baseUri&&(C=eq(Pt.from(n.baseUri),C)),e.actionHandler.callback(C,v))}catch(C){rn(C)}finally{v.preventDefault()}},m=e.actionHandler.disposables.add(new $n(s,"click")),_=e.actionHandler.disposables.add(new $n(s,"auxclick"));e.actionHandler.disposables.add(Ge.any(m.event,_.event)(v=>{const y=new qh(Ot(s),v);!y.leftButton&&!y.middleButton||p(y)})),e.actionHandler.disposables.add(Ce(s,"keydown",v=>{const y=new or(v);!y.equals(10)&&!y.equals(3)||p(y)}))}n.supportHtml||(l.html=({text:p})=>e.sanitizerOptions?.replaceWithPlaintext?gI(p):(n.isTrusted?p.match(/^(]+>)|(<\/\s*span>)$/):void 0)?p:""),t.renderer=l;let d=n.value??"";d.length>1e5&&(d=`${d.substr(0,1e5)}…`),n.supportThemeIcons&&(d=MCt(d));let h;if(e.fillInIncompleteTokens){const p={...YCt,...t},m=_W(d,p),_=dxt(m);h=ZCt(_,p)}else h=QFe(d,{...t,async:!1});n.supportThemeIcons&&(h=ob(h).map(m=>typeof m=="string"?m:m.outerHTML).join(""));const g=new DOMParser().parseFromString(sQ({isTrusted:n.isTrusted,...e.sanitizerOptions},h),"text/html");if(g.body.querySelectorAll("img, audio, video, source").forEach(p=>{const m=p.getAttribute("src");if(m){let _=m;try{n.baseUri&&(_=eq(Pt.from(n.baseUri),_))}catch{}if(p.setAttribute("src",a(_,!0)),e.remoteImageIsAllowed){const v=Pt.parse(_);v.scheme!==sn.file&&v.scheme!==sn.data&&!e.remoteImageIsAllowed(v)&&p.replaceWith(qe("",void 0,p.outerHTML))}}}),g.body.querySelectorAll("a").forEach(p=>{const m=p.getAttribute("href");if(p.setAttribute("href",""),!m||/^data:|javascript:/i.test(m)||/^command:/i.test(m)&&!n.isTrusted||/^command:(\/\/\/)?_workbench\.downloadResource/i.test(m))p.replaceWith(...p.childNodes);else{let _=a(m,!1);n.baseUri&&(_=eq(Pt.from(n.baseUri),m)),p.dataset.href=_}}),s.innerHTML=sQ({isTrusted:n.isTrusted,...e.sanitizerOptions},g.body.innerHTML),c.length>0)Promise.all(c).then(p=>{if(r)return;const m=new Map(p),_=s.querySelectorAll("div[data-code]");for(const v of _){const y=m.get(v.dataset.code??"");y&&ea(v,y)}e.asyncRenderCallback?.()});else if(u.length>0){const p=new Map(u),m=s.querySelectorAll("div[data-code]");for(const _ of m){const v=p.get(_.dataset.code??"");v&&ea(_,v)}}if(e.asyncRenderCallback)for(const p of s.getElementsByTagName("img")){const m=i.add(Ce(p,"load",()=>{m.dispose(),e.asyncRenderCallback()}))}return{element:s,dispose:()=>{r=!0,i.dispose()}}}function I1e(n){if(!n)return"";const e=n.split(/[\s+|:|,|\{|\?]/,1);return e.length?e[0]:n}function eq(n,e){return/^\w[\w\d+.-]*:/.test(e)?e:n.path.endsWith("/")?L1e(n,e).toString():L1e(mW(n),e).toString()}const JCt=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];function sQ(n,e){const{config:t,allowedSchemes:i}=txt(n),r=new ke;r.add(A1e("uponSanitizeAttribute",(s,o)=>{if(o.attrName==="style"||o.attrName==="class"){if(s.tagName==="SPAN"){if(o.attrName==="style"){o.keepAttr=/^(color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z]+)+\));)?(background-color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z]+)+\));)?(border-radius:[0-9]+px;)?$/.test(o.attrValue);return}else if(o.attrName==="class"){o.keepAttr=/^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(o.attrValue);return}}o.keepAttr=!1;return}else if(s.tagName==="INPUT"&&s.attributes.getNamedItem("type")?.value==="checkbox"){if(o.attrName==="type"&&o.attrValue==="checkbox"||o.attrName==="disabled"||o.attrName==="checked"){o.keepAttr=!0;return}o.keepAttr=!1}})),r.add(A1e("uponSanitizeElement",(s,o)=>{if(o.tagName==="input"&&(s.attributes.getNamedItem("type")?.value==="checkbox"?s.setAttribute("disabled",""):n.replaceWithPlaintext||s.remove()),n.replaceWithPlaintext&&!o.allowedTags[o.tagName]&&o.tagName!=="body"&&s.parentElement){let a,l;if(o.tagName==="#comment")a=``;else{const h=JCt.includes(o.tagName),f=s.attributes.length?" "+Array.from(s.attributes).map(g=>`${g.name}="${g.value}"`).join(" "):"";a=`<${o.tagName}${f}>`,h||(l=``)}const c=document.createDocumentFragment(),u=s.parentElement.ownerDocument.createTextNode(a);c.appendChild(u);const d=l?s.parentElement.ownerDocument.createTextNode(l):void 0;for(;s.firstChild;)c.appendChild(s.firstChild);d&&c.appendChild(d),s.nodeType===Node.COMMENT_NODE?s.parentElement.insertBefore(c,s):s.parentElement.replaceChild(c,s)}})),r.add(R0t(i));try{return r3e(e,{...t,RETURN_TRUSTED_TYPE:!0})}finally{r.dispose()}}const ext=["align","autoplay","alt","checked","class","colspan","controls","data-code","data-href","disabled","draggable","height","href","loop","muted","playsinline","poster","rowspan","src","style","target","title","type","width","start"];function txt(n){const e=[sn.http,sn.https,sn.mailto,sn.data,sn.file,sn.vscodeFileResource,sn.vscodeRemote,sn.vscodeRemoteResource];return n.isTrusted&&e.push(sn.command),{config:{ALLOWED_TAGS:n.allowedTags??[...P0t],ALLOWED_ATTR:ext,ALLOW_UNKNOWN_PROTOCOLS:!0},allowedSchemes:e}}function nxt(n){return typeof n=="string"?n:ixt(n)}function ixt(n,e){let t=n.value??"";t.length>1e5&&(t=`${t.substr(0,1e5)}…`);const i=QFe(t,{async:!1,renderer:oxt.value}).replace(/&(#\d+|[a-zA-Z]+);/g,r=>rxt.get(r)??r);return sQ({isTrusted:!1},i).toString()}const rxt=new Map([[""",'"'],[" "," "],["&","&"],["'","'"],["<","<"],[">",">"]]);function sxt(){const n=new XFe;return n.code=({text:e})=>e,n.blockquote=({text:e})=>e+` +Please report this to https://github.com/markedjs/marked.`,re){const Y="

An error occurred:

"+u(H.message+"",!0)+"
";return oe?Promise.resolve(Y):Y}if(oe)return Promise.reject(H);throw H}}}const As=new oo;function Ft(pn,re){return As.parse(pn,re)}Ft.options=Ft.setOptions=function(pn){return As.setOptions(pn),Ft.defaults=As.defaults,i(Ft.defaults),Ft},Ft.getDefaults=t,Ft.defaults=e.defaults,Ft.use=function(...pn){return As.use(...pn),Ft.defaults=As.defaults,i(Ft.defaults),Ft},Ft.walkTokens=function(pn,re){return As.walkTokens(pn,re)},Ft.parseInline=As.parseInline,Ft.Parser=qi,Ft.parser=qi.parse,Ft.Renderer=cr,Ft.TextRenderer=us,Ft.Lexer=Or,Ft.lexer=Or.lex,Ft.Tokenizer=C,Ft.Hooks=Er,Ft.parse=Ft;const qn=Ft.options,pi=Ft.setOptions,bn=Ft.use,dn=Ft.walkTokens,bi=Ft.parseInline,mi=Ft,Yi=qi.parse,Wn=Or.lex;e.Hooks=Er,e.Lexer=Or,e.Marked=oo,e.Parser=qi,e.Renderer=cr,e.TextRenderer=us,e.Tokenizer=C,e.getDefaults=t,e.lexer=Wn,e.marked=Ft,e.options=qn,e.parse=mi,e.parseInline=bi,e.parser=Yi,e.setOptions=pi,e.use=bn,e.walkTokens=dn})})();Ja.Hooks||exports.Hooks;Ja.Lexer||exports.Lexer;Ja.Marked||exports.Marked;Ja.Parser||exports.Parser;var X5e=Ja.Renderer||exports.Renderer;Ja.TextRenderer||exports.TextRenderer;Ja.Tokenizer||exports.Tokenizer;var YCt=Ja.defaults||exports.defaults;Ja.getDefaults||exports.getDefaults;var _W=Ja.lexer||exports.lexer;Ja.marked||exports.marked;Ja.options||exports.options;var Q5e=Ja.parse||exports.parse;Ja.parseInline||exports.parseInline;var ZCt=Ja.parser||exports.parser;Ja.setOptions||exports.setOptions;Ja.use||exports.use;Ja.walkTokens||exports.walkTokens;function XCt(n){return JSON.stringify(n,QCt)}function iQ(n){let e=JSON.parse(n);return e=rQ(e),e}function QCt(n,e){return e instanceof RegExp?{$mid:2,source:e.source,flags:e.flags}:e}function rQ(n,e=0){if(!n||e>200)return n;if(typeof n=="object"){switch(n.$mid){case 1:return Pt.revive(n);case 2:return new RegExp(n.source,n.flags);case 17:return new Date(n.source)}if(n instanceof Q$||n instanceof Uint8Array)return n;if(Array.isArray(n))for(let t=0;t{let i=[],r=[];return n&&({href:n,dimensions:i}=GCt(n),r.push(`src="${P4(n)}"`)),t&&r.push(`alt="${P4(t)}"`),e&&r.push(`title="${P4(e)}"`),i.length&&(r=r.concat(i)),""},paragraph({tokens:n}){return`

${this.parser.parseInline(n)}

`},link({href:n,title:e,tokens:t}){let i=this.parser.parseInline(t);return typeof n!="string"?"":(n===i&&(i=Qj(i)),e=typeof e=="string"?P4(Qj(e)):"",n=Qj(n),n=n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),`${i}`)}});function vW(n,e={},t={}){const i=new ke;let r=!1;const s=wle(e),o=function(p){let m;try{m=iQ(decodeURIComponent(p))}catch{}return m?(m=u4e(m,_=>{if(n.uris&&n.uris[_])return Pt.revive(n.uris[_])}),encodeURIComponent(JSON.stringify(m))):p},a=function(p,m){const _=n.uris&&n.uris[p];let v=Pt.revive(_);return m?p.startsWith(sn.data+":")?p:(v||(v=Pt.parse(p)),M$.uriToBrowserUri(v).toString(!0)):!v||Pt.parse(p).toString()===v.toString()?p:(v.query&&(v=v.with({query:o(v.query)})),v.toString())},l=new X5e;l.image=Jj.image,l.link=Jj.link,l.paragraph=Jj.paragraph;const c=[],u=[];if(e.codeBlockRendererSync?l.code=({text:p,lang:m})=>{const _=nQ.nextId(),v=e.codeBlockRendererSync(I1e(m),p);return u.push([_,v]),`
${gI(p)}
`}:e.codeBlockRenderer&&(l.code=({text:p,lang:m})=>{const _=nQ.nextId(),v=e.codeBlockRenderer(I1e(m),p);return c.push(v.then(y=>[_,y])),`
${gI(p)}
`}),e.actionHandler){const p=function(v){let y=v.target;if(!(y.tagName!=="A"&&(y=y.parentElement,!y||y.tagName!=="A")))try{let C=y.dataset.href;C&&(n.baseUri&&(C=eq(Pt.from(n.baseUri),C)),e.actionHandler.callback(C,v))}catch(C){rn(C)}finally{v.preventDefault()}},m=e.actionHandler.disposables.add(new $n(s,"click")),_=e.actionHandler.disposables.add(new $n(s,"auxclick"));e.actionHandler.disposables.add(Ge.any(m.event,_.event)(v=>{const y=new qh(Ot(s),v);!y.leftButton&&!y.middleButton||p(y)})),e.actionHandler.disposables.add(Ce(s,"keydown",v=>{const y=new or(v);!y.equals(10)&&!y.equals(3)||p(y)}))}n.supportHtml||(l.html=({text:p})=>e.sanitizerOptions?.replaceWithPlaintext?gI(p):(n.isTrusted?p.match(/^(]+>)|(<\/\s*span>)$/):void 0)?p:""),t.renderer=l;let d=n.value??"";d.length>1e5&&(d=`${d.substr(0,1e5)}…`),n.supportThemeIcons&&(d=MCt(d));let h;if(e.fillInIncompleteTokens){const p={...YCt,...t},m=_W(d,p),_=dxt(m);h=ZCt(_,p)}else h=Q5e(d,{...t,async:!1});n.supportThemeIcons&&(h=ob(h).map(m=>typeof m=="string"?m:m.outerHTML).join(""));const g=new DOMParser().parseFromString(sQ({isTrusted:n.isTrusted,...e.sanitizerOptions},h),"text/html");if(g.body.querySelectorAll("img, audio, video, source").forEach(p=>{const m=p.getAttribute("src");if(m){let _=m;try{n.baseUri&&(_=eq(Pt.from(n.baseUri),_))}catch{}if(p.setAttribute("src",a(_,!0)),e.remoteImageIsAllowed){const v=Pt.parse(_);v.scheme!==sn.file&&v.scheme!==sn.data&&!e.remoteImageIsAllowed(v)&&p.replaceWith(qe("",void 0,p.outerHTML))}}}),g.body.querySelectorAll("a").forEach(p=>{const m=p.getAttribute("href");if(p.setAttribute("href",""),!m||/^data:|javascript:/i.test(m)||/^command:/i.test(m)&&!n.isTrusted||/^command:(\/\/\/)?_workbench\.downloadResource/i.test(m))p.replaceWith(...p.childNodes);else{let _=a(m,!1);n.baseUri&&(_=eq(Pt.from(n.baseUri),m)),p.dataset.href=_}}),s.innerHTML=sQ({isTrusted:n.isTrusted,...e.sanitizerOptions},g.body.innerHTML),c.length>0)Promise.all(c).then(p=>{if(r)return;const m=new Map(p),_=s.querySelectorAll("div[data-code]");for(const v of _){const y=m.get(v.dataset.code??"");y&&ea(v,y)}e.asyncRenderCallback?.()});else if(u.length>0){const p=new Map(u),m=s.querySelectorAll("div[data-code]");for(const _ of m){const v=p.get(_.dataset.code??"");v&&ea(_,v)}}if(e.asyncRenderCallback)for(const p of s.getElementsByTagName("img")){const m=i.add(Ce(p,"load",()=>{m.dispose(),e.asyncRenderCallback()}))}return{element:s,dispose:()=>{r=!0,i.dispose()}}}function I1e(n){if(!n)return"";const e=n.split(/[\s+|:|,|\{|\?]/,1);return e.length?e[0]:n}function eq(n,e){return/^\w[\w\d+.-]*:/.test(e)?e:n.path.endsWith("/")?L1e(n,e).toString():L1e(mW(n),e).toString()}const JCt=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];function sQ(n,e){const{config:t,allowedSchemes:i}=txt(n),r=new ke;r.add(A1e("uponSanitizeAttribute",(s,o)=>{if(o.attrName==="style"||o.attrName==="class"){if(s.tagName==="SPAN"){if(o.attrName==="style"){o.keepAttr=/^(color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z]+)+\));)?(background-color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z]+)+\));)?(border-radius:[0-9]+px;)?$/.test(o.attrValue);return}else if(o.attrName==="class"){o.keepAttr=/^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(o.attrValue);return}}o.keepAttr=!1;return}else if(s.tagName==="INPUT"&&s.attributes.getNamedItem("type")?.value==="checkbox"){if(o.attrName==="type"&&o.attrValue==="checkbox"||o.attrName==="disabled"||o.attrName==="checked"){o.keepAttr=!0;return}o.keepAttr=!1}})),r.add(A1e("uponSanitizeElement",(s,o)=>{if(o.tagName==="input"&&(s.attributes.getNamedItem("type")?.value==="checkbox"?s.setAttribute("disabled",""):n.replaceWithPlaintext||s.remove()),n.replaceWithPlaintext&&!o.allowedTags[o.tagName]&&o.tagName!=="body"&&s.parentElement){let a,l;if(o.tagName==="#comment")a=``;else{const h=JCt.includes(o.tagName),f=s.attributes.length?" "+Array.from(s.attributes).map(g=>`${g.name}="${g.value}"`).join(" "):"";a=`<${o.tagName}${f}>`,h||(l=``)}const c=document.createDocumentFragment(),u=s.parentElement.ownerDocument.createTextNode(a);c.appendChild(u);const d=l?s.parentElement.ownerDocument.createTextNode(l):void 0;for(;s.firstChild;)c.appendChild(s.firstChild);d&&c.appendChild(d),s.nodeType===Node.COMMENT_NODE?s.parentElement.insertBefore(c,s):s.parentElement.replaceChild(c,s)}})),r.add(R0t(i));try{return r3e(e,{...t,RETURN_TRUSTED_TYPE:!0})}finally{r.dispose()}}const ext=["align","autoplay","alt","checked","class","colspan","controls","data-code","data-href","disabled","draggable","height","href","loop","muted","playsinline","poster","rowspan","src","style","target","title","type","width","start"];function txt(n){const e=[sn.http,sn.https,sn.mailto,sn.data,sn.file,sn.vscodeFileResource,sn.vscodeRemote,sn.vscodeRemoteResource];return n.isTrusted&&e.push(sn.command),{config:{ALLOWED_TAGS:n.allowedTags??[...P0t],ALLOWED_ATTR:ext,ALLOW_UNKNOWN_PROTOCOLS:!0},allowedSchemes:e}}function nxt(n){return typeof n=="string"?n:ixt(n)}function ixt(n,e){let t=n.value??"";t.length>1e5&&(t=`${t.substr(0,1e5)}…`);const i=Q5e(t,{async:!1,renderer:oxt.value}).replace(/&(#\d+|[a-zA-Z]+);/g,r=>rxt.get(r)??r);return sQ({isTrusted:!1},i).toString()}const rxt=new Map([[""",'"'],[" "," "],["&","&"],["'","'"],["<","<"],[">",">"]]);function sxt(){const n=new X5e;return n.code=({text:e})=>e,n.blockquote=({text:e})=>e+` `,n.html=e=>"",n.heading=function({tokens:e}){return this.parser.parseInline(e)+` `},n.hr=()=>"",n.list=function({items:e}){return e.map(t=>this.listitem(t)).join(` `)+` @@ -220,11 +220,11 @@ Please report this to https://github.com/markedjs/marked.`,re){const Y="

An er `+t.map(i=>i.map(r=>this.tablecell(r)).join(" ")).join(` `)+` `},n.tablerow=({text:e})=>e,n.tablecell=function({tokens:e}){return this.parser.parseInline(e)},n.strong=({text:e})=>e,n.em=({text:e})=>e,n.codespan=({text:e})=>e,n.br=e=>` -`,n.del=({text:e})=>e,n.image=e=>"",n.text=({text:e})=>e,n.link=({text:e})=>e,n}const oxt=new kg(n=>sxt());function m8(n){let e="";return n.forEach(t=>{e+=t.raw}),e}function JFe(n){if(n.tokens)for(let e=n.tokens.length-1;e>=0;e--){const t=n.tokens[e];if(t.type==="text"){const i=t.raw.split(` -`),r=i[i.length-1];if(r.includes("`"))return fxt(n);if(r.includes("**"))return bxt(n);if(r.match(/\*\w/))return gxt(n);if(r.match(/(^|\s)__\w/))return yxt(n);if(r.match(/(^|\s)_\w/))return pxt(n);if(axt(r)||lxt(r)&&n.tokens.slice(0,e).some(s=>s.type==="text"&&s.raw.match(/\[[^\]]*$/))){const s=n.tokens.slice(e+1);return s[0]?.type==="link"&&s[1]?.type==="text"&&s[1].raw.match(/^ *"[^"]*$/)||r.match(/^[^"]* +"[^"]*$/)?_xt(n):mxt(n)}else if(r.match(/(^|\s)\[\w*/))return vxt(n)}}}function axt(n){return!!n.match(/(^|\s)\[.*\]\(\w*/)}function lxt(n){return!!n.match(/^[^\[]*\]\([^\)]*$/)}function cxt(n){const e=n.items[n.items.length-1],t=e.tokens?e.tokens[e.tokens.length-1]:void 0;let i;if(t?.type==="text"&&!("inRawBlock"in e)&&(i=JFe(t)),!i||i.type!=="paragraph")return;const r=m8(n.items.slice(0,-1)),s=e.raw.match(/^(\s*(-|\d+\.|\*) +)/)?.[0];if(!s)return;const o=s+m8(e.tokens.slice(0,-1))+i.raw,a=_W(r+o)[0];if(a.type==="list")return a}const uxt=3;function dxt(n){for(let e=0;ee,n.image=e=>"",n.text=({text:e})=>e,n.link=({text:e})=>e,n}const oxt=new kg(n=>sxt());function m8(n){let e="";return n.forEach(t=>{e+=t.raw}),e}function J5e(n){if(n.tokens)for(let e=n.tokens.length-1;e>=0;e--){const t=n.tokens[e];if(t.type==="text"){const i=t.raw.split(` +`),r=i[i.length-1];if(r.includes("`"))return fxt(n);if(r.includes("**"))return bxt(n);if(r.match(/\*\w/))return gxt(n);if(r.match(/(^|\s)__\w/))return yxt(n);if(r.match(/(^|\s)_\w/))return pxt(n);if(axt(r)||lxt(r)&&n.tokens.slice(0,e).some(s=>s.type==="text"&&s.raw.match(/\[[^\]]*$/))){const s=n.tokens.slice(e+1);return s[0]?.type==="link"&&s[1]?.type==="text"&&s[1].raw.match(/^ *"[^"]*$/)||r.match(/^[^"]* +"[^"]*$/)?_xt(n):mxt(n)}else if(r.match(/(^|\s)\[\w*/))return vxt(n)}}}function axt(n){return!!n.match(/(^|\s)\[.*\]\(\w*/)}function lxt(n){return!!n.match(/^[^\[]*\]\([^\)]*$/)}function cxt(n){const e=n.items[n.items.length-1],t=e.tokens?e.tokens[e.tokens.length-1]:void 0;let i;if(t?.type==="text"&&!("inRawBlock"in e)&&(i=J5e(t)),!i||i.type!=="paragraph")return;const r=m8(n.items.slice(0,-1)),s=e.raw.match(/^(\s*(-|\d+\.|\*) +)/)?.[0];if(!s)return;const o=s+m8(e.tokens.slice(0,-1))+i.raw,a=_W(r+o)[0];if(a.type==="list")return a}const uxt=3;function dxt(n){for(let e=0;e"u"&&o.match(/^\s*\|/)){const a=o.match(/(\|[^\|]+)(?=\||$)/g);a&&(i=a.length)}else if(typeof i=="number")if(o.match(/^\s*\|/)){if(s!==t.length-1)return;r=!0}else return}if(typeof i=="number"&&i>0){const s=r?t.slice(0,-1).join(` `):e,o=!!s.match(/\|\s*$/),a=s+(o?"":"|")+` -|${" --- |".repeat(i)}`;return _W(a)}}function A1e(n,e){return s3e(n,e),Lt(()=>o3e(n))}class Fs{static{this.defaultTokenMetadata=(32768|2<<24)>>>0}static createEmpty(e,t){const i=Fs.defaultTokenMetadata,r=new Uint32Array(2);return r[0]=e.length,r[1]=i,new Fs(r,e,t)}static createFromTextAndMetadata(e,t){let i=0,r="";const s=new Array;for(const{text:o,metadata:a}of e)s.push(i+o.length,a),i+=o.length,r+=o;return new Fs(new Uint32Array(s),r,t)}constructor(e,t,i){this._lineTokensBrand=void 0,this._tokens=e,this._tokensCount=this._tokens.length>>>1,this._text=t,this.languageIdCodec=i}equals(e){return e instanceof Fs?this.slicedEquals(e,0,this._tokensCount):!1}slicedEquals(e,t,i){if(this._text!==e._text||this._tokensCount!==e._tokensCount)return!1;const r=t<<1,s=r+(i<<1);for(let o=r;o0?this._tokens[e-1<<1]:0}getMetadata(e){return this._tokens[(e<<1)+1]}getLanguageId(e){const t=this._tokens[(e<<1)+1],i=hc.getLanguageId(t);return this.languageIdCodec.decodeLanguageId(i)}getStandardTokenType(e){const t=this._tokens[(e<<1)+1];return hc.getTokenType(t)}getForeground(e){const t=this._tokens[(e<<1)+1];return hc.getForeground(t)}getClassName(e){const t=this._tokens[(e<<1)+1];return hc.getClassNameFromMetadata(t)}getInlineStyle(e,t){const i=this._tokens[(e<<1)+1];return hc.getInlineStyleFromMetadata(i,t)}getPresentation(e){const t=this._tokens[(e<<1)+1];return hc.getPresentationFromMetadata(t)}getEndOffset(e){return this._tokens[e<<1]}findTokenIndexAtOffset(e){return Fs.findIndexInTokensArray(this._tokens,e)}inflate(){return this}sliceAndInflate(e,t,i){return new Ale(this,e,t,i)}static convertToEndOffset(e,t){const r=(e.length>>>1)-1;for(let s=0;s>>1)-1;for(;it&&(r=s)}return i}withInserted(e){if(e.length===0)return this;let t=0,i=0,r="";const s=new Array;let o=0;for(;;){const a=to){r+=this._text.substring(o,l.offset);const c=this._tokens[(t<<1)+1];s.push(r.length,c),o=l.offset}r+=l.text,s.push(r.length,l.tokenMetadata),i++}else break}return new Fs(new Uint32Array(s),r,this.languageIdCodec)}getTokenText(e){const t=this.getStartOffset(e),i=this.getEndOffset(e);return this._text.substring(t,i)}forEach(e){const t=this.getCount();for(let i=0;i=i);s++)this._tokensCount++}getMetadata(e){return this._source.getMetadata(this._firstTokenIndex+e)}getLanguageId(e){return this._source.getLanguageId(this._firstTokenIndex+e)}getLineContent(){return this._source.getLineContent().substring(this._startOffset,this._endOffset)}equals(e){return e instanceof Ale?this._startOffset===e._startOffset&&this._endOffset===e._endOffset&&this._deltaOffset===e._deltaOffset&&this._source.slicedEquals(e._source,this._firstTokenIndex,this._tokensCount):!1}getCount(){return this._tokensCount}getStandardTokenType(e){return this._source.getStandardTokenType(this._firstTokenIndex+e)}getForeground(e){return this._source.getForeground(this._firstTokenIndex+e)}getEndOffset(e){const t=this._source.getEndOffset(this._firstTokenIndex+e);return Math.min(this._endOffset,t)-this._startOffset+this._deltaOffset}getClassName(e){return this._source.getClassName(this._firstTokenIndex+e)}getInlineStyle(e,t){return this._source.getInlineStyle(this._firstTokenIndex+e,t)}getPresentation(e){return this._source.getPresentation(this._firstTokenIndex+e)}findTokenIndexAtOffset(e){return this._source.findTokenIndexAtOffset(e+this._startOffset-this._deltaOffset)-this._firstTokenIndex}getTokenText(e){const t=this._firstTokenIndex+e,i=this._source.getStartOffset(t),r=this._source.getEndOffset(t);let s=this._source.getTokenText(t);return ithis._endOffset&&(s=s.substring(0,s.length-(r-this._endOffset))),s}forEach(e){for(let t=0;t>>0,new P$(t,e===null?gE:e)}const N1e={getInitialState:()=>gE,tokenizeEncoded:(n,e,t)=>bW(0,t)};async function xxt(n,e,t){if(!t)return R1e(e,n.languageIdCodec,N1e);const i=await rs.getOrCreate(t);return R1e(e,n.languageIdCodec,i||N1e)}function Sxt(n,e,t,i,r,s,o){let a="

",l=i,c=0,u=!0;for(let d=0,h=e.getCount();d0;)o&&u?(g+=" ",u=!1):(g+=" ",u=!0),m--;break}case 60:g+="<",u=!1;break;case 62:g+=">",u=!1;break;case 38:g+="&",u=!1;break;case 0:g+="�",u=!1;break;case 65279:case 8232:case 8233:case 133:g+="�",u=!1;break;case 13:g+="​",u=!1;break;case 32:o&&u?(g+=" ",u=!1):(g+=" ",u=!0);break;default:g+=String.fromCharCode(p),u=!1}}if(a+=`${g}`,f>r||l>=r)break}return a+="
",a}function R1e(n,e,t){let i='
';const r=om(n);let s=t.getInitialState();for(let o=0,a=r.length;o0&&(i+="
");const c=t.tokenizeEncoded(l,!0,s);Fs.convertToEndOffset(c.tokens,l.length);const d=new Fs(c.tokens,l,e).inflate();let h=0;for(let f=0,g=d.getCount();f${gI(l.substring(h,m))}`,h=m}s=c.endState}return i+="
",i}var kxt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},P1e=function(n,e){return function(t,i){e(t,i,n)}},oQ;let Q_=class{static{oQ=this}static{this._ttpTokenizer=p0("tokenizeToString",{createHTML(e){return e}})}constructor(e,t,i){this._options=e,this._languageService=t,this._openerService=i,this._onDidRenderAsync=new fe,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(e,t,i){if(!e)return{element:document.createElement("span"),dispose:()=>{}};const r=new ke,s=r.add(vW(e,{...this._getRenderOptions(e,r),...t},i));return s.element.classList.add("rendered-markdown"),{element:s.element,dispose:()=>r.dispose()}}_getRenderOptions(e,t){return{codeBlockRenderer:async(i,r)=>{let s;i?s=this._languageService.getLanguageIdByLanguageName(i):this._options.editor&&(s=this._options.editor.getModel()?.getLanguageId()),s||(s=Hl);const o=await xxt(this._languageService,r,s),a=document.createElement("span");if(a.innerHTML=oQ._ttpTokenizer?.createHTML(o)??o,this._options.editor){const l=this._options.editor.getOption(50);ta(a,l)}else this._options.codeBlockFontFamily&&(a.style.fontFamily=this._options.codeBlockFontFamily);return this._options.codeBlockFontSize!==void 0&&(a.style.fontSize=this._options.codeBlockFontSize),a},asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:i=>Rle(this._openerService,i,e.isTrusted),disposables:t}}}};Q_=oQ=kxt([P1e(1,Hr),P1e(2,Pc)],Q_);async function Rle(n,e,t){try{return await n.open(e,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:Ext(t)})}catch(i){return rn(i),!1}}function Ext(n){return n===!0?!0:n&&Array.isArray(n.enabledCommands)?n.enabledCommands:!1}const _u=On("accessibilityService"),iO=new et("accessibilityModeEnabled",!1),O1e=2e4;let dy,XF,aQ,QF,lQ;function Lxt(n){dy=document.createElement("div"),dy.className="monaco-aria-container";const e=()=>{const i=document.createElement("div");return i.className="monaco-alert",i.setAttribute("role","alert"),i.setAttribute("aria-atomic","true"),dy.appendChild(i),i};XF=e(),aQ=e();const t=()=>{const i=document.createElement("div");return i.className="monaco-status",i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),dy.appendChild(i),i};QF=t(),lQ=t(),n.appendChild(dy)}function ql(n){dy&&(XF.textContent!==n?(Jo(aQ),_8(XF,n)):(Jo(XF),_8(aQ,n)))}function Qp(n){dy&&(QF.textContent!==n?(Jo(lQ),_8(QF,n)):(Jo(QF),_8(lQ,n)))}function _8(n,e){Jo(n),e.length>O1e&&(e=e.substr(0,O1e)),n.textContent=e,n.style.visibility="hidden",n.style.visibility="visible"}var Txt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},AT=function(n,e){return function(t,i){e(t,i,n)}};const Zg=qe;let cQ=class extends ud{get _targetWindow(){return Ot(this._target.targetElements[0])}get _targetDocumentElement(){return Ot(this._target.targetElements[0]).document.documentElement}get isDisposed(){return this._isDisposed}get isMouseIn(){return this._lockMouseTracker.isMouseIn}get domNode(){return this._hover.containerDomNode}get onDispose(){return this._onDispose.event}get onRequestLayout(){return this._onRequestLayout.event}get anchor(){return this._hoverPosition===2?0:1}get x(){return this._x}get y(){return this._y}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked!==e&&(this._isLocked=e,this._hoverContainer.classList.toggle("locked",this._isLocked))}constructor(e,t,i,r,s,o){super(),this._keybindingService=t,this._configurationService=i,this._openerService=r,this._instantiationService=s,this._accessibilityService=o,this._messageListeners=new ke,this._isDisposed=!1,this._forcePosition=!1,this._x=0,this._y=0,this._isLocked=!1,this._enableFocusTraps=!1,this._addedFocusTrap=!1,this._onDispose=this._register(new fe),this._onRequestLayout=this._register(new fe),this._linkHandler=e.linkHandler||(h=>Rle(this._openerService,h,bg(e.content)?e.content.isTrusted:void 0)),this._target="targetElements"in e.target?e.target:new Dxt(e.target),this._hoverPointer=e.appearance?.showPointer?Zg("div.workbench-hover-pointer"):void 0,this._hover=this._register(new yle),this._hover.containerDomNode.classList.add("workbench-hover","fadeIn"),e.appearance?.compact&&this._hover.containerDomNode.classList.add("workbench-hover","compact"),e.appearance?.skipFadeInAnimation&&this._hover.containerDomNode.classList.add("skip-fade-in"),e.additionalClasses&&this._hover.containerDomNode.classList.add(...e.additionalClasses),e.position?.forcePosition&&(this._forcePosition=!0),e.trapFocus&&(this._enableFocusTraps=!0),this._hoverPosition=e.position?.hoverPosition??3,this.onmousedown(this._hover.containerDomNode,h=>h.stopPropagation()),this.onkeydown(this._hover.containerDomNode,h=>{h.equals(9)&&this.dispose()}),this._register(Ce(this._targetWindow,"blur",()=>this.dispose()));const a=Zg("div.hover-row.markdown-hover"),l=Zg("div.hover-contents");if(typeof e.content=="string")l.textContent=e.content,l.style.whiteSpace="pre-wrap";else if(Eo(e.content))l.appendChild(e.content),l.classList.add("html-hover-contents");else{const h=e.content,f=this._instantiationService.createInstance(Q_,{codeBlockFontFamily:this._configurationService.getValue("editor").fontFamily||Wl.fontFamily}),{element:g}=f.render(h,{actionHandler:{callback:p=>this._linkHandler(p),disposables:this._messageListeners},asyncRenderCallback:()=>{l.classList.add("code-hover-contents"),this.layout(),this._onRequestLayout.fire()}});l.appendChild(g)}if(a.appendChild(l),this._hover.contentsDomNode.appendChild(a),e.actions&&e.actions.length>0){const h=Zg("div.hover-row.status-bar"),f=Zg("div.actions");e.actions.forEach(g=>{const p=this._keybindingService.lookupKeybinding(g.commandId),m=p?p.getLabel():null;gW.render(f,{label:g.label,commandId:g.commandId,run:_=>{g.run(_),this.dispose()},iconClass:g.iconClass},m)}),h.appendChild(f),this._hover.containerDomNode.appendChild(h)}this._hoverContainer=Zg("div.workbench-hover-container"),this._hoverPointer&&this._hoverContainer.appendChild(this._hoverPointer),this._hoverContainer.appendChild(this._hover.containerDomNode);let c;if(e.actions&&e.actions.length>0?c=!1:e.persistence?.hideOnHover===void 0?c=typeof e.content=="string"||bg(e.content)&&!e.content.value.includes("](")&&!e.content.value.includes(""):c=e.persistence.hideOnHover,e.appearance?.showHoverHint){const h=Zg("div.hover-row.status-bar"),f=Zg("div.info");f.textContent=w("hoverhint","Hold {0} key to mouse over",Rn?"Option":"Alt"),h.appendChild(f),this._hover.containerDomNode.appendChild(h)}const u=[...this._target.targetElements];c||u.push(this._hoverContainer);const d=this._register(new M1e(u));if(this._register(d.onMouseOut(()=>{this._isLocked||this.dispose()})),c){const h=[...this._target.targetElements,this._hoverContainer];this._lockMouseTracker=this._register(new M1e(h)),this._register(this._lockMouseTracker.onMouseOut(()=>{this._isLocked||this.dispose()}))}else this._lockMouseTracker=d}addFocusTrap(){if(!this._enableFocusTraps||this._addedFocusTrap)return;this._addedFocusTrap=!0;const e=this._hover.containerDomNode,t=this.findLastFocusableChild(this._hover.containerDomNode);if(t){const i=Vae(this._hoverContainer,Zg("div")),r=Ne(this._hoverContainer,Zg("div"));i.tabIndex=0,r.tabIndex=0,this._register(Ce(r,"focus",s=>{e.focus(),s.preventDefault()})),this._register(Ce(i,"focus",s=>{t.focus(),s.preventDefault()}))}}findLastFocusableChild(e){if(e.hasChildNodes())for(let t=0;t=0)return s}const r=this.findLastFocusableChild(i);if(r)return r}}render(e){e.appendChild(this._hoverContainer);const i=this._hoverContainer.contains(this._hoverContainer.ownerDocument.activeElement)&&MFe(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel());i&&Qp(i),this.layout(),this.addFocusTrap()}layout(){this._hover.containerDomNode.classList.remove("right-aligned"),this._hover.contentsDomNode.style.maxHeight="";const e=u=>{const d=d3e(u),h=u.getBoundingClientRect();return{top:h.top*d,bottom:h.bottom*d,right:h.right*d,left:h.left*d}},t=this._target.targetElements.map(u=>e(u)),{top:i,right:r,bottom:s,left:o}=t[0],a=r-o,l=s-i,c={top:i,right:r,bottom:s,left:o,width:a,height:l,center:{x:o+a/2,y:i+l/2}};if(this.adjustHorizontalHoverPosition(c),this.adjustVerticalHoverPosition(c),this.adjustHoverMaxHeight(c),this._hoverContainer.style.padding="",this._hoverContainer.style.margin="",this._hoverPointer){switch(this._hoverPosition){case 1:c.left+=3,c.right+=3,this._hoverContainer.style.paddingLeft="3px",this._hoverContainer.style.marginLeft="-3px";break;case 0:c.left-=3,c.right-=3,this._hoverContainer.style.paddingRight="3px",this._hoverContainer.style.marginRight="-3px";break;case 2:c.top+=3,c.bottom+=3,this._hoverContainer.style.paddingTop="3px",this._hoverContainer.style.marginTop="-3px";break;case 3:c.top-=3,c.bottom-=3,this._hoverContainer.style.paddingBottom="3px",this._hoverContainer.style.marginBottom="-3px";break}c.center.x=c.left+a/2,c.center.y=c.top+l/2}this.computeXCordinate(c),this.computeYCordinate(c),this._hoverPointer&&(this._hoverPointer.classList.remove("top"),this._hoverPointer.classList.remove("left"),this._hoverPointer.classList.remove("right"),this._hoverPointer.classList.remove("bottom"),this.setHoverPointerPosition(c)),this._hover.onContentsChanged()}computeXCordinate(e){const t=this._hover.containerDomNode.clientWidth+2;this._target.x!==void 0?this._x=this._target.x:this._hoverPosition===1?this._x=e.right:this._hoverPosition===0?this._x=e.left-t:(this._hoverPointer?this._x=e.center.x-this._hover.containerDomNode.clientWidth/2:this._x=e.left,this._x+t>=this._targetDocumentElement.clientWidth&&(this._hover.containerDomNode.classList.add("right-aligned"),this._x=Math.max(this._targetDocumentElement.clientWidth-t-2,this._targetDocumentElement.clientLeft))),this._xthis._targetWindow.innerHeight&&(this._y=e.bottom)}adjustHorizontalHoverPosition(e){if(this._target.x!==void 0)return;const t=this._hoverPointer?3:0;if(this._forcePosition){const i=t+2;this._hoverPosition===1?this._hover.containerDomNode.style.maxWidth=`${this._targetDocumentElement.clientWidth-e.right-i}px`:this._hoverPosition===0&&(this._hover.containerDomNode.style.maxWidth=`${e.left-i}px`);return}this._hoverPosition===1?this._targetDocumentElement.clientWidth-e.right=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=0:this._hoverPosition=2):this._hoverPosition===0&&(e.left=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=1:this._hoverPosition=2),e.left-this._hover.containerDomNode.clientWidth-t<=this._targetDocumentElement.clientLeft&&(this._hoverPosition=1))}adjustVerticalHoverPosition(e){if(this._target.y!==void 0||this._forcePosition)return;const t=this._hoverPointer?3:0;this._hoverPosition===3?e.top-this._hover.containerDomNode.clientHeight-t<0&&(this._hoverPosition=2):this._hoverPosition===2&&e.bottom+this._hover.containerDomNode.clientHeight+t>this._targetWindow.innerHeight&&(this._hoverPosition=3)}adjustHoverMaxHeight(e){let t=this._targetWindow.innerHeight/2;if(this._forcePosition){const i=(this._hoverPointer?3:0)+2;this._hoverPosition===3?t=Math.min(t,e.top-i):this._hoverPosition===2&&(t=Math.min(t,this._targetWindow.innerHeight-e.bottom-i))}if(this._hover.containerDomNode.style.maxHeight=`${t}px`,this._hover.contentsDomNode.clientHeighte.height?this._hoverPointer.style.top=`${e.center.y-(this._y-t)-3}px`:this._hoverPointer.style.top=`${Math.round(t/2)-3}px`;break}case 3:case 2:{this._hoverPointer.classList.add(this._hoverPosition===3?"bottom":"top");const t=this._hover.containerDomNode.clientWidth;let i=Math.round(t/2)-3;const r=this._x+i;(re.right)&&(i=e.center.x-this._x-3),this._hoverPointer.style.left=`${i}px`;break}}}focus(){this._hover.containerDomNode.focus()}dispose(){this._isDisposed||(this._onDispose.fire(),this._hoverContainer.remove(),this._messageListeners.dispose(),this._target.dispose(),super.dispose()),this._isDisposed=!0}};cQ=Txt([AT(1,xi),AT(2,kn),AT(3,Pc),AT(4,Tt),AT(5,_u)],cQ);class M1e extends ud{get onMouseOut(){return this._onMouseOut.event}get isMouseIn(){return this._isMouseIn}constructor(e){super(),this._elements=e,this._isMouseIn=!0,this._onMouseOut=this._register(new fe),this._elements.forEach(t=>this.onmouseover(t,()=>this._onTargetMouseOver(t))),this._elements.forEach(t=>this.onmouseleave(t,()=>this._onTargetMouseLeave(t)))}_onTargetMouseOver(e){this._isMouseIn=!0,this._clearEvaluateMouseStateTimeout(e)}_onTargetMouseLeave(e){this._isMouseIn=!1,this._evaluateMouseState(e)}_evaluateMouseState(e){this._clearEvaluateMouseStateTimeout(e),this._mouseTimeout=Ot(e).setTimeout(()=>this._fireIfMouseOutside(),0)}_clearEvaluateMouseStateTimeout(e){this._mouseTimeout&&(Ot(e).clearTimeout(this._mouseTimeout),this._mouseTimeout=void 0)}_fireIfMouseOutside(){this._isMouseIn||this._onMouseOut.fire()}}class Dxt{constructor(e){this._element=e,this.targetElements=[this._element]}dispose(){}}var Ba;(function(n){function e(s,o){if(s.start>=o.end||o.start>=s.end)return{start:0,end:0};const a=Math.max(s.start,o.start),l=Math.min(s.end,o.end);return l-a<=0?{start:0,end:0}:{start:a,end:l}}n.intersect=e;function t(s){return s.end-s.start<=0}n.isEmpty=t;function i(s,o){return!t(e(s,o))}n.intersects=i;function r(s,o){const a=[],l={start:s.start,end:Math.min(o.start,s.end)},c={start:Math.max(o.end,s.start),end:s.end};return t(l)||a.push(l),t(c)||a.push(c),a}n.relativeComplement=r})(Ba||(Ba={}));function Ixt(n){const e=n;return!!e&&typeof e.x=="number"&&typeof e.y=="number"}var Rv;(function(n){n[n.AVOID=0]="AVOID",n[n.ALIGN=1]="ALIGN"})(Rv||(Rv={}));function SS(n,e,t){const i=t.mode===Rv.ALIGN?t.offset:t.offset+t.size,r=t.mode===Rv.ALIGN?t.offset+t.size:t.offset;return t.position===0?e<=n-i?i:e<=r?r-e:Math.max(n-e,0):e<=r?r-e:e<=n-i?i:0}class v8 extends me{static{this.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"]}static{this.BUBBLE_DOWN_EVENTS=["click"]}constructor(e,t){super(),this.container=null,this.useFixedPosition=!1,this.useShadowDOM=!1,this.delegate=null,this.toDisposeOnClean=me.None,this.toDisposeOnSetContainer=me.None,this.shadowRoot=null,this.shadowRootHostElement=null,this.view=qe(".context-view"),Al(this.view),this.setContainer(e,t),this._register(Lt(()=>this.setContainer(null,1)))}setContainer(e,t){this.useFixedPosition=t!==1;const i=this.useShadowDOM;if(this.useShadowDOM=t===3,!(e===this.container&&i===this.useShadowDOM)&&(this.container&&(this.toDisposeOnSetContainer.dispose(),this.view.remove(),this.shadowRoot&&(this.shadowRoot=null,this.shadowRootHostElement?.remove(),this.shadowRootHostElement=null),this.container=null),e)){if(this.container=e,this.useShadowDOM){this.shadowRootHostElement=qe(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});const s=document.createElement("style");s.textContent=Axt,this.shadowRoot.appendChild(s),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(qe("slot"))}else this.container.appendChild(this.view);const r=new ke;v8.BUBBLE_UP_EVENTS.forEach(s=>{r.add(Jr(this.container,s,o=>{this.onDOMEvent(o,!1)}))}),v8.BUBBLE_DOWN_EVENTS.forEach(s=>{r.add(Jr(this.container,s,o=>{this.onDOMEvent(o,!0)},!0))}),this.toDisposeOnSetContainer=r}}show(e){this.isVisible()&&this.hide(),Jo(this.view),this.view.className="context-view monaco-component",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex=`${2575+(e.layer??0)}`,this.view.style.position=this.useFixedPosition?"fixed":"absolute",Qc(this.view),this.toDisposeOnClean=e.render(this.view)||me.None,this.delegate=e,this.doLayout(),this.delegate.focus?.()}getViewElement(){return this.view}layout(){if(this.isVisible()){if(this.delegate.canRelayout===!1&&!(Sg&&Pae.pointerEvents)){this.hide();return}this.delegate?.layout?.(),this.doLayout()}}doLayout(){if(!this.isVisible())return;const e=this.delegate.getAnchor();let t;if(Eo(e)){const h=ms(e),f=d3e(e);t={top:h.top*f,left:h.left*f,width:h.width*f,height:h.height*f}}else Ixt(e)?t={top:e.y,left:e.x,width:e.width||1,height:e.height||2}:t={top:e.posy,left:e.posx,width:2,height:2};const i=qc(this.view),r=h_(this.view),s=this.delegate.anchorPosition||0,o=this.delegate.anchorAlignment||0,a=this.delegate.anchorAxisAlignment||0;let l,c;const u=SD();if(a===0){const h={offset:t.top-u.pageYOffset,size:t.height,position:s===0?0:1},f={offset:t.left,size:t.width,position:o===0?0:1,mode:Rv.ALIGN};l=SS(u.innerHeight,r,h)+u.pageYOffset,Ba.intersects({start:l,end:l+r},{start:h.offset,end:h.offset+h.size})&&(f.mode=Rv.AVOID),c=SS(u.innerWidth,i,f)}else{const h={offset:t.left,size:t.width,position:o===0?0:1},f={offset:t.top,size:t.height,position:s===0?0:1,mode:Rv.ALIGN};c=SS(u.innerWidth,i,h),Ba.intersects({start:c,end:c+i},{start:h.offset,end:h.offset+h.size})&&(f.mode=Rv.AVOID),l=SS(u.innerHeight,r,f)+u.pageYOffset}this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(s===0?"bottom":"top"),this.view.classList.add(o===0?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);const d=ms(this.container);this.view.style.top=`${l-(this.useFixedPosition?ms(this.view).top:d.top)}px`,this.view.style.left=`${c-(this.useFixedPosition?ms(this.view).left:d.left)}px`,this.view.style.width="initial"}hide(e){const t=this.delegate;this.delegate=null,t?.onHide&&t.onHide(e),this.toDisposeOnClean.dispose(),Al(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,Ot(e).document.activeElement):t&&!xo(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}}const Axt=` +|${" --- |".repeat(i)}`;return _W(a)}}function A1e(n,e){return s3e(n,e),Lt(()=>o3e(n))}class Fs{static{this.defaultTokenMetadata=(32768|2<<24)>>>0}static createEmpty(e,t){const i=Fs.defaultTokenMetadata,r=new Uint32Array(2);return r[0]=e.length,r[1]=i,new Fs(r,e,t)}static createFromTextAndMetadata(e,t){let i=0,r="";const s=new Array;for(const{text:o,metadata:a}of e)s.push(i+o.length,a),i+=o.length,r+=o;return new Fs(new Uint32Array(s),r,t)}constructor(e,t,i){this._lineTokensBrand=void 0,this._tokens=e,this._tokensCount=this._tokens.length>>>1,this._text=t,this.languageIdCodec=i}equals(e){return e instanceof Fs?this.slicedEquals(e,0,this._tokensCount):!1}slicedEquals(e,t,i){if(this._text!==e._text||this._tokensCount!==e._tokensCount)return!1;const r=t<<1,s=r+(i<<1);for(let o=r;o0?this._tokens[e-1<<1]:0}getMetadata(e){return this._tokens[(e<<1)+1]}getLanguageId(e){const t=this._tokens[(e<<1)+1],i=hc.getLanguageId(t);return this.languageIdCodec.decodeLanguageId(i)}getStandardTokenType(e){const t=this._tokens[(e<<1)+1];return hc.getTokenType(t)}getForeground(e){const t=this._tokens[(e<<1)+1];return hc.getForeground(t)}getClassName(e){const t=this._tokens[(e<<1)+1];return hc.getClassNameFromMetadata(t)}getInlineStyle(e,t){const i=this._tokens[(e<<1)+1];return hc.getInlineStyleFromMetadata(i,t)}getPresentation(e){const t=this._tokens[(e<<1)+1];return hc.getPresentationFromMetadata(t)}getEndOffset(e){return this._tokens[e<<1]}findTokenIndexAtOffset(e){return Fs.findIndexInTokensArray(this._tokens,e)}inflate(){return this}sliceAndInflate(e,t,i){return new Ale(this,e,t,i)}static convertToEndOffset(e,t){const r=(e.length>>>1)-1;for(let s=0;s>>1)-1;for(;it&&(r=s)}return i}withInserted(e){if(e.length===0)return this;let t=0,i=0,r="";const s=new Array;let o=0;for(;;){const a=to){r+=this._text.substring(o,l.offset);const c=this._tokens[(t<<1)+1];s.push(r.length,c),o=l.offset}r+=l.text,s.push(r.length,l.tokenMetadata),i++}else break}return new Fs(new Uint32Array(s),r,this.languageIdCodec)}getTokenText(e){const t=this.getStartOffset(e),i=this.getEndOffset(e);return this._text.substring(t,i)}forEach(e){const t=this.getCount();for(let i=0;i=i);s++)this._tokensCount++}getMetadata(e){return this._source.getMetadata(this._firstTokenIndex+e)}getLanguageId(e){return this._source.getLanguageId(this._firstTokenIndex+e)}getLineContent(){return this._source.getLineContent().substring(this._startOffset,this._endOffset)}equals(e){return e instanceof Ale?this._startOffset===e._startOffset&&this._endOffset===e._endOffset&&this._deltaOffset===e._deltaOffset&&this._source.slicedEquals(e._source,this._firstTokenIndex,this._tokensCount):!1}getCount(){return this._tokensCount}getStandardTokenType(e){return this._source.getStandardTokenType(this._firstTokenIndex+e)}getForeground(e){return this._source.getForeground(this._firstTokenIndex+e)}getEndOffset(e){const t=this._source.getEndOffset(this._firstTokenIndex+e);return Math.min(this._endOffset,t)-this._startOffset+this._deltaOffset}getClassName(e){return this._source.getClassName(this._firstTokenIndex+e)}getInlineStyle(e,t){return this._source.getInlineStyle(this._firstTokenIndex+e,t)}getPresentation(e){return this._source.getPresentation(this._firstTokenIndex+e)}findTokenIndexAtOffset(e){return this._source.findTokenIndexAtOffset(e+this._startOffset-this._deltaOffset)-this._firstTokenIndex}getTokenText(e){const t=this._firstTokenIndex+e,i=this._source.getStartOffset(t),r=this._source.getEndOffset(t);let s=this._source.getTokenText(t);return ithis._endOffset&&(s=s.substring(0,s.length-(r-this._endOffset))),s}forEach(e){for(let t=0;t>>0,new P$(t,e===null?gE:e)}const N1e={getInitialState:()=>gE,tokenizeEncoded:(n,e,t)=>bW(0,t)};async function xxt(n,e,t){if(!t)return R1e(e,n.languageIdCodec,N1e);const i=await rs.getOrCreate(t);return R1e(e,n.languageIdCodec,i||N1e)}function Sxt(n,e,t,i,r,s,o){let a="
",l=i,c=0,u=!0;for(let d=0,h=e.getCount();d0;)o&&u?(g+=" ",u=!1):(g+=" ",u=!0),m--;break}case 60:g+="<",u=!1;break;case 62:g+=">",u=!1;break;case 38:g+="&",u=!1;break;case 0:g+="�",u=!1;break;case 65279:case 8232:case 8233:case 133:g+="�",u=!1;break;case 13:g+="​",u=!1;break;case 32:o&&u?(g+=" ",u=!1):(g+=" ",u=!0);break;default:g+=String.fromCharCode(p),u=!1}}if(a+=`${g}`,f>r||l>=r)break}return a+="
",a}function R1e(n,e,t){let i='
';const r=om(n);let s=t.getInitialState();for(let o=0,a=r.length;o0&&(i+="
");const c=t.tokenizeEncoded(l,!0,s);Fs.convertToEndOffset(c.tokens,l.length);const d=new Fs(c.tokens,l,e).inflate();let h=0;for(let f=0,g=d.getCount();f${gI(l.substring(h,m))}`,h=m}s=c.endState}return i+="
",i}var kxt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},P1e=function(n,e){return function(t,i){e(t,i,n)}},oQ;let Q_=class{static{oQ=this}static{this._ttpTokenizer=p0("tokenizeToString",{createHTML(e){return e}})}constructor(e,t,i){this._options=e,this._languageService=t,this._openerService=i,this._onDidRenderAsync=new fe,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(e,t,i){if(!e)return{element:document.createElement("span"),dispose:()=>{}};const r=new ke,s=r.add(vW(e,{...this._getRenderOptions(e,r),...t},i));return s.element.classList.add("rendered-markdown"),{element:s.element,dispose:()=>r.dispose()}}_getRenderOptions(e,t){return{codeBlockRenderer:async(i,r)=>{let s;i?s=this._languageService.getLanguageIdByLanguageName(i):this._options.editor&&(s=this._options.editor.getModel()?.getLanguageId()),s||(s=Hl);const o=await xxt(this._languageService,r,s),a=document.createElement("span");if(a.innerHTML=oQ._ttpTokenizer?.createHTML(o)??o,this._options.editor){const l=this._options.editor.getOption(50);ta(a,l)}else this._options.codeBlockFontFamily&&(a.style.fontFamily=this._options.codeBlockFontFamily);return this._options.codeBlockFontSize!==void 0&&(a.style.fontSize=this._options.codeBlockFontSize),a},asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:i=>Rle(this._openerService,i,e.isTrusted),disposables:t}}}};Q_=oQ=kxt([P1e(1,Hr),P1e(2,Pc)],Q_);async function Rle(n,e,t){try{return await n.open(e,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:Ext(t)})}catch(i){return rn(i),!1}}function Ext(n){return n===!0?!0:n&&Array.isArray(n.enabledCommands)?n.enabledCommands:!1}const _u=On("accessibilityService"),iO=new et("accessibilityModeEnabled",!1),O1e=2e4;let dy,X5,aQ,Q5,lQ;function Lxt(n){dy=document.createElement("div"),dy.className="monaco-aria-container";const e=()=>{const i=document.createElement("div");return i.className="monaco-alert",i.setAttribute("role","alert"),i.setAttribute("aria-atomic","true"),dy.appendChild(i),i};X5=e(),aQ=e();const t=()=>{const i=document.createElement("div");return i.className="monaco-status",i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),dy.appendChild(i),i};Q5=t(),lQ=t(),n.appendChild(dy)}function ql(n){dy&&(X5.textContent!==n?(Jo(aQ),_8(X5,n)):(Jo(X5),_8(aQ,n)))}function Qp(n){dy&&(Q5.textContent!==n?(Jo(lQ),_8(Q5,n)):(Jo(Q5),_8(lQ,n)))}function _8(n,e){Jo(n),e.length>O1e&&(e=e.substr(0,O1e)),n.textContent=e,n.style.visibility="hidden",n.style.visibility="visible"}var Txt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},AT=function(n,e){return function(t,i){e(t,i,n)}};const Zg=qe;let cQ=class extends ud{get _targetWindow(){return Ot(this._target.targetElements[0])}get _targetDocumentElement(){return Ot(this._target.targetElements[0]).document.documentElement}get isDisposed(){return this._isDisposed}get isMouseIn(){return this._lockMouseTracker.isMouseIn}get domNode(){return this._hover.containerDomNode}get onDispose(){return this._onDispose.event}get onRequestLayout(){return this._onRequestLayout.event}get anchor(){return this._hoverPosition===2?0:1}get x(){return this._x}get y(){return this._y}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked!==e&&(this._isLocked=e,this._hoverContainer.classList.toggle("locked",this._isLocked))}constructor(e,t,i,r,s,o){super(),this._keybindingService=t,this._configurationService=i,this._openerService=r,this._instantiationService=s,this._accessibilityService=o,this._messageListeners=new ke,this._isDisposed=!1,this._forcePosition=!1,this._x=0,this._y=0,this._isLocked=!1,this._enableFocusTraps=!1,this._addedFocusTrap=!1,this._onDispose=this._register(new fe),this._onRequestLayout=this._register(new fe),this._linkHandler=e.linkHandler||(h=>Rle(this._openerService,h,bg(e.content)?e.content.isTrusted:void 0)),this._target="targetElements"in e.target?e.target:new Dxt(e.target),this._hoverPointer=e.appearance?.showPointer?Zg("div.workbench-hover-pointer"):void 0,this._hover=this._register(new yle),this._hover.containerDomNode.classList.add("workbench-hover","fadeIn"),e.appearance?.compact&&this._hover.containerDomNode.classList.add("workbench-hover","compact"),e.appearance?.skipFadeInAnimation&&this._hover.containerDomNode.classList.add("skip-fade-in"),e.additionalClasses&&this._hover.containerDomNode.classList.add(...e.additionalClasses),e.position?.forcePosition&&(this._forcePosition=!0),e.trapFocus&&(this._enableFocusTraps=!0),this._hoverPosition=e.position?.hoverPosition??3,this.onmousedown(this._hover.containerDomNode,h=>h.stopPropagation()),this.onkeydown(this._hover.containerDomNode,h=>{h.equals(9)&&this.dispose()}),this._register(Ce(this._targetWindow,"blur",()=>this.dispose()));const a=Zg("div.hover-row.markdown-hover"),l=Zg("div.hover-contents");if(typeof e.content=="string")l.textContent=e.content,l.style.whiteSpace="pre-wrap";else if(Eo(e.content))l.appendChild(e.content),l.classList.add("html-hover-contents");else{const h=e.content,f=this._instantiationService.createInstance(Q_,{codeBlockFontFamily:this._configurationService.getValue("editor").fontFamily||Wl.fontFamily}),{element:g}=f.render(h,{actionHandler:{callback:p=>this._linkHandler(p),disposables:this._messageListeners},asyncRenderCallback:()=>{l.classList.add("code-hover-contents"),this.layout(),this._onRequestLayout.fire()}});l.appendChild(g)}if(a.appendChild(l),this._hover.contentsDomNode.appendChild(a),e.actions&&e.actions.length>0){const h=Zg("div.hover-row.status-bar"),f=Zg("div.actions");e.actions.forEach(g=>{const p=this._keybindingService.lookupKeybinding(g.commandId),m=p?p.getLabel():null;gW.render(f,{label:g.label,commandId:g.commandId,run:_=>{g.run(_),this.dispose()},iconClass:g.iconClass},m)}),h.appendChild(f),this._hover.containerDomNode.appendChild(h)}this._hoverContainer=Zg("div.workbench-hover-container"),this._hoverPointer&&this._hoverContainer.appendChild(this._hoverPointer),this._hoverContainer.appendChild(this._hover.containerDomNode);let c;if(e.actions&&e.actions.length>0?c=!1:e.persistence?.hideOnHover===void 0?c=typeof e.content=="string"||bg(e.content)&&!e.content.value.includes("](")&&!e.content.value.includes(""):c=e.persistence.hideOnHover,e.appearance?.showHoverHint){const h=Zg("div.hover-row.status-bar"),f=Zg("div.info");f.textContent=w("hoverhint","Hold {0} key to mouse over",Rn?"Option":"Alt"),h.appendChild(f),this._hover.containerDomNode.appendChild(h)}const u=[...this._target.targetElements];c||u.push(this._hoverContainer);const d=this._register(new M1e(u));if(this._register(d.onMouseOut(()=>{this._isLocked||this.dispose()})),c){const h=[...this._target.targetElements,this._hoverContainer];this._lockMouseTracker=this._register(new M1e(h)),this._register(this._lockMouseTracker.onMouseOut(()=>{this._isLocked||this.dispose()}))}else this._lockMouseTracker=d}addFocusTrap(){if(!this._enableFocusTraps||this._addedFocusTrap)return;this._addedFocusTrap=!0;const e=this._hover.containerDomNode,t=this.findLastFocusableChild(this._hover.containerDomNode);if(t){const i=Vae(this._hoverContainer,Zg("div")),r=Ne(this._hoverContainer,Zg("div"));i.tabIndex=0,r.tabIndex=0,this._register(Ce(r,"focus",s=>{e.focus(),s.preventDefault()})),this._register(Ce(i,"focus",s=>{t.focus(),s.preventDefault()}))}}findLastFocusableChild(e){if(e.hasChildNodes())for(let t=0;t=0)return s}const r=this.findLastFocusableChild(i);if(r)return r}}render(e){e.appendChild(this._hoverContainer);const i=this._hoverContainer.contains(this._hoverContainer.ownerDocument.activeElement)&&M5e(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel());i&&Qp(i),this.layout(),this.addFocusTrap()}layout(){this._hover.containerDomNode.classList.remove("right-aligned"),this._hover.contentsDomNode.style.maxHeight="";const e=u=>{const d=d3e(u),h=u.getBoundingClientRect();return{top:h.top*d,bottom:h.bottom*d,right:h.right*d,left:h.left*d}},t=this._target.targetElements.map(u=>e(u)),{top:i,right:r,bottom:s,left:o}=t[0],a=r-o,l=s-i,c={top:i,right:r,bottom:s,left:o,width:a,height:l,center:{x:o+a/2,y:i+l/2}};if(this.adjustHorizontalHoverPosition(c),this.adjustVerticalHoverPosition(c),this.adjustHoverMaxHeight(c),this._hoverContainer.style.padding="",this._hoverContainer.style.margin="",this._hoverPointer){switch(this._hoverPosition){case 1:c.left+=3,c.right+=3,this._hoverContainer.style.paddingLeft="3px",this._hoverContainer.style.marginLeft="-3px";break;case 0:c.left-=3,c.right-=3,this._hoverContainer.style.paddingRight="3px",this._hoverContainer.style.marginRight="-3px";break;case 2:c.top+=3,c.bottom+=3,this._hoverContainer.style.paddingTop="3px",this._hoverContainer.style.marginTop="-3px";break;case 3:c.top-=3,c.bottom-=3,this._hoverContainer.style.paddingBottom="3px",this._hoverContainer.style.marginBottom="-3px";break}c.center.x=c.left+a/2,c.center.y=c.top+l/2}this.computeXCordinate(c),this.computeYCordinate(c),this._hoverPointer&&(this._hoverPointer.classList.remove("top"),this._hoverPointer.classList.remove("left"),this._hoverPointer.classList.remove("right"),this._hoverPointer.classList.remove("bottom"),this.setHoverPointerPosition(c)),this._hover.onContentsChanged()}computeXCordinate(e){const t=this._hover.containerDomNode.clientWidth+2;this._target.x!==void 0?this._x=this._target.x:this._hoverPosition===1?this._x=e.right:this._hoverPosition===0?this._x=e.left-t:(this._hoverPointer?this._x=e.center.x-this._hover.containerDomNode.clientWidth/2:this._x=e.left,this._x+t>=this._targetDocumentElement.clientWidth&&(this._hover.containerDomNode.classList.add("right-aligned"),this._x=Math.max(this._targetDocumentElement.clientWidth-t-2,this._targetDocumentElement.clientLeft))),this._xthis._targetWindow.innerHeight&&(this._y=e.bottom)}adjustHorizontalHoverPosition(e){if(this._target.x!==void 0)return;const t=this._hoverPointer?3:0;if(this._forcePosition){const i=t+2;this._hoverPosition===1?this._hover.containerDomNode.style.maxWidth=`${this._targetDocumentElement.clientWidth-e.right-i}px`:this._hoverPosition===0&&(this._hover.containerDomNode.style.maxWidth=`${e.left-i}px`);return}this._hoverPosition===1?this._targetDocumentElement.clientWidth-e.right=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=0:this._hoverPosition=2):this._hoverPosition===0&&(e.left=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=1:this._hoverPosition=2),e.left-this._hover.containerDomNode.clientWidth-t<=this._targetDocumentElement.clientLeft&&(this._hoverPosition=1))}adjustVerticalHoverPosition(e){if(this._target.y!==void 0||this._forcePosition)return;const t=this._hoverPointer?3:0;this._hoverPosition===3?e.top-this._hover.containerDomNode.clientHeight-t<0&&(this._hoverPosition=2):this._hoverPosition===2&&e.bottom+this._hover.containerDomNode.clientHeight+t>this._targetWindow.innerHeight&&(this._hoverPosition=3)}adjustHoverMaxHeight(e){let t=this._targetWindow.innerHeight/2;if(this._forcePosition){const i=(this._hoverPointer?3:0)+2;this._hoverPosition===3?t=Math.min(t,e.top-i):this._hoverPosition===2&&(t=Math.min(t,this._targetWindow.innerHeight-e.bottom-i))}if(this._hover.containerDomNode.style.maxHeight=`${t}px`,this._hover.contentsDomNode.clientHeighte.height?this._hoverPointer.style.top=`${e.center.y-(this._y-t)-3}px`:this._hoverPointer.style.top=`${Math.round(t/2)-3}px`;break}case 3:case 2:{this._hoverPointer.classList.add(this._hoverPosition===3?"bottom":"top");const t=this._hover.containerDomNode.clientWidth;let i=Math.round(t/2)-3;const r=this._x+i;(re.right)&&(i=e.center.x-this._x-3),this._hoverPointer.style.left=`${i}px`;break}}}focus(){this._hover.containerDomNode.focus()}dispose(){this._isDisposed||(this._onDispose.fire(),this._hoverContainer.remove(),this._messageListeners.dispose(),this._target.dispose(),super.dispose()),this._isDisposed=!0}};cQ=Txt([AT(1,xi),AT(2,En),AT(3,Pc),AT(4,Tt),AT(5,_u)],cQ);class M1e extends ud{get onMouseOut(){return this._onMouseOut.event}get isMouseIn(){return this._isMouseIn}constructor(e){super(),this._elements=e,this._isMouseIn=!0,this._onMouseOut=this._register(new fe),this._elements.forEach(t=>this.onmouseover(t,()=>this._onTargetMouseOver(t))),this._elements.forEach(t=>this.onmouseleave(t,()=>this._onTargetMouseLeave(t)))}_onTargetMouseOver(e){this._isMouseIn=!0,this._clearEvaluateMouseStateTimeout(e)}_onTargetMouseLeave(e){this._isMouseIn=!1,this._evaluateMouseState(e)}_evaluateMouseState(e){this._clearEvaluateMouseStateTimeout(e),this._mouseTimeout=Ot(e).setTimeout(()=>this._fireIfMouseOutside(),0)}_clearEvaluateMouseStateTimeout(e){this._mouseTimeout&&(Ot(e).clearTimeout(this._mouseTimeout),this._mouseTimeout=void 0)}_fireIfMouseOutside(){this._isMouseIn||this._onMouseOut.fire()}}class Dxt{constructor(e){this._element=e,this.targetElements=[this._element]}dispose(){}}var Ba;(function(n){function e(s,o){if(s.start>=o.end||o.start>=s.end)return{start:0,end:0};const a=Math.max(s.start,o.start),l=Math.min(s.end,o.end);return l-a<=0?{start:0,end:0}:{start:a,end:l}}n.intersect=e;function t(s){return s.end-s.start<=0}n.isEmpty=t;function i(s,o){return!t(e(s,o))}n.intersects=i;function r(s,o){const a=[],l={start:s.start,end:Math.min(o.start,s.end)},c={start:Math.max(o.end,s.start),end:s.end};return t(l)||a.push(l),t(c)||a.push(c),a}n.relativeComplement=r})(Ba||(Ba={}));function Ixt(n){const e=n;return!!e&&typeof e.x=="number"&&typeof e.y=="number"}var Rv;(function(n){n[n.AVOID=0]="AVOID",n[n.ALIGN=1]="ALIGN"})(Rv||(Rv={}));function SS(n,e,t){const i=t.mode===Rv.ALIGN?t.offset:t.offset+t.size,r=t.mode===Rv.ALIGN?t.offset+t.size:t.offset;return t.position===0?e<=n-i?i:e<=r?r-e:Math.max(n-e,0):e<=r?r-e:e<=n-i?i:0}class v8 extends me{static{this.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"]}static{this.BUBBLE_DOWN_EVENTS=["click"]}constructor(e,t){super(),this.container=null,this.useFixedPosition=!1,this.useShadowDOM=!1,this.delegate=null,this.toDisposeOnClean=me.None,this.toDisposeOnSetContainer=me.None,this.shadowRoot=null,this.shadowRootHostElement=null,this.view=qe(".context-view"),Al(this.view),this.setContainer(e,t),this._register(Lt(()=>this.setContainer(null,1)))}setContainer(e,t){this.useFixedPosition=t!==1;const i=this.useShadowDOM;if(this.useShadowDOM=t===3,!(e===this.container&&i===this.useShadowDOM)&&(this.container&&(this.toDisposeOnSetContainer.dispose(),this.view.remove(),this.shadowRoot&&(this.shadowRoot=null,this.shadowRootHostElement?.remove(),this.shadowRootHostElement=null),this.container=null),e)){if(this.container=e,this.useShadowDOM){this.shadowRootHostElement=qe(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});const s=document.createElement("style");s.textContent=Axt,this.shadowRoot.appendChild(s),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(qe("slot"))}else this.container.appendChild(this.view);const r=new ke;v8.BUBBLE_UP_EVENTS.forEach(s=>{r.add(Jr(this.container,s,o=>{this.onDOMEvent(o,!1)}))}),v8.BUBBLE_DOWN_EVENTS.forEach(s=>{r.add(Jr(this.container,s,o=>{this.onDOMEvent(o,!0)},!0))}),this.toDisposeOnSetContainer=r}}show(e){this.isVisible()&&this.hide(),Jo(this.view),this.view.className="context-view monaco-component",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex=`${2575+(e.layer??0)}`,this.view.style.position=this.useFixedPosition?"fixed":"absolute",Qc(this.view),this.toDisposeOnClean=e.render(this.view)||me.None,this.delegate=e,this.doLayout(),this.delegate.focus?.()}getViewElement(){return this.view}layout(){if(this.isVisible()){if(this.delegate.canRelayout===!1&&!(Sg&&Pae.pointerEvents)){this.hide();return}this.delegate?.layout?.(),this.doLayout()}}doLayout(){if(!this.isVisible())return;const e=this.delegate.getAnchor();let t;if(Eo(e)){const h=ms(e),f=d3e(e);t={top:h.top*f,left:h.left*f,width:h.width*f,height:h.height*f}}else Ixt(e)?t={top:e.y,left:e.x,width:e.width||1,height:e.height||2}:t={top:e.posy,left:e.posx,width:2,height:2};const i=qc(this.view),r=h_(this.view),s=this.delegate.anchorPosition||0,o=this.delegate.anchorAlignment||0,a=this.delegate.anchorAxisAlignment||0;let l,c;const u=SD();if(a===0){const h={offset:t.top-u.pageYOffset,size:t.height,position:s===0?0:1},f={offset:t.left,size:t.width,position:o===0?0:1,mode:Rv.ALIGN};l=SS(u.innerHeight,r,h)+u.pageYOffset,Ba.intersects({start:l,end:l+r},{start:h.offset,end:h.offset+h.size})&&(f.mode=Rv.AVOID),c=SS(u.innerWidth,i,f)}else{const h={offset:t.left,size:t.width,position:o===0?0:1},f={offset:t.top,size:t.height,position:s===0?0:1,mode:Rv.ALIGN};c=SS(u.innerWidth,i,h),Ba.intersects({start:c,end:c+i},{start:h.offset,end:h.offset+h.size})&&(f.mode=Rv.AVOID),l=SS(u.innerHeight,r,f)+u.pageYOffset}this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(s===0?"bottom":"top"),this.view.classList.add(o===0?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);const d=ms(this.container);this.view.style.top=`${l-(this.useFixedPosition?ms(this.view).top:d.top)}px`,this.view.style.left=`${c-(this.useFixedPosition?ms(this.view).left:d.left)}px`,this.view.style.width="initial"}hide(e){const t=this.delegate;this.delegate=null,t?.onHide&&t.onHide(e),this.toDisposeOnClean.dispose(),Al(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,Ot(e).document.activeElement):t&&!xo(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}}const Axt=` :host { all: initial; /* 1st rule so subsequent properties are reset. */ } @@ -263,8 +263,8 @@ Please report this to https://github.com/markedjs/marked.`,re){const Y="

An er :host-context(.linux:lang(zh-Hant)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; } :host-context(.linux:lang(ja)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; } :host-context(.linux:lang(ko)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; } -`;var Nxt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Rxt=function(n,e){return function(t,i){e(t,i,n)}};let b8=class extends me{constructor(e){super(),this.layoutService=e,this.contextView=this._register(new v8(this.layoutService.mainContainer,1)),this.layout(),this._register(e.onDidLayoutContainer(()=>this.layout()))}showContextView(e,t,i){let r;t?t===this.layoutService.getContainer(Ot(t))?r=1:i?r=3:r=2:r=1,this.contextView.setContainer(t??this.layoutService.activeContainer,r),this.contextView.show(e);const s={close:()=>{this.openContextView===s&&this.hideContextView()}};return this.openContextView=s,s}layout(){this.contextView.layout()}hideContextView(e){this.contextView.hide(e),this.openContextView=void 0}};b8=Nxt([Rxt(0,Zb)],b8);class Pxt extends b8{getContextViewElement(){return this.contextView.getViewElement()}}class Oxt{constructor(e,t,i){this.hoverDelegate=e,this.target=t,this.fadeInAnimation=i}async update(e,t,i){if(this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0),this.isDisposed)return;let r;if(e===void 0||yc(e)||Eo(e))r=e;else if(!tN(e.markdown))r=e.markdown??e.markdownNotSupportedFallback;else{this._hoverWidget||this.show(w("iconLabel.loading","Loading..."),t,i),this._cancellationTokenSource=new Kr;const s=this._cancellationTokenSource.token;if(r=await e.markdown(s),r===void 0&&(r=e.markdownNotSupportedFallback),this.isDisposed||s.isCancellationRequested)return}this.show(r,t,i)}show(e,t,i){const r=this._hoverWidget;if(this.hasContent(e)){const s={content:e,target:this.target,actions:i?.actions,linkHandler:i?.linkHandler,trapFocus:i?.trapFocus,appearance:{showPointer:this.hoverDelegate.placement==="element",skipFadeInAnimation:!this.fadeInAnimation||!!r,showHoverHint:i?.appearance?.showHoverHint},position:{hoverPosition:2}};this._hoverWidget=this.hoverDelegate.showHover(s,t)}r?.dispose()}hasContent(e){return e?bg(e)?!!e.value:!0:!1}get isDisposed(){return this._hoverWidget?.isDisposed}dispose(){this._hoverWidget?.dispose(),this._cancellationTokenSource?.dispose(!0),this._cancellationTokenSource=void 0}}var Mxt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},NT=function(n,e){return function(t,i){e(t,i,n)}};let uQ=class extends me{constructor(e,t,i,r,s){super(),this._instantiationService=e,this._keybindingService=i,this._layoutService=r,this._accessibilityService=s,this._managedHovers=new Map,t.onDidShowContextMenu(()=>this.hideHover()),this._contextViewHandler=this._register(new b8(this._layoutService))}showHover(e,t,i){if(F1e(this._currentHoverOptions)===F1e(e)||this._currentHover&&this._currentHoverOptions?.persistence?.sticky)return;this._currentHoverOptions=e,this._lastHoverOptions=e;const r=e.trapFocus||this._accessibilityService.isScreenReaderOptimized(),s=ka();i||(r&&s?s.classList.contains("monaco-hover")||(this._lastFocusedElementBeforeOpen=s):this._lastFocusedElementBeforeOpen=void 0);const o=new ke,a=this._instantiationService.createInstance(cQ,e);if(e.persistence?.sticky&&(a.isLocked=!0),a.onDispose(()=>{this._currentHover?.domNode&&f3e(this._currentHover.domNode)&&this._lastFocusedElementBeforeOpen?.focus(),this._currentHoverOptions===e&&(this._currentHoverOptions=void 0),o.dispose()},void 0,o),!e.container){const l=Eo(e.target)?e.target:e.target.targetElements[0];e.container=this._layoutService.getContainer(Ot(l))}if(this._contextViewHandler.showContextView(new Fxt(a,t),e.container),a.onRequestLayout(()=>this._contextViewHandler.layout(),void 0,o),e.persistence?.sticky)o.add(Ce(Ot(e.container).document,je.MOUSE_DOWN,l=>{xo(l.target,a.domNode)||this.doHideHover()}));else{if("targetElements"in e.target)for(const c of e.target.targetElements)o.add(Ce(c,je.CLICK,()=>this.hideHover()));else o.add(Ce(e.target,je.CLICK,()=>this.hideHover()));const l=ka();if(l){const c=Ot(l).document;o.add(Ce(l,je.KEY_DOWN,u=>this._keyDown(u,a,!!e.persistence?.hideOnKeyDown))),o.add(Ce(c,je.KEY_DOWN,u=>this._keyDown(u,a,!!e.persistence?.hideOnKeyDown))),o.add(Ce(l,je.KEY_UP,u=>this._keyUp(u,a))),o.add(Ce(c,je.KEY_UP,u=>this._keyUp(u,a)))}}if("IntersectionObserver"in Xi){const l=new IntersectionObserver(u=>this._intersectionChange(u,a),{threshold:0}),c="targetElements"in e.target?e.target.targetElements[0]:e.target;l.observe(c),o.add(Lt(()=>l.disconnect()))}return this._currentHover=a,a}hideHover(){this._currentHover?.isLocked||!this._currentHoverOptions||this.doHideHover()}doHideHover(){this._currentHover=void 0,this._currentHoverOptions=void 0,this._contextViewHandler.hideContextView()}_intersectionChange(e,t){e[e.length-1].isIntersecting||t.dispose()}showAndFocusLastHover(){this._lastHoverOptions&&this.showHover(this._lastHoverOptions,!0,!0)}_keyDown(e,t,i){if(e.key==="Alt"){t.isLocked=!0;return}const r=new or(e);this._keybindingService.resolveKeyboardEvent(r).getSingleModifierDispatchChords().some(o=>!!o)||this._keybindingService.softDispatch(r,r.target).kind!==0||i&&(!this._currentHoverOptions?.trapFocus||e.key!=="Tab")&&(this.hideHover(),this._lastFocusedElementBeforeOpen?.focus())}_keyUp(e,t){e.key==="Alt"&&(t.isLocked=!1,t.isMouseIn||(this.hideHover(),this._lastFocusedElementBeforeOpen?.focus()))}setupManagedHover(e,t,i,r){t.setAttribute("custom-hover","true"),t.title!==""&&(console.warn("HTML element already has a title attribute, which will conflict with the custom hover. Please remove the title attribute."),console.trace("Stack trace:",t.title),t.title="");let s,o;const a=(y,C)=>{const x=o!==void 0;y&&(o?.dispose(),o=void 0),C&&(s?.dispose(),s=void 0),x&&(e.onDidHideHover?.(),o=void 0)},l=(y,C,x,k)=>new hf(async()=>{(!o||o.isDisposed)&&(o=new Oxt(e,x||t,y>0),await o.update(typeof i=="function"?i():i,C,{...r,trapFocus:k}))},y);let c=!1;const u=Ce(t,je.MOUSE_DOWN,()=>{c=!0,a(!0,!0)},!0),d=Ce(t,je.MOUSE_UP,()=>{c=!1},!0),h=Ce(t,je.MOUSE_LEAVE,y=>{c=!1,a(!1,y.fromElement===t)},!0),f=y=>{if(s)return;const C=new ke,x={targetElements:[t],dispose:()=>{}};if(e.placement===void 0||e.placement==="mouse"){const k=L=>{x.x=L.x+10,Eo(L.target)&&B1e(L.target,t)!==t&&a(!0,!0)};C.add(Ce(t,je.MOUSE_MOVE,k,!0))}s=C,!(Eo(y.target)&&B1e(y.target,t)!==t)&&C.add(l(e.delay,!1,x))},g=Ce(t,je.MOUSE_OVER,f,!0),p=()=>{if(c||s)return;const y={targetElements:[t],dispose:()=>{}},C=new ke,x=()=>a(!0,!0);C.add(Ce(t,je.BLUR,x,!0)),C.add(l(e.delay,!1,y)),s=C};let m;const _=t.tagName.toLowerCase();_!=="input"&&_!=="textarea"&&(m=Ce(t,je.FOCUS,p,!0));const v={show:y=>{a(!1,!0),l(0,y,void 0,y)},hide:()=>{a(!0,!0)},update:async(y,C)=>{i=y,await o?.update(i,void 0,C)},dispose:()=>{this._managedHovers.delete(t),g.dispose(),h.dispose(),u.dispose(),d.dispose(),m?.dispose(),a(!0,!0)}};return this._managedHovers.set(t,v),v}showManagedHover(e){const t=this._managedHovers.get(e);t&&t.show(!0)}dispose(){this._managedHovers.forEach(e=>e.dispose()),super.dispose()}};uQ=Mxt([NT(0,Tt),NT(1,mu),NT(2,xi),NT(3,Zb),NT(4,_u)],uQ);function F1e(n){if(n!==void 0)return n?.id??n}class Fxt{get anchorPosition(){return this._hover.anchor}constructor(e,t=!1){this._hover=e,this._focus=t,this.layer=1}render(e){return this._hover.render(e),this._focus&&this._hover.focus(),this._hover}getAnchor(){return{x:this._hover.x,y:this._hover.y}}layout(){this._hover.layout()}}function B1e(n,e){for(e=e??Ot(n).document.body;!n.hasAttribute("custom-hover")&&n!==e;)n=n.parentElement;return n}Vn(um,uQ,1);dh((n,e)=>{const t=n.getColor(CFe);t&&(e.addRule(`.monaco-workbench .workbench-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-workbench .workbench-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`))});const rO=On("IWorkspaceEditService");class Ple{constructor(e){this.metadata=e}static convert(e){return e.edits.map(t=>{if(ab.is(t))return ab.lift(t);if(hk.is(t))return hk.lift(t);throw new Error("Unsupported edit")})}}class ab extends Ple{static is(e){return e instanceof ab?!0:Mo(e)&&Pt.isUri(e.resource)&&Mo(e.textEdit)}static lift(e){return e instanceof ab?e:new ab(e.resource,e.textEdit,e.versionId,e.metadata)}constructor(e,t,i=void 0,r){super(r),this.resource=e,this.textEdit=t,this.versionId=i}}class hk extends Ple{static is(e){return e instanceof hk?!0:Mo(e)&&(!!e.newResource||!!e.oldResource)}static lift(e){return e instanceof hk?e:new hk(e.oldResource,e.newResource,e.options,e.metadata)}constructor(e,t,i={},r){super(r),this.oldResource=e,this.newResource=t,this.options=i}}const la={enableSplitViewResizing:!0,splitViewDefaultRatio:.5,renderSideBySide:!0,renderMarginRevertIcon:!0,renderGutterMenu:!0,maxComputationTime:5e3,maxFileSize:50,ignoreTrimWhitespace:!0,renderIndicators:!0,originalEditable:!1,diffCodeLens:!1,renderOverviewRuler:!0,diffWordWrap:"inherit",diffAlgorithm:"advanced",accessibilityVerbose:!1,experimental:{showMoves:!1,showEmptyDecorations:!0,useTrueInlineView:!1},hideUnchangedRegions:{enabled:!1,contextLineCount:3,minimumLineCount:3,revealLineCount:20},isInEmbeddedEditor:!1,onlyShowAccessibleDiffViewer:!1,renderSideBySideInlineBreakpoint:900,useInlineViewWhenSpaceIsLimited:!0,compactMode:!1},sO=Object.freeze({id:"editor",order:5,type:"object",title:w("editorConfigurationTitle","Editor"),scope:5}),y8={...sO,properties:{"editor.tabSize":{type:"number",default:Va.tabSize,minimum:1,markdownDescription:w("tabSize","The number of spaces a tab is equal to. This setting is overridden based on the file contents when {0} is on.","`#editor.detectIndentation#`")},"editor.indentSize":{anyOf:[{type:"string",enum:["tabSize"]},{type:"number",minimum:1}],default:"tabSize",markdownDescription:w("indentSize",'The number of spaces used for indentation or `"tabSize"` to use the value from `#editor.tabSize#`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.')},"editor.insertSpaces":{type:"boolean",default:Va.insertSpaces,markdownDescription:w("insertSpaces","Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when {0} is on.","`#editor.detectIndentation#`")},"editor.detectIndentation":{type:"boolean",default:Va.detectIndentation,markdownDescription:w("detectIndentation","Controls whether {0} and {1} will be automatically detected when a file is opened based on the file contents.","`#editor.tabSize#`","`#editor.insertSpaces#`")},"editor.trimAutoWhitespace":{type:"boolean",default:Va.trimAutoWhitespace,description:w("trimAutoWhitespace","Remove trailing auto inserted whitespace.")},"editor.largeFileOptimizations":{type:"boolean",default:Va.largeFileOptimizations,description:w("largeFileOptimizations","Special handling for large files to disable certain memory intensive features.")},"editor.wordBasedSuggestions":{enum:["off","currentDocument","matchingDocuments","allDocuments"],default:"matchingDocuments",enumDescriptions:[w("wordBasedSuggestions.off","Turn off Word Based Suggestions."),w("wordBasedSuggestions.currentDocument","Only suggest words from the active document."),w("wordBasedSuggestions.matchingDocuments","Suggest words from all open documents of the same language."),w("wordBasedSuggestions.allDocuments","Suggest words from all open documents.")],description:w("wordBasedSuggestions","Controls whether completions should be computed based on words in the document and from which documents they are computed.")},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[w("semanticHighlighting.true","Semantic highlighting enabled for all color themes."),w("semanticHighlighting.false","Semantic highlighting disabled for all color themes."),w("semanticHighlighting.configuredByTheme","Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")],default:"configuredByTheme",description:w("semanticHighlighting.enabled","Controls whether the semanticHighlighting is shown for the languages that support it.")},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:w("stablePeek","Keep peek editors open even when double-clicking their content or when hitting `Escape`.")},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:w("maxTokenizationLineLength","Lines above this length will not be tokenized for performance reasons")},"editor.experimental.asyncTokenization":{type:"boolean",default:!0,description:w("editor.experimental.asyncTokenization","Controls whether the tokenization should happen asynchronously on a web worker."),tags:["experimental"]},"editor.experimental.asyncTokenizationLogging":{type:"boolean",default:!1,description:w("editor.experimental.asyncTokenizationLogging","Controls whether async tokenization should be logged. For debugging only.")},"editor.experimental.asyncTokenizationVerification":{type:"boolean",default:!1,description:w("editor.experimental.asyncTokenizationVerification","Controls whether async tokenization should be verified against legacy background tokenization. Might slow down tokenization. For debugging only."),tags:["experimental"]},"editor.experimental.treeSitterTelemetry":{type:"boolean",default:!1,markdownDescription:w("editor.experimental.treeSitterTelemetry","Controls whether tree sitter parsing should be turned on and telemetry collected. Setting `editor.experimental.preferTreeSitter` for specific languages will take precedence."),tags:["experimental"]},"editor.language.brackets":{type:["array","null"],default:null,description:w("schema.brackets","Defines the bracket symbols that increase or decrease the indentation."),items:{type:"array",items:[{type:"string",description:w("schema.openBracket","The opening bracket character or string sequence.")},{type:"string",description:w("schema.closeBracket","The closing bracket character or string sequence.")}]}},"editor.language.colorizedBracketPairs":{type:["array","null"],default:null,description:w("schema.colorizedBracketPairs","Defines the bracket pairs that are colorized by their nesting level if bracket pair colorization is enabled."),items:{type:"array",items:[{type:"string",description:w("schema.openBracket","The opening bracket character or string sequence.")},{type:"string",description:w("schema.closeBracket","The closing bracket character or string sequence.")}]}},"diffEditor.maxComputationTime":{type:"number",default:la.maxComputationTime,description:w("maxComputationTime","Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")},"diffEditor.maxFileSize":{type:"number",default:la.maxFileSize,description:w("maxFileSize","Maximum file size in MB for which to compute diffs. Use 0 for no limit.")},"diffEditor.renderSideBySide":{type:"boolean",default:la.renderSideBySide,description:w("sideBySide","Controls whether the diff editor shows the diff side by side or inline.")},"diffEditor.renderSideBySideInlineBreakpoint":{type:"number",default:la.renderSideBySideInlineBreakpoint,description:w("renderSideBySideInlineBreakpoint","If the diff editor width is smaller than this value, the inline view is used.")},"diffEditor.useInlineViewWhenSpaceIsLimited":{type:"boolean",default:la.useInlineViewWhenSpaceIsLimited,description:w("useInlineViewWhenSpaceIsLimited","If enabled and the editor width is too small, the inline view is used.")},"diffEditor.renderMarginRevertIcon":{type:"boolean",default:la.renderMarginRevertIcon,description:w("renderMarginRevertIcon","When enabled, the diff editor shows arrows in its glyph margin to revert changes.")},"diffEditor.renderGutterMenu":{type:"boolean",default:la.renderGutterMenu,description:w("renderGutterMenu","When enabled, the diff editor shows a special gutter for revert and stage actions.")},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:la.ignoreTrimWhitespace,description:w("ignoreTrimWhitespace","When enabled, the diff editor ignores changes in leading or trailing whitespace.")},"diffEditor.renderIndicators":{type:"boolean",default:la.renderIndicators,description:w("renderIndicators","Controls whether the diff editor shows +/- indicators for added/removed changes.")},"diffEditor.codeLens":{type:"boolean",default:la.diffCodeLens,description:w("codeLens","Controls whether the editor shows CodeLens.")},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:la.diffWordWrap,markdownEnumDescriptions:[w("wordWrap.off","Lines will never wrap."),w("wordWrap.on","Lines will wrap at the viewport width."),w("wordWrap.inherit","Lines will wrap according to the {0} setting.","`#editor.wordWrap#`")]},"diffEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:la.diffAlgorithm,markdownEnumDescriptions:[w("diffAlgorithm.legacy","Uses the legacy diffing algorithm."),w("diffAlgorithm.advanced","Uses the advanced diffing algorithm.")],tags:["experimental"]},"diffEditor.hideUnchangedRegions.enabled":{type:"boolean",default:la.hideUnchangedRegions.enabled,markdownDescription:w("hideUnchangedRegions.enabled","Controls whether the diff editor shows unchanged regions.")},"diffEditor.hideUnchangedRegions.revealLineCount":{type:"integer",default:la.hideUnchangedRegions.revealLineCount,markdownDescription:w("hideUnchangedRegions.revealLineCount","Controls how many lines are used for unchanged regions."),minimum:1},"diffEditor.hideUnchangedRegions.minimumLineCount":{type:"integer",default:la.hideUnchangedRegions.minimumLineCount,markdownDescription:w("hideUnchangedRegions.minimumLineCount","Controls how many lines are used as a minimum for unchanged regions."),minimum:1},"diffEditor.hideUnchangedRegions.contextLineCount":{type:"integer",default:la.hideUnchangedRegions.contextLineCount,markdownDescription:w("hideUnchangedRegions.contextLineCount","Controls how many lines are used as context when comparing unchanged regions."),minimum:1},"diffEditor.experimental.showMoves":{type:"boolean",default:la.experimental.showMoves,markdownDescription:w("showMoves","Controls whether the diff editor should show detected code moves.")},"diffEditor.experimental.showEmptyDecorations":{type:"boolean",default:la.experimental.showEmptyDecorations,description:w("showEmptyDecorations","Controls whether the diff editor shows empty decorations to see where characters got inserted or deleted.")},"diffEditor.experimental.useTrueInlineView":{type:"boolean",default:la.experimental.useTrueInlineView,description:w("useTrueInlineView","If enabled and the editor uses the inline view, word changes are rendered inline.")}}};function Bxt(n){return typeof n.type<"u"||typeof n.anyOf<"u"}for(const n of vS){const e=n.schema;if(typeof e<"u")if(Bxt(e))y8.properties[`editor.${n.name}`]=e;else for(const t in e)Object.hasOwnProperty.call(e,t)&&(y8.properties[t]=e[t])}let O4=null;function e5e(){return O4===null&&(O4=Object.create(null),Object.keys(y8.properties).forEach(n=>{O4[n]=!0})),O4}function $xt(n){return e5e()[`editor.${n}`]||!1}function Wxt(n){return e5e()[`diffEditor.${n}`]||!1}const Hxt=Yr.as(ff.Configuration);Hxt.registerConfiguration(y8);class jr{static insert(e,t){return{range:new $(e.lineNumber,e.column,e.lineNumber,e.column),text:t,forceMoveMarkers:!0}}static delete(e){return{range:e,text:null}}static replace(e,t){return{range:e,text:t}}static replaceMove(e,t){return{range:e,text:t,forceMoveMarkers:!0}}}function M4(n){return Object.isFrozen(n)?n:spt(n)}class Zo{static createEmptyModel(e){return new Zo({},[],[],void 0,e)}constructor(e,t,i,r,s){this._contents=e,this._keys=t,this._overrides=i,this.raw=r,this.logService=s,this.overrideConfigurations=new Map}get rawConfiguration(){if(!this._rawConfiguration)if(this.raw?.length){const e=this.raw.map(t=>{if(t instanceof Zo)return t;const i=new Vxt("",this.logService);return i.parseRaw(t),i.configurationModel});this._rawConfiguration=e.reduce((t,i)=>i===t?i:t.merge(i),e[0])}else this._rawConfiguration=this;return this._rawConfiguration}get contents(){return this._contents}get overrides(){return this._overrides}get keys(){return this._keys}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(e){return e?hbe(this.contents,e):this.contents}inspect(e,t){const i=this;return{get value(){return M4(i.rawConfiguration.getValue(e))},get override(){return t?M4(i.rawConfiguration.getOverrideValue(e,t)):void 0},get merged(){return M4(t?i.rawConfiguration.override(t).getValue(e):i.rawConfiguration.getValue(e))},get overrides(){const r=[];for(const{contents:s,identifiers:o,keys:a}of i.rawConfiguration.overrides){const l=new Zo(s,a,[],void 0,i.logService).getValue(e);l!==void 0&&r.push({identifiers:o,value:l})}return r.length?M4(r):void 0}}}getOverrideValue(e,t){const i=this.getContentsForOverrideIdentifer(t);return i?e?hbe(i,e):i:void 0}override(e){let t=this.overrideConfigurations.get(e);return t||(t=this.createOverrideConfigurationModel(e),this.overrideConfigurations.set(e,t)),t}merge(...e){const t=Qm(this.contents),i=Qm(this.overrides),r=[...this.keys],s=this.raw?.length?[...this.raw]:[this];for(const o of e)if(s.push(...o.raw?.length?o.raw:[o]),!o.isEmpty()){this.mergeContents(t,o.contents);for(const a of o.overrides){const[l]=i.filter(c=>$r(c.identifiers,a.identifiers));l?(this.mergeContents(l.contents,a.contents),l.keys.push(...a.keys),l.keys=j_(l.keys)):i.push(Qm(a))}for(const a of o.keys)r.indexOf(a)===-1&&r.push(a)}return new Zo(t,r,i,s.every(o=>o instanceof Zo)?void 0:s,this.logService)}createOverrideConfigurationModel(e){const t=this.getContentsForOverrideIdentifer(e);if(!t||typeof t!="object"||!Object.keys(t).length)return this;const i={};for(const r of j_([...Object.keys(this.contents),...Object.keys(t)])){let s=this.contents[r];const o=t[r];o&&(typeof s=="object"&&typeof o=="object"?(s=Qm(s),this.mergeContents(s,o)):s=o),i[r]=s}return new Zo(i,this.keys,this.overrides,void 0,this.logService)}mergeContents(e,t){for(const i of Object.keys(t)){if(i in e&&Mo(e[i])&&Mo(t[i])){this.mergeContents(e[i],t[i]);continue}e[i]=Qm(t[i])}}getContentsForOverrideIdentifer(e){let t=null,i=null;const r=s=>{s&&(i?this.mergeContents(i,s):i=Qm(s))};for(const s of this.overrides)s.identifiers.length===1&&s.identifiers[0]===e?t=s.contents:s.identifiers.includes(e)&&r(s.contents);return r(t),i}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}setValue(e,t){this.updateValue(e,t,!1)}removeValue(e){const t=this.keys.indexOf(e);t!==-1&&(this.keys.splice(t,1),qvt(this.contents,e),Eb.test(e)&&this.overrides.splice(this.overrides.findIndex(i=>$r(i.identifiers,e8(e))),1))}updateValue(e,t,i){if(M3e(this.contents,e,t,r=>this.logService.error(r)),i=i||this.keys.indexOf(e)===-1,i&&this.keys.push(e),Eb.test(e)){const r=e8(e),s={identifiers:r,keys:Object.keys(this.contents[e]),contents:EX(this.contents[e],a=>this.logService.error(a))},o=this.overrides.findIndex(a=>$r(a.identifiers,r));o!==-1?this.overrides[o]=s:this.overrides.push(s)}}}class Vxt{constructor(e,t){this._name=e,this.logService=t,this._raw=null,this._configurationModel=null,this._restrictedConfigurations=[]}get configurationModel(){return this._configurationModel||Zo.createEmptyModel(this.logService)}parseRaw(e,t){this._raw=e;const{contents:i,keys:r,overrides:s,restricted:o,hasExcludedProperties:a}=this.doParseRaw(e,t);this._configurationModel=new Zo(i,r,s,a?[e]:void 0,this.logService),this._restrictedConfigurations=o||[]}doParseRaw(e,t){const i=Yr.as(ff.Configuration).getConfigurationProperties(),r=this.filter(e,i,!0,t);e=r.raw;const s=EX(e,l=>this.logService.error(`Conflict in settings file ${this._name}: ${l}`)),o=Object.keys(e),a=this.toOverrides(e,l=>this.logService.error(`Conflict in settings file ${this._name}: ${l}`));return{contents:s,keys:o,overrides:a,restricted:r.restricted,hasExcludedProperties:r.hasExcludedProperties}}filter(e,t,i,r){let s=!1;if(!r?.scopes&&!r?.skipRestricted&&!r?.exclude?.length)return{raw:e,restricted:[],hasExcludedProperties:s};const o={},a=[];for(const l in e)if(Eb.test(l)&&i){const c=this.filter(e[l],t,!1,r);o[l]=c.raw,s=s||c.hasExcludedProperties,a.push(...c.restricted)}else{const c=t[l],u=c?typeof c.scope<"u"?c.scope:3:void 0;c?.restricted&&a.push(l),!r.exclude?.includes(l)&&(r.include?.includes(l)||(u===void 0||r.scopes===void 0||r.scopes.includes(u))&&!(r.skipRestricted&&c?.restricted))?o[l]=e[l]:s=!0}return{raw:o,restricted:a,hasExcludedProperties:s}}toOverrides(e,t){const i=[];for(const r of Object.keys(e))if(Eb.test(r)){const s={};for(const o in e[r])s[o]=e[r][o];i.push({identifiers:e8(r),keys:Object.keys(s),contents:EX(s,t)})}return i}}class zxt{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f){this.key=e,this.overrides=t,this._value=i,this.overrideIdentifiers=r,this.defaultConfiguration=s,this.policyConfiguration=o,this.applicationConfiguration=a,this.userConfiguration=l,this.localUserConfiguration=c,this.remoteUserConfiguration=u,this.workspaceConfiguration=d,this.folderConfigurationModel=h,this.memoryConfigurationModel=f}toInspectValue(e){return e?.value!==void 0||e?.override!==void 0||e?.overrides!==void 0?e:void 0}get userInspectValue(){return this._userInspectValue||(this._userInspectValue=this.userConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userInspectValue}get user(){return this.toInspectValue(this.userInspectValue)}}class yW{constructor(e,t,i,r,s,o,a,l,c,u){this._defaultConfiguration=e,this._policyConfiguration=t,this._applicationConfiguration=i,this._localUserConfiguration=r,this._remoteUserConfiguration=s,this._workspaceConfiguration=o,this._folderConfigurations=a,this._memoryConfiguration=l,this._memoryConfigurationByResource=c,this.logService=u,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations=new so,this._userConfiguration=null}getValue(e,t,i){return this.getConsolidatedConfigurationModel(e,t,i).getValue(e)}updateValue(e,t,i={}){let r;i.resource?(r=this._memoryConfigurationByResource.get(i.resource),r||(r=Zo.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(i.resource,r))):r=this._memoryConfiguration,t===void 0?r.removeValue(e):r.setValue(e,t),i.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(e,t,i){const r=this.getConsolidatedConfigurationModel(e,t,i),s=this.getFolderConfigurationModelForResource(t.resource,i),o=t.resource?this._memoryConfigurationByResource.get(t.resource)||this._memoryConfiguration:this._memoryConfiguration,a=new Set;for(const l of r.overrides)for(const c of l.identifiers)r.getOverrideValue(e,c)!==void 0&&a.add(c);return new zxt(e,t,r.getValue(e),a.size?[...a]:void 0,this._defaultConfiguration,this._policyConfiguration.isEmpty()?void 0:this._policyConfiguration,this.applicationConfiguration.isEmpty()?void 0:this.applicationConfiguration,this.userConfiguration,this.localUserConfiguration,this.remoteUserConfiguration,i?this._workspaceConfiguration:void 0,s||void 0,o)}get applicationConfiguration(){return this._applicationConfiguration}get userConfiguration(){return this._userConfiguration||(this._userConfiguration=this._remoteUserConfiguration.isEmpty()?this._localUserConfiguration:this._localUserConfiguration.merge(this._remoteUserConfiguration)),this._userConfiguration}get localUserConfiguration(){return this._localUserConfiguration}get remoteUserConfiguration(){return this._remoteUserConfiguration}getConsolidatedConfigurationModel(e,t,i){let r=this.getConsolidatedConfigurationModelForResource(t,i);return t.overrideIdentifier&&(r=r.override(t.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(e)!==void 0&&(r=r.merge(this._policyConfiguration)),r}getConsolidatedConfigurationModelForResource({resource:e},t){let i=this.getWorkspaceConsolidatedConfiguration();if(t&&e){const r=t.getFolder(e);r&&(i=this.getFolderConsolidatedConfiguration(r.uri)||i);const s=this._memoryConfigurationByResource.get(e);s&&(i=i.merge(s))}return i}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(e){let t=this._foldersConsolidatedConfigurations.get(e);if(!t){const i=this.getWorkspaceConsolidatedConfiguration(),r=this._folderConfigurations.get(e);r?(t=i.merge(r),this._foldersConsolidatedConfigurations.set(e,t)):t=i}return t}getFolderConfigurationModelForResource(e,t){if(t&&e){const i=t.getFolder(e);if(i)return this._folderConfigurations.get(i.uri)}}toData(){return{defaults:{contents:this._defaultConfiguration.contents,overrides:this._defaultConfiguration.overrides,keys:this._defaultConfiguration.keys},policy:{contents:this._policyConfiguration.contents,overrides:this._policyConfiguration.overrides,keys:this._policyConfiguration.keys},application:{contents:this.applicationConfiguration.contents,overrides:this.applicationConfiguration.overrides,keys:this.applicationConfiguration.keys},user:{contents:this.userConfiguration.contents,overrides:this.userConfiguration.overrides,keys:this.userConfiguration.keys},workspace:{contents:this._workspaceConfiguration.contents,overrides:this._workspaceConfiguration.overrides,keys:this._workspaceConfiguration.keys},folders:[...this._folderConfigurations.keys()].reduce((e,t)=>{const{contents:i,overrides:r,keys:s}=this._folderConfigurations.get(t);return e.push([t,{contents:i,overrides:r,keys:s}]),e},[])}}static parse(e,t){const i=this.parseConfigurationModel(e.defaults,t),r=this.parseConfigurationModel(e.policy,t),s=this.parseConfigurationModel(e.application,t),o=this.parseConfigurationModel(e.user,t),a=this.parseConfigurationModel(e.workspace,t),l=e.folders.reduce((c,u)=>(c.set(Pt.revive(u[0]),this.parseConfigurationModel(u[1],t)),c),new so);return new yW(i,r,s,o,Zo.createEmptyModel(t),a,l,Zo.createEmptyModel(t),new so,t)}static parseConfigurationModel(e,t){return new Zo(e.contents,e.keys,e.overrides,void 0,t)}}class Uxt{constructor(e,t,i,r,s){this.change=e,this.previous=t,this.currentConfiguraiton=i,this.currentWorkspace=r,this.logService=s,this._marker=` -`,this._markerCode1=this._marker.charCodeAt(0),this._markerCode2=46,this.affectedKeys=new Set,this._previousConfiguration=void 0;for(const o of e.keys)this.affectedKeys.add(o);for(const[,o]of e.overrides)for(const a of o)this.affectedKeys.add(a);this._affectsConfigStr=this._marker;for(const o of this.affectedKeys)this._affectsConfigStr+=o+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=yW.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(e,t){const i=this._marker+e,r=this._affectsConfigStr.indexOf(i);if(r<0)return!1;const s=r+i.length;if(s>=this._affectsConfigStr.length)return!1;const o=this._affectsConfigStr.charCodeAt(s);if(o!==this._markerCode1&&o!==this._markerCode2)return!1;if(t){const a=this.previousConfiguration?this.previousConfiguration.getValue(e,t,this.previous?.workspace):void 0,l=this.currentConfiguraiton.getValue(e,t,this.currentWorkspace);return!ru(a,l)}return!0}}class jxt{constructor(){this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._enabled=!0}get enabled(){return this._enabled}enable(){this._enabled=!0,this._onDidChange.fire()}disable(){this._enabled=!1,this._onDidChange.fire()}}const bI=new jxt,w8={kind:0},qxt={kind:1};function Kxt(n,e,t){return{kind:2,commandId:n,commandArgs:e,isBubble:t}}class yI{constructor(e,t,i){this._log=i,this._defaultKeybindings=e,this._defaultBoundCommands=new Map;for(const r of e){const s=r.command;s&&s.charAt(0)!=="-"&&this._defaultBoundCommands.set(s,!0)}this._map=new Map,this._lookupMap=new Map,this._keybindings=yI.handleRemovals([].concat(e).concat(t));for(let r=0,s=this._keybindings.length;r"u"){this._map.set(e,[t]),this._addToLookupMap(t);return}for(let r=i.length-1;r>=0;r--){const s=i[r];if(s.command===t.command)continue;let o=!0;for(let a=1;a"u"?(t=[e],this._lookupMap.set(e.command,t)):t.push(e)}_removeFromLookupMap(e){if(!e.command)return;const t=this._lookupMap.get(e.command);if(!(typeof t>"u")){for(let i=0,r=t.length;i"u"||i.length===0)return null;if(i.length===1)return i[0];for(let r=i.length-1;r>=0;r--){const s=i[r];if(t.contextMatchesRules(s.when))return s}return i[i.length-1]}resolve(e,t,i){const r=[...t,i];this._log(`| Resolving ${r}`);const s=this._map.get(r[0]);if(s===void 0)return this._log("\\ No keybinding entries."),w8;let o=null;if(r.length<2)o=s;else{o=[];for(let l=0,c=s.length;lu.chords.length)continue;let d=!0;for(let h=1;h=0;i--){const r=t[i];if(yI._contextMatchesRules(e,r.when))return r}return null}static _contextMatchesRules(e,t){return t?t.evaluate(e):!0}}function $1e(n){return n?`${n.serialize()}`:"no when condition"}function W1e(n){return n.extensionId?n.isBuiltinExtension?`built-in extension ${n.extensionId}`:`user extension ${n.extensionId}`:n.isDefault?"built-in":"user"}const Gxt=/^(cursor|delete|undo|redo|tab|editor\.action\.clipboard)/;class Yxt extends me{get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:Ge.None}get inChordMode(){return this._currentChords.length>0}constructor(e,t,i,r,s){super(),this._contextKeyService=e,this._commandService=t,this._telemetryService=i,this._notificationService=r,this._logService=s,this._onDidUpdateKeybindings=this._register(new fe),this._currentChords=[],this._currentChordChecker=new Mae,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=kS.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new hf,this._currentlyDispatchingCommandId=null,this._logging=!1}dispose(){super.dispose()}_log(e){this._logging&&this._logService.info(`[KeybindingService]: ${e}`)}getKeybindings(){return this._getResolver().getKeybindings()}lookupKeybinding(e,t){const i=this._getResolver().lookupPrimaryKeybinding(e,t||this._contextKeyService);if(i)return i.resolvedKeybinding}dispatchEvent(e,t){return this._dispatch(e,t)}softDispatch(e,t){this._log("/ Soft dispatching keyboard event");const i=this.resolveKeyboardEvent(e);if(i.hasMultipleChords())return console.warn("keyboard event should not be mapped to multiple chords"),w8;const[r]=i.getDispatchChords();if(r===null)return this._log("\\ Keyboard event cannot be dispatched"),w8;const s=this._contextKeyService.getContext(t),o=this._currentChords.map(({keypress:a})=>a);return this._getResolver().resolve(s,o,r)}_scheduleLeaveChordMode(){const e=Date.now();this._currentChordChecker.cancelAndSet(()=>{if(!this._documentHasFocus()){this._leaveChordMode();return}Date.now()-e>5e3&&this._leaveChordMode()},500)}_expectAnotherChord(e,t){switch(this._currentChords.push({keypress:e,label:t}),this._currentChords.length){case 0:throw bae("impossible");case 1:this._currentChordStatusMessage=this._notificationService.status(w("first.chord","({0}) was pressed. Waiting for second key of chord...",t));break;default:{const i=this._currentChords.map(({label:r})=>r).join(", ");this._currentChordStatusMessage=this._notificationService.status(w("next.chord","({0}) was pressed. Waiting for next key of chord...",i))}}this._scheduleLeaveChordMode(),bI.enabled&&bI.disable()}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.dispose(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChords=[],bI.enable()}_dispatch(e,t){return this._doDispatch(this.resolveKeyboardEvent(e),t,!1)}_singleModifierDispatch(e,t){const i=this.resolveKeyboardEvent(e),[r]=i.getSingleModifierDispatchChords();if(r)return this._ignoreSingleModifiers.has(r)?(this._log(`+ Ignoring single modifier ${r} due to it being pressed together with other keys.`),this._ignoreSingleModifiers=kS.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=kS.EMPTY,this._currentSingleModifier===null?(this._log(`+ Storing single modifier for possible chord ${r}.`),this._currentSingleModifier=r,this._currentSingleModifierClearTimeout.cancelAndSet(()=>{this._log("+ Clearing single modifier due to 300ms elapsed."),this._currentSingleModifier=null},300),!1):r===this._currentSingleModifier?(this._log(`/ Dispatching single modifier chord ${r} ${r}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,this._doDispatch(i,t,!0)):(this._log(`+ Clearing single modifier due to modifier mismatch: ${this._currentSingleModifier} ${r}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1));const[s]=i.getChords();return this._ignoreSingleModifiers=new kS(s),this._currentSingleModifier!==null&&this._log("+ Clearing single modifier due to other key up."),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1}_doDispatch(e,t,i=!1){let r=!1;if(e.hasMultipleChords())return console.warn("Unexpected keyboard event mapped to multiple chords"),!1;let s=null,o=null;if(i){const[u]=e.getSingleModifierDispatchChords();s=u,o=u?[u]:[]}else[s]=e.getDispatchChords(),o=this._currentChords.map(({keypress:u})=>u);if(s===null)return this._log("\\ Keyboard event cannot be dispatched in keydown phase."),r;const a=this._contextKeyService.getContext(t),l=e.getLabel(),c=this._getResolver().resolve(a,o,s);switch(c.kind){case 0:{if(this._logService.trace("KeybindingService#dispatch",l,"[ No matching keybinding ]"),this.inChordMode){const u=this._currentChords.map(({label:d})=>d).join(", ");this._log(`+ Leaving multi-chord mode: Nothing bound to "${u}, ${l}".`),this._notificationService.status(w("missing.chord","The key combination ({0}, {1}) is not a command.",u,l),{hideAfter:10*1e3}),this._leaveChordMode(),r=!0}return r}case 1:return this._logService.trace("KeybindingService#dispatch",l,"[ Several keybindings match - more chords needed ]"),r=!0,this._expectAnotherChord(s,l),this._log(this._currentChords.length===1?"+ Entering multi-chord mode...":"+ Continuing multi-chord mode..."),r;case 2:{if(this._logService.trace("KeybindingService#dispatch",l,`[ Will dispatch command ${c.commandId} ]`),c.commandId===null||c.commandId===""){if(this.inChordMode){const u=this._currentChords.map(({label:d})=>d).join(", ");this._log(`+ Leaving chord mode: Nothing bound to "${u}, ${l}".`),this._notificationService.status(w("missing.chord","The key combination ({0}, {1}) is not a command.",u,l),{hideAfter:10*1e3}),this._leaveChordMode(),r=!0}}else{this.inChordMode&&this._leaveChordMode(),c.isBubble||(r=!0),this._log(`+ Invoking command ${c.commandId}.`),this._currentlyDispatchingCommandId=c.commandId;try{typeof c.commandArgs>"u"?this._commandService.executeCommand(c.commandId).then(void 0,u=>this._notificationService.warn(u)):this._commandService.executeCommand(c.commandId,c.commandArgs).then(void 0,u=>this._notificationService.warn(u))}finally{this._currentlyDispatchingCommandId=null}Gxt.test(c.commandId)||this._telemetryService.publicLog2("workbenchActionExecuted",{id:c.commandId,from:"keybinding",detail:e.getUserSettingsLabel()??void 0})}return r}}}mightProducePrintableCharacter(e){return e.ctrlKey||e.metaKey?!1:e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30}}class kS{static{this.EMPTY=new kS(null)}constructor(e){this._ctrlKey=e?e.ctrlKey:!1,this._shiftKey=e?e.shiftKey:!1,this._altKey=e?e.altKey:!1,this._metaKey=e?e.metaKey:!1}has(e){switch(e){case"ctrl":return this._ctrlKey;case"shift":return this._shiftKey;case"alt":return this._altKey;case"meta":return this._metaKey}}}class H1e{constructor(e,t,i,r,s,o,a){this._resolvedKeybindingItemBrand=void 0,this.resolvedKeybinding=e,this.chords=e?dQ(e.getDispatchChords()):[],e&&this.chords.length===0&&(this.chords=dQ(e.getSingleModifierDispatchChords())),this.bubble=t?t.charCodeAt(0)===94:!1,this.command=this.bubble?t.substr(1):t,this.commandArgs=i,this.when=r,this.isDefault=s,this.extensionId=o,this.isBuiltinExtension=a}}function dQ(n){const e=[];for(let t=0,i=n.length;tthis._getLabel(e))}getAriaLabel(){return Zxt.toLabel(this._os,this._chords,e=>this._getAriaLabel(e))}getElectronAccelerator(){return this._chords.length>1||this._chords[0].isDuplicateModifierCase()?null:Xxt.toLabel(this._os,this._chords,e=>this._getElectronAccelerator(e))}getUserSettingsLabel(){return Qxt.toLabel(this._os,this._chords,e=>this._getUserSettingsLabel(e))}hasMultipleChords(){return this._chords.length>1}getChords(){return this._chords.map(e=>this._getChord(e))}_getChord(e){return new S_t(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,this._getLabel(e),this._getAriaLabel(e))}getDispatchChords(){return this._chords.map(e=>this._getChordDispatch(e))}getSingleModifierDispatchChords(){return this._chords.map(e=>this._getSingleModifierChordDispatch(e))}}class EN extends eSt{constructor(e,t){super(t,e)}_keyCodeToUILabel(e){if(this._os===2)switch(e){case 15:return"←";case 16:return"↑";case 17:return"→";case 18:return"↓"}return r_.toString(e)}_getLabel(e){return e.isDuplicateModifierCase()?"":this._keyCodeToUILabel(e.keyCode)}_getAriaLabel(e){return e.isDuplicateModifierCase()?"":r_.toString(e.keyCode)}_getElectronAccelerator(e){return r_.toElectronAccelerator(e.keyCode)}_getUserSettingsLabel(e){if(e.isDuplicateModifierCase())return"";const t=r_.toUserSettingsUS(e.keyCode);return t&&t.toLowerCase()}_getChordDispatch(e){return EN.getDispatchStr(e)}static getDispatchStr(e){if(e.isModifierKey())return null;let t="";return e.ctrlKey&&(t+="ctrl+"),e.shiftKey&&(t+="shift+"),e.altKey&&(t+="alt+"),e.metaKey&&(t+="meta+"),t+=r_.toString(e.keyCode),t}_getSingleModifierChordDispatch(e){return e.keyCode===5&&!e.shiftKey&&!e.altKey&&!e.metaKey?"ctrl":e.keyCode===4&&!e.ctrlKey&&!e.altKey&&!e.metaKey?"shift":e.keyCode===6&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey?"alt":e.keyCode===57&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?"meta":null}static _scanCodeToKeyCode(e){const t=Sae[e];if(t!==-1)return t;switch(e){case 10:return 31;case 11:return 32;case 12:return 33;case 13:return 34;case 14:return 35;case 15:return 36;case 16:return 37;case 17:return 38;case 18:return 39;case 19:return 40;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 45;case 25:return 46;case 26:return 47;case 27:return 48;case 28:return 49;case 29:return 50;case 30:return 51;case 31:return 52;case 32:return 53;case 33:return 54;case 34:return 55;case 35:return 56;case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 21;case 51:return 88;case 52:return 86;case 53:return 92;case 54:return 94;case 55:return 93;case 56:return 0;case 57:return 85;case 58:return 95;case 59:return 91;case 60:return 87;case 61:return 89;case 62:return 90;case 106:return 97}return 0}static _toKeyCodeChord(e){if(!e)return null;if(e instanceof G_)return e;const t=this._scanCodeToKeyCode(e.scanCode);return t===0?null:new G_(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t)}static resolveKeybinding(e,t){const i=dQ(e.chords.map(r=>this._toKeyCodeChord(r)));return i.length>0?[new EN(i,t)]:[]}}const pE=On("labelService"),t5e=On("progressService");let p_=class{static{this.None=Object.freeze({report(){}})}constructor(e){this.callback=e}report(e){this._value=e,this.callback(this._value)}};const Qb=On("editorProgressService");class tSt{constructor(){this._value="",this._pos=0}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos=0;t--,this._valueLen--){const i=this._value.charCodeAt(t);if(!(i===47||this._splitOnBackslash&&i===92))break}return this.next()}hasNext(){return this._to!1,t=()=>!1){return new fk(new rSt(e,t))}static forStrings(){return new fk(new tSt)}static forConfigKeys(){return new fk(new nSt)}constructor(e){this._iter=e}clear(){this._root=void 0}set(e,t){const i=this._iter.reset(e);let r;this._root||(this._root=new F4,this._root.segment=i.value());const s=[];for(r=this._root;;){const a=i.cmp(r.segment);if(a>0)r.left||(r.left=new F4,r.left.segment=i.value()),s.push([-1,r]),r=r.left;else if(a<0)r.right||(r.right=new F4,r.right.segment=i.value()),s.push([1,r]),r=r.right;else if(i.hasNext())i.next(),r.mid||(r.mid=new F4,r.mid.segment=i.value()),s.push([0,r]),r=r.mid;else break}const o=r.value;r.value=t,r.key=e;for(let a=s.length-1;a>=0;a--){const l=s[a][1];l.updateHeight();const c=l.balanceFactor();if(c<-1||c>1){const u=s[a][0],d=s[a+1][0];if(u===1&&d===1)s[a][1]=l.rotateLeft();else if(u===-1&&d===-1)s[a][1]=l.rotateRight();else if(u===1&&d===-1)l.right=s[a+1][1]=s[a+1][1].rotateRight(),s[a][1]=l.rotateLeft();else if(u===-1&&d===1)l.left=s[a+1][1]=s[a+1][1].rotateLeft(),s[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(s[a-1][0]){case-1:s[a-1][1].left=s[a][1];break;case 1:s[a-1][1].right=s[a][1];break;case 0:s[a-1][1].mid=s[a][1];break}else this._root=s[0][1]}}return o}get(e){return this._getNode(e)?.value}_getNode(e){const t=this._iter.reset(e);let i=this._root;for(;i;){const r=t.cmp(i.segment);if(r>0)i=i.left;else if(r<0)i=i.right;else if(t.hasNext())t.next(),i=i.mid;else break}return i}has(e){const t=this._getNode(e);return!(t?.value===void 0&&t?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){const i=this._iter.reset(e),r=[];let s=this._root;for(;s;){const o=i.cmp(s.segment);if(o>0)r.push([-1,s]),s=s.left;else if(o<0)r.push([1,s]),s=s.right;else if(i.hasNext())i.next(),r.push([0,s]),s=s.mid;else break}if(s){if(t?(s.left=void 0,s.mid=void 0,s.right=void 0,s.height=1):(s.key=void 0,s.value=void 0),!s.mid&&!s.value)if(s.left&&s.right){const o=this._min(s.right);if(o.key){const{key:a,value:l,segment:c}=o;this._delete(o.key,!1),s.key=a,s.value=l,s.segment=c}}else{const o=s.left??s.right;if(r.length>0){const[a,l]=r[r.length-1];switch(a){case-1:l.left=o;break;case 0:l.mid=o;break;case 1:l.right=o;break}}else this._root=o}for(let o=r.length-1;o>=0;o--){const a=r[o][1];a.updateHeight();const l=a.balanceFactor();if(l>1?(a.right.balanceFactor()>=0||(a.right=a.right.rotateRight()),r[o][1]=a.rotateLeft()):l<-1&&(a.left.balanceFactor()<=0||(a.left=a.left.rotateLeft()),r[o][1]=a.rotateRight()),o>0)switch(r[o-1][0]){case-1:r[o-1][1].left=r[o][1];break;case 1:r[o-1][1].right=r[o][1];break;case 0:r[o-1][1].mid=r[o][1];break}else this._root=r[0][1]}}}_min(e){for(;e.left;)e=e.left;return e}findSubstr(e){const t=this._iter.reset(e);let i=this._root,r;for(;i;){const s=t.cmp(i.segment);if(s>0)i=i.left;else if(s<0)i=i.right;else if(t.hasNext())t.next(),r=i.value||r,i=i.mid;else break}return i&&i.value||r}findSuperstr(e){return this._findSuperstrOrElement(e,!1)}_findSuperstrOrElement(e,t){const i=this._iter.reset(e);let r=this._root;for(;r;){const s=i.cmp(r.segment);if(s>0)r=r.left;else if(s<0)r=r.right;else if(i.hasNext())i.next(),r=r.mid;else return r.mid?this._entries(r.mid):t?r.value:void 0}}forEach(e){for(const[t,i]of this)e(i,t)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(e){const t=[];return this._dfsEntries(e,t),t[Symbol.iterator]()}_dfsEntries(e,t){e&&(e.left&&this._dfsEntries(e.left,t),e.value&&t.push([e.key,e.value]),e.mid&&this._dfsEntries(e.mid,t),e.right&&this._dfsEntries(e.right,t))}}const Mw=On("contextService");function hQ(n){const e=n;return typeof e?.id=="string"&&Pt.isUri(e.uri)}function sSt(n){return typeof n?.id=="string"&&!hQ(n)&&!lSt(n)}const oSt={id:"empty-window"};function aSt(n,e){if(typeof n=="string"||typeof n>"u")return typeof n=="string"?{id:rb(n)}:oSt;const t=n;return t.configuration?{id:t.id,configPath:t.configuration}:t.folders.length===1?{id:t.id,uri:t.folders[0].uri}:{id:t.id}}function lSt(n){const e=n;return typeof e?.id=="string"&&Pt.isUri(e.configPath)}let cSt=class{constructor(e,t){this.raw=t,this.uri=e.uri,this.index=e.index,this.name=e.name}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}};const fQ="code-workspace";w("codeWorkspace","Code Workspace");const n5e="4064f6ec-cb38-4ad0-af64-ee6467e63c82";function uSt(n){return n.id===n5e}var gQ;(function(n){n.inspectTokensAction=w("inspectTokens","Developer: Inspect Tokens")})(gQ||(gQ={}));var C8;(function(n){n.gotoLineActionLabel=w("gotoLineActionLabel","Go to Line/Column...")})(C8||(C8={}));var pQ;(function(n){n.helpQuickAccessActionLabel=w("helpQuickAccess","Show all Quick Access Providers")})(pQ||(pQ={}));var x8;(function(n){n.quickCommandActionLabel=w("quickCommandActionLabel","Command Palette"),n.quickCommandHelp=w("quickCommandActionHelp","Show And Run Commands")})(x8||(x8={}));var LN;(function(n){n.quickOutlineActionLabel=w("quickOutlineActionLabel","Go to Symbol..."),n.quickOutlineByCategoryActionLabel=w("quickOutlineByCategoryActionLabel","Go to Symbol by Category...")})(LN||(LN={}));var mQ;(function(n){n.editorViewAccessibleLabel=w("editorViewAccessibleLabel","Editor content")})(mQ||(mQ={}));var _Q;(function(n){n.toggleHighContrast=w("toggleHighContrast","Toggle High Contrast Theme")})(_Q||(_Q={}));var vQ;(function(n){n.bulkEditServiceSummary=w("bulkEditServiceSummary","Made {0} edits in {1} files")})(vQ||(vQ={}));const i5e=On("workspaceTrustManagementService");let mE=[],Mle=[],r5e=[];function B4(n,e=!1){dSt(n,!1,e)}function dSt(n,e,t){const i=hSt(n,e);mE.push(i),i.userConfigured?r5e.push(i):Mle.push(i),t&&!i.userConfigured&&mE.forEach(r=>{r.mime===i.mime||r.userConfigured||(i.extension&&r.extension===i.extension&&console.warn(`Overwriting extension <<${i.extension}>> to now point to mime <<${i.mime}>>`),i.filename&&r.filename===i.filename&&console.warn(`Overwriting filename <<${i.filename}>> to now point to mime <<${i.mime}>>`),i.filepattern&&r.filepattern===i.filepattern&&console.warn(`Overwriting filepattern <<${i.filepattern}>> to now point to mime <<${i.mime}>>`),i.firstline&&r.firstline===i.firstline&&console.warn(`Overwriting firstline <<${i.firstline}>> to now point to mime <<${i.mime}>>`))})}function hSt(n,e){return{id:n.id,mime:n.mime,filename:n.filename,extension:n.extension,filepattern:n.filepattern,firstline:n.firstline,userConfigured:e,filenameLowercase:n.filename?n.filename.toLowerCase():void 0,extensionLowercase:n.extension?n.extension.toLowerCase():void 0,filepatternLowercase:n.filepattern?hFe(n.filepattern.toLowerCase()):void 0,filepatternOnPath:n.filepattern?n.filepattern.indexOf(Ms.sep)>=0:!1}}function fSt(){mE=mE.filter(n=>n.userConfigured),Mle=[]}function gSt(n,e){return pSt(n,e).map(t=>t.id)}function pSt(n,e){let t;if(n)switch(n.scheme){case sn.file:t=n.fsPath;break;case sn.data:{t=Tb.parseMetaData(n).get(Tb.META_DATA_LABEL);break}case sn.vscodeNotebookCell:t=void 0;break;default:t=n.path}if(!t)return[{id:"unknown",mime:ps.unknown}];t=t.toLowerCase();const i=rb(t),r=V1e(t,i,r5e);if(r)return[r,{id:Hl,mime:ps.text}];const s=V1e(t,i,Mle);if(s)return[s,{id:Hl,mime:ps.text}];if(e){const o=mSt(e);if(o)return[o,{id:Hl,mime:ps.text}]}return[{id:"unknown",mime:ps.unknown}]}function V1e(n,e,t){let i,r,s;for(let o=t.length-1;o>=0;o--){const a=t[o];if(e===a.filenameLowercase){i=a;break}if(a.filepattern&&(!r||a.filepattern.length>r.filepattern.length)){const l=a.filepatternOnPath?n:e;a.filepatternLowercase?.(l)&&(r=a)}a.extension&&(!s||a.extension.length>s.extension.length)&&e.endsWith(a.extensionLowercase)&&(s=a)}if(i)return i;if(r)return r;if(s)return s}function mSt(n){if(Nae(n)&&(n=n.substr(1)),n.length>0)for(let e=mE.length-1;e>=0;e--){const t=mE[e];if(!t.firstline)continue;const i=n.match(t.firstline);if(i&&i.length>0)return t}}const $4=Object.prototype.hasOwnProperty,z1e="vs.editor.nullLanguage";class _St{constructor(){this._languageIdToLanguage=[],this._languageToLanguageId=new Map,this._register(z1e,0),this._register(Hl,1),this._nextLanguageId=2}_register(e,t){this._languageIdToLanguage[t]=e,this._languageToLanguageId.set(e,t)}register(e){if(this._languageToLanguageId.has(e))return;const t=this._nextLanguageId++;this._register(e,t)}encodeLanguageId(e){return this._languageToLanguageId.get(e)||0}decodeLanguageId(e){return this._languageIdToLanguage[e]||z1e}}class S8 extends me{static{this.instanceCount=0}constructor(e=!0,t=!1){super(),this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,S8.instanceCount++,this._warnOnOverwrite=t,this.languageIdCodec=new _St,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(sE.onDidChangeLanguages(i=>{this._initializeFromRegistry()})))}dispose(){S8.instanceCount--,super.dispose()}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},fSt();const e=[].concat(sE.getLanguages()).concat(this._dynamicLanguages);this._registerLanguages(e)}_registerLanguages(e){for(const t of e)this._registerLanguage(t);this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Object.keys(this._languages).forEach(t=>{const i=this._languages[t];i.name&&(this._nameMap[i.name]=i.identifier),i.aliases.forEach(r=>{this._lowercaseNameMap[r.toLowerCase()]=i.identifier}),i.mimetypes.forEach(r=>{this._mimeTypesMap[r]=i.identifier})}),Yr.as(ff.Configuration).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){const t=e.id;let i;$4.call(this._languages,t)?i=this._languages[t]:(this.languageIdCodec.register(t),i={identifier:t,name:null,mimetypes:[],aliases:[],extensions:[],filenames:[],configurationFiles:[],icons:[]},this._languages[t]=i),this._mergeLanguage(i,e)}_mergeLanguage(e,t){const i=t.id;let r=null;if(Array.isArray(t.mimetypes)&&t.mimetypes.length>0&&(e.mimetypes.push(...t.mimetypes),r=t.mimetypes[0]),r||(r=`text/x-${i}`,e.mimetypes.push(r)),Array.isArray(t.extensions)){t.configuration?e.extensions=t.extensions.concat(e.extensions):e.extensions=e.extensions.concat(t.extensions);for(const a of t.extensions)B4({id:i,mime:r,extension:a},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(const a of t.filenames)B4({id:i,mime:r,filename:a},this._warnOnOverwrite),e.filenames.push(a);if(Array.isArray(t.filenamePatterns))for(const a of t.filenamePatterns)B4({id:i,mime:r,filepattern:a},this._warnOnOverwrite);if(typeof t.firstLine=="string"&&t.firstLine.length>0){let a=t.firstLine;a.charAt(0)!=="^"&&(a="^"+a);try{const l=new RegExp(a);u_t(l)||B4({id:i,mime:r,firstline:l},this._warnOnOverwrite)}catch(l){console.warn(`[${t.id}]: Invalid regular expression \`${a}\`: `,l)}}e.aliases.push(i);let s=null;if(typeof t.aliases<"u"&&Array.isArray(t.aliases)&&(t.aliases.length===0?s=[null]:s=t.aliases),s!==null)for(const a of s)!a||a.length===0||e.aliases.push(a);const o=s!==null&&s.length>0;if(!(o&&s[0]===null)){const a=(o?s[0]:null)||i;(o||!e.name)&&(e.name=a)}t.configuration&&e.configurationFiles.push(t.configuration),t.icon&&e.icons.push(t.icon)}isRegisteredLanguageId(e){return e?$4.call(this._languages,e):!1}getRegisteredLanguageIds(){return Object.keys(this._languages)}getLanguageIdByLanguageName(e){const t=e.toLowerCase();return $4.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&$4.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){return!e&&!t?[]:gSt(e,t)}}const rd=(n,e)=>n===e;function k8(n=rd){return(e,t)=>$r(e,t,n)}function vSt(){return(n,e)=>n.equals(e)}function bQ(n,e,t){if(t!==void 0){const i=n;return i==null||e===void 0||e===null?e===i:t(i,e)}else{const i=n;return(r,s)=>r==null||s===void 0||s===null?s===r:i(r,s)}}function E8(n,e){if(n===e)return!0;if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return!1;for(let t=0;t{const s=Fle(r);if(s!==void 0)return s;const a=/^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(r.toString());if(a)return`${this.debugName}.${a[2]}`;if(!i)return`${this.debugName} (mapped)`},debugReferenceFn:r},s=>r(this.read(s),s))}flatten(){return wQ({owner:void 0,debugName:()=>`${this.debugName} (flattened)`},e=>this.read(e).read(e))}recomputeInitiallyAndOnChange(e,t){return e.add(o5e(this,t)),this}keepObserved(e){return e.add(a5e(this)),this}}class n2 extends l5e{constructor(){super(...arguments),this.observers=new Set}addObserver(e){const t=this.observers.size;this.observers.add(e),t===0&&this.onFirstObserverAdded()}removeObserver(e){this.observers.delete(e)&&this.observers.size===0&&this.onLastObserverRemoved()}onFirstObserverAdded(){}onLastObserverRemoved(){}}function qr(n,e){const t=new i2(n,e);try{n(t)}finally{t.finish()}}let W4;function ID(n){if(W4)n(W4);else{const e=new i2(n,void 0);W4=e;try{n(e)}finally{e.finish(),W4=void 0}}}async function c5e(n,e){const t=new i2(n,e);try{await n(t)}finally{t.finish()}}function Fw(n,e,t){n?e(n):qr(e,t)}class i2{constructor(e,t){this._fn=e,this._getDebugName=t,this.updatingObservers=[]}getDebugName(){return this._getDebugName?this._getDebugName():Fle(this._fn)}updateObserver(e,t){this.updatingObservers.push({observer:e,observable:t}),e.beginUpdate(t)}finish(){const e=this.updatingObservers;for(let t=0;t{},()=>`Setting ${this.debugName}`));try{const s=this._value;this._setValue(e),s5e()?.handleObservableChanged(this,{oldValue:s,newValue:e,change:i,didChange:!0,hadValue:!0});for(const o of this.observers)t.updateObserver(o,this),o.handleChange(this,i)}finally{r&&r.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}}function TN(n,e){let t;return typeof n=="string"?t=new Za(void 0,n,void 0):t=new Za(n,void 0,void 0),new TSt(t,e,rd)}class TSt extends Ble{_setValue(e){this._value!==e&&(this._value&&this._value.dispose(),this._value=e)}dispose(){this._value?.dispose()}}function St(n,e){return e!==void 0?new Bw(new Za(n,void 0,e),e,void 0,void 0,void 0,rd):new Bw(new Za(void 0,void 0,n),n,void 0,void 0,void 0,rd)}function oO(n,e,t){return new DSt(new Za(n,void 0,e),e,void 0,void 0,void 0,rd,t)}function $u(n,e){return new Bw(new Za(n.owner,n.debugName,n.debugReferenceFn),e,void 0,void 0,n.onLastObserverRemoved,n.equalsFn??rd)}LSt($u);function u5e(n,e){return new Bw(new Za(n.owner,n.debugName,void 0),e,n.createEmptyChangeSummary,n.handleChange,void 0,n.equalityComparer??rd)}function Jb(n,e){let t,i;e===void 0?(t=n,i=void 0):(i=n,t=e);const r=new ke;return new Bw(new Za(i,void 0,t),s=>(r.clear(),t(s,r)),void 0,void 0,()=>r.dispose(),rd)}function hl(n,e){let t,i;e===void 0?(t=n,i=void 0):(i=n,t=e);let r;return new Bw(new Za(i,void 0,t),s=>{r?r.clear():r=new ke;const o=t(s);return o&&r.add(o),o},void 0,void 0,()=>{r&&(r.dispose(),r=void 0)},rd)}class Bw extends n2{get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}constructor(e,t,i,r,s=void 0,o){super(),this._debugNameData=e,this._computeFn=t,this.createChangeSummary=i,this._handleChange=r,this._handleLastObserverRemoved=s,this._equalityComparator=o,this.state=0,this.value=void 0,this.updateCount=0,this.dependencies=new Set,this.dependenciesToBeRemoved=new Set,this.changeSummary=void 0,this.changeSummary=this.createChangeSummary?.()}onLastObserverRemoved(){this.state=0,this.value=void 0;for(const e of this.dependencies)e.removeObserver(this);this.dependencies.clear(),this._handleLastObserverRemoved?.()}get(){if(this.observers.size===0){const e=this._computeFn(this,this.createChangeSummary?.());return this.onLastObserverRemoved(),e}else{do{if(this.state===1){for(const e of this.dependencies)if(e.reportChanges(),this.state===2)break}this.state===1&&(this.state=3),this._recomputeIfNeeded()}while(this.state!==3);return this.value}}_recomputeIfNeeded(){if(this.state===3)return;const e=this.dependenciesToBeRemoved;this.dependenciesToBeRemoved=this.dependencies,this.dependencies=e;const t=this.state!==0,i=this.value;this.state=3;const r=this.changeSummary;this.changeSummary=this.createChangeSummary?.();try{this.value=this._computeFn(this,r)}finally{for(const o of this.dependenciesToBeRemoved)o.removeObserver(this);this.dependenciesToBeRemoved.clear()}if(t&&!this._equalityComparator(i,this.value))for(const o of this.observers)o.handleChange(this,void 0)}toString(){return`LazyDerived<${this.debugName}>`}beginUpdate(e){this.updateCount++;const t=this.updateCount===1;if(this.state===3&&(this.state=1,!t))for(const i of this.observers)i.handlePossibleChange(this);if(t)for(const i of this.observers)i.beginUpdate(this)}endUpdate(e){if(this.updateCount--,this.updateCount===0){const t=[...this.observers];for(const i of t)i.endUpdate(this)}Nw(()=>this.updateCount>=0)}handlePossibleChange(e){if(this.state===3&&this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)){this.state=1;for(const t of this.observers)t.handlePossibleChange(this)}}handleChange(e,t){if(this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)){const i=this._handleChange?this._handleChange({changedObservable:e,change:t,didChange:s=>s===e},this.changeSummary):!0,r=this.state===3;if(i&&(this.state===1||r)&&(this.state=2,r))for(const s of this.observers)s.handlePossibleChange(this)}}readObservable(e){e.addObserver(this);const t=e.get();return this.dependencies.add(e),this.dependenciesToBeRemoved.delete(e),t}addObserver(e){const t=!this.observers.has(e)&&this.updateCount>0;super.addObserver(e),t&&e.beginUpdate(this)}removeObserver(e){const t=this.observers.has(e)&&this.updateCount>0;super.removeObserver(e),t&&e.endUpdate(this)}}class DSt extends Bw{constructor(e,t,i,r,s=void 0,o,a){super(e,t,i,r,s,o),this.set=a}}function tn(n){return new CW(new Za(void 0,void 0,n),n,void 0,void 0)}function aO(n,e){return new CW(new Za(n.owner,n.debugName,n.debugReferenceFn??e),e,void 0,void 0)}function lO(n,e){return new CW(new Za(n.owner,n.debugName,n.debugReferenceFn??e),e,n.createEmptyChangeSummary,n.handleChange)}function ISt(n,e){const t=new ke,i=lO({owner:n.owner,debugName:n.debugName,debugReferenceFn:n.debugReferenceFn??e,createEmptyChangeSummary:n.createEmptyChangeSummary,handleChange:n.handleChange},(r,s)=>{t.clear(),e(r,s,t)});return Lt(()=>{i.dispose(),t.dispose()})}function wc(n){const e=new ke,t=aO({owner:void 0,debugName:void 0,debugReferenceFn:n},i=>{e.clear(),n(i,e)});return Lt(()=>{t.dispose(),e.dispose()})}class CW{get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}constructor(e,t,i,r){this._debugNameData=e,this._runFn=t,this.createChangeSummary=i,this._handleChange=r,this.state=2,this.updateCount=0,this.disposed=!1,this.dependencies=new Set,this.dependenciesToBeRemoved=new Set,this.changeSummary=this.createChangeSummary?.(),this._runIfNeeded()}dispose(){this.disposed=!0;for(const e of this.dependencies)e.removeObserver(this);this.dependencies.clear()}_runIfNeeded(){if(this.state===3)return;const e=this.dependenciesToBeRemoved;this.dependenciesToBeRemoved=this.dependencies,this.dependencies=e,this.state=3;const t=this.disposed;try{if(!t){s5e()?.handleAutorunTriggered(this);const i=this.changeSummary;this.changeSummary=this.createChangeSummary?.(),this._runFn(this,i)}}finally{for(const i of this.dependenciesToBeRemoved)i.removeObserver(this);this.dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(){this.state===3&&(this.state=1),this.updateCount++}endUpdate(){if(this.updateCount===1)do{if(this.state===1){this.state=3;for(const e of this.dependencies)if(e.reportChanges(),this.state===2)break}this._runIfNeeded()}while(this.state!==3);this.updateCount--,Nw(()=>this.updateCount>=0)}handlePossibleChange(e){this.state===3&&this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)&&(this.state=1)}handleChange(e,t){this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)&&(!this._handleChange||this._handleChange({changedObservable:e,change:t,didChange:r=>r===e},this.changeSummary))&&(this.state=2)}readObservable(e){if(this.disposed)return e.get();e.addObserver(this);const t=e.get();return this.dependencies.add(e),this.dependenciesToBeRemoved.delete(e),t}}(function(n){n.Observer=CW})(tn);function Hd(n){return new ASt(n)}class ASt extends l5e{constructor(e){super(),this.value=e}get debugName(){return this.toString()}get(){return this.value}addObserver(e){}removeObserver(e){}toString(){return`Const: ${this.value}`}}function Bi(...n){let e,t,i;return n.length===3?[e,t,i]=n:[t,i]=n,new Pv(new Za(e,void 0,i),t,i,()=>Pv.globalTransaction,rd)}function NSt(n,e,t){return new Pv(new Za(n.owner,n.debugName,n.debugReferenceFn??t),e,t,()=>Pv.globalTransaction,n.equalsFn??rd)}class Pv extends n2{constructor(e,t,i,r,s){super(),this._debugNameData=e,this.event=t,this._getValue=i,this._getTransaction=r,this._equalityComparator=s,this.hasValue=!1,this.handleEvent=o=>{const a=this._getValue(o),l=this.value;(!this.hasValue||!this._equalityComparator(l,a))&&(this.value=a,this.hasValue&&Fw(this._getTransaction(),u=>{for(const d of this.observers)u.updateObserver(d,this),d.handleChange(this,void 0)},()=>{const u=this.getDebugName();return"Event fired"+(u?`: ${u}`:"")}),this.hasValue=!0)}}getDebugName(){return this._debugNameData.getDebugName(this)}get debugName(){const e=this.getDebugName();return"From Event"+(e?`: ${e}`:"")}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0,this.hasValue=!1,this.value=void 0}get(){return this.subscription?(this.hasValue||this.handleEvent(void 0),this.value):this._getValue(void 0)}}(function(n){n.Observer=Pv;function e(t,i){let r=!1;Pv.globalTransaction===void 0&&(Pv.globalTransaction=t,r=!0);try{i()}finally{r&&(Pv.globalTransaction=void 0)}}n.batchEventsGlobally=e})(Bi);function xa(n,e){return new RSt(n,e)}class RSt extends n2{constructor(e,t){super(),this.debugName=e,this.event=t,this.handleEvent=()=>{qr(i=>{for(const r of this.observers)i.updateObserver(r,this),r.handleChange(this,void 0)},()=>this.debugName)}}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0}get(){}}function r2(n){return typeof n=="string"?new K1e(n):new K1e(void 0,n)}class K1e extends n2{get debugName(){return new Za(this._owner,this._debugName,void 0).getDebugName(this)??"Observable Signal"}toString(){return this.debugName}constructor(e,t){super(),this._debugName=e,this._owner=t}trigger(e,t){if(!e){qr(i=>{this.trigger(i,t)},()=>`Trigger signal ${this.debugName}`);return}for(const i of this.observers)e.updateObserver(i,this),i.handleChange(this,t)}get(){}}function PSt(n){const e=new d5e(!1,void 0);return n.addObserver(e),Lt(()=>{n.removeObserver(e)})}ESt(PSt);function s2(n,e){const t=new d5e(!0,e);return n.addObserver(t),e?e(n.get()):n.reportChanges(),Lt(()=>{n.removeObserver(t)})}kSt(s2);class d5e{constructor(e,t){this._forceRecompute=e,this._handleValue=t,this._counter=0}beginUpdate(e){this._counter++}endUpdate(e){this._counter--,this._counter===0&&this._forceRecompute&&(this._handleValue?this._handleValue(e.get()):e.reportChanges())}handlePossibleChange(e){}handleChange(e,t){}}function cO(n,e){let t;return $u({owner:n,debugReferenceFn:e},r=>(t=e(r,t),t))}function OSt(n,e,t,i){let r=new G1e(t,i);return $u({debugReferenceFn:t,owner:n,onLastObserverRemoved:()=>{r.dispose(),r=new G1e(t)}},o=>(r.setItems(e.read(o)),r.getItems()))}class G1e{constructor(e,t){this._map=e,this._keySelector=t,this._cache=new Map,this._items=[]}dispose(){this._cache.forEach(e=>e.store.dispose()),this._cache.clear()}setItems(e){const t=[],i=new Set(this._cache.keys());for(const r of e){const s=this._keySelector?this._keySelector(r):r;let o=this._cache.get(s);if(o)i.delete(s);else{const a=new ke;o={out:this._map(r,a),store:a},this._cache.set(s,o)}t.push(o.out)}for(const r of i)this._cache.get(r).store.dispose(),this._cache.delete(r);this._items=t}getItems(){return this._items}}function MSt(n,e){return cO(n,(t,i)=>i??e(t))}class xW{static fromFn(e){return new xW(e())}constructor(e){this._value=Sn(this,void 0),this.promiseResult=this._value,this.promise=e.then(t=>(qr(i=>{this._value.set(new Y1e(t,void 0),i)}),t),t=>{throw qr(i=>{this._value.set(new Y1e(void 0,t),i)}),t})}}class Y1e{constructor(e,t){this.data=e,this.error=t}}function h5e(n,e,t,i){return e||(e=r=>r!=null),new Promise((r,s)=>{let o=!0,a=!1;const l=n.map(u=>({isFinished:e(u),error:t?t(u):!1,state:u})),c=tn(u=>{const{isFinished:d,error:h,state:f}=l.read(u);(d||h)&&(o?a=!0:c.dispose(),h?s(h===!0?f:h):r(f))});if(i){const u=i.onCancellationRequested(()=>{c.dispose(),u.dispose(),s(new sf)});if(i.isCancellationRequested){c.dispose(),u.dispose(),s(new sf);return}}o=!1,a&&c.dispose()})}class FSt extends n2{get debugName(){return this._debugNameData.getDebugName(this)??"LazyObservableValue"}constructor(e,t,i){super(),this._debugNameData=e,this._equalityComparator=i,this._isUpToDate=!0,this._deltas=[],this._updateCounter=0,this._value=t}get(){return this._update(),this._value}_update(){if(!this._isUpToDate)if(this._isUpToDate=!0,this._deltas.length>0){for(const e of this.observers)for(const t of this._deltas)e.handleChange(this,t);this._deltas.length=0}else for(const e of this.observers)e.handleChange(this,void 0)}_beginUpdate(){if(this._updateCounter++,this._updateCounter===1)for(const e of this.observers)e.beginUpdate(this)}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){this._update();const e=[...this.observers];for(const t of e)t.endUpdate(this)}}addObserver(e){const t=!this.observers.has(e)&&this._updateCounter>0;super.addObserver(e),t&&e.beginUpdate(this)}removeObserver(e){const t=this.observers.has(e)&&this._updateCounter>0;super.removeObserver(e),t&&e.endUpdate(this)}set(e,t,i){if(i===void 0&&this._equalityComparator(this._value,e))return;let r;t||(t=r=new i2(()=>{},()=>`Setting ${this.debugName}`));try{if(this._isUpToDate=!1,this._setValue(e),i!==void 0&&this._deltas.push(i),t.updateObserver({beginUpdate:()=>this._beginUpdate(),endUpdate:()=>this._endUpdate(),handleChange:(s,o)=>{},handlePossibleChange:s=>{}},this),this._updateCounter>1)for(const s of this.observers)s.handlePossibleChange(this)}finally{r&&r.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}}function CQ(n,e){return n.lazy?new FSt(new Za(n.owner,n.debugName,void 0),e,n.equalsFn??rd):new Ble(new Za(n.owner,n.debugName,void 0),e,n.equalsFn??rd)}class L8 extends me{static{this.instanceCount=0}constructor(e=!1){super(),this._onDidRequestBasicLanguageFeatures=this._register(new fe),this.onDidRequestBasicLanguageFeatures=this._onDidRequestBasicLanguageFeatures.event,this._onDidRequestRichLanguageFeatures=this._register(new fe),this.onDidRequestRichLanguageFeatures=this._onDidRequestRichLanguageFeatures.event,this._onDidChange=this._register(new fe({leakWarningThreshold:200})),this.onDidChange=this._onDidChange.event,this._requestedBasicLanguages=new Set,this._requestedRichLanguages=new Set,L8.instanceCount++,this._registry=this._register(new S8(!0,e)),this.languageIdCodec=this._registry.languageIdCodec,this._register(this._registry.onDidChange(()=>this._onDidChange.fire()))}dispose(){L8.instanceCount--,super.dispose()}isRegisteredLanguageId(e){return this._registry.isRegisteredLanguageId(e)}getLanguageIdByLanguageName(e){return this._registry.getLanguageIdByLanguageName(e)}getLanguageIdByMimeType(e){return this._registry.getLanguageIdByMimeType(e)}guessLanguageIdByFilepathOrFirstLine(e,t){const i=this._registry.guessLanguageIdByFilepathOrFirstLine(e,t);return hae(i,null)}createById(e){return new Z1e(this.onDidChange,()=>this._createAndGetLanguageIdentifier(e))}createByFilepathOrFirstLine(e,t){return new Z1e(this.onDidChange,()=>{const i=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(i)})}_createAndGetLanguageIdentifier(e){return(!e||!this.isRegisteredLanguageId(e))&&(e=Hl),e}requestBasicLanguageFeatures(e){this._requestedBasicLanguages.has(e)||(this._requestedBasicLanguages.add(e),this._onDidRequestBasicLanguageFeatures.fire(e))}requestRichLanguageFeatures(e){this._requestedRichLanguages.has(e)||(this._requestedRichLanguages.add(e),this.requestBasicLanguageFeatures(e),rs.getOrCreate(e),this._onDidRequestRichLanguageFeatures.fire(e))}}class Z1e{constructor(e,t){this._value=Bi(this,e,()=>t()),this.onDidChange=Ge.fromObservable(this._value)}get languageId(){return this._value.get()}}const DN={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:ps.text,INTERNAL_URI_LIST:"application/vnd.code.uri-list"},BSt=()=>({get delay(){return-1},dispose:()=>{},showHover:()=>{}});let SW=BSt;const $St=new kg(()=>SW("mouse",!1)),WSt=new kg(()=>SW("element",!1));function HSt(n){SW=n}function Yl(n){return n==="element"?WSt.value:$St.value}function _E(){return SW("element",!0)}let f5e={showHover:()=>{},hideHover:()=>{},showAndFocusLastHover:()=>{},setupManagedHover:()=>null,showManagedHover:()=>{}};function VSt(n){f5e=n}function Bg(){return f5e}class zSt{constructor(e){this.spliceables=e}splice(e,t,i){this.spliceables.forEach(r=>r.splice(e,t,i))}}class D1 extends Error{constructor(e,t){super(`ListError [${e}] ${t}`)}}function X1e(n,e){const t=[];for(const i of e){if(n.start>=i.range.end)continue;if(n.ende.concat(t),[]))}class qSt{get paddingTop(){return this._paddingTop}set paddingTop(e){this._size=this._size+e-this._paddingTop,this._paddingTop=e}constructor(e){this.groups=[],this._size=0,this._paddingTop=0,this._paddingTop=e??0,this._size=this._paddingTop}splice(e,t,i=[]){const r=i.length-t,s=X1e({start:0,end:e},this.groups),o=X1e({start:e+t,end:Number.POSITIVE_INFINITY},this.groups).map(l=>({range:xQ(l.range,r),size:l.size})),a=i.map((l,c)=>({range:{start:e+c,end:e+c+1},size:l.size}));this.groups=jSt(s,a,o),this._size=this._paddingTop+this.groups.reduce((l,c)=>l+c.size*(c.range.end-c.range.start),0)}get count(){const e=this.groups.length;return e?this.groups[e-1].range.end:0}get size(){return this._size}indexAt(e){if(e<0)return-1;if(e{for(const i of e)this.getRenderer(t).disposeTemplate(i.templateData),i.templateData=null}),this.cache.clear(),this.transactionNodesPendingRemoval.clear()}getRenderer(e){const t=this.renderers.get(e);if(!t)throw new Error(`No renderer found for ${e}`);return t}}var _0=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};const I1={CurrentDragAndDropData:void 0},Xg={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements(n){return[n]},getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0};class uO{constructor(e){this.elements=e}update(){}getData(){return this.elements}}class GSt{constructor(e){this.elements=e}update(){}getData(){return this.elements}}class YSt{constructor(){this.types=[],this.files=[]}update(e){if(e.types&&this.types.splice(0,this.types.length,...e.types),e.files){this.files.splice(0,this.files.length);for(let t=0;tr,e?.getPosInSet?this.getPosInSet=e.getPosInSet.bind(e):this.getPosInSet=(t,i)=>i+1,e?.getRole?this.getRole=e.getRole.bind(e):this.getRole=t=>"listitem",e?.isChecked?this.isChecked=e.isChecked.bind(e):this.isChecked=t=>{}}}class gf{static{this.InstanceCount=0}get contentHeight(){return this.rangeMap.size}get onDidScroll(){return this.scrollableElement.onScroll}get scrollableElementDomNode(){return this.scrollableElement.getDomNode()}get horizontalScrolling(){return this._horizontalScrolling}set horizontalScrolling(e){if(e!==this._horizontalScrolling){if(e&&this.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");if(this._horizontalScrolling=e,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this._horizontalScrolling){for(const t of this.items)this.measureItemWidth(t);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:xj(this.domNode)}),this.rowsContainer.style.width=`${Math.max(this.scrollWidth||0,this.renderWidth)}px`}else this.scrollableElementWidthDelayer.cancel(),this.scrollableElement.setScrollDimensions({width:this.renderWidth,scrollWidth:this.renderWidth}),this.rowsContainer.style.width=""}}constructor(e,t,i,r=Xg){if(this.virtualDelegate=t,this.domId=`list_id_${++gf.InstanceCount}`,this.renderers=new Map,this.renderWidth=0,this._scrollHeight=0,this.scrollableElementUpdateDisposable=null,this.scrollableElementWidthDelayer=new Qd(50),this.splicing=!1,this.dragOverAnimationStopDisposable=me.None,this.dragOverMouseY=0,this.canDrop=!1,this.currentDragFeedbackDisposable=me.None,this.onDragLeaveTimeout=me.None,this.disposables=new ke,this._onDidChangeContentHeight=new fe,this._onDidChangeContentWidth=new fe,this.onDidChangeContentHeight=Ge.latch(this._onDidChangeContentHeight.event,void 0,this.disposables),this._horizontalScrolling=!1,r.horizontalScrolling&&r.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");this.items=[],this.itemId=0,this.rangeMap=this.createRangeMap(r.paddingTop??0);for(const o of i)this.renderers.set(o.templateId,o);this.cache=this.disposables.add(new KSt(this.renderers)),this.lastRenderTop=0,this.lastRenderHeight=0,this.domNode=document.createElement("div"),this.domNode.className="monaco-list",this.domNode.classList.add(this.domId),this.domNode.tabIndex=0,this.domNode.classList.toggle("mouse-support",typeof r.mouseSupport=="boolean"?r.mouseSupport:!0),this._horizontalScrolling=r.horizontalScrolling??Xg.horizontalScrolling,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.paddingBottom=typeof r.paddingBottom>"u"?0:r.paddingBottom,this.accessibilityProvider=new XSt(r.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",(r.transformOptimization??Xg.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)",this.rowsContainer.style.overflow="hidden",this.rowsContainer.style.contain="strict"),this.disposables.add(Fr.addTarget(this.rowsContainer)),this.scrollable=this.disposables.add(new t2({forceIntegerValues:!0,smoothScrollDuration:r.smoothScrolling??!1?125:0,scheduleAtNextAnimationFrame:o=>du(Ot(this.domNode),o)})),this.scrollableElement=this.disposables.add(new fW(this.rowsContainer,{alwaysConsumeMouseWheel:r.alwaysConsumeMouseWheel??Xg.alwaysConsumeMouseWheel,horizontal:1,vertical:r.verticalScrollMode??Xg.verticalScrollMode,useShadows:r.useShadows??Xg.useShadows,mouseWheelScrollSensitivity:r.mouseWheelScrollSensitivity,fastScrollSensitivity:r.fastScrollSensitivity,scrollByPage:r.scrollByPage},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),e.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add(Ce(this.rowsContainer,gr.Change,o=>this.onTouchChange(o))),this.disposables.add(Ce(this.scrollableElement.getDomNode(),"scroll",o=>o.target.scrollTop=0)),this.disposables.add(Ce(this.domNode,"dragover",o=>this.onDragOver(this.toDragEvent(o)))),this.disposables.add(Ce(this.domNode,"drop",o=>this.onDrop(this.toDragEvent(o)))),this.disposables.add(Ce(this.domNode,"dragleave",o=>this.onDragLeave(this.toDragEvent(o)))),this.disposables.add(Ce(this.domNode,"dragend",o=>this.onDragEnd(o))),this.setRowLineHeight=r.setRowLineHeight??Xg.setRowLineHeight,this.setRowHeight=r.setRowHeight??Xg.setRowHeight,this.supportDynamicHeights=r.supportDynamicHeights??Xg.supportDynamicHeights,this.dnd=r.dnd??this.disposables.add(Xg.dnd),this.layout(r.initialSize?.height,r.initialSize?.width)}updateOptions(e){e.paddingBottom!==void 0&&(this.paddingBottom=e.paddingBottom,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),e.smoothScrolling!==void 0&&this.scrollable.setSmoothScrollDuration(e.smoothScrolling?125:0),e.horizontalScrolling!==void 0&&(this.horizontalScrolling=e.horizontalScrolling);let t;if(e.scrollByPage!==void 0&&(t={...t??{},scrollByPage:e.scrollByPage}),e.mouseWheelScrollSensitivity!==void 0&&(t={...t??{},mouseWheelScrollSensitivity:e.mouseWheelScrollSensitivity}),e.fastScrollSensitivity!==void 0&&(t={...t??{},fastScrollSensitivity:e.fastScrollSensitivity}),t&&this.scrollableElement.updateOptions(t),e.paddingTop!==void 0&&e.paddingTop!==this.rangeMap.paddingTop){const i=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),r=e.paddingTop-this.rangeMap.paddingTop;this.rangeMap.paddingTop=e.paddingTop,this.render(i,Math.max(0,this.lastRenderTop+r),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.lastRenderTop,this.lastRenderHeight)}}createRangeMap(e){return new qSt(e)}splice(e,t,i=[]){if(this.splicing)throw new Error("Can't run recursive splices.");this.splicing=!0;try{return this._splice(e,t,i)}finally{this.splicing=!1,this._onDidChangeContentHeight.fire(this.contentHeight)}}_splice(e,t,i=[]){const r=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),s={start:e,end:e+t},o=Ba.intersect(r,s),a=new Map;for(let x=o.end-1;x>=o.start;x--){const k=this.items[x];if(k.dragStartDisposable.dispose(),k.checkedDisposable.dispose(),k.row){let L=a.get(k.templateId);L||(L=[],a.set(k.templateId,L));const D=this.renderers.get(k.templateId);D&&D.disposeElement&&D.disposeElement(k.element,x,k.row.templateData,k.size),L.unshift(k.row)}k.row=null,k.stale=!0}const l={start:e+t,end:this.items.length},c=Ba.intersect(l,r),u=Ba.relativeComplement(l,r),d=i.map(x=>({id:String(this.itemId++),element:x,templateId:this.virtualDelegate.getTemplateId(x),size:this.virtualDelegate.getHeight(x),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(x),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:me.None,checkedDisposable:me.None,stale:!1}));let h;e===0&&t>=this.items.length?(this.rangeMap=this.createRangeMap(this.rangeMap.paddingTop),this.rangeMap.splice(0,0,d),h=this.items,this.items=d):(this.rangeMap.splice(e,t,d),h=this.items.splice(e,t,...d));const f=i.length-t,g=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),p=xQ(c,f),m=Ba.intersect(g,p);for(let x=m.start;xxQ(x,f)),C=[{start:e,end:e+i.length},...v].map(x=>Ba.intersect(g,x)).reverse();for(const x of C)for(let k=x.end-1;k>=x.start;k--){const L=this.items[k],I=a.get(L.templateId)?.pop();this.insertItemInDOM(k,I)}for(const x of a.values())for(const k of x)this.cache.release(k);return this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight),h.map(x=>x.element)}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=du(Ot(this.domNode),()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null}))}eventuallyUpdateScrollWidth(){if(!this.horizontalScrolling){this.scrollableElementWidthDelayer.cancel();return}this.scrollableElementWidthDelayer.trigger(()=>this.updateScrollWidth())}updateScrollWidth(){if(!this.horizontalScrolling)return;let e=0;for(const t of this.items)typeof t.width<"u"&&(e=Math.max(e,t.width));this.scrollWidth=e,this.scrollableElement.setScrollDimensions({scrollWidth:e===0?0:e+10}),this._onDidChangeContentWidth.fire(this.scrollWidth)}rerender(){if(this.supportDynamicHeights){for(const e of this.items)e.lastDynamicHeightWidth=void 0;this._rerender(this.lastRenderTop,this.lastRenderHeight)}}get length(){return this.items.length}get renderHeight(){return this.scrollableElement.getScrollDimensions().height}get firstVisibleIndex(){return this.getRenderRange(this.lastRenderTop,this.lastRenderHeight).start}element(e){return this.items[e].element}indexOf(e){return this.items.findIndex(t=>t.element===e)}domElement(e){const t=this.items[e].row;return t&&t.domNode}elementHeight(e){return this.items[e].size}elementTop(e){return this.rangeMap.positionAt(e)}indexAt(e){return this.rangeMap.indexAt(e)}indexAfter(e){return this.rangeMap.indexAfter(e)}layout(e,t){const i={height:typeof e=="number"?e:b0t(this.domNode)};this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,i.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(i),typeof t<"u"&&(this.renderWidth=t,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling&&this.scrollableElement.setScrollDimensions({width:typeof t=="number"?t:xj(this.domNode)})}render(e,t,i,r,s,o=!1){const a=this.getRenderRange(t,i),l=Ba.relativeComplement(a,e).reverse(),c=Ba.relativeComplement(e,a);if(o){const u=Ba.intersect(e,a);for(let d=u.start;d{for(const u of c)for(let d=u.start;d=u.start;d--)this.insertItemInDOM(d)}),r!==void 0&&(this.rowsContainer.style.left=`-${r}px`),this.rowsContainer.style.top=`-${t}px`,this.horizontalScrolling&&s!==void 0&&(this.rowsContainer.style.width=`${Math.max(s,this.renderWidth)}px`),this.lastRenderTop=t,this.lastRenderHeight=i}insertItemInDOM(e,t){const i=this.items[e];if(!i.row)if(t)i.row=t,i.stale=!0;else{const l=this.cache.alloc(i.templateId);i.row=l.row,i.stale||=l.isReusingConnectedDomNode}const r=this.accessibilityProvider.getRole(i.element)||"listitem";i.row.domNode.setAttribute("role",r);const s=this.accessibilityProvider.isChecked(i.element);if(typeof s=="boolean")i.row.domNode.setAttribute("aria-checked",String(!!s));else if(s){const l=c=>i.row.domNode.setAttribute("aria-checked",String(!!c));l(s.value),i.checkedDisposable=s.onDidChange(()=>l(s.value))}if(i.stale||!i.row.domNode.parentElement){const l=this.items.at(e+1)?.row?.domNode??null;(i.row.domNode.parentElement!==this.rowsContainer||i.row.domNode.nextElementSibling!==l)&&this.rowsContainer.insertBefore(i.row.domNode,l),i.stale=!1}this.updateItemInDOM(i,e);const o=this.renderers.get(i.templateId);if(!o)throw new Error(`No renderer found for template id ${i.templateId}`);o?.renderElement(i.element,e,i.row.templateData,i.size);const a=this.dnd.getDragURI(i.element);i.dragStartDisposable.dispose(),i.row.domNode.draggable=!!a,a&&(i.dragStartDisposable=Ce(i.row.domNode,"dragstart",l=>this.onDragStart(i.element,a,l))),this.horizontalScrolling&&(this.measureItemWidth(i),this.eventuallyUpdateScrollWidth())}measureItemWidth(e){if(!e.row||!e.row.domNode)return;e.row.domNode.style.width="fit-content",e.width=xj(e.row.domNode);const t=Ot(e.row.domNode).getComputedStyle(e.row.domNode);t.paddingLeft&&(e.width+=parseFloat(t.paddingLeft)),t.paddingRight&&(e.width+=parseFloat(t.paddingRight)),e.row.domNode.style.width=""}updateItemInDOM(e,t){e.row.domNode.style.top=`${this.elementTop(t)}px`,this.setRowHeight&&(e.row.domNode.style.height=`${e.size}px`),this.setRowLineHeight&&(e.row.domNode.style.lineHeight=`${e.size}px`),e.row.domNode.setAttribute("data-index",`${t}`),e.row.domNode.setAttribute("data-last-element",t===this.length-1?"true":"false"),e.row.domNode.setAttribute("data-parity",t%2===0?"even":"odd"),e.row.domNode.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(e.element,t,this.length))),e.row.domNode.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(e.element,t))),e.row.domNode.setAttribute("id",this.getElementDomId(t)),e.row.domNode.classList.toggle("drop-target",e.dropTarget)}removeItemFromDOM(e){const t=this.items[e];if(t.dragStartDisposable.dispose(),t.checkedDisposable.dispose(),t.row){const i=this.renderers.get(t.templateId);i&&i.disposeElement&&i.disposeElement(t.element,e,t.row.templateData,t.size),this.cache.release(t.row),t.row=null}this.horizontalScrolling&&this.eventuallyUpdateScrollWidth()}getScrollTop(){return this.scrollableElement.getScrollPosition().scrollTop}setScrollTop(e,t){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),this.scrollableElement.setScrollPosition({scrollTop:e,reuseAnimation:t})}get scrollTop(){return this.getScrollTop()}set scrollTop(e){this.setScrollTop(e)}get scrollHeight(){return this._scrollHeight+(this.horizontalScrolling?10:0)+this.paddingBottom}get onMouseClick(){return Ge.map(this.disposables.add(new $n(this.domNode,"click")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseDblClick(){return Ge.map(this.disposables.add(new $n(this.domNode,"dblclick")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseMiddleClick(){return Ge.filter(Ge.map(this.disposables.add(new $n(this.domNode,"auxclick")).event,e=>this.toMouseEvent(e),this.disposables),e=>e.browserEvent.button===1,this.disposables)}get onMouseDown(){return Ge.map(this.disposables.add(new $n(this.domNode,"mousedown")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseOver(){return Ge.map(this.disposables.add(new $n(this.domNode,"mouseover")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseOut(){return Ge.map(this.disposables.add(new $n(this.domNode,"mouseout")).event,e=>this.toMouseEvent(e),this.disposables)}get onContextMenu(){return Ge.any(Ge.map(this.disposables.add(new $n(this.domNode,"contextmenu")).event,e=>this.toMouseEvent(e),this.disposables),Ge.map(this.disposables.add(new $n(this.domNode,gr.Contextmenu)).event,e=>this.toGestureEvent(e),this.disposables))}get onTouchStart(){return Ge.map(this.disposables.add(new $n(this.domNode,"touchstart")).event,e=>this.toTouchEvent(e),this.disposables)}get onTap(){return Ge.map(this.disposables.add(new $n(this.rowsContainer,gr.Tap)).event,e=>this.toGestureEvent(e),this.disposables)}toMouseEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],r=i&&i.element;return{browserEvent:e,index:t,element:r}}toTouchEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],r=i&&i.element;return{browserEvent:e,index:t,element:r}}toGestureEvent(e){const t=this.getItemIndexFromEventTarget(e.initialTarget||null),i=typeof t>"u"?void 0:this.items[t],r=i&&i.element;return{browserEvent:e,index:t,element:r}}toDragEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],r=i&&i.element,s=this.getTargetSector(e,t);return{browserEvent:e,index:t,element:r,sector:s}}onScroll(e){try{const t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(t,e.scrollTop,e.height,e.scrollLeft,e.scrollWidth),this.supportDynamicHeights&&this._rerender(e.scrollTop,e.height,e.inSmoothScrolling)}catch(t){throw console.error("Got bad scroll event:",e),t}}onTouchChange(e){e.preventDefault(),e.stopPropagation(),this.scrollTop-=e.translationY}onDragStart(e,t,i){if(!i.dataTransfer)return;const r=this.dnd.getDragElements(e);if(i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.setData(DN.TEXT,t),i.dataTransfer.setDragImage){let s;this.dnd.getDragLabel&&(s=this.dnd.getDragLabel(r,i)),typeof s>"u"&&(s=String(r.length));const o=qe(".monaco-drag-image");o.textContent=s,(c=>{for(;c&&!c.classList.contains("monaco-workbench");)c=c.parentElement;return c||this.domNode.ownerDocument})(this.domNode).appendChild(o),i.dataTransfer.setDragImage(o,-10,-10),setTimeout(()=>o.remove(),0)}this.domNode.classList.add("dragging"),this.currentDragData=new uO(r),I1.CurrentDragAndDropData=new GSt(r),this.dnd.onDragStart?.(this.currentDragData,i)}onDragOver(e){if(e.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),I1.CurrentDragAndDropData&&I1.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(e.browserEvent),!e.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(I1.CurrentDragAndDropData)this.currentDragData=I1.CurrentDragAndDropData;else{if(!e.browserEvent.dataTransfer.types)return!1;this.currentDragData=new YSt}const t=this.dnd.onDragOver(this.currentDragData,e.element,e.index,e.sector,e.browserEvent);if(this.canDrop=typeof t=="boolean"?t:t.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;e.browserEvent.dataTransfer.dropEffect=typeof t!="boolean"&&t.effect?.type===0?"copy":"move";let i;typeof t!="boolean"&&t.feedback?i=t.feedback:typeof e.index>"u"?i=[-1]:i=[e.index],i=j_(i).filter(s=>s>=-1&&ss-o),i=i[0]===-1?[-1]:i;let r=typeof t!="boolean"&&t.effect&&t.effect.position?t.effect.position:"drop-target";if(ZSt(this.currentDragFeedback,i)&&this.currentDragFeedbackPosition===r)return!0;if(this.currentDragFeedback=i,this.currentDragFeedbackPosition=r,this.currentDragFeedbackDisposable.dispose(),i[0]===-1)this.domNode.classList.add(r),this.rowsContainer.classList.add(r),this.currentDragFeedbackDisposable=Lt(()=>{this.domNode.classList.remove(r),this.rowsContainer.classList.remove(r)});else{if(i.length>1&&r!=="drop-target")throw new Error("Can't use multiple feedbacks with position different than 'over'");r==="drop-target-after"&&i[0]{for(const s of i){const o=this.items[s];o.dropTarget=!1,o.row?.domNode.classList.remove(r)}})}return!0}onDragLeave(e){this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=Sb(()=>this.clearDragOverFeedback(),100,this.disposables),this.currentDragData&&this.dnd.onDragLeave?.(this.currentDragData,e.element,e.index,e.browserEvent)}onDrop(e){if(!this.canDrop)return;const t=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,I1.CurrentDragAndDropData=void 0,!(!t||!e.browserEvent.dataTransfer)&&(e.browserEvent.preventDefault(),t.update(e.browserEvent.dataTransfer),this.dnd.drop(t,e.element,e.index,e.sector,e.browserEvent))}onDragEnd(e){this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,I1.CurrentDragAndDropData=void 0,this.dnd.onDragEnd?.(e)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackPosition=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=me.None}setupDragAndDropScrollTopAnimation(e){if(!this.dragOverAnimationDisposable){const t=u3e(this.domNode).top;this.dragOverAnimationDisposable=N0t(Ot(this.domNode),this.animateDragAndDropScrollTop.bind(this,t))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=Sb(()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)},1e3,this.disposables),this.dragOverMouseY=e.pageY}animateDragAndDropScrollTop(e){if(this.dragOverMouseY===void 0)return;const t=this.dragOverMouseY-e,i=this.renderHeight-35;t<35?this.scrollTop+=Math.max(-14,Math.floor(.3*(t-35))):t>i&&(this.scrollTop+=Math.min(14,Math.floor(.3*(t-i))))}teardownDragAndDropScrollTopAnimation(){this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}getTargetSector(e,t){if(t===void 0)return;const i=e.offsetY/this.items[t].size,r=Math.floor(i/.25);return Il(r,0,3)}getItemIndexFromEventTarget(e){const t=this.scrollableElement.getDomNode();let i=e;for(;(Eo(i)||k0t(i))&&i!==this.rowsContainer&&t.contains(i);){const r=i.getAttribute("data-index");if(r){const s=Number(r);if(!isNaN(s))return s}i=i.parentElement}}getRenderRange(e,t){return{start:this.rangeMap.indexAt(e),end:this.rangeMap.indexAfter(e+t-1)}}_rerender(e,t,i){const r=this.getRenderRange(e,t);let s,o;e===this.elementTop(r.start)?(s=r.start,o=0):r.end-r.start>1&&(s=r.start+1,o=this.elementTop(s)-e);let a=0;for(;;){const l=this.getRenderRange(e,t);let c=!1;for(let u=l.start;u=h.start;f--)this.insertItemInDOM(f);for(let h=l.start;h=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};class QSt{constructor(e){this.trait=e,this.renderedElements=[]}get templateId(){return`template:${this.trait.name}`}renderTemplate(e){return e}renderElement(e,t,i){const r=this.renderedElements.findIndex(s=>s.templateData===i);if(r>=0){const s=this.renderedElements[r];this.trait.unrender(i),s.index=t}else{const s={index:t,templateData:i};this.renderedElements.push(s)}this.trait.renderIndex(t,i)}splice(e,t,i){const r=[];for(const s of this.renderedElements)s.index=e+t&&r.push({index:s.index+i-t,templateData:s.templateData});this.renderedElements=r}renderIndexes(e){for(const{index:t,templateData:i}of this.renderedElements)e.indexOf(t)>-1&&this.trait.renderIndex(t,i)}disposeTemplate(e){const t=this.renderedElements.findIndex(i=>i.templateData===e);t<0||this.renderedElements.splice(t,1)}}let T8=class{get name(){return this._trait}get renderer(){return new QSt(this)}constructor(e){this._trait=e,this.indexes=[],this.sortedIndexes=[],this._onChange=new fe,this.onChange=this._onChange.event}splice(e,t,i){const r=i.length-t,s=e+t,o=[];let a=0;for(;a=s;)o.push(this.sortedIndexes[a++]+r);this.renderer.splice(e,t,i.length),this._set(o,o)}renderIndex(e,t){t.classList.toggle(this._trait,this.contains(e))}unrender(e){e.classList.remove(this._trait)}set(e,t){return this._set(e,[...e].sort(J1e),t)}_set(e,t,i){const r=this.indexes,s=this.sortedIndexes;this.indexes=e,this.sortedIndexes=t;const o=SQ(s,e);return this.renderer.renderIndexes(o),this._onChange.fire({indexes:e,browserEvent:i}),r}get(){return this.indexes}contains(e){return JA(this.sortedIndexes,e,J1e)>=0}dispose(){er(this._onChange)}};e1([Ds],T8.prototype,"renderer",null);class JSt extends T8{constructor(e){super("selected"),this.setAriaSelected=e}renderIndex(e,t){super.renderIndex(e,t),this.setAriaSelected&&(this.contains(e)?t.setAttribute("aria-selected","true"):t.setAttribute("aria-selected","false"))}}class tq{constructor(e,t,i){this.trait=e,this.view=t,this.identityProvider=i}splice(e,t,i){if(!this.identityProvider)return this.trait.splice(e,t,new Array(i.length).fill(!1));const r=this.trait.get().map(a=>this.identityProvider.getId(this.view.element(a)).toString());if(r.length===0)return this.trait.splice(e,t,new Array(i.length).fill(!1));const s=new Set(r),o=i.map(a=>s.has(this.identityProvider.getId(a).toString()));this.trait.splice(e,t,o)}}function lb(n){return n.tagName==="INPUT"||n.tagName==="TEXTAREA"}function dO(n,e){return n.classList.contains(e)?!0:n.classList.contains("monaco-list")||!n.parentElement?!1:dO(n.parentElement,e)}function AD(n){return dO(n,"monaco-editor")}function ekt(n){return dO(n,"monaco-custom-toggle")}function tkt(n){return dO(n,"action-item")}function wI(n){return dO(n,"monaco-tree-sticky-row")}function IN(n){return n.classList.contains("monaco-tree-sticky-container")}function g5e(n){return n.tagName==="A"&&n.classList.contains("monaco-button")||n.tagName==="DIV"&&n.classList.contains("monaco-button-dropdown")?!0:n.classList.contains("monaco-list")||!n.parentElement?!1:g5e(n.parentElement)}class p5e{get onKeyDown(){return Ge.chain(this.disposables.add(new $n(this.view.domNode,"keydown")).event,e=>e.filter(t=>!lb(t.target)).map(t=>new or(t)))}constructor(e,t,i){this.list=e,this.view=t,this.disposables=new ke,this.multipleSelectionDisposables=new ke,this.multipleSelectionSupport=i.multipleSelectionSupport,this.disposables.add(this.onKeyDown(r=>{switch(r.keyCode){case 3:return this.onEnter(r);case 16:return this.onUpArrow(r);case 18:return this.onDownArrow(r);case 11:return this.onPageUpArrow(r);case 12:return this.onPageDownArrow(r);case 9:return this.onEscape(r);case 31:this.multipleSelectionSupport&&(Rn?r.metaKey:r.ctrlKey)&&this.onCtrlA(r)}}))}updateOptions(e){e.multipleSelectionSupport!==void 0&&(this.multipleSelectionSupport=e.multipleSelectionSupport)}onEnter(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(this.list.getFocus(),e.browserEvent)}onUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPrevious(1,!1,e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNext(1,!1,e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPreviousPage(e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNextPage(e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onCtrlA(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(sc(this.list.length),e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus()}onEscape(e){this.list.getSelection().length&&(e.preventDefault(),e.stopPropagation(),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}}e1([Ds],p5e.prototype,"onKeyDown",null);var Cp;(function(n){n[n.Automatic=0]="Automatic",n[n.Trigger=1]="Trigger"})(Cp||(Cp={}));var ES;(function(n){n[n.Idle=0]="Idle",n[n.Typing=1]="Typing"})(ES||(ES={}));const nkt=new class{mightProducePrintableCharacter(n){return n.ctrlKey||n.metaKey||n.altKey?!1:n.keyCode>=31&&n.keyCode<=56||n.keyCode>=21&&n.keyCode<=30||n.keyCode>=98&&n.keyCode<=107||n.keyCode>=85&&n.keyCode<=95}};class ikt{constructor(e,t,i,r,s){this.list=e,this.view=t,this.keyboardNavigationLabelProvider=i,this.keyboardNavigationEventFilter=r,this.delegate=s,this.enabled=!1,this.state=ES.Idle,this.mode=Cp.Automatic,this.triggered=!1,this.previouslyFocused=-1,this.enabledDisposables=new ke,this.disposables=new ke,this.updateOptions(e.options)}updateOptions(e){e.typeNavigationEnabled??!0?this.enable():this.disable(),this.mode=e.typeNavigationMode??Cp.Automatic}enable(){if(this.enabled)return;let e=!1;const t=Ge.chain(this.enabledDisposables.add(new $n(this.view.domNode,"keydown")).event,s=>s.filter(o=>!lb(o.target)).filter(()=>this.mode===Cp.Automatic||this.triggered).map(o=>new or(o)).filter(o=>e||this.keyboardNavigationEventFilter(o)).filter(o=>this.delegate.mightProducePrintableCharacter(o)).forEach(o=>Hn.stop(o,!0)).map(o=>o.browserEvent.key)),i=Ge.debounce(t,()=>null,800,void 0,void 0,void 0,this.enabledDisposables);Ge.reduce(Ge.any(t,i),(s,o)=>o===null?null:(s||"")+o,void 0,this.enabledDisposables)(this.onInput,this,this.enabledDisposables),i(this.onClear,this,this.enabledDisposables),t(()=>e=!0,void 0,this.enabledDisposables),i(()=>e=!1,void 0,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){this.enabled&&(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){const e=this.list.getFocus();if(e.length>0&&e[0]===this.previouslyFocused){const t=this.list.options.accessibilityProvider?.getAriaLabel(this.list.element(e[0]));typeof t=="string"?ql(t):t&&ql(t.get())}this.previouslyFocused=-1}onInput(e){if(!e){this.state=ES.Idle,this.triggered=!1;return}const t=this.list.getFocus(),i=t.length>0?t[0]:0,r=this.state===ES.Idle?1:0;this.state=ES.Typing;for(let s=0;s1&&c.length===1){this.previouslyFocused=i,this.list.setFocus([o]),this.list.reveal(o);return}}}else if(typeof l>"u"||SN(e,l)){this.previouslyFocused=i,this.list.setFocus([o]),this.list.reveal(o);return}}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}}class rkt{constructor(e,t){this.list=e,this.view=t,this.disposables=new ke;const i=Ge.chain(this.disposables.add(new $n(t.domNode,"keydown")).event,s=>s.filter(o=>!lb(o.target)).map(o=>new or(o)));Ge.chain(i,s=>s.filter(o=>o.keyCode===2&&!o.ctrlKey&&!o.metaKey&&!o.shiftKey&&!o.altKey))(this.onTab,this,this.disposables)}onTab(e){if(e.target!==this.view.domNode)return;const t=this.list.getFocus();if(t.length===0)return;const i=this.view.domElement(t[0]);if(!i)return;const r=i.querySelector("[tabIndex]");if(!r||!Eo(r)||r.tabIndex===-1)return;const s=Ot(r).getComputedStyle(r);s.visibility==="hidden"||s.display==="none"||(e.preventDefault(),e.stopPropagation(),r.focus())}dispose(){this.disposables.dispose()}}function m5e(n){return Rn?n.browserEvent.metaKey:n.browserEvent.ctrlKey}function _5e(n){return n.browserEvent.shiftKey}function skt(n){return Hae(n)&&n.button===2}const Q1e={isSelectionSingleChangeEvent:m5e,isSelectionRangeChangeEvent:_5e};class v5e{constructor(e){this.list=e,this.disposables=new ke,this._onPointer=new fe,this.onPointer=this._onPointer.event,e.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||Q1e),this.mouseSupport=typeof e.options.mouseSupport>"u"||!!e.options.mouseSupport,this.mouseSupport&&(e.onMouseDown(this.onMouseDown,this,this.disposables),e.onContextMenu(this.onContextMenu,this,this.disposables),e.onMouseDblClick(this.onDoubleClick,this,this.disposables),e.onTouchStart(this.onMouseDown,this,this.disposables),this.disposables.add(Fr.addTarget(e.getHTMLElement()))),Ge.any(e.onMouseClick,e.onMouseMiddleClick,e.onTap)(this.onViewPointer,this,this.disposables)}updateOptions(e){e.multipleSelectionSupport!==void 0&&(this.multipleSelectionController=void 0,e.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||Q1e))}isSelectionSingleChangeEvent(e){return this.multipleSelectionController?this.multipleSelectionController.isSelectionSingleChangeEvent(e):!1}isSelectionRangeChangeEvent(e){return this.multipleSelectionController?this.multipleSelectionController.isSelectionRangeChangeEvent(e):!1}isSelectionChangeEvent(e){return this.isSelectionSingleChangeEvent(e)||this.isSelectionRangeChangeEvent(e)}onMouseDown(e){AD(e.browserEvent.target)||ka()!==e.browserEvent.target&&this.list.domFocus()}onContextMenu(e){if(lb(e.browserEvent.target)||AD(e.browserEvent.target))return;const t=typeof e.index>"u"?[]:[e.index];this.list.setFocus(t,e.browserEvent)}onViewPointer(e){if(!this.mouseSupport||lb(e.browserEvent.target)||AD(e.browserEvent.target)||e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;const t=e.index;if(typeof t>"u"){this.list.setFocus([],e.browserEvent),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0);return}if(this.isSelectionChangeEvent(e))return this.changeSelection(e);this.list.setFocus([t],e.browserEvent),this.list.setAnchor(t),skt(e.browserEvent)||this.list.setSelection([t],e.browserEvent),this._onPointer.fire(e)}onDoubleClick(e){if(lb(e.browserEvent.target)||AD(e.browserEvent.target)||this.isSelectionChangeEvent(e)||e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;const t=this.list.getFocus();this.list.setSelection(t,e.browserEvent)}changeSelection(e){const t=e.index;let i=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(e)){typeof i>"u"&&(i=this.list.getFocus()[0]??t,this.list.setAnchor(i));const r=Math.min(i,t),s=Math.max(i,t),o=sc(r,s+1),a=this.list.getSelection(),l=lkt(SQ(a,[i]),i);if(l.length===0)return;const c=SQ(o,ckt(a,l));this.list.setSelection(c,e.browserEvent),this.list.setFocus([t],e.browserEvent)}else if(this.isSelectionSingleChangeEvent(e)){const r=this.list.getSelection(),s=r.filter(o=>o!==t);this.list.setFocus([t]),this.list.setAnchor(t),r.length===s.length?this.list.setSelection([...s,t],e.browserEvent):this.list.setSelection(s,e.browserEvent)}}dispose(){this.disposables.dispose()}}class b5e{constructor(e,t){this.styleElement=e,this.selectorSuffix=t}style(e){const t=this.selectorSuffix&&`.${this.selectorSuffix}`,i=[];e.listBackground&&i.push(`.monaco-list${t} .monaco-list-rows { background: ${e.listBackground}; }`),e.listFocusBackground&&(i.push(`.monaco-list${t}:focus .monaco-list-row.focused { background-color: ${e.listFocusBackground}; }`),i.push(`.monaco-list${t}:focus .monaco-list-row.focused:hover { background-color: ${e.listFocusBackground}; }`)),e.listFocusForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),e.listActiveSelectionBackground&&(i.push(`.monaco-list${t}:focus .monaco-list-row.selected { background-color: ${e.listActiveSelectionBackground}; }`),i.push(`.monaco-list${t}:focus .monaco-list-row.selected:hover { background-color: ${e.listActiveSelectionBackground}; }`)),e.listActiveSelectionForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.selected { color: ${e.listActiveSelectionForeground}; }`),e.listActiveSelectionIconForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.selected .codicon { color: ${e.listActiveSelectionIconForeground}; }`),e.listFocusAndSelectionBackground&&i.push(` +`;var Nxt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Rxt=function(n,e){return function(t,i){e(t,i,n)}};let b8=class extends me{constructor(e){super(),this.layoutService=e,this.contextView=this._register(new v8(this.layoutService.mainContainer,1)),this.layout(),this._register(e.onDidLayoutContainer(()=>this.layout()))}showContextView(e,t,i){let r;t?t===this.layoutService.getContainer(Ot(t))?r=1:i?r=3:r=2:r=1,this.contextView.setContainer(t??this.layoutService.activeContainer,r),this.contextView.show(e);const s={close:()=>{this.openContextView===s&&this.hideContextView()}};return this.openContextView=s,s}layout(){this.contextView.layout()}hideContextView(e){this.contextView.hide(e),this.openContextView=void 0}};b8=Nxt([Rxt(0,Zb)],b8);class Pxt extends b8{getContextViewElement(){return this.contextView.getViewElement()}}class Oxt{constructor(e,t,i){this.hoverDelegate=e,this.target=t,this.fadeInAnimation=i}async update(e,t,i){if(this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0),this.isDisposed)return;let r;if(e===void 0||yc(e)||Eo(e))r=e;else if(!tN(e.markdown))r=e.markdown??e.markdownNotSupportedFallback;else{this._hoverWidget||this.show(w("iconLabel.loading","Loading..."),t,i),this._cancellationTokenSource=new Kr;const s=this._cancellationTokenSource.token;if(r=await e.markdown(s),r===void 0&&(r=e.markdownNotSupportedFallback),this.isDisposed||s.isCancellationRequested)return}this.show(r,t,i)}show(e,t,i){const r=this._hoverWidget;if(this.hasContent(e)){const s={content:e,target:this.target,actions:i?.actions,linkHandler:i?.linkHandler,trapFocus:i?.trapFocus,appearance:{showPointer:this.hoverDelegate.placement==="element",skipFadeInAnimation:!this.fadeInAnimation||!!r,showHoverHint:i?.appearance?.showHoverHint},position:{hoverPosition:2}};this._hoverWidget=this.hoverDelegate.showHover(s,t)}r?.dispose()}hasContent(e){return e?bg(e)?!!e.value:!0:!1}get isDisposed(){return this._hoverWidget?.isDisposed}dispose(){this._hoverWidget?.dispose(),this._cancellationTokenSource?.dispose(!0),this._cancellationTokenSource=void 0}}var Mxt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},NT=function(n,e){return function(t,i){e(t,i,n)}};let uQ=class extends me{constructor(e,t,i,r,s){super(),this._instantiationService=e,this._keybindingService=i,this._layoutService=r,this._accessibilityService=s,this._managedHovers=new Map,t.onDidShowContextMenu(()=>this.hideHover()),this._contextViewHandler=this._register(new b8(this._layoutService))}showHover(e,t,i){if(F1e(this._currentHoverOptions)===F1e(e)||this._currentHover&&this._currentHoverOptions?.persistence?.sticky)return;this._currentHoverOptions=e,this._lastHoverOptions=e;const r=e.trapFocus||this._accessibilityService.isScreenReaderOptimized(),s=ka();i||(r&&s?s.classList.contains("monaco-hover")||(this._lastFocusedElementBeforeOpen=s):this._lastFocusedElementBeforeOpen=void 0);const o=new ke,a=this._instantiationService.createInstance(cQ,e);if(e.persistence?.sticky&&(a.isLocked=!0),a.onDispose(()=>{this._currentHover?.domNode&&f3e(this._currentHover.domNode)&&this._lastFocusedElementBeforeOpen?.focus(),this._currentHoverOptions===e&&(this._currentHoverOptions=void 0),o.dispose()},void 0,o),!e.container){const l=Eo(e.target)?e.target:e.target.targetElements[0];e.container=this._layoutService.getContainer(Ot(l))}if(this._contextViewHandler.showContextView(new Fxt(a,t),e.container),a.onRequestLayout(()=>this._contextViewHandler.layout(),void 0,o),e.persistence?.sticky)o.add(Ce(Ot(e.container).document,je.MOUSE_DOWN,l=>{xo(l.target,a.domNode)||this.doHideHover()}));else{if("targetElements"in e.target)for(const c of e.target.targetElements)o.add(Ce(c,je.CLICK,()=>this.hideHover()));else o.add(Ce(e.target,je.CLICK,()=>this.hideHover()));const l=ka();if(l){const c=Ot(l).document;o.add(Ce(l,je.KEY_DOWN,u=>this._keyDown(u,a,!!e.persistence?.hideOnKeyDown))),o.add(Ce(c,je.KEY_DOWN,u=>this._keyDown(u,a,!!e.persistence?.hideOnKeyDown))),o.add(Ce(l,je.KEY_UP,u=>this._keyUp(u,a))),o.add(Ce(c,je.KEY_UP,u=>this._keyUp(u,a)))}}if("IntersectionObserver"in Xi){const l=new IntersectionObserver(u=>this._intersectionChange(u,a),{threshold:0}),c="targetElements"in e.target?e.target.targetElements[0]:e.target;l.observe(c),o.add(Lt(()=>l.disconnect()))}return this._currentHover=a,a}hideHover(){this._currentHover?.isLocked||!this._currentHoverOptions||this.doHideHover()}doHideHover(){this._currentHover=void 0,this._currentHoverOptions=void 0,this._contextViewHandler.hideContextView()}_intersectionChange(e,t){e[e.length-1].isIntersecting||t.dispose()}showAndFocusLastHover(){this._lastHoverOptions&&this.showHover(this._lastHoverOptions,!0,!0)}_keyDown(e,t,i){if(e.key==="Alt"){t.isLocked=!0;return}const r=new or(e);this._keybindingService.resolveKeyboardEvent(r).getSingleModifierDispatchChords().some(o=>!!o)||this._keybindingService.softDispatch(r,r.target).kind!==0||i&&(!this._currentHoverOptions?.trapFocus||e.key!=="Tab")&&(this.hideHover(),this._lastFocusedElementBeforeOpen?.focus())}_keyUp(e,t){e.key==="Alt"&&(t.isLocked=!1,t.isMouseIn||(this.hideHover(),this._lastFocusedElementBeforeOpen?.focus()))}setupManagedHover(e,t,i,r){t.setAttribute("custom-hover","true"),t.title!==""&&(console.warn("HTML element already has a title attribute, which will conflict with the custom hover. Please remove the title attribute."),console.trace("Stack trace:",t.title),t.title="");let s,o;const a=(y,C)=>{const x=o!==void 0;y&&(o?.dispose(),o=void 0),C&&(s?.dispose(),s=void 0),x&&(e.onDidHideHover?.(),o=void 0)},l=(y,C,x,k)=>new hf(async()=>{(!o||o.isDisposed)&&(o=new Oxt(e,x||t,y>0),await o.update(typeof i=="function"?i():i,C,{...r,trapFocus:k}))},y);let c=!1;const u=Ce(t,je.MOUSE_DOWN,()=>{c=!0,a(!0,!0)},!0),d=Ce(t,je.MOUSE_UP,()=>{c=!1},!0),h=Ce(t,je.MOUSE_LEAVE,y=>{c=!1,a(!1,y.fromElement===t)},!0),f=y=>{if(s)return;const C=new ke,x={targetElements:[t],dispose:()=>{}};if(e.placement===void 0||e.placement==="mouse"){const k=L=>{x.x=L.x+10,Eo(L.target)&&B1e(L.target,t)!==t&&a(!0,!0)};C.add(Ce(t,je.MOUSE_MOVE,k,!0))}s=C,!(Eo(y.target)&&B1e(y.target,t)!==t)&&C.add(l(e.delay,!1,x))},g=Ce(t,je.MOUSE_OVER,f,!0),p=()=>{if(c||s)return;const y={targetElements:[t],dispose:()=>{}},C=new ke,x=()=>a(!0,!0);C.add(Ce(t,je.BLUR,x,!0)),C.add(l(e.delay,!1,y)),s=C};let m;const _=t.tagName.toLowerCase();_!=="input"&&_!=="textarea"&&(m=Ce(t,je.FOCUS,p,!0));const v={show:y=>{a(!1,!0),l(0,y,void 0,y)},hide:()=>{a(!0,!0)},update:async(y,C)=>{i=y,await o?.update(i,void 0,C)},dispose:()=>{this._managedHovers.delete(t),g.dispose(),h.dispose(),u.dispose(),d.dispose(),m?.dispose(),a(!0,!0)}};return this._managedHovers.set(t,v),v}showManagedHover(e){const t=this._managedHovers.get(e);t&&t.show(!0)}dispose(){this._managedHovers.forEach(e=>e.dispose()),super.dispose()}};uQ=Mxt([NT(0,Tt),NT(1,mu),NT(2,xi),NT(3,Zb),NT(4,_u)],uQ);function F1e(n){if(n!==void 0)return n?.id??n}class Fxt{get anchorPosition(){return this._hover.anchor}constructor(e,t=!1){this._hover=e,this._focus=t,this.layer=1}render(e){return this._hover.render(e),this._focus&&this._hover.focus(),this._hover}getAnchor(){return{x:this._hover.x,y:this._hover.y}}layout(){this._hover.layout()}}function B1e(n,e){for(e=e??Ot(n).document.body;!n.hasAttribute("custom-hover")&&n!==e;)n=n.parentElement;return n}Vn(um,uQ,1);dh((n,e)=>{const t=n.getColor(C5e);t&&(e.addRule(`.monaco-workbench .workbench-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-workbench .workbench-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`))});const rO=On("IWorkspaceEditService");class Ple{constructor(e){this.metadata=e}static convert(e){return e.edits.map(t=>{if(ab.is(t))return ab.lift(t);if(hk.is(t))return hk.lift(t);throw new Error("Unsupported edit")})}}class ab extends Ple{static is(e){return e instanceof ab?!0:Mo(e)&&Pt.isUri(e.resource)&&Mo(e.textEdit)}static lift(e){return e instanceof ab?e:new ab(e.resource,e.textEdit,e.versionId,e.metadata)}constructor(e,t,i=void 0,r){super(r),this.resource=e,this.textEdit=t,this.versionId=i}}class hk extends Ple{static is(e){return e instanceof hk?!0:Mo(e)&&(!!e.newResource||!!e.oldResource)}static lift(e){return e instanceof hk?e:new hk(e.oldResource,e.newResource,e.options,e.metadata)}constructor(e,t,i={},r){super(r),this.oldResource=e,this.newResource=t,this.options=i}}const la={enableSplitViewResizing:!0,splitViewDefaultRatio:.5,renderSideBySide:!0,renderMarginRevertIcon:!0,renderGutterMenu:!0,maxComputationTime:5e3,maxFileSize:50,ignoreTrimWhitespace:!0,renderIndicators:!0,originalEditable:!1,diffCodeLens:!1,renderOverviewRuler:!0,diffWordWrap:"inherit",diffAlgorithm:"advanced",accessibilityVerbose:!1,experimental:{showMoves:!1,showEmptyDecorations:!0,useTrueInlineView:!1},hideUnchangedRegions:{enabled:!1,contextLineCount:3,minimumLineCount:3,revealLineCount:20},isInEmbeddedEditor:!1,onlyShowAccessibleDiffViewer:!1,renderSideBySideInlineBreakpoint:900,useInlineViewWhenSpaceIsLimited:!0,compactMode:!1},sO=Object.freeze({id:"editor",order:5,type:"object",title:w("editorConfigurationTitle","Editor"),scope:5}),y8={...sO,properties:{"editor.tabSize":{type:"number",default:Va.tabSize,minimum:1,markdownDescription:w("tabSize","The number of spaces a tab is equal to. This setting is overridden based on the file contents when {0} is on.","`#editor.detectIndentation#`")},"editor.indentSize":{anyOf:[{type:"string",enum:["tabSize"]},{type:"number",minimum:1}],default:"tabSize",markdownDescription:w("indentSize",'The number of spaces used for indentation or `"tabSize"` to use the value from `#editor.tabSize#`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.')},"editor.insertSpaces":{type:"boolean",default:Va.insertSpaces,markdownDescription:w("insertSpaces","Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when {0} is on.","`#editor.detectIndentation#`")},"editor.detectIndentation":{type:"boolean",default:Va.detectIndentation,markdownDescription:w("detectIndentation","Controls whether {0} and {1} will be automatically detected when a file is opened based on the file contents.","`#editor.tabSize#`","`#editor.insertSpaces#`")},"editor.trimAutoWhitespace":{type:"boolean",default:Va.trimAutoWhitespace,description:w("trimAutoWhitespace","Remove trailing auto inserted whitespace.")},"editor.largeFileOptimizations":{type:"boolean",default:Va.largeFileOptimizations,description:w("largeFileOptimizations","Special handling for large files to disable certain memory intensive features.")},"editor.wordBasedSuggestions":{enum:["off","currentDocument","matchingDocuments","allDocuments"],default:"matchingDocuments",enumDescriptions:[w("wordBasedSuggestions.off","Turn off Word Based Suggestions."),w("wordBasedSuggestions.currentDocument","Only suggest words from the active document."),w("wordBasedSuggestions.matchingDocuments","Suggest words from all open documents of the same language."),w("wordBasedSuggestions.allDocuments","Suggest words from all open documents.")],description:w("wordBasedSuggestions","Controls whether completions should be computed based on words in the document and from which documents they are computed.")},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[w("semanticHighlighting.true","Semantic highlighting enabled for all color themes."),w("semanticHighlighting.false","Semantic highlighting disabled for all color themes."),w("semanticHighlighting.configuredByTheme","Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")],default:"configuredByTheme",description:w("semanticHighlighting.enabled","Controls whether the semanticHighlighting is shown for the languages that support it.")},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:w("stablePeek","Keep peek editors open even when double-clicking their content or when hitting `Escape`.")},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:w("maxTokenizationLineLength","Lines above this length will not be tokenized for performance reasons")},"editor.experimental.asyncTokenization":{type:"boolean",default:!0,description:w("editor.experimental.asyncTokenization","Controls whether the tokenization should happen asynchronously on a web worker."),tags:["experimental"]},"editor.experimental.asyncTokenizationLogging":{type:"boolean",default:!1,description:w("editor.experimental.asyncTokenizationLogging","Controls whether async tokenization should be logged. For debugging only.")},"editor.experimental.asyncTokenizationVerification":{type:"boolean",default:!1,description:w("editor.experimental.asyncTokenizationVerification","Controls whether async tokenization should be verified against legacy background tokenization. Might slow down tokenization. For debugging only."),tags:["experimental"]},"editor.experimental.treeSitterTelemetry":{type:"boolean",default:!1,markdownDescription:w("editor.experimental.treeSitterTelemetry","Controls whether tree sitter parsing should be turned on and telemetry collected. Setting `editor.experimental.preferTreeSitter` for specific languages will take precedence."),tags:["experimental"]},"editor.language.brackets":{type:["array","null"],default:null,description:w("schema.brackets","Defines the bracket symbols that increase or decrease the indentation."),items:{type:"array",items:[{type:"string",description:w("schema.openBracket","The opening bracket character or string sequence.")},{type:"string",description:w("schema.closeBracket","The closing bracket character or string sequence.")}]}},"editor.language.colorizedBracketPairs":{type:["array","null"],default:null,description:w("schema.colorizedBracketPairs","Defines the bracket pairs that are colorized by their nesting level if bracket pair colorization is enabled."),items:{type:"array",items:[{type:"string",description:w("schema.openBracket","The opening bracket character or string sequence.")},{type:"string",description:w("schema.closeBracket","The closing bracket character or string sequence.")}]}},"diffEditor.maxComputationTime":{type:"number",default:la.maxComputationTime,description:w("maxComputationTime","Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")},"diffEditor.maxFileSize":{type:"number",default:la.maxFileSize,description:w("maxFileSize","Maximum file size in MB for which to compute diffs. Use 0 for no limit.")},"diffEditor.renderSideBySide":{type:"boolean",default:la.renderSideBySide,description:w("sideBySide","Controls whether the diff editor shows the diff side by side or inline.")},"diffEditor.renderSideBySideInlineBreakpoint":{type:"number",default:la.renderSideBySideInlineBreakpoint,description:w("renderSideBySideInlineBreakpoint","If the diff editor width is smaller than this value, the inline view is used.")},"diffEditor.useInlineViewWhenSpaceIsLimited":{type:"boolean",default:la.useInlineViewWhenSpaceIsLimited,description:w("useInlineViewWhenSpaceIsLimited","If enabled and the editor width is too small, the inline view is used.")},"diffEditor.renderMarginRevertIcon":{type:"boolean",default:la.renderMarginRevertIcon,description:w("renderMarginRevertIcon","When enabled, the diff editor shows arrows in its glyph margin to revert changes.")},"diffEditor.renderGutterMenu":{type:"boolean",default:la.renderGutterMenu,description:w("renderGutterMenu","When enabled, the diff editor shows a special gutter for revert and stage actions.")},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:la.ignoreTrimWhitespace,description:w("ignoreTrimWhitespace","When enabled, the diff editor ignores changes in leading or trailing whitespace.")},"diffEditor.renderIndicators":{type:"boolean",default:la.renderIndicators,description:w("renderIndicators","Controls whether the diff editor shows +/- indicators for added/removed changes.")},"diffEditor.codeLens":{type:"boolean",default:la.diffCodeLens,description:w("codeLens","Controls whether the editor shows CodeLens.")},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:la.diffWordWrap,markdownEnumDescriptions:[w("wordWrap.off","Lines will never wrap."),w("wordWrap.on","Lines will wrap at the viewport width."),w("wordWrap.inherit","Lines will wrap according to the {0} setting.","`#editor.wordWrap#`")]},"diffEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:la.diffAlgorithm,markdownEnumDescriptions:[w("diffAlgorithm.legacy","Uses the legacy diffing algorithm."),w("diffAlgorithm.advanced","Uses the advanced diffing algorithm.")],tags:["experimental"]},"diffEditor.hideUnchangedRegions.enabled":{type:"boolean",default:la.hideUnchangedRegions.enabled,markdownDescription:w("hideUnchangedRegions.enabled","Controls whether the diff editor shows unchanged regions.")},"diffEditor.hideUnchangedRegions.revealLineCount":{type:"integer",default:la.hideUnchangedRegions.revealLineCount,markdownDescription:w("hideUnchangedRegions.revealLineCount","Controls how many lines are used for unchanged regions."),minimum:1},"diffEditor.hideUnchangedRegions.minimumLineCount":{type:"integer",default:la.hideUnchangedRegions.minimumLineCount,markdownDescription:w("hideUnchangedRegions.minimumLineCount","Controls how many lines are used as a minimum for unchanged regions."),minimum:1},"diffEditor.hideUnchangedRegions.contextLineCount":{type:"integer",default:la.hideUnchangedRegions.contextLineCount,markdownDescription:w("hideUnchangedRegions.contextLineCount","Controls how many lines are used as context when comparing unchanged regions."),minimum:1},"diffEditor.experimental.showMoves":{type:"boolean",default:la.experimental.showMoves,markdownDescription:w("showMoves","Controls whether the diff editor should show detected code moves.")},"diffEditor.experimental.showEmptyDecorations":{type:"boolean",default:la.experimental.showEmptyDecorations,description:w("showEmptyDecorations","Controls whether the diff editor shows empty decorations to see where characters got inserted or deleted.")},"diffEditor.experimental.useTrueInlineView":{type:"boolean",default:la.experimental.useTrueInlineView,description:w("useTrueInlineView","If enabled and the editor uses the inline view, word changes are rendered inline.")}}};function Bxt(n){return typeof n.type<"u"||typeof n.anyOf<"u"}for(const n of vS){const e=n.schema;if(typeof e<"u")if(Bxt(e))y8.properties[`editor.${n.name}`]=e;else for(const t in e)Object.hasOwnProperty.call(e,t)&&(y8.properties[t]=e[t])}let O4=null;function eFe(){return O4===null&&(O4=Object.create(null),Object.keys(y8.properties).forEach(n=>{O4[n]=!0})),O4}function $xt(n){return eFe()[`editor.${n}`]||!1}function Wxt(n){return eFe()[`diffEditor.${n}`]||!1}const Hxt=Yr.as(ff.Configuration);Hxt.registerConfiguration(y8);class jr{static insert(e,t){return{range:new $(e.lineNumber,e.column,e.lineNumber,e.column),text:t,forceMoveMarkers:!0}}static delete(e){return{range:e,text:null}}static replace(e,t){return{range:e,text:t}}static replaceMove(e,t){return{range:e,text:t,forceMoveMarkers:!0}}}function M4(n){return Object.isFrozen(n)?n:spt(n)}class Zo{static createEmptyModel(e){return new Zo({},[],[],void 0,e)}constructor(e,t,i,r,s){this._contents=e,this._keys=t,this._overrides=i,this.raw=r,this.logService=s,this.overrideConfigurations=new Map}get rawConfiguration(){if(!this._rawConfiguration)if(this.raw?.length){const e=this.raw.map(t=>{if(t instanceof Zo)return t;const i=new Vxt("",this.logService);return i.parseRaw(t),i.configurationModel});this._rawConfiguration=e.reduce((t,i)=>i===t?i:t.merge(i),e[0])}else this._rawConfiguration=this;return this._rawConfiguration}get contents(){return this._contents}get overrides(){return this._overrides}get keys(){return this._keys}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(e){return e?hbe(this.contents,e):this.contents}inspect(e,t){const i=this;return{get value(){return M4(i.rawConfiguration.getValue(e))},get override(){return t?M4(i.rawConfiguration.getOverrideValue(e,t)):void 0},get merged(){return M4(t?i.rawConfiguration.override(t).getValue(e):i.rawConfiguration.getValue(e))},get overrides(){const r=[];for(const{contents:s,identifiers:o,keys:a}of i.rawConfiguration.overrides){const l=new Zo(s,a,[],void 0,i.logService).getValue(e);l!==void 0&&r.push({identifiers:o,value:l})}return r.length?M4(r):void 0}}}getOverrideValue(e,t){const i=this.getContentsForOverrideIdentifer(t);return i?e?hbe(i,e):i:void 0}override(e){let t=this.overrideConfigurations.get(e);return t||(t=this.createOverrideConfigurationModel(e),this.overrideConfigurations.set(e,t)),t}merge(...e){const t=Qm(this.contents),i=Qm(this.overrides),r=[...this.keys],s=this.raw?.length?[...this.raw]:[this];for(const o of e)if(s.push(...o.raw?.length?o.raw:[o]),!o.isEmpty()){this.mergeContents(t,o.contents);for(const a of o.overrides){const[l]=i.filter(c=>$r(c.identifiers,a.identifiers));l?(this.mergeContents(l.contents,a.contents),l.keys.push(...a.keys),l.keys=j_(l.keys)):i.push(Qm(a))}for(const a of o.keys)r.indexOf(a)===-1&&r.push(a)}return new Zo(t,r,i,s.every(o=>o instanceof Zo)?void 0:s,this.logService)}createOverrideConfigurationModel(e){const t=this.getContentsForOverrideIdentifer(e);if(!t||typeof t!="object"||!Object.keys(t).length)return this;const i={};for(const r of j_([...Object.keys(this.contents),...Object.keys(t)])){let s=this.contents[r];const o=t[r];o&&(typeof s=="object"&&typeof o=="object"?(s=Qm(s),this.mergeContents(s,o)):s=o),i[r]=s}return new Zo(i,this.keys,this.overrides,void 0,this.logService)}mergeContents(e,t){for(const i of Object.keys(t)){if(i in e&&Mo(e[i])&&Mo(t[i])){this.mergeContents(e[i],t[i]);continue}e[i]=Qm(t[i])}}getContentsForOverrideIdentifer(e){let t=null,i=null;const r=s=>{s&&(i?this.mergeContents(i,s):i=Qm(s))};for(const s of this.overrides)s.identifiers.length===1&&s.identifiers[0]===e?t=s.contents:s.identifiers.includes(e)&&r(s.contents);return r(t),i}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}setValue(e,t){this.updateValue(e,t,!1)}removeValue(e){const t=this.keys.indexOf(e);t!==-1&&(this.keys.splice(t,1),qvt(this.contents,e),Eb.test(e)&&this.overrides.splice(this.overrides.findIndex(i=>$r(i.identifiers,e8(e))),1))}updateValue(e,t,i){if(M3e(this.contents,e,t,r=>this.logService.error(r)),i=i||this.keys.indexOf(e)===-1,i&&this.keys.push(e),Eb.test(e)){const r=e8(e),s={identifiers:r,keys:Object.keys(this.contents[e]),contents:EX(this.contents[e],a=>this.logService.error(a))},o=this.overrides.findIndex(a=>$r(a.identifiers,r));o!==-1?this.overrides[o]=s:this.overrides.push(s)}}}class Vxt{constructor(e,t){this._name=e,this.logService=t,this._raw=null,this._configurationModel=null,this._restrictedConfigurations=[]}get configurationModel(){return this._configurationModel||Zo.createEmptyModel(this.logService)}parseRaw(e,t){this._raw=e;const{contents:i,keys:r,overrides:s,restricted:o,hasExcludedProperties:a}=this.doParseRaw(e,t);this._configurationModel=new Zo(i,r,s,a?[e]:void 0,this.logService),this._restrictedConfigurations=o||[]}doParseRaw(e,t){const i=Yr.as(ff.Configuration).getConfigurationProperties(),r=this.filter(e,i,!0,t);e=r.raw;const s=EX(e,l=>this.logService.error(`Conflict in settings file ${this._name}: ${l}`)),o=Object.keys(e),a=this.toOverrides(e,l=>this.logService.error(`Conflict in settings file ${this._name}: ${l}`));return{contents:s,keys:o,overrides:a,restricted:r.restricted,hasExcludedProperties:r.hasExcludedProperties}}filter(e,t,i,r){let s=!1;if(!r?.scopes&&!r?.skipRestricted&&!r?.exclude?.length)return{raw:e,restricted:[],hasExcludedProperties:s};const o={},a=[];for(const l in e)if(Eb.test(l)&&i){const c=this.filter(e[l],t,!1,r);o[l]=c.raw,s=s||c.hasExcludedProperties,a.push(...c.restricted)}else{const c=t[l],u=c?typeof c.scope<"u"?c.scope:3:void 0;c?.restricted&&a.push(l),!r.exclude?.includes(l)&&(r.include?.includes(l)||(u===void 0||r.scopes===void 0||r.scopes.includes(u))&&!(r.skipRestricted&&c?.restricted))?o[l]=e[l]:s=!0}return{raw:o,restricted:a,hasExcludedProperties:s}}toOverrides(e,t){const i=[];for(const r of Object.keys(e))if(Eb.test(r)){const s={};for(const o in e[r])s[o]=e[r][o];i.push({identifiers:e8(r),keys:Object.keys(s),contents:EX(s,t)})}return i}}class zxt{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f){this.key=e,this.overrides=t,this._value=i,this.overrideIdentifiers=r,this.defaultConfiguration=s,this.policyConfiguration=o,this.applicationConfiguration=a,this.userConfiguration=l,this.localUserConfiguration=c,this.remoteUserConfiguration=u,this.workspaceConfiguration=d,this.folderConfigurationModel=h,this.memoryConfigurationModel=f}toInspectValue(e){return e?.value!==void 0||e?.override!==void 0||e?.overrides!==void 0?e:void 0}get userInspectValue(){return this._userInspectValue||(this._userInspectValue=this.userConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userInspectValue}get user(){return this.toInspectValue(this.userInspectValue)}}class yW{constructor(e,t,i,r,s,o,a,l,c,u){this._defaultConfiguration=e,this._policyConfiguration=t,this._applicationConfiguration=i,this._localUserConfiguration=r,this._remoteUserConfiguration=s,this._workspaceConfiguration=o,this._folderConfigurations=a,this._memoryConfiguration=l,this._memoryConfigurationByResource=c,this.logService=u,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations=new so,this._userConfiguration=null}getValue(e,t,i){return this.getConsolidatedConfigurationModel(e,t,i).getValue(e)}updateValue(e,t,i={}){let r;i.resource?(r=this._memoryConfigurationByResource.get(i.resource),r||(r=Zo.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(i.resource,r))):r=this._memoryConfiguration,t===void 0?r.removeValue(e):r.setValue(e,t),i.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(e,t,i){const r=this.getConsolidatedConfigurationModel(e,t,i),s=this.getFolderConfigurationModelForResource(t.resource,i),o=t.resource?this._memoryConfigurationByResource.get(t.resource)||this._memoryConfiguration:this._memoryConfiguration,a=new Set;for(const l of r.overrides)for(const c of l.identifiers)r.getOverrideValue(e,c)!==void 0&&a.add(c);return new zxt(e,t,r.getValue(e),a.size?[...a]:void 0,this._defaultConfiguration,this._policyConfiguration.isEmpty()?void 0:this._policyConfiguration,this.applicationConfiguration.isEmpty()?void 0:this.applicationConfiguration,this.userConfiguration,this.localUserConfiguration,this.remoteUserConfiguration,i?this._workspaceConfiguration:void 0,s||void 0,o)}get applicationConfiguration(){return this._applicationConfiguration}get userConfiguration(){return this._userConfiguration||(this._userConfiguration=this._remoteUserConfiguration.isEmpty()?this._localUserConfiguration:this._localUserConfiguration.merge(this._remoteUserConfiguration)),this._userConfiguration}get localUserConfiguration(){return this._localUserConfiguration}get remoteUserConfiguration(){return this._remoteUserConfiguration}getConsolidatedConfigurationModel(e,t,i){let r=this.getConsolidatedConfigurationModelForResource(t,i);return t.overrideIdentifier&&(r=r.override(t.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(e)!==void 0&&(r=r.merge(this._policyConfiguration)),r}getConsolidatedConfigurationModelForResource({resource:e},t){let i=this.getWorkspaceConsolidatedConfiguration();if(t&&e){const r=t.getFolder(e);r&&(i=this.getFolderConsolidatedConfiguration(r.uri)||i);const s=this._memoryConfigurationByResource.get(e);s&&(i=i.merge(s))}return i}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(e){let t=this._foldersConsolidatedConfigurations.get(e);if(!t){const i=this.getWorkspaceConsolidatedConfiguration(),r=this._folderConfigurations.get(e);r?(t=i.merge(r),this._foldersConsolidatedConfigurations.set(e,t)):t=i}return t}getFolderConfigurationModelForResource(e,t){if(t&&e){const i=t.getFolder(e);if(i)return this._folderConfigurations.get(i.uri)}}toData(){return{defaults:{contents:this._defaultConfiguration.contents,overrides:this._defaultConfiguration.overrides,keys:this._defaultConfiguration.keys},policy:{contents:this._policyConfiguration.contents,overrides:this._policyConfiguration.overrides,keys:this._policyConfiguration.keys},application:{contents:this.applicationConfiguration.contents,overrides:this.applicationConfiguration.overrides,keys:this.applicationConfiguration.keys},user:{contents:this.userConfiguration.contents,overrides:this.userConfiguration.overrides,keys:this.userConfiguration.keys},workspace:{contents:this._workspaceConfiguration.contents,overrides:this._workspaceConfiguration.overrides,keys:this._workspaceConfiguration.keys},folders:[...this._folderConfigurations.keys()].reduce((e,t)=>{const{contents:i,overrides:r,keys:s}=this._folderConfigurations.get(t);return e.push([t,{contents:i,overrides:r,keys:s}]),e},[])}}static parse(e,t){const i=this.parseConfigurationModel(e.defaults,t),r=this.parseConfigurationModel(e.policy,t),s=this.parseConfigurationModel(e.application,t),o=this.parseConfigurationModel(e.user,t),a=this.parseConfigurationModel(e.workspace,t),l=e.folders.reduce((c,u)=>(c.set(Pt.revive(u[0]),this.parseConfigurationModel(u[1],t)),c),new so);return new yW(i,r,s,o,Zo.createEmptyModel(t),a,l,Zo.createEmptyModel(t),new so,t)}static parseConfigurationModel(e,t){return new Zo(e.contents,e.keys,e.overrides,void 0,t)}}class Uxt{constructor(e,t,i,r,s){this.change=e,this.previous=t,this.currentConfiguraiton=i,this.currentWorkspace=r,this.logService=s,this._marker=` +`,this._markerCode1=this._marker.charCodeAt(0),this._markerCode2=46,this.affectedKeys=new Set,this._previousConfiguration=void 0;for(const o of e.keys)this.affectedKeys.add(o);for(const[,o]of e.overrides)for(const a of o)this.affectedKeys.add(a);this._affectsConfigStr=this._marker;for(const o of this.affectedKeys)this._affectsConfigStr+=o+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=yW.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(e,t){const i=this._marker+e,r=this._affectsConfigStr.indexOf(i);if(r<0)return!1;const s=r+i.length;if(s>=this._affectsConfigStr.length)return!1;const o=this._affectsConfigStr.charCodeAt(s);if(o!==this._markerCode1&&o!==this._markerCode2)return!1;if(t){const a=this.previousConfiguration?this.previousConfiguration.getValue(e,t,this.previous?.workspace):void 0,l=this.currentConfiguraiton.getValue(e,t,this.currentWorkspace);return!ru(a,l)}return!0}}class jxt{constructor(){this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._enabled=!0}get enabled(){return this._enabled}enable(){this._enabled=!0,this._onDidChange.fire()}disable(){this._enabled=!1,this._onDidChange.fire()}}const bI=new jxt,w8={kind:0},qxt={kind:1};function Kxt(n,e,t){return{kind:2,commandId:n,commandArgs:e,isBubble:t}}class yI{constructor(e,t,i){this._log=i,this._defaultKeybindings=e,this._defaultBoundCommands=new Map;for(const r of e){const s=r.command;s&&s.charAt(0)!=="-"&&this._defaultBoundCommands.set(s,!0)}this._map=new Map,this._lookupMap=new Map,this._keybindings=yI.handleRemovals([].concat(e).concat(t));for(let r=0,s=this._keybindings.length;r"u"){this._map.set(e,[t]),this._addToLookupMap(t);return}for(let r=i.length-1;r>=0;r--){const s=i[r];if(s.command===t.command)continue;let o=!0;for(let a=1;a"u"?(t=[e],this._lookupMap.set(e.command,t)):t.push(e)}_removeFromLookupMap(e){if(!e.command)return;const t=this._lookupMap.get(e.command);if(!(typeof t>"u")){for(let i=0,r=t.length;i"u"||i.length===0)return null;if(i.length===1)return i[0];for(let r=i.length-1;r>=0;r--){const s=i[r];if(t.contextMatchesRules(s.when))return s}return i[i.length-1]}resolve(e,t,i){const r=[...t,i];this._log(`| Resolving ${r}`);const s=this._map.get(r[0]);if(s===void 0)return this._log("\\ No keybinding entries."),w8;let o=null;if(r.length<2)o=s;else{o=[];for(let l=0,c=s.length;lu.chords.length)continue;let d=!0;for(let h=1;h=0;i--){const r=t[i];if(yI._contextMatchesRules(e,r.when))return r}return null}static _contextMatchesRules(e,t){return t?t.evaluate(e):!0}}function $1e(n){return n?`${n.serialize()}`:"no when condition"}function W1e(n){return n.extensionId?n.isBuiltinExtension?`built-in extension ${n.extensionId}`:`user extension ${n.extensionId}`:n.isDefault?"built-in":"user"}const Gxt=/^(cursor|delete|undo|redo|tab|editor\.action\.clipboard)/;class Yxt extends me{get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:Ge.None}get inChordMode(){return this._currentChords.length>0}constructor(e,t,i,r,s){super(),this._contextKeyService=e,this._commandService=t,this._telemetryService=i,this._notificationService=r,this._logService=s,this._onDidUpdateKeybindings=this._register(new fe),this._currentChords=[],this._currentChordChecker=new Mae,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=kS.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new hf,this._currentlyDispatchingCommandId=null,this._logging=!1}dispose(){super.dispose()}_log(e){this._logging&&this._logService.info(`[KeybindingService]: ${e}`)}getKeybindings(){return this._getResolver().getKeybindings()}lookupKeybinding(e,t){const i=this._getResolver().lookupPrimaryKeybinding(e,t||this._contextKeyService);if(i)return i.resolvedKeybinding}dispatchEvent(e,t){return this._dispatch(e,t)}softDispatch(e,t){this._log("/ Soft dispatching keyboard event");const i=this.resolveKeyboardEvent(e);if(i.hasMultipleChords())return console.warn("keyboard event should not be mapped to multiple chords"),w8;const[r]=i.getDispatchChords();if(r===null)return this._log("\\ Keyboard event cannot be dispatched"),w8;const s=this._contextKeyService.getContext(t),o=this._currentChords.map(({keypress:a})=>a);return this._getResolver().resolve(s,o,r)}_scheduleLeaveChordMode(){const e=Date.now();this._currentChordChecker.cancelAndSet(()=>{if(!this._documentHasFocus()){this._leaveChordMode();return}Date.now()-e>5e3&&this._leaveChordMode()},500)}_expectAnotherChord(e,t){switch(this._currentChords.push({keypress:e,label:t}),this._currentChords.length){case 0:throw bae("impossible");case 1:this._currentChordStatusMessage=this._notificationService.status(w("first.chord","({0}) was pressed. Waiting for second key of chord...",t));break;default:{const i=this._currentChords.map(({label:r})=>r).join(", ");this._currentChordStatusMessage=this._notificationService.status(w("next.chord","({0}) was pressed. Waiting for next key of chord...",i))}}this._scheduleLeaveChordMode(),bI.enabled&&bI.disable()}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.dispose(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChords=[],bI.enable()}_dispatch(e,t){return this._doDispatch(this.resolveKeyboardEvent(e),t,!1)}_singleModifierDispatch(e,t){const i=this.resolveKeyboardEvent(e),[r]=i.getSingleModifierDispatchChords();if(r)return this._ignoreSingleModifiers.has(r)?(this._log(`+ Ignoring single modifier ${r} due to it being pressed together with other keys.`),this._ignoreSingleModifiers=kS.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=kS.EMPTY,this._currentSingleModifier===null?(this._log(`+ Storing single modifier for possible chord ${r}.`),this._currentSingleModifier=r,this._currentSingleModifierClearTimeout.cancelAndSet(()=>{this._log("+ Clearing single modifier due to 300ms elapsed."),this._currentSingleModifier=null},300),!1):r===this._currentSingleModifier?(this._log(`/ Dispatching single modifier chord ${r} ${r}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,this._doDispatch(i,t,!0)):(this._log(`+ Clearing single modifier due to modifier mismatch: ${this._currentSingleModifier} ${r}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1));const[s]=i.getChords();return this._ignoreSingleModifiers=new kS(s),this._currentSingleModifier!==null&&this._log("+ Clearing single modifier due to other key up."),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1}_doDispatch(e,t,i=!1){let r=!1;if(e.hasMultipleChords())return console.warn("Unexpected keyboard event mapped to multiple chords"),!1;let s=null,o=null;if(i){const[u]=e.getSingleModifierDispatchChords();s=u,o=u?[u]:[]}else[s]=e.getDispatchChords(),o=this._currentChords.map(({keypress:u})=>u);if(s===null)return this._log("\\ Keyboard event cannot be dispatched in keydown phase."),r;const a=this._contextKeyService.getContext(t),l=e.getLabel(),c=this._getResolver().resolve(a,o,s);switch(c.kind){case 0:{if(this._logService.trace("KeybindingService#dispatch",l,"[ No matching keybinding ]"),this.inChordMode){const u=this._currentChords.map(({label:d})=>d).join(", ");this._log(`+ Leaving multi-chord mode: Nothing bound to "${u}, ${l}".`),this._notificationService.status(w("missing.chord","The key combination ({0}, {1}) is not a command.",u,l),{hideAfter:10*1e3}),this._leaveChordMode(),r=!0}return r}case 1:return this._logService.trace("KeybindingService#dispatch",l,"[ Several keybindings match - more chords needed ]"),r=!0,this._expectAnotherChord(s,l),this._log(this._currentChords.length===1?"+ Entering multi-chord mode...":"+ Continuing multi-chord mode..."),r;case 2:{if(this._logService.trace("KeybindingService#dispatch",l,`[ Will dispatch command ${c.commandId} ]`),c.commandId===null||c.commandId===""){if(this.inChordMode){const u=this._currentChords.map(({label:d})=>d).join(", ");this._log(`+ Leaving chord mode: Nothing bound to "${u}, ${l}".`),this._notificationService.status(w("missing.chord","The key combination ({0}, {1}) is not a command.",u,l),{hideAfter:10*1e3}),this._leaveChordMode(),r=!0}}else{this.inChordMode&&this._leaveChordMode(),c.isBubble||(r=!0),this._log(`+ Invoking command ${c.commandId}.`),this._currentlyDispatchingCommandId=c.commandId;try{typeof c.commandArgs>"u"?this._commandService.executeCommand(c.commandId).then(void 0,u=>this._notificationService.warn(u)):this._commandService.executeCommand(c.commandId,c.commandArgs).then(void 0,u=>this._notificationService.warn(u))}finally{this._currentlyDispatchingCommandId=null}Gxt.test(c.commandId)||this._telemetryService.publicLog2("workbenchActionExecuted",{id:c.commandId,from:"keybinding",detail:e.getUserSettingsLabel()??void 0})}return r}}}mightProducePrintableCharacter(e){return e.ctrlKey||e.metaKey?!1:e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30}}class kS{static{this.EMPTY=new kS(null)}constructor(e){this._ctrlKey=e?e.ctrlKey:!1,this._shiftKey=e?e.shiftKey:!1,this._altKey=e?e.altKey:!1,this._metaKey=e?e.metaKey:!1}has(e){switch(e){case"ctrl":return this._ctrlKey;case"shift":return this._shiftKey;case"alt":return this._altKey;case"meta":return this._metaKey}}}class H1e{constructor(e,t,i,r,s,o,a){this._resolvedKeybindingItemBrand=void 0,this.resolvedKeybinding=e,this.chords=e?dQ(e.getDispatchChords()):[],e&&this.chords.length===0&&(this.chords=dQ(e.getSingleModifierDispatchChords())),this.bubble=t?t.charCodeAt(0)===94:!1,this.command=this.bubble?t.substr(1):t,this.commandArgs=i,this.when=r,this.isDefault=s,this.extensionId=o,this.isBuiltinExtension=a}}function dQ(n){const e=[];for(let t=0,i=n.length;tthis._getLabel(e))}getAriaLabel(){return Zxt.toLabel(this._os,this._chords,e=>this._getAriaLabel(e))}getElectronAccelerator(){return this._chords.length>1||this._chords[0].isDuplicateModifierCase()?null:Xxt.toLabel(this._os,this._chords,e=>this._getElectronAccelerator(e))}getUserSettingsLabel(){return Qxt.toLabel(this._os,this._chords,e=>this._getUserSettingsLabel(e))}hasMultipleChords(){return this._chords.length>1}getChords(){return this._chords.map(e=>this._getChord(e))}_getChord(e){return new S_t(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,this._getLabel(e),this._getAriaLabel(e))}getDispatchChords(){return this._chords.map(e=>this._getChordDispatch(e))}getSingleModifierDispatchChords(){return this._chords.map(e=>this._getSingleModifierChordDispatch(e))}}class EN extends eSt{constructor(e,t){super(t,e)}_keyCodeToUILabel(e){if(this._os===2)switch(e){case 15:return"←";case 16:return"↑";case 17:return"→";case 18:return"↓"}return r_.toString(e)}_getLabel(e){return e.isDuplicateModifierCase()?"":this._keyCodeToUILabel(e.keyCode)}_getAriaLabel(e){return e.isDuplicateModifierCase()?"":r_.toString(e.keyCode)}_getElectronAccelerator(e){return r_.toElectronAccelerator(e.keyCode)}_getUserSettingsLabel(e){if(e.isDuplicateModifierCase())return"";const t=r_.toUserSettingsUS(e.keyCode);return t&&t.toLowerCase()}_getChordDispatch(e){return EN.getDispatchStr(e)}static getDispatchStr(e){if(e.isModifierKey())return null;let t="";return e.ctrlKey&&(t+="ctrl+"),e.shiftKey&&(t+="shift+"),e.altKey&&(t+="alt+"),e.metaKey&&(t+="meta+"),t+=r_.toString(e.keyCode),t}_getSingleModifierChordDispatch(e){return e.keyCode===5&&!e.shiftKey&&!e.altKey&&!e.metaKey?"ctrl":e.keyCode===4&&!e.ctrlKey&&!e.altKey&&!e.metaKey?"shift":e.keyCode===6&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey?"alt":e.keyCode===57&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?"meta":null}static _scanCodeToKeyCode(e){const t=Sae[e];if(t!==-1)return t;switch(e){case 10:return 31;case 11:return 32;case 12:return 33;case 13:return 34;case 14:return 35;case 15:return 36;case 16:return 37;case 17:return 38;case 18:return 39;case 19:return 40;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 45;case 25:return 46;case 26:return 47;case 27:return 48;case 28:return 49;case 29:return 50;case 30:return 51;case 31:return 52;case 32:return 53;case 33:return 54;case 34:return 55;case 35:return 56;case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 21;case 51:return 88;case 52:return 86;case 53:return 92;case 54:return 94;case 55:return 93;case 56:return 0;case 57:return 85;case 58:return 95;case 59:return 91;case 60:return 87;case 61:return 89;case 62:return 90;case 106:return 97}return 0}static _toKeyCodeChord(e){if(!e)return null;if(e instanceof G_)return e;const t=this._scanCodeToKeyCode(e.scanCode);return t===0?null:new G_(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t)}static resolveKeybinding(e,t){const i=dQ(e.chords.map(r=>this._toKeyCodeChord(r)));return i.length>0?[new EN(i,t)]:[]}}const pE=On("labelService"),tFe=On("progressService");let p_=class{static{this.None=Object.freeze({report(){}})}constructor(e){this.callback=e}report(e){this._value=e,this.callback(this._value)}};const Qb=On("editorProgressService");class tSt{constructor(){this._value="",this._pos=0}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos=0;t--,this._valueLen--){const i=this._value.charCodeAt(t);if(!(i===47||this._splitOnBackslash&&i===92))break}return this.next()}hasNext(){return this._to!1,t=()=>!1){return new fk(new rSt(e,t))}static forStrings(){return new fk(new tSt)}static forConfigKeys(){return new fk(new nSt)}constructor(e){this._iter=e}clear(){this._root=void 0}set(e,t){const i=this._iter.reset(e);let r;this._root||(this._root=new F4,this._root.segment=i.value());const s=[];for(r=this._root;;){const a=i.cmp(r.segment);if(a>0)r.left||(r.left=new F4,r.left.segment=i.value()),s.push([-1,r]),r=r.left;else if(a<0)r.right||(r.right=new F4,r.right.segment=i.value()),s.push([1,r]),r=r.right;else if(i.hasNext())i.next(),r.mid||(r.mid=new F4,r.mid.segment=i.value()),s.push([0,r]),r=r.mid;else break}const o=r.value;r.value=t,r.key=e;for(let a=s.length-1;a>=0;a--){const l=s[a][1];l.updateHeight();const c=l.balanceFactor();if(c<-1||c>1){const u=s[a][0],d=s[a+1][0];if(u===1&&d===1)s[a][1]=l.rotateLeft();else if(u===-1&&d===-1)s[a][1]=l.rotateRight();else if(u===1&&d===-1)l.right=s[a+1][1]=s[a+1][1].rotateRight(),s[a][1]=l.rotateLeft();else if(u===-1&&d===1)l.left=s[a+1][1]=s[a+1][1].rotateLeft(),s[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(s[a-1][0]){case-1:s[a-1][1].left=s[a][1];break;case 1:s[a-1][1].right=s[a][1];break;case 0:s[a-1][1].mid=s[a][1];break}else this._root=s[0][1]}}return o}get(e){return this._getNode(e)?.value}_getNode(e){const t=this._iter.reset(e);let i=this._root;for(;i;){const r=t.cmp(i.segment);if(r>0)i=i.left;else if(r<0)i=i.right;else if(t.hasNext())t.next(),i=i.mid;else break}return i}has(e){const t=this._getNode(e);return!(t?.value===void 0&&t?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){const i=this._iter.reset(e),r=[];let s=this._root;for(;s;){const o=i.cmp(s.segment);if(o>0)r.push([-1,s]),s=s.left;else if(o<0)r.push([1,s]),s=s.right;else if(i.hasNext())i.next(),r.push([0,s]),s=s.mid;else break}if(s){if(t?(s.left=void 0,s.mid=void 0,s.right=void 0,s.height=1):(s.key=void 0,s.value=void 0),!s.mid&&!s.value)if(s.left&&s.right){const o=this._min(s.right);if(o.key){const{key:a,value:l,segment:c}=o;this._delete(o.key,!1),s.key=a,s.value=l,s.segment=c}}else{const o=s.left??s.right;if(r.length>0){const[a,l]=r[r.length-1];switch(a){case-1:l.left=o;break;case 0:l.mid=o;break;case 1:l.right=o;break}}else this._root=o}for(let o=r.length-1;o>=0;o--){const a=r[o][1];a.updateHeight();const l=a.balanceFactor();if(l>1?(a.right.balanceFactor()>=0||(a.right=a.right.rotateRight()),r[o][1]=a.rotateLeft()):l<-1&&(a.left.balanceFactor()<=0||(a.left=a.left.rotateLeft()),r[o][1]=a.rotateRight()),o>0)switch(r[o-1][0]){case-1:r[o-1][1].left=r[o][1];break;case 1:r[o-1][1].right=r[o][1];break;case 0:r[o-1][1].mid=r[o][1];break}else this._root=r[0][1]}}}_min(e){for(;e.left;)e=e.left;return e}findSubstr(e){const t=this._iter.reset(e);let i=this._root,r;for(;i;){const s=t.cmp(i.segment);if(s>0)i=i.left;else if(s<0)i=i.right;else if(t.hasNext())t.next(),r=i.value||r,i=i.mid;else break}return i&&i.value||r}findSuperstr(e){return this._findSuperstrOrElement(e,!1)}_findSuperstrOrElement(e,t){const i=this._iter.reset(e);let r=this._root;for(;r;){const s=i.cmp(r.segment);if(s>0)r=r.left;else if(s<0)r=r.right;else if(i.hasNext())i.next(),r=r.mid;else return r.mid?this._entries(r.mid):t?r.value:void 0}}forEach(e){for(const[t,i]of this)e(i,t)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(e){const t=[];return this._dfsEntries(e,t),t[Symbol.iterator]()}_dfsEntries(e,t){e&&(e.left&&this._dfsEntries(e.left,t),e.value&&t.push([e.key,e.value]),e.mid&&this._dfsEntries(e.mid,t),e.right&&this._dfsEntries(e.right,t))}}const Mw=On("contextService");function hQ(n){const e=n;return typeof e?.id=="string"&&Pt.isUri(e.uri)}function sSt(n){return typeof n?.id=="string"&&!hQ(n)&&!lSt(n)}const oSt={id:"empty-window"};function aSt(n,e){if(typeof n=="string"||typeof n>"u")return typeof n=="string"?{id:rb(n)}:oSt;const t=n;return t.configuration?{id:t.id,configPath:t.configuration}:t.folders.length===1?{id:t.id,uri:t.folders[0].uri}:{id:t.id}}function lSt(n){const e=n;return typeof e?.id=="string"&&Pt.isUri(e.configPath)}let cSt=class{constructor(e,t){this.raw=t,this.uri=e.uri,this.index=e.index,this.name=e.name}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}};const fQ="code-workspace";w("codeWorkspace","Code Workspace");const nFe="4064f6ec-cb38-4ad0-af64-ee6467e63c82";function uSt(n){return n.id===nFe}var gQ;(function(n){n.inspectTokensAction=w("inspectTokens","Developer: Inspect Tokens")})(gQ||(gQ={}));var C8;(function(n){n.gotoLineActionLabel=w("gotoLineActionLabel","Go to Line/Column...")})(C8||(C8={}));var pQ;(function(n){n.helpQuickAccessActionLabel=w("helpQuickAccess","Show all Quick Access Providers")})(pQ||(pQ={}));var x8;(function(n){n.quickCommandActionLabel=w("quickCommandActionLabel","Command Palette"),n.quickCommandHelp=w("quickCommandActionHelp","Show And Run Commands")})(x8||(x8={}));var LN;(function(n){n.quickOutlineActionLabel=w("quickOutlineActionLabel","Go to Symbol..."),n.quickOutlineByCategoryActionLabel=w("quickOutlineByCategoryActionLabel","Go to Symbol by Category...")})(LN||(LN={}));var mQ;(function(n){n.editorViewAccessibleLabel=w("editorViewAccessibleLabel","Editor content")})(mQ||(mQ={}));var _Q;(function(n){n.toggleHighContrast=w("toggleHighContrast","Toggle High Contrast Theme")})(_Q||(_Q={}));var vQ;(function(n){n.bulkEditServiceSummary=w("bulkEditServiceSummary","Made {0} edits in {1} files")})(vQ||(vQ={}));const iFe=On("workspaceTrustManagementService");let mE=[],Mle=[],rFe=[];function B4(n,e=!1){dSt(n,!1,e)}function dSt(n,e,t){const i=hSt(n,e);mE.push(i),i.userConfigured?rFe.push(i):Mle.push(i),t&&!i.userConfigured&&mE.forEach(r=>{r.mime===i.mime||r.userConfigured||(i.extension&&r.extension===i.extension&&console.warn(`Overwriting extension <<${i.extension}>> to now point to mime <<${i.mime}>>`),i.filename&&r.filename===i.filename&&console.warn(`Overwriting filename <<${i.filename}>> to now point to mime <<${i.mime}>>`),i.filepattern&&r.filepattern===i.filepattern&&console.warn(`Overwriting filepattern <<${i.filepattern}>> to now point to mime <<${i.mime}>>`),i.firstline&&r.firstline===i.firstline&&console.warn(`Overwriting firstline <<${i.firstline}>> to now point to mime <<${i.mime}>>`))})}function hSt(n,e){return{id:n.id,mime:n.mime,filename:n.filename,extension:n.extension,filepattern:n.filepattern,firstline:n.firstline,userConfigured:e,filenameLowercase:n.filename?n.filename.toLowerCase():void 0,extensionLowercase:n.extension?n.extension.toLowerCase():void 0,filepatternLowercase:n.filepattern?h5e(n.filepattern.toLowerCase()):void 0,filepatternOnPath:n.filepattern?n.filepattern.indexOf(Ms.sep)>=0:!1}}function fSt(){mE=mE.filter(n=>n.userConfigured),Mle=[]}function gSt(n,e){return pSt(n,e).map(t=>t.id)}function pSt(n,e){let t;if(n)switch(n.scheme){case sn.file:t=n.fsPath;break;case sn.data:{t=Tb.parseMetaData(n).get(Tb.META_DATA_LABEL);break}case sn.vscodeNotebookCell:t=void 0;break;default:t=n.path}if(!t)return[{id:"unknown",mime:ps.unknown}];t=t.toLowerCase();const i=rb(t),r=V1e(t,i,rFe);if(r)return[r,{id:Hl,mime:ps.text}];const s=V1e(t,i,Mle);if(s)return[s,{id:Hl,mime:ps.text}];if(e){const o=mSt(e);if(o)return[o,{id:Hl,mime:ps.text}]}return[{id:"unknown",mime:ps.unknown}]}function V1e(n,e,t){let i,r,s;for(let o=t.length-1;o>=0;o--){const a=t[o];if(e===a.filenameLowercase){i=a;break}if(a.filepattern&&(!r||a.filepattern.length>r.filepattern.length)){const l=a.filepatternOnPath?n:e;a.filepatternLowercase?.(l)&&(r=a)}a.extension&&(!s||a.extension.length>s.extension.length)&&e.endsWith(a.extensionLowercase)&&(s=a)}if(i)return i;if(r)return r;if(s)return s}function mSt(n){if(Nae(n)&&(n=n.substr(1)),n.length>0)for(let e=mE.length-1;e>=0;e--){const t=mE[e];if(!t.firstline)continue;const i=n.match(t.firstline);if(i&&i.length>0)return t}}const $4=Object.prototype.hasOwnProperty,z1e="vs.editor.nullLanguage";class _St{constructor(){this._languageIdToLanguage=[],this._languageToLanguageId=new Map,this._register(z1e,0),this._register(Hl,1),this._nextLanguageId=2}_register(e,t){this._languageIdToLanguage[t]=e,this._languageToLanguageId.set(e,t)}register(e){if(this._languageToLanguageId.has(e))return;const t=this._nextLanguageId++;this._register(e,t)}encodeLanguageId(e){return this._languageToLanguageId.get(e)||0}decodeLanguageId(e){return this._languageIdToLanguage[e]||z1e}}class S8 extends me{static{this.instanceCount=0}constructor(e=!0,t=!1){super(),this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,S8.instanceCount++,this._warnOnOverwrite=t,this.languageIdCodec=new _St,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(sE.onDidChangeLanguages(i=>{this._initializeFromRegistry()})))}dispose(){S8.instanceCount--,super.dispose()}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},fSt();const e=[].concat(sE.getLanguages()).concat(this._dynamicLanguages);this._registerLanguages(e)}_registerLanguages(e){for(const t of e)this._registerLanguage(t);this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Object.keys(this._languages).forEach(t=>{const i=this._languages[t];i.name&&(this._nameMap[i.name]=i.identifier),i.aliases.forEach(r=>{this._lowercaseNameMap[r.toLowerCase()]=i.identifier}),i.mimetypes.forEach(r=>{this._mimeTypesMap[r]=i.identifier})}),Yr.as(ff.Configuration).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){const t=e.id;let i;$4.call(this._languages,t)?i=this._languages[t]:(this.languageIdCodec.register(t),i={identifier:t,name:null,mimetypes:[],aliases:[],extensions:[],filenames:[],configurationFiles:[],icons:[]},this._languages[t]=i),this._mergeLanguage(i,e)}_mergeLanguage(e,t){const i=t.id;let r=null;if(Array.isArray(t.mimetypes)&&t.mimetypes.length>0&&(e.mimetypes.push(...t.mimetypes),r=t.mimetypes[0]),r||(r=`text/x-${i}`,e.mimetypes.push(r)),Array.isArray(t.extensions)){t.configuration?e.extensions=t.extensions.concat(e.extensions):e.extensions=e.extensions.concat(t.extensions);for(const a of t.extensions)B4({id:i,mime:r,extension:a},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(const a of t.filenames)B4({id:i,mime:r,filename:a},this._warnOnOverwrite),e.filenames.push(a);if(Array.isArray(t.filenamePatterns))for(const a of t.filenamePatterns)B4({id:i,mime:r,filepattern:a},this._warnOnOverwrite);if(typeof t.firstLine=="string"&&t.firstLine.length>0){let a=t.firstLine;a.charAt(0)!=="^"&&(a="^"+a);try{const l=new RegExp(a);u_t(l)||B4({id:i,mime:r,firstline:l},this._warnOnOverwrite)}catch(l){console.warn(`[${t.id}]: Invalid regular expression \`${a}\`: `,l)}}e.aliases.push(i);let s=null;if(typeof t.aliases<"u"&&Array.isArray(t.aliases)&&(t.aliases.length===0?s=[null]:s=t.aliases),s!==null)for(const a of s)!a||a.length===0||e.aliases.push(a);const o=s!==null&&s.length>0;if(!(o&&s[0]===null)){const a=(o?s[0]:null)||i;(o||!e.name)&&(e.name=a)}t.configuration&&e.configurationFiles.push(t.configuration),t.icon&&e.icons.push(t.icon)}isRegisteredLanguageId(e){return e?$4.call(this._languages,e):!1}getRegisteredLanguageIds(){return Object.keys(this._languages)}getLanguageIdByLanguageName(e){const t=e.toLowerCase();return $4.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&$4.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){return!e&&!t?[]:gSt(e,t)}}const rd=(n,e)=>n===e;function k8(n=rd){return(e,t)=>$r(e,t,n)}function vSt(){return(n,e)=>n.equals(e)}function bQ(n,e,t){if(t!==void 0){const i=n;return i==null||e===void 0||e===null?e===i:t(i,e)}else{const i=n;return(r,s)=>r==null||s===void 0||s===null?s===r:i(r,s)}}function E8(n,e){if(n===e)return!0;if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return!1;for(let t=0;t{const s=Fle(r);if(s!==void 0)return s;const a=/^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(r.toString());if(a)return`${this.debugName}.${a[2]}`;if(!i)return`${this.debugName} (mapped)`},debugReferenceFn:r},s=>r(this.read(s),s))}flatten(){return wQ({owner:void 0,debugName:()=>`${this.debugName} (flattened)`},e=>this.read(e).read(e))}recomputeInitiallyAndOnChange(e,t){return e.add(oFe(this,t)),this}keepObserved(e){return e.add(aFe(this)),this}}class n2 extends lFe{constructor(){super(...arguments),this.observers=new Set}addObserver(e){const t=this.observers.size;this.observers.add(e),t===0&&this.onFirstObserverAdded()}removeObserver(e){this.observers.delete(e)&&this.observers.size===0&&this.onLastObserverRemoved()}onFirstObserverAdded(){}onLastObserverRemoved(){}}function qr(n,e){const t=new i2(n,e);try{n(t)}finally{t.finish()}}let W4;function ID(n){if(W4)n(W4);else{const e=new i2(n,void 0);W4=e;try{n(e)}finally{e.finish(),W4=void 0}}}async function cFe(n,e){const t=new i2(n,e);try{await n(t)}finally{t.finish()}}function Fw(n,e,t){n?e(n):qr(e,t)}class i2{constructor(e,t){this._fn=e,this._getDebugName=t,this.updatingObservers=[]}getDebugName(){return this._getDebugName?this._getDebugName():Fle(this._fn)}updateObserver(e,t){this.updatingObservers.push({observer:e,observable:t}),e.beginUpdate(t)}finish(){const e=this.updatingObservers;for(let t=0;t{},()=>`Setting ${this.debugName}`));try{const s=this._value;this._setValue(e),sFe()?.handleObservableChanged(this,{oldValue:s,newValue:e,change:i,didChange:!0,hadValue:!0});for(const o of this.observers)t.updateObserver(o,this),o.handleChange(this,i)}finally{r&&r.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}}function TN(n,e){let t;return typeof n=="string"?t=new Za(void 0,n,void 0):t=new Za(n,void 0,void 0),new TSt(t,e,rd)}class TSt extends Ble{_setValue(e){this._value!==e&&(this._value&&this._value.dispose(),this._value=e)}dispose(){this._value?.dispose()}}function St(n,e){return e!==void 0?new Bw(new Za(n,void 0,e),e,void 0,void 0,void 0,rd):new Bw(new Za(void 0,void 0,n),n,void 0,void 0,void 0,rd)}function oO(n,e,t){return new DSt(new Za(n,void 0,e),e,void 0,void 0,void 0,rd,t)}function $u(n,e){return new Bw(new Za(n.owner,n.debugName,n.debugReferenceFn),e,void 0,void 0,n.onLastObserverRemoved,n.equalsFn??rd)}LSt($u);function uFe(n,e){return new Bw(new Za(n.owner,n.debugName,void 0),e,n.createEmptyChangeSummary,n.handleChange,void 0,n.equalityComparer??rd)}function Jb(n,e){let t,i;e===void 0?(t=n,i=void 0):(i=n,t=e);const r=new ke;return new Bw(new Za(i,void 0,t),s=>(r.clear(),t(s,r)),void 0,void 0,()=>r.dispose(),rd)}function hl(n,e){let t,i;e===void 0?(t=n,i=void 0):(i=n,t=e);let r;return new Bw(new Za(i,void 0,t),s=>{r?r.clear():r=new ke;const o=t(s);return o&&r.add(o),o},void 0,void 0,()=>{r&&(r.dispose(),r=void 0)},rd)}class Bw extends n2{get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}constructor(e,t,i,r,s=void 0,o){super(),this._debugNameData=e,this._computeFn=t,this.createChangeSummary=i,this._handleChange=r,this._handleLastObserverRemoved=s,this._equalityComparator=o,this.state=0,this.value=void 0,this.updateCount=0,this.dependencies=new Set,this.dependenciesToBeRemoved=new Set,this.changeSummary=void 0,this.changeSummary=this.createChangeSummary?.()}onLastObserverRemoved(){this.state=0,this.value=void 0;for(const e of this.dependencies)e.removeObserver(this);this.dependencies.clear(),this._handleLastObserverRemoved?.()}get(){if(this.observers.size===0){const e=this._computeFn(this,this.createChangeSummary?.());return this.onLastObserverRemoved(),e}else{do{if(this.state===1){for(const e of this.dependencies)if(e.reportChanges(),this.state===2)break}this.state===1&&(this.state=3),this._recomputeIfNeeded()}while(this.state!==3);return this.value}}_recomputeIfNeeded(){if(this.state===3)return;const e=this.dependenciesToBeRemoved;this.dependenciesToBeRemoved=this.dependencies,this.dependencies=e;const t=this.state!==0,i=this.value;this.state=3;const r=this.changeSummary;this.changeSummary=this.createChangeSummary?.();try{this.value=this._computeFn(this,r)}finally{for(const o of this.dependenciesToBeRemoved)o.removeObserver(this);this.dependenciesToBeRemoved.clear()}if(t&&!this._equalityComparator(i,this.value))for(const o of this.observers)o.handleChange(this,void 0)}toString(){return`LazyDerived<${this.debugName}>`}beginUpdate(e){this.updateCount++;const t=this.updateCount===1;if(this.state===3&&(this.state=1,!t))for(const i of this.observers)i.handlePossibleChange(this);if(t)for(const i of this.observers)i.beginUpdate(this)}endUpdate(e){if(this.updateCount--,this.updateCount===0){const t=[...this.observers];for(const i of t)i.endUpdate(this)}Nw(()=>this.updateCount>=0)}handlePossibleChange(e){if(this.state===3&&this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)){this.state=1;for(const t of this.observers)t.handlePossibleChange(this)}}handleChange(e,t){if(this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)){const i=this._handleChange?this._handleChange({changedObservable:e,change:t,didChange:s=>s===e},this.changeSummary):!0,r=this.state===3;if(i&&(this.state===1||r)&&(this.state=2,r))for(const s of this.observers)s.handlePossibleChange(this)}}readObservable(e){e.addObserver(this);const t=e.get();return this.dependencies.add(e),this.dependenciesToBeRemoved.delete(e),t}addObserver(e){const t=!this.observers.has(e)&&this.updateCount>0;super.addObserver(e),t&&e.beginUpdate(this)}removeObserver(e){const t=this.observers.has(e)&&this.updateCount>0;super.removeObserver(e),t&&e.endUpdate(this)}}class DSt extends Bw{constructor(e,t,i,r,s=void 0,o,a){super(e,t,i,r,s,o),this.set=a}}function tn(n){return new CW(new Za(void 0,void 0,n),n,void 0,void 0)}function aO(n,e){return new CW(new Za(n.owner,n.debugName,n.debugReferenceFn??e),e,void 0,void 0)}function lO(n,e){return new CW(new Za(n.owner,n.debugName,n.debugReferenceFn??e),e,n.createEmptyChangeSummary,n.handleChange)}function ISt(n,e){const t=new ke,i=lO({owner:n.owner,debugName:n.debugName,debugReferenceFn:n.debugReferenceFn??e,createEmptyChangeSummary:n.createEmptyChangeSummary,handleChange:n.handleChange},(r,s)=>{t.clear(),e(r,s,t)});return Lt(()=>{i.dispose(),t.dispose()})}function wc(n){const e=new ke,t=aO({owner:void 0,debugName:void 0,debugReferenceFn:n},i=>{e.clear(),n(i,e)});return Lt(()=>{t.dispose(),e.dispose()})}class CW{get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}constructor(e,t,i,r){this._debugNameData=e,this._runFn=t,this.createChangeSummary=i,this._handleChange=r,this.state=2,this.updateCount=0,this.disposed=!1,this.dependencies=new Set,this.dependenciesToBeRemoved=new Set,this.changeSummary=this.createChangeSummary?.(),this._runIfNeeded()}dispose(){this.disposed=!0;for(const e of this.dependencies)e.removeObserver(this);this.dependencies.clear()}_runIfNeeded(){if(this.state===3)return;const e=this.dependenciesToBeRemoved;this.dependenciesToBeRemoved=this.dependencies,this.dependencies=e,this.state=3;const t=this.disposed;try{if(!t){sFe()?.handleAutorunTriggered(this);const i=this.changeSummary;this.changeSummary=this.createChangeSummary?.(),this._runFn(this,i)}}finally{for(const i of this.dependenciesToBeRemoved)i.removeObserver(this);this.dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(){this.state===3&&(this.state=1),this.updateCount++}endUpdate(){if(this.updateCount===1)do{if(this.state===1){this.state=3;for(const e of this.dependencies)if(e.reportChanges(),this.state===2)break}this._runIfNeeded()}while(this.state!==3);this.updateCount--,Nw(()=>this.updateCount>=0)}handlePossibleChange(e){this.state===3&&this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)&&(this.state=1)}handleChange(e,t){this.dependencies.has(e)&&!this.dependenciesToBeRemoved.has(e)&&(!this._handleChange||this._handleChange({changedObservable:e,change:t,didChange:r=>r===e},this.changeSummary))&&(this.state=2)}readObservable(e){if(this.disposed)return e.get();e.addObserver(this);const t=e.get();return this.dependencies.add(e),this.dependenciesToBeRemoved.delete(e),t}}(function(n){n.Observer=CW})(tn);function Hd(n){return new ASt(n)}class ASt extends lFe{constructor(e){super(),this.value=e}get debugName(){return this.toString()}get(){return this.value}addObserver(e){}removeObserver(e){}toString(){return`Const: ${this.value}`}}function Bi(...n){let e,t,i;return n.length===3?[e,t,i]=n:[t,i]=n,new Pv(new Za(e,void 0,i),t,i,()=>Pv.globalTransaction,rd)}function NSt(n,e,t){return new Pv(new Za(n.owner,n.debugName,n.debugReferenceFn??t),e,t,()=>Pv.globalTransaction,n.equalsFn??rd)}class Pv extends n2{constructor(e,t,i,r,s){super(),this._debugNameData=e,this.event=t,this._getValue=i,this._getTransaction=r,this._equalityComparator=s,this.hasValue=!1,this.handleEvent=o=>{const a=this._getValue(o),l=this.value;(!this.hasValue||!this._equalityComparator(l,a))&&(this.value=a,this.hasValue&&Fw(this._getTransaction(),u=>{for(const d of this.observers)u.updateObserver(d,this),d.handleChange(this,void 0)},()=>{const u=this.getDebugName();return"Event fired"+(u?`: ${u}`:"")}),this.hasValue=!0)}}getDebugName(){return this._debugNameData.getDebugName(this)}get debugName(){const e=this.getDebugName();return"From Event"+(e?`: ${e}`:"")}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0,this.hasValue=!1,this.value=void 0}get(){return this.subscription?(this.hasValue||this.handleEvent(void 0),this.value):this._getValue(void 0)}}(function(n){n.Observer=Pv;function e(t,i){let r=!1;Pv.globalTransaction===void 0&&(Pv.globalTransaction=t,r=!0);try{i()}finally{r&&(Pv.globalTransaction=void 0)}}n.batchEventsGlobally=e})(Bi);function xa(n,e){return new RSt(n,e)}class RSt extends n2{constructor(e,t){super(),this.debugName=e,this.event=t,this.handleEvent=()=>{qr(i=>{for(const r of this.observers)i.updateObserver(r,this),r.handleChange(this,void 0)},()=>this.debugName)}}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0}get(){}}function r2(n){return typeof n=="string"?new K1e(n):new K1e(void 0,n)}class K1e extends n2{get debugName(){return new Za(this._owner,this._debugName,void 0).getDebugName(this)??"Observable Signal"}toString(){return this.debugName}constructor(e,t){super(),this._debugName=e,this._owner=t}trigger(e,t){if(!e){qr(i=>{this.trigger(i,t)},()=>`Trigger signal ${this.debugName}`);return}for(const i of this.observers)e.updateObserver(i,this),i.handleChange(this,t)}get(){}}function PSt(n){const e=new dFe(!1,void 0);return n.addObserver(e),Lt(()=>{n.removeObserver(e)})}ESt(PSt);function s2(n,e){const t=new dFe(!0,e);return n.addObserver(t),e?e(n.get()):n.reportChanges(),Lt(()=>{n.removeObserver(t)})}kSt(s2);class dFe{constructor(e,t){this._forceRecompute=e,this._handleValue=t,this._counter=0}beginUpdate(e){this._counter++}endUpdate(e){this._counter--,this._counter===0&&this._forceRecompute&&(this._handleValue?this._handleValue(e.get()):e.reportChanges())}handlePossibleChange(e){}handleChange(e,t){}}function cO(n,e){let t;return $u({owner:n,debugReferenceFn:e},r=>(t=e(r,t),t))}function OSt(n,e,t,i){let r=new G1e(t,i);return $u({debugReferenceFn:t,owner:n,onLastObserverRemoved:()=>{r.dispose(),r=new G1e(t)}},o=>(r.setItems(e.read(o)),r.getItems()))}class G1e{constructor(e,t){this._map=e,this._keySelector=t,this._cache=new Map,this._items=[]}dispose(){this._cache.forEach(e=>e.store.dispose()),this._cache.clear()}setItems(e){const t=[],i=new Set(this._cache.keys());for(const r of e){const s=this._keySelector?this._keySelector(r):r;let o=this._cache.get(s);if(o)i.delete(s);else{const a=new ke;o={out:this._map(r,a),store:a},this._cache.set(s,o)}t.push(o.out)}for(const r of i)this._cache.get(r).store.dispose(),this._cache.delete(r);this._items=t}getItems(){return this._items}}function MSt(n,e){return cO(n,(t,i)=>i??e(t))}class xW{static fromFn(e){return new xW(e())}constructor(e){this._value=kn(this,void 0),this.promiseResult=this._value,this.promise=e.then(t=>(qr(i=>{this._value.set(new Y1e(t,void 0),i)}),t),t=>{throw qr(i=>{this._value.set(new Y1e(void 0,t),i)}),t})}}class Y1e{constructor(e,t){this.data=e,this.error=t}}function hFe(n,e,t,i){return e||(e=r=>r!=null),new Promise((r,s)=>{let o=!0,a=!1;const l=n.map(u=>({isFinished:e(u),error:t?t(u):!1,state:u})),c=tn(u=>{const{isFinished:d,error:h,state:f}=l.read(u);(d||h)&&(o?a=!0:c.dispose(),h?s(h===!0?f:h):r(f))});if(i){const u=i.onCancellationRequested(()=>{c.dispose(),u.dispose(),s(new sf)});if(i.isCancellationRequested){c.dispose(),u.dispose(),s(new sf);return}}o=!1,a&&c.dispose()})}class FSt extends n2{get debugName(){return this._debugNameData.getDebugName(this)??"LazyObservableValue"}constructor(e,t,i){super(),this._debugNameData=e,this._equalityComparator=i,this._isUpToDate=!0,this._deltas=[],this._updateCounter=0,this._value=t}get(){return this._update(),this._value}_update(){if(!this._isUpToDate)if(this._isUpToDate=!0,this._deltas.length>0){for(const e of this.observers)for(const t of this._deltas)e.handleChange(this,t);this._deltas.length=0}else for(const e of this.observers)e.handleChange(this,void 0)}_beginUpdate(){if(this._updateCounter++,this._updateCounter===1)for(const e of this.observers)e.beginUpdate(this)}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){this._update();const e=[...this.observers];for(const t of e)t.endUpdate(this)}}addObserver(e){const t=!this.observers.has(e)&&this._updateCounter>0;super.addObserver(e),t&&e.beginUpdate(this)}removeObserver(e){const t=this.observers.has(e)&&this._updateCounter>0;super.removeObserver(e),t&&e.endUpdate(this)}set(e,t,i){if(i===void 0&&this._equalityComparator(this._value,e))return;let r;t||(t=r=new i2(()=>{},()=>`Setting ${this.debugName}`));try{if(this._isUpToDate=!1,this._setValue(e),i!==void 0&&this._deltas.push(i),t.updateObserver({beginUpdate:()=>this._beginUpdate(),endUpdate:()=>this._endUpdate(),handleChange:(s,o)=>{},handlePossibleChange:s=>{}},this),this._updateCounter>1)for(const s of this.observers)s.handlePossibleChange(this)}finally{r&&r.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}}function CQ(n,e){return n.lazy?new FSt(new Za(n.owner,n.debugName,void 0),e,n.equalsFn??rd):new Ble(new Za(n.owner,n.debugName,void 0),e,n.equalsFn??rd)}class L8 extends me{static{this.instanceCount=0}constructor(e=!1){super(),this._onDidRequestBasicLanguageFeatures=this._register(new fe),this.onDidRequestBasicLanguageFeatures=this._onDidRequestBasicLanguageFeatures.event,this._onDidRequestRichLanguageFeatures=this._register(new fe),this.onDidRequestRichLanguageFeatures=this._onDidRequestRichLanguageFeatures.event,this._onDidChange=this._register(new fe({leakWarningThreshold:200})),this.onDidChange=this._onDidChange.event,this._requestedBasicLanguages=new Set,this._requestedRichLanguages=new Set,L8.instanceCount++,this._registry=this._register(new S8(!0,e)),this.languageIdCodec=this._registry.languageIdCodec,this._register(this._registry.onDidChange(()=>this._onDidChange.fire()))}dispose(){L8.instanceCount--,super.dispose()}isRegisteredLanguageId(e){return this._registry.isRegisteredLanguageId(e)}getLanguageIdByLanguageName(e){return this._registry.getLanguageIdByLanguageName(e)}getLanguageIdByMimeType(e){return this._registry.getLanguageIdByMimeType(e)}guessLanguageIdByFilepathOrFirstLine(e,t){const i=this._registry.guessLanguageIdByFilepathOrFirstLine(e,t);return hae(i,null)}createById(e){return new Z1e(this.onDidChange,()=>this._createAndGetLanguageIdentifier(e))}createByFilepathOrFirstLine(e,t){return new Z1e(this.onDidChange,()=>{const i=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(i)})}_createAndGetLanguageIdentifier(e){return(!e||!this.isRegisteredLanguageId(e))&&(e=Hl),e}requestBasicLanguageFeatures(e){this._requestedBasicLanguages.has(e)||(this._requestedBasicLanguages.add(e),this._onDidRequestBasicLanguageFeatures.fire(e))}requestRichLanguageFeatures(e){this._requestedRichLanguages.has(e)||(this._requestedRichLanguages.add(e),this.requestBasicLanguageFeatures(e),rs.getOrCreate(e),this._onDidRequestRichLanguageFeatures.fire(e))}}class Z1e{constructor(e,t){this._value=Bi(this,e,()=>t()),this.onDidChange=Ge.fromObservable(this._value)}get languageId(){return this._value.get()}}const DN={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:ps.text,INTERNAL_URI_LIST:"application/vnd.code.uri-list"},BSt=()=>({get delay(){return-1},dispose:()=>{},showHover:()=>{}});let SW=BSt;const $St=new kg(()=>SW("mouse",!1)),WSt=new kg(()=>SW("element",!1));function HSt(n){SW=n}function Yl(n){return n==="element"?WSt.value:$St.value}function _E(){return SW("element",!0)}let fFe={showHover:()=>{},hideHover:()=>{},showAndFocusLastHover:()=>{},setupManagedHover:()=>null,showManagedHover:()=>{}};function VSt(n){fFe=n}function Bg(){return fFe}class zSt{constructor(e){this.spliceables=e}splice(e,t,i){this.spliceables.forEach(r=>r.splice(e,t,i))}}class D1 extends Error{constructor(e,t){super(`ListError [${e}] ${t}`)}}function X1e(n,e){const t=[];for(const i of e){if(n.start>=i.range.end)continue;if(n.ende.concat(t),[]))}class qSt{get paddingTop(){return this._paddingTop}set paddingTop(e){this._size=this._size+e-this._paddingTop,this._paddingTop=e}constructor(e){this.groups=[],this._size=0,this._paddingTop=0,this._paddingTop=e??0,this._size=this._paddingTop}splice(e,t,i=[]){const r=i.length-t,s=X1e({start:0,end:e},this.groups),o=X1e({start:e+t,end:Number.POSITIVE_INFINITY},this.groups).map(l=>({range:xQ(l.range,r),size:l.size})),a=i.map((l,c)=>({range:{start:e+c,end:e+c+1},size:l.size}));this.groups=jSt(s,a,o),this._size=this._paddingTop+this.groups.reduce((l,c)=>l+c.size*(c.range.end-c.range.start),0)}get count(){const e=this.groups.length;return e?this.groups[e-1].range.end:0}get size(){return this._size}indexAt(e){if(e<0)return-1;if(e{for(const i of e)this.getRenderer(t).disposeTemplate(i.templateData),i.templateData=null}),this.cache.clear(),this.transactionNodesPendingRemoval.clear()}getRenderer(e){const t=this.renderers.get(e);if(!t)throw new Error(`No renderer found for ${e}`);return t}}var _0=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};const I1={CurrentDragAndDropData:void 0},Xg={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements(n){return[n]},getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0};class uO{constructor(e){this.elements=e}update(){}getData(){return this.elements}}class GSt{constructor(e){this.elements=e}update(){}getData(){return this.elements}}class YSt{constructor(){this.types=[],this.files=[]}update(e){if(e.types&&this.types.splice(0,this.types.length,...e.types),e.files){this.files.splice(0,this.files.length);for(let t=0;tr,e?.getPosInSet?this.getPosInSet=e.getPosInSet.bind(e):this.getPosInSet=(t,i)=>i+1,e?.getRole?this.getRole=e.getRole.bind(e):this.getRole=t=>"listitem",e?.isChecked?this.isChecked=e.isChecked.bind(e):this.isChecked=t=>{}}}class gf{static{this.InstanceCount=0}get contentHeight(){return this.rangeMap.size}get onDidScroll(){return this.scrollableElement.onScroll}get scrollableElementDomNode(){return this.scrollableElement.getDomNode()}get horizontalScrolling(){return this._horizontalScrolling}set horizontalScrolling(e){if(e!==this._horizontalScrolling){if(e&&this.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");if(this._horizontalScrolling=e,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this._horizontalScrolling){for(const t of this.items)this.measureItemWidth(t);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:xj(this.domNode)}),this.rowsContainer.style.width=`${Math.max(this.scrollWidth||0,this.renderWidth)}px`}else this.scrollableElementWidthDelayer.cancel(),this.scrollableElement.setScrollDimensions({width:this.renderWidth,scrollWidth:this.renderWidth}),this.rowsContainer.style.width=""}}constructor(e,t,i,r=Xg){if(this.virtualDelegate=t,this.domId=`list_id_${++gf.InstanceCount}`,this.renderers=new Map,this.renderWidth=0,this._scrollHeight=0,this.scrollableElementUpdateDisposable=null,this.scrollableElementWidthDelayer=new Qd(50),this.splicing=!1,this.dragOverAnimationStopDisposable=me.None,this.dragOverMouseY=0,this.canDrop=!1,this.currentDragFeedbackDisposable=me.None,this.onDragLeaveTimeout=me.None,this.disposables=new ke,this._onDidChangeContentHeight=new fe,this._onDidChangeContentWidth=new fe,this.onDidChangeContentHeight=Ge.latch(this._onDidChangeContentHeight.event,void 0,this.disposables),this._horizontalScrolling=!1,r.horizontalScrolling&&r.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");this.items=[],this.itemId=0,this.rangeMap=this.createRangeMap(r.paddingTop??0);for(const o of i)this.renderers.set(o.templateId,o);this.cache=this.disposables.add(new KSt(this.renderers)),this.lastRenderTop=0,this.lastRenderHeight=0,this.domNode=document.createElement("div"),this.domNode.className="monaco-list",this.domNode.classList.add(this.domId),this.domNode.tabIndex=0,this.domNode.classList.toggle("mouse-support",typeof r.mouseSupport=="boolean"?r.mouseSupport:!0),this._horizontalScrolling=r.horizontalScrolling??Xg.horizontalScrolling,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.paddingBottom=typeof r.paddingBottom>"u"?0:r.paddingBottom,this.accessibilityProvider=new XSt(r.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",(r.transformOptimization??Xg.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)",this.rowsContainer.style.overflow="hidden",this.rowsContainer.style.contain="strict"),this.disposables.add(Fr.addTarget(this.rowsContainer)),this.scrollable=this.disposables.add(new t2({forceIntegerValues:!0,smoothScrollDuration:r.smoothScrolling??!1?125:0,scheduleAtNextAnimationFrame:o=>du(Ot(this.domNode),o)})),this.scrollableElement=this.disposables.add(new fW(this.rowsContainer,{alwaysConsumeMouseWheel:r.alwaysConsumeMouseWheel??Xg.alwaysConsumeMouseWheel,horizontal:1,vertical:r.verticalScrollMode??Xg.verticalScrollMode,useShadows:r.useShadows??Xg.useShadows,mouseWheelScrollSensitivity:r.mouseWheelScrollSensitivity,fastScrollSensitivity:r.fastScrollSensitivity,scrollByPage:r.scrollByPage},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),e.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add(Ce(this.rowsContainer,gr.Change,o=>this.onTouchChange(o))),this.disposables.add(Ce(this.scrollableElement.getDomNode(),"scroll",o=>o.target.scrollTop=0)),this.disposables.add(Ce(this.domNode,"dragover",o=>this.onDragOver(this.toDragEvent(o)))),this.disposables.add(Ce(this.domNode,"drop",o=>this.onDrop(this.toDragEvent(o)))),this.disposables.add(Ce(this.domNode,"dragleave",o=>this.onDragLeave(this.toDragEvent(o)))),this.disposables.add(Ce(this.domNode,"dragend",o=>this.onDragEnd(o))),this.setRowLineHeight=r.setRowLineHeight??Xg.setRowLineHeight,this.setRowHeight=r.setRowHeight??Xg.setRowHeight,this.supportDynamicHeights=r.supportDynamicHeights??Xg.supportDynamicHeights,this.dnd=r.dnd??this.disposables.add(Xg.dnd),this.layout(r.initialSize?.height,r.initialSize?.width)}updateOptions(e){e.paddingBottom!==void 0&&(this.paddingBottom=e.paddingBottom,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),e.smoothScrolling!==void 0&&this.scrollable.setSmoothScrollDuration(e.smoothScrolling?125:0),e.horizontalScrolling!==void 0&&(this.horizontalScrolling=e.horizontalScrolling);let t;if(e.scrollByPage!==void 0&&(t={...t??{},scrollByPage:e.scrollByPage}),e.mouseWheelScrollSensitivity!==void 0&&(t={...t??{},mouseWheelScrollSensitivity:e.mouseWheelScrollSensitivity}),e.fastScrollSensitivity!==void 0&&(t={...t??{},fastScrollSensitivity:e.fastScrollSensitivity}),t&&this.scrollableElement.updateOptions(t),e.paddingTop!==void 0&&e.paddingTop!==this.rangeMap.paddingTop){const i=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),r=e.paddingTop-this.rangeMap.paddingTop;this.rangeMap.paddingTop=e.paddingTop,this.render(i,Math.max(0,this.lastRenderTop+r),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.lastRenderTop,this.lastRenderHeight)}}createRangeMap(e){return new qSt(e)}splice(e,t,i=[]){if(this.splicing)throw new Error("Can't run recursive splices.");this.splicing=!0;try{return this._splice(e,t,i)}finally{this.splicing=!1,this._onDidChangeContentHeight.fire(this.contentHeight)}}_splice(e,t,i=[]){const r=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),s={start:e,end:e+t},o=Ba.intersect(r,s),a=new Map;for(let x=o.end-1;x>=o.start;x--){const k=this.items[x];if(k.dragStartDisposable.dispose(),k.checkedDisposable.dispose(),k.row){let L=a.get(k.templateId);L||(L=[],a.set(k.templateId,L));const D=this.renderers.get(k.templateId);D&&D.disposeElement&&D.disposeElement(k.element,x,k.row.templateData,k.size),L.unshift(k.row)}k.row=null,k.stale=!0}const l={start:e+t,end:this.items.length},c=Ba.intersect(l,r),u=Ba.relativeComplement(l,r),d=i.map(x=>({id:String(this.itemId++),element:x,templateId:this.virtualDelegate.getTemplateId(x),size:this.virtualDelegate.getHeight(x),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(x),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:me.None,checkedDisposable:me.None,stale:!1}));let h;e===0&&t>=this.items.length?(this.rangeMap=this.createRangeMap(this.rangeMap.paddingTop),this.rangeMap.splice(0,0,d),h=this.items,this.items=d):(this.rangeMap.splice(e,t,d),h=this.items.splice(e,t,...d));const f=i.length-t,g=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),p=xQ(c,f),m=Ba.intersect(g,p);for(let x=m.start;xxQ(x,f)),C=[{start:e,end:e+i.length},...v].map(x=>Ba.intersect(g,x)).reverse();for(const x of C)for(let k=x.end-1;k>=x.start;k--){const L=this.items[k],I=a.get(L.templateId)?.pop();this.insertItemInDOM(k,I)}for(const x of a.values())for(const k of x)this.cache.release(k);return this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight),h.map(x=>x.element)}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=du(Ot(this.domNode),()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null}))}eventuallyUpdateScrollWidth(){if(!this.horizontalScrolling){this.scrollableElementWidthDelayer.cancel();return}this.scrollableElementWidthDelayer.trigger(()=>this.updateScrollWidth())}updateScrollWidth(){if(!this.horizontalScrolling)return;let e=0;for(const t of this.items)typeof t.width<"u"&&(e=Math.max(e,t.width));this.scrollWidth=e,this.scrollableElement.setScrollDimensions({scrollWidth:e===0?0:e+10}),this._onDidChangeContentWidth.fire(this.scrollWidth)}rerender(){if(this.supportDynamicHeights){for(const e of this.items)e.lastDynamicHeightWidth=void 0;this._rerender(this.lastRenderTop,this.lastRenderHeight)}}get length(){return this.items.length}get renderHeight(){return this.scrollableElement.getScrollDimensions().height}get firstVisibleIndex(){return this.getRenderRange(this.lastRenderTop,this.lastRenderHeight).start}element(e){return this.items[e].element}indexOf(e){return this.items.findIndex(t=>t.element===e)}domElement(e){const t=this.items[e].row;return t&&t.domNode}elementHeight(e){return this.items[e].size}elementTop(e){return this.rangeMap.positionAt(e)}indexAt(e){return this.rangeMap.indexAt(e)}indexAfter(e){return this.rangeMap.indexAfter(e)}layout(e,t){const i={height:typeof e=="number"?e:b0t(this.domNode)};this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,i.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(i),typeof t<"u"&&(this.renderWidth=t,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling&&this.scrollableElement.setScrollDimensions({width:typeof t=="number"?t:xj(this.domNode)})}render(e,t,i,r,s,o=!1){const a=this.getRenderRange(t,i),l=Ba.relativeComplement(a,e).reverse(),c=Ba.relativeComplement(e,a);if(o){const u=Ba.intersect(e,a);for(let d=u.start;d{for(const u of c)for(let d=u.start;d=u.start;d--)this.insertItemInDOM(d)}),r!==void 0&&(this.rowsContainer.style.left=`-${r}px`),this.rowsContainer.style.top=`-${t}px`,this.horizontalScrolling&&s!==void 0&&(this.rowsContainer.style.width=`${Math.max(s,this.renderWidth)}px`),this.lastRenderTop=t,this.lastRenderHeight=i}insertItemInDOM(e,t){const i=this.items[e];if(!i.row)if(t)i.row=t,i.stale=!0;else{const l=this.cache.alloc(i.templateId);i.row=l.row,i.stale||=l.isReusingConnectedDomNode}const r=this.accessibilityProvider.getRole(i.element)||"listitem";i.row.domNode.setAttribute("role",r);const s=this.accessibilityProvider.isChecked(i.element);if(typeof s=="boolean")i.row.domNode.setAttribute("aria-checked",String(!!s));else if(s){const l=c=>i.row.domNode.setAttribute("aria-checked",String(!!c));l(s.value),i.checkedDisposable=s.onDidChange(()=>l(s.value))}if(i.stale||!i.row.domNode.parentElement){const l=this.items.at(e+1)?.row?.domNode??null;(i.row.domNode.parentElement!==this.rowsContainer||i.row.domNode.nextElementSibling!==l)&&this.rowsContainer.insertBefore(i.row.domNode,l),i.stale=!1}this.updateItemInDOM(i,e);const o=this.renderers.get(i.templateId);if(!o)throw new Error(`No renderer found for template id ${i.templateId}`);o?.renderElement(i.element,e,i.row.templateData,i.size);const a=this.dnd.getDragURI(i.element);i.dragStartDisposable.dispose(),i.row.domNode.draggable=!!a,a&&(i.dragStartDisposable=Ce(i.row.domNode,"dragstart",l=>this.onDragStart(i.element,a,l))),this.horizontalScrolling&&(this.measureItemWidth(i),this.eventuallyUpdateScrollWidth())}measureItemWidth(e){if(!e.row||!e.row.domNode)return;e.row.domNode.style.width="fit-content",e.width=xj(e.row.domNode);const t=Ot(e.row.domNode).getComputedStyle(e.row.domNode);t.paddingLeft&&(e.width+=parseFloat(t.paddingLeft)),t.paddingRight&&(e.width+=parseFloat(t.paddingRight)),e.row.domNode.style.width=""}updateItemInDOM(e,t){e.row.domNode.style.top=`${this.elementTop(t)}px`,this.setRowHeight&&(e.row.domNode.style.height=`${e.size}px`),this.setRowLineHeight&&(e.row.domNode.style.lineHeight=`${e.size}px`),e.row.domNode.setAttribute("data-index",`${t}`),e.row.domNode.setAttribute("data-last-element",t===this.length-1?"true":"false"),e.row.domNode.setAttribute("data-parity",t%2===0?"even":"odd"),e.row.domNode.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(e.element,t,this.length))),e.row.domNode.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(e.element,t))),e.row.domNode.setAttribute("id",this.getElementDomId(t)),e.row.domNode.classList.toggle("drop-target",e.dropTarget)}removeItemFromDOM(e){const t=this.items[e];if(t.dragStartDisposable.dispose(),t.checkedDisposable.dispose(),t.row){const i=this.renderers.get(t.templateId);i&&i.disposeElement&&i.disposeElement(t.element,e,t.row.templateData,t.size),this.cache.release(t.row),t.row=null}this.horizontalScrolling&&this.eventuallyUpdateScrollWidth()}getScrollTop(){return this.scrollableElement.getScrollPosition().scrollTop}setScrollTop(e,t){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),this.scrollableElement.setScrollPosition({scrollTop:e,reuseAnimation:t})}get scrollTop(){return this.getScrollTop()}set scrollTop(e){this.setScrollTop(e)}get scrollHeight(){return this._scrollHeight+(this.horizontalScrolling?10:0)+this.paddingBottom}get onMouseClick(){return Ge.map(this.disposables.add(new $n(this.domNode,"click")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseDblClick(){return Ge.map(this.disposables.add(new $n(this.domNode,"dblclick")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseMiddleClick(){return Ge.filter(Ge.map(this.disposables.add(new $n(this.domNode,"auxclick")).event,e=>this.toMouseEvent(e),this.disposables),e=>e.browserEvent.button===1,this.disposables)}get onMouseDown(){return Ge.map(this.disposables.add(new $n(this.domNode,"mousedown")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseOver(){return Ge.map(this.disposables.add(new $n(this.domNode,"mouseover")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseOut(){return Ge.map(this.disposables.add(new $n(this.domNode,"mouseout")).event,e=>this.toMouseEvent(e),this.disposables)}get onContextMenu(){return Ge.any(Ge.map(this.disposables.add(new $n(this.domNode,"contextmenu")).event,e=>this.toMouseEvent(e),this.disposables),Ge.map(this.disposables.add(new $n(this.domNode,gr.Contextmenu)).event,e=>this.toGestureEvent(e),this.disposables))}get onTouchStart(){return Ge.map(this.disposables.add(new $n(this.domNode,"touchstart")).event,e=>this.toTouchEvent(e),this.disposables)}get onTap(){return Ge.map(this.disposables.add(new $n(this.rowsContainer,gr.Tap)).event,e=>this.toGestureEvent(e),this.disposables)}toMouseEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],r=i&&i.element;return{browserEvent:e,index:t,element:r}}toTouchEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],r=i&&i.element;return{browserEvent:e,index:t,element:r}}toGestureEvent(e){const t=this.getItemIndexFromEventTarget(e.initialTarget||null),i=typeof t>"u"?void 0:this.items[t],r=i&&i.element;return{browserEvent:e,index:t,element:r}}toDragEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],r=i&&i.element,s=this.getTargetSector(e,t);return{browserEvent:e,index:t,element:r,sector:s}}onScroll(e){try{const t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(t,e.scrollTop,e.height,e.scrollLeft,e.scrollWidth),this.supportDynamicHeights&&this._rerender(e.scrollTop,e.height,e.inSmoothScrolling)}catch(t){throw console.error("Got bad scroll event:",e),t}}onTouchChange(e){e.preventDefault(),e.stopPropagation(),this.scrollTop-=e.translationY}onDragStart(e,t,i){if(!i.dataTransfer)return;const r=this.dnd.getDragElements(e);if(i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.setData(DN.TEXT,t),i.dataTransfer.setDragImage){let s;this.dnd.getDragLabel&&(s=this.dnd.getDragLabel(r,i)),typeof s>"u"&&(s=String(r.length));const o=qe(".monaco-drag-image");o.textContent=s,(c=>{for(;c&&!c.classList.contains("monaco-workbench");)c=c.parentElement;return c||this.domNode.ownerDocument})(this.domNode).appendChild(o),i.dataTransfer.setDragImage(o,-10,-10),setTimeout(()=>o.remove(),0)}this.domNode.classList.add("dragging"),this.currentDragData=new uO(r),I1.CurrentDragAndDropData=new GSt(r),this.dnd.onDragStart?.(this.currentDragData,i)}onDragOver(e){if(e.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),I1.CurrentDragAndDropData&&I1.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(e.browserEvent),!e.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(I1.CurrentDragAndDropData)this.currentDragData=I1.CurrentDragAndDropData;else{if(!e.browserEvent.dataTransfer.types)return!1;this.currentDragData=new YSt}const t=this.dnd.onDragOver(this.currentDragData,e.element,e.index,e.sector,e.browserEvent);if(this.canDrop=typeof t=="boolean"?t:t.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;e.browserEvent.dataTransfer.dropEffect=typeof t!="boolean"&&t.effect?.type===0?"copy":"move";let i;typeof t!="boolean"&&t.feedback?i=t.feedback:typeof e.index>"u"?i=[-1]:i=[e.index],i=j_(i).filter(s=>s>=-1&&ss-o),i=i[0]===-1?[-1]:i;let r=typeof t!="boolean"&&t.effect&&t.effect.position?t.effect.position:"drop-target";if(ZSt(this.currentDragFeedback,i)&&this.currentDragFeedbackPosition===r)return!0;if(this.currentDragFeedback=i,this.currentDragFeedbackPosition=r,this.currentDragFeedbackDisposable.dispose(),i[0]===-1)this.domNode.classList.add(r),this.rowsContainer.classList.add(r),this.currentDragFeedbackDisposable=Lt(()=>{this.domNode.classList.remove(r),this.rowsContainer.classList.remove(r)});else{if(i.length>1&&r!=="drop-target")throw new Error("Can't use multiple feedbacks with position different than 'over'");r==="drop-target-after"&&i[0]{for(const s of i){const o=this.items[s];o.dropTarget=!1,o.row?.domNode.classList.remove(r)}})}return!0}onDragLeave(e){this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=Sb(()=>this.clearDragOverFeedback(),100,this.disposables),this.currentDragData&&this.dnd.onDragLeave?.(this.currentDragData,e.element,e.index,e.browserEvent)}onDrop(e){if(!this.canDrop)return;const t=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,I1.CurrentDragAndDropData=void 0,!(!t||!e.browserEvent.dataTransfer)&&(e.browserEvent.preventDefault(),t.update(e.browserEvent.dataTransfer),this.dnd.drop(t,e.element,e.index,e.sector,e.browserEvent))}onDragEnd(e){this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,I1.CurrentDragAndDropData=void 0,this.dnd.onDragEnd?.(e)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackPosition=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=me.None}setupDragAndDropScrollTopAnimation(e){if(!this.dragOverAnimationDisposable){const t=u3e(this.domNode).top;this.dragOverAnimationDisposable=N0t(Ot(this.domNode),this.animateDragAndDropScrollTop.bind(this,t))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=Sb(()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)},1e3,this.disposables),this.dragOverMouseY=e.pageY}animateDragAndDropScrollTop(e){if(this.dragOverMouseY===void 0)return;const t=this.dragOverMouseY-e,i=this.renderHeight-35;t<35?this.scrollTop+=Math.max(-14,Math.floor(.3*(t-35))):t>i&&(this.scrollTop+=Math.min(14,Math.floor(.3*(t-i))))}teardownDragAndDropScrollTopAnimation(){this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}getTargetSector(e,t){if(t===void 0)return;const i=e.offsetY/this.items[t].size,r=Math.floor(i/.25);return Il(r,0,3)}getItemIndexFromEventTarget(e){const t=this.scrollableElement.getDomNode();let i=e;for(;(Eo(i)||k0t(i))&&i!==this.rowsContainer&&t.contains(i);){const r=i.getAttribute("data-index");if(r){const s=Number(r);if(!isNaN(s))return s}i=i.parentElement}}getRenderRange(e,t){return{start:this.rangeMap.indexAt(e),end:this.rangeMap.indexAfter(e+t-1)}}_rerender(e,t,i){const r=this.getRenderRange(e,t);let s,o;e===this.elementTop(r.start)?(s=r.start,o=0):r.end-r.start>1&&(s=r.start+1,o=this.elementTop(s)-e);let a=0;for(;;){const l=this.getRenderRange(e,t);let c=!1;for(let u=l.start;u=h.start;f--)this.insertItemInDOM(f);for(let h=l.start;h=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};class QSt{constructor(e){this.trait=e,this.renderedElements=[]}get templateId(){return`template:${this.trait.name}`}renderTemplate(e){return e}renderElement(e,t,i){const r=this.renderedElements.findIndex(s=>s.templateData===i);if(r>=0){const s=this.renderedElements[r];this.trait.unrender(i),s.index=t}else{const s={index:t,templateData:i};this.renderedElements.push(s)}this.trait.renderIndex(t,i)}splice(e,t,i){const r=[];for(const s of this.renderedElements)s.index=e+t&&r.push({index:s.index+i-t,templateData:s.templateData});this.renderedElements=r}renderIndexes(e){for(const{index:t,templateData:i}of this.renderedElements)e.indexOf(t)>-1&&this.trait.renderIndex(t,i)}disposeTemplate(e){const t=this.renderedElements.findIndex(i=>i.templateData===e);t<0||this.renderedElements.splice(t,1)}}let T8=class{get name(){return this._trait}get renderer(){return new QSt(this)}constructor(e){this._trait=e,this.indexes=[],this.sortedIndexes=[],this._onChange=new fe,this.onChange=this._onChange.event}splice(e,t,i){const r=i.length-t,s=e+t,o=[];let a=0;for(;a=s;)o.push(this.sortedIndexes[a++]+r);this.renderer.splice(e,t,i.length),this._set(o,o)}renderIndex(e,t){t.classList.toggle(this._trait,this.contains(e))}unrender(e){e.classList.remove(this._trait)}set(e,t){return this._set(e,[...e].sort(J1e),t)}_set(e,t,i){const r=this.indexes,s=this.sortedIndexes;this.indexes=e,this.sortedIndexes=t;const o=SQ(s,e);return this.renderer.renderIndexes(o),this._onChange.fire({indexes:e,browserEvent:i}),r}get(){return this.indexes}contains(e){return JA(this.sortedIndexes,e,J1e)>=0}dispose(){er(this._onChange)}};e1([Ds],T8.prototype,"renderer",null);class JSt extends T8{constructor(e){super("selected"),this.setAriaSelected=e}renderIndex(e,t){super.renderIndex(e,t),this.setAriaSelected&&(this.contains(e)?t.setAttribute("aria-selected","true"):t.setAttribute("aria-selected","false"))}}class tq{constructor(e,t,i){this.trait=e,this.view=t,this.identityProvider=i}splice(e,t,i){if(!this.identityProvider)return this.trait.splice(e,t,new Array(i.length).fill(!1));const r=this.trait.get().map(a=>this.identityProvider.getId(this.view.element(a)).toString());if(r.length===0)return this.trait.splice(e,t,new Array(i.length).fill(!1));const s=new Set(r),o=i.map(a=>s.has(this.identityProvider.getId(a).toString()));this.trait.splice(e,t,o)}}function lb(n){return n.tagName==="INPUT"||n.tagName==="TEXTAREA"}function dO(n,e){return n.classList.contains(e)?!0:n.classList.contains("monaco-list")||!n.parentElement?!1:dO(n.parentElement,e)}function AD(n){return dO(n,"monaco-editor")}function ekt(n){return dO(n,"monaco-custom-toggle")}function tkt(n){return dO(n,"action-item")}function wI(n){return dO(n,"monaco-tree-sticky-row")}function IN(n){return n.classList.contains("monaco-tree-sticky-container")}function gFe(n){return n.tagName==="A"&&n.classList.contains("monaco-button")||n.tagName==="DIV"&&n.classList.contains("monaco-button-dropdown")?!0:n.classList.contains("monaco-list")||!n.parentElement?!1:gFe(n.parentElement)}class pFe{get onKeyDown(){return Ge.chain(this.disposables.add(new $n(this.view.domNode,"keydown")).event,e=>e.filter(t=>!lb(t.target)).map(t=>new or(t)))}constructor(e,t,i){this.list=e,this.view=t,this.disposables=new ke,this.multipleSelectionDisposables=new ke,this.multipleSelectionSupport=i.multipleSelectionSupport,this.disposables.add(this.onKeyDown(r=>{switch(r.keyCode){case 3:return this.onEnter(r);case 16:return this.onUpArrow(r);case 18:return this.onDownArrow(r);case 11:return this.onPageUpArrow(r);case 12:return this.onPageDownArrow(r);case 9:return this.onEscape(r);case 31:this.multipleSelectionSupport&&(Rn?r.metaKey:r.ctrlKey)&&this.onCtrlA(r)}}))}updateOptions(e){e.multipleSelectionSupport!==void 0&&(this.multipleSelectionSupport=e.multipleSelectionSupport)}onEnter(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(this.list.getFocus(),e.browserEvent)}onUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPrevious(1,!1,e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNext(1,!1,e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPreviousPage(e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNextPage(e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onCtrlA(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(sc(this.list.length),e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus()}onEscape(e){this.list.getSelection().length&&(e.preventDefault(),e.stopPropagation(),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}}e1([Ds],pFe.prototype,"onKeyDown",null);var Cp;(function(n){n[n.Automatic=0]="Automatic",n[n.Trigger=1]="Trigger"})(Cp||(Cp={}));var ES;(function(n){n[n.Idle=0]="Idle",n[n.Typing=1]="Typing"})(ES||(ES={}));const nkt=new class{mightProducePrintableCharacter(n){return n.ctrlKey||n.metaKey||n.altKey?!1:n.keyCode>=31&&n.keyCode<=56||n.keyCode>=21&&n.keyCode<=30||n.keyCode>=98&&n.keyCode<=107||n.keyCode>=85&&n.keyCode<=95}};class ikt{constructor(e,t,i,r,s){this.list=e,this.view=t,this.keyboardNavigationLabelProvider=i,this.keyboardNavigationEventFilter=r,this.delegate=s,this.enabled=!1,this.state=ES.Idle,this.mode=Cp.Automatic,this.triggered=!1,this.previouslyFocused=-1,this.enabledDisposables=new ke,this.disposables=new ke,this.updateOptions(e.options)}updateOptions(e){e.typeNavigationEnabled??!0?this.enable():this.disable(),this.mode=e.typeNavigationMode??Cp.Automatic}enable(){if(this.enabled)return;let e=!1;const t=Ge.chain(this.enabledDisposables.add(new $n(this.view.domNode,"keydown")).event,s=>s.filter(o=>!lb(o.target)).filter(()=>this.mode===Cp.Automatic||this.triggered).map(o=>new or(o)).filter(o=>e||this.keyboardNavigationEventFilter(o)).filter(o=>this.delegate.mightProducePrintableCharacter(o)).forEach(o=>Hn.stop(o,!0)).map(o=>o.browserEvent.key)),i=Ge.debounce(t,()=>null,800,void 0,void 0,void 0,this.enabledDisposables);Ge.reduce(Ge.any(t,i),(s,o)=>o===null?null:(s||"")+o,void 0,this.enabledDisposables)(this.onInput,this,this.enabledDisposables),i(this.onClear,this,this.enabledDisposables),t(()=>e=!0,void 0,this.enabledDisposables),i(()=>e=!1,void 0,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){this.enabled&&(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){const e=this.list.getFocus();if(e.length>0&&e[0]===this.previouslyFocused){const t=this.list.options.accessibilityProvider?.getAriaLabel(this.list.element(e[0]));typeof t=="string"?ql(t):t&&ql(t.get())}this.previouslyFocused=-1}onInput(e){if(!e){this.state=ES.Idle,this.triggered=!1;return}const t=this.list.getFocus(),i=t.length>0?t[0]:0,r=this.state===ES.Idle?1:0;this.state=ES.Typing;for(let s=0;s1&&c.length===1){this.previouslyFocused=i,this.list.setFocus([o]),this.list.reveal(o);return}}}else if(typeof l>"u"||SN(e,l)){this.previouslyFocused=i,this.list.setFocus([o]),this.list.reveal(o);return}}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}}class rkt{constructor(e,t){this.list=e,this.view=t,this.disposables=new ke;const i=Ge.chain(this.disposables.add(new $n(t.domNode,"keydown")).event,s=>s.filter(o=>!lb(o.target)).map(o=>new or(o)));Ge.chain(i,s=>s.filter(o=>o.keyCode===2&&!o.ctrlKey&&!o.metaKey&&!o.shiftKey&&!o.altKey))(this.onTab,this,this.disposables)}onTab(e){if(e.target!==this.view.domNode)return;const t=this.list.getFocus();if(t.length===0)return;const i=this.view.domElement(t[0]);if(!i)return;const r=i.querySelector("[tabIndex]");if(!r||!Eo(r)||r.tabIndex===-1)return;const s=Ot(r).getComputedStyle(r);s.visibility==="hidden"||s.display==="none"||(e.preventDefault(),e.stopPropagation(),r.focus())}dispose(){this.disposables.dispose()}}function mFe(n){return Rn?n.browserEvent.metaKey:n.browserEvent.ctrlKey}function _Fe(n){return n.browserEvent.shiftKey}function skt(n){return Hae(n)&&n.button===2}const Q1e={isSelectionSingleChangeEvent:mFe,isSelectionRangeChangeEvent:_Fe};class vFe{constructor(e){this.list=e,this.disposables=new ke,this._onPointer=new fe,this.onPointer=this._onPointer.event,e.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||Q1e),this.mouseSupport=typeof e.options.mouseSupport>"u"||!!e.options.mouseSupport,this.mouseSupport&&(e.onMouseDown(this.onMouseDown,this,this.disposables),e.onContextMenu(this.onContextMenu,this,this.disposables),e.onMouseDblClick(this.onDoubleClick,this,this.disposables),e.onTouchStart(this.onMouseDown,this,this.disposables),this.disposables.add(Fr.addTarget(e.getHTMLElement()))),Ge.any(e.onMouseClick,e.onMouseMiddleClick,e.onTap)(this.onViewPointer,this,this.disposables)}updateOptions(e){e.multipleSelectionSupport!==void 0&&(this.multipleSelectionController=void 0,e.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||Q1e))}isSelectionSingleChangeEvent(e){return this.multipleSelectionController?this.multipleSelectionController.isSelectionSingleChangeEvent(e):!1}isSelectionRangeChangeEvent(e){return this.multipleSelectionController?this.multipleSelectionController.isSelectionRangeChangeEvent(e):!1}isSelectionChangeEvent(e){return this.isSelectionSingleChangeEvent(e)||this.isSelectionRangeChangeEvent(e)}onMouseDown(e){AD(e.browserEvent.target)||ka()!==e.browserEvent.target&&this.list.domFocus()}onContextMenu(e){if(lb(e.browserEvent.target)||AD(e.browserEvent.target))return;const t=typeof e.index>"u"?[]:[e.index];this.list.setFocus(t,e.browserEvent)}onViewPointer(e){if(!this.mouseSupport||lb(e.browserEvent.target)||AD(e.browserEvent.target)||e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;const t=e.index;if(typeof t>"u"){this.list.setFocus([],e.browserEvent),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0);return}if(this.isSelectionChangeEvent(e))return this.changeSelection(e);this.list.setFocus([t],e.browserEvent),this.list.setAnchor(t),skt(e.browserEvent)||this.list.setSelection([t],e.browserEvent),this._onPointer.fire(e)}onDoubleClick(e){if(lb(e.browserEvent.target)||AD(e.browserEvent.target)||this.isSelectionChangeEvent(e)||e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;const t=this.list.getFocus();this.list.setSelection(t,e.browserEvent)}changeSelection(e){const t=e.index;let i=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(e)){typeof i>"u"&&(i=this.list.getFocus()[0]??t,this.list.setAnchor(i));const r=Math.min(i,t),s=Math.max(i,t),o=sc(r,s+1),a=this.list.getSelection(),l=lkt(SQ(a,[i]),i);if(l.length===0)return;const c=SQ(o,ckt(a,l));this.list.setSelection(c,e.browserEvent),this.list.setFocus([t],e.browserEvent)}else if(this.isSelectionSingleChangeEvent(e)){const r=this.list.getSelection(),s=r.filter(o=>o!==t);this.list.setFocus([t]),this.list.setAnchor(t),r.length===s.length?this.list.setSelection([...s,t],e.browserEvent):this.list.setSelection(s,e.browserEvent)}}dispose(){this.disposables.dispose()}}class bFe{constructor(e,t){this.styleElement=e,this.selectorSuffix=t}style(e){const t=this.selectorSuffix&&`.${this.selectorSuffix}`,i=[];e.listBackground&&i.push(`.monaco-list${t} .monaco-list-rows { background: ${e.listBackground}; }`),e.listFocusBackground&&(i.push(`.monaco-list${t}:focus .monaco-list-row.focused { background-color: ${e.listFocusBackground}; }`),i.push(`.monaco-list${t}:focus .monaco-list-row.focused:hover { background-color: ${e.listFocusBackground}; }`)),e.listFocusForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),e.listActiveSelectionBackground&&(i.push(`.monaco-list${t}:focus .monaco-list-row.selected { background-color: ${e.listActiveSelectionBackground}; }`),i.push(`.monaco-list${t}:focus .monaco-list-row.selected:hover { background-color: ${e.listActiveSelectionBackground}; }`)),e.listActiveSelectionForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.selected { color: ${e.listActiveSelectionForeground}; }`),e.listActiveSelectionIconForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.selected .codicon { color: ${e.listActiveSelectionIconForeground}; }`),e.listFocusAndSelectionBackground&&i.push(` .monaco-drag-image, .monaco-list${t}:focus .monaco-list-row.selected.focused { background-color: ${e.listFocusAndSelectionBackground}; } `),e.listFocusAndSelectionForeground&&i.push(` @@ -307,9 +307,9 @@ Please report this to https://github.com/markedjs/marked.`,re){const Y="

An er background-color: ${e.tableOddRowsBackgroundColor}; } `),this.styleElement.textContent=i.join(` -`)}}const okt={listFocusBackground:"#7FB0D0",listActiveSelectionBackground:"#0E639C",listActiveSelectionForeground:"#FFFFFF",listActiveSelectionIconForeground:"#FFFFFF",listFocusAndSelectionOutline:"#90C2F9",listFocusAndSelectionBackground:"#094771",listFocusAndSelectionForeground:"#FFFFFF",listInactiveSelectionBackground:"#3F3F46",listInactiveSelectionIconForeground:"#FFFFFF",listHoverBackground:"#2A2D2E",listDropOverBackground:"#383B3D",listDropBetweenBackground:"#EEEEEE",treeIndentGuidesStroke:"#a9a9a9",treeInactiveIndentGuidesStroke:Te.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:Te.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:Te.fromHex("#cccccc").transparent(.04).toString(),listBackground:void 0,listFocusForeground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusForeground:void 0,listInactiveFocusBackground:void 0,listHoverForeground:void 0,listFocusOutline:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listHoverOutline:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},akt={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}}};function lkt(n,e){const t=n.indexOf(e);if(t===-1)return[];const i=[];let r=t-1;for(;r>=0&&n[r]===e-(t-r);)i.push(n[r--]);for(i.reverse(),r=t;r=n.length)t.push(e[r++]);else if(r>=e.length)t.push(n[i++]);else if(n[i]===e[r]){t.push(n[i]),i++,r++;continue}else n[i]=n.length)t.push(e[r++]);else if(r>=e.length)t.push(n[i++]);else if(n[i]===e[r]){i++,r++;continue}else n[i]n-e;class ukt{constructor(e,t){this._templateId=e,this.renderers=t}get templateId(){return this._templateId}renderTemplate(e){return this.renderers.map(t=>t.renderTemplate(e))}renderElement(e,t,i,r){let s=0;for(const o of this.renderers)o.renderElement(e,t,i[s++],r)}disposeElement(e,t,i,r){let s=0;for(const o of this.renderers)o.disposeElement?.(e,t,i[s],r),s+=1}disposeTemplate(e){let t=0;for(const i of this.renderers)i.disposeTemplate(e[t++])}}class dkt{constructor(e){this.accessibilityProvider=e,this.templateId="a18n"}renderTemplate(e){return{container:e,disposables:new ke}}renderElement(e,t,i){const r=this.accessibilityProvider.getAriaLabel(e),s=r&&typeof r!="string"?r:Hd(r);i.disposables.add(tn(a=>{this.setAriaLabel(a.readObservable(s),i.container)}));const o=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);typeof o=="number"?i.container.setAttribute("aria-level",`${o}`):i.container.removeAttribute("aria-level")}setAriaLabel(e,t){e?t.setAttribute("aria-label",e):t.removeAttribute("aria-label")}disposeElement(e,t,i,r){i.disposables.clear()}disposeTemplate(e){e.disposables.dispose()}}class hkt{constructor(e,t){this.list=e,this.dnd=t}getDragElements(e){const t=this.list.getSelectedElements();return t.indexOf(e)>-1?t:[e]}getDragURI(e){return this.dnd.getDragURI(e)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e,t)}onDragStart(e,t){this.dnd.onDragStart?.(e,t)}onDragOver(e,t,i,r,s){return this.dnd.onDragOver(e,t,i,r,s)}onDragLeave(e,t,i,r){this.dnd.onDragLeave?.(e,t,i,r)}onDragEnd(e){this.dnd.onDragEnd?.(e)}drop(e,t,i,r,s){this.dnd.drop(e,t,i,r,s)}dispose(){this.dnd.dispose()}}class dd{get onDidChangeFocus(){return Ge.map(this.eventBufferer.wrapEvent(this.focus.onChange),e=>this.toListEvent(e),this.disposables)}get onDidChangeSelection(){return Ge.map(this.eventBufferer.wrapEvent(this.selection.onChange),e=>this.toListEvent(e),this.disposables)}get domId(){return this.view.domId}get onDidScroll(){return this.view.onDidScroll}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseDown(){return this.view.onMouseDown}get onMouseOver(){return this.view.onMouseOver}get onMouseOut(){return this.view.onMouseOut}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let e=!1;const t=Ge.chain(this.disposables.add(new $n(this.view.domNode,"keydown")).event,s=>s.map(o=>new or(o)).filter(o=>e=o.keyCode===58||o.shiftKey&&o.keyCode===68).map(o=>Hn.stop(o,!0)).filter(()=>!1)),i=Ge.chain(this.disposables.add(new $n(this.view.domNode,"keyup")).event,s=>s.forEach(()=>e=!1).map(o=>new or(o)).filter(o=>o.keyCode===58||o.shiftKey&&o.keyCode===68).map(o=>Hn.stop(o,!0)).map(({browserEvent:o})=>{const a=this.getFocus(),l=a.length?a[0]:void 0,c=typeof l<"u"?this.view.element(l):void 0,u=typeof l<"u"?this.view.domElement(l):this.view.domNode;return{index:l,element:c,anchor:u,browserEvent:o}})),r=Ge.chain(this.view.onContextMenu,s=>s.filter(o=>!e).map(({element:o,index:a,browserEvent:l})=>({element:o,index:a,anchor:new qh(Ot(this.view.domNode),l),browserEvent:l})));return Ge.any(t,i,r)}get onKeyDown(){return this.disposables.add(new $n(this.view.domNode,"keydown")).event}get onDidFocus(){return Ge.signal(this.disposables.add(new $n(this.view.domNode,"focus",!0)).event)}get onDidBlur(){return Ge.signal(this.disposables.add(new $n(this.view.domNode,"blur",!0)).event)}constructor(e,t,i,r,s=akt){this.user=e,this._options=s,this.focus=new T8("focused"),this.anchor=new T8("anchor"),this.eventBufferer=new UP,this._ariaLabel="",this.disposables=new ke,this._onDidDispose=new fe,this.onDidDispose=this._onDidDispose.event;const o=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?this._options.accessibilityProvider?.getWidgetRole():"list";this.selection=new JSt(o!=="listbox");const a=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=s.accessibilityProvider,this.accessibilityProvider&&(a.push(new dkt(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant?.(this.onDidChangeActiveDescendant,this,this.disposables)),r=r.map(c=>new ukt(c.templateId,[...a,c]));const l={...s,dnd:s.dnd&&new hkt(this,s.dnd)};if(this.view=this.createListView(t,i,r,l),this.view.domNode.setAttribute("role",o),s.styleController)this.styleController=s.styleController(this.view.domId);else{const c=id(this.view.domNode);this.styleController=new b5e(c,this.view.domId)}if(this.spliceable=new zSt([new tq(this.focus,this.view,s.identityProvider),new tq(this.selection,this.view,s.identityProvider),new tq(this.anchor,this.view,s.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new rkt(this,this.view)),(typeof s.keyboardSupport!="boolean"||s.keyboardSupport)&&(this.keyboardController=new p5e(this,this.view,s),this.disposables.add(this.keyboardController)),s.keyboardNavigationLabelProvider){const c=s.keyboardNavigationDelegate||nkt;this.typeNavigationController=new ikt(this,this.view,s.keyboardNavigationLabelProvider,s.keyboardNavigationEventFilter??(()=>!0),c),this.disposables.add(this.typeNavigationController)}this.mouseController=this.createMouseController(s),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider&&(this.ariaLabel=this.accessibilityProvider.getWidgetAriaLabel()),this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}createListView(e,t,i,r){return new gf(e,t,i,r)}createMouseController(e){return new v5e(this)}updateOptions(e={}){this._options={...this._options,...e},this.typeNavigationController?.updateOptions(this._options),this._options.multipleSelectionController!==void 0&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(e),this.keyboardController?.updateOptions(e),this.view.updateOptions(e)}get options(){return this._options}splice(e,t,i=[]){if(e<0||e>this.view.length)throw new D1(this.user,`Invalid start index: ${e}`);if(t<0)throw new D1(this.user,`Invalid delete count: ${t}`);t===0&&i.length===0||this.eventBufferer.bufferEvents(()=>this.spliceable.splice(e,t,i))}rerender(){this.view.rerender()}element(e){return this.view.element(e)}indexOf(e){return this.view.indexOf(e)}indexAt(e){return this.view.indexAt(e)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get scrollTop(){return this.view.getScrollTop()}set scrollTop(e){this.view.setScrollTop(e)}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleIndex(){return this.view.firstVisibleIndex}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.view.domNode.setAttribute("aria-label",e)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(e,t){this.view.layout(e,t)}setSelection(e,t){for(const i of e)if(i<0||i>=this.length)throw new D1(this.user,`Invalid index ${i}`);this.selection.set(e,t)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map(e=>this.view.element(e))}setAnchor(e){if(typeof e>"u"){this.anchor.set([]);return}if(e<0||e>=this.length)throw new D1(this.user,`Invalid index ${e}`);this.anchor.set([e])}getAnchor(){return hae(this.anchor.get(),void 0)}getAnchorElement(){const e=this.getAnchor();return typeof e>"u"?void 0:this.element(e)}setFocus(e,t){for(const i of e)if(i<0||i>=this.length)throw new D1(this.user,`Invalid index ${i}`);this.focus.set(e,t)}focusNext(e=1,t=!1,i,r){if(this.length===0)return;const s=this.focus.get(),o=this.findNextIndex(s.length>0?s[0]+e:0,t,r);o>-1&&this.setFocus([o],i)}focusPrevious(e=1,t=!1,i,r){if(this.length===0)return;const s=this.focus.get(),o=this.findPreviousIndex(s.length>0?s[0]-e:0,t,r);o>-1&&this.setFocus([o],i)}async focusNextPage(e,t){let i=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);i=i===0?0:i-1;const r=this.getFocus()[0];if(r!==i&&(r===void 0||i>r)){const s=this.findPreviousIndex(i,!1,t);s>-1&&r!==s?this.setFocus([s],e):this.setFocus([i],e)}else{const s=this.view.getScrollTop();let o=s+this.view.renderHeight;i>r&&(o-=this.view.elementHeight(i)),this.view.setScrollTop(o),this.view.getScrollTop()!==s&&(this.setFocus([]),await Y_(0),await this.focusNextPage(e,t))}}async focusPreviousPage(e,t,i=()=>0){let r;const s=i(),o=this.view.getScrollTop()+s;o===0?r=this.view.indexAt(o):r=this.view.indexAfter(o-1);const a=this.getFocus()[0];if(a!==r&&(a===void 0||a>=r)){const l=this.findNextIndex(r,!1,t);l>-1&&a!==l?this.setFocus([l],e):this.setFocus([r],e)}else{const l=o;this.view.setScrollTop(o-this.view.renderHeight-s),this.view.getScrollTop()+i()!==l&&(this.setFocus([]),await Y_(0),await this.focusPreviousPage(e,t,i))}}focusLast(e,t){if(this.length===0)return;const i=this.findPreviousIndex(this.length-1,!1,t);i>-1&&this.setFocus([i],e)}focusFirst(e,t){this.focusNth(0,e,t)}focusNth(e,t,i){if(this.length===0)return;const r=this.findNextIndex(e,!1,i);r>-1&&this.setFocus([r],t)}findNextIndex(e,t=!1,i){for(let r=0;r=this.length&&!t)return-1;if(e=e%this.length,!i||i(this.element(e)))return e;e++}return-1}findPreviousIndex(e,t=!1,i){for(let r=0;rthis.view.element(e))}reveal(e,t,i=0){if(e<0||e>=this.length)throw new D1(this.user,`Invalid index ${e}`);const r=this.view.getScrollTop(),s=this.view.elementTop(e),o=this.view.elementHeight(e);if(yb(t)){const a=o-this.view.renderHeight+i;this.view.setScrollTop(a*Il(t,0,1)+s-i)}else{const a=s+o,l=r+this.view.renderHeight;s=l||(s=l&&o>=this.view.renderHeight?this.view.setScrollTop(s-i):a>=l&&this.view.setScrollTop(a-this.view.renderHeight))}}getRelativeTop(e,t=0){if(e<0||e>=this.length)throw new D1(this.user,`Invalid index ${e}`);const i=this.view.getScrollTop(),r=this.view.elementTop(e),s=this.view.elementHeight(e);if(ri+this.view.renderHeight)return null;const o=s-this.view.renderHeight+t;return Math.abs((i+t-r)/o)}getHTMLElement(){return this.view.domNode}getScrollableElement(){return this.view.scrollableElementDomNode}getElementID(e){return this.view.getElementDomId(e)}getElementTop(e){return this.view.elementTop(e)}style(e){this.styleController.style(e)}toListEvent({indexes:e,browserEvent:t}){return{indexes:e,elements:e.map(i=>this.view.element(i)),browserEvent:t}}_onFocusChange(){const e=this.focus.get();this.view.domNode.classList.toggle("element-focused",e.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){const e=this.focus.get();if(e.length>0){let t;this.accessibilityProvider?.getActiveDescendantId&&(t=this.accessibilityProvider.getActiveDescendantId(this.view.element(e[0]))),this.view.domNode.setAttribute("aria-activedescendant",t||this.view.getElementDomId(e[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){const e=this.selection.get();this.view.domNode.classList.toggle("selection-none",e.length===0),this.view.domNode.classList.toggle("selection-single",e.length===1),this.view.domNode.classList.toggle("selection-multiple",e.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}}e1([Ds],dd.prototype,"onDidChangeFocus",null);e1([Ds],dd.prototype,"onDidChangeSelection",null);e1([Ds],dd.prototype,"onContextMenu",null);e1([Ds],dd.prototype,"onKeyDown",null);e1([Ds],dd.prototype,"onDidFocus",null);e1([Ds],dd.prototype,"onDidBlur",null);const Ay=qe,y5e="selectOption.entry.template";class fkt{get templateId(){return y5e}renderTemplate(e){const t=Object.create(null);return t.root=e,t.text=Ne(e,Ay(".option-text")),t.detail=Ne(e,Ay(".option-detail")),t.decoratorRight=Ne(e,Ay(".option-decorator-right")),t}renderElement(e,t,i){const r=i,s=e.text,o=e.detail,a=e.decoratorRight,l=e.isDisabled;r.text.textContent=s,r.detail.textContent=o||"",r.decoratorRight.innerText=a||"",l?r.root.classList.add("option-disabled"):r.root.classList.remove("option-disabled")}disposeTemplate(e){}}class hy extends me{static{this.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN=32}static{this.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN=2}static{this.DEFAULT_MINIMUM_VISIBLE_OPTIONS=3}constructor(e,t,i,r,s){super(),this.options=[],this._currentSelection=0,this._hasDetails=!1,this._skipLayout=!1,this._sticky=!1,this._isVisible=!1,this.styles=r,this.selectBoxOptions=s||Object.create(null),typeof this.selectBoxOptions.minBottomMargin!="number"?this.selectBoxOptions.minBottomMargin=hy.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN:this.selectBoxOptions.minBottomMargin<0&&(this.selectBoxOptions.minBottomMargin=0),this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box monaco-select-box-dropdown-padding",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=new fe,this._register(this._onDidSelect),this.registerListeners(),this.constructSelectDropDown(i),this.selected=t||0,e&&this.setOptions(e,t),this.initStyleSheet()}setTitle(e){!this._hover&&e?this._hover=this._register(Bg().setupManagedHover(Yl("mouse"),this.selectElement,e)):this._hover&&this._hover.update(e)}getHeight(){return 22}getTemplateId(){return y5e}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=qe(".monaco-select-box-dropdown-container"),this.selectDropDownContainer.classList.add("monaco-select-box-dropdown-padding"),this.selectionDetailsPane=Ne(this.selectDropDownContainer,Ay(".select-box-details-pane"));const t=Ne(this.selectDropDownContainer,Ay(".select-box-dropdown-container-width-control")),i=Ne(t,Ay(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",Ne(i,this.widthControlElement),this._dropDownPosition=0,this.styleElement=id(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register(Ce(this.selectDropDownContainer,je.DRAG_START,r=>{Hn.stop(r,!0)}))}registerListeners(){this._register(Jr(this.selectElement,"change",t=>{this.selected=t.target.selectedIndex,this._onDidSelect.fire({index:t.target.selectedIndex,selected:t.target.value}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)})),this._register(Ce(this.selectElement,je.CLICK,t=>{Hn.stop(t),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(Ce(this.selectElement,je.MOUSE_DOWN,t=>{Hn.stop(t)}));let e;this._register(Ce(this.selectElement,"touchstart",t=>{e=this._isVisible})),this._register(Ce(this.selectElement,"touchend",t=>{Hn.stop(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(Ce(this.selectElement,je.KEY_DOWN,t=>{const i=new or(t);let r=!1;Rn?(i.keyCode===18||i.keyCode===16||i.keyCode===10||i.keyCode===3)&&(r=!0):(i.keyCode===18&&i.altKey||i.keyCode===16&&i.altKey||i.keyCode===10||i.keyCode===3)&&(r=!0),r&&(this.showSelectDropDown(),Hn.stop(t,!0))}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){$r(this.options,e)||(this.options=e,this.selectElement.options.length=0,this._hasDetails=!1,this._cachedMaxDetailsHeight=void 0,this.options.forEach((i,r)=>{this.selectElement.add(this.createOption(i.text,r,i.isDisabled)),typeof i.description=="string"&&(this._hasDetails=!0)})),t!==void 0&&(this.select(t),this._currentSelection=this.selected)}setOptionsList(){this.selectList?.splice(0,this.selectList.length,this.options)}select(e){e>=0&&ethis.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){this.container=e,e.classList.add("select-container"),e.appendChild(this.selectElement),this.styleSelectElement()}initStyleSheet(){const e=[];this.styles.listFocusBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`),this.styles.listFocusForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`),this.styles.decoratorRightForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`),this.styles.selectBackground&&this.styles.selectBorder&&this.styles.selectBorder!==this.styles.selectBackground?(e.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `)):this.styles.selectListBorder&&(e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `)),this.styles.listHoverForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`),this.styles.listHoverBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`),this.styles.listFocusOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1.6px dotted ${this.styles.listFocusOutline} !important; outline-offset: -1.6px !important; }`),this.styles.listHoverOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1.6px dashed ${this.styles.listHoverOutline} !important; outline-offset: -1.6px !important; }`),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }"),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }"),this.styleElement.textContent=e.join(` -`)}styleSelectElement(){const e=this.styles.selectBackground??"",t=this.styles.selectForeground??"",i=this.styles.selectBorder??"";this.selectElement.style.backgroundColor=e,this.selectElement.style.color=t,this.selectElement.style.borderColor=i}styleList(){const e=this.styles.selectBackground??"",t=A_(this.styles.selectListBackground,e);this.selectDropDownListContainer.style.backgroundColor=t,this.selectionDetailsPane.style.backgroundColor=t;const i=this.styles.focusBorder??"";this.selectDropDownContainer.style.outlineColor=i,this.selectDropDownContainer.style.outlineOffset="-1px",this.selectList.style(this.styles)}createOption(e,t,i){const r=document.createElement("option");return r.value=e,r.text=e,r.disabled=!!i,r}showSelectDropDown(){this.selectionDetailsPane.innerText="",!(!this.contextViewProvider||this._isVisible)&&(this.createSelectList(this.selectDropDownContainer),this.setOptionsList(),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e,!0),layout:()=>{this.layoutSelectDropDown()},onHide:()=>{this.selectDropDownContainer.classList.remove("visible"),this.selectElement.classList.remove("synthetic-focus")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._isVisible=!0,this.hideSelectDropDown(!1),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e),layout:()=>this.layoutSelectDropDown(),onHide:()=>{this.selectDropDownContainer.classList.remove("visible"),this.selectElement.classList.remove("synthetic-focus")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._currentSelection=this.selected,this._isVisible=!0,this.selectElement.setAttribute("aria-expanded","true"))}hideSelectDropDown(e){!this.contextViewProvider||!this._isVisible||(this._isVisible=!1,this.selectElement.setAttribute("aria-expanded","false"),e&&this.selectElement.focus(),this.contextViewProvider.hideContextView())}renderSelectDropDown(e,t){return e.appendChild(this.selectDropDownContainer),this.layoutSelectDropDown(t),{dispose:()=>{this.selectDropDownContainer.remove()}}}measureMaxDetailsHeight(){let e=0;return this.options.forEach((t,i)=>{this.updateDetail(i),this.selectionDetailsPane.offsetHeight>e&&(e=this.selectionDetailsPane.offsetHeight)}),e}layoutSelectDropDown(e){if(this._skipLayout)return!1;if(this.selectList){this.selectDropDownContainer.classList.add("visible");const t=Ot(this.selectElement),i=ms(this.selectElement),r=Ot(this.selectElement).getComputedStyle(this.selectElement),s=parseFloat(r.getPropertyValue("--dropdown-padding-top"))+parseFloat(r.getPropertyValue("--dropdown-padding-bottom")),o=t.innerHeight-i.top-i.height-(this.selectBoxOptions.minBottomMargin||0),a=i.top-hy.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN,l=this.selectElement.offsetWidth,c=this.setWidthControlElement(this.widthControlElement),u=Math.max(c,Math.round(l)).toString()+"px";this.selectDropDownContainer.style.width=u,this.selectList.getHTMLElement().style.height="",this.selectList.layout();let d=this.selectList.contentHeight;this._hasDetails&&this._cachedMaxDetailsHeight===void 0&&(this._cachedMaxDetailsHeight=this.measureMaxDetailsHeight());const h=this._hasDetails?this._cachedMaxDetailsHeight:0,f=d+s+h,g=Math.floor((o-s-h)/this.getHeight()),p=Math.floor((a-s-h)/this.getHeight());if(e)return i.top+i.height>t.innerHeight-22||i.topg&&this.options.length>g?(this._dropDownPosition=1,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectionDetailsPane.classList.remove("border-top"),this.selectionDetailsPane.classList.add("border-bottom")):(this._dropDownPosition=0,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectionDetailsPane.classList.remove("border-bottom"),this.selectionDetailsPane.classList.add("border-top")),!0);if(i.top+i.height>t.innerHeight-22||i.topo&&(d=g*this.getHeight())}else f>a&&(d=p*this.getHeight());return this.selectList.layout(d),this.selectList.domFocus(),this.selectList.length>0&&(this.selectList.setFocus([this.selected||0]),this.selectList.reveal(this.selectList.getFocus()[0]||0)),this._hasDetails?(this.selectList.getHTMLElement().style.height=d+s+"px",this.selectDropDownContainer.style.height=""):this.selectDropDownContainer.style.height=d+s+"px",this.updateDetail(this.selected),this.selectDropDownContainer.style.width=u,this.selectDropDownListContainer.setAttribute("tabindex","0"),this.selectElement.classList.add("synthetic-focus"),this.selectDropDownContainer.classList.add("synthetic-focus"),!0}else return!1}setWidthControlElement(e){let t=0;if(e){let i=0,r=0;this.options.forEach((s,o)=>{const a=s.detail?s.detail.length:0,l=s.decoratorRight?s.decoratorRight.length:0,c=s.text.length+a+l;c>r&&(i=o,r=c)}),e.textContent=this.options[i].text+(this.options[i].decoratorRight?this.options[i].decoratorRight+" ":""),t=qc(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=Ne(e,Ay(".select-box-dropdown-list-container")),this.listRenderer=new fkt,this.selectList=this._register(new dd("SelectBoxCustom",this.selectDropDownListContainer,this,[this.listRenderer],{useShadows:!1,verticalScrollMode:3,keyboardSupport:!1,mouseSupport:!1,accessibilityProvider:{getAriaLabel:r=>{let s=r.text;return r.detail&&(s+=`. ${r.detail}`),r.decoratorRight&&(s+=`. ${r.decoratorRight}`),r.description&&(s+=`. ${r.description}`),s},getWidgetAriaLabel:()=>w({key:"selectBox",comment:["Behave like native select dropdown element."]},"Select Box"),getRole:()=>Rn?"":"option",getWidgetRole:()=>"listbox"}})),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);const t=this._register(new $n(this.selectDropDownListContainer,"keydown")),i=Ge.chain(t.event,r=>r.filter(()=>this.selectList.length>0).map(s=>new or(s)));this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===3))(this.onEnter,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===2))(this.onEnter,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===9))(this.onEscape,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===16))(this.onUpArrow,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===18))(this.onDownArrow,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===12))(this.onPageDown,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===11))(this.onPageUp,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===14))(this.onHome,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===13))(this.onEnd,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode>=21&&s.keyCode<=56||s.keyCode>=85&&s.keyCode<=113))(this.onCharacter,this)),this._register(Ce(this.selectList.getHTMLElement(),je.POINTER_UP,r=>this.onPointerUp(r))),this._register(this.selectList.onMouseOver(r=>typeof r.index<"u"&&this.selectList.setFocus([r.index]))),this._register(this.selectList.onDidChangeFocus(r=>this.onListFocus(r))),this._register(Ce(this.selectDropDownContainer,je.FOCUS_OUT,r=>{!this._isVisible||xo(r.relatedTarget,this.selectDropDownContainer)||this.onListBlur()})),this.selectList.getHTMLElement().setAttribute("aria-label",this.selectBoxOptions.ariaLabel||""),this.selectList.getHTMLElement().setAttribute("aria-expanded","true"),this.styleList()}onPointerUp(e){if(!this.selectList.length)return;Hn.stop(e);const t=e.target;if(!t||t.classList.contains("slider"))return;const i=t.closest(".monaco-list-row");if(!i)return;const r=Number(i.getAttribute("data-index")),s=i.classList.contains("option-disabled");r>=0&&r{for(let o=0;othis.selected+2)this.selected+=2;else{if(t)return;this.selected++}this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onUpArrow(e){this.selected>0&&(Hn.stop(e,!0),this.options[this.selected-1].isDisabled&&this.selected>1?this.selected-=2:this.selected--,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0]))}onPageUp(e){Hn.stop(e),this.selectList.focusPreviousPage(),setTimeout(()=>{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected>0&&(this.selected--,this.selectList.setFocus([this.selected])),this.selectList.reveal(this.selected),this.select(this.selected)},1)}onHome(e){Hn.stop(e),!(this.options.length<2)&&(this.selected=0,this.options[this.selected].isDisabled&&this.selected>1&&this.selected++,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onEnd(e){Hn.stop(e),!(this.options.length<2)&&(this.selected=this.options.length-1,this.options[this.selected].isDisabled&&this.selected>1&&this.selected--,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onCharacter(e){const t=r_.toString(e.keyCode);let i=-1;for(let r=0;r{this._register(Ce(this.selectElement,e,t=>{this.selectElement.focus()}))}),this._register(Jr(this.selectElement,"click",e=>{Hn.stop(e,!0)})),this._register(Jr(this.selectElement,"change",e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})})),this._register(Jr(this.selectElement,"keydown",e=>{let t=!1;Rn?(e.keyCode===18||e.keyCode===16||e.keyCode===10)&&(t=!0):(e.keyCode===18&&e.altKey||e.keyCode===10||e.keyCode===3)&&(t=!0),t&&e.stopPropagation()}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){(!this.options||!$r(this.options,e))&&(this.options=e,this.selectElement.options.length=0,this.options.forEach((i,r)=>{this.selectElement.add(this.createOption(i.text,r,i.isDisabled))})),t!==void 0&&this.select(t)}select(e){this.options.length===0?this.selected=0:e>=0&&ethis.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.selected{this.element&&this.handleActionChangeEvent(r)}))}handleActionChangeEvent(e){e.enabled!==void 0&&this.updateEnabled(),e.checked!==void 0&&this.updateChecked(),e.class!==void 0&&this.updateClass(),e.label!==void 0&&(this.updateLabel(),this.updateTooltip()),e.tooltip!==void 0&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new Aw)),this._actionRunner}set actionRunner(e){this._actionRunner=e}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){const t=this.element=e;this._register(Fr.addTarget(e));const i=this.options&&this.options.draggable;i&&(e.draggable=!0,Xd&&this._register(Ce(e,je.DRAG_START,r=>r.dataTransfer?.setData(DN.TEXT,this._action.label)))),this._register(Ce(t,gr.Tap,r=>this.onClick(r,!0))),this._register(Ce(t,je.MOUSE_DOWN,r=>{i||Hn.stop(r,!0),this._action.enabled&&r.button===0&&t.classList.add("active")})),Rn&&this._register(Ce(t,je.CONTEXT_MENU,r=>{r.button===0&&r.ctrlKey===!0&&this.onClick(r)})),this._register(Ce(t,je.CLICK,r=>{Hn.stop(r,!0),this.options&&this.options.isMenu||this.onClick(r)})),this._register(Ce(t,je.DBLCLICK,r=>{Hn.stop(r,!0)})),[je.MOUSE_UP,je.MOUSE_OUT].forEach(r=>{this._register(Ce(t,r,s=>{Hn.stop(s),t.classList.remove("active")}))})}onClick(e,t=!1){Hn.stop(e,!0);const i=Bu(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,i)}focus(){this.element&&(this.element.tabIndex=0,this.element.focus(),this.element.classList.add("focused"))}blur(){this.element&&(this.element.blur(),this.element.tabIndex=-1,this.element.classList.remove("focused"))}setFocusable(e){this.element&&(this.element.tabIndex=e?0:-1)}get trapsArrowNavigation(){return!1}updateEnabled(){}updateLabel(){}getClass(){return this.action.class}getTooltip(){return this.action.tooltip}updateTooltip(){if(!this.element)return;const e=this.getTooltip()??"";if(this.updateAriaLabel(),this.options.hoverDelegate?.showNativeHover)this.element.title=e;else if(!this.customHover&&e!==""){const t=this.options.hoverDelegate??Yl("element");this.customHover=this._store.add(Bg().setupManagedHover(t,this.element,e))}else this.customHover&&this.customHover.update(e)}updateAriaLabel(){if(this.element){const e=this.getTooltip()??"";this.element.setAttribute("aria-label",e)}}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),this._context=void 0,super.dispose()}}class vE extends Xf{constructor(e,t,i){super(e,t,i),this.options=i,this.options.icon=i.icon!==void 0?i.icon:!1,this.options.label=i.label!==void 0?i.label:!0,this.cssClass=""}render(e){super.render(e),oi(this.element);const t=document.createElement("a");if(t.classList.add("action-label"),t.setAttribute("role",this.getDefaultAriaRole()),this.label=t,this.element.appendChild(t),this.options.label&&this.options.keybinding){const i=document.createElement("span");i.classList.add("keybinding"),i.textContent=this.options.keybinding,this.element.appendChild(i)}this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}getDefaultAriaRole(){return this._action.id===na.ID?"presentation":this.options.isMenu?"menuitem":this.options.isTabList?"tab":"button"}focus(){this.label&&(this.label.tabIndex=0,this.label.focus())}blur(){this.label&&(this.label.tabIndex=-1)}setFocusable(e){this.label&&(this.label.tabIndex=e?0:-1)}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this.action.label)}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:!this.options.label&&this.action.label&&this.options.icon&&(e=this.action.label,this.options.keybinding&&(e=w({key:"titleLabel",comment:["action title","action keybinding"]},"{0} ({1})",e,this.options.keybinding))),e??void 0}updateClass(){this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.options.icon?(this.cssClass=this.getClass(),this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):this.label?.classList.remove("codicon")}updateEnabled(){this.action.enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),this.element?.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),this.element?.classList.add("disabled"))}updateAriaLabel(){if(this.label){const e=this.getTooltip()??"";this.label.setAttribute("aria-label",e)}}updateChecked(){this.label&&(this.action.checked!==void 0?(this.label.classList.toggle("checked",this.action.checked),this.options.isTabList?this.label.setAttribute("aria-selected",this.action.checked?"true":"false"):(this.label.setAttribute("aria-checked",this.action.checked?"true":"false"),this.label.setAttribute("role","checkbox"))):(this.label.classList.remove("checked"),this.label.removeAttribute(this.options.isTabList?"aria-selected":"aria-checked"),this.label.setAttribute("role",this.getDefaultAriaRole())))}}class mkt extends Xf{constructor(e,t,i,r,s,o,a){super(e,t),this.selectBox=new pkt(i,r,s,o,a),this.selectBox.setFocusable(!1),this._register(this.selectBox),this.registerListeners()}select(e){this.selectBox.select(e)}registerListeners(){this._register(this.selectBox.onDidSelect(e=>this.runAction(e.selected,e.index)))}runAction(e,t){this.actionRunner.run(this._action,this.getActionContext(e,t))}getActionContext(e,t){return e}setFocusable(e){this.selectBox.setFocusable(e)}focus(){this.selectBox?.focus()}blur(){this.selectBox?.blur()}render(e){this.selectBox.render(e)}}class _kt extends Aw{constructor(e,t){super(),this._onDidChangeVisibility=this._register(new fe),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this._element=Ne(e,qe(".monaco-dropdown")),this._label=Ne(this._element,qe(".dropdown-label"));let i=t.labelRenderer;i||(i=s=>(s.textContent=t.label||"",null));for(const s of[je.CLICK,je.MOUSE_DOWN,gr.Tap])this._register(Ce(this.element,s,o=>Hn.stop(o,!0)));for(const s of[je.MOUSE_DOWN,gr.Tap])this._register(Ce(this._label,s,o=>{Hae(o)&&(o.detail>1||o.button!==0)||(this.visible?this.hide():this.show())}));this._register(Ce(this._label,je.KEY_UP,s=>{const o=new or(s);(o.equals(3)||o.equals(10))&&(Hn.stop(s,!0),this.visible?this.hide():this.show())}));const r=i(this._label);r&&this._register(r),this._register(Fr.addTarget(this._label))}get element(){return this._element}show(){this.visible||(this.visible=!0,this._onDidChangeVisibility.fire(!0))}hide(){this.visible&&(this.visible=!1,this._onDidChangeVisibility.fire(!1))}dispose(){super.dispose(),this.hide(),this.boxContainer&&(this.boxContainer.remove(),this.boxContainer=void 0),this.contents&&(this.contents.remove(),this.contents=void 0),this._label&&(this._label.remove(),this._label=void 0)}}let vkt=class extends _kt{constructor(e,t){super(e,t),this._options=t,this._actions=[],this.actions=t.actions||[]}set menuOptions(e){this._menuOptions=e}get menuOptions(){return this._menuOptions}get actions(){return this._options.actionProvider?this._options.actionProvider.getActions():this._actions}set actions(e){this._actions=e}show(){super.show(),this.element.classList.add("active"),this._options.contextMenuProvider.showContextMenu({getAnchor:()=>this.element,getActions:()=>this.actions,getActionsContext:()=>this.menuOptions?this.menuOptions.context:null,getActionViewItem:(e,t)=>this.menuOptions&&this.menuOptions.actionViewItemProvider?this.menuOptions.actionViewItemProvider(e,t):void 0,getKeyBinding:e=>this.menuOptions&&this.menuOptions.getKeyBinding?this.menuOptions.getKeyBinding(e):void 0,getMenuClassName:()=>this._options.menuClassName||"",onHide:()=>this.onHide(),actionRunner:this.menuOptions?this.menuOptions.actionRunner:void 0,anchorAlignment:this.menuOptions?this.menuOptions.anchorAlignment:0,domForShadowRoot:this._options.menuAsChild?this.element:void 0,skipTelemetry:this._options.skipTelemetry})}hide(){super.hide()}onHide(){this.hide(),this.element.classList.remove("active")}};class D8 extends Xf{constructor(e,t,i,r=Object.create(null)){super(null,e,r),this.actionItem=null,this._onDidChangeVisibility=this._register(new fe),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this.menuActionsOrProvider=t,this.contextMenuProvider=i,this.options=r,this.options.actionRunner&&(this.actionRunner=this.options.actionRunner)}render(e){this.actionItem=e;const t=s=>{this.element=Ne(s,qe("a.action-label"));let o=[];return typeof this.options.classNames=="string"?o=this.options.classNames.split(/\s+/g).filter(a=>!!a):this.options.classNames&&(o=this.options.classNames),o.find(a=>a==="icon")||o.push("codicon"),this.element.classList.add(...o),this.element.setAttribute("role","button"),this.element.setAttribute("aria-haspopup","true"),this.element.setAttribute("aria-expanded","false"),this._action.label&&this._register(Bg().setupManagedHover(this.options.hoverDelegate??Yl("mouse"),this.element,this._action.label)),this.element.ariaLabel=this._action.label||"",null},i=Array.isArray(this.menuActionsOrProvider),r={contextMenuProvider:this.contextMenuProvider,labelRenderer:t,menuAsChild:this.options.menuAsChild,actions:i?this.menuActionsOrProvider:void 0,actionProvider:i?void 0:this.menuActionsOrProvider,skipTelemetry:this.options.skipTelemetry};if(this.dropdownMenu=this._register(new vkt(e,r)),this._register(this.dropdownMenu.onDidChangeVisibility(s=>{this.element?.setAttribute("aria-expanded",`${s}`),this._onDidChangeVisibility.fire(s)})),this.dropdownMenu.menuOptions={actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,getKeyBinding:this.options.keybindingProvider,context:this._context},this.options.anchorAlignmentProvider){const s=this;this.dropdownMenu.menuOptions={...this.dropdownMenu.menuOptions,get anchorAlignment(){return s.options.anchorAlignmentProvider()}}}this.updateTooltip(),this.updateEnabled()}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:this.action.label&&(e=this.action.label),e??void 0}setActionContext(e){super.setActionContext(e),this.dropdownMenu&&(this.dropdownMenu.menuOptions?this.dropdownMenu.menuOptions.context=e:this.dropdownMenu.menuOptions={context:e})}show(){this.dropdownMenu?.show()}updateEnabled(){const e=!this.action.enabled;this.actionItem?.classList.toggle("disabled",e),this.element?.classList.toggle("disabled",e)}}function bkt(n){return n&&typeof n=="object"&&typeof n.original=="string"&&typeof n.value=="string"}function ykt(n){return n?n.condition!==void 0:!1}var gk;(function(n){n[n.STORAGE_DOES_NOT_EXIST=0]="STORAGE_DOES_NOT_EXIST",n[n.STORAGE_IN_MEMORY=1]="STORAGE_IN_MEMORY"})(gk||(gk={}));var LS;(function(n){n[n.None=0]="None",n[n.Initialized=1]="Initialized",n[n.Closed=2]="Closed"})(LS||(LS={}));class CI extends me{static{this.DEFAULT_FLUSH_DELAY=100}constructor(e,t=Object.create(null)){super(),this.database=e,this.options=t,this._onDidChangeStorage=this._register(new Ew),this.onDidChangeStorage=this._onDidChangeStorage.event,this.state=LS.None,this.cache=new Map,this.flushDelayer=this._register(new Z4e(CI.DEFAULT_FLUSH_DELAY)),this.pendingDeletes=new Set,this.pendingInserts=new Map,this.whenFlushedCallbacks=[],this.registerListeners()}registerListeners(){this._register(this.database.onDidChangeItemsExternal(e=>this.onDidChangeItemsExternal(e)))}onDidChangeItemsExternal(e){this._onDidChangeStorage.pause();try{e.changed?.forEach((t,i)=>this.acceptExternal(i,t)),e.deleted?.forEach(t=>this.acceptExternal(t,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,t){if(this.state===LS.Closed)return;let i=!1;Bu(t)?i=this.cache.delete(e):this.cache.get(e)!==t&&(this.cache.set(e,t),i=!0),i&&this._onDidChangeStorage.fire({key:e,external:!0})}get(e,t){const i=this.cache.get(e);return Bu(i)?t:i}getBoolean(e,t){const i=this.get(e);return Bu(i)?t:i==="true"}getNumber(e,t){const i=this.get(e);return Bu(i)?t:parseInt(i,10)}async set(e,t,i=!1){if(this.state===LS.Closed)return;if(Bu(t))return this.delete(e,i);const r=Mo(t)||Array.isArray(t)?XCt(t):String(t);if(this.cache.get(e)!==r)return this.cache.set(e,r),this.pendingInserts.set(e,r),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:i}),this.doFlush()}async delete(e,t=!1){if(!(this.state===LS.Closed||!this.cache.delete(e)))return this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire({key:e,external:t}),this.doFlush()}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}async flushPending(){if(!this.hasPending)return;const e={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(e).finally(()=>{if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)this.whenFlushedCallbacks.pop()?.()})}async doFlush(e){return this.options.hint===gk.STORAGE_IN_MEMORY?this.flushPending():this.flushDelayer.trigger(()=>this.flushPending(),e)}}class nq{constructor(){this.onDidChangeItemsExternal=Ge.None,this.items=new Map}async updateItems(e){e.insert?.forEach((t,i)=>this.items.set(i,t)),e.delete?.forEach(t=>this.items.delete(t))}}const JF="__$__targetStorageMarker",pf=On("storageService");var AN;(function(n){n[n.NONE=0]="NONE",n[n.SHUTDOWN=1]="SHUTDOWN"})(AN||(AN={}));function wkt(n){const e=n.get(JF);if(e)try{return JSON.parse(e)}catch{}return Object.create(null)}class $le extends me{static{this.DEFAULT_FLUSH_INTERVAL=60*1e3}constructor(e={flushInterval:$le.DEFAULT_FLUSH_INTERVAL}){super(),this.options=e,this._onDidChangeValue=this._register(new Ew),this._onDidChangeTarget=this._register(new Ew),this._onWillSaveState=this._register(new fe),this.onWillSaveState=this._onWillSaveState.event,this._workspaceKeyTargets=void 0,this._profileKeyTargets=void 0,this._applicationKeyTargets=void 0}onDidChangeValue(e,t,i){return Ge.filter(this._onDidChangeValue.event,r=>r.scope===e&&(t===void 0||r.key===t),i)}emitDidChangeValue(e,t){const{key:i,external:r}=t;if(i===JF){switch(e){case-1:this._applicationKeyTargets=void 0;break;case 0:this._profileKeyTargets=void 0;break;case 1:this._workspaceKeyTargets=void 0;break}this._onDidChangeTarget.fire({scope:e})}else this._onDidChangeValue.fire({scope:e,key:i,target:this.getKeyTargets(e)[i],external:r})}get(e,t,i){return this.getStorage(t)?.get(e,i)}getBoolean(e,t,i){return this.getStorage(t)?.getBoolean(e,i)}getNumber(e,t,i){return this.getStorage(t)?.getNumber(e,i)}store(e,t,i,r,s=!1){if(Bu(t)){this.remove(e,i,s);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,i,r),this.getStorage(i)?.set(e,t,s)})}remove(e,t,i=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,t,void 0),this.getStorage(t)?.delete(e,i)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}updateKeyTarget(e,t,i,r=!1){const s=this.getKeyTargets(t);typeof i=="number"?s[e]!==i&&(s[e]=i,this.getStorage(t)?.set(JF,JSON.stringify(s),r)):typeof s[e]=="number"&&(delete s[e],this.getStorage(t)?.set(JF,JSON.stringify(s),r))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get profileKeyTargets(){return this._profileKeyTargets||(this._profileKeyTargets=this.loadKeyTargets(0)),this._profileKeyTargets}get applicationKeyTargets(){return this._applicationKeyTargets||(this._applicationKeyTargets=this.loadKeyTargets(-1)),this._applicationKeyTargets}getKeyTargets(e){switch(e){case-1:return this.applicationKeyTargets;case 0:return this.profileKeyTargets;default:return this.workspaceKeyTargets}}loadKeyTargets(e){const t=this.getStorage(e);return t?wkt(t):Object.create(null)}}class Ckt extends $le{constructor(){super(),this.applicationStorage=this._register(new CI(new nq,{hint:gk.STORAGE_IN_MEMORY})),this.profileStorage=this._register(new CI(new nq,{hint:gk.STORAGE_IN_MEMORY})),this.workspaceStorage=this._register(new CI(new nq,{hint:gk.STORAGE_IN_MEMORY})),this._register(this.workspaceStorage.onDidChangeStorage(e=>this.emitDidChangeValue(1,e))),this._register(this.profileStorage.onDidChangeStorage(e=>this.emitDidChangeValue(0,e))),this._register(this.applicationStorage.onDidChangeStorage(e=>this.emitDidChangeValue(-1,e)))}getStorage(e){switch(e){case-1:return this.applicationStorage;case 0:return this.profileStorage;default:return this.workspaceStorage}}}function xkt(n,e){const t={...e};for(const i in n){const r=n[i];t[i]=r!==void 0?it(r):void 0}return t}const Skt={keybindingLabelBackground:it(gwt),keybindingLabelForeground:it(pwt),keybindingLabelBorder:it(mwt),keybindingLabelBottomBorder:it(_wt),keybindingLabelShadow:it(JL)},kkt={buttonForeground:it(TFe),buttonSeparator:it(ewt),buttonBackground:it(LD),buttonHoverBackground:it(twt),buttonSecondaryForeground:it(iwt),buttonSecondaryBackground:it(ZX),buttonSecondaryHoverBackground:it(rwt),buttonBorder:it(nwt)},Ekt={progressBarBackground:it(gyt)},I8={inputActiveOptionBorder:it(cW),inputActiveOptionForeground:it(uW),inputActiveOptionBackground:it(eO)};it(TD),it(swt),it(owt),it(awt),it(lwt),it(cwt),it(uwt);it(dwt),it(fwt),it(hwt);it(ju),it(oW),it(JL),it(Yn),it(Oyt),it(Myt),it(Fyt),it(hyt);const A8={inputBackground:it(YX),inputForeground:it(EFe),inputBorder:it(LFe),inputValidationInfoBorder:it(qyt),inputValidationInfoBackground:it(Uyt),inputValidationInfoForeground:it(jyt),inputValidationWarningBorder:it(Yyt),inputValidationWarningBackground:it(Kyt),inputValidationWarningForeground:it(Gyt),inputValidationErrorBorder:it(Qyt),inputValidationErrorBackground:it(Zyt),inputValidationErrorForeground:it(Xyt)},Lkt={listFilterWidgetBackground:it(Iwt),listFilterWidgetOutline:it(Awt),listFilterWidgetNoMatchesOutline:it(Nwt),listFilterWidgetShadow:it(Rwt),inputBoxStyles:A8,toggleStyles:I8},w5e={badgeBackground:it(YF),badgeForeground:it(fyt),badgeBorder:it(Yn)};it(Ryt),it(Nyt),it(h1e),it(h1e),it(Pyt);const yC={listBackground:void 0,listInactiveFocusForeground:void 0,listFocusBackground:it(vwt),listFocusForeground:it(bwt),listFocusOutline:it(ywt),listActiveSelectionBackground:it(Rw),listActiveSelectionForeground:it(yN),listActiveSelectionIconForeground:it(DFe),listFocusAndSelectionOutline:it(wwt),listFocusAndSelectionBackground:it(Rw),listFocusAndSelectionForeground:it(yN),listInactiveSelectionBackground:it(Cwt),listInactiveSelectionIconForeground:it(Swt),listInactiveSelectionForeground:it(xwt),listInactiveFocusBackground:it(kwt),listInactiveFocusOutline:it(Ewt),listHoverBackground:it(IFe),listHoverForeground:it(AFe),listDropOverBackground:it(Lwt),listDropBetweenBackground:it(Twt),listSelectionOutline:it(Ar),listHoverOutline:it(Ar),treeIndentGuidesStroke:it(NFe),treeInactiveIndentGuidesStroke:it(Pwt),treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:it(ule),tableColumnsBorder:it(Owt),tableOddRowsBackgroundColor:it(Mwt)};function wC(n){return xkt(n,yC)}const Tkt={selectBackground:it(dW),selectListBackground:it(Jyt),selectForeground:it(mle),decoratorRightForeground:it(RFe),selectBorder:it(_le),focusBorder:it(Zp),listFocusBackground:it(CN),listInactiveSelectionIconForeground:it(vle),listFocusForeground:it(wN),listFocusOutline:oyt(Ar,Te.transparent.toString()),listHoverBackground:it(IFe),listHoverForeground:it(AFe),listHoverOutline:it(Ar),selectListBorder:it(dle),listBackground:void 0,listActiveSelectionBackground:void 0,listActiveSelectionForeground:void 0,listActiveSelectionIconForeground:void 0,listFocusAndSelectionBackground:void 0,listDropOverBackground:void 0,listDropBetweenBackground:void 0,listInactiveSelectionBackground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusBackground:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listFocusAndSelectionForeground:void 0,listFocusAndSelectionOutline:void 0,listInactiveFocusForeground:void 0,tableColumnsBorder:void 0,tableOddRowsBackgroundColor:void 0,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},Dkt={shadowColor:it(JL),borderColor:it(Fwt),foregroundColor:it(Bwt),backgroundColor:it($wt),selectionForegroundColor:it(Wwt),selectionBackgroundColor:it(Hwt),selectionBorderColor:it(Vwt),separatorColor:it(zwt),scrollbarShadow:it(ule),scrollbarSliderBackground:it(vFe),scrollbarSliderHoverBackground:it(bFe),scrollbarSliderActiveBackground:it(yFe)};var kW=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},fc=function(n,e){return function(t,i){e(t,i,n)}};function Ikt(n,e,t,i){let r,s,o;if(Array.isArray(n))o=n,r=e,s=t;else{const c=e;o=n.getActions(c),r=t,s=i}const a=f_.getInstance(),l=a.keyStatus.altKey||(Ta||zl)&&a.keyStatus.shiftKey;C5e(o,r,l,s?c=>c===s:c=>c==="navigation")}function EW(n,e,t,i,r,s){let o,a,l,c,u;if(Array.isArray(n))u=n,o=e,a=t,l=i,c=r;else{const h=e;u=n.getActions(h),o=t,a=i,l=r,c=s}C5e(u,o,!1,typeof a=="string"?h=>h===a:a,l,c)}function C5e(n,e,t,i=o=>o==="navigation",r=()=>!1,s=!1){let o,a;Array.isArray(e)?(o=e,a=e):(o=e.primary,a=e.secondary);const l=new Set;for(const[c,u]of n){let d;i(c)?(d=o,d.length>0&&s&&d.push(new na)):(d=a,d.length>0&&d.push(new na));for(let h of u){t&&(h=h instanceof ou&&h.alt?h.alt:h);const f=d.push(h);h instanceof rE&&l.add({group:c,action:h,index:f-1})}}for(const{group:c,action:u,index:d}of l){const h=i(c)?o:a,f=u.actions;r(u,c,h.length)&&h.splice(d,1,...f)}}let Db=class extends vE{constructor(e,t,i,r,s,o,a,l){super(void 0,e,{icon:!!(e.class||e.item.icon),label:!e.class&&!e.item.icon,draggable:t?.draggable,keybinding:t?.keybinding,hoverDelegate:t?.hoverDelegate}),this._options=t,this._keybindingService=i,this._notificationService=r,this._contextKeyService=s,this._themeService=o,this._contextMenuService=a,this._accessibilityService=l,this._wantsAltCommand=!1,this._itemClassDispose=this._register(new To),this._altKey=f_.getInstance()}get _menuItemAction(){return this._action}get _commandAction(){return this._wantsAltCommand&&this._menuItemAction.alt||this._menuItemAction}async onClick(e){e.preventDefault(),e.stopPropagation();try{await this.actionRunner.run(this._commandAction,this._context)}catch(t){this._notificationService.error(t)}}render(e){if(super.render(e),e.classList.add("menu-entry"),this.options.icon&&this._updateItemClass(this._menuItemAction.item),this._menuItemAction.alt){let t=!1;const i=()=>{const r=!!this._menuItemAction.alt?.enabled&&(!this._accessibilityService.isMotionReduced()||t)&&(this._altKey.keyStatus.altKey||this._altKey.keyStatus.shiftKey&&t);r!==this._wantsAltCommand&&(this._wantsAltCommand=r,this.updateLabel(),this.updateTooltip(),this.updateClass())};this._register(this._altKey.event(i)),this._register(Ce(e,"mouseleave",r=>{t=!1,i()})),this._register(Ce(e,"mouseenter",r=>{t=!0,i()})),i()}}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this._commandAction.label)}getTooltip(){const e=this._keybindingService.lookupKeybinding(this._commandAction.id,this._contextKeyService),t=e&&e.getLabel(),i=this._commandAction.tooltip||this._commandAction.label;let r=t?w("titleAndKb","{0} ({1})",i,t):i;if(!this._wantsAltCommand&&this._menuItemAction.alt?.enabled){const s=this._menuItemAction.alt.tooltip||this._menuItemAction.alt.label,o=this._keybindingService.lookupKeybinding(this._menuItemAction.alt.id,this._contextKeyService),a=o&&o.getLabel(),l=a?w("titleAndKb","{0} ({1})",s,a):s;r=w("titleAndKbAndAlt",`{0} -[{1}] {2}`,r,Ole.modifierLabels[eu].altKey,l)}return r}updateClass(){this.options.icon&&(this._commandAction!==this._menuItemAction?this._menuItemAction.alt&&this._updateItemClass(this._menuItemAction.alt.item):this._updateItemClass(this._menuItemAction.item))}_updateItemClass(e){this._itemClassDispose.value=void 0;const{element:t,label:i}=this;if(!t||!i)return;const r=this._commandAction.checked&&ykt(e.toggled)&&e.toggled.icon?e.toggled.icon:e.icon;if(r)if(zt.isThemeIcon(r)){const s=zt.asClassNameArray(r);i.classList.add(...s),this._itemClassDispose.value=Lt(()=>{i.classList.remove(...s)})}else i.style.backgroundImage=aE(this._themeService.getColorTheme().type)?Z_(r.dark):Z_(r.light),i.classList.add("icon"),this._itemClassDispose.value=Qh(Lt(()=>{i.style.backgroundImage="",i.classList.remove("icon")}),this._themeService.onDidColorThemeChange(()=>{this.updateClass()}))}};Db=kW([fc(2,xi),fc(3,Ts),fc(4,jt),fc(5,go),fc(6,mu),fc(7,_u)],Db);class Wle extends Db{render(e){this.options.label=!0,this.options.icon=!1,super.render(e),e.classList.add("text-only"),e.classList.toggle("use-comma",this._options?.useComma??!1)}updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Wle._symbolPrintEnter(e);this._options?.conversational?this.label.textContent=w({key:"content2",comment:['A label with keybindg like "ESC to dismiss"']},"{1} to {0}",this._action.label,t):this.label.textContent=w({key:"content",comment:["A label","A keybinding"]},"{0} ({1})",this._action.label,t)}}static _symbolPrintEnter(e){return e.getLabel()?.replace(/\benter\b/gi,"⏎").replace(/\bEscape\b/gi,"Esc")}}let kQ=class extends D8{constructor(e,t,i,r,s){const o={...t,menuAsChild:t?.menuAsChild??!1,classNames:t?.classNames??(zt.isThemeIcon(e.item.icon)?zt.asClassName(e.item.icon):void 0),keybindingProvider:t?.keybindingProvider??(a=>i.lookupKeybinding(a.id))};super(e,{getActions:()=>e.actions},r,o),this._keybindingService=i,this._contextMenuService=r,this._themeService=s}render(e){super.render(e),oi(this.element),e.classList.add("menu-entry");const t=this._action,{icon:i}=t.item;if(i&&!zt.isThemeIcon(i)){this.element.classList.add("icon");const r=()=>{this.element&&(this.element.style.backgroundImage=aE(this._themeService.getColorTheme().type)?Z_(i.dark):Z_(i.light))};r(),this._register(this._themeService.onDidColorThemeChange(()=>{r()}))}}};kQ=kW([fc(2,xi),fc(3,mu),fc(4,go)],kQ);let EQ=class extends Xf{constructor(e,t,i,r,s,o,a,l){super(null,e),this._keybindingService=i,this._notificationService=r,this._contextMenuService=s,this._menuService=o,this._instaService=a,this._storageService=l,this._container=null,this._options=t,this._storageKey=`${e.item.submenu.id}_lastActionId`;let c;const u=t?.persistLastActionId?l.get(this._storageKey,1):void 0;u&&(c=e.actions.find(h=>u===h.id)),c||(c=e.actions[0]),this._defaultAction=this._instaService.createInstance(Db,c,{keybinding:this._getDefaultActionKeybindingLabel(c)});const d={keybindingProvider:h=>this._keybindingService.lookupKeybinding(h.id),...t,menuAsChild:t?.menuAsChild??!0,classNames:t?.classNames??["codicon","codicon-chevron-down"],actionRunner:t?.actionRunner??new Aw};this._dropdown=new D8(e,e.actions,this._contextMenuService,d),this._register(this._dropdown.actionRunner.onDidRun(h=>{h.action instanceof ou&&this.update(h.action)}))}update(e){this._options?.persistLastActionId&&this._storageService.store(this._storageKey,e.id,1,1),this._defaultAction.dispose(),this._defaultAction=this._instaService.createInstance(Db,e,{keybinding:this._getDefaultActionKeybindingLabel(e)}),this._defaultAction.actionRunner=new class extends Aw{async runAction(t,i){await t.run(void 0)}},this._container&&this._defaultAction.render(Vae(this._container,qe(".action-container")))}_getDefaultActionKeybindingLabel(e){let t;if(this._options?.renderKeybindingWithDefaultActionLabel){const i=this._keybindingService.lookupKeybinding(e.id);i&&(t=`(${i.getLabel()})`)}return t}setActionContext(e){super.setActionContext(e),this._defaultAction.setActionContext(e),this._dropdown.setActionContext(e)}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-default");const t=qe(".action-container");this._defaultAction.render(Ne(this._container,t)),this._register(Ce(t,je.KEY_DOWN,r=>{const s=new or(r);s.equals(17)&&(this._defaultAction.element.tabIndex=-1,this._dropdown.focus(),s.stopPropagation())}));const i=qe(".dropdown-action-container");this._dropdown.render(Ne(this._container,i)),this._register(Ce(i,je.KEY_DOWN,r=>{const s=new or(r);s.equals(15)&&(this._defaultAction.element.tabIndex=0,this._dropdown.setFocusable(!1),this._defaultAction.element?.focus(),s.stopPropagation())}))}focus(e){e?this._dropdown.focus():(this._defaultAction.element.tabIndex=0,this._defaultAction.element.focus())}blur(){this._defaultAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._defaultAction.element.tabIndex=0:(this._defaultAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}dispose(){this._defaultAction.dispose(),this._dropdown.dispose(),super.dispose()}};EQ=kW([fc(2,xi),fc(3,Ts),fc(4,mu),fc(5,ld),fc(6,Tt),fc(7,pf)],EQ);let LQ=class extends mkt{constructor(e,t){super(null,e,e.actions.map(i=>({text:i.id===na.ID?"─────────":i.label,isDisabled:!i.enabled})),0,t,Tkt,{ariaLabel:e.tooltip,optionsAsChildren:!0}),this.select(Math.max(0,e.actions.findIndex(i=>i.checked)))}render(e){super.render(e),e.style.borderColor=it(_le)}runAction(e,t){const i=this.action.actions[t];i&&this.actionRunner.run(i)}};LQ=kW([fc(1,m0)],LQ);function x5e(n,e,t){return e instanceof ou?n.createInstance(Db,e,t):e instanceof ck?e.item.isSelection?n.createInstance(LQ,e):e.item.rememberDefaultAction?n.createInstance(EQ,e,{...t,persistLastActionId:!0}):n.createInstance(kQ,e,t):void 0}class ed extends me{constructor(e,t={}){super(),this._actionRunnerDisposables=this._register(new ke),this.viewItemDisposables=this._register(new yae),this.triggerKeyDown=!1,this.focusable=!0,this._onDidBlur=this._register(new fe),this.onDidBlur=this._onDidBlur.event,this._onDidCancel=this._register(new fe({onWillAddFirstListener:()=>this.cancelHasListener=!0})),this.onDidCancel=this._onDidCancel.event,this.cancelHasListener=!1,this._onDidRun=this._register(new fe),this.onDidRun=this._onDidRun.event,this._onWillRun=this._register(new fe),this.onWillRun=this._onWillRun.event,this.options=t,this._context=t.context??null,this._orientation=this.options.orientation??0,this._triggerKeys={keyDown:this.options.triggerKeys?.keyDown??!1,keys:this.options.triggerKeys?.keys??[3,10]},this._hoverDelegate=t.hoverDelegate??this._register(_E()),this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new Aw,this._actionRunnerDisposables.add(this._actionRunner)),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(s=>this._onDidRun.fire(s))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(s=>this._onWillRun.fire(s))),this.viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar";let i,r;switch(this._orientation){case 0:i=[15],r=[17];break;case 1:i=[16],r=[18],this.domNode.className+=" vertical";break}this._register(Ce(this.domNode,je.KEY_DOWN,s=>{const o=new or(s);let a=!0;const l=typeof this.focusedItem=="number"?this.viewItems[this.focusedItem]:void 0;i&&(o.equals(i[0])||o.equals(i[1]))?a=this.focusPrevious():r&&(o.equals(r[0])||o.equals(r[1]))?a=this.focusNext():o.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():o.equals(14)?a=this.focusFirst():o.equals(13)?a=this.focusLast():o.equals(2)&&l instanceof Xf&&l.trapsArrowNavigation?a=this.focusNext(void 0,!0):this.isTriggerKeyEvent(o)?this._triggerKeys.keyDown?this.doTrigger(o):this.triggerKeyDown=!0:a=!1,a&&(o.preventDefault(),o.stopPropagation())})),this._register(Ce(this.domNode,je.KEY_UP,s=>{const o=new or(s);this.isTriggerKeyEvent(o)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(o)),o.preventDefault(),o.stopPropagation()):(o.equals(2)||o.equals(1026)||o.equals(16)||o.equals(18)||o.equals(15)||o.equals(17))&&this.updateFocusedItem()})),this.focusTracker=this._register(Eg(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{(ka()===this.domNode||!xo(ka(),this.domNode))&&(this._onDidBlur.fire(),this.previouslyFocusedItem=this.focusedItem,this.focusedItem=void 0,this.triggerKeyDown=!1)})),this._register(this.focusTracker.onDidFocus(()=>this.updateFocusedItem())),this.actionsList=document.createElement("ul"),this.actionsList.className="actions-container",this.options.highlightToggledItems&&this.actionsList.classList.add("highlight-toggled"),this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}refreshRole(){this.length()>=1?this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"):this.actionsList.setAttribute("role","presentation")}setFocusable(e){if(this.focusable=e,this.focusable){const t=this.viewItems.find(i=>i instanceof Xf&&i.isEnabled());t instanceof Xf&&t.setFocusable(!0)}else this.viewItems.forEach(t=>{t instanceof Xf&&t.setFocusable(!1)})}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach(i=>{t=t||e.equals(i)}),t}updateFocusedItem(){for(let e=0;et.setActionContext(e))}get actionRunner(){return this._actionRunner}set actionRunner(e){this._actionRunner=e,this._actionRunnerDisposables.clear(),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(t=>this._onDidRun.fire(t))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(t=>this._onWillRun.fire(t))),this.viewItems.forEach(t=>t.actionRunner=e)}getContainer(){return this.domNode}getAction(e){if(typeof e=="number")return this.viewItems[e]?.action;if(Eo(e)){for(;e.parentElement!==this.actionsList;){if(!e.parentElement)return;e=e.parentElement}for(let t=0;t{const o=document.createElement("li");o.className="action-item",o.setAttribute("role","presentation");let a;const l={hoverDelegate:this._hoverDelegate,...t,isTabList:this.options.ariaRole==="tablist"};this.options.actionViewItemProvider&&(a=this.options.actionViewItemProvider(s,l)),a||(a=new vE(this.context,s,l)),this.options.allowContextMenu||this.viewItemDisposables.set(a,Ce(o,je.CONTEXT_MENU,c=>{Hn.stop(c,!0)})),a.actionRunner=this._actionRunner,a.setActionContext(this.context),a.render(o),this.focusable&&a instanceof Xf&&this.viewItems.length===0&&a.setFocusable(!0),r===null||r<0||r>=this.actionsList.children.length?(this.actionsList.appendChild(o),this.viewItems.push(a)):(this.actionsList.insertBefore(o,this.actionsList.children[r]),this.viewItems.splice(r,0,a),r++)}),typeof this.focusedItem=="number"&&this.focus(this.focusedItem),this.refreshRole()}clear(){this.isEmpty()||(this.viewItems=er(this.viewItems),this.viewItemDisposables.clearAndDisposeAll(),Jo(this.actionsList),this.refreshRole())}length(){return this.viewItems.length}isEmpty(){return this.viewItems.length===0}focus(e){let t=!1,i;if(e===void 0?t=!0:typeof e=="number"?i=e:typeof e=="boolean"&&(t=e),t&&typeof this.focusedItem>"u"){const r=this.viewItems.findIndex(s=>s.isEnabled());this.focusedItem=r===-1?void 0:r,this.updateFocus(void 0,void 0,!0)}else i!==void 0&&(this.focusedItem=i),this.updateFocus(void 0,void 0,!0)}focusFirst(){return this.focusedItem=this.length()-1,this.focusNext(!0)}focusLast(){return this.focusedItem=0,this.focusPrevious(!0)}focusNext(e,t){if(typeof this.focusedItem>"u")this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;const i=this.focusedItem;let r;do{if(!e&&this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=i,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,r=this.viewItems[this.focusedItem]}while(this.focusedItem!==i&&(this.options.focusOnlyEnabledItems&&!r.isEnabled()||r.action.id===na.ID));return this.updateFocus(void 0,void 0,t),!0}focusPrevious(e){if(typeof this.focusedItem>"u")this.focusedItem=0;else if(this.viewItems.length<=1)return!1;const t=this.focusedItem;let i;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(!e&&this.options.preventLoopNavigation)return this.focusedItem=t,!1;this.focusedItem=this.viewItems.length-1}i=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&(this.options.focusOnlyEnabledItems&&!i.isEnabled()||i.action.id===na.ID));return this.updateFocus(!0),!0}updateFocus(e,t,i=!1){typeof this.focusedItem>"u"&&this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem!==void 0&&this.previouslyFocusedItem!==this.focusedItem&&this.viewItems[this.previouslyFocusedItem]?.blur();const r=this.focusedItem!==void 0?this.viewItems[this.focusedItem]:void 0;if(r){let s=!0;tN(r.focus)||(s=!1),this.options.focusOnlyEnabledItems&&tN(r.isEnabled)&&!r.isEnabled()&&(s=!1),r.action.id===na.ID&&(s=!1),s?(i||this.previouslyFocusedItem!==this.focusedItem)&&(r.focus(e),this.previouslyFocusedItem=this.focusedItem):(this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem=void 0),s&&r.showHover?.()}}doTrigger(e){if(typeof this.focusedItem>"u")return;const t=this.viewItems[this.focusedItem];if(t instanceof Xf){const i=t._context===null||t._context===void 0?e:t._context;this.run(t._action,i)}}async run(e,t){await this._actionRunner.run(e,t)}dispose(){this._context=void 0,this.viewItems=er(this.viewItems),this.getContainer().remove(),super.dispose()}}const TQ=/\(&([^\s&])\)|(^|[^&])&([^\s&])/,iq=/(&)?(&)([^\s&])/g;var N8;(function(n){n[n.Right=0]="Right",n[n.Left=1]="Left"})(N8||(N8={}));var DQ;(function(n){n[n.Above=0]="Above",n[n.Below=1]="Below"})(DQ||(DQ={}));let S5e=class e5 extends ed{constructor(e,t,i,r){e.classList.add("monaco-menu-container"),e.setAttribute("role","presentation");const s=document.createElement("div");s.classList.add("monaco-menu"),s.setAttribute("role","presentation"),super(s,{orientation:1,actionViewItemProvider:c=>this.doGetActionViewItem(c,i,o),context:i.context,actionRunner:i.actionRunner,ariaLabel:i.ariaLabel,ariaRole:"menu",focusOnlyEnabledItems:!0,triggerKeys:{keys:[3,...Rn||zl?[10]:[]],keyDown:!0}}),this.menuStyles=r,this.menuElement=s,this.actionsList.tabIndex=0,this.initializeOrUpdateStyleSheet(e,r),this._register(Fr.addTarget(s)),this._register(Ce(s,je.KEY_DOWN,c=>{new or(c).equals(2)&&c.preventDefault()})),i.enableMnemonics&&this._register(Ce(s,je.KEY_DOWN,c=>{const u=c.key.toLocaleLowerCase();if(this.mnemonics.has(u)){Hn.stop(c,!0);const d=this.mnemonics.get(u);if(d.length===1&&(d[0]instanceof eye&&d[0].container&&this.focusItemByElement(d[0].container),d[0].onClick(c)),d.length>1){const h=d.shift();h&&h.container&&(this.focusItemByElement(h.container),d.push(h)),this.mnemonics.set(u,d)}}})),zl&&this._register(Ce(s,je.KEY_DOWN,c=>{const u=new or(c);u.equals(14)||u.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),Hn.stop(c,!0)):(u.equals(13)||u.equals(12))&&(this.focusedItem=0,this.focusPrevious(),Hn.stop(c,!0))})),this._register(Ce(this.domNode,je.MOUSE_OUT,c=>{const u=c.relatedTarget;xo(u,this.domNode)||(this.focusedItem=void 0,this.updateFocus(),c.stopPropagation())})),this._register(Ce(this.actionsList,je.MOUSE_OVER,c=>{let u=c.target;if(!(!u||!xo(u,this.actionsList)||u===this.actionsList)){for(;u.parentElement!==this.actionsList&&u.parentElement!==null;)u=u.parentElement;if(u.classList.contains("action-item")){const d=this.focusedItem;this.setFocusedItem(u),d!==this.focusedItem&&this.updateFocus()}}})),this._register(Fr.addTarget(this.actionsList)),this._register(Ce(this.actionsList,gr.Tap,c=>{let u=c.initialTarget;if(!(!u||!xo(u,this.actionsList)||u===this.actionsList)){for(;u.parentElement!==this.actionsList&&u.parentElement!==null;)u=u.parentElement;if(u.classList.contains("action-item")){const d=this.focusedItem;this.setFocusedItem(u),d!==this.focusedItem&&this.updateFocus()}}}));const o={parent:this};this.mnemonics=new Map,this.scrollableElement=this._register(new tO(s,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3,verticalScrollbarSize:7,handleMouseWheel:!0,useShadows:!0}));const a=this.scrollableElement.getDomNode();a.style.position="",this.styleScrollElement(a,r),this._register(Ce(s,gr.Change,c=>{Hn.stop(c,!0);const u=this.scrollableElement.getScrollPosition().scrollTop;this.scrollableElement.setScrollPosition({scrollTop:u-c.translationY})})),this._register(Ce(a,je.MOUSE_UP,c=>{c.preventDefault()}));const l=Ot(e);s.style.maxHeight=`${Math.max(10,l.innerHeight-e.getBoundingClientRect().top-35)}px`,t=t.filter((c,u)=>i.submenuIds?.has(c.id)?(console.warn(`Found submenu cycle: ${c.id}`),!1):!(c instanceof na&&(u===t.length-1||u===0||t[u-1]instanceof na))),this.push(t,{icon:!0,label:!0,isMenu:!0}),e.appendChild(this.scrollableElement.getDomNode()),this.scrollableElement.scanDomNode(),this.viewItems.filter(c=>!(c instanceof tye)).forEach((c,u,d)=>{c.updatePositionInSet(u+1,d.length)})}initializeOrUpdateStyleSheet(e,t){this.styleSheet||(G6(e)?this.styleSheet=id(e):(e5.globalStyleSheet||(e5.globalStyleSheet=id()),this.styleSheet=e5.globalStyleSheet)),this.styleSheet.textContent=Nkt(t,G6(e))}styleScrollElement(e,t){const i=t.foregroundColor??"",r=t.backgroundColor??"",s=t.borderColor?`1px solid ${t.borderColor}`:"",o="5px",a=t.shadowColor?`0 2px 8px ${t.shadowColor}`:"";e.style.outline=s,e.style.borderRadius=o,e.style.color=i,e.style.backgroundColor=r,e.style.boxShadow=a}getContainer(){return this.scrollableElement.getDomNode()}get onScroll(){return this.scrollableElement.onScroll}focusItemByElement(e){const t=this.focusedItem;this.setFocusedItem(e),t!==this.focusedItem&&this.updateFocus()}setFocusedItem(e){for(let t=0;t{this.element&&(this._register(Ce(this.element,je.MOUSE_UP,s=>{if(Hn.stop(s,!0),Xd){if(new qh(Ot(this.element),s).rightButton)return;this.onClick(s)}else setTimeout(()=>{this.onClick(s)},0)})),this._register(Ce(this.element,je.CONTEXT_MENU,s=>{Hn.stop(s,!0)})))},100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),this.element&&(this.container=e,this.item=Ne(this.element,qe("a.action-menu-item")),this._action.id===na.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=Ne(this.item,qe("span.menu-item-check"+zt.asCSSSelector(ze.menuSelection))),this.check.setAttribute("role","none"),this.label=Ne(this.item,qe("span.action-label")),this.options.label&&this.options.keybinding&&(Ne(this.item,qe("span.keybinding")).textContent=this.options.keybinding),this.runOnceToEnableMouseUp.schedule(),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked(),this.applyStyle())}blur(){super.blur(),this.applyStyle()}focus(){super.focus(),this.item?.focus(),this.applyStyle()}updatePositionInSet(e,t){this.item&&(this.item.setAttribute("aria-posinset",`${e}`),this.item.setAttribute("aria-setsize",`${t}`))}updateLabel(){if(this.label&&this.options.label){Jo(this.label);let e=Dle(this.action.label);if(e){const t=Akt(e);this.options.enableMnemonics||(e=t),this.label.setAttribute("aria-label",t.replace(/&&/g,"&"));const i=TQ.exec(e);if(i){e=gI(e),iq.lastIndex=0;let r=iq.exec(e);for(;r&&r[1];)r=iq.exec(e);const s=o=>o.replace(/&&/g,"&");r?this.label.append(jP(s(e.substr(0,r.index))," "),qe("u",{"aria-hidden":"true"},r[3]),W4e(s(e.substr(r.index+r[0].length))," ")):this.label.innerText=s(e).trim(),this.item?.setAttribute("aria-keyshortcuts",(i[1]?i[1]:i[3]).toLocaleLowerCase())}else this.label.innerText=e.replace(/&&/g,"&").trim()}}}updateTooltip(){}updateClass(){this.cssClass&&this.item&&this.item.classList.remove(...this.cssClass.split(" ")),this.options.icon&&this.label?(this.cssClass=this.action.class||"",this.label.classList.add("icon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" ")),this.updateEnabled()):this.label&&this.label.classList.remove("icon")}updateEnabled(){this.action.enabled?(this.element&&(this.element.classList.remove("disabled"),this.element.removeAttribute("aria-disabled")),this.item&&(this.item.classList.remove("disabled"),this.item.removeAttribute("aria-disabled"),this.item.tabIndex=0)):(this.element&&(this.element.classList.add("disabled"),this.element.setAttribute("aria-disabled","true")),this.item&&(this.item.classList.add("disabled"),this.item.setAttribute("aria-disabled","true")))}updateChecked(){if(!this.item)return;const e=this.action.checked;this.item.classList.toggle("checked",!!e),e!==void 0?(this.item.setAttribute("role","menuitemcheckbox"),this.item.setAttribute("aria-checked",e?"true":"false")):(this.item.setAttribute("role","menuitem"),this.item.setAttribute("aria-checked",""))}getMnemonic(){return this.mnemonic}applyStyle(){const e=this.element&&this.element.classList.contains("focused"),t=e&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor,i=e&&this.menuStyle.selectionBackgroundColor?this.menuStyle.selectionBackgroundColor:void 0,r=e&&this.menuStyle.selectionBorderColor?`1px solid ${this.menuStyle.selectionBorderColor}`:"",s=e&&this.menuStyle.selectionBorderColor?"-1px":"";this.item&&(this.item.style.color=t??"",this.item.style.backgroundColor=i??"",this.item.style.outline=r,this.item.style.outlineOffset=s),this.check&&(this.check.style.color=t??"")}}class eye extends k5e{constructor(e,t,i,r,s){super(e,e,r,s),this.submenuActions=t,this.parentData=i,this.submenuOptions=r,this.mysubmenu=null,this.submenuDisposables=this._register(new ke),this.mouseOver=!1,this.expandDirection=r&&r.expandDirection!==void 0?r.expandDirection:{horizontal:N8.Right,vertical:DQ.Below},this.showScheduler=new Ui(()=>{this.mouseOver&&(this.cleanupExistingSubmenu(!1),this.createSubmenu(!1))},250),this.hideScheduler=new Ui(()=>{this.element&&!xo(ka(),this.element)&&this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))},750)}render(e){super.render(e),this.element&&(this.item&&(this.item.classList.add("monaco-submenu-item"),this.item.tabIndex=0,this.item.setAttribute("aria-haspopup","true"),this.updateAriaExpanded("false"),this.submenuIndicator=Ne(this.item,qe("span.submenu-indicator"+zt.asCSSSelector(ze.menuSubmenu))),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register(Ce(this.element,je.KEY_UP,t=>{const i=new or(t);(i.equals(17)||i.equals(3))&&(Hn.stop(t,!0),this.createSubmenu(!0))})),this._register(Ce(this.element,je.KEY_DOWN,t=>{const i=new or(t);ka()===this.item&&(i.equals(17)||i.equals(3))&&Hn.stop(t,!0)})),this._register(Ce(this.element,je.MOUSE_OVER,t=>{this.mouseOver||(this.mouseOver=!0,this.showScheduler.schedule())})),this._register(Ce(this.element,je.MOUSE_LEAVE,t=>{this.mouseOver=!1})),this._register(Ce(this.element,je.FOCUS_OUT,t=>{this.element&&!xo(ka(),this.element)&&this.hideScheduler.schedule()})),this._register(this.parentData.parent.onScroll(()=>{this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))})))}updateEnabled(){}onClick(e){Hn.stop(e,!0),this.cleanupExistingSubmenu(!1),this.createSubmenu(!0)}cleanupExistingSubmenu(e){if(this.parentData.submenu&&(e||this.parentData.submenu!==this.mysubmenu)){try{this.parentData.submenu.dispose()}catch{}this.parentData.submenu=void 0,this.updateAriaExpanded("false"),this.submenuContainer&&(this.submenuDisposables.clear(),this.submenuContainer=void 0)}}calculateSubmenuMenuLayout(e,t,i,r){const s={top:0,left:0};return s.left=SS(e.width,t.width,{position:r.horizontal===N8.Right?0:1,offset:i.left,size:i.width}),s.left>=i.left&&s.left{new or(u).equals(15)&&(Hn.stop(u,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))})),this.submenuDisposables.add(Ce(this.submenuContainer,je.KEY_DOWN,u=>{new or(u).equals(15)&&Hn.stop(u,!0)})),this.submenuDisposables.add(this.parentData.submenu.onDidCancel(()=>{this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0)})),this.parentData.submenu.focus(e),this.mysubmenu=this.parentData.submenu}}updateAriaExpanded(e){this.item&&this.item?.setAttribute("aria-expanded",e)}applyStyle(){super.applyStyle();const t=this.element&&this.element.classList.contains("focused")&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor;this.submenuIndicator&&(this.submenuIndicator.style.color=t??"")}dispose(){super.dispose(),this.hideScheduler.dispose(),this.mysubmenu&&(this.mysubmenu.dispose(),this.mysubmenu=null),this.submenuContainer&&(this.submenuContainer=void 0)}}class tye extends vE{constructor(e,t,i,r){super(e,t,i),this.menuStyles=r}render(e){super.render(e),this.label&&(this.label.style.borderBottomColor=this.menuStyles.separatorColor?`${this.menuStyles.separatorColor}`:"")}}function Akt(n){const e=TQ,t=e.exec(n);if(!t)return n;const i=!t[1];return n.replace(e,i?"$2$3":"").trim()}function nye(n){const e=P4e()[n.id];return`.codicon-${n.id}:before { content: '\\${e.toString(16)}'; }`}function Nkt(n,e){let t=` +`)}}const okt={listFocusBackground:"#7FB0D0",listActiveSelectionBackground:"#0E639C",listActiveSelectionForeground:"#FFFFFF",listActiveSelectionIconForeground:"#FFFFFF",listFocusAndSelectionOutline:"#90C2F9",listFocusAndSelectionBackground:"#094771",listFocusAndSelectionForeground:"#FFFFFF",listInactiveSelectionBackground:"#3F3F46",listInactiveSelectionIconForeground:"#FFFFFF",listHoverBackground:"#2A2D2E",listDropOverBackground:"#383B3D",listDropBetweenBackground:"#EEEEEE",treeIndentGuidesStroke:"#a9a9a9",treeInactiveIndentGuidesStroke:Te.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:Te.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:Te.fromHex("#cccccc").transparent(.04).toString(),listBackground:void 0,listFocusForeground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusForeground:void 0,listInactiveFocusBackground:void 0,listHoverForeground:void 0,listFocusOutline:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listHoverOutline:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},akt={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}}};function lkt(n,e){const t=n.indexOf(e);if(t===-1)return[];const i=[];let r=t-1;for(;r>=0&&n[r]===e-(t-r);)i.push(n[r--]);for(i.reverse(),r=t;r=n.length)t.push(e[r++]);else if(r>=e.length)t.push(n[i++]);else if(n[i]===e[r]){t.push(n[i]),i++,r++;continue}else n[i]=n.length)t.push(e[r++]);else if(r>=e.length)t.push(n[i++]);else if(n[i]===e[r]){i++,r++;continue}else n[i]n-e;class ukt{constructor(e,t){this._templateId=e,this.renderers=t}get templateId(){return this._templateId}renderTemplate(e){return this.renderers.map(t=>t.renderTemplate(e))}renderElement(e,t,i,r){let s=0;for(const o of this.renderers)o.renderElement(e,t,i[s++],r)}disposeElement(e,t,i,r){let s=0;for(const o of this.renderers)o.disposeElement?.(e,t,i[s],r),s+=1}disposeTemplate(e){let t=0;for(const i of this.renderers)i.disposeTemplate(e[t++])}}class dkt{constructor(e){this.accessibilityProvider=e,this.templateId="a18n"}renderTemplate(e){return{container:e,disposables:new ke}}renderElement(e,t,i){const r=this.accessibilityProvider.getAriaLabel(e),s=r&&typeof r!="string"?r:Hd(r);i.disposables.add(tn(a=>{this.setAriaLabel(a.readObservable(s),i.container)}));const o=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);typeof o=="number"?i.container.setAttribute("aria-level",`${o}`):i.container.removeAttribute("aria-level")}setAriaLabel(e,t){e?t.setAttribute("aria-label",e):t.removeAttribute("aria-label")}disposeElement(e,t,i,r){i.disposables.clear()}disposeTemplate(e){e.disposables.dispose()}}class hkt{constructor(e,t){this.list=e,this.dnd=t}getDragElements(e){const t=this.list.getSelectedElements();return t.indexOf(e)>-1?t:[e]}getDragURI(e){return this.dnd.getDragURI(e)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e,t)}onDragStart(e,t){this.dnd.onDragStart?.(e,t)}onDragOver(e,t,i,r,s){return this.dnd.onDragOver(e,t,i,r,s)}onDragLeave(e,t,i,r){this.dnd.onDragLeave?.(e,t,i,r)}onDragEnd(e){this.dnd.onDragEnd?.(e)}drop(e,t,i,r,s){this.dnd.drop(e,t,i,r,s)}dispose(){this.dnd.dispose()}}class dd{get onDidChangeFocus(){return Ge.map(this.eventBufferer.wrapEvent(this.focus.onChange),e=>this.toListEvent(e),this.disposables)}get onDidChangeSelection(){return Ge.map(this.eventBufferer.wrapEvent(this.selection.onChange),e=>this.toListEvent(e),this.disposables)}get domId(){return this.view.domId}get onDidScroll(){return this.view.onDidScroll}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseDown(){return this.view.onMouseDown}get onMouseOver(){return this.view.onMouseOver}get onMouseOut(){return this.view.onMouseOut}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let e=!1;const t=Ge.chain(this.disposables.add(new $n(this.view.domNode,"keydown")).event,s=>s.map(o=>new or(o)).filter(o=>e=o.keyCode===58||o.shiftKey&&o.keyCode===68).map(o=>Hn.stop(o,!0)).filter(()=>!1)),i=Ge.chain(this.disposables.add(new $n(this.view.domNode,"keyup")).event,s=>s.forEach(()=>e=!1).map(o=>new or(o)).filter(o=>o.keyCode===58||o.shiftKey&&o.keyCode===68).map(o=>Hn.stop(o,!0)).map(({browserEvent:o})=>{const a=this.getFocus(),l=a.length?a[0]:void 0,c=typeof l<"u"?this.view.element(l):void 0,u=typeof l<"u"?this.view.domElement(l):this.view.domNode;return{index:l,element:c,anchor:u,browserEvent:o}})),r=Ge.chain(this.view.onContextMenu,s=>s.filter(o=>!e).map(({element:o,index:a,browserEvent:l})=>({element:o,index:a,anchor:new qh(Ot(this.view.domNode),l),browserEvent:l})));return Ge.any(t,i,r)}get onKeyDown(){return this.disposables.add(new $n(this.view.domNode,"keydown")).event}get onDidFocus(){return Ge.signal(this.disposables.add(new $n(this.view.domNode,"focus",!0)).event)}get onDidBlur(){return Ge.signal(this.disposables.add(new $n(this.view.domNode,"blur",!0)).event)}constructor(e,t,i,r,s=akt){this.user=e,this._options=s,this.focus=new T8("focused"),this.anchor=new T8("anchor"),this.eventBufferer=new UP,this._ariaLabel="",this.disposables=new ke,this._onDidDispose=new fe,this.onDidDispose=this._onDidDispose.event;const o=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?this._options.accessibilityProvider?.getWidgetRole():"list";this.selection=new JSt(o!=="listbox");const a=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=s.accessibilityProvider,this.accessibilityProvider&&(a.push(new dkt(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant?.(this.onDidChangeActiveDescendant,this,this.disposables)),r=r.map(c=>new ukt(c.templateId,[...a,c]));const l={...s,dnd:s.dnd&&new hkt(this,s.dnd)};if(this.view=this.createListView(t,i,r,l),this.view.domNode.setAttribute("role",o),s.styleController)this.styleController=s.styleController(this.view.domId);else{const c=id(this.view.domNode);this.styleController=new bFe(c,this.view.domId)}if(this.spliceable=new zSt([new tq(this.focus,this.view,s.identityProvider),new tq(this.selection,this.view,s.identityProvider),new tq(this.anchor,this.view,s.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new rkt(this,this.view)),(typeof s.keyboardSupport!="boolean"||s.keyboardSupport)&&(this.keyboardController=new pFe(this,this.view,s),this.disposables.add(this.keyboardController)),s.keyboardNavigationLabelProvider){const c=s.keyboardNavigationDelegate||nkt;this.typeNavigationController=new ikt(this,this.view,s.keyboardNavigationLabelProvider,s.keyboardNavigationEventFilter??(()=>!0),c),this.disposables.add(this.typeNavigationController)}this.mouseController=this.createMouseController(s),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider&&(this.ariaLabel=this.accessibilityProvider.getWidgetAriaLabel()),this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}createListView(e,t,i,r){return new gf(e,t,i,r)}createMouseController(e){return new vFe(this)}updateOptions(e={}){this._options={...this._options,...e},this.typeNavigationController?.updateOptions(this._options),this._options.multipleSelectionController!==void 0&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(e),this.keyboardController?.updateOptions(e),this.view.updateOptions(e)}get options(){return this._options}splice(e,t,i=[]){if(e<0||e>this.view.length)throw new D1(this.user,`Invalid start index: ${e}`);if(t<0)throw new D1(this.user,`Invalid delete count: ${t}`);t===0&&i.length===0||this.eventBufferer.bufferEvents(()=>this.spliceable.splice(e,t,i))}rerender(){this.view.rerender()}element(e){return this.view.element(e)}indexOf(e){return this.view.indexOf(e)}indexAt(e){return this.view.indexAt(e)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get scrollTop(){return this.view.getScrollTop()}set scrollTop(e){this.view.setScrollTop(e)}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleIndex(){return this.view.firstVisibleIndex}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.view.domNode.setAttribute("aria-label",e)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(e,t){this.view.layout(e,t)}setSelection(e,t){for(const i of e)if(i<0||i>=this.length)throw new D1(this.user,`Invalid index ${i}`);this.selection.set(e,t)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map(e=>this.view.element(e))}setAnchor(e){if(typeof e>"u"){this.anchor.set([]);return}if(e<0||e>=this.length)throw new D1(this.user,`Invalid index ${e}`);this.anchor.set([e])}getAnchor(){return hae(this.anchor.get(),void 0)}getAnchorElement(){const e=this.getAnchor();return typeof e>"u"?void 0:this.element(e)}setFocus(e,t){for(const i of e)if(i<0||i>=this.length)throw new D1(this.user,`Invalid index ${i}`);this.focus.set(e,t)}focusNext(e=1,t=!1,i,r){if(this.length===0)return;const s=this.focus.get(),o=this.findNextIndex(s.length>0?s[0]+e:0,t,r);o>-1&&this.setFocus([o],i)}focusPrevious(e=1,t=!1,i,r){if(this.length===0)return;const s=this.focus.get(),o=this.findPreviousIndex(s.length>0?s[0]-e:0,t,r);o>-1&&this.setFocus([o],i)}async focusNextPage(e,t){let i=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);i=i===0?0:i-1;const r=this.getFocus()[0];if(r!==i&&(r===void 0||i>r)){const s=this.findPreviousIndex(i,!1,t);s>-1&&r!==s?this.setFocus([s],e):this.setFocus([i],e)}else{const s=this.view.getScrollTop();let o=s+this.view.renderHeight;i>r&&(o-=this.view.elementHeight(i)),this.view.setScrollTop(o),this.view.getScrollTop()!==s&&(this.setFocus([]),await Y_(0),await this.focusNextPage(e,t))}}async focusPreviousPage(e,t,i=()=>0){let r;const s=i(),o=this.view.getScrollTop()+s;o===0?r=this.view.indexAt(o):r=this.view.indexAfter(o-1);const a=this.getFocus()[0];if(a!==r&&(a===void 0||a>=r)){const l=this.findNextIndex(r,!1,t);l>-1&&a!==l?this.setFocus([l],e):this.setFocus([r],e)}else{const l=o;this.view.setScrollTop(o-this.view.renderHeight-s),this.view.getScrollTop()+i()!==l&&(this.setFocus([]),await Y_(0),await this.focusPreviousPage(e,t,i))}}focusLast(e,t){if(this.length===0)return;const i=this.findPreviousIndex(this.length-1,!1,t);i>-1&&this.setFocus([i],e)}focusFirst(e,t){this.focusNth(0,e,t)}focusNth(e,t,i){if(this.length===0)return;const r=this.findNextIndex(e,!1,i);r>-1&&this.setFocus([r],t)}findNextIndex(e,t=!1,i){for(let r=0;r=this.length&&!t)return-1;if(e=e%this.length,!i||i(this.element(e)))return e;e++}return-1}findPreviousIndex(e,t=!1,i){for(let r=0;rthis.view.element(e))}reveal(e,t,i=0){if(e<0||e>=this.length)throw new D1(this.user,`Invalid index ${e}`);const r=this.view.getScrollTop(),s=this.view.elementTop(e),o=this.view.elementHeight(e);if(yb(t)){const a=o-this.view.renderHeight+i;this.view.setScrollTop(a*Il(t,0,1)+s-i)}else{const a=s+o,l=r+this.view.renderHeight;s=l||(s=l&&o>=this.view.renderHeight?this.view.setScrollTop(s-i):a>=l&&this.view.setScrollTop(a-this.view.renderHeight))}}getRelativeTop(e,t=0){if(e<0||e>=this.length)throw new D1(this.user,`Invalid index ${e}`);const i=this.view.getScrollTop(),r=this.view.elementTop(e),s=this.view.elementHeight(e);if(ri+this.view.renderHeight)return null;const o=s-this.view.renderHeight+t;return Math.abs((i+t-r)/o)}getHTMLElement(){return this.view.domNode}getScrollableElement(){return this.view.scrollableElementDomNode}getElementID(e){return this.view.getElementDomId(e)}getElementTop(e){return this.view.elementTop(e)}style(e){this.styleController.style(e)}toListEvent({indexes:e,browserEvent:t}){return{indexes:e,elements:e.map(i=>this.view.element(i)),browserEvent:t}}_onFocusChange(){const e=this.focus.get();this.view.domNode.classList.toggle("element-focused",e.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){const e=this.focus.get();if(e.length>0){let t;this.accessibilityProvider?.getActiveDescendantId&&(t=this.accessibilityProvider.getActiveDescendantId(this.view.element(e[0]))),this.view.domNode.setAttribute("aria-activedescendant",t||this.view.getElementDomId(e[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){const e=this.selection.get();this.view.domNode.classList.toggle("selection-none",e.length===0),this.view.domNode.classList.toggle("selection-single",e.length===1),this.view.domNode.classList.toggle("selection-multiple",e.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}}e1([Ds],dd.prototype,"onDidChangeFocus",null);e1([Ds],dd.prototype,"onDidChangeSelection",null);e1([Ds],dd.prototype,"onContextMenu",null);e1([Ds],dd.prototype,"onKeyDown",null);e1([Ds],dd.prototype,"onDidFocus",null);e1([Ds],dd.prototype,"onDidBlur",null);const Ay=qe,yFe="selectOption.entry.template";class fkt{get templateId(){return yFe}renderTemplate(e){const t=Object.create(null);return t.root=e,t.text=Ne(e,Ay(".option-text")),t.detail=Ne(e,Ay(".option-detail")),t.decoratorRight=Ne(e,Ay(".option-decorator-right")),t}renderElement(e,t,i){const r=i,s=e.text,o=e.detail,a=e.decoratorRight,l=e.isDisabled;r.text.textContent=s,r.detail.textContent=o||"",r.decoratorRight.innerText=a||"",l?r.root.classList.add("option-disabled"):r.root.classList.remove("option-disabled")}disposeTemplate(e){}}class hy extends me{static{this.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN=32}static{this.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN=2}static{this.DEFAULT_MINIMUM_VISIBLE_OPTIONS=3}constructor(e,t,i,r,s){super(),this.options=[],this._currentSelection=0,this._hasDetails=!1,this._skipLayout=!1,this._sticky=!1,this._isVisible=!1,this.styles=r,this.selectBoxOptions=s||Object.create(null),typeof this.selectBoxOptions.minBottomMargin!="number"?this.selectBoxOptions.minBottomMargin=hy.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN:this.selectBoxOptions.minBottomMargin<0&&(this.selectBoxOptions.minBottomMargin=0),this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box monaco-select-box-dropdown-padding",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=new fe,this._register(this._onDidSelect),this.registerListeners(),this.constructSelectDropDown(i),this.selected=t||0,e&&this.setOptions(e,t),this.initStyleSheet()}setTitle(e){!this._hover&&e?this._hover=this._register(Bg().setupManagedHover(Yl("mouse"),this.selectElement,e)):this._hover&&this._hover.update(e)}getHeight(){return 22}getTemplateId(){return yFe}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=qe(".monaco-select-box-dropdown-container"),this.selectDropDownContainer.classList.add("monaco-select-box-dropdown-padding"),this.selectionDetailsPane=Ne(this.selectDropDownContainer,Ay(".select-box-details-pane"));const t=Ne(this.selectDropDownContainer,Ay(".select-box-dropdown-container-width-control")),i=Ne(t,Ay(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",Ne(i,this.widthControlElement),this._dropDownPosition=0,this.styleElement=id(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register(Ce(this.selectDropDownContainer,je.DRAG_START,r=>{Hn.stop(r,!0)}))}registerListeners(){this._register(Jr(this.selectElement,"change",t=>{this.selected=t.target.selectedIndex,this._onDidSelect.fire({index:t.target.selectedIndex,selected:t.target.value}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)})),this._register(Ce(this.selectElement,je.CLICK,t=>{Hn.stop(t),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(Ce(this.selectElement,je.MOUSE_DOWN,t=>{Hn.stop(t)}));let e;this._register(Ce(this.selectElement,"touchstart",t=>{e=this._isVisible})),this._register(Ce(this.selectElement,"touchend",t=>{Hn.stop(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(Ce(this.selectElement,je.KEY_DOWN,t=>{const i=new or(t);let r=!1;Rn?(i.keyCode===18||i.keyCode===16||i.keyCode===10||i.keyCode===3)&&(r=!0):(i.keyCode===18&&i.altKey||i.keyCode===16&&i.altKey||i.keyCode===10||i.keyCode===3)&&(r=!0),r&&(this.showSelectDropDown(),Hn.stop(t,!0))}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){$r(this.options,e)||(this.options=e,this.selectElement.options.length=0,this._hasDetails=!1,this._cachedMaxDetailsHeight=void 0,this.options.forEach((i,r)=>{this.selectElement.add(this.createOption(i.text,r,i.isDisabled)),typeof i.description=="string"&&(this._hasDetails=!0)})),t!==void 0&&(this.select(t),this._currentSelection=this.selected)}setOptionsList(){this.selectList?.splice(0,this.selectList.length,this.options)}select(e){e>=0&&ethis.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){this.container=e,e.classList.add("select-container"),e.appendChild(this.selectElement),this.styleSelectElement()}initStyleSheet(){const e=[];this.styles.listFocusBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`),this.styles.listFocusForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`),this.styles.decoratorRightForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`),this.styles.selectBackground&&this.styles.selectBorder&&this.styles.selectBorder!==this.styles.selectBackground?(e.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `)):this.styles.selectListBorder&&(e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `)),this.styles.listHoverForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`),this.styles.listHoverBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`),this.styles.listFocusOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1.6px dotted ${this.styles.listFocusOutline} !important; outline-offset: -1.6px !important; }`),this.styles.listHoverOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1.6px dashed ${this.styles.listHoverOutline} !important; outline-offset: -1.6px !important; }`),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }"),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }"),this.styleElement.textContent=e.join(` +`)}styleSelectElement(){const e=this.styles.selectBackground??"",t=this.styles.selectForeground??"",i=this.styles.selectBorder??"";this.selectElement.style.backgroundColor=e,this.selectElement.style.color=t,this.selectElement.style.borderColor=i}styleList(){const e=this.styles.selectBackground??"",t=A_(this.styles.selectListBackground,e);this.selectDropDownListContainer.style.backgroundColor=t,this.selectionDetailsPane.style.backgroundColor=t;const i=this.styles.focusBorder??"";this.selectDropDownContainer.style.outlineColor=i,this.selectDropDownContainer.style.outlineOffset="-1px",this.selectList.style(this.styles)}createOption(e,t,i){const r=document.createElement("option");return r.value=e,r.text=e,r.disabled=!!i,r}showSelectDropDown(){this.selectionDetailsPane.innerText="",!(!this.contextViewProvider||this._isVisible)&&(this.createSelectList(this.selectDropDownContainer),this.setOptionsList(),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e,!0),layout:()=>{this.layoutSelectDropDown()},onHide:()=>{this.selectDropDownContainer.classList.remove("visible"),this.selectElement.classList.remove("synthetic-focus")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._isVisible=!0,this.hideSelectDropDown(!1),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e),layout:()=>this.layoutSelectDropDown(),onHide:()=>{this.selectDropDownContainer.classList.remove("visible"),this.selectElement.classList.remove("synthetic-focus")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._currentSelection=this.selected,this._isVisible=!0,this.selectElement.setAttribute("aria-expanded","true"))}hideSelectDropDown(e){!this.contextViewProvider||!this._isVisible||(this._isVisible=!1,this.selectElement.setAttribute("aria-expanded","false"),e&&this.selectElement.focus(),this.contextViewProvider.hideContextView())}renderSelectDropDown(e,t){return e.appendChild(this.selectDropDownContainer),this.layoutSelectDropDown(t),{dispose:()=>{this.selectDropDownContainer.remove()}}}measureMaxDetailsHeight(){let e=0;return this.options.forEach((t,i)=>{this.updateDetail(i),this.selectionDetailsPane.offsetHeight>e&&(e=this.selectionDetailsPane.offsetHeight)}),e}layoutSelectDropDown(e){if(this._skipLayout)return!1;if(this.selectList){this.selectDropDownContainer.classList.add("visible");const t=Ot(this.selectElement),i=ms(this.selectElement),r=Ot(this.selectElement).getComputedStyle(this.selectElement),s=parseFloat(r.getPropertyValue("--dropdown-padding-top"))+parseFloat(r.getPropertyValue("--dropdown-padding-bottom")),o=t.innerHeight-i.top-i.height-(this.selectBoxOptions.minBottomMargin||0),a=i.top-hy.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN,l=this.selectElement.offsetWidth,c=this.setWidthControlElement(this.widthControlElement),u=Math.max(c,Math.round(l)).toString()+"px";this.selectDropDownContainer.style.width=u,this.selectList.getHTMLElement().style.height="",this.selectList.layout();let d=this.selectList.contentHeight;this._hasDetails&&this._cachedMaxDetailsHeight===void 0&&(this._cachedMaxDetailsHeight=this.measureMaxDetailsHeight());const h=this._hasDetails?this._cachedMaxDetailsHeight:0,f=d+s+h,g=Math.floor((o-s-h)/this.getHeight()),p=Math.floor((a-s-h)/this.getHeight());if(e)return i.top+i.height>t.innerHeight-22||i.topg&&this.options.length>g?(this._dropDownPosition=1,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectionDetailsPane.classList.remove("border-top"),this.selectionDetailsPane.classList.add("border-bottom")):(this._dropDownPosition=0,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectionDetailsPane.classList.remove("border-bottom"),this.selectionDetailsPane.classList.add("border-top")),!0);if(i.top+i.height>t.innerHeight-22||i.topo&&(d=g*this.getHeight())}else f>a&&(d=p*this.getHeight());return this.selectList.layout(d),this.selectList.domFocus(),this.selectList.length>0&&(this.selectList.setFocus([this.selected||0]),this.selectList.reveal(this.selectList.getFocus()[0]||0)),this._hasDetails?(this.selectList.getHTMLElement().style.height=d+s+"px",this.selectDropDownContainer.style.height=""):this.selectDropDownContainer.style.height=d+s+"px",this.updateDetail(this.selected),this.selectDropDownContainer.style.width=u,this.selectDropDownListContainer.setAttribute("tabindex","0"),this.selectElement.classList.add("synthetic-focus"),this.selectDropDownContainer.classList.add("synthetic-focus"),!0}else return!1}setWidthControlElement(e){let t=0;if(e){let i=0,r=0;this.options.forEach((s,o)=>{const a=s.detail?s.detail.length:0,l=s.decoratorRight?s.decoratorRight.length:0,c=s.text.length+a+l;c>r&&(i=o,r=c)}),e.textContent=this.options[i].text+(this.options[i].decoratorRight?this.options[i].decoratorRight+" ":""),t=qc(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=Ne(e,Ay(".select-box-dropdown-list-container")),this.listRenderer=new fkt,this.selectList=this._register(new dd("SelectBoxCustom",this.selectDropDownListContainer,this,[this.listRenderer],{useShadows:!1,verticalScrollMode:3,keyboardSupport:!1,mouseSupport:!1,accessibilityProvider:{getAriaLabel:r=>{let s=r.text;return r.detail&&(s+=`. ${r.detail}`),r.decoratorRight&&(s+=`. ${r.decoratorRight}`),r.description&&(s+=`. ${r.description}`),s},getWidgetAriaLabel:()=>w({key:"selectBox",comment:["Behave like native select dropdown element."]},"Select Box"),getRole:()=>Rn?"":"option",getWidgetRole:()=>"listbox"}})),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);const t=this._register(new $n(this.selectDropDownListContainer,"keydown")),i=Ge.chain(t.event,r=>r.filter(()=>this.selectList.length>0).map(s=>new or(s)));this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===3))(this.onEnter,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===2))(this.onEnter,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===9))(this.onEscape,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===16))(this.onUpArrow,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===18))(this.onDownArrow,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===12))(this.onPageDown,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===11))(this.onPageUp,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===14))(this.onHome,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode===13))(this.onEnd,this)),this._register(Ge.chain(i,r=>r.filter(s=>s.keyCode>=21&&s.keyCode<=56||s.keyCode>=85&&s.keyCode<=113))(this.onCharacter,this)),this._register(Ce(this.selectList.getHTMLElement(),je.POINTER_UP,r=>this.onPointerUp(r))),this._register(this.selectList.onMouseOver(r=>typeof r.index<"u"&&this.selectList.setFocus([r.index]))),this._register(this.selectList.onDidChangeFocus(r=>this.onListFocus(r))),this._register(Ce(this.selectDropDownContainer,je.FOCUS_OUT,r=>{!this._isVisible||xo(r.relatedTarget,this.selectDropDownContainer)||this.onListBlur()})),this.selectList.getHTMLElement().setAttribute("aria-label",this.selectBoxOptions.ariaLabel||""),this.selectList.getHTMLElement().setAttribute("aria-expanded","true"),this.styleList()}onPointerUp(e){if(!this.selectList.length)return;Hn.stop(e);const t=e.target;if(!t||t.classList.contains("slider"))return;const i=t.closest(".monaco-list-row");if(!i)return;const r=Number(i.getAttribute("data-index")),s=i.classList.contains("option-disabled");r>=0&&r{for(let o=0;othis.selected+2)this.selected+=2;else{if(t)return;this.selected++}this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onUpArrow(e){this.selected>0&&(Hn.stop(e,!0),this.options[this.selected-1].isDisabled&&this.selected>1?this.selected-=2:this.selected--,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0]))}onPageUp(e){Hn.stop(e),this.selectList.focusPreviousPage(),setTimeout(()=>{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected>0&&(this.selected--,this.selectList.setFocus([this.selected])),this.selectList.reveal(this.selected),this.select(this.selected)},1)}onHome(e){Hn.stop(e),!(this.options.length<2)&&(this.selected=0,this.options[this.selected].isDisabled&&this.selected>1&&this.selected++,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onEnd(e){Hn.stop(e),!(this.options.length<2)&&(this.selected=this.options.length-1,this.options[this.selected].isDisabled&&this.selected>1&&this.selected--,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onCharacter(e){const t=r_.toString(e.keyCode);let i=-1;for(let r=0;r{this._register(Ce(this.selectElement,e,t=>{this.selectElement.focus()}))}),this._register(Jr(this.selectElement,"click",e=>{Hn.stop(e,!0)})),this._register(Jr(this.selectElement,"change",e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})})),this._register(Jr(this.selectElement,"keydown",e=>{let t=!1;Rn?(e.keyCode===18||e.keyCode===16||e.keyCode===10)&&(t=!0):(e.keyCode===18&&e.altKey||e.keyCode===10||e.keyCode===3)&&(t=!0),t&&e.stopPropagation()}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){(!this.options||!$r(this.options,e))&&(this.options=e,this.selectElement.options.length=0,this.options.forEach((i,r)=>{this.selectElement.add(this.createOption(i.text,r,i.isDisabled))})),t!==void 0&&this.select(t)}select(e){this.options.length===0?this.selected=0:e>=0&&ethis.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.selected{this.element&&this.handleActionChangeEvent(r)}))}handleActionChangeEvent(e){e.enabled!==void 0&&this.updateEnabled(),e.checked!==void 0&&this.updateChecked(),e.class!==void 0&&this.updateClass(),e.label!==void 0&&(this.updateLabel(),this.updateTooltip()),e.tooltip!==void 0&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new Aw)),this._actionRunner}set actionRunner(e){this._actionRunner=e}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){const t=this.element=e;this._register(Fr.addTarget(e));const i=this.options&&this.options.draggable;i&&(e.draggable=!0,Xd&&this._register(Ce(e,je.DRAG_START,r=>r.dataTransfer?.setData(DN.TEXT,this._action.label)))),this._register(Ce(t,gr.Tap,r=>this.onClick(r,!0))),this._register(Ce(t,je.MOUSE_DOWN,r=>{i||Hn.stop(r,!0),this._action.enabled&&r.button===0&&t.classList.add("active")})),Rn&&this._register(Ce(t,je.CONTEXT_MENU,r=>{r.button===0&&r.ctrlKey===!0&&this.onClick(r)})),this._register(Ce(t,je.CLICK,r=>{Hn.stop(r,!0),this.options&&this.options.isMenu||this.onClick(r)})),this._register(Ce(t,je.DBLCLICK,r=>{Hn.stop(r,!0)})),[je.MOUSE_UP,je.MOUSE_OUT].forEach(r=>{this._register(Ce(t,r,s=>{Hn.stop(s),t.classList.remove("active")}))})}onClick(e,t=!1){Hn.stop(e,!0);const i=Bu(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,i)}focus(){this.element&&(this.element.tabIndex=0,this.element.focus(),this.element.classList.add("focused"))}blur(){this.element&&(this.element.blur(),this.element.tabIndex=-1,this.element.classList.remove("focused"))}setFocusable(e){this.element&&(this.element.tabIndex=e?0:-1)}get trapsArrowNavigation(){return!1}updateEnabled(){}updateLabel(){}getClass(){return this.action.class}getTooltip(){return this.action.tooltip}updateTooltip(){if(!this.element)return;const e=this.getTooltip()??"";if(this.updateAriaLabel(),this.options.hoverDelegate?.showNativeHover)this.element.title=e;else if(!this.customHover&&e!==""){const t=this.options.hoverDelegate??Yl("element");this.customHover=this._store.add(Bg().setupManagedHover(t,this.element,e))}else this.customHover&&this.customHover.update(e)}updateAriaLabel(){if(this.element){const e=this.getTooltip()??"";this.element.setAttribute("aria-label",e)}}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),this._context=void 0,super.dispose()}}class vE extends Xf{constructor(e,t,i){super(e,t,i),this.options=i,this.options.icon=i.icon!==void 0?i.icon:!1,this.options.label=i.label!==void 0?i.label:!0,this.cssClass=""}render(e){super.render(e),oi(this.element);const t=document.createElement("a");if(t.classList.add("action-label"),t.setAttribute("role",this.getDefaultAriaRole()),this.label=t,this.element.appendChild(t),this.options.label&&this.options.keybinding){const i=document.createElement("span");i.classList.add("keybinding"),i.textContent=this.options.keybinding,this.element.appendChild(i)}this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}getDefaultAriaRole(){return this._action.id===na.ID?"presentation":this.options.isMenu?"menuitem":this.options.isTabList?"tab":"button"}focus(){this.label&&(this.label.tabIndex=0,this.label.focus())}blur(){this.label&&(this.label.tabIndex=-1)}setFocusable(e){this.label&&(this.label.tabIndex=e?0:-1)}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this.action.label)}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:!this.options.label&&this.action.label&&this.options.icon&&(e=this.action.label,this.options.keybinding&&(e=w({key:"titleLabel",comment:["action title","action keybinding"]},"{0} ({1})",e,this.options.keybinding))),e??void 0}updateClass(){this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.options.icon?(this.cssClass=this.getClass(),this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):this.label?.classList.remove("codicon")}updateEnabled(){this.action.enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),this.element?.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),this.element?.classList.add("disabled"))}updateAriaLabel(){if(this.label){const e=this.getTooltip()??"";this.label.setAttribute("aria-label",e)}}updateChecked(){this.label&&(this.action.checked!==void 0?(this.label.classList.toggle("checked",this.action.checked),this.options.isTabList?this.label.setAttribute("aria-selected",this.action.checked?"true":"false"):(this.label.setAttribute("aria-checked",this.action.checked?"true":"false"),this.label.setAttribute("role","checkbox"))):(this.label.classList.remove("checked"),this.label.removeAttribute(this.options.isTabList?"aria-selected":"aria-checked"),this.label.setAttribute("role",this.getDefaultAriaRole())))}}class mkt extends Xf{constructor(e,t,i,r,s,o,a){super(e,t),this.selectBox=new pkt(i,r,s,o,a),this.selectBox.setFocusable(!1),this._register(this.selectBox),this.registerListeners()}select(e){this.selectBox.select(e)}registerListeners(){this._register(this.selectBox.onDidSelect(e=>this.runAction(e.selected,e.index)))}runAction(e,t){this.actionRunner.run(this._action,this.getActionContext(e,t))}getActionContext(e,t){return e}setFocusable(e){this.selectBox.setFocusable(e)}focus(){this.selectBox?.focus()}blur(){this.selectBox?.blur()}render(e){this.selectBox.render(e)}}class _kt extends Aw{constructor(e,t){super(),this._onDidChangeVisibility=this._register(new fe),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this._element=Ne(e,qe(".monaco-dropdown")),this._label=Ne(this._element,qe(".dropdown-label"));let i=t.labelRenderer;i||(i=s=>(s.textContent=t.label||"",null));for(const s of[je.CLICK,je.MOUSE_DOWN,gr.Tap])this._register(Ce(this.element,s,o=>Hn.stop(o,!0)));for(const s of[je.MOUSE_DOWN,gr.Tap])this._register(Ce(this._label,s,o=>{Hae(o)&&(o.detail>1||o.button!==0)||(this.visible?this.hide():this.show())}));this._register(Ce(this._label,je.KEY_UP,s=>{const o=new or(s);(o.equals(3)||o.equals(10))&&(Hn.stop(s,!0),this.visible?this.hide():this.show())}));const r=i(this._label);r&&this._register(r),this._register(Fr.addTarget(this._label))}get element(){return this._element}show(){this.visible||(this.visible=!0,this._onDidChangeVisibility.fire(!0))}hide(){this.visible&&(this.visible=!1,this._onDidChangeVisibility.fire(!1))}dispose(){super.dispose(),this.hide(),this.boxContainer&&(this.boxContainer.remove(),this.boxContainer=void 0),this.contents&&(this.contents.remove(),this.contents=void 0),this._label&&(this._label.remove(),this._label=void 0)}}let vkt=class extends _kt{constructor(e,t){super(e,t),this._options=t,this._actions=[],this.actions=t.actions||[]}set menuOptions(e){this._menuOptions=e}get menuOptions(){return this._menuOptions}get actions(){return this._options.actionProvider?this._options.actionProvider.getActions():this._actions}set actions(e){this._actions=e}show(){super.show(),this.element.classList.add("active"),this._options.contextMenuProvider.showContextMenu({getAnchor:()=>this.element,getActions:()=>this.actions,getActionsContext:()=>this.menuOptions?this.menuOptions.context:null,getActionViewItem:(e,t)=>this.menuOptions&&this.menuOptions.actionViewItemProvider?this.menuOptions.actionViewItemProvider(e,t):void 0,getKeyBinding:e=>this.menuOptions&&this.menuOptions.getKeyBinding?this.menuOptions.getKeyBinding(e):void 0,getMenuClassName:()=>this._options.menuClassName||"",onHide:()=>this.onHide(),actionRunner:this.menuOptions?this.menuOptions.actionRunner:void 0,anchorAlignment:this.menuOptions?this.menuOptions.anchorAlignment:0,domForShadowRoot:this._options.menuAsChild?this.element:void 0,skipTelemetry:this._options.skipTelemetry})}hide(){super.hide()}onHide(){this.hide(),this.element.classList.remove("active")}};class D8 extends Xf{constructor(e,t,i,r=Object.create(null)){super(null,e,r),this.actionItem=null,this._onDidChangeVisibility=this._register(new fe),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this.menuActionsOrProvider=t,this.contextMenuProvider=i,this.options=r,this.options.actionRunner&&(this.actionRunner=this.options.actionRunner)}render(e){this.actionItem=e;const t=s=>{this.element=Ne(s,qe("a.action-label"));let o=[];return typeof this.options.classNames=="string"?o=this.options.classNames.split(/\s+/g).filter(a=>!!a):this.options.classNames&&(o=this.options.classNames),o.find(a=>a==="icon")||o.push("codicon"),this.element.classList.add(...o),this.element.setAttribute("role","button"),this.element.setAttribute("aria-haspopup","true"),this.element.setAttribute("aria-expanded","false"),this._action.label&&this._register(Bg().setupManagedHover(this.options.hoverDelegate??Yl("mouse"),this.element,this._action.label)),this.element.ariaLabel=this._action.label||"",null},i=Array.isArray(this.menuActionsOrProvider),r={contextMenuProvider:this.contextMenuProvider,labelRenderer:t,menuAsChild:this.options.menuAsChild,actions:i?this.menuActionsOrProvider:void 0,actionProvider:i?void 0:this.menuActionsOrProvider,skipTelemetry:this.options.skipTelemetry};if(this.dropdownMenu=this._register(new vkt(e,r)),this._register(this.dropdownMenu.onDidChangeVisibility(s=>{this.element?.setAttribute("aria-expanded",`${s}`),this._onDidChangeVisibility.fire(s)})),this.dropdownMenu.menuOptions={actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,getKeyBinding:this.options.keybindingProvider,context:this._context},this.options.anchorAlignmentProvider){const s=this;this.dropdownMenu.menuOptions={...this.dropdownMenu.menuOptions,get anchorAlignment(){return s.options.anchorAlignmentProvider()}}}this.updateTooltip(),this.updateEnabled()}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:this.action.label&&(e=this.action.label),e??void 0}setActionContext(e){super.setActionContext(e),this.dropdownMenu&&(this.dropdownMenu.menuOptions?this.dropdownMenu.menuOptions.context=e:this.dropdownMenu.menuOptions={context:e})}show(){this.dropdownMenu?.show()}updateEnabled(){const e=!this.action.enabled;this.actionItem?.classList.toggle("disabled",e),this.element?.classList.toggle("disabled",e)}}function bkt(n){return n&&typeof n=="object"&&typeof n.original=="string"&&typeof n.value=="string"}function ykt(n){return n?n.condition!==void 0:!1}var gk;(function(n){n[n.STORAGE_DOES_NOT_EXIST=0]="STORAGE_DOES_NOT_EXIST",n[n.STORAGE_IN_MEMORY=1]="STORAGE_IN_MEMORY"})(gk||(gk={}));var LS;(function(n){n[n.None=0]="None",n[n.Initialized=1]="Initialized",n[n.Closed=2]="Closed"})(LS||(LS={}));class CI extends me{static{this.DEFAULT_FLUSH_DELAY=100}constructor(e,t=Object.create(null)){super(),this.database=e,this.options=t,this._onDidChangeStorage=this._register(new Ew),this.onDidChangeStorage=this._onDidChangeStorage.event,this.state=LS.None,this.cache=new Map,this.flushDelayer=this._register(new Z4e(CI.DEFAULT_FLUSH_DELAY)),this.pendingDeletes=new Set,this.pendingInserts=new Map,this.whenFlushedCallbacks=[],this.registerListeners()}registerListeners(){this._register(this.database.onDidChangeItemsExternal(e=>this.onDidChangeItemsExternal(e)))}onDidChangeItemsExternal(e){this._onDidChangeStorage.pause();try{e.changed?.forEach((t,i)=>this.acceptExternal(i,t)),e.deleted?.forEach(t=>this.acceptExternal(t,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,t){if(this.state===LS.Closed)return;let i=!1;Bu(t)?i=this.cache.delete(e):this.cache.get(e)!==t&&(this.cache.set(e,t),i=!0),i&&this._onDidChangeStorage.fire({key:e,external:!0})}get(e,t){const i=this.cache.get(e);return Bu(i)?t:i}getBoolean(e,t){const i=this.get(e);return Bu(i)?t:i==="true"}getNumber(e,t){const i=this.get(e);return Bu(i)?t:parseInt(i,10)}async set(e,t,i=!1){if(this.state===LS.Closed)return;if(Bu(t))return this.delete(e,i);const r=Mo(t)||Array.isArray(t)?XCt(t):String(t);if(this.cache.get(e)!==r)return this.cache.set(e,r),this.pendingInserts.set(e,r),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:i}),this.doFlush()}async delete(e,t=!1){if(!(this.state===LS.Closed||!this.cache.delete(e)))return this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire({key:e,external:t}),this.doFlush()}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}async flushPending(){if(!this.hasPending)return;const e={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(e).finally(()=>{if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)this.whenFlushedCallbacks.pop()?.()})}async doFlush(e){return this.options.hint===gk.STORAGE_IN_MEMORY?this.flushPending():this.flushDelayer.trigger(()=>this.flushPending(),e)}}class nq{constructor(){this.onDidChangeItemsExternal=Ge.None,this.items=new Map}async updateItems(e){e.insert?.forEach((t,i)=>this.items.set(i,t)),e.delete?.forEach(t=>this.items.delete(t))}}const J5="__$__targetStorageMarker",pf=On("storageService");var AN;(function(n){n[n.NONE=0]="NONE",n[n.SHUTDOWN=1]="SHUTDOWN"})(AN||(AN={}));function wkt(n){const e=n.get(J5);if(e)try{return JSON.parse(e)}catch{}return Object.create(null)}class $le extends me{static{this.DEFAULT_FLUSH_INTERVAL=60*1e3}constructor(e={flushInterval:$le.DEFAULT_FLUSH_INTERVAL}){super(),this.options=e,this._onDidChangeValue=this._register(new Ew),this._onDidChangeTarget=this._register(new Ew),this._onWillSaveState=this._register(new fe),this.onWillSaveState=this._onWillSaveState.event,this._workspaceKeyTargets=void 0,this._profileKeyTargets=void 0,this._applicationKeyTargets=void 0}onDidChangeValue(e,t,i){return Ge.filter(this._onDidChangeValue.event,r=>r.scope===e&&(t===void 0||r.key===t),i)}emitDidChangeValue(e,t){const{key:i,external:r}=t;if(i===J5){switch(e){case-1:this._applicationKeyTargets=void 0;break;case 0:this._profileKeyTargets=void 0;break;case 1:this._workspaceKeyTargets=void 0;break}this._onDidChangeTarget.fire({scope:e})}else this._onDidChangeValue.fire({scope:e,key:i,target:this.getKeyTargets(e)[i],external:r})}get(e,t,i){return this.getStorage(t)?.get(e,i)}getBoolean(e,t,i){return this.getStorage(t)?.getBoolean(e,i)}getNumber(e,t,i){return this.getStorage(t)?.getNumber(e,i)}store(e,t,i,r,s=!1){if(Bu(t)){this.remove(e,i,s);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,i,r),this.getStorage(i)?.set(e,t,s)})}remove(e,t,i=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,t,void 0),this.getStorage(t)?.delete(e,i)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}updateKeyTarget(e,t,i,r=!1){const s=this.getKeyTargets(t);typeof i=="number"?s[e]!==i&&(s[e]=i,this.getStorage(t)?.set(J5,JSON.stringify(s),r)):typeof s[e]=="number"&&(delete s[e],this.getStorage(t)?.set(J5,JSON.stringify(s),r))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get profileKeyTargets(){return this._profileKeyTargets||(this._profileKeyTargets=this.loadKeyTargets(0)),this._profileKeyTargets}get applicationKeyTargets(){return this._applicationKeyTargets||(this._applicationKeyTargets=this.loadKeyTargets(-1)),this._applicationKeyTargets}getKeyTargets(e){switch(e){case-1:return this.applicationKeyTargets;case 0:return this.profileKeyTargets;default:return this.workspaceKeyTargets}}loadKeyTargets(e){const t=this.getStorage(e);return t?wkt(t):Object.create(null)}}class Ckt extends $le{constructor(){super(),this.applicationStorage=this._register(new CI(new nq,{hint:gk.STORAGE_IN_MEMORY})),this.profileStorage=this._register(new CI(new nq,{hint:gk.STORAGE_IN_MEMORY})),this.workspaceStorage=this._register(new CI(new nq,{hint:gk.STORAGE_IN_MEMORY})),this._register(this.workspaceStorage.onDidChangeStorage(e=>this.emitDidChangeValue(1,e))),this._register(this.profileStorage.onDidChangeStorage(e=>this.emitDidChangeValue(0,e))),this._register(this.applicationStorage.onDidChangeStorage(e=>this.emitDidChangeValue(-1,e)))}getStorage(e){switch(e){case-1:return this.applicationStorage;case 0:return this.profileStorage;default:return this.workspaceStorage}}}function xkt(n,e){const t={...e};for(const i in n){const r=n[i];t[i]=r!==void 0?it(r):void 0}return t}const Skt={keybindingLabelBackground:it(gwt),keybindingLabelForeground:it(pwt),keybindingLabelBorder:it(mwt),keybindingLabelBottomBorder:it(_wt),keybindingLabelShadow:it(JL)},kkt={buttonForeground:it(T5e),buttonSeparator:it(ewt),buttonBackground:it(LD),buttonHoverBackground:it(twt),buttonSecondaryForeground:it(iwt),buttonSecondaryBackground:it(ZX),buttonSecondaryHoverBackground:it(rwt),buttonBorder:it(nwt)},Ekt={progressBarBackground:it(gyt)},I8={inputActiveOptionBorder:it(cW),inputActiveOptionForeground:it(uW),inputActiveOptionBackground:it(eO)};it(TD),it(swt),it(owt),it(awt),it(lwt),it(cwt),it(uwt);it(dwt),it(fwt),it(hwt);it(ju),it(oW),it(JL),it(Yn),it(Oyt),it(Myt),it(Fyt),it(hyt);const A8={inputBackground:it(YX),inputForeground:it(E5e),inputBorder:it(L5e),inputValidationInfoBorder:it(qyt),inputValidationInfoBackground:it(Uyt),inputValidationInfoForeground:it(jyt),inputValidationWarningBorder:it(Yyt),inputValidationWarningBackground:it(Kyt),inputValidationWarningForeground:it(Gyt),inputValidationErrorBorder:it(Qyt),inputValidationErrorBackground:it(Zyt),inputValidationErrorForeground:it(Xyt)},Lkt={listFilterWidgetBackground:it(Iwt),listFilterWidgetOutline:it(Awt),listFilterWidgetNoMatchesOutline:it(Nwt),listFilterWidgetShadow:it(Rwt),inputBoxStyles:A8,toggleStyles:I8},wFe={badgeBackground:it(Y5),badgeForeground:it(fyt),badgeBorder:it(Yn)};it(Ryt),it(Nyt),it(h1e),it(h1e),it(Pyt);const yC={listBackground:void 0,listInactiveFocusForeground:void 0,listFocusBackground:it(vwt),listFocusForeground:it(bwt),listFocusOutline:it(ywt),listActiveSelectionBackground:it(Rw),listActiveSelectionForeground:it(yN),listActiveSelectionIconForeground:it(D5e),listFocusAndSelectionOutline:it(wwt),listFocusAndSelectionBackground:it(Rw),listFocusAndSelectionForeground:it(yN),listInactiveSelectionBackground:it(Cwt),listInactiveSelectionIconForeground:it(Swt),listInactiveSelectionForeground:it(xwt),listInactiveFocusBackground:it(kwt),listInactiveFocusOutline:it(Ewt),listHoverBackground:it(I5e),listHoverForeground:it(A5e),listDropOverBackground:it(Lwt),listDropBetweenBackground:it(Twt),listSelectionOutline:it(Ar),listHoverOutline:it(Ar),treeIndentGuidesStroke:it(N5e),treeInactiveIndentGuidesStroke:it(Pwt),treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:it(ule),tableColumnsBorder:it(Owt),tableOddRowsBackgroundColor:it(Mwt)};function wC(n){return xkt(n,yC)}const Tkt={selectBackground:it(dW),selectListBackground:it(Jyt),selectForeground:it(mle),decoratorRightForeground:it(R5e),selectBorder:it(_le),focusBorder:it(Zp),listFocusBackground:it(CN),listInactiveSelectionIconForeground:it(vle),listFocusForeground:it(wN),listFocusOutline:oyt(Ar,Te.transparent.toString()),listHoverBackground:it(I5e),listHoverForeground:it(A5e),listHoverOutline:it(Ar),selectListBorder:it(dle),listBackground:void 0,listActiveSelectionBackground:void 0,listActiveSelectionForeground:void 0,listActiveSelectionIconForeground:void 0,listFocusAndSelectionBackground:void 0,listDropOverBackground:void 0,listDropBetweenBackground:void 0,listInactiveSelectionBackground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusBackground:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listFocusAndSelectionForeground:void 0,listFocusAndSelectionOutline:void 0,listInactiveFocusForeground:void 0,tableColumnsBorder:void 0,tableOddRowsBackgroundColor:void 0,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},Dkt={shadowColor:it(JL),borderColor:it(Fwt),foregroundColor:it(Bwt),backgroundColor:it($wt),selectionForegroundColor:it(Wwt),selectionBackgroundColor:it(Hwt),selectionBorderColor:it(Vwt),separatorColor:it(zwt),scrollbarShadow:it(ule),scrollbarSliderBackground:it(v5e),scrollbarSliderHoverBackground:it(b5e),scrollbarSliderActiveBackground:it(y5e)};var kW=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},fc=function(n,e){return function(t,i){e(t,i,n)}};function Ikt(n,e,t,i){let r,s,o;if(Array.isArray(n))o=n,r=e,s=t;else{const c=e;o=n.getActions(c),r=t,s=i}const a=f_.getInstance(),l=a.keyStatus.altKey||(Ta||zl)&&a.keyStatus.shiftKey;CFe(o,r,l,s?c=>c===s:c=>c==="navigation")}function EW(n,e,t,i,r,s){let o,a,l,c,u;if(Array.isArray(n))u=n,o=e,a=t,l=i,c=r;else{const h=e;u=n.getActions(h),o=t,a=i,l=r,c=s}CFe(u,o,!1,typeof a=="string"?h=>h===a:a,l,c)}function CFe(n,e,t,i=o=>o==="navigation",r=()=>!1,s=!1){let o,a;Array.isArray(e)?(o=e,a=e):(o=e.primary,a=e.secondary);const l=new Set;for(const[c,u]of n){let d;i(c)?(d=o,d.length>0&&s&&d.push(new na)):(d=a,d.length>0&&d.push(new na));for(let h of u){t&&(h=h instanceof ou&&h.alt?h.alt:h);const f=d.push(h);h instanceof rE&&l.add({group:c,action:h,index:f-1})}}for(const{group:c,action:u,index:d}of l){const h=i(c)?o:a,f=u.actions;r(u,c,h.length)&&h.splice(d,1,...f)}}let Db=class extends vE{constructor(e,t,i,r,s,o,a,l){super(void 0,e,{icon:!!(e.class||e.item.icon),label:!e.class&&!e.item.icon,draggable:t?.draggable,keybinding:t?.keybinding,hoverDelegate:t?.hoverDelegate}),this._options=t,this._keybindingService=i,this._notificationService=r,this._contextKeyService=s,this._themeService=o,this._contextMenuService=a,this._accessibilityService=l,this._wantsAltCommand=!1,this._itemClassDispose=this._register(new To),this._altKey=f_.getInstance()}get _menuItemAction(){return this._action}get _commandAction(){return this._wantsAltCommand&&this._menuItemAction.alt||this._menuItemAction}async onClick(e){e.preventDefault(),e.stopPropagation();try{await this.actionRunner.run(this._commandAction,this._context)}catch(t){this._notificationService.error(t)}}render(e){if(super.render(e),e.classList.add("menu-entry"),this.options.icon&&this._updateItemClass(this._menuItemAction.item),this._menuItemAction.alt){let t=!1;const i=()=>{const r=!!this._menuItemAction.alt?.enabled&&(!this._accessibilityService.isMotionReduced()||t)&&(this._altKey.keyStatus.altKey||this._altKey.keyStatus.shiftKey&&t);r!==this._wantsAltCommand&&(this._wantsAltCommand=r,this.updateLabel(),this.updateTooltip(),this.updateClass())};this._register(this._altKey.event(i)),this._register(Ce(e,"mouseleave",r=>{t=!1,i()})),this._register(Ce(e,"mouseenter",r=>{t=!0,i()})),i()}}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this._commandAction.label)}getTooltip(){const e=this._keybindingService.lookupKeybinding(this._commandAction.id,this._contextKeyService),t=e&&e.getLabel(),i=this._commandAction.tooltip||this._commandAction.label;let r=t?w("titleAndKb","{0} ({1})",i,t):i;if(!this._wantsAltCommand&&this._menuItemAction.alt?.enabled){const s=this._menuItemAction.alt.tooltip||this._menuItemAction.alt.label,o=this._keybindingService.lookupKeybinding(this._menuItemAction.alt.id,this._contextKeyService),a=o&&o.getLabel(),l=a?w("titleAndKb","{0} ({1})",s,a):s;r=w("titleAndKbAndAlt",`{0} +[{1}] {2}`,r,Ole.modifierLabels[eu].altKey,l)}return r}updateClass(){this.options.icon&&(this._commandAction!==this._menuItemAction?this._menuItemAction.alt&&this._updateItemClass(this._menuItemAction.alt.item):this._updateItemClass(this._menuItemAction.item))}_updateItemClass(e){this._itemClassDispose.value=void 0;const{element:t,label:i}=this;if(!t||!i)return;const r=this._commandAction.checked&&ykt(e.toggled)&&e.toggled.icon?e.toggled.icon:e.icon;if(r)if(zt.isThemeIcon(r)){const s=zt.asClassNameArray(r);i.classList.add(...s),this._itemClassDispose.value=Lt(()=>{i.classList.remove(...s)})}else i.style.backgroundImage=aE(this._themeService.getColorTheme().type)?Z_(r.dark):Z_(r.light),i.classList.add("icon"),this._itemClassDispose.value=Qh(Lt(()=>{i.style.backgroundImage="",i.classList.remove("icon")}),this._themeService.onDidColorThemeChange(()=>{this.updateClass()}))}};Db=kW([fc(2,xi),fc(3,Ts),fc(4,jt),fc(5,go),fc(6,mu),fc(7,_u)],Db);class Wle extends Db{render(e){this.options.label=!0,this.options.icon=!1,super.render(e),e.classList.add("text-only"),e.classList.toggle("use-comma",this._options?.useComma??!1)}updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=Wle._symbolPrintEnter(e);this._options?.conversational?this.label.textContent=w({key:"content2",comment:['A label with keybindg like "ESC to dismiss"']},"{1} to {0}",this._action.label,t):this.label.textContent=w({key:"content",comment:["A label","A keybinding"]},"{0} ({1})",this._action.label,t)}}static _symbolPrintEnter(e){return e.getLabel()?.replace(/\benter\b/gi,"⏎").replace(/\bEscape\b/gi,"Esc")}}let kQ=class extends D8{constructor(e,t,i,r,s){const o={...t,menuAsChild:t?.menuAsChild??!1,classNames:t?.classNames??(zt.isThemeIcon(e.item.icon)?zt.asClassName(e.item.icon):void 0),keybindingProvider:t?.keybindingProvider??(a=>i.lookupKeybinding(a.id))};super(e,{getActions:()=>e.actions},r,o),this._keybindingService=i,this._contextMenuService=r,this._themeService=s}render(e){super.render(e),oi(this.element),e.classList.add("menu-entry");const t=this._action,{icon:i}=t.item;if(i&&!zt.isThemeIcon(i)){this.element.classList.add("icon");const r=()=>{this.element&&(this.element.style.backgroundImage=aE(this._themeService.getColorTheme().type)?Z_(i.dark):Z_(i.light))};r(),this._register(this._themeService.onDidColorThemeChange(()=>{r()}))}}};kQ=kW([fc(2,xi),fc(3,mu),fc(4,go)],kQ);let EQ=class extends Xf{constructor(e,t,i,r,s,o,a,l){super(null,e),this._keybindingService=i,this._notificationService=r,this._contextMenuService=s,this._menuService=o,this._instaService=a,this._storageService=l,this._container=null,this._options=t,this._storageKey=`${e.item.submenu.id}_lastActionId`;let c;const u=t?.persistLastActionId?l.get(this._storageKey,1):void 0;u&&(c=e.actions.find(h=>u===h.id)),c||(c=e.actions[0]),this._defaultAction=this._instaService.createInstance(Db,c,{keybinding:this._getDefaultActionKeybindingLabel(c)});const d={keybindingProvider:h=>this._keybindingService.lookupKeybinding(h.id),...t,menuAsChild:t?.menuAsChild??!0,classNames:t?.classNames??["codicon","codicon-chevron-down"],actionRunner:t?.actionRunner??new Aw};this._dropdown=new D8(e,e.actions,this._contextMenuService,d),this._register(this._dropdown.actionRunner.onDidRun(h=>{h.action instanceof ou&&this.update(h.action)}))}update(e){this._options?.persistLastActionId&&this._storageService.store(this._storageKey,e.id,1,1),this._defaultAction.dispose(),this._defaultAction=this._instaService.createInstance(Db,e,{keybinding:this._getDefaultActionKeybindingLabel(e)}),this._defaultAction.actionRunner=new class extends Aw{async runAction(t,i){await t.run(void 0)}},this._container&&this._defaultAction.render(Vae(this._container,qe(".action-container")))}_getDefaultActionKeybindingLabel(e){let t;if(this._options?.renderKeybindingWithDefaultActionLabel){const i=this._keybindingService.lookupKeybinding(e.id);i&&(t=`(${i.getLabel()})`)}return t}setActionContext(e){super.setActionContext(e),this._defaultAction.setActionContext(e),this._dropdown.setActionContext(e)}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-default");const t=qe(".action-container");this._defaultAction.render(Ne(this._container,t)),this._register(Ce(t,je.KEY_DOWN,r=>{const s=new or(r);s.equals(17)&&(this._defaultAction.element.tabIndex=-1,this._dropdown.focus(),s.stopPropagation())}));const i=qe(".dropdown-action-container");this._dropdown.render(Ne(this._container,i)),this._register(Ce(i,je.KEY_DOWN,r=>{const s=new or(r);s.equals(15)&&(this._defaultAction.element.tabIndex=0,this._dropdown.setFocusable(!1),this._defaultAction.element?.focus(),s.stopPropagation())}))}focus(e){e?this._dropdown.focus():(this._defaultAction.element.tabIndex=0,this._defaultAction.element.focus())}blur(){this._defaultAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._defaultAction.element.tabIndex=0:(this._defaultAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}dispose(){this._defaultAction.dispose(),this._dropdown.dispose(),super.dispose()}};EQ=kW([fc(2,xi),fc(3,Ts),fc(4,mu),fc(5,ld),fc(6,Tt),fc(7,pf)],EQ);let LQ=class extends mkt{constructor(e,t){super(null,e,e.actions.map(i=>({text:i.id===na.ID?"─────────":i.label,isDisabled:!i.enabled})),0,t,Tkt,{ariaLabel:e.tooltip,optionsAsChildren:!0}),this.select(Math.max(0,e.actions.findIndex(i=>i.checked)))}render(e){super.render(e),e.style.borderColor=it(_le)}runAction(e,t){const i=this.action.actions[t];i&&this.actionRunner.run(i)}};LQ=kW([fc(1,m0)],LQ);function xFe(n,e,t){return e instanceof ou?n.createInstance(Db,e,t):e instanceof ck?e.item.isSelection?n.createInstance(LQ,e):e.item.rememberDefaultAction?n.createInstance(EQ,e,{...t,persistLastActionId:!0}):n.createInstance(kQ,e,t):void 0}class ed extends me{constructor(e,t={}){super(),this._actionRunnerDisposables=this._register(new ke),this.viewItemDisposables=this._register(new yae),this.triggerKeyDown=!1,this.focusable=!0,this._onDidBlur=this._register(new fe),this.onDidBlur=this._onDidBlur.event,this._onDidCancel=this._register(new fe({onWillAddFirstListener:()=>this.cancelHasListener=!0})),this.onDidCancel=this._onDidCancel.event,this.cancelHasListener=!1,this._onDidRun=this._register(new fe),this.onDidRun=this._onDidRun.event,this._onWillRun=this._register(new fe),this.onWillRun=this._onWillRun.event,this.options=t,this._context=t.context??null,this._orientation=this.options.orientation??0,this._triggerKeys={keyDown:this.options.triggerKeys?.keyDown??!1,keys:this.options.triggerKeys?.keys??[3,10]},this._hoverDelegate=t.hoverDelegate??this._register(_E()),this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new Aw,this._actionRunnerDisposables.add(this._actionRunner)),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(s=>this._onDidRun.fire(s))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(s=>this._onWillRun.fire(s))),this.viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar";let i,r;switch(this._orientation){case 0:i=[15],r=[17];break;case 1:i=[16],r=[18],this.domNode.className+=" vertical";break}this._register(Ce(this.domNode,je.KEY_DOWN,s=>{const o=new or(s);let a=!0;const l=typeof this.focusedItem=="number"?this.viewItems[this.focusedItem]:void 0;i&&(o.equals(i[0])||o.equals(i[1]))?a=this.focusPrevious():r&&(o.equals(r[0])||o.equals(r[1]))?a=this.focusNext():o.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():o.equals(14)?a=this.focusFirst():o.equals(13)?a=this.focusLast():o.equals(2)&&l instanceof Xf&&l.trapsArrowNavigation?a=this.focusNext(void 0,!0):this.isTriggerKeyEvent(o)?this._triggerKeys.keyDown?this.doTrigger(o):this.triggerKeyDown=!0:a=!1,a&&(o.preventDefault(),o.stopPropagation())})),this._register(Ce(this.domNode,je.KEY_UP,s=>{const o=new or(s);this.isTriggerKeyEvent(o)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(o)),o.preventDefault(),o.stopPropagation()):(o.equals(2)||o.equals(1026)||o.equals(16)||o.equals(18)||o.equals(15)||o.equals(17))&&this.updateFocusedItem()})),this.focusTracker=this._register(Eg(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{(ka()===this.domNode||!xo(ka(),this.domNode))&&(this._onDidBlur.fire(),this.previouslyFocusedItem=this.focusedItem,this.focusedItem=void 0,this.triggerKeyDown=!1)})),this._register(this.focusTracker.onDidFocus(()=>this.updateFocusedItem())),this.actionsList=document.createElement("ul"),this.actionsList.className="actions-container",this.options.highlightToggledItems&&this.actionsList.classList.add("highlight-toggled"),this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}refreshRole(){this.length()>=1?this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"):this.actionsList.setAttribute("role","presentation")}setFocusable(e){if(this.focusable=e,this.focusable){const t=this.viewItems.find(i=>i instanceof Xf&&i.isEnabled());t instanceof Xf&&t.setFocusable(!0)}else this.viewItems.forEach(t=>{t instanceof Xf&&t.setFocusable(!1)})}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach(i=>{t=t||e.equals(i)}),t}updateFocusedItem(){for(let e=0;et.setActionContext(e))}get actionRunner(){return this._actionRunner}set actionRunner(e){this._actionRunner=e,this._actionRunnerDisposables.clear(),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(t=>this._onDidRun.fire(t))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(t=>this._onWillRun.fire(t))),this.viewItems.forEach(t=>t.actionRunner=e)}getContainer(){return this.domNode}getAction(e){if(typeof e=="number")return this.viewItems[e]?.action;if(Eo(e)){for(;e.parentElement!==this.actionsList;){if(!e.parentElement)return;e=e.parentElement}for(let t=0;t{const o=document.createElement("li");o.className="action-item",o.setAttribute("role","presentation");let a;const l={hoverDelegate:this._hoverDelegate,...t,isTabList:this.options.ariaRole==="tablist"};this.options.actionViewItemProvider&&(a=this.options.actionViewItemProvider(s,l)),a||(a=new vE(this.context,s,l)),this.options.allowContextMenu||this.viewItemDisposables.set(a,Ce(o,je.CONTEXT_MENU,c=>{Hn.stop(c,!0)})),a.actionRunner=this._actionRunner,a.setActionContext(this.context),a.render(o),this.focusable&&a instanceof Xf&&this.viewItems.length===0&&a.setFocusable(!0),r===null||r<0||r>=this.actionsList.children.length?(this.actionsList.appendChild(o),this.viewItems.push(a)):(this.actionsList.insertBefore(o,this.actionsList.children[r]),this.viewItems.splice(r,0,a),r++)}),typeof this.focusedItem=="number"&&this.focus(this.focusedItem),this.refreshRole()}clear(){this.isEmpty()||(this.viewItems=er(this.viewItems),this.viewItemDisposables.clearAndDisposeAll(),Jo(this.actionsList),this.refreshRole())}length(){return this.viewItems.length}isEmpty(){return this.viewItems.length===0}focus(e){let t=!1,i;if(e===void 0?t=!0:typeof e=="number"?i=e:typeof e=="boolean"&&(t=e),t&&typeof this.focusedItem>"u"){const r=this.viewItems.findIndex(s=>s.isEnabled());this.focusedItem=r===-1?void 0:r,this.updateFocus(void 0,void 0,!0)}else i!==void 0&&(this.focusedItem=i),this.updateFocus(void 0,void 0,!0)}focusFirst(){return this.focusedItem=this.length()-1,this.focusNext(!0)}focusLast(){return this.focusedItem=0,this.focusPrevious(!0)}focusNext(e,t){if(typeof this.focusedItem>"u")this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;const i=this.focusedItem;let r;do{if(!e&&this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=i,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,r=this.viewItems[this.focusedItem]}while(this.focusedItem!==i&&(this.options.focusOnlyEnabledItems&&!r.isEnabled()||r.action.id===na.ID));return this.updateFocus(void 0,void 0,t),!0}focusPrevious(e){if(typeof this.focusedItem>"u")this.focusedItem=0;else if(this.viewItems.length<=1)return!1;const t=this.focusedItem;let i;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(!e&&this.options.preventLoopNavigation)return this.focusedItem=t,!1;this.focusedItem=this.viewItems.length-1}i=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&(this.options.focusOnlyEnabledItems&&!i.isEnabled()||i.action.id===na.ID));return this.updateFocus(!0),!0}updateFocus(e,t,i=!1){typeof this.focusedItem>"u"&&this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem!==void 0&&this.previouslyFocusedItem!==this.focusedItem&&this.viewItems[this.previouslyFocusedItem]?.blur();const r=this.focusedItem!==void 0?this.viewItems[this.focusedItem]:void 0;if(r){let s=!0;tN(r.focus)||(s=!1),this.options.focusOnlyEnabledItems&&tN(r.isEnabled)&&!r.isEnabled()&&(s=!1),r.action.id===na.ID&&(s=!1),s?(i||this.previouslyFocusedItem!==this.focusedItem)&&(r.focus(e),this.previouslyFocusedItem=this.focusedItem):(this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem=void 0),s&&r.showHover?.()}}doTrigger(e){if(typeof this.focusedItem>"u")return;const t=this.viewItems[this.focusedItem];if(t instanceof Xf){const i=t._context===null||t._context===void 0?e:t._context;this.run(t._action,i)}}async run(e,t){await this._actionRunner.run(e,t)}dispose(){this._context=void 0,this.viewItems=er(this.viewItems),this.getContainer().remove(),super.dispose()}}const TQ=/\(&([^\s&])\)|(^|[^&])&([^\s&])/,iq=/(&)?(&)([^\s&])/g;var N8;(function(n){n[n.Right=0]="Right",n[n.Left=1]="Left"})(N8||(N8={}));var DQ;(function(n){n[n.Above=0]="Above",n[n.Below=1]="Below"})(DQ||(DQ={}));let SFe=class eF extends ed{constructor(e,t,i,r){e.classList.add("monaco-menu-container"),e.setAttribute("role","presentation");const s=document.createElement("div");s.classList.add("monaco-menu"),s.setAttribute("role","presentation"),super(s,{orientation:1,actionViewItemProvider:c=>this.doGetActionViewItem(c,i,o),context:i.context,actionRunner:i.actionRunner,ariaLabel:i.ariaLabel,ariaRole:"menu",focusOnlyEnabledItems:!0,triggerKeys:{keys:[3,...Rn||zl?[10]:[]],keyDown:!0}}),this.menuStyles=r,this.menuElement=s,this.actionsList.tabIndex=0,this.initializeOrUpdateStyleSheet(e,r),this._register(Fr.addTarget(s)),this._register(Ce(s,je.KEY_DOWN,c=>{new or(c).equals(2)&&c.preventDefault()})),i.enableMnemonics&&this._register(Ce(s,je.KEY_DOWN,c=>{const u=c.key.toLocaleLowerCase();if(this.mnemonics.has(u)){Hn.stop(c,!0);const d=this.mnemonics.get(u);if(d.length===1&&(d[0]instanceof eye&&d[0].container&&this.focusItemByElement(d[0].container),d[0].onClick(c)),d.length>1){const h=d.shift();h&&h.container&&(this.focusItemByElement(h.container),d.push(h)),this.mnemonics.set(u,d)}}})),zl&&this._register(Ce(s,je.KEY_DOWN,c=>{const u=new or(c);u.equals(14)||u.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),Hn.stop(c,!0)):(u.equals(13)||u.equals(12))&&(this.focusedItem=0,this.focusPrevious(),Hn.stop(c,!0))})),this._register(Ce(this.domNode,je.MOUSE_OUT,c=>{const u=c.relatedTarget;xo(u,this.domNode)||(this.focusedItem=void 0,this.updateFocus(),c.stopPropagation())})),this._register(Ce(this.actionsList,je.MOUSE_OVER,c=>{let u=c.target;if(!(!u||!xo(u,this.actionsList)||u===this.actionsList)){for(;u.parentElement!==this.actionsList&&u.parentElement!==null;)u=u.parentElement;if(u.classList.contains("action-item")){const d=this.focusedItem;this.setFocusedItem(u),d!==this.focusedItem&&this.updateFocus()}}})),this._register(Fr.addTarget(this.actionsList)),this._register(Ce(this.actionsList,gr.Tap,c=>{let u=c.initialTarget;if(!(!u||!xo(u,this.actionsList)||u===this.actionsList)){for(;u.parentElement!==this.actionsList&&u.parentElement!==null;)u=u.parentElement;if(u.classList.contains("action-item")){const d=this.focusedItem;this.setFocusedItem(u),d!==this.focusedItem&&this.updateFocus()}}}));const o={parent:this};this.mnemonics=new Map,this.scrollableElement=this._register(new tO(s,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3,verticalScrollbarSize:7,handleMouseWheel:!0,useShadows:!0}));const a=this.scrollableElement.getDomNode();a.style.position="",this.styleScrollElement(a,r),this._register(Ce(s,gr.Change,c=>{Hn.stop(c,!0);const u=this.scrollableElement.getScrollPosition().scrollTop;this.scrollableElement.setScrollPosition({scrollTop:u-c.translationY})})),this._register(Ce(a,je.MOUSE_UP,c=>{c.preventDefault()}));const l=Ot(e);s.style.maxHeight=`${Math.max(10,l.innerHeight-e.getBoundingClientRect().top-35)}px`,t=t.filter((c,u)=>i.submenuIds?.has(c.id)?(console.warn(`Found submenu cycle: ${c.id}`),!1):!(c instanceof na&&(u===t.length-1||u===0||t[u-1]instanceof na))),this.push(t,{icon:!0,label:!0,isMenu:!0}),e.appendChild(this.scrollableElement.getDomNode()),this.scrollableElement.scanDomNode(),this.viewItems.filter(c=>!(c instanceof tye)).forEach((c,u,d)=>{c.updatePositionInSet(u+1,d.length)})}initializeOrUpdateStyleSheet(e,t){this.styleSheet||(G6(e)?this.styleSheet=id(e):(eF.globalStyleSheet||(eF.globalStyleSheet=id()),this.styleSheet=eF.globalStyleSheet)),this.styleSheet.textContent=Nkt(t,G6(e))}styleScrollElement(e,t){const i=t.foregroundColor??"",r=t.backgroundColor??"",s=t.borderColor?`1px solid ${t.borderColor}`:"",o="5px",a=t.shadowColor?`0 2px 8px ${t.shadowColor}`:"";e.style.outline=s,e.style.borderRadius=o,e.style.color=i,e.style.backgroundColor=r,e.style.boxShadow=a}getContainer(){return this.scrollableElement.getDomNode()}get onScroll(){return this.scrollableElement.onScroll}focusItemByElement(e){const t=this.focusedItem;this.setFocusedItem(e),t!==this.focusedItem&&this.updateFocus()}setFocusedItem(e){for(let t=0;t{this.element&&(this._register(Ce(this.element,je.MOUSE_UP,s=>{if(Hn.stop(s,!0),Xd){if(new qh(Ot(this.element),s).rightButton)return;this.onClick(s)}else setTimeout(()=>{this.onClick(s)},0)})),this._register(Ce(this.element,je.CONTEXT_MENU,s=>{Hn.stop(s,!0)})))},100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),this.element&&(this.container=e,this.item=Ne(this.element,qe("a.action-menu-item")),this._action.id===na.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=Ne(this.item,qe("span.menu-item-check"+zt.asCSSSelector(ze.menuSelection))),this.check.setAttribute("role","none"),this.label=Ne(this.item,qe("span.action-label")),this.options.label&&this.options.keybinding&&(Ne(this.item,qe("span.keybinding")).textContent=this.options.keybinding),this.runOnceToEnableMouseUp.schedule(),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked(),this.applyStyle())}blur(){super.blur(),this.applyStyle()}focus(){super.focus(),this.item?.focus(),this.applyStyle()}updatePositionInSet(e,t){this.item&&(this.item.setAttribute("aria-posinset",`${e}`),this.item.setAttribute("aria-setsize",`${t}`))}updateLabel(){if(this.label&&this.options.label){Jo(this.label);let e=Dle(this.action.label);if(e){const t=Akt(e);this.options.enableMnemonics||(e=t),this.label.setAttribute("aria-label",t.replace(/&&/g,"&"));const i=TQ.exec(e);if(i){e=gI(e),iq.lastIndex=0;let r=iq.exec(e);for(;r&&r[1];)r=iq.exec(e);const s=o=>o.replace(/&&/g,"&");r?this.label.append(jP(s(e.substr(0,r.index))," "),qe("u",{"aria-hidden":"true"},r[3]),W4e(s(e.substr(r.index+r[0].length))," ")):this.label.innerText=s(e).trim(),this.item?.setAttribute("aria-keyshortcuts",(i[1]?i[1]:i[3]).toLocaleLowerCase())}else this.label.innerText=e.replace(/&&/g,"&").trim()}}}updateTooltip(){}updateClass(){this.cssClass&&this.item&&this.item.classList.remove(...this.cssClass.split(" ")),this.options.icon&&this.label?(this.cssClass=this.action.class||"",this.label.classList.add("icon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" ")),this.updateEnabled()):this.label&&this.label.classList.remove("icon")}updateEnabled(){this.action.enabled?(this.element&&(this.element.classList.remove("disabled"),this.element.removeAttribute("aria-disabled")),this.item&&(this.item.classList.remove("disabled"),this.item.removeAttribute("aria-disabled"),this.item.tabIndex=0)):(this.element&&(this.element.classList.add("disabled"),this.element.setAttribute("aria-disabled","true")),this.item&&(this.item.classList.add("disabled"),this.item.setAttribute("aria-disabled","true")))}updateChecked(){if(!this.item)return;const e=this.action.checked;this.item.classList.toggle("checked",!!e),e!==void 0?(this.item.setAttribute("role","menuitemcheckbox"),this.item.setAttribute("aria-checked",e?"true":"false")):(this.item.setAttribute("role","menuitem"),this.item.setAttribute("aria-checked",""))}getMnemonic(){return this.mnemonic}applyStyle(){const e=this.element&&this.element.classList.contains("focused"),t=e&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor,i=e&&this.menuStyle.selectionBackgroundColor?this.menuStyle.selectionBackgroundColor:void 0,r=e&&this.menuStyle.selectionBorderColor?`1px solid ${this.menuStyle.selectionBorderColor}`:"",s=e&&this.menuStyle.selectionBorderColor?"-1px":"";this.item&&(this.item.style.color=t??"",this.item.style.backgroundColor=i??"",this.item.style.outline=r,this.item.style.outlineOffset=s),this.check&&(this.check.style.color=t??"")}}class eye extends kFe{constructor(e,t,i,r,s){super(e,e,r,s),this.submenuActions=t,this.parentData=i,this.submenuOptions=r,this.mysubmenu=null,this.submenuDisposables=this._register(new ke),this.mouseOver=!1,this.expandDirection=r&&r.expandDirection!==void 0?r.expandDirection:{horizontal:N8.Right,vertical:DQ.Below},this.showScheduler=new Ui(()=>{this.mouseOver&&(this.cleanupExistingSubmenu(!1),this.createSubmenu(!1))},250),this.hideScheduler=new Ui(()=>{this.element&&!xo(ka(),this.element)&&this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))},750)}render(e){super.render(e),this.element&&(this.item&&(this.item.classList.add("monaco-submenu-item"),this.item.tabIndex=0,this.item.setAttribute("aria-haspopup","true"),this.updateAriaExpanded("false"),this.submenuIndicator=Ne(this.item,qe("span.submenu-indicator"+zt.asCSSSelector(ze.menuSubmenu))),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register(Ce(this.element,je.KEY_UP,t=>{const i=new or(t);(i.equals(17)||i.equals(3))&&(Hn.stop(t,!0),this.createSubmenu(!0))})),this._register(Ce(this.element,je.KEY_DOWN,t=>{const i=new or(t);ka()===this.item&&(i.equals(17)||i.equals(3))&&Hn.stop(t,!0)})),this._register(Ce(this.element,je.MOUSE_OVER,t=>{this.mouseOver||(this.mouseOver=!0,this.showScheduler.schedule())})),this._register(Ce(this.element,je.MOUSE_LEAVE,t=>{this.mouseOver=!1})),this._register(Ce(this.element,je.FOCUS_OUT,t=>{this.element&&!xo(ka(),this.element)&&this.hideScheduler.schedule()})),this._register(this.parentData.parent.onScroll(()=>{this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))})))}updateEnabled(){}onClick(e){Hn.stop(e,!0),this.cleanupExistingSubmenu(!1),this.createSubmenu(!0)}cleanupExistingSubmenu(e){if(this.parentData.submenu&&(e||this.parentData.submenu!==this.mysubmenu)){try{this.parentData.submenu.dispose()}catch{}this.parentData.submenu=void 0,this.updateAriaExpanded("false"),this.submenuContainer&&(this.submenuDisposables.clear(),this.submenuContainer=void 0)}}calculateSubmenuMenuLayout(e,t,i,r){const s={top:0,left:0};return s.left=SS(e.width,t.width,{position:r.horizontal===N8.Right?0:1,offset:i.left,size:i.width}),s.left>=i.left&&s.left{new or(u).equals(15)&&(Hn.stop(u,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))})),this.submenuDisposables.add(Ce(this.submenuContainer,je.KEY_DOWN,u=>{new or(u).equals(15)&&Hn.stop(u,!0)})),this.submenuDisposables.add(this.parentData.submenu.onDidCancel(()=>{this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0)})),this.parentData.submenu.focus(e),this.mysubmenu=this.parentData.submenu}}updateAriaExpanded(e){this.item&&this.item?.setAttribute("aria-expanded",e)}applyStyle(){super.applyStyle();const t=this.element&&this.element.classList.contains("focused")&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor;this.submenuIndicator&&(this.submenuIndicator.style.color=t??"")}dispose(){super.dispose(),this.hideScheduler.dispose(),this.mysubmenu&&(this.mysubmenu.dispose(),this.mysubmenu=null),this.submenuContainer&&(this.submenuContainer=void 0)}}class tye extends vE{constructor(e,t,i,r){super(e,t,i),this.menuStyles=r}render(e){super.render(e),this.label&&(this.label.style.borderBottomColor=this.menuStyles.separatorColor?`${this.menuStyles.separatorColor}`:"")}}function Akt(n){const e=TQ,t=e.exec(n);if(!t)return n;const i=!t[1];return n.replace(e,i?"$2$3":"").trim()}function nye(n){const e=P4e()[n.id];return`.codicon-${n.id}:before { content: '\\${e.toString(16)}'; }`}function Nkt(n,e){let t=` .monaco-menu { font-size: 13px; border-radius: 5px; @@ -674,17 +674,17 @@ ${nye(ze.menuSubmenu)} .monaco-scrollable-element > .scrollbar > .slider.active { background: ${o}; } - `)}return t}class Rkt{constructor(e,t,i,r){this.contextViewService=e,this.telemetryService=t,this.notificationService=i,this.keybindingService=r,this.focusToReturn=null,this.lastContainer=null,this.block=null,this.blockDisposable=null,this.options={blockMouse:!0}}configure(e){this.options=e}showContextMenu(e){const t=e.getActions();if(!t.length)return;this.focusToReturn=ka();let i;const r=Eo(e.domForShadowRoot)?e.domForShadowRoot:void 0;this.contextViewService.showContextView({getAnchor:()=>e.getAnchor(),canRelayout:!1,anchorAlignment:e.anchorAlignment,anchorAxisAlignment:e.anchorAxisAlignment,render:s=>{this.lastContainer=s;const o=e.getMenuClassName?e.getMenuClassName():"";o&&(s.className+=" "+o),this.options.blockMouse&&(this.block=s.appendChild(qe(".context-view-block")),this.block.style.position="fixed",this.block.style.cursor="initial",this.block.style.left="0",this.block.style.top="0",this.block.style.width="100%",this.block.style.height="100%",this.block.style.zIndex="-1",this.blockDisposable?.dispose(),this.blockDisposable=Ce(this.block,je.MOUSE_DOWN,u=>u.stopPropagation()));const a=new ke,l=e.actionRunner||new Aw;l.onWillRun(u=>this.onActionRun(u,!e.skipTelemetry),this,a),l.onDidRun(this.onDidActionRun,this,a),i=new S5e(s,t,{actionViewItemProvider:e.getActionViewItem,context:e.getActionsContext?e.getActionsContext():null,actionRunner:l,getKeyBinding:e.getKeyBinding?e.getKeyBinding:u=>this.keybindingService.lookupKeybinding(u.id)},Dkt),i.onDidCancel(()=>this.contextViewService.hideContextView(!0),null,a),i.onDidBlur(()=>this.contextViewService.hideContextView(!0),null,a);const c=Ot(s);return a.add(Ce(c,je.BLUR,()=>this.contextViewService.hideContextView(!0))),a.add(Ce(c,je.MOUSE_DOWN,u=>{if(u.defaultPrevented)return;const d=new qh(c,u);let h=d.target;if(!d.rightButton){for(;h;){if(h===s)return;h=h.parentElement}this.contextViewService.hideContextView(!0)}})),Qh(a,i)},focus:()=>{i?.focus(!!e.autoSelectFirstItem)},onHide:s=>{e.onHide?.(!!s),this.block&&(this.block.remove(),this.block=null),this.blockDisposable?.dispose(),this.blockDisposable=null,this.lastContainer&&(ka()===this.lastContainer||xo(ka(),this.lastContainer))&&this.focusToReturn?.focus(),this.lastContainer=null}},r,!!r)}onActionRun(e,t){t&&this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.action.id,from:"contextMenu"}),this.contextViewService.hideContextView(!1)}onDidActionRun(e){e.error&&!uh(e.error)&&this.notificationService.error(e.error)}}var Pkt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gx=function(n,e){return function(t,i){e(t,i,n)}};let IQ=class extends me{get contextMenuHandler(){return this._contextMenuHandler||(this._contextMenuHandler=new Rkt(this.contextViewService,this.telemetryService,this.notificationService,this.keybindingService)),this._contextMenuHandler}constructor(e,t,i,r,s,o){super(),this.telemetryService=e,this.notificationService=t,this.contextViewService=i,this.keybindingService=r,this.menuService=s,this.contextKeyService=o,this._contextMenuHandler=void 0,this._onDidShowContextMenu=this._store.add(new fe),this.onDidShowContextMenu=this._onDidShowContextMenu.event,this._onDidHideContextMenu=this._store.add(new fe)}configure(e){this.contextMenuHandler.configure(e)}showContextMenu(e){e=AQ.transform(e,this.menuService,this.contextKeyService),this.contextMenuHandler.showContextMenu({...e,onHide:t=>{e.onHide?.(t),this._onDidHideContextMenu.fire()}}),f_.getInstance().resetKeyStatus(),this._onDidShowContextMenu.fire()}};IQ=Pkt([gx(0,Qa),gx(1,Ts),gx(2,m0),gx(3,xi),gx(4,ld),gx(5,jt)],IQ);var AQ;(function(n){function e(i){return i&&i.menuId instanceof ce}function t(i,r,s){if(!e(i))return i;const{menuId:o,menuActionOptions:a,contextKeyService:l}=i;return{...i,getActions:()=>{const c=[];if(o){const u=r.getMenuActions(o,l??s,a);Ikt(u,c)}return i.getActions?na.join(i.getActions(),c):c}}}n.transform=t})(AQ||(AQ={}));var R8;(function(n){n[n.API=0]="API",n[n.USER=1]="USER"})(R8||(R8={}));var Hle=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},P8=function(n,e){return function(t,i){e(t,i,n)}};let NQ=class{constructor(e){this._commandService=e}async open(e,t){if(!O$(e,sn.command))return!1;if(!t?.allowCommands||(typeof e=="string"&&(e=Pt.parse(e)),Array.isArray(t.allowCommands)&&!t.allowCommands.includes(e.path)))return!0;let i=[];try{i=iQ(decodeURIComponent(e.query))}catch{try{i=iQ(e.query)}catch{}}return Array.isArray(i)||(i=[i]),await this._commandService.executeCommand(e.path,...i),!0}};NQ=Hle([P8(0,_r)],NQ);let RQ=class{constructor(e){this._editorService=e}async open(e,t){typeof e=="string"&&(e=Pt.parse(e));const{selection:i,uri:r}=aCt(e);return e=r,e.scheme===sn.file&&(e=zCt(e)),await this._editorService.openCodeEditor({resource:e,options:{selection:i,source:t?.fromUserGesture?R8.USER:R8.API,...t?.editorOptions}},this._editorService.getFocusedCodeEditor(),t?.openToSide),!0}};RQ=Hle([P8(0,ai)],RQ);let PQ=class{constructor(e,t){this._openers=new Rl,this._validators=new Rl,this._resolvers=new Rl,this._resolvedUriTargets=new so(i=>i.with({path:null,fragment:null,query:null}).toString()),this._externalOpeners=new Rl,this._defaultExternalOpener={openExternal:async i=>(mX(i,sn.http,sn.https)?v3e(i):Xi.location.href=i,!0)},this._openers.push({open:async(i,r)=>r?.openExternal||mX(i,sn.mailto,sn.http,sn.https,sn.vsls)?(await this._doOpenExternal(i,r),!0):!1}),this._openers.push(new NQ(t)),this._openers.push(new RQ(e))}registerOpener(e){return{dispose:this._openers.unshift(e)}}async open(e,t){const i=typeof e=="string"?Pt.parse(e):e,r=this._resolvedUriTargets.get(i)??e;for(const s of this._validators)if(!await s.shouldOpen(r,t))return!1;for(const s of this._openers)if(await s.open(e,t))return!0;return!1}async resolveExternalUri(e,t){for(const i of this._resolvers)try{const r=await i.resolveExternalUri(e,t);if(r)return this._resolvedUriTargets.has(r.resolved)||this._resolvedUriTargets.set(r.resolved,e),r}catch{}throw new Error("Could not resolve external URI: "+e.toString())}async _doOpenExternal(e,t){const i=typeof e=="string"?Pt.parse(e):e;let r;try{r=(await this.resolveExternalUri(i,t)).resolved}catch{r=i}let s;if(typeof e=="string"&&i.toString()===r.toString()?s=e:s=encodeURI(r.toString(!0)),t?.allowContributedOpeners){const o=typeof t?.allowContributedOpeners=="string"?t?.allowContributedOpeners:void 0;for(const a of this._externalOpeners)if(await a.openExternal(s,{sourceUri:i,preferredOpenerId:o},yn.None))return!0}return this._defaultExternalOpener.openExternal(s,{sourceUri:i},yn.None)}dispose(){this._validators.clear()}};PQ=Hle([P8(0,ai),P8(1,_r)],PQ);const Oc=On("editorWorkerService");var os;(function(n){n[n.Hint=1]="Hint",n[n.Info=2]="Info",n[n.Warning=4]="Warning",n[n.Error=8]="Error"})(os||(os={}));(function(n){function e(o,a){return a-o}n.compare=e;const t=Object.create(null);t[n.Error]=w("sev.error","Error"),t[n.Warning]=w("sev.warning","Warning"),t[n.Info]=w("sev.info","Info");function i(o){return t[o]||""}n.toString=i;function r(o){switch(o){case Ss.Error:return n.Error;case Ss.Warning:return n.Warning;case Ss.Info:return n.Info;case Ss.Ignore:return n.Hint}}n.fromSeverity=r;function s(o){switch(o){case n.Error:return Ss.Error;case n.Warning:return Ss.Warning;case n.Info:return Ss.Info;case n.Hint:return Ss.Ignore}}n.toSeverity=s})(os||(os={}));var O8;(function(n){const e="";function t(r){return i(r,!0)}n.makeKey=t;function i(r,s){const o=[e];return r.source?o.push(r.source.replace("¦","\\¦")):o.push(e),r.code?typeof r.code=="string"?o.push(r.code.replace("¦","\\¦")):o.push(r.code.value.replace("¦","\\¦")):o.push(e),r.severity!==void 0&&r.severity!==null?o.push(os.toString(r.severity)):o.push(e),r.message&&s?o.push(r.message.replace("¦","\\¦")):o.push(e),r.startLineNumber!==void 0&&r.startLineNumber!==null?o.push(r.startLineNumber.toString()):o.push(e),r.startColumn!==void 0&&r.startColumn!==null?o.push(r.startColumn.toString()):o.push(e),r.endLineNumber!==void 0&&r.endLineNumber!==null?o.push(r.endLineNumber.toString()):o.push(e),r.endColumn!==void 0&&r.endColumn!==null?o.push(r.endColumn.toString()):o.push(e),o.push(e),o.join("¦")}n.makeKeyOptionalMessage=i})(O8||(O8={}));const dm=On("markerService"),E5e=J("editor.lineHighlightBackground",null,w("lineHighlight","Background color for the highlight of line at the cursor position.")),iye=J("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hcDark:"#f38518",hcLight:Yn},w("lineHighlightBorderBox","Background color for the border around the line at the cursor position."));J("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hcDark:null,hcLight:null},w("rangeHighlight","Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.rangeHighlightBorder",{dark:null,light:null,hcDark:Ar,hcLight:Ar},w("rangeHighlightBorder","Background color of the border around highlighted ranges."));J("editor.symbolHighlightBackground",{dark:g_,light:g_,hcDark:null,hcLight:null},w("symbolHighlight","Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.symbolHighlightBorder",{dark:null,light:null,hcDark:Ar,hcLight:Ar},w("symbolHighlightBorder","Background color of the border around highlighted symbols."));const LW=J("editorCursor.foreground",{dark:"#AEAFAD",light:Te.black,hcDark:Te.white,hcLight:"#0F4A85"},w("caret","Color of the editor cursor.")),Vle=J("editorCursor.background",null,w("editorCursorBackground","The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.")),L5e=J("editorMultiCursor.primary.foreground",LW,w("editorMultiCursorPrimaryForeground","Color of the primary editor cursor when multiple cursors are present.")),Okt=J("editorMultiCursor.primary.background",Vle,w("editorMultiCursorPrimaryBackground","The background color of the primary editor cursor when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.")),T5e=J("editorMultiCursor.secondary.foreground",LW,w("editorMultiCursorSecondaryForeground","Color of secondary editor cursors when multiple cursors are present.")),Mkt=J("editorMultiCursor.secondary.background",Vle,w("editorMultiCursorSecondaryBackground","The background color of secondary editor cursors when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.")),zle=J("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hcDark:"#e3e4e229",hcLight:"#CCCCCC"},w("editorWhitespaces","Color of whitespace characters in the editor.")),Fkt=J("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hcDark:Te.white,hcLight:"#292929"},w("editorLineNumbers","Color of editor line numbers.")),Bkt=J("editorIndentGuide.background",zle,w("editorIndentGuides","Color of the editor indentation guides."),!1,w("deprecatedEditorIndentGuides","'editorIndentGuide.background' is deprecated. Use 'editorIndentGuide.background1' instead.")),$kt=J("editorIndentGuide.activeBackground",zle,w("editorActiveIndentGuide","Color of the active editor indentation guides."),!1,w("deprecatedEditorActiveIndentGuide","'editorIndentGuide.activeBackground' is deprecated. Use 'editorIndentGuide.activeBackground1' instead.")),hO=J("editorIndentGuide.background1",Bkt,w("editorIndentGuides1","Color of the editor indentation guides (1).")),Wkt=J("editorIndentGuide.background2","#00000000",w("editorIndentGuides2","Color of the editor indentation guides (2).")),Hkt=J("editorIndentGuide.background3","#00000000",w("editorIndentGuides3","Color of the editor indentation guides (3).")),Vkt=J("editorIndentGuide.background4","#00000000",w("editorIndentGuides4","Color of the editor indentation guides (4).")),zkt=J("editorIndentGuide.background5","#00000000",w("editorIndentGuides5","Color of the editor indentation guides (5).")),Ukt=J("editorIndentGuide.background6","#00000000",w("editorIndentGuides6","Color of the editor indentation guides (6).")),fO=J("editorIndentGuide.activeBackground1",$kt,w("editorActiveIndentGuide1","Color of the active editor indentation guides (1).")),jkt=J("editorIndentGuide.activeBackground2","#00000000",w("editorActiveIndentGuide2","Color of the active editor indentation guides (2).")),qkt=J("editorIndentGuide.activeBackground3","#00000000",w("editorActiveIndentGuide3","Color of the active editor indentation guides (3).")),Kkt=J("editorIndentGuide.activeBackground4","#00000000",w("editorActiveIndentGuide4","Color of the active editor indentation guides (4).")),Gkt=J("editorIndentGuide.activeBackground5","#00000000",w("editorActiveIndentGuide5","Color of the active editor indentation guides (5).")),Ykt=J("editorIndentGuide.activeBackground6","#00000000",w("editorActiveIndentGuide6","Color of the active editor indentation guides (6).")),Zkt=J("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hcDark:Ar,hcLight:Ar},w("editorActiveLineNumber","Color of editor active line number"),!1,w("deprecatedEditorActiveLineNumber","Id is deprecated. Use 'editorLineNumber.activeForeground' instead."));J("editorLineNumber.activeForeground",Zkt,w("editorActiveLineNumber","Color of editor active line number"));const Xkt=J("editorLineNumber.dimmedForeground",null,w("editorDimmedLineNumber","Color of the final editor line when editor.renderFinalNewline is set to dimmed."));J("editorRuler.foreground",{dark:"#5A5A5A",light:Te.lightgrey,hcDark:Te.white,hcLight:"#292929"},w("editorRuler","Color of the editor rulers."));J("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hcDark:"#999999",hcLight:"#292929"},w("editorCodeLensForeground","Foreground color of editor CodeLens"));J("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hcDark:"#0064001a",hcLight:"#0000"},w("editorBracketMatchBackground","Background color behind matching brackets"));J("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hcDark:Yn,hcLight:Yn},w("editorBracketMatchBorder","Color for matching brackets boxes"));const Qkt=J("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hcDark:"#7f7f7f4d",hcLight:"#666666"},w("editorOverviewRulerBorder","Color of the overview ruler border.")),Jkt=J("editorOverviewRuler.background",null,w("editorOverviewRulerBackground","Background color of the editor overview ruler."));J("editorGutter.background",lf,w("editorGutter","Background color of the editor gutter. The gutter contains the glyph margins and the line numbers."));J("editorUnnecessaryCode.border",{dark:null,light:null,hcDark:Te.fromHex("#fff").transparent(.8),hcLight:Yn},w("unnecessaryCodeBorder","Border color of unnecessary (unused) source code in the editor."));const eEt=J("editorUnnecessaryCode.opacity",{dark:Te.fromHex("#000a"),light:Te.fromHex("#0007"),hcDark:null,hcLight:null},w("unnecessaryCodeOpacity",`Opacity of unnecessary (unused) source code in the editor. For example, "#000000c0" will render the code with 75% opacity. For high contrast themes, use the 'editorUnnecessaryCode.border' theme color to underline unnecessary code instead of fading it out.`));J("editorGhostText.border",{dark:null,light:null,hcDark:Te.fromHex("#fff").transparent(.8),hcLight:Te.fromHex("#292929").transparent(.8)},w("editorGhostTextBorder","Border color of ghost text in the editor."));const tEt=J("editorGhostText.foreground",{dark:Te.fromHex("#ffffff56"),light:Te.fromHex("#0007"),hcDark:null,hcLight:null},w("editorGhostTextForeground","Foreground color of the ghost text in the editor."));J("editorGhostText.background",null,w("editorGhostTextBackground","Background color of the ghost text in the editor."));const nEt=new Te(new Jn(0,122,204,.6)),D5e=J("editorOverviewRuler.rangeHighlightForeground",nEt,w("overviewRulerRangeHighlight","Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations."),!0),iEt=J("editorOverviewRuler.errorForeground",{dark:new Te(new Jn(255,18,18,.7)),light:new Te(new Jn(255,18,18,.7)),hcDark:new Te(new Jn(255,50,50,1)),hcLight:"#B5200D"},w("overviewRuleError","Overview ruler marker color for errors.")),rEt=J("editorOverviewRuler.warningForeground",{dark:X_,light:X_,hcDark:vN,hcLight:vN},w("overviewRuleWarning","Overview ruler marker color for warnings.")),sEt=J("editorOverviewRuler.infoForeground",{dark:Xp,light:Xp,hcDark:bN,hcLight:bN},w("overviewRuleInfo","Overview ruler marker color for infos.")),I5e=J("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hcDark:"#FFD700",hcLight:"#0431FAFF"},w("editorBracketHighlightForeground1","Foreground color of brackets (1). Requires enabling bracket pair colorization.")),A5e=J("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hcDark:"#DA70D6",hcLight:"#319331FF"},w("editorBracketHighlightForeground2","Foreground color of brackets (2). Requires enabling bracket pair colorization.")),N5e=J("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hcDark:"#87CEFA",hcLight:"#7B3814FF"},w("editorBracketHighlightForeground3","Foreground color of brackets (3). Requires enabling bracket pair colorization.")),R5e=J("editorBracketHighlight.foreground4","#00000000",w("editorBracketHighlightForeground4","Foreground color of brackets (4). Requires enabling bracket pair colorization.")),P5e=J("editorBracketHighlight.foreground5","#00000000",w("editorBracketHighlightForeground5","Foreground color of brackets (5). Requires enabling bracket pair colorization.")),O5e=J("editorBracketHighlight.foreground6","#00000000",w("editorBracketHighlightForeground6","Foreground color of brackets (6). Requires enabling bracket pair colorization.")),oEt=J("editorBracketHighlight.unexpectedBracket.foreground",{dark:new Te(new Jn(255,18,18,.8)),light:new Te(new Jn(255,18,18,.8)),hcDark:"new Color(new RGBA(255, 50, 50, 1))",hcLight:"#B5200D"},w("editorBracketHighlightUnexpectedBracketForeground","Foreground color of unexpected brackets.")),aEt=J("editorBracketPairGuide.background1","#00000000",w("editorBracketPairGuide.background1","Background color of inactive bracket pair guides (1). Requires enabling bracket pair guides.")),lEt=J("editorBracketPairGuide.background2","#00000000",w("editorBracketPairGuide.background2","Background color of inactive bracket pair guides (2). Requires enabling bracket pair guides.")),cEt=J("editorBracketPairGuide.background3","#00000000",w("editorBracketPairGuide.background3","Background color of inactive bracket pair guides (3). Requires enabling bracket pair guides.")),uEt=J("editorBracketPairGuide.background4","#00000000",w("editorBracketPairGuide.background4","Background color of inactive bracket pair guides (4). Requires enabling bracket pair guides.")),dEt=J("editorBracketPairGuide.background5","#00000000",w("editorBracketPairGuide.background5","Background color of inactive bracket pair guides (5). Requires enabling bracket pair guides.")),hEt=J("editorBracketPairGuide.background6","#00000000",w("editorBracketPairGuide.background6","Background color of inactive bracket pair guides (6). Requires enabling bracket pair guides.")),fEt=J("editorBracketPairGuide.activeBackground1","#00000000",w("editorBracketPairGuide.activeBackground1","Background color of active bracket pair guides (1). Requires enabling bracket pair guides.")),gEt=J("editorBracketPairGuide.activeBackground2","#00000000",w("editorBracketPairGuide.activeBackground2","Background color of active bracket pair guides (2). Requires enabling bracket pair guides.")),pEt=J("editorBracketPairGuide.activeBackground3","#00000000",w("editorBracketPairGuide.activeBackground3","Background color of active bracket pair guides (3). Requires enabling bracket pair guides.")),mEt=J("editorBracketPairGuide.activeBackground4","#00000000",w("editorBracketPairGuide.activeBackground4","Background color of active bracket pair guides (4). Requires enabling bracket pair guides.")),_Et=J("editorBracketPairGuide.activeBackground5","#00000000",w("editorBracketPairGuide.activeBackground5","Background color of active bracket pair guides (5). Requires enabling bracket pair guides.")),vEt=J("editorBracketPairGuide.activeBackground6","#00000000",w("editorBracketPairGuide.activeBackground6","Background color of active bracket pair guides (6). Requires enabling bracket pair guides."));J("editorUnicodeHighlight.border",X_,w("editorUnicodeHighlight.border","Border color used to highlight unicode characters."));J("editorUnicodeHighlight.background",myt,w("editorUnicodeHighlight.background","Background color used to highlight unicode characters."));dh((n,e)=>{const t=n.getColor(lf),i=n.getColor(E5e),r=i&&!i.isTransparent()?i:t;r&&e.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${r}; }`)});function bEt(n,e){const t=[],i=[];for(const r of n)e.has(r)||t.push(r);for(const r of e)n.has(r)||i.push(r);return{removed:t,added:i}}function yEt(n,e){const t=new Set;for(const i of e)n.has(i)&&t.add(i);return t}var wEt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},rye=function(n,e){return function(t,i){e(t,i,n)}};let OQ=class extends me{constructor(e,t){super(),this._markerService=t,this._onDidChangeMarker=this._register(new fe),this._markerDecorations=new so,e.getModels().forEach(i=>this._onModelAdded(i)),this._register(e.onModelAdded(this._onModelAdded,this)),this._register(e.onModelRemoved(this._onModelRemoved,this)),this._register(this._markerService.onMarkerChanged(this._handleMarkerChange,this))}dispose(){super.dispose(),this._markerDecorations.forEach(e=>e.dispose()),this._markerDecorations.clear()}getMarker(e,t){const i=this._markerDecorations.get(e);return i&&i.getMarker(t)||null}_handleMarkerChange(e){e.forEach(t=>{const i=this._markerDecorations.get(t);i&&this._updateDecorations(i)})}_onModelAdded(e){const t=new CEt(e);this._markerDecorations.set(e.uri,t),this._updateDecorations(t)}_onModelRemoved(e){const t=this._markerDecorations.get(e.uri);t&&(t.dispose(),this._markerDecorations.delete(e.uri)),(e.uri.scheme===sn.inMemory||e.uri.scheme===sn.internal||e.uri.scheme===sn.vscode)&&this._markerService?.read({resource:e.uri}).map(i=>i.owner).forEach(i=>this._markerService.remove(i,[e.uri]))}_updateDecorations(e){const t=this._markerService.read({resource:e.model.uri,take:500});e.update(t)&&this._onDidChangeMarker.fire(e.model)}};OQ=wEt([rye(0,Sr),rye(1,dm)],OQ);class CEt extends me{constructor(e){super(),this.model=e,this._map=new Cbt,this._register(Lt(()=>{this.model.deltaDecorations([...this._map.values()],[]),this._map.clear()}))}update(e){const{added:t,removed:i}=bEt(new Set(this._map.keys()),new Set(e));if(t.length===0&&i.length===0)return!1;const r=i.map(a=>this._map.get(a)),s=t.map(a=>({range:this._createDecorationRange(this.model,a),options:this._createDecorationOption(a)})),o=this.model.deltaDecorations(r,s);for(const a of i)this._map.delete(a);for(let a=0;a=r)return i;const s=e.getWordAtPosition(i.getStartPosition());s&&(i=new $(i.startLineNumber,s.startColumn,i.endLineNumber,s.endColumn))}else if(t.endColumn===Number.MAX_VALUE&&t.startColumn===1&&i.startLineNumber===i.endLineNumber){const r=e.getLineFirstNonWhitespaceColumn(t.startLineNumber);r=0:!1}}const Ule=On("markerDecorationsService");class co{static _nextVisibleColumn(e,t,i){return e===9?co.nextRenderTabStop(t,i):xb(e)||Aae(e)?t+2:t+1}static visibleColumnFromColumn(e,t,i){const r=Math.min(t-1,e.length),s=e.substring(0,r),o=new U6(s);let a=0;for(;!o.eol();){const l=z6(s,r,o.offset);o.nextGraphemeLength(),a=this._nextVisibleColumn(l,a,i)}return a}static columnFromVisibleColumn(e,t,i){if(t<=0)return 1;const r=e.length,s=new U6(e);let o=0,a=1;for(;!s.eol();){const l=z6(e,r,s.offset);s.nextGraphemeLength();const c=this._nextVisibleColumn(l,o,i),u=s.offset+1;if(c>=t){const d=t-o;return c-t=qu&&(t=t-n%qu),t}function TEt(n,e){return n.reduce((t,i)=>as(t,e(i)),Pl)}function M5e(n,e){return n===e}function NN(n,e){const t=n,i=e;if(i-t<=0)return Pl;const s=Math.floor(t/qu),o=Math.floor(i/qu),a=i-o*qu;if(s===o){const l=t-s*qu;return Os(0,a-l)}else return Os(o-s,a)}function pk(n,e){return n=e}function TS(n){return Os(n.lineNumber-1,n.column-1)}function Xy(n,e){const t=n,i=Math.floor(t/qu),r=t-i*qu,s=e,o=Math.floor(s/qu),a=s-o*qu;return new $(i+1,r+1,o+1,a+1)}function DEt(n){const e=om(n);return Os(e.length-1,e[e.length-1].length)}class m_{static fromModelContentChanges(e){return e.map(i=>{const r=$.lift(i.range);return new m_(TS(r.getStartPosition()),TS(r.getEndPosition()),DEt(i.text))}).reverse()}constructor(e,t,i){this.startOffset=e,this.endOffset=t,this.newLength=i}toString(){return`[${Kd(this.startOffset)}...${Kd(this.endOffset)}) -> ${Kd(this.newLength)}`}}class IEt{constructor(e){this.nextEditIdx=0,this.deltaOldToNewLineCount=0,this.deltaOldToNewColumnCount=0,this.deltaLineIdxInOld=-1,this.edits=e.map(t=>qle.from(t))}getOffsetBeforeChange(e){return this.adjustNextEdit(e),this.translateCurToOld(e)}getDistanceToNextChange(e){this.adjustNextEdit(e);const t=this.edits[this.nextEditIdx],i=t?this.translateOldToCur(t.offsetObj):null;return i===null?null:NN(e,i)}translateOldToCur(e){return e.lineCount===this.deltaLineIdxInOld?Os(e.lineCount+this.deltaOldToNewLineCount,e.columnCount+this.deltaOldToNewColumnCount):Os(e.lineCount+this.deltaOldToNewLineCount,e.columnCount)}translateCurToOld(e){const t=Kd(e);return t.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?Os(t.lineCount-this.deltaOldToNewLineCount,t.columnCount-this.deltaOldToNewColumnCount):Os(t.lineCount-this.deltaOldToNewLineCount,t.columnCount)}adjustNextEdit(e){for(;this.nextEditIdx>5;if(r===0){const o=1<this.textBufferLineCount-1||this.lineIdx===this.textBufferLineCount-1&&this.lineCharOffset>=this.textBufferLastLineLength)return null;this.line===null&&(this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.line=this.lineTokens.getLineContent(),this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset));const e=this.lineIdx,t=this.lineCharOffset;let i=0;for(;;){const s=this.lineTokens,o=s.getCount();let a=null;if(this.lineTokenOffset1e3))break;if(i>1500)break}const r=EEt(e,t,this.lineIdx,this.lineCharOffset);return new pv(r,0,-1,bo.getEmpty(),new fy(r))}}class MEt{constructor(e,t){this.text=e,this._offset=Pl,this.idx=0;const i=t.getRegExpStr(),r=i?new RegExp(i+`| + `)}return t}class Rkt{constructor(e,t,i,r){this.contextViewService=e,this.telemetryService=t,this.notificationService=i,this.keybindingService=r,this.focusToReturn=null,this.lastContainer=null,this.block=null,this.blockDisposable=null,this.options={blockMouse:!0}}configure(e){this.options=e}showContextMenu(e){const t=e.getActions();if(!t.length)return;this.focusToReturn=ka();let i;const r=Eo(e.domForShadowRoot)?e.domForShadowRoot:void 0;this.contextViewService.showContextView({getAnchor:()=>e.getAnchor(),canRelayout:!1,anchorAlignment:e.anchorAlignment,anchorAxisAlignment:e.anchorAxisAlignment,render:s=>{this.lastContainer=s;const o=e.getMenuClassName?e.getMenuClassName():"";o&&(s.className+=" "+o),this.options.blockMouse&&(this.block=s.appendChild(qe(".context-view-block")),this.block.style.position="fixed",this.block.style.cursor="initial",this.block.style.left="0",this.block.style.top="0",this.block.style.width="100%",this.block.style.height="100%",this.block.style.zIndex="-1",this.blockDisposable?.dispose(),this.blockDisposable=Ce(this.block,je.MOUSE_DOWN,u=>u.stopPropagation()));const a=new ke,l=e.actionRunner||new Aw;l.onWillRun(u=>this.onActionRun(u,!e.skipTelemetry),this,a),l.onDidRun(this.onDidActionRun,this,a),i=new SFe(s,t,{actionViewItemProvider:e.getActionViewItem,context:e.getActionsContext?e.getActionsContext():null,actionRunner:l,getKeyBinding:e.getKeyBinding?e.getKeyBinding:u=>this.keybindingService.lookupKeybinding(u.id)},Dkt),i.onDidCancel(()=>this.contextViewService.hideContextView(!0),null,a),i.onDidBlur(()=>this.contextViewService.hideContextView(!0),null,a);const c=Ot(s);return a.add(Ce(c,je.BLUR,()=>this.contextViewService.hideContextView(!0))),a.add(Ce(c,je.MOUSE_DOWN,u=>{if(u.defaultPrevented)return;const d=new qh(c,u);let h=d.target;if(!d.rightButton){for(;h;){if(h===s)return;h=h.parentElement}this.contextViewService.hideContextView(!0)}})),Qh(a,i)},focus:()=>{i?.focus(!!e.autoSelectFirstItem)},onHide:s=>{e.onHide?.(!!s),this.block&&(this.block.remove(),this.block=null),this.blockDisposable?.dispose(),this.blockDisposable=null,this.lastContainer&&(ka()===this.lastContainer||xo(ka(),this.lastContainer))&&this.focusToReturn?.focus(),this.lastContainer=null}},r,!!r)}onActionRun(e,t){t&&this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.action.id,from:"contextMenu"}),this.contextViewService.hideContextView(!1)}onDidActionRun(e){e.error&&!uh(e.error)&&this.notificationService.error(e.error)}}var Pkt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gx=function(n,e){return function(t,i){e(t,i,n)}};let IQ=class extends me{get contextMenuHandler(){return this._contextMenuHandler||(this._contextMenuHandler=new Rkt(this.contextViewService,this.telemetryService,this.notificationService,this.keybindingService)),this._contextMenuHandler}constructor(e,t,i,r,s,o){super(),this.telemetryService=e,this.notificationService=t,this.contextViewService=i,this.keybindingService=r,this.menuService=s,this.contextKeyService=o,this._contextMenuHandler=void 0,this._onDidShowContextMenu=this._store.add(new fe),this.onDidShowContextMenu=this._onDidShowContextMenu.event,this._onDidHideContextMenu=this._store.add(new fe)}configure(e){this.contextMenuHandler.configure(e)}showContextMenu(e){e=AQ.transform(e,this.menuService,this.contextKeyService),this.contextMenuHandler.showContextMenu({...e,onHide:t=>{e.onHide?.(t),this._onDidHideContextMenu.fire()}}),f_.getInstance().resetKeyStatus(),this._onDidShowContextMenu.fire()}};IQ=Pkt([gx(0,Qa),gx(1,Ts),gx(2,m0),gx(3,xi),gx(4,ld),gx(5,jt)],IQ);var AQ;(function(n){function e(i){return i&&i.menuId instanceof ce}function t(i,r,s){if(!e(i))return i;const{menuId:o,menuActionOptions:a,contextKeyService:l}=i;return{...i,getActions:()=>{const c=[];if(o){const u=r.getMenuActions(o,l??s,a);Ikt(u,c)}return i.getActions?na.join(i.getActions(),c):c}}}n.transform=t})(AQ||(AQ={}));var R8;(function(n){n[n.API=0]="API",n[n.USER=1]="USER"})(R8||(R8={}));var Hle=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},P8=function(n,e){return function(t,i){e(t,i,n)}};let NQ=class{constructor(e){this._commandService=e}async open(e,t){if(!O$(e,sn.command))return!1;if(!t?.allowCommands||(typeof e=="string"&&(e=Pt.parse(e)),Array.isArray(t.allowCommands)&&!t.allowCommands.includes(e.path)))return!0;let i=[];try{i=iQ(decodeURIComponent(e.query))}catch{try{i=iQ(e.query)}catch{}}return Array.isArray(i)||(i=[i]),await this._commandService.executeCommand(e.path,...i),!0}};NQ=Hle([P8(0,_r)],NQ);let RQ=class{constructor(e){this._editorService=e}async open(e,t){typeof e=="string"&&(e=Pt.parse(e));const{selection:i,uri:r}=aCt(e);return e=r,e.scheme===sn.file&&(e=zCt(e)),await this._editorService.openCodeEditor({resource:e,options:{selection:i,source:t?.fromUserGesture?R8.USER:R8.API,...t?.editorOptions}},this._editorService.getFocusedCodeEditor(),t?.openToSide),!0}};RQ=Hle([P8(0,ai)],RQ);let PQ=class{constructor(e,t){this._openers=new Rl,this._validators=new Rl,this._resolvers=new Rl,this._resolvedUriTargets=new so(i=>i.with({path:null,fragment:null,query:null}).toString()),this._externalOpeners=new Rl,this._defaultExternalOpener={openExternal:async i=>(mX(i,sn.http,sn.https)?v3e(i):Xi.location.href=i,!0)},this._openers.push({open:async(i,r)=>r?.openExternal||mX(i,sn.mailto,sn.http,sn.https,sn.vsls)?(await this._doOpenExternal(i,r),!0):!1}),this._openers.push(new NQ(t)),this._openers.push(new RQ(e))}registerOpener(e){return{dispose:this._openers.unshift(e)}}async open(e,t){const i=typeof e=="string"?Pt.parse(e):e,r=this._resolvedUriTargets.get(i)??e;for(const s of this._validators)if(!await s.shouldOpen(r,t))return!1;for(const s of this._openers)if(await s.open(e,t))return!0;return!1}async resolveExternalUri(e,t){for(const i of this._resolvers)try{const r=await i.resolveExternalUri(e,t);if(r)return this._resolvedUriTargets.has(r.resolved)||this._resolvedUriTargets.set(r.resolved,e),r}catch{}throw new Error("Could not resolve external URI: "+e.toString())}async _doOpenExternal(e,t){const i=typeof e=="string"?Pt.parse(e):e;let r;try{r=(await this.resolveExternalUri(i,t)).resolved}catch{r=i}let s;if(typeof e=="string"&&i.toString()===r.toString()?s=e:s=encodeURI(r.toString(!0)),t?.allowContributedOpeners){const o=typeof t?.allowContributedOpeners=="string"?t?.allowContributedOpeners:void 0;for(const a of this._externalOpeners)if(await a.openExternal(s,{sourceUri:i,preferredOpenerId:o},yn.None))return!0}return this._defaultExternalOpener.openExternal(s,{sourceUri:i},yn.None)}dispose(){this._validators.clear()}};PQ=Hle([P8(0,ai),P8(1,_r)],PQ);const Oc=On("editorWorkerService");var os;(function(n){n[n.Hint=1]="Hint",n[n.Info=2]="Info",n[n.Warning=4]="Warning",n[n.Error=8]="Error"})(os||(os={}));(function(n){function e(o,a){return a-o}n.compare=e;const t=Object.create(null);t[n.Error]=w("sev.error","Error"),t[n.Warning]=w("sev.warning","Warning"),t[n.Info]=w("sev.info","Info");function i(o){return t[o]||""}n.toString=i;function r(o){switch(o){case Ss.Error:return n.Error;case Ss.Warning:return n.Warning;case Ss.Info:return n.Info;case Ss.Ignore:return n.Hint}}n.fromSeverity=r;function s(o){switch(o){case n.Error:return Ss.Error;case n.Warning:return Ss.Warning;case n.Info:return Ss.Info;case n.Hint:return Ss.Ignore}}n.toSeverity=s})(os||(os={}));var O8;(function(n){const e="";function t(r){return i(r,!0)}n.makeKey=t;function i(r,s){const o=[e];return r.source?o.push(r.source.replace("¦","\\¦")):o.push(e),r.code?typeof r.code=="string"?o.push(r.code.replace("¦","\\¦")):o.push(r.code.value.replace("¦","\\¦")):o.push(e),r.severity!==void 0&&r.severity!==null?o.push(os.toString(r.severity)):o.push(e),r.message&&s?o.push(r.message.replace("¦","\\¦")):o.push(e),r.startLineNumber!==void 0&&r.startLineNumber!==null?o.push(r.startLineNumber.toString()):o.push(e),r.startColumn!==void 0&&r.startColumn!==null?o.push(r.startColumn.toString()):o.push(e),r.endLineNumber!==void 0&&r.endLineNumber!==null?o.push(r.endLineNumber.toString()):o.push(e),r.endColumn!==void 0&&r.endColumn!==null?o.push(r.endColumn.toString()):o.push(e),o.push(e),o.join("¦")}n.makeKeyOptionalMessage=i})(O8||(O8={}));const dm=On("markerService"),EFe=J("editor.lineHighlightBackground",null,w("lineHighlight","Background color for the highlight of line at the cursor position.")),iye=J("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hcDark:"#f38518",hcLight:Yn},w("lineHighlightBorderBox","Background color for the border around the line at the cursor position."));J("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hcDark:null,hcLight:null},w("rangeHighlight","Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.rangeHighlightBorder",{dark:null,light:null,hcDark:Ar,hcLight:Ar},w("rangeHighlightBorder","Background color of the border around highlighted ranges."));J("editor.symbolHighlightBackground",{dark:g_,light:g_,hcDark:null,hcLight:null},w("symbolHighlight","Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.symbolHighlightBorder",{dark:null,light:null,hcDark:Ar,hcLight:Ar},w("symbolHighlightBorder","Background color of the border around highlighted symbols."));const LW=J("editorCursor.foreground",{dark:"#AEAFAD",light:Te.black,hcDark:Te.white,hcLight:"#0F4A85"},w("caret","Color of the editor cursor.")),Vle=J("editorCursor.background",null,w("editorCursorBackground","The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.")),LFe=J("editorMultiCursor.primary.foreground",LW,w("editorMultiCursorPrimaryForeground","Color of the primary editor cursor when multiple cursors are present.")),Okt=J("editorMultiCursor.primary.background",Vle,w("editorMultiCursorPrimaryBackground","The background color of the primary editor cursor when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.")),TFe=J("editorMultiCursor.secondary.foreground",LW,w("editorMultiCursorSecondaryForeground","Color of secondary editor cursors when multiple cursors are present.")),Mkt=J("editorMultiCursor.secondary.background",Vle,w("editorMultiCursorSecondaryBackground","The background color of secondary editor cursors when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.")),zle=J("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hcDark:"#e3e4e229",hcLight:"#CCCCCC"},w("editorWhitespaces","Color of whitespace characters in the editor.")),Fkt=J("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hcDark:Te.white,hcLight:"#292929"},w("editorLineNumbers","Color of editor line numbers.")),Bkt=J("editorIndentGuide.background",zle,w("editorIndentGuides","Color of the editor indentation guides."),!1,w("deprecatedEditorIndentGuides","'editorIndentGuide.background' is deprecated. Use 'editorIndentGuide.background1' instead.")),$kt=J("editorIndentGuide.activeBackground",zle,w("editorActiveIndentGuide","Color of the active editor indentation guides."),!1,w("deprecatedEditorActiveIndentGuide","'editorIndentGuide.activeBackground' is deprecated. Use 'editorIndentGuide.activeBackground1' instead.")),hO=J("editorIndentGuide.background1",Bkt,w("editorIndentGuides1","Color of the editor indentation guides (1).")),Wkt=J("editorIndentGuide.background2","#00000000",w("editorIndentGuides2","Color of the editor indentation guides (2).")),Hkt=J("editorIndentGuide.background3","#00000000",w("editorIndentGuides3","Color of the editor indentation guides (3).")),Vkt=J("editorIndentGuide.background4","#00000000",w("editorIndentGuides4","Color of the editor indentation guides (4).")),zkt=J("editorIndentGuide.background5","#00000000",w("editorIndentGuides5","Color of the editor indentation guides (5).")),Ukt=J("editorIndentGuide.background6","#00000000",w("editorIndentGuides6","Color of the editor indentation guides (6).")),fO=J("editorIndentGuide.activeBackground1",$kt,w("editorActiveIndentGuide1","Color of the active editor indentation guides (1).")),jkt=J("editorIndentGuide.activeBackground2","#00000000",w("editorActiveIndentGuide2","Color of the active editor indentation guides (2).")),qkt=J("editorIndentGuide.activeBackground3","#00000000",w("editorActiveIndentGuide3","Color of the active editor indentation guides (3).")),Kkt=J("editorIndentGuide.activeBackground4","#00000000",w("editorActiveIndentGuide4","Color of the active editor indentation guides (4).")),Gkt=J("editorIndentGuide.activeBackground5","#00000000",w("editorActiveIndentGuide5","Color of the active editor indentation guides (5).")),Ykt=J("editorIndentGuide.activeBackground6","#00000000",w("editorActiveIndentGuide6","Color of the active editor indentation guides (6).")),Zkt=J("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hcDark:Ar,hcLight:Ar},w("editorActiveLineNumber","Color of editor active line number"),!1,w("deprecatedEditorActiveLineNumber","Id is deprecated. Use 'editorLineNumber.activeForeground' instead."));J("editorLineNumber.activeForeground",Zkt,w("editorActiveLineNumber","Color of editor active line number"));const Xkt=J("editorLineNumber.dimmedForeground",null,w("editorDimmedLineNumber","Color of the final editor line when editor.renderFinalNewline is set to dimmed."));J("editorRuler.foreground",{dark:"#5A5A5A",light:Te.lightgrey,hcDark:Te.white,hcLight:"#292929"},w("editorRuler","Color of the editor rulers."));J("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hcDark:"#999999",hcLight:"#292929"},w("editorCodeLensForeground","Foreground color of editor CodeLens"));J("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hcDark:"#0064001a",hcLight:"#0000"},w("editorBracketMatchBackground","Background color behind matching brackets"));J("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hcDark:Yn,hcLight:Yn},w("editorBracketMatchBorder","Color for matching brackets boxes"));const Qkt=J("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hcDark:"#7f7f7f4d",hcLight:"#666666"},w("editorOverviewRulerBorder","Color of the overview ruler border.")),Jkt=J("editorOverviewRuler.background",null,w("editorOverviewRulerBackground","Background color of the editor overview ruler."));J("editorGutter.background",lf,w("editorGutter","Background color of the editor gutter. The gutter contains the glyph margins and the line numbers."));J("editorUnnecessaryCode.border",{dark:null,light:null,hcDark:Te.fromHex("#fff").transparent(.8),hcLight:Yn},w("unnecessaryCodeBorder","Border color of unnecessary (unused) source code in the editor."));const eEt=J("editorUnnecessaryCode.opacity",{dark:Te.fromHex("#000a"),light:Te.fromHex("#0007"),hcDark:null,hcLight:null},w("unnecessaryCodeOpacity",`Opacity of unnecessary (unused) source code in the editor. For example, "#000000c0" will render the code with 75% opacity. For high contrast themes, use the 'editorUnnecessaryCode.border' theme color to underline unnecessary code instead of fading it out.`));J("editorGhostText.border",{dark:null,light:null,hcDark:Te.fromHex("#fff").transparent(.8),hcLight:Te.fromHex("#292929").transparent(.8)},w("editorGhostTextBorder","Border color of ghost text in the editor."));const tEt=J("editorGhostText.foreground",{dark:Te.fromHex("#ffffff56"),light:Te.fromHex("#0007"),hcDark:null,hcLight:null},w("editorGhostTextForeground","Foreground color of the ghost text in the editor."));J("editorGhostText.background",null,w("editorGhostTextBackground","Background color of the ghost text in the editor."));const nEt=new Te(new Jn(0,122,204,.6)),DFe=J("editorOverviewRuler.rangeHighlightForeground",nEt,w("overviewRulerRangeHighlight","Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations."),!0),iEt=J("editorOverviewRuler.errorForeground",{dark:new Te(new Jn(255,18,18,.7)),light:new Te(new Jn(255,18,18,.7)),hcDark:new Te(new Jn(255,50,50,1)),hcLight:"#B5200D"},w("overviewRuleError","Overview ruler marker color for errors.")),rEt=J("editorOverviewRuler.warningForeground",{dark:X_,light:X_,hcDark:vN,hcLight:vN},w("overviewRuleWarning","Overview ruler marker color for warnings.")),sEt=J("editorOverviewRuler.infoForeground",{dark:Xp,light:Xp,hcDark:bN,hcLight:bN},w("overviewRuleInfo","Overview ruler marker color for infos.")),IFe=J("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hcDark:"#FFD700",hcLight:"#0431FAFF"},w("editorBracketHighlightForeground1","Foreground color of brackets (1). Requires enabling bracket pair colorization.")),AFe=J("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hcDark:"#DA70D6",hcLight:"#319331FF"},w("editorBracketHighlightForeground2","Foreground color of brackets (2). Requires enabling bracket pair colorization.")),NFe=J("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hcDark:"#87CEFA",hcLight:"#7B3814FF"},w("editorBracketHighlightForeground3","Foreground color of brackets (3). Requires enabling bracket pair colorization.")),RFe=J("editorBracketHighlight.foreground4","#00000000",w("editorBracketHighlightForeground4","Foreground color of brackets (4). Requires enabling bracket pair colorization.")),PFe=J("editorBracketHighlight.foreground5","#00000000",w("editorBracketHighlightForeground5","Foreground color of brackets (5). Requires enabling bracket pair colorization.")),OFe=J("editorBracketHighlight.foreground6","#00000000",w("editorBracketHighlightForeground6","Foreground color of brackets (6). Requires enabling bracket pair colorization.")),oEt=J("editorBracketHighlight.unexpectedBracket.foreground",{dark:new Te(new Jn(255,18,18,.8)),light:new Te(new Jn(255,18,18,.8)),hcDark:"new Color(new RGBA(255, 50, 50, 1))",hcLight:"#B5200D"},w("editorBracketHighlightUnexpectedBracketForeground","Foreground color of unexpected brackets.")),aEt=J("editorBracketPairGuide.background1","#00000000",w("editorBracketPairGuide.background1","Background color of inactive bracket pair guides (1). Requires enabling bracket pair guides.")),lEt=J("editorBracketPairGuide.background2","#00000000",w("editorBracketPairGuide.background2","Background color of inactive bracket pair guides (2). Requires enabling bracket pair guides.")),cEt=J("editorBracketPairGuide.background3","#00000000",w("editorBracketPairGuide.background3","Background color of inactive bracket pair guides (3). Requires enabling bracket pair guides.")),uEt=J("editorBracketPairGuide.background4","#00000000",w("editorBracketPairGuide.background4","Background color of inactive bracket pair guides (4). Requires enabling bracket pair guides.")),dEt=J("editorBracketPairGuide.background5","#00000000",w("editorBracketPairGuide.background5","Background color of inactive bracket pair guides (5). Requires enabling bracket pair guides.")),hEt=J("editorBracketPairGuide.background6","#00000000",w("editorBracketPairGuide.background6","Background color of inactive bracket pair guides (6). Requires enabling bracket pair guides.")),fEt=J("editorBracketPairGuide.activeBackground1","#00000000",w("editorBracketPairGuide.activeBackground1","Background color of active bracket pair guides (1). Requires enabling bracket pair guides.")),gEt=J("editorBracketPairGuide.activeBackground2","#00000000",w("editorBracketPairGuide.activeBackground2","Background color of active bracket pair guides (2). Requires enabling bracket pair guides.")),pEt=J("editorBracketPairGuide.activeBackground3","#00000000",w("editorBracketPairGuide.activeBackground3","Background color of active bracket pair guides (3). Requires enabling bracket pair guides.")),mEt=J("editorBracketPairGuide.activeBackground4","#00000000",w("editorBracketPairGuide.activeBackground4","Background color of active bracket pair guides (4). Requires enabling bracket pair guides.")),_Et=J("editorBracketPairGuide.activeBackground5","#00000000",w("editorBracketPairGuide.activeBackground5","Background color of active bracket pair guides (5). Requires enabling bracket pair guides.")),vEt=J("editorBracketPairGuide.activeBackground6","#00000000",w("editorBracketPairGuide.activeBackground6","Background color of active bracket pair guides (6). Requires enabling bracket pair guides."));J("editorUnicodeHighlight.border",X_,w("editorUnicodeHighlight.border","Border color used to highlight unicode characters."));J("editorUnicodeHighlight.background",myt,w("editorUnicodeHighlight.background","Background color used to highlight unicode characters."));dh((n,e)=>{const t=n.getColor(lf),i=n.getColor(EFe),r=i&&!i.isTransparent()?i:t;r&&e.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${r}; }`)});function bEt(n,e){const t=[],i=[];for(const r of n)e.has(r)||t.push(r);for(const r of e)n.has(r)||i.push(r);return{removed:t,added:i}}function yEt(n,e){const t=new Set;for(const i of e)n.has(i)&&t.add(i);return t}var wEt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},rye=function(n,e){return function(t,i){e(t,i,n)}};let OQ=class extends me{constructor(e,t){super(),this._markerService=t,this._onDidChangeMarker=this._register(new fe),this._markerDecorations=new so,e.getModels().forEach(i=>this._onModelAdded(i)),this._register(e.onModelAdded(this._onModelAdded,this)),this._register(e.onModelRemoved(this._onModelRemoved,this)),this._register(this._markerService.onMarkerChanged(this._handleMarkerChange,this))}dispose(){super.dispose(),this._markerDecorations.forEach(e=>e.dispose()),this._markerDecorations.clear()}getMarker(e,t){const i=this._markerDecorations.get(e);return i&&i.getMarker(t)||null}_handleMarkerChange(e){e.forEach(t=>{const i=this._markerDecorations.get(t);i&&this._updateDecorations(i)})}_onModelAdded(e){const t=new CEt(e);this._markerDecorations.set(e.uri,t),this._updateDecorations(t)}_onModelRemoved(e){const t=this._markerDecorations.get(e.uri);t&&(t.dispose(),this._markerDecorations.delete(e.uri)),(e.uri.scheme===sn.inMemory||e.uri.scheme===sn.internal||e.uri.scheme===sn.vscode)&&this._markerService?.read({resource:e.uri}).map(i=>i.owner).forEach(i=>this._markerService.remove(i,[e.uri]))}_updateDecorations(e){const t=this._markerService.read({resource:e.model.uri,take:500});e.update(t)&&this._onDidChangeMarker.fire(e.model)}};OQ=wEt([rye(0,Sr),rye(1,dm)],OQ);class CEt extends me{constructor(e){super(),this.model=e,this._map=new Cbt,this._register(Lt(()=>{this.model.deltaDecorations([...this._map.values()],[]),this._map.clear()}))}update(e){const{added:t,removed:i}=bEt(new Set(this._map.keys()),new Set(e));if(t.length===0&&i.length===0)return!1;const r=i.map(a=>this._map.get(a)),s=t.map(a=>({range:this._createDecorationRange(this.model,a),options:this._createDecorationOption(a)})),o=this.model.deltaDecorations(r,s);for(const a of i)this._map.delete(a);for(let a=0;a=r)return i;const s=e.getWordAtPosition(i.getStartPosition());s&&(i=new $(i.startLineNumber,s.startColumn,i.endLineNumber,s.endColumn))}else if(t.endColumn===Number.MAX_VALUE&&t.startColumn===1&&i.startLineNumber===i.endLineNumber){const r=e.getLineFirstNonWhitespaceColumn(t.startLineNumber);r=0:!1}}const Ule=On("markerDecorationsService");class co{static _nextVisibleColumn(e,t,i){return e===9?co.nextRenderTabStop(t,i):xb(e)||Aae(e)?t+2:t+1}static visibleColumnFromColumn(e,t,i){const r=Math.min(t-1,e.length),s=e.substring(0,r),o=new U6(s);let a=0;for(;!o.eol();){const l=z6(s,r,o.offset);o.nextGraphemeLength(),a=this._nextVisibleColumn(l,a,i)}return a}static columnFromVisibleColumn(e,t,i){if(t<=0)return 1;const r=e.length,s=new U6(e);let o=0,a=1;for(;!s.eol();){const l=z6(e,r,s.offset);s.nextGraphemeLength();const c=this._nextVisibleColumn(l,o,i),u=s.offset+1;if(c>=t){const d=t-o;return c-t=qu&&(t=t-n%qu),t}function TEt(n,e){return n.reduce((t,i)=>as(t,e(i)),Pl)}function MFe(n,e){return n===e}function NN(n,e){const t=n,i=e;if(i-t<=0)return Pl;const s=Math.floor(t/qu),o=Math.floor(i/qu),a=i-o*qu;if(s===o){const l=t-s*qu;return Os(0,a-l)}else return Os(o-s,a)}function pk(n,e){return n=e}function TS(n){return Os(n.lineNumber-1,n.column-1)}function Xy(n,e){const t=n,i=Math.floor(t/qu),r=t-i*qu,s=e,o=Math.floor(s/qu),a=s-o*qu;return new $(i+1,r+1,o+1,a+1)}function DEt(n){const e=om(n);return Os(e.length-1,e[e.length-1].length)}class m_{static fromModelContentChanges(e){return e.map(i=>{const r=$.lift(i.range);return new m_(TS(r.getStartPosition()),TS(r.getEndPosition()),DEt(i.text))}).reverse()}constructor(e,t,i){this.startOffset=e,this.endOffset=t,this.newLength=i}toString(){return`[${Kd(this.startOffset)}...${Kd(this.endOffset)}) -> ${Kd(this.newLength)}`}}class IEt{constructor(e){this.nextEditIdx=0,this.deltaOldToNewLineCount=0,this.deltaOldToNewColumnCount=0,this.deltaLineIdxInOld=-1,this.edits=e.map(t=>qle.from(t))}getOffsetBeforeChange(e){return this.adjustNextEdit(e),this.translateCurToOld(e)}getDistanceToNextChange(e){this.adjustNextEdit(e);const t=this.edits[this.nextEditIdx],i=t?this.translateOldToCur(t.offsetObj):null;return i===null?null:NN(e,i)}translateOldToCur(e){return e.lineCount===this.deltaLineIdxInOld?Os(e.lineCount+this.deltaOldToNewLineCount,e.columnCount+this.deltaOldToNewColumnCount):Os(e.lineCount+this.deltaOldToNewLineCount,e.columnCount)}translateCurToOld(e){const t=Kd(e);return t.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?Os(t.lineCount-this.deltaOldToNewLineCount,t.columnCount-this.deltaOldToNewColumnCount):Os(t.lineCount-this.deltaOldToNewLineCount,t.columnCount)}adjustNextEdit(e){for(;this.nextEditIdx>5;if(r===0){const o=1<this.textBufferLineCount-1||this.lineIdx===this.textBufferLineCount-1&&this.lineCharOffset>=this.textBufferLastLineLength)return null;this.line===null&&(this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.line=this.lineTokens.getLineContent(),this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset));const e=this.lineIdx,t=this.lineCharOffset;let i=0;for(;;){const s=this.lineTokens,o=s.getCount();let a=null;if(this.lineTokenOffset1e3))break;if(i>1500)break}const r=EEt(e,t,this.lineIdx,this.lineCharOffset);return new pv(r,0,-1,bo.getEmpty(),new fy(r))}}class MEt{constructor(e,t){this.text=e,this._offset=Pl,this.idx=0;const i=t.getRegExpStr(),r=i?new RegExp(i+`| `,"gi"):null,s=[];let o,a=0,l=0,c=0,u=0;const d=[];for(let g=0;g<60;g++)d.push(new pv(Os(0,g),0,-1,bo.getEmpty(),new fy(Os(0,g))));const h=[];for(let g=0;g<60;g++)h.push(new pv(Os(1,g),0,-1,bo.getEmpty(),new fy(Os(1,g))));if(r)for(r.lastIndex=0;(o=r.exec(e))!==null;){const g=o.index,p=o[0];if(p===` -`)a++,l=g+1;else{if(c!==g){let m;if(u===a){const _=g-c;if(_FEt(t)).join("|")}}get regExpGlobal(){if(!this.hasRegExp){const e=this.getRegExpStr();this._regExpGlobal=e?new RegExp(e,"gi"):null,this.hasRegExp=!0}return this._regExpGlobal}getToken(e){return this.map.get(e.toLowerCase())}findClosingTokenText(e){for(const[t,i]of this.map)if(i.kind===2&&i.bracketIds.intersects(e))return t}get isEmpty(){return this.map.size===0}}function FEt(n){let e=nd(n);return/^[\w ]+/.test(n)&&(e=`\\b${e}`),/[\w ]+$/.test(n)&&(e=`${e}\\b`),e}class $5e{constructor(e,t){this.denseKeyProvider=e,this.getLanguageConfiguration=t,this.languageIdToBracketTokens=new Map}didLanguageChange(e){return this.languageIdToBracketTokens.has(e)}getSingleLanguageBracketTokens(e){let t=this.languageIdToBracketTokens.get(e);return t||(t=Yle.createFromLanguage(this.getLanguageConfiguration(e),this.denseKeyProvider),this.languageIdToBracketTokens.set(e,t)),t}}function BEt(n){if(n.length===0)return null;if(n.length===1)return n[0];let e=0;function t(){if(e>=n.length)return null;const o=e,a=n[o].listHeight;for(e++;e=2?W5e(o===0&&e===n.length?n:n.slice(o,e),!1):n[o]}let i=t(),r=t();if(!r)return i;for(let o=t();o;o=t())aye(i,r)<=aye(r,o)?(i=rq(i,r),r=o):r=rq(r,o);return rq(i,r)}function W5e(n,e=!1){if(n.length===0)return null;if(n.length===1)return n[0];let t=n.length;for(;t>3;){const i=t>>1;for(let r=0;r=3?n[2]:null,e)}function aye(n,e){return Math.abs(n.listHeight-e.listHeight)}function rq(n,e){return n.listHeight===e.listHeight?Jp.create23(n,e,null,!1):n.listHeight>e.listHeight?$Et(n,e):WEt(e,n)}function $Et(n,e){n=n.toMutable();let t=n;const i=[];let r;for(;;){if(e.listHeight===t.listHeight){r=e;break}if(t.kind!==4)throw new Error("unexpected");i.push(t),t=t.makeLastElementMutable()}for(let s=i.length-1;s>=0;s--){const o=i[s];r?o.childrenLength>=3?r=Jp.create23(o.unappendChild(),r,null,!1):(o.appendChildOfSameHeight(r),r=void 0):o.handleChildrenChanged()}return r?Jp.create23(n,r,null,!1):n}function WEt(n,e){n=n.toMutable();let t=n;const i=[];for(;e.listHeight!==t.listHeight;){if(t.kind!==4)throw new Error("unexpected");i.push(t),t=t.makeFirstElementMutable()}let r=e;for(let s=i.length-1;s>=0;s--){const o=i[s];r?o.childrenLength>=3?r=Jp.create23(r,o.unprependChild(),null,!1):(o.prependChildOfSameHeight(r),r=void 0):o.handleChildrenChanged()}return r?Jp.create23(r,n,null,!1):n}class HEt{constructor(e){this.lastOffset=Pl,this.nextNodes=[e],this.offsets=[Pl],this.idxs=[]}readLongestNodeAt(e,t){if(pk(e,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=e;;){const i=RT(this.nextNodes);if(!i)return;const r=RT(this.offsets);if(pk(e,r))return;if(pk(r,e))if(as(r,i.length)<=e)this.nextNodeAfterCurrent();else{const s=sq(i);s!==-1?(this.nextNodes.push(i.getChild(s)),this.offsets.push(r),this.idxs.push(s)):this.nextNodeAfterCurrent()}else{if(t(i))return this.nextNodeAfterCurrent(),i;{const s=sq(i);if(s===-1){this.nextNodeAfterCurrent();return}else this.nextNodes.push(i.getChild(s)),this.offsets.push(r),this.idxs.push(s)}}}}nextNodeAfterCurrent(){for(;;){const e=RT(this.offsets),t=RT(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),this.idxs.length===0)break;const i=RT(this.nextNodes),r=sq(i,this.idxs[this.idxs.length-1]);if(r!==-1){this.nextNodes.push(i.getChild(r)),this.offsets.push(as(e,t.length)),this.idxs[this.idxs.length-1]=r;break}else this.idxs.pop()}}}function sq(n,e=-1){for(;;){if(e++,e>=n.childrenLength)return-1;if(n.getChild(e))return e}}function RT(n){return n.length>0?n[n.length-1]:void 0}function MQ(n,e,t,i){return new VEt(n,e,t,i).parseDocument()}class VEt{constructor(e,t,i,r){if(this.tokenizer=e,this.createImmutableLists=r,this._itemsConstructed=0,this._itemsFromCache=0,i&&r)throw new Error("Not supported");this.oldNodeReader=i?new HEt(i):void 0,this.positionMapper=new IEt(t)}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let e=this.parseList(bo.getEmpty(),0);return e||(e=Jp.getEmpty()),e}parseList(e,t){const i=[];for(;;){let s=this.tryReadChildFromCache(e);if(!s){const o=this.tokenizer.peek();if(!o||o.kind===2&&o.bracketIds.intersects(e))break;s=this.parseChild(e,t+1)}s.kind===4&&s.childrenLength===0||i.push(s)}return this.oldNodeReader?BEt(i):W5e(i,this.createImmutableLists)}tryReadChildFromCache(e){if(this.oldNodeReader){const t=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(t===null||!M8(t)){const i=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),r=>t!==null&&!pk(r.length,t)?!1:r.canBeReused(e));if(i)return this._itemsFromCache++,this.tokenizer.skip(i.length),i}}}parseChild(e,t){this._itemsConstructed++;const i=this.tokenizer.read();switch(i.kind){case 2:return new PEt(i.bracketIds,i.length);case 0:return i.astNode;case 1:{if(t>300)return new fy(i.length);const r=e.merge(i.bracketIds),s=this.parseList(r,t+1),o=this.tokenizer.peek();return o&&o.kind===2&&(o.bracketId===i.bracketId||o.bracketIds.intersects(i.bracketIds))?(this.tokenizer.read(),RN.create(i.astNode,s,o.astNode)):RN.create(i.astNode,s,null)}default:throw new Error("unexpected")}}}function $8(n,e){if(n.length===0)return e;if(e.length===0)return n;const t=new q_(lye(n)),i=lye(e);i.push({modified:!1,lengthBefore:void 0,lengthAfter:void 0});let r=t.dequeue();function s(c){if(c===void 0){const d=t.takeWhile(h=>!0)||[];return r&&d.unshift(r),d}const u=[];for(;r&&!M8(c);){const[d,h]=r.splitAt(c);u.push(d),c=NN(d.lengthAfter,c),r=h??t.dequeue()}return M8(c)||u.push(new Ov(!1,c,c)),u}const o=[];function a(c,u,d){if(o.length>0&&M5e(o[o.length-1].endOffset,c)){const h=o[o.length-1];o[o.length-1]=new m_(h.startOffset,u,as(h.newLength,d))}else o.push({startOffset:c,endOffset:u,newLength:d})}let l=Pl;for(const c of i){const u=s(c.lengthBefore);if(c.modified){const d=TEt(u,f=>f.lengthBefore),h=as(l,d);a(l,h,c.lengthAfter),l=h}else for(const d of u){const h=l;l=as(l,d.lengthBefore),d.modified&&a(h,l,d.lengthAfter)}}return o}class Ov{constructor(e,t,i){this.modified=e,this.lengthBefore=t,this.lengthAfter=i}splitAt(e){const t=NN(e,this.lengthAfter);return M5e(t,Pl)?[this,void 0]:this.modified?[new Ov(this.modified,this.lengthBefore,e),new Ov(this.modified,Pl,t)]:[new Ov(this.modified,e,e),new Ov(this.modified,t,t)]}toString(){return`${this.modified?"M":"U"}:${Kd(this.lengthBefore)} -> ${Kd(this.lengthAfter)}`}}function lye(n){const e=[];let t=Pl;for(const i of n){const r=NN(t,i.startOffset);M8(r)||e.push(new Ov(!1,r,r));const s=NN(i.startOffset,i.endOffset);e.push(new Ov(!0,s,i.newLength)),t=i.endOffset}return e}class zEt extends me{didLanguageChange(e){return this.brackets.didLanguageChange(e)}constructor(e,t){if(super(),this.textModel=e,this.getLanguageConfiguration=t,this.didChangeEmitter=new fe,this.denseKeyProvider=new F5e,this.brackets=new $5e(this.denseKeyProvider,this.getLanguageConfiguration),this.onDidChange=this.didChangeEmitter.event,this.queuedTextEditsForInitialAstWithoutTokens=[],this.queuedTextEdits=[],e.tokenization.hasTokens)e.tokenization.backgroundTokenizationState===2?(this.initialAstWithoutTokens=void 0,this.astWithTokens=this.parseDocumentFromTextBuffer([],void 0,!1)):(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer([],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens);else{const i=this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId()),r=new MEt(this.textModel.getValue(),i);this.initialAstWithoutTokens=MQ(r,[],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens}}handleDidChangeBackgroundTokenizationState(){if(this.textModel.tokenization.backgroundTokenizationState===2){const e=this.initialAstWithoutTokens===void 0;this.initialAstWithoutTokens=void 0,e||this.didChangeEmitter.fire()}}handleDidChangeTokens({ranges:e}){const t=e.map(i=>new m_(Os(i.fromLineNumber-1,0),Os(i.toLineNumber,0),Os(i.toLineNumber-i.fromLineNumber+1,0)));this.handleEdits(t,!0),this.initialAstWithoutTokens||this.didChangeEmitter.fire()}handleContentChanged(e){const t=m_.fromModelContentChanges(e.changes);this.handleEdits(t,!1)}handleEdits(e,t){const i=$8(this.queuedTextEdits,e);this.queuedTextEdits=i,this.initialAstWithoutTokens&&!t&&(this.queuedTextEditsForInitialAstWithoutTokens=$8(this.queuedTextEditsForInitialAstWithoutTokens,e))}flushQueue(){this.queuedTextEdits.length>0&&(this.astWithTokens=this.parseDocumentFromTextBuffer(this.queuedTextEdits,this.astWithTokens,!1),this.queuedTextEdits=[]),this.queuedTextEditsForInitialAstWithoutTokens.length>0&&(this.initialAstWithoutTokens&&(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer(this.queuedTextEditsForInitialAstWithoutTokens,this.initialAstWithoutTokens,!1)),this.queuedTextEditsForInitialAstWithoutTokens=[])}parseDocumentFromTextBuffer(e,t,i){const r=t,s=new B5e(this.textModel,this.brackets);return MQ(s,e,r,i)}getBracketsInRange(e,t){this.flushQueue();const i=Os(e.startLineNumber-1,e.startColumn-1),r=Os(e.endLineNumber-1,e.endColumn-1);return new T_(s=>{const o=this.initialAstWithoutTokens||this.astWithTokens;FQ(o,Pl,o.length,i,r,s,0,0,new Map,t)})}getBracketPairsInRange(e,t){this.flushQueue();const i=TS(e.getStartPosition()),r=TS(e.getEndPosition());return new T_(s=>{const o=this.initialAstWithoutTokens||this.astWithTokens,a=new UEt(s,t,this.textModel);BQ(o,Pl,o.length,i,r,a,0,new Map)})}getFirstBracketAfter(e){this.flushQueue();const t=this.initialAstWithoutTokens||this.astWithTokens;return V5e(t,Pl,t.length,TS(e))}getFirstBracketBefore(e){this.flushQueue();const t=this.initialAstWithoutTokens||this.astWithTokens;return H5e(t,Pl,t.length,TS(e))}}function H5e(n,e,t,i){if(n.kind===4||n.kind===2){const r=[];for(const s of n.children)t=as(e,s.length),r.push({nodeOffsetStart:e,nodeOffsetEnd:t}),e=t;for(let s=r.length-1;s>=0;s--){const{nodeOffsetStart:o,nodeOffsetEnd:a}=r[s];if(pk(o,i)){const l=H5e(n.children[s],o,a,i);if(l)return l}}return null}else{if(n.kind===3)return null;if(n.kind===1){const r=Xy(e,t);return{bracketInfo:n.bracketInfo,range:r}}}return null}function V5e(n,e,t,i){if(n.kind===4||n.kind===2){for(const r of n.children){if(t=as(e,r.length),pk(i,t)){const s=V5e(r,e,t,i);if(s)return s}e=t}return null}else{if(n.kind===3)return null;if(n.kind===1){const r=Xy(e,t);return{bracketInfo:n.bracketInfo,range:r}}}return null}function FQ(n,e,t,i,r,s,o,a,l,c,u=!1){if(o>200)return!0;e:for(;;)switch(n.kind){case 4:{const d=n.childrenLength;for(let h=0;h200)return!0;let l=!0;if(n.kind===2){let c=0;if(a){let h=a.get(n.openingBracket.text);h===void 0&&(h=0),c=h,h++,a.set(n.openingBracket.text,h)}const u=as(e,n.openingBracket.length);let d=-1;if(s.includeMinIndentation&&(d=n.computeMinIndentation(e,s.textModel)),l=s.push(new kEt(Xy(e,t),Xy(e,u),n.closingBracket?Xy(as(u,n.child?.length||Pl),t):void 0,o,c,n,d)),e=u,l&&n.child){const h=n.child;if(t=as(e,h.length),mk(e,r)&&ND(t,i)&&(l=BQ(h,e,t,i,r,s,o+1,a),!l))return!1}a?.set(n.openingBracket.text,c)}else{let c=e;for(const u of n.children){const d=c;if(c=as(c,u.length),mk(d,r)&&mk(i,c)&&(l=BQ(u,d,c,i,r,s,o,a),!l))return!1}}return l}class jEt extends me{get canBuildAST(){return this.textModel.getValueLength()<=5e6}constructor(e,t){super(),this.textModel=e,this.languageConfigurationService=t,this.bracketPairsTree=this._register(new To),this.onDidChangeEmitter=new fe,this.onDidChange=this.onDidChangeEmitter.event,this.bracketsRequested=!1}handleLanguageConfigurationServiceChange(e){(!e.languageId||this.bracketPairsTree.value?.object.didLanguageChange(e.languageId))&&(this.bracketPairsTree.clear(),this.updateBracketPairsTree())}handleDidChangeOptions(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeLanguage(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeContent(e){this.bracketPairsTree.value?.object.handleContentChanged(e)}handleDidChangeBackgroundTokenizationState(){this.bracketPairsTree.value?.object.handleDidChangeBackgroundTokenizationState()}handleDidChangeTokens(e){this.bracketPairsTree.value?.object.handleDidChangeTokens(e)}updateBracketPairsTree(){if(this.bracketsRequested&&this.canBuildAST){if(!this.bracketPairsTree.value){const e=new ke;this.bracketPairsTree.value=qEt(e.add(new zEt(this.textModel,t=>this.languageConfigurationService.getLanguageConfiguration(t))),e),e.add(this.bracketPairsTree.value.object.onDidChange(t=>this.onDidChangeEmitter.fire(t))),this.onDidChangeEmitter.fire()}}else this.bracketPairsTree.value&&(this.bracketPairsTree.clear(),this.onDidChangeEmitter.fire())}getBracketPairsInRange(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!1)||T_.empty}getBracketPairsInRangeWithMinIndentation(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!0)||T_.empty}getBracketsInRange(e,t=!1){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketsInRange(e,t)||T_.empty}findMatchingBracketUp(e,t,i){const r=this.textModel.validatePosition(t),s=this.textModel.getLanguageIdAtPosition(r.lineNumber,r.column);if(this.canBuildAST){const o=this.languageConfigurationService.getLanguageConfiguration(s).bracketsNew.getClosingBracketInfo(e);if(!o)return null;const a=this.getBracketPairsInRange($.fromPositions(t,t)).findLast(l=>o.closes(l.openingBracketInfo));return a?a.openingBracketRange:null}else{const o=e.toLowerCase(),a=this.languageConfigurationService.getLanguageConfiguration(s).brackets;if(!a)return null;const l=a.textIsBracket[o];return l?V4(this._findMatchingBracketUp(l,r,oq(i))):null}}matchBracket(e,t){if(this.canBuildAST){const i=this.getBracketPairsInRange($.fromPositions(e,e)).filter(r=>r.closingBracketRange!==void 0&&(r.openingBracketRange.containsPosition(e)||r.closingBracketRange.containsPosition(e))).findLastMaxBy($l(r=>r.openingBracketRange.containsPosition(e)?r.openingBracketRange:r.closingBracketRange,$.compareRangesUsingStarts));return i?[i.openingBracketRange,i.closingBracketRange]:null}else{const i=oq(t);return this._matchBracket(this.textModel.validatePosition(e),i)}}_establishBracketSearchOffsets(e,t,i,r){const s=t.getCount(),o=t.getLanguageId(r);let a=Math.max(0,e.column-1-i.maxBracketLength);for(let c=r-1;c>=0;c--){const u=t.getEndOffset(c);if(u<=a)break;if(np(t.getStandardTokenType(c))||t.getLanguageId(c)!==o){a=u;break}}let l=Math.min(t.getLineContent().length,e.column-1+i.maxBracketLength);for(let c=r+1;c=l)break;if(np(t.getStandardTokenType(c))||t.getLanguageId(c)!==o){l=u;break}}return{searchStartOffset:a,searchEndOffset:l}}_matchBracket(e,t){const i=e.lineNumber,r=this.textModel.tokenization.getLineTokens(i),s=this.textModel.getLineContent(i),o=r.findTokenIndexAtOffset(e.column-1);if(o<0)return null;const a=this.languageConfigurationService.getLanguageConfiguration(r.getLanguageId(o)).brackets;if(a&&!np(r.getStandardTokenType(o))){let{searchStartOffset:l,searchEndOffset:c}=this._establishBracketSearchOffsets(e,r,a,o),u=null;for(;;){const d=Lh.findNextBracketInRange(a.forwardRegex,i,s,l,c);if(!d)break;if(d.startColumn<=e.column&&e.column<=d.endColumn){const h=s.substring(d.startColumn-1,d.endColumn-1).toLowerCase(),f=this._matchFoundBracket(d,a.textIsBracket[h],a.textIsOpenBracket[h],t);if(f){if(f instanceof e_)return null;u=f}}l=d.endColumn-1}if(u)return u}if(o>0&&r.getStartOffset(o)===e.column-1){const l=o-1,c=this.languageConfigurationService.getLanguageConfiguration(r.getLanguageId(l)).brackets;if(c&&!np(r.getStandardTokenType(l))){const{searchStartOffset:u,searchEndOffset:d}=this._establishBracketSearchOffsets(e,r,c,l),h=Lh.findPrevBracketInRange(c.reversedRegex,i,s,u,d);if(h&&h.startColumn<=e.column&&e.column<=h.endColumn){const f=s.substring(h.startColumn-1,h.endColumn-1).toLowerCase(),g=this._matchFoundBracket(h,c.textIsBracket[f],c.textIsOpenBracket[f],t);if(g)return g instanceof e_?null:g}}}return null}_matchFoundBracket(e,t,i,r){if(!t)return null;const s=i?this._findMatchingBracketDown(t,e.getEndPosition(),r):this._findMatchingBracketUp(t,e.getStartPosition(),r);return s?s instanceof e_?s:[e,s]:null}_findMatchingBracketUp(e,t,i){const r=e.languageId,s=e.reversedRegex;let o=-1,a=0;const l=(c,u,d,h)=>{for(;;){if(i&&++a%100===0&&!i())return e_.INSTANCE;const f=Lh.findPrevBracketInRange(s,c,u,d,h);if(!f)break;const g=u.substring(f.startColumn-1,f.endColumn-1).toLowerCase();if(e.isOpen(g)?o++:e.isClose(g)&&o--,o===0)return f;h=f.startColumn-1}return null};for(let c=t.lineNumber;c>=1;c--){const u=this.textModel.tokenization.getLineTokens(c),d=u.getCount(),h=this.textModel.getLineContent(c);let f=d-1,g=h.length,p=h.length;c===t.lineNumber&&(f=u.findTokenIndexAtOffset(t.column-1),g=t.column-1,p=t.column-1);let m=!0;for(;f>=0;f--){const _=u.getLanguageId(f)===r&&!np(u.getStandardTokenType(f));if(_)m?g=u.getStartOffset(f):(g=u.getStartOffset(f),p=u.getEndOffset(f));else if(m&&g!==p){const v=l(c,h,g,p);if(v)return v}m=_}if(m&&g!==p){const _=l(c,h,g,p);if(_)return _}}return null}_findMatchingBracketDown(e,t,i){const r=e.languageId,s=e.forwardRegex;let o=1,a=0;const l=(u,d,h,f)=>{for(;;){if(i&&++a%100===0&&!i())return e_.INSTANCE;const g=Lh.findNextBracketInRange(s,u,d,h,f);if(!g)break;const p=d.substring(g.startColumn-1,g.endColumn-1).toLowerCase();if(e.isOpen(p)?o++:e.isClose(p)&&o--,o===0)return g;h=g.endColumn-1}return null},c=this.textModel.getLineCount();for(let u=t.lineNumber;u<=c;u++){const d=this.textModel.tokenization.getLineTokens(u),h=d.getCount(),f=this.textModel.getLineContent(u);let g=0,p=0,m=0;u===t.lineNumber&&(g=d.findTokenIndexAtOffset(t.column-1),p=t.column-1,m=t.column-1);let _=!0;for(;g=1;o--){const a=this.textModel.tokenization.getLineTokens(o),l=a.getCount(),c=this.textModel.getLineContent(o);let u=l-1,d=c.length,h=c.length;if(o===t.lineNumber){u=a.findTokenIndexAtOffset(t.column-1),d=t.column-1,h=t.column-1;const g=a.getLanguageId(u);i!==g&&(i=g,r=this.languageConfigurationService.getLanguageConfiguration(i).brackets,s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew)}let f=!0;for(;u>=0;u--){const g=a.getLanguageId(u);if(i!==g){if(r&&s&&f&&d!==h){const m=Lh.findPrevBracketInRange(r.reversedRegex,o,c,d,h);if(m)return this._toFoundBracket(s,m);f=!1}i=g,r=this.languageConfigurationService.getLanguageConfiguration(i).brackets,s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew}const p=!!r&&!np(a.getStandardTokenType(u));if(p)f?d=a.getStartOffset(u):(d=a.getStartOffset(u),h=a.getEndOffset(u));else if(s&&r&&f&&d!==h){const m=Lh.findPrevBracketInRange(r.reversedRegex,o,c,d,h);if(m)return this._toFoundBracket(s,m)}f=p}if(s&&r&&f&&d!==h){const g=Lh.findPrevBracketInRange(r.reversedRegex,o,c,d,h);if(g)return this._toFoundBracket(s,g)}}return null}findNextBracket(e){const t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketAfter(t)||null;const i=this.textModel.getLineCount();let r=null,s=null,o=null;for(let a=t.lineNumber;a<=i;a++){const l=this.textModel.tokenization.getLineTokens(a),c=l.getCount(),u=this.textModel.getLineContent(a);let d=0,h=0,f=0;if(a===t.lineNumber){d=l.findTokenIndexAtOffset(t.column-1),h=t.column-1,f=t.column-1;const p=l.getLanguageId(d);r!==p&&(r=p,s=this.languageConfigurationService.getLanguageConfiguration(r).brackets,o=this.languageConfigurationService.getLanguageConfiguration(r).bracketsNew)}let g=!0;for(;dp.closingBracketRange!==void 0&&p.range.strictContainsRange(f));return g?[g.openingBracketRange,g.closingBracketRange]:null}const r=oq(t),s=this.textModel.getLineCount(),o=new Map;let a=[];const l=(f,g)=>{if(!o.has(f)){const p=[];for(let m=0,_=g?g.brackets.length:0;m<_;m++)p[m]=0;o.set(f,p)}a=o.get(f)};let c=0;const u=(f,g,p,m,_)=>{for(;;){if(r&&++c%100===0&&!r())return e_.INSTANCE;const v=Lh.findNextBracketInRange(f.forwardRegex,g,p,m,_);if(!v)break;const y=p.substring(v.startColumn-1,v.endColumn-1).toLowerCase(),C=f.textIsBracket[y];if(C&&(C.isOpen(y)?a[C.index]++:C.isClose(y)&&a[C.index]--,a[C.index]===-1))return this._matchFoundBracket(v,C,!1,r);m=v.endColumn-1}return null};let d=null,h=null;for(let f=i.lineNumber;f<=s;f++){const g=this.textModel.tokenization.getLineTokens(f),p=g.getCount(),m=this.textModel.getLineContent(f);let _=0,v=0,y=0;if(f===i.lineNumber){_=g.findTokenIndexAtOffset(i.column-1),v=i.column-1,y=i.column-1;const x=g.getLanguageId(_);d!==x&&(d=x,h=this.languageConfigurationService.getLanguageConfiguration(d).brackets,l(d,h))}let C=!0;for(;_e?.dispose()}}function oq(n){if(typeof n>"u")return()=>!0;{const e=Date.now();return()=>Date.now()-e<=n}}class e_{static{this.INSTANCE=new e_}constructor(){this._searchCanceledBrand=void 0}}function V4(n){return n instanceof e_?null:n}class KEt extends me{constructor(e){super(),this.textModel=e,this.colorProvider=new z5e,this.onDidChangeEmitter=new fe,this.onDidChange=this.onDidChangeEmitter.event,this.colorizationOptions=e.getOptions().bracketPairColorizationOptions,this._register(e.bracketPairs.onDidChange(t=>{this.onDidChangeEmitter.fire()}))}handleDidChangeOptions(e){this.colorizationOptions=this.textModel.getOptions().bracketPairColorizationOptions}getDecorationsInRange(e,t,i,r){return r?[]:t===void 0?[]:this.colorizationOptions.enabled?this.textModel.bracketPairs.getBracketsInRange(e,!0).map(o=>({id:`bracket${o.range.toString()}-${o.nestingLevel}`,options:{description:"BracketPairColorization",inlineClassName:this.colorProvider.getInlineClassName(o,this.colorizationOptions.independentColorPoolPerBracketType)},ownerId:0,range:o.range})).toArray():[]}getAllDecorations(e,t){return e===void 0?[]:this.colorizationOptions.enabled?this.getDecorationsInRange(new $(1,1,this.textModel.getLineCount(),1),e,t):[]}}class z5e{constructor(){this.unexpectedClosingBracketClassName="unexpected-closing-bracket"}getInlineClassName(e,t){return e.isInvalid?this.unexpectedClosingBracketClassName:this.getInlineClassNameOfLevel(t?e.nestingLevelOfEqualBracketType:e.nestingLevel)}getInlineClassNameOfLevel(e){return`bracket-highlighting-${e%30}`}}dh((n,e)=>{const t=[I5e,A5e,N5e,R5e,P5e,O5e],i=new z5e;e.addRule(`.monaco-editor .${i.unexpectedClosingBracketClassName} { color: ${n.getColor(oEt)}; }`);const r=t.map(s=>n.getColor(s)).filter(s=>!!s).filter(s=>!s.isTransparent());for(let s=0;s<30;s++){const o=r[s%r.length];e.addRule(`.monaco-editor .${i.getInlineClassNameOfLevel(s)} { color: ${o}; }`)}});function z4(n){return n.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}class ya{get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,i,r){this.oldPosition=e,this.oldText=t,this.newPosition=i,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${z4(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${z4(this.oldText)}")`:`(replace@${this.oldPosition} "${z4(this.oldText)}" with "${z4(this.newText)}")`}static _writeStringSize(e){return 4+2*e.length}static _writeString(e,t,i){const r=t.length;Wf(e,r,i),i+=4;for(let s=0;s0&&(this.changes=GEt(this.changes,t)),this.afterEOL=i,this.afterVersionId=r,this.afterCursorState=s}static _writeSelectionsSize(e){return 4+4*4*(e?e.length:0)}static _writeSelections(e,t,i){if(Wf(e,t?t.length:0,i),i+=4,t)for(const r of t)Wf(e,r.selectionStartLineNumber,i),i+=4,Wf(e,r.selectionStartColumn,i),i+=4,Wf(e,r.positionLineNumber,i),i+=4,Wf(e,r.positionColumn,i),i+=4;return i}static _readSelections(e,t,i){const r=$f(e,t);t+=4;for(let s=0;st.toString()).join(", ")}matchesResource(e){return(Pt.isUri(this.model)?this.model:this.model.uri).toString()===e.toString()}setModel(e){this.model=e}canAppend(e){return this.model===e&&this._data instanceof Ao}append(e,t,i,r,s){this._data instanceof Ao&&this._data.append(e,t,i,r,s)}close(){this._data instanceof Ao&&(this._data=this._data.serialize())}open(){this._data instanceof Ao||(this._data=Ao.deserialize(this._data))}undo(){if(Pt.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof Ao&&(this._data=this._data.serialize());const e=Ao.deserialize(this._data);this.model._applyUndo(e.changes,e.beforeEOL,e.beforeVersionId,e.beforeCursorState)}redo(){if(Pt.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof Ao&&(this._data=this._data.serialize());const e=Ao.deserialize(this._data);this.model._applyRedo(e.changes,e.afterEOL,e.afterVersionId,e.afterCursorState)}heapSize(){return this._data instanceof Ao&&(this._data=this._data.serialize()),this._data.byteLength+168}}class YEt{get resources(){return this._editStackElementsArr.map(e=>e.resource)}constructor(e,t,i){this.label=e,this.code=t,this.type=1,this._isOpen=!0,this._editStackElementsArr=i.slice(0),this._editStackElementsMap=new Map;for(const r of this._editStackElementsArr){const s=px(r.resource);this._editStackElementsMap.set(s,r)}this._delegate=null}prepareUndoRedo(){if(this._delegate)return this._delegate.prepareUndoRedo(this)}matchesResource(e){const t=px(e);return this._editStackElementsMap.has(t)}setModel(e){const t=px(Pt.isUri(e)?e:e.uri);this._editStackElementsMap.has(t)&&this._editStackElementsMap.get(t).setModel(e)}canAppend(e){if(!this._isOpen)return!1;const t=px(e.uri);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).canAppend(e):!1}append(e,t,i,r,s){const o=px(e.uri);this._editStackElementsMap.get(o).append(e,t,i,r,s)}close(){this._isOpen=!1}open(){}undo(){this._isOpen=!1;for(const e of this._editStackElementsArr)e.undo()}redo(){for(const e of this._editStackElementsArr)e.redo()}heapSize(e){const t=px(e);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).heapSize():0}split(){return this._editStackElementsArr}toString(){const e=[];for(const t of this._editStackElementsArr)e.push(`${th(t.resource)}: ${t}`);return`{${e.join(", ")}}`}}function $Q(n){return n.getEOL()===` -`?0:1}function t_(n){return n?n instanceof U5e||n instanceof YEt:!1}class Zle{constructor(e,t){this._model=e,this._undoRedoService=t}pushStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);t_(e)&&e.close()}popStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);t_(e)&&e.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(e,t){const i=this._undoRedoService.getLastElement(this._model.uri);if(t_(i)&&i.canAppend(this._model))return i;const r=new U5e(w("edit","Typing"),"undoredo.textBufferEdit",this._model,e);return this._undoRedoService.pushElement(r,t),r}pushEOL(e){const t=this._getOrCreateEditStackElement(null,void 0);this._model.setEOL(e),t.append(this._model,[],$Q(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(e,t,i,r){const s=this._getOrCreateEditStackElement(e,r),o=this._model.applyEdits(t,!0),a=Zle._computeCursorState(i,o),l=o.map((c,u)=>({index:u,textChange:c.textChange}));return l.sort((c,u)=>c.textChange.oldPosition===u.textChange.oldPosition?c.index-u.index:c.textChange.oldPosition-u.textChange.oldPosition),s.append(this._model,l.map(c=>c.textChange),$Q(this._model),this._model.getAlternativeVersionId(),a),a}static _computeCursorState(e,t){try{return e?e(t):null}catch(i){return rn(i),null}}}class j5e extends me{constructor(){super(...arguments),this._isDisposed=!1}dispose(){super.dispose(),this._isDisposed=!0}assertNotDisposed(){if(this._isDisposed)throw new Error("TextModelPart is disposed!")}}function TW(n,e){let t=0,i=0;const r=n.length;for(;ir)throw new fi("Illegal value for lineNumber");const s=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,o=!!(s&&s.offSide);let a=-2,l=-1,c=-2,u=-1;const d=L=>{if(a!==-1&&(a===-2||a>L-1)){a=-1,l=-1;for(let D=L-2;D>=0;D--){const I=this._computeIndentLevel(D);if(I>=0){a=D,l=I;break}}}if(c===-2){c=-1,u=-1;for(let D=L;D=0){c=D,u=I;break}}}};let h=-2,f=-1,g=-2,p=-1;const m=L=>{if(h===-2){h=-1,f=-1;for(let D=L-2;D>=0;D--){const I=this._computeIndentLevel(D);if(I>=0){h=D,f=I;break}}}if(g!==-1&&(g===-2||g=0){g=D,p=I;break}}}};let _=0,v=!0,y=0,C=!0,x=0,k=0;for(let L=0;v||C;L++){const D=e-L,I=e+L;L>1&&(D<1||D1&&(I>r||I>i)&&(C=!1),L>5e4&&(v=!1,C=!1);let O=-1;if(v&&D>=1){const B=this._computeIndentLevel(D-1);B>=0?(c=D-1,u=B,O=Math.ceil(B/this.textModel.getOptions().indentSize)):(d(D),O=this._getIndentLevelForWhitespaceLine(o,l,u))}let M=-1;if(C&&I<=r){const B=this._computeIndentLevel(I-1);B>=0?(h=I-1,f=B,M=Math.ceil(B/this.textModel.getOptions().indentSize)):(m(I),M=this._getIndentLevelForWhitespaceLine(o,f,p))}if(L===0){k=O;continue}if(L===1){if(I<=r&&M>=0&&k+1===M){v=!1,_=I,y=I,x=M;continue}if(D>=1&&O>=0&&O-1===k){C=!1,_=D,y=D,x=O;continue}if(_=e,y=e,x=k,x===0)return{startLineNumber:_,endLineNumber:y,indent:x}}v&&(O>=x?_=D:v=!1),C&&(M>=x?y=I:C=!1)}return{startLineNumber:_,endLineNumber:y,indent:x}}getLinesBracketGuides(e,t,i,r){const s=[];for(let d=e;d<=t;d++)s.push([]);const o=!0,a=this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new $(e,1,t,this.textModel.getLineMaxColumn(t))).toArray();let l;if(i&&a.length>0){const d=(e<=i.lineNumber&&i.lineNumber<=t?a:this.textModel.bracketPairs.getBracketPairsInRange($.fromPositions(i)).toArray()).filter(h=>$.strictContainsPosition(h.range,i));l=hN(d,h=>o)?.range}const c=this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType,u=new q5e;for(const d of a){if(!d.closingBracketRange)continue;const h=l&&d.range.equalsRange(l);if(!h&&!r.includeInactive)continue;const f=u.getInlineClassName(d.nestingLevel,d.nestingLevelOfEqualBracketType,c)+(r.highlightActive&&h?" "+u.activeClassName:""),g=d.openingBracketRange.getStartPosition(),p=d.closingBracketRange.getStartPosition(),m=r.horizontalGuides===Qy.Enabled||r.horizontalGuides===Qy.EnabledForActive&&h;if(d.range.startLineNumber===d.range.endLineNumber){m&&s[d.range.startLineNumber-e].push(new Ny(-1,d.openingBracketRange.getEndPosition().column,f,new xI(!1,p.column),-1,-1));continue}const _=this.getVisibleColumnFromPosition(p),v=this.getVisibleColumnFromPosition(d.openingBracketRange.getStartPosition()),y=Math.min(v,_,d.minVisibleColumnIndentation+1);let C=!1;yl(this.textModel.getLineContent(d.closingBracketRange.startLineNumber))=e&&v>y&&s[g.lineNumber-e].push(new Ny(y,-1,f,new xI(!1,g.column),-1,-1)),p.lineNumber<=t&&_>y&&s[p.lineNumber-e].push(new Ny(y,-1,f,new xI(!C,p.column),-1,-1)))}for(const d of s)d.sort((h,f)=>h.visibleColumn-f.visibleColumn);return s}getVisibleColumnFromPosition(e){return co.visibleColumnFromColumn(this.textModel.getLineContent(e.lineNumber),e.column,this.textModel.getOptions().tabSize)+1}getLinesIndentGuides(e,t){this.assertNotDisposed();const i=this.textModel.getLineCount();if(e<1||e>i)throw new Error("Illegal value for startLineNumber");if(t<1||t>i)throw new Error("Illegal value for endLineNumber");const r=this.textModel.getOptions(),s=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,o=!!(s&&s.offSide),a=new Array(t-e+1);let l=-2,c=-1,u=-2,d=-1;for(let h=e;h<=t;h++){const f=h-e,g=this._computeIndentLevel(h-1);if(g>=0){l=h-1,c=g,a[f]=Math.ceil(g/r.indentSize);continue}if(l===-2){l=-1,c=-1;for(let p=h-2;p>=0;p--){const m=this._computeIndentLevel(p);if(m>=0){l=p,c=m;break}}}if(u!==-1&&(u===-2||u=0){u=p,d=m;break}}}a[f]=this._getIndentLevelForWhitespaceLine(o,c,d)}return a}_getIndentLevelForWhitespaceLine(e,t,i){const r=this.textModel.getOptions();return t===-1||i===-1?0:t0&&a>0||l>0&&c>0)return;const u=Math.abs(a-c),d=Math.abs(o-l);if(u===0){r.spacesDiff=d,d>0&&0<=l-1&&l-10?r++:C>1&&s++,QEt(o,a,m,y,d),d.looksLikeAlignment&&!(t&&e===d.spacesDiff)))continue;const k=d.spacesDiff;k<=c&&u[k]++,o=m,a=y}let h=t;r!==s&&(h=r{const m=u[p];m>g&&(g=m,f=p)}),f===4&&u[4]>0&&u[2]>0&&u[2]>=u[4]/2&&(f=2)}return{insertSpaces:h,tabSize:f}}function rc(n){return(n.metadata&1)>>>0}function Lr(n,e){n.metadata=n.metadata&254|e<<0}function Ea(n){return(n.metadata&2)>>>1===1}function Cr(n,e){n.metadata=n.metadata&253|(e?1:0)<<1}function K5e(n){return(n.metadata&4)>>>2===1}function uye(n,e){n.metadata=n.metadata&251|(e?1:0)<<2}function G5e(n){return(n.metadata&64)>>>6===1}function dye(n,e){n.metadata=n.metadata&191|(e?1:0)<<6}function JEt(n){return(n.metadata&24)>>>3}function hye(n,e){n.metadata=n.metadata&231|e<<3}function eLt(n){return(n.metadata&32)>>>5===1}function fye(n,e){n.metadata=n.metadata&223|(e?1:0)<<5}class Y5e{constructor(e,t,i){this.metadata=0,this.parent=this,this.left=this,this.right=this,Lr(this,1),this.start=t,this.end=i,this.delta=0,this.maxEnd=i,this.id=e,this.ownerId=0,this.options=null,uye(this,!1),dye(this,!1),hye(this,1),fye(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=null,Cr(this,!1)}reset(e,t,i,r){this.start=t,this.end=i,this.maxEnd=i,this.cachedVersionId=e,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=r}setOptions(e){this.options=e;const t=this.options.className;uye(this,t==="squiggly-error"||t==="squiggly-warning"||t==="squiggly-info"),dye(this,this.options.glyphMarginClassName!==null),hye(this,this.options.stickiness),fye(this,this.options.collapseOnReplaceEdit)}setCachedOffsets(e,t,i){this.cachedVersionId!==i&&(this.range=null),this.cachedVersionId=i,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t}detach(){this.parent=null,this.left=null,this.right=null}}const Nn=new Y5e(null,0,0);Nn.parent=Nn;Nn.left=Nn;Nn.right=Nn;Lr(Nn,0);class aq{constructor(){this.root=Nn,this.requestNormalizeDelta=!1}intervalSearch(e,t,i,r,s,o){return this.root===Nn?[]:lLt(this,e,t,i,r,s,o)}search(e,t,i,r){return this.root===Nn?[]:aLt(this,e,t,i,r)}collectNodesFromOwner(e){return sLt(this,e)}collectNodesPostOrder(){return oLt(this)}insert(e){gye(this,e),this._normalizeDeltaIfNecessary()}delete(e){pye(this,e),this._normalizeDeltaIfNecessary()}resolveNode(e,t){const i=e;let r=0;for(;e!==this.root;)e===e.parent.right&&(r+=e.parent.delta),e=e.parent;const s=i.start+r,o=i.end+r;i.setCachedOffsets(s,o,t)}acceptReplace(e,t,i,r){const s=iLt(this,e,e+t);for(let o=0,a=s.length;ot||i===1?!1:i===2?!0:e}function nLt(n,e,t,i,r){const s=JEt(n),o=s===0||s===2,a=s===1||s===2,l=t-e,c=i,u=Math.min(l,c),d=n.start;let h=!1;const f=n.end;let g=!1;e<=d&&f<=t&&eLt(n)&&(n.start=e,h=!0,n.end=e,g=!0);{const m=r?1:l>0?2:0;!h&&mx(d,o,e,m)&&(h=!0),!g&&mx(f,a,e,m)&&(g=!0)}if(u>0&&!r){const m=l>c?2:0;!h&&mx(d,o,e+u,m)&&(h=!0),!g&&mx(f,a,e+u,m)&&(g=!0)}{const m=r?1:0;!h&&mx(d,o,t,m)&&(n.start=e+c,h=!0),!g&&mx(f,a,t,m)&&(n.end=e+c,g=!0)}const p=c-l;h||(n.start=Math.max(0,d+p)),g||(n.end=Math.max(0,f+p)),n.start>n.end&&(n.end=n.start)}function iLt(n,e,t){let i=n.root,r=0,s=0,o=0,a=0;const l=[];let c=0;for(;i!==Nn;){if(Ea(i)){Cr(i.left,!1),Cr(i.right,!1),i===i.parent.right&&(r-=i.parent.delta),i=i.parent;continue}if(!Ea(i.left)){if(s=r+i.maxEnd,st){Cr(i,!0);continue}if(a=r+i.end,a>=e&&(i.setCachedOffsets(o,a,0),l[c++]=i),Cr(i,!0),i.right!==Nn&&!Ea(i.right)){r+=i.delta,i=i.right;continue}}return Cr(n.root,!1),l}function rLt(n,e,t,i){let r=n.root,s=0,o=0,a=0;const l=i-(t-e);for(;r!==Nn;){if(Ea(r)){Cr(r.left,!1),Cr(r.right,!1),r===r.parent.right&&(s-=r.parent.delta),Ib(r),r=r.parent;continue}if(!Ea(r.left)){if(o=s+r.maxEnd,ot){r.start+=l,r.end+=l,r.delta+=l,(r.delta<-1073741824||r.delta>1073741824)&&(n.requestNormalizeDelta=!0),Cr(r,!0);continue}if(Cr(r,!0),r.right!==Nn&&!Ea(r.right)){s+=r.delta,r=r.right;continue}}Cr(n.root,!1)}function sLt(n,e){let t=n.root;const i=[];let r=0;for(;t!==Nn;){if(Ea(t)){Cr(t.left,!1),Cr(t.right,!1),t=t.parent;continue}if(t.left!==Nn&&!Ea(t.left)){t=t.left;continue}if(t.ownerId===e&&(i[r++]=t),Cr(t,!0),t.right!==Nn&&!Ea(t.right)){t=t.right;continue}}return Cr(n.root,!1),i}function oLt(n){let e=n.root;const t=[];let i=0;for(;e!==Nn;){if(Ea(e)){Cr(e.left,!1),Cr(e.right,!1),e=e.parent;continue}if(e.left!==Nn&&!Ea(e.left)){e=e.left;continue}if(e.right!==Nn&&!Ea(e.right)){e=e.right;continue}t[i++]=e,Cr(e,!0)}return Cr(n.root,!1),t}function aLt(n,e,t,i,r){let s=n.root,o=0,a=0,l=0;const c=[];let u=0;for(;s!==Nn;){if(Ea(s)){Cr(s.left,!1),Cr(s.right,!1),s===s.parent.right&&(o-=s.parent.delta),s=s.parent;continue}if(s.left!==Nn&&!Ea(s.left)){s=s.left;continue}a=o+s.start,l=o+s.end,s.setCachedOffsets(a,l,i);let d=!0;if(e&&s.ownerId&&s.ownerId!==e&&(d=!1),t&&K5e(s)&&(d=!1),r&&!G5e(s)&&(d=!1),d&&(c[u++]=s),Cr(s,!0),s.right!==Nn&&!Ea(s.right)){o+=s.delta,s=s.right;continue}}return Cr(n.root,!1),c}function lLt(n,e,t,i,r,s,o){let a=n.root,l=0,c=0,u=0,d=0;const h=[];let f=0;for(;a!==Nn;){if(Ea(a)){Cr(a.left,!1),Cr(a.right,!1),a===a.parent.right&&(l-=a.parent.delta),a=a.parent;continue}if(!Ea(a.left)){if(c=l+a.maxEnd,ct){Cr(a,!0);continue}if(d=l+a.end,d>=e){a.setCachedOffsets(u,d,s);let g=!0;i&&a.ownerId&&a.ownerId!==i&&(g=!1),r&&K5e(a)&&(g=!1),o&&!G5e(a)&&(g=!1),g&&(h[f++]=a)}if(Cr(a,!0),a.right!==Nn&&!Ea(a.right)){l+=a.delta,a=a.right;continue}}return Cr(n.root,!1),h}function gye(n,e){if(n.root===Nn)return e.parent=Nn,e.left=Nn,e.right=Nn,Lr(e,0),n.root=e,n.root;cLt(n,e),X0(e.parent);let t=e;for(;t!==n.root&&rc(t.parent)===1;)if(t.parent===t.parent.parent.left){const i=t.parent.parent.right;rc(i)===1?(Lr(t.parent,0),Lr(i,0),Lr(t.parent.parent,1),t=t.parent.parent):(t===t.parent.right&&(t=t.parent,SI(n,t)),Lr(t.parent,0),Lr(t.parent.parent,1),kI(n,t.parent.parent))}else{const i=t.parent.parent.left;rc(i)===1?(Lr(t.parent,0),Lr(i,0),Lr(t.parent.parent,1),t=t.parent.parent):(t===t.parent.left&&(t=t.parent,kI(n,t)),Lr(t.parent,0),Lr(t.parent.parent,1),SI(n,t.parent.parent))}return Lr(n.root,0),e}function cLt(n,e){let t=0,i=n.root;const r=e.start,s=e.end;for(;;)if(dLt(r,s,i.start+t,i.end+t)<0)if(i.left===Nn){e.start-=t,e.end-=t,e.maxEnd-=t,i.left=e;break}else i=i.left;else if(i.right===Nn){e.start-=t+i.delta,e.end-=t+i.delta,e.maxEnd-=t+i.delta,i.right=e;break}else t+=i.delta,i=i.right;e.parent=i,e.left=Nn,e.right=Nn,Lr(e,1)}function pye(n,e){let t,i;if(e.left===Nn?(t=e.right,i=e,t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(n.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta):e.right===Nn?(t=e.left,i=e):(i=uLt(e.right),t=i.right,t.start+=i.delta,t.end+=i.delta,t.delta+=i.delta,(t.delta<-1073741824||t.delta>1073741824)&&(n.requestNormalizeDelta=!0),i.start+=e.delta,i.end+=e.delta,i.delta=e.delta,(i.delta<-1073741824||i.delta>1073741824)&&(n.requestNormalizeDelta=!0)),i===n.root){n.root=t,Lr(t,0),e.detach(),lq(),Ib(t),n.root.parent=Nn;return}const r=rc(i)===1;if(i===i.parent.left?i.parent.left=t:i.parent.right=t,i===e?t.parent=i.parent:(i.parent===e?t.parent=i:t.parent=i.parent,i.left=e.left,i.right=e.right,i.parent=e.parent,Lr(i,rc(e)),e===n.root?n.root=i:e===e.parent.left?e.parent.left=i:e.parent.right=i,i.left!==Nn&&(i.left.parent=i),i.right!==Nn&&(i.right.parent=i)),e.detach(),r){X0(t.parent),i!==e&&(X0(i),X0(i.parent)),lq();return}X0(t),X0(t.parent),i!==e&&(X0(i),X0(i.parent));let s;for(;t!==n.root&&rc(t)===0;)t===t.parent.left?(s=t.parent.right,rc(s)===1&&(Lr(s,0),Lr(t.parent,1),SI(n,t.parent),s=t.parent.right),rc(s.left)===0&&rc(s.right)===0?(Lr(s,1),t=t.parent):(rc(s.right)===0&&(Lr(s.left,0),Lr(s,1),kI(n,s),s=t.parent.right),Lr(s,rc(t.parent)),Lr(t.parent,0),Lr(s.right,0),SI(n,t.parent),t=n.root)):(s=t.parent.left,rc(s)===1&&(Lr(s,0),Lr(t.parent,1),kI(n,t.parent),s=t.parent.left),rc(s.left)===0&&rc(s.right)===0?(Lr(s,1),t=t.parent):(rc(s.left)===0&&(Lr(s.right,0),Lr(s,1),SI(n,s),s=t.parent.left),Lr(s,rc(t.parent)),Lr(t.parent,0),Lr(s.left,0),kI(n,t.parent),t=n.root));Lr(t,0),lq()}function uLt(n){for(;n.left!==Nn;)n=n.left;return n}function lq(){Nn.parent=Nn,Nn.delta=0,Nn.start=0,Nn.end=0}function SI(n,e){const t=e.right;t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(n.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta,e.right=t.left,t.left!==Nn&&(t.left.parent=e),t.parent=e.parent,e.parent===Nn?n.root=t:e===e.parent.left?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t,Ib(e),Ib(t)}function kI(n,e){const t=e.left;e.delta-=t.delta,(e.delta<-1073741824||e.delta>1073741824)&&(n.requestNormalizeDelta=!0),e.start-=t.delta,e.end-=t.delta,e.left=t.right,t.right!==Nn&&(t.right.parent=e),t.parent=e.parent,e.parent===Nn?n.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t,Ib(e),Ib(t)}function Z5e(n){let e=n.end;if(n.left!==Nn){const t=n.left.maxEnd;t>e&&(e=t)}if(n.right!==Nn){const t=n.right.maxEnd+n.delta;t>e&&(e=t)}return e}function Ib(n){n.maxEnd=Z5e(n)}function X0(n){for(;n!==Nn;){const e=Z5e(n);if(n.maxEnd===e)return;n.maxEnd=e,n=n.parent}}function dLt(n,e,t,i){return n===t?e-i:n-t}class WQ{constructor(e,t){this.piece=e,this.color=t,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==mn)return Xle(this.right);let e=this;for(;e.parent!==mn&&e.parent.left!==e;)e=e.parent;return e.parent===mn?mn:e.parent}prev(){if(this.left!==mn)return X5e(this.left);let e=this;for(;e.parent!==mn&&e.parent.right!==e;)e=e.parent;return e.parent===mn?mn:e.parent}detach(){this.parent=null,this.left=null,this.right=null}}const mn=new WQ(null,0);mn.parent=mn;mn.left=mn;mn.right=mn;mn.color=0;function Xle(n){for(;n.left!==mn;)n=n.left;return n}function X5e(n){for(;n.right!==mn;)n=n.right;return n}function Qle(n){return n===mn?0:n.size_left+n.piece.length+Qle(n.right)}function Jle(n){return n===mn?0:n.lf_left+n.piece.lineFeedCnt+Jle(n.right)}function cq(){mn.parent=mn}function EI(n,e){const t=e.right;t.size_left+=e.size_left+(e.piece?e.piece.length:0),t.lf_left+=e.lf_left+(e.piece?e.piece.lineFeedCnt:0),e.right=t.left,t.left!==mn&&(t.left.parent=e),t.parent=e.parent,e.parent===mn?n.root=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}function LI(n,e){const t=e.left;e.left=t.right,t.right!==mn&&(t.right.parent=e),t.parent=e.parent,e.size_left-=t.size_left+(t.piece?t.piece.length:0),e.lf_left-=t.lf_left+(t.piece?t.piece.lineFeedCnt:0),e.parent===mn?n.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}function U4(n,e){let t,i;if(e.left===mn?(i=e,t=i.right):e.right===mn?(i=e,t=i.left):(i=Xle(e.right),t=i.right),i===n.root){n.root=t,t.color=0,e.detach(),cq(),n.root.parent=mn;return}const r=i.color===1;if(i===i.parent.left?i.parent.left=t:i.parent.right=t,i===e?(t.parent=i.parent,RD(n,t)):(i.parent===e?t.parent=i:t.parent=i.parent,RD(n,t),i.left=e.left,i.right=e.right,i.parent=e.parent,i.color=e.color,e===n.root?n.root=i:e===e.parent.left?e.parent.left=i:e.parent.right=i,i.left!==mn&&(i.left.parent=i),i.right!==mn&&(i.right.parent=i),i.size_left=e.size_left,i.lf_left=e.lf_left,RD(n,i)),e.detach(),t.parent.left===t){const o=Qle(t),a=Jle(t);if(o!==t.parent.size_left||a!==t.parent.lf_left){const l=o-t.parent.size_left,c=a-t.parent.lf_left;t.parent.size_left=o,t.parent.lf_left=a,$m(n,t.parent,l,c)}}if(RD(n,t.parent),r){cq();return}let s;for(;t!==n.root&&t.color===0;)t===t.parent.left?(s=t.parent.right,s.color===1&&(s.color=0,t.parent.color=1,EI(n,t.parent),s=t.parent.right),s.left.color===0&&s.right.color===0?(s.color=1,t=t.parent):(s.right.color===0&&(s.left.color=0,s.color=1,LI(n,s),s=t.parent.right),s.color=t.parent.color,t.parent.color=0,s.right.color=0,EI(n,t.parent),t=n.root)):(s=t.parent.left,s.color===1&&(s.color=0,t.parent.color=1,LI(n,t.parent),s=t.parent.left),s.left.color===0&&s.right.color===0?(s.color=1,t=t.parent):(s.left.color===0&&(s.right.color=0,s.color=1,EI(n,s),s=t.parent.left),s.color=t.parent.color,t.parent.color=0,s.left.color=0,LI(n,t.parent),t=n.root));t.color=0,cq()}function mye(n,e){for(RD(n,e);e!==n.root&&e.parent.color===1;)if(e.parent===e.parent.parent.left){const t=e.parent.parent.right;t.color===1?(e.parent.color=0,t.color=0,e.parent.parent.color=1,e=e.parent.parent):(e===e.parent.right&&(e=e.parent,EI(n,e)),e.parent.color=0,e.parent.parent.color=1,LI(n,e.parent.parent))}else{const t=e.parent.parent.left;t.color===1?(e.parent.color=0,t.color=0,e.parent.parent.color=1,e=e.parent.parent):(e===e.parent.left&&(e=e.parent,LI(n,e)),e.parent.color=0,e.parent.parent.color=1,EI(n,e.parent.parent))}n.root.color=0}function $m(n,e,t,i){for(;e!==n.root&&e!==mn;)e.parent.left===e&&(e.parent.size_left+=t,e.parent.lf_left+=i),e=e.parent}function RD(n,e){let t=0,i=0;if(e!==n.root){for(;e!==n.root&&e===e.parent.right;)e=e.parent;if(e!==n.root)for(e=e.parent,t=Qle(e.left)-e.size_left,i=Jle(e.left)-e.lf_left,e.size_left+=t,e.lf_left+=i;e!==n.root&&(t!==0||i!==0);)e.parent.left===e&&(e.parent.size_left+=t,e.parent.lf_left+=i),e=e.parent}}const Am=65535;function Q5e(n){let e;return n[n.length-1]<65536?e=new Uint16Array(n.length):e=new Uint32Array(n.length),e.set(n,0),e}class hLt{constructor(e,t,i,r,s){this.lineStarts=e,this.cr=t,this.lf=i,this.crlf=r,this.isBasicASCII=s}}function Vm(n,e=!0){const t=[0];let i=1;for(let r=0,s=n.length;r126)&&(o=!1)}const a=new hLt(Q5e(n),i,r,s,o);return n.length=0,a}class Wc{constructor(e,t,i,r,s){this.bufferIndex=e,this.start=t,this.end=i,this.lineFeedCnt=r,this.length=s}}class gy{constructor(e,t){this.buffer=e,this.lineStarts=t}}class gLt{constructor(e,t){this._pieces=[],this._tree=e,this._BOM=t,this._index=0,e.root!==mn&&e.iterate(e.root,i=>(i!==mn&&this._pieces.push(i.piece),!0))}read(){return this._pieces.length===0?this._index===0?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:this._index===0?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}}class pLt{constructor(e){this._limit=e,this._cache=[]}get(e){for(let t=this._cache.length-1;t>=0;t--){const i=this._cache[t];if(i.nodeStartOffset<=e&&i.nodeStartOffset+i.node.piece.length>=e)return i}return null}get2(e){for(let t=this._cache.length-1;t>=0;t--){const i=this._cache[t];if(i.nodeStartLineNumber&&i.nodeStartLineNumber=e)return i}return null}set(e){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(e)}validate(e){let t=!1;const i=this._cache;for(let r=0;r=e){i[r]=null,t=!0;continue}}if(t){const r=[];for(const s of i)s!==null&&r.push(s);this._cache=r}}}class mLt{constructor(e,t,i){this.create(e,t,i)}create(e,t,i){this._buffers=[new gy("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=mn,this._lineCnt=1,this._length=0,this._EOL=t,this._EOLLength=t.length,this._EOLNormalized=i;let r=null;for(let s=0,o=e.length;s0){e[s].lineStarts||(e[s].lineStarts=Vm(e[s].buffer));const a=new Wc(s+1,{line:0,column:0},{line:e[s].lineStarts.length-1,column:e[s].buffer.length-e[s].lineStarts[e[s].lineStarts.length-1]},e[s].lineStarts.length-1,e[s].buffer.length);this._buffers.push(e[s]),r=this.rbInsertRight(r,a)}this._searchCache=new pLt(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(e){const t=Am,i=t-Math.floor(t/3),r=i*2;let s="",o=0;const a=[];if(this.iterate(this.root,l=>{const c=this.getNodeContent(l),u=c.length;if(o<=i||o+u0){const l=s.replace(/\r\n|\r|\n/g,e);a.push(new gy(l,Vm(l)))}this.create(a,e,!0)}getEOL(){return this._EOL}setEOL(e){this._EOL=e,this._EOLLength=this._EOL.length,this.normalizeEOL(e)}createSnapshot(e){return new gLt(this,e)}getOffsetAt(e,t){let i=0,r=this.root;for(;r!==mn;)if(r.left!==mn&&r.lf_left+1>=e)r=r.left;else if(r.lf_left+r.piece.lineFeedCnt+1>=e){i+=r.size_left;const s=this.getAccumulatedValue(r,e-r.lf_left-2);return i+=s+t-1}else e-=r.lf_left+r.piece.lineFeedCnt,i+=r.size_left+r.piece.length,r=r.right;return i}getPositionAt(e){e=Math.floor(e),e=Math.max(0,e);let t=this.root,i=0;const r=e;for(;t!==mn;)if(t.size_left!==0&&t.size_left>=e)t=t.left;else if(t.size_left+t.piece.length>=e){const s=this.getIndexOf(t,e-t.size_left);if(i+=t.lf_left+s.index,s.index===0){const o=this.getOffsetAt(i+1,1),a=r-o;return new he(i+1,a+1)}return new he(i+1,s.remainder+1)}else if(e-=t.size_left+t.piece.length,i+=t.lf_left+t.piece.lineFeedCnt,t.right===mn){const s=this.getOffsetAt(i+1,1),o=r-e-s;return new he(i+1,o+1)}else t=t.right;return new he(1,1)}getValueInRange(e,t){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return"";const i=this.nodeAt2(e.startLineNumber,e.startColumn),r=this.nodeAt2(e.endLineNumber,e.endColumn),s=this.getValueInRange2(i,r);return t?t!==this._EOL||!this._EOLNormalized?s.replace(/\r\n|\r|\n/g,t):t===this.getEOL()&&this._EOLNormalized?s:s.replace(/\r\n|\r|\n/g,t):s}getValueInRange2(e,t){if(e.node===t.node){const a=e.node,l=this._buffers[a.piece.bufferIndex].buffer,c=this.offsetInBuffer(a.piece.bufferIndex,a.piece.start);return l.substring(c+e.remainder,c+t.remainder)}let i=e.node;const r=this._buffers[i.piece.bufferIndex].buffer,s=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);let o=r.substring(s+e.remainder,s+i.piece.length);for(i=i.next();i!==mn;){const a=this._buffers[i.piece.bufferIndex].buffer,l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(i===t.node){o+=a.substring(l,l+t.remainder);break}else o+=a.substr(l,i.piece.length);i=i.next()}return o}getLinesContent(){const e=[];let t=0,i="",r=!1;return this.iterate(this.root,s=>{if(s===mn)return!0;const o=s.piece;let a=o.length;if(a===0)return!0;const l=this._buffers[o.bufferIndex].buffer,c=this._buffers[o.bufferIndex].lineStarts,u=o.start.line,d=o.end.line;let h=c[u]+o.start.column;if(r&&(l.charCodeAt(h)===10&&(h++,a--),e[t++]=i,i="",r=!1,a===0))return!0;if(u===d)return!this._EOLNormalized&&l.charCodeAt(h+a-1)===13?(r=!0,i+=l.substr(h,a-1)):i+=l.substr(h,a),!0;i+=this._EOLNormalized?l.substring(h,Math.max(h,c[u+1]-this._EOLLength)):l.substring(h,c[u+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;for(let f=u+1;fC+g,t.reset(0)):(v=h.buffer,y=C=>C,t.reset(g));do if(m=t.next(v),m){if(y(m.index)>=p)return u;this.positionInBuffer(e,y(m.index)-f,_);const C=this.getLineFeedCnt(e.piece.bufferIndex,s,_),x=_.line===s.line?_.column-s.column+r:_.column+1,k=x+m[0].length;if(d[u++]=ly(new $(i+C,x,i+C,k),m,l),y(m.index)+m[0].length>=p||u>=c)return u}while(m);return u}findMatchesLineByLine(e,t,i,r){const s=[];let o=0;const a=new CS(t.wordSeparators,t.regex);let l=this.nodeAt2(e.startLineNumber,e.startColumn);if(l===null)return[];const c=this.nodeAt2(e.endLineNumber,e.endColumn);if(c===null)return[];let u=this.positionInBuffer(l.node,l.remainder);const d=this.positionInBuffer(c.node,c.remainder);if(l.node===c.node)return this.findMatchesInNode(l.node,a,e.startLineNumber,e.startColumn,u,d,t,i,r,o,s),s;let h=e.startLineNumber,f=l.node;for(;f!==c.node;){const p=this.getLineFeedCnt(f.piece.bufferIndex,u,f.piece.end);if(p>=1){const _=this._buffers[f.piece.bufferIndex].lineStarts,v=this.offsetInBuffer(f.piece.bufferIndex,f.piece.start),y=_[u.line+p],C=h===e.startLineNumber?e.startColumn:1;if(o=this.findMatchesInNode(f,a,h,C,u,this.positionInBuffer(f,y-v),t,i,r,o,s),o>=r)return s;h+=p}const m=h===e.startLineNumber?e.startColumn-1:0;if(h===e.endLineNumber){const _=this.getLineContent(h).substring(m,e.endColumn-1);return o=this._findMatchesInLine(t,a,_,e.endLineNumber,m,o,s,i,r),s}if(o=this._findMatchesInLine(t,a,this.getLineContent(h).substr(m),h,m,o,s,i,r),o>=r)return s;h++,l=this.nodeAt2(h,1),f=l.node,u=this.positionInBuffer(l.node,l.remainder)}if(h===e.endLineNumber){const p=h===e.startLineNumber?e.startColumn-1:0,m=this.getLineContent(h).substring(p,e.endColumn-1);return o=this._findMatchesInLine(t,a,m,e.endLineNumber,p,o,s,i,r),s}const g=h===e.startLineNumber?e.startColumn:1;return o=this.findMatchesInNode(c.node,a,h,g,u,d,t,i,r,o,s),s}_findMatchesInLine(e,t,i,r,s,o,a,l,c){const u=e.wordSeparators;if(!l&&e.simpleSearch){const h=e.simpleSearch,f=h.length,g=i.length;let p=-f;for(;(p=i.indexOf(h,p+f))!==-1;)if((!u||Qae(u,i,g,p,f))&&(a[o++]=new dN(new $(r,p+1+s,r,p+1+f+s),null),o>=c))return o;return o}let d;t.reset(0);do if(d=t.next(i),d&&(a[o++]=ly(new $(r,d.index+1+s,r,d.index+1+d[0].length+s),d,l),o>=c))return o;while(d);return o}insert(e,t,i=!1){if(this._EOLNormalized=this._EOLNormalized&&i,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==mn){const{node:r,remainder:s,nodeStartOffset:o}=this.nodeAt(e),a=r.piece,l=a.bufferIndex,c=this.positionInBuffer(r,s);if(r.piece.bufferIndex===0&&a.end.line===this._lastChangeBufferPos.line&&a.end.column===this._lastChangeBufferPos.column&&o+a.length===e&&t.lengthe){const u=[];let d=new Wc(a.bufferIndex,c,a.end,this.getLineFeedCnt(a.bufferIndex,c,a.end),this.offsetInBuffer(l,a.end)-this.offsetInBuffer(l,c));if(this.shouldCheckCRLF()&&this.endWithCR(t)&&this.nodeCharCodeAt(r,s)===10){const p={line:d.start.line+1,column:0};d=new Wc(d.bufferIndex,p,d.end,this.getLineFeedCnt(d.bufferIndex,p,d.end),d.length-1),t+=` +`)a++,l=g+1;else{if(c!==g){let m;if(u===a){const _=g-c;if(_FEt(t)).join("|")}}get regExpGlobal(){if(!this.hasRegExp){const e=this.getRegExpStr();this._regExpGlobal=e?new RegExp(e,"gi"):null,this.hasRegExp=!0}return this._regExpGlobal}getToken(e){return this.map.get(e.toLowerCase())}findClosingTokenText(e){for(const[t,i]of this.map)if(i.kind===2&&i.bracketIds.intersects(e))return t}get isEmpty(){return this.map.size===0}}function FEt(n){let e=nd(n);return/^[\w ]+/.test(n)&&(e=`\\b${e}`),/[\w ]+$/.test(n)&&(e=`${e}\\b`),e}class $Fe{constructor(e,t){this.denseKeyProvider=e,this.getLanguageConfiguration=t,this.languageIdToBracketTokens=new Map}didLanguageChange(e){return this.languageIdToBracketTokens.has(e)}getSingleLanguageBracketTokens(e){let t=this.languageIdToBracketTokens.get(e);return t||(t=Yle.createFromLanguage(this.getLanguageConfiguration(e),this.denseKeyProvider),this.languageIdToBracketTokens.set(e,t)),t}}function BEt(n){if(n.length===0)return null;if(n.length===1)return n[0];let e=0;function t(){if(e>=n.length)return null;const o=e,a=n[o].listHeight;for(e++;e=2?WFe(o===0&&e===n.length?n:n.slice(o,e),!1):n[o]}let i=t(),r=t();if(!r)return i;for(let o=t();o;o=t())aye(i,r)<=aye(r,o)?(i=rq(i,r),r=o):r=rq(r,o);return rq(i,r)}function WFe(n,e=!1){if(n.length===0)return null;if(n.length===1)return n[0];let t=n.length;for(;t>3;){const i=t>>1;for(let r=0;r=3?n[2]:null,e)}function aye(n,e){return Math.abs(n.listHeight-e.listHeight)}function rq(n,e){return n.listHeight===e.listHeight?Jp.create23(n,e,null,!1):n.listHeight>e.listHeight?$Et(n,e):WEt(e,n)}function $Et(n,e){n=n.toMutable();let t=n;const i=[];let r;for(;;){if(e.listHeight===t.listHeight){r=e;break}if(t.kind!==4)throw new Error("unexpected");i.push(t),t=t.makeLastElementMutable()}for(let s=i.length-1;s>=0;s--){const o=i[s];r?o.childrenLength>=3?r=Jp.create23(o.unappendChild(),r,null,!1):(o.appendChildOfSameHeight(r),r=void 0):o.handleChildrenChanged()}return r?Jp.create23(n,r,null,!1):n}function WEt(n,e){n=n.toMutable();let t=n;const i=[];for(;e.listHeight!==t.listHeight;){if(t.kind!==4)throw new Error("unexpected");i.push(t),t=t.makeFirstElementMutable()}let r=e;for(let s=i.length-1;s>=0;s--){const o=i[s];r?o.childrenLength>=3?r=Jp.create23(r,o.unprependChild(),null,!1):(o.prependChildOfSameHeight(r),r=void 0):o.handleChildrenChanged()}return r?Jp.create23(r,n,null,!1):n}class HEt{constructor(e){this.lastOffset=Pl,this.nextNodes=[e],this.offsets=[Pl],this.idxs=[]}readLongestNodeAt(e,t){if(pk(e,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=e;;){const i=RT(this.nextNodes);if(!i)return;const r=RT(this.offsets);if(pk(e,r))return;if(pk(r,e))if(as(r,i.length)<=e)this.nextNodeAfterCurrent();else{const s=sq(i);s!==-1?(this.nextNodes.push(i.getChild(s)),this.offsets.push(r),this.idxs.push(s)):this.nextNodeAfterCurrent()}else{if(t(i))return this.nextNodeAfterCurrent(),i;{const s=sq(i);if(s===-1){this.nextNodeAfterCurrent();return}else this.nextNodes.push(i.getChild(s)),this.offsets.push(r),this.idxs.push(s)}}}}nextNodeAfterCurrent(){for(;;){const e=RT(this.offsets),t=RT(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),this.idxs.length===0)break;const i=RT(this.nextNodes),r=sq(i,this.idxs[this.idxs.length-1]);if(r!==-1){this.nextNodes.push(i.getChild(r)),this.offsets.push(as(e,t.length)),this.idxs[this.idxs.length-1]=r;break}else this.idxs.pop()}}}function sq(n,e=-1){for(;;){if(e++,e>=n.childrenLength)return-1;if(n.getChild(e))return e}}function RT(n){return n.length>0?n[n.length-1]:void 0}function MQ(n,e,t,i){return new VEt(n,e,t,i).parseDocument()}class VEt{constructor(e,t,i,r){if(this.tokenizer=e,this.createImmutableLists=r,this._itemsConstructed=0,this._itemsFromCache=0,i&&r)throw new Error("Not supported");this.oldNodeReader=i?new HEt(i):void 0,this.positionMapper=new IEt(t)}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let e=this.parseList(bo.getEmpty(),0);return e||(e=Jp.getEmpty()),e}parseList(e,t){const i=[];for(;;){let s=this.tryReadChildFromCache(e);if(!s){const o=this.tokenizer.peek();if(!o||o.kind===2&&o.bracketIds.intersects(e))break;s=this.parseChild(e,t+1)}s.kind===4&&s.childrenLength===0||i.push(s)}return this.oldNodeReader?BEt(i):WFe(i,this.createImmutableLists)}tryReadChildFromCache(e){if(this.oldNodeReader){const t=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(t===null||!M8(t)){const i=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),r=>t!==null&&!pk(r.length,t)?!1:r.canBeReused(e));if(i)return this._itemsFromCache++,this.tokenizer.skip(i.length),i}}}parseChild(e,t){this._itemsConstructed++;const i=this.tokenizer.read();switch(i.kind){case 2:return new PEt(i.bracketIds,i.length);case 0:return i.astNode;case 1:{if(t>300)return new fy(i.length);const r=e.merge(i.bracketIds),s=this.parseList(r,t+1),o=this.tokenizer.peek();return o&&o.kind===2&&(o.bracketId===i.bracketId||o.bracketIds.intersects(i.bracketIds))?(this.tokenizer.read(),RN.create(i.astNode,s,o.astNode)):RN.create(i.astNode,s,null)}default:throw new Error("unexpected")}}}function $8(n,e){if(n.length===0)return e;if(e.length===0)return n;const t=new q_(lye(n)),i=lye(e);i.push({modified:!1,lengthBefore:void 0,lengthAfter:void 0});let r=t.dequeue();function s(c){if(c===void 0){const d=t.takeWhile(h=>!0)||[];return r&&d.unshift(r),d}const u=[];for(;r&&!M8(c);){const[d,h]=r.splitAt(c);u.push(d),c=NN(d.lengthAfter,c),r=h??t.dequeue()}return M8(c)||u.push(new Ov(!1,c,c)),u}const o=[];function a(c,u,d){if(o.length>0&&MFe(o[o.length-1].endOffset,c)){const h=o[o.length-1];o[o.length-1]=new m_(h.startOffset,u,as(h.newLength,d))}else o.push({startOffset:c,endOffset:u,newLength:d})}let l=Pl;for(const c of i){const u=s(c.lengthBefore);if(c.modified){const d=TEt(u,f=>f.lengthBefore),h=as(l,d);a(l,h,c.lengthAfter),l=h}else for(const d of u){const h=l;l=as(l,d.lengthBefore),d.modified&&a(h,l,d.lengthAfter)}}return o}class Ov{constructor(e,t,i){this.modified=e,this.lengthBefore=t,this.lengthAfter=i}splitAt(e){const t=NN(e,this.lengthAfter);return MFe(t,Pl)?[this,void 0]:this.modified?[new Ov(this.modified,this.lengthBefore,e),new Ov(this.modified,Pl,t)]:[new Ov(this.modified,e,e),new Ov(this.modified,t,t)]}toString(){return`${this.modified?"M":"U"}:${Kd(this.lengthBefore)} -> ${Kd(this.lengthAfter)}`}}function lye(n){const e=[];let t=Pl;for(const i of n){const r=NN(t,i.startOffset);M8(r)||e.push(new Ov(!1,r,r));const s=NN(i.startOffset,i.endOffset);e.push(new Ov(!0,s,i.newLength)),t=i.endOffset}return e}class zEt extends me{didLanguageChange(e){return this.brackets.didLanguageChange(e)}constructor(e,t){if(super(),this.textModel=e,this.getLanguageConfiguration=t,this.didChangeEmitter=new fe,this.denseKeyProvider=new FFe,this.brackets=new $Fe(this.denseKeyProvider,this.getLanguageConfiguration),this.onDidChange=this.didChangeEmitter.event,this.queuedTextEditsForInitialAstWithoutTokens=[],this.queuedTextEdits=[],e.tokenization.hasTokens)e.tokenization.backgroundTokenizationState===2?(this.initialAstWithoutTokens=void 0,this.astWithTokens=this.parseDocumentFromTextBuffer([],void 0,!1)):(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer([],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens);else{const i=this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId()),r=new MEt(this.textModel.getValue(),i);this.initialAstWithoutTokens=MQ(r,[],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens}}handleDidChangeBackgroundTokenizationState(){if(this.textModel.tokenization.backgroundTokenizationState===2){const e=this.initialAstWithoutTokens===void 0;this.initialAstWithoutTokens=void 0,e||this.didChangeEmitter.fire()}}handleDidChangeTokens({ranges:e}){const t=e.map(i=>new m_(Os(i.fromLineNumber-1,0),Os(i.toLineNumber,0),Os(i.toLineNumber-i.fromLineNumber+1,0)));this.handleEdits(t,!0),this.initialAstWithoutTokens||this.didChangeEmitter.fire()}handleContentChanged(e){const t=m_.fromModelContentChanges(e.changes);this.handleEdits(t,!1)}handleEdits(e,t){const i=$8(this.queuedTextEdits,e);this.queuedTextEdits=i,this.initialAstWithoutTokens&&!t&&(this.queuedTextEditsForInitialAstWithoutTokens=$8(this.queuedTextEditsForInitialAstWithoutTokens,e))}flushQueue(){this.queuedTextEdits.length>0&&(this.astWithTokens=this.parseDocumentFromTextBuffer(this.queuedTextEdits,this.astWithTokens,!1),this.queuedTextEdits=[]),this.queuedTextEditsForInitialAstWithoutTokens.length>0&&(this.initialAstWithoutTokens&&(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer(this.queuedTextEditsForInitialAstWithoutTokens,this.initialAstWithoutTokens,!1)),this.queuedTextEditsForInitialAstWithoutTokens=[])}parseDocumentFromTextBuffer(e,t,i){const r=t,s=new BFe(this.textModel,this.brackets);return MQ(s,e,r,i)}getBracketsInRange(e,t){this.flushQueue();const i=Os(e.startLineNumber-1,e.startColumn-1),r=Os(e.endLineNumber-1,e.endColumn-1);return new T_(s=>{const o=this.initialAstWithoutTokens||this.astWithTokens;FQ(o,Pl,o.length,i,r,s,0,0,new Map,t)})}getBracketPairsInRange(e,t){this.flushQueue();const i=TS(e.getStartPosition()),r=TS(e.getEndPosition());return new T_(s=>{const o=this.initialAstWithoutTokens||this.astWithTokens,a=new UEt(s,t,this.textModel);BQ(o,Pl,o.length,i,r,a,0,new Map)})}getFirstBracketAfter(e){this.flushQueue();const t=this.initialAstWithoutTokens||this.astWithTokens;return VFe(t,Pl,t.length,TS(e))}getFirstBracketBefore(e){this.flushQueue();const t=this.initialAstWithoutTokens||this.astWithTokens;return HFe(t,Pl,t.length,TS(e))}}function HFe(n,e,t,i){if(n.kind===4||n.kind===2){const r=[];for(const s of n.children)t=as(e,s.length),r.push({nodeOffsetStart:e,nodeOffsetEnd:t}),e=t;for(let s=r.length-1;s>=0;s--){const{nodeOffsetStart:o,nodeOffsetEnd:a}=r[s];if(pk(o,i)){const l=HFe(n.children[s],o,a,i);if(l)return l}}return null}else{if(n.kind===3)return null;if(n.kind===1){const r=Xy(e,t);return{bracketInfo:n.bracketInfo,range:r}}}return null}function VFe(n,e,t,i){if(n.kind===4||n.kind===2){for(const r of n.children){if(t=as(e,r.length),pk(i,t)){const s=VFe(r,e,t,i);if(s)return s}e=t}return null}else{if(n.kind===3)return null;if(n.kind===1){const r=Xy(e,t);return{bracketInfo:n.bracketInfo,range:r}}}return null}function FQ(n,e,t,i,r,s,o,a,l,c,u=!1){if(o>200)return!0;e:for(;;)switch(n.kind){case 4:{const d=n.childrenLength;for(let h=0;h200)return!0;let l=!0;if(n.kind===2){let c=0;if(a){let h=a.get(n.openingBracket.text);h===void 0&&(h=0),c=h,h++,a.set(n.openingBracket.text,h)}const u=as(e,n.openingBracket.length);let d=-1;if(s.includeMinIndentation&&(d=n.computeMinIndentation(e,s.textModel)),l=s.push(new kEt(Xy(e,t),Xy(e,u),n.closingBracket?Xy(as(u,n.child?.length||Pl),t):void 0,o,c,n,d)),e=u,l&&n.child){const h=n.child;if(t=as(e,h.length),mk(e,r)&&ND(t,i)&&(l=BQ(h,e,t,i,r,s,o+1,a),!l))return!1}a?.set(n.openingBracket.text,c)}else{let c=e;for(const u of n.children){const d=c;if(c=as(c,u.length),mk(d,r)&&mk(i,c)&&(l=BQ(u,d,c,i,r,s,o,a),!l))return!1}}return l}class jEt extends me{get canBuildAST(){return this.textModel.getValueLength()<=5e6}constructor(e,t){super(),this.textModel=e,this.languageConfigurationService=t,this.bracketPairsTree=this._register(new To),this.onDidChangeEmitter=new fe,this.onDidChange=this.onDidChangeEmitter.event,this.bracketsRequested=!1}handleLanguageConfigurationServiceChange(e){(!e.languageId||this.bracketPairsTree.value?.object.didLanguageChange(e.languageId))&&(this.bracketPairsTree.clear(),this.updateBracketPairsTree())}handleDidChangeOptions(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeLanguage(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeContent(e){this.bracketPairsTree.value?.object.handleContentChanged(e)}handleDidChangeBackgroundTokenizationState(){this.bracketPairsTree.value?.object.handleDidChangeBackgroundTokenizationState()}handleDidChangeTokens(e){this.bracketPairsTree.value?.object.handleDidChangeTokens(e)}updateBracketPairsTree(){if(this.bracketsRequested&&this.canBuildAST){if(!this.bracketPairsTree.value){const e=new ke;this.bracketPairsTree.value=qEt(e.add(new zEt(this.textModel,t=>this.languageConfigurationService.getLanguageConfiguration(t))),e),e.add(this.bracketPairsTree.value.object.onDidChange(t=>this.onDidChangeEmitter.fire(t))),this.onDidChangeEmitter.fire()}}else this.bracketPairsTree.value&&(this.bracketPairsTree.clear(),this.onDidChangeEmitter.fire())}getBracketPairsInRange(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!1)||T_.empty}getBracketPairsInRangeWithMinIndentation(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!0)||T_.empty}getBracketsInRange(e,t=!1){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketsInRange(e,t)||T_.empty}findMatchingBracketUp(e,t,i){const r=this.textModel.validatePosition(t),s=this.textModel.getLanguageIdAtPosition(r.lineNumber,r.column);if(this.canBuildAST){const o=this.languageConfigurationService.getLanguageConfiguration(s).bracketsNew.getClosingBracketInfo(e);if(!o)return null;const a=this.getBracketPairsInRange($.fromPositions(t,t)).findLast(l=>o.closes(l.openingBracketInfo));return a?a.openingBracketRange:null}else{const o=e.toLowerCase(),a=this.languageConfigurationService.getLanguageConfiguration(s).brackets;if(!a)return null;const l=a.textIsBracket[o];return l?V4(this._findMatchingBracketUp(l,r,oq(i))):null}}matchBracket(e,t){if(this.canBuildAST){const i=this.getBracketPairsInRange($.fromPositions(e,e)).filter(r=>r.closingBracketRange!==void 0&&(r.openingBracketRange.containsPosition(e)||r.closingBracketRange.containsPosition(e))).findLastMaxBy($l(r=>r.openingBracketRange.containsPosition(e)?r.openingBracketRange:r.closingBracketRange,$.compareRangesUsingStarts));return i?[i.openingBracketRange,i.closingBracketRange]:null}else{const i=oq(t);return this._matchBracket(this.textModel.validatePosition(e),i)}}_establishBracketSearchOffsets(e,t,i,r){const s=t.getCount(),o=t.getLanguageId(r);let a=Math.max(0,e.column-1-i.maxBracketLength);for(let c=r-1;c>=0;c--){const u=t.getEndOffset(c);if(u<=a)break;if(np(t.getStandardTokenType(c))||t.getLanguageId(c)!==o){a=u;break}}let l=Math.min(t.getLineContent().length,e.column-1+i.maxBracketLength);for(let c=r+1;c=l)break;if(np(t.getStandardTokenType(c))||t.getLanguageId(c)!==o){l=u;break}}return{searchStartOffset:a,searchEndOffset:l}}_matchBracket(e,t){const i=e.lineNumber,r=this.textModel.tokenization.getLineTokens(i),s=this.textModel.getLineContent(i),o=r.findTokenIndexAtOffset(e.column-1);if(o<0)return null;const a=this.languageConfigurationService.getLanguageConfiguration(r.getLanguageId(o)).brackets;if(a&&!np(r.getStandardTokenType(o))){let{searchStartOffset:l,searchEndOffset:c}=this._establishBracketSearchOffsets(e,r,a,o),u=null;for(;;){const d=Lh.findNextBracketInRange(a.forwardRegex,i,s,l,c);if(!d)break;if(d.startColumn<=e.column&&e.column<=d.endColumn){const h=s.substring(d.startColumn-1,d.endColumn-1).toLowerCase(),f=this._matchFoundBracket(d,a.textIsBracket[h],a.textIsOpenBracket[h],t);if(f){if(f instanceof e_)return null;u=f}}l=d.endColumn-1}if(u)return u}if(o>0&&r.getStartOffset(o)===e.column-1){const l=o-1,c=this.languageConfigurationService.getLanguageConfiguration(r.getLanguageId(l)).brackets;if(c&&!np(r.getStandardTokenType(l))){const{searchStartOffset:u,searchEndOffset:d}=this._establishBracketSearchOffsets(e,r,c,l),h=Lh.findPrevBracketInRange(c.reversedRegex,i,s,u,d);if(h&&h.startColumn<=e.column&&e.column<=h.endColumn){const f=s.substring(h.startColumn-1,h.endColumn-1).toLowerCase(),g=this._matchFoundBracket(h,c.textIsBracket[f],c.textIsOpenBracket[f],t);if(g)return g instanceof e_?null:g}}}return null}_matchFoundBracket(e,t,i,r){if(!t)return null;const s=i?this._findMatchingBracketDown(t,e.getEndPosition(),r):this._findMatchingBracketUp(t,e.getStartPosition(),r);return s?s instanceof e_?s:[e,s]:null}_findMatchingBracketUp(e,t,i){const r=e.languageId,s=e.reversedRegex;let o=-1,a=0;const l=(c,u,d,h)=>{for(;;){if(i&&++a%100===0&&!i())return e_.INSTANCE;const f=Lh.findPrevBracketInRange(s,c,u,d,h);if(!f)break;const g=u.substring(f.startColumn-1,f.endColumn-1).toLowerCase();if(e.isOpen(g)?o++:e.isClose(g)&&o--,o===0)return f;h=f.startColumn-1}return null};for(let c=t.lineNumber;c>=1;c--){const u=this.textModel.tokenization.getLineTokens(c),d=u.getCount(),h=this.textModel.getLineContent(c);let f=d-1,g=h.length,p=h.length;c===t.lineNumber&&(f=u.findTokenIndexAtOffset(t.column-1),g=t.column-1,p=t.column-1);let m=!0;for(;f>=0;f--){const _=u.getLanguageId(f)===r&&!np(u.getStandardTokenType(f));if(_)m?g=u.getStartOffset(f):(g=u.getStartOffset(f),p=u.getEndOffset(f));else if(m&&g!==p){const v=l(c,h,g,p);if(v)return v}m=_}if(m&&g!==p){const _=l(c,h,g,p);if(_)return _}}return null}_findMatchingBracketDown(e,t,i){const r=e.languageId,s=e.forwardRegex;let o=1,a=0;const l=(u,d,h,f)=>{for(;;){if(i&&++a%100===0&&!i())return e_.INSTANCE;const g=Lh.findNextBracketInRange(s,u,d,h,f);if(!g)break;const p=d.substring(g.startColumn-1,g.endColumn-1).toLowerCase();if(e.isOpen(p)?o++:e.isClose(p)&&o--,o===0)return g;h=g.endColumn-1}return null},c=this.textModel.getLineCount();for(let u=t.lineNumber;u<=c;u++){const d=this.textModel.tokenization.getLineTokens(u),h=d.getCount(),f=this.textModel.getLineContent(u);let g=0,p=0,m=0;u===t.lineNumber&&(g=d.findTokenIndexAtOffset(t.column-1),p=t.column-1,m=t.column-1);let _=!0;for(;g=1;o--){const a=this.textModel.tokenization.getLineTokens(o),l=a.getCount(),c=this.textModel.getLineContent(o);let u=l-1,d=c.length,h=c.length;if(o===t.lineNumber){u=a.findTokenIndexAtOffset(t.column-1),d=t.column-1,h=t.column-1;const g=a.getLanguageId(u);i!==g&&(i=g,r=this.languageConfigurationService.getLanguageConfiguration(i).brackets,s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew)}let f=!0;for(;u>=0;u--){const g=a.getLanguageId(u);if(i!==g){if(r&&s&&f&&d!==h){const m=Lh.findPrevBracketInRange(r.reversedRegex,o,c,d,h);if(m)return this._toFoundBracket(s,m);f=!1}i=g,r=this.languageConfigurationService.getLanguageConfiguration(i).brackets,s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew}const p=!!r&&!np(a.getStandardTokenType(u));if(p)f?d=a.getStartOffset(u):(d=a.getStartOffset(u),h=a.getEndOffset(u));else if(s&&r&&f&&d!==h){const m=Lh.findPrevBracketInRange(r.reversedRegex,o,c,d,h);if(m)return this._toFoundBracket(s,m)}f=p}if(s&&r&&f&&d!==h){const g=Lh.findPrevBracketInRange(r.reversedRegex,o,c,d,h);if(g)return this._toFoundBracket(s,g)}}return null}findNextBracket(e){const t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketAfter(t)||null;const i=this.textModel.getLineCount();let r=null,s=null,o=null;for(let a=t.lineNumber;a<=i;a++){const l=this.textModel.tokenization.getLineTokens(a),c=l.getCount(),u=this.textModel.getLineContent(a);let d=0,h=0,f=0;if(a===t.lineNumber){d=l.findTokenIndexAtOffset(t.column-1),h=t.column-1,f=t.column-1;const p=l.getLanguageId(d);r!==p&&(r=p,s=this.languageConfigurationService.getLanguageConfiguration(r).brackets,o=this.languageConfigurationService.getLanguageConfiguration(r).bracketsNew)}let g=!0;for(;dp.closingBracketRange!==void 0&&p.range.strictContainsRange(f));return g?[g.openingBracketRange,g.closingBracketRange]:null}const r=oq(t),s=this.textModel.getLineCount(),o=new Map;let a=[];const l=(f,g)=>{if(!o.has(f)){const p=[];for(let m=0,_=g?g.brackets.length:0;m<_;m++)p[m]=0;o.set(f,p)}a=o.get(f)};let c=0;const u=(f,g,p,m,_)=>{for(;;){if(r&&++c%100===0&&!r())return e_.INSTANCE;const v=Lh.findNextBracketInRange(f.forwardRegex,g,p,m,_);if(!v)break;const y=p.substring(v.startColumn-1,v.endColumn-1).toLowerCase(),C=f.textIsBracket[y];if(C&&(C.isOpen(y)?a[C.index]++:C.isClose(y)&&a[C.index]--,a[C.index]===-1))return this._matchFoundBracket(v,C,!1,r);m=v.endColumn-1}return null};let d=null,h=null;for(let f=i.lineNumber;f<=s;f++){const g=this.textModel.tokenization.getLineTokens(f),p=g.getCount(),m=this.textModel.getLineContent(f);let _=0,v=0,y=0;if(f===i.lineNumber){_=g.findTokenIndexAtOffset(i.column-1),v=i.column-1,y=i.column-1;const x=g.getLanguageId(_);d!==x&&(d=x,h=this.languageConfigurationService.getLanguageConfiguration(d).brackets,l(d,h))}let C=!0;for(;_e?.dispose()}}function oq(n){if(typeof n>"u")return()=>!0;{const e=Date.now();return()=>Date.now()-e<=n}}class e_{static{this.INSTANCE=new e_}constructor(){this._searchCanceledBrand=void 0}}function V4(n){return n instanceof e_?null:n}class KEt extends me{constructor(e){super(),this.textModel=e,this.colorProvider=new zFe,this.onDidChangeEmitter=new fe,this.onDidChange=this.onDidChangeEmitter.event,this.colorizationOptions=e.getOptions().bracketPairColorizationOptions,this._register(e.bracketPairs.onDidChange(t=>{this.onDidChangeEmitter.fire()}))}handleDidChangeOptions(e){this.colorizationOptions=this.textModel.getOptions().bracketPairColorizationOptions}getDecorationsInRange(e,t,i,r){return r?[]:t===void 0?[]:this.colorizationOptions.enabled?this.textModel.bracketPairs.getBracketsInRange(e,!0).map(o=>({id:`bracket${o.range.toString()}-${o.nestingLevel}`,options:{description:"BracketPairColorization",inlineClassName:this.colorProvider.getInlineClassName(o,this.colorizationOptions.independentColorPoolPerBracketType)},ownerId:0,range:o.range})).toArray():[]}getAllDecorations(e,t){return e===void 0?[]:this.colorizationOptions.enabled?this.getDecorationsInRange(new $(1,1,this.textModel.getLineCount(),1),e,t):[]}}class zFe{constructor(){this.unexpectedClosingBracketClassName="unexpected-closing-bracket"}getInlineClassName(e,t){return e.isInvalid?this.unexpectedClosingBracketClassName:this.getInlineClassNameOfLevel(t?e.nestingLevelOfEqualBracketType:e.nestingLevel)}getInlineClassNameOfLevel(e){return`bracket-highlighting-${e%30}`}}dh((n,e)=>{const t=[IFe,AFe,NFe,RFe,PFe,OFe],i=new zFe;e.addRule(`.monaco-editor .${i.unexpectedClosingBracketClassName} { color: ${n.getColor(oEt)}; }`);const r=t.map(s=>n.getColor(s)).filter(s=>!!s).filter(s=>!s.isTransparent());for(let s=0;s<30;s++){const o=r[s%r.length];e.addRule(`.monaco-editor .${i.getInlineClassNameOfLevel(s)} { color: ${o}; }`)}});function z4(n){return n.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}class ya{get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,i,r){this.oldPosition=e,this.oldText=t,this.newPosition=i,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${z4(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${z4(this.oldText)}")`:`(replace@${this.oldPosition} "${z4(this.oldText)}" with "${z4(this.newText)}")`}static _writeStringSize(e){return 4+2*e.length}static _writeString(e,t,i){const r=t.length;Wf(e,r,i),i+=4;for(let s=0;s0&&(this.changes=GEt(this.changes,t)),this.afterEOL=i,this.afterVersionId=r,this.afterCursorState=s}static _writeSelectionsSize(e){return 4+4*4*(e?e.length:0)}static _writeSelections(e,t,i){if(Wf(e,t?t.length:0,i),i+=4,t)for(const r of t)Wf(e,r.selectionStartLineNumber,i),i+=4,Wf(e,r.selectionStartColumn,i),i+=4,Wf(e,r.positionLineNumber,i),i+=4,Wf(e,r.positionColumn,i),i+=4;return i}static _readSelections(e,t,i){const r=$f(e,t);t+=4;for(let s=0;st.toString()).join(", ")}matchesResource(e){return(Pt.isUri(this.model)?this.model:this.model.uri).toString()===e.toString()}setModel(e){this.model=e}canAppend(e){return this.model===e&&this._data instanceof Ao}append(e,t,i,r,s){this._data instanceof Ao&&this._data.append(e,t,i,r,s)}close(){this._data instanceof Ao&&(this._data=this._data.serialize())}open(){this._data instanceof Ao||(this._data=Ao.deserialize(this._data))}undo(){if(Pt.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof Ao&&(this._data=this._data.serialize());const e=Ao.deserialize(this._data);this.model._applyUndo(e.changes,e.beforeEOL,e.beforeVersionId,e.beforeCursorState)}redo(){if(Pt.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof Ao&&(this._data=this._data.serialize());const e=Ao.deserialize(this._data);this.model._applyRedo(e.changes,e.afterEOL,e.afterVersionId,e.afterCursorState)}heapSize(){return this._data instanceof Ao&&(this._data=this._data.serialize()),this._data.byteLength+168}}class YEt{get resources(){return this._editStackElementsArr.map(e=>e.resource)}constructor(e,t,i){this.label=e,this.code=t,this.type=1,this._isOpen=!0,this._editStackElementsArr=i.slice(0),this._editStackElementsMap=new Map;for(const r of this._editStackElementsArr){const s=px(r.resource);this._editStackElementsMap.set(s,r)}this._delegate=null}prepareUndoRedo(){if(this._delegate)return this._delegate.prepareUndoRedo(this)}matchesResource(e){const t=px(e);return this._editStackElementsMap.has(t)}setModel(e){const t=px(Pt.isUri(e)?e:e.uri);this._editStackElementsMap.has(t)&&this._editStackElementsMap.get(t).setModel(e)}canAppend(e){if(!this._isOpen)return!1;const t=px(e.uri);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).canAppend(e):!1}append(e,t,i,r,s){const o=px(e.uri);this._editStackElementsMap.get(o).append(e,t,i,r,s)}close(){this._isOpen=!1}open(){}undo(){this._isOpen=!1;for(const e of this._editStackElementsArr)e.undo()}redo(){for(const e of this._editStackElementsArr)e.redo()}heapSize(e){const t=px(e);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).heapSize():0}split(){return this._editStackElementsArr}toString(){const e=[];for(const t of this._editStackElementsArr)e.push(`${th(t.resource)}: ${t}`);return`{${e.join(", ")}}`}}function $Q(n){return n.getEOL()===` +`?0:1}function t_(n){return n?n instanceof UFe||n instanceof YEt:!1}class Zle{constructor(e,t){this._model=e,this._undoRedoService=t}pushStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);t_(e)&&e.close()}popStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);t_(e)&&e.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(e,t){const i=this._undoRedoService.getLastElement(this._model.uri);if(t_(i)&&i.canAppend(this._model))return i;const r=new UFe(w("edit","Typing"),"undoredo.textBufferEdit",this._model,e);return this._undoRedoService.pushElement(r,t),r}pushEOL(e){const t=this._getOrCreateEditStackElement(null,void 0);this._model.setEOL(e),t.append(this._model,[],$Q(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(e,t,i,r){const s=this._getOrCreateEditStackElement(e,r),o=this._model.applyEdits(t,!0),a=Zle._computeCursorState(i,o),l=o.map((c,u)=>({index:u,textChange:c.textChange}));return l.sort((c,u)=>c.textChange.oldPosition===u.textChange.oldPosition?c.index-u.index:c.textChange.oldPosition-u.textChange.oldPosition),s.append(this._model,l.map(c=>c.textChange),$Q(this._model),this._model.getAlternativeVersionId(),a),a}static _computeCursorState(e,t){try{return e?e(t):null}catch(i){return rn(i),null}}}class jFe extends me{constructor(){super(...arguments),this._isDisposed=!1}dispose(){super.dispose(),this._isDisposed=!0}assertNotDisposed(){if(this._isDisposed)throw new Error("TextModelPart is disposed!")}}function TW(n,e){let t=0,i=0;const r=n.length;for(;ir)throw new fi("Illegal value for lineNumber");const s=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,o=!!(s&&s.offSide);let a=-2,l=-1,c=-2,u=-1;const d=L=>{if(a!==-1&&(a===-2||a>L-1)){a=-1,l=-1;for(let D=L-2;D>=0;D--){const I=this._computeIndentLevel(D);if(I>=0){a=D,l=I;break}}}if(c===-2){c=-1,u=-1;for(let D=L;D=0){c=D,u=I;break}}}};let h=-2,f=-1,g=-2,p=-1;const m=L=>{if(h===-2){h=-1,f=-1;for(let D=L-2;D>=0;D--){const I=this._computeIndentLevel(D);if(I>=0){h=D,f=I;break}}}if(g!==-1&&(g===-2||g=0){g=D,p=I;break}}}};let _=0,v=!0,y=0,C=!0,x=0,k=0;for(let L=0;v||C;L++){const D=e-L,I=e+L;L>1&&(D<1||D1&&(I>r||I>i)&&(C=!1),L>5e4&&(v=!1,C=!1);let O=-1;if(v&&D>=1){const B=this._computeIndentLevel(D-1);B>=0?(c=D-1,u=B,O=Math.ceil(B/this.textModel.getOptions().indentSize)):(d(D),O=this._getIndentLevelForWhitespaceLine(o,l,u))}let M=-1;if(C&&I<=r){const B=this._computeIndentLevel(I-1);B>=0?(h=I-1,f=B,M=Math.ceil(B/this.textModel.getOptions().indentSize)):(m(I),M=this._getIndentLevelForWhitespaceLine(o,f,p))}if(L===0){k=O;continue}if(L===1){if(I<=r&&M>=0&&k+1===M){v=!1,_=I,y=I,x=M;continue}if(D>=1&&O>=0&&O-1===k){C=!1,_=D,y=D,x=O;continue}if(_=e,y=e,x=k,x===0)return{startLineNumber:_,endLineNumber:y,indent:x}}v&&(O>=x?_=D:v=!1),C&&(M>=x?y=I:C=!1)}return{startLineNumber:_,endLineNumber:y,indent:x}}getLinesBracketGuides(e,t,i,r){const s=[];for(let d=e;d<=t;d++)s.push([]);const o=!0,a=this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new $(e,1,t,this.textModel.getLineMaxColumn(t))).toArray();let l;if(i&&a.length>0){const d=(e<=i.lineNumber&&i.lineNumber<=t?a:this.textModel.bracketPairs.getBracketPairsInRange($.fromPositions(i)).toArray()).filter(h=>$.strictContainsPosition(h.range,i));l=hN(d,h=>o)?.range}const c=this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType,u=new qFe;for(const d of a){if(!d.closingBracketRange)continue;const h=l&&d.range.equalsRange(l);if(!h&&!r.includeInactive)continue;const f=u.getInlineClassName(d.nestingLevel,d.nestingLevelOfEqualBracketType,c)+(r.highlightActive&&h?" "+u.activeClassName:""),g=d.openingBracketRange.getStartPosition(),p=d.closingBracketRange.getStartPosition(),m=r.horizontalGuides===Qy.Enabled||r.horizontalGuides===Qy.EnabledForActive&&h;if(d.range.startLineNumber===d.range.endLineNumber){m&&s[d.range.startLineNumber-e].push(new Ny(-1,d.openingBracketRange.getEndPosition().column,f,new xI(!1,p.column),-1,-1));continue}const _=this.getVisibleColumnFromPosition(p),v=this.getVisibleColumnFromPosition(d.openingBracketRange.getStartPosition()),y=Math.min(v,_,d.minVisibleColumnIndentation+1);let C=!1;yl(this.textModel.getLineContent(d.closingBracketRange.startLineNumber))=e&&v>y&&s[g.lineNumber-e].push(new Ny(y,-1,f,new xI(!1,g.column),-1,-1)),p.lineNumber<=t&&_>y&&s[p.lineNumber-e].push(new Ny(y,-1,f,new xI(!C,p.column),-1,-1)))}for(const d of s)d.sort((h,f)=>h.visibleColumn-f.visibleColumn);return s}getVisibleColumnFromPosition(e){return co.visibleColumnFromColumn(this.textModel.getLineContent(e.lineNumber),e.column,this.textModel.getOptions().tabSize)+1}getLinesIndentGuides(e,t){this.assertNotDisposed();const i=this.textModel.getLineCount();if(e<1||e>i)throw new Error("Illegal value for startLineNumber");if(t<1||t>i)throw new Error("Illegal value for endLineNumber");const r=this.textModel.getOptions(),s=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,o=!!(s&&s.offSide),a=new Array(t-e+1);let l=-2,c=-1,u=-2,d=-1;for(let h=e;h<=t;h++){const f=h-e,g=this._computeIndentLevel(h-1);if(g>=0){l=h-1,c=g,a[f]=Math.ceil(g/r.indentSize);continue}if(l===-2){l=-1,c=-1;for(let p=h-2;p>=0;p--){const m=this._computeIndentLevel(p);if(m>=0){l=p,c=m;break}}}if(u!==-1&&(u===-2||u=0){u=p,d=m;break}}}a[f]=this._getIndentLevelForWhitespaceLine(o,c,d)}return a}_getIndentLevelForWhitespaceLine(e,t,i){const r=this.textModel.getOptions();return t===-1||i===-1?0:t0&&a>0||l>0&&c>0)return;const u=Math.abs(a-c),d=Math.abs(o-l);if(u===0){r.spacesDiff=d,d>0&&0<=l-1&&l-10?r++:C>1&&s++,QEt(o,a,m,y,d),d.looksLikeAlignment&&!(t&&e===d.spacesDiff)))continue;const k=d.spacesDiff;k<=c&&u[k]++,o=m,a=y}let h=t;r!==s&&(h=r{const m=u[p];m>g&&(g=m,f=p)}),f===4&&u[4]>0&&u[2]>0&&u[2]>=u[4]/2&&(f=2)}return{insertSpaces:h,tabSize:f}}function rc(n){return(n.metadata&1)>>>0}function Lr(n,e){n.metadata=n.metadata&254|e<<0}function Ea(n){return(n.metadata&2)>>>1===1}function Cr(n,e){n.metadata=n.metadata&253|(e?1:0)<<1}function KFe(n){return(n.metadata&4)>>>2===1}function uye(n,e){n.metadata=n.metadata&251|(e?1:0)<<2}function GFe(n){return(n.metadata&64)>>>6===1}function dye(n,e){n.metadata=n.metadata&191|(e?1:0)<<6}function JEt(n){return(n.metadata&24)>>>3}function hye(n,e){n.metadata=n.metadata&231|e<<3}function eLt(n){return(n.metadata&32)>>>5===1}function fye(n,e){n.metadata=n.metadata&223|(e?1:0)<<5}class YFe{constructor(e,t,i){this.metadata=0,this.parent=this,this.left=this,this.right=this,Lr(this,1),this.start=t,this.end=i,this.delta=0,this.maxEnd=i,this.id=e,this.ownerId=0,this.options=null,uye(this,!1),dye(this,!1),hye(this,1),fye(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=null,Cr(this,!1)}reset(e,t,i,r){this.start=t,this.end=i,this.maxEnd=i,this.cachedVersionId=e,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=r}setOptions(e){this.options=e;const t=this.options.className;uye(this,t==="squiggly-error"||t==="squiggly-warning"||t==="squiggly-info"),dye(this,this.options.glyphMarginClassName!==null),hye(this,this.options.stickiness),fye(this,this.options.collapseOnReplaceEdit)}setCachedOffsets(e,t,i){this.cachedVersionId!==i&&(this.range=null),this.cachedVersionId=i,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t}detach(){this.parent=null,this.left=null,this.right=null}}const Nn=new YFe(null,0,0);Nn.parent=Nn;Nn.left=Nn;Nn.right=Nn;Lr(Nn,0);class aq{constructor(){this.root=Nn,this.requestNormalizeDelta=!1}intervalSearch(e,t,i,r,s,o){return this.root===Nn?[]:lLt(this,e,t,i,r,s,o)}search(e,t,i,r){return this.root===Nn?[]:aLt(this,e,t,i,r)}collectNodesFromOwner(e){return sLt(this,e)}collectNodesPostOrder(){return oLt(this)}insert(e){gye(this,e),this._normalizeDeltaIfNecessary()}delete(e){pye(this,e),this._normalizeDeltaIfNecessary()}resolveNode(e,t){const i=e;let r=0;for(;e!==this.root;)e===e.parent.right&&(r+=e.parent.delta),e=e.parent;const s=i.start+r,o=i.end+r;i.setCachedOffsets(s,o,t)}acceptReplace(e,t,i,r){const s=iLt(this,e,e+t);for(let o=0,a=s.length;ot||i===1?!1:i===2?!0:e}function nLt(n,e,t,i,r){const s=JEt(n),o=s===0||s===2,a=s===1||s===2,l=t-e,c=i,u=Math.min(l,c),d=n.start;let h=!1;const f=n.end;let g=!1;e<=d&&f<=t&&eLt(n)&&(n.start=e,h=!0,n.end=e,g=!0);{const m=r?1:l>0?2:0;!h&&mx(d,o,e,m)&&(h=!0),!g&&mx(f,a,e,m)&&(g=!0)}if(u>0&&!r){const m=l>c?2:0;!h&&mx(d,o,e+u,m)&&(h=!0),!g&&mx(f,a,e+u,m)&&(g=!0)}{const m=r?1:0;!h&&mx(d,o,t,m)&&(n.start=e+c,h=!0),!g&&mx(f,a,t,m)&&(n.end=e+c,g=!0)}const p=c-l;h||(n.start=Math.max(0,d+p)),g||(n.end=Math.max(0,f+p)),n.start>n.end&&(n.end=n.start)}function iLt(n,e,t){let i=n.root,r=0,s=0,o=0,a=0;const l=[];let c=0;for(;i!==Nn;){if(Ea(i)){Cr(i.left,!1),Cr(i.right,!1),i===i.parent.right&&(r-=i.parent.delta),i=i.parent;continue}if(!Ea(i.left)){if(s=r+i.maxEnd,st){Cr(i,!0);continue}if(a=r+i.end,a>=e&&(i.setCachedOffsets(o,a,0),l[c++]=i),Cr(i,!0),i.right!==Nn&&!Ea(i.right)){r+=i.delta,i=i.right;continue}}return Cr(n.root,!1),l}function rLt(n,e,t,i){let r=n.root,s=0,o=0,a=0;const l=i-(t-e);for(;r!==Nn;){if(Ea(r)){Cr(r.left,!1),Cr(r.right,!1),r===r.parent.right&&(s-=r.parent.delta),Ib(r),r=r.parent;continue}if(!Ea(r.left)){if(o=s+r.maxEnd,ot){r.start+=l,r.end+=l,r.delta+=l,(r.delta<-1073741824||r.delta>1073741824)&&(n.requestNormalizeDelta=!0),Cr(r,!0);continue}if(Cr(r,!0),r.right!==Nn&&!Ea(r.right)){s+=r.delta,r=r.right;continue}}Cr(n.root,!1)}function sLt(n,e){let t=n.root;const i=[];let r=0;for(;t!==Nn;){if(Ea(t)){Cr(t.left,!1),Cr(t.right,!1),t=t.parent;continue}if(t.left!==Nn&&!Ea(t.left)){t=t.left;continue}if(t.ownerId===e&&(i[r++]=t),Cr(t,!0),t.right!==Nn&&!Ea(t.right)){t=t.right;continue}}return Cr(n.root,!1),i}function oLt(n){let e=n.root;const t=[];let i=0;for(;e!==Nn;){if(Ea(e)){Cr(e.left,!1),Cr(e.right,!1),e=e.parent;continue}if(e.left!==Nn&&!Ea(e.left)){e=e.left;continue}if(e.right!==Nn&&!Ea(e.right)){e=e.right;continue}t[i++]=e,Cr(e,!0)}return Cr(n.root,!1),t}function aLt(n,e,t,i,r){let s=n.root,o=0,a=0,l=0;const c=[];let u=0;for(;s!==Nn;){if(Ea(s)){Cr(s.left,!1),Cr(s.right,!1),s===s.parent.right&&(o-=s.parent.delta),s=s.parent;continue}if(s.left!==Nn&&!Ea(s.left)){s=s.left;continue}a=o+s.start,l=o+s.end,s.setCachedOffsets(a,l,i);let d=!0;if(e&&s.ownerId&&s.ownerId!==e&&(d=!1),t&&KFe(s)&&(d=!1),r&&!GFe(s)&&(d=!1),d&&(c[u++]=s),Cr(s,!0),s.right!==Nn&&!Ea(s.right)){o+=s.delta,s=s.right;continue}}return Cr(n.root,!1),c}function lLt(n,e,t,i,r,s,o){let a=n.root,l=0,c=0,u=0,d=0;const h=[];let f=0;for(;a!==Nn;){if(Ea(a)){Cr(a.left,!1),Cr(a.right,!1),a===a.parent.right&&(l-=a.parent.delta),a=a.parent;continue}if(!Ea(a.left)){if(c=l+a.maxEnd,ct){Cr(a,!0);continue}if(d=l+a.end,d>=e){a.setCachedOffsets(u,d,s);let g=!0;i&&a.ownerId&&a.ownerId!==i&&(g=!1),r&&KFe(a)&&(g=!1),o&&!GFe(a)&&(g=!1),g&&(h[f++]=a)}if(Cr(a,!0),a.right!==Nn&&!Ea(a.right)){l+=a.delta,a=a.right;continue}}return Cr(n.root,!1),h}function gye(n,e){if(n.root===Nn)return e.parent=Nn,e.left=Nn,e.right=Nn,Lr(e,0),n.root=e,n.root;cLt(n,e),X0(e.parent);let t=e;for(;t!==n.root&&rc(t.parent)===1;)if(t.parent===t.parent.parent.left){const i=t.parent.parent.right;rc(i)===1?(Lr(t.parent,0),Lr(i,0),Lr(t.parent.parent,1),t=t.parent.parent):(t===t.parent.right&&(t=t.parent,SI(n,t)),Lr(t.parent,0),Lr(t.parent.parent,1),kI(n,t.parent.parent))}else{const i=t.parent.parent.left;rc(i)===1?(Lr(t.parent,0),Lr(i,0),Lr(t.parent.parent,1),t=t.parent.parent):(t===t.parent.left&&(t=t.parent,kI(n,t)),Lr(t.parent,0),Lr(t.parent.parent,1),SI(n,t.parent.parent))}return Lr(n.root,0),e}function cLt(n,e){let t=0,i=n.root;const r=e.start,s=e.end;for(;;)if(dLt(r,s,i.start+t,i.end+t)<0)if(i.left===Nn){e.start-=t,e.end-=t,e.maxEnd-=t,i.left=e;break}else i=i.left;else if(i.right===Nn){e.start-=t+i.delta,e.end-=t+i.delta,e.maxEnd-=t+i.delta,i.right=e;break}else t+=i.delta,i=i.right;e.parent=i,e.left=Nn,e.right=Nn,Lr(e,1)}function pye(n,e){let t,i;if(e.left===Nn?(t=e.right,i=e,t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(n.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta):e.right===Nn?(t=e.left,i=e):(i=uLt(e.right),t=i.right,t.start+=i.delta,t.end+=i.delta,t.delta+=i.delta,(t.delta<-1073741824||t.delta>1073741824)&&(n.requestNormalizeDelta=!0),i.start+=e.delta,i.end+=e.delta,i.delta=e.delta,(i.delta<-1073741824||i.delta>1073741824)&&(n.requestNormalizeDelta=!0)),i===n.root){n.root=t,Lr(t,0),e.detach(),lq(),Ib(t),n.root.parent=Nn;return}const r=rc(i)===1;if(i===i.parent.left?i.parent.left=t:i.parent.right=t,i===e?t.parent=i.parent:(i.parent===e?t.parent=i:t.parent=i.parent,i.left=e.left,i.right=e.right,i.parent=e.parent,Lr(i,rc(e)),e===n.root?n.root=i:e===e.parent.left?e.parent.left=i:e.parent.right=i,i.left!==Nn&&(i.left.parent=i),i.right!==Nn&&(i.right.parent=i)),e.detach(),r){X0(t.parent),i!==e&&(X0(i),X0(i.parent)),lq();return}X0(t),X0(t.parent),i!==e&&(X0(i),X0(i.parent));let s;for(;t!==n.root&&rc(t)===0;)t===t.parent.left?(s=t.parent.right,rc(s)===1&&(Lr(s,0),Lr(t.parent,1),SI(n,t.parent),s=t.parent.right),rc(s.left)===0&&rc(s.right)===0?(Lr(s,1),t=t.parent):(rc(s.right)===0&&(Lr(s.left,0),Lr(s,1),kI(n,s),s=t.parent.right),Lr(s,rc(t.parent)),Lr(t.parent,0),Lr(s.right,0),SI(n,t.parent),t=n.root)):(s=t.parent.left,rc(s)===1&&(Lr(s,0),Lr(t.parent,1),kI(n,t.parent),s=t.parent.left),rc(s.left)===0&&rc(s.right)===0?(Lr(s,1),t=t.parent):(rc(s.left)===0&&(Lr(s.right,0),Lr(s,1),SI(n,s),s=t.parent.left),Lr(s,rc(t.parent)),Lr(t.parent,0),Lr(s.left,0),kI(n,t.parent),t=n.root));Lr(t,0),lq()}function uLt(n){for(;n.left!==Nn;)n=n.left;return n}function lq(){Nn.parent=Nn,Nn.delta=0,Nn.start=0,Nn.end=0}function SI(n,e){const t=e.right;t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(n.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta,e.right=t.left,t.left!==Nn&&(t.left.parent=e),t.parent=e.parent,e.parent===Nn?n.root=t:e===e.parent.left?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t,Ib(e),Ib(t)}function kI(n,e){const t=e.left;e.delta-=t.delta,(e.delta<-1073741824||e.delta>1073741824)&&(n.requestNormalizeDelta=!0),e.start-=t.delta,e.end-=t.delta,e.left=t.right,t.right!==Nn&&(t.right.parent=e),t.parent=e.parent,e.parent===Nn?n.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t,Ib(e),Ib(t)}function ZFe(n){let e=n.end;if(n.left!==Nn){const t=n.left.maxEnd;t>e&&(e=t)}if(n.right!==Nn){const t=n.right.maxEnd+n.delta;t>e&&(e=t)}return e}function Ib(n){n.maxEnd=ZFe(n)}function X0(n){for(;n!==Nn;){const e=ZFe(n);if(n.maxEnd===e)return;n.maxEnd=e,n=n.parent}}function dLt(n,e,t,i){return n===t?e-i:n-t}class WQ{constructor(e,t){this.piece=e,this.color=t,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==mn)return Xle(this.right);let e=this;for(;e.parent!==mn&&e.parent.left!==e;)e=e.parent;return e.parent===mn?mn:e.parent}prev(){if(this.left!==mn)return XFe(this.left);let e=this;for(;e.parent!==mn&&e.parent.right!==e;)e=e.parent;return e.parent===mn?mn:e.parent}detach(){this.parent=null,this.left=null,this.right=null}}const mn=new WQ(null,0);mn.parent=mn;mn.left=mn;mn.right=mn;mn.color=0;function Xle(n){for(;n.left!==mn;)n=n.left;return n}function XFe(n){for(;n.right!==mn;)n=n.right;return n}function Qle(n){return n===mn?0:n.size_left+n.piece.length+Qle(n.right)}function Jle(n){return n===mn?0:n.lf_left+n.piece.lineFeedCnt+Jle(n.right)}function cq(){mn.parent=mn}function EI(n,e){const t=e.right;t.size_left+=e.size_left+(e.piece?e.piece.length:0),t.lf_left+=e.lf_left+(e.piece?e.piece.lineFeedCnt:0),e.right=t.left,t.left!==mn&&(t.left.parent=e),t.parent=e.parent,e.parent===mn?n.root=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}function LI(n,e){const t=e.left;e.left=t.right,t.right!==mn&&(t.right.parent=e),t.parent=e.parent,e.size_left-=t.size_left+(t.piece?t.piece.length:0),e.lf_left-=t.lf_left+(t.piece?t.piece.lineFeedCnt:0),e.parent===mn?n.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}function U4(n,e){let t,i;if(e.left===mn?(i=e,t=i.right):e.right===mn?(i=e,t=i.left):(i=Xle(e.right),t=i.right),i===n.root){n.root=t,t.color=0,e.detach(),cq(),n.root.parent=mn;return}const r=i.color===1;if(i===i.parent.left?i.parent.left=t:i.parent.right=t,i===e?(t.parent=i.parent,RD(n,t)):(i.parent===e?t.parent=i:t.parent=i.parent,RD(n,t),i.left=e.left,i.right=e.right,i.parent=e.parent,i.color=e.color,e===n.root?n.root=i:e===e.parent.left?e.parent.left=i:e.parent.right=i,i.left!==mn&&(i.left.parent=i),i.right!==mn&&(i.right.parent=i),i.size_left=e.size_left,i.lf_left=e.lf_left,RD(n,i)),e.detach(),t.parent.left===t){const o=Qle(t),a=Jle(t);if(o!==t.parent.size_left||a!==t.parent.lf_left){const l=o-t.parent.size_left,c=a-t.parent.lf_left;t.parent.size_left=o,t.parent.lf_left=a,$m(n,t.parent,l,c)}}if(RD(n,t.parent),r){cq();return}let s;for(;t!==n.root&&t.color===0;)t===t.parent.left?(s=t.parent.right,s.color===1&&(s.color=0,t.parent.color=1,EI(n,t.parent),s=t.parent.right),s.left.color===0&&s.right.color===0?(s.color=1,t=t.parent):(s.right.color===0&&(s.left.color=0,s.color=1,LI(n,s),s=t.parent.right),s.color=t.parent.color,t.parent.color=0,s.right.color=0,EI(n,t.parent),t=n.root)):(s=t.parent.left,s.color===1&&(s.color=0,t.parent.color=1,LI(n,t.parent),s=t.parent.left),s.left.color===0&&s.right.color===0?(s.color=1,t=t.parent):(s.left.color===0&&(s.right.color=0,s.color=1,EI(n,s),s=t.parent.left),s.color=t.parent.color,t.parent.color=0,s.left.color=0,LI(n,t.parent),t=n.root));t.color=0,cq()}function mye(n,e){for(RD(n,e);e!==n.root&&e.parent.color===1;)if(e.parent===e.parent.parent.left){const t=e.parent.parent.right;t.color===1?(e.parent.color=0,t.color=0,e.parent.parent.color=1,e=e.parent.parent):(e===e.parent.right&&(e=e.parent,EI(n,e)),e.parent.color=0,e.parent.parent.color=1,LI(n,e.parent.parent))}else{const t=e.parent.parent.left;t.color===1?(e.parent.color=0,t.color=0,e.parent.parent.color=1,e=e.parent.parent):(e===e.parent.left&&(e=e.parent,LI(n,e)),e.parent.color=0,e.parent.parent.color=1,EI(n,e.parent.parent))}n.root.color=0}function $m(n,e,t,i){for(;e!==n.root&&e!==mn;)e.parent.left===e&&(e.parent.size_left+=t,e.parent.lf_left+=i),e=e.parent}function RD(n,e){let t=0,i=0;if(e!==n.root){for(;e!==n.root&&e===e.parent.right;)e=e.parent;if(e!==n.root)for(e=e.parent,t=Qle(e.left)-e.size_left,i=Jle(e.left)-e.lf_left,e.size_left+=t,e.lf_left+=i;e!==n.root&&(t!==0||i!==0);)e.parent.left===e&&(e.parent.size_left+=t,e.parent.lf_left+=i),e=e.parent}}const Am=65535;function QFe(n){let e;return n[n.length-1]<65536?e=new Uint16Array(n.length):e=new Uint32Array(n.length),e.set(n,0),e}class hLt{constructor(e,t,i,r,s){this.lineStarts=e,this.cr=t,this.lf=i,this.crlf=r,this.isBasicASCII=s}}function Vm(n,e=!0){const t=[0];let i=1;for(let r=0,s=n.length;r126)&&(o=!1)}const a=new hLt(QFe(n),i,r,s,o);return n.length=0,a}class Wc{constructor(e,t,i,r,s){this.bufferIndex=e,this.start=t,this.end=i,this.lineFeedCnt=r,this.length=s}}class gy{constructor(e,t){this.buffer=e,this.lineStarts=t}}class gLt{constructor(e,t){this._pieces=[],this._tree=e,this._BOM=t,this._index=0,e.root!==mn&&e.iterate(e.root,i=>(i!==mn&&this._pieces.push(i.piece),!0))}read(){return this._pieces.length===0?this._index===0?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:this._index===0?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}}class pLt{constructor(e){this._limit=e,this._cache=[]}get(e){for(let t=this._cache.length-1;t>=0;t--){const i=this._cache[t];if(i.nodeStartOffset<=e&&i.nodeStartOffset+i.node.piece.length>=e)return i}return null}get2(e){for(let t=this._cache.length-1;t>=0;t--){const i=this._cache[t];if(i.nodeStartLineNumber&&i.nodeStartLineNumber=e)return i}return null}set(e){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(e)}validate(e){let t=!1;const i=this._cache;for(let r=0;r=e){i[r]=null,t=!0;continue}}if(t){const r=[];for(const s of i)s!==null&&r.push(s);this._cache=r}}}class mLt{constructor(e,t,i){this.create(e,t,i)}create(e,t,i){this._buffers=[new gy("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=mn,this._lineCnt=1,this._length=0,this._EOL=t,this._EOLLength=t.length,this._EOLNormalized=i;let r=null;for(let s=0,o=e.length;s0){e[s].lineStarts||(e[s].lineStarts=Vm(e[s].buffer));const a=new Wc(s+1,{line:0,column:0},{line:e[s].lineStarts.length-1,column:e[s].buffer.length-e[s].lineStarts[e[s].lineStarts.length-1]},e[s].lineStarts.length-1,e[s].buffer.length);this._buffers.push(e[s]),r=this.rbInsertRight(r,a)}this._searchCache=new pLt(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(e){const t=Am,i=t-Math.floor(t/3),r=i*2;let s="",o=0;const a=[];if(this.iterate(this.root,l=>{const c=this.getNodeContent(l),u=c.length;if(o<=i||o+u0){const l=s.replace(/\r\n|\r|\n/g,e);a.push(new gy(l,Vm(l)))}this.create(a,e,!0)}getEOL(){return this._EOL}setEOL(e){this._EOL=e,this._EOLLength=this._EOL.length,this.normalizeEOL(e)}createSnapshot(e){return new gLt(this,e)}getOffsetAt(e,t){let i=0,r=this.root;for(;r!==mn;)if(r.left!==mn&&r.lf_left+1>=e)r=r.left;else if(r.lf_left+r.piece.lineFeedCnt+1>=e){i+=r.size_left;const s=this.getAccumulatedValue(r,e-r.lf_left-2);return i+=s+t-1}else e-=r.lf_left+r.piece.lineFeedCnt,i+=r.size_left+r.piece.length,r=r.right;return i}getPositionAt(e){e=Math.floor(e),e=Math.max(0,e);let t=this.root,i=0;const r=e;for(;t!==mn;)if(t.size_left!==0&&t.size_left>=e)t=t.left;else if(t.size_left+t.piece.length>=e){const s=this.getIndexOf(t,e-t.size_left);if(i+=t.lf_left+s.index,s.index===0){const o=this.getOffsetAt(i+1,1),a=r-o;return new he(i+1,a+1)}return new he(i+1,s.remainder+1)}else if(e-=t.size_left+t.piece.length,i+=t.lf_left+t.piece.lineFeedCnt,t.right===mn){const s=this.getOffsetAt(i+1,1),o=r-e-s;return new he(i+1,o+1)}else t=t.right;return new he(1,1)}getValueInRange(e,t){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return"";const i=this.nodeAt2(e.startLineNumber,e.startColumn),r=this.nodeAt2(e.endLineNumber,e.endColumn),s=this.getValueInRange2(i,r);return t?t!==this._EOL||!this._EOLNormalized?s.replace(/\r\n|\r|\n/g,t):t===this.getEOL()&&this._EOLNormalized?s:s.replace(/\r\n|\r|\n/g,t):s}getValueInRange2(e,t){if(e.node===t.node){const a=e.node,l=this._buffers[a.piece.bufferIndex].buffer,c=this.offsetInBuffer(a.piece.bufferIndex,a.piece.start);return l.substring(c+e.remainder,c+t.remainder)}let i=e.node;const r=this._buffers[i.piece.bufferIndex].buffer,s=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);let o=r.substring(s+e.remainder,s+i.piece.length);for(i=i.next();i!==mn;){const a=this._buffers[i.piece.bufferIndex].buffer,l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(i===t.node){o+=a.substring(l,l+t.remainder);break}else o+=a.substr(l,i.piece.length);i=i.next()}return o}getLinesContent(){const e=[];let t=0,i="",r=!1;return this.iterate(this.root,s=>{if(s===mn)return!0;const o=s.piece;let a=o.length;if(a===0)return!0;const l=this._buffers[o.bufferIndex].buffer,c=this._buffers[o.bufferIndex].lineStarts,u=o.start.line,d=o.end.line;let h=c[u]+o.start.column;if(r&&(l.charCodeAt(h)===10&&(h++,a--),e[t++]=i,i="",r=!1,a===0))return!0;if(u===d)return!this._EOLNormalized&&l.charCodeAt(h+a-1)===13?(r=!0,i+=l.substr(h,a-1)):i+=l.substr(h,a),!0;i+=this._EOLNormalized?l.substring(h,Math.max(h,c[u+1]-this._EOLLength)):l.substring(h,c[u+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;for(let f=u+1;fC+g,t.reset(0)):(v=h.buffer,y=C=>C,t.reset(g));do if(m=t.next(v),m){if(y(m.index)>=p)return u;this.positionInBuffer(e,y(m.index)-f,_);const C=this.getLineFeedCnt(e.piece.bufferIndex,s,_),x=_.line===s.line?_.column-s.column+r:_.column+1,k=x+m[0].length;if(d[u++]=ly(new $(i+C,x,i+C,k),m,l),y(m.index)+m[0].length>=p||u>=c)return u}while(m);return u}findMatchesLineByLine(e,t,i,r){const s=[];let o=0;const a=new CS(t.wordSeparators,t.regex);let l=this.nodeAt2(e.startLineNumber,e.startColumn);if(l===null)return[];const c=this.nodeAt2(e.endLineNumber,e.endColumn);if(c===null)return[];let u=this.positionInBuffer(l.node,l.remainder);const d=this.positionInBuffer(c.node,c.remainder);if(l.node===c.node)return this.findMatchesInNode(l.node,a,e.startLineNumber,e.startColumn,u,d,t,i,r,o,s),s;let h=e.startLineNumber,f=l.node;for(;f!==c.node;){const p=this.getLineFeedCnt(f.piece.bufferIndex,u,f.piece.end);if(p>=1){const _=this._buffers[f.piece.bufferIndex].lineStarts,v=this.offsetInBuffer(f.piece.bufferIndex,f.piece.start),y=_[u.line+p],C=h===e.startLineNumber?e.startColumn:1;if(o=this.findMatchesInNode(f,a,h,C,u,this.positionInBuffer(f,y-v),t,i,r,o,s),o>=r)return s;h+=p}const m=h===e.startLineNumber?e.startColumn-1:0;if(h===e.endLineNumber){const _=this.getLineContent(h).substring(m,e.endColumn-1);return o=this._findMatchesInLine(t,a,_,e.endLineNumber,m,o,s,i,r),s}if(o=this._findMatchesInLine(t,a,this.getLineContent(h).substr(m),h,m,o,s,i,r),o>=r)return s;h++,l=this.nodeAt2(h,1),f=l.node,u=this.positionInBuffer(l.node,l.remainder)}if(h===e.endLineNumber){const p=h===e.startLineNumber?e.startColumn-1:0,m=this.getLineContent(h).substring(p,e.endColumn-1);return o=this._findMatchesInLine(t,a,m,e.endLineNumber,p,o,s,i,r),s}const g=h===e.startLineNumber?e.startColumn:1;return o=this.findMatchesInNode(c.node,a,h,g,u,d,t,i,r,o,s),s}_findMatchesInLine(e,t,i,r,s,o,a,l,c){const u=e.wordSeparators;if(!l&&e.simpleSearch){const h=e.simpleSearch,f=h.length,g=i.length;let p=-f;for(;(p=i.indexOf(h,p+f))!==-1;)if((!u||Qae(u,i,g,p,f))&&(a[o++]=new dN(new $(r,p+1+s,r,p+1+f+s),null),o>=c))return o;return o}let d;t.reset(0);do if(d=t.next(i),d&&(a[o++]=ly(new $(r,d.index+1+s,r,d.index+1+d[0].length+s),d,l),o>=c))return o;while(d);return o}insert(e,t,i=!1){if(this._EOLNormalized=this._EOLNormalized&&i,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==mn){const{node:r,remainder:s,nodeStartOffset:o}=this.nodeAt(e),a=r.piece,l=a.bufferIndex,c=this.positionInBuffer(r,s);if(r.piece.bufferIndex===0&&a.end.line===this._lastChangeBufferPos.line&&a.end.column===this._lastChangeBufferPos.column&&o+a.length===e&&t.lengthe){const u=[];let d=new Wc(a.bufferIndex,c,a.end,this.getLineFeedCnt(a.bufferIndex,c,a.end),this.offsetInBuffer(l,a.end)-this.offsetInBuffer(l,c));if(this.shouldCheckCRLF()&&this.endWithCR(t)&&this.nodeCharCodeAt(r,s)===10){const p={line:d.start.line+1,column:0};d=new Wc(d.bufferIndex,p,d.end,this.getLineFeedCnt(d.bufferIndex,p,d.end),d.length-1),t+=` `}if(this.shouldCheckCRLF()&&this.startWithLF(t))if(this.nodeCharCodeAt(r,s-1)===13){const p=this.positionInBuffer(r,s-1);this.deleteNodeTail(r,p),t="\r"+t,r.piece.length===0&&u.push(r)}else this.deleteNodeTail(r,c);else this.deleteNodeTail(r,c);const h=this.createNewPieces(t);d.length>0&&this.rbInsertRight(r,d);let f=r;for(let g=0;g=0;o--)s=this.rbInsertLeft(s,r[o]);this.validateCRLFWithPrevNode(s),this.deleteNodes(i)}insertContentToNodeRight(e,t){this.adjustCarriageReturnFromNext(e,t)&&(e+=` `);const i=this.createNewPieces(e),r=this.rbInsertRight(t,i[0]);let s=r;for(let o=1;o=h)c=d+1;else break;return i?(i.line=d,i.column=l-f,null):{line:d,column:l-f}}getLineFeedCnt(e,t,i){if(i.column===0)return i.line-t.line;const r=this._buffers[e].lineStarts;if(i.line===r.length-1)return i.line-t.line;const s=r[i.line+1],o=r[i.line]+i.column;if(s>o+1)return i.line-t.line;const a=o-1;return this._buffers[e].buffer.charCodeAt(a)===13?i.line-t.line+1:i.line-t.line}offsetInBuffer(e,t){return this._buffers[e].lineStarts[t.line]+t.column}deleteNodes(e){for(let t=0;tAm){const u=[];for(;e.length>Am;){const h=e.charCodeAt(Am-1);let f;h===13||h>=55296&&h<=56319?(f=e.substring(0,Am-1),e=e.substring(Am-1)):(f=e.substring(0,Am),e=e.substring(Am));const g=Vm(f);u.push(new Wc(this._buffers.length,{line:0,column:0},{line:g.length-1,column:f.length-g[g.length-1]},g.length-1,f.length)),this._buffers.push(new gy(f,g))}const d=Vm(e);return u.push(new Wc(this._buffers.length,{line:0,column:0},{line:d.length-1,column:e.length-d[d.length-1]},d.length-1,e.length)),this._buffers.push(new gy(e,d)),u}let t=this._buffers[0].buffer.length;const i=Vm(e,!1);let r=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===t&&t!==0&&this.startWithLF(e)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},r=this._lastChangeBufferPos;for(let u=0;u=e-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>e-1){const l=this.getAccumulatedValue(i,e-i.lf_left-2),c=this.getAccumulatedValue(i,e-i.lf_left-1),u=this._buffers[i.piece.bufferIndex].buffer,d=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return o+=i.size_left,this._searchCache.set({node:i,nodeStartOffset:o,nodeStartLineNumber:a-(e-1-i.lf_left)}),u.substring(d+l,d+c-t)}else if(i.lf_left+i.piece.lineFeedCnt===e-1){const l=this.getAccumulatedValue(i,e-i.lf_left-2),c=this._buffers[i.piece.bufferIndex].buffer,u=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);r=c.substring(u+l,u+i.piece.length);break}else e-=i.lf_left+i.piece.lineFeedCnt,o+=i.size_left+i.piece.length,i=i.right}for(i=i.next();i!==mn;){const o=this._buffers[i.piece.bufferIndex].buffer;if(i.piece.lineFeedCnt>0){const a=this.getAccumulatedValue(i,0),l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return r+=o.substring(l,l+a-t),r}else{const a=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);r+=o.substr(a,i.piece.length)}i=i.next()}return r}computeBufferMetadata(){let e=this.root,t=1,i=0;for(;e!==mn;)t+=e.lf_left+e.piece.lineFeedCnt,i+=e.size_left+e.piece.length,e=e.right;this._lineCnt=t,this._length=i,this._searchCache.validate(this._length)}getIndexOf(e,t){const i=e.piece,r=this.positionInBuffer(e,t),s=r.line-i.start.line;if(this.offsetInBuffer(i.bufferIndex,i.end)-this.offsetInBuffer(i.bufferIndex,i.start)===t){const o=this.getLineFeedCnt(e.piece.bufferIndex,i.start,r);if(o!==s)return{index:o,remainder:0}}return{index:s,remainder:r.column}}getAccumulatedValue(e,t){if(t<0)return 0;const i=e.piece,r=this._buffers[i.bufferIndex].lineStarts,s=i.start.line+t+1;return s>i.end.line?r[i.end.line]+i.end.column-r[i.start.line]-i.start.column:r[s]-r[i.start.line]-i.start.column}deleteNodeTail(e,t){const i=e.piece,r=i.lineFeedCnt,s=this.offsetInBuffer(i.bufferIndex,i.end),o=t,a=this.offsetInBuffer(i.bufferIndex,o),l=this.getLineFeedCnt(i.bufferIndex,i.start,o),c=l-r,u=a-s,d=i.length+u;e.piece=new Wc(i.bufferIndex,i.start,o,l,d),$m(this,e,u,c)}deleteNodeHead(e,t){const i=e.piece,r=i.lineFeedCnt,s=this.offsetInBuffer(i.bufferIndex,i.start),o=t,a=this.getLineFeedCnt(i.bufferIndex,o,i.end),l=this.offsetInBuffer(i.bufferIndex,o),c=a-r,u=s-l,d=i.length+u;e.piece=new Wc(i.bufferIndex,o,i.end,a,d),$m(this,e,u,c)}shrinkNode(e,t,i){const r=e.piece,s=r.start,o=r.end,a=r.length,l=r.lineFeedCnt,c=t,u=this.getLineFeedCnt(r.bufferIndex,r.start,c),d=this.offsetInBuffer(r.bufferIndex,t)-this.offsetInBuffer(r.bufferIndex,s);e.piece=new Wc(r.bufferIndex,r.start,c,u,d),$m(this,e,d-a,u-l);const h=new Wc(r.bufferIndex,i,o,this.getLineFeedCnt(r.bufferIndex,i,o),this.offsetInBuffer(r.bufferIndex,o)-this.offsetInBuffer(r.bufferIndex,i)),f=this.rbInsertRight(e,h);this.validateCRLFWithPrevNode(f)}appendToNode(e,t){this.adjustCarriageReturnFromNext(t,e)&&(t+=` `);const i=this.shouldCheckCRLF()&&this.startWithLF(t)&&this.endWithCR(e),r=this._buffers[0].buffer.length;this._buffers[0].buffer+=t;const s=Vm(t,!1);for(let f=0;fe)t=t.left;else if(t.size_left+t.piece.length>=e){r+=t.size_left;const s={node:t,remainder:e-t.size_left,nodeStartOffset:r};return this._searchCache.set(s),s}else e-=t.size_left+t.piece.length,r+=t.size_left+t.piece.length,t=t.right;return null}nodeAt2(e,t){let i=this.root,r=0;for(;i!==mn;)if(i.left!==mn&&i.lf_left>=e-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>e-1){const s=this.getAccumulatedValue(i,e-i.lf_left-2),o=this.getAccumulatedValue(i,e-i.lf_left-1);return r+=i.size_left,{node:i,remainder:Math.min(s+t-1,o),nodeStartOffset:r}}else if(i.lf_left+i.piece.lineFeedCnt===e-1){const s=this.getAccumulatedValue(i,e-i.lf_left-2);if(s+t-1<=i.piece.length)return{node:i,remainder:s+t-1,nodeStartOffset:r};t-=i.piece.length-s;break}else e-=i.lf_left+i.piece.lineFeedCnt,r+=i.size_left+i.piece.length,i=i.right;for(i=i.next();i!==mn;){if(i.piece.lineFeedCnt>0){const s=this.getAccumulatedValue(i,0),o=this.offsetOfNode(i);return{node:i,remainder:Math.min(t-1,s),nodeStartOffset:o}}else if(i.piece.length>=t-1){const s=this.offsetOfNode(i);return{node:i,remainder:t-1,nodeStartOffset:s}}else t-=i.piece.length;i=i.next()}return null}nodeCharCodeAt(e,t){if(e.piece.lineFeedCnt<1)return-1;const i=this._buffers[e.piece.bufferIndex],r=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start)+t;return i.buffer.charCodeAt(r)}offsetOfNode(e){if(!e)return 0;let t=e.size_left;for(;e!==this.root;)e.parent.right===e&&(t+=e.parent.size_left+e.parent.piece.length),e=e.parent;return t}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===` `)}startWithLF(e){if(typeof e=="string")return e.charCodeAt(0)===10;if(e===mn||e.piece.lineFeedCnt===0)return!1;const t=e.piece,i=this._buffers[t.bufferIndex].lineStarts,r=t.start.line,s=i[r]+t.start.column;return r===i.length-1||i[r+1]>s+1?!1:this._buffers[t.bufferIndex].buffer.charCodeAt(s)===10}endWithCR(e){return typeof e=="string"?e.charCodeAt(e.length-1)===13:e===mn||e.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(e,e.piece.length-1)===13}validateCRLFWithPrevNode(e){if(this.shouldCheckCRLF()&&this.startWithLF(e)){const t=e.prev();this.endWithCR(t)&&this.fixCRLF(t,e)}}validateCRLFWithNextNode(e){if(this.shouldCheckCRLF()&&this.endWithCR(e)){const t=e.next();this.startWithLF(t)&&this.fixCRLF(e,t)}}fixCRLF(e,t){const i=[],r=this._buffers[e.piece.bufferIndex].lineStarts;let s;e.piece.end.column===0?s={line:e.piece.end.line-1,column:r[e.piece.end.line]-r[e.piece.end.line-1]-1}:s={line:e.piece.end.line,column:e.piece.end.column-1};const o=e.piece.length-1,a=e.piece.lineFeedCnt-1;e.piece=new Wc(e.piece.bufferIndex,e.piece.start,s,a,o),$m(this,e,-1,-1),e.piece.length===0&&i.push(e);const l={line:t.piece.start.line+1,column:0},c=t.piece.length-1,u=this.getLineFeedCnt(t.piece.bufferIndex,l,t.piece.end);t.piece=new Wc(t.piece.bufferIndex,l,t.piece.end,u,c),$m(this,t,-1,-1),t.piece.length===0&&i.push(t);const d=this.createNewPieces(`\r `);this.rbInsertRight(e,d[0]);for(let h=0;hm.sortIndex-_.sortIndex)}this._mightContainRTL=r,this._mightContainUnusualLineTerminators=s,this._mightContainNonBasicASCII=o;const f=this._doApplyEdits(l);let g=null;if(t&&d.length>0){d.sort((p,m)=>m.lineNumber-p.lineNumber),g=[];for(let p=0,m=d.length;p0&&d[p-1].lineNumber===_)continue;const v=d[p].oldContent,y=this.getLineContent(_);y.length===0||y===v||yl(y)!==-1||g.push(_)}}return this._onDidChangeContent.fire(),new Ebt(h,f,g)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let t=!1;const i=e[0].range,r=e[e.length-1].range,s=new $(i.startLineNumber,i.startColumn,r.endLineNumber,r.endColumn);let o=i.startLineNumber,a=i.startColumn;const l=[];for(let f=0,g=e.length;f0&&l.push(p.text),o=m.endLineNumber,a=m.endColumn}const c=l.join(""),[u,d,h]=Lb(c);return{sortIndex:0,identifier:e[0].identifier,range:s,rangeOffset:this.getOffsetAt(s.startLineNumber,s.startColumn),rangeLength:this.getValueLengthInRange(s,0),text:c,eolCount:u,firstLineLength:d,lastLineLength:h,forceMoveMarkers:t,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(_k._sortOpsDescending);const t=[];for(let i=0;i0){const h=l.eolCount+1;h===1?d=new $(c,u,c,u+l.firstLineLength):d=new $(c,u,c+h-1,l.lastLineLength+1)}else d=new $(c,u,c,u);i=d.endLineNumber,r=d.endColumn,t.push(d),s=l}return t}static _sortOpsAscending(e,t){const i=$.compareRangesUsingEnds(e.range,t.range);return i===0?e.sortIndex-t.sortIndex:i}static _sortOpsDescending(e,t){const i=$.compareRangesUsingEnds(e.range,t.range);return i===0?t.sortIndex-e.sortIndex:-i}}class _Lt{constructor(e,t,i,r,s,o,a,l,c){this._chunks=e,this._bom=t,this._cr=i,this._lf=r,this._crlf=s,this._containsRTL=o,this._containsUnusualLineTerminators=a,this._isBasicASCII=l,this._normalizeEOL=c}_getEOL(e){const t=this._cr+this._lf+this._crlf,i=this._cr+this._crlf;return t===0?e===1?` @@ -693,35 +693,35 @@ ${nye(ze.menuSubmenu)} `:` `}create(e){const t=this._getEOL(e),i=this._chunks;if(this._normalizeEOL&&(t===`\r `&&(this._cr>0||this._lf>0)||t===` -`&&(this._cr>0||this._crlf>0)))for(let s=0,o=i.length;s=55296&&t<=56319?(this._acceptChunk1(e.substr(0,e.length-1),!1),this._hasPreviousChar=!0,this._previousChar=t):(this._acceptChunk1(e,!1),this._hasPreviousChar=!1,this._previousChar=t)}_acceptChunk1(e,t){!t&&e.length===0||(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+e):this._acceptChunk2(e))}_acceptChunk2(e){const t=fLt(this._tmpLineStarts,e);this.chunks.push(new gy(e,t.lineStarts)),this.cr+=t.cr,this.lf+=t.lf,this.crlf+=t.crlf,t.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=iE(e)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=U4e(e)))}finish(e=!0){return this._finish(),new _Lt(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,e)}_finish(){if(this.chunks.length===0&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;const e=this.chunks[this.chunks.length-1];e.buffer+=String.fromCharCode(this._previousChar);const t=Vm(e.buffer);e.lineStarts=t,this._previousChar===13&&this.cr++}}}class vLt{constructor(e){this._default=e,this._store=[]}get(e){return e=this._store.length;)this._store[this._store.length]=this._default;this._store[e]=t}replace(e,t,i){if(e>=this._store.length)return;if(t===0){this.insert(e,i);return}else if(i===0){this.delete(e,t);return}const r=this._store.slice(0,e),s=this._store.slice(e+t),o=bLt(i,this._default);this._store=r.concat(o,s)}delete(e,t){t===0||e>=this._store.length||this._store.splice(e,t)}insert(e,t){if(t===0||e>=this._store.length)return;const i=[];for(let r=0;r0){const i=this._tokens[this._tokens.length-1];if(i.endLineNumber+1===e){i.appendLineTokens(t);return}}this._tokens.push(new yLt(e,[t]))}finalize(){return this._tokens}}class wLt{constructor(e,t){this.tokenizationSupport=t,this.initialState=this.tokenizationSupport.getInitialState(),this.store=new VQ(e)}getStartState(e){return this.store.getStartState(e,this.initialState)}getFirstInvalidLine(){return this.store.getFirstInvalidLine(this.initialState)}}class CLt extends wLt{constructor(e,t,i,r){super(e,t),this._textModel=i,this._languageIdCodec=r}updateTokensUntilLine(e,t){const i=this._textModel.getLanguageId();for(;;){const r=this.getFirstInvalidLine();if(!r||r.lineNumber>t)break;const s=this._textModel.getLineContent(r.lineNumber),o=PT(this._languageIdCodec,i,this.tokenizationSupport,s,!0,r.startState);e.add(r.lineNumber,o.tokens),this.store.setEndState(r.lineNumber,o.endState)}}getTokenTypeIfInsertingCharacter(e,t){const i=this.getStartState(e.lineNumber);if(!i)return 0;const r=this._textModel.getLanguageId(),s=this._textModel.getLineContent(e.lineNumber),o=s.substring(0,e.column-1)+t+s.substring(e.column-1),a=PT(this._languageIdCodec,r,this.tokenizationSupport,o,!0,i),l=new Fs(a.tokens,o,this._languageIdCodec);if(l.getCount()===0)return 0;const c=l.findTokenIndexAtOffset(e.column-1);return l.getStandardTokenType(c)}tokenizeLineWithEdit(e,t,i){const r=e.lineNumber,s=e.column,o=this.getStartState(r);if(!o)return null;const a=this._textModel.getLineContent(r),l=a.substring(0,s-1)+i+a.substring(s-1+t),c=this._textModel.getLanguageIdAtPosition(r,0),u=PT(this._languageIdCodec,c,this.tokenizationSupport,l,!0,o);return new Fs(u.tokens,l,this._languageIdCodec)}hasAccurateTokensForLine(e){const t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e1&&a>=1;a--){const l=this._textModel.getLineFirstNonWhitespaceColumn(a);if(l!==0&&l0&&i>0&&(i--,t--),this._lineEndStates.replace(e.startLineNumber,i,t)}}class SLt{constructor(){this._ranges=[]}get min(){return this._ranges.length===0?null:this._ranges[0].start}delete(e){const t=this._ranges.findIndex(i=>i.contains(e));if(t!==-1){const i=this._ranges[t];i.start===e?i.endExclusive===e+1?this._ranges.splice(t,1):this._ranges[t]=new Dn(e+1,i.endExclusive):i.endExclusive===e+1?this._ranges[t]=new Dn(i.start,e):this._ranges.splice(t,1,new Dn(i.start,e),new Dn(e+1,i.endExclusive))}}addRange(e){Dn.addRange(e,this._ranges)}addRangeAndResize(e,t){let i=0;for(;!(i>=this._ranges.length||e.start<=this._ranges[i].endExclusive);)i++;let r=i;for(;!(r>=this._ranges.length||e.endExclusivee.toString()).join(" + ")}}function PT(n,e,t,i,r,s){let o=null;if(t)try{o=t.tokenizeEncoded(i,r,s.clone())}catch(a){rn(a)}return o||(o=bW(n.encodeLanguageId(e),s)),Fs.convertToEndOffset(o.tokens,i.length),o}class kLt{constructor(e,t){this._tokenizerWithStateStore=e,this._backgroundTokenStore=t,this._isDisposed=!1,this._isScheduled=!1}dispose(){this._isDisposed=!0}handleChanges(){this._beginBackgroundTokenization()}_beginBackgroundTokenization(){this._isScheduled||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._isScheduled=!0,X4e(e=>{this._isScheduled=!1,this._backgroundTokenizeWithDeadline(e)}))}_backgroundTokenizeWithDeadline(e){const t=Date.now()+e.timeRemaining(),i=()=>{this._isDisposed||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._backgroundTokenizeForAtLeast1ms(),Date.now()1||this._tokenizeOneInvalidLine(t)>=e)break;while(this._hasLinesToTokenize());this._backgroundTokenStore.setTokens(t.finalize()),this.checkFinished()}_hasLinesToTokenize(){return this._tokenizerWithStateStore?!this._tokenizerWithStateStore.store.allStatesValid():!1}_tokenizeOneInvalidLine(e){const t=this._tokenizerWithStateStore?.getFirstInvalidLine();return t?(this._tokenizerWithStateStore.updateTokensUntilLine(e,t.lineNumber),t.lineNumber):this._tokenizerWithStateStore._textModel.getLineCount()+1}checkFinished(){this._isDisposed||this._tokenizerWithStateStore.store.allStatesValid()&&this._backgroundTokenStore.backgroundTokenizationFinished()}requestTokens(e,t){this._tokenizerWithStateStore.store.invalidateEndStateRange(new gn(e,t))}}class ELt{constructor(){this._onDidChangeVisibleRanges=new fe,this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event,this._views=new Set}attachView(){const e=new LLt(t=>{this._onDidChangeVisibleRanges.fire({view:e,state:t})});return this._views.add(e),e}detachView(e){this._views.delete(e),this._onDidChangeVisibleRanges.fire({view:e,state:void 0})}}class LLt{constructor(e){this.handleStateChange=e}setVisibleLines(e,t){const i=e.map(r=>new gn(r.startLineNumber,r.endLineNumber+1));this.handleStateChange({visibleLineRanges:i,stabilized:t})}}class TLt extends me{get lineRanges(){return this._lineRanges}constructor(e){super(),this._refreshTokens=e,this.runner=this._register(new Ui(()=>this.update(),50)),this._computedLineRanges=[],this._lineRanges=[]}update(){$r(this._computedLineRanges,this._lineRanges,(e,t)=>e.equals(t))||(this._computedLineRanges=this._lineRanges,this._refreshTokens())}handleStateChange(e){this._lineRanges=e.visibleLineRanges,e.stabilized?(this.runner.cancel(),this.update()):this.runner.schedule()}}class e6e extends me{get backgroundTokenizationState(){return this._backgroundTokenizationState}constructor(e,t,i){super(),this._languageIdCodec=e,this._textModel=t,this.getLanguageId=i,this._backgroundTokenizationState=1,this._onDidChangeBackgroundTokenizationState=this._register(new fe),this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event,this._onDidChangeTokens=this._register(new fe),this.onDidChangeTokens=this._onDidChangeTokens.event}tokenizeIfCheap(e){this.isCheapToTokenize(e)&&this.forceTokenization(e)}}class _ye extends e6e{constructor(e,t,i,r){super(t,i,r),this._treeSitterService=e,this._tokenizationSupport=null,this._initialize()}_initialize(){const e=this.getLanguageId();(!this._tokenizationSupport||this._lastLanguageId!==e)&&(this._lastLanguageId=e,this._tokenizationSupport=_Z.get(e))}getLineTokens(e){const t=this._textModel.getLineContent(e);if(this._tokenizationSupport){const i=this._tokenizationSupport.tokenizeEncoded(e,this._textModel);if(i)return new Fs(i,t,this._languageIdCodec)}return Fs.createEmpty(t,this._languageIdCodec)}resetTokenization(e=!0){e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]}),this._initialize()}handleDidChangeAttached(){}handleDidChangeContent(e){e.isFlush&&this.resetTokenization(!1)}forceTokenization(e){}hasAccurateTokensForLine(e){return!0}isCheapToTokenize(e){return!0}getTokenTypeIfInsertingCharacter(e,t,i){return 0}tokenizeLineWithEdit(e,t,i){return null}get hasTokens(){return this._treeSitterService.getParseResult(this._textModel)!==void 0}}const t6e=On("treeSitterParserService"),zm=new Uint32Array(0).buffer;class cp{static deleteBeginning(e,t){return e===null||e===zm?e:cp.delete(e,0,t)}static deleteEnding(e,t){if(e===null||e===zm)return e;const i=o_(e),r=i[i.length-2];return cp.delete(e,t,r)}static delete(e,t,i){if(e===null||e===zm||t===i)return e;const r=o_(e),s=r.length>>>1;if(t===0&&r[r.length-2]===i)return zm;const o=Fs.findIndexInTokensArray(r,t),a=o>0?r[o-1<<1]:0,l=r[o<<1];if(iu&&(r[c++]=g,r[c++]=r[(f<<1)+1],u=g)}if(c===r.length)return e;const h=new Uint32Array(c);return h.set(r.subarray(0,c),0),h.buffer}static append(e,t){if(t===zm)return e;if(e===zm)return t;if(e===null)return e;if(t===null)return null;const i=o_(e),r=o_(t),s=r.length>>>1,o=new Uint32Array(i.length+r.length);o.set(i,0);let a=i.length;const l=i[i.length-2];for(let c=0;c>>1;let o=Fs.findIndexInTokensArray(r,t);o>0&&r[o-1<<1]===t&&o--;for(let a=o;a0}getTokens(e,t,i){let r=null;if(t1&&(s=hc.getLanguageId(r[1])!==e),!s)return zm}if(!r||r.length===0){const s=new Uint32Array(2);return s[0]=t,s[1]=vye(e),s.buffer}return r[r.length-2]=t,r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:r}_ensureLine(e){for(;e>=this._len;)this._lineTokens[this._len]=null,this._len++}_deleteLines(e,t){t!==0&&(e+t>this._len&&(t=this._len-e),this._lineTokens.splice(e,t),this._len-=t)}_insertLines(e,t){if(t===0)return;const i=[];for(let r=0;r=this._len)return;if(e.startLineNumber===e.endLineNumber){if(e.startColumn===e.endColumn)return;this._lineTokens[t]=cp.delete(this._lineTokens[t],e.startColumn-1,e.endColumn-1);return}this._lineTokens[t]=cp.deleteEnding(this._lineTokens[t],e.startColumn-1);const i=e.endLineNumber-1;let r=null;i=this._len)){if(t===0){this._lineTokens[r]=cp.insert(this._lineTokens[r],e.column-1,i);return}this._lineTokens[r]=cp.deleteEnding(this._lineTokens[r],e.column-1),this._lineTokens[r]=cp.insert(this._lineTokens[r],e.column-1,i),this._insertLines(e.lineNumber,t)}}setMultilineTokens(e,t){if(e.length===0)return{changes:[]};const i=[];for(let r=0,s=e.length;r>>0}class ece{constructor(e){this._pieces=[],this._isComplete=!1,this._languageIdCodec=e}flush(){this._pieces=[],this._isComplete=!1}isEmpty(){return this._pieces.length===0}set(e,t){this._pieces=e||[],this._isComplete=t}setPartial(e,t){let i=e;if(t.length>0){const s=t[0].getRange(),o=t[t.length-1].getRange();if(!s||!o)return e;i=e.plusRange(s).plusRange(o)}let r=null;for(let s=0,o=this._pieces.length;si.endLineNumber){r=r||{index:s};break}if(a.removeTokens(i),a.isEmpty()){this._pieces.splice(s,1),s--,o--;continue}if(a.endLineNumberi.endLineNumber){r=r||{index:s};continue}const[l,c]=a.split(i);if(l.isEmpty()){r=r||{index:s};continue}c.isEmpty()||(this._pieces.splice(s,1,l,c),s++,o++,r=r||{index:s})}return r=r||{index:this._pieces.length},t.length>0&&(this._pieces=I$(this._pieces,r.index,t)),i}isComplete(){return this._isComplete}addSparseTokens(e,t){if(t.getLineContent().length===0)return t;const i=this._pieces;if(i.length===0)return t;const r=ece._findFirstPieceWithLine(i,e),s=i[r].getLineTokens(e);if(!s)return t;const o=t.getCount(),a=s.getCount();let l=0;const c=[];let u=0,d=0;const h=(f,g)=>{f!==d&&(d=f,c[u++]=f,c[u++]=g)};for(let f=0;f>>0,v=~_>>>0;for(;lt)r=s-1;else{for(;s>i&&e[s-1].startLineNumber<=t&&t<=e[s-1].endLineNumber;)s--;return s}}return i}acceptEdit(e,t,i,r,s){for(const o of this._pieces)o.acceptEdit(e,t,i,r,s)}}var DLt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},uq=function(n,e){return function(t,i){e(t,i,n)}},t5;let zQ=t5=class extends j5e{constructor(e,t,i,r,s,o,a){super(),this._textModel=e,this._bracketPairsTextModelPart=t,this._languageId=i,this._attachedViews=r,this._languageService=s,this._languageConfigurationService=o,this._treeSitterService=a,this._semanticTokens=new ece(this._languageService.languageIdCodec),this._onDidChangeLanguage=this._register(new fe),this.onDidChangeLanguage=this._onDidChangeLanguage.event,this._onDidChangeLanguageConfiguration=this._register(new fe),this.onDidChangeLanguageConfiguration=this._onDidChangeLanguageConfiguration.event,this._onDidChangeTokens=this._register(new fe),this.onDidChangeTokens=this._onDidChangeTokens.event,this._tokensDisposables=this._register(new ke),this._register(this._languageConfigurationService.onDidChange(l=>{l.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})})),this._register(Ge.filter(_Z.onDidChange,l=>l.changedLanguages.includes(this._languageId))(()=>{this.createPreferredTokenProvider()})),this.createPreferredTokenProvider()}createGrammarTokens(){return this._register(new bye(this._languageService.languageIdCodec,this._textModel,()=>this._languageId,this._attachedViews))}createTreeSitterTokens(){return this._register(new _ye(this._treeSitterService,this._languageService.languageIdCodec,this._textModel,()=>this._languageId))}createTokens(e){const t=this._tokens!==void 0;this._tokens?.dispose(),this._tokens=e?this.createTreeSitterTokens():this.createGrammarTokens(),this._tokensDisposables.clear(),this._tokensDisposables.add(this._tokens.onDidChangeTokens(i=>{this._emitModelTokensChangedEvent(i)})),this._tokensDisposables.add(this._tokens.onDidChangeBackgroundTokenizationState(i=>{this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState()})),t&&this._tokens.resetTokenization()}createPreferredTokenProvider(){_Z.get(this._languageId)?this._tokens instanceof _ye||this.createTokens(!0):this._tokens instanceof bye||this.createTokens(!1)}handleLanguageConfigurationServiceChange(e){e.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})}handleDidChangeContent(e){if(e.isFlush)this._semanticTokens.flush();else if(!e.isEolChange)for(const t of e.changes){const[i,r,s]=Lb(t.text);this._semanticTokens.acceptEdit(t.range,i,r,s,t.text.length>0?t.text.charCodeAt(0):0)}this._tokens.handleDidChangeContent(e)}handleDidChangeAttached(){this._tokens.handleDidChangeAttached()}getLineTokens(e){this.validateLineNumber(e);const t=this._tokens.getLineTokens(e);return this._semanticTokens.addSparseTokens(e,t)}_emitModelTokensChangedEvent(e){this._textModel._isDisposing()||(this._bracketPairsTextModelPart.handleDidChangeTokens(e),this._onDidChangeTokens.fire(e))}validateLineNumber(e){if(e<1||e>this._textModel.getLineCount())throw new fi("Illegal value for lineNumber")}get hasTokens(){return this._tokens.hasTokens}resetTokenization(){this._tokens.resetTokenization()}get backgroundTokenizationState(){return this._tokens.backgroundTokenizationState}forceTokenization(e){this.validateLineNumber(e),this._tokens.forceTokenization(e)}hasAccurateTokensForLine(e){return this.validateLineNumber(e),this._tokens.hasAccurateTokensForLine(e)}isCheapToTokenize(e){return this.validateLineNumber(e),this._tokens.isCheapToTokenize(e)}tokenizeIfCheap(e){this.validateLineNumber(e),this._tokens.tokenizeIfCheap(e)}getTokenTypeIfInsertingCharacter(e,t,i){return this._tokens.getTokenTypeIfInsertingCharacter(e,t,i)}tokenizeLineWithEdit(e,t,i){return this._tokens.tokenizeLineWithEdit(e,t,i)}setSemanticTokens(e,t){this._semanticTokens.set(e,t),this._emitModelTokensChangedEvent({semanticTokensApplied:e!==null,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}hasCompleteSemanticTokens(){return this._semanticTokens.isComplete()}hasSomeSemanticTokens(){return!this._semanticTokens.isEmpty()}setPartialSemanticTokens(e,t){if(this.hasCompleteSemanticTokens())return;const i=this._textModel.validateRange(this._semanticTokens.setPartial(e,t));this._emitModelTokensChangedEvent({semanticTokensApplied:!0,ranges:[{fromLineNumber:i.startLineNumber,toLineNumber:i.endLineNumber}]})}getWordAtPosition(e){this.assertNotDisposed();const t=this._textModel.validatePosition(e),i=this._textModel.getLineContent(t.lineNumber),r=this.getLineTokens(t.lineNumber),s=r.findTokenIndexAtOffset(t.column-1),[o,a]=t5._findLanguageBoundaries(r,s),l=nN(t.column,this.getLanguageConfiguration(r.getLanguageId(s)).getWordDefinition(),i.substring(o,a),o);if(l&&l.startColumn<=e.column&&e.column<=l.endColumn)return l;if(s>0&&o===t.column-1){const[c,u]=t5._findLanguageBoundaries(r,s-1),d=nN(t.column,this.getLanguageConfiguration(r.getLanguageId(s-1)).getWordDefinition(),i.substring(c,u),c);if(d&&d.startColumn<=e.column&&e.column<=d.endColumn)return d}return null}getLanguageConfiguration(e){return this._languageConfigurationService.getLanguageConfiguration(e)}static _findLanguageBoundaries(e,t){const i=e.getLanguageId(t);let r=0;for(let o=t;o>=0&&e.getLanguageId(o)===i;o--)r=e.getStartOffset(o);let s=e.getLineContent().length;for(let o=t,a=e.getCount();o{const o=this.getLanguageId();s.changedLanguages.indexOf(o)!==-1&&this.resetTokenization()})),this.resetTokenization(),this._register(r.onDidChangeVisibleRanges(({view:s,state:o})=>{if(o){let a=this._attachedViewStates.get(s);a||(a=new TLt(()=>this.refreshRanges(a.lineRanges)),this._attachedViewStates.set(s,a)),a.handleStateChange(o)}else this._attachedViewStates.deleteAndDispose(s)}))}resetTokenization(e=!0){this._tokens.flush(),this._debugBackgroundTokens?.flush(),this._debugBackgroundStates&&(this._debugBackgroundStates=new VQ(this._textModel.getLineCount())),e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]});const t=()=>{if(this._textModel.isTooLargeForTokenization())return[null,null];const s=rs.get(this.getLanguageId());if(!s)return[null,null];let o;try{o=s.getInitialState()}catch(a){return rn(a),[null,null]}return[s,o]},[i,r]=t();if(i&&r?this._tokenizer=new CLt(this._textModel.getLineCount(),i,this._textModel,this._languageIdCodec):this._tokenizer=null,this._backgroundTokenizer.clear(),this._defaultBackgroundTokenizer=null,this._tokenizer){const s={setTokens:o=>{this.setTokens(o)},backgroundTokenizationFinished:()=>{if(this._backgroundTokenizationState===2)return;const o=2;this._backgroundTokenizationState=o,this._onDidChangeBackgroundTokenizationState.fire()},setEndState:(o,a)=>{if(!this._tokenizer)return;const l=this._tokenizer.store.getFirstInvalidEndStateLineNumber();l!==null&&o>=l&&this._tokenizer?.store.setEndState(o,a)}};i&&i.createBackgroundTokenizer&&!i.backgroundTokenizerShouldOnlyVerifyTokens&&(this._backgroundTokenizer.value=i.createBackgroundTokenizer(this._textModel,s)),!this._backgroundTokenizer.value&&!this._textModel.isTooLargeForTokenization()&&(this._backgroundTokenizer.value=this._defaultBackgroundTokenizer=new kLt(this._tokenizer,s),this._defaultBackgroundTokenizer.handleChanges()),i?.backgroundTokenizerShouldOnlyVerifyTokens&&i.createBackgroundTokenizer?(this._debugBackgroundTokens=new ON(this._languageIdCodec),this._debugBackgroundStates=new VQ(this._textModel.getLineCount()),this._debugBackgroundTokenizer.clear(),this._debugBackgroundTokenizer.value=i.createBackgroundTokenizer(this._textModel,{setTokens:o=>{this._debugBackgroundTokens?.setMultilineTokens(o,this._textModel)},backgroundTokenizationFinished(){},setEndState:(o,a)=>{this._debugBackgroundStates?.setEndState(o,a)}})):(this._debugBackgroundTokens=void 0,this._debugBackgroundStates=void 0,this._debugBackgroundTokenizer.value=void 0)}this.refreshAllVisibleLineTokens()}handleDidChangeAttached(){this._defaultBackgroundTokenizer?.handleChanges()}handleDidChangeContent(e){if(e.isFlush)this.resetTokenization(!1);else if(!e.isEolChange){for(const t of e.changes){const[i,r]=Lb(t.text);this._tokens.acceptEdit(t.range,i,r),this._debugBackgroundTokens?.acceptEdit(t.range,i,r)}this._debugBackgroundStates?.acceptChanges(e.changes),this._tokenizer&&this._tokenizer.store.acceptChanges(e.changes),this._defaultBackgroundTokenizer?.handleChanges()}}setTokens(e){const{changes:t}=this._tokens.setMultilineTokens(e,this._textModel);return t.length>0&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:t}),{changes:t}}refreshAllVisibleLineTokens(){const e=gn.joinMany([...this._attachedViewStates].map(([t,i])=>i.lineRanges));this.refreshRanges(e)}refreshRanges(e){for(const t of e)this.refreshRange(t.startLineNumber,t.endLineNumberExclusive-1)}refreshRange(e,t){if(!this._tokenizer)return;e=Math.max(1,Math.min(this._textModel.getLineCount(),e)),t=Math.min(this._textModel.getLineCount(),t);const i=new HQ,{heuristicTokens:r}=this._tokenizer.tokenizeHeuristically(i,e,t),s=this.setTokens(i.finalize());if(r)for(const o of s.changes)this._backgroundTokenizer.value?.requestTokens(o.fromLineNumber,o.toLineNumber+1);this._defaultBackgroundTokenizer?.checkFinished()}forceTokenization(e){const t=new HQ;this._tokenizer?.updateTokensUntilLine(t,e),this.setTokens(t.finalize()),this._defaultBackgroundTokenizer?.checkFinished()}hasAccurateTokensForLine(e){return this._tokenizer?this._tokenizer.hasAccurateTokensForLine(e):!0}isCheapToTokenize(e){return this._tokenizer?this._tokenizer.isCheapToTokenize(e):!0}getLineTokens(e){const t=this._textModel.getLineContent(e),i=this._tokens.getTokens(this._textModel.getLanguageId(),e-1,t);if(this._debugBackgroundTokens&&this._debugBackgroundStates&&this._tokenizer&&this._debugBackgroundStates.getFirstInvalidEndStateLineNumberOrMax()>e&&this._tokenizer.store.getFirstInvalidEndStateLineNumberOrMax()>e){const r=this._debugBackgroundTokens.getTokens(this._textModel.getLanguageId(),e-1,t);!i.equals(r)&&this._debugBackgroundTokenizer.value?.reportMismatchingTokens&&this._debugBackgroundTokenizer.value.reportMismatchingTokens(e)}return i}getTokenTypeIfInsertingCharacter(e,t,i){if(!this._tokenizer)return 0;const r=this._textModel.validatePosition(new he(e,t));return this.forceTokenization(r.lineNumber),this._tokenizer.getTokenTypeIfInsertingCharacter(r,i)}tokenizeLineWithEdit(e,t,i){if(!this._tokenizer)return null;const r=this._textModel.validatePosition(e);return this.forceTokenization(r.lineNumber),this._tokenizer.tokenizeLineWithEdit(r,t,i)}get hasTokens(){return this._tokens.hasTokens}}class ILt{constructor(){this.changeType=1}}class Lg{static applyInjectedText(e,t){if(!t||t.length===0)return e;let i="",r=0;for(const s of t)i+=e.substring(r,s.column-1),r=s.column-1,i+=s.options.content;return i+=e.substring(r),i}static fromDecorations(e){const t=[];for(const i of e)i.options.before&&i.options.before.content.length>0&&t.push(new Lg(i.ownerId,i.range.startLineNumber,i.range.startColumn,i.options.before,0)),i.options.after&&i.options.after.content.length>0&&t.push(new Lg(i.ownerId,i.range.endLineNumber,i.range.endColumn,i.options.after,1));return t.sort((i,r)=>i.lineNumber===r.lineNumber?i.column===r.column?i.order-r.order:i.column-r.column:i.lineNumber-r.lineNumber),t}constructor(e,t,i,r,s){this.ownerId=e,this.lineNumber=t,this.column=i,this.options=r,this.order=s}}class yye{constructor(e,t,i){this.changeType=2,this.lineNumber=e,this.detail=t,this.injectedText=i}}class ALt{constructor(e,t){this.changeType=3,this.fromLineNumber=e,this.toLineNumber=t}}class NLt{constructor(e,t,i,r){this.changeType=4,this.injectedTexts=r,this.fromLineNumber=e,this.toLineNumber=t,this.detail=i}}class RLt{constructor(){this.changeType=5}}class vk{constructor(e,t,i,r){this.changes=e,this.versionId=t,this.isUndoing=i,this.isRedoing=r,this.resultingSelection=null}containsEvent(e){for(let t=0,i=this.changes.length;t=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},j4=function(n,e){return function(t,i){e(t,i,n)}},q1;function OLt(n){const e=new J5e;return e.acceptChunk(n),e.finish()}function MLt(n){const e=new J5e;let t;for(;typeof(t=n.read())=="string";)e.acceptChunk(t);return e.finish()}function wye(n,e){let t;return typeof n=="string"?t=OLt(n):Sbt(n)?t=MLt(n):t=n,t.create(e)}let q4=0;const FLt=999,BLt=1e4;class $Lt{constructor(e){this._source=e,this._eos=!1}read(){if(this._eos)return null;const e=[];let t=0,i=0;do{const r=this._source.read();if(r===null)return this._eos=!0,t===0?null:e.join("");if(r.length>0&&(e[t++]=r,i+=r.length),i>=64*1024)return e.join("")}while(!0)}}const OT=()=>{throw new Error("Invalid change accessor")};let og=class extends me{static{q1=this}static{this._MODEL_SYNC_LIMIT=50*1024*1024}static{this.LARGE_FILE_SIZE_THRESHOLD=20*1024*1024}static{this.LARGE_FILE_LINE_COUNT_THRESHOLD=300*1e3}static{this.LARGE_FILE_HEAP_OPERATION_THRESHOLD=256*1024*1024}static{this.DEFAULT_CREATION_OPTIONS={isForSimpleWidget:!1,tabSize:Va.tabSize,indentSize:Va.indentSize,insertSpaces:Va.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:Va.trimAutoWhitespace,largeFileOptimizations:Va.largeFileOptimizations,bracketPairColorizationOptions:Va.bracketPairColorizationOptions}}static resolveOptions(e,t){if(t.detectIndentation){const i=cye(e,t.tabSize,t.insertSpaces);return new UF({tabSize:i.tabSize,indentSize:"tabSize",insertSpaces:i.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}return new UF(t)}get onDidChangeLanguage(){return this._tokenizationTextModelPart.onDidChangeLanguage}get onDidChangeLanguageConfiguration(){return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration}get onDidChangeTokens(){return this._tokenizationTextModelPart.onDidChangeTokens}onDidChangeContent(e){return this._eventEmitter.slowEvent(t=>e(t.contentChangedEvent))}onDidChangeContentOrInjectedText(e){return Qh(this._eventEmitter.fastEvent(t=>e(t)),this._onDidChangeInjectedText.event(t=>e(t)))}_isDisposing(){return this.__isDisposing}get tokenization(){return this._tokenizationTextModelPart}get bracketPairs(){return this._bracketPairs}get guides(){return this._guidesTextModelPart}constructor(e,t,i,r=null,s,o,a,l){super(),this._undoRedoService=s,this._languageService=o,this._languageConfigurationService=a,this.instantiationService=l,this._onWillDispose=this._register(new fe),this.onWillDispose=this._onWillDispose.event,this._onDidChangeDecorations=this._register(new jLt(g=>this.handleBeforeFireDecorationsChangedEvent(g))),this.onDidChangeDecorations=this._onDidChangeDecorations.event,this._onDidChangeOptions=this._register(new fe),this.onDidChangeOptions=this._onDidChangeOptions.event,this._onDidChangeAttached=this._register(new fe),this.onDidChangeAttached=this._onDidChangeAttached.event,this._onDidChangeInjectedText=this._register(new fe),this._eventEmitter=this._register(new qLt),this._languageSelectionListener=this._register(new To),this._deltaDecorationCallCnt=0,this._attachedViews=new ELt,q4++,this.id="$model"+q4,this.isForSimpleWidget=i.isForSimpleWidget,typeof r>"u"||r===null?this._associatedResource=Pt.parse("inmemory://model/"+q4):this._associatedResource=r,this._attachedEditorCount=0;const{textBuffer:c,disposable:u}=wye(e,i.defaultEOL);this._buffer=c,this._bufferDisposable=u,this._options=q1.resolveOptions(this._buffer,i);const d=typeof t=="string"?t:t.languageId;typeof t!="string"&&(this._languageSelectionListener.value=t.onDidChange(()=>this._setLanguage(t.languageId))),this._bracketPairs=this._register(new jEt(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new ZEt(this,this._languageConfigurationService)),this._decorationProvider=this._register(new KEt(this)),this._tokenizationTextModelPart=this.instantiationService.createInstance(zQ,this,this._bracketPairs,d,this._attachedViews);const h=this._buffer.getLineCount(),f=this._buffer.getValueLengthInRange(new $(1,1,h,this._buffer.getLineLength(h)+1),0);i.largeFileOptimizations?(this._isTooLargeForTokenization=f>q1.LARGE_FILE_SIZE_THRESHOLD||h>q1.LARGE_FILE_LINE_COUNT_THRESHOLD,this._isTooLargeForHeapOperation=f>q1.LARGE_FILE_HEAP_OPERATION_THRESHOLD):(this._isTooLargeForTokenization=!1,this._isTooLargeForHeapOperation=!1),this._isTooLargeForSyncing=f>q1._MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this.__isDisposing=!1,this._instanceId=j4e(q4),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new Cye,this._commandManager=new Zle(this,this._undoRedoService),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._register(this._decorationProvider.onDidChange(()=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._onDidChangeDecorations.endDeferredEmit()})),this._languageService.requestRichLanguageFeatures(d),this._register(this._languageConfigurationService.onDidChange(g=>{this._bracketPairs.handleLanguageConfigurationServiceChange(g),this._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(g)}))}dispose(){this.__isDisposing=!0,this._onWillDispose.fire(),this._tokenizationTextModelPart.dispose(),this._isDisposed=!0,super.dispose(),this._bufferDisposable.dispose(),this.__isDisposing=!1;const e=new _k([],"",` +`&&(this._cr>0||this._crlf>0)))for(let s=0,o=i.length;s=55296&&t<=56319?(this._acceptChunk1(e.substr(0,e.length-1),!1),this._hasPreviousChar=!0,this._previousChar=t):(this._acceptChunk1(e,!1),this._hasPreviousChar=!1,this._previousChar=t)}_acceptChunk1(e,t){!t&&e.length===0||(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+e):this._acceptChunk2(e))}_acceptChunk2(e){const t=fLt(this._tmpLineStarts,e);this.chunks.push(new gy(e,t.lineStarts)),this.cr+=t.cr,this.lf+=t.lf,this.crlf+=t.crlf,t.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=iE(e)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=U4e(e)))}finish(e=!0){return this._finish(),new _Lt(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,e)}_finish(){if(this.chunks.length===0&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;const e=this.chunks[this.chunks.length-1];e.buffer+=String.fromCharCode(this._previousChar);const t=Vm(e.buffer);e.lineStarts=t,this._previousChar===13&&this.cr++}}}class vLt{constructor(e){this._default=e,this._store=[]}get(e){return e=this._store.length;)this._store[this._store.length]=this._default;this._store[e]=t}replace(e,t,i){if(e>=this._store.length)return;if(t===0){this.insert(e,i);return}else if(i===0){this.delete(e,t);return}const r=this._store.slice(0,e),s=this._store.slice(e+t),o=bLt(i,this._default);this._store=r.concat(o,s)}delete(e,t){t===0||e>=this._store.length||this._store.splice(e,t)}insert(e,t){if(t===0||e>=this._store.length)return;const i=[];for(let r=0;r0){const i=this._tokens[this._tokens.length-1];if(i.endLineNumber+1===e){i.appendLineTokens(t);return}}this._tokens.push(new yLt(e,[t]))}finalize(){return this._tokens}}class wLt{constructor(e,t){this.tokenizationSupport=t,this.initialState=this.tokenizationSupport.getInitialState(),this.store=new VQ(e)}getStartState(e){return this.store.getStartState(e,this.initialState)}getFirstInvalidLine(){return this.store.getFirstInvalidLine(this.initialState)}}class CLt extends wLt{constructor(e,t,i,r){super(e,t),this._textModel=i,this._languageIdCodec=r}updateTokensUntilLine(e,t){const i=this._textModel.getLanguageId();for(;;){const r=this.getFirstInvalidLine();if(!r||r.lineNumber>t)break;const s=this._textModel.getLineContent(r.lineNumber),o=PT(this._languageIdCodec,i,this.tokenizationSupport,s,!0,r.startState);e.add(r.lineNumber,o.tokens),this.store.setEndState(r.lineNumber,o.endState)}}getTokenTypeIfInsertingCharacter(e,t){const i=this.getStartState(e.lineNumber);if(!i)return 0;const r=this._textModel.getLanguageId(),s=this._textModel.getLineContent(e.lineNumber),o=s.substring(0,e.column-1)+t+s.substring(e.column-1),a=PT(this._languageIdCodec,r,this.tokenizationSupport,o,!0,i),l=new Fs(a.tokens,o,this._languageIdCodec);if(l.getCount()===0)return 0;const c=l.findTokenIndexAtOffset(e.column-1);return l.getStandardTokenType(c)}tokenizeLineWithEdit(e,t,i){const r=e.lineNumber,s=e.column,o=this.getStartState(r);if(!o)return null;const a=this._textModel.getLineContent(r),l=a.substring(0,s-1)+i+a.substring(s-1+t),c=this._textModel.getLanguageIdAtPosition(r,0),u=PT(this._languageIdCodec,c,this.tokenizationSupport,l,!0,o);return new Fs(u.tokens,l,this._languageIdCodec)}hasAccurateTokensForLine(e){const t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e1&&a>=1;a--){const l=this._textModel.getLineFirstNonWhitespaceColumn(a);if(l!==0&&l0&&i>0&&(i--,t--),this._lineEndStates.replace(e.startLineNumber,i,t)}}class SLt{constructor(){this._ranges=[]}get min(){return this._ranges.length===0?null:this._ranges[0].start}delete(e){const t=this._ranges.findIndex(i=>i.contains(e));if(t!==-1){const i=this._ranges[t];i.start===e?i.endExclusive===e+1?this._ranges.splice(t,1):this._ranges[t]=new Dn(e+1,i.endExclusive):i.endExclusive===e+1?this._ranges[t]=new Dn(i.start,e):this._ranges.splice(t,1,new Dn(i.start,e),new Dn(e+1,i.endExclusive))}}addRange(e){Dn.addRange(e,this._ranges)}addRangeAndResize(e,t){let i=0;for(;!(i>=this._ranges.length||e.start<=this._ranges[i].endExclusive);)i++;let r=i;for(;!(r>=this._ranges.length||e.endExclusivee.toString()).join(" + ")}}function PT(n,e,t,i,r,s){let o=null;if(t)try{o=t.tokenizeEncoded(i,r,s.clone())}catch(a){rn(a)}return o||(o=bW(n.encodeLanguageId(e),s)),Fs.convertToEndOffset(o.tokens,i.length),o}class kLt{constructor(e,t){this._tokenizerWithStateStore=e,this._backgroundTokenStore=t,this._isDisposed=!1,this._isScheduled=!1}dispose(){this._isDisposed=!0}handleChanges(){this._beginBackgroundTokenization()}_beginBackgroundTokenization(){this._isScheduled||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._isScheduled=!0,X4e(e=>{this._isScheduled=!1,this._backgroundTokenizeWithDeadline(e)}))}_backgroundTokenizeWithDeadline(e){const t=Date.now()+e.timeRemaining(),i=()=>{this._isDisposed||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._backgroundTokenizeForAtLeast1ms(),Date.now()1||this._tokenizeOneInvalidLine(t)>=e)break;while(this._hasLinesToTokenize());this._backgroundTokenStore.setTokens(t.finalize()),this.checkFinished()}_hasLinesToTokenize(){return this._tokenizerWithStateStore?!this._tokenizerWithStateStore.store.allStatesValid():!1}_tokenizeOneInvalidLine(e){const t=this._tokenizerWithStateStore?.getFirstInvalidLine();return t?(this._tokenizerWithStateStore.updateTokensUntilLine(e,t.lineNumber),t.lineNumber):this._tokenizerWithStateStore._textModel.getLineCount()+1}checkFinished(){this._isDisposed||this._tokenizerWithStateStore.store.allStatesValid()&&this._backgroundTokenStore.backgroundTokenizationFinished()}requestTokens(e,t){this._tokenizerWithStateStore.store.invalidateEndStateRange(new gn(e,t))}}class ELt{constructor(){this._onDidChangeVisibleRanges=new fe,this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event,this._views=new Set}attachView(){const e=new LLt(t=>{this._onDidChangeVisibleRanges.fire({view:e,state:t})});return this._views.add(e),e}detachView(e){this._views.delete(e),this._onDidChangeVisibleRanges.fire({view:e,state:void 0})}}class LLt{constructor(e){this.handleStateChange=e}setVisibleLines(e,t){const i=e.map(r=>new gn(r.startLineNumber,r.endLineNumber+1));this.handleStateChange({visibleLineRanges:i,stabilized:t})}}class TLt extends me{get lineRanges(){return this._lineRanges}constructor(e){super(),this._refreshTokens=e,this.runner=this._register(new Ui(()=>this.update(),50)),this._computedLineRanges=[],this._lineRanges=[]}update(){$r(this._computedLineRanges,this._lineRanges,(e,t)=>e.equals(t))||(this._computedLineRanges=this._lineRanges,this._refreshTokens())}handleStateChange(e){this._lineRanges=e.visibleLineRanges,e.stabilized?(this.runner.cancel(),this.update()):this.runner.schedule()}}class e6e extends me{get backgroundTokenizationState(){return this._backgroundTokenizationState}constructor(e,t,i){super(),this._languageIdCodec=e,this._textModel=t,this.getLanguageId=i,this._backgroundTokenizationState=1,this._onDidChangeBackgroundTokenizationState=this._register(new fe),this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event,this._onDidChangeTokens=this._register(new fe),this.onDidChangeTokens=this._onDidChangeTokens.event}tokenizeIfCheap(e){this.isCheapToTokenize(e)&&this.forceTokenization(e)}}class _ye extends e6e{constructor(e,t,i,r){super(t,i,r),this._treeSitterService=e,this._tokenizationSupport=null,this._initialize()}_initialize(){const e=this.getLanguageId();(!this._tokenizationSupport||this._lastLanguageId!==e)&&(this._lastLanguageId=e,this._tokenizationSupport=_Z.get(e))}getLineTokens(e){const t=this._textModel.getLineContent(e);if(this._tokenizationSupport){const i=this._tokenizationSupport.tokenizeEncoded(e,this._textModel);if(i)return new Fs(i,t,this._languageIdCodec)}return Fs.createEmpty(t,this._languageIdCodec)}resetTokenization(e=!0){e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]}),this._initialize()}handleDidChangeAttached(){}handleDidChangeContent(e){e.isFlush&&this.resetTokenization(!1)}forceTokenization(e){}hasAccurateTokensForLine(e){return!0}isCheapToTokenize(e){return!0}getTokenTypeIfInsertingCharacter(e,t,i){return 0}tokenizeLineWithEdit(e,t,i){return null}get hasTokens(){return this._treeSitterService.getParseResult(this._textModel)!==void 0}}const t6e=On("treeSitterParserService"),zm=new Uint32Array(0).buffer;class cp{static deleteBeginning(e,t){return e===null||e===zm?e:cp.delete(e,0,t)}static deleteEnding(e,t){if(e===null||e===zm)return e;const i=o_(e),r=i[i.length-2];return cp.delete(e,t,r)}static delete(e,t,i){if(e===null||e===zm||t===i)return e;const r=o_(e),s=r.length>>>1;if(t===0&&r[r.length-2]===i)return zm;const o=Fs.findIndexInTokensArray(r,t),a=o>0?r[o-1<<1]:0,l=r[o<<1];if(iu&&(r[c++]=g,r[c++]=r[(f<<1)+1],u=g)}if(c===r.length)return e;const h=new Uint32Array(c);return h.set(r.subarray(0,c),0),h.buffer}static append(e,t){if(t===zm)return e;if(e===zm)return t;if(e===null)return e;if(t===null)return null;const i=o_(e),r=o_(t),s=r.length>>>1,o=new Uint32Array(i.length+r.length);o.set(i,0);let a=i.length;const l=i[i.length-2];for(let c=0;c>>1;let o=Fs.findIndexInTokensArray(r,t);o>0&&r[o-1<<1]===t&&o--;for(let a=o;a0}getTokens(e,t,i){let r=null;if(t1&&(s=hc.getLanguageId(r[1])!==e),!s)return zm}if(!r||r.length===0){const s=new Uint32Array(2);return s[0]=t,s[1]=vye(e),s.buffer}return r[r.length-2]=t,r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:r}_ensureLine(e){for(;e>=this._len;)this._lineTokens[this._len]=null,this._len++}_deleteLines(e,t){t!==0&&(e+t>this._len&&(t=this._len-e),this._lineTokens.splice(e,t),this._len-=t)}_insertLines(e,t){if(t===0)return;const i=[];for(let r=0;r=this._len)return;if(e.startLineNumber===e.endLineNumber){if(e.startColumn===e.endColumn)return;this._lineTokens[t]=cp.delete(this._lineTokens[t],e.startColumn-1,e.endColumn-1);return}this._lineTokens[t]=cp.deleteEnding(this._lineTokens[t],e.startColumn-1);const i=e.endLineNumber-1;let r=null;i=this._len)){if(t===0){this._lineTokens[r]=cp.insert(this._lineTokens[r],e.column-1,i);return}this._lineTokens[r]=cp.deleteEnding(this._lineTokens[r],e.column-1),this._lineTokens[r]=cp.insert(this._lineTokens[r],e.column-1,i),this._insertLines(e.lineNumber,t)}}setMultilineTokens(e,t){if(e.length===0)return{changes:[]};const i=[];for(let r=0,s=e.length;r>>0}class ece{constructor(e){this._pieces=[],this._isComplete=!1,this._languageIdCodec=e}flush(){this._pieces=[],this._isComplete=!1}isEmpty(){return this._pieces.length===0}set(e,t){this._pieces=e||[],this._isComplete=t}setPartial(e,t){let i=e;if(t.length>0){const s=t[0].getRange(),o=t[t.length-1].getRange();if(!s||!o)return e;i=e.plusRange(s).plusRange(o)}let r=null;for(let s=0,o=this._pieces.length;si.endLineNumber){r=r||{index:s};break}if(a.removeTokens(i),a.isEmpty()){this._pieces.splice(s,1),s--,o--;continue}if(a.endLineNumberi.endLineNumber){r=r||{index:s};continue}const[l,c]=a.split(i);if(l.isEmpty()){r=r||{index:s};continue}c.isEmpty()||(this._pieces.splice(s,1,l,c),s++,o++,r=r||{index:s})}return r=r||{index:this._pieces.length},t.length>0&&(this._pieces=I$(this._pieces,r.index,t)),i}isComplete(){return this._isComplete}addSparseTokens(e,t){if(t.getLineContent().length===0)return t;const i=this._pieces;if(i.length===0)return t;const r=ece._findFirstPieceWithLine(i,e),s=i[r].getLineTokens(e);if(!s)return t;const o=t.getCount(),a=s.getCount();let l=0;const c=[];let u=0,d=0;const h=(f,g)=>{f!==d&&(d=f,c[u++]=f,c[u++]=g)};for(let f=0;f>>0,v=~_>>>0;for(;lt)r=s-1;else{for(;s>i&&e[s-1].startLineNumber<=t&&t<=e[s-1].endLineNumber;)s--;return s}}return i}acceptEdit(e,t,i,r,s){for(const o of this._pieces)o.acceptEdit(e,t,i,r,s)}}var DLt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},uq=function(n,e){return function(t,i){e(t,i,n)}},tF;let zQ=tF=class extends jFe{constructor(e,t,i,r,s,o,a){super(),this._textModel=e,this._bracketPairsTextModelPart=t,this._languageId=i,this._attachedViews=r,this._languageService=s,this._languageConfigurationService=o,this._treeSitterService=a,this._semanticTokens=new ece(this._languageService.languageIdCodec),this._onDidChangeLanguage=this._register(new fe),this.onDidChangeLanguage=this._onDidChangeLanguage.event,this._onDidChangeLanguageConfiguration=this._register(new fe),this.onDidChangeLanguageConfiguration=this._onDidChangeLanguageConfiguration.event,this._onDidChangeTokens=this._register(new fe),this.onDidChangeTokens=this._onDidChangeTokens.event,this._tokensDisposables=this._register(new ke),this._register(this._languageConfigurationService.onDidChange(l=>{l.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})})),this._register(Ge.filter(_Z.onDidChange,l=>l.changedLanguages.includes(this._languageId))(()=>{this.createPreferredTokenProvider()})),this.createPreferredTokenProvider()}createGrammarTokens(){return this._register(new bye(this._languageService.languageIdCodec,this._textModel,()=>this._languageId,this._attachedViews))}createTreeSitterTokens(){return this._register(new _ye(this._treeSitterService,this._languageService.languageIdCodec,this._textModel,()=>this._languageId))}createTokens(e){const t=this._tokens!==void 0;this._tokens?.dispose(),this._tokens=e?this.createTreeSitterTokens():this.createGrammarTokens(),this._tokensDisposables.clear(),this._tokensDisposables.add(this._tokens.onDidChangeTokens(i=>{this._emitModelTokensChangedEvent(i)})),this._tokensDisposables.add(this._tokens.onDidChangeBackgroundTokenizationState(i=>{this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState()})),t&&this._tokens.resetTokenization()}createPreferredTokenProvider(){_Z.get(this._languageId)?this._tokens instanceof _ye||this.createTokens(!0):this._tokens instanceof bye||this.createTokens(!1)}handleLanguageConfigurationServiceChange(e){e.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})}handleDidChangeContent(e){if(e.isFlush)this._semanticTokens.flush();else if(!e.isEolChange)for(const t of e.changes){const[i,r,s]=Lb(t.text);this._semanticTokens.acceptEdit(t.range,i,r,s,t.text.length>0?t.text.charCodeAt(0):0)}this._tokens.handleDidChangeContent(e)}handleDidChangeAttached(){this._tokens.handleDidChangeAttached()}getLineTokens(e){this.validateLineNumber(e);const t=this._tokens.getLineTokens(e);return this._semanticTokens.addSparseTokens(e,t)}_emitModelTokensChangedEvent(e){this._textModel._isDisposing()||(this._bracketPairsTextModelPart.handleDidChangeTokens(e),this._onDidChangeTokens.fire(e))}validateLineNumber(e){if(e<1||e>this._textModel.getLineCount())throw new fi("Illegal value for lineNumber")}get hasTokens(){return this._tokens.hasTokens}resetTokenization(){this._tokens.resetTokenization()}get backgroundTokenizationState(){return this._tokens.backgroundTokenizationState}forceTokenization(e){this.validateLineNumber(e),this._tokens.forceTokenization(e)}hasAccurateTokensForLine(e){return this.validateLineNumber(e),this._tokens.hasAccurateTokensForLine(e)}isCheapToTokenize(e){return this.validateLineNumber(e),this._tokens.isCheapToTokenize(e)}tokenizeIfCheap(e){this.validateLineNumber(e),this._tokens.tokenizeIfCheap(e)}getTokenTypeIfInsertingCharacter(e,t,i){return this._tokens.getTokenTypeIfInsertingCharacter(e,t,i)}tokenizeLineWithEdit(e,t,i){return this._tokens.tokenizeLineWithEdit(e,t,i)}setSemanticTokens(e,t){this._semanticTokens.set(e,t),this._emitModelTokensChangedEvent({semanticTokensApplied:e!==null,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}hasCompleteSemanticTokens(){return this._semanticTokens.isComplete()}hasSomeSemanticTokens(){return!this._semanticTokens.isEmpty()}setPartialSemanticTokens(e,t){if(this.hasCompleteSemanticTokens())return;const i=this._textModel.validateRange(this._semanticTokens.setPartial(e,t));this._emitModelTokensChangedEvent({semanticTokensApplied:!0,ranges:[{fromLineNumber:i.startLineNumber,toLineNumber:i.endLineNumber}]})}getWordAtPosition(e){this.assertNotDisposed();const t=this._textModel.validatePosition(e),i=this._textModel.getLineContent(t.lineNumber),r=this.getLineTokens(t.lineNumber),s=r.findTokenIndexAtOffset(t.column-1),[o,a]=tF._findLanguageBoundaries(r,s),l=nN(t.column,this.getLanguageConfiguration(r.getLanguageId(s)).getWordDefinition(),i.substring(o,a),o);if(l&&l.startColumn<=e.column&&e.column<=l.endColumn)return l;if(s>0&&o===t.column-1){const[c,u]=tF._findLanguageBoundaries(r,s-1),d=nN(t.column,this.getLanguageConfiguration(r.getLanguageId(s-1)).getWordDefinition(),i.substring(c,u),c);if(d&&d.startColumn<=e.column&&e.column<=d.endColumn)return d}return null}getLanguageConfiguration(e){return this._languageConfigurationService.getLanguageConfiguration(e)}static _findLanguageBoundaries(e,t){const i=e.getLanguageId(t);let r=0;for(let o=t;o>=0&&e.getLanguageId(o)===i;o--)r=e.getStartOffset(o);let s=e.getLineContent().length;for(let o=t,a=e.getCount();o{const o=this.getLanguageId();s.changedLanguages.indexOf(o)!==-1&&this.resetTokenization()})),this.resetTokenization(),this._register(r.onDidChangeVisibleRanges(({view:s,state:o})=>{if(o){let a=this._attachedViewStates.get(s);a||(a=new TLt(()=>this.refreshRanges(a.lineRanges)),this._attachedViewStates.set(s,a)),a.handleStateChange(o)}else this._attachedViewStates.deleteAndDispose(s)}))}resetTokenization(e=!0){this._tokens.flush(),this._debugBackgroundTokens?.flush(),this._debugBackgroundStates&&(this._debugBackgroundStates=new VQ(this._textModel.getLineCount())),e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]});const t=()=>{if(this._textModel.isTooLargeForTokenization())return[null,null];const s=rs.get(this.getLanguageId());if(!s)return[null,null];let o;try{o=s.getInitialState()}catch(a){return rn(a),[null,null]}return[s,o]},[i,r]=t();if(i&&r?this._tokenizer=new CLt(this._textModel.getLineCount(),i,this._textModel,this._languageIdCodec):this._tokenizer=null,this._backgroundTokenizer.clear(),this._defaultBackgroundTokenizer=null,this._tokenizer){const s={setTokens:o=>{this.setTokens(o)},backgroundTokenizationFinished:()=>{if(this._backgroundTokenizationState===2)return;const o=2;this._backgroundTokenizationState=o,this._onDidChangeBackgroundTokenizationState.fire()},setEndState:(o,a)=>{if(!this._tokenizer)return;const l=this._tokenizer.store.getFirstInvalidEndStateLineNumber();l!==null&&o>=l&&this._tokenizer?.store.setEndState(o,a)}};i&&i.createBackgroundTokenizer&&!i.backgroundTokenizerShouldOnlyVerifyTokens&&(this._backgroundTokenizer.value=i.createBackgroundTokenizer(this._textModel,s)),!this._backgroundTokenizer.value&&!this._textModel.isTooLargeForTokenization()&&(this._backgroundTokenizer.value=this._defaultBackgroundTokenizer=new kLt(this._tokenizer,s),this._defaultBackgroundTokenizer.handleChanges()),i?.backgroundTokenizerShouldOnlyVerifyTokens&&i.createBackgroundTokenizer?(this._debugBackgroundTokens=new ON(this._languageIdCodec),this._debugBackgroundStates=new VQ(this._textModel.getLineCount()),this._debugBackgroundTokenizer.clear(),this._debugBackgroundTokenizer.value=i.createBackgroundTokenizer(this._textModel,{setTokens:o=>{this._debugBackgroundTokens?.setMultilineTokens(o,this._textModel)},backgroundTokenizationFinished(){},setEndState:(o,a)=>{this._debugBackgroundStates?.setEndState(o,a)}})):(this._debugBackgroundTokens=void 0,this._debugBackgroundStates=void 0,this._debugBackgroundTokenizer.value=void 0)}this.refreshAllVisibleLineTokens()}handleDidChangeAttached(){this._defaultBackgroundTokenizer?.handleChanges()}handleDidChangeContent(e){if(e.isFlush)this.resetTokenization(!1);else if(!e.isEolChange){for(const t of e.changes){const[i,r]=Lb(t.text);this._tokens.acceptEdit(t.range,i,r),this._debugBackgroundTokens?.acceptEdit(t.range,i,r)}this._debugBackgroundStates?.acceptChanges(e.changes),this._tokenizer&&this._tokenizer.store.acceptChanges(e.changes),this._defaultBackgroundTokenizer?.handleChanges()}}setTokens(e){const{changes:t}=this._tokens.setMultilineTokens(e,this._textModel);return t.length>0&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:t}),{changes:t}}refreshAllVisibleLineTokens(){const e=gn.joinMany([...this._attachedViewStates].map(([t,i])=>i.lineRanges));this.refreshRanges(e)}refreshRanges(e){for(const t of e)this.refreshRange(t.startLineNumber,t.endLineNumberExclusive-1)}refreshRange(e,t){if(!this._tokenizer)return;e=Math.max(1,Math.min(this._textModel.getLineCount(),e)),t=Math.min(this._textModel.getLineCount(),t);const i=new HQ,{heuristicTokens:r}=this._tokenizer.tokenizeHeuristically(i,e,t),s=this.setTokens(i.finalize());if(r)for(const o of s.changes)this._backgroundTokenizer.value?.requestTokens(o.fromLineNumber,o.toLineNumber+1);this._defaultBackgroundTokenizer?.checkFinished()}forceTokenization(e){const t=new HQ;this._tokenizer?.updateTokensUntilLine(t,e),this.setTokens(t.finalize()),this._defaultBackgroundTokenizer?.checkFinished()}hasAccurateTokensForLine(e){return this._tokenizer?this._tokenizer.hasAccurateTokensForLine(e):!0}isCheapToTokenize(e){return this._tokenizer?this._tokenizer.isCheapToTokenize(e):!0}getLineTokens(e){const t=this._textModel.getLineContent(e),i=this._tokens.getTokens(this._textModel.getLanguageId(),e-1,t);if(this._debugBackgroundTokens&&this._debugBackgroundStates&&this._tokenizer&&this._debugBackgroundStates.getFirstInvalidEndStateLineNumberOrMax()>e&&this._tokenizer.store.getFirstInvalidEndStateLineNumberOrMax()>e){const r=this._debugBackgroundTokens.getTokens(this._textModel.getLanguageId(),e-1,t);!i.equals(r)&&this._debugBackgroundTokenizer.value?.reportMismatchingTokens&&this._debugBackgroundTokenizer.value.reportMismatchingTokens(e)}return i}getTokenTypeIfInsertingCharacter(e,t,i){if(!this._tokenizer)return 0;const r=this._textModel.validatePosition(new he(e,t));return this.forceTokenization(r.lineNumber),this._tokenizer.getTokenTypeIfInsertingCharacter(r,i)}tokenizeLineWithEdit(e,t,i){if(!this._tokenizer)return null;const r=this._textModel.validatePosition(e);return this.forceTokenization(r.lineNumber),this._tokenizer.tokenizeLineWithEdit(r,t,i)}get hasTokens(){return this._tokens.hasTokens}}class ILt{constructor(){this.changeType=1}}class Lg{static applyInjectedText(e,t){if(!t||t.length===0)return e;let i="",r=0;for(const s of t)i+=e.substring(r,s.column-1),r=s.column-1,i+=s.options.content;return i+=e.substring(r),i}static fromDecorations(e){const t=[];for(const i of e)i.options.before&&i.options.before.content.length>0&&t.push(new Lg(i.ownerId,i.range.startLineNumber,i.range.startColumn,i.options.before,0)),i.options.after&&i.options.after.content.length>0&&t.push(new Lg(i.ownerId,i.range.endLineNumber,i.range.endColumn,i.options.after,1));return t.sort((i,r)=>i.lineNumber===r.lineNumber?i.column===r.column?i.order-r.order:i.column-r.column:i.lineNumber-r.lineNumber),t}constructor(e,t,i,r,s){this.ownerId=e,this.lineNumber=t,this.column=i,this.options=r,this.order=s}}class yye{constructor(e,t,i){this.changeType=2,this.lineNumber=e,this.detail=t,this.injectedText=i}}class ALt{constructor(e,t){this.changeType=3,this.fromLineNumber=e,this.toLineNumber=t}}class NLt{constructor(e,t,i,r){this.changeType=4,this.injectedTexts=r,this.fromLineNumber=e,this.toLineNumber=t,this.detail=i}}class RLt{constructor(){this.changeType=5}}class vk{constructor(e,t,i,r){this.changes=e,this.versionId=t,this.isUndoing=i,this.isRedoing=r,this.resultingSelection=null}containsEvent(e){for(let t=0,i=this.changes.length;t=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},j4=function(n,e){return function(t,i){e(t,i,n)}},q1;function OLt(n){const e=new JFe;return e.acceptChunk(n),e.finish()}function MLt(n){const e=new JFe;let t;for(;typeof(t=n.read())=="string";)e.acceptChunk(t);return e.finish()}function wye(n,e){let t;return typeof n=="string"?t=OLt(n):Sbt(n)?t=MLt(n):t=n,t.create(e)}let q4=0;const FLt=999,BLt=1e4;class $Lt{constructor(e){this._source=e,this._eos=!1}read(){if(this._eos)return null;const e=[];let t=0,i=0;do{const r=this._source.read();if(r===null)return this._eos=!0,t===0?null:e.join("");if(r.length>0&&(e[t++]=r,i+=r.length),i>=64*1024)return e.join("")}while(!0)}}const OT=()=>{throw new Error("Invalid change accessor")};let og=class extends me{static{q1=this}static{this._MODEL_SYNC_LIMIT=50*1024*1024}static{this.LARGE_FILE_SIZE_THRESHOLD=20*1024*1024}static{this.LARGE_FILE_LINE_COUNT_THRESHOLD=300*1e3}static{this.LARGE_FILE_HEAP_OPERATION_THRESHOLD=256*1024*1024}static{this.DEFAULT_CREATION_OPTIONS={isForSimpleWidget:!1,tabSize:Va.tabSize,indentSize:Va.indentSize,insertSpaces:Va.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:Va.trimAutoWhitespace,largeFileOptimizations:Va.largeFileOptimizations,bracketPairColorizationOptions:Va.bracketPairColorizationOptions}}static resolveOptions(e,t){if(t.detectIndentation){const i=cye(e,t.tabSize,t.insertSpaces);return new U5({tabSize:i.tabSize,indentSize:"tabSize",insertSpaces:i.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}return new U5(t)}get onDidChangeLanguage(){return this._tokenizationTextModelPart.onDidChangeLanguage}get onDidChangeLanguageConfiguration(){return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration}get onDidChangeTokens(){return this._tokenizationTextModelPart.onDidChangeTokens}onDidChangeContent(e){return this._eventEmitter.slowEvent(t=>e(t.contentChangedEvent))}onDidChangeContentOrInjectedText(e){return Qh(this._eventEmitter.fastEvent(t=>e(t)),this._onDidChangeInjectedText.event(t=>e(t)))}_isDisposing(){return this.__isDisposing}get tokenization(){return this._tokenizationTextModelPart}get bracketPairs(){return this._bracketPairs}get guides(){return this._guidesTextModelPart}constructor(e,t,i,r=null,s,o,a,l){super(),this._undoRedoService=s,this._languageService=o,this._languageConfigurationService=a,this.instantiationService=l,this._onWillDispose=this._register(new fe),this.onWillDispose=this._onWillDispose.event,this._onDidChangeDecorations=this._register(new jLt(g=>this.handleBeforeFireDecorationsChangedEvent(g))),this.onDidChangeDecorations=this._onDidChangeDecorations.event,this._onDidChangeOptions=this._register(new fe),this.onDidChangeOptions=this._onDidChangeOptions.event,this._onDidChangeAttached=this._register(new fe),this.onDidChangeAttached=this._onDidChangeAttached.event,this._onDidChangeInjectedText=this._register(new fe),this._eventEmitter=this._register(new qLt),this._languageSelectionListener=this._register(new To),this._deltaDecorationCallCnt=0,this._attachedViews=new ELt,q4++,this.id="$model"+q4,this.isForSimpleWidget=i.isForSimpleWidget,typeof r>"u"||r===null?this._associatedResource=Pt.parse("inmemory://model/"+q4):this._associatedResource=r,this._attachedEditorCount=0;const{textBuffer:c,disposable:u}=wye(e,i.defaultEOL);this._buffer=c,this._bufferDisposable=u,this._options=q1.resolveOptions(this._buffer,i);const d=typeof t=="string"?t:t.languageId;typeof t!="string"&&(this._languageSelectionListener.value=t.onDidChange(()=>this._setLanguage(t.languageId))),this._bracketPairs=this._register(new jEt(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new ZEt(this,this._languageConfigurationService)),this._decorationProvider=this._register(new KEt(this)),this._tokenizationTextModelPart=this.instantiationService.createInstance(zQ,this,this._bracketPairs,d,this._attachedViews);const h=this._buffer.getLineCount(),f=this._buffer.getValueLengthInRange(new $(1,1,h,this._buffer.getLineLength(h)+1),0);i.largeFileOptimizations?(this._isTooLargeForTokenization=f>q1.LARGE_FILE_SIZE_THRESHOLD||h>q1.LARGE_FILE_LINE_COUNT_THRESHOLD,this._isTooLargeForHeapOperation=f>q1.LARGE_FILE_HEAP_OPERATION_THRESHOLD):(this._isTooLargeForTokenization=!1,this._isTooLargeForHeapOperation=!1),this._isTooLargeForSyncing=f>q1._MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this.__isDisposing=!1,this._instanceId=j4e(q4),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new Cye,this._commandManager=new Zle(this,this._undoRedoService),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._register(this._decorationProvider.onDidChange(()=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._onDidChangeDecorations.endDeferredEmit()})),this._languageService.requestRichLanguageFeatures(d),this._register(this._languageConfigurationService.onDidChange(g=>{this._bracketPairs.handleLanguageConfigurationServiceChange(g),this._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(g)}))}dispose(){this.__isDisposing=!0,this._onWillDispose.fire(),this._tokenizationTextModelPart.dispose(),this._isDisposed=!0,super.dispose(),this._bufferDisposable.dispose(),this.__isDisposing=!1;const e=new _k([],"",` `,!1,!1,!0,!0);e.dispose(),this._buffer=e,this._bufferDisposable=me.None}_assertNotDisposed(){if(this._isDisposed)throw new fi("Model is disposed!")}_emitContentChangedEvent(e,t){this.__isDisposing||(this._tokenizationTextModelPart.handleDidChangeContent(t),this._bracketPairs.handleDidChangeContent(t),this._eventEmitter.fire(new Jy(e,t)))}setValue(e){if(this._assertNotDisposed(),e==null)throw qd();const{textBuffer:t,disposable:i}=wye(e,this._options.defaultEOL);this._setValueFromTextBuffer(t,i)}_createContentChanged2(e,t,i,r,s,o,a,l){return{changes:[{range:e,rangeOffset:t,rangeLength:i,text:r}],eol:this._buffer.getEOL(),isEolChange:l,versionId:this.getVersionId(),isUndoing:s,isRedoing:o,isFlush:a}}_setValueFromTextBuffer(e,t){this._assertNotDisposed();const i=this.getFullModelRange(),r=this.getValueLengthInRange(i),s=this.getLineCount(),o=this.getLineMaxColumn(s);this._buffer=e,this._bufferDisposable.dispose(),this._bufferDisposable=t,this._increaseVersionId(),this._decorations=Object.create(null),this._decorationsTree=new Cye,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new vk([new ILt],this._versionId,!1,!1),this._createContentChanged2(new $(1,1,s,o),0,r,this.getValue(),!1,!1,!0,!1))}setEOL(e){this._assertNotDisposed();const t=e===1?`\r `:` -`;if(this._buffer.getEOL()===t)return;const i=this.getFullModelRange(),r=this.getValueLengthInRange(i),s=this.getLineCount(),o=this.getLineMaxColumn(s);this._onBeforeEOLChange(),this._buffer.setEOL(t),this._increaseVersionId(),this._onAfterEOLChange(),this._emitContentChangedEvent(new vk([new RLt],this._versionId,!1,!1),this._createContentChanged2(new $(1,1,s,o),0,r,this.getValue(),!1,!1,!1,!0))}_onBeforeEOLChange(){this._decorationsTree.ensureAllNodesHaveRanges(this)}_onAfterEOLChange(){const e=this.getVersionId(),t=this._decorationsTree.collectNodesPostOrder();for(let i=0,r=t.length;i0}getAttachedEditorCount(){return this._attachedEditorCount}isTooLargeForSyncing(){return this._isTooLargeForSyncing}isTooLargeForTokenization(){return this._isTooLargeForTokenization}isTooLargeForHeapOperation(){return this._isTooLargeForHeapOperation}isDisposed(){return this._isDisposed}isDominatedByLongLines(){if(this._assertNotDisposed(),this.isTooLargeForTokenization())return!1;let e=0,t=0;const i=this._buffer.getLineCount();for(let r=1;r<=i;r++){const s=this._buffer.getLineLength(r);s>=BLt?t+=s:e+=s}return t>e}get uri(){return this._associatedResource}getOptions(){return this._assertNotDisposed(),this._options}getFormattingOptions(){return{tabSize:this._options.indentSize,insertSpaces:this._options.insertSpaces}}updateOptions(e){this._assertNotDisposed();const t=typeof e.tabSize<"u"?e.tabSize:this._options.tabSize,i=typeof e.indentSize<"u"?e.indentSize:this._options.originalIndentSize,r=typeof e.insertSpaces<"u"?e.insertSpaces:this._options.insertSpaces,s=typeof e.trimAutoWhitespace<"u"?e.trimAutoWhitespace:this._options.trimAutoWhitespace,o=typeof e.bracketColorizationOptions<"u"?e.bracketColorizationOptions:this._options.bracketPairColorizationOptions,a=new UF({tabSize:t,indentSize:i,insertSpaces:r,defaultEOL:this._options.defaultEOL,trimAutoWhitespace:s,bracketPairColorizationOptions:o});if(this._options.equals(a))return;const l=this._options.createChangeEvent(a);this._options=a,this._bracketPairs.handleDidChangeOptions(l),this._decorationProvider.handleDidChangeOptions(l),this._onDidChangeOptions.fire(l)}detectIndentation(e,t){this._assertNotDisposed();const i=cye(this._buffer,t,e);this.updateOptions({insertSpaces:i.insertSpaces,tabSize:i.tabSize,indentSize:i.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),jle(e,this._options.indentSize,this._options.insertSpaces)}getVersionId(){return this._assertNotDisposed(),this._versionId}mightContainRTL(){return this._buffer.mightContainRTL()}mightContainUnusualLineTerminators(){return this._buffer.mightContainUnusualLineTerminators()}removeUnusualLineTerminators(e=null){const t=this.findMatches(z4e.source,!1,!0,!1,null,!1,1073741824);this._buffer.resetMightContainUnusualLineTerminators(),this.pushEditOperations(e,t.map(i=>({range:i.range,text:null})),()=>null)}mightContainNonBasicASCII(){return this._buffer.mightContainNonBasicASCII()}getAlternativeVersionId(){return this._assertNotDisposed(),this._alternativeVersionId}getInitialUndoRedoSnapshot(){return this._assertNotDisposed(),this._initialUndoRedoSnapshot}getOffsetAt(e){this._assertNotDisposed();const t=this._validatePosition(e.lineNumber,e.column,0);return this._buffer.getOffsetAt(t.lineNumber,t.column)}getPositionAt(e){this._assertNotDisposed();const t=Math.min(this._buffer.getLength(),Math.max(0,e));return this._buffer.getPositionAt(t)}_increaseVersionId(){this._versionId=this._versionId+1,this._alternativeVersionId=this._versionId}_overwriteVersionId(e){this._versionId=e}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e}_overwriteInitialUndoRedoSnapshot(e){this._initialUndoRedoSnapshot=e}getValue(e,t=!1){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new fi("Operation would exceed heap memory limits");const i=this.getFullModelRange(),r=this.getValueInRange(i,e);return t?this._buffer.getBOM()+r:r}createSnapshot(e=!1){return new $Lt(this._buffer.createSnapshot(e))}getValueLength(e,t=!1){this._assertNotDisposed();const i=this.getFullModelRange(),r=this.getValueLengthInRange(i,e);return t?this._buffer.getBOM().length+r:r}getValueInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueInRange(this.validateRange(e),t)}getValueLengthInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueLengthInRange(this.validateRange(e),t)}getCharacterCountInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getCharacterCountInRange(this.validateRange(e),t)}getLineCount(){return this._assertNotDisposed(),this._buffer.getLineCount()}getLineContent(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new fi("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new fi("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new fi("Operation would exceed heap memory limits");return this._buffer.getLinesContent()}getEOL(){return this._assertNotDisposed(),this._buffer.getEOL()}getEndOfLineSequence(){return this._assertNotDisposed(),this._buffer.getEOL()===` +`;if(this._buffer.getEOL()===t)return;const i=this.getFullModelRange(),r=this.getValueLengthInRange(i),s=this.getLineCount(),o=this.getLineMaxColumn(s);this._onBeforeEOLChange(),this._buffer.setEOL(t),this._increaseVersionId(),this._onAfterEOLChange(),this._emitContentChangedEvent(new vk([new RLt],this._versionId,!1,!1),this._createContentChanged2(new $(1,1,s,o),0,r,this.getValue(),!1,!1,!1,!0))}_onBeforeEOLChange(){this._decorationsTree.ensureAllNodesHaveRanges(this)}_onAfterEOLChange(){const e=this.getVersionId(),t=this._decorationsTree.collectNodesPostOrder();for(let i=0,r=t.length;i0}getAttachedEditorCount(){return this._attachedEditorCount}isTooLargeForSyncing(){return this._isTooLargeForSyncing}isTooLargeForTokenization(){return this._isTooLargeForTokenization}isTooLargeForHeapOperation(){return this._isTooLargeForHeapOperation}isDisposed(){return this._isDisposed}isDominatedByLongLines(){if(this._assertNotDisposed(),this.isTooLargeForTokenization())return!1;let e=0,t=0;const i=this._buffer.getLineCount();for(let r=1;r<=i;r++){const s=this._buffer.getLineLength(r);s>=BLt?t+=s:e+=s}return t>e}get uri(){return this._associatedResource}getOptions(){return this._assertNotDisposed(),this._options}getFormattingOptions(){return{tabSize:this._options.indentSize,insertSpaces:this._options.insertSpaces}}updateOptions(e){this._assertNotDisposed();const t=typeof e.tabSize<"u"?e.tabSize:this._options.tabSize,i=typeof e.indentSize<"u"?e.indentSize:this._options.originalIndentSize,r=typeof e.insertSpaces<"u"?e.insertSpaces:this._options.insertSpaces,s=typeof e.trimAutoWhitespace<"u"?e.trimAutoWhitespace:this._options.trimAutoWhitespace,o=typeof e.bracketColorizationOptions<"u"?e.bracketColorizationOptions:this._options.bracketPairColorizationOptions,a=new U5({tabSize:t,indentSize:i,insertSpaces:r,defaultEOL:this._options.defaultEOL,trimAutoWhitespace:s,bracketPairColorizationOptions:o});if(this._options.equals(a))return;const l=this._options.createChangeEvent(a);this._options=a,this._bracketPairs.handleDidChangeOptions(l),this._decorationProvider.handleDidChangeOptions(l),this._onDidChangeOptions.fire(l)}detectIndentation(e,t){this._assertNotDisposed();const i=cye(this._buffer,t,e);this.updateOptions({insertSpaces:i.insertSpaces,tabSize:i.tabSize,indentSize:i.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),jle(e,this._options.indentSize,this._options.insertSpaces)}getVersionId(){return this._assertNotDisposed(),this._versionId}mightContainRTL(){return this._buffer.mightContainRTL()}mightContainUnusualLineTerminators(){return this._buffer.mightContainUnusualLineTerminators()}removeUnusualLineTerminators(e=null){const t=this.findMatches(z4e.source,!1,!0,!1,null,!1,1073741824);this._buffer.resetMightContainUnusualLineTerminators(),this.pushEditOperations(e,t.map(i=>({range:i.range,text:null})),()=>null)}mightContainNonBasicASCII(){return this._buffer.mightContainNonBasicASCII()}getAlternativeVersionId(){return this._assertNotDisposed(),this._alternativeVersionId}getInitialUndoRedoSnapshot(){return this._assertNotDisposed(),this._initialUndoRedoSnapshot}getOffsetAt(e){this._assertNotDisposed();const t=this._validatePosition(e.lineNumber,e.column,0);return this._buffer.getOffsetAt(t.lineNumber,t.column)}getPositionAt(e){this._assertNotDisposed();const t=Math.min(this._buffer.getLength(),Math.max(0,e));return this._buffer.getPositionAt(t)}_increaseVersionId(){this._versionId=this._versionId+1,this._alternativeVersionId=this._versionId}_overwriteVersionId(e){this._versionId=e}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e}_overwriteInitialUndoRedoSnapshot(e){this._initialUndoRedoSnapshot=e}getValue(e,t=!1){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new fi("Operation would exceed heap memory limits");const i=this.getFullModelRange(),r=this.getValueInRange(i,e);return t?this._buffer.getBOM()+r:r}createSnapshot(e=!1){return new $Lt(this._buffer.createSnapshot(e))}getValueLength(e,t=!1){this._assertNotDisposed();const i=this.getFullModelRange(),r=this.getValueLengthInRange(i,e);return t?this._buffer.getBOM().length+r:r}getValueInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueInRange(this.validateRange(e),t)}getValueLengthInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueLengthInRange(this.validateRange(e),t)}getCharacterCountInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getCharacterCountInRange(this.validateRange(e),t)}getLineCount(){return this._assertNotDisposed(),this._buffer.getLineCount()}getLineContent(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new fi("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new fi("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new fi("Operation would exceed heap memory limits");return this._buffer.getLinesContent()}getEOL(){return this._assertNotDisposed(),this._buffer.getEOL()}getEndOfLineSequence(){return this._assertNotDisposed(),this._buffer.getEOL()===` `?0:1}getLineMinColumn(e){return this._assertNotDisposed(),1}getLineMaxColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new fi("Illegal value for lineNumber");return this._buffer.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new fi("Illegal value for lineNumber");return this._buffer.getLineFirstNonWhitespaceColumn(e)}getLineLastNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new fi("Illegal value for lineNumber");return this._buffer.getLineLastNonWhitespaceColumn(e)}_validateRangeRelaxedNoAllocations(e){const t=this._buffer.getLineCount(),i=e.startLineNumber,r=e.startColumn;let s=Math.floor(typeof i=="number"&&!isNaN(i)?i:1),o=Math.floor(typeof r=="number"&&!isNaN(r)?r:1);if(s<1)s=1,o=1;else if(s>t)s=t,o=this.getLineMaxColumn(s);else if(o<=1)o=1;else{const d=this.getLineMaxColumn(s);o>=d&&(o=d)}const a=e.endLineNumber,l=e.endColumn;let c=Math.floor(typeof a=="number"&&!isNaN(a)?a:1),u=Math.floor(typeof l=="number"&&!isNaN(l)?l:1);if(c<1)c=1,u=1;else if(c>t)c=t,u=this.getLineMaxColumn(c);else if(u<=1)u=1;else{const d=this.getLineMaxColumn(c);u>=d&&(u=d)}return i===s&&r===o&&a===c&&l===u&&e instanceof $&&!(e instanceof yt)?e:new $(s,o,c,u)}_isValidPosition(e,t,i){if(typeof e!="number"||typeof t!="number"||isNaN(e)||isNaN(t)||e<1||t<1||(e|0)!==e||(t|0)!==t)return!1;const r=this._buffer.getLineCount();if(e>r)return!1;if(t===1)return!0;const s=this.getLineMaxColumn(e);if(t>s)return!1;if(i===1){const o=this._buffer.getLineCharCode(e,t-2);if(Co(o))return!1}return!0}_validatePosition(e,t,i){const r=Math.floor(typeof e=="number"&&!isNaN(e)?e:1),s=Math.floor(typeof t=="number"&&!isNaN(t)?t:1),o=this._buffer.getLineCount();if(r<1)return new he(1,1);if(r>o)return new he(o,this.getLineMaxColumn(o));if(s<=1)return new he(r,1);const a=this.getLineMaxColumn(r);if(s>=a)return new he(r,a);if(i===1){const l=this._buffer.getLineCharCode(r,s-2);if(Co(l))return new he(r,s-1)}return new he(r,s)}validatePosition(e){return this._assertNotDisposed(),e instanceof he&&this._isValidPosition(e.lineNumber,e.column,1)?e:this._validatePosition(e.lineNumber,e.column,1)}_isValidRange(e,t){const i=e.startLineNumber,r=e.startColumn,s=e.endLineNumber,o=e.endColumn;if(!this._isValidPosition(i,r,0)||!this._isValidPosition(s,o,0))return!1;if(t===1){const a=r>1?this._buffer.getLineCharCode(i,r-2):0,l=o>1&&o<=this._buffer.getLineLength(s)?this._buffer.getLineCharCode(s,o-2):0,c=Co(a),u=Co(l);return!c&&!u}return!0}validateRange(e){if(this._assertNotDisposed(),e instanceof $&&!(e instanceof yt)&&this._isValidRange(e,1))return e;const i=this._validatePosition(e.startLineNumber,e.startColumn,0),r=this._validatePosition(e.endLineNumber,e.endColumn,0),s=i.lineNumber,o=i.column,a=r.lineNumber,l=r.column;{const c=o>1?this._buffer.getLineCharCode(s,o-2):0,u=l>1&&l<=this._buffer.getLineLength(a)?this._buffer.getLineCharCode(a,l-2):0,d=Co(c),h=Co(u);return!d&&!h?new $(s,o,a,l):s===a&&o===l?new $(s,o-1,a,l-1):d&&h?new $(s,o-1,a,l+1):d?new $(s,o-1,a,l):new $(s,o,a,l+1)}}modifyPosition(e,t){this._assertNotDisposed();const i=this.getOffsetAt(e)+t;return this.getPositionAt(Math.min(this._buffer.getLength(),Math.max(0,i)))}getFullModelRange(){this._assertNotDisposed();const e=this.getLineCount();return new $(1,1,e,this.getLineMaxColumn(e))}findMatchesLineByLine(e,t,i,r){return this._buffer.findMatchesLineByLine(e,t,i,r)}findMatches(e,t,i,r,s,o,a=FLt){this._assertNotDisposed();let l=null;t!==null&&(Array.isArray(t)||(t=[t]),t.every(d=>$.isIRange(d))&&(l=t.map(d=>this.validateRange(d)))),l===null&&(l=[this.getFullModelRange()]),l=l.sort((d,h)=>d.startLineNumber-h.startLineNumber||d.startColumn-h.startColumn);const c=[];c.push(l.reduce((d,h)=>$.areIntersecting(d,h)?d.plusRange(h):(c.push(d),h)));let u;if(!i&&e.indexOf(` `)<0){const h=new j1(e,i,r,s).parseSearchRequest();if(!h)return[];u=f=>this.findMatchesLineByLine(f,h,o,a)}else u=d=>E4.findMatches(this,new j1(e,i,r,s),d,o,a);return c.map(u).reduce((d,h)=>d.concat(h),[])}findNextMatch(e,t,i,r,s,o){this._assertNotDisposed();const a=this.validatePosition(t);if(!i&&e.indexOf(` `)<0){const c=new j1(e,i,r,s).parseSearchRequest();if(!c)return null;const u=this.getLineCount();let d=new $(a.lineNumber,a.column,u,this.getLineMaxColumn(u)),h=this.findMatchesLineByLine(d,c,o,1);return E4.findNextMatch(this,new j1(e,i,r,s),a,o),h.length>0||(d=new $(1,1,a.lineNumber,this.getLineMaxColumn(a.lineNumber)),h=this.findMatchesLineByLine(d,c,o,1),h.length>0)?h[0]:null}return E4.findNextMatch(this,new j1(e,i,r,s),a,o)}findPreviousMatch(e,t,i,r,s,o){this._assertNotDisposed();const a=this.validatePosition(t);return E4.findPreviousMatch(this,new j1(e,i,r,s),a,o)}pushStackElement(){this._commandManager.pushStackElement()}popStackElement(){this._commandManager.popStackElement()}pushEOL(e){if((this.getEOL()===` `?0:1)!==e)try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEOL(e)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_validateEditOperation(e){return e instanceof Fj?e:new Fj(e.identifier||null,this.validateRange(e.range),e.text,e.forceMoveMarkers||!1,e.isAutoWhitespaceEdit||!1,e._isTracked||!1)}_validateEditOperations(e){const t=[];for(let i=0,r=e.length;i({range:this.validateRange(a.range),text:a.text}));let o=!0;if(e)for(let a=0,l=e.length;ac.endLineNumber,p=c.startLineNumber>f.endLineNumber;if(!g&&!p){u=!0;break}}if(!u){o=!1;break}}if(o)for(let a=0,l=this._trimAutoWhitespaceLines.length;ag.endLineNumber)&&!(c===g.startLineNumber&&g.startColumn===u&&g.isEmpty()&&p&&p.length>0&&p.charAt(0)===` `)&&!(c===g.startLineNumber&&g.startColumn===1&&g.isEmpty()&&p&&p.length>0&&p.charAt(p.length-1)===` -`)){d=!1;break}}if(d){const h=new $(c,1,c,u);t.push(new Fj(null,h,null,!1,!1,!1))}}this._trimAutoWhitespaceLines=null}return this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEditOperation(e,t,i,r)}_applyUndo(e,t,i,r){const s=e.map(o=>{const a=this.getPositionAt(o.newPosition),l=this.getPositionAt(o.newEnd);return{range:new $(a.lineNumber,a.column,l.lineNumber,l.column),text:o.oldText}});this._applyUndoRedoEdits(s,t,!0,!1,i,r)}_applyRedo(e,t,i,r){const s=e.map(o=>{const a=this.getPositionAt(o.oldPosition),l=this.getPositionAt(o.oldEnd);return{range:new $(a.lineNumber,a.column,l.lineNumber,l.column),text:o.newText}});this._applyUndoRedoEdits(s,t,!1,!0,i,r)}_applyUndoRedoEdits(e,t,i,r,s,o){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._isUndoing=i,this._isRedoing=r,this.applyEdits(e,!1),this.setEOL(t),this._overwriteAlternativeVersionId(s)}finally{this._isUndoing=!1,this._isRedoing=!1,this._eventEmitter.endDeferredEmit(o),this._onDidChangeDecorations.endDeferredEmit()}}applyEdits(e,t=!1){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit();const i=this._validateEditOperations(e);return this._doApplyEdits(i,t)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_doApplyEdits(e,t){const i=this._buffer.getLineCount(),r=this._buffer.applyEdits(e,this._options.trimAutoWhitespace,t),s=this._buffer.getLineCount(),o=r.changes;if(this._trimAutoWhitespaceLines=r.trimAutoWhitespaceLineNumbers,o.length!==0){for(let c=0,u=o.length;c=0;I--){const O=f+I,M=y+I;D.takeFromEndWhile(G=>G.lineNumber>M);const B=D.takeFromEndWhile(G=>G.lineNumber===M);a.push(new yye(O,this.getLineContent(M),B))}if(_ee.lineNumberee.lineNumber===q)}a.push(new NLt(O+1,f+m,W,G))}l+=v}this._emitContentChangedEvent(new vk(a,this.getVersionId(),this._isUndoing,this._isRedoing),{changes:o,eol:this._buffer.getEOL(),isEolChange:!1,versionId:this.getVersionId(),isUndoing:this._isUndoing,isRedoing:this._isRedoing,isFlush:!1})}return r.reverseEdits===null?void 0:r.reverseEdits}undo(){return this._undoRedoService.undo(this.uri)}canUndo(){return this._undoRedoService.canUndo(this.uri)}redo(){return this._undoRedoService.redo(this.uri)}canRedo(){return this._undoRedoService.canRedo(this.uri)}handleBeforeFireDecorationsChangedEvent(e){if(e===null||e.size===0)return;const i=Array.from(e).map(r=>new yye(r,this.getLineContent(r),this._getInjectedTextInLine(r)));this._onDidChangeInjectedText.fire(new n6e(i))}changeDecorations(e,t=0){this._assertNotDisposed();try{return this._onDidChangeDecorations.beginDeferredEmit(),this._changeDecorations(t,e)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_changeDecorations(e,t){const i={addDecoration:(s,o)=>this._deltaDecorationsImpl(e,[],[{range:s,options:o}])[0],changeDecoration:(s,o)=>{this._changeDecorationImpl(s,o)},changeDecorationOptions:(s,o)=>{this._changeDecorationOptionsImpl(s,Sye(o))},removeDecoration:s=>{this._deltaDecorationsImpl(e,[s],[])},deltaDecorations:(s,o)=>s.length===0&&o.length===0?[]:this._deltaDecorationsImpl(e,s,o)};let r=null;try{r=t(i)}catch(s){rn(s)}return i.addDecoration=OT,i.changeDecoration=OT,i.changeDecorationOptions=OT,i.removeDecoration=OT,i.deltaDecorations=OT,r}deltaDecorations(e,t,i=0){if(this._assertNotDisposed(),e||(e=[]),e.length===0&&t.length===0)return[];try{return this._deltaDecorationCallCnt++,this._deltaDecorationCallCnt>1&&(console.warn("Invoking deltaDecorations recursively could lead to leaking decorations."),rn(new Error("Invoking deltaDecorations recursively could lead to leaking decorations."))),this._onDidChangeDecorations.beginDeferredEmit(),this._deltaDecorationsImpl(i,e,t)}finally{this._onDidChangeDecorations.endDeferredEmit(),this._deltaDecorationCallCnt--}}_getTrackedRange(e){return this.getDecorationRange(e)}_setTrackedRange(e,t,i){const r=e?this._decorations[e]:null;if(!r)return t?this._deltaDecorationsImpl(0,[],[{range:t,options:xye[i]}],!0)[0]:null;if(!t)return this._decorationsTree.delete(r),delete this._decorations[r.id],null;const s=this._validateRangeRelaxedNoAllocations(t),o=this._buffer.getOffsetAt(s.startLineNumber,s.startColumn),a=this._buffer.getOffsetAt(s.endLineNumber,s.endColumn);return this._decorationsTree.delete(r),r.reset(this.getVersionId(),o,a,s),r.setOptions(xye[i]),this._decorationsTree.insert(r),r.id}removeAllDecorationsWithOwnerId(e){if(this._isDisposed)return;const t=this._decorationsTree.collectNodesFromOwner(e);for(let i=0,r=t.length;ithis.getLineCount()?[]:this.getLinesDecorations(e,e,t,i)}getLinesDecorations(e,t,i=0,r=!1,s=!1){const o=this.getLineCount(),a=Math.min(o,Math.max(1,e)),l=Math.min(o,Math.max(1,t)),c=this.getLineMaxColumn(l),u=new $(a,1,l,c),d=this._getDecorationsInRange(u,i,r,s);return sZ(d,this._decorationProvider.getDecorationsInRange(u,i,r)),d}getDecorationsInRange(e,t=0,i=!1,r=!1,s=!1){const o=this.validateRange(e),a=this._getDecorationsInRange(o,t,i,s);return sZ(a,this._decorationProvider.getDecorationsInRange(o,t,i,r)),a}getOverviewRulerDecorations(e=0,t=!1){return this._decorationsTree.getAll(this,e,t,!0,!1)}getInjectedTextDecorations(e=0){return this._decorationsTree.getAllInjectedText(this,e)}_getInjectedTextInLine(e){const t=this._buffer.getOffsetAt(e,1),i=t+this._buffer.getLineLength(e),r=this._decorationsTree.getInjectedTextInInterval(this,t,i,0);return Lg.fromDecorations(r).filter(s=>s.lineNumber===e)}getAllDecorations(e=0,t=!1){let i=this._decorationsTree.getAll(this,e,t,!1,!1);return i=i.concat(this._decorationProvider.getAllDecorations(e,t)),i}getAllMarginDecorations(e=0){return this._decorationsTree.getAll(this,e,!1,!1,!0)}_getDecorationsInRange(e,t,i,r){const s=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),o=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getAllInInterval(this,s,o,t,i,r)}getRangeAt(e,t){return this._buffer.getRangeAt(e,t-e)}_changeDecorationImpl(e,t){const i=this._decorations[e];if(!i)return;if(i.options.after){const a=this.getDecorationRange(e);this._onDidChangeDecorations.recordLineAffectedByInjectedText(a.endLineNumber)}if(i.options.before){const a=this.getDecorationRange(e);this._onDidChangeDecorations.recordLineAffectedByInjectedText(a.startLineNumber)}const r=this._validateRangeRelaxedNoAllocations(t),s=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),o=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);this._decorationsTree.delete(i),i.reset(this.getVersionId(),s,o,r),this._decorationsTree.insert(i),this._onDidChangeDecorations.checkAffectedAndFire(i.options),i.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(r.endLineNumber),i.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(r.startLineNumber)}_changeDecorationOptionsImpl(e,t){const i=this._decorations[e];if(!i)return;const r=!!(i.options.overviewRuler&&i.options.overviewRuler.color),s=!!(t.overviewRuler&&t.overviewRuler.color);if(this._onDidChangeDecorations.checkAffectedAndFire(i.options),this._onDidChangeDecorations.checkAffectedAndFire(t),i.options.after||t.after){const l=this._decorationsTree.getNodeRange(this,i);this._onDidChangeDecorations.recordLineAffectedByInjectedText(l.endLineNumber)}if(i.options.before||t.before){const l=this._decorationsTree.getNodeRange(this,i);this._onDidChangeDecorations.recordLineAffectedByInjectedText(l.startLineNumber)}const o=r!==s,a=HLt(t)!==n5(i);o||a?(this._decorationsTree.delete(i),i.setOptions(t),this._decorationsTree.insert(i)):i.setOptions(t)}_deltaDecorationsImpl(e,t,i,r=!1){const s=this.getVersionId(),o=t.length;let a=0;const l=i.length;let c=0;this._onDidChangeDecorations.beginDeferredEmit();try{const u=new Array(l);for(;athis._setLanguage(e.languageId,t)),this._setLanguage(e.languageId,t))}_setLanguage(e,t){this.tokenization.setLanguageId(e,t),this._languageService.requestRichLanguageFeatures(e)}getLanguageIdAtPosition(e,t){return this.tokenization.getLanguageIdAtPosition(e,t)}getWordAtPosition(e){return this._tokenizationTextModelPart.getWordAtPosition(e)}getWordUntilPosition(e){return this._tokenizationTextModelPart.getWordUntilPosition(e)}normalizePosition(e,t){return e}getLineIndentColumn(e){return WLt(this.getLineContent(e))+1}};og=q1=PLt([j4(4,sle),j4(5,Hr),j4(6,Zr),j4(7,Tt)],og);function WLt(n){let e=0;for(const t of n)if(t===" "||t===" ")e++;else break;return e}function dq(n){return!!(n.options.overviewRuler&&n.options.overviewRuler.color)}function HLt(n){return!!n.after||!!n.before}function n5(n){return!!n.options.after||!!n.options.before}class Cye{constructor(){this._decorationsTree0=new aq,this._decorationsTree1=new aq,this._injectedTextDecorationsTree=new aq}ensureAllNodesHaveRanges(e){this.getAll(e,0,!1,!1,!1)}_ensureNodesHaveRanges(e,t){for(const i of t)i.range===null&&(i.range=e.getRangeAt(i.cachedAbsoluteStart,i.cachedAbsoluteEnd));return t}getAllInInterval(e,t,i,r,s,o){const a=e.getVersionId(),l=this._intervalSearch(t,i,r,s,a,o);return this._ensureNodesHaveRanges(e,l)}_intervalSearch(e,t,i,r,s,o){const a=this._decorationsTree0.intervalSearch(e,t,i,r,s,o),l=this._decorationsTree1.intervalSearch(e,t,i,r,s,o),c=this._injectedTextDecorationsTree.intervalSearch(e,t,i,r,s,o);return a.concat(l).concat(c)}getInjectedTextInInterval(e,t,i,r){const s=e.getVersionId(),o=this._injectedTextDecorationsTree.intervalSearch(t,i,r,!1,s,!1);return this._ensureNodesHaveRanges(e,o).filter(a=>a.options.showIfCollapsed||!a.range.isEmpty())}getAllInjectedText(e,t){const i=e.getVersionId(),r=this._injectedTextDecorationsTree.search(t,!1,i,!1);return this._ensureNodesHaveRanges(e,r).filter(s=>s.options.showIfCollapsed||!s.range.isEmpty())}getAll(e,t,i,r,s){const o=e.getVersionId(),a=this._search(t,i,r,o,s);return this._ensureNodesHaveRanges(e,a)}_search(e,t,i,r,s){if(i)return this._decorationsTree1.search(e,t,r,s);{const o=this._decorationsTree0.search(e,t,r,s),a=this._decorationsTree1.search(e,t,r,s),l=this._injectedTextDecorationsTree.search(e,t,r,s);return o.concat(a).concat(l)}}collectNodesFromOwner(e){const t=this._decorationsTree0.collectNodesFromOwner(e),i=this._decorationsTree1.collectNodesFromOwner(e),r=this._injectedTextDecorationsTree.collectNodesFromOwner(e);return t.concat(i).concat(r)}collectNodesPostOrder(){const e=this._decorationsTree0.collectNodesPostOrder(),t=this._decorationsTree1.collectNodesPostOrder(),i=this._injectedTextDecorationsTree.collectNodesPostOrder();return e.concat(t).concat(i)}insert(e){n5(e)?this._injectedTextDecorationsTree.insert(e):dq(e)?this._decorationsTree1.insert(e):this._decorationsTree0.insert(e)}delete(e){n5(e)?this._injectedTextDecorationsTree.delete(e):dq(e)?this._decorationsTree1.delete(e):this._decorationsTree0.delete(e)}getNodeRange(e,t){const i=e.getVersionId();return t.cachedVersionId!==i&&this._resolveNode(t,i),t.range===null&&(t.range=e.getRangeAt(t.cachedAbsoluteStart,t.cachedAbsoluteEnd)),t.range}_resolveNode(e,t){n5(e)?this._injectedTextDecorationsTree.resolveNode(e,t):dq(e)?this._decorationsTree1.resolveNode(e,t):this._decorationsTree0.resolveNode(e,t)}acceptReplace(e,t,i,r){this._decorationsTree0.acceptReplace(e,t,i,r),this._decorationsTree1.acceptReplace(e,t,i,r),this._injectedTextDecorationsTree.acceptReplace(e,t,i,r)}}function Qg(n){return n.replace(/[^a-z0-9\-_]/gi," ")}class i6e{constructor(e){this.color=e.color||"",this.darkColor=e.darkColor||""}}class VLt extends i6e{constructor(e){super(e),this._resolvedColor=null,this.position=typeof e.position=="number"?e.position:Qu.Center}getColor(e){return this._resolvedColor||(e.type!=="light"&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=null}_resolveColor(e,t){if(typeof e=="string")return e;const i=e?t.getColor(e.id):null;return i?i.toString():""}}class zLt{constructor(e){this.position=e?.position??af.Center,this.persistLane=e?.persistLane}}class ULt extends i6e{constructor(e){super(e),this.position=e.position,this.sectionHeaderStyle=e.sectionHeaderStyle??null,this.sectionHeaderText=e.sectionHeaderText??null}getColor(e){return this._resolvedColor||(e.type!=="light"&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=void 0}_resolveColor(e,t){return typeof e=="string"?Te.fromHex(e):t.getColor(e.id)}}class Ab{static from(e){return e instanceof Ab?e:new Ab(e)}constructor(e){this.content=e.content||"",this.inlineClassName=e.inlineClassName||null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.attachedData=e.attachedData||null,this.cursorStops=e.cursorStops||null}}class un{static register(e){return new un(e)}static createDynamic(e){return new un(e)}constructor(e){this.description=e.description,this.blockClassName=e.blockClassName?Qg(e.blockClassName):null,this.blockDoesNotCollapse=e.blockDoesNotCollapse??null,this.blockIsAfterEnd=e.blockIsAfterEnd??null,this.blockPadding=e.blockPadding??null,this.stickiness=e.stickiness||0,this.zIndex=e.zIndex||0,this.className=e.className?Qg(e.className):null,this.shouldFillLineOnLineBreak=e.shouldFillLineOnLineBreak??null,this.hoverMessage=e.hoverMessage||null,this.glyphMarginHoverMessage=e.glyphMarginHoverMessage||null,this.lineNumberHoverMessage=e.lineNumberHoverMessage||null,this.isWholeLine=e.isWholeLine||!1,this.showIfCollapsed=e.showIfCollapsed||!1,this.collapseOnReplaceEdit=e.collapseOnReplaceEdit||!1,this.overviewRuler=e.overviewRuler?new VLt(e.overviewRuler):null,this.minimap=e.minimap?new ULt(e.minimap):null,this.glyphMargin=e.glyphMarginClassName?new zLt(e.glyphMargin):null,this.glyphMarginClassName=e.glyphMarginClassName?Qg(e.glyphMarginClassName):null,this.linesDecorationsClassName=e.linesDecorationsClassName?Qg(e.linesDecorationsClassName):null,this.lineNumberClassName=e.lineNumberClassName?Qg(e.lineNumberClassName):null,this.linesDecorationsTooltip=e.linesDecorationsTooltip?o_t(e.linesDecorationsTooltip):null,this.firstLineDecorationClassName=e.firstLineDecorationClassName?Qg(e.firstLineDecorationClassName):null,this.marginClassName=e.marginClassName?Qg(e.marginClassName):null,this.inlineClassName=e.inlineClassName?Qg(e.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=e.beforeContentClassName?Qg(e.beforeContentClassName):null,this.afterContentClassName=e.afterContentClassName?Qg(e.afterContentClassName):null,this.after=e.after?Ab.from(e.after):null,this.before=e.before?Ab.from(e.before):null,this.hideInCommentTokens=e.hideInCommentTokens??!1,this.hideInStringTokens=e.hideInStringTokens??!1}}un.EMPTY=un.register({description:"empty"});const xye=[un.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),un.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),un.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),un.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];function Sye(n){return n instanceof un?n:un.createDynamic(n)}class jLt extends me{constructor(e){super(),this.handleBeforeFire=e,this._actual=this._register(new fe),this.event=this._actual.event,this._affectedInjectedTextLines=null,this._deferredCnt=0,this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._affectsLineNumber=!1}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(){this._deferredCnt--,this._deferredCnt===0&&(this._shouldFireDeferred&&this.doFire(),this._affectedInjectedTextLines?.clear(),this._affectedInjectedTextLines=null)}recordLineAffectedByInjectedText(e){this._affectedInjectedTextLines||(this._affectedInjectedTextLines=new Set),this._affectedInjectedTextLines.add(e)}checkAffectedAndFire(e){this._affectsMinimap||=!!e.minimap?.position,this._affectsOverviewRuler||=!!e.overviewRuler?.color,this._affectsGlyphMargin||=!!e.glyphMarginClassName,this._affectsLineNumber||=!!e.lineNumberClassName,this.tryFire()}fire(){this._affectsMinimap=!0,this._affectsOverviewRuler=!0,this._affectsGlyphMargin=!0,this.tryFire()}tryFire(){this._deferredCnt===0?this.doFire():this._shouldFireDeferred=!0}doFire(){this.handleBeforeFire(this._affectedInjectedTextLines);const e={affectsMinimap:this._affectsMinimap,affectsOverviewRuler:this._affectsOverviewRuler,affectsGlyphMargin:this._affectsGlyphMargin,affectsLineNumber:this._affectsLineNumber};this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._actual.fire(e)}}class qLt extends me{constructor(){super(),this._fastEmitter=this._register(new fe),this.fastEvent=this._fastEmitter.event,this._slowEmitter=this._register(new fe),this.slowEvent=this._slowEmitter.event,this._deferredCnt=0,this._deferredEvent=null}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(e=null){if(this._deferredCnt--,this._deferredCnt===0&&this._deferredEvent!==null){this._deferredEvent.rawContentChangedEvent.resultingSelection=e;const t=this._deferredEvent;this._deferredEvent=null,this._fastEmitter.fire(t),this._slowEmitter.fire(t)}}fire(e){if(this._deferredCnt>0){this._deferredEvent?this._deferredEvent=this._deferredEvent.merge(e):this._deferredEvent=e;return}this._fastEmitter.fire(e),this._slowEmitter.fire(e)}}var KLt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},K4=function(n,e){return function(t,i){e(t,i,n)}},Gx;function A1(n){return n.toString()}let GLt=class{constructor(e,t,i){this.model=e,this._modelEventListeners=new ke,this.model=e,this._modelEventListeners.add(e.onWillDispose(()=>t(e))),this._modelEventListeners.add(e.onDidChangeLanguage(r=>i(e,r)))}dispose(){this._modelEventListeners.dispose()}};const YLt=zl||Rn?1:2;class ZLt{constructor(e,t,i,r,s,o,a,l){this.uri=e,this.initialUndoRedoSnapshot=t,this.time=i,this.sharesUndoRedoStack=r,this.heapSize=s,this.sha1=o,this.versionId=a,this.alternativeVersionId=l}}let UQ=class extends me{static{Gx=this}static{this.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20*1024*1024}constructor(e,t,i,r){super(),this._configurationService=e,this._resourcePropertiesService=t,this._undoRedoService=i,this._instantiationService=r,this._onModelAdded=this._register(new fe),this.onModelAdded=this._onModelAdded.event,this._onModelRemoved=this._register(new fe),this.onModelRemoved=this._onModelRemoved.event,this._onModelModeChanged=this._register(new fe),this.onModelLanguageChanged=this._onModelModeChanged.event,this._modelCreationOptionsByLanguageAndResource=Object.create(null),this._models={},this._disposedModels=new Map,this._disposedModelsHeapSize=0,this._register(this._configurationService.onDidChangeConfiguration(s=>this._updateModelOptions(s))),this._updateModelOptions(void 0)}static _readModelOptions(e,t){let i=Va.tabSize;if(e.editor&&typeof e.editor.tabSize<"u"){const h=parseInt(e.editor.tabSize,10);isNaN(h)||(i=h),i<1&&(i=1)}let r="tabSize";if(e.editor&&typeof e.editor.indentSize<"u"&&e.editor.indentSize!=="tabSize"){const h=parseInt(e.editor.indentSize,10);isNaN(h)||(r=Math.max(h,1))}let s=Va.insertSpaces;e.editor&&typeof e.editor.insertSpaces<"u"&&(s=e.editor.insertSpaces==="false"?!1:!!e.editor.insertSpaces);let o=YLt;const a=e.eol;a===`\r +`)){d=!1;break}}if(d){const h=new $(c,1,c,u);t.push(new Fj(null,h,null,!1,!1,!1))}}this._trimAutoWhitespaceLines=null}return this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEditOperation(e,t,i,r)}_applyUndo(e,t,i,r){const s=e.map(o=>{const a=this.getPositionAt(o.newPosition),l=this.getPositionAt(o.newEnd);return{range:new $(a.lineNumber,a.column,l.lineNumber,l.column),text:o.oldText}});this._applyUndoRedoEdits(s,t,!0,!1,i,r)}_applyRedo(e,t,i,r){const s=e.map(o=>{const a=this.getPositionAt(o.oldPosition),l=this.getPositionAt(o.oldEnd);return{range:new $(a.lineNumber,a.column,l.lineNumber,l.column),text:o.newText}});this._applyUndoRedoEdits(s,t,!1,!0,i,r)}_applyUndoRedoEdits(e,t,i,r,s,o){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._isUndoing=i,this._isRedoing=r,this.applyEdits(e,!1),this.setEOL(t),this._overwriteAlternativeVersionId(s)}finally{this._isUndoing=!1,this._isRedoing=!1,this._eventEmitter.endDeferredEmit(o),this._onDidChangeDecorations.endDeferredEmit()}}applyEdits(e,t=!1){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit();const i=this._validateEditOperations(e);return this._doApplyEdits(i,t)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_doApplyEdits(e,t){const i=this._buffer.getLineCount(),r=this._buffer.applyEdits(e,this._options.trimAutoWhitespace,t),s=this._buffer.getLineCount(),o=r.changes;if(this._trimAutoWhitespaceLines=r.trimAutoWhitespaceLineNumbers,o.length!==0){for(let c=0,u=o.length;c=0;I--){const O=f+I,M=y+I;D.takeFromEndWhile(G=>G.lineNumber>M);const B=D.takeFromEndWhile(G=>G.lineNumber===M);a.push(new yye(O,this.getLineContent(M),B))}if(_ee.lineNumberee.lineNumber===q)}a.push(new NLt(O+1,f+m,W,G))}l+=v}this._emitContentChangedEvent(new vk(a,this.getVersionId(),this._isUndoing,this._isRedoing),{changes:o,eol:this._buffer.getEOL(),isEolChange:!1,versionId:this.getVersionId(),isUndoing:this._isUndoing,isRedoing:this._isRedoing,isFlush:!1})}return r.reverseEdits===null?void 0:r.reverseEdits}undo(){return this._undoRedoService.undo(this.uri)}canUndo(){return this._undoRedoService.canUndo(this.uri)}redo(){return this._undoRedoService.redo(this.uri)}canRedo(){return this._undoRedoService.canRedo(this.uri)}handleBeforeFireDecorationsChangedEvent(e){if(e===null||e.size===0)return;const i=Array.from(e).map(r=>new yye(r,this.getLineContent(r),this._getInjectedTextInLine(r)));this._onDidChangeInjectedText.fire(new n6e(i))}changeDecorations(e,t=0){this._assertNotDisposed();try{return this._onDidChangeDecorations.beginDeferredEmit(),this._changeDecorations(t,e)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_changeDecorations(e,t){const i={addDecoration:(s,o)=>this._deltaDecorationsImpl(e,[],[{range:s,options:o}])[0],changeDecoration:(s,o)=>{this._changeDecorationImpl(s,o)},changeDecorationOptions:(s,o)=>{this._changeDecorationOptionsImpl(s,Sye(o))},removeDecoration:s=>{this._deltaDecorationsImpl(e,[s],[])},deltaDecorations:(s,o)=>s.length===0&&o.length===0?[]:this._deltaDecorationsImpl(e,s,o)};let r=null;try{r=t(i)}catch(s){rn(s)}return i.addDecoration=OT,i.changeDecoration=OT,i.changeDecorationOptions=OT,i.removeDecoration=OT,i.deltaDecorations=OT,r}deltaDecorations(e,t,i=0){if(this._assertNotDisposed(),e||(e=[]),e.length===0&&t.length===0)return[];try{return this._deltaDecorationCallCnt++,this._deltaDecorationCallCnt>1&&(console.warn("Invoking deltaDecorations recursively could lead to leaking decorations."),rn(new Error("Invoking deltaDecorations recursively could lead to leaking decorations."))),this._onDidChangeDecorations.beginDeferredEmit(),this._deltaDecorationsImpl(i,e,t)}finally{this._onDidChangeDecorations.endDeferredEmit(),this._deltaDecorationCallCnt--}}_getTrackedRange(e){return this.getDecorationRange(e)}_setTrackedRange(e,t,i){const r=e?this._decorations[e]:null;if(!r)return t?this._deltaDecorationsImpl(0,[],[{range:t,options:xye[i]}],!0)[0]:null;if(!t)return this._decorationsTree.delete(r),delete this._decorations[r.id],null;const s=this._validateRangeRelaxedNoAllocations(t),o=this._buffer.getOffsetAt(s.startLineNumber,s.startColumn),a=this._buffer.getOffsetAt(s.endLineNumber,s.endColumn);return this._decorationsTree.delete(r),r.reset(this.getVersionId(),o,a,s),r.setOptions(xye[i]),this._decorationsTree.insert(r),r.id}removeAllDecorationsWithOwnerId(e){if(this._isDisposed)return;const t=this._decorationsTree.collectNodesFromOwner(e);for(let i=0,r=t.length;ithis.getLineCount()?[]:this.getLinesDecorations(e,e,t,i)}getLinesDecorations(e,t,i=0,r=!1,s=!1){const o=this.getLineCount(),a=Math.min(o,Math.max(1,e)),l=Math.min(o,Math.max(1,t)),c=this.getLineMaxColumn(l),u=new $(a,1,l,c),d=this._getDecorationsInRange(u,i,r,s);return sZ(d,this._decorationProvider.getDecorationsInRange(u,i,r)),d}getDecorationsInRange(e,t=0,i=!1,r=!1,s=!1){const o=this.validateRange(e),a=this._getDecorationsInRange(o,t,i,s);return sZ(a,this._decorationProvider.getDecorationsInRange(o,t,i,r)),a}getOverviewRulerDecorations(e=0,t=!1){return this._decorationsTree.getAll(this,e,t,!0,!1)}getInjectedTextDecorations(e=0){return this._decorationsTree.getAllInjectedText(this,e)}_getInjectedTextInLine(e){const t=this._buffer.getOffsetAt(e,1),i=t+this._buffer.getLineLength(e),r=this._decorationsTree.getInjectedTextInInterval(this,t,i,0);return Lg.fromDecorations(r).filter(s=>s.lineNumber===e)}getAllDecorations(e=0,t=!1){let i=this._decorationsTree.getAll(this,e,t,!1,!1);return i=i.concat(this._decorationProvider.getAllDecorations(e,t)),i}getAllMarginDecorations(e=0){return this._decorationsTree.getAll(this,e,!1,!1,!0)}_getDecorationsInRange(e,t,i,r){const s=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),o=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getAllInInterval(this,s,o,t,i,r)}getRangeAt(e,t){return this._buffer.getRangeAt(e,t-e)}_changeDecorationImpl(e,t){const i=this._decorations[e];if(!i)return;if(i.options.after){const a=this.getDecorationRange(e);this._onDidChangeDecorations.recordLineAffectedByInjectedText(a.endLineNumber)}if(i.options.before){const a=this.getDecorationRange(e);this._onDidChangeDecorations.recordLineAffectedByInjectedText(a.startLineNumber)}const r=this._validateRangeRelaxedNoAllocations(t),s=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),o=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);this._decorationsTree.delete(i),i.reset(this.getVersionId(),s,o,r),this._decorationsTree.insert(i),this._onDidChangeDecorations.checkAffectedAndFire(i.options),i.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(r.endLineNumber),i.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(r.startLineNumber)}_changeDecorationOptionsImpl(e,t){const i=this._decorations[e];if(!i)return;const r=!!(i.options.overviewRuler&&i.options.overviewRuler.color),s=!!(t.overviewRuler&&t.overviewRuler.color);if(this._onDidChangeDecorations.checkAffectedAndFire(i.options),this._onDidChangeDecorations.checkAffectedAndFire(t),i.options.after||t.after){const l=this._decorationsTree.getNodeRange(this,i);this._onDidChangeDecorations.recordLineAffectedByInjectedText(l.endLineNumber)}if(i.options.before||t.before){const l=this._decorationsTree.getNodeRange(this,i);this._onDidChangeDecorations.recordLineAffectedByInjectedText(l.startLineNumber)}const o=r!==s,a=HLt(t)!==nF(i);o||a?(this._decorationsTree.delete(i),i.setOptions(t),this._decorationsTree.insert(i)):i.setOptions(t)}_deltaDecorationsImpl(e,t,i,r=!1){const s=this.getVersionId(),o=t.length;let a=0;const l=i.length;let c=0;this._onDidChangeDecorations.beginDeferredEmit();try{const u=new Array(l);for(;athis._setLanguage(e.languageId,t)),this._setLanguage(e.languageId,t))}_setLanguage(e,t){this.tokenization.setLanguageId(e,t),this._languageService.requestRichLanguageFeatures(e)}getLanguageIdAtPosition(e,t){return this.tokenization.getLanguageIdAtPosition(e,t)}getWordAtPosition(e){return this._tokenizationTextModelPart.getWordAtPosition(e)}getWordUntilPosition(e){return this._tokenizationTextModelPart.getWordUntilPosition(e)}normalizePosition(e,t){return e}getLineIndentColumn(e){return WLt(this.getLineContent(e))+1}};og=q1=PLt([j4(4,sle),j4(5,Hr),j4(6,Zr),j4(7,Tt)],og);function WLt(n){let e=0;for(const t of n)if(t===" "||t===" ")e++;else break;return e}function dq(n){return!!(n.options.overviewRuler&&n.options.overviewRuler.color)}function HLt(n){return!!n.after||!!n.before}function nF(n){return!!n.options.after||!!n.options.before}class Cye{constructor(){this._decorationsTree0=new aq,this._decorationsTree1=new aq,this._injectedTextDecorationsTree=new aq}ensureAllNodesHaveRanges(e){this.getAll(e,0,!1,!1,!1)}_ensureNodesHaveRanges(e,t){for(const i of t)i.range===null&&(i.range=e.getRangeAt(i.cachedAbsoluteStart,i.cachedAbsoluteEnd));return t}getAllInInterval(e,t,i,r,s,o){const a=e.getVersionId(),l=this._intervalSearch(t,i,r,s,a,o);return this._ensureNodesHaveRanges(e,l)}_intervalSearch(e,t,i,r,s,o){const a=this._decorationsTree0.intervalSearch(e,t,i,r,s,o),l=this._decorationsTree1.intervalSearch(e,t,i,r,s,o),c=this._injectedTextDecorationsTree.intervalSearch(e,t,i,r,s,o);return a.concat(l).concat(c)}getInjectedTextInInterval(e,t,i,r){const s=e.getVersionId(),o=this._injectedTextDecorationsTree.intervalSearch(t,i,r,!1,s,!1);return this._ensureNodesHaveRanges(e,o).filter(a=>a.options.showIfCollapsed||!a.range.isEmpty())}getAllInjectedText(e,t){const i=e.getVersionId(),r=this._injectedTextDecorationsTree.search(t,!1,i,!1);return this._ensureNodesHaveRanges(e,r).filter(s=>s.options.showIfCollapsed||!s.range.isEmpty())}getAll(e,t,i,r,s){const o=e.getVersionId(),a=this._search(t,i,r,o,s);return this._ensureNodesHaveRanges(e,a)}_search(e,t,i,r,s){if(i)return this._decorationsTree1.search(e,t,r,s);{const o=this._decorationsTree0.search(e,t,r,s),a=this._decorationsTree1.search(e,t,r,s),l=this._injectedTextDecorationsTree.search(e,t,r,s);return o.concat(a).concat(l)}}collectNodesFromOwner(e){const t=this._decorationsTree0.collectNodesFromOwner(e),i=this._decorationsTree1.collectNodesFromOwner(e),r=this._injectedTextDecorationsTree.collectNodesFromOwner(e);return t.concat(i).concat(r)}collectNodesPostOrder(){const e=this._decorationsTree0.collectNodesPostOrder(),t=this._decorationsTree1.collectNodesPostOrder(),i=this._injectedTextDecorationsTree.collectNodesPostOrder();return e.concat(t).concat(i)}insert(e){nF(e)?this._injectedTextDecorationsTree.insert(e):dq(e)?this._decorationsTree1.insert(e):this._decorationsTree0.insert(e)}delete(e){nF(e)?this._injectedTextDecorationsTree.delete(e):dq(e)?this._decorationsTree1.delete(e):this._decorationsTree0.delete(e)}getNodeRange(e,t){const i=e.getVersionId();return t.cachedVersionId!==i&&this._resolveNode(t,i),t.range===null&&(t.range=e.getRangeAt(t.cachedAbsoluteStart,t.cachedAbsoluteEnd)),t.range}_resolveNode(e,t){nF(e)?this._injectedTextDecorationsTree.resolveNode(e,t):dq(e)?this._decorationsTree1.resolveNode(e,t):this._decorationsTree0.resolveNode(e,t)}acceptReplace(e,t,i,r){this._decorationsTree0.acceptReplace(e,t,i,r),this._decorationsTree1.acceptReplace(e,t,i,r),this._injectedTextDecorationsTree.acceptReplace(e,t,i,r)}}function Qg(n){return n.replace(/[^a-z0-9\-_]/gi," ")}class i6e{constructor(e){this.color=e.color||"",this.darkColor=e.darkColor||""}}class VLt extends i6e{constructor(e){super(e),this._resolvedColor=null,this.position=typeof e.position=="number"?e.position:Qu.Center}getColor(e){return this._resolvedColor||(e.type!=="light"&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=null}_resolveColor(e,t){if(typeof e=="string")return e;const i=e?t.getColor(e.id):null;return i?i.toString():""}}class zLt{constructor(e){this.position=e?.position??af.Center,this.persistLane=e?.persistLane}}class ULt extends i6e{constructor(e){super(e),this.position=e.position,this.sectionHeaderStyle=e.sectionHeaderStyle??null,this.sectionHeaderText=e.sectionHeaderText??null}getColor(e){return this._resolvedColor||(e.type!=="light"&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=void 0}_resolveColor(e,t){return typeof e=="string"?Te.fromHex(e):t.getColor(e.id)}}class Ab{static from(e){return e instanceof Ab?e:new Ab(e)}constructor(e){this.content=e.content||"",this.inlineClassName=e.inlineClassName||null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.attachedData=e.attachedData||null,this.cursorStops=e.cursorStops||null}}class un{static register(e){return new un(e)}static createDynamic(e){return new un(e)}constructor(e){this.description=e.description,this.blockClassName=e.blockClassName?Qg(e.blockClassName):null,this.blockDoesNotCollapse=e.blockDoesNotCollapse??null,this.blockIsAfterEnd=e.blockIsAfterEnd??null,this.blockPadding=e.blockPadding??null,this.stickiness=e.stickiness||0,this.zIndex=e.zIndex||0,this.className=e.className?Qg(e.className):null,this.shouldFillLineOnLineBreak=e.shouldFillLineOnLineBreak??null,this.hoverMessage=e.hoverMessage||null,this.glyphMarginHoverMessage=e.glyphMarginHoverMessage||null,this.lineNumberHoverMessage=e.lineNumberHoverMessage||null,this.isWholeLine=e.isWholeLine||!1,this.showIfCollapsed=e.showIfCollapsed||!1,this.collapseOnReplaceEdit=e.collapseOnReplaceEdit||!1,this.overviewRuler=e.overviewRuler?new VLt(e.overviewRuler):null,this.minimap=e.minimap?new ULt(e.minimap):null,this.glyphMargin=e.glyphMarginClassName?new zLt(e.glyphMargin):null,this.glyphMarginClassName=e.glyphMarginClassName?Qg(e.glyphMarginClassName):null,this.linesDecorationsClassName=e.linesDecorationsClassName?Qg(e.linesDecorationsClassName):null,this.lineNumberClassName=e.lineNumberClassName?Qg(e.lineNumberClassName):null,this.linesDecorationsTooltip=e.linesDecorationsTooltip?o_t(e.linesDecorationsTooltip):null,this.firstLineDecorationClassName=e.firstLineDecorationClassName?Qg(e.firstLineDecorationClassName):null,this.marginClassName=e.marginClassName?Qg(e.marginClassName):null,this.inlineClassName=e.inlineClassName?Qg(e.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=e.beforeContentClassName?Qg(e.beforeContentClassName):null,this.afterContentClassName=e.afterContentClassName?Qg(e.afterContentClassName):null,this.after=e.after?Ab.from(e.after):null,this.before=e.before?Ab.from(e.before):null,this.hideInCommentTokens=e.hideInCommentTokens??!1,this.hideInStringTokens=e.hideInStringTokens??!1}}un.EMPTY=un.register({description:"empty"});const xye=[un.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),un.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),un.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),un.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];function Sye(n){return n instanceof un?n:un.createDynamic(n)}class jLt extends me{constructor(e){super(),this.handleBeforeFire=e,this._actual=this._register(new fe),this.event=this._actual.event,this._affectedInjectedTextLines=null,this._deferredCnt=0,this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._affectsLineNumber=!1}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(){this._deferredCnt--,this._deferredCnt===0&&(this._shouldFireDeferred&&this.doFire(),this._affectedInjectedTextLines?.clear(),this._affectedInjectedTextLines=null)}recordLineAffectedByInjectedText(e){this._affectedInjectedTextLines||(this._affectedInjectedTextLines=new Set),this._affectedInjectedTextLines.add(e)}checkAffectedAndFire(e){this._affectsMinimap||=!!e.minimap?.position,this._affectsOverviewRuler||=!!e.overviewRuler?.color,this._affectsGlyphMargin||=!!e.glyphMarginClassName,this._affectsLineNumber||=!!e.lineNumberClassName,this.tryFire()}fire(){this._affectsMinimap=!0,this._affectsOverviewRuler=!0,this._affectsGlyphMargin=!0,this.tryFire()}tryFire(){this._deferredCnt===0?this.doFire():this._shouldFireDeferred=!0}doFire(){this.handleBeforeFire(this._affectedInjectedTextLines);const e={affectsMinimap:this._affectsMinimap,affectsOverviewRuler:this._affectsOverviewRuler,affectsGlyphMargin:this._affectsGlyphMargin,affectsLineNumber:this._affectsLineNumber};this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._actual.fire(e)}}class qLt extends me{constructor(){super(),this._fastEmitter=this._register(new fe),this.fastEvent=this._fastEmitter.event,this._slowEmitter=this._register(new fe),this.slowEvent=this._slowEmitter.event,this._deferredCnt=0,this._deferredEvent=null}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(e=null){if(this._deferredCnt--,this._deferredCnt===0&&this._deferredEvent!==null){this._deferredEvent.rawContentChangedEvent.resultingSelection=e;const t=this._deferredEvent;this._deferredEvent=null,this._fastEmitter.fire(t),this._slowEmitter.fire(t)}}fire(e){if(this._deferredCnt>0){this._deferredEvent?this._deferredEvent=this._deferredEvent.merge(e):this._deferredEvent=e;return}this._fastEmitter.fire(e),this._slowEmitter.fire(e)}}var KLt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},K4=function(n,e){return function(t,i){e(t,i,n)}},Gx;function A1(n){return n.toString()}let GLt=class{constructor(e,t,i){this.model=e,this._modelEventListeners=new ke,this.model=e,this._modelEventListeners.add(e.onWillDispose(()=>t(e))),this._modelEventListeners.add(e.onDidChangeLanguage(r=>i(e,r)))}dispose(){this._modelEventListeners.dispose()}};const YLt=zl||Rn?1:2;class ZLt{constructor(e,t,i,r,s,o,a,l){this.uri=e,this.initialUndoRedoSnapshot=t,this.time=i,this.sharesUndoRedoStack=r,this.heapSize=s,this.sha1=o,this.versionId=a,this.alternativeVersionId=l}}let UQ=class extends me{static{Gx=this}static{this.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20*1024*1024}constructor(e,t,i,r){super(),this._configurationService=e,this._resourcePropertiesService=t,this._undoRedoService=i,this._instantiationService=r,this._onModelAdded=this._register(new fe),this.onModelAdded=this._onModelAdded.event,this._onModelRemoved=this._register(new fe),this.onModelRemoved=this._onModelRemoved.event,this._onModelModeChanged=this._register(new fe),this.onModelLanguageChanged=this._onModelModeChanged.event,this._modelCreationOptionsByLanguageAndResource=Object.create(null),this._models={},this._disposedModels=new Map,this._disposedModelsHeapSize=0,this._register(this._configurationService.onDidChangeConfiguration(s=>this._updateModelOptions(s))),this._updateModelOptions(void 0)}static _readModelOptions(e,t){let i=Va.tabSize;if(e.editor&&typeof e.editor.tabSize<"u"){const h=parseInt(e.editor.tabSize,10);isNaN(h)||(i=h),i<1&&(i=1)}let r="tabSize";if(e.editor&&typeof e.editor.indentSize<"u"&&e.editor.indentSize!=="tabSize"){const h=parseInt(e.editor.indentSize,10);isNaN(h)||(r=Math.max(h,1))}let s=Va.insertSpaces;e.editor&&typeof e.editor.insertSpaces<"u"&&(s=e.editor.insertSpaces==="false"?!1:!!e.editor.insertSpaces);let o=YLt;const a=e.eol;a===`\r `?o=2:a===` `&&(o=1);let l=Va.trimAutoWhitespace;e.editor&&typeof e.editor.trimAutoWhitespace<"u"&&(l=e.editor.trimAutoWhitespace==="false"?!1:!!e.editor.trimAutoWhitespace);let c=Va.detectIndentation;e.editor&&typeof e.editor.detectIndentation<"u"&&(c=e.editor.detectIndentation==="false"?!1:!!e.editor.detectIndentation);let u=Va.largeFileOptimizations;e.editor&&typeof e.editor.largeFileOptimizations<"u"&&(u=e.editor.largeFileOptimizations==="false"?!1:!!e.editor.largeFileOptimizations);let d=Va.bracketPairColorizationOptions;return e.editor?.bracketPairColorization&&typeof e.editor.bracketPairColorization=="object"&&(d={enabled:!!e.editor.bracketPairColorization.enabled,independentColorPoolPerBracketType:!!e.editor.bracketPairColorization.independentColorPoolPerBracketType}),{isForSimpleWidget:t,tabSize:i,indentSize:r,insertSpaces:s,detectIndentation:c,defaultEOL:o,trimAutoWhitespace:l,largeFileOptimizations:u,bracketPairColorizationOptions:d}}_getEOL(e,t){if(e)return this._resourcePropertiesService.getEOL(e,t);const i=this._configurationService.getValue("files.eol",{overrideIdentifier:t});return i&&typeof i=="string"&&i!=="auto"?i:eu===3||eu===2?` `:`\r -`}_shouldRestoreUndoStack(){const e=this._configurationService.getValue("files.restoreUndoStack");return typeof e=="boolean"?e:!0}getCreationOptions(e,t,i){const r=typeof e=="string"?e:e.languageId;let s=this._modelCreationOptionsByLanguageAndResource[r+t];if(!s){const o=this._configurationService.getValue("editor",{overrideIdentifier:r,resource:t}),a=this._getEOL(t,r);s=Gx._readModelOptions({editor:o,eol:a},i),this._modelCreationOptionsByLanguageAndResource[r+t]=s}return s}_updateModelOptions(e){const t=this._modelCreationOptionsByLanguageAndResource;this._modelCreationOptionsByLanguageAndResource=Object.create(null);const i=Object.keys(this._models);for(let r=0,s=i.length;re){const t=[];for(this._disposedModels.forEach(i=>{i.sharesUndoRedoStack||t.push(i)}),t.sort((i,r)=>i.time-r.time);t.length>0&&this._disposedModelsHeapSize>e;){const i=t.shift();this._removeDisposedModel(i.uri),i.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(i.initialUndoRedoSnapshot)}}}_createModelData(e,t,i,r){const s=this.getCreationOptions(t,i,r),o=this._instantiationService.createInstance(og,e,t,s,i);if(i&&this._disposedModels.has(A1(i))){const c=this._removeDisposedModel(i),u=this._undoRedoService.getElements(i),d=this._getSHA1Computer(),h=d.canComputeSHA1(o)?d.computeSHA1(o)===c.sha1:!1;if(h||c.sharesUndoRedoStack){for(const f of u.past)t_(f)&&f.matchesResource(i)&&f.setModel(o);for(const f of u.future)t_(f)&&f.matchesResource(i)&&f.setModel(o);this._undoRedoService.setElementsValidFlag(i,!0,f=>t_(f)&&f.matchesResource(i)),h&&(o._overwriteVersionId(c.versionId),o._overwriteAlternativeVersionId(c.alternativeVersionId),o._overwriteInitialUndoRedoSnapshot(c.initialUndoRedoSnapshot))}else c.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(c.initialUndoRedoSnapshot)}const a=A1(o.uri);if(this._models[a])throw new Error("ModelService: Cannot add model because it already exists!");const l=new GLt(o,c=>this._onWillDispose(c),(c,u)=>this._onDidChangeLanguage(c,u));return this._models[a]=l,l}createModel(e,t,i,r=!1){let s;return t?s=this._createModelData(e,t,i,r):s=this._createModelData(e,Hl,i,r),this._onModelAdded.fire(s.model),s.model}getModels(){const e=[],t=Object.keys(this._models);for(let i=0,r=t.length;i0||c.future.length>0){for(const u of c.past)t_(u)&&u.matchesResource(e.uri)&&(s=!0,o+=u.heapSize(e.uri),u.setModel(e.uri));for(const u of c.future)t_(u)&&u.matchesResource(e.uri)&&(s=!0,o+=u.heapSize(e.uri),u.setModel(e.uri))}}const a=Gx.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK,l=this._getSHA1Computer();if(s)if(!r&&(o>a||!l.canComputeSHA1(e))){const c=i.model.getInitialUndoRedoSnapshot();c!==null&&this._undoRedoService.restoreSnapshot(c)}else this._ensureDisposedModelsHeapSize(a-o),this._undoRedoService.setElementsValidFlag(e.uri,!1,c=>t_(c)&&c.matchesResource(e.uri)),this._insertDisposedModel(new ZLt(e.uri,i.model.getInitialUndoRedoSnapshot(),Date.now(),r,o,l.computeSHA1(e),e.getVersionId(),e.getAlternativeVersionId()));else if(!r){const c=i.model.getInitialUndoRedoSnapshot();c!==null&&this._undoRedoService.restoreSnapshot(c)}delete this._models[t],i.dispose(),delete this._modelCreationOptionsByLanguageAndResource[e.getLanguageId()+e.uri],this._onModelRemoved.fire(e)}_onDidChangeLanguage(e,t){const i=t.oldLanguage,r=e.getLanguageId(),s=this.getCreationOptions(i,e.uri,e.isForSimpleWidget),o=this.getCreationOptions(r,e.uri,e.isForSimpleWidget);Gx._setModelOptionsForModel(e,o,s),this._onModelModeChanged.fire({model:e,oldLanguageId:i})}_getSHA1Computer(){return new tce}};UQ=Gx=KLt([K4(0,kn),K4(1,Q3e),K4(2,sle),K4(3,Tt)],UQ);class tce{static{this.MAX_MODEL_SIZE=10*1024*1024}canComputeSHA1(e){return e.getValueLength()<=tce.MAX_MODEL_SIZE}computeSHA1(e){const t=new Bae,i=e.createSnapshot();let r;for(;r=i.read();)t.update(r);return t.digest()}}var jQ;(function(n){n[n.PRESERVE=0]="PRESERVE",n[n.LAST=1]="LAST"})(jQ||(jQ={}));const CC={Quickaccess:"workbench.contributions.quickaccess"};class XLt{constructor(){this.providers=[],this.defaultProvider=void 0}registerQuickAccessProvider(e){return e.prefix.length===0?this.defaultProvider=e:this.providers.push(e),this.providers.sort((t,i)=>i.prefix.length-t.prefix.length),Lt(()=>{this.providers.splice(this.providers.indexOf(e),1),this.defaultProvider===e&&(this.defaultProvider=void 0)})}getQuickAccessProviders(){return rf([this.defaultProvider,...this.providers])}getQuickAccessProvider(e){return e&&this.providers.find(i=>e.startsWith(i.prefix))||void 0||this.defaultProvider}}Yr.add(CC.Quickaccess,new XLt);const QLt={ctrlCmd:!1,alt:!1};var bE;(function(n){n[n.Blur=1]="Blur",n[n.Gesture=2]="Gesture",n[n.Other=3]="Other"})(bE||(bE={}));var zf;(function(n){n[n.NONE=0]="NONE",n[n.FIRST=1]="FIRST",n[n.SECOND=2]="SECOND",n[n.LAST=3]="LAST"})(zf||(zf={}));var yr;(function(n){n[n.First=1]="First",n[n.Second=2]="Second",n[n.Last=3]="Last",n[n.Next=4]="Next",n[n.Previous=5]="Previous",n[n.NextPage=6]="NextPage",n[n.PreviousPage=7]="PreviousPage",n[n.NextSeparator=8]="NextSeparator",n[n.PreviousSeparator=9]="PreviousSeparator"})(yr||(yr={}));var W8;(function(n){n[n.Title=1]="Title",n[n.Inline=2]="Inline"})(W8||(W8={}));const hh=On("quickInputService");var JLt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},kye=function(n,e){return function(t,i){e(t,i,n)}};let qQ=class extends me{constructor(e,t){super(),this.quickInputService=e,this.instantiationService=t,this.registry=Yr.as(CC.Quickaccess),this.mapProviderToDescriptor=new Map,this.lastAcceptedPickerValues=new Map,this.visibleQuickAccess=void 0}show(e="",t){this.doShowOrPick(e,!1,t)}doShowOrPick(e,t,i){const[r,s]=this.getOrInstantiateProvider(e,i?.enabledProviderPrefixes),o=this.visibleQuickAccess,a=o?.descriptor;if(o&&s&&a===s){e!==s.prefix&&!i?.preserveValue&&(o.picker.value=e),this.adjustValueSelection(o.picker,s,i);return}if(s&&!i?.preserveValue){let g;if(o&&a&&a!==s){const p=o.value.substr(a.prefix.length);p&&(g=`${s.prefix}${p}`)}if(!g){const p=r?.defaultFilterValue;p===jQ.LAST?g=this.lastAcceptedPickerValues.get(s):typeof p=="string"&&(g=`${s.prefix}${p}`)}typeof g=="string"&&(e=g)}const l=o?.picker?.valueSelection,c=o?.picker?.value,u=new ke,d=u.add(this.quickInputService.createQuickPick({useSeparators:!0}));d.value=e,this.adjustValueSelection(d,s,i),d.placeholder=i?.placeholder??s?.placeholder,d.quickNavigate=i?.quickNavigateConfiguration,d.hideInput=!!d.quickNavigate&&!o,(typeof i?.itemActivation=="number"||i?.quickNavigateConfiguration)&&(d.itemActivation=i?.itemActivation??zf.SECOND),d.contextKey=s?.contextKey,d.filterValue=g=>g.substring(s?s.prefix.length:0);let h;t&&(h=new KL,u.add(Ge.once(d.onWillAccept)(g=>{g.veto(),d.hide()}))),u.add(this.registerPickerListeners(d,r,s,e,i));const f=u.add(new Kr);if(r&&u.add(r.provide(d,f.token,i?.providerOptions)),Ge.once(d.onDidHide)(()=>{d.selectedItems.length===0&&f.cancel(),u.dispose(),h?.complete(d.selectedItems.slice(0))}),d.show(),l&&c===e&&(d.valueSelection=l),t)return h?.p}adjustValueSelection(e,t,i){let r;i?.preserveValue?r=[e.value.length,e.value.length]:r=[t?.prefix.length??0,e.value.length],e.valueSelection=r}registerPickerListeners(e,t,i,r,s){const o=new ke,a=this.visibleQuickAccess={picker:e,descriptor:i,value:r};return o.add(Lt(()=>{a===this.visibleQuickAccess&&(this.visibleQuickAccess=void 0)})),o.add(e.onDidChangeValue(l=>{const[c]=this.getOrInstantiateProvider(l,s?.enabledProviderPrefixes);c!==t?this.show(l,{enabledProviderPrefixes:s?.enabledProviderPrefixes,preserveValue:!0,providerOptions:s?.providerOptions}):a.value=l})),i&&o.add(e.onDidAccept(()=>{this.lastAcceptedPickerValues.set(i,e.value)})),o}getOrInstantiateProvider(e,t){const i=this.registry.getQuickAccessProvider(e);if(!i||t&&!t?.includes(i.prefix))return[void 0,void 0];let r=this.mapProviderToDescriptor.get(i);return r||(r=this.instantiationService.createInstance(i.ctor),this.mapProviderToDescriptor.set(i,r)),[r,i]}};qQ=JLt([kye(0,hh),kye(1,Tt)],qQ);class o2 extends ud{constructor(e){super(),this._onChange=this._register(new fe),this.onChange=this._onChange.event,this._onKeyDown=this._register(new fe),this.onKeyDown=this._onKeyDown.event,this._opts=e,this._checked=this._opts.isChecked;const t=["monaco-custom-toggle"];this._opts.icon&&(this._icon=this._opts.icon,t.push(...zt.asClassNameArray(this._icon))),this._opts.actionClassName&&t.push(...this._opts.actionClassName.split(" ")),this._checked&&t.push("checked"),this.domNode=document.createElement("div"),this._hover=this._register(Bg().setupManagedHover(e.hoverDelegate??Yl("mouse"),this.domNode,this._opts.title)),this.domNode.classList.add(...t),this._opts.notFocusable||(this.domNode.tabIndex=0),this.domNode.setAttribute("role","checkbox"),this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.setAttribute("aria-label",this._opts.title),this.applyStyles(),this.onclick(this.domNode,i=>{this.enabled&&(this.checked=!this._checked,this._onChange.fire(!1),i.preventDefault())}),this._register(this.ignoreGesture(this.domNode)),this.onkeydown(this.domNode,i=>{if(i.keyCode===10||i.keyCode===3){this.checked=!this._checked,this._onChange.fire(!0),i.preventDefault(),i.stopPropagation();return}this._onKeyDown.fire(i)})}get enabled(){return this.domNode.getAttribute("aria-disabled")!=="true"}focus(){this.domNode.focus()}get checked(){return this._checked}set checked(e){this._checked=e,this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked),this.applyStyles()}width(){return 22}applyStyles(){this.domNode&&(this.domNode.style.borderColor=this._checked&&this._opts.inputActiveOptionBorder||"",this.domNode.style.color=this._checked&&this._opts.inputActiveOptionForeground||"inherit",this.domNode.style.backgroundColor=this._checked&&this._opts.inputActiveOptionBackground||"")}enable(){this.domNode.setAttribute("aria-disabled",String(!1))}disable(){this.domNode.setAttribute("aria-disabled",String(!0))}}var e2t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};class r6e{constructor(e){this.nodes=e}toString(){return this.nodes.map(e=>typeof e=="string"?e:e.label).join("")}}e2t([Ds],r6e.prototype,"toString",null);const t2t=/\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;function n2t(n){const e=[];let t=0,i;for(;i=t2t.exec(n);){i.index-t>0&&e.push(n.substring(t,i.index));const[,r,s,,o]=i;o?e.push({label:r,href:s,title:o}):e.push({label:r,href:s}),t=i.index+i[0].length}return t{E0t(f)&&Hn.stop(f,!0),t.callback(s.href)},c=t.disposables.add(new $n(a,je.CLICK)).event,u=t.disposables.add(new $n(a,je.KEY_DOWN)).event,d=Ge.chain(u,f=>f.filter(g=>{const p=new or(g);return p.equals(10)||p.equals(3)}));t.disposables.add(Fr.addTarget(a));const h=t.disposables.add(new $n(a,gr.Tap)).event;Ge.any(c,h,d)(l,null,t.disposables),e.appendChild(a)}}var o2t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Eye=function(n,e){return function(t,i){e(t,i,n)}};const s6e="inQuickInput",a2t=new et(s6e,!1,w("inQuickInput","Whether keyboard focus is inside the quick input control")),l2t=Le.has(s6e),o6e="quickInputType",c2t=new et(o6e,void 0,w("quickInputType","The type of the currently visible quick input")),a6e="cursorAtEndOfQuickInputBox",u2t=new et(a6e,!1,w("cursorAtEndOfQuickInputBox","Whether the cursor in the quick input is at the end of the input box")),d2t=Le.has(a6e),KQ={iconClass:zt.asClassName(ze.quickInputBack),tooltip:w("quickInput.back","Back"),handle:-1};class DW extends me{static{this.noPromptMessage=w("inputModeEntry","Press 'Enter' to confirm your input or 'Escape' to cancel")}constructor(e){super(),this.ui=e,this._widgetUpdated=!1,this.visible=!1,this._enabled=!0,this._busy=!1,this._ignoreFocusOut=!1,this._leftButtons=[],this._rightButtons=[],this._inlineButtons=[],this.buttonsUpdated=!1,this._toggles=[],this.togglesUpdated=!1,this.noValidationMessage=DW.noPromptMessage,this._severity=Ss.Ignore,this.onDidTriggerButtonEmitter=this._register(new fe),this.onDidHideEmitter=this._register(new fe),this.onWillHideEmitter=this._register(new fe),this.onDisposeEmitter=this._register(new fe),this.visibleDisposables=this._register(new ke),this.onDidHide=this.onDidHideEmitter.event}get title(){return this._title}set title(e){this._title=e,this.update()}get description(){return this._description}set description(e){this._description=e,this.update()}get step(){return this._steps}set step(e){this._steps=e,this.update()}get totalSteps(){return this._totalSteps}set totalSteps(e){this._totalSteps=e,this.update()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}get contextKey(){return this._contextKey}set contextKey(e){this._contextKey=e,this.update()}get busy(){return this._busy}set busy(e){this._busy=e,this.update()}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(e){const t=this._ignoreFocusOut!==e&&!Sg;this._ignoreFocusOut=e&&!Sg,t&&this.update()}get titleButtons(){return this._leftButtons.length?[...this._leftButtons,this._rightButtons]:this._rightButtons}get buttons(){return[...this._leftButtons,...this._rightButtons,...this._inlineButtons]}set buttons(e){this._leftButtons=e.filter(t=>t===KQ),this._rightButtons=e.filter(t=>t!==KQ&&t.location!==W8.Inline),this._inlineButtons=e.filter(t=>t.location===W8.Inline),this.buttonsUpdated=!0,this.update()}get toggles(){return this._toggles}set toggles(e){this._toggles=e??[],this.togglesUpdated=!0,this.update()}get validationMessage(){return this._validationMessage}set validationMessage(e){this._validationMessage=e,this.update()}get severity(){return this._severity}set severity(e){this._severity=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.onDidTriggerButton(e=>{this.buttons.indexOf(e)!==-1&&this.onDidTriggerButtonEmitter.fire(e)})),this.ui.show(this),this.visible=!0,this._lastValidationMessage=void 0,this._lastSeverity=void 0,this.buttons.length&&(this.buttonsUpdated=!0),this.toggles.length&&(this.togglesUpdated=!0),this.update())}hide(){this.visible&&this.ui.hide()}didHide(e=bE.Other){this.visible=!1,this.visibleDisposables.clear(),this.onDidHideEmitter.fire({reason:e})}willHide(e=bE.Other){this.onWillHideEmitter.fire({reason:e})}update(){if(!this.visible)return;const e=this.getTitle();e&&this.ui.title.textContent!==e?this.ui.title.textContent=e:!e&&this.ui.title.innerHTML!==" "&&(this.ui.title.innerText=" ");const t=this.getDescription();if(this.ui.description1.textContent!==t&&(this.ui.description1.textContent=t),this.ui.description2.textContent!==t&&(this.ui.description2.textContent=t),this._widgetUpdated&&(this._widgetUpdated=!1,this._widget?ea(this.ui.widget,this._widget):ea(this.ui.widget)),this.busy&&!this.busyDelay&&(this.busyDelay=new hf,this.busyDelay.setIfNotSet(()=>{this.visible&&this.ui.progressBar.infinite()},800)),!this.busy&&this.busyDelay&&(this.ui.progressBar.stop(),this.busyDelay.cancel(),this.busyDelay=void 0),this.buttonsUpdated){this.buttonsUpdated=!1,this.ui.leftActionBar.clear();const r=this._leftButtons.map((a,l)=>TI(a,`id-${l}`,async()=>this.onDidTriggerButtonEmitter.fire(a)));this.ui.leftActionBar.push(r,{icon:!0,label:!1}),this.ui.rightActionBar.clear();const s=this._rightButtons.map((a,l)=>TI(a,`id-${l}`,async()=>this.onDidTriggerButtonEmitter.fire(a)));this.ui.rightActionBar.push(s,{icon:!0,label:!1}),this.ui.inlineActionBar.clear();const o=this._inlineButtons.map((a,l)=>TI(a,`id-${l}`,async()=>this.onDidTriggerButtonEmitter.fire(a)));this.ui.inlineActionBar.push(o,{icon:!0,label:!1})}if(this.togglesUpdated){this.togglesUpdated=!1;const r=this.toggles?.filter(s=>s instanceof o2)??[];this.ui.inputBox.toggles=r}this.ui.ignoreFocusOut=this.ignoreFocusOut,this.ui.setEnabled(this.enabled),this.ui.setContextKey(this.contextKey);const i=this.validationMessage||this.noValidationMessage;this._lastValidationMessage!==i&&(this._lastValidationMessage=i,ea(this.ui.message),s2t(i,this.ui.message,{callback:r=>{this.ui.linkOpenerDelegate(r)},disposables:this.visibleDisposables})),this._lastSeverity!==this.severity&&(this._lastSeverity=this.severity,this.showMessageDecoration(this.severity))}getTitle(){return this.title&&this.step?`${this.title} (${this.getSteps()})`:this.title?this.title:this.step?this.getSteps():""}getDescription(){return this.description||""}getSteps(){return this.step&&this.totalSteps?w("quickInput.steps","{0}/{1}",this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==Ss.Ignore){const t=this.ui.inputBox.stylesForType(e);this.ui.message.style.color=t.foreground?`${t.foreground}`:"",this.ui.message.style.backgroundColor=t.background?`${t.background}`:"",this.ui.message.style.border=t.border?`1px solid ${t.border}`:"",this.ui.message.style.marginBottom="-2px"}else this.ui.message.style.color="",this.ui.message.style.backgroundColor="",this.ui.message.style.border="",this.ui.message.style.marginBottom=""}dispose(){this.hide(),this.onDisposeEmitter.fire(),super.dispose()}}class H8 extends DW{constructor(){super(...arguments),this._value="",this.onDidChangeValueEmitter=this._register(new fe),this.onWillAcceptEmitter=this._register(new fe),this.onDidAcceptEmitter=this._register(new fe),this.onDidCustomEmitter=this._register(new fe),this._items=[],this.itemsUpdated=!1,this._canSelectMany=!1,this._canAcceptInBackground=!1,this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._matchOnLabelMode="fuzzy",this._sortByLabel=!0,this._keepScrollPosition=!1,this._itemActivation=zf.FIRST,this._activeItems=[],this.activeItemsUpdated=!1,this.activeItemsToConfirm=[],this.onDidChangeActiveEmitter=this._register(new fe),this._selectedItems=[],this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=[],this.onDidChangeSelectionEmitter=this._register(new fe),this.onDidTriggerItemButtonEmitter=this._register(new fe),this.onDidTriggerSeparatorButtonEmitter=this._register(new fe),this.valueSelectionUpdated=!0,this._ok="default",this._customButton=!1,this._focusEventBufferer=new UP,this.type="quickPick",this.filterValue=e=>e,this.onDidChangeValue=this.onDidChangeValueEmitter.event,this.onWillAccept=this.onWillAcceptEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event,this.onDidChangeActive=this.onDidChangeActiveEmitter.event,this.onDidChangeSelection=this.onDidChangeSelectionEmitter.event,this.onDidTriggerItemButton=this.onDidTriggerItemButtonEmitter.event,this.onDidTriggerSeparatorButton=this.onDidTriggerSeparatorButtonEmitter.event}static{this.DEFAULT_ARIA_LABEL=w("quickInputBox.ariaLabel","Type to narrow down results.")}get quickNavigate(){return this._quickNavigate}set quickNavigate(e){this._quickNavigate=e,this.update()}get value(){return this._value}set value(e){this.doSetValue(e)}doSetValue(e,t){this._value!==e&&(this._value=e,t||this.update(),this.visible&&this.ui.list.filter(this.filterValue(this._value))&&this.trySelectFirst(),this.onDidChangeValueEmitter.fire(this._value))}set ariaLabel(e){this._ariaLabel=e,this.update()}get ariaLabel(){return this._ariaLabel}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get items(){return this._items}get scrollTop(){return this.ui.list.scrollTop}set scrollTop(e){this.ui.list.scrollTop=e}set items(e){this._items=e,this.itemsUpdated=!0,this.update()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){this._canSelectMany=e,this.update()}get canAcceptInBackground(){return this._canAcceptInBackground}set canAcceptInBackground(e){this._canAcceptInBackground=e}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e,this.update()}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e,this.update()}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e,this.update()}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e,this.update()}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e,this.update()}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(e){this._keepScrollPosition=e}get itemActivation(){return this._itemActivation}set itemActivation(e){this._itemActivation=e}get activeItems(){return this._activeItems}set activeItems(e){this._activeItems=e,this.activeItemsUpdated=!0,this.update()}get selectedItems(){return this._selectedItems}set selectedItems(e){this._selectedItems=e,this.selectedItemsUpdated=!0,this.update()}get keyMods(){return this._quickNavigate?QLt:this.ui.keyMods}get valueSelection(){const e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get customButton(){return this._customButton}set customButton(e){this._customButton=e,this.update()}get customLabel(){return this._customButtonLabel}set customLabel(e){this._customButtonLabel=e,this.update()}get customHover(){return this._customButtonHover}set customHover(e){this._customButtonHover=e,this.update()}get ok(){return this._ok}set ok(e){this._ok=e,this.update()}get hideInput(){return!!this._hideInput}set hideInput(e){this._hideInput=e,this.update()}trySelectFirst(){this.canSelectMany||this.ui.list.focus(yr.First)}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{this.doSetValue(e,!0)})),this.visibleDisposables.add(this.ui.onDidAccept(()=>{this.canSelectMany?this.ui.list.getCheckedElements().length||(this._selectedItems=[],this.onDidChangeSelectionEmitter.fire(this.selectedItems)):this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(!1)})),this.visibleDisposables.add(this.ui.onDidCustom(()=>{this.onDidCustomEmitter.fire()})),this.visibleDisposables.add(this._focusEventBufferer.wrapEvent(this.ui.list.onDidChangeFocus,(e,t)=>t)(e=>{this.activeItemsUpdated||this.activeItemsToConfirm!==this._activeItems&&$r(e,this._activeItems,(t,i)=>t===i)||(this._activeItems=e,this.onDidChangeActiveEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onDidChangeSelection(({items:e,event:t})=>{if(this.canSelectMany){e.length&&this.ui.list.setSelectedElements([]);return}this.selectedItemsToConfirm!==this._selectedItems&&$r(e,this._selectedItems,(i,r)=>i===r)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e),e.length&&this.handleAccept(Hae(t)&&t.button===1))})),this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(e=>{!this.canSelectMany||!this.visible||this.selectedItemsToConfirm!==this._selectedItems&&$r(e,this._selectedItems,(t,i)=>t===i)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onButtonTriggered(e=>this.onDidTriggerItemButtonEmitter.fire(e))),this.visibleDisposables.add(this.ui.list.onSeparatorButtonTriggered(e=>this.onDidTriggerSeparatorButtonEmitter.fire(e))),this.visibleDisposables.add(this.registerQuickNavigation()),this.valueSelectionUpdated=!0),super.show()}handleAccept(e){let t=!1;this.onWillAcceptEmitter.fire({veto:()=>t=!0}),t||this.onDidAcceptEmitter.fire({inBackground:e})}registerQuickNavigation(){return Ce(this.ui.container,je.KEY_UP,e=>{if(this.canSelectMany||!this._quickNavigate)return;const t=new or(e),i=t.keyCode;this._quickNavigate.keybindings.some(o=>{const a=o.getChords();return a.length>1?!1:a[0].shiftKey&&i===4?!(t.ctrlKey||t.altKey||t.metaKey):!!(a[0].altKey&&i===6||a[0].ctrlKey&&i===5||a[0].metaKey&&i===57)})&&(this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!1)),this._quickNavigate=void 0)})}update(){if(!this.visible)return;const e=this.keepScrollPosition?this.scrollTop:0,t=!!this.description,i={title:!!this.title||!!this.step||!!this.titleButtons.length,description:t,checkAll:this.canSelectMany&&!this._hideCheckAll,checkBox:this.canSelectMany,inputBox:!this._hideInput,progressBar:!this._hideInput||t,visibleCount:!0,count:this.canSelectMany&&!this._hideCountBadge,ok:this.ok==="default"?this.canSelectMany:this.ok,list:!0,message:!!this.validationMessage,customButton:this.customButton};this.ui.setVisibilities(i),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||"");let r=this.ariaLabel;!r&&i.inputBox&&(r=this.placeholder||H8.DEFAULT_ARIA_LABEL,this.title&&(r+=` - ${this.title}`)),this.ui.list.ariaLabel!==r&&(this.ui.list.ariaLabel=r??null),this.ui.list.matchOnDescription=this.matchOnDescription,this.ui.list.matchOnDetail=this.matchOnDetail,this.ui.list.matchOnLabel=this.matchOnLabel,this.ui.list.matchOnLabelMode=this.matchOnLabelMode,this.ui.list.sortByLabel=this.sortByLabel,this.itemsUpdated&&(this.itemsUpdated=!1,this._focusEventBufferer.bufferEvents(()=>{switch(this.ui.list.setElements(this.items),this.ui.list.shouldLoop=!this.canSelectMany,this.ui.list.filter(this.filterValue(this.ui.inputBox.value)),this._itemActivation){case zf.NONE:this._itemActivation=zf.FIRST;break;case zf.SECOND:this.ui.list.focus(yr.Second),this._itemActivation=zf.FIRST;break;case zf.LAST:this.ui.list.focus(yr.Last),this._itemActivation=zf.FIRST;break;default:this.trySelectFirst();break}})),this.ui.container.classList.contains("show-checkboxes")!==!!this.canSelectMany&&(this.canSelectMany?this.ui.list.clearFocus():this.trySelectFirst()),this.activeItemsUpdated&&(this.activeItemsUpdated=!1,this.activeItemsToConfirm=this._activeItems,this.ui.list.setFocusedElements(this.activeItems),this.activeItemsToConfirm===this._activeItems&&(this.activeItemsToConfirm=null)),this.selectedItemsUpdated&&(this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=this._selectedItems,this.canSelectMany?this.ui.list.setCheckedElements(this.selectedItems):this.ui.list.setSelectedElements(this.selectedItems),this.selectedItemsToConfirm===this._selectedItems&&(this.selectedItemsToConfirm=null)),this.ui.customButton.label=this.customLabel||"",this.ui.customButton.element.title=this.customHover||"",i.inputBox||(this.ui.list.domFocus(),this.canSelectMany&&this.ui.list.focus(yr.First)),this.keepScrollPosition&&(this.scrollTop=e)}focus(e){this.ui.list.focus(e),this.canSelectMany&&this.ui.list.domFocus()}accept(e){e&&!this._canAcceptInBackground||this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(e??!1))}}let h2t=class extends DW{constructor(){super(...arguments),this._value="",this.valueSelectionUpdated=!0,this._password=!1,this.onDidValueChangeEmitter=this._register(new fe),this.onDidAcceptEmitter=this._register(new fe),this.type="inputBox",this.onDidChangeValue=this.onDidValueChangeEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event}get value(){return this._value}set value(e){this._value=e||"",this.update()}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get password(){return this._password}set password(e){this._password=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{e!==this.value&&(this._value=e,this.onDidValueChangeEmitter.fire(e))})),this.visibleDisposables.add(this.ui.onDidAccept(()=>this.onDidAcceptEmitter.fire())),this.valueSelectionUpdated=!0),super.show()}update(){if(!this.visible)return;this.ui.container.classList.remove("hidden-input");const e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description||!!this.step,inputBox:!0,message:!0,progressBar:!0};this.ui.setVisibilities(e),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||""),this.ui.inputBox.password!==this.password&&(this.ui.inputBox.password=this.password)}},GQ=class extends uE{constructor(e,t){super("element",!1,i=>this.getOverrideOptions(i),e,t)}getOverrideOptions(e){const t=(Eo(e.content)?e.content.textContent??"":typeof e.content=="string"?e.content:e.content.value).includes(` -`);return{persistence:{hideOnKeyDown:!1},appearance:{showHoverHint:t,skipFadeInAnimation:!0}}}};GQ=o2t([Eye(0,kn),Eye(1,um)],GQ);Te.white.toString(),Te.white.toString();let V8=class extends me{get onDidClick(){return this._onDidClick.event}constructor(e,t){super(),this._label="",this._onDidClick=this._register(new fe),this._onDidEscape=this._register(new fe),this.options=t,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),this._element.classList.toggle("secondary",!!t.secondary);const i=t.secondary?t.buttonSecondaryBackground:t.buttonBackground,r=t.secondary?t.buttonSecondaryForeground:t.buttonForeground;this._element.style.color=r||"",this._element.style.backgroundColor=i||"",t.supportShortLabel&&(this._labelShortElement=document.createElement("div"),this._labelShortElement.classList.add("monaco-button-label-short"),this._element.appendChild(this._labelShortElement),this._labelElement=document.createElement("div"),this._labelElement.classList.add("monaco-button-label"),this._element.appendChild(this._labelElement),this._element.classList.add("monaco-text-button-with-short-label")),typeof t.title=="string"&&this.setTitle(t.title),typeof t.ariaLabel=="string"&&this._element.setAttribute("aria-label",t.ariaLabel),e.appendChild(this._element),this._register(Fr.addTarget(this._element)),[je.CLICK,gr.Tap].forEach(s=>{this._register(Ce(this._element,s,o=>{if(!this.enabled){Hn.stop(o);return}this._onDidClick.fire(o)}))}),this._register(Ce(this._element,je.KEY_DOWN,s=>{const o=new or(s);let a=!1;this.enabled&&(o.equals(3)||o.equals(10))?(this._onDidClick.fire(s),a=!0):o.equals(9)&&(this._onDidEscape.fire(s),this._element.blur(),a=!0),a&&Hn.stop(o,!0)})),this._register(Ce(this._element,je.MOUSE_OVER,s=>{this._element.classList.contains("disabled")||this.updateBackground(!0)})),this._register(Ce(this._element,je.MOUSE_OUT,s=>{this.updateBackground(!1)})),this.focusTracker=this._register(Eg(this._element)),this._register(this.focusTracker.onDidFocus(()=>{this.enabled&&this.updateBackground(!0)})),this._register(this.focusTracker.onDidBlur(()=>{this.enabled&&this.updateBackground(!1)}))}dispose(){super.dispose(),this._element.remove()}getContentElements(e){const t=[];for(let i of ob(e))if(typeof i=="string"){if(i=i.trim(),i==="")continue;const r=document.createElement("span");r.textContent=i,t.push(r)}else t.push(i);return t}updateBackground(e){let t;this.options.secondary?t=e?this.options.buttonSecondaryHoverBackground:this.options.buttonSecondaryBackground:t=e?this.options.buttonHoverBackground:this.options.buttonBackground,t&&(this._element.style.backgroundColor=t)}get element(){return this._element}set label(e){if(this._label===e||bg(this._label)&&bg(e)&&jCt(this._label,e))return;this._element.classList.add("monaco-text-button");const t=this.options.supportShortLabel?this._labelElement:this._element;if(bg(e)){const r=vW(e,{inline:!0});r.dispose();const s=r.element.querySelector("p")?.innerHTML;if(s){const o=r3e(s,{ADD_TAGS:["b","i","u","code","span"],ALLOWED_ATTR:["class"],RETURN_TRUSTED_TYPE:!0});t.innerHTML=o}else ea(t)}else this.options.supportIcons?ea(t,...this.getContentElements(e)):t.textContent=e;let i="";typeof this.options.title=="string"?i=this.options.title:this.options.title&&(i=nxt(e)),this.setTitle(i),typeof this.options.ariaLabel=="string"?this._element.setAttribute("aria-label",this.options.ariaLabel):this.options.ariaLabel&&this._element.setAttribute("aria-label",i),this._label=e}get label(){return this._label}set icon(e){this._element.classList.add(...zt.asClassNameArray(e))}set enabled(e){e?(this._element.classList.remove("disabled"),this._element.setAttribute("aria-disabled",String(!1)),this._element.tabIndex=0):(this._element.classList.add("disabled"),this._element.setAttribute("aria-disabled",String(!0)))}get enabled(){return!this._element.classList.contains("disabled")}setTitle(e){!this._hover&&e!==""?this._hover=this._register(Bg().setupManagedHover(this.options.hoverDelegate??Yl("mouse"),this._element,e)):this._hover&&this._hover.update(e)}};class YQ{constructor(e,t,i){this.options=t,this.styles=i,this.count=0,this.element=Ne(e,qe(".monaco-count-badge")),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0)}setCount(e){this.count=e,this.render()}setTitleFormat(e){this.titleFormat=e,this.render()}render(){this.element.textContent=Lw(this.countFormat,this.count),this.element.title=Lw(this.titleFormat,this.count),this.element.style.backgroundColor=this.styles.badgeBackground??"",this.element.style.color=this.styles.badgeForeground??"",this.styles.badgeBorder&&(this.element.style.border=`1px solid ${this.styles.badgeBorder}`)}}const Lye="done",Tye="active",fq="infinite",gq="infinite-long-running",Dye="discrete";class nce extends me{static{this.LONG_RUNNING_INFINITE_THRESHOLD=1e4}constructor(e,t){super(),this.progressSignal=this._register(new To),this.workedVal=0,this.showDelayedScheduler=this._register(new Ui(()=>Qc(this.element),0)),this.longRunningScheduler=this._register(new Ui(()=>this.infiniteLongRunning(),nce.LONG_RUNNING_INFINITE_THRESHOLD)),this.create(e,t)}create(e,t){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),e.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.bit.style.backgroundColor=t?.progressBarBackground||"#0E70C0",this.element.appendChild(this.bit)}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(Tye,fq,gq,Dye),this.workedVal=0,this.totalWork=void 0,this.longRunningScheduler.cancel(),this.progressSignal.clear()}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add(Lye),this.element.classList.contains(fq)?(this.bit.style.opacity="0",e?setTimeout(()=>this.off(),200):this.off()):(this.bit.style.width="inherit",e?setTimeout(()=>this.off(),200):this.off()),this}infinite(){return this.bit.style.width="2%",this.bit.style.opacity="1",this.element.classList.remove(Dye,Lye,gq),this.element.classList.add(Tye,fq),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add(gq)}getContainer(){return this.element}}const f2t=w("caseDescription","Match Case"),g2t=w("wordsDescription","Match Whole Word"),p2t=w("regexDescription","Use Regular Expression");class l6e extends o2{constructor(e){super({icon:ze.caseSensitive,title:f2t+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Yl("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class c6e extends o2{constructor(e){super({icon:ze.wholeWord,title:g2t+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Yl("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class u6e extends o2{constructor(e){super({icon:ze.regex,title:p2t+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Yl("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class m2t{constructor(e,t=0,i=e.length,r=t-1){this.items=e,this.start=t,this.end=i,this.index=r}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}next(){return this.index=Math.min(this.index+1,this.end),this.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}}class _2t{constructor(e=[],t=10){this._initialize(e),this._limit=t,this._onChange()}getHistory(){return this._elements}add(e){this._history.delete(e),this._history.add(e),this._onChange()}next(){return this._navigator.next()}previous(){return this._currentPosition()!==0?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}isLast(){return this._currentPosition()>=this._elements.length-1}isNowhere(){return this._navigator.current()===null}has(e){return this._history.has(e)}_onChange(){this._reduceToLimit();const e=this._elements;this._navigator=new m2t(e,0,e.length,e.length)}_reduceToLimit(){const e=this._elements;e.length>this._limit&&this._initialize(e.slice(e.length-this._limit))}_currentPosition(){const e=this._navigator.current();return e?this._elements.indexOf(e):-1}_initialize(e){this._history=new Set;for(const t of e)this._history.add(t)}get _elements(){const e=[];return this._history.forEach(t=>e.push(t)),e}}const MT=qe;class v2t extends ud{constructor(e,t,i){super(),this.state="idle",this.maxHeight=Number.POSITIVE_INFINITY,this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._onDidHeightChange=this._register(new fe),this.onDidHeightChange=this._onDidHeightChange.event,this.contextViewProvider=t,this.options=i,this.message=null,this.placeholder=this.options.placeholder||"",this.tooltip=this.options.tooltip??(this.placeholder||""),this.ariaLabel=this.options.ariaLabel||"",this.options.validationOptions&&(this.validation=this.options.validationOptions.validation),this.element=Ne(e,MT(".monaco-inputbox.idle"));const r=this.options.flexibleHeight?"textarea":"input",s=Ne(this.element,MT(".ibwrapper"));if(this.input=Ne(s,MT(r+".input.empty")),this.input.setAttribute("autocorrect","off"),this.input.setAttribute("autocapitalize","off"),this.input.setAttribute("spellcheck","false"),this.onfocus(this.input,()=>this.element.classList.add("synthetic-focus")),this.onblur(this.input,()=>this.element.classList.remove("synthetic-focus")),this.options.flexibleHeight){this.maxHeight=typeof this.options.flexibleMaxHeight=="number"?this.options.flexibleMaxHeight:Number.POSITIVE_INFINITY,this.mirror=Ne(s,MT("div.mirror")),this.mirror.innerText=" ",this.scrollableElement=new OFe(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),Ne(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll(l=>this.input.scrollTop=l.scrollTop));const o=this._register(new $n(e.ownerDocument,"selectionchange")),a=Ge.filter(o.event,()=>e.ownerDocument.getSelection()?.anchorNode===s);this._register(a(this.updateScrollDimensions,this)),this._register(this.onDidHeightChange(this.updateScrollDimensions,this))}else this.input.type=this.options.type||"text",this.input.setAttribute("wrap","off");this.ariaLabel&&this.input.setAttribute("aria-label",this.ariaLabel),this.placeholder&&!this.options.showPlaceholderOnFocus&&this.setPlaceHolder(this.placeholder),this.tooltip&&this.setTooltip(this.tooltip),this.oninput(this.input,()=>this.onValueChange()),this.onblur(this.input,()=>this.onBlur()),this.onfocus(this.input,()=>this.onFocus()),this._register(this.ignoreGesture(this.input)),setTimeout(()=>this.updateMirror(),0),this.options.actions&&(this.actionbar=this._register(new ed(this.element)),this.actionbar.push(this.options.actions,{icon:!0,label:!1})),this.applyStyles()}onBlur(){this._hideMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder","")}onFocus(){this._showMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder",this.placeholder||"")}setPlaceHolder(e){this.placeholder=e,this.input.setAttribute("placeholder",e)}setTooltip(e){this.tooltip=e,this.hover?this.hover.update(e):this.hover=this._register(Bg().setupManagedHover(Yl("mouse"),this.input,e))}get inputElement(){return this.input}get value(){return this.input.value}set value(e){this.input.value!==e&&(this.input.value=e,this.onValueChange())}get height(){return typeof this.cachedHeight=="number"?this.cachedHeight:h_(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return H$(this.input)}select(e=null){this.input.select(),e&&(this.input.setSelectionRange(e.start,e.end),e.end===this.input.value.length&&(this.input.scrollLeft=this.input.scrollWidth))}isSelectionAtEnd(){return this.input.selectionEnd===this.input.value.length&&this.input.selectionStart===this.input.selectionEnd}getSelection(){const e=this.input.selectionStart;if(e===null)return null;const t=this.input.selectionEnd??e;return{start:e,end:t}}enable(){this.input.removeAttribute("disabled")}disable(){this.blur(),this.input.disabled=!0,this._hideMessage()}set paddingRight(e){this.input.style.width=`calc(100% - ${e}px)`,this.mirror&&(this.mirror.style.paddingRight=e+"px")}updateScrollDimensions(){if(typeof this.cachedContentHeight!="number"||typeof this.cachedHeight!="number"||!this.scrollableElement)return;const e=this.cachedContentHeight,t=this.cachedHeight,i=this.input.scrollTop;this.scrollableElement.setScrollDimensions({scrollHeight:e,height:t}),this.scrollableElement.setScrollPosition({scrollTop:i})}showMessage(e,t){if(this.state==="open"&&ru(this.message,e))return;this.message=e,this.element.classList.remove("idle"),this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add(this.classForType(e.type));const i=this.stylesForType(this.message.type);this.element.style.border=`1px solid ${A_(i.border,"transparent")}`,this.message.content&&(this.hasFocus()||t)&&this._showMessage()}hideMessage(){this.message=null,this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add("idle"),this._hideMessage(),this.applyStyles()}validate(){let e=null;return this.validation&&(e=this.validation(this.value),e?(this.inputElement.setAttribute("aria-invalid","true"),this.showMessage(e)):this.inputElement.hasAttribute("aria-invalid")&&(this.inputElement.removeAttribute("aria-invalid"),this.hideMessage())),e?.type}stylesForType(e){const t=this.options.inputBoxStyles;switch(e){case 1:return{border:t.inputValidationInfoBorder,background:t.inputValidationInfoBackground,foreground:t.inputValidationInfoForeground};case 2:return{border:t.inputValidationWarningBorder,background:t.inputValidationWarningBackground,foreground:t.inputValidationWarningForeground};default:return{border:t.inputValidationErrorBorder,background:t.inputValidationErrorBackground,foreground:t.inputValidationErrorForeground}}}classForType(e){switch(e){case 1:return"info";case 2:return"warning";default:return"error"}}_showMessage(){if(!this.contextViewProvider||!this.message)return;let e;const t=()=>e.style.width=qc(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:r=>{if(!this.message)return null;e=Ne(r,MT(".monaco-inputbox-container")),t();const s={inline:!0,className:"monaco-inputbox-message"},o=this.message.formatContent?cCt(this.message.content,s):lCt(this.message.content,s);o.classList.add(this.classForType(this.message.type));const a=this.stylesForType(this.message.type);return o.style.backgroundColor=a.background??"",o.style.color=a.foreground??"",o.style.border=a.border?`1px solid ${a.border}`:"",Ne(e,o),null},onHide:()=>{this.state="closed"},layout:t});let i;this.message.type===3?i=w("alertErrorMessage","Error: {0}",this.message.content):this.message.type===2?i=w("alertWarningMessage","Warning: {0}",this.message.content):i=w("alertInfoMessage","Info: {0}",this.message.content),ql(i),this.state="open"}_hideMessage(){this.contextViewProvider&&(this.state==="open"&&this.contextViewProvider.hideContextView(),this.state="idle")}onValueChange(){this._onDidChange.fire(this.value),this.validate(),this.updateMirror(),this.input.classList.toggle("empty",!this.value),this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout()}updateMirror(){if(!this.mirror)return;const e=this.value,i=e.charCodeAt(e.length-1)===10?" ":"";(e+i).replace(/\u000c/g,"")?this.mirror.textContent=e+i:this.mirror.innerText=" ",this.layout()}applyStyles(){const e=this.options.inputBoxStyles,t=e.inputBackground??"",i=e.inputForeground??"",r=e.inputBorder??"";this.element.style.backgroundColor=t,this.element.style.color=i,this.input.style.backgroundColor="inherit",this.input.style.color=i,this.element.style.border=`1px solid ${A_(r,"transparent")}`}layout(){if(!this.mirror)return;const e=this.cachedContentHeight;this.cachedContentHeight=h_(this.mirror),e!==this.cachedContentHeight&&(this.cachedHeight=Math.min(this.cachedContentHeight,this.maxHeight),this.input.style.height=this.cachedHeight+"px",this._onDidHeightChange.fire(this.cachedContentHeight))}insertAtCursor(e){const t=this.inputElement,i=t.selectionStart,r=t.selectionEnd,s=t.value;i!==null&&r!==null&&(this.value=s.substr(0,i)+e+s.substr(r),t.setSelectionRange(i+1,i+1),this.layout())}dispose(){this._hideMessage(),this.message=null,this.actionbar?.dispose(),super.dispose()}}class d6e extends v2t{constructor(e,t,i){const r=w({key:"history.inputbox.hint.suffix.noparens",comment:['Text is the suffix of an input field placeholder coming after the action the input field performs, this will be used when the input field ends in a closing parenthesis ")", for example "Filter (e.g. text, !exclude)". The character inserted into the final string is ⇅ to represent the up and down arrow keys.']}," or {0} for history","⇅"),s=w({key:"history.inputbox.hint.suffix.inparens",comment:['Text is the suffix of an input field placeholder coming after the action the input field performs, this will be used when the input field does NOT end in a closing parenthesis (eg. "Find"). The character inserted into the final string is ⇅ to represent the up and down arrow keys.']}," ({0} for history)","⇅");super(e,t,i),this._onDidFocus=this._register(new fe),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new fe),this.onDidBlur=this._onDidBlur.event,this.history=new _2t(i.history,100);const o=()=>{if(i.showHistoryHint&&i.showHistoryHint()&&!this.placeholder.endsWith(r)&&!this.placeholder.endsWith(s)&&this.history.getHistory().length){const a=this.placeholder.endsWith(")")?r:s,l=this.placeholder+a;i.showPlaceholderOnFocus&&!H$(this.input)?this.placeholder=l:this.setPlaceHolder(l)}};this.observer=new MutationObserver((a,l)=>{a.forEach(c=>{c.target.textContent||o()})}),this.observer.observe(this.input,{attributeFilter:["class"]}),this.onfocus(this.input,()=>o()),this.onblur(this.input,()=>{const a=l=>{if(this.placeholder.endsWith(l)){const c=this.placeholder.slice(0,this.placeholder.length-l.length);return i.showPlaceholderOnFocus?this.placeholder=c:this.setPlaceHolder(c),!0}else return!1};a(s)||a(r)})}dispose(){super.dispose(),this.observer&&(this.observer.disconnect(),this.observer=void 0)}addToHistory(e){this.value&&(e||this.value!==this.getCurrentValue())&&this.history.add(this.value)}isAtLastInHistory(){return this.history.isLast()}isNowhereInHistory(){return this.history.isNowhere()}showNextValue(){this.history.has(this.value)||this.addToHistory();let e=this.getNextValue();e&&(e=e===this.value?this.getNextValue():e),this.value=e??"",Qp(this.value?this.value:w("clearedInput","Cleared Input"))}showPreviousValue(){this.history.has(this.value)||this.addToHistory();let e=this.getPreviousValue();e&&(e=e===this.value?this.getPreviousValue():e),e&&(this.value=e,Qp(this.value))}setPlaceHolder(e){super.setPlaceHolder(e),this.setTooltip(e)}onBlur(){super.onBlur(),this._onDidBlur.fire()}onFocus(){super.onFocus(),this._onDidFocus.fire()}getCurrentValue(){let e=this.history.current();return e||(e=this.history.last(),this.history.next()),e}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}}const b2t=w("defaultLabel","input");class h6e extends ud{constructor(e,t,i){super(),this.fixFocusOnOptionClickEnabled=!0,this.imeSessionInProgress=!1,this.additionalTogglesDisposables=this._register(new To),this.additionalToggles=[],this._onDidOptionChange=this._register(new fe),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new fe),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new fe),this.onMouseDown=this._onMouseDown.event,this._onInput=this._register(new fe),this._onKeyUp=this._register(new fe),this._onCaseSensitiveKeyDown=this._register(new fe),this.onCaseSensitiveKeyDown=this._onCaseSensitiveKeyDown.event,this._onRegexKeyDown=this._register(new fe),this.onRegexKeyDown=this._onRegexKeyDown.event,this._lastHighlightFindOptions=0,this.placeholder=i.placeholder||"",this.validation=i.validation,this.label=i.label||b2t,this.showCommonFindToggles=!!i.showCommonFindToggles;const r=i.appendCaseSensitiveLabel||"",s=i.appendWholeWordsLabel||"",o=i.appendRegexLabel||"",a=i.history||[],l=!!i.flexibleHeight,c=!!i.flexibleWidth,u=i.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new d6e(this.domNode,t,{placeholder:this.placeholder||"",ariaLabel:this.label||"",validationOptions:{validation:this.validation},history:a,showHistoryHint:i.showHistoryHint,flexibleHeight:l,flexibleWidth:c,flexibleMaxHeight:u,inputBoxStyles:i.inputBoxStyles}));const d=this._register(_E());if(this.showCommonFindToggles){this.regex=this._register(new u6e({appendTitle:o,isChecked:!1,hoverDelegate:d,...i.toggleStyles})),this._register(this.regex.onChange(f=>{this._onDidOptionChange.fire(f),!f&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.regex.onKeyDown(f=>{this._onRegexKeyDown.fire(f)})),this.wholeWords=this._register(new c6e({appendTitle:s,isChecked:!1,hoverDelegate:d,...i.toggleStyles})),this._register(this.wholeWords.onChange(f=>{this._onDidOptionChange.fire(f),!f&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this.caseSensitive=this._register(new l6e({appendTitle:r,isChecked:!1,hoverDelegate:d,...i.toggleStyles})),this._register(this.caseSensitive.onChange(f=>{this._onDidOptionChange.fire(f),!f&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.caseSensitive.onKeyDown(f=>{this._onCaseSensitiveKeyDown.fire(f)}));const h=[this.caseSensitive.domNode,this.wholeWords.domNode,this.regex.domNode];this.onkeydown(this.domNode,f=>{if(f.equals(15)||f.equals(17)||f.equals(9)){const g=h.indexOf(this.domNode.ownerDocument.activeElement);if(g>=0){let p=-1;f.equals(17)?p=(g+1)%h.length:f.equals(15)&&(g===0?p=h.length-1:p=g-1),f.equals(9)?(h[g].blur(),this.inputBox.focus()):p>=0&&h[p].focus(),Hn.stop(f,!0)}}})}this.controls=document.createElement("div"),this.controls.className="controls",this.controls.style.display=this.showCommonFindToggles?"":"none",this.caseSensitive&&this.controls.append(this.caseSensitive.domNode),this.wholeWords&&this.controls.appendChild(this.wholeWords.domNode),this.regex&&this.controls.appendChild(this.regex.domNode),this.setAdditionalToggles(i?.additionalToggles),this.controls&&this.domNode.appendChild(this.controls),e?.appendChild(this.domNode),this._register(Ce(this.inputBox.inputElement,"compositionstart",h=>{this.imeSessionInProgress=!0})),this._register(Ce(this.inputBox.inputElement,"compositionend",h=>{this.imeSessionInProgress=!1,this._onInput.fire()})),this.onkeydown(this.inputBox.inputElement,h=>this._onKeyDown.fire(h)),this.onkeyup(this.inputBox.inputElement,h=>this._onKeyUp.fire(h)),this.oninput(this.inputBox.inputElement,h=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,h=>this._onMouseDown.fire(h))}get onDidChange(){return this.inputBox.onDidChange}layout(e){this.inputBox.layout(),this.updateInputBoxPadding(e.collapsedFindWidget)}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.regex?.enable(),this.wholeWords?.enable(),this.caseSensitive?.enable();for(const e of this.additionalToggles)e.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.regex?.disable(),this.wholeWords?.disable(),this.caseSensitive?.disable();for(const e of this.additionalToggles)e.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}setAdditionalToggles(e){for(const t of this.additionalToggles)t.domNode.remove();this.additionalToggles=[],this.additionalTogglesDisposables.value=new ke;for(const t of e??[])this.additionalTogglesDisposables.value.add(t),this.controls.appendChild(t.domNode),this.additionalTogglesDisposables.value.add(t.onChange(i=>{this._onDidOptionChange.fire(i),!i&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus()})),this.additionalToggles.push(t);this.additionalToggles.length>0&&(this.controls.style.display=""),this.updateInputBoxPadding()}updateInputBoxPadding(e=!1){e?this.inputBox.paddingRight=0:this.inputBox.paddingRight=(this.caseSensitive?.width()??0)+(this.wholeWords?.width()??0)+(this.regex?.width()??0)+this.additionalToggles.reduce((t,i)=>t+i.width(),0)}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getCaseSensitive(){return this.caseSensitive?.checked??!1}setCaseSensitive(e){this.caseSensitive&&(this.caseSensitive.checked=e)}getWholeWords(){return this.wholeWords?.checked??!1}setWholeWords(e){this.wholeWords&&(this.wholeWords.checked=e)}getRegex(){return this.regex?.checked??!1}setRegex(e){this.regex&&(this.regex.checked=e,this.validate())}focusOnCaseSensitive(){this.caseSensitive?.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox.validate()}showMessage(e){this.inputBox.showMessage(e)}clearMessage(){this.inputBox.hideMessage()}}const y2t=qe;class w2t extends me{constructor(e,t,i){super(),this.parent=e,this.onKeyDown=s=>Jr(this.findInput.inputBox.inputElement,je.KEY_DOWN,s),this.onDidChange=s=>this.findInput.onDidChange(s),this.container=Ne(this.parent,y2t(".quick-input-box")),this.findInput=this._register(new h6e(this.container,void 0,{label:"",inputBoxStyles:t,toggleStyles:i}));const r=this.findInput.inputBox.inputElement;r.role="combobox",r.ariaHasPopup="menu",r.ariaAutoComplete="list",r.ariaExpanded="true"}get value(){return this.findInput.getValue()}set value(e){this.findInput.setValue(e)}select(e=null){this.findInput.inputBox.select(e)}getSelection(){return this.findInput.inputBox.getSelection()}isSelectionAtEnd(){return this.findInput.inputBox.isSelectionAtEnd()}get placeholder(){return this.findInput.inputBox.inputElement.getAttribute("placeholder")||""}set placeholder(e){this.findInput.inputBox.setPlaceHolder(e)}get password(){return this.findInput.inputBox.inputElement.type==="password"}set password(e){this.findInput.inputBox.inputElement.type=e?"password":"text"}set enabled(e){this.findInput.inputBox.inputElement.toggleAttribute("readonly",!e)}set toggles(e){this.findInput.setAdditionalToggles(e)}setAttribute(e,t){this.findInput.inputBox.inputElement.setAttribute(e,t)}showDecoration(e){e===Ss.Ignore?this.findInput.clearMessage():this.findInput.showMessage({type:e===Ss.Info?1:e===Ss.Warning?2:3,content:""})}stylesForType(e){return this.findInput.inputBox.stylesForType(e===Ss.Info?1:e===Ss.Warning?2:3)}setFocus(){this.findInput.focus()}layout(){this.findInput.inputBox.layout()}}class C2t{get templateId(){return this.renderer.templateId}constructor(e,t){this.renderer=e,this.modelProvider=t}renderTemplate(e){return{data:this.renderer.renderTemplate(e),disposable:me.None}}renderElement(e,t,i,r){if(i.disposable?.dispose(),!i.data)return;const s=this.modelProvider();if(s.isResolved(e))return this.renderer.renderElement(s.get(e),e,i.data,r);const o=new Kr,a=s.resolve(e,o.token);i.disposable={dispose:()=>o.cancel()},this.renderer.renderPlaceholder(e,i.data),a.then(l=>this.renderer.renderElement(l,e,i.data,r))}disposeTemplate(e){e.disposable&&(e.disposable.dispose(),e.disposable=void 0),e.data&&(this.renderer.disposeTemplate(e.data),e.data=void 0)}}class x2t{constructor(e,t){this.modelProvider=e,this.accessibilityProvider=t}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(e){const t=this.modelProvider();return t.isResolved(e)?this.accessibilityProvider.getAriaLabel(t.get(e)):null}}function S2t(n,e){return{...e,accessibilityProvider:e.accessibilityProvider&&new x2t(n,e.accessibilityProvider)}}class k2t{constructor(e,t,i,r,s={}){const o=()=>this.model,a=r.map(l=>new C2t(l,o));this.list=new dd(e,t,i,a,S2t(o,s))}updateOptions(e){this.list.updateOptions(e)}getHTMLElement(){return this.list.getHTMLElement()}get onDidFocus(){return this.list.onDidFocus}get widget(){return this.list}get onDidDispose(){return this.list.onDidDispose}get onMouseDblClick(){return Ge.map(this.list.onMouseDblClick,({element:e,index:t,browserEvent:i})=>({element:e===void 0?void 0:this._model.get(e),index:t,browserEvent:i}))}get onPointer(){return Ge.map(this.list.onPointer,({element:e,index:t,browserEvent:i})=>({element:e===void 0?void 0:this._model.get(e),index:t,browserEvent:i}))}get onDidChangeSelection(){return Ge.map(this.list.onDidChangeSelection,({elements:e,indexes:t,browserEvent:i})=>({elements:e.map(r=>this._model.get(r)),indexes:t,browserEvent:i}))}get model(){return this._model}set model(e){this._model=e,this.list.splice(0,this.list.length,sc(e.length))}getFocus(){return this.list.getFocus()}getSelection(){return this.list.getSelection()}getSelectedElements(){return this.getSelection().map(e=>this.model.get(e))}style(e){this.list.style(e)}dispose(){this.list.dispose()}}var a2=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};const E2t=!1;var z8;(function(n){n.North="north",n.South="south",n.East="east",n.West="west"})(z8||(z8={}));let L2t=4;const T2t=new fe;let D2t=300;const I2t=new fe;class ice{constructor(e){this.el=e,this.disposables=new ke}get onPointerMove(){return this.disposables.add(new $n(Ot(this.el),"mousemove")).event}get onPointerUp(){return this.disposables.add(new $n(Ot(this.el),"mouseup")).event}dispose(){this.disposables.dispose()}}a2([Ds],ice.prototype,"onPointerMove",null);a2([Ds],ice.prototype,"onPointerUp",null);class rce{get onPointerMove(){return this.disposables.add(new $n(this.el,gr.Change)).event}get onPointerUp(){return this.disposables.add(new $n(this.el,gr.End)).event}constructor(e){this.el=e,this.disposables=new ke}dispose(){this.disposables.dispose()}}a2([Ds],rce.prototype,"onPointerMove",null);a2([Ds],rce.prototype,"onPointerUp",null);class U8{get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}constructor(e){this.factory=e}dispose(){}}a2([Ds],U8.prototype,"onPointerMove",null);a2([Ds],U8.prototype,"onPointerUp",null);const Iye="pointer-events-disabled";class $a extends me{get state(){return this._state}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}set state(e){this._state!==e&&(this.el.classList.toggle("disabled",e===0),this.el.classList.toggle("minimum",e===1),this.el.classList.toggle("maximum",e===2),this._state=e,this.onDidEnablementChange.fire(e))}set orthogonalStartSash(e){if(this._orthogonalStartSash!==e){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),e){const t=i=>{this.orthogonalStartDragHandleDisposables.clear(),i!==0&&(this._orthogonalStartDragHandle=Ne(this.el,qe(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(Lt(()=>this._orthogonalStartDragHandle.remove())),this.orthogonalStartDragHandleDisposables.add(new $n(this._orthogonalStartDragHandle,"mouseenter")).event(()=>$a.onMouseEnter(e),void 0,this.orthogonalStartDragHandleDisposables),this.orthogonalStartDragHandleDisposables.add(new $n(this._orthogonalStartDragHandle,"mouseleave")).event(()=>$a.onMouseLeave(e),void 0,this.orthogonalStartDragHandleDisposables))};this.orthogonalStartSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalStartSash=e}}set orthogonalEndSash(e){if(this._orthogonalEndSash!==e){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),e){const t=i=>{this.orthogonalEndDragHandleDisposables.clear(),i!==0&&(this._orthogonalEndDragHandle=Ne(this.el,qe(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(Lt(()=>this._orthogonalEndDragHandle.remove())),this.orthogonalEndDragHandleDisposables.add(new $n(this._orthogonalEndDragHandle,"mouseenter")).event(()=>$a.onMouseEnter(e),void 0,this.orthogonalEndDragHandleDisposables),this.orthogonalEndDragHandleDisposables.add(new $n(this._orthogonalEndDragHandle,"mouseleave")).event(()=>$a.onMouseLeave(e),void 0,this.orthogonalEndDragHandleDisposables))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalEndSash=e}}constructor(e,t,i){super(),this.hoverDelay=D2t,this.hoverDelayer=this._register(new Qd(this.hoverDelay)),this._state=3,this.onDidEnablementChange=this._register(new fe),this._onDidStart=this._register(new fe),this._onDidChange=this._register(new fe),this._onDidReset=this._register(new fe),this._onDidEnd=this._register(new fe),this.orthogonalStartSashDisposables=this._register(new ke),this.orthogonalStartDragHandleDisposables=this._register(new ke),this.orthogonalEndSashDisposables=this._register(new ke),this.orthogonalEndDragHandleDisposables=this._register(new ke),this.onDidStart=this._onDidStart.event,this.onDidChange=this._onDidChange.event,this.onDidReset=this._onDidReset.event,this.onDidEnd=this._onDidEnd.event,this.linkedSash=void 0,this.el=Ne(e,qe(".monaco-sash")),i.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${i.orthogonalEdge}`),Rn&&this.el.classList.add("mac");const r=this._register(new $n(this.el,"mousedown")).event;this._register(r(d=>this.onPointerStart(d,new ice(e)),this));const s=this._register(new $n(this.el,"dblclick")).event;this._register(s(this.onPointerDoublePress,this));const o=this._register(new $n(this.el,"mouseenter")).event;this._register(o(()=>$a.onMouseEnter(this)));const a=this._register(new $n(this.el,"mouseleave")).event;this._register(a(()=>$a.onMouseLeave(this))),this._register(Fr.addTarget(this.el));const l=this._register(new $n(this.el,gr.Start)).event;this._register(l(d=>this.onPointerStart(d,new rce(this.el)),this));const c=this._register(new $n(this.el,gr.Tap)).event;let u;this._register(c(d=>{if(u){clearTimeout(u),u=void 0,this.onPointerDoublePress(d);return}clearTimeout(u),u=setTimeout(()=>u=void 0,250)},this)),typeof i.size=="number"?(this.size=i.size,i.orientation===0?this.el.style.width=`${this.size}px`:this.el.style.height=`${this.size}px`):(this.size=L2t,this._register(T2t.event(d=>{this.size=d,this.layout()}))),this._register(I2t.event(d=>this.hoverDelay=d)),this.layoutProvider=t,this.orthogonalStartSash=i.orthogonalStartSash,this.orthogonalEndSash=i.orthogonalEndSash,this.orientation=i.orientation||0,this.orientation===1?(this.el.classList.add("horizontal"),this.el.classList.remove("vertical")):(this.el.classList.remove("horizontal"),this.el.classList.add("vertical")),this.el.classList.toggle("debug",E2t),this.layout()}onPointerStart(e,t){Hn.stop(e);let i=!1;if(!e.__orthogonalSashEvent){const g=this.getOrthogonalSash(e);g&&(i=!0,e.__orthogonalSashEvent=!0,g.onPointerStart(e,new U8(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new U8(t))),!this.state)return;const r=this.el.ownerDocument.getElementsByTagName("iframe");for(const g of r)g.classList.add(Iye);const s=e.pageX,o=e.pageY,a=e.altKey,l={startX:s,currentX:s,startY:o,currentY:o,altKey:a};this.el.classList.add("active"),this._onDidStart.fire(l);const c=id(this.el),u=()=>{let g="";i?g="all-scroll":this.orientation===1?this.state===1?g="s-resize":this.state===2?g="n-resize":g=Rn?"row-resize":"ns-resize":this.state===1?g="e-resize":this.state===2?g="w-resize":g=Rn?"col-resize":"ew-resize",c.textContent=`* { cursor: ${g} !important; }`},d=new ke;u(),i||this.onDidEnablementChange.event(u,null,d);const h=g=>{Hn.stop(g,!1);const p={startX:s,currentX:g.pageX,startY:o,currentY:g.pageY,altKey:a};this._onDidChange.fire(p)},f=g=>{Hn.stop(g,!1),c.remove(),this.el.classList.remove("active"),this._onDidEnd.fire(),d.dispose();for(const p of r)p.classList.remove(Iye)};t.onPointerMove(h,null,d),t.onPointerUp(f,null,d),d.add(t)}onPointerDoublePress(e){const t=this.getOrthogonalSash(e);t&&t._onDidReset.fire(),this.linkedSash&&this.linkedSash._onDidReset.fire(),this._onDidReset.fire()}static onMouseEnter(e,t=!1){e.el.classList.contains("active")?(e.hoverDelayer.cancel(),e.el.classList.add("hover")):e.hoverDelayer.trigger(()=>e.el.classList.add("hover"),e.hoverDelay).then(void 0,()=>{}),!t&&e.linkedSash&&$a.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&$a.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){$a.onMouseLeave(this)}layout(){if(this.orientation===0){const e=this.layoutProvider;this.el.style.left=e.getVerticalSashLeft(this)-this.size/2+"px",e.getVerticalSashTop&&(this.el.style.top=e.getVerticalSashTop(this)+"px"),e.getVerticalSashHeight&&(this.el.style.height=e.getVerticalSashHeight(this)+"px")}else{const e=this.layoutProvider;this.el.style.top=e.getHorizontalSashTop(this)-this.size/2+"px",e.getHorizontalSashLeft&&(this.el.style.left=e.getHorizontalSashLeft(this)+"px"),e.getHorizontalSashWidth&&(this.el.style.width=e.getHorizontalSashWidth(this)+"px")}}getOrthogonalSash(e){const t=e.initialTarget??e.target;if(!(!t||!Eo(t))&&t.classList.contains("orthogonal-drag-handle"))return t.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}}const A2t={separatorBorder:Te.transparent};class f6e{set size(e){this._size=e}get size(){return this._size}get visible(){return typeof this._cachedVisibleSize>"u"}setVisible(e,t){if(e!==this.visible){e?(this.size=Il(this._cachedVisibleSize,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof t=="number"?t:this.size,this.size=0),this.container.classList.toggle("visible",e);try{this.view.setVisible?.(e)}catch(i){console.error("Splitview: Failed to set visible view"),console.error(i)}}}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,t,i,r){this.container=e,this.view=t,this.disposable=r,this._cachedVisibleSize=void 0,typeof i=="number"?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}layout(e,t){this.layoutContainer(e);try{this.view.layout(this.size,e,t)}catch(i){console.error("Splitview: Failed to layout view"),console.error(i)}}dispose(){this.disposable.dispose()}}class N2t extends f6e{layoutContainer(e){this.container.style.top=`${e}px`,this.container.style.height=`${this.size}px`}}class R2t extends f6e{layoutContainer(e){this.container.style.left=`${e}px`,this.container.style.width=`${this.size}px`}}var Um;(function(n){n[n.Idle=0]="Idle",n[n.Busy=1]="Busy"})(Um||(Um={}));var j8;(function(n){n.Distribute={type:"distribute"};function e(r){return{type:"split",index:r}}n.Split=e;function t(r){return{type:"auto",index:r}}n.Auto=t;function i(r){return{type:"invisible",cachedVisibleSize:r}}n.Invisible=i})(j8||(j8={}));class g6e extends me{get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}get startSnappingEnabled(){return this._startSnappingEnabled}get endSnappingEnabled(){return this._endSnappingEnabled}set orthogonalStartSash(e){for(const t of this.sashItems)t.sash.orthogonalStartSash=e;this._orthogonalStartSash=e}set orthogonalEndSash(e){for(const t of this.sashItems)t.sash.orthogonalEndSash=e;this._orthogonalEndSash=e}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}constructor(e,t={}){super(),this.size=0,this._contentSize=0,this.proportions=void 0,this.viewItems=[],this.sashItems=[],this.state=Um.Idle,this._onDidSashChange=this._register(new fe),this._onDidSashReset=this._register(new fe),this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this.onDidSashChange=this._onDidSashChange.event,this.onDidSashReset=this._onDidSashReset.event,this.orientation=t.orientation??0,this.inverseAltBehavior=t.inverseAltBehavior??!1,this.proportionalLayout=t.proportionalLayout??!0,this.getSashOrthogonalSize=t.getSashOrthogonalSize,this.el=document.createElement("div"),this.el.classList.add("monaco-split-view2"),this.el.classList.add(this.orientation===0?"vertical":"horizontal"),e.appendChild(this.el),this.sashContainer=Ne(this.el,qe(".sash-container")),this.viewContainer=qe(".split-view-container"),this.scrollable=this._register(new t2({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:r=>du(Ot(this.el),r)})),this.scrollableElement=this._register(new fW(this.viewContainer,{vertical:this.orientation===0?t.scrollbarVisibility??1:2,horizontal:this.orientation===1?t.scrollbarVisibility??1:2},this.scrollable));const i=this._register(new $n(this.viewContainer,"scroll")).event;this._register(i(r=>{const s=this.scrollableElement.getScrollPosition(),o=Math.abs(this.viewContainer.scrollLeft-s.scrollLeft)<=1?void 0:this.viewContainer.scrollLeft,a=Math.abs(this.viewContainer.scrollTop-s.scrollTop)<=1?void 0:this.viewContainer.scrollTop;(o!==void 0||a!==void 0)&&this.scrollableElement.setScrollPosition({scrollLeft:o,scrollTop:a})})),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll(r=>{r.scrollTopChanged&&(this.viewContainer.scrollTop=r.scrollTop),r.scrollLeftChanged&&(this.viewContainer.scrollLeft=r.scrollLeft)})),Ne(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||A2t),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach((r,s)=>{const o=ml(r.visible)||r.visible?r.size:{type:"invisible",cachedVisibleSize:r.size},a=r.view;this.doAddView(a,o,s,!0)}),this._contentSize=this.viewItems.reduce((r,s)=>r+s.size,0),this.saveProportions())}style(e){e.separatorBorder.isTransparent()?(this.el.classList.remove("separator-border"),this.el.style.removeProperty("--separator-border")):(this.el.classList.add("separator-border"),this.el.style.setProperty("--separator-border",e.separatorBorder.toString()))}addView(e,t,i=this.viewItems.length,r){this.doAddView(e,t,i,r)}layout(e,t){const i=Math.max(this.size,this._contentSize);if(this.size=e,this.layoutContext=t,this.proportions){let r=0;for(let s=0;s0&&(o.size=Il(Math.round(a*e/r),o.minimumSize,o.maximumSize))}}else{const r=sc(this.viewItems.length),s=r.filter(a=>this.viewItems[a].priority===1),o=r.filter(a=>this.viewItems[a].priority===2);this.resize(this.viewItems.length-1,e-i,void 0,s,o)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this.proportions=this.viewItems.map(e=>e.proportionalLayout&&e.visible?e.size/this._contentSize:void 0))}onSashStart({sash:e,start:t,alt:i}){for(const a of this.viewItems)a.enabled=!1;const r=this.sashItems.findIndex(a=>a.sash===e),s=Qh(Ce(this.el.ownerDocument.body,"keydown",a=>o(this.sashDragState.current,a.altKey)),Ce(this.el.ownerDocument.body,"keyup",()=>o(this.sashDragState.current,!1))),o=(a,l)=>{const c=this.viewItems.map(g=>g.size);let u=Number.NEGATIVE_INFINITY,d=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(l=!l),l)if(r===this.sashItems.length-1){const p=this.viewItems[r];u=(p.minimumSize-p.size)/2,d=(p.maximumSize-p.size)/2}else{const p=this.viewItems[r+1];u=(p.size-p.maximumSize)/2,d=(p.size-p.minimumSize)/2}let h,f;if(!l){const g=sc(r,-1),p=sc(r+1,this.viewItems.length),m=g.reduce((D,I)=>D+(this.viewItems[I].minimumSize-c[I]),0),_=g.reduce((D,I)=>D+(this.viewItems[I].viewMaximumSize-c[I]),0),v=p.length===0?Number.POSITIVE_INFINITY:p.reduce((D,I)=>D+(c[I]-this.viewItems[I].minimumSize),0),y=p.length===0?Number.NEGATIVE_INFINITY:p.reduce((D,I)=>D+(c[I]-this.viewItems[I].viewMaximumSize),0),C=Math.max(m,y),x=Math.min(v,_),k=this.findFirstSnapIndex(g),L=this.findFirstSnapIndex(p);if(typeof k=="number"){const D=this.viewItems[k],I=Math.floor(D.viewMinimumSize/2);h={index:k,limitDelta:D.visible?C-I:C+I,size:D.size}}if(typeof L=="number"){const D=this.viewItems[L],I=Math.floor(D.viewMinimumSize/2);f={index:L,limitDelta:D.visible?x+I:x-I,size:D.size}}}this.sashDragState={start:a,current:a,index:r,sizes:c,minDelta:u,maxDelta:d,alt:l,snapBefore:h,snapAfter:f,disposable:s}};o(t,i)}onSashChange({current:e}){const{index:t,start:i,sizes:r,alt:s,minDelta:o,maxDelta:a,snapBefore:l,snapAfter:c}=this.sashDragState;this.sashDragState.current=e;const u=e-i,d=this.resize(t,u,r,void 0,void 0,o,a,l,c);if(s){const h=t===this.sashItems.length-1,f=this.viewItems.map(y=>y.size),g=h?t:t+1,p=this.viewItems[g],m=p.size-p.maximumSize,_=p.size-p.minimumSize,v=h?t-1:t+1;this.resize(v,-d,f,void 0,void 0,m,_)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(e){this._onDidSashChange.fire(e),this.sashDragState.disposable.dispose(),this.saveProportions();for(const t of this.viewItems)t.enabled=!0}onViewChange(e,t){const i=this.viewItems.indexOf(e);i<0||i>=this.viewItems.length||(t=typeof t=="number"?t:e.size,t=Il(t,e.minimumSize,e.maximumSize),this.inverseAltBehavior&&i>0?(this.resize(i-1,Math.floor((e.size-t)/2)),this.distributeEmptySpace(),this.layoutViews()):(e.size=t,this.relayout([i],void 0)))}resizeView(e,t){if(!(e<0||e>=this.viewItems.length)){if(this.state!==Um.Idle)throw new Error("Cant modify splitview");this.state=Um.Busy;try{const i=sc(this.viewItems.length).filter(a=>a!==e),r=[...i.filter(a=>this.viewItems[a].priority===1),e],s=i.filter(a=>this.viewItems[a].priority===2),o=this.viewItems[e];t=Math.round(t),t=Il(t,o.minimumSize,Math.min(o.maximumSize,this.size)),o.size=t,this.relayout(r,s)}finally{this.state=Um.Idle}}}distributeViewSizes(){const e=[];let t=0;for(const a of this.viewItems)a.maximumSize-a.minimumSize>0&&(e.push(a),t+=a.size);const i=Math.floor(t/e.length);for(const a of e)a.size=Il(i,a.minimumSize,a.maximumSize);const r=sc(this.viewItems.length),s=r.filter(a=>this.viewItems[a].priority===1),o=r.filter(a=>this.viewItems[a].priority===2);this.relayout(s,o)}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}doAddView(e,t,i=this.viewItems.length,r){if(this.state!==Um.Idle)throw new Error("Cant modify splitview");this.state=Um.Busy;try{const s=qe(".split-view-view");i===this.viewItems.length?this.viewContainer.appendChild(s):this.viewContainer.insertBefore(s,this.viewContainer.children.item(i));const o=e.onDidChange(h=>this.onViewChange(u,h)),a=Lt(()=>s.remove()),l=Qh(o,a);let c;typeof t=="number"?c=t:(t.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index}),t.type==="split"?c=this.getViewSize(t.index)/2:t.type==="invisible"?c={cachedVisibleSize:t.cachedVisibleSize}:c=e.minimumSize);const u=this.orientation===0?new N2t(s,e,c,l):new R2t(s,e,c,l);if(this.viewItems.splice(i,0,u),this.viewItems.length>1){const h={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash},f=this.orientation===0?new $a(this.sashContainer,{getHorizontalSashTop:D=>this.getSashPosition(D),getHorizontalSashWidth:this.getSashOrthogonalSize},{...h,orientation:1}):new $a(this.sashContainer,{getVerticalSashLeft:D=>this.getSashPosition(D),getVerticalSashHeight:this.getSashOrthogonalSize},{...h,orientation:0}),g=this.orientation===0?D=>({sash:f,start:D.startY,current:D.currentY,alt:D.altKey}):D=>({sash:f,start:D.startX,current:D.currentX,alt:D.altKey}),m=Ge.map(f.onDidStart,g)(this.onSashStart,this),v=Ge.map(f.onDidChange,g)(this.onSashChange,this),C=Ge.map(f.onDidEnd,()=>this.sashItems.findIndex(D=>D.sash===f))(this.onSashEnd,this),x=f.onDidReset(()=>{const D=this.sashItems.findIndex(G=>G.sash===f),I=sc(D,-1),O=sc(D+1,this.viewItems.length),M=this.findFirstSnapIndex(I),B=this.findFirstSnapIndex(O);typeof M=="number"&&!this.viewItems[M].visible||typeof B=="number"&&!this.viewItems[B].visible||this._onDidSashReset.fire(D)}),k=Qh(m,v,C,x,f),L={sash:f,disposable:k};this.sashItems.splice(i-1,0,L)}s.appendChild(e.element);let d;typeof t!="number"&&t.type==="split"&&(d=[t.index]),r||this.relayout([i],d),!r&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes()}finally{this.state=Um.Idle}}relayout(e,t){const i=this.viewItems.reduce((r,s)=>r+s.size,0);this.resize(this.viewItems.length-1,this.size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}resize(e,t,i=this.viewItems.map(u=>u.size),r,s,o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,l,c){if(e<0||e>=this.viewItems.length)return 0;const u=sc(e,-1),d=sc(e+1,this.viewItems.length);if(s)for(const L of s)uj(u,L),uj(d,L);if(r)for(const L of r)_4(u,L),_4(d,L);const h=u.map(L=>this.viewItems[L]),f=u.map(L=>i[L]),g=d.map(L=>this.viewItems[L]),p=d.map(L=>i[L]),m=u.reduce((L,D)=>L+(this.viewItems[D].minimumSize-i[D]),0),_=u.reduce((L,D)=>L+(this.viewItems[D].maximumSize-i[D]),0),v=d.length===0?Number.POSITIVE_INFINITY:d.reduce((L,D)=>L+(i[D]-this.viewItems[D].minimumSize),0),y=d.length===0?Number.NEGATIVE_INFINITY:d.reduce((L,D)=>L+(i[D]-this.viewItems[D].maximumSize),0),C=Math.max(m,y,o),x=Math.min(v,_,a);let k=!1;if(l){const L=this.viewItems[l.index],D=t>=l.limitDelta;k=D!==L.visible,L.setVisible(D,l.size)}if(!k&&c){const L=this.viewItems[c.index],D=ta+l.size,0);let i=this.size-t;const r=sc(this.viewItems.length-1,-1),s=r.filter(a=>this.viewItems[a].priority===1),o=r.filter(a=>this.viewItems[a].priority===2);for(const a of o)uj(r,a);for(const a of s)_4(r,a);typeof e=="number"&&_4(r,e);for(let a=0;i!==0&&at+i.size,0);let e=0;for(const t of this.viewItems)t.layout(e,this.layoutContext),e+=t.size;this.sashItems.forEach(t=>t.sash.layout()),this.updateSashEnablement(),this.updateScrollableElement()}updateScrollableElement(){this.orientation===0?this.scrollableElement.setScrollDimensions({height:this.size,scrollHeight:this._contentSize}):this.scrollableElement.setScrollDimensions({width:this.size,scrollWidth:this._contentSize})}updateSashEnablement(){let e=!1;const t=this.viewItems.map(l=>e=l.size-l.minimumSize>0||e);e=!1;const i=this.viewItems.map(l=>e=l.maximumSize-l.size>0||e),r=[...this.viewItems].reverse();e=!1;const s=r.map(l=>e=l.size-l.minimumSize>0||e).reverse();e=!1;const o=r.map(l=>e=l.maximumSize-l.size>0||e).reverse();let a=0;for(let l=0;l0||this.startSnappingEnabled)?c.state=1:v&&t[l]&&(a0)return;if(!i.visible&&i.snap)return t}}areViewsDistributed(){let e,t;for(const i of this.viewItems)if(e=e===void 0?i.size:Math.min(e,i.size),t=t===void 0?i.size:Math.max(t,i.size),t-e>2)return!1;return!0}dispose(){this.sashDragState?.disposable.dispose(),er(this.viewItems),this.viewItems=[],this.sashItems.forEach(e=>e.disposable.dispose()),this.sashItems=[],super.dispose()}}class IW{static{this.TemplateId="row"}constructor(e,t,i){this.columns=e,this.getColumnSize=i,this.templateId=IW.TemplateId,this.renderedTemplates=new Set;const r=new Map(t.map(s=>[s.templateId,s]));this.renderers=[];for(const s of e){const o=r.get(s.templateId);if(!o)throw new Error(`Table cell renderer for template id ${s.templateId} not found.`);this.renderers.push(o)}}renderTemplate(e){const t=Ne(e,qe(".monaco-table-tr")),i=[],r=[];for(let o=0;othis.disposables.add(new O2t(u,d))),l={size:a.reduce((u,d)=>u+d.column.weight,0),views:a.map(u=>({size:u.column.weight,view:u}))};this.splitview=this.disposables.add(new g6e(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:l})),this.splitview.el.style.height=`${i.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${i.headerRowHeight}px`;const c=new IW(r,s,u=>this.splitview.getViewSize(u));this.list=this.disposables.add(new dd(e,this.domNode,P2t(i),[c],o)),Ge.any(...a.map(u=>u.onDidLayout))(([u,d])=>c.layoutColumn(u,d),null,this.disposables),this.splitview.onDidSashReset(u=>{const d=r.reduce((f,g)=>f+g.weight,0),h=r[u].weight/d*this.cachedWidth;this.splitview.resizeView(u,h)},null,this.disposables),this.styleElement=id(this.domNode),this.style(okt)}updateOptions(e){this.list.updateOptions(e)}splice(e,t,i=[]){this.list.splice(e,t,i)}getHTMLElement(){return this.domNode}style(e){const t=[];t.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before { +`}_shouldRestoreUndoStack(){const e=this._configurationService.getValue("files.restoreUndoStack");return typeof e=="boolean"?e:!0}getCreationOptions(e,t,i){const r=typeof e=="string"?e:e.languageId;let s=this._modelCreationOptionsByLanguageAndResource[r+t];if(!s){const o=this._configurationService.getValue("editor",{overrideIdentifier:r,resource:t}),a=this._getEOL(t,r);s=Gx._readModelOptions({editor:o,eol:a},i),this._modelCreationOptionsByLanguageAndResource[r+t]=s}return s}_updateModelOptions(e){const t=this._modelCreationOptionsByLanguageAndResource;this._modelCreationOptionsByLanguageAndResource=Object.create(null);const i=Object.keys(this._models);for(let r=0,s=i.length;re){const t=[];for(this._disposedModels.forEach(i=>{i.sharesUndoRedoStack||t.push(i)}),t.sort((i,r)=>i.time-r.time);t.length>0&&this._disposedModelsHeapSize>e;){const i=t.shift();this._removeDisposedModel(i.uri),i.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(i.initialUndoRedoSnapshot)}}}_createModelData(e,t,i,r){const s=this.getCreationOptions(t,i,r),o=this._instantiationService.createInstance(og,e,t,s,i);if(i&&this._disposedModels.has(A1(i))){const c=this._removeDisposedModel(i),u=this._undoRedoService.getElements(i),d=this._getSHA1Computer(),h=d.canComputeSHA1(o)?d.computeSHA1(o)===c.sha1:!1;if(h||c.sharesUndoRedoStack){for(const f of u.past)t_(f)&&f.matchesResource(i)&&f.setModel(o);for(const f of u.future)t_(f)&&f.matchesResource(i)&&f.setModel(o);this._undoRedoService.setElementsValidFlag(i,!0,f=>t_(f)&&f.matchesResource(i)),h&&(o._overwriteVersionId(c.versionId),o._overwriteAlternativeVersionId(c.alternativeVersionId),o._overwriteInitialUndoRedoSnapshot(c.initialUndoRedoSnapshot))}else c.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(c.initialUndoRedoSnapshot)}const a=A1(o.uri);if(this._models[a])throw new Error("ModelService: Cannot add model because it already exists!");const l=new GLt(o,c=>this._onWillDispose(c),(c,u)=>this._onDidChangeLanguage(c,u));return this._models[a]=l,l}createModel(e,t,i,r=!1){let s;return t?s=this._createModelData(e,t,i,r):s=this._createModelData(e,Hl,i,r),this._onModelAdded.fire(s.model),s.model}getModels(){const e=[],t=Object.keys(this._models);for(let i=0,r=t.length;i0||c.future.length>0){for(const u of c.past)t_(u)&&u.matchesResource(e.uri)&&(s=!0,o+=u.heapSize(e.uri),u.setModel(e.uri));for(const u of c.future)t_(u)&&u.matchesResource(e.uri)&&(s=!0,o+=u.heapSize(e.uri),u.setModel(e.uri))}}const a=Gx.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK,l=this._getSHA1Computer();if(s)if(!r&&(o>a||!l.canComputeSHA1(e))){const c=i.model.getInitialUndoRedoSnapshot();c!==null&&this._undoRedoService.restoreSnapshot(c)}else this._ensureDisposedModelsHeapSize(a-o),this._undoRedoService.setElementsValidFlag(e.uri,!1,c=>t_(c)&&c.matchesResource(e.uri)),this._insertDisposedModel(new ZLt(e.uri,i.model.getInitialUndoRedoSnapshot(),Date.now(),r,o,l.computeSHA1(e),e.getVersionId(),e.getAlternativeVersionId()));else if(!r){const c=i.model.getInitialUndoRedoSnapshot();c!==null&&this._undoRedoService.restoreSnapshot(c)}delete this._models[t],i.dispose(),delete this._modelCreationOptionsByLanguageAndResource[e.getLanguageId()+e.uri],this._onModelRemoved.fire(e)}_onDidChangeLanguage(e,t){const i=t.oldLanguage,r=e.getLanguageId(),s=this.getCreationOptions(i,e.uri,e.isForSimpleWidget),o=this.getCreationOptions(r,e.uri,e.isForSimpleWidget);Gx._setModelOptionsForModel(e,o,s),this._onModelModeChanged.fire({model:e,oldLanguageId:i})}_getSHA1Computer(){return new tce}};UQ=Gx=KLt([K4(0,En),K4(1,Q3e),K4(2,sle),K4(3,Tt)],UQ);class tce{static{this.MAX_MODEL_SIZE=10*1024*1024}canComputeSHA1(e){return e.getValueLength()<=tce.MAX_MODEL_SIZE}computeSHA1(e){const t=new Bae,i=e.createSnapshot();let r;for(;r=i.read();)t.update(r);return t.digest()}}var jQ;(function(n){n[n.PRESERVE=0]="PRESERVE",n[n.LAST=1]="LAST"})(jQ||(jQ={}));const CC={Quickaccess:"workbench.contributions.quickaccess"};class XLt{constructor(){this.providers=[],this.defaultProvider=void 0}registerQuickAccessProvider(e){return e.prefix.length===0?this.defaultProvider=e:this.providers.push(e),this.providers.sort((t,i)=>i.prefix.length-t.prefix.length),Lt(()=>{this.providers.splice(this.providers.indexOf(e),1),this.defaultProvider===e&&(this.defaultProvider=void 0)})}getQuickAccessProviders(){return rf([this.defaultProvider,...this.providers])}getQuickAccessProvider(e){return e&&this.providers.find(i=>e.startsWith(i.prefix))||void 0||this.defaultProvider}}Yr.add(CC.Quickaccess,new XLt);const QLt={ctrlCmd:!1,alt:!1};var bE;(function(n){n[n.Blur=1]="Blur",n[n.Gesture=2]="Gesture",n[n.Other=3]="Other"})(bE||(bE={}));var zf;(function(n){n[n.NONE=0]="NONE",n[n.FIRST=1]="FIRST",n[n.SECOND=2]="SECOND",n[n.LAST=3]="LAST"})(zf||(zf={}));var yr;(function(n){n[n.First=1]="First",n[n.Second=2]="Second",n[n.Last=3]="Last",n[n.Next=4]="Next",n[n.Previous=5]="Previous",n[n.NextPage=6]="NextPage",n[n.PreviousPage=7]="PreviousPage",n[n.NextSeparator=8]="NextSeparator",n[n.PreviousSeparator=9]="PreviousSeparator"})(yr||(yr={}));var W8;(function(n){n[n.Title=1]="Title",n[n.Inline=2]="Inline"})(W8||(W8={}));const hh=On("quickInputService");var JLt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},kye=function(n,e){return function(t,i){e(t,i,n)}};let qQ=class extends me{constructor(e,t){super(),this.quickInputService=e,this.instantiationService=t,this.registry=Yr.as(CC.Quickaccess),this.mapProviderToDescriptor=new Map,this.lastAcceptedPickerValues=new Map,this.visibleQuickAccess=void 0}show(e="",t){this.doShowOrPick(e,!1,t)}doShowOrPick(e,t,i){const[r,s]=this.getOrInstantiateProvider(e,i?.enabledProviderPrefixes),o=this.visibleQuickAccess,a=o?.descriptor;if(o&&s&&a===s){e!==s.prefix&&!i?.preserveValue&&(o.picker.value=e),this.adjustValueSelection(o.picker,s,i);return}if(s&&!i?.preserveValue){let g;if(o&&a&&a!==s){const p=o.value.substr(a.prefix.length);p&&(g=`${s.prefix}${p}`)}if(!g){const p=r?.defaultFilterValue;p===jQ.LAST?g=this.lastAcceptedPickerValues.get(s):typeof p=="string"&&(g=`${s.prefix}${p}`)}typeof g=="string"&&(e=g)}const l=o?.picker?.valueSelection,c=o?.picker?.value,u=new ke,d=u.add(this.quickInputService.createQuickPick({useSeparators:!0}));d.value=e,this.adjustValueSelection(d,s,i),d.placeholder=i?.placeholder??s?.placeholder,d.quickNavigate=i?.quickNavigateConfiguration,d.hideInput=!!d.quickNavigate&&!o,(typeof i?.itemActivation=="number"||i?.quickNavigateConfiguration)&&(d.itemActivation=i?.itemActivation??zf.SECOND),d.contextKey=s?.contextKey,d.filterValue=g=>g.substring(s?s.prefix.length:0);let h;t&&(h=new KL,u.add(Ge.once(d.onWillAccept)(g=>{g.veto(),d.hide()}))),u.add(this.registerPickerListeners(d,r,s,e,i));const f=u.add(new Kr);if(r&&u.add(r.provide(d,f.token,i?.providerOptions)),Ge.once(d.onDidHide)(()=>{d.selectedItems.length===0&&f.cancel(),u.dispose(),h?.complete(d.selectedItems.slice(0))}),d.show(),l&&c===e&&(d.valueSelection=l),t)return h?.p}adjustValueSelection(e,t,i){let r;i?.preserveValue?r=[e.value.length,e.value.length]:r=[t?.prefix.length??0,e.value.length],e.valueSelection=r}registerPickerListeners(e,t,i,r,s){const o=new ke,a=this.visibleQuickAccess={picker:e,descriptor:i,value:r};return o.add(Lt(()=>{a===this.visibleQuickAccess&&(this.visibleQuickAccess=void 0)})),o.add(e.onDidChangeValue(l=>{const[c]=this.getOrInstantiateProvider(l,s?.enabledProviderPrefixes);c!==t?this.show(l,{enabledProviderPrefixes:s?.enabledProviderPrefixes,preserveValue:!0,providerOptions:s?.providerOptions}):a.value=l})),i&&o.add(e.onDidAccept(()=>{this.lastAcceptedPickerValues.set(i,e.value)})),o}getOrInstantiateProvider(e,t){const i=this.registry.getQuickAccessProvider(e);if(!i||t&&!t?.includes(i.prefix))return[void 0,void 0];let r=this.mapProviderToDescriptor.get(i);return r||(r=this.instantiationService.createInstance(i.ctor),this.mapProviderToDescriptor.set(i,r)),[r,i]}};qQ=JLt([kye(0,hh),kye(1,Tt)],qQ);class o2 extends ud{constructor(e){super(),this._onChange=this._register(new fe),this.onChange=this._onChange.event,this._onKeyDown=this._register(new fe),this.onKeyDown=this._onKeyDown.event,this._opts=e,this._checked=this._opts.isChecked;const t=["monaco-custom-toggle"];this._opts.icon&&(this._icon=this._opts.icon,t.push(...zt.asClassNameArray(this._icon))),this._opts.actionClassName&&t.push(...this._opts.actionClassName.split(" ")),this._checked&&t.push("checked"),this.domNode=document.createElement("div"),this._hover=this._register(Bg().setupManagedHover(e.hoverDelegate??Yl("mouse"),this.domNode,this._opts.title)),this.domNode.classList.add(...t),this._opts.notFocusable||(this.domNode.tabIndex=0),this.domNode.setAttribute("role","checkbox"),this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.setAttribute("aria-label",this._opts.title),this.applyStyles(),this.onclick(this.domNode,i=>{this.enabled&&(this.checked=!this._checked,this._onChange.fire(!1),i.preventDefault())}),this._register(this.ignoreGesture(this.domNode)),this.onkeydown(this.domNode,i=>{if(i.keyCode===10||i.keyCode===3){this.checked=!this._checked,this._onChange.fire(!0),i.preventDefault(),i.stopPropagation();return}this._onKeyDown.fire(i)})}get enabled(){return this.domNode.getAttribute("aria-disabled")!=="true"}focus(){this.domNode.focus()}get checked(){return this._checked}set checked(e){this._checked=e,this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked),this.applyStyles()}width(){return 22}applyStyles(){this.domNode&&(this.domNode.style.borderColor=this._checked&&this._opts.inputActiveOptionBorder||"",this.domNode.style.color=this._checked&&this._opts.inputActiveOptionForeground||"inherit",this.domNode.style.backgroundColor=this._checked&&this._opts.inputActiveOptionBackground||"")}enable(){this.domNode.setAttribute("aria-disabled",String(!1))}disable(){this.domNode.setAttribute("aria-disabled",String(!0))}}var e2t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};class r6e{constructor(e){this.nodes=e}toString(){return this.nodes.map(e=>typeof e=="string"?e:e.label).join("")}}e2t([Ds],r6e.prototype,"toString",null);const t2t=/\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;function n2t(n){const e=[];let t=0,i;for(;i=t2t.exec(n);){i.index-t>0&&e.push(n.substring(t,i.index));const[,r,s,,o]=i;o?e.push({label:r,href:s,title:o}):e.push({label:r,href:s}),t=i.index+i[0].length}return t{E0t(f)&&Hn.stop(f,!0),t.callback(s.href)},c=t.disposables.add(new $n(a,je.CLICK)).event,u=t.disposables.add(new $n(a,je.KEY_DOWN)).event,d=Ge.chain(u,f=>f.filter(g=>{const p=new or(g);return p.equals(10)||p.equals(3)}));t.disposables.add(Fr.addTarget(a));const h=t.disposables.add(new $n(a,gr.Tap)).event;Ge.any(c,h,d)(l,null,t.disposables),e.appendChild(a)}}var o2t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Eye=function(n,e){return function(t,i){e(t,i,n)}};const s6e="inQuickInput",a2t=new et(s6e,!1,w("inQuickInput","Whether keyboard focus is inside the quick input control")),l2t=Le.has(s6e),o6e="quickInputType",c2t=new et(o6e,void 0,w("quickInputType","The type of the currently visible quick input")),a6e="cursorAtEndOfQuickInputBox",u2t=new et(a6e,!1,w("cursorAtEndOfQuickInputBox","Whether the cursor in the quick input is at the end of the input box")),d2t=Le.has(a6e),KQ={iconClass:zt.asClassName(ze.quickInputBack),tooltip:w("quickInput.back","Back"),handle:-1};class DW extends me{static{this.noPromptMessage=w("inputModeEntry","Press 'Enter' to confirm your input or 'Escape' to cancel")}constructor(e){super(),this.ui=e,this._widgetUpdated=!1,this.visible=!1,this._enabled=!0,this._busy=!1,this._ignoreFocusOut=!1,this._leftButtons=[],this._rightButtons=[],this._inlineButtons=[],this.buttonsUpdated=!1,this._toggles=[],this.togglesUpdated=!1,this.noValidationMessage=DW.noPromptMessage,this._severity=Ss.Ignore,this.onDidTriggerButtonEmitter=this._register(new fe),this.onDidHideEmitter=this._register(new fe),this.onWillHideEmitter=this._register(new fe),this.onDisposeEmitter=this._register(new fe),this.visibleDisposables=this._register(new ke),this.onDidHide=this.onDidHideEmitter.event}get title(){return this._title}set title(e){this._title=e,this.update()}get description(){return this._description}set description(e){this._description=e,this.update()}get step(){return this._steps}set step(e){this._steps=e,this.update()}get totalSteps(){return this._totalSteps}set totalSteps(e){this._totalSteps=e,this.update()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}get contextKey(){return this._contextKey}set contextKey(e){this._contextKey=e,this.update()}get busy(){return this._busy}set busy(e){this._busy=e,this.update()}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(e){const t=this._ignoreFocusOut!==e&&!Sg;this._ignoreFocusOut=e&&!Sg,t&&this.update()}get titleButtons(){return this._leftButtons.length?[...this._leftButtons,this._rightButtons]:this._rightButtons}get buttons(){return[...this._leftButtons,...this._rightButtons,...this._inlineButtons]}set buttons(e){this._leftButtons=e.filter(t=>t===KQ),this._rightButtons=e.filter(t=>t!==KQ&&t.location!==W8.Inline),this._inlineButtons=e.filter(t=>t.location===W8.Inline),this.buttonsUpdated=!0,this.update()}get toggles(){return this._toggles}set toggles(e){this._toggles=e??[],this.togglesUpdated=!0,this.update()}get validationMessage(){return this._validationMessage}set validationMessage(e){this._validationMessage=e,this.update()}get severity(){return this._severity}set severity(e){this._severity=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.onDidTriggerButton(e=>{this.buttons.indexOf(e)!==-1&&this.onDidTriggerButtonEmitter.fire(e)})),this.ui.show(this),this.visible=!0,this._lastValidationMessage=void 0,this._lastSeverity=void 0,this.buttons.length&&(this.buttonsUpdated=!0),this.toggles.length&&(this.togglesUpdated=!0),this.update())}hide(){this.visible&&this.ui.hide()}didHide(e=bE.Other){this.visible=!1,this.visibleDisposables.clear(),this.onDidHideEmitter.fire({reason:e})}willHide(e=bE.Other){this.onWillHideEmitter.fire({reason:e})}update(){if(!this.visible)return;const e=this.getTitle();e&&this.ui.title.textContent!==e?this.ui.title.textContent=e:!e&&this.ui.title.innerHTML!==" "&&(this.ui.title.innerText=" ");const t=this.getDescription();if(this.ui.description1.textContent!==t&&(this.ui.description1.textContent=t),this.ui.description2.textContent!==t&&(this.ui.description2.textContent=t),this._widgetUpdated&&(this._widgetUpdated=!1,this._widget?ea(this.ui.widget,this._widget):ea(this.ui.widget)),this.busy&&!this.busyDelay&&(this.busyDelay=new hf,this.busyDelay.setIfNotSet(()=>{this.visible&&this.ui.progressBar.infinite()},800)),!this.busy&&this.busyDelay&&(this.ui.progressBar.stop(),this.busyDelay.cancel(),this.busyDelay=void 0),this.buttonsUpdated){this.buttonsUpdated=!1,this.ui.leftActionBar.clear();const r=this._leftButtons.map((a,l)=>TI(a,`id-${l}`,async()=>this.onDidTriggerButtonEmitter.fire(a)));this.ui.leftActionBar.push(r,{icon:!0,label:!1}),this.ui.rightActionBar.clear();const s=this._rightButtons.map((a,l)=>TI(a,`id-${l}`,async()=>this.onDidTriggerButtonEmitter.fire(a)));this.ui.rightActionBar.push(s,{icon:!0,label:!1}),this.ui.inlineActionBar.clear();const o=this._inlineButtons.map((a,l)=>TI(a,`id-${l}`,async()=>this.onDidTriggerButtonEmitter.fire(a)));this.ui.inlineActionBar.push(o,{icon:!0,label:!1})}if(this.togglesUpdated){this.togglesUpdated=!1;const r=this.toggles?.filter(s=>s instanceof o2)??[];this.ui.inputBox.toggles=r}this.ui.ignoreFocusOut=this.ignoreFocusOut,this.ui.setEnabled(this.enabled),this.ui.setContextKey(this.contextKey);const i=this.validationMessage||this.noValidationMessage;this._lastValidationMessage!==i&&(this._lastValidationMessage=i,ea(this.ui.message),s2t(i,this.ui.message,{callback:r=>{this.ui.linkOpenerDelegate(r)},disposables:this.visibleDisposables})),this._lastSeverity!==this.severity&&(this._lastSeverity=this.severity,this.showMessageDecoration(this.severity))}getTitle(){return this.title&&this.step?`${this.title} (${this.getSteps()})`:this.title?this.title:this.step?this.getSteps():""}getDescription(){return this.description||""}getSteps(){return this.step&&this.totalSteps?w("quickInput.steps","{0}/{1}",this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==Ss.Ignore){const t=this.ui.inputBox.stylesForType(e);this.ui.message.style.color=t.foreground?`${t.foreground}`:"",this.ui.message.style.backgroundColor=t.background?`${t.background}`:"",this.ui.message.style.border=t.border?`1px solid ${t.border}`:"",this.ui.message.style.marginBottom="-2px"}else this.ui.message.style.color="",this.ui.message.style.backgroundColor="",this.ui.message.style.border="",this.ui.message.style.marginBottom=""}dispose(){this.hide(),this.onDisposeEmitter.fire(),super.dispose()}}class H8 extends DW{constructor(){super(...arguments),this._value="",this.onDidChangeValueEmitter=this._register(new fe),this.onWillAcceptEmitter=this._register(new fe),this.onDidAcceptEmitter=this._register(new fe),this.onDidCustomEmitter=this._register(new fe),this._items=[],this.itemsUpdated=!1,this._canSelectMany=!1,this._canAcceptInBackground=!1,this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._matchOnLabelMode="fuzzy",this._sortByLabel=!0,this._keepScrollPosition=!1,this._itemActivation=zf.FIRST,this._activeItems=[],this.activeItemsUpdated=!1,this.activeItemsToConfirm=[],this.onDidChangeActiveEmitter=this._register(new fe),this._selectedItems=[],this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=[],this.onDidChangeSelectionEmitter=this._register(new fe),this.onDidTriggerItemButtonEmitter=this._register(new fe),this.onDidTriggerSeparatorButtonEmitter=this._register(new fe),this.valueSelectionUpdated=!0,this._ok="default",this._customButton=!1,this._focusEventBufferer=new UP,this.type="quickPick",this.filterValue=e=>e,this.onDidChangeValue=this.onDidChangeValueEmitter.event,this.onWillAccept=this.onWillAcceptEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event,this.onDidChangeActive=this.onDidChangeActiveEmitter.event,this.onDidChangeSelection=this.onDidChangeSelectionEmitter.event,this.onDidTriggerItemButton=this.onDidTriggerItemButtonEmitter.event,this.onDidTriggerSeparatorButton=this.onDidTriggerSeparatorButtonEmitter.event}static{this.DEFAULT_ARIA_LABEL=w("quickInputBox.ariaLabel","Type to narrow down results.")}get quickNavigate(){return this._quickNavigate}set quickNavigate(e){this._quickNavigate=e,this.update()}get value(){return this._value}set value(e){this.doSetValue(e)}doSetValue(e,t){this._value!==e&&(this._value=e,t||this.update(),this.visible&&this.ui.list.filter(this.filterValue(this._value))&&this.trySelectFirst(),this.onDidChangeValueEmitter.fire(this._value))}set ariaLabel(e){this._ariaLabel=e,this.update()}get ariaLabel(){return this._ariaLabel}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get items(){return this._items}get scrollTop(){return this.ui.list.scrollTop}set scrollTop(e){this.ui.list.scrollTop=e}set items(e){this._items=e,this.itemsUpdated=!0,this.update()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){this._canSelectMany=e,this.update()}get canAcceptInBackground(){return this._canAcceptInBackground}set canAcceptInBackground(e){this._canAcceptInBackground=e}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e,this.update()}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e,this.update()}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e,this.update()}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e,this.update()}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e,this.update()}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(e){this._keepScrollPosition=e}get itemActivation(){return this._itemActivation}set itemActivation(e){this._itemActivation=e}get activeItems(){return this._activeItems}set activeItems(e){this._activeItems=e,this.activeItemsUpdated=!0,this.update()}get selectedItems(){return this._selectedItems}set selectedItems(e){this._selectedItems=e,this.selectedItemsUpdated=!0,this.update()}get keyMods(){return this._quickNavigate?QLt:this.ui.keyMods}get valueSelection(){const e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get customButton(){return this._customButton}set customButton(e){this._customButton=e,this.update()}get customLabel(){return this._customButtonLabel}set customLabel(e){this._customButtonLabel=e,this.update()}get customHover(){return this._customButtonHover}set customHover(e){this._customButtonHover=e,this.update()}get ok(){return this._ok}set ok(e){this._ok=e,this.update()}get hideInput(){return!!this._hideInput}set hideInput(e){this._hideInput=e,this.update()}trySelectFirst(){this.canSelectMany||this.ui.list.focus(yr.First)}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{this.doSetValue(e,!0)})),this.visibleDisposables.add(this.ui.onDidAccept(()=>{this.canSelectMany?this.ui.list.getCheckedElements().length||(this._selectedItems=[],this.onDidChangeSelectionEmitter.fire(this.selectedItems)):this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(!1)})),this.visibleDisposables.add(this.ui.onDidCustom(()=>{this.onDidCustomEmitter.fire()})),this.visibleDisposables.add(this._focusEventBufferer.wrapEvent(this.ui.list.onDidChangeFocus,(e,t)=>t)(e=>{this.activeItemsUpdated||this.activeItemsToConfirm!==this._activeItems&&$r(e,this._activeItems,(t,i)=>t===i)||(this._activeItems=e,this.onDidChangeActiveEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onDidChangeSelection(({items:e,event:t})=>{if(this.canSelectMany){e.length&&this.ui.list.setSelectedElements([]);return}this.selectedItemsToConfirm!==this._selectedItems&&$r(e,this._selectedItems,(i,r)=>i===r)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e),e.length&&this.handleAccept(Hae(t)&&t.button===1))})),this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(e=>{!this.canSelectMany||!this.visible||this.selectedItemsToConfirm!==this._selectedItems&&$r(e,this._selectedItems,(t,i)=>t===i)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onButtonTriggered(e=>this.onDidTriggerItemButtonEmitter.fire(e))),this.visibleDisposables.add(this.ui.list.onSeparatorButtonTriggered(e=>this.onDidTriggerSeparatorButtonEmitter.fire(e))),this.visibleDisposables.add(this.registerQuickNavigation()),this.valueSelectionUpdated=!0),super.show()}handleAccept(e){let t=!1;this.onWillAcceptEmitter.fire({veto:()=>t=!0}),t||this.onDidAcceptEmitter.fire({inBackground:e})}registerQuickNavigation(){return Ce(this.ui.container,je.KEY_UP,e=>{if(this.canSelectMany||!this._quickNavigate)return;const t=new or(e),i=t.keyCode;this._quickNavigate.keybindings.some(o=>{const a=o.getChords();return a.length>1?!1:a[0].shiftKey&&i===4?!(t.ctrlKey||t.altKey||t.metaKey):!!(a[0].altKey&&i===6||a[0].ctrlKey&&i===5||a[0].metaKey&&i===57)})&&(this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!1)),this._quickNavigate=void 0)})}update(){if(!this.visible)return;const e=this.keepScrollPosition?this.scrollTop:0,t=!!this.description,i={title:!!this.title||!!this.step||!!this.titleButtons.length,description:t,checkAll:this.canSelectMany&&!this._hideCheckAll,checkBox:this.canSelectMany,inputBox:!this._hideInput,progressBar:!this._hideInput||t,visibleCount:!0,count:this.canSelectMany&&!this._hideCountBadge,ok:this.ok==="default"?this.canSelectMany:this.ok,list:!0,message:!!this.validationMessage,customButton:this.customButton};this.ui.setVisibilities(i),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||"");let r=this.ariaLabel;!r&&i.inputBox&&(r=this.placeholder||H8.DEFAULT_ARIA_LABEL,this.title&&(r+=` - ${this.title}`)),this.ui.list.ariaLabel!==r&&(this.ui.list.ariaLabel=r??null),this.ui.list.matchOnDescription=this.matchOnDescription,this.ui.list.matchOnDetail=this.matchOnDetail,this.ui.list.matchOnLabel=this.matchOnLabel,this.ui.list.matchOnLabelMode=this.matchOnLabelMode,this.ui.list.sortByLabel=this.sortByLabel,this.itemsUpdated&&(this.itemsUpdated=!1,this._focusEventBufferer.bufferEvents(()=>{switch(this.ui.list.setElements(this.items),this.ui.list.shouldLoop=!this.canSelectMany,this.ui.list.filter(this.filterValue(this.ui.inputBox.value)),this._itemActivation){case zf.NONE:this._itemActivation=zf.FIRST;break;case zf.SECOND:this.ui.list.focus(yr.Second),this._itemActivation=zf.FIRST;break;case zf.LAST:this.ui.list.focus(yr.Last),this._itemActivation=zf.FIRST;break;default:this.trySelectFirst();break}})),this.ui.container.classList.contains("show-checkboxes")!==!!this.canSelectMany&&(this.canSelectMany?this.ui.list.clearFocus():this.trySelectFirst()),this.activeItemsUpdated&&(this.activeItemsUpdated=!1,this.activeItemsToConfirm=this._activeItems,this.ui.list.setFocusedElements(this.activeItems),this.activeItemsToConfirm===this._activeItems&&(this.activeItemsToConfirm=null)),this.selectedItemsUpdated&&(this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=this._selectedItems,this.canSelectMany?this.ui.list.setCheckedElements(this.selectedItems):this.ui.list.setSelectedElements(this.selectedItems),this.selectedItemsToConfirm===this._selectedItems&&(this.selectedItemsToConfirm=null)),this.ui.customButton.label=this.customLabel||"",this.ui.customButton.element.title=this.customHover||"",i.inputBox||(this.ui.list.domFocus(),this.canSelectMany&&this.ui.list.focus(yr.First)),this.keepScrollPosition&&(this.scrollTop=e)}focus(e){this.ui.list.focus(e),this.canSelectMany&&this.ui.list.domFocus()}accept(e){e&&!this._canAcceptInBackground||this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(e??!1))}}let h2t=class extends DW{constructor(){super(...arguments),this._value="",this.valueSelectionUpdated=!0,this._password=!1,this.onDidValueChangeEmitter=this._register(new fe),this.onDidAcceptEmitter=this._register(new fe),this.type="inputBox",this.onDidChangeValue=this.onDidValueChangeEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event}get value(){return this._value}set value(e){this._value=e||"",this.update()}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get password(){return this._password}set password(e){this._password=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{e!==this.value&&(this._value=e,this.onDidValueChangeEmitter.fire(e))})),this.visibleDisposables.add(this.ui.onDidAccept(()=>this.onDidAcceptEmitter.fire())),this.valueSelectionUpdated=!0),super.show()}update(){if(!this.visible)return;this.ui.container.classList.remove("hidden-input");const e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description||!!this.step,inputBox:!0,message:!0,progressBar:!0};this.ui.setVisibilities(e),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||""),this.ui.inputBox.password!==this.password&&(this.ui.inputBox.password=this.password)}},GQ=class extends uE{constructor(e,t){super("element",!1,i=>this.getOverrideOptions(i),e,t)}getOverrideOptions(e){const t=(Eo(e.content)?e.content.textContent??"":typeof e.content=="string"?e.content:e.content.value).includes(` +`);return{persistence:{hideOnKeyDown:!1},appearance:{showHoverHint:t,skipFadeInAnimation:!0}}}};GQ=o2t([Eye(0,En),Eye(1,um)],GQ);Te.white.toString(),Te.white.toString();let V8=class extends me{get onDidClick(){return this._onDidClick.event}constructor(e,t){super(),this._label="",this._onDidClick=this._register(new fe),this._onDidEscape=this._register(new fe),this.options=t,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),this._element.classList.toggle("secondary",!!t.secondary);const i=t.secondary?t.buttonSecondaryBackground:t.buttonBackground,r=t.secondary?t.buttonSecondaryForeground:t.buttonForeground;this._element.style.color=r||"",this._element.style.backgroundColor=i||"",t.supportShortLabel&&(this._labelShortElement=document.createElement("div"),this._labelShortElement.classList.add("monaco-button-label-short"),this._element.appendChild(this._labelShortElement),this._labelElement=document.createElement("div"),this._labelElement.classList.add("monaco-button-label"),this._element.appendChild(this._labelElement),this._element.classList.add("monaco-text-button-with-short-label")),typeof t.title=="string"&&this.setTitle(t.title),typeof t.ariaLabel=="string"&&this._element.setAttribute("aria-label",t.ariaLabel),e.appendChild(this._element),this._register(Fr.addTarget(this._element)),[je.CLICK,gr.Tap].forEach(s=>{this._register(Ce(this._element,s,o=>{if(!this.enabled){Hn.stop(o);return}this._onDidClick.fire(o)}))}),this._register(Ce(this._element,je.KEY_DOWN,s=>{const o=new or(s);let a=!1;this.enabled&&(o.equals(3)||o.equals(10))?(this._onDidClick.fire(s),a=!0):o.equals(9)&&(this._onDidEscape.fire(s),this._element.blur(),a=!0),a&&Hn.stop(o,!0)})),this._register(Ce(this._element,je.MOUSE_OVER,s=>{this._element.classList.contains("disabled")||this.updateBackground(!0)})),this._register(Ce(this._element,je.MOUSE_OUT,s=>{this.updateBackground(!1)})),this.focusTracker=this._register(Eg(this._element)),this._register(this.focusTracker.onDidFocus(()=>{this.enabled&&this.updateBackground(!0)})),this._register(this.focusTracker.onDidBlur(()=>{this.enabled&&this.updateBackground(!1)}))}dispose(){super.dispose(),this._element.remove()}getContentElements(e){const t=[];for(let i of ob(e))if(typeof i=="string"){if(i=i.trim(),i==="")continue;const r=document.createElement("span");r.textContent=i,t.push(r)}else t.push(i);return t}updateBackground(e){let t;this.options.secondary?t=e?this.options.buttonSecondaryHoverBackground:this.options.buttonSecondaryBackground:t=e?this.options.buttonHoverBackground:this.options.buttonBackground,t&&(this._element.style.backgroundColor=t)}get element(){return this._element}set label(e){if(this._label===e||bg(this._label)&&bg(e)&&jCt(this._label,e))return;this._element.classList.add("monaco-text-button");const t=this.options.supportShortLabel?this._labelElement:this._element;if(bg(e)){const r=vW(e,{inline:!0});r.dispose();const s=r.element.querySelector("p")?.innerHTML;if(s){const o=r3e(s,{ADD_TAGS:["b","i","u","code","span"],ALLOWED_ATTR:["class"],RETURN_TRUSTED_TYPE:!0});t.innerHTML=o}else ea(t)}else this.options.supportIcons?ea(t,...this.getContentElements(e)):t.textContent=e;let i="";typeof this.options.title=="string"?i=this.options.title:this.options.title&&(i=nxt(e)),this.setTitle(i),typeof this.options.ariaLabel=="string"?this._element.setAttribute("aria-label",this.options.ariaLabel):this.options.ariaLabel&&this._element.setAttribute("aria-label",i),this._label=e}get label(){return this._label}set icon(e){this._element.classList.add(...zt.asClassNameArray(e))}set enabled(e){e?(this._element.classList.remove("disabled"),this._element.setAttribute("aria-disabled",String(!1)),this._element.tabIndex=0):(this._element.classList.add("disabled"),this._element.setAttribute("aria-disabled",String(!0)))}get enabled(){return!this._element.classList.contains("disabled")}setTitle(e){!this._hover&&e!==""?this._hover=this._register(Bg().setupManagedHover(this.options.hoverDelegate??Yl("mouse"),this._element,e)):this._hover&&this._hover.update(e)}};class YQ{constructor(e,t,i){this.options=t,this.styles=i,this.count=0,this.element=Ne(e,qe(".monaco-count-badge")),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0)}setCount(e){this.count=e,this.render()}setTitleFormat(e){this.titleFormat=e,this.render()}render(){this.element.textContent=Lw(this.countFormat,this.count),this.element.title=Lw(this.titleFormat,this.count),this.element.style.backgroundColor=this.styles.badgeBackground??"",this.element.style.color=this.styles.badgeForeground??"",this.styles.badgeBorder&&(this.element.style.border=`1px solid ${this.styles.badgeBorder}`)}}const Lye="done",Tye="active",fq="infinite",gq="infinite-long-running",Dye="discrete";class nce extends me{static{this.LONG_RUNNING_INFINITE_THRESHOLD=1e4}constructor(e,t){super(),this.progressSignal=this._register(new To),this.workedVal=0,this.showDelayedScheduler=this._register(new Ui(()=>Qc(this.element),0)),this.longRunningScheduler=this._register(new Ui(()=>this.infiniteLongRunning(),nce.LONG_RUNNING_INFINITE_THRESHOLD)),this.create(e,t)}create(e,t){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),e.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.bit.style.backgroundColor=t?.progressBarBackground||"#0E70C0",this.element.appendChild(this.bit)}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(Tye,fq,gq,Dye),this.workedVal=0,this.totalWork=void 0,this.longRunningScheduler.cancel(),this.progressSignal.clear()}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add(Lye),this.element.classList.contains(fq)?(this.bit.style.opacity="0",e?setTimeout(()=>this.off(),200):this.off()):(this.bit.style.width="inherit",e?setTimeout(()=>this.off(),200):this.off()),this}infinite(){return this.bit.style.width="2%",this.bit.style.opacity="1",this.element.classList.remove(Dye,Lye,gq),this.element.classList.add(Tye,fq),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add(gq)}getContainer(){return this.element}}const f2t=w("caseDescription","Match Case"),g2t=w("wordsDescription","Match Whole Word"),p2t=w("regexDescription","Use Regular Expression");class l6e extends o2{constructor(e){super({icon:ze.caseSensitive,title:f2t+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Yl("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class c6e extends o2{constructor(e){super({icon:ze.wholeWord,title:g2t+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Yl("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class u6e extends o2{constructor(e){super({icon:ze.regex,title:p2t+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Yl("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class m2t{constructor(e,t=0,i=e.length,r=t-1){this.items=e,this.start=t,this.end=i,this.index=r}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}next(){return this.index=Math.min(this.index+1,this.end),this.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}}class _2t{constructor(e=[],t=10){this._initialize(e),this._limit=t,this._onChange()}getHistory(){return this._elements}add(e){this._history.delete(e),this._history.add(e),this._onChange()}next(){return this._navigator.next()}previous(){return this._currentPosition()!==0?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}isLast(){return this._currentPosition()>=this._elements.length-1}isNowhere(){return this._navigator.current()===null}has(e){return this._history.has(e)}_onChange(){this._reduceToLimit();const e=this._elements;this._navigator=new m2t(e,0,e.length,e.length)}_reduceToLimit(){const e=this._elements;e.length>this._limit&&this._initialize(e.slice(e.length-this._limit))}_currentPosition(){const e=this._navigator.current();return e?this._elements.indexOf(e):-1}_initialize(e){this._history=new Set;for(const t of e)this._history.add(t)}get _elements(){const e=[];return this._history.forEach(t=>e.push(t)),e}}const MT=qe;class v2t extends ud{constructor(e,t,i){super(),this.state="idle",this.maxHeight=Number.POSITIVE_INFINITY,this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._onDidHeightChange=this._register(new fe),this.onDidHeightChange=this._onDidHeightChange.event,this.contextViewProvider=t,this.options=i,this.message=null,this.placeholder=this.options.placeholder||"",this.tooltip=this.options.tooltip??(this.placeholder||""),this.ariaLabel=this.options.ariaLabel||"",this.options.validationOptions&&(this.validation=this.options.validationOptions.validation),this.element=Ne(e,MT(".monaco-inputbox.idle"));const r=this.options.flexibleHeight?"textarea":"input",s=Ne(this.element,MT(".ibwrapper"));if(this.input=Ne(s,MT(r+".input.empty")),this.input.setAttribute("autocorrect","off"),this.input.setAttribute("autocapitalize","off"),this.input.setAttribute("spellcheck","false"),this.onfocus(this.input,()=>this.element.classList.add("synthetic-focus")),this.onblur(this.input,()=>this.element.classList.remove("synthetic-focus")),this.options.flexibleHeight){this.maxHeight=typeof this.options.flexibleMaxHeight=="number"?this.options.flexibleMaxHeight:Number.POSITIVE_INFINITY,this.mirror=Ne(s,MT("div.mirror")),this.mirror.innerText=" ",this.scrollableElement=new O5e(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),Ne(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll(l=>this.input.scrollTop=l.scrollTop));const o=this._register(new $n(e.ownerDocument,"selectionchange")),a=Ge.filter(o.event,()=>e.ownerDocument.getSelection()?.anchorNode===s);this._register(a(this.updateScrollDimensions,this)),this._register(this.onDidHeightChange(this.updateScrollDimensions,this))}else this.input.type=this.options.type||"text",this.input.setAttribute("wrap","off");this.ariaLabel&&this.input.setAttribute("aria-label",this.ariaLabel),this.placeholder&&!this.options.showPlaceholderOnFocus&&this.setPlaceHolder(this.placeholder),this.tooltip&&this.setTooltip(this.tooltip),this.oninput(this.input,()=>this.onValueChange()),this.onblur(this.input,()=>this.onBlur()),this.onfocus(this.input,()=>this.onFocus()),this._register(this.ignoreGesture(this.input)),setTimeout(()=>this.updateMirror(),0),this.options.actions&&(this.actionbar=this._register(new ed(this.element)),this.actionbar.push(this.options.actions,{icon:!0,label:!1})),this.applyStyles()}onBlur(){this._hideMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder","")}onFocus(){this._showMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder",this.placeholder||"")}setPlaceHolder(e){this.placeholder=e,this.input.setAttribute("placeholder",e)}setTooltip(e){this.tooltip=e,this.hover?this.hover.update(e):this.hover=this._register(Bg().setupManagedHover(Yl("mouse"),this.input,e))}get inputElement(){return this.input}get value(){return this.input.value}set value(e){this.input.value!==e&&(this.input.value=e,this.onValueChange())}get height(){return typeof this.cachedHeight=="number"?this.cachedHeight:h_(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return H$(this.input)}select(e=null){this.input.select(),e&&(this.input.setSelectionRange(e.start,e.end),e.end===this.input.value.length&&(this.input.scrollLeft=this.input.scrollWidth))}isSelectionAtEnd(){return this.input.selectionEnd===this.input.value.length&&this.input.selectionStart===this.input.selectionEnd}getSelection(){const e=this.input.selectionStart;if(e===null)return null;const t=this.input.selectionEnd??e;return{start:e,end:t}}enable(){this.input.removeAttribute("disabled")}disable(){this.blur(),this.input.disabled=!0,this._hideMessage()}set paddingRight(e){this.input.style.width=`calc(100% - ${e}px)`,this.mirror&&(this.mirror.style.paddingRight=e+"px")}updateScrollDimensions(){if(typeof this.cachedContentHeight!="number"||typeof this.cachedHeight!="number"||!this.scrollableElement)return;const e=this.cachedContentHeight,t=this.cachedHeight,i=this.input.scrollTop;this.scrollableElement.setScrollDimensions({scrollHeight:e,height:t}),this.scrollableElement.setScrollPosition({scrollTop:i})}showMessage(e,t){if(this.state==="open"&&ru(this.message,e))return;this.message=e,this.element.classList.remove("idle"),this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add(this.classForType(e.type));const i=this.stylesForType(this.message.type);this.element.style.border=`1px solid ${A_(i.border,"transparent")}`,this.message.content&&(this.hasFocus()||t)&&this._showMessage()}hideMessage(){this.message=null,this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add("idle"),this._hideMessage(),this.applyStyles()}validate(){let e=null;return this.validation&&(e=this.validation(this.value),e?(this.inputElement.setAttribute("aria-invalid","true"),this.showMessage(e)):this.inputElement.hasAttribute("aria-invalid")&&(this.inputElement.removeAttribute("aria-invalid"),this.hideMessage())),e?.type}stylesForType(e){const t=this.options.inputBoxStyles;switch(e){case 1:return{border:t.inputValidationInfoBorder,background:t.inputValidationInfoBackground,foreground:t.inputValidationInfoForeground};case 2:return{border:t.inputValidationWarningBorder,background:t.inputValidationWarningBackground,foreground:t.inputValidationWarningForeground};default:return{border:t.inputValidationErrorBorder,background:t.inputValidationErrorBackground,foreground:t.inputValidationErrorForeground}}}classForType(e){switch(e){case 1:return"info";case 2:return"warning";default:return"error"}}_showMessage(){if(!this.contextViewProvider||!this.message)return;let e;const t=()=>e.style.width=qc(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:r=>{if(!this.message)return null;e=Ne(r,MT(".monaco-inputbox-container")),t();const s={inline:!0,className:"monaco-inputbox-message"},o=this.message.formatContent?cCt(this.message.content,s):lCt(this.message.content,s);o.classList.add(this.classForType(this.message.type));const a=this.stylesForType(this.message.type);return o.style.backgroundColor=a.background??"",o.style.color=a.foreground??"",o.style.border=a.border?`1px solid ${a.border}`:"",Ne(e,o),null},onHide:()=>{this.state="closed"},layout:t});let i;this.message.type===3?i=w("alertErrorMessage","Error: {0}",this.message.content):this.message.type===2?i=w("alertWarningMessage","Warning: {0}",this.message.content):i=w("alertInfoMessage","Info: {0}",this.message.content),ql(i),this.state="open"}_hideMessage(){this.contextViewProvider&&(this.state==="open"&&this.contextViewProvider.hideContextView(),this.state="idle")}onValueChange(){this._onDidChange.fire(this.value),this.validate(),this.updateMirror(),this.input.classList.toggle("empty",!this.value),this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout()}updateMirror(){if(!this.mirror)return;const e=this.value,i=e.charCodeAt(e.length-1)===10?" ":"";(e+i).replace(/\u000c/g,"")?this.mirror.textContent=e+i:this.mirror.innerText=" ",this.layout()}applyStyles(){const e=this.options.inputBoxStyles,t=e.inputBackground??"",i=e.inputForeground??"",r=e.inputBorder??"";this.element.style.backgroundColor=t,this.element.style.color=i,this.input.style.backgroundColor="inherit",this.input.style.color=i,this.element.style.border=`1px solid ${A_(r,"transparent")}`}layout(){if(!this.mirror)return;const e=this.cachedContentHeight;this.cachedContentHeight=h_(this.mirror),e!==this.cachedContentHeight&&(this.cachedHeight=Math.min(this.cachedContentHeight,this.maxHeight),this.input.style.height=this.cachedHeight+"px",this._onDidHeightChange.fire(this.cachedContentHeight))}insertAtCursor(e){const t=this.inputElement,i=t.selectionStart,r=t.selectionEnd,s=t.value;i!==null&&r!==null&&(this.value=s.substr(0,i)+e+s.substr(r),t.setSelectionRange(i+1,i+1),this.layout())}dispose(){this._hideMessage(),this.message=null,this.actionbar?.dispose(),super.dispose()}}class d6e extends v2t{constructor(e,t,i){const r=w({key:"history.inputbox.hint.suffix.noparens",comment:['Text is the suffix of an input field placeholder coming after the action the input field performs, this will be used when the input field ends in a closing parenthesis ")", for example "Filter (e.g. text, !exclude)". The character inserted into the final string is ⇅ to represent the up and down arrow keys.']}," or {0} for history","⇅"),s=w({key:"history.inputbox.hint.suffix.inparens",comment:['Text is the suffix of an input field placeholder coming after the action the input field performs, this will be used when the input field does NOT end in a closing parenthesis (eg. "Find"). The character inserted into the final string is ⇅ to represent the up and down arrow keys.']}," ({0} for history)","⇅");super(e,t,i),this._onDidFocus=this._register(new fe),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new fe),this.onDidBlur=this._onDidBlur.event,this.history=new _2t(i.history,100);const o=()=>{if(i.showHistoryHint&&i.showHistoryHint()&&!this.placeholder.endsWith(r)&&!this.placeholder.endsWith(s)&&this.history.getHistory().length){const a=this.placeholder.endsWith(")")?r:s,l=this.placeholder+a;i.showPlaceholderOnFocus&&!H$(this.input)?this.placeholder=l:this.setPlaceHolder(l)}};this.observer=new MutationObserver((a,l)=>{a.forEach(c=>{c.target.textContent||o()})}),this.observer.observe(this.input,{attributeFilter:["class"]}),this.onfocus(this.input,()=>o()),this.onblur(this.input,()=>{const a=l=>{if(this.placeholder.endsWith(l)){const c=this.placeholder.slice(0,this.placeholder.length-l.length);return i.showPlaceholderOnFocus?this.placeholder=c:this.setPlaceHolder(c),!0}else return!1};a(s)||a(r)})}dispose(){super.dispose(),this.observer&&(this.observer.disconnect(),this.observer=void 0)}addToHistory(e){this.value&&(e||this.value!==this.getCurrentValue())&&this.history.add(this.value)}isAtLastInHistory(){return this.history.isLast()}isNowhereInHistory(){return this.history.isNowhere()}showNextValue(){this.history.has(this.value)||this.addToHistory();let e=this.getNextValue();e&&(e=e===this.value?this.getNextValue():e),this.value=e??"",Qp(this.value?this.value:w("clearedInput","Cleared Input"))}showPreviousValue(){this.history.has(this.value)||this.addToHistory();let e=this.getPreviousValue();e&&(e=e===this.value?this.getPreviousValue():e),e&&(this.value=e,Qp(this.value))}setPlaceHolder(e){super.setPlaceHolder(e),this.setTooltip(e)}onBlur(){super.onBlur(),this._onDidBlur.fire()}onFocus(){super.onFocus(),this._onDidFocus.fire()}getCurrentValue(){let e=this.history.current();return e||(e=this.history.last(),this.history.next()),e}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}}const b2t=w("defaultLabel","input");class h6e extends ud{constructor(e,t,i){super(),this.fixFocusOnOptionClickEnabled=!0,this.imeSessionInProgress=!1,this.additionalTogglesDisposables=this._register(new To),this.additionalToggles=[],this._onDidOptionChange=this._register(new fe),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new fe),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new fe),this.onMouseDown=this._onMouseDown.event,this._onInput=this._register(new fe),this._onKeyUp=this._register(new fe),this._onCaseSensitiveKeyDown=this._register(new fe),this.onCaseSensitiveKeyDown=this._onCaseSensitiveKeyDown.event,this._onRegexKeyDown=this._register(new fe),this.onRegexKeyDown=this._onRegexKeyDown.event,this._lastHighlightFindOptions=0,this.placeholder=i.placeholder||"",this.validation=i.validation,this.label=i.label||b2t,this.showCommonFindToggles=!!i.showCommonFindToggles;const r=i.appendCaseSensitiveLabel||"",s=i.appendWholeWordsLabel||"",o=i.appendRegexLabel||"",a=i.history||[],l=!!i.flexibleHeight,c=!!i.flexibleWidth,u=i.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new d6e(this.domNode,t,{placeholder:this.placeholder||"",ariaLabel:this.label||"",validationOptions:{validation:this.validation},history:a,showHistoryHint:i.showHistoryHint,flexibleHeight:l,flexibleWidth:c,flexibleMaxHeight:u,inputBoxStyles:i.inputBoxStyles}));const d=this._register(_E());if(this.showCommonFindToggles){this.regex=this._register(new u6e({appendTitle:o,isChecked:!1,hoverDelegate:d,...i.toggleStyles})),this._register(this.regex.onChange(f=>{this._onDidOptionChange.fire(f),!f&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.regex.onKeyDown(f=>{this._onRegexKeyDown.fire(f)})),this.wholeWords=this._register(new c6e({appendTitle:s,isChecked:!1,hoverDelegate:d,...i.toggleStyles})),this._register(this.wholeWords.onChange(f=>{this._onDidOptionChange.fire(f),!f&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this.caseSensitive=this._register(new l6e({appendTitle:r,isChecked:!1,hoverDelegate:d,...i.toggleStyles})),this._register(this.caseSensitive.onChange(f=>{this._onDidOptionChange.fire(f),!f&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.caseSensitive.onKeyDown(f=>{this._onCaseSensitiveKeyDown.fire(f)}));const h=[this.caseSensitive.domNode,this.wholeWords.domNode,this.regex.domNode];this.onkeydown(this.domNode,f=>{if(f.equals(15)||f.equals(17)||f.equals(9)){const g=h.indexOf(this.domNode.ownerDocument.activeElement);if(g>=0){let p=-1;f.equals(17)?p=(g+1)%h.length:f.equals(15)&&(g===0?p=h.length-1:p=g-1),f.equals(9)?(h[g].blur(),this.inputBox.focus()):p>=0&&h[p].focus(),Hn.stop(f,!0)}}})}this.controls=document.createElement("div"),this.controls.className="controls",this.controls.style.display=this.showCommonFindToggles?"":"none",this.caseSensitive&&this.controls.append(this.caseSensitive.domNode),this.wholeWords&&this.controls.appendChild(this.wholeWords.domNode),this.regex&&this.controls.appendChild(this.regex.domNode),this.setAdditionalToggles(i?.additionalToggles),this.controls&&this.domNode.appendChild(this.controls),e?.appendChild(this.domNode),this._register(Ce(this.inputBox.inputElement,"compositionstart",h=>{this.imeSessionInProgress=!0})),this._register(Ce(this.inputBox.inputElement,"compositionend",h=>{this.imeSessionInProgress=!1,this._onInput.fire()})),this.onkeydown(this.inputBox.inputElement,h=>this._onKeyDown.fire(h)),this.onkeyup(this.inputBox.inputElement,h=>this._onKeyUp.fire(h)),this.oninput(this.inputBox.inputElement,h=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,h=>this._onMouseDown.fire(h))}get onDidChange(){return this.inputBox.onDidChange}layout(e){this.inputBox.layout(),this.updateInputBoxPadding(e.collapsedFindWidget)}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.regex?.enable(),this.wholeWords?.enable(),this.caseSensitive?.enable();for(const e of this.additionalToggles)e.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.regex?.disable(),this.wholeWords?.disable(),this.caseSensitive?.disable();for(const e of this.additionalToggles)e.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}setAdditionalToggles(e){for(const t of this.additionalToggles)t.domNode.remove();this.additionalToggles=[],this.additionalTogglesDisposables.value=new ke;for(const t of e??[])this.additionalTogglesDisposables.value.add(t),this.controls.appendChild(t.domNode),this.additionalTogglesDisposables.value.add(t.onChange(i=>{this._onDidOptionChange.fire(i),!i&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus()})),this.additionalToggles.push(t);this.additionalToggles.length>0&&(this.controls.style.display=""),this.updateInputBoxPadding()}updateInputBoxPadding(e=!1){e?this.inputBox.paddingRight=0:this.inputBox.paddingRight=(this.caseSensitive?.width()??0)+(this.wholeWords?.width()??0)+(this.regex?.width()??0)+this.additionalToggles.reduce((t,i)=>t+i.width(),0)}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getCaseSensitive(){return this.caseSensitive?.checked??!1}setCaseSensitive(e){this.caseSensitive&&(this.caseSensitive.checked=e)}getWholeWords(){return this.wholeWords?.checked??!1}setWholeWords(e){this.wholeWords&&(this.wholeWords.checked=e)}getRegex(){return this.regex?.checked??!1}setRegex(e){this.regex&&(this.regex.checked=e,this.validate())}focusOnCaseSensitive(){this.caseSensitive?.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox.validate()}showMessage(e){this.inputBox.showMessage(e)}clearMessage(){this.inputBox.hideMessage()}}const y2t=qe;class w2t extends me{constructor(e,t,i){super(),this.parent=e,this.onKeyDown=s=>Jr(this.findInput.inputBox.inputElement,je.KEY_DOWN,s),this.onDidChange=s=>this.findInput.onDidChange(s),this.container=Ne(this.parent,y2t(".quick-input-box")),this.findInput=this._register(new h6e(this.container,void 0,{label:"",inputBoxStyles:t,toggleStyles:i}));const r=this.findInput.inputBox.inputElement;r.role="combobox",r.ariaHasPopup="menu",r.ariaAutoComplete="list",r.ariaExpanded="true"}get value(){return this.findInput.getValue()}set value(e){this.findInput.setValue(e)}select(e=null){this.findInput.inputBox.select(e)}getSelection(){return this.findInput.inputBox.getSelection()}isSelectionAtEnd(){return this.findInput.inputBox.isSelectionAtEnd()}get placeholder(){return this.findInput.inputBox.inputElement.getAttribute("placeholder")||""}set placeholder(e){this.findInput.inputBox.setPlaceHolder(e)}get password(){return this.findInput.inputBox.inputElement.type==="password"}set password(e){this.findInput.inputBox.inputElement.type=e?"password":"text"}set enabled(e){this.findInput.inputBox.inputElement.toggleAttribute("readonly",!e)}set toggles(e){this.findInput.setAdditionalToggles(e)}setAttribute(e,t){this.findInput.inputBox.inputElement.setAttribute(e,t)}showDecoration(e){e===Ss.Ignore?this.findInput.clearMessage():this.findInput.showMessage({type:e===Ss.Info?1:e===Ss.Warning?2:3,content:""})}stylesForType(e){return this.findInput.inputBox.stylesForType(e===Ss.Info?1:e===Ss.Warning?2:3)}setFocus(){this.findInput.focus()}layout(){this.findInput.inputBox.layout()}}class C2t{get templateId(){return this.renderer.templateId}constructor(e,t){this.renderer=e,this.modelProvider=t}renderTemplate(e){return{data:this.renderer.renderTemplate(e),disposable:me.None}}renderElement(e,t,i,r){if(i.disposable?.dispose(),!i.data)return;const s=this.modelProvider();if(s.isResolved(e))return this.renderer.renderElement(s.get(e),e,i.data,r);const o=new Kr,a=s.resolve(e,o.token);i.disposable={dispose:()=>o.cancel()},this.renderer.renderPlaceholder(e,i.data),a.then(l=>this.renderer.renderElement(l,e,i.data,r))}disposeTemplate(e){e.disposable&&(e.disposable.dispose(),e.disposable=void 0),e.data&&(this.renderer.disposeTemplate(e.data),e.data=void 0)}}class x2t{constructor(e,t){this.modelProvider=e,this.accessibilityProvider=t}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(e){const t=this.modelProvider();return t.isResolved(e)?this.accessibilityProvider.getAriaLabel(t.get(e)):null}}function S2t(n,e){return{...e,accessibilityProvider:e.accessibilityProvider&&new x2t(n,e.accessibilityProvider)}}class k2t{constructor(e,t,i,r,s={}){const o=()=>this.model,a=r.map(l=>new C2t(l,o));this.list=new dd(e,t,i,a,S2t(o,s))}updateOptions(e){this.list.updateOptions(e)}getHTMLElement(){return this.list.getHTMLElement()}get onDidFocus(){return this.list.onDidFocus}get widget(){return this.list}get onDidDispose(){return this.list.onDidDispose}get onMouseDblClick(){return Ge.map(this.list.onMouseDblClick,({element:e,index:t,browserEvent:i})=>({element:e===void 0?void 0:this._model.get(e),index:t,browserEvent:i}))}get onPointer(){return Ge.map(this.list.onPointer,({element:e,index:t,browserEvent:i})=>({element:e===void 0?void 0:this._model.get(e),index:t,browserEvent:i}))}get onDidChangeSelection(){return Ge.map(this.list.onDidChangeSelection,({elements:e,indexes:t,browserEvent:i})=>({elements:e.map(r=>this._model.get(r)),indexes:t,browserEvent:i}))}get model(){return this._model}set model(e){this._model=e,this.list.splice(0,this.list.length,sc(e.length))}getFocus(){return this.list.getFocus()}getSelection(){return this.list.getSelection()}getSelectedElements(){return this.getSelection().map(e=>this.model.get(e))}style(e){this.list.style(e)}dispose(){this.list.dispose()}}var a2=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};const E2t=!1;var z8;(function(n){n.North="north",n.South="south",n.East="east",n.West="west"})(z8||(z8={}));let L2t=4;const T2t=new fe;let D2t=300;const I2t=new fe;class ice{constructor(e){this.el=e,this.disposables=new ke}get onPointerMove(){return this.disposables.add(new $n(Ot(this.el),"mousemove")).event}get onPointerUp(){return this.disposables.add(new $n(Ot(this.el),"mouseup")).event}dispose(){this.disposables.dispose()}}a2([Ds],ice.prototype,"onPointerMove",null);a2([Ds],ice.prototype,"onPointerUp",null);class rce{get onPointerMove(){return this.disposables.add(new $n(this.el,gr.Change)).event}get onPointerUp(){return this.disposables.add(new $n(this.el,gr.End)).event}constructor(e){this.el=e,this.disposables=new ke}dispose(){this.disposables.dispose()}}a2([Ds],rce.prototype,"onPointerMove",null);a2([Ds],rce.prototype,"onPointerUp",null);class U8{get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}constructor(e){this.factory=e}dispose(){}}a2([Ds],U8.prototype,"onPointerMove",null);a2([Ds],U8.prototype,"onPointerUp",null);const Iye="pointer-events-disabled";class $a extends me{get state(){return this._state}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}set state(e){this._state!==e&&(this.el.classList.toggle("disabled",e===0),this.el.classList.toggle("minimum",e===1),this.el.classList.toggle("maximum",e===2),this._state=e,this.onDidEnablementChange.fire(e))}set orthogonalStartSash(e){if(this._orthogonalStartSash!==e){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),e){const t=i=>{this.orthogonalStartDragHandleDisposables.clear(),i!==0&&(this._orthogonalStartDragHandle=Ne(this.el,qe(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(Lt(()=>this._orthogonalStartDragHandle.remove())),this.orthogonalStartDragHandleDisposables.add(new $n(this._orthogonalStartDragHandle,"mouseenter")).event(()=>$a.onMouseEnter(e),void 0,this.orthogonalStartDragHandleDisposables),this.orthogonalStartDragHandleDisposables.add(new $n(this._orthogonalStartDragHandle,"mouseleave")).event(()=>$a.onMouseLeave(e),void 0,this.orthogonalStartDragHandleDisposables))};this.orthogonalStartSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalStartSash=e}}set orthogonalEndSash(e){if(this._orthogonalEndSash!==e){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),e){const t=i=>{this.orthogonalEndDragHandleDisposables.clear(),i!==0&&(this._orthogonalEndDragHandle=Ne(this.el,qe(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(Lt(()=>this._orthogonalEndDragHandle.remove())),this.orthogonalEndDragHandleDisposables.add(new $n(this._orthogonalEndDragHandle,"mouseenter")).event(()=>$a.onMouseEnter(e),void 0,this.orthogonalEndDragHandleDisposables),this.orthogonalEndDragHandleDisposables.add(new $n(this._orthogonalEndDragHandle,"mouseleave")).event(()=>$a.onMouseLeave(e),void 0,this.orthogonalEndDragHandleDisposables))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalEndSash=e}}constructor(e,t,i){super(),this.hoverDelay=D2t,this.hoverDelayer=this._register(new Qd(this.hoverDelay)),this._state=3,this.onDidEnablementChange=this._register(new fe),this._onDidStart=this._register(new fe),this._onDidChange=this._register(new fe),this._onDidReset=this._register(new fe),this._onDidEnd=this._register(new fe),this.orthogonalStartSashDisposables=this._register(new ke),this.orthogonalStartDragHandleDisposables=this._register(new ke),this.orthogonalEndSashDisposables=this._register(new ke),this.orthogonalEndDragHandleDisposables=this._register(new ke),this.onDidStart=this._onDidStart.event,this.onDidChange=this._onDidChange.event,this.onDidReset=this._onDidReset.event,this.onDidEnd=this._onDidEnd.event,this.linkedSash=void 0,this.el=Ne(e,qe(".monaco-sash")),i.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${i.orthogonalEdge}`),Rn&&this.el.classList.add("mac");const r=this._register(new $n(this.el,"mousedown")).event;this._register(r(d=>this.onPointerStart(d,new ice(e)),this));const s=this._register(new $n(this.el,"dblclick")).event;this._register(s(this.onPointerDoublePress,this));const o=this._register(new $n(this.el,"mouseenter")).event;this._register(o(()=>$a.onMouseEnter(this)));const a=this._register(new $n(this.el,"mouseleave")).event;this._register(a(()=>$a.onMouseLeave(this))),this._register(Fr.addTarget(this.el));const l=this._register(new $n(this.el,gr.Start)).event;this._register(l(d=>this.onPointerStart(d,new rce(this.el)),this));const c=this._register(new $n(this.el,gr.Tap)).event;let u;this._register(c(d=>{if(u){clearTimeout(u),u=void 0,this.onPointerDoublePress(d);return}clearTimeout(u),u=setTimeout(()=>u=void 0,250)},this)),typeof i.size=="number"?(this.size=i.size,i.orientation===0?this.el.style.width=`${this.size}px`:this.el.style.height=`${this.size}px`):(this.size=L2t,this._register(T2t.event(d=>{this.size=d,this.layout()}))),this._register(I2t.event(d=>this.hoverDelay=d)),this.layoutProvider=t,this.orthogonalStartSash=i.orthogonalStartSash,this.orthogonalEndSash=i.orthogonalEndSash,this.orientation=i.orientation||0,this.orientation===1?(this.el.classList.add("horizontal"),this.el.classList.remove("vertical")):(this.el.classList.remove("horizontal"),this.el.classList.add("vertical")),this.el.classList.toggle("debug",E2t),this.layout()}onPointerStart(e,t){Hn.stop(e);let i=!1;if(!e.__orthogonalSashEvent){const g=this.getOrthogonalSash(e);g&&(i=!0,e.__orthogonalSashEvent=!0,g.onPointerStart(e,new U8(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new U8(t))),!this.state)return;const r=this.el.ownerDocument.getElementsByTagName("iframe");for(const g of r)g.classList.add(Iye);const s=e.pageX,o=e.pageY,a=e.altKey,l={startX:s,currentX:s,startY:o,currentY:o,altKey:a};this.el.classList.add("active"),this._onDidStart.fire(l);const c=id(this.el),u=()=>{let g="";i?g="all-scroll":this.orientation===1?this.state===1?g="s-resize":this.state===2?g="n-resize":g=Rn?"row-resize":"ns-resize":this.state===1?g="e-resize":this.state===2?g="w-resize":g=Rn?"col-resize":"ew-resize",c.textContent=`* { cursor: ${g} !important; }`},d=new ke;u(),i||this.onDidEnablementChange.event(u,null,d);const h=g=>{Hn.stop(g,!1);const p={startX:s,currentX:g.pageX,startY:o,currentY:g.pageY,altKey:a};this._onDidChange.fire(p)},f=g=>{Hn.stop(g,!1),c.remove(),this.el.classList.remove("active"),this._onDidEnd.fire(),d.dispose();for(const p of r)p.classList.remove(Iye)};t.onPointerMove(h,null,d),t.onPointerUp(f,null,d),d.add(t)}onPointerDoublePress(e){const t=this.getOrthogonalSash(e);t&&t._onDidReset.fire(),this.linkedSash&&this.linkedSash._onDidReset.fire(),this._onDidReset.fire()}static onMouseEnter(e,t=!1){e.el.classList.contains("active")?(e.hoverDelayer.cancel(),e.el.classList.add("hover")):e.hoverDelayer.trigger(()=>e.el.classList.add("hover"),e.hoverDelay).then(void 0,()=>{}),!t&&e.linkedSash&&$a.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&$a.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){$a.onMouseLeave(this)}layout(){if(this.orientation===0){const e=this.layoutProvider;this.el.style.left=e.getVerticalSashLeft(this)-this.size/2+"px",e.getVerticalSashTop&&(this.el.style.top=e.getVerticalSashTop(this)+"px"),e.getVerticalSashHeight&&(this.el.style.height=e.getVerticalSashHeight(this)+"px")}else{const e=this.layoutProvider;this.el.style.top=e.getHorizontalSashTop(this)-this.size/2+"px",e.getHorizontalSashLeft&&(this.el.style.left=e.getHorizontalSashLeft(this)+"px"),e.getHorizontalSashWidth&&(this.el.style.width=e.getHorizontalSashWidth(this)+"px")}}getOrthogonalSash(e){const t=e.initialTarget??e.target;if(!(!t||!Eo(t))&&t.classList.contains("orthogonal-drag-handle"))return t.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}}const A2t={separatorBorder:Te.transparent};class f6e{set size(e){this._size=e}get size(){return this._size}get visible(){return typeof this._cachedVisibleSize>"u"}setVisible(e,t){if(e!==this.visible){e?(this.size=Il(this._cachedVisibleSize,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof t=="number"?t:this.size,this.size=0),this.container.classList.toggle("visible",e);try{this.view.setVisible?.(e)}catch(i){console.error("Splitview: Failed to set visible view"),console.error(i)}}}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,t,i,r){this.container=e,this.view=t,this.disposable=r,this._cachedVisibleSize=void 0,typeof i=="number"?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}layout(e,t){this.layoutContainer(e);try{this.view.layout(this.size,e,t)}catch(i){console.error("Splitview: Failed to layout view"),console.error(i)}}dispose(){this.disposable.dispose()}}class N2t extends f6e{layoutContainer(e){this.container.style.top=`${e}px`,this.container.style.height=`${this.size}px`}}class R2t extends f6e{layoutContainer(e){this.container.style.left=`${e}px`,this.container.style.width=`${this.size}px`}}var Um;(function(n){n[n.Idle=0]="Idle",n[n.Busy=1]="Busy"})(Um||(Um={}));var j8;(function(n){n.Distribute={type:"distribute"};function e(r){return{type:"split",index:r}}n.Split=e;function t(r){return{type:"auto",index:r}}n.Auto=t;function i(r){return{type:"invisible",cachedVisibleSize:r}}n.Invisible=i})(j8||(j8={}));class g6e extends me{get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}get startSnappingEnabled(){return this._startSnappingEnabled}get endSnappingEnabled(){return this._endSnappingEnabled}set orthogonalStartSash(e){for(const t of this.sashItems)t.sash.orthogonalStartSash=e;this._orthogonalStartSash=e}set orthogonalEndSash(e){for(const t of this.sashItems)t.sash.orthogonalEndSash=e;this._orthogonalEndSash=e}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}constructor(e,t={}){super(),this.size=0,this._contentSize=0,this.proportions=void 0,this.viewItems=[],this.sashItems=[],this.state=Um.Idle,this._onDidSashChange=this._register(new fe),this._onDidSashReset=this._register(new fe),this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this.onDidSashChange=this._onDidSashChange.event,this.onDidSashReset=this._onDidSashReset.event,this.orientation=t.orientation??0,this.inverseAltBehavior=t.inverseAltBehavior??!1,this.proportionalLayout=t.proportionalLayout??!0,this.getSashOrthogonalSize=t.getSashOrthogonalSize,this.el=document.createElement("div"),this.el.classList.add("monaco-split-view2"),this.el.classList.add(this.orientation===0?"vertical":"horizontal"),e.appendChild(this.el),this.sashContainer=Ne(this.el,qe(".sash-container")),this.viewContainer=qe(".split-view-container"),this.scrollable=this._register(new t2({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:r=>du(Ot(this.el),r)})),this.scrollableElement=this._register(new fW(this.viewContainer,{vertical:this.orientation===0?t.scrollbarVisibility??1:2,horizontal:this.orientation===1?t.scrollbarVisibility??1:2},this.scrollable));const i=this._register(new $n(this.viewContainer,"scroll")).event;this._register(i(r=>{const s=this.scrollableElement.getScrollPosition(),o=Math.abs(this.viewContainer.scrollLeft-s.scrollLeft)<=1?void 0:this.viewContainer.scrollLeft,a=Math.abs(this.viewContainer.scrollTop-s.scrollTop)<=1?void 0:this.viewContainer.scrollTop;(o!==void 0||a!==void 0)&&this.scrollableElement.setScrollPosition({scrollLeft:o,scrollTop:a})})),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll(r=>{r.scrollTopChanged&&(this.viewContainer.scrollTop=r.scrollTop),r.scrollLeftChanged&&(this.viewContainer.scrollLeft=r.scrollLeft)})),Ne(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||A2t),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach((r,s)=>{const o=ml(r.visible)||r.visible?r.size:{type:"invisible",cachedVisibleSize:r.size},a=r.view;this.doAddView(a,o,s,!0)}),this._contentSize=this.viewItems.reduce((r,s)=>r+s.size,0),this.saveProportions())}style(e){e.separatorBorder.isTransparent()?(this.el.classList.remove("separator-border"),this.el.style.removeProperty("--separator-border")):(this.el.classList.add("separator-border"),this.el.style.setProperty("--separator-border",e.separatorBorder.toString()))}addView(e,t,i=this.viewItems.length,r){this.doAddView(e,t,i,r)}layout(e,t){const i=Math.max(this.size,this._contentSize);if(this.size=e,this.layoutContext=t,this.proportions){let r=0;for(let s=0;s0&&(o.size=Il(Math.round(a*e/r),o.minimumSize,o.maximumSize))}}else{const r=sc(this.viewItems.length),s=r.filter(a=>this.viewItems[a].priority===1),o=r.filter(a=>this.viewItems[a].priority===2);this.resize(this.viewItems.length-1,e-i,void 0,s,o)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this.proportions=this.viewItems.map(e=>e.proportionalLayout&&e.visible?e.size/this._contentSize:void 0))}onSashStart({sash:e,start:t,alt:i}){for(const a of this.viewItems)a.enabled=!1;const r=this.sashItems.findIndex(a=>a.sash===e),s=Qh(Ce(this.el.ownerDocument.body,"keydown",a=>o(this.sashDragState.current,a.altKey)),Ce(this.el.ownerDocument.body,"keyup",()=>o(this.sashDragState.current,!1))),o=(a,l)=>{const c=this.viewItems.map(g=>g.size);let u=Number.NEGATIVE_INFINITY,d=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(l=!l),l)if(r===this.sashItems.length-1){const p=this.viewItems[r];u=(p.minimumSize-p.size)/2,d=(p.maximumSize-p.size)/2}else{const p=this.viewItems[r+1];u=(p.size-p.maximumSize)/2,d=(p.size-p.minimumSize)/2}let h,f;if(!l){const g=sc(r,-1),p=sc(r+1,this.viewItems.length),m=g.reduce((D,I)=>D+(this.viewItems[I].minimumSize-c[I]),0),_=g.reduce((D,I)=>D+(this.viewItems[I].viewMaximumSize-c[I]),0),v=p.length===0?Number.POSITIVE_INFINITY:p.reduce((D,I)=>D+(c[I]-this.viewItems[I].minimumSize),0),y=p.length===0?Number.NEGATIVE_INFINITY:p.reduce((D,I)=>D+(c[I]-this.viewItems[I].viewMaximumSize),0),C=Math.max(m,y),x=Math.min(v,_),k=this.findFirstSnapIndex(g),L=this.findFirstSnapIndex(p);if(typeof k=="number"){const D=this.viewItems[k],I=Math.floor(D.viewMinimumSize/2);h={index:k,limitDelta:D.visible?C-I:C+I,size:D.size}}if(typeof L=="number"){const D=this.viewItems[L],I=Math.floor(D.viewMinimumSize/2);f={index:L,limitDelta:D.visible?x+I:x-I,size:D.size}}}this.sashDragState={start:a,current:a,index:r,sizes:c,minDelta:u,maxDelta:d,alt:l,snapBefore:h,snapAfter:f,disposable:s}};o(t,i)}onSashChange({current:e}){const{index:t,start:i,sizes:r,alt:s,minDelta:o,maxDelta:a,snapBefore:l,snapAfter:c}=this.sashDragState;this.sashDragState.current=e;const u=e-i,d=this.resize(t,u,r,void 0,void 0,o,a,l,c);if(s){const h=t===this.sashItems.length-1,f=this.viewItems.map(y=>y.size),g=h?t:t+1,p=this.viewItems[g],m=p.size-p.maximumSize,_=p.size-p.minimumSize,v=h?t-1:t+1;this.resize(v,-d,f,void 0,void 0,m,_)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(e){this._onDidSashChange.fire(e),this.sashDragState.disposable.dispose(),this.saveProportions();for(const t of this.viewItems)t.enabled=!0}onViewChange(e,t){const i=this.viewItems.indexOf(e);i<0||i>=this.viewItems.length||(t=typeof t=="number"?t:e.size,t=Il(t,e.minimumSize,e.maximumSize),this.inverseAltBehavior&&i>0?(this.resize(i-1,Math.floor((e.size-t)/2)),this.distributeEmptySpace(),this.layoutViews()):(e.size=t,this.relayout([i],void 0)))}resizeView(e,t){if(!(e<0||e>=this.viewItems.length)){if(this.state!==Um.Idle)throw new Error("Cant modify splitview");this.state=Um.Busy;try{const i=sc(this.viewItems.length).filter(a=>a!==e),r=[...i.filter(a=>this.viewItems[a].priority===1),e],s=i.filter(a=>this.viewItems[a].priority===2),o=this.viewItems[e];t=Math.round(t),t=Il(t,o.minimumSize,Math.min(o.maximumSize,this.size)),o.size=t,this.relayout(r,s)}finally{this.state=Um.Idle}}}distributeViewSizes(){const e=[];let t=0;for(const a of this.viewItems)a.maximumSize-a.minimumSize>0&&(e.push(a),t+=a.size);const i=Math.floor(t/e.length);for(const a of e)a.size=Il(i,a.minimumSize,a.maximumSize);const r=sc(this.viewItems.length),s=r.filter(a=>this.viewItems[a].priority===1),o=r.filter(a=>this.viewItems[a].priority===2);this.relayout(s,o)}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}doAddView(e,t,i=this.viewItems.length,r){if(this.state!==Um.Idle)throw new Error("Cant modify splitview");this.state=Um.Busy;try{const s=qe(".split-view-view");i===this.viewItems.length?this.viewContainer.appendChild(s):this.viewContainer.insertBefore(s,this.viewContainer.children.item(i));const o=e.onDidChange(h=>this.onViewChange(u,h)),a=Lt(()=>s.remove()),l=Qh(o,a);let c;typeof t=="number"?c=t:(t.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index}),t.type==="split"?c=this.getViewSize(t.index)/2:t.type==="invisible"?c={cachedVisibleSize:t.cachedVisibleSize}:c=e.minimumSize);const u=this.orientation===0?new N2t(s,e,c,l):new R2t(s,e,c,l);if(this.viewItems.splice(i,0,u),this.viewItems.length>1){const h={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash},f=this.orientation===0?new $a(this.sashContainer,{getHorizontalSashTop:D=>this.getSashPosition(D),getHorizontalSashWidth:this.getSashOrthogonalSize},{...h,orientation:1}):new $a(this.sashContainer,{getVerticalSashLeft:D=>this.getSashPosition(D),getVerticalSashHeight:this.getSashOrthogonalSize},{...h,orientation:0}),g=this.orientation===0?D=>({sash:f,start:D.startY,current:D.currentY,alt:D.altKey}):D=>({sash:f,start:D.startX,current:D.currentX,alt:D.altKey}),m=Ge.map(f.onDidStart,g)(this.onSashStart,this),v=Ge.map(f.onDidChange,g)(this.onSashChange,this),C=Ge.map(f.onDidEnd,()=>this.sashItems.findIndex(D=>D.sash===f))(this.onSashEnd,this),x=f.onDidReset(()=>{const D=this.sashItems.findIndex(G=>G.sash===f),I=sc(D,-1),O=sc(D+1,this.viewItems.length),M=this.findFirstSnapIndex(I),B=this.findFirstSnapIndex(O);typeof M=="number"&&!this.viewItems[M].visible||typeof B=="number"&&!this.viewItems[B].visible||this._onDidSashReset.fire(D)}),k=Qh(m,v,C,x,f),L={sash:f,disposable:k};this.sashItems.splice(i-1,0,L)}s.appendChild(e.element);let d;typeof t!="number"&&t.type==="split"&&(d=[t.index]),r||this.relayout([i],d),!r&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes()}finally{this.state=Um.Idle}}relayout(e,t){const i=this.viewItems.reduce((r,s)=>r+s.size,0);this.resize(this.viewItems.length-1,this.size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}resize(e,t,i=this.viewItems.map(u=>u.size),r,s,o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,l,c){if(e<0||e>=this.viewItems.length)return 0;const u=sc(e,-1),d=sc(e+1,this.viewItems.length);if(s)for(const L of s)uj(u,L),uj(d,L);if(r)for(const L of r)_4(u,L),_4(d,L);const h=u.map(L=>this.viewItems[L]),f=u.map(L=>i[L]),g=d.map(L=>this.viewItems[L]),p=d.map(L=>i[L]),m=u.reduce((L,D)=>L+(this.viewItems[D].minimumSize-i[D]),0),_=u.reduce((L,D)=>L+(this.viewItems[D].maximumSize-i[D]),0),v=d.length===0?Number.POSITIVE_INFINITY:d.reduce((L,D)=>L+(i[D]-this.viewItems[D].minimumSize),0),y=d.length===0?Number.NEGATIVE_INFINITY:d.reduce((L,D)=>L+(i[D]-this.viewItems[D].maximumSize),0),C=Math.max(m,y,o),x=Math.min(v,_,a);let k=!1;if(l){const L=this.viewItems[l.index],D=t>=l.limitDelta;k=D!==L.visible,L.setVisible(D,l.size)}if(!k&&c){const L=this.viewItems[c.index],D=ta+l.size,0);let i=this.size-t;const r=sc(this.viewItems.length-1,-1),s=r.filter(a=>this.viewItems[a].priority===1),o=r.filter(a=>this.viewItems[a].priority===2);for(const a of o)uj(r,a);for(const a of s)_4(r,a);typeof e=="number"&&_4(r,e);for(let a=0;i!==0&&at+i.size,0);let e=0;for(const t of this.viewItems)t.layout(e,this.layoutContext),e+=t.size;this.sashItems.forEach(t=>t.sash.layout()),this.updateSashEnablement(),this.updateScrollableElement()}updateScrollableElement(){this.orientation===0?this.scrollableElement.setScrollDimensions({height:this.size,scrollHeight:this._contentSize}):this.scrollableElement.setScrollDimensions({width:this.size,scrollWidth:this._contentSize})}updateSashEnablement(){let e=!1;const t=this.viewItems.map(l=>e=l.size-l.minimumSize>0||e);e=!1;const i=this.viewItems.map(l=>e=l.maximumSize-l.size>0||e),r=[...this.viewItems].reverse();e=!1;const s=r.map(l=>e=l.size-l.minimumSize>0||e).reverse();e=!1;const o=r.map(l=>e=l.maximumSize-l.size>0||e).reverse();let a=0;for(let l=0;l0||this.startSnappingEnabled)?c.state=1:v&&t[l]&&(a0)return;if(!i.visible&&i.snap)return t}}areViewsDistributed(){let e,t;for(const i of this.viewItems)if(e=e===void 0?i.size:Math.min(e,i.size),t=t===void 0?i.size:Math.max(t,i.size),t-e>2)return!1;return!0}dispose(){this.sashDragState?.disposable.dispose(),er(this.viewItems),this.viewItems=[],this.sashItems.forEach(e=>e.disposable.dispose()),this.sashItems=[],super.dispose()}}class IW{static{this.TemplateId="row"}constructor(e,t,i){this.columns=e,this.getColumnSize=i,this.templateId=IW.TemplateId,this.renderedTemplates=new Set;const r=new Map(t.map(s=>[s.templateId,s]));this.renderers=[];for(const s of e){const o=r.get(s.templateId);if(!o)throw new Error(`Table cell renderer for template id ${s.templateId} not found.`);this.renderers.push(o)}}renderTemplate(e){const t=Ne(e,qe(".monaco-table-tr")),i=[],r=[];for(let o=0;othis.disposables.add(new O2t(u,d))),l={size:a.reduce((u,d)=>u+d.column.weight,0),views:a.map(u=>({size:u.column.weight,view:u}))};this.splitview=this.disposables.add(new g6e(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:l})),this.splitview.el.style.height=`${i.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${i.headerRowHeight}px`;const c=new IW(r,s,u=>this.splitview.getViewSize(u));this.list=this.disposables.add(new dd(e,this.domNode,P2t(i),[c],o)),Ge.any(...a.map(u=>u.onDidLayout))(([u,d])=>c.layoutColumn(u,d),null,this.disposables),this.splitview.onDidSashReset(u=>{const d=r.reduce((f,g)=>f+g.weight,0),h=r[u].weight/d*this.cachedWidth;this.splitview.resizeView(u,h)},null,this.disposables),this.styleElement=id(this.domNode),this.style(okt)}updateOptions(e){this.list.updateOptions(e)}splice(e,t,i=[]){this.list.splice(e,t,i)}getHTMLElement(){return this.domNode}style(e){const t=[];t.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before { top: ${this.virtualDelegate.headerRowHeight+1}px; height: calc(100% - ${this.virtualDelegate.headerRowHeight}px); }`),this.styleElement.textContent=t.join(` -`),this.list.style(e)}getSelectedElements(){return this.list.getSelectedElements()}getSelection(){return this.list.getSelection()}getFocus(){return this.list.getFocus()}dispose(){this.disposables.dispose()}};var Ru;(function(n){n[n.Expanded=0]="Expanded",n[n.Collapsed=1]="Collapsed",n[n.PreserveOrExpanded=2]="PreserveOrExpanded",n[n.PreserveOrCollapsed=3]="PreserveOrCollapsed"})(Ru||(Ru={}));var Ry;(function(n){n[n.Unknown=0]="Unknown",n[n.Twistie=1]="Twistie",n[n.Element=2]="Element",n[n.Filter=3]="Filter"})(Ry||(Ry={}));class Wu extends Error{constructor(e,t){super(`TreeError [${e}] ${t}`)}}class sce{constructor(e){this.fn=e,this._map=new WeakMap}map(e){let t=this._map.get(e);return t||(t=this.fn(e),this._map.set(e,t)),t}}function oce(n){return typeof n=="object"&&"visibility"in n&&"data"in n}function MN(n){switch(n){case!0:return 1;case!1:return 0;default:return n}}function pq(n){return typeof n.collapsible=="boolean"}class F2t{constructor(e,t,i,r={}){this.user=e,this.list=t,this.rootRef=[],this.eventBufferer=new UP,this._onDidChangeCollapseState=new fe,this.onDidChangeCollapseState=this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event),this._onDidChangeRenderNodeCount=new fe,this.onDidChangeRenderNodeCount=this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event),this._onDidSplice=new fe,this.onDidSplice=this._onDidSplice.event,this.refilterDelayer=new Qd(Y4e),this.collapseByDefault=typeof r.collapseByDefault>"u"?!1:r.collapseByDefault,this.allowNonCollapsibleParents=r.allowNonCollapsibleParents??!1,this.filter=r.filter,this.autoExpandSingleChildren=typeof r.autoExpandSingleChildren>"u"?!1:r.autoExpandSingleChildren,this.root={parent:void 0,element:i,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:!1,collapsed:!1,renderNodeCount:0,visibility:1,visible:!0,filterData:void 0}}splice(e,t,i=zn.empty(),r={}){if(e.length===0)throw new Wu(this.user,"Invalid tree location");r.diffIdentityProvider?this.spliceSmart(r.diffIdentityProvider,e,t,i,r):this.spliceSimple(e,t,i,r)}spliceSmart(e,t,i,r=zn.empty(),s,o=s.diffDepth??0){const{parentNode:a}=this.getParentNodeWithListIndex(t);if(!a.lastDiffIds)return this.spliceSimple(t,i,r,s);const l=[...r],c=t[t.length-1],u=new wp({getElements:()=>a.lastDiffIds},{getElements:()=>[...a.children.slice(0,c),...l,...a.children.slice(c+i)].map(p=>e.getId(p.element).toString())}).ComputeDiff(!1);if(u.quitEarly)return a.lastDiffIds=void 0,this.spliceSimple(t,i,l,s);const d=t.slice(0,-1),h=(p,m,_)=>{if(o>0)for(let v=0;v<_;v++)p--,m--,this.spliceSmart(e,[...d,p,0],Number.MAX_SAFE_INTEGER,l[m].children,s,o-1)};let f=Math.min(a.children.length,c+i),g=l.length;for(const p of u.changes.sort((m,_)=>_.originalStart-m.originalStart))h(f,g,f-(p.originalStart+p.originalLength)),f=p.originalStart,g=p.modifiedStart-c,this.spliceSimple([...d,f],p.originalLength,zn.slice(l,g,g+p.modifiedLength),s);h(f,g,f)}spliceSimple(e,t,i=zn.empty(),{onDidCreateNode:r,onDidDeleteNode:s,diffIdentityProvider:o}){const{parentNode:a,listIndex:l,revealed:c,visible:u}=this.getParentNodeWithListIndex(e),d=[],h=zn.map(i,x=>this.createTreeNode(x,a,a.visible?1:0,c,d,r)),f=e[e.length-1];let g=0;for(let x=f;x>=0&&xo.getId(x.element).toString())):a.lastDiffIds=a.children.map(x=>o.getId(x.element).toString()):a.lastDiffIds=void 0;let y=0;for(const x of v)x.visible&&y++;if(y!==0)for(let x=f+p.length;xk+(L.visible?L.renderNodeCount:0),0);this._updateAncestorsRenderNodeCount(a,_-x),this.list.splice(l,x,d)}if(v.length>0&&s){const x=k=>{s(k),k.children.forEach(x)};v.forEach(x)}this._onDidSplice.fire({insertedNodes:p,deletedNodes:v});let C=a;for(;C;){if(C.visibility===2){this.refilterDelayer.trigger(()=>this.refilter());break}C=C.parent}}rerender(e){if(e.length===0)throw new Wu(this.user,"Invalid tree location");const{node:t,listIndex:i,revealed:r}=this.getTreeNodeWithListIndex(e);t.visible&&r&&this.list.splice(i,1,[t])}has(e){return this.hasTreeNode(e)}getListIndex(e){const{listIndex:t,visible:i,revealed:r}=this.getTreeNodeWithListIndex(e);return i&&r?t:-1}getListRenderCount(e){return this.getTreeNode(e).renderNodeCount}isCollapsible(e){return this.getTreeNode(e).collapsible}setCollapsible(e,t){const i=this.getTreeNode(e);typeof t>"u"&&(t=!i.collapsible);const r={collapsible:t};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,r))}isCollapsed(e){return this.getTreeNode(e).collapsed}setCollapsed(e,t,i){const r=this.getTreeNode(e);typeof t>"u"&&(t=!r.collapsed);const s={collapsed:t,recursive:i||!1};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,s))}_setCollapseState(e,t){const{node:i,listIndex:r,revealed:s}=this.getTreeNodeWithListIndex(e),o=this._setListNodeCollapseState(i,r,s,t);if(i!==this.root&&this.autoExpandSingleChildren&&o&&!pq(t)&&i.collapsible&&!i.collapsed&&!t.recursive){let a=-1;for(let l=0;l-1){a=-1;break}else a=l;a>-1&&this._setCollapseState([...e,a],t)}return o}_setListNodeCollapseState(e,t,i,r){const s=this._setNodeCollapseState(e,r,!1);if(!i||!e.visible||!s)return s;const o=e.renderNodeCount,a=this.updateNodeAfterCollapseChange(e),l=o-(t===-1?0:1);return this.list.splice(t+1,l,a.slice(1)),s}_setNodeCollapseState(e,t,i){let r;if(e===this.root?r=!1:(pq(t)?(r=e.collapsible!==t.collapsible,e.collapsible=t.collapsible):e.collapsible?(r=e.collapsed!==t.collapsed,e.collapsed=t.collapsed):r=!1,r&&this._onDidChangeCollapseState.fire({node:e,deep:i})),!pq(t)&&t.recursive)for(const s of e.children)r=this._setNodeCollapseState(s,t,!0)||r;return r}expandTo(e){this.eventBufferer.bufferEvents(()=>{let t=this.getTreeNode(e);for(;t.parent;)t=t.parent,e=e.slice(0,e.length-1),t.collapsed&&this._setCollapseState(e,{collapsed:!1,recursive:!1})})}refilter(){const e=this.root.renderNodeCount,t=this.updateNodeAfterFilterChange(this.root);this.list.splice(0,e,t),this.refilterDelayer.cancel()}createTreeNode(e,t,i,r,s,o){const a={parent:t,element:e.element,children:[],depth:t.depth+1,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:typeof e.collapsible=="boolean"?e.collapsible:typeof e.collapsed<"u",collapsed:typeof e.collapsed>"u"?this.collapseByDefault:e.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},l=this._filterNode(a,i);a.visibility=l,r&&s.push(a);const c=e.children||zn.empty(),u=r&&l!==0&&!a.collapsed;let d=0,h=1;for(const f of c){const g=this.createTreeNode(f,a,l,u,s,o);a.children.push(g),h+=g.renderNodeCount,g.visible&&(g.visibleChildIndex=d++)}return this.allowNonCollapsibleParents||(a.collapsible=a.collapsible||a.children.length>0),a.visibleChildrenCount=d,a.visible=l===2?d>0:l===1,a.visible?a.collapsed||(a.renderNodeCount=h):(a.renderNodeCount=0,r&&s.pop()),o?.(a),a}updateNodeAfterCollapseChange(e){const t=e.renderNodeCount,i=[];return this._updateNodeAfterCollapseChange(e,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterCollapseChange(e,t){if(e.visible===!1)return 0;if(t.push(e),e.renderNodeCount=1,!e.collapsed)for(const i of e.children)e.renderNodeCount+=this._updateNodeAfterCollapseChange(i,t);return this._onDidChangeRenderNodeCount.fire(e),e.renderNodeCount}updateNodeAfterFilterChange(e){const t=e.renderNodeCount,i=[];return this._updateNodeAfterFilterChange(e,e.visible?1:0,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterFilterChange(e,t,i,r=!0){let s;if(e!==this.root){if(s=this._filterNode(e,t),s===0)return e.visible=!1,e.renderNodeCount=0,!1;r&&i.push(e)}const o=i.length;e.renderNodeCount=e===this.root?0:1;let a=!1;if(!e.collapsed||s!==0){let l=0;for(const c of e.children)a=this._updateNodeAfterFilterChange(c,s,i,r&&!e.collapsed)||a,c.visible&&(c.visibleChildIndex=l++);e.visibleChildrenCount=l}else e.visibleChildrenCount=0;return e!==this.root&&(e.visible=s===2?a:s===1,e.visibility=s),e.visible?e.collapsed||(e.renderNodeCount+=i.length-o):(e.renderNodeCount=0,r&&i.pop()),this._onDidChangeRenderNodeCount.fire(e),e.visible}_updateAncestorsRenderNodeCount(e,t){if(t!==0)for(;e;)e.renderNodeCount+=t,this._onDidChangeRenderNodeCount.fire(e),e=e.parent}_filterNode(e,t){const i=this.filter?this.filter.filter(e.element,t):1;return typeof i=="boolean"?(e.filterData=void 0,i?1:0):oce(i)?(e.filterData=i.data,MN(i.visibility)):(e.filterData=void 0,MN(i))}hasTreeNode(e,t=this.root){if(!e||e.length===0)return!0;const[i,...r]=e;return i<0||i>t.children.length?!1:this.hasTreeNode(r,t.children[i])}getTreeNode(e,t=this.root){if(!e||e.length===0)return t;const[i,...r]=e;if(i<0||i>t.children.length)throw new Wu(this.user,"Invalid tree location");return this.getTreeNode(r,t.children[i])}getTreeNodeWithListIndex(e){if(e.length===0)return{node:this.root,listIndex:-1,revealed:!0,visible:!1};const{parentNode:t,listIndex:i,revealed:r,visible:s}=this.getParentNodeWithListIndex(e),o=e[e.length-1];if(o<0||o>t.children.length)throw new Wu(this.user,"Invalid tree location");const a=t.children[o];return{node:a,listIndex:i,revealed:r,visible:s&&a.visible}}getParentNodeWithListIndex(e,t=this.root,i=0,r=!0,s=!0){const[o,...a]=e;if(o<0||o>t.children.length)throw new Wu(this.user,"Invalid tree location");for(let l=0;lt.element)),this.data=e}}function mq(n){return n instanceof uO?new B2t(n):n}class $2t{constructor(e,t){this.modelProvider=e,this.dnd=t,this.autoExpandDisposable=me.None,this.disposables=new ke}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map(i=>i.element),t)}onDragStart(e,t){this.dnd.onDragStart?.(mq(e),t)}onDragOver(e,t,i,r,s,o=!0){const a=this.dnd.onDragOver(mq(e),t&&t.element,i,r,s),l=this.autoExpandNode!==t;if(l&&(this.autoExpandDisposable.dispose(),this.autoExpandNode=t),typeof t>"u")return a;if(l&&typeof a!="boolean"&&a.autoExpand&&(this.autoExpandDisposable=Sb(()=>{const f=this.modelProvider(),g=f.getNodeLocation(t);f.isCollapsed(g)&&f.setCollapsed(g,!1),this.autoExpandNode=void 0},500,this.disposables)),typeof a=="boolean"||!a.accept||typeof a.bubble>"u"||a.feedback){if(!o){const f=typeof a=="boolean"?a:a.accept,g=typeof a=="boolean"?void 0:a.effect;return{accept:f,effect:g,feedback:[i]}}return a}if(a.bubble===1){const f=this.modelProvider(),g=f.getNodeLocation(t),p=f.getParentNodeLocation(g),m=f.getNode(p),_=p&&f.getListIndex(p);return this.onDragOver(e,m,_,r,s,!1)}const c=this.modelProvider(),u=c.getNodeLocation(t),d=c.getListIndex(u),h=c.getListRenderCount(u);return{...a,feedback:sc(d,d+h)}}drop(e,t,i,r,s){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(mq(e),t&&t.element,i,r,s)}onDragEnd(e){this.dnd.onDragEnd?.(e)}dispose(){this.disposables.dispose(),this.dnd.dispose()}}function W2t(n,e){return e&&{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(t.element)}},dnd:e.dnd&&new $2t(n,e.dnd),multipleSelectionController:e.multipleSelectionController&&{isSelectionSingleChangeEvent(t){return e.multipleSelectionController.isSelectionSingleChangeEvent({...t,element:t.element})},isSelectionRangeChangeEvent(t){return e.multipleSelectionController.isSelectionRangeChangeEvent({...t,element:t.element})}},accessibilityProvider:e.accessibilityProvider&&{...e.accessibilityProvider,getSetSize(t){const i=n(),r=i.getNodeLocation(t),s=i.getParentNodeLocation(r);return i.getNode(s).visibleChildrenCount},getPosInSet(t){return t.visibleChildIndex+1},isChecked:e.accessibilityProvider&&e.accessibilityProvider.isChecked?t=>e.accessibilityProvider.isChecked(t.element):void 0,getRole:e.accessibilityProvider&&e.accessibilityProvider.getRole?t=>e.accessibilityProvider.getRole(t.element):()=>"treeitem",getAriaLabel(t){return e.accessibilityProvider.getAriaLabel(t.element)},getWidgetAriaLabel(){return e.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:e.accessibilityProvider&&e.accessibilityProvider.getWidgetRole?()=>e.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:e.accessibilityProvider&&e.accessibilityProvider.getAriaLevel?t=>e.accessibilityProvider.getAriaLevel(t.element):t=>t.depth,getActiveDescendantId:e.accessibilityProvider.getActiveDescendantId&&(t=>e.accessibilityProvider.getActiveDescendantId(t.element))},keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(t){return e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t.element)}}}}class ace{constructor(e){this.delegate=e}getHeight(e){return this.delegate.getHeight(e.element)}getTemplateId(e){return this.delegate.getTemplateId(e.element)}hasDynamicHeight(e){return!!this.delegate.hasDynamicHeight&&this.delegate.hasDynamicHeight(e.element)}setDynamicHeight(e,t){this.delegate.setDynamicHeight?.(e.element,t)}}var yE;(function(n){n.None="none",n.OnHover="onHover",n.Always="always"})(yE||(yE={}));class H2t{get elements(){return this._elements}constructor(e,t=[]){this._elements=t,this.disposables=new ke,this.onDidChange=Ge.forEach(e,i=>this._elements=i,this.disposables)}dispose(){this.disposables.dispose()}}class q8{static{this.DefaultIndent=8}constructor(e,t,i,r,s,o={}){this.renderer=e,this.modelProvider=t,this.activeNodes=r,this.renderedIndentGuides=s,this.renderedElements=new Map,this.renderedNodes=new Map,this.indent=q8.DefaultIndent,this.hideTwistiesOfChildlessElements=!1,this.shouldRenderIndentGuides=!1,this.activeIndentNodes=new Set,this.indentGuidesDisposable=me.None,this.disposables=new ke,this.templateId=e.templateId,this.updateOptions(o),Ge.map(i,a=>a.node)(this.onDidChangeNodeTwistieState,this,this.disposables),e.onDidChangeTwistieState?.(this.onDidChangeTwistieState,this,this.disposables)}updateOptions(e={}){if(typeof e.indent<"u"){const t=Il(e.indent,0,40);if(t!==this.indent){this.indent=t;for(const[i,r]of this.renderedNodes)this.renderTreeElement(i,r)}}if(typeof e.renderIndentGuides<"u"){const t=e.renderIndentGuides!==yE.None;if(t!==this.shouldRenderIndentGuides){this.shouldRenderIndentGuides=t;for(const[i,r]of this.renderedNodes)this._renderIndentGuides(i,r);if(this.indentGuidesDisposable.dispose(),t){const i=new ke;this.activeNodes.onDidChange(this._onDidChangeActiveNodes,this,i),this.indentGuidesDisposable=i,this._onDidChangeActiveNodes(this.activeNodes.elements)}}}typeof e.hideTwistiesOfChildlessElements<"u"&&(this.hideTwistiesOfChildlessElements=e.hideTwistiesOfChildlessElements)}renderTemplate(e){const t=Ne(e,qe(".monaco-tl-row")),i=Ne(t,qe(".monaco-tl-indent")),r=Ne(t,qe(".monaco-tl-twistie")),s=Ne(t,qe(".monaco-tl-contents")),o=this.renderer.renderTemplate(s);return{container:e,indent:i,twistie:r,indentGuidesDisposable:me.None,templateData:o}}renderElement(e,t,i,r){this.renderedNodes.set(e,i),this.renderedElements.set(e.element,e),this.renderTreeElement(e,i),this.renderer.renderElement(e,t,i.templateData,r)}disposeElement(e,t,i,r){i.indentGuidesDisposable.dispose(),this.renderer.disposeElement?.(e,t,i.templateData,r),typeof r=="number"&&(this.renderedNodes.delete(e),this.renderedElements.delete(e.element))}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}onDidChangeTwistieState(e){const t=this.renderedElements.get(e);t&&this.onDidChangeNodeTwistieState(t)}onDidChangeNodeTwistieState(e){const t=this.renderedNodes.get(e);t&&(this._onDidChangeActiveNodes(this.activeNodes.elements),this.renderTreeElement(e,t))}renderTreeElement(e,t){const i=q8.DefaultIndent+(e.depth-1)*this.indent;t.twistie.style.paddingLeft=`${i}px`,t.indent.style.width=`${i+this.indent-16}px`,e.collapsible?t.container.setAttribute("aria-expanded",String(!e.collapsed)):t.container.removeAttribute("aria-expanded"),t.twistie.classList.remove(...zt.asClassNameArray(ze.treeItemExpanded));let r=!1;this.renderer.renderTwistie&&(r=this.renderer.renderTwistie(e.element,t.twistie)),e.collapsible&&(!this.hideTwistiesOfChildlessElements||e.visibleChildrenCount>0)?(r||t.twistie.classList.add(...zt.asClassNameArray(ze.treeItemExpanded)),t.twistie.classList.add("collapsible"),t.twistie.classList.toggle("collapsed",e.collapsed)):t.twistie.classList.remove("collapsible","collapsed"),this._renderIndentGuides(e,t)}_renderIndentGuides(e,t){if(Jo(t.indent),t.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;const i=new ke,r=this.modelProvider();for(;;){const s=r.getNodeLocation(e),o=r.getParentNodeLocation(s);if(!o)break;const a=r.getNode(o),l=qe(".indent-guide",{style:`width: ${this.indent}px`});this.activeIndentNodes.has(a)&&l.classList.add("active"),t.indent.childElementCount===0?t.indent.appendChild(l):t.indent.insertBefore(l,t.indent.firstElementChild),this.renderedIndentGuides.add(a,l),i.add(Lt(()=>this.renderedIndentGuides.delete(a,l))),e=a}t.indentGuidesDisposable=i}_onDidChangeActiveNodes(e){if(!this.shouldRenderIndentGuides)return;const t=new Set,i=this.modelProvider();e.forEach(r=>{const s=i.getNodeLocation(r);try{const o=i.getParentNodeLocation(s);r.collapsible&&r.children.length>0&&!r.collapsed?t.add(r):o&&t.add(i.getNode(o))}catch{}}),this.activeIndentNodes.forEach(r=>{t.has(r)||this.renderedIndentGuides.forEach(r,s=>s.classList.remove("active"))}),t.forEach(r=>{this.activeIndentNodes.has(r)||this.renderedIndentGuides.forEach(r,s=>s.classList.add("active"))}),this.activeIndentNodes=t}dispose(){this.renderedNodes.clear(),this.renderedElements.clear(),this.indentGuidesDisposable.dispose(),er(this.disposables)}}class V2t{get totalCount(){return this._totalCount}get matchCount(){return this._matchCount}constructor(e,t,i){this.tree=e,this.keyboardNavigationLabelProvider=t,this._filter=i,this._totalCount=0,this._matchCount=0,this._pattern="",this._lowercasePattern="",this.disposables=new ke,e.onWillRefilter(this.reset,this,this.disposables)}filter(e,t){let i=1;if(this._filter){const o=this._filter.filter(e,t);if(typeof o=="boolean"?i=o?1:0:oce(o)?i=MN(o.visibility):i=o,i===0)return!1}if(this._totalCount++,!this._pattern)return this._matchCount++,{data:vg.Default,visibility:i};const r=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e),s=Array.isArray(r)?r:[r];for(const o of s){const a=o&&o.toString();if(typeof a>"u")return{data:vg.Default,visibility:i};let l;if(this.tree.findMatchType===$w.Contiguous){const c=a.toLowerCase().indexOf(this._lowercasePattern);if(c>-1){l=[Number.MAX_SAFE_INTEGER,0];for(let u=this._lowercasePattern.length;u>0;u--)l.push(c+u-1)}}else l=Ow(this._pattern,this._lowercasePattern,0,a,a.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});if(l)return this._matchCount++,s.length===1?{data:l,visibility:i}:{data:{label:a,score:l},visibility:i}}return this.tree.findMode===__.Filter?typeof this.tree.options.defaultFindVisibility=="number"?this.tree.options.defaultFindVisibility:this.tree.options.defaultFindVisibility?this.tree.options.defaultFindVisibility(e):2:{data:vg.Default,visibility:i}}reset(){this._totalCount=0,this._matchCount=0}dispose(){er(this.disposables)}}var __;(function(n){n[n.Highlight=0]="Highlight",n[n.Filter=1]="Filter"})(__||(__={}));var $w;(function(n){n[n.Fuzzy=0]="Fuzzy",n[n.Contiguous=1]="Contiguous"})($w||($w={}));let z2t=class{get pattern(){return this._pattern}get mode(){return this._mode}set mode(e){e!==this._mode&&(this._mode=e,this.widget&&(this.widget.mode=this._mode),this.tree.refilter(),this.render(),this._onDidChangeMode.fire(e))}get matchType(){return this._matchType}set matchType(e){e!==this._matchType&&(this._matchType=e,this.widget&&(this.widget.matchType=this._matchType),this.tree.refilter(),this.render(),this._onDidChangeMatchType.fire(e))}constructor(e,t,i,r,s,o={}){this.tree=e,this.view=i,this.filter=r,this.contextViewProvider=s,this.options=o,this._pattern="",this.width=0,this._onDidChangeMode=new fe,this.onDidChangeMode=this._onDidChangeMode.event,this._onDidChangeMatchType=new fe,this.onDidChangeMatchType=this._onDidChangeMatchType.event,this._onDidChangePattern=new fe,this._onDidChangeOpenState=new fe,this.onDidChangeOpenState=this._onDidChangeOpenState.event,this.enabledDisposables=new ke,this.disposables=new ke,this._mode=e.options.defaultFindMode??__.Highlight,this._matchType=e.options.defaultFindMatchType??$w.Fuzzy,t.onDidSplice(this.onDidSpliceModel,this,this.disposables)}updateOptions(e={}){e.defaultFindMode!==void 0&&(this.mode=e.defaultFindMode),e.defaultFindMatchType!==void 0&&(this.matchType=e.defaultFindMatchType)}onDidSpliceModel(){!this.widget||this.pattern.length===0||(this.tree.refilter(),this.render())}render(){const e=this.filter.totalCount>0&&this.filter.matchCount===0;this.pattern&&e?(ql(w("replFindNoResults","No results")),this.tree.options.showNotFoundMessage??!0?this.widget?.showMessage({type:2,content:w("not found","No elements found.")}):this.widget?.showMessage({type:2})):(this.widget?.clearMessage(),this.pattern&&ql(w("replFindResults","{0} results",this.filter.matchCount)))}shouldAllowFocus(e){return!this.widget||!this.pattern||this.filter.totalCount>0&&this.filter.matchCount<=1?!0:!vg.isDefault(e.filterData)}layout(e){this.width=e,this.widget?.layout(e)}dispose(){this._history=void 0,this._onDidChangePattern.dispose(),this.enabledDisposables.dispose(),this.disposables.dispose()}};function U2t(n,e){return n.position===e.position&&m6e(n,e)}function m6e(n,e){return n.node.element===e.node.element&&n.startIndex===e.startIndex&&n.height===e.height&&n.endIndex===e.endIndex}class j2t{constructor(e=[]){this.stickyNodes=e}get count(){return this.stickyNodes.length}equal(e){return $r(this.stickyNodes,e.stickyNodes,U2t)}lastNodePartiallyVisible(){if(this.count===0)return!1;const e=this.stickyNodes[this.count-1];if(this.count===1)return e.position!==0;const t=this.stickyNodes[this.count-2];return t.position+t.height!==e.position}animationStateChanged(e){if(!$r(this.stickyNodes,e.stickyNodes,m6e)||this.count===0)return!1;const t=this.stickyNodes[this.count-1],i=e.stickyNodes[e.count-1];return t.position!==i.position}}class q2t{constrainStickyScrollNodes(e,t,i){for(let r=0;ri||r>=t)return e.slice(0,r)}return e}}let Aye=class extends me{constructor(e,t,i,r,s,o={}){super(),this.tree=e,this.model=t,this.view=i,this.treeDelegate=s,this.maxWidgetViewRatio=.4;const a=this.validateStickySettings(o);this.stickyScrollMaxItemCount=a.stickyScrollMaxItemCount,this.stickyScrollDelegate=o.stickyScrollDelegate??new q2t,this._widget=this._register(new K2t(i.getScrollableElement(),i,e,r,s,o.accessibilityProvider)),this.onDidChangeHasFocus=this._widget.onDidChangeHasFocus,this.onContextMenu=this._widget.onContextMenu,this._register(i.onDidScroll(()=>this.update())),this._register(i.onDidChangeContentHeight(()=>this.update())),this._register(e.onDidChangeCollapseState(()=>this.update())),this.update()}get height(){return this._widget.height}getNodeAtHeight(e){let t;if(e===0?t=this.view.firstVisibleIndex:t=this.view.indexAt(e+this.view.scrollTop),!(t<0||t>=this.view.length))return this.view.element(t)}update(){const e=this.getNodeAtHeight(0);if(!e||this.tree.scrollTop===0){this._widget.setState(void 0);return}const t=this.findStickyState(e);this._widget.setState(t)}findStickyState(e){const t=[];let i=e,r=0,s=this.getNextStickyNode(i,void 0,r);for(;s&&(t.push(s),r+=s.height,!(t.length<=this.stickyScrollMaxItemCount&&(i=this.getNextVisibleNode(s),!i)));)s=this.getNextStickyNode(i,s.node,r);const o=this.constrainStickyNodes(t);return o.length?new j2t(o):void 0}getNextVisibleNode(e){return this.getNodeAtHeight(e.position+e.height)}getNextStickyNode(e,t,i){const r=this.getAncestorUnderPrevious(e,t);if(r&&!(r===e&&(!this.nodeIsUncollapsedParent(e)||this.nodeTopAlignsWithStickyNodesBottom(e,i))))return this.createStickyScrollNode(r,i)}nodeTopAlignsWithStickyNodesBottom(e,t){const i=this.getNodeIndex(e),r=this.view.getElementTop(i),s=t;return this.view.scrollTop===r-s}createStickyScrollNode(e,t){const i=this.treeDelegate.getHeight(e),{startIndex:r,endIndex:s}=this.getNodeRange(e),o=this.calculateStickyNodePosition(s,t,i);return{node:e,position:o,height:i,startIndex:r,endIndex:s}}getAncestorUnderPrevious(e,t=void 0){let i=e,r=this.getParentNode(i);for(;r;){if(r===t)return i;i=r,r=this.getParentNode(i)}if(t===void 0)return i}calculateStickyNodePosition(e,t,i){let r=this.view.getRelativeTop(e);if(r===null&&this.view.firstVisibleIndex===e&&e+1l&&t<=l?l-i:t}constrainStickyNodes(e){if(e.length===0)return[];const t=this.view.renderHeight*this.maxWidgetViewRatio,i=e[e.length-1];if(e.length<=this.stickyScrollMaxItemCount&&i.position+i.height<=t)return e;const r=this.stickyScrollDelegate.constrainStickyScrollNodes(e,this.stickyScrollMaxItemCount,t);if(!r.length)return[];const s=r[r.length-1];if(r.length>this.stickyScrollMaxItemCount||s.position+s.height>t)throw new Error("stickyScrollDelegate violates constraints");return r}getParentNode(e){const t=this.model.getNodeLocation(e),i=this.model.getParentNodeLocation(t);return i?this.model.getNode(i):void 0}nodeIsUncollapsedParent(e){const t=this.model.getNodeLocation(e);return this.model.getListRenderCount(t)>1}getNodeIndex(e){const t=this.model.getNodeLocation(e);return this.model.getListIndex(t)}getNodeRange(e){const t=this.model.getNodeLocation(e),i=this.model.getListIndex(t);if(i<0)throw new Error("Node not found in tree");const r=this.model.getListRenderCount(t),s=i+r-1;return{startIndex:i,endIndex:s}}nodePositionTopBelowWidget(e){const t=[];let i=this.getParentNode(e);for(;i;)t.push(i),i=this.getParentNode(i);let r=0;for(let s=0;s0,i=!!e&&e.count>0;if(!t&&!i||t&&i&&this._previousState.equal(e))return;if(t!==i&&this.setVisible(i),!i){this._previousState=void 0,this._previousElements=[],this._previousStateDisposables.clear();return}const r=e.stickyNodes[e.count-1];if(this._previousState&&e.animationStateChanged(this._previousState))this._previousElements[this._previousState.count-1].style.top=`${r.position}px`;else{this._previousStateDisposables.clear();const s=Array(e.count);for(let o=e.count-1;o>=0;o--){const a=e.stickyNodes[o],{element:l,disposable:c}=this.createElement(a,o,e.count);s[o]=l,this._rootDomNode.appendChild(l),this._previousStateDisposables.add(c)}this.stickyScrollFocus.updateElements(s,e),this._previousElements=s}this._previousState=e,this._rootDomNode.style.height=`${r.position+r.height}px`}createElement(e,t,i){const r=e.startIndex,s=document.createElement("div");s.style.top=`${e.position}px`,this.tree.options.setRowHeight!==!1&&(s.style.height=`${e.height}px`),this.tree.options.setRowLineHeight!==!1&&(s.style.lineHeight=`${e.height}px`),s.classList.add("monaco-tree-sticky-row"),s.classList.add("monaco-list-row"),s.setAttribute("data-index",`${r}`),s.setAttribute("data-parity",r%2===0?"even":"odd"),s.setAttribute("id",this.view.getElementID(r));const o=this.setAccessibilityAttributes(s,e.node.element,t,i),a=this.treeDelegate.getTemplateId(e.node),l=this.treeRenderers.find(h=>h.templateId===a);if(!l)throw new Error(`No renderer found for template id ${a}`);let c=e.node;c===this.tree.getNode(this.tree.getNodeLocation(e.node))&&(c=new Proxy(e.node,{}));const u=l.renderTemplate(s);l.renderElement(c,e.startIndex,u,e.height);const d=Lt(()=>{o.dispose(),l.disposeElement(c,e.startIndex,u,e.height),l.disposeTemplate(u),s.remove()});return{element:s,disposable:d}}setAccessibilityAttributes(e,t,i,r){if(!this.accessibilityProvider)return me.None;this.accessibilityProvider.getSetSize&&e.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(t,i,r))),this.accessibilityProvider.getPosInSet&&e.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(t,i))),this.accessibilityProvider.getRole&&e.setAttribute("role",this.accessibilityProvider.getRole(t)??"treeitem");const s=this.accessibilityProvider.getAriaLabel(t),o=s&&typeof s!="string"?s:Hd(s),a=tn(c=>{const u=c.readObservable(o);u?e.setAttribute("aria-label",u):e.removeAttribute("aria-label")});typeof s=="string"||s&&e.setAttribute("aria-label",s.get());const l=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(t);return typeof l=="number"&&e.setAttribute("aria-level",`${l}`),e.setAttribute("aria-selected",String(!1)),a}setVisible(e){this._rootDomNode.classList.toggle("empty",!e),e||this.stickyScrollFocus.updateElements([],void 0)}domFocus(){this.stickyScrollFocus.domFocus()}focusedLast(){return this.stickyScrollFocus.focusedLast()}dispose(){this.stickyScrollFocus.dispose(),this._previousStateDisposables.dispose(),this._rootDomNode.remove()}};class G2t extends me{get domHasFocus(){return this._domHasFocus}set domHasFocus(e){e!==this._domHasFocus&&(this._onDidChangeHasFocus.fire(e),this._domHasFocus=e)}constructor(e,t){super(),this.container=e,this.view=t,this.focusedIndex=-1,this.elements=[],this._onDidChangeHasFocus=new fe,this.onDidChangeHasFocus=this._onDidChangeHasFocus.event,this._onContextMenu=new fe,this.onContextMenu=this._onContextMenu.event,this._domHasFocus=!1,this._register(Ce(this.container,"focus",()=>this.onFocus())),this._register(Ce(this.container,"blur",()=>this.onBlur())),this._register(this.view.onDidFocus(()=>this.toggleStickyScrollFocused(!1))),this._register(this.view.onKeyDown(i=>this.onKeyDown(i))),this._register(this.view.onMouseDown(i=>this.onMouseDown(i))),this._register(this.view.onContextMenu(i=>this.handleContextMenu(i)))}handleContextMenu(e){const t=e.browserEvent.target;if(!IN(t)&&!wI(t)){this.focusedLast()&&this.view.domFocus();return}if(!Jm(e.browserEvent)){if(!this.state)throw new Error("Context menu should not be triggered when state is undefined");const o=this.state.stickyNodes.findIndex(a=>a.node.element===e.element?.element);if(o===-1)throw new Error("Context menu should not be triggered when element is not in sticky scroll widget");this.container.focus(),this.setFocus(o);return}if(!this.state||this.focusedIndex<0)throw new Error("Context menu key should not be triggered when focus is not in sticky scroll widget");const r=this.state.stickyNodes[this.focusedIndex].node.element,s=this.elements[this.focusedIndex];this._onContextMenu.fire({element:r,anchor:s,browserEvent:e.browserEvent,isStickyScroll:!0})}onKeyDown(e){if(this.domHasFocus&&this.state){if(e.key==="ArrowUp")this.setFocusedElement(Math.max(0,this.focusedIndex-1)),e.preventDefault(),e.stopPropagation();else if(e.key==="ArrowDown"||e.key==="ArrowRight"){if(this.focusedIndex>=this.state.count-1){const t=this.state.stickyNodes[this.state.count-1].startIndex+1;this.view.domFocus(),this.view.setFocus([t]),this.scrollNodeUnderWidget(t,this.state)}else this.setFocusedElement(this.focusedIndex+1);e.preventDefault(),e.stopPropagation()}}}onMouseDown(e){const t=e.browserEvent.target;!IN(t)&&!wI(t)||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation())}updateElements(e,t){if(t&&t.count===0)throw new Error("Sticky scroll state must be undefined when there are no sticky nodes");if(t&&t.count!==e.length)throw new Error("Sticky scroll focus received illigel state");const i=this.focusedIndex;if(this.removeFocus(),this.elements=e,this.state=t,t){const r=Il(i,0,t.count-1);this.setFocus(r)}else this.domHasFocus&&this.view.domFocus();this.container.tabIndex=t?0:-1}setFocusedElement(e){const t=this.state;if(!t)throw new Error("Cannot set focus when state is undefined");if(this.setFocus(e),!(e1?t.stickyNodes[t.count-2]:void 0,s=this.view.getElementTop(e),o=r?r.position+r.height+i.height:i.height;this.view.scrollTop=s-o}domFocus(){if(!this.state)throw new Error("Cannot focus when state is undefined");this.container.focus()}focusedLast(){return this.state?this.view.getHTMLElement().classList.contains("sticky-scroll-focused"):!1}removeFocus(){this.focusedIndex!==-1&&(this.toggleElementFocus(this.elements[this.focusedIndex],!1),this.focusedIndex=-1)}setFocus(e){if(0>e)throw new Error("addFocus() can not remove focus");if(!this.state&&e>=0)throw new Error("Cannot set focus index when state is undefined");if(this.state&&e>=this.state.count)throw new Error("Cannot set focus index to an index that does not exist");const t=this.focusedIndex;t>=0&&this.toggleElementFocus(this.elements[t],!1),e>=0&&this.toggleElementFocus(this.elements[e],!0),this.focusedIndex=e}toggleElementFocus(e,t){this.toggleElementActiveFocus(e,t&&this.domHasFocus),this.toggleElementPassiveFocus(e,t)}toggleCurrentElementActiveFocus(e){this.focusedIndex!==-1&&this.toggleElementActiveFocus(this.elements[this.focusedIndex],e)}toggleElementActiveFocus(e,t){e.classList.toggle("focused",t)}toggleElementPassiveFocus(e,t){e.classList.toggle("passive-focused",t)}toggleStickyScrollFocused(e){this.view.getHTMLElement().classList.toggle("sticky-scroll-focused",e)}onFocus(){if(!this.state||this.elements.length===0)throw new Error("Cannot focus when state is undefined or elements are empty");this.domHasFocus=!0,this.toggleStickyScrollFocused(!0),this.toggleCurrentElementActiveFocus(!0),this.focusedIndex===-1&&this.setFocus(0)}onBlur(){this.domHasFocus=!1,this.toggleCurrentElementActiveFocus(!1)}dispose(){this.toggleStickyScrollFocused(!1),this._onDidChangeHasFocus.fire(!1),super.dispose()}}function G4(n){let e=Ry.Unknown;return Sj(n.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?e=Ry.Twistie:Sj(n.browserEvent.target,"monaco-tl-contents","monaco-tl-row")?e=Ry.Element:Sj(n.browserEvent.target,"monaco-tree-type-filter","monaco-list")&&(e=Ry.Filter),{browserEvent:n.browserEvent,element:n.element?n.element.element:null,target:e}}function Y2t(n){const e=IN(n.browserEvent.target);return{element:n.element?n.element.element:null,browserEvent:n.browserEvent,anchor:n.anchor,isStickyScroll:e}}function i5(n,e){e(n),n.children.forEach(t=>i5(t,e))}class _q{get nodeSet(){return this._nodeSet||(this._nodeSet=this.createNodeSet()),this._nodeSet}constructor(e,t){this.getFirstViewElementWithTrait=e,this.identityProvider=t,this.nodes=[],this._onDidChange=new fe,this.onDidChange=this._onDidChange.event}set(e,t){!t?.__forceEvent&&$r(this.nodes,e)||this._set(e,!1,t)}_set(e,t,i){if(this.nodes=[...e],this.elements=void 0,this._nodeSet=void 0,!t){const r=this;this._onDidChange.fire({get elements(){return r.get()},browserEvent:i})}}get(){return this.elements||(this.elements=this.nodes.map(e=>e.element)),[...this.elements]}getNodes(){return this.nodes}has(e){return this.nodeSet.has(e)}onDidModelSplice({insertedNodes:e,deletedNodes:t}){if(!this.identityProvider){const l=this.createNodeSet(),c=u=>l.delete(u);t.forEach(u=>i5(u,c)),this.set([...l.values()]);return}const i=new Set,r=l=>i.add(this.identityProvider.getId(l.element).toString());t.forEach(l=>i5(l,r));const s=new Map,o=l=>s.set(this.identityProvider.getId(l.element).toString(),l);e.forEach(l=>i5(l,o));const a=[];for(const l of this.nodes){const c=this.identityProvider.getId(l.element).toString();if(!i.has(c))a.push(l);else{const d=s.get(c);d&&d.visible&&a.push(d)}}if(this.nodes.length>0&&a.length===0){const l=this.getFirstViewElementWithTrait();l&&a.push(l)}this._set(a,!0)}createNodeSet(){const e=new Set;for(const t of this.nodes)e.add(t);return e}}class Z2t extends v5e{constructor(e,t,i){super(e),this.tree=t,this.stickyScrollProvider=i}onViewPointer(e){if(g5e(e.browserEvent.target)||lb(e.browserEvent.target)||AD(e.browserEvent.target)||e.browserEvent.isHandledByList)return;const t=e.element;if(!t)return super.onViewPointer(e);if(this.isSelectionRangeChangeEvent(e)||this.isSelectionSingleChangeEvent(e))return super.onViewPointer(e);const i=e.browserEvent.target,r=i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&e.browserEvent.offsetX<16,s=wI(e.browserEvent.target);let o=!1;if(s?o=!0:typeof this.tree.expandOnlyOnTwistieClick=="function"?o=this.tree.expandOnlyOnTwistieClick(t.element):o=!!this.tree.expandOnlyOnTwistieClick,s)this.handleStickyScrollMouseEvent(e,t);else{if(o&&!r&&e.browserEvent.detail!==2)return super.onViewPointer(e);if(!this.tree.expandOnDoubleClick&&e.browserEvent.detail===2)return super.onViewPointer(e)}if(t.collapsible&&(!s||r)){const a=this.tree.getNodeLocation(t),l=e.browserEvent.altKey;if(this.tree.setFocus([a]),this.tree.toggleCollapsed(a,l),r){e.browserEvent.isHandledByList=!0;return}}s||super.onViewPointer(e)}handleStickyScrollMouseEvent(e,t){if(ekt(e.browserEvent.target)||tkt(e.browserEvent.target))return;const i=this.stickyScrollProvider();if(!i)throw new Error("Sticky scroll controller not found");const r=this.list.indexOf(t),s=this.list.getElementTop(r),o=i.nodePositionTopBelowWidget(t);this.tree.scrollTop=s-o,this.list.domFocus(),this.list.setFocus([r]),this.list.setSelection([r])}onDoubleClick(e){e.browserEvent.target.classList.contains("monaco-tl-twistie")||!this.tree.expandOnDoubleClick||e.browserEvent.isHandledByList||super.onDoubleClick(e)}onMouseDown(e){const t=e.browserEvent.target;if(!IN(t)&&!wI(t)){super.onMouseDown(e);return}}onContextMenu(e){const t=e.browserEvent.target;if(!IN(t)&&!wI(t)){super.onContextMenu(e);return}}}class X2t extends dd{constructor(e,t,i,r,s,o,a,l){super(e,t,i,r,l),this.focusTrait=s,this.selectionTrait=o,this.anchorTrait=a}createMouseController(e){return new Z2t(this,e.tree,e.stickyScrollProvider)}splice(e,t,i=[]){if(super.splice(e,t,i),i.length===0)return;const r=[],s=[];let o;i.forEach((a,l)=>{this.focusTrait.has(a)&&r.push(e+l),this.selectionTrait.has(a)&&s.push(e+l),this.anchorTrait.has(a)&&(o=e+l)}),r.length>0&&super.setFocus(j_([...super.getFocus(),...r])),s.length>0&&super.setSelection(j_([...super.getSelection(),...s])),typeof o=="number"&&super.setAnchor(o)}setFocus(e,t,i=!1){super.setFocus(e,t),i||this.focusTrait.set(e.map(r=>this.element(r)),t)}setSelection(e,t,i=!1){super.setSelection(e,t),i||this.selectionTrait.set(e.map(r=>this.element(r)),t)}setAnchor(e,t=!1){super.setAnchor(e),t||(typeof e>"u"?this.anchorTrait.set([]):this.anchorTrait.set([this.element(e)]))}}class _6e{get onDidScroll(){return this.view.onDidScroll}get onDidChangeFocus(){return this.eventBufferer.wrapEvent(this.focus.onDidChange)}get onDidChangeSelection(){return this.eventBufferer.wrapEvent(this.selection.onDidChange)}get onMouseDblClick(){return Ge.filter(Ge.map(this.view.onMouseDblClick,G4),e=>e.target!==Ry.Filter)}get onMouseOver(){return Ge.map(this.view.onMouseOver,G4)}get onMouseOut(){return Ge.map(this.view.onMouseOut,G4)}get onContextMenu(){return Ge.any(Ge.filter(Ge.map(this.view.onContextMenu,Y2t),e=>!e.isStickyScroll),this.stickyScrollController?.onContextMenu??Ge.None)}get onPointer(){return Ge.map(this.view.onPointer,G4)}get onKeyDown(){return this.view.onKeyDown}get onDidFocus(){return this.view.onDidFocus}get onDidChangeModel(){return Ge.signal(this.model.onDidSplice)}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get findMode(){return this.findController?.mode??__.Highlight}set findMode(e){this.findController&&(this.findController.mode=e)}get findMatchType(){return this.findController?.matchType??$w.Fuzzy}set findMatchType(e){this.findController&&(this.findController.matchType=e)}get expandOnDoubleClick(){return typeof this._options.expandOnDoubleClick>"u"?!0:this._options.expandOnDoubleClick}get expandOnlyOnTwistieClick(){return typeof this._options.expandOnlyOnTwistieClick>"u"?!0:this._options.expandOnlyOnTwistieClick}get onDidDispose(){return this.view.onDidDispose}constructor(e,t,i,r,s={}){this._user=e,this._options=s,this.eventBufferer=new UP,this.onDidChangeFindOpenState=Ge.None,this.onDidChangeStickyScrollFocused=Ge.None,this.disposables=new ke,this._onWillRefilter=new fe,this.onWillRefilter=this._onWillRefilter.event,this._onDidUpdateOptions=new fe,this.treeDelegate=new ace(i);const o=new Ove,a=new Ove,l=this.disposables.add(new H2t(a.event)),c=new Xae;this.renderers=r.map(g=>new q8(g,()=>this.model,o.event,l,c,s));for(const g of this.renderers)this.disposables.add(g);let u;s.keyboardNavigationLabelProvider&&(u=new V2t(this,s.keyboardNavigationLabelProvider,s.filter),s={...s,filter:u},this.disposables.add(u)),this.focus=new _q(()=>this.view.getFocusedElements()[0],s.identityProvider),this.selection=new _q(()=>this.view.getSelectedElements()[0],s.identityProvider),this.anchor=new _q(()=>this.view.getAnchorElement(),s.identityProvider),this.view=new X2t(e,t,this.treeDelegate,this.renderers,this.focus,this.selection,this.anchor,{...W2t(()=>this.model,s),tree:this,stickyScrollProvider:()=>this.stickyScrollController}),this.model=this.createModel(e,this.view,s),o.input=this.model.onDidChangeCollapseState;const d=Ge.forEach(this.model.onDidSplice,g=>{this.eventBufferer.bufferEvents(()=>{this.focus.onDidModelSplice(g),this.selection.onDidModelSplice(g)})},this.disposables);d(()=>null,null,this.disposables);const h=this.disposables.add(new fe),f=this.disposables.add(new Qd(0));if(this.disposables.add(Ge.any(d,this.focus.onDidChange,this.selection.onDidChange)(()=>{f.trigger(()=>{const g=new Set;for(const p of this.focus.getNodes())g.add(p);for(const p of this.selection.getNodes())g.add(p);h.fire([...g.values()])})})),a.input=h.event,s.keyboardSupport!==!1){const g=Ge.chain(this.view.onKeyDown,p=>p.filter(m=>!lb(m.target)).map(m=>new or(m)));Ge.chain(g,p=>p.filter(m=>m.keyCode===15))(this.onLeftArrow,this,this.disposables),Ge.chain(g,p=>p.filter(m=>m.keyCode===17))(this.onRightArrow,this,this.disposables),Ge.chain(g,p=>p.filter(m=>m.keyCode===10))(this.onSpace,this,this.disposables)}if((s.findWidgetEnabled??!0)&&s.keyboardNavigationLabelProvider&&s.contextViewProvider){const g=this.options.findWidgetStyles?{styles:this.options.findWidgetStyles}:void 0;this.findController=new z2t(this,this.model,this.view,u,s.contextViewProvider,g),this.focusNavigationFilter=p=>this.findController.shouldAllowFocus(p),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.disposables.add(this.findController),this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindMode=Ge.None,this.onDidChangeFindMatchType=Ge.None;s.enableStickyScroll&&(this.stickyScrollController=new Aye(this,this.model,this.view,this.renderers,this.treeDelegate,s),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus),this.styleElement=id(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===yE.Always)}updateOptions(e={}){this._options={...this._options,...e};for(const t of this.renderers)t.updateOptions(e);this.view.updateOptions(this._options),this.findController?.updateOptions(e),this.updateStickyScroll(e),this._onDidUpdateOptions.fire(this._options),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===yE.Always)}get options(){return this._options}updateStickyScroll(e){!this.stickyScrollController&&this._options.enableStickyScroll?(this.stickyScrollController=new Aye(this,this.model,this.view,this.renderers,this.treeDelegate,this._options),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus):this.stickyScrollController&&!this._options.enableStickyScroll&&(this.onDidChangeStickyScrollFocused=Ge.None,this.stickyScrollController.dispose(),this.stickyScrollController=void 0),this.stickyScrollController?.updateOptions(e)}getHTMLElement(){return this.view.getHTMLElement()}get scrollTop(){return this.view.scrollTop}set scrollTop(e){this.view.scrollTop=e}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get ariaLabel(){return this.view.ariaLabel}set ariaLabel(e){this.view.ariaLabel=e}domFocus(){this.stickyScrollController?.focusedLast()?this.stickyScrollController.domFocus():this.view.domFocus()}layout(e,t){this.view.layout(e,t),yb(t)&&this.findController?.layout(t)}style(e){const t=`.${this.view.domId}`,i=[];e.treeIndentGuidesStroke&&(i.push(`.monaco-list${t}:hover .monaco-tl-indent > .indent-guide, .monaco-list${t}.always .monaco-tl-indent > .indent-guide { border-color: ${e.treeInactiveIndentGuidesStroke}; }`),i.push(`.monaco-list${t} .monaco-tl-indent > .indent-guide.active { border-color: ${e.treeIndentGuidesStroke}; }`));const r=e.treeStickyScrollBackground??e.listBackground;r&&(i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${r}; }`),i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${r}; }`)),e.treeStickyScrollBorder&&i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${e.treeStickyScrollBorder}; }`),e.treeStickyScrollShadow&&i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${e.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`),e.listFocusForeground&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`));const s=A_(e.listFocusAndSelectionOutline,A_(e.listSelectionOutline,e.listFocusOutline??""));s&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${s}; outline-offset: -1px;}`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`)),e.listFocusOutline&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`),i.push(`.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }`),i.push(`.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`),i.push(`.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`)),this.styleElement.textContent=i.join(` -`),this.view.style(e)}getParentElement(e){const t=this.model.getParentNodeLocation(e);return this.model.getNode(t).element}getFirstElementChild(e){return this.model.getFirstElementChild(e)}getNode(e){return this.model.getNode(e)}getNodeLocation(e){return this.model.getNodeLocation(e)}collapse(e,t=!1){return this.model.setCollapsed(e,!0,t)}expand(e,t=!1){return this.model.setCollapsed(e,!1,t)}toggleCollapsed(e,t=!1){return this.model.setCollapsed(e,void 0,t)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}refilter(){this._onWillRefilter.fire(void 0),this.model.refilter()}setSelection(e,t){this.eventBufferer.bufferEvents(()=>{const i=e.map(s=>this.model.getNode(s));this.selection.set(i,t);const r=e.map(s=>this.model.getListIndex(s)).filter(s=>s>-1);this.view.setSelection(r,t,!0)})}getSelection(){return this.selection.get()}setFocus(e,t){this.eventBufferer.bufferEvents(()=>{const i=e.map(s=>this.model.getNode(s));this.focus.set(i,t);const r=e.map(s=>this.model.getListIndex(s)).filter(s=>s>-1);this.view.setFocus(r,t,!0)})}focusNext(e=1,t=!1,i,r=Jm(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusNext(e,t,i,r)}focusPrevious(e=1,t=!1,i,r=Jm(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusPrevious(e,t,i,r)}focusNextPage(e,t=Jm(e)&&e.altKey?void 0:this.focusNavigationFilter){return this.view.focusNextPage(e,t)}focusPreviousPage(e,t=Jm(e)&&e.altKey?void 0:this.focusNavigationFilter){return this.view.focusPreviousPage(e,t,()=>this.stickyScrollController?.height??0)}focusLast(e,t=Jm(e)&&e.altKey?void 0:this.focusNavigationFilter){this.view.focusLast(e,t)}focusFirst(e,t=Jm(e)&&e.altKey?void 0:this.focusNavigationFilter){this.view.focusFirst(e,t)}getFocus(){return this.focus.get()}reveal(e,t){this.model.expandTo(e);const i=this.model.getListIndex(e);if(i!==-1)if(!this.stickyScrollController)this.view.reveal(i,t);else{const r=this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(e));this.view.reveal(i,t,r)}}onLeftArrow(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],r=this.model.getNodeLocation(i);if(!this.model.setCollapsed(r,!0)){const o=this.model.getParentNodeLocation(r);if(!o)return;const a=this.model.getListIndex(o);this.view.reveal(a),this.view.setFocus([a])}}onRightArrow(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],r=this.model.getNodeLocation(i);if(!this.model.setCollapsed(r,!1)){if(!i.children.some(l=>l.visible))return;const[o]=this.view.getFocus(),a=o+1;this.view.reveal(a),this.view.setFocus([a])}}onSpace(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],r=this.model.getNodeLocation(i),s=e.browserEvent.altKey;this.model.setCollapsed(r,void 0,s)}dispose(){er(this.disposables),this.stickyScrollController?.dispose(),this.view.dispose()}}class lce{constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.nodesByIdentity=new Map,this.model=new F2t(e,t,null,i),this.onDidSplice=this.model.onDidSplice,this.onDidChangeCollapseState=this.model.onDidChangeCollapseState,this.onDidChangeRenderNodeCount=this.model.onDidChangeRenderNodeCount,i.sorter&&(this.sorter={compare(r,s){return i.sorter.compare(r.element,s.element)}}),this.identityProvider=i.identityProvider}setChildren(e,t=zn.empty(),i={}){const r=this.getElementLocation(e);this._setChildren(r,this.preserveCollapseState(t),i)}_setChildren(e,t=zn.empty(),i){const r=new Set,s=new Set,o=l=>{if(l.element===null)return;const c=l;if(r.add(c.element),this.nodes.set(c.element,c),this.identityProvider){const u=this.identityProvider.getId(c.element).toString();s.add(u),this.nodesByIdentity.set(u,c)}i.onDidCreateNode?.(c)},a=l=>{if(l.element===null)return;const c=l;if(r.has(c.element)||this.nodes.delete(c.element),this.identityProvider){const u=this.identityProvider.getId(c.element).toString();s.has(u)||this.nodesByIdentity.delete(u)}i.onDidDeleteNode?.(c)};this.model.splice([...e,0],Number.MAX_VALUE,t,{...i,onDidCreateNode:o,onDidDeleteNode:a})}preserveCollapseState(e=zn.empty()){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),zn.map(e,t=>{let i=this.nodes.get(t.element);if(!i&&this.identityProvider){const o=this.identityProvider.getId(t.element).toString();i=this.nodesByIdentity.get(o)}if(!i){let o;return typeof t.collapsed>"u"?o=void 0:t.collapsed===Ru.Collapsed||t.collapsed===Ru.PreserveOrCollapsed?o=!0:t.collapsed===Ru.Expanded||t.collapsed===Ru.PreserveOrExpanded?o=!1:o=!!t.collapsed,{...t,children:this.preserveCollapseState(t.children),collapsed:o}}const r=typeof t.collapsible=="boolean"?t.collapsible:i.collapsible;let s;return typeof t.collapsed>"u"||t.collapsed===Ru.PreserveOrCollapsed||t.collapsed===Ru.PreserveOrExpanded?s=i.collapsed:t.collapsed===Ru.Collapsed?s=!0:t.collapsed===Ru.Expanded?s=!1:s=!!t.collapsed,{...t,collapsible:r,collapsed:s,children:this.preserveCollapseState(t.children)}})}rerender(e){const t=this.getElementLocation(e);this.model.rerender(t)}getFirstElementChild(e=null){const t=this.getElementLocation(e);return this.model.getFirstElementChild(t)}has(e){return this.nodes.has(e)}getListIndex(e){const t=this.getElementLocation(e);return this.model.getListIndex(t)}getListRenderCount(e){const t=this.getElementLocation(e);return this.model.getListRenderCount(t)}isCollapsible(e){const t=this.getElementLocation(e);return this.model.isCollapsible(t)}setCollapsible(e,t){const i=this.getElementLocation(e);return this.model.setCollapsible(i,t)}isCollapsed(e){const t=this.getElementLocation(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){const r=this.getElementLocation(e);return this.model.setCollapsed(r,t,i)}expandTo(e){const t=this.getElementLocation(e);this.model.expandTo(t)}refilter(){this.model.refilter()}getNode(e=null){if(e===null)return this.model.getNode(this.model.rootRef);const t=this.nodes.get(e);if(!t)throw new Wu(this.user,`Tree element not found: ${e}`);return t}getNodeLocation(e){return e.element}getParentNodeLocation(e){if(e===null)throw new Wu(this.user,"Invalid getParentNodeLocation call");const t=this.nodes.get(e);if(!t)throw new Wu(this.user,`Tree element not found: ${e}`);const i=this.model.getNodeLocation(t),r=this.model.getParentNodeLocation(i);return this.model.getNode(r).element}getElementLocation(e){if(e===null)return[];const t=this.nodes.get(e);if(!t)throw new Wu(this.user,`Tree element not found: ${e}`);return this.model.getNodeLocation(t)}}function r5(n){const e=[n.element],t=n.incompressible||!1;return{element:{elements:e,incompressible:t},children:zn.map(zn.from(n.children),r5),collapsible:n.collapsible,collapsed:n.collapsed}}function s5(n){const e=[n.element],t=n.incompressible||!1;let i,r;for(;[r,i]=zn.consume(zn.from(n.children),2),!(r.length!==1||r[0].incompressible);)n=r[0],e.push(n.element);return{element:{elements:e,incompressible:t},children:zn.map(zn.concat(r,i),s5),collapsible:n.collapsible,collapsed:n.collapsed}}function ZQ(n,e=0){let t;return eZQ(i,0)),e===0&&n.element.incompressible?{element:n.element.elements[e],children:t,incompressible:!0,collapsible:n.collapsible,collapsed:n.collapsed}:{element:n.element.elements[e],children:t,collapsible:n.collapsible,collapsed:n.collapsed}}function Nye(n){return ZQ(n,0)}function v6e(n,e,t){return n.element===e?{...n,children:t}:{...n,children:zn.map(zn.from(n.children),i=>v6e(i,e,t))}}const Q2t=n=>({getId(e){return e.elements.map(t=>n.getId(t).toString()).join("\0")}});class J2t{get onDidSplice(){return this.model.onDidSplice}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.model=new lce(e,t,i),this.enabled=typeof i.compressionEnabled>"u"?!0:i.compressionEnabled,this.identityProvider=i.identityProvider}setChildren(e,t=zn.empty(),i){const r=i.diffIdentityProvider&&Q2t(i.diffIdentityProvider);if(e===null){const g=zn.map(t,this.enabled?s5:r5);this._setChildren(null,g,{diffIdentityProvider:r,diffDepth:1/0});return}const s=this.nodes.get(e);if(!s)throw new Wu(this.user,"Unknown compressed tree node");const o=this.model.getNode(s),a=this.model.getParentNodeLocation(s),l=this.model.getNode(a),c=Nye(o),u=v6e(c,e,t),d=(this.enabled?s5:r5)(u),h=i.diffIdentityProvider?(g,p)=>i.diffIdentityProvider.getId(g)===i.diffIdentityProvider.getId(p):void 0;if($r(d.element.elements,o.element.elements,h)){this._setChildren(s,d.children||zn.empty(),{diffIdentityProvider:r,diffDepth:1});return}const f=l.children.map(g=>g===o?d:g);this._setChildren(l.element,f,{diffIdentityProvider:r,diffDepth:o.depth-l.depth})}isCompressionEnabled(){return this.enabled}setCompressionEnabled(e){if(e===this.enabled)return;this.enabled=e;const i=this.model.getNode().children,r=zn.map(i,Nye),s=zn.map(r,e?s5:r5);this._setChildren(null,s,{diffIdentityProvider:this.identityProvider,diffDepth:1/0})}_setChildren(e,t,i){const r=new Set,s=a=>{for(const l of a.element.elements)r.add(l),this.nodes.set(l,a.element)},o=a=>{for(const l of a.element.elements)r.has(l)||this.nodes.delete(l)};this.model.setChildren(e,t,{...i,onDidCreateNode:s,onDidDeleteNode:o})}has(e){return this.nodes.has(e)}getListIndex(e){const t=this.getCompressedNode(e);return this.model.getListIndex(t)}getListRenderCount(e){const t=this.getCompressedNode(e);return this.model.getListRenderCount(t)}getNode(e){if(typeof e>"u")return this.model.getNode();const t=this.getCompressedNode(e);return this.model.getNode(t)}getNodeLocation(e){const t=this.model.getNodeLocation(e);return t===null?null:t.elements[t.elements.length-1]}getParentNodeLocation(e){const t=this.getCompressedNode(e),i=this.model.getParentNodeLocation(t);return i===null?null:i.elements[i.elements.length-1]}getFirstElementChild(e){const t=this.getCompressedNode(e);return this.model.getFirstElementChild(t)}isCollapsible(e){const t=this.getCompressedNode(e);return this.model.isCollapsible(t)}setCollapsible(e,t){const i=this.getCompressedNode(e);return this.model.setCollapsible(i,t)}isCollapsed(e){const t=this.getCompressedNode(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){const r=this.getCompressedNode(e);return this.model.setCollapsed(r,t,i)}expandTo(e){const t=this.getCompressedNode(e);this.model.expandTo(t)}rerender(e){const t=this.getCompressedNode(e);this.model.rerender(t)}refilter(){this.model.refilter()}getCompressedNode(e){if(e===null)return null;const t=this.nodes.get(e);if(!t)throw new Wu(this.user,`Tree element not found: ${e}`);return t}}const eTt=n=>n[n.length-1];class cce{get element(){return this.node.element===null?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map(e=>new cce(this.unwrapper,e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e,t){this.unwrapper=e,this.node=t}}function tTt(n,e){return{splice(t,i,r){e.splice(t,i,r.map(s=>n.map(s)))},updateElementHeight(t,i){e.updateElementHeight(t,i)}}}function nTt(n,e){return{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(n(t))}},sorter:e.sorter&&{compare(t,i){return e.sorter.compare(t.elements[0],i.elements[0])}},filter:e.filter&&{filter(t,i){return e.filter.filter(n(t),i)}}}}class iTt{get onDidSplice(){return Ge.map(this.model.onDidSplice,({insertedNodes:e,deletedNodes:t})=>({insertedNodes:e.map(i=>this.nodeMapper.map(i)),deletedNodes:t.map(i=>this.nodeMapper.map(i))}))}get onDidChangeCollapseState(){return Ge.map(this.model.onDidChangeCollapseState,({node:e,deep:t})=>({node:this.nodeMapper.map(e),deep:t}))}get onDidChangeRenderNodeCount(){return Ge.map(this.model.onDidChangeRenderNodeCount,e=>this.nodeMapper.map(e))}constructor(e,t,i={}){this.rootRef=null,this.elementMapper=i.elementMapper||eTt;const r=s=>this.elementMapper(s.elements);this.nodeMapper=new sce(s=>new cce(r,s)),this.model=new J2t(e,tTt(this.nodeMapper,t),nTt(r,i))}setChildren(e,t=zn.empty(),i={}){this.model.setChildren(e,t,i)}isCompressionEnabled(){return this.model.isCompressionEnabled()}setCompressionEnabled(e){this.model.setCompressionEnabled(e)}has(e){return this.model.has(e)}getListIndex(e){return this.model.getListIndex(e)}getListRenderCount(e){return this.model.getListRenderCount(e)}getNode(e){return this.nodeMapper.map(this.model.getNode(e))}getNodeLocation(e){return e.element}getParentNodeLocation(e){return this.model.getParentNodeLocation(e)}getFirstElementChild(e){const t=this.model.getFirstElementChild(e);return t===null||typeof t>"u"?t:this.elementMapper(t.elements)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}setCollapsed(e,t,i){return this.model.setCollapsed(e,t,i)}expandTo(e){return this.model.expandTo(e)}rerender(e){return this.model.rerender(e)}refilter(){return this.model.refilter()}getCompressedTreeNode(e=null){return this.model.getNode(e)}}var rTt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};class uce extends _6e{get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}constructor(e,t,i,r,s={}){super(e,t,i,r,s),this.user=e}setChildren(e,t=zn.empty(),i){this.model.setChildren(e,t,i)}rerender(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}hasElement(e){return this.model.has(e)}createModel(e,t,i){return new lce(e,t,i)}}class b6e{get compressedTreeNodeProvider(){return this._compressedTreeNodeProvider()}constructor(e,t,i){this._compressedTreeNodeProvider=e,this.stickyScrollDelegate=t,this.renderer=i,this.templateId=i.templateId,i.onDidChangeTwistieState&&(this.onDidChangeTwistieState=i.onDidChangeTwistieState)}renderTemplate(e){return{compressedTreeNode:void 0,data:this.renderer.renderTemplate(e)}}renderElement(e,t,i,r){let s=this.stickyScrollDelegate.getCompressedNode(e);s||(s=this.compressedTreeNodeProvider.getCompressedTreeNode(e.element)),s.element.elements.length===1?(i.compressedTreeNode=void 0,this.renderer.renderElement(e,t,i.data,r)):(i.compressedTreeNode=s,this.renderer.renderCompressedElements(s,t,i.data,r))}disposeElement(e,t,i,r){i.compressedTreeNode?this.renderer.disposeCompressedElements?.(i.compressedTreeNode,t,i.data,r):this.renderer.disposeElement?.(e,t,i.data,r)}disposeTemplate(e){this.renderer.disposeTemplate(e.data)}renderTwistie(e,t){return this.renderer.renderTwistie?this.renderer.renderTwistie(e,t):!1}}rTt([Ds],b6e.prototype,"compressedTreeNodeProvider",null);class sTt{constructor(e){this.modelProvider=e,this.compressedStickyNodes=new Map}getCompressedNode(e){return this.compressedStickyNodes.get(e)}constrainStickyScrollNodes(e,t,i){if(this.compressedStickyNodes.clear(),e.length===0)return[];for(let r=0;ri||r>=t-1&&tthis,a=new sTt(()=>this.model),l=r.map(c=>new b6e(o,a,c));super(e,t,i,l,{...oTt(o,s),stickyScrollDelegate:a})}setChildren(e,t=zn.empty(),i){this.model.setChildren(e,t,i)}createModel(e,t,i){return new iTt(e,t,i)}updateOptions(e={}){super.updateOptions(e),typeof e.compressionEnabled<"u"&&this.model.setCompressionEnabled(e.compressionEnabled)}getCompressedTreeNode(e=null){return this.model.getCompressedTreeNode(e)}}function vq(n){return{...n,children:[],refreshPromise:void 0,stale:!0,slow:!1,forceExpanded:!1}}function XQ(n,e){return e.parent?e.parent===n?!0:XQ(n,e.parent):!1}function aTt(n,e){return n===e||XQ(n,e)||XQ(e,n)}class dce{get element(){return this.node.element.element}get children(){return this.node.children.map(e=>new dce(e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e){this.node=e}}class lTt{constructor(e,t,i){this.renderer=e,this.nodeMapper=t,this.onDidChangeTwistieState=i,this.renderedNodes=new Map,this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,r){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,r)}renderTwistie(e,t){return e.slow?(t.classList.add(...zt.asClassNameArray(ze.treeItemLoading)),!0):(t.classList.remove(...zt.asClassNameArray(ze.treeItemLoading)),!1)}disposeElement(e,t,i,r){this.renderer.disposeElement?.(this.nodeMapper.map(e),t,i.templateData,r)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear()}}function Rye(n){return{browserEvent:n.browserEvent,elements:n.elements.map(e=>e.element)}}function Pye(n){return{browserEvent:n.browserEvent,element:n.element&&n.element.element,target:n.target}}class cTt extends uO{constructor(e){super(e.elements.map(t=>t.element)),this.data=e}}function bq(n){return n instanceof uO?new cTt(n):n}class uTt{constructor(e){this.dnd=e}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map(i=>i.element),t)}onDragStart(e,t){this.dnd.onDragStart?.(bq(e),t)}onDragOver(e,t,i,r,s,o=!0){return this.dnd.onDragOver(bq(e),t&&t.element,i,r,s)}drop(e,t,i,r,s){this.dnd.drop(bq(e),t&&t.element,i,r,s)}onDragEnd(e){this.dnd.onDragEnd?.(e)}dispose(){this.dnd.dispose()}}function w6e(n){return n&&{...n,collapseByDefault:!0,identityProvider:n.identityProvider&&{getId(e){return n.identityProvider.getId(e.element)}},dnd:n.dnd&&new uTt(n.dnd),multipleSelectionController:n.multipleSelectionController&&{isSelectionSingleChangeEvent(e){return n.multipleSelectionController.isSelectionSingleChangeEvent({...e,element:e.element})},isSelectionRangeChangeEvent(e){return n.multipleSelectionController.isSelectionRangeChangeEvent({...e,element:e.element})}},accessibilityProvider:n.accessibilityProvider&&{...n.accessibilityProvider,getPosInSet:void 0,getSetSize:void 0,getRole:n.accessibilityProvider.getRole?e=>n.accessibilityProvider.getRole(e.element):()=>"treeitem",isChecked:n.accessibilityProvider.isChecked?e=>!!n.accessibilityProvider?.isChecked(e.element):void 0,getAriaLabel(e){return n.accessibilityProvider.getAriaLabel(e.element)},getWidgetAriaLabel(){return n.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:n.accessibilityProvider.getWidgetRole?()=>n.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:n.accessibilityProvider.getAriaLevel&&(e=>n.accessibilityProvider.getAriaLevel(e.element)),getActiveDescendantId:n.accessibilityProvider.getActiveDescendantId&&(e=>n.accessibilityProvider.getActiveDescendantId(e.element))},filter:n.filter&&{filter(e,t){return n.filter.filter(e.element,t)}},keyboardNavigationLabelProvider:n.keyboardNavigationLabelProvider&&{...n.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(e){return n.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element)}},sorter:void 0,expandOnlyOnTwistieClick:typeof n.expandOnlyOnTwistieClick>"u"?void 0:typeof n.expandOnlyOnTwistieClick!="function"?n.expandOnlyOnTwistieClick:e=>n.expandOnlyOnTwistieClick(e.element),defaultFindVisibility:e=>e.hasChildren&&e.stale?1:typeof n.defaultFindVisibility=="number"?n.defaultFindVisibility:typeof n.defaultFindVisibility>"u"?2:n.defaultFindVisibility(e.element)}}function QQ(n,e){e(n),n.children.forEach(t=>QQ(t,e))}class C6e{get onDidScroll(){return this.tree.onDidScroll}get onDidChangeFocus(){return Ge.map(this.tree.onDidChangeFocus,Rye)}get onDidChangeSelection(){return Ge.map(this.tree.onDidChangeSelection,Rye)}get onMouseDblClick(){return Ge.map(this.tree.onMouseDblClick,Pye)}get onPointer(){return Ge.map(this.tree.onPointer,Pye)}get onDidFocus(){return this.tree.onDidFocus}get onDidChangeModel(){return this.tree.onDidChangeModel}get onDidChangeCollapseState(){return this.tree.onDidChangeCollapseState}get onDidChangeFindOpenState(){return this.tree.onDidChangeFindOpenState}get onDidChangeStickyScrollFocused(){return this.tree.onDidChangeStickyScrollFocused}get onDidDispose(){return this.tree.onDidDispose}constructor(e,t,i,r,s,o={}){this.user=e,this.dataSource=s,this.nodes=new Map,this.subTreeRefreshPromises=new Map,this.refreshPromises=new Map,this._onDidRender=new fe,this._onDidChangeNodeSlowState=new fe,this.nodeMapper=new sce(a=>new dce(a)),this.disposables=new ke,this.identityProvider=o.identityProvider,this.autoExpandSingleChildren=typeof o.autoExpandSingleChildren>"u"?!1:o.autoExpandSingleChildren,this.sorter=o.sorter,this.getDefaultCollapseState=a=>o.collapseByDefault?o.collapseByDefault(a)?Ru.PreserveOrCollapsed:Ru.PreserveOrExpanded:void 0,this.tree=this.createTree(e,t,i,r,o),this.onDidChangeFindMode=this.tree.onDidChangeFindMode,this.onDidChangeFindMatchType=this.tree.onDidChangeFindMatchType,this.root=vq({element:void 0,parent:null,hasChildren:!0,defaultCollapseState:void 0}),this.identityProvider&&(this.root={...this.root,id:null}),this.nodes.set(null,this.root),this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState,this,this.disposables)}createTree(e,t,i,r,s){const o=new ace(i),a=r.map(c=>new lTt(c,this.nodeMapper,this._onDidChangeNodeSlowState.event)),l=w6e(s)||{};return new uce(e,t,o,a,l)}updateOptions(e={}){this.tree.updateOptions(e)}getHTMLElement(){return this.tree.getHTMLElement()}get scrollTop(){return this.tree.scrollTop}set scrollTop(e){this.tree.scrollTop=e}get scrollHeight(){return this.tree.scrollHeight}get renderHeight(){return this.tree.renderHeight}domFocus(){this.tree.domFocus()}layout(e,t){this.tree.layout(e,t)}style(e){this.tree.style(e)}getInput(){return this.root.element}async setInput(e,t){this.refreshPromises.forEach(r=>r.cancel()),this.refreshPromises.clear(),this.root.element=e;const i=t&&{viewState:t,focus:[],selection:[]};await this._updateChildren(e,!0,!1,i),i&&(this.tree.setFocus(i.focus),this.tree.setSelection(i.selection)),t&&typeof t.scrollTop=="number"&&(this.scrollTop=t.scrollTop)}async _updateChildren(e=this.root.element,t=!0,i=!1,r,s){if(typeof this.root.element>"u")throw new Wu(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await Ge.toPromise(this._onDidRender.event));const o=this.getDataNode(e);if(await this.refreshAndRenderNode(o,t,r,s),i)try{this.tree.rerender(o)}catch{}}rerender(e){if(e===void 0||e===this.root.element){this.tree.rerender();return}const t=this.getDataNode(e);this.tree.rerender(t)}getNode(e=this.root.element){const t=this.getDataNode(e),i=this.tree.getNode(t===this.root?null:t);return this.nodeMapper.map(i)}collapse(e,t=!1){const i=this.getDataNode(e);return this.tree.collapse(i===this.root?null:i,t)}async expand(e,t=!1){if(typeof this.root.element>"u")throw new Wu(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await Ge.toPromise(this._onDidRender.event));const i=this.getDataNode(e);if(this.tree.hasElement(i)&&!this.tree.isCollapsible(i)||(i.refreshPromise&&(await this.root.refreshPromise,await Ge.toPromise(this._onDidRender.event)),i!==this.root&&!i.refreshPromise&&!this.tree.isCollapsed(i)))return!1;const r=this.tree.expand(i===this.root?null:i,t);return i.refreshPromise&&(await this.root.refreshPromise,await Ge.toPromise(this._onDidRender.event)),r}setSelection(e,t){const i=e.map(r=>this.getDataNode(r));this.tree.setSelection(i,t)}getSelection(){return this.tree.getSelection().map(t=>t.element)}setFocus(e,t){const i=e.map(r=>this.getDataNode(r));this.tree.setFocus(i,t)}getFocus(){return this.tree.getFocus().map(t=>t.element)}reveal(e,t){this.tree.reveal(this.getDataNode(e),t)}getParentElement(e){const t=this.tree.getParentElement(this.getDataNode(e));return t&&t.element}getFirstElementChild(e=this.root.element){const t=this.getDataNode(e),i=this.tree.getFirstElementChild(t===this.root?null:t);return i&&i.element}getDataNode(e){const t=this.nodes.get(e===this.root.element?null:e);if(!t)throw new Wu(this.user,`Data tree node not found: ${e}`);return t}async refreshAndRenderNode(e,t,i,r){await this.refreshNode(e,t,i),!this.disposables.isDisposed&&this.render(e,i,r)}async refreshNode(e,t,i){let r;if(this.subTreeRefreshPromises.forEach((s,o)=>{!r&&aTt(o,e)&&(r=s.then(()=>this.refreshNode(e,t,i)))}),r)return r;if(e!==this.root&&this.tree.getNode(e).collapsed){e.hasChildren=!!this.dataSource.hasChildren(e.element),e.stale=!0,this.setChildren(e,[],t,i);return}return this.doRefreshSubTree(e,t,i)}async doRefreshSubTree(e,t,i){let r;e.refreshPromise=new Promise(s=>r=s),this.subTreeRefreshPromises.set(e,e.refreshPromise),e.refreshPromise.finally(()=>{e.refreshPromise=void 0,this.subTreeRefreshPromises.delete(e)});try{const s=await this.doRefreshNode(e,t,i);e.stale=!1,await fX.settled(s.map(o=>this.doRefreshSubTree(o,t,i)))}finally{r()}}async doRefreshNode(e,t,i){e.hasChildren=!!this.dataSource.hasChildren(e.element);let r;if(!e.hasChildren)r=Promise.resolve(zn.empty());else{const s=this.doGetChildren(e);if(Dve(s))r=Promise.resolve(s);else{const o=Y_(800);o.then(()=>{e.slow=!0,this._onDidChangeNodeSlowState.fire(e)},a=>null),r=s.finally(()=>o.cancel())}}try{const s=await r;return this.setChildren(e,s,t,i)}catch(s){if(e!==this.root&&this.tree.hasElement(e)&&this.tree.collapse(e),uh(s))return[];throw s}finally{e.slow&&(e.slow=!1,this._onDidChangeNodeSlowState.fire(e))}}doGetChildren(e){let t=this.refreshPromises.get(e);if(t)return t;const i=this.dataSource.getChildren(e.element);return Dve(i)?this.processChildren(i):(t=ko(async()=>this.processChildren(await i)),this.refreshPromises.set(e,t),t.finally(()=>{this.refreshPromises.delete(e)}))}_onDidChangeCollapseState({node:e,deep:t}){e.element!==null&&!e.collapsed&&e.element.stale&&(t?this.collapse(e.element.element):this.refreshAndRenderNode(e.element,!1).catch(rn))}setChildren(e,t,i,r){const s=[...t];if(e.children.length===0&&s.length===0)return[];const o=new Map,a=new Map;for(const u of e.children)o.set(u.element,u),this.identityProvider&&a.set(u.id,{node:u,collapsed:this.tree.hasElement(u)&&this.tree.isCollapsed(u)});const l=[],c=s.map(u=>{const d=!!this.dataSource.hasChildren(u);if(!this.identityProvider){const p=vq({element:u,parent:e,hasChildren:d,defaultCollapseState:this.getDefaultCollapseState(u)});return d&&p.defaultCollapseState===Ru.PreserveOrExpanded&&l.push(p),p}const h=this.identityProvider.getId(u).toString(),f=a.get(h);if(f){const p=f.node;return o.delete(p.element),this.nodes.delete(p.element),this.nodes.set(u,p),p.element=u,p.hasChildren=d,i?f.collapsed?(p.children.forEach(m=>QQ(m,_=>this.nodes.delete(_.element))),p.children.splice(0,p.children.length),p.stale=!0):l.push(p):d&&!f.collapsed&&l.push(p),p}const g=vq({element:u,parent:e,id:h,hasChildren:d,defaultCollapseState:this.getDefaultCollapseState(u)});return r&&r.viewState.focus&&r.viewState.focus.indexOf(h)>-1&&r.focus.push(g),r&&r.viewState.selection&&r.viewState.selection.indexOf(h)>-1&&r.selection.push(g),(r&&r.viewState.expanded&&r.viewState.expanded.indexOf(h)>-1||d&&g.defaultCollapseState===Ru.PreserveOrExpanded)&&l.push(g),g});for(const u of o.values())QQ(u,d=>this.nodes.delete(d.element));for(const u of c)this.nodes.set(u.element,u);return e.children.splice(0,e.children.length,...c),e!==this.root&&this.autoExpandSingleChildren&&c.length===1&&l.length===0&&(c[0].forceExpanded=!0,l.push(c[0])),l}render(e,t,i){const r=e.children.map(o=>this.asTreeElement(o,t)),s=i&&{...i,diffIdentityProvider:i.diffIdentityProvider&&{getId(o){return i.diffIdentityProvider.getId(o.element)}}};this.tree.setChildren(e===this.root?null:e,r,s),e!==this.root&&this.tree.setCollapsible(e,e.hasChildren),this._onDidRender.fire()}asTreeElement(e,t){if(e.stale)return{element:e,collapsible:e.hasChildren,collapsed:!0};let i;return t&&t.viewState.expanded&&e.id&&t.viewState.expanded.indexOf(e.id)>-1?i=!1:e.forceExpanded?(i=!1,e.forceExpanded=!1):i=e.defaultCollapseState,{element:e,children:e.hasChildren?zn.map(e.children,r=>this.asTreeElement(r,t)):[],collapsible:e.hasChildren,collapsed:i}}processChildren(e){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),e}dispose(){this.disposables.dispose(),this.tree.dispose()}}class hce{get element(){return{elements:this.node.element.elements.map(e=>e.element),incompressible:this.node.element.incompressible}}get children(){return this.node.children.map(e=>new hce(e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e){this.node=e}}class dTt{constructor(e,t,i,r){this.renderer=e,this.nodeMapper=t,this.compressibleNodeMapperProvider=i,this.onDidChangeTwistieState=r,this.renderedNodes=new Map,this.disposables=[],this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,r){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,r)}renderCompressedElements(e,t,i,r){this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(e),t,i.templateData,r)}renderTwistie(e,t){return e.slow?(t.classList.add(...zt.asClassNameArray(ze.treeItemLoading)),!0):(t.classList.remove(...zt.asClassNameArray(ze.treeItemLoading)),!1)}disposeElement(e,t,i,r){this.renderer.disposeElement?.(this.nodeMapper.map(e),t,i.templateData,r)}disposeCompressedElements(e,t,i,r){this.renderer.disposeCompressedElements?.(this.compressibleNodeMapperProvider().map(e),t,i.templateData,r)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear(),this.disposables=er(this.disposables)}}function hTt(n){const e=n&&w6e(n);return e&&{...e,keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getCompressedNodeKeyboardNavigationLabel(t){return n.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(t.map(i=>i.element))}}}}class fTt extends C6e{constructor(e,t,i,r,s,o,a={}){super(e,t,i,s,o,a),this.compressionDelegate=r,this.compressibleNodeMapper=new sce(l=>new hce(l)),this.filter=a.filter}createTree(e,t,i,r,s){const o=new ace(i),a=r.map(c=>new dTt(c,this.nodeMapper,()=>this.compressibleNodeMapper,this._onDidChangeNodeSlowState.event)),l=hTt(s)||{};return new y6e(e,t,o,a,l)}asTreeElement(e,t){return{incompressible:this.compressionDelegate.isIncompressible(e.element),...super.asTreeElement(e,t)}}updateOptions(e={}){this.tree.updateOptions(e)}render(e,t,i){if(!this.identityProvider)return super.render(e,t);const r=f=>this.identityProvider.getId(f).toString(),s=f=>{const g=new Set;for(const p of f){const m=this.tree.getCompressedTreeNode(p===this.root?null:p);if(m.element)for(const _ of m.element.elements)g.add(r(_.element))}return g},o=s(this.tree.getSelection()),a=s(this.tree.getFocus());super.render(e,t,i);const l=this.getSelection();let c=!1;const u=this.getFocus();let d=!1;const h=f=>{const g=f.element;if(g)for(let p=0;p{const i=this.filter.filter(t,1),r=gTt(i);if(r===2)throw new Error("Recursive tree visibility not supported in async data compressed trees");return r===1})),super.processChildren(e)}}function gTt(n){return typeof n=="boolean"?n?1:0:oce(n)?MN(n.visibility):MN(n)}class pTt extends _6e{constructor(e,t,i,r,s,o={}){super(e,t,i,r,o),this.user=e,this.dataSource=s,this.identityProvider=o.identityProvider}createModel(e,t,i){return new lce(e,t,i)}}new et("isMac",Rn,w("isMac","Whether the operating system is macOS"));new et("isLinux",zl,w("isLinux","Whether the operating system is Linux"));const AW=new et("isWindows",Ta,w("isWindows","Whether the operating system is Windows")),x6e=new et("isWeb",pC,w("isWeb","Whether the platform is a web browser"));new et("isMacNative",Rn&&!pC,w("isMacNative","Whether the operating system is macOS on a non-browser platform"));new et("isIOS",Sg,w("isIOS","Whether the operating system is iOS"));new et("isMobile",p4e,w("isMobile","Whether the platform is a mobile web browser"));new et("isDevelopment",!1,!0);new et("productQualityType","",w("productQualityType","Quality type of VS Code"));const S6e="inputFocus",k6e=new et(S6e,!1,w("inputFocus","Whether keyboard focus is inside an input box"));var v0=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},xr=function(n,e){return function(t,i){e(t,i,n)}};const fh=On("listService");class mTt{get lastFocusedList(){return this._lastFocusedWidget}constructor(){this.disposables=new ke,this.lists=[],this._lastFocusedWidget=void 0,this._hasCreatedStyleController=!1}setLastFocusedList(e){e!==this._lastFocusedWidget&&(this._lastFocusedWidget?.getHTMLElement().classList.remove("last-focused"),this._lastFocusedWidget=e,this._lastFocusedWidget?.getHTMLElement().classList.add("last-focused"))}register(e,t){if(this._hasCreatedStyleController||(this._hasCreatedStyleController=!0,new b5e(id(),"").style(yC)),this.lists.some(r=>r.widget===e))throw new Error("Cannot register the same widget multiple times");const i={widget:e,extraContextKeys:t};return this.lists.push(i),H$(e.getHTMLElement())&&this.setLastFocusedList(e),Qh(e.onDidFocus(()=>this.setLastFocusedList(e)),Lt(()=>this.lists.splice(this.lists.indexOf(i),1)),e.onDidDispose(()=>{this.lists=this.lists.filter(r=>r!==i),this._lastFocusedWidget===e&&this.setLastFocusedList(void 0)}))}dispose(){this.disposables.dispose()}}const FN=new et("listScrollAtBoundary","none");Le.or(FN.isEqualTo("top"),FN.isEqualTo("both"));Le.or(FN.isEqualTo("bottom"),FN.isEqualTo("both"));const E6e=new et("listFocus",!0),L6e=new et("treestickyScrollFocused",!1),NW=new et("listSupportsMultiselect",!0),T6e=Le.and(E6e,Le.not(S6e),L6e.negate()),fce=new et("listHasSelectionOrFocus",!1),gce=new et("listDoubleSelection",!1),pce=new et("listMultiSelection",!1),RW=new et("listSelectionNavigation",!1),_Tt=new et("listSupportsFind",!0),mce=new et("treeElementCanCollapse",!1),vTt=new et("treeElementHasParent",!1),_ce=new et("treeElementCanExpand",!1),bTt=new et("treeElementHasChild",!1),yTt=new et("treeFindOpen",!1),D6e="listTypeNavigationMode",I6e="listAutomaticKeyboardNavigation";function PW(n,e){const t=n.createScoped(e.getHTMLElement());return E6e.bindTo(t),t}function OW(n,e){const t=FN.bindTo(n),i=()=>{const r=e.scrollTop===0,s=e.scrollHeight-e.renderHeight-e.scrollTop<1;r&&s?t.set("both"):r?t.set("top"):s?t.set("bottom"):t.set("none")};return i(),e.onDidScroll(i)}const xC="workbench.list.multiSelectModifier",o5="workbench.list.openMode",Gd="workbench.list.horizontalScrolling",vce="workbench.list.defaultFindMode",bce="workbench.list.typeNavigationMode",K8="workbench.list.keyboardNavigation",Tg="workbench.list.scrollByPage",yce="workbench.list.defaultFindMatchType",BN="workbench.tree.indent",G8="workbench.tree.renderIndentGuides",Dg="workbench.list.smoothScrolling",em="workbench.list.mouseWheelScrollSensitivity",tm="workbench.list.fastScrollSensitivity",Y8="workbench.tree.expandMode",Z8="workbench.tree.enableStickyScroll",X8="workbench.tree.stickyScrollMaxItemCount";function nm(n){return n.getValue(xC)==="alt"}class wTt extends me{constructor(e){super(),this.configurationService=e,this.useAltAsMultipleSelectionModifier=nm(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(xC)&&(this.useAltAsMultipleSelectionModifier=nm(this.configurationService))}))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:m5e(e)}isSelectionRangeChangeEvent(e){return _5e(e)}}function MW(n,e){const t=n.get(kn),i=n.get(xi),r=new ke;return[{...e,keyboardNavigationDelegate:{mightProducePrintableCharacter(o){return i.mightProducePrintableCharacter(o)}},smoothScrolling:!!t.getValue(Dg),mouseWheelScrollSensitivity:t.getValue(em),fastScrollSensitivity:t.getValue(tm),multipleSelectionController:e.multipleSelectionController??r.add(new wTt(t)),keyboardNavigationEventFilter:STt(i),scrollByPage:!!t.getValue(Tg)},r]}let Oye=class extends dd{constructor(e,t,i,r,s,o,a,l,c){const u=typeof s.horizontalScrolling<"u"?s.horizontalScrolling:!!l.getValue(Gd),[d,h]=c.invokeFunction(MW,s);super(e,t,i,r,{keyboardSupport:!1,...d,horizontalScrolling:u}),this.disposables.add(h),this.contextKeyService=PW(o,this),this.disposables.add(OW(this.contextKeyService,this)),this.listSupportsMultiSelect=NW.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(s.multipleSelectionSupport!==!1),RW.bindTo(this.contextKeyService).set(!!s.selectionNavigation),this.listHasSelectionOrFocus=fce.bindTo(this.contextKeyService),this.listDoubleSelection=gce.bindTo(this.contextKeyService),this.listMultiSelection=pce.bindTo(this.contextKeyService),this.horizontalScrolling=s.horizontalScrolling,this._useAltAsMultipleSelectionModifier=nm(l),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),this.updateStyles(s.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{const g=this.getSelection(),p=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(g.length>0||p.length>0),this.listMultiSelection.set(g.length>1),this.listDoubleSelection.set(g.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{const g=this.getSelection(),p=this.getFocus();this.listHasSelectionOrFocus.set(g.length>0||p.length>0)})),this.disposables.add(l.onDidChangeConfiguration(g=>{g.affectsConfiguration(xC)&&(this._useAltAsMultipleSelectionModifier=nm(l));let p={};if(g.affectsConfiguration(Gd)&&this.horizontalScrolling===void 0){const m=!!l.getValue(Gd);p={...p,horizontalScrolling:m}}if(g.affectsConfiguration(Tg)){const m=!!l.getValue(Tg);p={...p,scrollByPage:m}}if(g.affectsConfiguration(Dg)){const m=!!l.getValue(Dg);p={...p,smoothScrolling:m}}if(g.affectsConfiguration(em)){const m=l.getValue(em);p={...p,mouseWheelScrollSensitivity:m}}if(g.affectsConfiguration(tm)){const m=l.getValue(tm);p={...p,fastScrollSensitivity:m}}Object.keys(p).length>0&&this.updateOptions(p)})),this.navigator=new A6e(this,{configurationService:l,...s}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?wC(e):yC)}};Oye=v0([xr(5,jt),xr(6,fh),xr(7,kn),xr(8,Tt)],Oye);let Mye=class extends k2t{constructor(e,t,i,r,s,o,a,l,c){const u=typeof s.horizontalScrolling<"u"?s.horizontalScrolling:!!l.getValue(Gd),[d,h]=c.invokeFunction(MW,s);super(e,t,i,r,{keyboardSupport:!1,...d,horizontalScrolling:u}),this.disposables=new ke,this.disposables.add(h),this.contextKeyService=PW(o,this),this.disposables.add(OW(this.contextKeyService,this.widget)),this.horizontalScrolling=s.horizontalScrolling,this.listSupportsMultiSelect=NW.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(s.multipleSelectionSupport!==!1),RW.bindTo(this.contextKeyService).set(!!s.selectionNavigation),this._useAltAsMultipleSelectionModifier=nm(l),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),this.updateStyles(s.overrideStyles),this.disposables.add(l.onDidChangeConfiguration(g=>{g.affectsConfiguration(xC)&&(this._useAltAsMultipleSelectionModifier=nm(l));let p={};if(g.affectsConfiguration(Gd)&&this.horizontalScrolling===void 0){const m=!!l.getValue(Gd);p={...p,horizontalScrolling:m}}if(g.affectsConfiguration(Tg)){const m=!!l.getValue(Tg);p={...p,scrollByPage:m}}if(g.affectsConfiguration(Dg)){const m=!!l.getValue(Dg);p={...p,smoothScrolling:m}}if(g.affectsConfiguration(em)){const m=l.getValue(em);p={...p,mouseWheelScrollSensitivity:m}}if(g.affectsConfiguration(tm)){const m=l.getValue(tm);p={...p,fastScrollSensitivity:m}}Object.keys(p).length>0&&this.updateOptions(p)})),this.navigator=new A6e(this,{configurationService:l,...s}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?wC(e):yC)}dispose(){this.disposables.dispose(),super.dispose()}};Mye=v0([xr(5,jt),xr(6,fh),xr(7,kn),xr(8,Tt)],Mye);let Fye=class extends M2t{constructor(e,t,i,r,s,o,a,l,c,u){const d=typeof o.horizontalScrolling<"u"?o.horizontalScrolling:!!c.getValue(Gd),[h,f]=u.invokeFunction(MW,o);super(e,t,i,r,s,{keyboardSupport:!1,...h,horizontalScrolling:d}),this.disposables.add(f),this.contextKeyService=PW(a,this),this.disposables.add(OW(this.contextKeyService,this)),this.listSupportsMultiSelect=NW.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(o.multipleSelectionSupport!==!1),RW.bindTo(this.contextKeyService).set(!!o.selectionNavigation),this.listHasSelectionOrFocus=fce.bindTo(this.contextKeyService),this.listDoubleSelection=gce.bindTo(this.contextKeyService),this.listMultiSelection=pce.bindTo(this.contextKeyService),this.horizontalScrolling=o.horizontalScrolling,this._useAltAsMultipleSelectionModifier=nm(c),this.disposables.add(this.contextKeyService),this.disposables.add(l.register(this)),this.updateStyles(o.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{const p=this.getSelection(),m=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(p.length>0||m.length>0),this.listMultiSelection.set(p.length>1),this.listDoubleSelection.set(p.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{const p=this.getSelection(),m=this.getFocus();this.listHasSelectionOrFocus.set(p.length>0||m.length>0)})),this.disposables.add(c.onDidChangeConfiguration(p=>{p.affectsConfiguration(xC)&&(this._useAltAsMultipleSelectionModifier=nm(c));let m={};if(p.affectsConfiguration(Gd)&&this.horizontalScrolling===void 0){const _=!!c.getValue(Gd);m={...m,horizontalScrolling:_}}if(p.affectsConfiguration(Tg)){const _=!!c.getValue(Tg);m={...m,scrollByPage:_}}if(p.affectsConfiguration(Dg)){const _=!!c.getValue(Dg);m={...m,smoothScrolling:_}}if(p.affectsConfiguration(em)){const _=c.getValue(em);m={...m,mouseWheelScrollSensitivity:_}}if(p.affectsConfiguration(tm)){const _=c.getValue(tm);m={...m,fastScrollSensitivity:_}}Object.keys(m).length>0&&this.updateOptions(m)})),this.navigator=new CTt(this,{configurationService:c,...o}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?wC(e):yC)}dispose(){this.disposables.dispose(),super.dispose()}};Fye=v0([xr(6,jt),xr(7,fh),xr(8,kn),xr(9,Tt)],Fye);class wce extends me{constructor(e,t){super(),this.widget=e,this._onDidOpen=this._register(new fe),this.onDidOpen=this._onDidOpen.event,this._register(Ge.filter(this.widget.onDidChangeSelection,i=>Jm(i.browserEvent))(i=>this.onSelectionFromKeyboard(i))),this._register(this.widget.onPointer(i=>this.onPointer(i.element,i.browserEvent))),this._register(this.widget.onMouseDblClick(i=>this.onMouseDblClick(i.element,i.browserEvent))),typeof t?.openOnSingleClick!="boolean"&&t?.configurationService?(this.openOnSingleClick=t?.configurationService.getValue(o5)!=="doubleClick",this._register(t?.configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration(o5)&&(this.openOnSingleClick=t?.configurationService.getValue(o5)!=="doubleClick")}))):this.openOnSingleClick=t?.openOnSingleClick??!0}onSelectionFromKeyboard(e){if(e.elements.length!==1)return;const t=e.browserEvent,i=typeof t.preserveFocus=="boolean"?t.preserveFocus:!0,r=typeof t.pinned=="boolean"?t.pinned:!i;this._open(this.getSelectedElement(),i,r,!1,e.browserEvent)}onPointer(e,t){if(!this.openOnSingleClick||t.detail===2)return;const r=t.button===1,s=!0,o=r,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,s,o,a,t)}onMouseDblClick(e,t){if(!t)return;const i=t.target;if(i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&t.offsetX<16)return;const s=!1,o=!0,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,s,o,a,t)}_open(e,t,i,r,s){e&&this._onDidOpen.fire({editorOptions:{preserveFocus:t,pinned:i,revealIfVisible:!0},sideBySide:r,element:e,browserEvent:s})}}class A6e extends wce{constructor(e,t){super(e,t),this.widget=e}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class CTt extends wce{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class xTt extends wce{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelection()[0]??void 0}}function STt(n){let e=!1;return t=>{if(t.toKeyCodeChord().isModifierKey())return!1;if(e)return e=!1,!1;const i=n.softDispatch(t,t.target);return i.kind===1?(e=!0,!1):(e=!1,i.kind===0)}}let JQ=class extends uce{constructor(e,t,i,r,s,o,a,l,c){const{options:u,getTypeNavigationMode:d,disposable:h}=o.invokeFunction(gO,s);super(e,t,i,r,u),this.disposables.add(h),this.internals=new Ww(this,s,d,s.overrideStyles,a,l,c),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};JQ=v0([xr(5,Tt),xr(6,jt),xr(7,fh),xr(8,kn)],JQ);let Bye=class extends y6e{constructor(e,t,i,r,s,o,a,l,c){const{options:u,getTypeNavigationMode:d,disposable:h}=o.invokeFunction(gO,s);super(e,t,i,r,u),this.disposables.add(h),this.internals=new Ww(this,s,d,s.overrideStyles,a,l,c),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};Bye=v0([xr(5,Tt),xr(6,jt),xr(7,fh),xr(8,kn)],Bye);let $ye=class extends pTt{constructor(e,t,i,r,s,o,a,l,c,u){const{options:d,getTypeNavigationMode:h,disposable:f}=a.invokeFunction(gO,o);super(e,t,i,r,s,d),this.disposables.add(f),this.internals=new Ww(this,o,h,o.overrideStyles,l,c,u),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles!==void 0&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};$ye=v0([xr(6,Tt),xr(7,jt),xr(8,fh),xr(9,kn)],$ye);let eJ=class extends C6e{get onDidOpen(){return this.internals.onDidOpen}constructor(e,t,i,r,s,o,a,l,c,u){const{options:d,getTypeNavigationMode:h,disposable:f}=a.invokeFunction(gO,o);super(e,t,i,r,s,d),this.disposables.add(f),this.internals=new Ww(this,o,h,o.overrideStyles,l,c,u),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};eJ=v0([xr(6,Tt),xr(7,jt),xr(8,fh),xr(9,kn)],eJ);let Wye=class extends fTt{constructor(e,t,i,r,s,o,a,l,c,u,d){const{options:h,getTypeNavigationMode:f,disposable:g}=l.invokeFunction(gO,a);super(e,t,i,r,s,o,h),this.disposables.add(g),this.internals=new Ww(this,a,f,a.overrideStyles,c,u,d),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};Wye=v0([xr(7,Tt),xr(8,jt),xr(9,fh),xr(10,kn)],Wye);function N6e(n){const e=n.getValue(vce);if(e==="highlight")return __.Highlight;if(e==="filter")return __.Filter;const t=n.getValue(K8);if(t==="simple"||t==="highlight")return __.Highlight;if(t==="filter")return __.Filter}function R6e(n){const e=n.getValue(yce);if(e==="fuzzy")return $w.Fuzzy;if(e==="contiguous")return $w.Contiguous}function gO(n,e){const t=n.get(kn),i=n.get(m0),r=n.get(jt),s=n.get(Tt),o=()=>{const h=r.getContextKeyValue(D6e);if(h==="automatic")return Cp.Automatic;if(h==="trigger"||r.getContextKeyValue(I6e)===!1)return Cp.Trigger;const g=t.getValue(bce);if(g==="automatic")return Cp.Automatic;if(g==="trigger")return Cp.Trigger},a=e.horizontalScrolling!==void 0?e.horizontalScrolling:!!t.getValue(Gd),[l,c]=s.invokeFunction(MW,e),u=e.paddingBottom,d=e.renderIndentGuides!==void 0?e.renderIndentGuides:t.getValue(G8);return{getTypeNavigationMode:o,disposable:c,options:{keyboardSupport:!1,...l,indent:typeof t.getValue(BN)=="number"?t.getValue(BN):void 0,renderIndentGuides:d,smoothScrolling:!!t.getValue(Dg),defaultFindMode:N6e(t),defaultFindMatchType:R6e(t),horizontalScrolling:a,scrollByPage:!!t.getValue(Tg),paddingBottom:u,hideTwistiesOfChildlessElements:e.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:e.expandOnlyOnTwistieClick??t.getValue(Y8)==="doubleClick",contextViewProvider:i,findWidgetStyles:Lkt,enableStickyScroll:!!t.getValue(Z8),stickyScrollMaxItemCount:Number(t.getValue(X8))}}}let Ww=class{get onDidOpen(){return this.navigator.onDidOpen}constructor(e,t,i,r,s,o,a){this.tree=e,this.disposables=[],this.contextKeyService=PW(s,e),this.disposables.push(OW(this.contextKeyService,e)),this.listSupportsMultiSelect=NW.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(t.multipleSelectionSupport!==!1),RW.bindTo(this.contextKeyService).set(!!t.selectionNavigation),this.listSupportFindWidget=_Tt.bindTo(this.contextKeyService),this.listSupportFindWidget.set(t.findWidgetEnabled??!0),this.hasSelectionOrFocus=fce.bindTo(this.contextKeyService),this.hasDoubleSelection=gce.bindTo(this.contextKeyService),this.hasMultiSelection=pce.bindTo(this.contextKeyService),this.treeElementCanCollapse=mce.bindTo(this.contextKeyService),this.treeElementHasParent=vTt.bindTo(this.contextKeyService),this.treeElementCanExpand=_ce.bindTo(this.contextKeyService),this.treeElementHasChild=bTt.bindTo(this.contextKeyService),this.treeFindOpen=yTt.bindTo(this.contextKeyService),this.treeStickyScrollFocused=L6e.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=nm(a),this.updateStyleOverrides(r);const c=()=>{const d=e.getFocus()[0];if(!d)return;const h=e.getNode(d);this.treeElementCanCollapse.set(h.collapsible&&!h.collapsed),this.treeElementHasParent.set(!!e.getParentElement(d)),this.treeElementCanExpand.set(h.collapsible&&h.collapsed),this.treeElementHasChild.set(!!e.getFirstElementChild(d))},u=new Set;u.add(D6e),u.add(I6e),this.disposables.push(this.contextKeyService,o.register(e),e.onDidChangeSelection(()=>{const d=e.getSelection(),h=e.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.hasSelectionOrFocus.set(d.length>0||h.length>0),this.hasMultiSelection.set(d.length>1),this.hasDoubleSelection.set(d.length===2)})}),e.onDidChangeFocus(()=>{const d=e.getSelection(),h=e.getFocus();this.hasSelectionOrFocus.set(d.length>0||h.length>0),c()}),e.onDidChangeCollapseState(c),e.onDidChangeModel(c),e.onDidChangeFindOpenState(d=>this.treeFindOpen.set(d)),e.onDidChangeStickyScrollFocused(d=>this.treeStickyScrollFocused.set(d)),a.onDidChangeConfiguration(d=>{let h={};if(d.affectsConfiguration(xC)&&(this._useAltAsMultipleSelectionModifier=nm(a)),d.affectsConfiguration(BN)){const f=a.getValue(BN);h={...h,indent:f}}if(d.affectsConfiguration(G8)&&t.renderIndentGuides===void 0){const f=a.getValue(G8);h={...h,renderIndentGuides:f}}if(d.affectsConfiguration(Dg)){const f=!!a.getValue(Dg);h={...h,smoothScrolling:f}}if(d.affectsConfiguration(vce)||d.affectsConfiguration(K8)){const f=N6e(a);h={...h,defaultFindMode:f}}if(d.affectsConfiguration(bce)||d.affectsConfiguration(K8)){const f=i();h={...h,typeNavigationMode:f}}if(d.affectsConfiguration(yce)){const f=R6e(a);h={...h,defaultFindMatchType:f}}if(d.affectsConfiguration(Gd)&&t.horizontalScrolling===void 0){const f=!!a.getValue(Gd);h={...h,horizontalScrolling:f}}if(d.affectsConfiguration(Tg)){const f=!!a.getValue(Tg);h={...h,scrollByPage:f}}if(d.affectsConfiguration(Y8)&&t.expandOnlyOnTwistieClick===void 0&&(h={...h,expandOnlyOnTwistieClick:a.getValue(Y8)==="doubleClick"}),d.affectsConfiguration(Z8)){const f=a.getValue(Z8);h={...h,enableStickyScroll:f}}if(d.affectsConfiguration(X8)){const f=Math.max(1,a.getValue(X8));h={...h,stickyScrollMaxItemCount:f}}if(d.affectsConfiguration(em)){const f=a.getValue(em);h={...h,mouseWheelScrollSensitivity:f}}if(d.affectsConfiguration(tm)){const f=a.getValue(tm);h={...h,fastScrollSensitivity:f}}Object.keys(h).length>0&&e.updateOptions(h)}),this.contextKeyService.onDidChangeContext(d=>{d.affectsSome(u)&&e.updateOptions({typeNavigationMode:i()})})),this.navigator=new xTt(e,{configurationService:a,...t}),this.disposables.push(this.navigator)}updateOptions(e){e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyleOverrides(e){this.tree.style(e?wC(e):yC)}dispose(){this.disposables=er(this.disposables)}};Ww=v0([xr(4,jt),xr(5,fh),xr(6,kn)],Ww);const kTt=Yr.as(ff.Configuration);kTt.registerConfiguration({id:"workbench",order:7,title:w("workbenchConfigurationTitle","Workbench"),type:"object",properties:{[xC]:{type:"string",enum:["ctrlCmd","alt"],markdownEnumDescriptions:[w("multiSelectModifier.ctrlCmd","Maps to `Control` on Windows and Linux and to `Command` on macOS."),w("multiSelectModifier.alt","Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],default:"ctrlCmd",description:w({key:"multiSelectModifier",comment:["- `ctrlCmd` refers to a value the setting can take and should not be localized.","- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized."]},"The modifier to be used to add an item in trees and lists to a multi-selection with the mouse (for example in the explorer, open editors and scm view). The 'Open to Side' mouse gestures - if supported - will adapt such that they do not conflict with the multiselect modifier.")},[o5]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:w({key:"openModeModifier",comment:["`singleClick` and `doubleClick` refers to a value the setting can take and should not be localized."]},"Controls how to open items in trees and lists using the mouse (if supported). Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[Gd]:{type:"boolean",default:!1,description:w("horizontalScrolling setting","Controls whether lists and trees support horizontal scrolling in the workbench. Warning: turning on this setting has a performance implication.")},[Tg]:{type:"boolean",default:!1,description:w("list.scrollByPage","Controls whether clicks in the scrollbar scroll page by page.")},[BN]:{type:"number",default:8,minimum:4,maximum:40,description:w("tree indent setting","Controls tree indentation in pixels.")},[G8]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:w("render tree indent guides","Controls whether the tree should render indent guides.")},[Dg]:{type:"boolean",default:!1,description:w("list smoothScrolling setting","Controls whether lists and trees have smooth scrolling.")},[em]:{type:"number",default:1,markdownDescription:w("Mouse Wheel Scroll Sensitivity","A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")},[tm]:{type:"number",default:5,markdownDescription:w("Fast Scroll Sensitivity","Scrolling speed multiplier when pressing `Alt`.")},[vce]:{type:"string",enum:["highlight","filter"],enumDescriptions:[w("defaultFindModeSettingKey.highlight","Highlight elements when searching. Further up and down navigation will traverse only the highlighted elements."),w("defaultFindModeSettingKey.filter","Filter elements when searching.")],default:"highlight",description:w("defaultFindModeSettingKey","Controls the default find mode for lists and trees in the workbench.")},[K8]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[w("keyboardNavigationSettingKey.simple","Simple keyboard navigation focuses elements which match the keyboard input. Matching is done only on prefixes."),w("keyboardNavigationSettingKey.highlight","Highlight keyboard navigation highlights elements which match the keyboard input. Further up and down navigation will traverse only the highlighted elements."),w("keyboardNavigationSettingKey.filter","Filter keyboard navigation will filter out and hide all the elements which do not match the keyboard input.")],default:"highlight",description:w("keyboardNavigationSettingKey","Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter."),deprecated:!0,deprecationMessage:w("keyboardNavigationSettingKeyDeprecated","Please use 'workbench.list.defaultFindMode' and 'workbench.list.typeNavigationMode' instead.")},[yce]:{type:"string",enum:["fuzzy","contiguous"],enumDescriptions:[w("defaultFindMatchTypeSettingKey.fuzzy","Use fuzzy matching when searching."),w("defaultFindMatchTypeSettingKey.contiguous","Use contiguous matching when searching.")],default:"fuzzy",description:w("defaultFindMatchTypeSettingKey","Controls the type of matching used when searching lists and trees in the workbench.")},[Y8]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:w("expand mode","Controls how tree folders are expanded when clicking the folder names. Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[Z8]:{type:"boolean",default:!0,description:w("sticky scroll","Controls whether sticky scrolling is enabled in trees.")},[X8]:{type:"number",minimum:1,default:7,markdownDescription:w("sticky scroll maximum items","Controls the number of sticky elements displayed in the tree when {0} is enabled.","`#workbench.tree.enableStickyScroll#`")},[bce]:{type:"string",enum:["automatic","trigger"],default:"automatic",markdownDescription:w("typeNavigationMode2","Controls how type navigation works in lists and trees in the workbench. When set to `trigger`, type navigation begins once the `list.triggerTypeNavigation` command is run.")}}});class cb extends me{constructor(e,t){super(),this.options=t,this.text="",this.title="",this.highlights=[],this.didEverRender=!1,this.supportIcons=t?.supportIcons??!1,this.domNode=Ne(e,qe("span.monaco-highlighted-label"))}get element(){return this.domNode}set(e,t=[],i="",r){e||(e=""),r&&(e=cb.escapeNewLines(e,t)),!(this.didEverRender&&this.text===e&&this.title===i&&ru(this.highlights,t))&&(this.text=e,this.title=i,this.highlights=t,this.render())}render(){const e=[];let t=0;for(const i of this.highlights){if(i.end===i.start)continue;if(t{r=s===`\r -`?-1:0,o+=i;for(const a of t)a.end<=o||(a.start>=o&&(a.start+=r),a.end>=o&&(a.end+=r));return i+=r,"⏎"})}}class FT{constructor(e){this._element=e}get element(){return this._element}set textContent(e){this.disposed||e===this._textContent||(this._textContent=e,this._element.textContent=e)}set classNames(e){this.disposed||ru(e,this._classNames)||(this._classNames=e,this._element.classList.value="",this._element.classList.add(...e))}set empty(e){this.disposed||e===this._empty||(this._empty=e,this._element.style.marginLeft=e?"0":"")}dispose(){this.disposed=!0}}class Q8 extends me{constructor(e,t){super(),this.customHovers=new Map,this.creationOptions=t,this.domNode=this._register(new FT(Ne(e,qe(".monaco-icon-label")))),this.labelContainer=Ne(this.domNode.element,qe(".monaco-icon-label-container")),this.nameContainer=Ne(this.labelContainer,qe("span.monaco-icon-name-container")),t?.supportHighlights||t?.supportIcons?this.nameNode=this._register(new TTt(this.nameContainer,!!t.supportIcons)):this.nameNode=new ETt(this.nameContainer),this.hoverDelegate=t?.hoverDelegate??Yl("mouse")}get element(){return this.domNode.element}setLabel(e,t,i){const r=["monaco-icon-label"],s=["monaco-icon-label-container"];let o="";i&&(i.extraClasses&&r.push(...i.extraClasses),i.italic&&r.push("italic"),i.strikethrough&&r.push("strikethrough"),i.disabledCommand&&s.push("disabled"),i.title&&(typeof i.title=="string"?o+=i.title:o+=e));const a=this.domNode.element.querySelector(".monaco-icon-label-iconpath");if(i?.iconPath){let l;!a||!Eo(a)?(l=qe(".monaco-icon-label-iconpath"),this.domNode.element.prepend(l)):l=a,l.style.backgroundImage=Z_(i?.iconPath)}else a&&a.remove();if(this.domNode.classNames=r,this.domNode.element.setAttribute("aria-label",o),this.labelContainer.classList.value="",this.labelContainer.classList.add(...s),this.setupHover(i?.descriptionTitle?this.labelContainer:this.element,i?.title),this.nameNode.setLabel(e,i),t||this.descriptionNode){const l=this.getOrCreateDescriptionNode();l instanceof cb?(l.set(t||"",i?i.descriptionMatches:void 0,void 0,i?.labelEscapeNewLines),this.setupHover(l.element,i?.descriptionTitle)):(l.textContent=t&&i?.labelEscapeNewLines?cb.escapeNewLines(t,[]):t||"",this.setupHover(l.element,i?.descriptionTitle||""),l.empty=!t)}if(i?.suffix||this.suffixNode){const l=this.getOrCreateSuffixNode();l.textContent=i?.suffix??""}}setupHover(e,t){const i=this.customHovers.get(e);if(i&&(i.dispose(),this.customHovers.delete(e)),!t){e.removeAttribute("title");return}if(this.hoverDelegate.showNativeHover)(function(s,o){yc(o)?s.title=Dle(o):o?.markdownNotSupportedFallback?s.title=o.markdownNotSupportedFallback:s.removeAttribute("title")})(e,t);else{const r=Bg().setupManagedHover(this.hoverDelegate,e,t);r&&this.customHovers.set(e,r)}}dispose(){super.dispose();for(const e of this.customHovers.values())e.dispose();this.customHovers.clear()}getOrCreateSuffixNode(){if(!this.suffixNode){const e=this._register(new FT(D0t(this.nameContainer,qe("span.monaco-icon-suffix-container"))));this.suffixNode=this._register(new FT(Ne(e.element,qe("span.label-suffix"))))}return this.suffixNode}getOrCreateDescriptionNode(){if(!this.descriptionNode){const e=this._register(new FT(Ne(this.labelContainer,qe("span.monaco-icon-description-container"))));this.creationOptions?.supportDescriptionHighlights?this.descriptionNode=this._register(new cb(Ne(e.element,qe("span.label-description")),{supportIcons:!!this.creationOptions.supportIcons})):this.descriptionNode=this._register(new FT(Ne(e.element,qe("span.label-description"))))}return this.descriptionNode}}let ETt=class{constructor(e){this.container=e,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&ru(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.innerText="",this.container.classList.remove("multiple"),this.singleLabel=Ne(this.container,qe("a.label-name",{id:t?.domId}))),this.singleLabel.textContent=e;else{this.container.innerText="",this.container.classList.add("multiple"),this.singleLabel=void 0;for(let i=0;i{const s={start:i,end:i+r.length},o=t.map(a=>Ba.intersect(s,a)).filter(a=>!Ba.isEmpty(a)).map(({start:a,end:l})=>({start:a-i,end:l-i}));return i=s.end+e.length,o})}class TTt extends me{constructor(e,t){super(),this.container=e,this.supportIcons=t,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&ru(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.innerText="",this.container.classList.remove("multiple"),this.singleLabel=this._register(new cb(Ne(this.container,qe("a.label-name",{id:t?.domId})),{supportIcons:this.supportIcons}))),this.singleLabel.set(e,t?.matches,void 0,t?.labelEscapeNewLines);else{this.container.innerText="",this.container.classList.add("multiple"),this.singleLabel=void 0;const i=t?.separator||"/",r=LTt(e,i,t?.matches);for(let s=0;s{const n=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});return{collator:n,collatorIsNumeric:n.resolvedOptions().numeric}});function DTt(n,e,t=!1){const i=n||"",r=e||"",s=Hye.value.collator.compare(i,r);return Hye.value.collatorIsNumeric&&s===0&&i!==r?ir.length)return 1}return 0}var FW=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},tJ=function(n,e){return function(t,i){e(t,i,n)}},nJ;const Tf=qe;class O6e{constructor(e,t,i){this.index=e,this.hasCheckbox=t,this._hidden=!1,this._init=new kg(()=>{const r=i.label??"",s=DD(r).text.trim(),o=i.ariaLabel||[r,this.saneDescription,this.saneDetail].map(a=>BCt(a)).filter(a=>!!a).join(", ");return{saneLabel:r,saneSortLabel:s,saneAriaLabel:o}}),this._saneDescription=i.description,this._saneTooltip=i.tooltip}get saneLabel(){return this._init.value.saneLabel}get saneSortLabel(){return this._init.value.saneSortLabel}get saneAriaLabel(){return this._init.value.saneAriaLabel}get element(){return this._element}set element(e){this._element=e}get hidden(){return this._hidden}set hidden(e){this._hidden=e}get saneDescription(){return this._saneDescription}set saneDescription(e){this._saneDescription=e}get saneDetail(){return this._saneDetail}set saneDetail(e){this._saneDetail=e}get saneTooltip(){return this._saneTooltip}set saneTooltip(e){this._saneTooltip=e}get labelHighlights(){return this._labelHighlights}set labelHighlights(e){this._labelHighlights=e}get descriptionHighlights(){return this._descriptionHighlights}set descriptionHighlights(e){this._descriptionHighlights=e}get detailHighlights(){return this._detailHighlights}set detailHighlights(e){this._detailHighlights=e}}class ca extends O6e{constructor(e,t,i,r,s,o){super(e,t,s),this.fireButtonTriggered=i,this._onChecked=r,this.item=s,this._separator=o,this._checked=!1,this.onChecked=t?Ge.map(Ge.filter(this._onChecked.event,a=>a.element===this),a=>a.checked):Ge.None,this._saneDetail=s.detail,this._labelHighlights=s.highlights?.label,this._descriptionHighlights=s.highlights?.description,this._detailHighlights=s.highlights?.detail}get separator(){return this._separator}set separator(e){this._separator=e}get checked(){return this._checked}set checked(e){e!==this._checked&&(this._checked=e,this._onChecked.fire({element:this,checked:e}))}get checkboxDisabled(){return!!this.item.disabled}}var up;(function(n){n[n.NONE=0]="NONE",n[n.MOUSE_HOVER=1]="MOUSE_HOVER",n[n.ACTIVE_ITEM=2]="ACTIVE_ITEM"})(up||(up={}));class K1 extends O6e{constructor(e,t,i){super(e,!1,i),this.fireSeparatorButtonTriggered=t,this.separator=i,this.children=new Array,this.focusInsideSeparator=up.NONE}}class NTt{getHeight(e){return e instanceof K1?30:e.saneDetail?44:22}getTemplateId(e){return e instanceof ca?J8.ID:BW.ID}}class RTt{getWidgetAriaLabel(){return w("quickInput","Quick Input")}getAriaLabel(e){return e.separator?.label?`${e.saneAriaLabel}, ${e.separator.label}`:e.saneAriaLabel}getWidgetRole(){return"listbox"}getRole(e){return e.hasCheckbox?"checkbox":"option"}isChecked(e){if(!(!e.hasCheckbox||!(e instanceof ca)))return{get value(){return e.checked},onDidChange:t=>e.onChecked(()=>t())}}}class M6e{constructor(e){this.hoverDelegate=e}renderTemplate(e){const t=Object.create(null);t.toDisposeElement=new ke,t.toDisposeTemplate=new ke,t.entry=Ne(e,Tf(".quick-input-list-entry"));const i=Ne(t.entry,Tf("label.quick-input-list-label"));t.toDisposeTemplate.add(Jr(i,je.CLICK,c=>{t.checkbox.offsetParent||c.preventDefault()})),t.checkbox=Ne(i,Tf("input.quick-input-list-checkbox")),t.checkbox.type="checkbox";const r=Ne(i,Tf(".quick-input-list-rows")),s=Ne(r,Tf(".quick-input-list-row")),o=Ne(r,Tf(".quick-input-list-row"));t.label=new Q8(s,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.label),t.icon=Vae(t.label.element,Tf(".quick-input-list-icon"));const a=Ne(s,Tf(".quick-input-list-entry-keybinding"));t.keybinding=new l2(a,eu),t.toDisposeTemplate.add(t.keybinding);const l=Ne(o,Tf(".quick-input-list-label-meta"));return t.detail=new Q8(l,{supportHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.detail),t.separator=Ne(t.entry,Tf(".quick-input-list-separator")),t.actionBar=new ed(t.entry,this.hoverDelegate?{hoverDelegate:this.hoverDelegate}:void 0),t.actionBar.domNode.classList.add("quick-input-list-entry-action-bar"),t.toDisposeTemplate.add(t.actionBar),t}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}disposeElement(e,t,i){i.toDisposeElement.clear(),i.actionBar.clear()}}let J8=class extends M6e{static{nJ=this}static{this.ID="quickpickitem"}constructor(e,t){super(e),this.themeService=t,this._itemsWithSeparatorsFrequency=new Map}get templateId(){return nJ.ID}renderTemplate(e){const t=super.renderTemplate(e);return t.toDisposeTemplate.add(Jr(t.checkbox,je.CHANGE,i=>{t.element.checked=t.checkbox.checked})),t}renderElement(e,t,i){const r=e.element;i.element=r,r.element=i.entry??void 0;const s=r.item;i.checkbox.checked=r.checked,i.toDisposeElement.add(r.onChecked(h=>i.checkbox.checked=h)),i.checkbox.disabled=r.checkboxDisabled;const{labelHighlights:o,descriptionHighlights:a,detailHighlights:l}=r;if(s.iconPath){const h=aE(this.themeService.getColorTheme().type)?s.iconPath.dark:s.iconPath.light??s.iconPath.dark,f=Pt.revive(h);i.icon.className="quick-input-list-icon",i.icon.style.backgroundImage=Z_(f)}else i.icon.style.backgroundImage="",i.icon.className=s.iconClass?`quick-input-list-icon ${s.iconClass}`:"";let c;!r.saneTooltip&&r.saneDescription&&(c={markdown:{value:r.saneDescription,supportThemeIcons:!0},markdownNotSupportedFallback:r.saneDescription});const u={matches:o||[],descriptionTitle:c,descriptionMatches:a||[],labelEscapeNewLines:!0};if(u.extraClasses=s.iconClasses,u.italic=s.italic,u.strikethrough=s.strikethrough,i.entry.classList.remove("quick-input-list-separator-as-item"),i.label.setLabel(r.saneLabel,r.saneDescription,u),i.keybinding.set(s.keybinding),r.saneDetail){let h;r.saneTooltip||(h={markdown:{value:r.saneDetail,supportThemeIcons:!0},markdownNotSupportedFallback:r.saneDetail}),i.detail.element.style.display="",i.detail.setLabel(r.saneDetail,void 0,{matches:l,title:h,labelEscapeNewLines:!0})}else i.detail.element.style.display="none";r.separator?.label?(i.separator.textContent=r.separator.label,i.separator.style.display="",this.addItemWithSeparator(r)):i.separator.style.display="none",i.entry.classList.toggle("quick-input-list-separator-border",!!r.separator);const d=s.buttons;d&&d.length?(i.actionBar.push(d.map((h,f)=>TI(h,`id-${f}`,()=>r.fireButtonTriggered({button:h,item:r.item}))),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions")}disposeElement(e,t,i){this.removeItemWithSeparator(e.element),super.disposeElement(e,t,i)}isItemWithSeparatorVisible(e){return this._itemsWithSeparatorsFrequency.has(e)}addItemWithSeparator(e){this._itemsWithSeparatorsFrequency.set(e,(this._itemsWithSeparatorsFrequency.get(e)||0)+1)}removeItemWithSeparator(e){const t=this._itemsWithSeparatorsFrequency.get(e)||0;t>1?this._itemsWithSeparatorsFrequency.set(e,t-1):this._itemsWithSeparatorsFrequency.delete(e)}};J8=nJ=FW([tJ(1,go)],J8);class BW extends M6e{constructor(){super(...arguments),this._visibleSeparatorsFrequency=new Map}static{this.ID="quickpickseparator"}get templateId(){return BW.ID}get visibleSeparators(){return[...this._visibleSeparatorsFrequency.keys()]}isSeparatorVisible(e){return this._visibleSeparatorsFrequency.has(e)}renderTemplate(e){const t=super.renderTemplate(e);return t.checkbox.style.display="none",t}renderElement(e,t,i){const r=e.element;i.element=r,r.element=i.entry??void 0,r.element.classList.toggle("focus-inside",!!r.focusInsideSeparator);const s=r.separator,{labelHighlights:o,descriptionHighlights:a,detailHighlights:l}=r;i.icon.style.backgroundImage="",i.icon.className="";let c;!r.saneTooltip&&r.saneDescription&&(c={markdown:{value:r.saneDescription,supportThemeIcons:!0},markdownNotSupportedFallback:r.saneDescription});const u={matches:o||[],descriptionTitle:c,descriptionMatches:a||[],labelEscapeNewLines:!0};if(i.entry.classList.add("quick-input-list-separator-as-item"),i.label.setLabel(r.saneLabel,r.saneDescription,u),r.saneDetail){let h;r.saneTooltip||(h={markdown:{value:r.saneDetail,supportThemeIcons:!0},markdownNotSupportedFallback:r.saneDetail}),i.detail.element.style.display="",i.detail.setLabel(r.saneDetail,void 0,{matches:l,title:h,labelEscapeNewLines:!0})}else i.detail.element.style.display="none";i.separator.style.display="none",i.entry.classList.add("quick-input-list-separator-border");const d=s.buttons;d&&d.length?(i.actionBar.push(d.map((h,f)=>TI(h,`id-${f}`,()=>r.fireSeparatorButtonTriggered({button:h,separator:r.separator}))),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions"),this.addSeparator(r)}disposeElement(e,t,i){this.removeSeparator(e.element),this.isSeparatorVisible(e.element)||e.element.element?.classList.remove("focus-inside"),super.disposeElement(e,t,i)}addSeparator(e){this._visibleSeparatorsFrequency.set(e,(this._visibleSeparatorsFrequency.get(e)||0)+1)}removeSeparator(e){const t=this._visibleSeparatorsFrequency.get(e)||0;t>1?this._visibleSeparatorsFrequency.set(e,t-1):this._visibleSeparatorsFrequency.delete(e)}}let $N=class extends me{constructor(e,t,i,r,s,o){super(),this.parent=e,this.hoverDelegate=t,this.linkOpenerDelegate=i,this.accessibilityService=o,this._onKeyDown=new fe,this._onLeave=new fe,this.onLeave=this._onLeave.event,this._visibleCountObservable=Sn("VisibleCount",0),this.onChangedVisibleCount=Ge.fromObservable(this._visibleCountObservable,this._store),this._allVisibleCheckedObservable=Sn("AllVisibleChecked",!1),this.onChangedAllVisibleChecked=Ge.fromObservable(this._allVisibleCheckedObservable,this._store),this._checkedCountObservable=Sn("CheckedCount",0),this.onChangedCheckedCount=Ge.fromObservable(this._checkedCountObservable,this._store),this._checkedElementsObservable=CQ({equalsFn:$r},new Array),this.onChangedCheckedElements=Ge.fromObservable(this._checkedElementsObservable,this._store),this._onButtonTriggered=new fe,this.onButtonTriggered=this._onButtonTriggered.event,this._onSeparatorButtonTriggered=new fe,this.onSeparatorButtonTriggered=this._onSeparatorButtonTriggered.event,this._elementChecked=new fe,this._elementCheckedEventBufferer=new UP,this._hasCheckboxes=!1,this._inputElements=new Array,this._elementTree=new Array,this._itemElements=new Array,this._elementDisposable=this._register(new ke),this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._matchOnLabelMode="fuzzy",this._sortByLabel=!0,this._shouldLoop=!0,this._container=Ne(this.parent,Tf(".quick-input-list")),this._separatorRenderer=new BW(t),this._itemRenderer=s.createInstance(J8,t),this._tree=this._register(s.createInstance(JQ,"QuickInput",this._container,new NTt,[this._itemRenderer,this._separatorRenderer],{filter:{filter(a){return a.hidden?0:a instanceof K1?2:1}},sorter:{compare:(a,l)=>{if(!this.sortByLabel||!this._lastQueryString)return 0;const c=this._lastQueryString.toLowerCase();return OTt(a,l,c)}},accessibilityProvider:new RTt,setRowLineHeight:!1,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:yE.None,findWidgetEnabled:!1,indent:0,horizontalScrolling:!1,allowNonCollapsibleParents:!0,alwaysConsumeMouseWheel:!0})),this._tree.getHTMLElement().id=r,this._registerListeners()}get onDidChangeFocus(){return Ge.map(this._tree.onDidChangeFocus,e=>e.elements.filter(t=>t instanceof ca).map(t=>t.item),this._store)}get onDidChangeSelection(){return Ge.map(this._tree.onDidChangeSelection,e=>({items:e.elements.filter(t=>t instanceof ca).map(t=>t.item),event:e.browserEvent}),this._store)}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get ariaLabel(){return this._tree.ariaLabel}set ariaLabel(e){this._tree.ariaLabel=e??""}set enabled(e){this._tree.getHTMLElement().style.pointerEvents=e?"":"none"}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}get shouldLoop(){return this._shouldLoop}set shouldLoop(e){this._shouldLoop=e}_registerListeners(){this._registerOnKeyDown(),this._registerOnContainerClick(),this._registerOnMouseMiddleClick(),this._registerOnTreeModelChanged(),this._registerOnElementChecked(),this._registerOnContextMenu(),this._registerHoverListeners(),this._registerSelectionChangeListener(),this._registerSeparatorActionShowingListeners()}_registerOnKeyDown(){this._register(this._tree.onKeyDown(e=>{const t=new or(e);switch(t.keyCode){case 10:this.toggleCheckbox();break}this._onKeyDown.fire(t)}))}_registerOnContainerClick(){this._register(Ce(this._container,je.CLICK,e=>{(e.x||e.y)&&this._onLeave.fire()}))}_registerOnMouseMiddleClick(){this._register(Ce(this._container,je.AUXCLICK,e=>{e.button===1&&this._onLeave.fire()}))}_registerOnTreeModelChanged(){this._register(this._tree.onDidChangeModel(()=>{const e=this._itemElements.filter(t=>!t.hidden).length;this._visibleCountObservable.set(e,void 0),this._hasCheckboxes&&this._updateCheckedObservables()}))}_registerOnElementChecked(){this._register(this._elementCheckedEventBufferer.wrapEvent(this._elementChecked.event,(e,t)=>t)(e=>this._updateCheckedObservables()))}_registerOnContextMenu(){this._register(this._tree.onContextMenu(e=>{e.element&&(e.browserEvent.preventDefault(),this._tree.setSelection([e.element]))}))}_registerHoverListeners(){const e=this._register(new Z4e(this.hoverDelegate.delay));this._register(this._tree.onMouseOver(async t=>{if(Jve(t.browserEvent.target)){e.cancel();return}if(!(!Jve(t.browserEvent.relatedTarget)&&xo(t.browserEvent.relatedTarget,t.element?.element)))try{await e.trigger(async()=>{t.element instanceof ca&&this.showHover(t.element)})}catch(i){if(!uh(i))throw i}})),this._register(this._tree.onMouseOut(t=>{xo(t.browserEvent.relatedTarget,t.element?.element)||e.cancel()}))}_registerSeparatorActionShowingListeners(){this._register(this._tree.onDidChangeFocus(e=>{const t=e.elements[0]?this._tree.getParentElement(e.elements[0]):null;for(const i of this._separatorRenderer.visibleSeparators){const r=i===t;!!(i.focusInsideSeparator&up.ACTIVE_ITEM)!==r&&(r?i.focusInsideSeparator|=up.ACTIVE_ITEM:i.focusInsideSeparator&=~up.ACTIVE_ITEM,this._tree.rerender(i))}})),this._register(this._tree.onMouseOver(e=>{const t=e.element?this._tree.getParentElement(e.element):null;for(const i of this._separatorRenderer.visibleSeparators){if(i!==t)continue;!!(i.focusInsideSeparator&up.MOUSE_HOVER)||(i.focusInsideSeparator|=up.MOUSE_HOVER,this._tree.rerender(i))}})),this._register(this._tree.onMouseOut(e=>{const t=e.element?this._tree.getParentElement(e.element):null;for(const i of this._separatorRenderer.visibleSeparators){if(i!==t)continue;!!(i.focusInsideSeparator&up.MOUSE_HOVER)&&(i.focusInsideSeparator&=~up.MOUSE_HOVER,this._tree.rerender(i))}}))}_registerSelectionChangeListener(){this._register(this._tree.onDidChangeSelection(e=>{const t=e.elements.filter(i=>i instanceof ca);t.length!==e.elements.length&&(e.elements.length===1&&e.elements[0]instanceof K1&&(this._tree.setFocus([e.elements[0].children[0]]),this._tree.reveal(e.elements[0],0)),this._tree.setSelection(t))}))}setAllVisibleChecked(e){this._elementCheckedEventBufferer.bufferEvents(()=>{this._itemElements.forEach(t=>{!t.hidden&&!t.checkboxDisabled&&(t.checked=e)})})}setElements(e){this._elementDisposable.clear(),this._lastQueryString=void 0,this._inputElements=e,this._hasCheckboxes=this.parent.classList.contains("show-checkboxes");let t;this._itemElements=new Array,this._elementTree=e.reduce((i,r,s)=>{let o;if(r.type==="separator"){if(!r.buttons)return i;t=new K1(s,a=>this._onSeparatorButtonTriggered.fire(a),r),o=t}else{const a=s>0?e[s-1]:void 0;let l;a&&a.type==="separator"&&!a.buttons&&(t=void 0,l=a);const c=new ca(s,this._hasCheckboxes,u=>this._onButtonTriggered.fire(u),this._elementChecked,r,l);if(this._itemElements.push(c),t)return t.children.push(c),i;o=c}return i.push(o),i},new Array),this._setElementsToTree(this._elementTree),this.accessibilityService.isScreenReaderOptimized()&&setTimeout(()=>{const i=this._tree.getHTMLElement().querySelector(".monaco-list-row.focused"),r=i?.parentNode;if(i&&r){const s=i.nextSibling;i.remove(),r.insertBefore(i,s)}},0)}setFocusedElements(e){const t=e.map(i=>this._itemElements.find(r=>r.item===i)).filter(i=>!!i).filter(i=>!i.hidden);if(this._tree.setFocus(t),e.length>0){const i=this._tree.getFocus()[0];i&&this._tree.reveal(i)}}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}setSelectedElements(e){const t=e.map(i=>this._itemElements.find(r=>r.item===i)).filter(i=>!!i);this._tree.setSelection(t)}getCheckedElements(){return this._itemElements.filter(e=>e.checked).map(e=>e.item)}setCheckedElements(e){this._elementCheckedEventBufferer.bufferEvents(()=>{const t=new Set;for(const i of e)t.add(i);for(const i of this._itemElements)i.checked=t.has(i.item)})}focus(e){if(this._itemElements.length)switch(e===yr.Second&&this._itemElements.length<2&&(e=yr.First),e){case yr.First:this._tree.scrollTop=0,this._tree.focusFirst(void 0,t=>t.element instanceof ca);break;case yr.Second:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,i=>i.element instanceof ca?t?!0:(t=!t,!1):!1);break}case yr.Last:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,t=>t.element instanceof ca);break;case yr.Next:{const t=this._tree.getFocus();this._tree.focusNext(void 0,this._shouldLoop,void 0,r=>r.element instanceof ca?(this._tree.reveal(r.element),!0):!1);const i=this._tree.getFocus();t.length&&t[0]===i[0]&&t[0]===this._itemElements[this._itemElements.length-1]&&this._onLeave.fire();break}case yr.Previous:{const t=this._tree.getFocus();this._tree.focusPrevious(void 0,this._shouldLoop,void 0,r=>{if(!(r.element instanceof ca))return!1;const s=this._tree.getParentElement(r.element);return s===null||s.children[0]!==r.element?this._tree.reveal(r.element):this._tree.reveal(s),!0});const i=this._tree.getFocus();t.length&&t[0]===i[0]&&t[0]===this._itemElements[0]&&this._onLeave.fire();break}case yr.NextPage:this._tree.focusNextPage(void 0,t=>t.element instanceof ca?(this._tree.reveal(t.element),!0):!1);break;case yr.PreviousPage:this._tree.focusPreviousPage(void 0,t=>{if(!(t.element instanceof ca))return!1;const i=this._tree.getParentElement(t.element);return i===null||i.children[0]!==t.element?this._tree.reveal(t.element):this._tree.reveal(i),!0});break;case yr.NextSeparator:{let t=!1;const i=this._tree.getFocus()[0];this._tree.focusNext(void 0,!0,void 0,s=>{if(t)return!0;if(s.element instanceof K1)t=!0,this._separatorRenderer.isSeparatorVisible(s.element)?this._tree.reveal(s.element.children[0]):this._tree.reveal(s.element,0);else if(s.element instanceof ca){if(s.element.separator)return this._itemRenderer.isItemWithSeparatorVisible(s.element)?this._tree.reveal(s.element):this._tree.reveal(s.element,0),!0;if(s.element===this._elementTree[0])return this._tree.reveal(s.element,0),!0}return!1});const r=this._tree.getFocus()[0];i===r&&(this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,s=>s.element instanceof ca));break}case yr.PreviousSeparator:{let t,i=!!this._tree.getFocus()[0]?.separator;this._tree.focusPrevious(void 0,!0,void 0,r=>{if(r.element instanceof K1)i?t||(this._separatorRenderer.isSeparatorVisible(r.element)?this._tree.reveal(r.element):this._tree.reveal(r.element,0),t=r.element.children[0]):i=!0;else if(r.element instanceof ca&&!t){if(r.element.separator)this._itemRenderer.isItemWithSeparatorVisible(r.element)?this._tree.reveal(r.element):this._tree.reveal(r.element,0),t=r.element;else if(r.element===this._elementTree[0])return this._tree.reveal(r.element,0),!0}return!1}),t&&this._tree.setFocus([t]);break}}}clearFocus(){this._tree.setFocus([])}domFocus(){this._tree.domFocus()}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}filter(e){if(this._lastQueryString=e,!(this._sortByLabel||this._matchOnLabel||this._matchOnDescription||this._matchOnDetail))return this._tree.layout(),!1;const t=e;if(e=e.trim(),!e||!(this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))this._itemElements.forEach(i=>{i.labelHighlights=void 0,i.descriptionHighlights=void 0,i.detailHighlights=void 0,i.hidden=!1;const r=i.index&&this._inputElements[i.index-1];i.item&&(i.separator=r&&r.type==="separator"&&!r.buttons?r:void 0)});else{let i;this._itemElements.forEach(r=>{let s;this.matchOnLabelMode==="fuzzy"?s=this.matchOnLabel?Xj(e,DD(r.saneLabel))??void 0:void 0:s=this.matchOnLabel?PTt(t,DD(r.saneLabel))??void 0:void 0;const o=this.matchOnDescription?Xj(e,DD(r.saneDescription||""))??void 0:void 0,a=this.matchOnDetail?Xj(e,DD(r.saneDetail||""))??void 0:void 0;if(s||o||a?(r.labelHighlights=s,r.descriptionHighlights=o,r.detailHighlights=a,r.hidden=!1):(r.labelHighlights=void 0,r.descriptionHighlights=void 0,r.detailHighlights=void 0,r.hidden=r.item?!r.item.alwaysShow:!0),r.item?r.separator=void 0:r.separator&&(r.hidden=!0),!this.sortByLabel){const l=r.index&&this._inputElements[r.index-1]||void 0;l?.type==="separator"&&!l.buttons&&(i=l),i&&!r.hidden&&(r.separator=i,i=void 0)}})}return this._setElementsToTree(this._sortByLabel&&e?this._itemElements:this._elementTree),this._tree.layout(),!0}toggleCheckbox(){this._elementCheckedEventBufferer.bufferEvents(()=>{const e=this._tree.getFocus().filter(i=>i instanceof ca),t=this._allVisibleChecked(e);for(const i of e)i.checkboxDisabled||(i.checked=!t)})}style(e){this._tree.style(e)}toggleHover(){const e=this._tree.getFocus()[0];if(!e?.saneTooltip||!(e instanceof ca))return;if(this._lastHover&&!this._lastHover.isDisposed){this._lastHover.dispose();return}this.showHover(e);const t=new ke;t.add(this._tree.onDidChangeFocus(i=>{i.elements[0]instanceof ca&&this.showHover(i.elements[0])})),this._lastHover&&t.add(this._lastHover),this._elementDisposable.add(t)}_setElementsToTree(e){const t=new Array;for(const i of e)i instanceof K1?t.push({element:i,collapsible:!1,collapsed:!1,children:i.children.map(r=>({element:r,collapsible:!1,collapsed:!1}))}):t.push({element:i,collapsible:!1,collapsed:!1});this._tree.setChildren(null,t)}_allVisibleChecked(e,t=!0){for(let i=0,r=e.length;i{this._allVisibleCheckedObservable.set(this._allVisibleChecked(this._itemElements,!1),e);const t=this._itemElements.filter(i=>i.checked).length;this._checkedCountObservable.set(t,e),this._checkedElementsObservable.set(this.getCheckedElements(),e)})}showHover(e){this._lastHover&&!this._lastHover.isDisposed&&(this.hoverDelegate.onDidHideHover?.(),this._lastHover?.dispose()),!(!e.element||!e.saneTooltip)&&(this._lastHover=this.hoverDelegate.showHover({content:e.saneTooltip,target:e.element,linkHandler:t=>{this.linkOpenerDelegate(t)},appearance:{showPointer:!0},container:this._container,position:{hoverPosition:1}},!1))}};FW([Ds],$N.prototype,"onDidChangeFocus",null);FW([Ds],$N.prototype,"onDidChangeSelection",null);$N=FW([tJ(4,Tt),tJ(5,_u)],$N);function PTt(n,e){const{text:t,iconOffsets:i}=e;if(!i||i.length===0)return Vye(n,t);const r=jP(t," "),s=t.length-r.length,o=Vye(n,r);if(o)for(const a of o){const l=i[a.start+s]+s;a.start+=l,a.end+=l}return o}function Vye(n,e){const t=e.toLowerCase().indexOf(n.toLowerCase());return t!==-1?[{start:t,end:t+n.length}]:null}function OTt(n,e,t){const i=n.labelHighlights||[],r=e.labelHighlights||[];return i.length&&!r.length?-1:!i.length&&r.length?1:i.length===0&&r.length===0?0:ITt(n.saneSortLabel,e.saneSortLabel,t)}const F6e={weight:200,when:Le.and(Le.equals(o6e,"quickPick"),l2t),metadata:{description:w("quickPick","Used while in the context of the quick pick. If you change one keybinding for this command, you should change all of the other keybindings (modifier variants) of this command as well.")}};function Gc(n,e={}){jl.registerCommandAndKeybindingRule({...F6e,...n,secondary:MTt(n.primary,n.secondary??[],e)})}const e9=Rn?256:2048;function MTt(n,e,t={}){return t.withAltMod&&e.push(512+n),t.withCtrlMod&&(e.push(e9+n),t.withAltMod&&e.push(512+e9+n)),t.withCmdMod&&Rn&&(e.push(2048+n),t.withCtrlMod&&e.push(2304+n),t.withAltMod&&(e.push(2560+n),t.withCtrlMod&&e.push(2816+n))),e}function Pu(n,e){return t=>{const i=t.get(hh).currentQuickInput;if(i)return e&&i.quickNavigate?i.focus(e):i.focus(n)}}Gc({id:"quickInput.pageNext",primary:12,handler:Pu(yr.NextPage)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});Gc({id:"quickInput.pagePrevious",primary:11,handler:Pu(yr.PreviousPage)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});Gc({id:"quickInput.first",primary:e9+14,handler:Pu(yr.First)},{withAltMod:!0,withCmdMod:!0});Gc({id:"quickInput.last",primary:e9+13,handler:Pu(yr.Last)},{withAltMod:!0,withCmdMod:!0});Gc({id:"quickInput.next",primary:18,handler:Pu(yr.Next)},{withCtrlMod:!0});Gc({id:"quickInput.previous",primary:16,handler:Pu(yr.Previous)},{withCtrlMod:!0});const zye=w("quickInput.nextSeparatorWithQuickAccessFallback","If we're in quick access mode, this will navigate to the next item. If we are not in quick access mode, this will navigate to the next separator."),Uye=w("quickInput.previousSeparatorWithQuickAccessFallback","If we're in quick access mode, this will navigate to the previous item. If we are not in quick access mode, this will navigate to the previous separator.");Rn?(Gc({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:2066,handler:Pu(yr.NextSeparator,yr.Next),metadata:{description:zye}}),Gc({id:"quickInput.nextSeparator",primary:2578,secondary:[2322],handler:Pu(yr.NextSeparator)},{withCtrlMod:!0}),Gc({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:2064,handler:Pu(yr.PreviousSeparator,yr.Previous),metadata:{description:Uye}}),Gc({id:"quickInput.previousSeparator",primary:2576,secondary:[2320],handler:Pu(yr.PreviousSeparator)},{withCtrlMod:!0})):(Gc({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:530,handler:Pu(yr.NextSeparator,yr.Next),metadata:{description:zye}}),Gc({id:"quickInput.nextSeparator",primary:2578,handler:Pu(yr.NextSeparator)}),Gc({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:528,handler:Pu(yr.PreviousSeparator,yr.Previous),metadata:{description:Uye}}),Gc({id:"quickInput.previousSeparator",primary:2576,handler:Pu(yr.PreviousSeparator)}));Gc({id:"quickInput.acceptInBackground",when:Le.and(F6e.when,Le.or(k6e.negate(),d2t)),primary:17,weight:250,handler:n=>{n.get(hh).currentQuickInput?.accept(!0)}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});var FTt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},yq=function(n,e){return function(t,i){e(t,i,n)}},iJ;const Hc=qe;let rJ=class extends me{static{iJ=this}static{this.MAX_WIDTH=600}get currentQuickInput(){return this.controller??void 0}get container(){return this._container}constructor(e,t,i,r){super(),this.options=e,this.layoutService=t,this.instantiationService=i,this.contextKeyService=r,this.enabled=!0,this.onDidAcceptEmitter=this._register(new fe),this.onDidCustomEmitter=this._register(new fe),this.onDidTriggerButtonEmitter=this._register(new fe),this.keyMods={ctrlCmd:!1,alt:!1},this.controller=null,this.onShowEmitter=this._register(new fe),this.onShow=this.onShowEmitter.event,this.onHideEmitter=this._register(new fe),this.onHide=this.onHideEmitter.event,this.inQuickInputContext=a2t.bindTo(this.contextKeyService),this.quickInputTypeContext=c2t.bindTo(this.contextKeyService),this.endOfQuickInputBoxContext=u2t.bindTo(this.contextKeyService),this.idPrefix=e.idPrefix,this._container=e.container,this.styles=e.styles,this._register(Ge.runAndSubscribe($$,({window:s,disposables:o})=>this.registerKeyModsListeners(s,o),{window:Xi,disposables:this._store})),this._register(h0t(s=>{this.ui&&Ot(this.ui.container)===s&&(this.reparentUI(this.layoutService.mainContainer),this.layout(this.layoutService.mainContainerDimension,this.layoutService.mainContainerOffset.quickPickTop))}))}registerKeyModsListeners(e,t){const i=r=>{this.keyMods.ctrlCmd=r.ctrlKey||r.metaKey,this.keyMods.alt=r.altKey};for(const r of[je.KEY_DOWN,je.KEY_UP,je.MOUSE_DOWN])t.add(Ce(e,r,i,!0))}getUI(e){if(this.ui)return e&&Ot(this._container)!==Ot(this.layoutService.activeContainer)&&(this.reparentUI(this.layoutService.activeContainer),this.layout(this.layoutService.activeContainerDimension,this.layoutService.activeContainerOffset.quickPickTop)),this.ui;const t=Ne(this._container,Hc(".quick-input-widget.show-file-icons"));t.tabIndex=-1,t.style.display="none";const i=id(t),r=Ne(t,Hc(".quick-input-titlebar")),s=this._register(new ed(r,{hoverDelegate:this.options.hoverDelegate}));s.domNode.classList.add("quick-input-left-action-bar");const o=Ne(r,Hc(".quick-input-title")),a=this._register(new ed(r,{hoverDelegate:this.options.hoverDelegate}));a.domNode.classList.add("quick-input-right-action-bar");const l=Ne(t,Hc(".quick-input-header")),c=Ne(l,Hc("input.quick-input-check-all"));c.type="checkbox",c.setAttribute("aria-label",w("quickInput.checkAll","Toggle all checkboxes")),this._register(Jr(c,je.CHANGE,W=>{const z=c.checked;B.setAllVisibleChecked(z)})),this._register(Ce(c,je.CLICK,W=>{(W.x||W.y)&&f.setFocus()}));const u=Ne(l,Hc(".quick-input-description")),d=Ne(l,Hc(".quick-input-and-message")),h=Ne(d,Hc(".quick-input-filter")),f=this._register(new w2t(h,this.styles.inputBox,this.styles.toggle));f.setAttribute("aria-describedby",`${this.idPrefix}message`);const g=Ne(h,Hc(".quick-input-visible-count"));g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true");const p=new YQ(g,{countFormat:w({key:"quickInput.visibleCount",comment:["This tells the user how many items are shown in a list of items to select from. The items can be anything. Currently not visible, but read by screen readers."]},"{0} Results")},this.styles.countBadge),m=Ne(h,Hc(".quick-input-count"));m.setAttribute("aria-live","polite");const _=new YQ(m,{countFormat:w({key:"quickInput.countSelected",comment:["This tells the user how many items are selected in a list of items to select from. The items can be anything."]},"{0} Selected")},this.styles.countBadge),v=this._register(new ed(l,{hoverDelegate:this.options.hoverDelegate}));v.domNode.classList.add("quick-input-inline-action-bar");const y=Ne(l,Hc(".quick-input-action")),C=this._register(new V8(y,this.styles.button));C.label=w("ok","OK"),this._register(C.onDidClick(W=>{this.onDidAcceptEmitter.fire()}));const x=Ne(l,Hc(".quick-input-action")),k=this._register(new V8(x,{...this.styles.button,supportIcons:!0}));k.label=w("custom","Custom"),this._register(k.onDidClick(W=>{this.onDidCustomEmitter.fire()}));const L=Ne(d,Hc(`#${this.idPrefix}message.quick-input-message`)),D=this._register(new nce(t,this.styles.progressBar));D.getContainer().classList.add("quick-input-progress");const I=Ne(t,Hc(".quick-input-html-widget"));I.tabIndex=-1;const O=Ne(t,Hc(".quick-input-description")),M=this.idPrefix+"list",B=this._register(this.instantiationService.createInstance($N,t,this.options.hoverDelegate,this.options.linkOpenerDelegate,M));f.setAttribute("aria-controls",M),this._register(B.onDidChangeFocus(()=>{f.setAttribute("aria-activedescendant",B.getActiveDescendant()??"")})),this._register(B.onChangedAllVisibleChecked(W=>{c.checked=W})),this._register(B.onChangedVisibleCount(W=>{p.setCount(W)})),this._register(B.onChangedCheckedCount(W=>{_.setCount(W)})),this._register(B.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),this.controller instanceof H8&&this.controller.canSelectMany&&B.clearFocus())},0)}));const G=Eg(t);return this._register(G),this._register(Ce(t,je.FOCUS,W=>{const z=this.getUI();if(xo(W.relatedTarget,z.inputContainer)){const q=z.inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==q&&this.endOfQuickInputBoxContext.set(q)}xo(W.relatedTarget,z.container)||(this.inQuickInputContext.set(!0),this.previousFocusElement=Eo(W.relatedTarget)?W.relatedTarget:void 0)},!0)),this._register(G.onDidBlur(()=>{!this.getUI().ignoreFocusOut&&!this.options.ignoreFocusOut()&&this.hide(bE.Blur),this.inQuickInputContext.set(!1),this.endOfQuickInputBoxContext.set(!1),this.previousFocusElement=void 0})),this._register(f.onKeyDown(W=>{const z=this.getUI().inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==z&&this.endOfQuickInputBoxContext.set(z)})),this._register(Ce(t,je.FOCUS,W=>{f.setFocus()})),this._register(Jr(t,je.KEY_DOWN,W=>{if(!xo(W.target,I))switch(W.keyCode){case 3:Hn.stop(W,!0),this.enabled&&this.onDidAcceptEmitter.fire();break;case 9:Hn.stop(W,!0),this.hide(bE.Gesture);break;case 2:if(!W.altKey&&!W.ctrlKey&&!W.metaKey){const z=[".quick-input-list .monaco-action-bar .always-visible",".quick-input-list-entry:hover .monaco-action-bar",".monaco-list-row.focused .monaco-action-bar"];if(t.classList.contains("show-checkboxes")?z.push("input"):z.push("input[type=text]"),this.getUI().list.displayed&&z.push(".monaco-list"),this.getUI().message&&z.push(".quick-input-message a"),this.getUI().widget){if(xo(W.target,this.getUI().widget))break;z.push(".quick-input-html-widget")}const q=t.querySelectorAll(z.join(", "));W.shiftKey&&W.target===q[0]?(Hn.stop(W,!0),B.clearFocus()):!W.shiftKey&&xo(W.target,q[q.length-1])&&(Hn.stop(W,!0),q[0].focus())}break;case 10:W.ctrlKey&&(Hn.stop(W,!0),this.getUI().list.toggleHover());break}})),this.ui={container:t,styleSheet:i,leftActionBar:s,titleBar:r,title:o,description1:O,description2:u,widget:I,rightActionBar:a,inlineActionBar:v,checkAll:c,inputContainer:d,filterContainer:h,inputBox:f,visibleCountContainer:g,visibleCount:p,countContainer:m,count:_,okContainer:y,ok:C,message:L,customButtonContainer:x,customButton:k,list:B,progressBar:D,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,show:W=>this.show(W),hide:()=>this.hide(),setVisibilities:W=>this.setVisibilities(W),setEnabled:W=>this.setEnabled(W),setContextKey:W=>this.options.setContextKey(W),linkOpenerDelegate:W=>this.options.linkOpenerDelegate(W)},this.updateStyles(),this.ui}reparentUI(e){this.ui&&(this._container=e,Ne(this._container,this.ui.container))}pick(e,t={},i=yn.None){return new Promise((r,s)=>{let o=u=>{o=r,t.onKeyMods?.(a.keyMods),r(u)};if(i.isCancellationRequested){o(void 0);return}const a=this.createQuickPick({useSeparators:!0});let l;const c=[a,a.onDidAccept(()=>{if(a.canSelectMany)o(a.selectedItems.slice()),a.hide();else{const u=a.activeItems[0];u&&(o(u),a.hide())}}),a.onDidChangeActive(u=>{const d=u[0];d&&t.onDidFocus&&t.onDidFocus(d)}),a.onDidChangeSelection(u=>{if(!a.canSelectMany){const d=u[0];d&&(o(d),a.hide())}}),a.onDidTriggerItemButton(u=>t.onDidTriggerItemButton&&t.onDidTriggerItemButton({...u,removeItem:()=>{const d=a.items.indexOf(u.item);if(d!==-1){const h=a.items.slice(),f=h.splice(d,1),g=a.activeItems.filter(m=>m!==f[0]),p=a.keepScrollPosition;a.keepScrollPosition=!0,a.items=h,g&&(a.activeItems=g),a.keepScrollPosition=p}}})),a.onDidTriggerSeparatorButton(u=>t.onDidTriggerSeparatorButton?.(u)),a.onDidChangeValue(u=>{l&&!u&&(a.activeItems.length!==1||a.activeItems[0]!==l)&&(a.activeItems=[l])}),i.onCancellationRequested(()=>{a.hide()}),a.onDidHide(()=>{er(c),o(void 0)})];a.title=t.title,t.value&&(a.value=t.value),a.canSelectMany=!!t.canPickMany,a.placeholder=t.placeHolder,a.ignoreFocusOut=!!t.ignoreFocusLost,a.matchOnDescription=!!t.matchOnDescription,a.matchOnDetail=!!t.matchOnDetail,a.matchOnLabel=t.matchOnLabel===void 0||t.matchOnLabel,a.quickNavigate=t.quickNavigate,a.hideInput=!!t.hideInput,a.contextKey=t.contextKey,a.busy=!0,Promise.all([e,t.activeItem]).then(([u,d])=>{l=d,a.busy=!1,a.items=u,a.canSelectMany&&(a.selectedItems=u.filter(h=>h.type!=="separator"&&h.picked)),l&&(a.activeItems=[l])}),a.show(),Promise.resolve(e).then(void 0,u=>{s(u),a.hide()})})}createQuickPick(e={useSeparators:!1}){const t=this.getUI(!0);return new H8(t)}createInputBox(){const e=this.getUI(!0);return new h2t(e)}show(e){const t=this.getUI(!0);this.onShowEmitter.fire();const i=this.controller;this.controller=e,i?.didHide(),this.setEnabled(!0),t.leftActionBar.clear(),t.title.textContent="",t.description1.textContent="",t.description2.textContent="",ea(t.widget),t.rightActionBar.clear(),t.inlineActionBar.clear(),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(Ss.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),ea(t.message),t.progressBar.stop(),t.list.setElements([]),t.list.matchOnDescription=!1,t.list.matchOnDetail=!1,t.list.matchOnLabel=!0,t.list.sortByLabel=!0,t.ignoreFocusOut=!1,t.inputBox.toggles=void 0;const r=this.options.backKeybindingLabel();KQ.tooltip=r?w("quickInput.backWithKeybinding","Back ({0})",r):w("quickInput.back","Back"),t.container.style.display="",this.updateLayout(),t.inputBox.setFocus(),this.quickInputTypeContext.set(e.type)}isVisible(){return!!this.ui&&this.ui.container.style.display!=="none"}setVisibilities(e){const t=this.getUI();t.title.style.display=e.title?"":"none",t.description1.style.display=e.description&&(e.inputBox||e.checkAll)?"":"none",t.description2.style.display=e.description&&!(e.inputBox||e.checkAll)?"":"none",t.checkAll.style.display=e.checkAll?"":"none",t.inputContainer.style.display=e.inputBox?"":"none",t.filterContainer.style.display=e.inputBox?"":"none",t.visibleCountContainer.style.display=e.visibleCount?"":"none",t.countContainer.style.display=e.count?"":"none",t.okContainer.style.display=e.ok?"":"none",t.customButtonContainer.style.display=e.customButton?"":"none",t.message.style.display=e.message?"":"none",t.progressBar.getContainer().style.display=e.progressBar?"":"none",t.list.displayed=!!e.list,t.container.classList.toggle("show-checkboxes",!!e.checkBox),t.container.classList.toggle("hidden-input",!e.inputBox&&!e.description),this.updateLayout()}setEnabled(e){if(e!==this.enabled){this.enabled=e;for(const t of this.getUI().leftActionBar.viewItems)t.action.enabled=e;for(const t of this.getUI().rightActionBar.viewItems)t.action.enabled=e;this.getUI().checkAll.disabled=!e,this.getUI().inputBox.enabled=e,this.getUI().ok.enabled=e,this.getUI().list.enabled=e}}hide(e){const t=this.controller;if(!t)return;t.willHide(e);const i=this.ui?.container,r=i&&!f3e(i);if(this.controller=null,this.onHideEmitter.fire(),i&&(i.style.display="none"),!r){let s=this.previousFocusElement;for(;s&&!s.offsetParent;)s=s.parentElement??void 0;s?.offsetParent?(s.focus(),this.previousFocusElement=void 0):this.options.returnFocus()}t.didHide(e)}layout(e,t){this.dimension=e,this.titleBarOffset=t,this.updateLayout()}updateLayout(){if(this.ui&&this.isVisible()){this.ui.container.style.top=`${this.titleBarOffset}px`;const e=this.ui.container.style,t=Math.min(this.dimension.width*.62,iJ.MAX_WIDTH);e.width=t+"px",e.marginLeft="-"+t/2+"px",this.ui.inputBox.layout(),this.ui.list.layout(this.dimension&&this.dimension.height*.4)}}applyStyles(e){this.styles=e,this.updateStyles()}updateStyles(){if(this.ui){const{quickInputTitleBackground:e,quickInputBackground:t,quickInputForeground:i,widgetBorder:r,widgetShadow:s}=this.styles.widget;this.ui.titleBar.style.backgroundColor=e??"",this.ui.container.style.backgroundColor=t??"",this.ui.container.style.color=i??"",this.ui.container.style.border=r?`1px solid ${r}`:"",this.ui.container.style.boxShadow=s?`0 0 8px 2px ${s}`:"",this.ui.list.style(this.styles.list);const o=[];this.styles.pickerGroup.pickerGroupBorder&&o.push(`.quick-input-list .quick-input-list-entry { border-top-color: ${this.styles.pickerGroup.pickerGroupBorder}; }`),this.styles.pickerGroup.pickerGroupForeground&&o.push(`.quick-input-list .quick-input-list-separator { color: ${this.styles.pickerGroup.pickerGroupForeground}; }`),this.styles.pickerGroup.pickerGroupForeground&&o.push(".quick-input-list .quick-input-list-separator-as-item { color: var(--vscode-descriptionForeground); }"),(this.styles.keybindingLabel.keybindingLabelBackground||this.styles.keybindingLabel.keybindingLabelBorder||this.styles.keybindingLabel.keybindingLabelBottomBorder||this.styles.keybindingLabel.keybindingLabelShadow||this.styles.keybindingLabel.keybindingLabelForeground)&&(o.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {"),this.styles.keybindingLabel.keybindingLabelBackground&&o.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`),this.styles.keybindingLabel.keybindingLabelBorder&&o.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`),this.styles.keybindingLabel.keybindingLabelBottomBorder&&o.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`),this.styles.keybindingLabel.keybindingLabelShadow&&o.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`),this.styles.keybindingLabel.keybindingLabelForeground&&o.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`),o.push("}"));const a=o.join(` -`);a!==this.ui.styleSheet.textContent&&(this.ui.styleSheet.textContent=a)}}};rJ=iJ=FTt([yq(1,Zb),yq(2,Tt),yq(3,jt)],rJ);var BTt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},BT=function(n,e){return function(t,i){e(t,i,n)}};let sJ=class extends T1t{get controller(){return this._controller||(this._controller=this._register(this.createController())),this._controller}get hasController(){return!!this._controller}get currentQuickInput(){return this.controller.currentQuickInput}get quickAccess(){return this._quickAccess||(this._quickAccess=this._register(this.instantiationService.createInstance(qQ))),this._quickAccess}constructor(e,t,i,r,s){super(i),this.instantiationService=e,this.contextKeyService=t,this.layoutService=r,this.configurationService=s,this._onShow=this._register(new fe),this._onHide=this._register(new fe),this.contexts=new Map}createController(e=this.layoutService,t){const i={idPrefix:"quickInput_",container:e.activeContainer,ignoreFocusOut:()=>!1,backKeybindingLabel:()=>{},setContextKey:s=>this.setContextKey(s),linkOpenerDelegate:s=>{this.instantiationService.invokeFunction(o=>{o.get(Pc).open(s,{allowCommands:!0,fromUserGesture:!0})})},returnFocus:()=>e.focus(),styles:this.computeStyles(),hoverDelegate:this._register(this.instantiationService.createInstance(GQ))},r=this._register(this.instantiationService.createInstance(rJ,{...i,...t}));return r.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop),this._register(e.onDidLayoutActiveContainer(s=>{Ot(e.activeContainer)===Ot(r.container)&&r.layout(s,e.activeContainerOffset.quickPickTop)})),this._register(e.onDidChangeActiveContainer(()=>{r.isVisible()||r.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop)})),this._register(r.onShow(()=>{this.resetContextKeys(),this._onShow.fire()})),this._register(r.onHide(()=>{this.resetContextKeys(),this._onHide.fire()})),r}setContextKey(e){let t;e&&(t=this.contexts.get(e),t||(t=new et(e,!1).bindTo(this.contextKeyService),this.contexts.set(e,t))),!(t&&t.get())&&(this.resetContextKeys(),t?.set(!0))}resetContextKeys(){this.contexts.forEach(e=>{e.get()&&e.reset()})}pick(e,t,i=yn.None){return this.controller.pick(e,t,i)}createQuickPick(e={useSeparators:!1}){return this.controller.createQuickPick(e)}createInputBox(){return this.controller.createInputBox()}updateStyles(){this.hasController&&this.controller.applyStyles(this.computeStyles())}computeStyles(){return{widget:{quickInputBackground:it(_1e),quickInputForeground:it(Uwt),quickInputTitleBackground:it(jwt),widgetBorder:it(xFe),widgetShadow:it(JL)},inputBox:A8,toggle:I8,countBadge:w5e,button:kkt,progressBar:Ekt,keybindingLabel:Skt,list:wC({listBackground:_1e,listFocusBackground:CN,listFocusForeground:wN,listInactiveFocusForeground:wN,listInactiveSelectionIconForeground:vle,listInactiveFocusBackground:CN,listFocusOutline:Ar,listInactiveFocusOutline:Ar}),pickerGroup:{pickerGroupBorder:it(qwt),pickerGroupForeground:it(RFe)}}}};sJ=BTt([BT(0,Tt),BT(1,jt),BT(2,go),BT(3,Zb),BT(4,kn)],sJ);var B6e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},py=function(n,e){return function(t,i){e(t,i,n)}};let oJ=class extends sJ{constructor(e,t,i,r,s,o){super(t,i,r,new FX(e.getContainerDomNode(),s),o),this.host=void 0;const a=WN.get(e);if(a){const l=a.widget;this.host={_serviceBrand:void 0,get mainContainer(){return l.getDomNode()},getContainer(){return l.getDomNode()},whenContainerStylesLoaded(){},get containers(){return[l.getDomNode()]},get activeContainer(){return l.getDomNode()},get mainContainerDimension(){return e.getLayoutInfo()},get activeContainerDimension(){return e.getLayoutInfo()},get onDidLayoutMainContainer(){return e.onDidLayoutChange},get onDidLayoutActiveContainer(){return e.onDidLayoutChange},get onDidLayoutContainer(){return Ge.map(e.onDidLayoutChange,c=>({container:l.getDomNode(),dimension:c}))},get onDidChangeActiveContainer(){return Ge.None},get onDidAddContainer(){return Ge.None},get mainContainerOffset(){return{top:0,quickPickTop:0}},get activeContainerOffset(){return{top:0,quickPickTop:0}},focus:()=>e.focus()}}else this.host=void 0}createController(){return super.createController(this.host)}};oJ=B6e([py(1,Tt),py(2,jt),py(3,go),py(4,ai),py(5,kn)],oJ);let aJ=class{get activeService(){const e=this.codeEditorService.getFocusedCodeEditor();if(!e)throw new Error("Quick input service needs a focused editor to work.");let t=this.mapEditorToService.get(e);if(!t){const i=t=this.instantiationService.createInstance(oJ,e);this.mapEditorToService.set(e,t),wb(e.onDidDispose)(()=>{i.dispose(),this.mapEditorToService.delete(e)})}return t}get currentQuickInput(){return this.activeService.currentQuickInput}get quickAccess(){return this.activeService.quickAccess}constructor(e,t){this.instantiationService=e,this.codeEditorService=t,this.mapEditorToService=new Map}pick(e,t,i=yn.None){return this.activeService.pick(e,t,i)}createQuickPick(e={useSeparators:!1}){return this.activeService.createQuickPick(e)}createInputBox(){return this.activeService.createInputBox()}};aJ=B6e([py(0,Tt),py(1,ai)],aJ);class WN{static{this.ID="editor.controller.quickInput"}static get(e){return e.getContribution(WN.ID)}constructor(e){this.editor=e,this.widget=new Cce(this.editor)}dispose(){this.widget.dispose()}}class Cce{static{this.ID="editor.contrib.quickInputWidget"}constructor(e){this.codeEditor=e,this.domNode=document.createElement("div"),this.codeEditor.addOverlayWidget(this)}getId(){return Cce.ID}getDomNode(){return this.domNode}getPosition(){return{preference:2}}dispose(){this.codeEditor.removeOverlayWidget(this)}}Zn(WN.ID,WN,4);class $Tt{constructor(e,t,i,r,s){this._parsedThemeRuleBrand=void 0,this.token=e,this.index=t,this.fontStyle=i,this.foreground=r,this.background=s}}function WTt(n){if(!n||!Array.isArray(n))return[];const e=[];let t=0;for(let i=0,r=n.length;i{const h=qTt(u.token,d.token);return h!==0?h:u.index-d.index});let t=0,i="000000",r="ffffff";for(;n.length>=1&&n[0].token==="";){const u=n.shift();u.fontStyle!==-1&&(t=u.fontStyle),u.foreground!==null&&(i=u.foreground),u.background!==null&&(r=u.background)}const s=new zTt;for(const u of e)s.getId(u);const o=s.getId(i),a=s.getId(r),l=new xce(t,o,a),c=new Sce(l);for(let u=0,d=n.length;u"u"){const r=this._match(t),s=jTt(t);i=(r.metadata|s<<8)>>>0,this._cache.set(t,i)}return(i|e<<0)>>>0}}const UTt=/\b(comment|string|regex|regexp)\b/;function jTt(n){const e=n.match(UTt);if(!e)return 0;switch(e[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"regexp":return 3}throw new Error("Unexpected match for standard token type!")}function qTt(n,e){return ne?1:0}class xce{constructor(e,t,i){this._themeTrieElementRuleBrand=void 0,this._fontStyle=e,this._foreground=t,this._background=i,this.metadata=(this._fontStyle<<11|this._foreground<<15|this._background<<24)>>>0}clone(){return new xce(this._fontStyle,this._foreground,this._background)}acceptOverwrite(e,t,i){e!==-1&&(this._fontStyle=e),t!==0&&(this._foreground=t),i!==0&&(this._background=i),this.metadata=(this._fontStyle<<11|this._foreground<<15|this._background<<24)>>>0}}class Sce{constructor(e){this._themeTrieElementBrand=void 0,this._mainRule=e,this._children=new Map}match(e){if(e==="")return this._mainRule;const t=e.indexOf(".");let i,r;t===-1?(i=e,r=""):(i=e.substring(0,t),r=e.substring(t+1));const s=this._children.get(i);return typeof s<"u"?s.match(r):this._mainRule}insert(e,t,i,r){if(e===""){this._mainRule.acceptOverwrite(t,i,r);return}const s=e.indexOf(".");let o,a;s===-1?(o=e,a=""):(o=e.substring(0,s),a=e.substring(s+1));let l=this._children.get(o);typeof l>"u"&&(l=new Sce(this._mainRule.clone()),this._children.set(o,l)),l.insert(a,t,i,r)}}function KTt(n){const e=[];for(let t=1,i=n.length;t({format:r.format,location:r.location.toString()}))}}n.toJSONObject=e;function t(i){const r=s=>yc(s)?s:void 0;if(i&&Array.isArray(i.src)&&i.src.every(s=>yc(s.format)&&yc(s.location)))return{weight:r(i.weight),style:r(i.style),src:i.src.map(s=>({format:s.format,location:Pt.parse(s.location)}))}}n.fromJSONObject=t})(qye||(qye={}));class JTt{constructor(){this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:w("iconDefinition.fontId","The id of the font to use. If not set, the font that is defined first is used.")},fontCharacter:{type:"string",description:w("iconDefinition.fontCharacter","The font character associated with the icon definition.")}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}},this.iconReferenceSchema={type:"string",pattern:`^${zt.iconNameExpression}$`,enum:[],enumDescriptions:[]},this.iconsById={},this.iconFontsById={}}registerIcon(e,t,i,r){const s=this.iconsById[e];if(s){if(i&&!s.description){s.description=i,this.iconSchema.properties[e].markdownDescription=`${i} $(${e})`;const l=this.iconReferenceSchema.enum.indexOf(e);l!==-1&&(this.iconReferenceSchema.enumDescriptions[l]=i),this._onDidChange.fire()}return s}const o={id:e,description:i,defaults:t,deprecationMessage:r};this.iconsById[e]=o;const a={$ref:"#/definitions/icons"};return r&&(a.deprecationMessage=r),i&&(a.markdownDescription=`${i}: $(${e})`),this.iconSchema.properties[e]=a,this.iconReferenceSchema.enum.push(e),this.iconReferenceSchema.enumDescriptions.push(i||""),this._onDidChange.fire(),{id:e}}getIcons(){return Object.keys(this.iconsById).map(e=>this.iconsById[e])}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}toString(){const e=(s,o)=>s.id.localeCompare(o.id),t=s=>{for(;zt.isThemeIcon(s.defaults);)s=this.iconsById[s.defaults.id];return`codicon codicon-${s?s.id:""}`},i=[];i.push("| preview | identifier | default codicon ID | description"),i.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");const r=Object.keys(this.iconsById).map(s=>this.iconsById[s]);for(const s of r.filter(o=>!!o.description).sort(e))i.push(`||${s.id}|${zt.isThemeIcon(s.defaults)?s.defaults.id:s.id}|${s.description||""}|`);i.push("| preview | identifier "),i.push("| ----------- | --------------------------------- |");for(const s of r.filter(o=>!zt.isThemeIcon(o.defaults)).sort(e))i.push(`||${s.id}|`);return i.join(` +`),this.list.style(e)}getSelectedElements(){return this.list.getSelectedElements()}getSelection(){return this.list.getSelection()}getFocus(){return this.list.getFocus()}dispose(){this.disposables.dispose()}};var Ru;(function(n){n[n.Expanded=0]="Expanded",n[n.Collapsed=1]="Collapsed",n[n.PreserveOrExpanded=2]="PreserveOrExpanded",n[n.PreserveOrCollapsed=3]="PreserveOrCollapsed"})(Ru||(Ru={}));var Ry;(function(n){n[n.Unknown=0]="Unknown",n[n.Twistie=1]="Twistie",n[n.Element=2]="Element",n[n.Filter=3]="Filter"})(Ry||(Ry={}));class Wu extends Error{constructor(e,t){super(`TreeError [${e}] ${t}`)}}class sce{constructor(e){this.fn=e,this._map=new WeakMap}map(e){let t=this._map.get(e);return t||(t=this.fn(e),this._map.set(e,t)),t}}function oce(n){return typeof n=="object"&&"visibility"in n&&"data"in n}function MN(n){switch(n){case!0:return 1;case!1:return 0;default:return n}}function pq(n){return typeof n.collapsible=="boolean"}class F2t{constructor(e,t,i,r={}){this.user=e,this.list=t,this.rootRef=[],this.eventBufferer=new UP,this._onDidChangeCollapseState=new fe,this.onDidChangeCollapseState=this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event),this._onDidChangeRenderNodeCount=new fe,this.onDidChangeRenderNodeCount=this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event),this._onDidSplice=new fe,this.onDidSplice=this._onDidSplice.event,this.refilterDelayer=new Qd(Y4e),this.collapseByDefault=typeof r.collapseByDefault>"u"?!1:r.collapseByDefault,this.allowNonCollapsibleParents=r.allowNonCollapsibleParents??!1,this.filter=r.filter,this.autoExpandSingleChildren=typeof r.autoExpandSingleChildren>"u"?!1:r.autoExpandSingleChildren,this.root={parent:void 0,element:i,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:!1,collapsed:!1,renderNodeCount:0,visibility:1,visible:!0,filterData:void 0}}splice(e,t,i=zn.empty(),r={}){if(e.length===0)throw new Wu(this.user,"Invalid tree location");r.diffIdentityProvider?this.spliceSmart(r.diffIdentityProvider,e,t,i,r):this.spliceSimple(e,t,i,r)}spliceSmart(e,t,i,r=zn.empty(),s,o=s.diffDepth??0){const{parentNode:a}=this.getParentNodeWithListIndex(t);if(!a.lastDiffIds)return this.spliceSimple(t,i,r,s);const l=[...r],c=t[t.length-1],u=new wp({getElements:()=>a.lastDiffIds},{getElements:()=>[...a.children.slice(0,c),...l,...a.children.slice(c+i)].map(p=>e.getId(p.element).toString())}).ComputeDiff(!1);if(u.quitEarly)return a.lastDiffIds=void 0,this.spliceSimple(t,i,l,s);const d=t.slice(0,-1),h=(p,m,_)=>{if(o>0)for(let v=0;v<_;v++)p--,m--,this.spliceSmart(e,[...d,p,0],Number.MAX_SAFE_INTEGER,l[m].children,s,o-1)};let f=Math.min(a.children.length,c+i),g=l.length;for(const p of u.changes.sort((m,_)=>_.originalStart-m.originalStart))h(f,g,f-(p.originalStart+p.originalLength)),f=p.originalStart,g=p.modifiedStart-c,this.spliceSimple([...d,f],p.originalLength,zn.slice(l,g,g+p.modifiedLength),s);h(f,g,f)}spliceSimple(e,t,i=zn.empty(),{onDidCreateNode:r,onDidDeleteNode:s,diffIdentityProvider:o}){const{parentNode:a,listIndex:l,revealed:c,visible:u}=this.getParentNodeWithListIndex(e),d=[],h=zn.map(i,x=>this.createTreeNode(x,a,a.visible?1:0,c,d,r)),f=e[e.length-1];let g=0;for(let x=f;x>=0&&xo.getId(x.element).toString())):a.lastDiffIds=a.children.map(x=>o.getId(x.element).toString()):a.lastDiffIds=void 0;let y=0;for(const x of v)x.visible&&y++;if(y!==0)for(let x=f+p.length;xk+(L.visible?L.renderNodeCount:0),0);this._updateAncestorsRenderNodeCount(a,_-x),this.list.splice(l,x,d)}if(v.length>0&&s){const x=k=>{s(k),k.children.forEach(x)};v.forEach(x)}this._onDidSplice.fire({insertedNodes:p,deletedNodes:v});let C=a;for(;C;){if(C.visibility===2){this.refilterDelayer.trigger(()=>this.refilter());break}C=C.parent}}rerender(e){if(e.length===0)throw new Wu(this.user,"Invalid tree location");const{node:t,listIndex:i,revealed:r}=this.getTreeNodeWithListIndex(e);t.visible&&r&&this.list.splice(i,1,[t])}has(e){return this.hasTreeNode(e)}getListIndex(e){const{listIndex:t,visible:i,revealed:r}=this.getTreeNodeWithListIndex(e);return i&&r?t:-1}getListRenderCount(e){return this.getTreeNode(e).renderNodeCount}isCollapsible(e){return this.getTreeNode(e).collapsible}setCollapsible(e,t){const i=this.getTreeNode(e);typeof t>"u"&&(t=!i.collapsible);const r={collapsible:t};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,r))}isCollapsed(e){return this.getTreeNode(e).collapsed}setCollapsed(e,t,i){const r=this.getTreeNode(e);typeof t>"u"&&(t=!r.collapsed);const s={collapsed:t,recursive:i||!1};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,s))}_setCollapseState(e,t){const{node:i,listIndex:r,revealed:s}=this.getTreeNodeWithListIndex(e),o=this._setListNodeCollapseState(i,r,s,t);if(i!==this.root&&this.autoExpandSingleChildren&&o&&!pq(t)&&i.collapsible&&!i.collapsed&&!t.recursive){let a=-1;for(let l=0;l-1){a=-1;break}else a=l;a>-1&&this._setCollapseState([...e,a],t)}return o}_setListNodeCollapseState(e,t,i,r){const s=this._setNodeCollapseState(e,r,!1);if(!i||!e.visible||!s)return s;const o=e.renderNodeCount,a=this.updateNodeAfterCollapseChange(e),l=o-(t===-1?0:1);return this.list.splice(t+1,l,a.slice(1)),s}_setNodeCollapseState(e,t,i){let r;if(e===this.root?r=!1:(pq(t)?(r=e.collapsible!==t.collapsible,e.collapsible=t.collapsible):e.collapsible?(r=e.collapsed!==t.collapsed,e.collapsed=t.collapsed):r=!1,r&&this._onDidChangeCollapseState.fire({node:e,deep:i})),!pq(t)&&t.recursive)for(const s of e.children)r=this._setNodeCollapseState(s,t,!0)||r;return r}expandTo(e){this.eventBufferer.bufferEvents(()=>{let t=this.getTreeNode(e);for(;t.parent;)t=t.parent,e=e.slice(0,e.length-1),t.collapsed&&this._setCollapseState(e,{collapsed:!1,recursive:!1})})}refilter(){const e=this.root.renderNodeCount,t=this.updateNodeAfterFilterChange(this.root);this.list.splice(0,e,t),this.refilterDelayer.cancel()}createTreeNode(e,t,i,r,s,o){const a={parent:t,element:e.element,children:[],depth:t.depth+1,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:typeof e.collapsible=="boolean"?e.collapsible:typeof e.collapsed<"u",collapsed:typeof e.collapsed>"u"?this.collapseByDefault:e.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},l=this._filterNode(a,i);a.visibility=l,r&&s.push(a);const c=e.children||zn.empty(),u=r&&l!==0&&!a.collapsed;let d=0,h=1;for(const f of c){const g=this.createTreeNode(f,a,l,u,s,o);a.children.push(g),h+=g.renderNodeCount,g.visible&&(g.visibleChildIndex=d++)}return this.allowNonCollapsibleParents||(a.collapsible=a.collapsible||a.children.length>0),a.visibleChildrenCount=d,a.visible=l===2?d>0:l===1,a.visible?a.collapsed||(a.renderNodeCount=h):(a.renderNodeCount=0,r&&s.pop()),o?.(a),a}updateNodeAfterCollapseChange(e){const t=e.renderNodeCount,i=[];return this._updateNodeAfterCollapseChange(e,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterCollapseChange(e,t){if(e.visible===!1)return 0;if(t.push(e),e.renderNodeCount=1,!e.collapsed)for(const i of e.children)e.renderNodeCount+=this._updateNodeAfterCollapseChange(i,t);return this._onDidChangeRenderNodeCount.fire(e),e.renderNodeCount}updateNodeAfterFilterChange(e){const t=e.renderNodeCount,i=[];return this._updateNodeAfterFilterChange(e,e.visible?1:0,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterFilterChange(e,t,i,r=!0){let s;if(e!==this.root){if(s=this._filterNode(e,t),s===0)return e.visible=!1,e.renderNodeCount=0,!1;r&&i.push(e)}const o=i.length;e.renderNodeCount=e===this.root?0:1;let a=!1;if(!e.collapsed||s!==0){let l=0;for(const c of e.children)a=this._updateNodeAfterFilterChange(c,s,i,r&&!e.collapsed)||a,c.visible&&(c.visibleChildIndex=l++);e.visibleChildrenCount=l}else e.visibleChildrenCount=0;return e!==this.root&&(e.visible=s===2?a:s===1,e.visibility=s),e.visible?e.collapsed||(e.renderNodeCount+=i.length-o):(e.renderNodeCount=0,r&&i.pop()),this._onDidChangeRenderNodeCount.fire(e),e.visible}_updateAncestorsRenderNodeCount(e,t){if(t!==0)for(;e;)e.renderNodeCount+=t,this._onDidChangeRenderNodeCount.fire(e),e=e.parent}_filterNode(e,t){const i=this.filter?this.filter.filter(e.element,t):1;return typeof i=="boolean"?(e.filterData=void 0,i?1:0):oce(i)?(e.filterData=i.data,MN(i.visibility)):(e.filterData=void 0,MN(i))}hasTreeNode(e,t=this.root){if(!e||e.length===0)return!0;const[i,...r]=e;return i<0||i>t.children.length?!1:this.hasTreeNode(r,t.children[i])}getTreeNode(e,t=this.root){if(!e||e.length===0)return t;const[i,...r]=e;if(i<0||i>t.children.length)throw new Wu(this.user,"Invalid tree location");return this.getTreeNode(r,t.children[i])}getTreeNodeWithListIndex(e){if(e.length===0)return{node:this.root,listIndex:-1,revealed:!0,visible:!1};const{parentNode:t,listIndex:i,revealed:r,visible:s}=this.getParentNodeWithListIndex(e),o=e[e.length-1];if(o<0||o>t.children.length)throw new Wu(this.user,"Invalid tree location");const a=t.children[o];return{node:a,listIndex:i,revealed:r,visible:s&&a.visible}}getParentNodeWithListIndex(e,t=this.root,i=0,r=!0,s=!0){const[o,...a]=e;if(o<0||o>t.children.length)throw new Wu(this.user,"Invalid tree location");for(let l=0;lt.element)),this.data=e}}function mq(n){return n instanceof uO?new B2t(n):n}class $2t{constructor(e,t){this.modelProvider=e,this.dnd=t,this.autoExpandDisposable=me.None,this.disposables=new ke}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map(i=>i.element),t)}onDragStart(e,t){this.dnd.onDragStart?.(mq(e),t)}onDragOver(e,t,i,r,s,o=!0){const a=this.dnd.onDragOver(mq(e),t&&t.element,i,r,s),l=this.autoExpandNode!==t;if(l&&(this.autoExpandDisposable.dispose(),this.autoExpandNode=t),typeof t>"u")return a;if(l&&typeof a!="boolean"&&a.autoExpand&&(this.autoExpandDisposable=Sb(()=>{const f=this.modelProvider(),g=f.getNodeLocation(t);f.isCollapsed(g)&&f.setCollapsed(g,!1),this.autoExpandNode=void 0},500,this.disposables)),typeof a=="boolean"||!a.accept||typeof a.bubble>"u"||a.feedback){if(!o){const f=typeof a=="boolean"?a:a.accept,g=typeof a=="boolean"?void 0:a.effect;return{accept:f,effect:g,feedback:[i]}}return a}if(a.bubble===1){const f=this.modelProvider(),g=f.getNodeLocation(t),p=f.getParentNodeLocation(g),m=f.getNode(p),_=p&&f.getListIndex(p);return this.onDragOver(e,m,_,r,s,!1)}const c=this.modelProvider(),u=c.getNodeLocation(t),d=c.getListIndex(u),h=c.getListRenderCount(u);return{...a,feedback:sc(d,d+h)}}drop(e,t,i,r,s){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(mq(e),t&&t.element,i,r,s)}onDragEnd(e){this.dnd.onDragEnd?.(e)}dispose(){this.disposables.dispose(),this.dnd.dispose()}}function W2t(n,e){return e&&{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(t.element)}},dnd:e.dnd&&new $2t(n,e.dnd),multipleSelectionController:e.multipleSelectionController&&{isSelectionSingleChangeEvent(t){return e.multipleSelectionController.isSelectionSingleChangeEvent({...t,element:t.element})},isSelectionRangeChangeEvent(t){return e.multipleSelectionController.isSelectionRangeChangeEvent({...t,element:t.element})}},accessibilityProvider:e.accessibilityProvider&&{...e.accessibilityProvider,getSetSize(t){const i=n(),r=i.getNodeLocation(t),s=i.getParentNodeLocation(r);return i.getNode(s).visibleChildrenCount},getPosInSet(t){return t.visibleChildIndex+1},isChecked:e.accessibilityProvider&&e.accessibilityProvider.isChecked?t=>e.accessibilityProvider.isChecked(t.element):void 0,getRole:e.accessibilityProvider&&e.accessibilityProvider.getRole?t=>e.accessibilityProvider.getRole(t.element):()=>"treeitem",getAriaLabel(t){return e.accessibilityProvider.getAriaLabel(t.element)},getWidgetAriaLabel(){return e.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:e.accessibilityProvider&&e.accessibilityProvider.getWidgetRole?()=>e.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:e.accessibilityProvider&&e.accessibilityProvider.getAriaLevel?t=>e.accessibilityProvider.getAriaLevel(t.element):t=>t.depth,getActiveDescendantId:e.accessibilityProvider.getActiveDescendantId&&(t=>e.accessibilityProvider.getActiveDescendantId(t.element))},keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(t){return e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t.element)}}}}class ace{constructor(e){this.delegate=e}getHeight(e){return this.delegate.getHeight(e.element)}getTemplateId(e){return this.delegate.getTemplateId(e.element)}hasDynamicHeight(e){return!!this.delegate.hasDynamicHeight&&this.delegate.hasDynamicHeight(e.element)}setDynamicHeight(e,t){this.delegate.setDynamicHeight?.(e.element,t)}}var yE;(function(n){n.None="none",n.OnHover="onHover",n.Always="always"})(yE||(yE={}));class H2t{get elements(){return this._elements}constructor(e,t=[]){this._elements=t,this.disposables=new ke,this.onDidChange=Ge.forEach(e,i=>this._elements=i,this.disposables)}dispose(){this.disposables.dispose()}}class q8{static{this.DefaultIndent=8}constructor(e,t,i,r,s,o={}){this.renderer=e,this.modelProvider=t,this.activeNodes=r,this.renderedIndentGuides=s,this.renderedElements=new Map,this.renderedNodes=new Map,this.indent=q8.DefaultIndent,this.hideTwistiesOfChildlessElements=!1,this.shouldRenderIndentGuides=!1,this.activeIndentNodes=new Set,this.indentGuidesDisposable=me.None,this.disposables=new ke,this.templateId=e.templateId,this.updateOptions(o),Ge.map(i,a=>a.node)(this.onDidChangeNodeTwistieState,this,this.disposables),e.onDidChangeTwistieState?.(this.onDidChangeTwistieState,this,this.disposables)}updateOptions(e={}){if(typeof e.indent<"u"){const t=Il(e.indent,0,40);if(t!==this.indent){this.indent=t;for(const[i,r]of this.renderedNodes)this.renderTreeElement(i,r)}}if(typeof e.renderIndentGuides<"u"){const t=e.renderIndentGuides!==yE.None;if(t!==this.shouldRenderIndentGuides){this.shouldRenderIndentGuides=t;for(const[i,r]of this.renderedNodes)this._renderIndentGuides(i,r);if(this.indentGuidesDisposable.dispose(),t){const i=new ke;this.activeNodes.onDidChange(this._onDidChangeActiveNodes,this,i),this.indentGuidesDisposable=i,this._onDidChangeActiveNodes(this.activeNodes.elements)}}}typeof e.hideTwistiesOfChildlessElements<"u"&&(this.hideTwistiesOfChildlessElements=e.hideTwistiesOfChildlessElements)}renderTemplate(e){const t=Ne(e,qe(".monaco-tl-row")),i=Ne(t,qe(".monaco-tl-indent")),r=Ne(t,qe(".monaco-tl-twistie")),s=Ne(t,qe(".monaco-tl-contents")),o=this.renderer.renderTemplate(s);return{container:e,indent:i,twistie:r,indentGuidesDisposable:me.None,templateData:o}}renderElement(e,t,i,r){this.renderedNodes.set(e,i),this.renderedElements.set(e.element,e),this.renderTreeElement(e,i),this.renderer.renderElement(e,t,i.templateData,r)}disposeElement(e,t,i,r){i.indentGuidesDisposable.dispose(),this.renderer.disposeElement?.(e,t,i.templateData,r),typeof r=="number"&&(this.renderedNodes.delete(e),this.renderedElements.delete(e.element))}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}onDidChangeTwistieState(e){const t=this.renderedElements.get(e);t&&this.onDidChangeNodeTwistieState(t)}onDidChangeNodeTwistieState(e){const t=this.renderedNodes.get(e);t&&(this._onDidChangeActiveNodes(this.activeNodes.elements),this.renderTreeElement(e,t))}renderTreeElement(e,t){const i=q8.DefaultIndent+(e.depth-1)*this.indent;t.twistie.style.paddingLeft=`${i}px`,t.indent.style.width=`${i+this.indent-16}px`,e.collapsible?t.container.setAttribute("aria-expanded",String(!e.collapsed)):t.container.removeAttribute("aria-expanded"),t.twistie.classList.remove(...zt.asClassNameArray(ze.treeItemExpanded));let r=!1;this.renderer.renderTwistie&&(r=this.renderer.renderTwistie(e.element,t.twistie)),e.collapsible&&(!this.hideTwistiesOfChildlessElements||e.visibleChildrenCount>0)?(r||t.twistie.classList.add(...zt.asClassNameArray(ze.treeItemExpanded)),t.twistie.classList.add("collapsible"),t.twistie.classList.toggle("collapsed",e.collapsed)):t.twistie.classList.remove("collapsible","collapsed"),this._renderIndentGuides(e,t)}_renderIndentGuides(e,t){if(Jo(t.indent),t.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;const i=new ke,r=this.modelProvider();for(;;){const s=r.getNodeLocation(e),o=r.getParentNodeLocation(s);if(!o)break;const a=r.getNode(o),l=qe(".indent-guide",{style:`width: ${this.indent}px`});this.activeIndentNodes.has(a)&&l.classList.add("active"),t.indent.childElementCount===0?t.indent.appendChild(l):t.indent.insertBefore(l,t.indent.firstElementChild),this.renderedIndentGuides.add(a,l),i.add(Lt(()=>this.renderedIndentGuides.delete(a,l))),e=a}t.indentGuidesDisposable=i}_onDidChangeActiveNodes(e){if(!this.shouldRenderIndentGuides)return;const t=new Set,i=this.modelProvider();e.forEach(r=>{const s=i.getNodeLocation(r);try{const o=i.getParentNodeLocation(s);r.collapsible&&r.children.length>0&&!r.collapsed?t.add(r):o&&t.add(i.getNode(o))}catch{}}),this.activeIndentNodes.forEach(r=>{t.has(r)||this.renderedIndentGuides.forEach(r,s=>s.classList.remove("active"))}),t.forEach(r=>{this.activeIndentNodes.has(r)||this.renderedIndentGuides.forEach(r,s=>s.classList.add("active"))}),this.activeIndentNodes=t}dispose(){this.renderedNodes.clear(),this.renderedElements.clear(),this.indentGuidesDisposable.dispose(),er(this.disposables)}}class V2t{get totalCount(){return this._totalCount}get matchCount(){return this._matchCount}constructor(e,t,i){this.tree=e,this.keyboardNavigationLabelProvider=t,this._filter=i,this._totalCount=0,this._matchCount=0,this._pattern="",this._lowercasePattern="",this.disposables=new ke,e.onWillRefilter(this.reset,this,this.disposables)}filter(e,t){let i=1;if(this._filter){const o=this._filter.filter(e,t);if(typeof o=="boolean"?i=o?1:0:oce(o)?i=MN(o.visibility):i=o,i===0)return!1}if(this._totalCount++,!this._pattern)return this._matchCount++,{data:vg.Default,visibility:i};const r=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e),s=Array.isArray(r)?r:[r];for(const o of s){const a=o&&o.toString();if(typeof a>"u")return{data:vg.Default,visibility:i};let l;if(this.tree.findMatchType===$w.Contiguous){const c=a.toLowerCase().indexOf(this._lowercasePattern);if(c>-1){l=[Number.MAX_SAFE_INTEGER,0];for(let u=this._lowercasePattern.length;u>0;u--)l.push(c+u-1)}}else l=Ow(this._pattern,this._lowercasePattern,0,a,a.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});if(l)return this._matchCount++,s.length===1?{data:l,visibility:i}:{data:{label:a,score:l},visibility:i}}return this.tree.findMode===__.Filter?typeof this.tree.options.defaultFindVisibility=="number"?this.tree.options.defaultFindVisibility:this.tree.options.defaultFindVisibility?this.tree.options.defaultFindVisibility(e):2:{data:vg.Default,visibility:i}}reset(){this._totalCount=0,this._matchCount=0}dispose(){er(this.disposables)}}var __;(function(n){n[n.Highlight=0]="Highlight",n[n.Filter=1]="Filter"})(__||(__={}));var $w;(function(n){n[n.Fuzzy=0]="Fuzzy",n[n.Contiguous=1]="Contiguous"})($w||($w={}));let z2t=class{get pattern(){return this._pattern}get mode(){return this._mode}set mode(e){e!==this._mode&&(this._mode=e,this.widget&&(this.widget.mode=this._mode),this.tree.refilter(),this.render(),this._onDidChangeMode.fire(e))}get matchType(){return this._matchType}set matchType(e){e!==this._matchType&&(this._matchType=e,this.widget&&(this.widget.matchType=this._matchType),this.tree.refilter(),this.render(),this._onDidChangeMatchType.fire(e))}constructor(e,t,i,r,s,o={}){this.tree=e,this.view=i,this.filter=r,this.contextViewProvider=s,this.options=o,this._pattern="",this.width=0,this._onDidChangeMode=new fe,this.onDidChangeMode=this._onDidChangeMode.event,this._onDidChangeMatchType=new fe,this.onDidChangeMatchType=this._onDidChangeMatchType.event,this._onDidChangePattern=new fe,this._onDidChangeOpenState=new fe,this.onDidChangeOpenState=this._onDidChangeOpenState.event,this.enabledDisposables=new ke,this.disposables=new ke,this._mode=e.options.defaultFindMode??__.Highlight,this._matchType=e.options.defaultFindMatchType??$w.Fuzzy,t.onDidSplice(this.onDidSpliceModel,this,this.disposables)}updateOptions(e={}){e.defaultFindMode!==void 0&&(this.mode=e.defaultFindMode),e.defaultFindMatchType!==void 0&&(this.matchType=e.defaultFindMatchType)}onDidSpliceModel(){!this.widget||this.pattern.length===0||(this.tree.refilter(),this.render())}render(){const e=this.filter.totalCount>0&&this.filter.matchCount===0;this.pattern&&e?(ql(w("replFindNoResults","No results")),this.tree.options.showNotFoundMessage??!0?this.widget?.showMessage({type:2,content:w("not found","No elements found.")}):this.widget?.showMessage({type:2})):(this.widget?.clearMessage(),this.pattern&&ql(w("replFindResults","{0} results",this.filter.matchCount)))}shouldAllowFocus(e){return!this.widget||!this.pattern||this.filter.totalCount>0&&this.filter.matchCount<=1?!0:!vg.isDefault(e.filterData)}layout(e){this.width=e,this.widget?.layout(e)}dispose(){this._history=void 0,this._onDidChangePattern.dispose(),this.enabledDisposables.dispose(),this.disposables.dispose()}};function U2t(n,e){return n.position===e.position&&m6e(n,e)}function m6e(n,e){return n.node.element===e.node.element&&n.startIndex===e.startIndex&&n.height===e.height&&n.endIndex===e.endIndex}class j2t{constructor(e=[]){this.stickyNodes=e}get count(){return this.stickyNodes.length}equal(e){return $r(this.stickyNodes,e.stickyNodes,U2t)}lastNodePartiallyVisible(){if(this.count===0)return!1;const e=this.stickyNodes[this.count-1];if(this.count===1)return e.position!==0;const t=this.stickyNodes[this.count-2];return t.position+t.height!==e.position}animationStateChanged(e){if(!$r(this.stickyNodes,e.stickyNodes,m6e)||this.count===0)return!1;const t=this.stickyNodes[this.count-1],i=e.stickyNodes[e.count-1];return t.position!==i.position}}class q2t{constrainStickyScrollNodes(e,t,i){for(let r=0;ri||r>=t)return e.slice(0,r)}return e}}let Aye=class extends me{constructor(e,t,i,r,s,o={}){super(),this.tree=e,this.model=t,this.view=i,this.treeDelegate=s,this.maxWidgetViewRatio=.4;const a=this.validateStickySettings(o);this.stickyScrollMaxItemCount=a.stickyScrollMaxItemCount,this.stickyScrollDelegate=o.stickyScrollDelegate??new q2t,this._widget=this._register(new K2t(i.getScrollableElement(),i,e,r,s,o.accessibilityProvider)),this.onDidChangeHasFocus=this._widget.onDidChangeHasFocus,this.onContextMenu=this._widget.onContextMenu,this._register(i.onDidScroll(()=>this.update())),this._register(i.onDidChangeContentHeight(()=>this.update())),this._register(e.onDidChangeCollapseState(()=>this.update())),this.update()}get height(){return this._widget.height}getNodeAtHeight(e){let t;if(e===0?t=this.view.firstVisibleIndex:t=this.view.indexAt(e+this.view.scrollTop),!(t<0||t>=this.view.length))return this.view.element(t)}update(){const e=this.getNodeAtHeight(0);if(!e||this.tree.scrollTop===0){this._widget.setState(void 0);return}const t=this.findStickyState(e);this._widget.setState(t)}findStickyState(e){const t=[];let i=e,r=0,s=this.getNextStickyNode(i,void 0,r);for(;s&&(t.push(s),r+=s.height,!(t.length<=this.stickyScrollMaxItemCount&&(i=this.getNextVisibleNode(s),!i)));)s=this.getNextStickyNode(i,s.node,r);const o=this.constrainStickyNodes(t);return o.length?new j2t(o):void 0}getNextVisibleNode(e){return this.getNodeAtHeight(e.position+e.height)}getNextStickyNode(e,t,i){const r=this.getAncestorUnderPrevious(e,t);if(r&&!(r===e&&(!this.nodeIsUncollapsedParent(e)||this.nodeTopAlignsWithStickyNodesBottom(e,i))))return this.createStickyScrollNode(r,i)}nodeTopAlignsWithStickyNodesBottom(e,t){const i=this.getNodeIndex(e),r=this.view.getElementTop(i),s=t;return this.view.scrollTop===r-s}createStickyScrollNode(e,t){const i=this.treeDelegate.getHeight(e),{startIndex:r,endIndex:s}=this.getNodeRange(e),o=this.calculateStickyNodePosition(s,t,i);return{node:e,position:o,height:i,startIndex:r,endIndex:s}}getAncestorUnderPrevious(e,t=void 0){let i=e,r=this.getParentNode(i);for(;r;){if(r===t)return i;i=r,r=this.getParentNode(i)}if(t===void 0)return i}calculateStickyNodePosition(e,t,i){let r=this.view.getRelativeTop(e);if(r===null&&this.view.firstVisibleIndex===e&&e+1l&&t<=l?l-i:t}constrainStickyNodes(e){if(e.length===0)return[];const t=this.view.renderHeight*this.maxWidgetViewRatio,i=e[e.length-1];if(e.length<=this.stickyScrollMaxItemCount&&i.position+i.height<=t)return e;const r=this.stickyScrollDelegate.constrainStickyScrollNodes(e,this.stickyScrollMaxItemCount,t);if(!r.length)return[];const s=r[r.length-1];if(r.length>this.stickyScrollMaxItemCount||s.position+s.height>t)throw new Error("stickyScrollDelegate violates constraints");return r}getParentNode(e){const t=this.model.getNodeLocation(e),i=this.model.getParentNodeLocation(t);return i?this.model.getNode(i):void 0}nodeIsUncollapsedParent(e){const t=this.model.getNodeLocation(e);return this.model.getListRenderCount(t)>1}getNodeIndex(e){const t=this.model.getNodeLocation(e);return this.model.getListIndex(t)}getNodeRange(e){const t=this.model.getNodeLocation(e),i=this.model.getListIndex(t);if(i<0)throw new Error("Node not found in tree");const r=this.model.getListRenderCount(t),s=i+r-1;return{startIndex:i,endIndex:s}}nodePositionTopBelowWidget(e){const t=[];let i=this.getParentNode(e);for(;i;)t.push(i),i=this.getParentNode(i);let r=0;for(let s=0;s0,i=!!e&&e.count>0;if(!t&&!i||t&&i&&this._previousState.equal(e))return;if(t!==i&&this.setVisible(i),!i){this._previousState=void 0,this._previousElements=[],this._previousStateDisposables.clear();return}const r=e.stickyNodes[e.count-1];if(this._previousState&&e.animationStateChanged(this._previousState))this._previousElements[this._previousState.count-1].style.top=`${r.position}px`;else{this._previousStateDisposables.clear();const s=Array(e.count);for(let o=e.count-1;o>=0;o--){const a=e.stickyNodes[o],{element:l,disposable:c}=this.createElement(a,o,e.count);s[o]=l,this._rootDomNode.appendChild(l),this._previousStateDisposables.add(c)}this.stickyScrollFocus.updateElements(s,e),this._previousElements=s}this._previousState=e,this._rootDomNode.style.height=`${r.position+r.height}px`}createElement(e,t,i){const r=e.startIndex,s=document.createElement("div");s.style.top=`${e.position}px`,this.tree.options.setRowHeight!==!1&&(s.style.height=`${e.height}px`),this.tree.options.setRowLineHeight!==!1&&(s.style.lineHeight=`${e.height}px`),s.classList.add("monaco-tree-sticky-row"),s.classList.add("monaco-list-row"),s.setAttribute("data-index",`${r}`),s.setAttribute("data-parity",r%2===0?"even":"odd"),s.setAttribute("id",this.view.getElementID(r));const o=this.setAccessibilityAttributes(s,e.node.element,t,i),a=this.treeDelegate.getTemplateId(e.node),l=this.treeRenderers.find(h=>h.templateId===a);if(!l)throw new Error(`No renderer found for template id ${a}`);let c=e.node;c===this.tree.getNode(this.tree.getNodeLocation(e.node))&&(c=new Proxy(e.node,{}));const u=l.renderTemplate(s);l.renderElement(c,e.startIndex,u,e.height);const d=Lt(()=>{o.dispose(),l.disposeElement(c,e.startIndex,u,e.height),l.disposeTemplate(u),s.remove()});return{element:s,disposable:d}}setAccessibilityAttributes(e,t,i,r){if(!this.accessibilityProvider)return me.None;this.accessibilityProvider.getSetSize&&e.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(t,i,r))),this.accessibilityProvider.getPosInSet&&e.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(t,i))),this.accessibilityProvider.getRole&&e.setAttribute("role",this.accessibilityProvider.getRole(t)??"treeitem");const s=this.accessibilityProvider.getAriaLabel(t),o=s&&typeof s!="string"?s:Hd(s),a=tn(c=>{const u=c.readObservable(o);u?e.setAttribute("aria-label",u):e.removeAttribute("aria-label")});typeof s=="string"||s&&e.setAttribute("aria-label",s.get());const l=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(t);return typeof l=="number"&&e.setAttribute("aria-level",`${l}`),e.setAttribute("aria-selected",String(!1)),a}setVisible(e){this._rootDomNode.classList.toggle("empty",!e),e||this.stickyScrollFocus.updateElements([],void 0)}domFocus(){this.stickyScrollFocus.domFocus()}focusedLast(){return this.stickyScrollFocus.focusedLast()}dispose(){this.stickyScrollFocus.dispose(),this._previousStateDisposables.dispose(),this._rootDomNode.remove()}};class G2t extends me{get domHasFocus(){return this._domHasFocus}set domHasFocus(e){e!==this._domHasFocus&&(this._onDidChangeHasFocus.fire(e),this._domHasFocus=e)}constructor(e,t){super(),this.container=e,this.view=t,this.focusedIndex=-1,this.elements=[],this._onDidChangeHasFocus=new fe,this.onDidChangeHasFocus=this._onDidChangeHasFocus.event,this._onContextMenu=new fe,this.onContextMenu=this._onContextMenu.event,this._domHasFocus=!1,this._register(Ce(this.container,"focus",()=>this.onFocus())),this._register(Ce(this.container,"blur",()=>this.onBlur())),this._register(this.view.onDidFocus(()=>this.toggleStickyScrollFocused(!1))),this._register(this.view.onKeyDown(i=>this.onKeyDown(i))),this._register(this.view.onMouseDown(i=>this.onMouseDown(i))),this._register(this.view.onContextMenu(i=>this.handleContextMenu(i)))}handleContextMenu(e){const t=e.browserEvent.target;if(!IN(t)&&!wI(t)){this.focusedLast()&&this.view.domFocus();return}if(!Jm(e.browserEvent)){if(!this.state)throw new Error("Context menu should not be triggered when state is undefined");const o=this.state.stickyNodes.findIndex(a=>a.node.element===e.element?.element);if(o===-1)throw new Error("Context menu should not be triggered when element is not in sticky scroll widget");this.container.focus(),this.setFocus(o);return}if(!this.state||this.focusedIndex<0)throw new Error("Context menu key should not be triggered when focus is not in sticky scroll widget");const r=this.state.stickyNodes[this.focusedIndex].node.element,s=this.elements[this.focusedIndex];this._onContextMenu.fire({element:r,anchor:s,browserEvent:e.browserEvent,isStickyScroll:!0})}onKeyDown(e){if(this.domHasFocus&&this.state){if(e.key==="ArrowUp")this.setFocusedElement(Math.max(0,this.focusedIndex-1)),e.preventDefault(),e.stopPropagation();else if(e.key==="ArrowDown"||e.key==="ArrowRight"){if(this.focusedIndex>=this.state.count-1){const t=this.state.stickyNodes[this.state.count-1].startIndex+1;this.view.domFocus(),this.view.setFocus([t]),this.scrollNodeUnderWidget(t,this.state)}else this.setFocusedElement(this.focusedIndex+1);e.preventDefault(),e.stopPropagation()}}}onMouseDown(e){const t=e.browserEvent.target;!IN(t)&&!wI(t)||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation())}updateElements(e,t){if(t&&t.count===0)throw new Error("Sticky scroll state must be undefined when there are no sticky nodes");if(t&&t.count!==e.length)throw new Error("Sticky scroll focus received illigel state");const i=this.focusedIndex;if(this.removeFocus(),this.elements=e,this.state=t,t){const r=Il(i,0,t.count-1);this.setFocus(r)}else this.domHasFocus&&this.view.domFocus();this.container.tabIndex=t?0:-1}setFocusedElement(e){const t=this.state;if(!t)throw new Error("Cannot set focus when state is undefined");if(this.setFocus(e),!(e1?t.stickyNodes[t.count-2]:void 0,s=this.view.getElementTop(e),o=r?r.position+r.height+i.height:i.height;this.view.scrollTop=s-o}domFocus(){if(!this.state)throw new Error("Cannot focus when state is undefined");this.container.focus()}focusedLast(){return this.state?this.view.getHTMLElement().classList.contains("sticky-scroll-focused"):!1}removeFocus(){this.focusedIndex!==-1&&(this.toggleElementFocus(this.elements[this.focusedIndex],!1),this.focusedIndex=-1)}setFocus(e){if(0>e)throw new Error("addFocus() can not remove focus");if(!this.state&&e>=0)throw new Error("Cannot set focus index when state is undefined");if(this.state&&e>=this.state.count)throw new Error("Cannot set focus index to an index that does not exist");const t=this.focusedIndex;t>=0&&this.toggleElementFocus(this.elements[t],!1),e>=0&&this.toggleElementFocus(this.elements[e],!0),this.focusedIndex=e}toggleElementFocus(e,t){this.toggleElementActiveFocus(e,t&&this.domHasFocus),this.toggleElementPassiveFocus(e,t)}toggleCurrentElementActiveFocus(e){this.focusedIndex!==-1&&this.toggleElementActiveFocus(this.elements[this.focusedIndex],e)}toggleElementActiveFocus(e,t){e.classList.toggle("focused",t)}toggleElementPassiveFocus(e,t){e.classList.toggle("passive-focused",t)}toggleStickyScrollFocused(e){this.view.getHTMLElement().classList.toggle("sticky-scroll-focused",e)}onFocus(){if(!this.state||this.elements.length===0)throw new Error("Cannot focus when state is undefined or elements are empty");this.domHasFocus=!0,this.toggleStickyScrollFocused(!0),this.toggleCurrentElementActiveFocus(!0),this.focusedIndex===-1&&this.setFocus(0)}onBlur(){this.domHasFocus=!1,this.toggleCurrentElementActiveFocus(!1)}dispose(){this.toggleStickyScrollFocused(!1),this._onDidChangeHasFocus.fire(!1),super.dispose()}}function G4(n){let e=Ry.Unknown;return Sj(n.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?e=Ry.Twistie:Sj(n.browserEvent.target,"monaco-tl-contents","monaco-tl-row")?e=Ry.Element:Sj(n.browserEvent.target,"monaco-tree-type-filter","monaco-list")&&(e=Ry.Filter),{browserEvent:n.browserEvent,element:n.element?n.element.element:null,target:e}}function Y2t(n){const e=IN(n.browserEvent.target);return{element:n.element?n.element.element:null,browserEvent:n.browserEvent,anchor:n.anchor,isStickyScroll:e}}function iF(n,e){e(n),n.children.forEach(t=>iF(t,e))}class _q{get nodeSet(){return this._nodeSet||(this._nodeSet=this.createNodeSet()),this._nodeSet}constructor(e,t){this.getFirstViewElementWithTrait=e,this.identityProvider=t,this.nodes=[],this._onDidChange=new fe,this.onDidChange=this._onDidChange.event}set(e,t){!t?.__forceEvent&&$r(this.nodes,e)||this._set(e,!1,t)}_set(e,t,i){if(this.nodes=[...e],this.elements=void 0,this._nodeSet=void 0,!t){const r=this;this._onDidChange.fire({get elements(){return r.get()},browserEvent:i})}}get(){return this.elements||(this.elements=this.nodes.map(e=>e.element)),[...this.elements]}getNodes(){return this.nodes}has(e){return this.nodeSet.has(e)}onDidModelSplice({insertedNodes:e,deletedNodes:t}){if(!this.identityProvider){const l=this.createNodeSet(),c=u=>l.delete(u);t.forEach(u=>iF(u,c)),this.set([...l.values()]);return}const i=new Set,r=l=>i.add(this.identityProvider.getId(l.element).toString());t.forEach(l=>iF(l,r));const s=new Map,o=l=>s.set(this.identityProvider.getId(l.element).toString(),l);e.forEach(l=>iF(l,o));const a=[];for(const l of this.nodes){const c=this.identityProvider.getId(l.element).toString();if(!i.has(c))a.push(l);else{const d=s.get(c);d&&d.visible&&a.push(d)}}if(this.nodes.length>0&&a.length===0){const l=this.getFirstViewElementWithTrait();l&&a.push(l)}this._set(a,!0)}createNodeSet(){const e=new Set;for(const t of this.nodes)e.add(t);return e}}class Z2t extends vFe{constructor(e,t,i){super(e),this.tree=t,this.stickyScrollProvider=i}onViewPointer(e){if(gFe(e.browserEvent.target)||lb(e.browserEvent.target)||AD(e.browserEvent.target)||e.browserEvent.isHandledByList)return;const t=e.element;if(!t)return super.onViewPointer(e);if(this.isSelectionRangeChangeEvent(e)||this.isSelectionSingleChangeEvent(e))return super.onViewPointer(e);const i=e.browserEvent.target,r=i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&e.browserEvent.offsetX<16,s=wI(e.browserEvent.target);let o=!1;if(s?o=!0:typeof this.tree.expandOnlyOnTwistieClick=="function"?o=this.tree.expandOnlyOnTwistieClick(t.element):o=!!this.tree.expandOnlyOnTwistieClick,s)this.handleStickyScrollMouseEvent(e,t);else{if(o&&!r&&e.browserEvent.detail!==2)return super.onViewPointer(e);if(!this.tree.expandOnDoubleClick&&e.browserEvent.detail===2)return super.onViewPointer(e)}if(t.collapsible&&(!s||r)){const a=this.tree.getNodeLocation(t),l=e.browserEvent.altKey;if(this.tree.setFocus([a]),this.tree.toggleCollapsed(a,l),r){e.browserEvent.isHandledByList=!0;return}}s||super.onViewPointer(e)}handleStickyScrollMouseEvent(e,t){if(ekt(e.browserEvent.target)||tkt(e.browserEvent.target))return;const i=this.stickyScrollProvider();if(!i)throw new Error("Sticky scroll controller not found");const r=this.list.indexOf(t),s=this.list.getElementTop(r),o=i.nodePositionTopBelowWidget(t);this.tree.scrollTop=s-o,this.list.domFocus(),this.list.setFocus([r]),this.list.setSelection([r])}onDoubleClick(e){e.browserEvent.target.classList.contains("monaco-tl-twistie")||!this.tree.expandOnDoubleClick||e.browserEvent.isHandledByList||super.onDoubleClick(e)}onMouseDown(e){const t=e.browserEvent.target;if(!IN(t)&&!wI(t)){super.onMouseDown(e);return}}onContextMenu(e){const t=e.browserEvent.target;if(!IN(t)&&!wI(t)){super.onContextMenu(e);return}}}class X2t extends dd{constructor(e,t,i,r,s,o,a,l){super(e,t,i,r,l),this.focusTrait=s,this.selectionTrait=o,this.anchorTrait=a}createMouseController(e){return new Z2t(this,e.tree,e.stickyScrollProvider)}splice(e,t,i=[]){if(super.splice(e,t,i),i.length===0)return;const r=[],s=[];let o;i.forEach((a,l)=>{this.focusTrait.has(a)&&r.push(e+l),this.selectionTrait.has(a)&&s.push(e+l),this.anchorTrait.has(a)&&(o=e+l)}),r.length>0&&super.setFocus(j_([...super.getFocus(),...r])),s.length>0&&super.setSelection(j_([...super.getSelection(),...s])),typeof o=="number"&&super.setAnchor(o)}setFocus(e,t,i=!1){super.setFocus(e,t),i||this.focusTrait.set(e.map(r=>this.element(r)),t)}setSelection(e,t,i=!1){super.setSelection(e,t),i||this.selectionTrait.set(e.map(r=>this.element(r)),t)}setAnchor(e,t=!1){super.setAnchor(e),t||(typeof e>"u"?this.anchorTrait.set([]):this.anchorTrait.set([this.element(e)]))}}class _6e{get onDidScroll(){return this.view.onDidScroll}get onDidChangeFocus(){return this.eventBufferer.wrapEvent(this.focus.onDidChange)}get onDidChangeSelection(){return this.eventBufferer.wrapEvent(this.selection.onDidChange)}get onMouseDblClick(){return Ge.filter(Ge.map(this.view.onMouseDblClick,G4),e=>e.target!==Ry.Filter)}get onMouseOver(){return Ge.map(this.view.onMouseOver,G4)}get onMouseOut(){return Ge.map(this.view.onMouseOut,G4)}get onContextMenu(){return Ge.any(Ge.filter(Ge.map(this.view.onContextMenu,Y2t),e=>!e.isStickyScroll),this.stickyScrollController?.onContextMenu??Ge.None)}get onPointer(){return Ge.map(this.view.onPointer,G4)}get onKeyDown(){return this.view.onKeyDown}get onDidFocus(){return this.view.onDidFocus}get onDidChangeModel(){return Ge.signal(this.model.onDidSplice)}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get findMode(){return this.findController?.mode??__.Highlight}set findMode(e){this.findController&&(this.findController.mode=e)}get findMatchType(){return this.findController?.matchType??$w.Fuzzy}set findMatchType(e){this.findController&&(this.findController.matchType=e)}get expandOnDoubleClick(){return typeof this._options.expandOnDoubleClick>"u"?!0:this._options.expandOnDoubleClick}get expandOnlyOnTwistieClick(){return typeof this._options.expandOnlyOnTwistieClick>"u"?!0:this._options.expandOnlyOnTwistieClick}get onDidDispose(){return this.view.onDidDispose}constructor(e,t,i,r,s={}){this._user=e,this._options=s,this.eventBufferer=new UP,this.onDidChangeFindOpenState=Ge.None,this.onDidChangeStickyScrollFocused=Ge.None,this.disposables=new ke,this._onWillRefilter=new fe,this.onWillRefilter=this._onWillRefilter.event,this._onDidUpdateOptions=new fe,this.treeDelegate=new ace(i);const o=new Ove,a=new Ove,l=this.disposables.add(new H2t(a.event)),c=new Xae;this.renderers=r.map(g=>new q8(g,()=>this.model,o.event,l,c,s));for(const g of this.renderers)this.disposables.add(g);let u;s.keyboardNavigationLabelProvider&&(u=new V2t(this,s.keyboardNavigationLabelProvider,s.filter),s={...s,filter:u},this.disposables.add(u)),this.focus=new _q(()=>this.view.getFocusedElements()[0],s.identityProvider),this.selection=new _q(()=>this.view.getSelectedElements()[0],s.identityProvider),this.anchor=new _q(()=>this.view.getAnchorElement(),s.identityProvider),this.view=new X2t(e,t,this.treeDelegate,this.renderers,this.focus,this.selection,this.anchor,{...W2t(()=>this.model,s),tree:this,stickyScrollProvider:()=>this.stickyScrollController}),this.model=this.createModel(e,this.view,s),o.input=this.model.onDidChangeCollapseState;const d=Ge.forEach(this.model.onDidSplice,g=>{this.eventBufferer.bufferEvents(()=>{this.focus.onDidModelSplice(g),this.selection.onDidModelSplice(g)})},this.disposables);d(()=>null,null,this.disposables);const h=this.disposables.add(new fe),f=this.disposables.add(new Qd(0));if(this.disposables.add(Ge.any(d,this.focus.onDidChange,this.selection.onDidChange)(()=>{f.trigger(()=>{const g=new Set;for(const p of this.focus.getNodes())g.add(p);for(const p of this.selection.getNodes())g.add(p);h.fire([...g.values()])})})),a.input=h.event,s.keyboardSupport!==!1){const g=Ge.chain(this.view.onKeyDown,p=>p.filter(m=>!lb(m.target)).map(m=>new or(m)));Ge.chain(g,p=>p.filter(m=>m.keyCode===15))(this.onLeftArrow,this,this.disposables),Ge.chain(g,p=>p.filter(m=>m.keyCode===17))(this.onRightArrow,this,this.disposables),Ge.chain(g,p=>p.filter(m=>m.keyCode===10))(this.onSpace,this,this.disposables)}if((s.findWidgetEnabled??!0)&&s.keyboardNavigationLabelProvider&&s.contextViewProvider){const g=this.options.findWidgetStyles?{styles:this.options.findWidgetStyles}:void 0;this.findController=new z2t(this,this.model,this.view,u,s.contextViewProvider,g),this.focusNavigationFilter=p=>this.findController.shouldAllowFocus(p),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.disposables.add(this.findController),this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindMode=Ge.None,this.onDidChangeFindMatchType=Ge.None;s.enableStickyScroll&&(this.stickyScrollController=new Aye(this,this.model,this.view,this.renderers,this.treeDelegate,s),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus),this.styleElement=id(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===yE.Always)}updateOptions(e={}){this._options={...this._options,...e};for(const t of this.renderers)t.updateOptions(e);this.view.updateOptions(this._options),this.findController?.updateOptions(e),this.updateStickyScroll(e),this._onDidUpdateOptions.fire(this._options),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===yE.Always)}get options(){return this._options}updateStickyScroll(e){!this.stickyScrollController&&this._options.enableStickyScroll?(this.stickyScrollController=new Aye(this,this.model,this.view,this.renderers,this.treeDelegate,this._options),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus):this.stickyScrollController&&!this._options.enableStickyScroll&&(this.onDidChangeStickyScrollFocused=Ge.None,this.stickyScrollController.dispose(),this.stickyScrollController=void 0),this.stickyScrollController?.updateOptions(e)}getHTMLElement(){return this.view.getHTMLElement()}get scrollTop(){return this.view.scrollTop}set scrollTop(e){this.view.scrollTop=e}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get ariaLabel(){return this.view.ariaLabel}set ariaLabel(e){this.view.ariaLabel=e}domFocus(){this.stickyScrollController?.focusedLast()?this.stickyScrollController.domFocus():this.view.domFocus()}layout(e,t){this.view.layout(e,t),yb(t)&&this.findController?.layout(t)}style(e){const t=`.${this.view.domId}`,i=[];e.treeIndentGuidesStroke&&(i.push(`.monaco-list${t}:hover .monaco-tl-indent > .indent-guide, .monaco-list${t}.always .monaco-tl-indent > .indent-guide { border-color: ${e.treeInactiveIndentGuidesStroke}; }`),i.push(`.monaco-list${t} .monaco-tl-indent > .indent-guide.active { border-color: ${e.treeIndentGuidesStroke}; }`));const r=e.treeStickyScrollBackground??e.listBackground;r&&(i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${r}; }`),i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${r}; }`)),e.treeStickyScrollBorder&&i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${e.treeStickyScrollBorder}; }`),e.treeStickyScrollShadow&&i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${e.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`),e.listFocusForeground&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`));const s=A_(e.listFocusAndSelectionOutline,A_(e.listSelectionOutline,e.listFocusOutline??""));s&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${s}; outline-offset: -1px;}`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`)),e.listFocusOutline&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`),i.push(`.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }`),i.push(`.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`),i.push(`.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`)),this.styleElement.textContent=i.join(` +`),this.view.style(e)}getParentElement(e){const t=this.model.getParentNodeLocation(e);return this.model.getNode(t).element}getFirstElementChild(e){return this.model.getFirstElementChild(e)}getNode(e){return this.model.getNode(e)}getNodeLocation(e){return this.model.getNodeLocation(e)}collapse(e,t=!1){return this.model.setCollapsed(e,!0,t)}expand(e,t=!1){return this.model.setCollapsed(e,!1,t)}toggleCollapsed(e,t=!1){return this.model.setCollapsed(e,void 0,t)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}refilter(){this._onWillRefilter.fire(void 0),this.model.refilter()}setSelection(e,t){this.eventBufferer.bufferEvents(()=>{const i=e.map(s=>this.model.getNode(s));this.selection.set(i,t);const r=e.map(s=>this.model.getListIndex(s)).filter(s=>s>-1);this.view.setSelection(r,t,!0)})}getSelection(){return this.selection.get()}setFocus(e,t){this.eventBufferer.bufferEvents(()=>{const i=e.map(s=>this.model.getNode(s));this.focus.set(i,t);const r=e.map(s=>this.model.getListIndex(s)).filter(s=>s>-1);this.view.setFocus(r,t,!0)})}focusNext(e=1,t=!1,i,r=Jm(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusNext(e,t,i,r)}focusPrevious(e=1,t=!1,i,r=Jm(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusPrevious(e,t,i,r)}focusNextPage(e,t=Jm(e)&&e.altKey?void 0:this.focusNavigationFilter){return this.view.focusNextPage(e,t)}focusPreviousPage(e,t=Jm(e)&&e.altKey?void 0:this.focusNavigationFilter){return this.view.focusPreviousPage(e,t,()=>this.stickyScrollController?.height??0)}focusLast(e,t=Jm(e)&&e.altKey?void 0:this.focusNavigationFilter){this.view.focusLast(e,t)}focusFirst(e,t=Jm(e)&&e.altKey?void 0:this.focusNavigationFilter){this.view.focusFirst(e,t)}getFocus(){return this.focus.get()}reveal(e,t){this.model.expandTo(e);const i=this.model.getListIndex(e);if(i!==-1)if(!this.stickyScrollController)this.view.reveal(i,t);else{const r=this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(e));this.view.reveal(i,t,r)}}onLeftArrow(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],r=this.model.getNodeLocation(i);if(!this.model.setCollapsed(r,!0)){const o=this.model.getParentNodeLocation(r);if(!o)return;const a=this.model.getListIndex(o);this.view.reveal(a),this.view.setFocus([a])}}onRightArrow(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],r=this.model.getNodeLocation(i);if(!this.model.setCollapsed(r,!1)){if(!i.children.some(l=>l.visible))return;const[o]=this.view.getFocus(),a=o+1;this.view.reveal(a),this.view.setFocus([a])}}onSpace(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],r=this.model.getNodeLocation(i),s=e.browserEvent.altKey;this.model.setCollapsed(r,void 0,s)}dispose(){er(this.disposables),this.stickyScrollController?.dispose(),this.view.dispose()}}class lce{constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.nodesByIdentity=new Map,this.model=new F2t(e,t,null,i),this.onDidSplice=this.model.onDidSplice,this.onDidChangeCollapseState=this.model.onDidChangeCollapseState,this.onDidChangeRenderNodeCount=this.model.onDidChangeRenderNodeCount,i.sorter&&(this.sorter={compare(r,s){return i.sorter.compare(r.element,s.element)}}),this.identityProvider=i.identityProvider}setChildren(e,t=zn.empty(),i={}){const r=this.getElementLocation(e);this._setChildren(r,this.preserveCollapseState(t),i)}_setChildren(e,t=zn.empty(),i){const r=new Set,s=new Set,o=l=>{if(l.element===null)return;const c=l;if(r.add(c.element),this.nodes.set(c.element,c),this.identityProvider){const u=this.identityProvider.getId(c.element).toString();s.add(u),this.nodesByIdentity.set(u,c)}i.onDidCreateNode?.(c)},a=l=>{if(l.element===null)return;const c=l;if(r.has(c.element)||this.nodes.delete(c.element),this.identityProvider){const u=this.identityProvider.getId(c.element).toString();s.has(u)||this.nodesByIdentity.delete(u)}i.onDidDeleteNode?.(c)};this.model.splice([...e,0],Number.MAX_VALUE,t,{...i,onDidCreateNode:o,onDidDeleteNode:a})}preserveCollapseState(e=zn.empty()){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),zn.map(e,t=>{let i=this.nodes.get(t.element);if(!i&&this.identityProvider){const o=this.identityProvider.getId(t.element).toString();i=this.nodesByIdentity.get(o)}if(!i){let o;return typeof t.collapsed>"u"?o=void 0:t.collapsed===Ru.Collapsed||t.collapsed===Ru.PreserveOrCollapsed?o=!0:t.collapsed===Ru.Expanded||t.collapsed===Ru.PreserveOrExpanded?o=!1:o=!!t.collapsed,{...t,children:this.preserveCollapseState(t.children),collapsed:o}}const r=typeof t.collapsible=="boolean"?t.collapsible:i.collapsible;let s;return typeof t.collapsed>"u"||t.collapsed===Ru.PreserveOrCollapsed||t.collapsed===Ru.PreserveOrExpanded?s=i.collapsed:t.collapsed===Ru.Collapsed?s=!0:t.collapsed===Ru.Expanded?s=!1:s=!!t.collapsed,{...t,collapsible:r,collapsed:s,children:this.preserveCollapseState(t.children)}})}rerender(e){const t=this.getElementLocation(e);this.model.rerender(t)}getFirstElementChild(e=null){const t=this.getElementLocation(e);return this.model.getFirstElementChild(t)}has(e){return this.nodes.has(e)}getListIndex(e){const t=this.getElementLocation(e);return this.model.getListIndex(t)}getListRenderCount(e){const t=this.getElementLocation(e);return this.model.getListRenderCount(t)}isCollapsible(e){const t=this.getElementLocation(e);return this.model.isCollapsible(t)}setCollapsible(e,t){const i=this.getElementLocation(e);return this.model.setCollapsible(i,t)}isCollapsed(e){const t=this.getElementLocation(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){const r=this.getElementLocation(e);return this.model.setCollapsed(r,t,i)}expandTo(e){const t=this.getElementLocation(e);this.model.expandTo(t)}refilter(){this.model.refilter()}getNode(e=null){if(e===null)return this.model.getNode(this.model.rootRef);const t=this.nodes.get(e);if(!t)throw new Wu(this.user,`Tree element not found: ${e}`);return t}getNodeLocation(e){return e.element}getParentNodeLocation(e){if(e===null)throw new Wu(this.user,"Invalid getParentNodeLocation call");const t=this.nodes.get(e);if(!t)throw new Wu(this.user,`Tree element not found: ${e}`);const i=this.model.getNodeLocation(t),r=this.model.getParentNodeLocation(i);return this.model.getNode(r).element}getElementLocation(e){if(e===null)return[];const t=this.nodes.get(e);if(!t)throw new Wu(this.user,`Tree element not found: ${e}`);return this.model.getNodeLocation(t)}}function rF(n){const e=[n.element],t=n.incompressible||!1;return{element:{elements:e,incompressible:t},children:zn.map(zn.from(n.children),rF),collapsible:n.collapsible,collapsed:n.collapsed}}function sF(n){const e=[n.element],t=n.incompressible||!1;let i,r;for(;[r,i]=zn.consume(zn.from(n.children),2),!(r.length!==1||r[0].incompressible);)n=r[0],e.push(n.element);return{element:{elements:e,incompressible:t},children:zn.map(zn.concat(r,i),sF),collapsible:n.collapsible,collapsed:n.collapsed}}function ZQ(n,e=0){let t;return eZQ(i,0)),e===0&&n.element.incompressible?{element:n.element.elements[e],children:t,incompressible:!0,collapsible:n.collapsible,collapsed:n.collapsed}:{element:n.element.elements[e],children:t,collapsible:n.collapsible,collapsed:n.collapsed}}function Nye(n){return ZQ(n,0)}function v6e(n,e,t){return n.element===e?{...n,children:t}:{...n,children:zn.map(zn.from(n.children),i=>v6e(i,e,t))}}const Q2t=n=>({getId(e){return e.elements.map(t=>n.getId(t).toString()).join("\0")}});class J2t{get onDidSplice(){return this.model.onDidSplice}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}constructor(e,t,i={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.model=new lce(e,t,i),this.enabled=typeof i.compressionEnabled>"u"?!0:i.compressionEnabled,this.identityProvider=i.identityProvider}setChildren(e,t=zn.empty(),i){const r=i.diffIdentityProvider&&Q2t(i.diffIdentityProvider);if(e===null){const g=zn.map(t,this.enabled?sF:rF);this._setChildren(null,g,{diffIdentityProvider:r,diffDepth:1/0});return}const s=this.nodes.get(e);if(!s)throw new Wu(this.user,"Unknown compressed tree node");const o=this.model.getNode(s),a=this.model.getParentNodeLocation(s),l=this.model.getNode(a),c=Nye(o),u=v6e(c,e,t),d=(this.enabled?sF:rF)(u),h=i.diffIdentityProvider?(g,p)=>i.diffIdentityProvider.getId(g)===i.diffIdentityProvider.getId(p):void 0;if($r(d.element.elements,o.element.elements,h)){this._setChildren(s,d.children||zn.empty(),{diffIdentityProvider:r,diffDepth:1});return}const f=l.children.map(g=>g===o?d:g);this._setChildren(l.element,f,{diffIdentityProvider:r,diffDepth:o.depth-l.depth})}isCompressionEnabled(){return this.enabled}setCompressionEnabled(e){if(e===this.enabled)return;this.enabled=e;const i=this.model.getNode().children,r=zn.map(i,Nye),s=zn.map(r,e?sF:rF);this._setChildren(null,s,{diffIdentityProvider:this.identityProvider,diffDepth:1/0})}_setChildren(e,t,i){const r=new Set,s=a=>{for(const l of a.element.elements)r.add(l),this.nodes.set(l,a.element)},o=a=>{for(const l of a.element.elements)r.has(l)||this.nodes.delete(l)};this.model.setChildren(e,t,{...i,onDidCreateNode:s,onDidDeleteNode:o})}has(e){return this.nodes.has(e)}getListIndex(e){const t=this.getCompressedNode(e);return this.model.getListIndex(t)}getListRenderCount(e){const t=this.getCompressedNode(e);return this.model.getListRenderCount(t)}getNode(e){if(typeof e>"u")return this.model.getNode();const t=this.getCompressedNode(e);return this.model.getNode(t)}getNodeLocation(e){const t=this.model.getNodeLocation(e);return t===null?null:t.elements[t.elements.length-1]}getParentNodeLocation(e){const t=this.getCompressedNode(e),i=this.model.getParentNodeLocation(t);return i===null?null:i.elements[i.elements.length-1]}getFirstElementChild(e){const t=this.getCompressedNode(e);return this.model.getFirstElementChild(t)}isCollapsible(e){const t=this.getCompressedNode(e);return this.model.isCollapsible(t)}setCollapsible(e,t){const i=this.getCompressedNode(e);return this.model.setCollapsible(i,t)}isCollapsed(e){const t=this.getCompressedNode(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){const r=this.getCompressedNode(e);return this.model.setCollapsed(r,t,i)}expandTo(e){const t=this.getCompressedNode(e);this.model.expandTo(t)}rerender(e){const t=this.getCompressedNode(e);this.model.rerender(t)}refilter(){this.model.refilter()}getCompressedNode(e){if(e===null)return null;const t=this.nodes.get(e);if(!t)throw new Wu(this.user,`Tree element not found: ${e}`);return t}}const eTt=n=>n[n.length-1];class cce{get element(){return this.node.element===null?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map(e=>new cce(this.unwrapper,e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e,t){this.unwrapper=e,this.node=t}}function tTt(n,e){return{splice(t,i,r){e.splice(t,i,r.map(s=>n.map(s)))},updateElementHeight(t,i){e.updateElementHeight(t,i)}}}function nTt(n,e){return{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(n(t))}},sorter:e.sorter&&{compare(t,i){return e.sorter.compare(t.elements[0],i.elements[0])}},filter:e.filter&&{filter(t,i){return e.filter.filter(n(t),i)}}}}class iTt{get onDidSplice(){return Ge.map(this.model.onDidSplice,({insertedNodes:e,deletedNodes:t})=>({insertedNodes:e.map(i=>this.nodeMapper.map(i)),deletedNodes:t.map(i=>this.nodeMapper.map(i))}))}get onDidChangeCollapseState(){return Ge.map(this.model.onDidChangeCollapseState,({node:e,deep:t})=>({node:this.nodeMapper.map(e),deep:t}))}get onDidChangeRenderNodeCount(){return Ge.map(this.model.onDidChangeRenderNodeCount,e=>this.nodeMapper.map(e))}constructor(e,t,i={}){this.rootRef=null,this.elementMapper=i.elementMapper||eTt;const r=s=>this.elementMapper(s.elements);this.nodeMapper=new sce(s=>new cce(r,s)),this.model=new J2t(e,tTt(this.nodeMapper,t),nTt(r,i))}setChildren(e,t=zn.empty(),i={}){this.model.setChildren(e,t,i)}isCompressionEnabled(){return this.model.isCompressionEnabled()}setCompressionEnabled(e){this.model.setCompressionEnabled(e)}has(e){return this.model.has(e)}getListIndex(e){return this.model.getListIndex(e)}getListRenderCount(e){return this.model.getListRenderCount(e)}getNode(e){return this.nodeMapper.map(this.model.getNode(e))}getNodeLocation(e){return e.element}getParentNodeLocation(e){return this.model.getParentNodeLocation(e)}getFirstElementChild(e){const t=this.model.getFirstElementChild(e);return t===null||typeof t>"u"?t:this.elementMapper(t.elements)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}setCollapsed(e,t,i){return this.model.setCollapsed(e,t,i)}expandTo(e){return this.model.expandTo(e)}rerender(e){return this.model.rerender(e)}refilter(){return this.model.refilter()}getCompressedTreeNode(e=null){return this.model.getNode(e)}}var rTt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s};class uce extends _6e{get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}constructor(e,t,i,r,s={}){super(e,t,i,r,s),this.user=e}setChildren(e,t=zn.empty(),i){this.model.setChildren(e,t,i)}rerender(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}hasElement(e){return this.model.has(e)}createModel(e,t,i){return new lce(e,t,i)}}class b6e{get compressedTreeNodeProvider(){return this._compressedTreeNodeProvider()}constructor(e,t,i){this._compressedTreeNodeProvider=e,this.stickyScrollDelegate=t,this.renderer=i,this.templateId=i.templateId,i.onDidChangeTwistieState&&(this.onDidChangeTwistieState=i.onDidChangeTwistieState)}renderTemplate(e){return{compressedTreeNode:void 0,data:this.renderer.renderTemplate(e)}}renderElement(e,t,i,r){let s=this.stickyScrollDelegate.getCompressedNode(e);s||(s=this.compressedTreeNodeProvider.getCompressedTreeNode(e.element)),s.element.elements.length===1?(i.compressedTreeNode=void 0,this.renderer.renderElement(e,t,i.data,r)):(i.compressedTreeNode=s,this.renderer.renderCompressedElements(s,t,i.data,r))}disposeElement(e,t,i,r){i.compressedTreeNode?this.renderer.disposeCompressedElements?.(i.compressedTreeNode,t,i.data,r):this.renderer.disposeElement?.(e,t,i.data,r)}disposeTemplate(e){this.renderer.disposeTemplate(e.data)}renderTwistie(e,t){return this.renderer.renderTwistie?this.renderer.renderTwistie(e,t):!1}}rTt([Ds],b6e.prototype,"compressedTreeNodeProvider",null);class sTt{constructor(e){this.modelProvider=e,this.compressedStickyNodes=new Map}getCompressedNode(e){return this.compressedStickyNodes.get(e)}constrainStickyScrollNodes(e,t,i){if(this.compressedStickyNodes.clear(),e.length===0)return[];for(let r=0;ri||r>=t-1&&tthis,a=new sTt(()=>this.model),l=r.map(c=>new b6e(o,a,c));super(e,t,i,l,{...oTt(o,s),stickyScrollDelegate:a})}setChildren(e,t=zn.empty(),i){this.model.setChildren(e,t,i)}createModel(e,t,i){return new iTt(e,t,i)}updateOptions(e={}){super.updateOptions(e),typeof e.compressionEnabled<"u"&&this.model.setCompressionEnabled(e.compressionEnabled)}getCompressedTreeNode(e=null){return this.model.getCompressedTreeNode(e)}}function vq(n){return{...n,children:[],refreshPromise:void 0,stale:!0,slow:!1,forceExpanded:!1}}function XQ(n,e){return e.parent?e.parent===n?!0:XQ(n,e.parent):!1}function aTt(n,e){return n===e||XQ(n,e)||XQ(e,n)}class dce{get element(){return this.node.element.element}get children(){return this.node.children.map(e=>new dce(e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e){this.node=e}}class lTt{constructor(e,t,i){this.renderer=e,this.nodeMapper=t,this.onDidChangeTwistieState=i,this.renderedNodes=new Map,this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,r){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,r)}renderTwistie(e,t){return e.slow?(t.classList.add(...zt.asClassNameArray(ze.treeItemLoading)),!0):(t.classList.remove(...zt.asClassNameArray(ze.treeItemLoading)),!1)}disposeElement(e,t,i,r){this.renderer.disposeElement?.(this.nodeMapper.map(e),t,i.templateData,r)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear()}}function Rye(n){return{browserEvent:n.browserEvent,elements:n.elements.map(e=>e.element)}}function Pye(n){return{browserEvent:n.browserEvent,element:n.element&&n.element.element,target:n.target}}class cTt extends uO{constructor(e){super(e.elements.map(t=>t.element)),this.data=e}}function bq(n){return n instanceof uO?new cTt(n):n}class uTt{constructor(e){this.dnd=e}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map(i=>i.element),t)}onDragStart(e,t){this.dnd.onDragStart?.(bq(e),t)}onDragOver(e,t,i,r,s,o=!0){return this.dnd.onDragOver(bq(e),t&&t.element,i,r,s)}drop(e,t,i,r,s){this.dnd.drop(bq(e),t&&t.element,i,r,s)}onDragEnd(e){this.dnd.onDragEnd?.(e)}dispose(){this.dnd.dispose()}}function w6e(n){return n&&{...n,collapseByDefault:!0,identityProvider:n.identityProvider&&{getId(e){return n.identityProvider.getId(e.element)}},dnd:n.dnd&&new uTt(n.dnd),multipleSelectionController:n.multipleSelectionController&&{isSelectionSingleChangeEvent(e){return n.multipleSelectionController.isSelectionSingleChangeEvent({...e,element:e.element})},isSelectionRangeChangeEvent(e){return n.multipleSelectionController.isSelectionRangeChangeEvent({...e,element:e.element})}},accessibilityProvider:n.accessibilityProvider&&{...n.accessibilityProvider,getPosInSet:void 0,getSetSize:void 0,getRole:n.accessibilityProvider.getRole?e=>n.accessibilityProvider.getRole(e.element):()=>"treeitem",isChecked:n.accessibilityProvider.isChecked?e=>!!n.accessibilityProvider?.isChecked(e.element):void 0,getAriaLabel(e){return n.accessibilityProvider.getAriaLabel(e.element)},getWidgetAriaLabel(){return n.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:n.accessibilityProvider.getWidgetRole?()=>n.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:n.accessibilityProvider.getAriaLevel&&(e=>n.accessibilityProvider.getAriaLevel(e.element)),getActiveDescendantId:n.accessibilityProvider.getActiveDescendantId&&(e=>n.accessibilityProvider.getActiveDescendantId(e.element))},filter:n.filter&&{filter(e,t){return n.filter.filter(e.element,t)}},keyboardNavigationLabelProvider:n.keyboardNavigationLabelProvider&&{...n.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(e){return n.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element)}},sorter:void 0,expandOnlyOnTwistieClick:typeof n.expandOnlyOnTwistieClick>"u"?void 0:typeof n.expandOnlyOnTwistieClick!="function"?n.expandOnlyOnTwistieClick:e=>n.expandOnlyOnTwistieClick(e.element),defaultFindVisibility:e=>e.hasChildren&&e.stale?1:typeof n.defaultFindVisibility=="number"?n.defaultFindVisibility:typeof n.defaultFindVisibility>"u"?2:n.defaultFindVisibility(e.element)}}function QQ(n,e){e(n),n.children.forEach(t=>QQ(t,e))}class C6e{get onDidScroll(){return this.tree.onDidScroll}get onDidChangeFocus(){return Ge.map(this.tree.onDidChangeFocus,Rye)}get onDidChangeSelection(){return Ge.map(this.tree.onDidChangeSelection,Rye)}get onMouseDblClick(){return Ge.map(this.tree.onMouseDblClick,Pye)}get onPointer(){return Ge.map(this.tree.onPointer,Pye)}get onDidFocus(){return this.tree.onDidFocus}get onDidChangeModel(){return this.tree.onDidChangeModel}get onDidChangeCollapseState(){return this.tree.onDidChangeCollapseState}get onDidChangeFindOpenState(){return this.tree.onDidChangeFindOpenState}get onDidChangeStickyScrollFocused(){return this.tree.onDidChangeStickyScrollFocused}get onDidDispose(){return this.tree.onDidDispose}constructor(e,t,i,r,s,o={}){this.user=e,this.dataSource=s,this.nodes=new Map,this.subTreeRefreshPromises=new Map,this.refreshPromises=new Map,this._onDidRender=new fe,this._onDidChangeNodeSlowState=new fe,this.nodeMapper=new sce(a=>new dce(a)),this.disposables=new ke,this.identityProvider=o.identityProvider,this.autoExpandSingleChildren=typeof o.autoExpandSingleChildren>"u"?!1:o.autoExpandSingleChildren,this.sorter=o.sorter,this.getDefaultCollapseState=a=>o.collapseByDefault?o.collapseByDefault(a)?Ru.PreserveOrCollapsed:Ru.PreserveOrExpanded:void 0,this.tree=this.createTree(e,t,i,r,o),this.onDidChangeFindMode=this.tree.onDidChangeFindMode,this.onDidChangeFindMatchType=this.tree.onDidChangeFindMatchType,this.root=vq({element:void 0,parent:null,hasChildren:!0,defaultCollapseState:void 0}),this.identityProvider&&(this.root={...this.root,id:null}),this.nodes.set(null,this.root),this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState,this,this.disposables)}createTree(e,t,i,r,s){const o=new ace(i),a=r.map(c=>new lTt(c,this.nodeMapper,this._onDidChangeNodeSlowState.event)),l=w6e(s)||{};return new uce(e,t,o,a,l)}updateOptions(e={}){this.tree.updateOptions(e)}getHTMLElement(){return this.tree.getHTMLElement()}get scrollTop(){return this.tree.scrollTop}set scrollTop(e){this.tree.scrollTop=e}get scrollHeight(){return this.tree.scrollHeight}get renderHeight(){return this.tree.renderHeight}domFocus(){this.tree.domFocus()}layout(e,t){this.tree.layout(e,t)}style(e){this.tree.style(e)}getInput(){return this.root.element}async setInput(e,t){this.refreshPromises.forEach(r=>r.cancel()),this.refreshPromises.clear(),this.root.element=e;const i=t&&{viewState:t,focus:[],selection:[]};await this._updateChildren(e,!0,!1,i),i&&(this.tree.setFocus(i.focus),this.tree.setSelection(i.selection)),t&&typeof t.scrollTop=="number"&&(this.scrollTop=t.scrollTop)}async _updateChildren(e=this.root.element,t=!0,i=!1,r,s){if(typeof this.root.element>"u")throw new Wu(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await Ge.toPromise(this._onDidRender.event));const o=this.getDataNode(e);if(await this.refreshAndRenderNode(o,t,r,s),i)try{this.tree.rerender(o)}catch{}}rerender(e){if(e===void 0||e===this.root.element){this.tree.rerender();return}const t=this.getDataNode(e);this.tree.rerender(t)}getNode(e=this.root.element){const t=this.getDataNode(e),i=this.tree.getNode(t===this.root?null:t);return this.nodeMapper.map(i)}collapse(e,t=!1){const i=this.getDataNode(e);return this.tree.collapse(i===this.root?null:i,t)}async expand(e,t=!1){if(typeof this.root.element>"u")throw new Wu(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await Ge.toPromise(this._onDidRender.event));const i=this.getDataNode(e);if(this.tree.hasElement(i)&&!this.tree.isCollapsible(i)||(i.refreshPromise&&(await this.root.refreshPromise,await Ge.toPromise(this._onDidRender.event)),i!==this.root&&!i.refreshPromise&&!this.tree.isCollapsed(i)))return!1;const r=this.tree.expand(i===this.root?null:i,t);return i.refreshPromise&&(await this.root.refreshPromise,await Ge.toPromise(this._onDidRender.event)),r}setSelection(e,t){const i=e.map(r=>this.getDataNode(r));this.tree.setSelection(i,t)}getSelection(){return this.tree.getSelection().map(t=>t.element)}setFocus(e,t){const i=e.map(r=>this.getDataNode(r));this.tree.setFocus(i,t)}getFocus(){return this.tree.getFocus().map(t=>t.element)}reveal(e,t){this.tree.reveal(this.getDataNode(e),t)}getParentElement(e){const t=this.tree.getParentElement(this.getDataNode(e));return t&&t.element}getFirstElementChild(e=this.root.element){const t=this.getDataNode(e),i=this.tree.getFirstElementChild(t===this.root?null:t);return i&&i.element}getDataNode(e){const t=this.nodes.get(e===this.root.element?null:e);if(!t)throw new Wu(this.user,`Data tree node not found: ${e}`);return t}async refreshAndRenderNode(e,t,i,r){await this.refreshNode(e,t,i),!this.disposables.isDisposed&&this.render(e,i,r)}async refreshNode(e,t,i){let r;if(this.subTreeRefreshPromises.forEach((s,o)=>{!r&&aTt(o,e)&&(r=s.then(()=>this.refreshNode(e,t,i)))}),r)return r;if(e!==this.root&&this.tree.getNode(e).collapsed){e.hasChildren=!!this.dataSource.hasChildren(e.element),e.stale=!0,this.setChildren(e,[],t,i);return}return this.doRefreshSubTree(e,t,i)}async doRefreshSubTree(e,t,i){let r;e.refreshPromise=new Promise(s=>r=s),this.subTreeRefreshPromises.set(e,e.refreshPromise),e.refreshPromise.finally(()=>{e.refreshPromise=void 0,this.subTreeRefreshPromises.delete(e)});try{const s=await this.doRefreshNode(e,t,i);e.stale=!1,await fX.settled(s.map(o=>this.doRefreshSubTree(o,t,i)))}finally{r()}}async doRefreshNode(e,t,i){e.hasChildren=!!this.dataSource.hasChildren(e.element);let r;if(!e.hasChildren)r=Promise.resolve(zn.empty());else{const s=this.doGetChildren(e);if(Dve(s))r=Promise.resolve(s);else{const o=Y_(800);o.then(()=>{e.slow=!0,this._onDidChangeNodeSlowState.fire(e)},a=>null),r=s.finally(()=>o.cancel())}}try{const s=await r;return this.setChildren(e,s,t,i)}catch(s){if(e!==this.root&&this.tree.hasElement(e)&&this.tree.collapse(e),uh(s))return[];throw s}finally{e.slow&&(e.slow=!1,this._onDidChangeNodeSlowState.fire(e))}}doGetChildren(e){let t=this.refreshPromises.get(e);if(t)return t;const i=this.dataSource.getChildren(e.element);return Dve(i)?this.processChildren(i):(t=ko(async()=>this.processChildren(await i)),this.refreshPromises.set(e,t),t.finally(()=>{this.refreshPromises.delete(e)}))}_onDidChangeCollapseState({node:e,deep:t}){e.element!==null&&!e.collapsed&&e.element.stale&&(t?this.collapse(e.element.element):this.refreshAndRenderNode(e.element,!1).catch(rn))}setChildren(e,t,i,r){const s=[...t];if(e.children.length===0&&s.length===0)return[];const o=new Map,a=new Map;for(const u of e.children)o.set(u.element,u),this.identityProvider&&a.set(u.id,{node:u,collapsed:this.tree.hasElement(u)&&this.tree.isCollapsed(u)});const l=[],c=s.map(u=>{const d=!!this.dataSource.hasChildren(u);if(!this.identityProvider){const p=vq({element:u,parent:e,hasChildren:d,defaultCollapseState:this.getDefaultCollapseState(u)});return d&&p.defaultCollapseState===Ru.PreserveOrExpanded&&l.push(p),p}const h=this.identityProvider.getId(u).toString(),f=a.get(h);if(f){const p=f.node;return o.delete(p.element),this.nodes.delete(p.element),this.nodes.set(u,p),p.element=u,p.hasChildren=d,i?f.collapsed?(p.children.forEach(m=>QQ(m,_=>this.nodes.delete(_.element))),p.children.splice(0,p.children.length),p.stale=!0):l.push(p):d&&!f.collapsed&&l.push(p),p}const g=vq({element:u,parent:e,id:h,hasChildren:d,defaultCollapseState:this.getDefaultCollapseState(u)});return r&&r.viewState.focus&&r.viewState.focus.indexOf(h)>-1&&r.focus.push(g),r&&r.viewState.selection&&r.viewState.selection.indexOf(h)>-1&&r.selection.push(g),(r&&r.viewState.expanded&&r.viewState.expanded.indexOf(h)>-1||d&&g.defaultCollapseState===Ru.PreserveOrExpanded)&&l.push(g),g});for(const u of o.values())QQ(u,d=>this.nodes.delete(d.element));for(const u of c)this.nodes.set(u.element,u);return e.children.splice(0,e.children.length,...c),e!==this.root&&this.autoExpandSingleChildren&&c.length===1&&l.length===0&&(c[0].forceExpanded=!0,l.push(c[0])),l}render(e,t,i){const r=e.children.map(o=>this.asTreeElement(o,t)),s=i&&{...i,diffIdentityProvider:i.diffIdentityProvider&&{getId(o){return i.diffIdentityProvider.getId(o.element)}}};this.tree.setChildren(e===this.root?null:e,r,s),e!==this.root&&this.tree.setCollapsible(e,e.hasChildren),this._onDidRender.fire()}asTreeElement(e,t){if(e.stale)return{element:e,collapsible:e.hasChildren,collapsed:!0};let i;return t&&t.viewState.expanded&&e.id&&t.viewState.expanded.indexOf(e.id)>-1?i=!1:e.forceExpanded?(i=!1,e.forceExpanded=!1):i=e.defaultCollapseState,{element:e,children:e.hasChildren?zn.map(e.children,r=>this.asTreeElement(r,t)):[],collapsible:e.hasChildren,collapsed:i}}processChildren(e){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),e}dispose(){this.disposables.dispose(),this.tree.dispose()}}class hce{get element(){return{elements:this.node.element.elements.map(e=>e.element),incompressible:this.node.element.incompressible}}get children(){return this.node.children.map(e=>new hce(e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e){this.node=e}}class dTt{constructor(e,t,i,r){this.renderer=e,this.nodeMapper=t,this.compressibleNodeMapperProvider=i,this.onDidChangeTwistieState=r,this.renderedNodes=new Map,this.disposables=[],this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,r){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,r)}renderCompressedElements(e,t,i,r){this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(e),t,i.templateData,r)}renderTwistie(e,t){return e.slow?(t.classList.add(...zt.asClassNameArray(ze.treeItemLoading)),!0):(t.classList.remove(...zt.asClassNameArray(ze.treeItemLoading)),!1)}disposeElement(e,t,i,r){this.renderer.disposeElement?.(this.nodeMapper.map(e),t,i.templateData,r)}disposeCompressedElements(e,t,i,r){this.renderer.disposeCompressedElements?.(this.compressibleNodeMapperProvider().map(e),t,i.templateData,r)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear(),this.disposables=er(this.disposables)}}function hTt(n){const e=n&&w6e(n);return e&&{...e,keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getCompressedNodeKeyboardNavigationLabel(t){return n.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(t.map(i=>i.element))}}}}class fTt extends C6e{constructor(e,t,i,r,s,o,a={}){super(e,t,i,s,o,a),this.compressionDelegate=r,this.compressibleNodeMapper=new sce(l=>new hce(l)),this.filter=a.filter}createTree(e,t,i,r,s){const o=new ace(i),a=r.map(c=>new dTt(c,this.nodeMapper,()=>this.compressibleNodeMapper,this._onDidChangeNodeSlowState.event)),l=hTt(s)||{};return new y6e(e,t,o,a,l)}asTreeElement(e,t){return{incompressible:this.compressionDelegate.isIncompressible(e.element),...super.asTreeElement(e,t)}}updateOptions(e={}){this.tree.updateOptions(e)}render(e,t,i){if(!this.identityProvider)return super.render(e,t);const r=f=>this.identityProvider.getId(f).toString(),s=f=>{const g=new Set;for(const p of f){const m=this.tree.getCompressedTreeNode(p===this.root?null:p);if(m.element)for(const _ of m.element.elements)g.add(r(_.element))}return g},o=s(this.tree.getSelection()),a=s(this.tree.getFocus());super.render(e,t,i);const l=this.getSelection();let c=!1;const u=this.getFocus();let d=!1;const h=f=>{const g=f.element;if(g)for(let p=0;p{const i=this.filter.filter(t,1),r=gTt(i);if(r===2)throw new Error("Recursive tree visibility not supported in async data compressed trees");return r===1})),super.processChildren(e)}}function gTt(n){return typeof n=="boolean"?n?1:0:oce(n)?MN(n.visibility):MN(n)}class pTt extends _6e{constructor(e,t,i,r,s,o={}){super(e,t,i,r,o),this.user=e,this.dataSource=s,this.identityProvider=o.identityProvider}createModel(e,t,i){return new lce(e,t,i)}}new et("isMac",Rn,w("isMac","Whether the operating system is macOS"));new et("isLinux",zl,w("isLinux","Whether the operating system is Linux"));const AW=new et("isWindows",Ta,w("isWindows","Whether the operating system is Windows")),x6e=new et("isWeb",pC,w("isWeb","Whether the platform is a web browser"));new et("isMacNative",Rn&&!pC,w("isMacNative","Whether the operating system is macOS on a non-browser platform"));new et("isIOS",Sg,w("isIOS","Whether the operating system is iOS"));new et("isMobile",p4e,w("isMobile","Whether the platform is a mobile web browser"));new et("isDevelopment",!1,!0);new et("productQualityType","",w("productQualityType","Quality type of VS Code"));const S6e="inputFocus",k6e=new et(S6e,!1,w("inputFocus","Whether keyboard focus is inside an input box"));var v0=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},xr=function(n,e){return function(t,i){e(t,i,n)}};const fh=On("listService");class mTt{get lastFocusedList(){return this._lastFocusedWidget}constructor(){this.disposables=new ke,this.lists=[],this._lastFocusedWidget=void 0,this._hasCreatedStyleController=!1}setLastFocusedList(e){e!==this._lastFocusedWidget&&(this._lastFocusedWidget?.getHTMLElement().classList.remove("last-focused"),this._lastFocusedWidget=e,this._lastFocusedWidget?.getHTMLElement().classList.add("last-focused"))}register(e,t){if(this._hasCreatedStyleController||(this._hasCreatedStyleController=!0,new bFe(id(),"").style(yC)),this.lists.some(r=>r.widget===e))throw new Error("Cannot register the same widget multiple times");const i={widget:e,extraContextKeys:t};return this.lists.push(i),H$(e.getHTMLElement())&&this.setLastFocusedList(e),Qh(e.onDidFocus(()=>this.setLastFocusedList(e)),Lt(()=>this.lists.splice(this.lists.indexOf(i),1)),e.onDidDispose(()=>{this.lists=this.lists.filter(r=>r!==i),this._lastFocusedWidget===e&&this.setLastFocusedList(void 0)}))}dispose(){this.disposables.dispose()}}const FN=new et("listScrollAtBoundary","none");Le.or(FN.isEqualTo("top"),FN.isEqualTo("both"));Le.or(FN.isEqualTo("bottom"),FN.isEqualTo("both"));const E6e=new et("listFocus",!0),L6e=new et("treestickyScrollFocused",!1),NW=new et("listSupportsMultiselect",!0),T6e=Le.and(E6e,Le.not(S6e),L6e.negate()),fce=new et("listHasSelectionOrFocus",!1),gce=new et("listDoubleSelection",!1),pce=new et("listMultiSelection",!1),RW=new et("listSelectionNavigation",!1),_Tt=new et("listSupportsFind",!0),mce=new et("treeElementCanCollapse",!1),vTt=new et("treeElementHasParent",!1),_ce=new et("treeElementCanExpand",!1),bTt=new et("treeElementHasChild",!1),yTt=new et("treeFindOpen",!1),D6e="listTypeNavigationMode",I6e="listAutomaticKeyboardNavigation";function PW(n,e){const t=n.createScoped(e.getHTMLElement());return E6e.bindTo(t),t}function OW(n,e){const t=FN.bindTo(n),i=()=>{const r=e.scrollTop===0,s=e.scrollHeight-e.renderHeight-e.scrollTop<1;r&&s?t.set("both"):r?t.set("top"):s?t.set("bottom"):t.set("none")};return i(),e.onDidScroll(i)}const xC="workbench.list.multiSelectModifier",oF="workbench.list.openMode",Gd="workbench.list.horizontalScrolling",vce="workbench.list.defaultFindMode",bce="workbench.list.typeNavigationMode",K8="workbench.list.keyboardNavigation",Tg="workbench.list.scrollByPage",yce="workbench.list.defaultFindMatchType",BN="workbench.tree.indent",G8="workbench.tree.renderIndentGuides",Dg="workbench.list.smoothScrolling",em="workbench.list.mouseWheelScrollSensitivity",tm="workbench.list.fastScrollSensitivity",Y8="workbench.tree.expandMode",Z8="workbench.tree.enableStickyScroll",X8="workbench.tree.stickyScrollMaxItemCount";function nm(n){return n.getValue(xC)==="alt"}class wTt extends me{constructor(e){super(),this.configurationService=e,this.useAltAsMultipleSelectionModifier=nm(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(xC)&&(this.useAltAsMultipleSelectionModifier=nm(this.configurationService))}))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:mFe(e)}isSelectionRangeChangeEvent(e){return _Fe(e)}}function MW(n,e){const t=n.get(En),i=n.get(xi),r=new ke;return[{...e,keyboardNavigationDelegate:{mightProducePrintableCharacter(o){return i.mightProducePrintableCharacter(o)}},smoothScrolling:!!t.getValue(Dg),mouseWheelScrollSensitivity:t.getValue(em),fastScrollSensitivity:t.getValue(tm),multipleSelectionController:e.multipleSelectionController??r.add(new wTt(t)),keyboardNavigationEventFilter:STt(i),scrollByPage:!!t.getValue(Tg)},r]}let Oye=class extends dd{constructor(e,t,i,r,s,o,a,l,c){const u=typeof s.horizontalScrolling<"u"?s.horizontalScrolling:!!l.getValue(Gd),[d,h]=c.invokeFunction(MW,s);super(e,t,i,r,{keyboardSupport:!1,...d,horizontalScrolling:u}),this.disposables.add(h),this.contextKeyService=PW(o,this),this.disposables.add(OW(this.contextKeyService,this)),this.listSupportsMultiSelect=NW.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(s.multipleSelectionSupport!==!1),RW.bindTo(this.contextKeyService).set(!!s.selectionNavigation),this.listHasSelectionOrFocus=fce.bindTo(this.contextKeyService),this.listDoubleSelection=gce.bindTo(this.contextKeyService),this.listMultiSelection=pce.bindTo(this.contextKeyService),this.horizontalScrolling=s.horizontalScrolling,this._useAltAsMultipleSelectionModifier=nm(l),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),this.updateStyles(s.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{const g=this.getSelection(),p=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(g.length>0||p.length>0),this.listMultiSelection.set(g.length>1),this.listDoubleSelection.set(g.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{const g=this.getSelection(),p=this.getFocus();this.listHasSelectionOrFocus.set(g.length>0||p.length>0)})),this.disposables.add(l.onDidChangeConfiguration(g=>{g.affectsConfiguration(xC)&&(this._useAltAsMultipleSelectionModifier=nm(l));let p={};if(g.affectsConfiguration(Gd)&&this.horizontalScrolling===void 0){const m=!!l.getValue(Gd);p={...p,horizontalScrolling:m}}if(g.affectsConfiguration(Tg)){const m=!!l.getValue(Tg);p={...p,scrollByPage:m}}if(g.affectsConfiguration(Dg)){const m=!!l.getValue(Dg);p={...p,smoothScrolling:m}}if(g.affectsConfiguration(em)){const m=l.getValue(em);p={...p,mouseWheelScrollSensitivity:m}}if(g.affectsConfiguration(tm)){const m=l.getValue(tm);p={...p,fastScrollSensitivity:m}}Object.keys(p).length>0&&this.updateOptions(p)})),this.navigator=new A6e(this,{configurationService:l,...s}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?wC(e):yC)}};Oye=v0([xr(5,jt),xr(6,fh),xr(7,En),xr(8,Tt)],Oye);let Mye=class extends k2t{constructor(e,t,i,r,s,o,a,l,c){const u=typeof s.horizontalScrolling<"u"?s.horizontalScrolling:!!l.getValue(Gd),[d,h]=c.invokeFunction(MW,s);super(e,t,i,r,{keyboardSupport:!1,...d,horizontalScrolling:u}),this.disposables=new ke,this.disposables.add(h),this.contextKeyService=PW(o,this),this.disposables.add(OW(this.contextKeyService,this.widget)),this.horizontalScrolling=s.horizontalScrolling,this.listSupportsMultiSelect=NW.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(s.multipleSelectionSupport!==!1),RW.bindTo(this.contextKeyService).set(!!s.selectionNavigation),this._useAltAsMultipleSelectionModifier=nm(l),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),this.updateStyles(s.overrideStyles),this.disposables.add(l.onDidChangeConfiguration(g=>{g.affectsConfiguration(xC)&&(this._useAltAsMultipleSelectionModifier=nm(l));let p={};if(g.affectsConfiguration(Gd)&&this.horizontalScrolling===void 0){const m=!!l.getValue(Gd);p={...p,horizontalScrolling:m}}if(g.affectsConfiguration(Tg)){const m=!!l.getValue(Tg);p={...p,scrollByPage:m}}if(g.affectsConfiguration(Dg)){const m=!!l.getValue(Dg);p={...p,smoothScrolling:m}}if(g.affectsConfiguration(em)){const m=l.getValue(em);p={...p,mouseWheelScrollSensitivity:m}}if(g.affectsConfiguration(tm)){const m=l.getValue(tm);p={...p,fastScrollSensitivity:m}}Object.keys(p).length>0&&this.updateOptions(p)})),this.navigator=new A6e(this,{configurationService:l,...s}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?wC(e):yC)}dispose(){this.disposables.dispose(),super.dispose()}};Mye=v0([xr(5,jt),xr(6,fh),xr(7,En),xr(8,Tt)],Mye);let Fye=class extends M2t{constructor(e,t,i,r,s,o,a,l,c,u){const d=typeof o.horizontalScrolling<"u"?o.horizontalScrolling:!!c.getValue(Gd),[h,f]=u.invokeFunction(MW,o);super(e,t,i,r,s,{keyboardSupport:!1,...h,horizontalScrolling:d}),this.disposables.add(f),this.contextKeyService=PW(a,this),this.disposables.add(OW(this.contextKeyService,this)),this.listSupportsMultiSelect=NW.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(o.multipleSelectionSupport!==!1),RW.bindTo(this.contextKeyService).set(!!o.selectionNavigation),this.listHasSelectionOrFocus=fce.bindTo(this.contextKeyService),this.listDoubleSelection=gce.bindTo(this.contextKeyService),this.listMultiSelection=pce.bindTo(this.contextKeyService),this.horizontalScrolling=o.horizontalScrolling,this._useAltAsMultipleSelectionModifier=nm(c),this.disposables.add(this.contextKeyService),this.disposables.add(l.register(this)),this.updateStyles(o.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{const p=this.getSelection(),m=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(p.length>0||m.length>0),this.listMultiSelection.set(p.length>1),this.listDoubleSelection.set(p.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{const p=this.getSelection(),m=this.getFocus();this.listHasSelectionOrFocus.set(p.length>0||m.length>0)})),this.disposables.add(c.onDidChangeConfiguration(p=>{p.affectsConfiguration(xC)&&(this._useAltAsMultipleSelectionModifier=nm(c));let m={};if(p.affectsConfiguration(Gd)&&this.horizontalScrolling===void 0){const _=!!c.getValue(Gd);m={...m,horizontalScrolling:_}}if(p.affectsConfiguration(Tg)){const _=!!c.getValue(Tg);m={...m,scrollByPage:_}}if(p.affectsConfiguration(Dg)){const _=!!c.getValue(Dg);m={...m,smoothScrolling:_}}if(p.affectsConfiguration(em)){const _=c.getValue(em);m={...m,mouseWheelScrollSensitivity:_}}if(p.affectsConfiguration(tm)){const _=c.getValue(tm);m={...m,fastScrollSensitivity:_}}Object.keys(m).length>0&&this.updateOptions(m)})),this.navigator=new CTt(this,{configurationService:c,...o}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?wC(e):yC)}dispose(){this.disposables.dispose(),super.dispose()}};Fye=v0([xr(6,jt),xr(7,fh),xr(8,En),xr(9,Tt)],Fye);class wce extends me{constructor(e,t){super(),this.widget=e,this._onDidOpen=this._register(new fe),this.onDidOpen=this._onDidOpen.event,this._register(Ge.filter(this.widget.onDidChangeSelection,i=>Jm(i.browserEvent))(i=>this.onSelectionFromKeyboard(i))),this._register(this.widget.onPointer(i=>this.onPointer(i.element,i.browserEvent))),this._register(this.widget.onMouseDblClick(i=>this.onMouseDblClick(i.element,i.browserEvent))),typeof t?.openOnSingleClick!="boolean"&&t?.configurationService?(this.openOnSingleClick=t?.configurationService.getValue(oF)!=="doubleClick",this._register(t?.configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration(oF)&&(this.openOnSingleClick=t?.configurationService.getValue(oF)!=="doubleClick")}))):this.openOnSingleClick=t?.openOnSingleClick??!0}onSelectionFromKeyboard(e){if(e.elements.length!==1)return;const t=e.browserEvent,i=typeof t.preserveFocus=="boolean"?t.preserveFocus:!0,r=typeof t.pinned=="boolean"?t.pinned:!i;this._open(this.getSelectedElement(),i,r,!1,e.browserEvent)}onPointer(e,t){if(!this.openOnSingleClick||t.detail===2)return;const r=t.button===1,s=!0,o=r,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,s,o,a,t)}onMouseDblClick(e,t){if(!t)return;const i=t.target;if(i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&t.offsetX<16)return;const s=!1,o=!0,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,s,o,a,t)}_open(e,t,i,r,s){e&&this._onDidOpen.fire({editorOptions:{preserveFocus:t,pinned:i,revealIfVisible:!0},sideBySide:r,element:e,browserEvent:s})}}class A6e extends wce{constructor(e,t){super(e,t),this.widget=e}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class CTt extends wce{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class xTt extends wce{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelection()[0]??void 0}}function STt(n){let e=!1;return t=>{if(t.toKeyCodeChord().isModifierKey())return!1;if(e)return e=!1,!1;const i=n.softDispatch(t,t.target);return i.kind===1?(e=!0,!1):(e=!1,i.kind===0)}}let JQ=class extends uce{constructor(e,t,i,r,s,o,a,l,c){const{options:u,getTypeNavigationMode:d,disposable:h}=o.invokeFunction(gO,s);super(e,t,i,r,u),this.disposables.add(h),this.internals=new Ww(this,s,d,s.overrideStyles,a,l,c),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};JQ=v0([xr(5,Tt),xr(6,jt),xr(7,fh),xr(8,En)],JQ);let Bye=class extends y6e{constructor(e,t,i,r,s,o,a,l,c){const{options:u,getTypeNavigationMode:d,disposable:h}=o.invokeFunction(gO,s);super(e,t,i,r,u),this.disposables.add(h),this.internals=new Ww(this,s,d,s.overrideStyles,a,l,c),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};Bye=v0([xr(5,Tt),xr(6,jt),xr(7,fh),xr(8,En)],Bye);let $ye=class extends pTt{constructor(e,t,i,r,s,o,a,l,c,u){const{options:d,getTypeNavigationMode:h,disposable:f}=a.invokeFunction(gO,o);super(e,t,i,r,s,d),this.disposables.add(f),this.internals=new Ww(this,o,h,o.overrideStyles,l,c,u),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles!==void 0&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};$ye=v0([xr(6,Tt),xr(7,jt),xr(8,fh),xr(9,En)],$ye);let eJ=class extends C6e{get onDidOpen(){return this.internals.onDidOpen}constructor(e,t,i,r,s,o,a,l,c,u){const{options:d,getTypeNavigationMode:h,disposable:f}=a.invokeFunction(gO,o);super(e,t,i,r,s,d),this.disposables.add(f),this.internals=new Ww(this,o,h,o.overrideStyles,l,c,u),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};eJ=v0([xr(6,Tt),xr(7,jt),xr(8,fh),xr(9,En)],eJ);let Wye=class extends fTt{constructor(e,t,i,r,s,o,a,l,c,u,d){const{options:h,getTypeNavigationMode:f,disposable:g}=l.invokeFunction(gO,a);super(e,t,i,r,s,o,h),this.disposables.add(g),this.internals=new Ww(this,a,f,a.overrideStyles,c,u,d),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};Wye=v0([xr(7,Tt),xr(8,jt),xr(9,fh),xr(10,En)],Wye);function N6e(n){const e=n.getValue(vce);if(e==="highlight")return __.Highlight;if(e==="filter")return __.Filter;const t=n.getValue(K8);if(t==="simple"||t==="highlight")return __.Highlight;if(t==="filter")return __.Filter}function R6e(n){const e=n.getValue(yce);if(e==="fuzzy")return $w.Fuzzy;if(e==="contiguous")return $w.Contiguous}function gO(n,e){const t=n.get(En),i=n.get(m0),r=n.get(jt),s=n.get(Tt),o=()=>{const h=r.getContextKeyValue(D6e);if(h==="automatic")return Cp.Automatic;if(h==="trigger"||r.getContextKeyValue(I6e)===!1)return Cp.Trigger;const g=t.getValue(bce);if(g==="automatic")return Cp.Automatic;if(g==="trigger")return Cp.Trigger},a=e.horizontalScrolling!==void 0?e.horizontalScrolling:!!t.getValue(Gd),[l,c]=s.invokeFunction(MW,e),u=e.paddingBottom,d=e.renderIndentGuides!==void 0?e.renderIndentGuides:t.getValue(G8);return{getTypeNavigationMode:o,disposable:c,options:{keyboardSupport:!1,...l,indent:typeof t.getValue(BN)=="number"?t.getValue(BN):void 0,renderIndentGuides:d,smoothScrolling:!!t.getValue(Dg),defaultFindMode:N6e(t),defaultFindMatchType:R6e(t),horizontalScrolling:a,scrollByPage:!!t.getValue(Tg),paddingBottom:u,hideTwistiesOfChildlessElements:e.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:e.expandOnlyOnTwistieClick??t.getValue(Y8)==="doubleClick",contextViewProvider:i,findWidgetStyles:Lkt,enableStickyScroll:!!t.getValue(Z8),stickyScrollMaxItemCount:Number(t.getValue(X8))}}}let Ww=class{get onDidOpen(){return this.navigator.onDidOpen}constructor(e,t,i,r,s,o,a){this.tree=e,this.disposables=[],this.contextKeyService=PW(s,e),this.disposables.push(OW(this.contextKeyService,e)),this.listSupportsMultiSelect=NW.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(t.multipleSelectionSupport!==!1),RW.bindTo(this.contextKeyService).set(!!t.selectionNavigation),this.listSupportFindWidget=_Tt.bindTo(this.contextKeyService),this.listSupportFindWidget.set(t.findWidgetEnabled??!0),this.hasSelectionOrFocus=fce.bindTo(this.contextKeyService),this.hasDoubleSelection=gce.bindTo(this.contextKeyService),this.hasMultiSelection=pce.bindTo(this.contextKeyService),this.treeElementCanCollapse=mce.bindTo(this.contextKeyService),this.treeElementHasParent=vTt.bindTo(this.contextKeyService),this.treeElementCanExpand=_ce.bindTo(this.contextKeyService),this.treeElementHasChild=bTt.bindTo(this.contextKeyService),this.treeFindOpen=yTt.bindTo(this.contextKeyService),this.treeStickyScrollFocused=L6e.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=nm(a),this.updateStyleOverrides(r);const c=()=>{const d=e.getFocus()[0];if(!d)return;const h=e.getNode(d);this.treeElementCanCollapse.set(h.collapsible&&!h.collapsed),this.treeElementHasParent.set(!!e.getParentElement(d)),this.treeElementCanExpand.set(h.collapsible&&h.collapsed),this.treeElementHasChild.set(!!e.getFirstElementChild(d))},u=new Set;u.add(D6e),u.add(I6e),this.disposables.push(this.contextKeyService,o.register(e),e.onDidChangeSelection(()=>{const d=e.getSelection(),h=e.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.hasSelectionOrFocus.set(d.length>0||h.length>0),this.hasMultiSelection.set(d.length>1),this.hasDoubleSelection.set(d.length===2)})}),e.onDidChangeFocus(()=>{const d=e.getSelection(),h=e.getFocus();this.hasSelectionOrFocus.set(d.length>0||h.length>0),c()}),e.onDidChangeCollapseState(c),e.onDidChangeModel(c),e.onDidChangeFindOpenState(d=>this.treeFindOpen.set(d)),e.onDidChangeStickyScrollFocused(d=>this.treeStickyScrollFocused.set(d)),a.onDidChangeConfiguration(d=>{let h={};if(d.affectsConfiguration(xC)&&(this._useAltAsMultipleSelectionModifier=nm(a)),d.affectsConfiguration(BN)){const f=a.getValue(BN);h={...h,indent:f}}if(d.affectsConfiguration(G8)&&t.renderIndentGuides===void 0){const f=a.getValue(G8);h={...h,renderIndentGuides:f}}if(d.affectsConfiguration(Dg)){const f=!!a.getValue(Dg);h={...h,smoothScrolling:f}}if(d.affectsConfiguration(vce)||d.affectsConfiguration(K8)){const f=N6e(a);h={...h,defaultFindMode:f}}if(d.affectsConfiguration(bce)||d.affectsConfiguration(K8)){const f=i();h={...h,typeNavigationMode:f}}if(d.affectsConfiguration(yce)){const f=R6e(a);h={...h,defaultFindMatchType:f}}if(d.affectsConfiguration(Gd)&&t.horizontalScrolling===void 0){const f=!!a.getValue(Gd);h={...h,horizontalScrolling:f}}if(d.affectsConfiguration(Tg)){const f=!!a.getValue(Tg);h={...h,scrollByPage:f}}if(d.affectsConfiguration(Y8)&&t.expandOnlyOnTwistieClick===void 0&&(h={...h,expandOnlyOnTwistieClick:a.getValue(Y8)==="doubleClick"}),d.affectsConfiguration(Z8)){const f=a.getValue(Z8);h={...h,enableStickyScroll:f}}if(d.affectsConfiguration(X8)){const f=Math.max(1,a.getValue(X8));h={...h,stickyScrollMaxItemCount:f}}if(d.affectsConfiguration(em)){const f=a.getValue(em);h={...h,mouseWheelScrollSensitivity:f}}if(d.affectsConfiguration(tm)){const f=a.getValue(tm);h={...h,fastScrollSensitivity:f}}Object.keys(h).length>0&&e.updateOptions(h)}),this.contextKeyService.onDidChangeContext(d=>{d.affectsSome(u)&&e.updateOptions({typeNavigationMode:i()})})),this.navigator=new xTt(e,{configurationService:a,...t}),this.disposables.push(this.navigator)}updateOptions(e){e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyleOverrides(e){this.tree.style(e?wC(e):yC)}dispose(){this.disposables=er(this.disposables)}};Ww=v0([xr(4,jt),xr(5,fh),xr(6,En)],Ww);const kTt=Yr.as(ff.Configuration);kTt.registerConfiguration({id:"workbench",order:7,title:w("workbenchConfigurationTitle","Workbench"),type:"object",properties:{[xC]:{type:"string",enum:["ctrlCmd","alt"],markdownEnumDescriptions:[w("multiSelectModifier.ctrlCmd","Maps to `Control` on Windows and Linux and to `Command` on macOS."),w("multiSelectModifier.alt","Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],default:"ctrlCmd",description:w({key:"multiSelectModifier",comment:["- `ctrlCmd` refers to a value the setting can take and should not be localized.","- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized."]},"The modifier to be used to add an item in trees and lists to a multi-selection with the mouse (for example in the explorer, open editors and scm view). The 'Open to Side' mouse gestures - if supported - will adapt such that they do not conflict with the multiselect modifier.")},[oF]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:w({key:"openModeModifier",comment:["`singleClick` and `doubleClick` refers to a value the setting can take and should not be localized."]},"Controls how to open items in trees and lists using the mouse (if supported). Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[Gd]:{type:"boolean",default:!1,description:w("horizontalScrolling setting","Controls whether lists and trees support horizontal scrolling in the workbench. Warning: turning on this setting has a performance implication.")},[Tg]:{type:"boolean",default:!1,description:w("list.scrollByPage","Controls whether clicks in the scrollbar scroll page by page.")},[BN]:{type:"number",default:8,minimum:4,maximum:40,description:w("tree indent setting","Controls tree indentation in pixels.")},[G8]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:w("render tree indent guides","Controls whether the tree should render indent guides.")},[Dg]:{type:"boolean",default:!1,description:w("list smoothScrolling setting","Controls whether lists and trees have smooth scrolling.")},[em]:{type:"number",default:1,markdownDescription:w("Mouse Wheel Scroll Sensitivity","A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")},[tm]:{type:"number",default:5,markdownDescription:w("Fast Scroll Sensitivity","Scrolling speed multiplier when pressing `Alt`.")},[vce]:{type:"string",enum:["highlight","filter"],enumDescriptions:[w("defaultFindModeSettingKey.highlight","Highlight elements when searching. Further up and down navigation will traverse only the highlighted elements."),w("defaultFindModeSettingKey.filter","Filter elements when searching.")],default:"highlight",description:w("defaultFindModeSettingKey","Controls the default find mode for lists and trees in the workbench.")},[K8]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[w("keyboardNavigationSettingKey.simple","Simple keyboard navigation focuses elements which match the keyboard input. Matching is done only on prefixes."),w("keyboardNavigationSettingKey.highlight","Highlight keyboard navigation highlights elements which match the keyboard input. Further up and down navigation will traverse only the highlighted elements."),w("keyboardNavigationSettingKey.filter","Filter keyboard navigation will filter out and hide all the elements which do not match the keyboard input.")],default:"highlight",description:w("keyboardNavigationSettingKey","Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter."),deprecated:!0,deprecationMessage:w("keyboardNavigationSettingKeyDeprecated","Please use 'workbench.list.defaultFindMode' and 'workbench.list.typeNavigationMode' instead.")},[yce]:{type:"string",enum:["fuzzy","contiguous"],enumDescriptions:[w("defaultFindMatchTypeSettingKey.fuzzy","Use fuzzy matching when searching."),w("defaultFindMatchTypeSettingKey.contiguous","Use contiguous matching when searching.")],default:"fuzzy",description:w("defaultFindMatchTypeSettingKey","Controls the type of matching used when searching lists and trees in the workbench.")},[Y8]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:w("expand mode","Controls how tree folders are expanded when clicking the folder names. Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[Z8]:{type:"boolean",default:!0,description:w("sticky scroll","Controls whether sticky scrolling is enabled in trees.")},[X8]:{type:"number",minimum:1,default:7,markdownDescription:w("sticky scroll maximum items","Controls the number of sticky elements displayed in the tree when {0} is enabled.","`#workbench.tree.enableStickyScroll#`")},[bce]:{type:"string",enum:["automatic","trigger"],default:"automatic",markdownDescription:w("typeNavigationMode2","Controls how type navigation works in lists and trees in the workbench. When set to `trigger`, type navigation begins once the `list.triggerTypeNavigation` command is run.")}}});class cb extends me{constructor(e,t){super(),this.options=t,this.text="",this.title="",this.highlights=[],this.didEverRender=!1,this.supportIcons=t?.supportIcons??!1,this.domNode=Ne(e,qe("span.monaco-highlighted-label"))}get element(){return this.domNode}set(e,t=[],i="",r){e||(e=""),r&&(e=cb.escapeNewLines(e,t)),!(this.didEverRender&&this.text===e&&this.title===i&&ru(this.highlights,t))&&(this.text=e,this.title=i,this.highlights=t,this.render())}render(){const e=[];let t=0;for(const i of this.highlights){if(i.end===i.start)continue;if(t{r=s===`\r +`?-1:0,o+=i;for(const a of t)a.end<=o||(a.start>=o&&(a.start+=r),a.end>=o&&(a.end+=r));return i+=r,"⏎"})}}class FT{constructor(e){this._element=e}get element(){return this._element}set textContent(e){this.disposed||e===this._textContent||(this._textContent=e,this._element.textContent=e)}set classNames(e){this.disposed||ru(e,this._classNames)||(this._classNames=e,this._element.classList.value="",this._element.classList.add(...e))}set empty(e){this.disposed||e===this._empty||(this._empty=e,this._element.style.marginLeft=e?"0":"")}dispose(){this.disposed=!0}}class Q8 extends me{constructor(e,t){super(),this.customHovers=new Map,this.creationOptions=t,this.domNode=this._register(new FT(Ne(e,qe(".monaco-icon-label")))),this.labelContainer=Ne(this.domNode.element,qe(".monaco-icon-label-container")),this.nameContainer=Ne(this.labelContainer,qe("span.monaco-icon-name-container")),t?.supportHighlights||t?.supportIcons?this.nameNode=this._register(new TTt(this.nameContainer,!!t.supportIcons)):this.nameNode=new ETt(this.nameContainer),this.hoverDelegate=t?.hoverDelegate??Yl("mouse")}get element(){return this.domNode.element}setLabel(e,t,i){const r=["monaco-icon-label"],s=["monaco-icon-label-container"];let o="";i&&(i.extraClasses&&r.push(...i.extraClasses),i.italic&&r.push("italic"),i.strikethrough&&r.push("strikethrough"),i.disabledCommand&&s.push("disabled"),i.title&&(typeof i.title=="string"?o+=i.title:o+=e));const a=this.domNode.element.querySelector(".monaco-icon-label-iconpath");if(i?.iconPath){let l;!a||!Eo(a)?(l=qe(".monaco-icon-label-iconpath"),this.domNode.element.prepend(l)):l=a,l.style.backgroundImage=Z_(i?.iconPath)}else a&&a.remove();if(this.domNode.classNames=r,this.domNode.element.setAttribute("aria-label",o),this.labelContainer.classList.value="",this.labelContainer.classList.add(...s),this.setupHover(i?.descriptionTitle?this.labelContainer:this.element,i?.title),this.nameNode.setLabel(e,i),t||this.descriptionNode){const l=this.getOrCreateDescriptionNode();l instanceof cb?(l.set(t||"",i?i.descriptionMatches:void 0,void 0,i?.labelEscapeNewLines),this.setupHover(l.element,i?.descriptionTitle)):(l.textContent=t&&i?.labelEscapeNewLines?cb.escapeNewLines(t,[]):t||"",this.setupHover(l.element,i?.descriptionTitle||""),l.empty=!t)}if(i?.suffix||this.suffixNode){const l=this.getOrCreateSuffixNode();l.textContent=i?.suffix??""}}setupHover(e,t){const i=this.customHovers.get(e);if(i&&(i.dispose(),this.customHovers.delete(e)),!t){e.removeAttribute("title");return}if(this.hoverDelegate.showNativeHover)(function(s,o){yc(o)?s.title=Dle(o):o?.markdownNotSupportedFallback?s.title=o.markdownNotSupportedFallback:s.removeAttribute("title")})(e,t);else{const r=Bg().setupManagedHover(this.hoverDelegate,e,t);r&&this.customHovers.set(e,r)}}dispose(){super.dispose();for(const e of this.customHovers.values())e.dispose();this.customHovers.clear()}getOrCreateSuffixNode(){if(!this.suffixNode){const e=this._register(new FT(D0t(this.nameContainer,qe("span.monaco-icon-suffix-container"))));this.suffixNode=this._register(new FT(Ne(e.element,qe("span.label-suffix"))))}return this.suffixNode}getOrCreateDescriptionNode(){if(!this.descriptionNode){const e=this._register(new FT(Ne(this.labelContainer,qe("span.monaco-icon-description-container"))));this.creationOptions?.supportDescriptionHighlights?this.descriptionNode=this._register(new cb(Ne(e.element,qe("span.label-description")),{supportIcons:!!this.creationOptions.supportIcons})):this.descriptionNode=this._register(new FT(Ne(e.element,qe("span.label-description"))))}return this.descriptionNode}}let ETt=class{constructor(e){this.container=e,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&ru(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.innerText="",this.container.classList.remove("multiple"),this.singleLabel=Ne(this.container,qe("a.label-name",{id:t?.domId}))),this.singleLabel.textContent=e;else{this.container.innerText="",this.container.classList.add("multiple"),this.singleLabel=void 0;for(let i=0;i{const s={start:i,end:i+r.length},o=t.map(a=>Ba.intersect(s,a)).filter(a=>!Ba.isEmpty(a)).map(({start:a,end:l})=>({start:a-i,end:l-i}));return i=s.end+e.length,o})}class TTt extends me{constructor(e,t){super(),this.container=e,this.supportIcons=t,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&ru(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.innerText="",this.container.classList.remove("multiple"),this.singleLabel=this._register(new cb(Ne(this.container,qe("a.label-name",{id:t?.domId})),{supportIcons:this.supportIcons}))),this.singleLabel.set(e,t?.matches,void 0,t?.labelEscapeNewLines);else{this.container.innerText="",this.container.classList.add("multiple"),this.singleLabel=void 0;const i=t?.separator||"/",r=LTt(e,i,t?.matches);for(let s=0;s{const n=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});return{collator:n,collatorIsNumeric:n.resolvedOptions().numeric}});function DTt(n,e,t=!1){const i=n||"",r=e||"",s=Hye.value.collator.compare(i,r);return Hye.value.collatorIsNumeric&&s===0&&i!==r?ir.length)return 1}return 0}var FW=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},tJ=function(n,e){return function(t,i){e(t,i,n)}},nJ;const Tf=qe;class O6e{constructor(e,t,i){this.index=e,this.hasCheckbox=t,this._hidden=!1,this._init=new kg(()=>{const r=i.label??"",s=DD(r).text.trim(),o=i.ariaLabel||[r,this.saneDescription,this.saneDetail].map(a=>BCt(a)).filter(a=>!!a).join(", ");return{saneLabel:r,saneSortLabel:s,saneAriaLabel:o}}),this._saneDescription=i.description,this._saneTooltip=i.tooltip}get saneLabel(){return this._init.value.saneLabel}get saneSortLabel(){return this._init.value.saneSortLabel}get saneAriaLabel(){return this._init.value.saneAriaLabel}get element(){return this._element}set element(e){this._element=e}get hidden(){return this._hidden}set hidden(e){this._hidden=e}get saneDescription(){return this._saneDescription}set saneDescription(e){this._saneDescription=e}get saneDetail(){return this._saneDetail}set saneDetail(e){this._saneDetail=e}get saneTooltip(){return this._saneTooltip}set saneTooltip(e){this._saneTooltip=e}get labelHighlights(){return this._labelHighlights}set labelHighlights(e){this._labelHighlights=e}get descriptionHighlights(){return this._descriptionHighlights}set descriptionHighlights(e){this._descriptionHighlights=e}get detailHighlights(){return this._detailHighlights}set detailHighlights(e){this._detailHighlights=e}}class ca extends O6e{constructor(e,t,i,r,s,o){super(e,t,s),this.fireButtonTriggered=i,this._onChecked=r,this.item=s,this._separator=o,this._checked=!1,this.onChecked=t?Ge.map(Ge.filter(this._onChecked.event,a=>a.element===this),a=>a.checked):Ge.None,this._saneDetail=s.detail,this._labelHighlights=s.highlights?.label,this._descriptionHighlights=s.highlights?.description,this._detailHighlights=s.highlights?.detail}get separator(){return this._separator}set separator(e){this._separator=e}get checked(){return this._checked}set checked(e){e!==this._checked&&(this._checked=e,this._onChecked.fire({element:this,checked:e}))}get checkboxDisabled(){return!!this.item.disabled}}var up;(function(n){n[n.NONE=0]="NONE",n[n.MOUSE_HOVER=1]="MOUSE_HOVER",n[n.ACTIVE_ITEM=2]="ACTIVE_ITEM"})(up||(up={}));class K1 extends O6e{constructor(e,t,i){super(e,!1,i),this.fireSeparatorButtonTriggered=t,this.separator=i,this.children=new Array,this.focusInsideSeparator=up.NONE}}class NTt{getHeight(e){return e instanceof K1?30:e.saneDetail?44:22}getTemplateId(e){return e instanceof ca?J8.ID:BW.ID}}class RTt{getWidgetAriaLabel(){return w("quickInput","Quick Input")}getAriaLabel(e){return e.separator?.label?`${e.saneAriaLabel}, ${e.separator.label}`:e.saneAriaLabel}getWidgetRole(){return"listbox"}getRole(e){return e.hasCheckbox?"checkbox":"option"}isChecked(e){if(!(!e.hasCheckbox||!(e instanceof ca)))return{get value(){return e.checked},onDidChange:t=>e.onChecked(()=>t())}}}class M6e{constructor(e){this.hoverDelegate=e}renderTemplate(e){const t=Object.create(null);t.toDisposeElement=new ke,t.toDisposeTemplate=new ke,t.entry=Ne(e,Tf(".quick-input-list-entry"));const i=Ne(t.entry,Tf("label.quick-input-list-label"));t.toDisposeTemplate.add(Jr(i,je.CLICK,c=>{t.checkbox.offsetParent||c.preventDefault()})),t.checkbox=Ne(i,Tf("input.quick-input-list-checkbox")),t.checkbox.type="checkbox";const r=Ne(i,Tf(".quick-input-list-rows")),s=Ne(r,Tf(".quick-input-list-row")),o=Ne(r,Tf(".quick-input-list-row"));t.label=new Q8(s,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.label),t.icon=Vae(t.label.element,Tf(".quick-input-list-icon"));const a=Ne(s,Tf(".quick-input-list-entry-keybinding"));t.keybinding=new l2(a,eu),t.toDisposeTemplate.add(t.keybinding);const l=Ne(o,Tf(".quick-input-list-label-meta"));return t.detail=new Q8(l,{supportHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.detail),t.separator=Ne(t.entry,Tf(".quick-input-list-separator")),t.actionBar=new ed(t.entry,this.hoverDelegate?{hoverDelegate:this.hoverDelegate}:void 0),t.actionBar.domNode.classList.add("quick-input-list-entry-action-bar"),t.toDisposeTemplate.add(t.actionBar),t}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}disposeElement(e,t,i){i.toDisposeElement.clear(),i.actionBar.clear()}}let J8=class extends M6e{static{nJ=this}static{this.ID="quickpickitem"}constructor(e,t){super(e),this.themeService=t,this._itemsWithSeparatorsFrequency=new Map}get templateId(){return nJ.ID}renderTemplate(e){const t=super.renderTemplate(e);return t.toDisposeTemplate.add(Jr(t.checkbox,je.CHANGE,i=>{t.element.checked=t.checkbox.checked})),t}renderElement(e,t,i){const r=e.element;i.element=r,r.element=i.entry??void 0;const s=r.item;i.checkbox.checked=r.checked,i.toDisposeElement.add(r.onChecked(h=>i.checkbox.checked=h)),i.checkbox.disabled=r.checkboxDisabled;const{labelHighlights:o,descriptionHighlights:a,detailHighlights:l}=r;if(s.iconPath){const h=aE(this.themeService.getColorTheme().type)?s.iconPath.dark:s.iconPath.light??s.iconPath.dark,f=Pt.revive(h);i.icon.className="quick-input-list-icon",i.icon.style.backgroundImage=Z_(f)}else i.icon.style.backgroundImage="",i.icon.className=s.iconClass?`quick-input-list-icon ${s.iconClass}`:"";let c;!r.saneTooltip&&r.saneDescription&&(c={markdown:{value:r.saneDescription,supportThemeIcons:!0},markdownNotSupportedFallback:r.saneDescription});const u={matches:o||[],descriptionTitle:c,descriptionMatches:a||[],labelEscapeNewLines:!0};if(u.extraClasses=s.iconClasses,u.italic=s.italic,u.strikethrough=s.strikethrough,i.entry.classList.remove("quick-input-list-separator-as-item"),i.label.setLabel(r.saneLabel,r.saneDescription,u),i.keybinding.set(s.keybinding),r.saneDetail){let h;r.saneTooltip||(h={markdown:{value:r.saneDetail,supportThemeIcons:!0},markdownNotSupportedFallback:r.saneDetail}),i.detail.element.style.display="",i.detail.setLabel(r.saneDetail,void 0,{matches:l,title:h,labelEscapeNewLines:!0})}else i.detail.element.style.display="none";r.separator?.label?(i.separator.textContent=r.separator.label,i.separator.style.display="",this.addItemWithSeparator(r)):i.separator.style.display="none",i.entry.classList.toggle("quick-input-list-separator-border",!!r.separator);const d=s.buttons;d&&d.length?(i.actionBar.push(d.map((h,f)=>TI(h,`id-${f}`,()=>r.fireButtonTriggered({button:h,item:r.item}))),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions")}disposeElement(e,t,i){this.removeItemWithSeparator(e.element),super.disposeElement(e,t,i)}isItemWithSeparatorVisible(e){return this._itemsWithSeparatorsFrequency.has(e)}addItemWithSeparator(e){this._itemsWithSeparatorsFrequency.set(e,(this._itemsWithSeparatorsFrequency.get(e)||0)+1)}removeItemWithSeparator(e){const t=this._itemsWithSeparatorsFrequency.get(e)||0;t>1?this._itemsWithSeparatorsFrequency.set(e,t-1):this._itemsWithSeparatorsFrequency.delete(e)}};J8=nJ=FW([tJ(1,go)],J8);class BW extends M6e{constructor(){super(...arguments),this._visibleSeparatorsFrequency=new Map}static{this.ID="quickpickseparator"}get templateId(){return BW.ID}get visibleSeparators(){return[...this._visibleSeparatorsFrequency.keys()]}isSeparatorVisible(e){return this._visibleSeparatorsFrequency.has(e)}renderTemplate(e){const t=super.renderTemplate(e);return t.checkbox.style.display="none",t}renderElement(e,t,i){const r=e.element;i.element=r,r.element=i.entry??void 0,r.element.classList.toggle("focus-inside",!!r.focusInsideSeparator);const s=r.separator,{labelHighlights:o,descriptionHighlights:a,detailHighlights:l}=r;i.icon.style.backgroundImage="",i.icon.className="";let c;!r.saneTooltip&&r.saneDescription&&(c={markdown:{value:r.saneDescription,supportThemeIcons:!0},markdownNotSupportedFallback:r.saneDescription});const u={matches:o||[],descriptionTitle:c,descriptionMatches:a||[],labelEscapeNewLines:!0};if(i.entry.classList.add("quick-input-list-separator-as-item"),i.label.setLabel(r.saneLabel,r.saneDescription,u),r.saneDetail){let h;r.saneTooltip||(h={markdown:{value:r.saneDetail,supportThemeIcons:!0},markdownNotSupportedFallback:r.saneDetail}),i.detail.element.style.display="",i.detail.setLabel(r.saneDetail,void 0,{matches:l,title:h,labelEscapeNewLines:!0})}else i.detail.element.style.display="none";i.separator.style.display="none",i.entry.classList.add("quick-input-list-separator-border");const d=s.buttons;d&&d.length?(i.actionBar.push(d.map((h,f)=>TI(h,`id-${f}`,()=>r.fireSeparatorButtonTriggered({button:h,separator:r.separator}))),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions"),this.addSeparator(r)}disposeElement(e,t,i){this.removeSeparator(e.element),this.isSeparatorVisible(e.element)||e.element.element?.classList.remove("focus-inside"),super.disposeElement(e,t,i)}addSeparator(e){this._visibleSeparatorsFrequency.set(e,(this._visibleSeparatorsFrequency.get(e)||0)+1)}removeSeparator(e){const t=this._visibleSeparatorsFrequency.get(e)||0;t>1?this._visibleSeparatorsFrequency.set(e,t-1):this._visibleSeparatorsFrequency.delete(e)}}let $N=class extends me{constructor(e,t,i,r,s,o){super(),this.parent=e,this.hoverDelegate=t,this.linkOpenerDelegate=i,this.accessibilityService=o,this._onKeyDown=new fe,this._onLeave=new fe,this.onLeave=this._onLeave.event,this._visibleCountObservable=kn("VisibleCount",0),this.onChangedVisibleCount=Ge.fromObservable(this._visibleCountObservable,this._store),this._allVisibleCheckedObservable=kn("AllVisibleChecked",!1),this.onChangedAllVisibleChecked=Ge.fromObservable(this._allVisibleCheckedObservable,this._store),this._checkedCountObservable=kn("CheckedCount",0),this.onChangedCheckedCount=Ge.fromObservable(this._checkedCountObservable,this._store),this._checkedElementsObservable=CQ({equalsFn:$r},new Array),this.onChangedCheckedElements=Ge.fromObservable(this._checkedElementsObservable,this._store),this._onButtonTriggered=new fe,this.onButtonTriggered=this._onButtonTriggered.event,this._onSeparatorButtonTriggered=new fe,this.onSeparatorButtonTriggered=this._onSeparatorButtonTriggered.event,this._elementChecked=new fe,this._elementCheckedEventBufferer=new UP,this._hasCheckboxes=!1,this._inputElements=new Array,this._elementTree=new Array,this._itemElements=new Array,this._elementDisposable=this._register(new ke),this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._matchOnLabelMode="fuzzy",this._sortByLabel=!0,this._shouldLoop=!0,this._container=Ne(this.parent,Tf(".quick-input-list")),this._separatorRenderer=new BW(t),this._itemRenderer=s.createInstance(J8,t),this._tree=this._register(s.createInstance(JQ,"QuickInput",this._container,new NTt,[this._itemRenderer,this._separatorRenderer],{filter:{filter(a){return a.hidden?0:a instanceof K1?2:1}},sorter:{compare:(a,l)=>{if(!this.sortByLabel||!this._lastQueryString)return 0;const c=this._lastQueryString.toLowerCase();return OTt(a,l,c)}},accessibilityProvider:new RTt,setRowLineHeight:!1,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:yE.None,findWidgetEnabled:!1,indent:0,horizontalScrolling:!1,allowNonCollapsibleParents:!0,alwaysConsumeMouseWheel:!0})),this._tree.getHTMLElement().id=r,this._registerListeners()}get onDidChangeFocus(){return Ge.map(this._tree.onDidChangeFocus,e=>e.elements.filter(t=>t instanceof ca).map(t=>t.item),this._store)}get onDidChangeSelection(){return Ge.map(this._tree.onDidChangeSelection,e=>({items:e.elements.filter(t=>t instanceof ca).map(t=>t.item),event:e.browserEvent}),this._store)}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get ariaLabel(){return this._tree.ariaLabel}set ariaLabel(e){this._tree.ariaLabel=e??""}set enabled(e){this._tree.getHTMLElement().style.pointerEvents=e?"":"none"}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}get shouldLoop(){return this._shouldLoop}set shouldLoop(e){this._shouldLoop=e}_registerListeners(){this._registerOnKeyDown(),this._registerOnContainerClick(),this._registerOnMouseMiddleClick(),this._registerOnTreeModelChanged(),this._registerOnElementChecked(),this._registerOnContextMenu(),this._registerHoverListeners(),this._registerSelectionChangeListener(),this._registerSeparatorActionShowingListeners()}_registerOnKeyDown(){this._register(this._tree.onKeyDown(e=>{const t=new or(e);switch(t.keyCode){case 10:this.toggleCheckbox();break}this._onKeyDown.fire(t)}))}_registerOnContainerClick(){this._register(Ce(this._container,je.CLICK,e=>{(e.x||e.y)&&this._onLeave.fire()}))}_registerOnMouseMiddleClick(){this._register(Ce(this._container,je.AUXCLICK,e=>{e.button===1&&this._onLeave.fire()}))}_registerOnTreeModelChanged(){this._register(this._tree.onDidChangeModel(()=>{const e=this._itemElements.filter(t=>!t.hidden).length;this._visibleCountObservable.set(e,void 0),this._hasCheckboxes&&this._updateCheckedObservables()}))}_registerOnElementChecked(){this._register(this._elementCheckedEventBufferer.wrapEvent(this._elementChecked.event,(e,t)=>t)(e=>this._updateCheckedObservables()))}_registerOnContextMenu(){this._register(this._tree.onContextMenu(e=>{e.element&&(e.browserEvent.preventDefault(),this._tree.setSelection([e.element]))}))}_registerHoverListeners(){const e=this._register(new Z4e(this.hoverDelegate.delay));this._register(this._tree.onMouseOver(async t=>{if(Jve(t.browserEvent.target)){e.cancel();return}if(!(!Jve(t.browserEvent.relatedTarget)&&xo(t.browserEvent.relatedTarget,t.element?.element)))try{await e.trigger(async()=>{t.element instanceof ca&&this.showHover(t.element)})}catch(i){if(!uh(i))throw i}})),this._register(this._tree.onMouseOut(t=>{xo(t.browserEvent.relatedTarget,t.element?.element)||e.cancel()}))}_registerSeparatorActionShowingListeners(){this._register(this._tree.onDidChangeFocus(e=>{const t=e.elements[0]?this._tree.getParentElement(e.elements[0]):null;for(const i of this._separatorRenderer.visibleSeparators){const r=i===t;!!(i.focusInsideSeparator&up.ACTIVE_ITEM)!==r&&(r?i.focusInsideSeparator|=up.ACTIVE_ITEM:i.focusInsideSeparator&=~up.ACTIVE_ITEM,this._tree.rerender(i))}})),this._register(this._tree.onMouseOver(e=>{const t=e.element?this._tree.getParentElement(e.element):null;for(const i of this._separatorRenderer.visibleSeparators){if(i!==t)continue;!!(i.focusInsideSeparator&up.MOUSE_HOVER)||(i.focusInsideSeparator|=up.MOUSE_HOVER,this._tree.rerender(i))}})),this._register(this._tree.onMouseOut(e=>{const t=e.element?this._tree.getParentElement(e.element):null;for(const i of this._separatorRenderer.visibleSeparators){if(i!==t)continue;!!(i.focusInsideSeparator&up.MOUSE_HOVER)&&(i.focusInsideSeparator&=~up.MOUSE_HOVER,this._tree.rerender(i))}}))}_registerSelectionChangeListener(){this._register(this._tree.onDidChangeSelection(e=>{const t=e.elements.filter(i=>i instanceof ca);t.length!==e.elements.length&&(e.elements.length===1&&e.elements[0]instanceof K1&&(this._tree.setFocus([e.elements[0].children[0]]),this._tree.reveal(e.elements[0],0)),this._tree.setSelection(t))}))}setAllVisibleChecked(e){this._elementCheckedEventBufferer.bufferEvents(()=>{this._itemElements.forEach(t=>{!t.hidden&&!t.checkboxDisabled&&(t.checked=e)})})}setElements(e){this._elementDisposable.clear(),this._lastQueryString=void 0,this._inputElements=e,this._hasCheckboxes=this.parent.classList.contains("show-checkboxes");let t;this._itemElements=new Array,this._elementTree=e.reduce((i,r,s)=>{let o;if(r.type==="separator"){if(!r.buttons)return i;t=new K1(s,a=>this._onSeparatorButtonTriggered.fire(a),r),o=t}else{const a=s>0?e[s-1]:void 0;let l;a&&a.type==="separator"&&!a.buttons&&(t=void 0,l=a);const c=new ca(s,this._hasCheckboxes,u=>this._onButtonTriggered.fire(u),this._elementChecked,r,l);if(this._itemElements.push(c),t)return t.children.push(c),i;o=c}return i.push(o),i},new Array),this._setElementsToTree(this._elementTree),this.accessibilityService.isScreenReaderOptimized()&&setTimeout(()=>{const i=this._tree.getHTMLElement().querySelector(".monaco-list-row.focused"),r=i?.parentNode;if(i&&r){const s=i.nextSibling;i.remove(),r.insertBefore(i,s)}},0)}setFocusedElements(e){const t=e.map(i=>this._itemElements.find(r=>r.item===i)).filter(i=>!!i).filter(i=>!i.hidden);if(this._tree.setFocus(t),e.length>0){const i=this._tree.getFocus()[0];i&&this._tree.reveal(i)}}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}setSelectedElements(e){const t=e.map(i=>this._itemElements.find(r=>r.item===i)).filter(i=>!!i);this._tree.setSelection(t)}getCheckedElements(){return this._itemElements.filter(e=>e.checked).map(e=>e.item)}setCheckedElements(e){this._elementCheckedEventBufferer.bufferEvents(()=>{const t=new Set;for(const i of e)t.add(i);for(const i of this._itemElements)i.checked=t.has(i.item)})}focus(e){if(this._itemElements.length)switch(e===yr.Second&&this._itemElements.length<2&&(e=yr.First),e){case yr.First:this._tree.scrollTop=0,this._tree.focusFirst(void 0,t=>t.element instanceof ca);break;case yr.Second:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,i=>i.element instanceof ca?t?!0:(t=!t,!1):!1);break}case yr.Last:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,t=>t.element instanceof ca);break;case yr.Next:{const t=this._tree.getFocus();this._tree.focusNext(void 0,this._shouldLoop,void 0,r=>r.element instanceof ca?(this._tree.reveal(r.element),!0):!1);const i=this._tree.getFocus();t.length&&t[0]===i[0]&&t[0]===this._itemElements[this._itemElements.length-1]&&this._onLeave.fire();break}case yr.Previous:{const t=this._tree.getFocus();this._tree.focusPrevious(void 0,this._shouldLoop,void 0,r=>{if(!(r.element instanceof ca))return!1;const s=this._tree.getParentElement(r.element);return s===null||s.children[0]!==r.element?this._tree.reveal(r.element):this._tree.reveal(s),!0});const i=this._tree.getFocus();t.length&&t[0]===i[0]&&t[0]===this._itemElements[0]&&this._onLeave.fire();break}case yr.NextPage:this._tree.focusNextPage(void 0,t=>t.element instanceof ca?(this._tree.reveal(t.element),!0):!1);break;case yr.PreviousPage:this._tree.focusPreviousPage(void 0,t=>{if(!(t.element instanceof ca))return!1;const i=this._tree.getParentElement(t.element);return i===null||i.children[0]!==t.element?this._tree.reveal(t.element):this._tree.reveal(i),!0});break;case yr.NextSeparator:{let t=!1;const i=this._tree.getFocus()[0];this._tree.focusNext(void 0,!0,void 0,s=>{if(t)return!0;if(s.element instanceof K1)t=!0,this._separatorRenderer.isSeparatorVisible(s.element)?this._tree.reveal(s.element.children[0]):this._tree.reveal(s.element,0);else if(s.element instanceof ca){if(s.element.separator)return this._itemRenderer.isItemWithSeparatorVisible(s.element)?this._tree.reveal(s.element):this._tree.reveal(s.element,0),!0;if(s.element===this._elementTree[0])return this._tree.reveal(s.element,0),!0}return!1});const r=this._tree.getFocus()[0];i===r&&(this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,s=>s.element instanceof ca));break}case yr.PreviousSeparator:{let t,i=!!this._tree.getFocus()[0]?.separator;this._tree.focusPrevious(void 0,!0,void 0,r=>{if(r.element instanceof K1)i?t||(this._separatorRenderer.isSeparatorVisible(r.element)?this._tree.reveal(r.element):this._tree.reveal(r.element,0),t=r.element.children[0]):i=!0;else if(r.element instanceof ca&&!t){if(r.element.separator)this._itemRenderer.isItemWithSeparatorVisible(r.element)?this._tree.reveal(r.element):this._tree.reveal(r.element,0),t=r.element;else if(r.element===this._elementTree[0])return this._tree.reveal(r.element,0),!0}return!1}),t&&this._tree.setFocus([t]);break}}}clearFocus(){this._tree.setFocus([])}domFocus(){this._tree.domFocus()}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}filter(e){if(this._lastQueryString=e,!(this._sortByLabel||this._matchOnLabel||this._matchOnDescription||this._matchOnDetail))return this._tree.layout(),!1;const t=e;if(e=e.trim(),!e||!(this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))this._itemElements.forEach(i=>{i.labelHighlights=void 0,i.descriptionHighlights=void 0,i.detailHighlights=void 0,i.hidden=!1;const r=i.index&&this._inputElements[i.index-1];i.item&&(i.separator=r&&r.type==="separator"&&!r.buttons?r:void 0)});else{let i;this._itemElements.forEach(r=>{let s;this.matchOnLabelMode==="fuzzy"?s=this.matchOnLabel?Xj(e,DD(r.saneLabel))??void 0:void 0:s=this.matchOnLabel?PTt(t,DD(r.saneLabel))??void 0:void 0;const o=this.matchOnDescription?Xj(e,DD(r.saneDescription||""))??void 0:void 0,a=this.matchOnDetail?Xj(e,DD(r.saneDetail||""))??void 0:void 0;if(s||o||a?(r.labelHighlights=s,r.descriptionHighlights=o,r.detailHighlights=a,r.hidden=!1):(r.labelHighlights=void 0,r.descriptionHighlights=void 0,r.detailHighlights=void 0,r.hidden=r.item?!r.item.alwaysShow:!0),r.item?r.separator=void 0:r.separator&&(r.hidden=!0),!this.sortByLabel){const l=r.index&&this._inputElements[r.index-1]||void 0;l?.type==="separator"&&!l.buttons&&(i=l),i&&!r.hidden&&(r.separator=i,i=void 0)}})}return this._setElementsToTree(this._sortByLabel&&e?this._itemElements:this._elementTree),this._tree.layout(),!0}toggleCheckbox(){this._elementCheckedEventBufferer.bufferEvents(()=>{const e=this._tree.getFocus().filter(i=>i instanceof ca),t=this._allVisibleChecked(e);for(const i of e)i.checkboxDisabled||(i.checked=!t)})}style(e){this._tree.style(e)}toggleHover(){const e=this._tree.getFocus()[0];if(!e?.saneTooltip||!(e instanceof ca))return;if(this._lastHover&&!this._lastHover.isDisposed){this._lastHover.dispose();return}this.showHover(e);const t=new ke;t.add(this._tree.onDidChangeFocus(i=>{i.elements[0]instanceof ca&&this.showHover(i.elements[0])})),this._lastHover&&t.add(this._lastHover),this._elementDisposable.add(t)}_setElementsToTree(e){const t=new Array;for(const i of e)i instanceof K1?t.push({element:i,collapsible:!1,collapsed:!1,children:i.children.map(r=>({element:r,collapsible:!1,collapsed:!1}))}):t.push({element:i,collapsible:!1,collapsed:!1});this._tree.setChildren(null,t)}_allVisibleChecked(e,t=!0){for(let i=0,r=e.length;i{this._allVisibleCheckedObservable.set(this._allVisibleChecked(this._itemElements,!1),e);const t=this._itemElements.filter(i=>i.checked).length;this._checkedCountObservable.set(t,e),this._checkedElementsObservable.set(this.getCheckedElements(),e)})}showHover(e){this._lastHover&&!this._lastHover.isDisposed&&(this.hoverDelegate.onDidHideHover?.(),this._lastHover?.dispose()),!(!e.element||!e.saneTooltip)&&(this._lastHover=this.hoverDelegate.showHover({content:e.saneTooltip,target:e.element,linkHandler:t=>{this.linkOpenerDelegate(t)},appearance:{showPointer:!0},container:this._container,position:{hoverPosition:1}},!1))}};FW([Ds],$N.prototype,"onDidChangeFocus",null);FW([Ds],$N.prototype,"onDidChangeSelection",null);$N=FW([tJ(4,Tt),tJ(5,_u)],$N);function PTt(n,e){const{text:t,iconOffsets:i}=e;if(!i||i.length===0)return Vye(n,t);const r=jP(t," "),s=t.length-r.length,o=Vye(n,r);if(o)for(const a of o){const l=i[a.start+s]+s;a.start+=l,a.end+=l}return o}function Vye(n,e){const t=e.toLowerCase().indexOf(n.toLowerCase());return t!==-1?[{start:t,end:t+n.length}]:null}function OTt(n,e,t){const i=n.labelHighlights||[],r=e.labelHighlights||[];return i.length&&!r.length?-1:!i.length&&r.length?1:i.length===0&&r.length===0?0:ITt(n.saneSortLabel,e.saneSortLabel,t)}const F6e={weight:200,when:Le.and(Le.equals(o6e,"quickPick"),l2t),metadata:{description:w("quickPick","Used while in the context of the quick pick. If you change one keybinding for this command, you should change all of the other keybindings (modifier variants) of this command as well.")}};function Gc(n,e={}){jl.registerCommandAndKeybindingRule({...F6e,...n,secondary:MTt(n.primary,n.secondary??[],e)})}const e9=Rn?256:2048;function MTt(n,e,t={}){return t.withAltMod&&e.push(512+n),t.withCtrlMod&&(e.push(e9+n),t.withAltMod&&e.push(512+e9+n)),t.withCmdMod&&Rn&&(e.push(2048+n),t.withCtrlMod&&e.push(2304+n),t.withAltMod&&(e.push(2560+n),t.withCtrlMod&&e.push(2816+n))),e}function Pu(n,e){return t=>{const i=t.get(hh).currentQuickInput;if(i)return e&&i.quickNavigate?i.focus(e):i.focus(n)}}Gc({id:"quickInput.pageNext",primary:12,handler:Pu(yr.NextPage)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});Gc({id:"quickInput.pagePrevious",primary:11,handler:Pu(yr.PreviousPage)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});Gc({id:"quickInput.first",primary:e9+14,handler:Pu(yr.First)},{withAltMod:!0,withCmdMod:!0});Gc({id:"quickInput.last",primary:e9+13,handler:Pu(yr.Last)},{withAltMod:!0,withCmdMod:!0});Gc({id:"quickInput.next",primary:18,handler:Pu(yr.Next)},{withCtrlMod:!0});Gc({id:"quickInput.previous",primary:16,handler:Pu(yr.Previous)},{withCtrlMod:!0});const zye=w("quickInput.nextSeparatorWithQuickAccessFallback","If we're in quick access mode, this will navigate to the next item. If we are not in quick access mode, this will navigate to the next separator."),Uye=w("quickInput.previousSeparatorWithQuickAccessFallback","If we're in quick access mode, this will navigate to the previous item. If we are not in quick access mode, this will navigate to the previous separator.");Rn?(Gc({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:2066,handler:Pu(yr.NextSeparator,yr.Next),metadata:{description:zye}}),Gc({id:"quickInput.nextSeparator",primary:2578,secondary:[2322],handler:Pu(yr.NextSeparator)},{withCtrlMod:!0}),Gc({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:2064,handler:Pu(yr.PreviousSeparator,yr.Previous),metadata:{description:Uye}}),Gc({id:"quickInput.previousSeparator",primary:2576,secondary:[2320],handler:Pu(yr.PreviousSeparator)},{withCtrlMod:!0})):(Gc({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:530,handler:Pu(yr.NextSeparator,yr.Next),metadata:{description:zye}}),Gc({id:"quickInput.nextSeparator",primary:2578,handler:Pu(yr.NextSeparator)}),Gc({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:528,handler:Pu(yr.PreviousSeparator,yr.Previous),metadata:{description:Uye}}),Gc({id:"quickInput.previousSeparator",primary:2576,handler:Pu(yr.PreviousSeparator)}));Gc({id:"quickInput.acceptInBackground",when:Le.and(F6e.when,Le.or(k6e.negate(),d2t)),primary:17,weight:250,handler:n=>{n.get(hh).currentQuickInput?.accept(!0)}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});var FTt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},yq=function(n,e){return function(t,i){e(t,i,n)}},iJ;const Hc=qe;let rJ=class extends me{static{iJ=this}static{this.MAX_WIDTH=600}get currentQuickInput(){return this.controller??void 0}get container(){return this._container}constructor(e,t,i,r){super(),this.options=e,this.layoutService=t,this.instantiationService=i,this.contextKeyService=r,this.enabled=!0,this.onDidAcceptEmitter=this._register(new fe),this.onDidCustomEmitter=this._register(new fe),this.onDidTriggerButtonEmitter=this._register(new fe),this.keyMods={ctrlCmd:!1,alt:!1},this.controller=null,this.onShowEmitter=this._register(new fe),this.onShow=this.onShowEmitter.event,this.onHideEmitter=this._register(new fe),this.onHide=this.onHideEmitter.event,this.inQuickInputContext=a2t.bindTo(this.contextKeyService),this.quickInputTypeContext=c2t.bindTo(this.contextKeyService),this.endOfQuickInputBoxContext=u2t.bindTo(this.contextKeyService),this.idPrefix=e.idPrefix,this._container=e.container,this.styles=e.styles,this._register(Ge.runAndSubscribe($$,({window:s,disposables:o})=>this.registerKeyModsListeners(s,o),{window:Xi,disposables:this._store})),this._register(h0t(s=>{this.ui&&Ot(this.ui.container)===s&&(this.reparentUI(this.layoutService.mainContainer),this.layout(this.layoutService.mainContainerDimension,this.layoutService.mainContainerOffset.quickPickTop))}))}registerKeyModsListeners(e,t){const i=r=>{this.keyMods.ctrlCmd=r.ctrlKey||r.metaKey,this.keyMods.alt=r.altKey};for(const r of[je.KEY_DOWN,je.KEY_UP,je.MOUSE_DOWN])t.add(Ce(e,r,i,!0))}getUI(e){if(this.ui)return e&&Ot(this._container)!==Ot(this.layoutService.activeContainer)&&(this.reparentUI(this.layoutService.activeContainer),this.layout(this.layoutService.activeContainerDimension,this.layoutService.activeContainerOffset.quickPickTop)),this.ui;const t=Ne(this._container,Hc(".quick-input-widget.show-file-icons"));t.tabIndex=-1,t.style.display="none";const i=id(t),r=Ne(t,Hc(".quick-input-titlebar")),s=this._register(new ed(r,{hoverDelegate:this.options.hoverDelegate}));s.domNode.classList.add("quick-input-left-action-bar");const o=Ne(r,Hc(".quick-input-title")),a=this._register(new ed(r,{hoverDelegate:this.options.hoverDelegate}));a.domNode.classList.add("quick-input-right-action-bar");const l=Ne(t,Hc(".quick-input-header")),c=Ne(l,Hc("input.quick-input-check-all"));c.type="checkbox",c.setAttribute("aria-label",w("quickInput.checkAll","Toggle all checkboxes")),this._register(Jr(c,je.CHANGE,W=>{const z=c.checked;B.setAllVisibleChecked(z)})),this._register(Ce(c,je.CLICK,W=>{(W.x||W.y)&&f.setFocus()}));const u=Ne(l,Hc(".quick-input-description")),d=Ne(l,Hc(".quick-input-and-message")),h=Ne(d,Hc(".quick-input-filter")),f=this._register(new w2t(h,this.styles.inputBox,this.styles.toggle));f.setAttribute("aria-describedby",`${this.idPrefix}message`);const g=Ne(h,Hc(".quick-input-visible-count"));g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true");const p=new YQ(g,{countFormat:w({key:"quickInput.visibleCount",comment:["This tells the user how many items are shown in a list of items to select from. The items can be anything. Currently not visible, but read by screen readers."]},"{0} Results")},this.styles.countBadge),m=Ne(h,Hc(".quick-input-count"));m.setAttribute("aria-live","polite");const _=new YQ(m,{countFormat:w({key:"quickInput.countSelected",comment:["This tells the user how many items are selected in a list of items to select from. The items can be anything."]},"{0} Selected")},this.styles.countBadge),v=this._register(new ed(l,{hoverDelegate:this.options.hoverDelegate}));v.domNode.classList.add("quick-input-inline-action-bar");const y=Ne(l,Hc(".quick-input-action")),C=this._register(new V8(y,this.styles.button));C.label=w("ok","OK"),this._register(C.onDidClick(W=>{this.onDidAcceptEmitter.fire()}));const x=Ne(l,Hc(".quick-input-action")),k=this._register(new V8(x,{...this.styles.button,supportIcons:!0}));k.label=w("custom","Custom"),this._register(k.onDidClick(W=>{this.onDidCustomEmitter.fire()}));const L=Ne(d,Hc(`#${this.idPrefix}message.quick-input-message`)),D=this._register(new nce(t,this.styles.progressBar));D.getContainer().classList.add("quick-input-progress");const I=Ne(t,Hc(".quick-input-html-widget"));I.tabIndex=-1;const O=Ne(t,Hc(".quick-input-description")),M=this.idPrefix+"list",B=this._register(this.instantiationService.createInstance($N,t,this.options.hoverDelegate,this.options.linkOpenerDelegate,M));f.setAttribute("aria-controls",M),this._register(B.onDidChangeFocus(()=>{f.setAttribute("aria-activedescendant",B.getActiveDescendant()??"")})),this._register(B.onChangedAllVisibleChecked(W=>{c.checked=W})),this._register(B.onChangedVisibleCount(W=>{p.setCount(W)})),this._register(B.onChangedCheckedCount(W=>{_.setCount(W)})),this._register(B.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),this.controller instanceof H8&&this.controller.canSelectMany&&B.clearFocus())},0)}));const G=Eg(t);return this._register(G),this._register(Ce(t,je.FOCUS,W=>{const z=this.getUI();if(xo(W.relatedTarget,z.inputContainer)){const q=z.inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==q&&this.endOfQuickInputBoxContext.set(q)}xo(W.relatedTarget,z.container)||(this.inQuickInputContext.set(!0),this.previousFocusElement=Eo(W.relatedTarget)?W.relatedTarget:void 0)},!0)),this._register(G.onDidBlur(()=>{!this.getUI().ignoreFocusOut&&!this.options.ignoreFocusOut()&&this.hide(bE.Blur),this.inQuickInputContext.set(!1),this.endOfQuickInputBoxContext.set(!1),this.previousFocusElement=void 0})),this._register(f.onKeyDown(W=>{const z=this.getUI().inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==z&&this.endOfQuickInputBoxContext.set(z)})),this._register(Ce(t,je.FOCUS,W=>{f.setFocus()})),this._register(Jr(t,je.KEY_DOWN,W=>{if(!xo(W.target,I))switch(W.keyCode){case 3:Hn.stop(W,!0),this.enabled&&this.onDidAcceptEmitter.fire();break;case 9:Hn.stop(W,!0),this.hide(bE.Gesture);break;case 2:if(!W.altKey&&!W.ctrlKey&&!W.metaKey){const z=[".quick-input-list .monaco-action-bar .always-visible",".quick-input-list-entry:hover .monaco-action-bar",".monaco-list-row.focused .monaco-action-bar"];if(t.classList.contains("show-checkboxes")?z.push("input"):z.push("input[type=text]"),this.getUI().list.displayed&&z.push(".monaco-list"),this.getUI().message&&z.push(".quick-input-message a"),this.getUI().widget){if(xo(W.target,this.getUI().widget))break;z.push(".quick-input-html-widget")}const q=t.querySelectorAll(z.join(", "));W.shiftKey&&W.target===q[0]?(Hn.stop(W,!0),B.clearFocus()):!W.shiftKey&&xo(W.target,q[q.length-1])&&(Hn.stop(W,!0),q[0].focus())}break;case 10:W.ctrlKey&&(Hn.stop(W,!0),this.getUI().list.toggleHover());break}})),this.ui={container:t,styleSheet:i,leftActionBar:s,titleBar:r,title:o,description1:O,description2:u,widget:I,rightActionBar:a,inlineActionBar:v,checkAll:c,inputContainer:d,filterContainer:h,inputBox:f,visibleCountContainer:g,visibleCount:p,countContainer:m,count:_,okContainer:y,ok:C,message:L,customButtonContainer:x,customButton:k,list:B,progressBar:D,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,show:W=>this.show(W),hide:()=>this.hide(),setVisibilities:W=>this.setVisibilities(W),setEnabled:W=>this.setEnabled(W),setContextKey:W=>this.options.setContextKey(W),linkOpenerDelegate:W=>this.options.linkOpenerDelegate(W)},this.updateStyles(),this.ui}reparentUI(e){this.ui&&(this._container=e,Ne(this._container,this.ui.container))}pick(e,t={},i=yn.None){return new Promise((r,s)=>{let o=u=>{o=r,t.onKeyMods?.(a.keyMods),r(u)};if(i.isCancellationRequested){o(void 0);return}const a=this.createQuickPick({useSeparators:!0});let l;const c=[a,a.onDidAccept(()=>{if(a.canSelectMany)o(a.selectedItems.slice()),a.hide();else{const u=a.activeItems[0];u&&(o(u),a.hide())}}),a.onDidChangeActive(u=>{const d=u[0];d&&t.onDidFocus&&t.onDidFocus(d)}),a.onDidChangeSelection(u=>{if(!a.canSelectMany){const d=u[0];d&&(o(d),a.hide())}}),a.onDidTriggerItemButton(u=>t.onDidTriggerItemButton&&t.onDidTriggerItemButton({...u,removeItem:()=>{const d=a.items.indexOf(u.item);if(d!==-1){const h=a.items.slice(),f=h.splice(d,1),g=a.activeItems.filter(m=>m!==f[0]),p=a.keepScrollPosition;a.keepScrollPosition=!0,a.items=h,g&&(a.activeItems=g),a.keepScrollPosition=p}}})),a.onDidTriggerSeparatorButton(u=>t.onDidTriggerSeparatorButton?.(u)),a.onDidChangeValue(u=>{l&&!u&&(a.activeItems.length!==1||a.activeItems[0]!==l)&&(a.activeItems=[l])}),i.onCancellationRequested(()=>{a.hide()}),a.onDidHide(()=>{er(c),o(void 0)})];a.title=t.title,t.value&&(a.value=t.value),a.canSelectMany=!!t.canPickMany,a.placeholder=t.placeHolder,a.ignoreFocusOut=!!t.ignoreFocusLost,a.matchOnDescription=!!t.matchOnDescription,a.matchOnDetail=!!t.matchOnDetail,a.matchOnLabel=t.matchOnLabel===void 0||t.matchOnLabel,a.quickNavigate=t.quickNavigate,a.hideInput=!!t.hideInput,a.contextKey=t.contextKey,a.busy=!0,Promise.all([e,t.activeItem]).then(([u,d])=>{l=d,a.busy=!1,a.items=u,a.canSelectMany&&(a.selectedItems=u.filter(h=>h.type!=="separator"&&h.picked)),l&&(a.activeItems=[l])}),a.show(),Promise.resolve(e).then(void 0,u=>{s(u),a.hide()})})}createQuickPick(e={useSeparators:!1}){const t=this.getUI(!0);return new H8(t)}createInputBox(){const e=this.getUI(!0);return new h2t(e)}show(e){const t=this.getUI(!0);this.onShowEmitter.fire();const i=this.controller;this.controller=e,i?.didHide(),this.setEnabled(!0),t.leftActionBar.clear(),t.title.textContent="",t.description1.textContent="",t.description2.textContent="",ea(t.widget),t.rightActionBar.clear(),t.inlineActionBar.clear(),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(Ss.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),ea(t.message),t.progressBar.stop(),t.list.setElements([]),t.list.matchOnDescription=!1,t.list.matchOnDetail=!1,t.list.matchOnLabel=!0,t.list.sortByLabel=!0,t.ignoreFocusOut=!1,t.inputBox.toggles=void 0;const r=this.options.backKeybindingLabel();KQ.tooltip=r?w("quickInput.backWithKeybinding","Back ({0})",r):w("quickInput.back","Back"),t.container.style.display="",this.updateLayout(),t.inputBox.setFocus(),this.quickInputTypeContext.set(e.type)}isVisible(){return!!this.ui&&this.ui.container.style.display!=="none"}setVisibilities(e){const t=this.getUI();t.title.style.display=e.title?"":"none",t.description1.style.display=e.description&&(e.inputBox||e.checkAll)?"":"none",t.description2.style.display=e.description&&!(e.inputBox||e.checkAll)?"":"none",t.checkAll.style.display=e.checkAll?"":"none",t.inputContainer.style.display=e.inputBox?"":"none",t.filterContainer.style.display=e.inputBox?"":"none",t.visibleCountContainer.style.display=e.visibleCount?"":"none",t.countContainer.style.display=e.count?"":"none",t.okContainer.style.display=e.ok?"":"none",t.customButtonContainer.style.display=e.customButton?"":"none",t.message.style.display=e.message?"":"none",t.progressBar.getContainer().style.display=e.progressBar?"":"none",t.list.displayed=!!e.list,t.container.classList.toggle("show-checkboxes",!!e.checkBox),t.container.classList.toggle("hidden-input",!e.inputBox&&!e.description),this.updateLayout()}setEnabled(e){if(e!==this.enabled){this.enabled=e;for(const t of this.getUI().leftActionBar.viewItems)t.action.enabled=e;for(const t of this.getUI().rightActionBar.viewItems)t.action.enabled=e;this.getUI().checkAll.disabled=!e,this.getUI().inputBox.enabled=e,this.getUI().ok.enabled=e,this.getUI().list.enabled=e}}hide(e){const t=this.controller;if(!t)return;t.willHide(e);const i=this.ui?.container,r=i&&!f3e(i);if(this.controller=null,this.onHideEmitter.fire(),i&&(i.style.display="none"),!r){let s=this.previousFocusElement;for(;s&&!s.offsetParent;)s=s.parentElement??void 0;s?.offsetParent?(s.focus(),this.previousFocusElement=void 0):this.options.returnFocus()}t.didHide(e)}layout(e,t){this.dimension=e,this.titleBarOffset=t,this.updateLayout()}updateLayout(){if(this.ui&&this.isVisible()){this.ui.container.style.top=`${this.titleBarOffset}px`;const e=this.ui.container.style,t=Math.min(this.dimension.width*.62,iJ.MAX_WIDTH);e.width=t+"px",e.marginLeft="-"+t/2+"px",this.ui.inputBox.layout(),this.ui.list.layout(this.dimension&&this.dimension.height*.4)}}applyStyles(e){this.styles=e,this.updateStyles()}updateStyles(){if(this.ui){const{quickInputTitleBackground:e,quickInputBackground:t,quickInputForeground:i,widgetBorder:r,widgetShadow:s}=this.styles.widget;this.ui.titleBar.style.backgroundColor=e??"",this.ui.container.style.backgroundColor=t??"",this.ui.container.style.color=i??"",this.ui.container.style.border=r?`1px solid ${r}`:"",this.ui.container.style.boxShadow=s?`0 0 8px 2px ${s}`:"",this.ui.list.style(this.styles.list);const o=[];this.styles.pickerGroup.pickerGroupBorder&&o.push(`.quick-input-list .quick-input-list-entry { border-top-color: ${this.styles.pickerGroup.pickerGroupBorder}; }`),this.styles.pickerGroup.pickerGroupForeground&&o.push(`.quick-input-list .quick-input-list-separator { color: ${this.styles.pickerGroup.pickerGroupForeground}; }`),this.styles.pickerGroup.pickerGroupForeground&&o.push(".quick-input-list .quick-input-list-separator-as-item { color: var(--vscode-descriptionForeground); }"),(this.styles.keybindingLabel.keybindingLabelBackground||this.styles.keybindingLabel.keybindingLabelBorder||this.styles.keybindingLabel.keybindingLabelBottomBorder||this.styles.keybindingLabel.keybindingLabelShadow||this.styles.keybindingLabel.keybindingLabelForeground)&&(o.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {"),this.styles.keybindingLabel.keybindingLabelBackground&&o.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`),this.styles.keybindingLabel.keybindingLabelBorder&&o.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`),this.styles.keybindingLabel.keybindingLabelBottomBorder&&o.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`),this.styles.keybindingLabel.keybindingLabelShadow&&o.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`),this.styles.keybindingLabel.keybindingLabelForeground&&o.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`),o.push("}"));const a=o.join(` +`);a!==this.ui.styleSheet.textContent&&(this.ui.styleSheet.textContent=a)}}};rJ=iJ=FTt([yq(1,Zb),yq(2,Tt),yq(3,jt)],rJ);var BTt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},BT=function(n,e){return function(t,i){e(t,i,n)}};let sJ=class extends T1t{get controller(){return this._controller||(this._controller=this._register(this.createController())),this._controller}get hasController(){return!!this._controller}get currentQuickInput(){return this.controller.currentQuickInput}get quickAccess(){return this._quickAccess||(this._quickAccess=this._register(this.instantiationService.createInstance(qQ))),this._quickAccess}constructor(e,t,i,r,s){super(i),this.instantiationService=e,this.contextKeyService=t,this.layoutService=r,this.configurationService=s,this._onShow=this._register(new fe),this._onHide=this._register(new fe),this.contexts=new Map}createController(e=this.layoutService,t){const i={idPrefix:"quickInput_",container:e.activeContainer,ignoreFocusOut:()=>!1,backKeybindingLabel:()=>{},setContextKey:s=>this.setContextKey(s),linkOpenerDelegate:s=>{this.instantiationService.invokeFunction(o=>{o.get(Pc).open(s,{allowCommands:!0,fromUserGesture:!0})})},returnFocus:()=>e.focus(),styles:this.computeStyles(),hoverDelegate:this._register(this.instantiationService.createInstance(GQ))},r=this._register(this.instantiationService.createInstance(rJ,{...i,...t}));return r.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop),this._register(e.onDidLayoutActiveContainer(s=>{Ot(e.activeContainer)===Ot(r.container)&&r.layout(s,e.activeContainerOffset.quickPickTop)})),this._register(e.onDidChangeActiveContainer(()=>{r.isVisible()||r.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop)})),this._register(r.onShow(()=>{this.resetContextKeys(),this._onShow.fire()})),this._register(r.onHide(()=>{this.resetContextKeys(),this._onHide.fire()})),r}setContextKey(e){let t;e&&(t=this.contexts.get(e),t||(t=new et(e,!1).bindTo(this.contextKeyService),this.contexts.set(e,t))),!(t&&t.get())&&(this.resetContextKeys(),t?.set(!0))}resetContextKeys(){this.contexts.forEach(e=>{e.get()&&e.reset()})}pick(e,t,i=yn.None){return this.controller.pick(e,t,i)}createQuickPick(e={useSeparators:!1}){return this.controller.createQuickPick(e)}createInputBox(){return this.controller.createInputBox()}updateStyles(){this.hasController&&this.controller.applyStyles(this.computeStyles())}computeStyles(){return{widget:{quickInputBackground:it(_1e),quickInputForeground:it(Uwt),quickInputTitleBackground:it(jwt),widgetBorder:it(x5e),widgetShadow:it(JL)},inputBox:A8,toggle:I8,countBadge:wFe,button:kkt,progressBar:Ekt,keybindingLabel:Skt,list:wC({listBackground:_1e,listFocusBackground:CN,listFocusForeground:wN,listInactiveFocusForeground:wN,listInactiveSelectionIconForeground:vle,listInactiveFocusBackground:CN,listFocusOutline:Ar,listInactiveFocusOutline:Ar}),pickerGroup:{pickerGroupBorder:it(qwt),pickerGroupForeground:it(R5e)}}}};sJ=BTt([BT(0,Tt),BT(1,jt),BT(2,go),BT(3,Zb),BT(4,En)],sJ);var B6e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},py=function(n,e){return function(t,i){e(t,i,n)}};let oJ=class extends sJ{constructor(e,t,i,r,s,o){super(t,i,r,new FX(e.getContainerDomNode(),s),o),this.host=void 0;const a=WN.get(e);if(a){const l=a.widget;this.host={_serviceBrand:void 0,get mainContainer(){return l.getDomNode()},getContainer(){return l.getDomNode()},whenContainerStylesLoaded(){},get containers(){return[l.getDomNode()]},get activeContainer(){return l.getDomNode()},get mainContainerDimension(){return e.getLayoutInfo()},get activeContainerDimension(){return e.getLayoutInfo()},get onDidLayoutMainContainer(){return e.onDidLayoutChange},get onDidLayoutActiveContainer(){return e.onDidLayoutChange},get onDidLayoutContainer(){return Ge.map(e.onDidLayoutChange,c=>({container:l.getDomNode(),dimension:c}))},get onDidChangeActiveContainer(){return Ge.None},get onDidAddContainer(){return Ge.None},get mainContainerOffset(){return{top:0,quickPickTop:0}},get activeContainerOffset(){return{top:0,quickPickTop:0}},focus:()=>e.focus()}}else this.host=void 0}createController(){return super.createController(this.host)}};oJ=B6e([py(1,Tt),py(2,jt),py(3,go),py(4,ai),py(5,En)],oJ);let aJ=class{get activeService(){const e=this.codeEditorService.getFocusedCodeEditor();if(!e)throw new Error("Quick input service needs a focused editor to work.");let t=this.mapEditorToService.get(e);if(!t){const i=t=this.instantiationService.createInstance(oJ,e);this.mapEditorToService.set(e,t),wb(e.onDidDispose)(()=>{i.dispose(),this.mapEditorToService.delete(e)})}return t}get currentQuickInput(){return this.activeService.currentQuickInput}get quickAccess(){return this.activeService.quickAccess}constructor(e,t){this.instantiationService=e,this.codeEditorService=t,this.mapEditorToService=new Map}pick(e,t,i=yn.None){return this.activeService.pick(e,t,i)}createQuickPick(e={useSeparators:!1}){return this.activeService.createQuickPick(e)}createInputBox(){return this.activeService.createInputBox()}};aJ=B6e([py(0,Tt),py(1,ai)],aJ);class WN{static{this.ID="editor.controller.quickInput"}static get(e){return e.getContribution(WN.ID)}constructor(e){this.editor=e,this.widget=new Cce(this.editor)}dispose(){this.widget.dispose()}}class Cce{static{this.ID="editor.contrib.quickInputWidget"}constructor(e){this.codeEditor=e,this.domNode=document.createElement("div"),this.codeEditor.addOverlayWidget(this)}getId(){return Cce.ID}getDomNode(){return this.domNode}getPosition(){return{preference:2}}dispose(){this.codeEditor.removeOverlayWidget(this)}}Zn(WN.ID,WN,4);class $Tt{constructor(e,t,i,r,s){this._parsedThemeRuleBrand=void 0,this.token=e,this.index=t,this.fontStyle=i,this.foreground=r,this.background=s}}function WTt(n){if(!n||!Array.isArray(n))return[];const e=[];let t=0;for(let i=0,r=n.length;i{const h=qTt(u.token,d.token);return h!==0?h:u.index-d.index});let t=0,i="000000",r="ffffff";for(;n.length>=1&&n[0].token==="";){const u=n.shift();u.fontStyle!==-1&&(t=u.fontStyle),u.foreground!==null&&(i=u.foreground),u.background!==null&&(r=u.background)}const s=new zTt;for(const u of e)s.getId(u);const o=s.getId(i),a=s.getId(r),l=new xce(t,o,a),c=new Sce(l);for(let u=0,d=n.length;u"u"){const r=this._match(t),s=jTt(t);i=(r.metadata|s<<8)>>>0,this._cache.set(t,i)}return(i|e<<0)>>>0}}const UTt=/\b(comment|string|regex|regexp)\b/;function jTt(n){const e=n.match(UTt);if(!e)return 0;switch(e[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"regexp":return 3}throw new Error("Unexpected match for standard token type!")}function qTt(n,e){return ne?1:0}class xce{constructor(e,t,i){this._themeTrieElementRuleBrand=void 0,this._fontStyle=e,this._foreground=t,this._background=i,this.metadata=(this._fontStyle<<11|this._foreground<<15|this._background<<24)>>>0}clone(){return new xce(this._fontStyle,this._foreground,this._background)}acceptOverwrite(e,t,i){e!==-1&&(this._fontStyle=e),t!==0&&(this._foreground=t),i!==0&&(this._background=i),this.metadata=(this._fontStyle<<11|this._foreground<<15|this._background<<24)>>>0}}class Sce{constructor(e){this._themeTrieElementBrand=void 0,this._mainRule=e,this._children=new Map}match(e){if(e==="")return this._mainRule;const t=e.indexOf(".");let i,r;t===-1?(i=e,r=""):(i=e.substring(0,t),r=e.substring(t+1));const s=this._children.get(i);return typeof s<"u"?s.match(r):this._mainRule}insert(e,t,i,r){if(e===""){this._mainRule.acceptOverwrite(t,i,r);return}const s=e.indexOf(".");let o,a;s===-1?(o=e,a=""):(o=e.substring(0,s),a=e.substring(s+1));let l=this._children.get(o);typeof l>"u"&&(l=new Sce(this._mainRule.clone()),this._children.set(o,l)),l.insert(a,t,i,r)}}function KTt(n){const e=[];for(let t=1,i=n.length;t({format:r.format,location:r.location.toString()}))}}n.toJSONObject=e;function t(i){const r=s=>yc(s)?s:void 0;if(i&&Array.isArray(i.src)&&i.src.every(s=>yc(s.format)&&yc(s.location)))return{weight:r(i.weight),style:r(i.style),src:i.src.map(s=>({format:s.format,location:Pt.parse(s.location)}))}}n.fromJSONObject=t})(qye||(qye={}));class JTt{constructor(){this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:w("iconDefinition.fontId","The id of the font to use. If not set, the font that is defined first is used.")},fontCharacter:{type:"string",description:w("iconDefinition.fontCharacter","The font character associated with the icon definition.")}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}},this.iconReferenceSchema={type:"string",pattern:`^${zt.iconNameExpression}$`,enum:[],enumDescriptions:[]},this.iconsById={},this.iconFontsById={}}registerIcon(e,t,i,r){const s=this.iconsById[e];if(s){if(i&&!s.description){s.description=i,this.iconSchema.properties[e].markdownDescription=`${i} $(${e})`;const l=this.iconReferenceSchema.enum.indexOf(e);l!==-1&&(this.iconReferenceSchema.enumDescriptions[l]=i),this._onDidChange.fire()}return s}const o={id:e,description:i,defaults:t,deprecationMessage:r};this.iconsById[e]=o;const a={$ref:"#/definitions/icons"};return r&&(a.deprecationMessage=r),i&&(a.markdownDescription=`${i}: $(${e})`),this.iconSchema.properties[e]=a,this.iconReferenceSchema.enum.push(e),this.iconReferenceSchema.enumDescriptions.push(i||""),this._onDidChange.fire(),{id:e}}getIcons(){return Object.keys(this.iconsById).map(e=>this.iconsById[e])}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}toString(){const e=(s,o)=>s.id.localeCompare(o.id),t=s=>{for(;zt.isThemeIcon(s.defaults);)s=this.iconsById[s.defaults.id];return`codicon codicon-${s?s.id:""}`},i=[];i.push("| preview | identifier | default codicon ID | description"),i.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");const r=Object.keys(this.iconsById).map(s=>this.iconsById[s]);for(const s of r.filter(o=>!!o.description).sort(e))i.push(`||${s.id}|${zt.isThemeIcon(s.defaults)?s.defaults.id:s.id}|${s.description||""}|`);i.push("| preview | identifier "),i.push("| ----------- | --------------------------------- |");for(const s of r.filter(o=>!zt.isThemeIcon(o.defaults)).sort(e))i.push(`||${s.id}|`);return i.join(` `)}}const SC=new JTt;Yr.add(QTt.IconContribution,SC);function kr(n,e,t,i){return SC.registerIcon(n,e,t,i)}function W6e(){return SC}function eDt(){const n=P4e();for(const e in n){const t="\\"+n[e].toString(16);SC.registerIcon(e,{fontCharacter:t})}}eDt();const H6e="vscode://schemas/icons",V6e=Yr.as(eW.JSONContribution);V6e.registerSchema(H6e,SC.getIconSchema());const Kye=new Ui(()=>V6e.notifySchemaChanged(H6e),200);SC.onDidChange(()=>{Kye.isScheduled()||Kye.schedule()});const z6e=kr("widget-close",ze.close,w("widgetClose","Icon for the close action in widgets."));kr("goto-previous-location",ze.arrowUp,w("previousChangeIcon","Icon for goto previous editor location."));kr("goto-next-location",ze.arrowDown,w("nextChangeIcon","Icon for goto next editor location."));zt.modify(ze.sync,"spin");zt.modify(ze.loading,"spin");function tDt(n){const e=new ke,t=e.add(new fe),i=W6e();return e.add(i.onDidChange(()=>t.fire())),n&&e.add(n.onDidProductIconThemeChange(()=>t.fire())),{dispose:()=>e.dispose(),onDidChange:t.event,getCSS(){const r=n?n.getProductIconTheme():new U6e,s={},o=[],a=[];for(const l of i.getIcons()){const c=r.getIcon(l);if(!c)continue;const u=c.font,d=`--vscode-icon-${l.id}-font-family`,h=`--vscode-icon-${l.id}-content`;u?(s[u.id]=u.definition,a.push(`${d}: ${Ej(u.id)};`,`${h}: '${c.fontCharacter}';`),o.push(`.codicon-${l.id}:before { content: '${c.fontCharacter}'; font-family: ${Ej(u.id)}; }`)):(a.push(`${h}: '${c.fontCharacter}'; ${d}: 'codicon';`),o.push(`.codicon-${l.id}:before { content: '${c.fontCharacter}'; }`))}for(const l in s){const c=s[l],u=c.weight?`font-weight: ${c.weight};`:"",d=c.style?`font-style: ${c.style};`:"",h=c.src.map(f=>`${Z_(f.location)} format('${f.format}')`).join(", ");o.push(`@font-face { src: ${h}; font-family: ${Ej(l)};${u}${d} font-display: block; }`)}return o.push(`:root { ${a.join(" ")} }`),o.join(` -`)}}}class U6e{getIcon(e){const t=W6e();let i=e.defaults;for(;zt.isThemeIcon(i);){const r=t.getIcon(i.id);if(!r)return;i=r.defaults}return i}}const a_="vs",bk="vs-dark",ew="hc-black",tw="hc-light",j6e=Yr.as(pFe.ColorContribution),nDt=Yr.as(J3e.ThemingContribution);class q6e{constructor(e,t){this.semanticHighlighting=!1,this.themeData=t;const i=t.base;e.length>0?(a5(e)?this.id=e:this.id=i+" "+e,this.themeName=e):(this.id=i,this.themeName=i),this.colors=null,this.defaultColors=Object.create(null),this._tokenTheme=null}get base(){return this.themeData.base}notifyBaseUpdated(){this.themeData.inherit&&(this.colors=null,this._tokenTheme=null)}getColors(){if(!this.colors){const e=new Map;for(const t in this.themeData.colors)e.set(t,Te.fromHex(this.themeData.colors[t]));if(this.themeData.inherit){const t=lJ(this.themeData.base);for(const i in t.colors)e.has(i)||e.set(i,Te.fromHex(t.colors[i]))}this.colors=e}return this.colors}getColor(e,t){const i=this.getColors().get(e);if(i)return i;if(t!==!1)return this.getDefault(e)}getDefault(e){let t=this.defaultColors[e];return t||(t=j6e.resolveDefaultColor(e,this),this.defaultColors[e]=t,t)}defines(e){return this.getColors().has(e)}get type(){switch(this.base){case a_:return Wd.LIGHT;case ew:return Wd.HIGH_CONTRAST_DARK;case tw:return Wd.HIGH_CONTRAST_LIGHT;default:return Wd.DARK}}get tokenTheme(){if(!this._tokenTheme){let e=[],t=[];if(this.themeData.inherit){const s=lJ(this.themeData.base);e=s.rules,s.encodedTokensColors&&(t=s.encodedTokensColors)}const i=this.themeData.colors["editor.foreground"],r=this.themeData.colors["editor.background"];if(i||r){const s={token:""};i&&(s.foreground=i),r&&(s.background=r),e.push(s)}e=e.concat(this.themeData.rules),this.themeData.encodedTokensColors&&(t=this.themeData.encodedTokensColors),this._tokenTheme=$6e.createFromRawTokenTheme(e,t)}return this._tokenTheme}getTokenStyleMetadata(e,t,i){const s=this.tokenTheme._match([e].concat(t).join(".")).metadata,o=hc.getForeground(s),a=hc.getFontStyle(s);return{foreground:o,italic:!!(a&1),bold:!!(a&2),underline:!!(a&4),strikethrough:!!(a&8)}}}function a5(n){return n===a_||n===bk||n===ew||n===tw}function lJ(n){switch(n){case a_:return GTt;case bk:return YTt;case ew:return ZTt;case tw:return XTt}}function Z4(n){const e=lJ(n);return new q6e(n,e)}class iDt extends me{constructor(){super(),this._onColorThemeChange=this._register(new fe),this.onDidColorThemeChange=this._onColorThemeChange.event,this._onProductIconThemeChange=this._register(new fe),this.onDidProductIconThemeChange=this._onProductIconThemeChange.event,this._environment=Object.create(null),this._builtInProductIconTheme=new U6e,this._autoDetectHighContrast=!0,this._knownThemes=new Map,this._knownThemes.set(a_,Z4(a_)),this._knownThemes.set(bk,Z4(bk)),this._knownThemes.set(ew,Z4(ew)),this._knownThemes.set(tw,Z4(tw));const e=this._register(tDt(this));this._codiconCSS=e.getCSS(),this._themeCSS="",this._allCSS=`${this._codiconCSS} -${this._themeCSS}`,this._globalStyleElement=null,this._styleElements=[],this._colorMapOverride=null,this.setTheme(a_),this._onOSSchemeChanged(),this._register(e.onDidChange(()=>{this._codiconCSS=e.getCSS(),this._updateCSS()})),K4e(Xi,"(forced-colors: active)",()=>{this._onOSSchemeChanged()})}registerEditorContainer(e){return G6(e)?this._registerShadowDomContainer(e):this._registerRegularEditorContainer()}_registerRegularEditorContainer(){return this._globalStyleElement||(this._globalStyleElement=id(void 0,e=>{e.className="monaco-colors",e.textContent=this._allCSS}),this._styleElements.push(this._globalStyleElement)),me.None}_registerShadowDomContainer(e){const t=id(e,i=>{i.className="monaco-colors",i.textContent=this._allCSS});return this._styleElements.push(t),{dispose:()=>{for(let i=0;i{i.base===e&&i.notifyBaseUpdated()}),this._theme.themeName===e&&this.setTheme(e)}getColorTheme(){return this._theme}setColorMapOverride(e){this._colorMapOverride=e,this._updateThemeOrColorMap()}setTheme(e){let t;this._knownThemes.has(e)?t=this._knownThemes.get(e):t=this._knownThemes.get(a_),this._updateActualTheme(t)}_updateActualTheme(e){!e||this._theme===e||(this._theme=e,this._updateThemeOrColorMap())}_onOSSchemeChanged(){if(this._autoDetectHighContrast){const e=Xi.matchMedia("(forced-colors: active)").matches;if(e!==mg(this._theme.type)){let t;aE(this._theme.type)?t=e?ew:bk:t=e?tw:a_,this._updateActualTheme(this._knownThemes.get(t))}}}setAutoDetectHighContrast(e){this._autoDetectHighContrast=e,this._onOSSchemeChanged()}_updateThemeOrColorMap(){const e=[],t={},i={addRule:o=>{t[o]||(e.push(o),t[o]=!0)}};nDt.getThemingParticipants().forEach(o=>o(this._theme,i,this._environment));const r=[];for(const o of j6e.getColors()){const a=this._theme.getColor(o.id,!0);a&&r.push(`${cle(o.id)}: ${a.toString()};`)}i.addRule(`.monaco-editor, .monaco-diff-editor, .monaco-component { ${r.join(` +`)}}}class U6e{getIcon(e){const t=W6e();let i=e.defaults;for(;zt.isThemeIcon(i);){const r=t.getIcon(i.id);if(!r)return;i=r.defaults}return i}}const a_="vs",bk="vs-dark",ew="hc-black",tw="hc-light",j6e=Yr.as(p5e.ColorContribution),nDt=Yr.as(J3e.ThemingContribution);class q6e{constructor(e,t){this.semanticHighlighting=!1,this.themeData=t;const i=t.base;e.length>0?(aF(e)?this.id=e:this.id=i+" "+e,this.themeName=e):(this.id=i,this.themeName=i),this.colors=null,this.defaultColors=Object.create(null),this._tokenTheme=null}get base(){return this.themeData.base}notifyBaseUpdated(){this.themeData.inherit&&(this.colors=null,this._tokenTheme=null)}getColors(){if(!this.colors){const e=new Map;for(const t in this.themeData.colors)e.set(t,Te.fromHex(this.themeData.colors[t]));if(this.themeData.inherit){const t=lJ(this.themeData.base);for(const i in t.colors)e.has(i)||e.set(i,Te.fromHex(t.colors[i]))}this.colors=e}return this.colors}getColor(e,t){const i=this.getColors().get(e);if(i)return i;if(t!==!1)return this.getDefault(e)}getDefault(e){let t=this.defaultColors[e];return t||(t=j6e.resolveDefaultColor(e,this),this.defaultColors[e]=t,t)}defines(e){return this.getColors().has(e)}get type(){switch(this.base){case a_:return Wd.LIGHT;case ew:return Wd.HIGH_CONTRAST_DARK;case tw:return Wd.HIGH_CONTRAST_LIGHT;default:return Wd.DARK}}get tokenTheme(){if(!this._tokenTheme){let e=[],t=[];if(this.themeData.inherit){const s=lJ(this.themeData.base);e=s.rules,s.encodedTokensColors&&(t=s.encodedTokensColors)}const i=this.themeData.colors["editor.foreground"],r=this.themeData.colors["editor.background"];if(i||r){const s={token:""};i&&(s.foreground=i),r&&(s.background=r),e.push(s)}e=e.concat(this.themeData.rules),this.themeData.encodedTokensColors&&(t=this.themeData.encodedTokensColors),this._tokenTheme=$6e.createFromRawTokenTheme(e,t)}return this._tokenTheme}getTokenStyleMetadata(e,t,i){const s=this.tokenTheme._match([e].concat(t).join(".")).metadata,o=hc.getForeground(s),a=hc.getFontStyle(s);return{foreground:o,italic:!!(a&1),bold:!!(a&2),underline:!!(a&4),strikethrough:!!(a&8)}}}function aF(n){return n===a_||n===bk||n===ew||n===tw}function lJ(n){switch(n){case a_:return GTt;case bk:return YTt;case ew:return ZTt;case tw:return XTt}}function Z4(n){const e=lJ(n);return new q6e(n,e)}class iDt extends me{constructor(){super(),this._onColorThemeChange=this._register(new fe),this.onDidColorThemeChange=this._onColorThemeChange.event,this._onProductIconThemeChange=this._register(new fe),this.onDidProductIconThemeChange=this._onProductIconThemeChange.event,this._environment=Object.create(null),this._builtInProductIconTheme=new U6e,this._autoDetectHighContrast=!0,this._knownThemes=new Map,this._knownThemes.set(a_,Z4(a_)),this._knownThemes.set(bk,Z4(bk)),this._knownThemes.set(ew,Z4(ew)),this._knownThemes.set(tw,Z4(tw));const e=this._register(tDt(this));this._codiconCSS=e.getCSS(),this._themeCSS="",this._allCSS=`${this._codiconCSS} +${this._themeCSS}`,this._globalStyleElement=null,this._styleElements=[],this._colorMapOverride=null,this.setTheme(a_),this._onOSSchemeChanged(),this._register(e.onDidChange(()=>{this._codiconCSS=e.getCSS(),this._updateCSS()})),K4e(Xi,"(forced-colors: active)",()=>{this._onOSSchemeChanged()})}registerEditorContainer(e){return G6(e)?this._registerShadowDomContainer(e):this._registerRegularEditorContainer()}_registerRegularEditorContainer(){return this._globalStyleElement||(this._globalStyleElement=id(void 0,e=>{e.className="monaco-colors",e.textContent=this._allCSS}),this._styleElements.push(this._globalStyleElement)),me.None}_registerShadowDomContainer(e){const t=id(e,i=>{i.className="monaco-colors",i.textContent=this._allCSS});return this._styleElements.push(t),{dispose:()=>{for(let i=0;i{i.base===e&&i.notifyBaseUpdated()}),this._theme.themeName===e&&this.setTheme(e)}getColorTheme(){return this._theme}setColorMapOverride(e){this._colorMapOverride=e,this._updateThemeOrColorMap()}setTheme(e){let t;this._knownThemes.has(e)?t=this._knownThemes.get(e):t=this._knownThemes.get(a_),this._updateActualTheme(t)}_updateActualTheme(e){!e||this._theme===e||(this._theme=e,this._updateThemeOrColorMap())}_onOSSchemeChanged(){if(this._autoDetectHighContrast){const e=Xi.matchMedia("(forced-colors: active)").matches;if(e!==mg(this._theme.type)){let t;aE(this._theme.type)?t=e?ew:bk:t=e?tw:a_,this._updateActualTheme(this._knownThemes.get(t))}}}setAutoDetectHighContrast(e){this._autoDetectHighContrast=e,this._onOSSchemeChanged()}_updateThemeOrColorMap(){const e=[],t={},i={addRule:o=>{t[o]||(e.push(o),t[o]=!0)}};nDt.getThemingParticipants().forEach(o=>o(this._theme,i,this._environment));const r=[];for(const o of j6e.getColors()){const a=this._theme.getColor(o.id,!0);a&&r.push(`${cle(o.id)}: ${a.toString()};`)}i.addRule(`.monaco-editor, .monaco-diff-editor, .monaco-component { ${r.join(` `)} }`);const s=this._colorMapOverride||this._theme.tokenTheme.getColorMap();i.addRule(KTt(s)),this._themeCSS=e.join(` `),this._updateCSS(),rs.setColorMap(s),this._onColorThemeChange.fire(this._theme)}_updateCSS(){this._allCSS=`${this._codiconCSS} -${this._themeCSS}`,this._styleElements.forEach(e=>e.textContent=this._allCSS)}getFileIconTheme(){return{hasFileIcons:!1,hasFolderIcons:!1,hidesExplorerArrows:!1}}getProductIconTheme(){return this._builtInProductIconTheme}}const hd=On("themeService");var rDt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},wq=function(n,e){return function(t,i){e(t,i,n)}};let cJ=class extends me{constructor(e,t,i){super(),this._contextKeyService=e,this._layoutService=t,this._configurationService=i,this._accessibilitySupport=0,this._onDidChangeScreenReaderOptimized=new fe,this._onDidChangeReducedMotion=new fe,this._onDidChangeLinkUnderline=new fe,this._accessibilityModeEnabledContext=iO.bindTo(this._contextKeyService);const r=()=>this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());this._register(this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("editor.accessibilitySupport")&&(r(),this._onDidChangeScreenReaderOptimized.fire()),o.affectsConfiguration("workbench.reduceMotion")&&(this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this._onDidChangeReducedMotion.fire())})),r(),this._register(this.onDidChangeScreenReaderOptimized(()=>r()));const s=Xi.matchMedia("(prefers-reduced-motion: reduce)");this._systemMotionReduced=s.matches,this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this._linkUnderlinesEnabled=this._configurationService.getValue("accessibility.underlineLinks"),this.initReducedMotionListeners(s),this.initLinkUnderlineListeners()}initReducedMotionListeners(e){this._register(Ce(e,"change",()=>{this._systemMotionReduced=e.matches,this._configMotionReduced==="auto"&&this._onDidChangeReducedMotion.fire()}));const t=()=>{const i=this.isMotionReduced();this._layoutService.mainContainer.classList.toggle("reduce-motion",i),this._layoutService.mainContainer.classList.toggle("enable-motion",!i)};t(),this._register(this.onDidChangeReducedMotion(()=>t()))}initLinkUnderlineListeners(){this._register(this._configurationService.onDidChangeConfiguration(t=>{if(t.affectsConfiguration("accessibility.underlineLinks")){const i=this._configurationService.getValue("accessibility.underlineLinks");this._linkUnderlinesEnabled=i,this._onDidChangeLinkUnderline.fire()}}));const e=()=>{const t=this._linkUnderlinesEnabled;this._layoutService.mainContainer.classList.toggle("underline-links",t)};e(),this._register(this.onDidChangeLinkUnderlines(()=>e()))}onDidChangeLinkUnderlines(e){return this._onDidChangeLinkUnderline.event(e)}get onDidChangeScreenReaderOptimized(){return this._onDidChangeScreenReaderOptimized.event}isScreenReaderOptimized(){const e=this._configurationService.getValue("editor.accessibilitySupport");return e==="on"||e==="auto"&&this._accessibilitySupport===2}get onDidChangeReducedMotion(){return this._onDidChangeReducedMotion.event}isMotionReduced(){const e=this._configMotionReduced;return e==="on"||e==="auto"&&this._systemMotionReduced}getAccessibilitySupport(){return this._accessibilitySupport}};cJ=rDt([wq(0,jt),wq(1,Zb),wq(2,kn)],cJ);var $W=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Hp=function(n,e){return function(t,i){e(t,i,n)}},Yx,PD;let uJ=class{constructor(e,t,i){this._commandService=e,this._keybindingService=t,this._hiddenStates=new dJ(i)}createMenu(e,t,i){return new t9(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...i},this._commandService,this._keybindingService,t)}getMenuActions(e,t,i){const r=new t9(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...i},this._commandService,this._keybindingService,t),s=r.getActions(i);return r.dispose(),s}resetHiddenStates(e){this._hiddenStates.reset(e)}};uJ=$W([Hp(0,_r),Hp(1,xi),Hp(2,pf)],uJ);let dJ=class{static{Yx=this}static{this._key="menu.hiddenCommands"}constructor(e){this._storageService=e,this._disposables=new ke,this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._ignoreChangeEvent=!1,this._hiddenByDefaultCache=new Map;try{const t=e.get(Yx._key,0,"{}");this._data=JSON.parse(t)}catch{this._data=Object.create(null)}this._disposables.add(e.onDidChangeValue(0,Yx._key,this._disposables)(()=>{if(!this._ignoreChangeEvent)try{const t=e.get(Yx._key,0,"{}");this._data=JSON.parse(t)}catch(t){console.log("FAILED to read storage after UPDATE",t)}this._onDidChange.fire()}))}dispose(){this._onDidChange.dispose(),this._disposables.dispose()}_isHiddenByDefault(e,t){return this._hiddenByDefaultCache.get(`${e.id}/${t}`)??!1}setDefaultState(e,t,i){this._hiddenByDefaultCache.set(`${e.id}/${t}`,i)}isHidden(e,t){const i=this._isHiddenByDefault(e,t),r=this._data[e.id]?.includes(t)??!1;return i?!r:r}updateHidden(e,t,i){this._isHiddenByDefault(e,t)&&(i=!i);const s=this._data[e.id];if(i)s?s.indexOf(t)<0&&s.push(t):this._data[e.id]=[t];else if(s){const o=s.indexOf(t);o>=0&&Zgt(s,o),s.length===0&&delete this._data[e.id]}this._persist()}reset(e){if(e===void 0)this._data=Object.create(null),this._persist();else{for(const{id:t}of e)this._data[t]&&delete this._data[t];this._persist()}}_persist(){try{this._ignoreChangeEvent=!0;const e=JSON.stringify(this._data);this._storageService.store(Yx._key,e,0,0)}finally{this._ignoreChangeEvent=!1}}};dJ=Yx=$W([Hp(0,pf)],dJ);class DI{constructor(e,t){this._id=e,this._collectContextKeysForSubmenus=t,this._menuGroups=[],this._allMenuIds=new Set,this._structureContextKeys=new Set,this._preconditionContextKeys=new Set,this._toggledContextKeys=new Set,this.refresh()}get allMenuIds(){return this._allMenuIds}get structureContextKeys(){return this._structureContextKeys}get preconditionContextKeys(){return this._preconditionContextKeys}get toggledContextKeys(){return this._toggledContextKeys}refresh(){this._menuGroups.length=0,this._allMenuIds.clear(),this._structureContextKeys.clear(),this._preconditionContextKeys.clear(),this._toggledContextKeys.clear();const e=this._sort(Fo.getMenuItems(this._id));let t;for(const i of e){const r=i.group||"";(!t||t[0]!==r)&&(t=[r,[]],this._menuGroups.push(t)),t[1].push(i),this._collectContextKeysAndSubmenuIds(i)}this._allMenuIds.add(this._id)}_sort(e){return e}_collectContextKeysAndSubmenuIds(e){if(DI._fillInKbExprKeys(e.when,this._structureContextKeys),lk(e)){if(e.command.precondition&&DI._fillInKbExprKeys(e.command.precondition,this._preconditionContextKeys),e.command.toggled){const t=e.command.toggled.condition||e.command.toggled;DI._fillInKbExprKeys(t,this._toggledContextKeys)}}else this._collectContextKeysForSubmenus&&(Fo.getMenuItems(e.submenu).forEach(this._collectContextKeysAndSubmenuIds,this),this._allMenuIds.add(e.submenu))}static _fillInKbExprKeys(e,t){if(e)for(const i of e.keys())t.add(i)}}let hJ=PD=class extends DI{constructor(e,t,i,r,s,o){super(e,i),this._hiddenStates=t,this._commandService=r,this._keybindingService=s,this._contextKeyService=o,this.refresh()}createActionGroups(e){const t=[];for(const i of this._menuGroups){const[r,s]=i;let o;for(const a of s)if(this._contextKeyService.contextMatchesRules(a.when)){const l=lk(a);l&&this._hiddenStates.setDefaultState(this._id,a.command.id,!!a.isHiddenByDefault);const c=sDt(this._id,l?a.command:a,this._hiddenStates);if(l){const u=K6e(this._commandService,this._keybindingService,a.command.id,a.when);(o??=[]).push(new ou(a.command,a.alt,e,c,u,this._contextKeyService,this._commandService))}else{const u=new PD(a.submenu,this._hiddenStates,this._collectContextKeysForSubmenus,this._commandService,this._keybindingService,this._contextKeyService).createActionGroups(e),d=na.join(...u.map(h=>h[1]));d.length>0&&(o??=[]).push(new ck(a,c,d))}}o&&o.length>0&&t.push([r,o])}return t}_sort(e){return e.sort(PD._compareMenuItems)}static _compareMenuItems(e,t){const i=e.group,r=t.group;if(i!==r){if(i){if(!r)return-1}else return 1;if(i==="navigation")return-1;if(r==="navigation")return 1;const a=i.localeCompare(r);if(a!==0)return a}const s=e.order||0,o=t.order||0;return so?1:PD._compareTitles(lk(e)?e.command.title:e.title,lk(t)?t.command.title:t.title)}static _compareTitles(e,t){const i=typeof e=="string"?e:e.original,r=typeof t=="string"?t:t.original;return i.localeCompare(r)}};hJ=PD=$W([Hp(3,_r),Hp(4,xi),Hp(5,jt)],hJ);let t9=class{constructor(e,t,i,r,s,o){this._disposables=new ke,this._menuInfo=new hJ(e,t,i.emitEventsForSubmenuChanges,r,s,o);const a=new Ui(()=>{this._menuInfo.refresh(),this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!0,isToggleChange:!0})},i.eventDebounceDelay);this._disposables.add(a),this._disposables.add(Fo.onDidChangeMenu(d=>{for(const h of this._menuInfo.allMenuIds)if(d.has(h)){a.schedule();break}}));const l=this._disposables.add(new ke),c=d=>{let h=!1,f=!1,g=!1;for(const p of d)if(h=h||p.isStructuralChange,f=f||p.isEnablementChange,g=g||p.isToggleChange,h&&f&&g)break;return{menu:this,isStructuralChange:h,isEnablementChange:f,isToggleChange:g}},u=()=>{l.add(o.onDidChangeContext(d=>{const h=d.affectsSome(this._menuInfo.structureContextKeys),f=d.affectsSome(this._menuInfo.preconditionContextKeys),g=d.affectsSome(this._menuInfo.toggledContextKeys);(h||f||g)&&this._onDidChange.fire({menu:this,isStructuralChange:h,isEnablementChange:f,isToggleChange:g})})),l.add(t.onDidChange(d=>{this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!1,isToggleChange:!1})}))};this._onDidChange=new S4e({onWillAddFirstListener:u,onDidRemoveLastListener:l.clear.bind(l),delay:i.eventDebounceDelay,merge:c}),this.onDidChange=this._onDidChange.event}getActions(e){return this._menuInfo.createActionGroups(e)}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}};t9=$W([Hp(3,_r),Hp(4,xi),Hp(5,jt)],t9);function sDt(n,e,t){const i=cvt(e)?e.submenu.id:e.id,r=typeof e.title=="string"?e.title:e.title.value,s=Yy({id:`hide/${n.id}/${i}`,label:w("hide.label","Hide '{0}'",r),run(){t.updateHidden(n,i,!0)}}),o=Yy({id:`toggle/${n.id}/${i}`,label:r,get checked(){return!t.isHidden(n,i)},run(){t.updateHidden(n,i,!!this.checked)}});return{hide:s,toggle:o,get isHidden(){return!o.checked}}}function K6e(n,e,t,i=void 0,r=!0){return Yy({id:`configureKeybinding/${t}`,label:w("configure keybinding","Configure Keybinding"),enabled:r,run(){const o=!!!e.lookupKeybinding(t)&&i?i.serialize():void 0;n.executeCommand("workbench.action.openGlobalKeybindings",`@command:${t}`+(o?` +when:${o}`:""))}})}var oDt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Gye=function(n,e){return function(t,i){e(t,i,n)}},fJ;const Yye="application/vnd.code.resources";let gJ=class extends me{static{fJ=this}constructor(e,t){super(),this.layoutService=e,this.logService=t,this.mapTextToType=new Map,this.findText="",this.resources=[],this.resourcesStateHash=void 0,(K_||G4e)&&this.installWebKitWriteTextWorkaround(),this._register(Ge.runAndSubscribe($$,({window:i,disposables:r})=>{r.add(Ce(i.document,"copy",()=>this.clearResourcesState()))},{window:Xi,disposables:this._store}))}installWebKitWriteTextWorkaround(){const e=()=>{const t=new KL;this.webKitPendingClipboardWritePromise&&!this.webKitPendingClipboardWritePromise.isSettled&&this.webKitPendingClipboardWritePromise.cancel(),this.webKitPendingClipboardWritePromise=t,SD().navigator.clipboard.write([new ClipboardItem({"text/plain":t.p})]).catch(async i=>{(!(i instanceof Error)||i.name!=="NotAllowedError"||!t.isRejected)&&this.logService.error(i)})};this._register(Ge.runAndSubscribe(this.layoutService.onDidAddContainer,({container:t,disposables:i})=>{i.add(Ce(t,"click",e)),i.add(Ce(t,"keydown",e))},{container:this.layoutService.mainContainer,disposables:this._store}))}async writeText(e,t){if(this.clearResourcesState(),t){this.mapTextToType.set(t,e);return}if(this.webKitPendingClipboardWritePromise)return this.webKitPendingClipboardWritePromise.complete(e);try{return await SD().navigator.clipboard.writeText(e)}catch(i){console.error(i)}this.fallbackWriteText(e)}fallbackWriteText(e){const t=GL(),i=t.activeElement,r=t.body.appendChild(qe("textarea",{"aria-hidden":!0}));r.style.height="1px",r.style.width="1px",r.style.position="absolute",r.value=e,r.focus(),r.select(),t.execCommand("copy"),Eo(i)&&i.focus(),r.remove()}async readText(e){if(e)return this.mapTextToType.get(e)||"";try{return await SD().navigator.clipboard.readText()}catch(t){console.error(t)}return""}async readFindText(){return this.findText}async writeFindText(e){this.findText=e}static{this.MAX_RESOURCE_STATE_SOURCE_LENGTH=1e3}async readResources(){try{const t=await SD().navigator.clipboard.read();for(const i of t)if(i.types.includes(`web ${Yye}`)){const r=await i.getType(`web ${Yye}`);return JSON.parse(await r.text()).map(o=>Pt.from(o))}}catch{}const e=await this.computeResourcesStateHash();return this.resourcesStateHash!==e&&this.clearResourcesState(),this.resources}async computeResourcesStateHash(){if(this.resources.length===0)return;const e=await this.readText();return F$(e.substring(0,fJ.MAX_RESOURCE_STATE_SOURCE_LENGTH))}clearInternalState(){this.clearResourcesState()}clearResourcesState(){this.resources=[],this.resourcesStateHash=void 0}};gJ=fJ=oDt([Gye(0,Zb),Gye(1,Da)],gJ);const b0=On("clipboardService");var aDt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},lDt=function(n,e){return function(t,i){e(t,i,n)}};const II="data-keybinding-context";let kce=class{constructor(e,t){this._id=e,this._parent=t,this._value=Object.create(null),this._value._contextId=e}get value(){return{...this._value}}setValue(e,t){return this._value[e]!==t?(this._value[e]=t,!0):!1}removeValue(e){return e in this._value?(delete this._value[e],!0):!1}getValue(e){const t=this._value[e];return typeof t>"u"&&this._parent?this._parent.getValue(e):t}};class wE extends kce{static{this.INSTANCE=new wE}constructor(){super(-1,null)}setValue(e,t){return!1}removeValue(e){return!1}getValue(e){}}class n9 extends kce{static{this._keyPrefix="config."}constructor(e,t,i){super(e,null),this._configurationService=t,this._values=fk.forConfigKeys(),this._listener=this._configurationService.onDidChangeConfiguration(r=>{if(r.source===7){const s=Array.from(this._values,([o])=>o);this._values.clear(),i.fire(new Xye(s))}else{const s=[];for(const o of r.affectedKeys){const a=`config.${o}`,l=this._values.findSuperstr(a);l!==void 0&&(s.push(...zn.map(l,([c])=>c)),this._values.deleteSuperstr(a)),this._values.has(a)&&(s.push(a),this._values.delete(a))}i.fire(new Xye(s))}})}dispose(){this._listener.dispose()}getValue(e){if(e.indexOf(n9._keyPrefix)!==0)return super.getValue(e);if(this._values.has(e))return this._values.get(e);const t=e.substr(n9._keyPrefix.length),i=this._configurationService.getValue(t);let r;switch(typeof i){case"number":case"boolean":case"string":r=i;break;default:Array.isArray(i)?r=JSON.stringify(i):r=i}return this._values.set(e,r),r}setValue(e,t){return super.setValue(e,t)}removeValue(e){return super.removeValue(e)}}class cDt{constructor(e,t,i){this._service=e,this._key=t,this._defaultValue=i,this.reset()}set(e){this._service.setContext(this._key,e)}reset(){typeof this._defaultValue>"u"?this._service.removeContext(this._key):this._service.setContext(this._key,this._defaultValue)}get(){return this._service.getContextKeyValue(this._key)}}class Zye{constructor(e){this.key=e}affectsSome(e){return e.has(this.key)}allKeysContainedIn(e){return this.affectsSome(e)}}class Xye{constructor(e){this.keys=e}affectsSome(e){for(const t of this.keys)if(e.has(t))return!0;return!1}allKeysContainedIn(e){return this.keys.every(t=>e.has(t))}}class uDt{constructor(e){this.events=e}affectsSome(e){for(const t of this.events)if(t.affectsSome(e))return!0;return!1}allKeysContainedIn(e){return this.events.every(t=>t.allKeysContainedIn(e))}}function dDt(n,e){return n.allKeysContainedIn(new Set(Object.keys(e)))}class G6e extends me{constructor(e){super(),this._onDidChangeContext=this._register(new Ew({merge:t=>new uDt(t)})),this.onDidChangeContext=this._onDidChangeContext.event,this._isDisposed=!1,this._myContextId=e}createKey(e,t){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new cDt(this,e,t)}bufferChangeEvents(e){this._onDidChangeContext.pause();try{e()}finally{this._onDidChangeContext.resume()}}createScoped(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new hDt(this,e)}contextMatchesRules(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");const t=this.getContextValuesContainer(this._myContextId);return e?e.evaluate(t):!0}getContextKeyValue(e){if(!this._isDisposed)return this.getContextValuesContainer(this._myContextId).getValue(e)}setContext(e,t){if(this._isDisposed)return;const i=this.getContextValuesContainer(this._myContextId);i&&i.setValue(e,t)&&this._onDidChangeContext.fire(new Zye(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new Zye(e))}getContext(e){return this._isDisposed?wE.INSTANCE:this.getContextValuesContainer(fDt(e))}dispose(){super.dispose(),this._isDisposed=!0}}let pJ=class extends G6e{constructor(e){super(0),this._contexts=new Map,this._lastContextId=0;const t=this._register(new n9(this._myContextId,e,this._onDidChangeContext));this._contexts.set(this._myContextId,t)}getContextValuesContainer(e){return this._isDisposed?wE.INSTANCE:this._contexts.get(e)||wE.INSTANCE}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ContextKeyService has been disposed");const t=++this._lastContextId;return this._contexts.set(t,new kce(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}};pJ=aDt([lDt(0,kn)],pJ);class hDt extends G6e{constructor(e,t){if(super(e.createChildContext()),this._parentChangeListener=this._register(new To),this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(II)){let i="";this._domNode.classList&&(i=Array.from(this._domNode.classList.values()).join(", ")),console.error(`Element already has context attribute${i?": "+i:""}`)}this._domNode.setAttribute(II,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(e=>{const i=this._parent.getContextValuesContainer(this._myContextId).value;dDt(e,i)||this._onDidChangeContext.fire(e)})}dispose(){this._isDisposed||(this._parent.disposeContext(this._myContextId),this._domNode.removeAttribute(II),super.dispose())}getContextValuesContainer(e){return this._isDisposed?wE.INSTANCE:this._parent.getContextValuesContainer(e)}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ScopedContextKeyService has been disposed");return this._parent.createChildContext(e)}disposeContext(e){this._isDisposed||this._parent.disposeContext(e)}}function fDt(n){for(;n;){if(n.hasAttribute(II)){const e=n.getAttribute(II);return e?parseInt(e,10):NaN}n=n.parentElement}return 0}function gDt(n,e,t){n.get(jt).createKey(String(e),pDt(t))}function pDt(n){return u4e(n,e=>{if(typeof e=="object"&&e.$mid===1)return Pt.revive(e).toString();if(e instanceof Pt)return e.toString()})}Un.registerCommand("_setContext",gDt);Un.registerCommand({id:"getContextKeyInfo",handler(){return[...et.all()].sort((n,e)=>n.key.localeCompare(e.key))},metadata:{description:w("getContextKeyInfo","A command that returns information about context keys"),args:[]}});Un.registerCommand("_generateContextKeyInfo",function(){const n=[],e=new Set;for(const t of et.all())e.has(t.key)||(e.add(t.key),n.push(t));n.sort((t,i)=>t.key.localeCompare(i.key)),console.log(JSON.stringify(n,void 0,2))});let mDt=class{constructor(e,t){this.key=e,this.data=t,this.incoming=new Map,this.outgoing=new Map}};class Qye{constructor(e){this._hashFn=e,this._nodes=new Map}roots(){const e=[];for(const t of this._nodes.values())t.outgoing.size===0&&e.push(t);return e}insertEdge(e,t){const i=this.lookupOrInsertNode(e),r=this.lookupOrInsertNode(t);i.outgoing.set(r.key,r),r.incoming.set(i.key,i)}removeNode(e){const t=this._hashFn(e);this._nodes.delete(t);for(const i of this._nodes.values())i.outgoing.delete(t),i.incoming.delete(t)}lookupOrInsertNode(e){const t=this._hashFn(e);let i=this._nodes.get(t);return i||(i=new mDt(t,e),this._nodes.set(t,i)),i}isEmpty(){return this._nodes.size===0}toString(){const e=[];for(const[t,i]of this._nodes)e.push(`${t} +${this._themeCSS}`,this._styleElements.forEach(e=>e.textContent=this._allCSS)}getFileIconTheme(){return{hasFileIcons:!1,hasFolderIcons:!1,hidesExplorerArrows:!1}}getProductIconTheme(){return this._builtInProductIconTheme}}const hd=On("themeService");var rDt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},wq=function(n,e){return function(t,i){e(t,i,n)}};let cJ=class extends me{constructor(e,t,i){super(),this._contextKeyService=e,this._layoutService=t,this._configurationService=i,this._accessibilitySupport=0,this._onDidChangeScreenReaderOptimized=new fe,this._onDidChangeReducedMotion=new fe,this._onDidChangeLinkUnderline=new fe,this._accessibilityModeEnabledContext=iO.bindTo(this._contextKeyService);const r=()=>this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());this._register(this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("editor.accessibilitySupport")&&(r(),this._onDidChangeScreenReaderOptimized.fire()),o.affectsConfiguration("workbench.reduceMotion")&&(this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this._onDidChangeReducedMotion.fire())})),r(),this._register(this.onDidChangeScreenReaderOptimized(()=>r()));const s=Xi.matchMedia("(prefers-reduced-motion: reduce)");this._systemMotionReduced=s.matches,this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this._linkUnderlinesEnabled=this._configurationService.getValue("accessibility.underlineLinks"),this.initReducedMotionListeners(s),this.initLinkUnderlineListeners()}initReducedMotionListeners(e){this._register(Ce(e,"change",()=>{this._systemMotionReduced=e.matches,this._configMotionReduced==="auto"&&this._onDidChangeReducedMotion.fire()}));const t=()=>{const i=this.isMotionReduced();this._layoutService.mainContainer.classList.toggle("reduce-motion",i),this._layoutService.mainContainer.classList.toggle("enable-motion",!i)};t(),this._register(this.onDidChangeReducedMotion(()=>t()))}initLinkUnderlineListeners(){this._register(this._configurationService.onDidChangeConfiguration(t=>{if(t.affectsConfiguration("accessibility.underlineLinks")){const i=this._configurationService.getValue("accessibility.underlineLinks");this._linkUnderlinesEnabled=i,this._onDidChangeLinkUnderline.fire()}}));const e=()=>{const t=this._linkUnderlinesEnabled;this._layoutService.mainContainer.classList.toggle("underline-links",t)};e(),this._register(this.onDidChangeLinkUnderlines(()=>e()))}onDidChangeLinkUnderlines(e){return this._onDidChangeLinkUnderline.event(e)}get onDidChangeScreenReaderOptimized(){return this._onDidChangeScreenReaderOptimized.event}isScreenReaderOptimized(){const e=this._configurationService.getValue("editor.accessibilitySupport");return e==="on"||e==="auto"&&this._accessibilitySupport===2}get onDidChangeReducedMotion(){return this._onDidChangeReducedMotion.event}isMotionReduced(){const e=this._configMotionReduced;return e==="on"||e==="auto"&&this._systemMotionReduced}getAccessibilitySupport(){return this._accessibilitySupport}};cJ=rDt([wq(0,jt),wq(1,Zb),wq(2,En)],cJ);var $W=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Hp=function(n,e){return function(t,i){e(t,i,n)}},Yx,PD;let uJ=class{constructor(e,t,i){this._commandService=e,this._keybindingService=t,this._hiddenStates=new dJ(i)}createMenu(e,t,i){return new t9(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...i},this._commandService,this._keybindingService,t)}getMenuActions(e,t,i){const r=new t9(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...i},this._commandService,this._keybindingService,t),s=r.getActions(i);return r.dispose(),s}resetHiddenStates(e){this._hiddenStates.reset(e)}};uJ=$W([Hp(0,_r),Hp(1,xi),Hp(2,pf)],uJ);let dJ=class{static{Yx=this}static{this._key="menu.hiddenCommands"}constructor(e){this._storageService=e,this._disposables=new ke,this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._ignoreChangeEvent=!1,this._hiddenByDefaultCache=new Map;try{const t=e.get(Yx._key,0,"{}");this._data=JSON.parse(t)}catch{this._data=Object.create(null)}this._disposables.add(e.onDidChangeValue(0,Yx._key,this._disposables)(()=>{if(!this._ignoreChangeEvent)try{const t=e.get(Yx._key,0,"{}");this._data=JSON.parse(t)}catch(t){console.log("FAILED to read storage after UPDATE",t)}this._onDidChange.fire()}))}dispose(){this._onDidChange.dispose(),this._disposables.dispose()}_isHiddenByDefault(e,t){return this._hiddenByDefaultCache.get(`${e.id}/${t}`)??!1}setDefaultState(e,t,i){this._hiddenByDefaultCache.set(`${e.id}/${t}`,i)}isHidden(e,t){const i=this._isHiddenByDefault(e,t),r=this._data[e.id]?.includes(t)??!1;return i?!r:r}updateHidden(e,t,i){this._isHiddenByDefault(e,t)&&(i=!i);const s=this._data[e.id];if(i)s?s.indexOf(t)<0&&s.push(t):this._data[e.id]=[t];else if(s){const o=s.indexOf(t);o>=0&&Zgt(s,o),s.length===0&&delete this._data[e.id]}this._persist()}reset(e){if(e===void 0)this._data=Object.create(null),this._persist();else{for(const{id:t}of e)this._data[t]&&delete this._data[t];this._persist()}}_persist(){try{this._ignoreChangeEvent=!0;const e=JSON.stringify(this._data);this._storageService.store(Yx._key,e,0,0)}finally{this._ignoreChangeEvent=!1}}};dJ=Yx=$W([Hp(0,pf)],dJ);class DI{constructor(e,t){this._id=e,this._collectContextKeysForSubmenus=t,this._menuGroups=[],this._allMenuIds=new Set,this._structureContextKeys=new Set,this._preconditionContextKeys=new Set,this._toggledContextKeys=new Set,this.refresh()}get allMenuIds(){return this._allMenuIds}get structureContextKeys(){return this._structureContextKeys}get preconditionContextKeys(){return this._preconditionContextKeys}get toggledContextKeys(){return this._toggledContextKeys}refresh(){this._menuGroups.length=0,this._allMenuIds.clear(),this._structureContextKeys.clear(),this._preconditionContextKeys.clear(),this._toggledContextKeys.clear();const e=this._sort(Fo.getMenuItems(this._id));let t;for(const i of e){const r=i.group||"";(!t||t[0]!==r)&&(t=[r,[]],this._menuGroups.push(t)),t[1].push(i),this._collectContextKeysAndSubmenuIds(i)}this._allMenuIds.add(this._id)}_sort(e){return e}_collectContextKeysAndSubmenuIds(e){if(DI._fillInKbExprKeys(e.when,this._structureContextKeys),lk(e)){if(e.command.precondition&&DI._fillInKbExprKeys(e.command.precondition,this._preconditionContextKeys),e.command.toggled){const t=e.command.toggled.condition||e.command.toggled;DI._fillInKbExprKeys(t,this._toggledContextKeys)}}else this._collectContextKeysForSubmenus&&(Fo.getMenuItems(e.submenu).forEach(this._collectContextKeysAndSubmenuIds,this),this._allMenuIds.add(e.submenu))}static _fillInKbExprKeys(e,t){if(e)for(const i of e.keys())t.add(i)}}let hJ=PD=class extends DI{constructor(e,t,i,r,s,o){super(e,i),this._hiddenStates=t,this._commandService=r,this._keybindingService=s,this._contextKeyService=o,this.refresh()}createActionGroups(e){const t=[];for(const i of this._menuGroups){const[r,s]=i;let o;for(const a of s)if(this._contextKeyService.contextMatchesRules(a.when)){const l=lk(a);l&&this._hiddenStates.setDefaultState(this._id,a.command.id,!!a.isHiddenByDefault);const c=sDt(this._id,l?a.command:a,this._hiddenStates);if(l){const u=K6e(this._commandService,this._keybindingService,a.command.id,a.when);(o??=[]).push(new ou(a.command,a.alt,e,c,u,this._contextKeyService,this._commandService))}else{const u=new PD(a.submenu,this._hiddenStates,this._collectContextKeysForSubmenus,this._commandService,this._keybindingService,this._contextKeyService).createActionGroups(e),d=na.join(...u.map(h=>h[1]));d.length>0&&(o??=[]).push(new ck(a,c,d))}}o&&o.length>0&&t.push([r,o])}return t}_sort(e){return e.sort(PD._compareMenuItems)}static _compareMenuItems(e,t){const i=e.group,r=t.group;if(i!==r){if(i){if(!r)return-1}else return 1;if(i==="navigation")return-1;if(r==="navigation")return 1;const a=i.localeCompare(r);if(a!==0)return a}const s=e.order||0,o=t.order||0;return so?1:PD._compareTitles(lk(e)?e.command.title:e.title,lk(t)?t.command.title:t.title)}static _compareTitles(e,t){const i=typeof e=="string"?e:e.original,r=typeof t=="string"?t:t.original;return i.localeCompare(r)}};hJ=PD=$W([Hp(3,_r),Hp(4,xi),Hp(5,jt)],hJ);let t9=class{constructor(e,t,i,r,s,o){this._disposables=new ke,this._menuInfo=new hJ(e,t,i.emitEventsForSubmenuChanges,r,s,o);const a=new Ui(()=>{this._menuInfo.refresh(),this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!0,isToggleChange:!0})},i.eventDebounceDelay);this._disposables.add(a),this._disposables.add(Fo.onDidChangeMenu(d=>{for(const h of this._menuInfo.allMenuIds)if(d.has(h)){a.schedule();break}}));const l=this._disposables.add(new ke),c=d=>{let h=!1,f=!1,g=!1;for(const p of d)if(h=h||p.isStructuralChange,f=f||p.isEnablementChange,g=g||p.isToggleChange,h&&f&&g)break;return{menu:this,isStructuralChange:h,isEnablementChange:f,isToggleChange:g}},u=()=>{l.add(o.onDidChangeContext(d=>{const h=d.affectsSome(this._menuInfo.structureContextKeys),f=d.affectsSome(this._menuInfo.preconditionContextKeys),g=d.affectsSome(this._menuInfo.toggledContextKeys);(h||f||g)&&this._onDidChange.fire({menu:this,isStructuralChange:h,isEnablementChange:f,isToggleChange:g})})),l.add(t.onDidChange(d=>{this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!1,isToggleChange:!1})}))};this._onDidChange=new S4e({onWillAddFirstListener:u,onDidRemoveLastListener:l.clear.bind(l),delay:i.eventDebounceDelay,merge:c}),this.onDidChange=this._onDidChange.event}getActions(e){return this._menuInfo.createActionGroups(e)}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}};t9=$W([Hp(3,_r),Hp(4,xi),Hp(5,jt)],t9);function sDt(n,e,t){const i=cvt(e)?e.submenu.id:e.id,r=typeof e.title=="string"?e.title:e.title.value,s=Yy({id:`hide/${n.id}/${i}`,label:w("hide.label","Hide '{0}'",r),run(){t.updateHidden(n,i,!0)}}),o=Yy({id:`toggle/${n.id}/${i}`,label:r,get checked(){return!t.isHidden(n,i)},run(){t.updateHidden(n,i,!!this.checked)}});return{hide:s,toggle:o,get isHidden(){return!o.checked}}}function K6e(n,e,t,i=void 0,r=!0){return Yy({id:`configureKeybinding/${t}`,label:w("configure keybinding","Configure Keybinding"),enabled:r,run(){const o=!!!e.lookupKeybinding(t)&&i?i.serialize():void 0;n.executeCommand("workbench.action.openGlobalKeybindings",`@command:${t}`+(o?` +when:${o}`:""))}})}var oDt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Gye=function(n,e){return function(t,i){e(t,i,n)}},fJ;const Yye="application/vnd.code.resources";let gJ=class extends me{static{fJ=this}constructor(e,t){super(),this.layoutService=e,this.logService=t,this.mapTextToType=new Map,this.findText="",this.resources=[],this.resourcesStateHash=void 0,(K_||G4e)&&this.installWebKitWriteTextWorkaround(),this._register(Ge.runAndSubscribe($$,({window:i,disposables:r})=>{r.add(Ce(i.document,"copy",()=>this.clearResourcesState()))},{window:Xi,disposables:this._store}))}installWebKitWriteTextWorkaround(){const e=()=>{const t=new KL;this.webKitPendingClipboardWritePromise&&!this.webKitPendingClipboardWritePromise.isSettled&&this.webKitPendingClipboardWritePromise.cancel(),this.webKitPendingClipboardWritePromise=t,SD().navigator.clipboard.write([new ClipboardItem({"text/plain":t.p})]).catch(async i=>{(!(i instanceof Error)||i.name!=="NotAllowedError"||!t.isRejected)&&this.logService.error(i)})};this._register(Ge.runAndSubscribe(this.layoutService.onDidAddContainer,({container:t,disposables:i})=>{i.add(Ce(t,"click",e)),i.add(Ce(t,"keydown",e))},{container:this.layoutService.mainContainer,disposables:this._store}))}async writeText(e,t){if(this.clearResourcesState(),t){this.mapTextToType.set(t,e);return}if(this.webKitPendingClipboardWritePromise)return this.webKitPendingClipboardWritePromise.complete(e);try{return await SD().navigator.clipboard.writeText(e)}catch(i){console.error(i)}this.fallbackWriteText(e)}fallbackWriteText(e){const t=GL(),i=t.activeElement,r=t.body.appendChild(qe("textarea",{"aria-hidden":!0}));r.style.height="1px",r.style.width="1px",r.style.position="absolute",r.value=e,r.focus(),r.select(),t.execCommand("copy"),Eo(i)&&i.focus(),r.remove()}async readText(e){if(e)return this.mapTextToType.get(e)||"";try{return await SD().navigator.clipboard.readText()}catch(t){console.error(t)}return""}async readFindText(){return this.findText}async writeFindText(e){this.findText=e}static{this.MAX_RESOURCE_STATE_SOURCE_LENGTH=1e3}async readResources(){try{const t=await SD().navigator.clipboard.read();for(const i of t)if(i.types.includes(`web ${Yye}`)){const r=await i.getType(`web ${Yye}`);return JSON.parse(await r.text()).map(o=>Pt.from(o))}}catch{}const e=await this.computeResourcesStateHash();return this.resourcesStateHash!==e&&this.clearResourcesState(),this.resources}async computeResourcesStateHash(){if(this.resources.length===0)return;const e=await this.readText();return F$(e.substring(0,fJ.MAX_RESOURCE_STATE_SOURCE_LENGTH))}clearInternalState(){this.clearResourcesState()}clearResourcesState(){this.resources=[],this.resourcesStateHash=void 0}};gJ=fJ=oDt([Gye(0,Zb),Gye(1,Da)],gJ);const b0=On("clipboardService");var aDt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},lDt=function(n,e){return function(t,i){e(t,i,n)}};const II="data-keybinding-context";let kce=class{constructor(e,t){this._id=e,this._parent=t,this._value=Object.create(null),this._value._contextId=e}get value(){return{...this._value}}setValue(e,t){return this._value[e]!==t?(this._value[e]=t,!0):!1}removeValue(e){return e in this._value?(delete this._value[e],!0):!1}getValue(e){const t=this._value[e];return typeof t>"u"&&this._parent?this._parent.getValue(e):t}};class wE extends kce{static{this.INSTANCE=new wE}constructor(){super(-1,null)}setValue(e,t){return!1}removeValue(e){return!1}getValue(e){}}class n9 extends kce{static{this._keyPrefix="config."}constructor(e,t,i){super(e,null),this._configurationService=t,this._values=fk.forConfigKeys(),this._listener=this._configurationService.onDidChangeConfiguration(r=>{if(r.source===7){const s=Array.from(this._values,([o])=>o);this._values.clear(),i.fire(new Xye(s))}else{const s=[];for(const o of r.affectedKeys){const a=`config.${o}`,l=this._values.findSuperstr(a);l!==void 0&&(s.push(...zn.map(l,([c])=>c)),this._values.deleteSuperstr(a)),this._values.has(a)&&(s.push(a),this._values.delete(a))}i.fire(new Xye(s))}})}dispose(){this._listener.dispose()}getValue(e){if(e.indexOf(n9._keyPrefix)!==0)return super.getValue(e);if(this._values.has(e))return this._values.get(e);const t=e.substr(n9._keyPrefix.length),i=this._configurationService.getValue(t);let r;switch(typeof i){case"number":case"boolean":case"string":r=i;break;default:Array.isArray(i)?r=JSON.stringify(i):r=i}return this._values.set(e,r),r}setValue(e,t){return super.setValue(e,t)}removeValue(e){return super.removeValue(e)}}class cDt{constructor(e,t,i){this._service=e,this._key=t,this._defaultValue=i,this.reset()}set(e){this._service.setContext(this._key,e)}reset(){typeof this._defaultValue>"u"?this._service.removeContext(this._key):this._service.setContext(this._key,this._defaultValue)}get(){return this._service.getContextKeyValue(this._key)}}class Zye{constructor(e){this.key=e}affectsSome(e){return e.has(this.key)}allKeysContainedIn(e){return this.affectsSome(e)}}class Xye{constructor(e){this.keys=e}affectsSome(e){for(const t of this.keys)if(e.has(t))return!0;return!1}allKeysContainedIn(e){return this.keys.every(t=>e.has(t))}}class uDt{constructor(e){this.events=e}affectsSome(e){for(const t of this.events)if(t.affectsSome(e))return!0;return!1}allKeysContainedIn(e){return this.events.every(t=>t.allKeysContainedIn(e))}}function dDt(n,e){return n.allKeysContainedIn(new Set(Object.keys(e)))}class G6e extends me{constructor(e){super(),this._onDidChangeContext=this._register(new Ew({merge:t=>new uDt(t)})),this.onDidChangeContext=this._onDidChangeContext.event,this._isDisposed=!1,this._myContextId=e}createKey(e,t){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new cDt(this,e,t)}bufferChangeEvents(e){this._onDidChangeContext.pause();try{e()}finally{this._onDidChangeContext.resume()}}createScoped(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new hDt(this,e)}contextMatchesRules(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");const t=this.getContextValuesContainer(this._myContextId);return e?e.evaluate(t):!0}getContextKeyValue(e){if(!this._isDisposed)return this.getContextValuesContainer(this._myContextId).getValue(e)}setContext(e,t){if(this._isDisposed)return;const i=this.getContextValuesContainer(this._myContextId);i&&i.setValue(e,t)&&this._onDidChangeContext.fire(new Zye(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new Zye(e))}getContext(e){return this._isDisposed?wE.INSTANCE:this.getContextValuesContainer(fDt(e))}dispose(){super.dispose(),this._isDisposed=!0}}let pJ=class extends G6e{constructor(e){super(0),this._contexts=new Map,this._lastContextId=0;const t=this._register(new n9(this._myContextId,e,this._onDidChangeContext));this._contexts.set(this._myContextId,t)}getContextValuesContainer(e){return this._isDisposed?wE.INSTANCE:this._contexts.get(e)||wE.INSTANCE}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ContextKeyService has been disposed");const t=++this._lastContextId;return this._contexts.set(t,new kce(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}};pJ=aDt([lDt(0,En)],pJ);class hDt extends G6e{constructor(e,t){if(super(e.createChildContext()),this._parentChangeListener=this._register(new To),this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(II)){let i="";this._domNode.classList&&(i=Array.from(this._domNode.classList.values()).join(", ")),console.error(`Element already has context attribute${i?": "+i:""}`)}this._domNode.setAttribute(II,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(e=>{const i=this._parent.getContextValuesContainer(this._myContextId).value;dDt(e,i)||this._onDidChangeContext.fire(e)})}dispose(){this._isDisposed||(this._parent.disposeContext(this._myContextId),this._domNode.removeAttribute(II),super.dispose())}getContextValuesContainer(e){return this._isDisposed?wE.INSTANCE:this._parent.getContextValuesContainer(e)}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ScopedContextKeyService has been disposed");return this._parent.createChildContext(e)}disposeContext(e){this._isDisposed||this._parent.disposeContext(e)}}function fDt(n){for(;n;){if(n.hasAttribute(II)){const e=n.getAttribute(II);return e?parseInt(e,10):NaN}n=n.parentElement}return 0}function gDt(n,e,t){n.get(jt).createKey(String(e),pDt(t))}function pDt(n){return u4e(n,e=>{if(typeof e=="object"&&e.$mid===1)return Pt.revive(e).toString();if(e instanceof Pt)return e.toString()})}Un.registerCommand("_setContext",gDt);Un.registerCommand({id:"getContextKeyInfo",handler(){return[...et.all()].sort((n,e)=>n.key.localeCompare(e.key))},metadata:{description:w("getContextKeyInfo","A command that returns information about context keys"),args:[]}});Un.registerCommand("_generateContextKeyInfo",function(){const n=[],e=new Set;for(const t of et.all())e.has(t.key)||(e.add(t.key),n.push(t));n.sort((t,i)=>t.key.localeCompare(i.key)),console.log(JSON.stringify(n,void 0,2))});let mDt=class{constructor(e,t){this.key=e,this.data=t,this.incoming=new Map,this.outgoing=new Map}};class Qye{constructor(e){this._hashFn=e,this._nodes=new Map}roots(){const e=[];for(const t of this._nodes.values())t.outgoing.size===0&&e.push(t);return e}insertEdge(e,t){const i=this.lookupOrInsertNode(e),r=this.lookupOrInsertNode(t);i.outgoing.set(r.key,r),r.incoming.set(i.key,i)}removeNode(e){const t=this._hashFn(e);this._nodes.delete(t);for(const i of this._nodes.values())i.outgoing.delete(t),i.incoming.delete(t)}lookupOrInsertNode(e){const t=this._hashFn(e);let i=this._nodes.get(t);return i||(i=new mDt(t,e),this._nodes.set(t,i)),i}isEmpty(){return this._nodes.size===0}toString(){const e=[];for(const[t,i]of this._nodes)e.push(`${t} (-> incoming)[${[...i.incoming.keys()].join(", ")}] (outgoing ->)[${[...i.outgoing.keys()].join(",")}] `);return e.join(` @@ -732,19 +732,19 @@ ${e.toString()}`}}class i9{constructor(e=new c2,t=!1,i,r=_Dt){this._services=e,t `)}const r=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${i(1,this)}`,`DONE, took ${e.toFixed(2)}ms (grand total ${kd._totals.toFixed(2)}ms)`];(e>2||t)&&kd.all.add(r.join(` `))}}const vDt=new Set([sn.inMemory,sn.vscodeSourceControl,sn.walkThrough,sn.walkThroughSnippet,sn.vscodeChatCodeBlock]);class bDt{constructor(){this._byResource=new so,this._byOwner=new Map}set(e,t,i){let r=this._byResource.get(e);r||(r=new Map,this._byResource.set(e,r)),r.set(t,i);let s=this._byOwner.get(t);s||(s=new so,this._byOwner.set(t,s)),s.set(e,i)}get(e,t){return this._byResource.get(e)?.get(t)}delete(e,t){let i=!1,r=!1;const s=this._byResource.get(e);s&&(i=s.delete(t));const o=this._byOwner.get(t);if(o&&(r=o.delete(e)),i!==r)throw new Error("illegal state");return i&&r}values(e){return typeof e=="string"?this._byOwner.get(e)?.values()??zn.empty():Pt.isUri(e)?this._byResource.get(e)?.values()??zn.empty():zn.map(zn.concat(...this._byOwner.values()),t=>t[1])}}class yDt{constructor(e){this.errors=0,this.infos=0,this.warnings=0,this.unknowns=0,this._data=new so,this._service=e,this._subscription=e.onMarkerChanged(this._update,this)}dispose(){this._subscription.dispose()}_update(e){for(const t of e){const i=this._data.get(t);i&&this._substract(i);const r=this._resourceStats(t);this._add(r),this._data.set(t,r)}}_resourceStats(e){const t={errors:0,warnings:0,infos:0,unknowns:0};if(vDt.has(e.scheme))return t;for(const{severity:i}of this._service.read({resource:e}))i===os.Error?t.errors+=1:i===os.Warning?t.warnings+=1:i===os.Info?t.infos+=1:t.unknowns+=1;return t}_substract(e){this.errors-=e.errors,this.warnings-=e.warnings,this.infos-=e.infos,this.unknowns-=e.unknowns}_add(e){this.errors+=e.errors,this.warnings+=e.warnings,this.infos+=e.infos,this.unknowns+=e.unknowns}}class sv{constructor(){this._onMarkerChanged=new S4e({delay:0,merge:sv._merge}),this.onMarkerChanged=this._onMarkerChanged.event,this._data=new bDt,this._stats=new yDt(this)}dispose(){this._stats.dispose(),this._onMarkerChanged.dispose()}remove(e,t){for(const i of t||[])this.changeOne(e,i,[])}changeOne(e,t,i){if(s4e(i))this._data.delete(t,e)&&this._onMarkerChanged.fire([t]);else{const r=[];for(const s of i){const o=sv._toMarker(e,t,s);o&&r.push(o)}this._data.set(t,e,r),this._onMarkerChanged.fire([t])}}static _toMarker(e,t,i){let{code:r,severity:s,message:o,source:a,startLineNumber:l,startColumn:c,endLineNumber:u,endColumn:d,relatedInformation:h,tags:f}=i;if(o)return l=l>0?l:1,c=c>0?c:1,u=u>=l?u:l,d=d>0?d:c,{resource:t,owner:e,code:r,severity:s,message:o,source:a,startLineNumber:l,startColumn:c,endLineNumber:u,endColumn:d,relatedInformation:h,tags:f}}changeAll(e,t){const i=[],r=this._data.values(e);if(r)for(const s of r){const o=zn.first(s);o&&(i.push(o.resource),this._data.delete(o.resource,e))}if(bl(t)){const s=new so;for(const{resource:o,marker:a}of t){const l=sv._toMarker(e,o,a);if(!l)continue;const c=s.get(o);c?c.push(l):(s.set(o,[l]),i.push(o))}for(const[o,a]of s)this._data.set(o,e,a)}i.length>0&&this._onMarkerChanged.fire(i)}read(e=Object.create(null)){let{owner:t,resource:i,severities:r,take:s}=e;if((!s||s<0)&&(s=-1),t&&i){const o=this._data.get(i,t);if(o){const a=[];for(const l of o)if(sv._accept(l,r)){const c=a.push(l);if(s>0&&c===s)break}return a}else return[]}else if(!t&&!i){const o=[];for(const a of this._data.values())for(const l of a)if(sv._accept(l,r)){const c=o.push(l);if(s>0&&c===s)return o}return o}else{const o=this._data.values(i??t),a=[];for(const l of o)for(const c of l)if(sv._accept(c,r)){const u=a.push(c);if(s>0&&u===s)return a}return a}}static _accept(e,t){return t===void 0||(t&e.severity)===e.severity}static _merge(e){const t=new so;for(const i of e)for(const r of i)t.set(r,!0);return Array.from(t.keys())}}class wDt extends me{get configurationModel(){return this._configurationModel}constructor(e){super(),this.logService=e,this._configurationModel=Zo.createEmptyModel(this.logService)}reload(){return this.resetConfigurationModel(),this.configurationModel}getConfigurationDefaultOverrides(){return{}}resetConfigurationModel(){this._configurationModel=Zo.createEmptyModel(this.logService);const e=Yr.as(ff.Configuration).getConfigurationProperties();this.updateConfigurationModel(Object.keys(e),e)}updateConfigurationModel(e,t){const i=this.getConfigurationDefaultOverrides();for(const r of e){const s=i[r],o=t[r];s!==void 0?this._configurationModel.setValue(r,s):o?this._configurationModel.setValue(r,o.default):this._configurationModel.removeValue(r)}}}const t1=On("accessibilitySignalService");class Bn{static register(e){return new Bn(e.fileName)}static{this.error=Bn.register({fileName:"error.mp3"})}static{this.warning=Bn.register({fileName:"warning.mp3"})}static{this.success=Bn.register({fileName:"success.mp3"})}static{this.foldedArea=Bn.register({fileName:"foldedAreas.mp3"})}static{this.break=Bn.register({fileName:"break.mp3"})}static{this.quickFixes=Bn.register({fileName:"quickFixes.mp3"})}static{this.taskCompleted=Bn.register({fileName:"taskCompleted.mp3"})}static{this.taskFailed=Bn.register({fileName:"taskFailed.mp3"})}static{this.terminalBell=Bn.register({fileName:"terminalBell.mp3"})}static{this.diffLineInserted=Bn.register({fileName:"diffLineInserted.mp3"})}static{this.diffLineDeleted=Bn.register({fileName:"diffLineDeleted.mp3"})}static{this.diffLineModified=Bn.register({fileName:"diffLineModified.mp3"})}static{this.chatRequestSent=Bn.register({fileName:"chatRequestSent.mp3"})}static{this.chatResponseReceived1=Bn.register({fileName:"chatResponseReceived1.mp3"})}static{this.chatResponseReceived2=Bn.register({fileName:"chatResponseReceived2.mp3"})}static{this.chatResponseReceived3=Bn.register({fileName:"chatResponseReceived3.mp3"})}static{this.chatResponseReceived4=Bn.register({fileName:"chatResponseReceived4.mp3"})}static{this.clear=Bn.register({fileName:"clear.mp3"})}static{this.save=Bn.register({fileName:"save.mp3"})}static{this.format=Bn.register({fileName:"format.mp3"})}static{this.voiceRecordingStarted=Bn.register({fileName:"voiceRecordingStarted.mp3"})}static{this.voiceRecordingStopped=Bn.register({fileName:"voiceRecordingStopped.mp3"})}static{this.progress=Bn.register({fileName:"progress.mp3"})}constructor(e){this.fileName=e}}class CDt{constructor(e){this.randomOneOf=e}}class Ai{constructor(e,t,i,r,s,o){this.sound=e,this.name=t,this.legacySoundSettingsKey=i,this.settingsKey=r,this.legacyAnnouncementSettingsKey=s,this.announcementMessage=o}static{this._signals=new Set}static register(e){const t=new CDt("randomOneOf"in e.sound?e.sound.randomOneOf:[e.sound]),i=new Ai(t,e.name,e.legacySoundSettingsKey,e.settingsKey,e.legacyAnnouncementSettingsKey,e.announcementMessage);return Ai._signals.add(i),i}static{this.errorAtPosition=Ai.register({name:w("accessibilitySignals.positionHasError.name","Error at Position"),sound:Bn.error,announcementMessage:w("accessibility.signals.positionHasError","Error"),settingsKey:"accessibility.signals.positionHasError",delaySettingsKey:"accessibility.signalOptions.delays.errorAtPosition"})}static{this.warningAtPosition=Ai.register({name:w("accessibilitySignals.positionHasWarning.name","Warning at Position"),sound:Bn.warning,announcementMessage:w("accessibility.signals.positionHasWarning","Warning"),settingsKey:"accessibility.signals.positionHasWarning",delaySettingsKey:"accessibility.signalOptions.delays.warningAtPosition"})}static{this.errorOnLine=Ai.register({name:w("accessibilitySignals.lineHasError.name","Error on Line"),sound:Bn.error,legacySoundSettingsKey:"audioCues.lineHasError",legacyAnnouncementSettingsKey:"accessibility.alert.error",announcementMessage:w("accessibility.signals.lineHasError","Error on Line"),settingsKey:"accessibility.signals.lineHasError"})}static{this.warningOnLine=Ai.register({name:w("accessibilitySignals.lineHasWarning.name","Warning on Line"),sound:Bn.warning,legacySoundSettingsKey:"audioCues.lineHasWarning",legacyAnnouncementSettingsKey:"accessibility.alert.warning",announcementMessage:w("accessibility.signals.lineHasWarning","Warning on Line"),settingsKey:"accessibility.signals.lineHasWarning"})}static{this.foldedArea=Ai.register({name:w("accessibilitySignals.lineHasFoldedArea.name","Folded Area on Line"),sound:Bn.foldedArea,legacySoundSettingsKey:"audioCues.lineHasFoldedArea",legacyAnnouncementSettingsKey:"accessibility.alert.foldedArea",announcementMessage:w("accessibility.signals.lineHasFoldedArea","Folded"),settingsKey:"accessibility.signals.lineHasFoldedArea"})}static{this.break=Ai.register({name:w("accessibilitySignals.lineHasBreakpoint.name","Breakpoint on Line"),sound:Bn.break,legacySoundSettingsKey:"audioCues.lineHasBreakpoint",legacyAnnouncementSettingsKey:"accessibility.alert.breakpoint",announcementMessage:w("accessibility.signals.lineHasBreakpoint","Breakpoint"),settingsKey:"accessibility.signals.lineHasBreakpoint"})}static{this.inlineSuggestion=Ai.register({name:w("accessibilitySignals.lineHasInlineSuggestion.name","Inline Suggestion on Line"),sound:Bn.quickFixes,legacySoundSettingsKey:"audioCues.lineHasInlineSuggestion",settingsKey:"accessibility.signals.lineHasInlineSuggestion"})}static{this.terminalQuickFix=Ai.register({name:w("accessibilitySignals.terminalQuickFix.name","Terminal Quick Fix"),sound:Bn.quickFixes,legacySoundSettingsKey:"audioCues.terminalQuickFix",legacyAnnouncementSettingsKey:"accessibility.alert.terminalQuickFix",announcementMessage:w("accessibility.signals.terminalQuickFix","Quick Fix"),settingsKey:"accessibility.signals.terminalQuickFix"})}static{this.onDebugBreak=Ai.register({name:w("accessibilitySignals.onDebugBreak.name","Debugger Stopped on Breakpoint"),sound:Bn.break,legacySoundSettingsKey:"audioCues.onDebugBreak",legacyAnnouncementSettingsKey:"accessibility.alert.onDebugBreak",announcementMessage:w("accessibility.signals.onDebugBreak","Breakpoint"),settingsKey:"accessibility.signals.onDebugBreak"})}static{this.noInlayHints=Ai.register({name:w("accessibilitySignals.noInlayHints","No Inlay Hints on Line"),sound:Bn.error,legacySoundSettingsKey:"audioCues.noInlayHints",legacyAnnouncementSettingsKey:"accessibility.alert.noInlayHints",announcementMessage:w("accessibility.signals.noInlayHints","No Inlay Hints"),settingsKey:"accessibility.signals.noInlayHints"})}static{this.taskCompleted=Ai.register({name:w("accessibilitySignals.taskCompleted","Task Completed"),sound:Bn.taskCompleted,legacySoundSettingsKey:"audioCues.taskCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.taskCompleted",announcementMessage:w("accessibility.signals.taskCompleted","Task Completed"),settingsKey:"accessibility.signals.taskCompleted"})}static{this.taskFailed=Ai.register({name:w("accessibilitySignals.taskFailed","Task Failed"),sound:Bn.taskFailed,legacySoundSettingsKey:"audioCues.taskFailed",legacyAnnouncementSettingsKey:"accessibility.alert.taskFailed",announcementMessage:w("accessibility.signals.taskFailed","Task Failed"),settingsKey:"accessibility.signals.taskFailed"})}static{this.terminalCommandFailed=Ai.register({name:w("accessibilitySignals.terminalCommandFailed","Terminal Command Failed"),sound:Bn.error,legacySoundSettingsKey:"audioCues.terminalCommandFailed",legacyAnnouncementSettingsKey:"accessibility.alert.terminalCommandFailed",announcementMessage:w("accessibility.signals.terminalCommandFailed","Command Failed"),settingsKey:"accessibility.signals.terminalCommandFailed"})}static{this.terminalCommandSucceeded=Ai.register({name:w("accessibilitySignals.terminalCommandSucceeded","Terminal Command Succeeded"),sound:Bn.success,announcementMessage:w("accessibility.signals.terminalCommandSucceeded","Command Succeeded"),settingsKey:"accessibility.signals.terminalCommandSucceeded"})}static{this.terminalBell=Ai.register({name:w("accessibilitySignals.terminalBell","Terminal Bell"),sound:Bn.terminalBell,legacySoundSettingsKey:"audioCues.terminalBell",legacyAnnouncementSettingsKey:"accessibility.alert.terminalBell",announcementMessage:w("accessibility.signals.terminalBell","Terminal Bell"),settingsKey:"accessibility.signals.terminalBell"})}static{this.notebookCellCompleted=Ai.register({name:w("accessibilitySignals.notebookCellCompleted","Notebook Cell Completed"),sound:Bn.taskCompleted,legacySoundSettingsKey:"audioCues.notebookCellCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellCompleted",announcementMessage:w("accessibility.signals.notebookCellCompleted","Notebook Cell Completed"),settingsKey:"accessibility.signals.notebookCellCompleted"})}static{this.notebookCellFailed=Ai.register({name:w("accessibilitySignals.notebookCellFailed","Notebook Cell Failed"),sound:Bn.taskFailed,legacySoundSettingsKey:"audioCues.notebookCellFailed",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellFailed",announcementMessage:w("accessibility.signals.notebookCellFailed","Notebook Cell Failed"),settingsKey:"accessibility.signals.notebookCellFailed"})}static{this.diffLineInserted=Ai.register({name:w("accessibilitySignals.diffLineInserted","Diff Line Inserted"),sound:Bn.diffLineInserted,legacySoundSettingsKey:"audioCues.diffLineInserted",settingsKey:"accessibility.signals.diffLineInserted"})}static{this.diffLineDeleted=Ai.register({name:w("accessibilitySignals.diffLineDeleted","Diff Line Deleted"),sound:Bn.diffLineDeleted,legacySoundSettingsKey:"audioCues.diffLineDeleted",settingsKey:"accessibility.signals.diffLineDeleted"})}static{this.diffLineModified=Ai.register({name:w("accessibilitySignals.diffLineModified","Diff Line Modified"),sound:Bn.diffLineModified,legacySoundSettingsKey:"audioCues.diffLineModified",settingsKey:"accessibility.signals.diffLineModified"})}static{this.chatRequestSent=Ai.register({name:w("accessibilitySignals.chatRequestSent","Chat Request Sent"),sound:Bn.chatRequestSent,legacySoundSettingsKey:"audioCues.chatRequestSent",legacyAnnouncementSettingsKey:"accessibility.alert.chatRequestSent",announcementMessage:w("accessibility.signals.chatRequestSent","Chat Request Sent"),settingsKey:"accessibility.signals.chatRequestSent"})}static{this.chatResponseReceived=Ai.register({name:w("accessibilitySignals.chatResponseReceived","Chat Response Received"),legacySoundSettingsKey:"audioCues.chatResponseReceived",sound:{randomOneOf:[Bn.chatResponseReceived1,Bn.chatResponseReceived2,Bn.chatResponseReceived3,Bn.chatResponseReceived4]},settingsKey:"accessibility.signals.chatResponseReceived"})}static{this.progress=Ai.register({name:w("accessibilitySignals.progress","Progress"),sound:Bn.progress,legacySoundSettingsKey:"audioCues.chatResponsePending",legacyAnnouncementSettingsKey:"accessibility.alert.progress",announcementMessage:w("accessibility.signals.progress","Progress"),settingsKey:"accessibility.signals.progress"})}static{this.clear=Ai.register({name:w("accessibilitySignals.clear","Clear"),sound:Bn.clear,legacySoundSettingsKey:"audioCues.clear",legacyAnnouncementSettingsKey:"accessibility.alert.clear",announcementMessage:w("accessibility.signals.clear","Clear"),settingsKey:"accessibility.signals.clear"})}static{this.save=Ai.register({name:w("accessibilitySignals.save","Save"),sound:Bn.save,legacySoundSettingsKey:"audioCues.save",legacyAnnouncementSettingsKey:"accessibility.alert.save",announcementMessage:w("accessibility.signals.save","Save"),settingsKey:"accessibility.signals.save"})}static{this.format=Ai.register({name:w("accessibilitySignals.format","Format"),sound:Bn.format,legacySoundSettingsKey:"audioCues.format",legacyAnnouncementSettingsKey:"accessibility.alert.format",announcementMessage:w("accessibility.signals.format","Format"),settingsKey:"accessibility.signals.format"})}static{this.voiceRecordingStarted=Ai.register({name:w("accessibilitySignals.voiceRecordingStarted","Voice Recording Started"),sound:Bn.voiceRecordingStarted,legacySoundSettingsKey:"audioCues.voiceRecordingStarted",settingsKey:"accessibility.signals.voiceRecordingStarted"})}static{this.voiceRecordingStopped=Ai.register({name:w("accessibilitySignals.voiceRecordingStopped","Voice Recording Stopped"),sound:Bn.voiceRecordingStopped,legacySoundSettingsKey:"audioCues.voiceRecordingStopped",settingsKey:"accessibility.signals.voiceRecordingStopped"})}}class xDt extends me{constructor(e,t=[]){super(),this.logger=new dvt([e,...t]),this._register(e.onDidChangeLogLevel(i=>this.setLevel(i)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(e){this.logger.setLevel(e)}getLevel(){return this.logger.getLevel()}trace(e,...t){this.logger.trace(e,...t)}debug(e,...t){this.logger.debug(e,...t)}info(e,...t){this.logger.info(e,...t)}warn(e,...t){this.logger.warn(e,...t)}error(e,...t){this.logger.error(e,...t)}}const Y6e=[];function u2(n){Y6e.push(n)}function SDt(){return Y6e.slice(0)}class kDt{getParseResult(e){}}var hm=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Bs=function(n,e){return function(t,i){e(t,i,n)}};class EDt{constructor(e){this.disposed=!1,this.model=e,this._onWillDispose=new fe}get textEditorModel(){return this.model}dispose(){this.disposed=!0,this._onWillDispose.fire()}}let mJ=class{constructor(e){this.modelService=e}createModelReference(e){const t=this.modelService.getModel(e);return t?Promise.resolve(new _mt(new EDt(t))):Promise.reject(new Error("Model not found"))}};mJ=hm([Bs(0,Sr)],mJ);class Ece{static{this.NULL_PROGRESS_RUNNER={done:()=>{},total:()=>{},worked:()=>{}}}show(){return Ece.NULL_PROGRESS_RUNNER}async showWhile(e,t){await e}}class LDt{withProgress(e,t,i){return t({report:()=>{}})}}class TDt{constructor(){this.isExtensionDevelopment=!1,this.isBuilt=!1}}class DDt{async confirm(e){return{confirmed:this.doConfirm(e.message,e.detail),checkboxChecked:!1}}doConfirm(e,t){let i=e;return t&&(i=i+` -`+t),Xi.confirm(i)}async prompt(e){let t;if(this.doConfirm(e.message,e.detail)){const r=[...e.buttons??[]];e.cancelButton&&typeof e.cancelButton!="string"&&typeof e.cancelButton!="boolean"&&r.push(e.cancelButton),t=await r[0]?.run({checkboxChecked:!1})}return{result:t}}async error(e,t){await this.prompt({type:Ss.Error,message:e,detail:t})}}class r9{static{this.NO_OP=new N1t}info(e){return this.notify({severity:Ss.Info,message:e})}warn(e){return this.notify({severity:Ss.Warning,message:e})}error(e){return this.notify({severity:Ss.Error,message:e})}notify(e){switch(e.severity){case Ss.Error:console.error(e.message);break;case Ss.Warning:console.warn(e.message);break;default:console.log(e.message);break}return r9.NO_OP}prompt(e,t,i,r){return r9.NO_OP}status(e,t){return me.None}}let _J=class{constructor(e){this._onWillExecuteCommand=new fe,this._onDidExecuteCommand=new fe,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this._instantiationService=e}executeCommand(e,...t){const i=Un.getCommand(e);if(!i)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});const r=this._instantiationService.invokeFunction.apply(this._instantiationService,[i.handler,...t]);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(r)}catch(r){return Promise.reject(r)}}};_J=hm([Bs(0,Tt)],_J);let CE=class extends Yxt{constructor(e,t,i,r,s,o){super(e,t,i,r,s),this._cachedResolver=null,this._dynamicKeybindings=[],this._domNodeListeners=[];const a=f=>{const g=new ke;g.add(Ce(f,je.KEY_DOWN,p=>{const m=new or(p);this._dispatch(m,m.target)&&(m.preventDefault(),m.stopPropagation())})),g.add(Ce(f,je.KEY_UP,p=>{const m=new or(p);this._singleModifierDispatch(m,m.target)&&m.preventDefault()})),this._domNodeListeners.push(new IDt(f,g))},l=f=>{for(let g=0;g{f.getOption(61)||a(f.getContainerDomNode())},u=f=>{f.getOption(61)||l(f.getContainerDomNode())};this._register(o.onCodeEditorAdd(c)),this._register(o.onCodeEditorRemove(u)),o.listCodeEditors().forEach(c);const d=f=>{a(f.getContainerDomNode())},h=f=>{l(f.getContainerDomNode())};this._register(o.onDiffEditorAdd(d)),this._register(o.onDiffEditorRemove(h)),o.listDiffEditors().forEach(d)}addDynamicKeybinding(e,t,i,r){return Qh(Un.registerCommand(e,i),this.addDynamicKeybindings([{keybinding:t,command:e,when:r}]))}addDynamicKeybindings(e){const t=e.map(i=>({keybinding:dX(i.keybinding,eu),command:i.command??null,commandArgs:i.commandArgs,when:i.when,weight1:1e3,weight2:0,extensionId:null,isBuiltinExtension:!1}));return this._dynamicKeybindings=this._dynamicKeybindings.concat(t),this.updateResolver(),Lt(()=>{for(let i=0;ithis._log(i))}return this._cachedResolver}_documentHasFocus(){return Xi.document.hasFocus()}_toNormalizedKeybindingItems(e,t){const i=[];let r=0;for(const s of e){const o=s.when||void 0,a=s.keybinding;if(!a)i[r++]=new H1e(void 0,s.command,s.commandArgs,o,t,null,!1);else{const l=EN.resolveKeybinding(a,eu);for(const c of l)i[r++]=new H1e(c,s.command,s.commandArgs,o,t,null,!1)}}return i}resolveKeyboardEvent(e){const t=new G_(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,e.keyCode);return new EN([t],eu)}};CE=hm([Bs(0,jt),Bs(1,_r),Bs(2,Qa),Bs(3,Ts),Bs(4,Da),Bs(5,ai)],CE);class IDt extends me{constructor(e,t){super(),this.domNode=e,this._register(t)}}function ewe(n){return n&&typeof n=="object"&&(!n.overrideIdentifier||typeof n.overrideIdentifier=="string")&&(!n.resource||n.resource instanceof Pt)}let s9=class{constructor(e){this.logService=e,this._onDidChangeConfiguration=new fe,this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;const t=new wDt(e);this._configuration=new yW(t.reload(),Zo.createEmptyModel(e),Zo.createEmptyModel(e),Zo.createEmptyModel(e),Zo.createEmptyModel(e),Zo.createEmptyModel(e),new so,Zo.createEmptyModel(e),new so,e),t.dispose()}getValue(e,t){const i=typeof e=="string"?e:void 0,r=ewe(e)?e:ewe(t)?t:{};return this._configuration.getValue(i,r,void 0)}updateValues(e){const t={data:this._configuration.toData()},i=[];for(const r of e){const[s,o]=r;this.getValue(s)!==o&&(this._configuration.updateValue(s,o),i.push(s))}if(i.length>0){const r=new Uxt({keys:i,overrides:[]},t,this._configuration,void 0,this.logService);r.source=8,this._onDidChangeConfiguration.fire(r)}return Promise.resolve()}updateValue(e,t,i,r){return this.updateValues([[e,t]])}inspect(e,t={}){return this._configuration.inspect(e,t,void 0)}};s9=hm([Bs(0,Da)],s9);let vJ=class{constructor(e,t,i){this.configurationService=e,this.modelService=t,this.languageService=i,this._onDidChangeConfiguration=new fe,this.configurationService.onDidChangeConfiguration(r=>{this._onDidChangeConfiguration.fire({affectedKeys:r.affectedKeys,affectsConfiguration:(s,o)=>r.affectsConfiguration(o)})})}getValue(e,t,i){const r=he.isIPosition(t)?t:null,s=r?typeof i=="string"?i:void 0:typeof t=="string"?t:void 0,o=e?this.getLanguage(e,r):void 0;return typeof s>"u"?this.configurationService.getValue({resource:e,overrideIdentifier:o}):this.configurationService.getValue(s,{resource:e,overrideIdentifier:o})}getLanguage(e,t){const i=this.modelService.getModel(e);return i?t?i.getLanguageIdAtPosition(t.lineNumber,t.column):i.getLanguageId():this.languageService.guessLanguageIdByFilepathOrFirstLine(e)}};vJ=hm([Bs(0,kn),Bs(1,Sr),Bs(2,Hr)],vJ);let bJ=class{constructor(e){this.configurationService=e}getEOL(e,t){const i=this.configurationService.getValue("files.eol",{overrideIdentifier:t,resource:e});return i&&typeof i=="string"&&i!=="auto"?i:zl||Rn?` +`+t),Xi.confirm(i)}async prompt(e){let t;if(this.doConfirm(e.message,e.detail)){const r=[...e.buttons??[]];e.cancelButton&&typeof e.cancelButton!="string"&&typeof e.cancelButton!="boolean"&&r.push(e.cancelButton),t=await r[0]?.run({checkboxChecked:!1})}return{result:t}}async error(e,t){await this.prompt({type:Ss.Error,message:e,detail:t})}}class r9{static{this.NO_OP=new N1t}info(e){return this.notify({severity:Ss.Info,message:e})}warn(e){return this.notify({severity:Ss.Warning,message:e})}error(e){return this.notify({severity:Ss.Error,message:e})}notify(e){switch(e.severity){case Ss.Error:console.error(e.message);break;case Ss.Warning:console.warn(e.message);break;default:console.log(e.message);break}return r9.NO_OP}prompt(e,t,i,r){return r9.NO_OP}status(e,t){return me.None}}let _J=class{constructor(e){this._onWillExecuteCommand=new fe,this._onDidExecuteCommand=new fe,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this._instantiationService=e}executeCommand(e,...t){const i=Un.getCommand(e);if(!i)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});const r=this._instantiationService.invokeFunction.apply(this._instantiationService,[i.handler,...t]);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(r)}catch(r){return Promise.reject(r)}}};_J=hm([Bs(0,Tt)],_J);let CE=class extends Yxt{constructor(e,t,i,r,s,o){super(e,t,i,r,s),this._cachedResolver=null,this._dynamicKeybindings=[],this._domNodeListeners=[];const a=f=>{const g=new ke;g.add(Ce(f,je.KEY_DOWN,p=>{const m=new or(p);this._dispatch(m,m.target)&&(m.preventDefault(),m.stopPropagation())})),g.add(Ce(f,je.KEY_UP,p=>{const m=new or(p);this._singleModifierDispatch(m,m.target)&&m.preventDefault()})),this._domNodeListeners.push(new IDt(f,g))},l=f=>{for(let g=0;g{f.getOption(61)||a(f.getContainerDomNode())},u=f=>{f.getOption(61)||l(f.getContainerDomNode())};this._register(o.onCodeEditorAdd(c)),this._register(o.onCodeEditorRemove(u)),o.listCodeEditors().forEach(c);const d=f=>{a(f.getContainerDomNode())},h=f=>{l(f.getContainerDomNode())};this._register(o.onDiffEditorAdd(d)),this._register(o.onDiffEditorRemove(h)),o.listDiffEditors().forEach(d)}addDynamicKeybinding(e,t,i,r){return Qh(Un.registerCommand(e,i),this.addDynamicKeybindings([{keybinding:t,command:e,when:r}]))}addDynamicKeybindings(e){const t=e.map(i=>({keybinding:dX(i.keybinding,eu),command:i.command??null,commandArgs:i.commandArgs,when:i.when,weight1:1e3,weight2:0,extensionId:null,isBuiltinExtension:!1}));return this._dynamicKeybindings=this._dynamicKeybindings.concat(t),this.updateResolver(),Lt(()=>{for(let i=0;ithis._log(i))}return this._cachedResolver}_documentHasFocus(){return Xi.document.hasFocus()}_toNormalizedKeybindingItems(e,t){const i=[];let r=0;for(const s of e){const o=s.when||void 0,a=s.keybinding;if(!a)i[r++]=new H1e(void 0,s.command,s.commandArgs,o,t,null,!1);else{const l=EN.resolveKeybinding(a,eu);for(const c of l)i[r++]=new H1e(c,s.command,s.commandArgs,o,t,null,!1)}}return i}resolveKeyboardEvent(e){const t=new G_(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,e.keyCode);return new EN([t],eu)}};CE=hm([Bs(0,jt),Bs(1,_r),Bs(2,Qa),Bs(3,Ts),Bs(4,Da),Bs(5,ai)],CE);class IDt extends me{constructor(e,t){super(),this.domNode=e,this._register(t)}}function ewe(n){return n&&typeof n=="object"&&(!n.overrideIdentifier||typeof n.overrideIdentifier=="string")&&(!n.resource||n.resource instanceof Pt)}let s9=class{constructor(e){this.logService=e,this._onDidChangeConfiguration=new fe,this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;const t=new wDt(e);this._configuration=new yW(t.reload(),Zo.createEmptyModel(e),Zo.createEmptyModel(e),Zo.createEmptyModel(e),Zo.createEmptyModel(e),Zo.createEmptyModel(e),new so,Zo.createEmptyModel(e),new so,e),t.dispose()}getValue(e,t){const i=typeof e=="string"?e:void 0,r=ewe(e)?e:ewe(t)?t:{};return this._configuration.getValue(i,r,void 0)}updateValues(e){const t={data:this._configuration.toData()},i=[];for(const r of e){const[s,o]=r;this.getValue(s)!==o&&(this._configuration.updateValue(s,o),i.push(s))}if(i.length>0){const r=new Uxt({keys:i,overrides:[]},t,this._configuration,void 0,this.logService);r.source=8,this._onDidChangeConfiguration.fire(r)}return Promise.resolve()}updateValue(e,t,i,r){return this.updateValues([[e,t]])}inspect(e,t={}){return this._configuration.inspect(e,t,void 0)}};s9=hm([Bs(0,Da)],s9);let vJ=class{constructor(e,t,i){this.configurationService=e,this.modelService=t,this.languageService=i,this._onDidChangeConfiguration=new fe,this.configurationService.onDidChangeConfiguration(r=>{this._onDidChangeConfiguration.fire({affectedKeys:r.affectedKeys,affectsConfiguration:(s,o)=>r.affectsConfiguration(o)})})}getValue(e,t,i){const r=he.isIPosition(t)?t:null,s=r?typeof i=="string"?i:void 0:typeof t=="string"?t:void 0,o=e?this.getLanguage(e,r):void 0;return typeof s>"u"?this.configurationService.getValue({resource:e,overrideIdentifier:o}):this.configurationService.getValue(s,{resource:e,overrideIdentifier:o})}getLanguage(e,t){const i=this.modelService.getModel(e);return i?t?i.getLanguageIdAtPosition(t.lineNumber,t.column):i.getLanguageId():this.languageService.guessLanguageIdByFilepathOrFirstLine(e)}};vJ=hm([Bs(0,En),Bs(1,Sr),Bs(2,Hr)],vJ);let bJ=class{constructor(e){this.configurationService=e}getEOL(e,t){const i=this.configurationService.getValue("files.eol",{overrideIdentifier:t,resource:e});return i&&typeof i=="string"&&i!=="auto"?i:zl||Rn?` `:`\r -`}};bJ=hm([Bs(0,kn)],bJ);class ADt{publicLog2(){}}class o9{static{this.SCHEME="inmemory"}constructor(){const e=Pt.from({scheme:o9.SCHEME,authority:"model",path:"/"});this.workspace={id:n5e,folders:[new cSt({uri:e,name:"",index:0})]}}getWorkspace(){return this.workspace}getWorkspaceFolder(e){return e&&e.scheme===o9.SCHEME?this.workspace.folders[0]:null}}function a9(n,e,t){if(!e||!(n instanceof s9))return;const i=[];Object.keys(e).forEach(r=>{$xt(r)&&i.push([`editor.${r}`,e[r]]),t&&Wxt(r)&&i.push([`diffEditor.${r}`,e[r]])}),i.length>0&&n.updateValues(i)}let yJ=class{constructor(e){this._modelService=e}hasPreviewHandler(){return!1}async apply(e,t){const i=Array.isArray(e)?e:Ple.convert(e),r=new Map;for(const a of i){if(!(a instanceof ab))throw new Error("bad edit - only text edits are supported");const l=this._modelService.getModel(a.resource);if(!l)throw new Error("bad edit - model not found");if(typeof a.versionId=="number"&&l.getVersionId()!==a.versionId)throw new Error("bad state - model changed in the meantime");let c=r.get(l);c||(c=[],r.set(l,c)),c.push(jr.replaceMove($.lift(a.textEdit.range),a.textEdit.text))}let s=0,o=0;for(const[a,l]of r)a.pushStackElement(),a.pushEditOperations([],l,()=>[]),a.pushStackElement(),o+=1,s+=l.length;return{ariaSummary:Lw(vQ.bulkEditServiceSummary,s,o),isApplied:s>0}}};yJ=hm([Bs(0,Sr)],yJ);class NDt{getUriLabel(e,t){return e.scheme==="file"?e.fsPath:e.path}getUriBasenameLabel(e){return th(e)}}let wJ=class extends Pxt{constructor(e,t){super(e),this._codeEditorService=t}showContextView(e,t,i){if(!t){const r=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();r&&(t=r.getContainerDomNode())}return super.showContextView(e,t,i)}};wJ=hm([Bs(0,Zb),Bs(1,ai)],wJ);class RDt{constructor(){this._neverEmitter=new fe,this.onDidChangeTrust=this._neverEmitter.event}isWorkspaceTrusted(){return!0}}class PDt extends L8{constructor(){super()}}class ODt extends xDt{constructor(){super(new uvt)}}let CJ=class extends IQ{constructor(e,t,i,r,s,o){super(e,t,i,r,s,o),this.configure({blockMouse:!1})}};CJ=hm([Bs(0,Qa),Bs(1,Ts),Bs(2,m0),Bs(3,xi),Bs(4,ld),Bs(5,jt)],CJ);const xJ={amdModuleId:"vs/editor/common/services/editorSimpleWorker",esmModuleLocation:void 0,label:"editorWorkerService"};let SJ=class extends RX{constructor(e,t,i,r,s){super(xJ,e,t,i,r,s)}};SJ=hm([Bs(0,Sr),Bs(1,nW),Bs(2,Da),Bs(3,Zr),Bs(4,dt)],SJ);class MDt{async playSignal(e,t){}}Vn(Da,ODt,0);Vn(kn,s9,0);Vn(nW,vJ,0);Vn(Q3e,bJ,0);Vn(Mw,o9,0);Vn(pE,NDt,0);Vn(Qa,ADt,0);Vn(JP,DDt,0);Vn(ole,TDt,0);Vn(Ts,r9,0);Vn(dm,sv,0);Vn(Hr,PDt,0);Vn(hd,iDt,0);Vn(Sr,UQ,0);Vn(Ule,OQ,0);Vn(jt,pJ,0);Vn(t5e,LDt,0);Vn(Qb,Ece,0);Vn(pf,Ckt,0);Vn(Oc,SJ,0);Vn(rO,yJ,0);Vn(i5e,RDt,0);Vn(Nc,mJ,0);Vn(_u,cJ,0);Vn(fh,mTt,0);Vn(_r,_J,0);Vn(xi,CE,0);Vn(hh,aJ,0);Vn(m0,wJ,0);Vn(Pc,PQ,0);Vn(b0,gJ,0);Vn(mu,CJ,0);Vn(ld,uJ,0);Vn(t1,MDt,0);Vn(t6e,kDt,0);var Yt;(function(n){const e=new c2;for(const[l,c]of fbe())e.set(l,c);const t=new i9(e,!0);e.set(Tt,t);function i(l){r||o({});const c=e.get(l);if(!c)throw new Error("Missing service "+l);return c instanceof gp?t.invokeFunction(u=>u.get(l)):c}n.get=i;let r=!1;const s=new fe;function o(l){if(r)return t;r=!0;for(const[u,d]of fbe())e.get(u)||e.set(u,d);for(const u in l)if(l.hasOwnProperty(u)){const d=On(u);e.get(d)instanceof gp&&e.set(d,l[u])}const c=SDt();for(const u of c)try{t.createInstance(u)}catch(d){rn(d)}return s.fire(),t}n.initialize=o;function a(l){if(r)return l();const c=new ke,u=c.add(s.event(()=>{u.dispose(),c.add(l())}));return c}n.withServices=a})(Yt||(Yt={}));function FDt(n,e){return new BDt(n,e)}class BDt extends o8{constructor(e,t){const i={amdModuleId:xJ.amdModuleId,esmModuleLocation:xJ.esmModuleLocation,label:t.label};super(i,t.keepIdleModels||!1,e),this._foreignModuleId=t.moduleId,this._foreignModuleCreateData=t.createData||null,this._foreignModuleHost=t.host||null,this._foreignProxy=null}fhr(e,t){if(!this._foreignModuleHost||typeof this._foreignModuleHost[e]!="function")return Promise.reject(new Error("Missing method "+e+" or missing main thread foreign host."));try{return Promise.resolve(this._foreignModuleHost[e].apply(this._foreignModuleHost,t))}catch(i){return Promise.reject(i)}}_getForeignProxy(){return this._foreignProxy||(this._foreignProxy=this._getProxy().then(e=>{const t=this._foreignModuleHost?aZ(this._foreignModuleHost):[];return e.$loadForeignModule(this._foreignModuleId,this._foreignModuleCreateData,t).then(i=>{this._foreignModuleCreateData=null;const r=(a,l)=>e.$fmr(a,l),s=(a,l)=>function(){const c=Array.prototype.slice.call(arguments,0);return l(a,c)},o={};for(const a of i)o[a]=s(a,r);return o})})),this._foreignProxy}getProxy(){return this._getForeignProxy()}withSyncedResources(e){return this.workerWithSyncedResources(e).then(t=>this.getProxy())}}const pO={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"};class Ol{constructor(e,t,i,r){this.startColumn=e,this.endColumn=t,this.className=i,this.type=r,this._lineDecorationBrand=void 0}static _equals(e,t){return e.startColumn===t.startColumn&&e.endColumn===t.endColumn&&e.className===t.className&&e.type===t.type}static equalsArr(e,t){const i=e.length,r=t.length;if(i!==r)return!1;for(let s=0;s=s||(a[l++]=new Ol(Math.max(1,c.startColumn-r+1),Math.min(o+1,c.endColumn-r+1),c.className,c.type));return a}static filter(e,t,i,r){if(e.length===0)return[];const s=[];let o=0;for(let a=0,l=e.length;at||u.isEmpty()&&(c.type===0||c.type===3))continue;const d=u.startLineNumber===t?u.startColumn:i,h=u.endLineNumber===t?u.endColumn:r;s[o++]=new Ol(d,h,c.inlineClassName,c.type)}return s}static _typeCompare(e,t){const i=[2,0,1,3];return i[e]-i[t]}static compare(e,t){if(e.startColumn!==t.startColumn)return e.startColumn-t.startColumn;if(e.endColumn!==t.endColumn)return e.endColumn-t.endColumn;const i=Ol._typeCompare(e.type,t.type);return i!==0?i:e.className!==t.className?e.className0&&this.stopOffsets[0]0&&t=e){this.stopOffsets.splice(r,0,e),this.classNames.splice(r,0,t),this.metadata.splice(r,0,i);break}this.count++}};class WDt{static normalize(e,t){if(t.length===0)return[];const i=[],r=new $Dt;let s=0;for(let o=0,a=t.length;o1){const p=e.charCodeAt(c-2);Co(p)&&c--}if(u>1){const p=e.charCodeAt(u-2);Co(p)&&u--}const f=c-1,g=u-2;s=r.consumeLowerThan(f,s,i),r.count===0&&(s=f),r.insert(g,d,h)}return r.consumeLowerThan(1073741824,s,i),i}}class Oo{constructor(e,t,i,r){this.endIndex=e,this.type=t,this.metadata=i,this.containsRTL=r,this._linePartBrand=void 0}isWhitespace(){return!!(this.metadata&1)}isPseudoAfter(){return!!(this.metadata&4)}}class Z6e{constructor(e,t){this.startOffset=e,this.endOffset=t}equals(e){return this.startOffset===e.startOffset&&this.endOffset===e.endOffset}}class n1{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f,g,p,m,_,v,y){this.useMonospaceOptimizations=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.continuesWithWrappedLine=r,this.isBasicASCII=s,this.containsRTL=o,this.fauxIndentLength=a,this.lineTokens=l,this.lineDecorations=c.sort(Ol.compare),this.tabSize=u,this.startVisibleColumn=d,this.spaceWidth=h,this.stopRenderingLineAfter=p,this.renderWhitespace=m==="all"?4:m==="boundary"?1:m==="selection"?2:m==="trailing"?3:0,this.renderControlCharacters=_,this.fontLigatures=v,this.selectionsOnLine=y&&y.sort((k,L)=>k.startOffset>>16}static getCharIndex(e){return(e&65535)>>>0}constructor(e,t){this.length=e,this._data=new Uint32Array(this.length),this._horizontalOffset=new Uint32Array(this.length)}setColumnInfo(e,t,i,r){const s=(t<<16|i<<0)>>>0;this._data[e-1]=s,this._horizontalOffset[e-1]=r}getHorizontalOffset(e){return this._horizontalOffset.length===0?0:this._horizontalOffset[e-1]}charOffsetToPartData(e){return this.length===0?0:e<0?this._data[0]:e>=this.length?this._data[this.length-1]:this._data[e]}getDomPosition(e){const t=this.charOffsetToPartData(e-1),i=pp.getPartIndex(t),r=pp.getCharIndex(t);return new X6e(i,r)}getColumn(e,t){return this.partDataToCharOffset(e.partIndex,t,e.charIndex)+1}partDataToCharOffset(e,t,i){if(this.length===0)return 0;const r=(e<<16|i<<0)>>>0;let s=0,o=this.length-1;for(;s+1>>1,m=this._data[p];if(m===r)return p;m>r?o=p:s=p}if(s===o)return s;const a=this._data[s],l=this._data[o];if(a===r)return s;if(l===r)return o;const c=pp.getPartIndex(a),u=pp.getCharIndex(a),d=pp.getPartIndex(l);let h;c!==d?h=t:h=pp.getCharIndex(l);const f=i-u,g=h-i;return f<=g?s:o}}class EJ{constructor(e,t,i){this._renderLineOutputBrand=void 0,this.characterMapping=e,this.containsRTL=t,this.containsForeignElements=i}}function mO(n,e){if(n.lineContent.length===0){if(n.lineDecorations.length>0){e.appendString("");let t=0,i=0,r=0;for(const o of n.lineDecorations)(o.type===1||o.type===2)&&(e.appendString(''),o.type===1&&(r|=1,t++),o.type===2&&(r|=2,i++));e.appendString("");const s=new pp(1,t+i);return s.setColumnInfo(1,t,0,0),new EJ(s,!1,r)}return e.appendString(""),new EJ(new pp(0,0),!1,0)}return YDt(zDt(n),e)}class HDt{constructor(e,t,i,r){this.characterMapping=e,this.html=t,this.containsRTL=i,this.containsForeignElements=r}}function WW(n){const e=new XL(1e4),t=mO(n,e);return new HDt(t.characterMapping,e.build(),t.containsRTL,t.containsForeignElements)}class VDt{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f,g,p,m){this.fontIsMonospace=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.len=r,this.isOverflowing=s,this.overflowingCharCount=o,this.parts=a,this.containsForeignElements=l,this.fauxIndentLength=c,this.tabSize=u,this.startVisibleColumn=d,this.containsRTL=h,this.spaceWidth=f,this.renderSpaceCharCode=g,this.renderWhitespace=p,this.renderControlCharacters=m}}function zDt(n){const e=n.lineContent;let t,i,r;n.stopRenderingLineAfter!==-1&&n.stopRenderingLineAfter0){for(let a=0,l=n.lineDecorations.length;a0&&(s[o++]=new Oo(i,"",0,!1));let a=i;for(let l=0,c=t.getCount();l=r){const f=e?iE(n.substring(a,r)):!1;s[o++]=new Oo(r,d,0,f);break}const h=e?iE(n.substring(a,u)):!1;s[o++]=new Oo(u,d,0,h),a=u}return s}function jDt(n,e,t){let i=0;const r=[];let s=0;if(t)for(let o=0,a=e.length;o=50&&(r[s++]=new Oo(f+1,u,d,h),g=f+1,f=-1);g!==c&&(r[s++]=new Oo(c,u,d,h))}else r[s++]=l;i=c}else for(let o=0,a=e.length;o50){const d=l.type,h=l.metadata,f=l.containsRTL,g=Math.ceil(u/50);for(let p=1;p=8234&&n<=8238||n>=8294&&n<=8297||n>=8206&&n<=8207||n===1564}function qDt(n,e){const t=[];let i=new Oo(0,"",0,!1),r=0;for(const s of e){const o=s.endIndex;for(;ri.endIndex&&(i=new Oo(r,s.type,s.metadata,s.containsRTL),t.push(i)),i=new Oo(r+1,"mtkcontrol",s.metadata,!1),t.push(i))}r>i.endIndex&&(i=new Oo(o,s.type,s.metadata,s.containsRTL),t.push(i))}return t}function KDt(n,e,t,i){const r=n.continuesWithWrappedLine,s=n.fauxIndentLength,o=n.tabSize,a=n.startVisibleColumn,l=n.useMonospaceOptimizations,c=n.selectionsOnLine,u=n.renderWhitespace===1,d=n.renderWhitespace===3,h=n.renderSpaceWidth!==n.spaceWidth,f=[];let g=0,p=0,m=i[p].type,_=i[p].containsRTL,v=i[p].endIndex;const y=i.length;let C=!1,x=yl(e),k;x===-1?(C=!0,x=t,k=t):k=pg(e);let L=!1,D=0,I=c&&c[D],O=a%o;for(let B=s;B=I.endOffset&&(D++,I=c&&c[D]);let W;if(Bk)W=!0;else if(G===9)W=!0;else if(G===32)if(u)if(L)W=!0;else{const z=B+1B),W&&d&&(W=C||B>k),W&&_&&B>=x&&B<=k&&(W=!1),L){if(!W||!l&&O>=o){if(h){const z=g>0?f[g-1].endIndex:s;for(let q=z+1;q<=B;q++)f[g++]=new Oo(q,"mtkw",1,!1)}else f[g++]=new Oo(B,"mtkw",1,!1);O=O%o}}else(B===v||W&&B>s)&&(f[g++]=new Oo(B,m,0,_),O=O%o);for(G===9?O=o:xb(G)?O+=2:O++,L=W;B===v&&(p++,p0?e.charCodeAt(t-1):0,G=t>1?e.charCodeAt(t-2):0;B===32&&G!==32&&G!==9||(M=!0)}else M=!0;if(M)if(h){const B=g>0?f[g-1].endIndex:s;for(let G=B+1;G<=t;G++)f[g++]=new Oo(G,"mtkw",1,!1)}else f[g++]=new Oo(t,"mtkw",1,!1);else f[g++]=new Oo(t,m,0,_);return f}function GDt(n,e,t,i){i.sort(Ol.compare);const r=WDt.normalize(n,i),s=r.length;let o=0;const a=[];let l=0,c=0;for(let d=0,h=t.length;dc&&(c=v.startOffset,a[l++]=new Oo(c,p,m,_)),v.endOffset+1<=g)c=v.endOffset+1,a[l++]=new Oo(c,p+" "+v.className,m|v.metadata,_),o++;else{c=g,a[l++]=new Oo(c,p+" "+v.className,m|v.metadata,_);break}}g>c&&(c=g,a[l++]=new Oo(c,p,m,_))}const u=t[t.length-1].endIndex;if(o'):e.appendString("");for(let I=0,O=c.length;I=u&&(te+=ue)}}for(q&&(e.appendString(' style="width:'),e.appendString(String(g*Z)),e.appendString('px"')),e.appendASCIICharCode(62);C1?e.appendCharCode(8594):e.appendCharCode(65515);for(let ue=2;ue<=le;ue++)e.appendCharCode(160)}else te=2,le=1,e.appendCharCode(p),e.appendCharCode(8204);k+=te,L+=le,C>=u&&(x+=le)}}else for(e.appendASCIICharCode(62);C=u&&(x+=te)}ee?D++:D=0,C>=o&&!y&&M.isPseudoAfter()&&(y=!0,v.setColumnInfo(C+1,I,k,L)),e.appendString("")}return y||v.setColumnInfo(o+1,c.length-1,k,L),a&&(e.appendString(''),e.appendString(w("showMore","Show more ({0})",XDt(l))),e.appendString("")),e.appendString(""),new EJ(v,f,r)}function ZDt(n){return n.toString(16).toUpperCase().padStart(4,"0")}function XDt(n){return n<1024?w("overflow.chars","{0} chars",n):n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/1024/1024).toFixed(1)} MB`}let nwe=class{constructor(e,t,i,r){this._viewportBrand=void 0,this.top=e|0,this.left=t|0,this.width=i|0,this.height=r|0}};class QDt{constructor(e,t){this.tabSize=e,this.data=t}}class Lce{constructor(e,t,i,r,s,o,a){this._viewLineDataBrand=void 0,this.content=e,this.continuesWithWrappedLine=t,this.minColumn=i,this.maxColumn=r,this.startVisibleColumn=s,this.tokens=o,this.inlineDecorations=a}}class sd{constructor(e,t,i,r,s,o,a,l,c,u){this.minColumn=e,this.maxColumn=t,this.content=i,this.continuesWithWrappedLine=r,this.isBasicASCII=sd.isBasicASCII(i,o),this.containsRTL=sd.containsRTL(i,this.isBasicASCII,s),this.tokens=a,this.inlineDecorations=l,this.tabSize=c,this.startVisibleColumn=u}static isBasicASCII(e,t){return t?KP(e):!0}static containsRTL(e,t,i){return!t&&i?iE(e):!1}}class AI{constructor(e,t,i){this.range=e,this.inlineClassName=t,this.type=i}}class JDt{constructor(e,t,i,r){this.startOffset=e,this.endOffset=t,this.inlineClassName=i,this.inlineClassNameAffectsLetterSpacing=r}toInlineDecoration(e){return new AI(new $(e,this.startOffset+1,e,this.endOffset+1),this.inlineClassName,this.inlineClassNameAffectsLetterSpacing?3:0)}}class J6e{constructor(e,t){this._viewModelDecorationBrand=void 0,this.range=e,this.options=t}}class HN{constructor(e,t,i){this.color=e,this.zIndex=t,this.data=i}static compareByRenderingProps(e,t){return e.zIndex===t.zIndex?e.colort.color?1:0:e.zIndex-t.zIndex}static equals(e,t){return e.color===t.color&&e.zIndex===t.zIndex&&$r(e.data,t.data)}static equalsArr(e,t){return $r(e,t,HN.equals)}}function eIt(n){return Array.isArray(n)}function tIt(n){return!eIt(n)}function e8e(n){return typeof n=="string"}function iwe(n){return!e8e(n)}function my(n){return!n}function R_(n,e){return n.ignoreCase&&e?e.toLowerCase():e}function rwe(n){return n.replace(/[&<>'"_]/g,"-")}function nIt(n,e){console.log(`${n.languageId}: ${e}`)}function Tr(n,e){return new Error(`${n.languageId}: ${e}`)}function mv(n,e,t,i,r){const s=/\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g;let o=null;return e.replace(s,function(a,l,c,u,d,h,f,g,p){return my(c)?my(u)?!my(d)&&d0;){const i=n.tokenizer[t];if(i)return i;const r=t.lastIndexOf(".");r<0?t=null:t=t.substr(0,r)}return null}function rIt(n,e){let t=e;for(;t&&t.length>0;){if(n.stateNames[t])return!0;const r=t.lastIndexOf(".");r<0?t=null:t=t.substr(0,r)}return!1}var sIt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},oIt=function(n,e){return function(t,i){e(t,i,n)}},LJ;const t8e=5;class VN{static{this._INSTANCE=new VN(t8e)}static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(e!==null&&e.depth>=this._maxCacheDepth)return new yk(e,t);let i=yk.getStackElementId(e);i.length>0&&(i+="|"),i+=t;let r=this._entries[i];return r||(r=new yk(e,t),this._entries[i]=r,r)}}class yk{constructor(e,t){this.parent=e,this.state=t,this.depth=(this.parent?this.parent.depth:0)+1}static getStackElementId(e){let t="";for(;e!==null;)t.length>0&&(t+="|"),t+=e.state,e=e.parent;return t}static _equals(e,t){for(;e!==null&&t!==null;){if(e===t)return!0;if(e.state!==t.state)return!1;e=e.parent,t=t.parent}return e===null&&t===null}equals(e){return yk._equals(this,e)}push(e){return VN.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return VN.create(this.parent,e)}}class DS{constructor(e,t){this.languageId=e,this.state=t}equals(e){return this.languageId===e.languageId&&this.state.equals(e.state)}clone(){return this.state.clone()===this.state?this:new DS(this.languageId,this.state)}}class _v{static{this._INSTANCE=new _v(t8e)}static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(t!==null)return new NI(e,t);if(e!==null&&e.depth>=this._maxCacheDepth)return new NI(e,t);const i=yk.getStackElementId(e);let r=this._entries[i];return r||(r=new NI(e,null),this._entries[i]=r,r)}}class NI{constructor(e,t){this.stack=e,this.embeddedLanguageData=t}clone(){return(this.embeddedLanguageData?this.embeddedLanguageData.clone():null)===this.embeddedLanguageData?this:_v.create(this.stack,this.embeddedLanguageData)}equals(e){return!(e instanceof NI)||!this.stack.equals(e.stack)?!1:this.embeddedLanguageData===null&&e.embeddedLanguageData===null?!0:this.embeddedLanguageData===null||e.embeddedLanguageData===null?!1:this.embeddedLanguageData.equals(e.embeddedLanguageData)}}class aIt{constructor(){this._tokens=[],this._languageId=null,this._lastTokenType=null,this._lastTokenLanguage=null}enterLanguage(e){this._languageId=e}emit(e,t){this._lastTokenType===t&&this._lastTokenLanguage===this._languageId||(this._lastTokenType=t,this._lastTokenLanguage=this._languageId,this._tokens.push(new iN(e,t,this._languageId)))}nestedLanguageTokenize(e,t,i,r){const s=i.languageId,o=i.state,a=rs.get(s);if(!a)return this.enterLanguage(s),this.emit(r,""),o;const l=a.tokenize(e,t,o);if(r!==0)for(const c of l.tokens)this._tokens.push(new iN(c.offset+r,c.type,c.language));else this._tokens=this._tokens.concat(l.tokens);return this._lastTokenType=null,this._lastTokenLanguage=null,this._languageId=null,l.endState}finalize(e){return new kae(this._tokens,e)}}class l9{constructor(e,t){this._languageService=e,this._theme=t,this._prependTokens=null,this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0}enterLanguage(e){this._currentLanguageId=this._languageService.languageIdCodec.encodeLanguageId(e)}emit(e,t){const i=this._theme.match(this._currentLanguageId,t)|1024;this._lastTokenMetadata!==i&&(this._lastTokenMetadata=i,this._tokens.push(e),this._tokens.push(i))}static _merge(e,t,i){const r=e!==null?e.length:0,s=t.length,o=i!==null?i.length:0;if(r===0&&s===0&&o===0)return new Uint32Array(0);if(r===0&&s===0)return i;if(s===0&&o===0)return e;const a=new Uint32Array(r+s+o);e!==null&&a.set(e);for(let l=0;l{if(o)return;let l=!1;for(let c=0,u=a.changedLanguages.length;c{a.affectsConfiguration("editor.maxTokenizationLineLength")&&(this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}))}))}getLoadStatus(){const e=[];for(const t in this._embeddedLanguages){const i=rs.get(t);if(i){if(i instanceof LJ){const r=i.getLoadStatus();r.loaded===!1&&e.push(r.promise)}continue}rs.isResolved(t)||e.push(rs.getOrCreate(t))}return e.length===0?{loaded:!0}:{loaded:!1,promise:Promise.all(e).then(t=>{})}}getInitialState(){const e=VN.create(null,this._lexer.start);return _v.create(e,null)}tokenize(e,t,i){if(e.length>=this._maxTokenizationLineLength)return Nle(this._languageId,i);const r=new aIt,s=this._tokenize(e,t,i,r);return r.finalize(s)}tokenizeEncoded(e,t,i){if(e.length>=this._maxTokenizationLineLength)return bW(this._languageService.languageIdCodec.encodeLanguageId(this._languageId),i);const r=new l9(this._languageService,this._standaloneThemeService.getColorTheme().tokenTheme),s=this._tokenize(e,t,i,r);return r.finalize(s)}_tokenize(e,t,i,r){return i.embeddedLanguageData?this._nestedTokenize(e,t,i,0,r):this._myTokenize(e,t,i,0,r)}_findLeavingNestedLanguageOffset(e,t){let i=this._lexer.tokenizer[t.stack.state];if(!i&&(i=X4(this._lexer,t.stack.state),!i))throw Tr(this._lexer,"tokenizer state is not defined: "+t.stack.state);let r=-1,s=!1;for(const o of i){if(!iwe(o.action)||o.action.nextEmbedded!=="@pop")continue;s=!0;let a=o.resolveRegex(t.stack.state);const l=a.source;if(l.substr(0,4)==="^(?:"&&l.substr(l.length-1,1)===")"){const u=(a.ignoreCase?"i":"")+(a.unicode?"u":"");a=new RegExp(l.substr(4,l.length-5),u)}const c=e.search(a);c===-1||c!==0&&o.matchOnlyAtLineStart||(r===-1||c0&&s.nestedLanguageTokenize(a,!1,i.embeddedLanguageData,r);const l=e.substring(o);return this._myTokenize(l,t,i,r+o,s)}_safeRuleName(e){return e?e.name:"(unknown)"}_myTokenize(e,t,i,r,s){s.enterLanguage(this._languageId);const o=e.length,a=t&&this._lexer.includeLF?e+` -`:e,l=a.length;let c=i.embeddedLanguageData,u=i.stack,d=0,h=null,f=!0;for(;f||d=l)break;f=!1;let I=this._lexer.tokenizer[_];if(!I&&(I=X4(this._lexer,_),!I))throw Tr(this._lexer,"tokenizer state is not defined: "+_);const O=a.substr(d);for(const M of I)if((d===0||!M.matchOnlyAtLineStart)&&(v=O.match(M.resolveRegex(_)),v)){y=v[0],C=M.action;break}}if(v||(v=[""],y=""),C||(d=this._lexer.maxStack)throw Tr(this._lexer,"maximum tokenizer stack size reached: ["+u.state+","+u.parent.state+",...]");u=u.push(_)}else if(C.next==="@pop"){if(u.depth<=1)throw Tr(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(x));u=u.pop()}else if(C.next==="@popall")u=u.popall();else{let I=mv(this._lexer,C.next,y,v,_);if(I[0]==="@"&&(I=I.substr(1)),X4(this._lexer,I))u=u.push(I);else throw Tr(this._lexer,"trying to set a next state '"+I+"' that is undefined in rule: "+this._safeRuleName(x))}}C.log&&typeof C.log=="string"&&nIt(this._lexer,this._lexer.languageId+": "+mv(this._lexer,C.log,y,v,_))}if(L===null)throw Tr(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(x));const D=I=>{const O=this._languageService.getLanguageIdByLanguageName(I)||this._languageService.getLanguageIdByMimeType(I)||I,M=this._getNestedEmbeddedLanguageData(O);if(d0)throw Tr(this._lexer,"groups cannot be nested: "+this._safeRuleName(x));if(v.length!==L.length+1)throw Tr(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(x));let I=0;for(let O=1;On});class Tce{static colorizeElement(e,t,i,r){r=r||{};const s=r.theme||"vs",o=r.mimeType||i.getAttribute("lang")||i.getAttribute("data-lang");if(!o)return console.error("Mode not detected"),Promise.resolve();const a=t.getLanguageIdByMimeType(o)||o;e.setTheme(s);const l=i.firstChild?i.firstChild.nodeValue:"";i.className+=" "+s;const c=u=>{const d=cIt?.createHTML(u)??u;i.innerHTML=d};return this.colorize(t,l||"",a,r).then(c,u=>console.error(u))}static async colorize(e,t,i,r){const s=e.languageIdCodec;let o=4;r&&typeof r.tabSize=="number"&&(o=r.tabSize),Nae(t)&&(t=t.substr(1));const a=om(t);if(!e.isRegisteredLanguageId(i))return swe(a,o,s);const l=await rs.getOrCreate(i);return l?uIt(a,o,l,s):swe(a,o,s)}static colorizeLine(e,t,i,r,s=4){const o=sd.isBasicASCII(e,t),a=sd.containsRTL(e,o,i);return WW(new n1(!1,!0,e,!1,o,a,0,r,[],s,0,0,0,0,-1,"none",!1,!1,null)).html}static colorizeModelLine(e,t,i=4){const r=e.getLineContent(t);e.tokenization.forceTokenization(t);const o=e.tokenization.getLineTokens(t).inflate();return this.colorizeLine(r,e.mightContainNonBasicASCII(),e.mightContainRTL(),o,i)}}function uIt(n,e,t,i){return new Promise((r,s)=>{const o=()=>{const a=dIt(n,e,t,i);if(t instanceof zN){const l=t.getLoadStatus();if(l.loaded===!1){l.promise.then(o,s);return}}r(a)};o()})}function swe(n,e,t){let i=[];const s=new Uint32Array(2);s[0]=0,s[1]=33587200;for(let o=0,a=n.length;o")}return i.join("")}function dIt(n,e,t,i){let r=[],s=t.getInitialState();for(let o=0,a=n.length;o"),s=c.endState}return r.join("")}var hIt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},fIt=function(n,e){return function(t,i){e(t,i,n)}};let c9=class{static{this.ID="editor.contrib.markerDecorations"}constructor(e,t){}dispose(){}};c9=hIt([fIt(1,Ule)],c9);Zn(c9.ID,c9,0);class n8e extends me{constructor(e,t){super(),this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._referenceDomElement=e,this._width=-1,this._height=-1,this._resizeObserver=null,this.measureReferenceDomElement(!1,t)}dispose(){this.stopObserving(),super.dispose()}getWidth(){return this._width}getHeight(){return this._height}startObserving(){if(!this._resizeObserver&&this._referenceDomElement){let e=null;const t=()=>{e?this.observe({width:e.width,height:e.height}):this.observe()};let i=!1,r=!1;const s=()=>{if(i&&!r)try{i=!1,r=!0,t()}finally{du(Ot(this._referenceDomElement),()=>{r=!1,s()})}};this._resizeObserver=new ResizeObserver(o=>{o&&o[0]&&o[0].contentRect?e={width:o[0].contentRect.width,height:o[0].contentRect.height}:e=null,i=!0,s()}),this._resizeObserver.observe(this._referenceDomElement)}}stopObserving(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}observe(e){this.measureReferenceDomElement(!0,e)}measureReferenceDomElement(e,t){let i=0,r=0;t?(i=t.width,r=t.height):this._referenceDomElement&&(i=this._referenceDomElement.clientWidth,r=this._referenceDomElement.clientHeight),i=Math.max(5,i),r=Math.max(5,r),(this._width!==i||this._height!==r)&&(this._width=i,this._height=r,e&&this._onDidChange.fire())}}class nw{static{this.items=[]}constructor(e,t){this.key=e,this.migrate=t}apply(e){const t=nw._read(e,this.key),i=s=>nw._read(e,s),r=(s,o)=>nw._write(e,s,o);this.migrate(t,i,r)}static _read(e,t){if(typeof e>"u")return;const i=t.indexOf(".");if(i>=0){const r=t.substring(0,i);return this._read(e[r],t.substring(i+1))}return e[t]}static _write(e,t,i){const r=t.indexOf(".");if(r>=0){const s=t.substring(0,r);e[s]=e[s]||{},this._write(e[s],t.substring(r+1),i);return}e[t]=i}}function $g(n,e){nw.items.push(new nw(n,e))}function vu(n,e){$g(n,(t,i,r)=>{if(typeof t<"u"){for(const[s,o]of e)if(t===s){r(n,o);return}}})}function gIt(n){nw.items.forEach(e=>e.apply(n))}vu("wordWrap",[[!0,"on"],[!1,"off"]]);vu("lineNumbers",[[!0,"on"],[!1,"off"]]);vu("cursorBlinking",[["visible","solid"]]);vu("renderWhitespace",[[!0,"boundary"],[!1,"none"]]);vu("renderLineHighlight",[[!0,"line"],[!1,"none"]]);vu("acceptSuggestionOnEnter",[[!0,"on"],[!1,"off"]]);vu("tabCompletion",[[!1,"off"],[!0,"onlySnippets"]]);vu("hover",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);vu("parameterHints",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);vu("autoIndent",[[!1,"advanced"],[!0,"full"]]);vu("matchBrackets",[[!0,"always"],[!1,"never"]]);vu("renderFinalNewline",[[!0,"on"],[!1,"off"]]);vu("cursorSmoothCaretAnimation",[[!0,"on"],[!1,"off"]]);vu("occurrencesHighlight",[[!0,"singleFile"],[!1,"off"]]);vu("wordBasedSuggestions",[[!0,"matchingDocuments"],[!1,"off"]]);$g("autoClosingBrackets",(n,e,t)=>{n===!1&&(t("autoClosingBrackets","never"),typeof e("autoClosingQuotes")>"u"&&t("autoClosingQuotes","never"),typeof e("autoSurround")>"u"&&t("autoSurround","never"))});$g("renderIndentGuides",(n,e,t)=>{typeof n<"u"&&(t("renderIndentGuides",void 0),typeof e("guides.indentation")>"u"&&t("guides.indentation",!!n))});$g("highlightActiveIndentGuide",(n,e,t)=>{typeof n<"u"&&(t("highlightActiveIndentGuide",void 0),typeof e("guides.highlightActiveIndentation")>"u"&&t("guides.highlightActiveIndentation",!!n))});const pIt={method:"showMethods",function:"showFunctions",constructor:"showConstructors",deprecated:"showDeprecated",field:"showFields",variable:"showVariables",class:"showClasses",struct:"showStructs",interface:"showInterfaces",module:"showModules",property:"showProperties",event:"showEvents",operator:"showOperators",unit:"showUnits",value:"showValues",constant:"showConstants",enum:"showEnums",enumMember:"showEnumMembers",keyword:"showKeywords",text:"showWords",color:"showColors",file:"showFiles",reference:"showReferences",folder:"showFolders",typeParameter:"showTypeParameters",snippet:"showSnippets"};$g("suggest.filteredTypes",(n,e,t)=>{if(n&&typeof n=="object"){for(const i of Object.entries(pIt))n[i[0]]===!1&&typeof e(`suggest.${i[1]}`)>"u"&&t(`suggest.${i[1]}`,!1);t("suggest.filteredTypes",void 0)}});$g("quickSuggestions",(n,e,t)=>{if(typeof n=="boolean"){const i=n?"on":"off";t("quickSuggestions",{comments:i,strings:i,other:i})}});$g("experimental.stickyScroll.enabled",(n,e,t)=>{typeof n=="boolean"&&(t("experimental.stickyScroll.enabled",void 0),typeof e("stickyScroll.enabled")>"u"&&t("stickyScroll.enabled",n))});$g("experimental.stickyScroll.maxLineCount",(n,e,t)=>{typeof n=="number"&&(t("experimental.stickyScroll.maxLineCount",void 0),typeof e("stickyScroll.maxLineCount")>"u"&&t("stickyScroll.maxLineCount",n))});$g("codeActionsOnSave",(n,e,t)=>{if(n&&typeof n=="object"){let i=!1;const r={};for(const s of Object.entries(n))typeof s[1]=="boolean"?(i=!0,r[s[0]]=s[1]?"explicit":"never"):r[s[0]]=s[1];i&&t("codeActionsOnSave",r)}});$g("codeActionWidget.includeNearbyQuickfixes",(n,e,t)=>{typeof n=="boolean"&&(t("codeActionWidget.includeNearbyQuickfixes",void 0),typeof e("codeActionWidget.includeNearbyQuickFixes")>"u"&&t("codeActionWidget.includeNearbyQuickFixes",n))});$g("lightbulb.enabled",(n,e,t)=>{typeof n=="boolean"&&t("lightbulb.enabled",n?void 0:"off")});class mIt{constructor(){this._tabFocus=!1,this._onDidChangeTabFocus=new fe,this.onDidChangeTabFocus=this._onDidChangeTabFocus.event}getTabFocusMode(){return this._tabFocus}setTabFocusMode(e){this._tabFocus=e,this._onDidChangeTabFocus.fire(this._tabFocus)}}const xE=new mIt;var _It=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},vIt=function(n,e){return function(t,i){e(t,i,n)}};let TJ=class extends me{constructor(e,t,i,r,s){super(),this._accessibilityService=s,this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._onDidChangeFast=this._register(new fe),this.onDidChangeFast=this._onDidChangeFast.event,this._isDominatedByLongLines=!1,this._viewLineCount=1,this._lineNumbersDigitCount=1,this._reservedHeight=0,this._glyphMarginDecorationLaneCount=1,this._computeOptionsMemory=new w4e,this.isSimpleWidget=e,this.contextMenuId=t,this._containerObserver=this._register(new n8e(r,i.dimension)),this._targetWindowId=Ot(r).vscodeWindowId,this._rawOptions=owe(i),this._validatedOptions=vv.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(13)&&this._containerObserver.startObserving(),this._register(Pd.onDidChangeZoomLevel(()=>this._recomputeOptions())),this._register(xE.onDidChangeTabFocus(()=>this._recomputeOptions())),this._register(this._containerObserver.onDidChange(()=>this._recomputeOptions())),this._register(yX.onDidChange(()=>this._recomputeOptions())),this._register(cN.getInstance(Ot(r)).onDidChange(()=>this._recomputeOptions())),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>this._recomputeOptions()))}_recomputeOptions(){const e=this._computeOptions(),t=vv.checkEquals(this.options,e);t!==null&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){const e=this._readEnvConfiguration(),t=Gy.createFromValidatedSettings(this._validatedOptions,e.pixelRatio,this.isSimpleWidget),i=this._readFontInfo(t),r={memory:this._computeOptionsMemory,outerWidth:e.outerWidth,outerHeight:e.outerHeight-this._reservedHeight,fontInfo:i,extraEditorClassName:e.extraEditorClassName,isDominatedByLongLines:this._isDominatedByLongLines,viewLineCount:this._viewLineCount,lineNumbersDigitCount:this._lineNumbersDigitCount,emptySelectionClipboard:e.emptySelectionClipboard,pixelRatio:e.pixelRatio,tabFocusMode:xE.getTabFocusMode(),accessibilitySupport:e.accessibilitySupport,glyphMarginDecorationLaneCount:this._glyphMarginDecorationLaneCount};return vv.computeOptions(this._validatedOptions,r)}_readEnvConfiguration(){return{extraEditorClassName:yIt(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:Ky||Xd,pixelRatio:cN.getInstance(Qve(this._targetWindowId,!0).window).value,accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return yX.readFontInfo(Qve(this._targetWindowId,!0).window,e)}getRawOptions(){return this._rawOptions}updateOptions(e){const t=owe(e);vv.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=vv.validateOptions(this._rawOptions),this._recomputeOptions())}observeContainer(e){this._containerObserver.observe(e)}setIsDominatedByLongLines(e){this._isDominatedByLongLines!==e&&(this._isDominatedByLongLines=e,this._recomputeOptions())}setModelLineCount(e){const t=bIt(e);this._lineNumbersDigitCount!==t&&(this._lineNumbersDigitCount=t,this._recomputeOptions())}setViewLineCount(e){this._viewLineCount!==e&&(this._viewLineCount=e,this._recomputeOptions())}setReservedHeight(e){this._reservedHeight!==e&&(this._reservedHeight=e,this._recomputeOptions())}setGlyphMarginDecorationLaneCount(e){this._glyphMarginDecorationLaneCount!==e&&(this._glyphMarginDecorationLaneCount=e,this._recomputeOptions())}};TJ=_It([vIt(4,_u)],TJ);function bIt(n){let e=0;for(;n;)n=Math.floor(n/10),e++;return e||1}function yIt(){let n="";return!K_&&!G4e&&(n+="no-user-select "),K_&&(n+="no-minimap-shadow ",n+="enable-user-select "),Rn&&(n+="mac "),n}class wIt{constructor(){this._values=[]}_read(e){return this._values[e]}get(e){return this._values[e]}_write(e,t){this._values[e]=t}}class CIt{constructor(){this._values=[]}_read(e){if(e>=this._values.length)throw new Error("Cannot read uninitialized value");return this._values[e]}get(e){return this._read(e)}_write(e,t){this._values[e]=t}}class vv{static validateOptions(e){const t=new wIt;for(const i of vS){const r=i.name==="_never_"?void 0:e[i.name];t._write(i.id,i.validate(r))}return t}static computeOptions(e,t){const i=new CIt;for(const r of vS)i._write(r.id,r.compute(t,i,e._read(r.id)));return i}static _deepEquals(e,t){if(typeof e!="object"||typeof t!="object"||!e||!t)return e===t;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)?$r(e,t):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!vv._deepEquals(e[i],t[i]))return!1;return!0}static checkEquals(e,t){const i=[];let r=!1;for(const s of vS){const o=!vv._deepEquals(e._read(s.id),t._read(s.id));i[s.id]=o,o&&(r=!0)}return r?new y4e(i):null}static applyUpdate(e,t){let i=!1;for(const r of vS)if(t.hasOwnProperty(r.name)){const s=r.applyUpdate(e[r.name],t[r.name]);e[r.name]=s.newValue,i=i||s.didChange}return i}}function owe(n){const e=Qm(n);return gIt(e),e}var Mv;(function(n){const e={total:0,min:Number.MAX_VALUE,max:0},t={...e},i={...e},r={...e};let s=0;const o={keydown:0,input:0,render:0};function a(){_(),performance.mark("inputlatency/start"),performance.mark("keydown/start"),o.keydown=1,queueMicrotask(l)}n.onKeyDown=a;function l(){o.keydown===1&&(performance.mark("keydown/end"),o.keydown=2)}function c(){performance.mark("input/start"),o.input=1,m()}n.onBeforeInput=c;function u(){o.input===0&&c(),queueMicrotask(d)}n.onInput=u;function d(){o.input===1&&(performance.mark("input/end"),o.input=2)}function h(){_()}n.onKeyUp=h;function f(){_()}n.onSelectionChange=f;function g(){o.keydown===2&&o.input===2&&o.render===0&&(performance.mark("render/start"),o.render=1,queueMicrotask(p),m())}n.onRenderStart=g;function p(){o.render===1&&(performance.mark("render/end"),o.render=2)}function m(){setTimeout(_)}function _(){o.keydown===2&&o.input===2&&o.render===2&&(performance.mark("inputlatency/end"),performance.measure("keydown","keydown/start","keydown/end"),performance.measure("input","input/start","input/end"),performance.measure("render","render/start","render/end"),performance.measure("inputlatency","inputlatency/start","inputlatency/end"),v("keydown",e),v("input",t),v("render",i),v("inputlatency",r),s++,y())}function v(L,D){const I=performance.getEntriesByName(L)[0].duration;D.total+=I,D.min=Math.min(D.min,I),D.max=Math.max(D.max,I)}function y(){performance.clearMarks("keydown/start"),performance.clearMarks("keydown/end"),performance.clearMarks("input/start"),performance.clearMarks("input/end"),performance.clearMarks("render/start"),performance.clearMarks("render/end"),performance.clearMarks("inputlatency/start"),performance.clearMarks("inputlatency/end"),performance.clearMeasures("keydown"),performance.clearMeasures("input"),performance.clearMeasures("render"),performance.clearMeasures("inputlatency"),o.keydown=0,o.input=0,o.render=0}function C(){if(s===0)return;const L={keydown:x(e),input:x(t),render:x(i),total:x(r),sampleCount:s};return k(e),k(t),k(i),k(r),s=0,L}n.getAndClearMeasurements=C;function x(L){return{average:L.total/s,max:L.max,min:L.min}}function k(L){L.total=0,L.min=Number.MAX_VALUE,L.max=0}})(Mv||(Mv={}));class HW{constructor(e,t){this.x=e,this.y=t,this._pageCoordinatesBrand=void 0}toClientCoordinates(e){return new i8e(this.x-e.scrollX,this.y-e.scrollY)}}class i8e{constructor(e,t){this.clientX=e,this.clientY=t,this._clientCoordinatesBrand=void 0}toPageCoordinates(e){return new HW(this.clientX+e.scrollX,this.clientY+e.scrollY)}}class xIt{constructor(e,t,i,r){this.x=e,this.y=t,this.width=i,this.height=r,this._editorPagePositionBrand=void 0}}class SIt{constructor(e,t){this.x=e,this.y=t,this._positionRelativeToEditorBrand=void 0}}function Dce(n){const e=ms(n);return new xIt(e.left,e.top,e.width,e.height)}function Ice(n,e,t){const i=e.width/n.offsetWidth,r=e.height/n.offsetHeight,s=(t.x-e.x)/i,o=(t.y-e.y)/r;return new SIt(s,o)}class Nb extends qh{constructor(e,t,i){super(Ot(i),e),this._editorMouseEventBrand=void 0,this.isFromPointerCapture=t,this.pos=new HW(this.posx,this.posy),this.editorPos=Dce(i),this.relativePos=Ice(i,this.editorPos,this.pos)}}class kIt{constructor(e){this._editorViewDomNode=e}_create(e){return new Nb(e,!1,this._editorViewDomNode)}onContextMenu(e,t){return Ce(e,"contextmenu",i=>{t(this._create(i))})}onMouseUp(e,t){return Ce(e,"mouseup",i=>{t(this._create(i))})}onMouseDown(e,t){return Ce(e,je.MOUSE_DOWN,i=>{t(this._create(i))})}onPointerDown(e,t){return Ce(e,je.POINTER_DOWN,i=>{t(this._create(i),i.pointerId)})}onMouseLeave(e,t){return Ce(e,je.MOUSE_LEAVE,i=>{t(this._create(i))})}onMouseMove(e,t){return Ce(e,"mousemove",i=>t(this._create(i)))}}class EIt{constructor(e){this._editorViewDomNode=e}_create(e){return new Nb(e,!1,this._editorViewDomNode)}onPointerUp(e,t){return Ce(e,"pointerup",i=>{t(this._create(i))})}onPointerDown(e,t){return Ce(e,je.POINTER_DOWN,i=>{t(this._create(i),i.pointerId)})}onPointerLeave(e,t){return Ce(e,je.POINTER_LEAVE,i=>{t(this._create(i))})}onPointerMove(e,t){return Ce(e,"pointermove",i=>t(this._create(i)))}}class LIt extends me{constructor(e){super(),this._editorViewDomNode=e,this._globalPointerMoveMonitor=this._register(new e2),this._keydownListener=null}startMonitoring(e,t,i,r,s){this._keydownListener=Jr(e.ownerDocument,"keydown",o=>{o.toKeyCodeChord().isModifierKey()||this._globalPointerMoveMonitor.stopMonitoring(!0,o.browserEvent)},!0),this._globalPointerMoveMonitor.startMonitoring(e,t,i,o=>{r(new Nb(o,!0,this._editorViewDomNode))},o=>{this._keydownListener.dispose(),s(o)})}stopMonitoring(){this._globalPointerMoveMonitor.stopMonitoring(!0)}}class VW{static{this._idPool=0}constructor(e){this._editor=e,this._instanceId=++VW._idPool,this._counter=0,this._rules=new Map,this._garbageCollectionScheduler=new Ui(()=>this.garbageCollect(),1e3)}createClassNameRef(e){const t=this.getOrCreateRule(e);return t.increaseRefCount(),{className:t.className,dispose:()=>{t.decreaseRefCount(),this._garbageCollectionScheduler.schedule()}}}getOrCreateRule(e){const t=this.computeUniqueKey(e);let i=this._rules.get(t);if(!i){const r=this._counter++;i=new TIt(t,`dyn-rule-${this._instanceId}-${r}`,G6(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,e),this._rules.set(t,i)}return i}computeUniqueKey(e){return JSON.stringify(e)}garbageCollect(){for(const e of this._rules.values())e.hasReferences()||(this._rules.delete(e.key),e.dispose())}}class TIt{constructor(e,t,i,r){this.key=e,this.className=t,this.properties=r,this._referenceCount=0,this._styleElementDisposables=new ke,this._styleElement=id(i,void 0,this._styleElementDisposables),this._styleElement.textContent=this.getCssText(this.className,this.properties)}getCssText(e,t){let i=`.${e} {`;for(const r in t){const s=t[r];let o;typeof s=="object"?o=it(s.id):o=s;const a=DIt(r);i+=` +`}};bJ=hm([Bs(0,En)],bJ);class ADt{publicLog2(){}}class o9{static{this.SCHEME="inmemory"}constructor(){const e=Pt.from({scheme:o9.SCHEME,authority:"model",path:"/"});this.workspace={id:nFe,folders:[new cSt({uri:e,name:"",index:0})]}}getWorkspace(){return this.workspace}getWorkspaceFolder(e){return e&&e.scheme===o9.SCHEME?this.workspace.folders[0]:null}}function a9(n,e,t){if(!e||!(n instanceof s9))return;const i=[];Object.keys(e).forEach(r=>{$xt(r)&&i.push([`editor.${r}`,e[r]]),t&&Wxt(r)&&i.push([`diffEditor.${r}`,e[r]])}),i.length>0&&n.updateValues(i)}let yJ=class{constructor(e){this._modelService=e}hasPreviewHandler(){return!1}async apply(e,t){const i=Array.isArray(e)?e:Ple.convert(e),r=new Map;for(const a of i){if(!(a instanceof ab))throw new Error("bad edit - only text edits are supported");const l=this._modelService.getModel(a.resource);if(!l)throw new Error("bad edit - model not found");if(typeof a.versionId=="number"&&l.getVersionId()!==a.versionId)throw new Error("bad state - model changed in the meantime");let c=r.get(l);c||(c=[],r.set(l,c)),c.push(jr.replaceMove($.lift(a.textEdit.range),a.textEdit.text))}let s=0,o=0;for(const[a,l]of r)a.pushStackElement(),a.pushEditOperations([],l,()=>[]),a.pushStackElement(),o+=1,s+=l.length;return{ariaSummary:Lw(vQ.bulkEditServiceSummary,s,o),isApplied:s>0}}};yJ=hm([Bs(0,Sr)],yJ);class NDt{getUriLabel(e,t){return e.scheme==="file"?e.fsPath:e.path}getUriBasenameLabel(e){return th(e)}}let wJ=class extends Pxt{constructor(e,t){super(e),this._codeEditorService=t}showContextView(e,t,i){if(!t){const r=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();r&&(t=r.getContainerDomNode())}return super.showContextView(e,t,i)}};wJ=hm([Bs(0,Zb),Bs(1,ai)],wJ);class RDt{constructor(){this._neverEmitter=new fe,this.onDidChangeTrust=this._neverEmitter.event}isWorkspaceTrusted(){return!0}}class PDt extends L8{constructor(){super()}}class ODt extends xDt{constructor(){super(new uvt)}}let CJ=class extends IQ{constructor(e,t,i,r,s,o){super(e,t,i,r,s,o),this.configure({blockMouse:!1})}};CJ=hm([Bs(0,Qa),Bs(1,Ts),Bs(2,m0),Bs(3,xi),Bs(4,ld),Bs(5,jt)],CJ);const xJ={amdModuleId:"vs/editor/common/services/editorSimpleWorker",esmModuleLocation:void 0,label:"editorWorkerService"};let SJ=class extends RX{constructor(e,t,i,r,s){super(xJ,e,t,i,r,s)}};SJ=hm([Bs(0,Sr),Bs(1,nW),Bs(2,Da),Bs(3,Zr),Bs(4,dt)],SJ);class MDt{async playSignal(e,t){}}Vn(Da,ODt,0);Vn(En,s9,0);Vn(nW,vJ,0);Vn(Q3e,bJ,0);Vn(Mw,o9,0);Vn(pE,NDt,0);Vn(Qa,ADt,0);Vn(JP,DDt,0);Vn(ole,TDt,0);Vn(Ts,r9,0);Vn(dm,sv,0);Vn(Hr,PDt,0);Vn(hd,iDt,0);Vn(Sr,UQ,0);Vn(Ule,OQ,0);Vn(jt,pJ,0);Vn(tFe,LDt,0);Vn(Qb,Ece,0);Vn(pf,Ckt,0);Vn(Oc,SJ,0);Vn(rO,yJ,0);Vn(iFe,RDt,0);Vn(Nc,mJ,0);Vn(_u,cJ,0);Vn(fh,mTt,0);Vn(_r,_J,0);Vn(xi,CE,0);Vn(hh,aJ,0);Vn(m0,wJ,0);Vn(Pc,PQ,0);Vn(b0,gJ,0);Vn(mu,CJ,0);Vn(ld,uJ,0);Vn(t1,MDt,0);Vn(t6e,kDt,0);var Yt;(function(n){const e=new c2;for(const[l,c]of fbe())e.set(l,c);const t=new i9(e,!0);e.set(Tt,t);function i(l){r||o({});const c=e.get(l);if(!c)throw new Error("Missing service "+l);return c instanceof gp?t.invokeFunction(u=>u.get(l)):c}n.get=i;let r=!1;const s=new fe;function o(l){if(r)return t;r=!0;for(const[u,d]of fbe())e.get(u)||e.set(u,d);for(const u in l)if(l.hasOwnProperty(u)){const d=On(u);e.get(d)instanceof gp&&e.set(d,l[u])}const c=SDt();for(const u of c)try{t.createInstance(u)}catch(d){rn(d)}return s.fire(),t}n.initialize=o;function a(l){if(r)return l();const c=new ke,u=c.add(s.event(()=>{u.dispose(),c.add(l())}));return c}n.withServices=a})(Yt||(Yt={}));function FDt(n,e){return new BDt(n,e)}class BDt extends o8{constructor(e,t){const i={amdModuleId:xJ.amdModuleId,esmModuleLocation:xJ.esmModuleLocation,label:t.label};super(i,t.keepIdleModels||!1,e),this._foreignModuleId=t.moduleId,this._foreignModuleCreateData=t.createData||null,this._foreignModuleHost=t.host||null,this._foreignProxy=null}fhr(e,t){if(!this._foreignModuleHost||typeof this._foreignModuleHost[e]!="function")return Promise.reject(new Error("Missing method "+e+" or missing main thread foreign host."));try{return Promise.resolve(this._foreignModuleHost[e].apply(this._foreignModuleHost,t))}catch(i){return Promise.reject(i)}}_getForeignProxy(){return this._foreignProxy||(this._foreignProxy=this._getProxy().then(e=>{const t=this._foreignModuleHost?aZ(this._foreignModuleHost):[];return e.$loadForeignModule(this._foreignModuleId,this._foreignModuleCreateData,t).then(i=>{this._foreignModuleCreateData=null;const r=(a,l)=>e.$fmr(a,l),s=(a,l)=>function(){const c=Array.prototype.slice.call(arguments,0);return l(a,c)},o={};for(const a of i)o[a]=s(a,r);return o})})),this._foreignProxy}getProxy(){return this._getForeignProxy()}withSyncedResources(e){return this.workerWithSyncedResources(e).then(t=>this.getProxy())}}const pO={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"};class Ol{constructor(e,t,i,r){this.startColumn=e,this.endColumn=t,this.className=i,this.type=r,this._lineDecorationBrand=void 0}static _equals(e,t){return e.startColumn===t.startColumn&&e.endColumn===t.endColumn&&e.className===t.className&&e.type===t.type}static equalsArr(e,t){const i=e.length,r=t.length;if(i!==r)return!1;for(let s=0;s=s||(a[l++]=new Ol(Math.max(1,c.startColumn-r+1),Math.min(o+1,c.endColumn-r+1),c.className,c.type));return a}static filter(e,t,i,r){if(e.length===0)return[];const s=[];let o=0;for(let a=0,l=e.length;at||u.isEmpty()&&(c.type===0||c.type===3))continue;const d=u.startLineNumber===t?u.startColumn:i,h=u.endLineNumber===t?u.endColumn:r;s[o++]=new Ol(d,h,c.inlineClassName,c.type)}return s}static _typeCompare(e,t){const i=[2,0,1,3];return i[e]-i[t]}static compare(e,t){if(e.startColumn!==t.startColumn)return e.startColumn-t.startColumn;if(e.endColumn!==t.endColumn)return e.endColumn-t.endColumn;const i=Ol._typeCompare(e.type,t.type);return i!==0?i:e.className!==t.className?e.className0&&this.stopOffsets[0]0&&t=e){this.stopOffsets.splice(r,0,e),this.classNames.splice(r,0,t),this.metadata.splice(r,0,i);break}this.count++}};class WDt{static normalize(e,t){if(t.length===0)return[];const i=[],r=new $Dt;let s=0;for(let o=0,a=t.length;o1){const p=e.charCodeAt(c-2);Co(p)&&c--}if(u>1){const p=e.charCodeAt(u-2);Co(p)&&u--}const f=c-1,g=u-2;s=r.consumeLowerThan(f,s,i),r.count===0&&(s=f),r.insert(g,d,h)}return r.consumeLowerThan(1073741824,s,i),i}}class Oo{constructor(e,t,i,r){this.endIndex=e,this.type=t,this.metadata=i,this.containsRTL=r,this._linePartBrand=void 0}isWhitespace(){return!!(this.metadata&1)}isPseudoAfter(){return!!(this.metadata&4)}}class Z6e{constructor(e,t){this.startOffset=e,this.endOffset=t}equals(e){return this.startOffset===e.startOffset&&this.endOffset===e.endOffset}}class n1{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f,g,p,m,_,v,y){this.useMonospaceOptimizations=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.continuesWithWrappedLine=r,this.isBasicASCII=s,this.containsRTL=o,this.fauxIndentLength=a,this.lineTokens=l,this.lineDecorations=c.sort(Ol.compare),this.tabSize=u,this.startVisibleColumn=d,this.spaceWidth=h,this.stopRenderingLineAfter=p,this.renderWhitespace=m==="all"?4:m==="boundary"?1:m==="selection"?2:m==="trailing"?3:0,this.renderControlCharacters=_,this.fontLigatures=v,this.selectionsOnLine=y&&y.sort((k,L)=>k.startOffset>>16}static getCharIndex(e){return(e&65535)>>>0}constructor(e,t){this.length=e,this._data=new Uint32Array(this.length),this._horizontalOffset=new Uint32Array(this.length)}setColumnInfo(e,t,i,r){const s=(t<<16|i<<0)>>>0;this._data[e-1]=s,this._horizontalOffset[e-1]=r}getHorizontalOffset(e){return this._horizontalOffset.length===0?0:this._horizontalOffset[e-1]}charOffsetToPartData(e){return this.length===0?0:e<0?this._data[0]:e>=this.length?this._data[this.length-1]:this._data[e]}getDomPosition(e){const t=this.charOffsetToPartData(e-1),i=pp.getPartIndex(t),r=pp.getCharIndex(t);return new X6e(i,r)}getColumn(e,t){return this.partDataToCharOffset(e.partIndex,t,e.charIndex)+1}partDataToCharOffset(e,t,i){if(this.length===0)return 0;const r=(e<<16|i<<0)>>>0;let s=0,o=this.length-1;for(;s+1>>1,m=this._data[p];if(m===r)return p;m>r?o=p:s=p}if(s===o)return s;const a=this._data[s],l=this._data[o];if(a===r)return s;if(l===r)return o;const c=pp.getPartIndex(a),u=pp.getCharIndex(a),d=pp.getPartIndex(l);let h;c!==d?h=t:h=pp.getCharIndex(l);const f=i-u,g=h-i;return f<=g?s:o}}class EJ{constructor(e,t,i){this._renderLineOutputBrand=void 0,this.characterMapping=e,this.containsRTL=t,this.containsForeignElements=i}}function mO(n,e){if(n.lineContent.length===0){if(n.lineDecorations.length>0){e.appendString("");let t=0,i=0,r=0;for(const o of n.lineDecorations)(o.type===1||o.type===2)&&(e.appendString(''),o.type===1&&(r|=1,t++),o.type===2&&(r|=2,i++));e.appendString("");const s=new pp(1,t+i);return s.setColumnInfo(1,t,0,0),new EJ(s,!1,r)}return e.appendString(""),new EJ(new pp(0,0),!1,0)}return YDt(zDt(n),e)}class HDt{constructor(e,t,i,r){this.characterMapping=e,this.html=t,this.containsRTL=i,this.containsForeignElements=r}}function WW(n){const e=new XL(1e4),t=mO(n,e);return new HDt(t.characterMapping,e.build(),t.containsRTL,t.containsForeignElements)}class VDt{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f,g,p,m){this.fontIsMonospace=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.len=r,this.isOverflowing=s,this.overflowingCharCount=o,this.parts=a,this.containsForeignElements=l,this.fauxIndentLength=c,this.tabSize=u,this.startVisibleColumn=d,this.containsRTL=h,this.spaceWidth=f,this.renderSpaceCharCode=g,this.renderWhitespace=p,this.renderControlCharacters=m}}function zDt(n){const e=n.lineContent;let t,i,r;n.stopRenderingLineAfter!==-1&&n.stopRenderingLineAfter0){for(let a=0,l=n.lineDecorations.length;a0&&(s[o++]=new Oo(i,"",0,!1));let a=i;for(let l=0,c=t.getCount();l=r){const f=e?iE(n.substring(a,r)):!1;s[o++]=new Oo(r,d,0,f);break}const h=e?iE(n.substring(a,u)):!1;s[o++]=new Oo(u,d,0,h),a=u}return s}function jDt(n,e,t){let i=0;const r=[];let s=0;if(t)for(let o=0,a=e.length;o=50&&(r[s++]=new Oo(f+1,u,d,h),g=f+1,f=-1);g!==c&&(r[s++]=new Oo(c,u,d,h))}else r[s++]=l;i=c}else for(let o=0,a=e.length;o50){const d=l.type,h=l.metadata,f=l.containsRTL,g=Math.ceil(u/50);for(let p=1;p=8234&&n<=8238||n>=8294&&n<=8297||n>=8206&&n<=8207||n===1564}function qDt(n,e){const t=[];let i=new Oo(0,"",0,!1),r=0;for(const s of e){const o=s.endIndex;for(;ri.endIndex&&(i=new Oo(r,s.type,s.metadata,s.containsRTL),t.push(i)),i=new Oo(r+1,"mtkcontrol",s.metadata,!1),t.push(i))}r>i.endIndex&&(i=new Oo(o,s.type,s.metadata,s.containsRTL),t.push(i))}return t}function KDt(n,e,t,i){const r=n.continuesWithWrappedLine,s=n.fauxIndentLength,o=n.tabSize,a=n.startVisibleColumn,l=n.useMonospaceOptimizations,c=n.selectionsOnLine,u=n.renderWhitespace===1,d=n.renderWhitespace===3,h=n.renderSpaceWidth!==n.spaceWidth,f=[];let g=0,p=0,m=i[p].type,_=i[p].containsRTL,v=i[p].endIndex;const y=i.length;let C=!1,x=yl(e),k;x===-1?(C=!0,x=t,k=t):k=pg(e);let L=!1,D=0,I=c&&c[D],O=a%o;for(let B=s;B=I.endOffset&&(D++,I=c&&c[D]);let W;if(Bk)W=!0;else if(G===9)W=!0;else if(G===32)if(u)if(L)W=!0;else{const z=B+1B),W&&d&&(W=C||B>k),W&&_&&B>=x&&B<=k&&(W=!1),L){if(!W||!l&&O>=o){if(h){const z=g>0?f[g-1].endIndex:s;for(let q=z+1;q<=B;q++)f[g++]=new Oo(q,"mtkw",1,!1)}else f[g++]=new Oo(B,"mtkw",1,!1);O=O%o}}else(B===v||W&&B>s)&&(f[g++]=new Oo(B,m,0,_),O=O%o);for(G===9?O=o:xb(G)?O+=2:O++,L=W;B===v&&(p++,p0?e.charCodeAt(t-1):0,G=t>1?e.charCodeAt(t-2):0;B===32&&G!==32&&G!==9||(M=!0)}else M=!0;if(M)if(h){const B=g>0?f[g-1].endIndex:s;for(let G=B+1;G<=t;G++)f[g++]=new Oo(G,"mtkw",1,!1)}else f[g++]=new Oo(t,"mtkw",1,!1);else f[g++]=new Oo(t,m,0,_);return f}function GDt(n,e,t,i){i.sort(Ol.compare);const r=WDt.normalize(n,i),s=r.length;let o=0;const a=[];let l=0,c=0;for(let d=0,h=t.length;dc&&(c=v.startOffset,a[l++]=new Oo(c,p,m,_)),v.endOffset+1<=g)c=v.endOffset+1,a[l++]=new Oo(c,p+" "+v.className,m|v.metadata,_),o++;else{c=g,a[l++]=new Oo(c,p+" "+v.className,m|v.metadata,_);break}}g>c&&(c=g,a[l++]=new Oo(c,p,m,_))}const u=t[t.length-1].endIndex;if(o'):e.appendString("");for(let I=0,O=c.length;I=u&&(te+=ue)}}for(q&&(e.appendString(' style="width:'),e.appendString(String(g*Z)),e.appendString('px"')),e.appendASCIICharCode(62);C1?e.appendCharCode(8594):e.appendCharCode(65515);for(let ue=2;ue<=le;ue++)e.appendCharCode(160)}else te=2,le=1,e.appendCharCode(p),e.appendCharCode(8204);k+=te,L+=le,C>=u&&(x+=le)}}else for(e.appendASCIICharCode(62);C=u&&(x+=te)}ee?D++:D=0,C>=o&&!y&&M.isPseudoAfter()&&(y=!0,v.setColumnInfo(C+1,I,k,L)),e.appendString("")}return y||v.setColumnInfo(o+1,c.length-1,k,L),a&&(e.appendString(''),e.appendString(w("showMore","Show more ({0})",XDt(l))),e.appendString("")),e.appendString(""),new EJ(v,f,r)}function ZDt(n){return n.toString(16).toUpperCase().padStart(4,"0")}function XDt(n){return n<1024?w("overflow.chars","{0} chars",n):n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/1024/1024).toFixed(1)} MB`}let nwe=class{constructor(e,t,i,r){this._viewportBrand=void 0,this.top=e|0,this.left=t|0,this.width=i|0,this.height=r|0}};class QDt{constructor(e,t){this.tabSize=e,this.data=t}}class Lce{constructor(e,t,i,r,s,o,a){this._viewLineDataBrand=void 0,this.content=e,this.continuesWithWrappedLine=t,this.minColumn=i,this.maxColumn=r,this.startVisibleColumn=s,this.tokens=o,this.inlineDecorations=a}}class sd{constructor(e,t,i,r,s,o,a,l,c,u){this.minColumn=e,this.maxColumn=t,this.content=i,this.continuesWithWrappedLine=r,this.isBasicASCII=sd.isBasicASCII(i,o),this.containsRTL=sd.containsRTL(i,this.isBasicASCII,s),this.tokens=a,this.inlineDecorations=l,this.tabSize=c,this.startVisibleColumn=u}static isBasicASCII(e,t){return t?KP(e):!0}static containsRTL(e,t,i){return!t&&i?iE(e):!1}}class AI{constructor(e,t,i){this.range=e,this.inlineClassName=t,this.type=i}}class JDt{constructor(e,t,i,r){this.startOffset=e,this.endOffset=t,this.inlineClassName=i,this.inlineClassNameAffectsLetterSpacing=r}toInlineDecoration(e){return new AI(new $(e,this.startOffset+1,e,this.endOffset+1),this.inlineClassName,this.inlineClassNameAffectsLetterSpacing?3:0)}}class J6e{constructor(e,t){this._viewModelDecorationBrand=void 0,this.range=e,this.options=t}}class HN{constructor(e,t,i){this.color=e,this.zIndex=t,this.data=i}static compareByRenderingProps(e,t){return e.zIndex===t.zIndex?e.colort.color?1:0:e.zIndex-t.zIndex}static equals(e,t){return e.color===t.color&&e.zIndex===t.zIndex&&$r(e.data,t.data)}static equalsArr(e,t){return $r(e,t,HN.equals)}}function eIt(n){return Array.isArray(n)}function tIt(n){return!eIt(n)}function e8e(n){return typeof n=="string"}function iwe(n){return!e8e(n)}function my(n){return!n}function R_(n,e){return n.ignoreCase&&e?e.toLowerCase():e}function rwe(n){return n.replace(/[&<>'"_]/g,"-")}function nIt(n,e){console.log(`${n.languageId}: ${e}`)}function Tr(n,e){return new Error(`${n.languageId}: ${e}`)}function mv(n,e,t,i,r){const s=/\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g;let o=null;return e.replace(s,function(a,l,c,u,d,h,f,g,p){return my(c)?my(u)?!my(d)&&d0;){const i=n.tokenizer[t];if(i)return i;const r=t.lastIndexOf(".");r<0?t=null:t=t.substr(0,r)}return null}function rIt(n,e){let t=e;for(;t&&t.length>0;){if(n.stateNames[t])return!0;const r=t.lastIndexOf(".");r<0?t=null:t=t.substr(0,r)}return!1}var sIt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},oIt=function(n,e){return function(t,i){e(t,i,n)}},LJ;const t8e=5;class VN{static{this._INSTANCE=new VN(t8e)}static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(e!==null&&e.depth>=this._maxCacheDepth)return new yk(e,t);let i=yk.getStackElementId(e);i.length>0&&(i+="|"),i+=t;let r=this._entries[i];return r||(r=new yk(e,t),this._entries[i]=r,r)}}class yk{constructor(e,t){this.parent=e,this.state=t,this.depth=(this.parent?this.parent.depth:0)+1}static getStackElementId(e){let t="";for(;e!==null;)t.length>0&&(t+="|"),t+=e.state,e=e.parent;return t}static _equals(e,t){for(;e!==null&&t!==null;){if(e===t)return!0;if(e.state!==t.state)return!1;e=e.parent,t=t.parent}return e===null&&t===null}equals(e){return yk._equals(this,e)}push(e){return VN.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return VN.create(this.parent,e)}}class DS{constructor(e,t){this.languageId=e,this.state=t}equals(e){return this.languageId===e.languageId&&this.state.equals(e.state)}clone(){return this.state.clone()===this.state?this:new DS(this.languageId,this.state)}}class _v{static{this._INSTANCE=new _v(t8e)}static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(t!==null)return new NI(e,t);if(e!==null&&e.depth>=this._maxCacheDepth)return new NI(e,t);const i=yk.getStackElementId(e);let r=this._entries[i];return r||(r=new NI(e,null),this._entries[i]=r,r)}}class NI{constructor(e,t){this.stack=e,this.embeddedLanguageData=t}clone(){return(this.embeddedLanguageData?this.embeddedLanguageData.clone():null)===this.embeddedLanguageData?this:_v.create(this.stack,this.embeddedLanguageData)}equals(e){return!(e instanceof NI)||!this.stack.equals(e.stack)?!1:this.embeddedLanguageData===null&&e.embeddedLanguageData===null?!0:this.embeddedLanguageData===null||e.embeddedLanguageData===null?!1:this.embeddedLanguageData.equals(e.embeddedLanguageData)}}class aIt{constructor(){this._tokens=[],this._languageId=null,this._lastTokenType=null,this._lastTokenLanguage=null}enterLanguage(e){this._languageId=e}emit(e,t){this._lastTokenType===t&&this._lastTokenLanguage===this._languageId||(this._lastTokenType=t,this._lastTokenLanguage=this._languageId,this._tokens.push(new iN(e,t,this._languageId)))}nestedLanguageTokenize(e,t,i,r){const s=i.languageId,o=i.state,a=rs.get(s);if(!a)return this.enterLanguage(s),this.emit(r,""),o;const l=a.tokenize(e,t,o);if(r!==0)for(const c of l.tokens)this._tokens.push(new iN(c.offset+r,c.type,c.language));else this._tokens=this._tokens.concat(l.tokens);return this._lastTokenType=null,this._lastTokenLanguage=null,this._languageId=null,l.endState}finalize(e){return new kae(this._tokens,e)}}class l9{constructor(e,t){this._languageService=e,this._theme=t,this._prependTokens=null,this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0}enterLanguage(e){this._currentLanguageId=this._languageService.languageIdCodec.encodeLanguageId(e)}emit(e,t){const i=this._theme.match(this._currentLanguageId,t)|1024;this._lastTokenMetadata!==i&&(this._lastTokenMetadata=i,this._tokens.push(e),this._tokens.push(i))}static _merge(e,t,i){const r=e!==null?e.length:0,s=t.length,o=i!==null?i.length:0;if(r===0&&s===0&&o===0)return new Uint32Array(0);if(r===0&&s===0)return i;if(s===0&&o===0)return e;const a=new Uint32Array(r+s+o);e!==null&&a.set(e);for(let l=0;l{if(o)return;let l=!1;for(let c=0,u=a.changedLanguages.length;c{a.affectsConfiguration("editor.maxTokenizationLineLength")&&(this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}))}))}getLoadStatus(){const e=[];for(const t in this._embeddedLanguages){const i=rs.get(t);if(i){if(i instanceof LJ){const r=i.getLoadStatus();r.loaded===!1&&e.push(r.promise)}continue}rs.isResolved(t)||e.push(rs.getOrCreate(t))}return e.length===0?{loaded:!0}:{loaded:!1,promise:Promise.all(e).then(t=>{})}}getInitialState(){const e=VN.create(null,this._lexer.start);return _v.create(e,null)}tokenize(e,t,i){if(e.length>=this._maxTokenizationLineLength)return Nle(this._languageId,i);const r=new aIt,s=this._tokenize(e,t,i,r);return r.finalize(s)}tokenizeEncoded(e,t,i){if(e.length>=this._maxTokenizationLineLength)return bW(this._languageService.languageIdCodec.encodeLanguageId(this._languageId),i);const r=new l9(this._languageService,this._standaloneThemeService.getColorTheme().tokenTheme),s=this._tokenize(e,t,i,r);return r.finalize(s)}_tokenize(e,t,i,r){return i.embeddedLanguageData?this._nestedTokenize(e,t,i,0,r):this._myTokenize(e,t,i,0,r)}_findLeavingNestedLanguageOffset(e,t){let i=this._lexer.tokenizer[t.stack.state];if(!i&&(i=X4(this._lexer,t.stack.state),!i))throw Tr(this._lexer,"tokenizer state is not defined: "+t.stack.state);let r=-1,s=!1;for(const o of i){if(!iwe(o.action)||o.action.nextEmbedded!=="@pop")continue;s=!0;let a=o.resolveRegex(t.stack.state);const l=a.source;if(l.substr(0,4)==="^(?:"&&l.substr(l.length-1,1)===")"){const u=(a.ignoreCase?"i":"")+(a.unicode?"u":"");a=new RegExp(l.substr(4,l.length-5),u)}const c=e.search(a);c===-1||c!==0&&o.matchOnlyAtLineStart||(r===-1||c0&&s.nestedLanguageTokenize(a,!1,i.embeddedLanguageData,r);const l=e.substring(o);return this._myTokenize(l,t,i,r+o,s)}_safeRuleName(e){return e?e.name:"(unknown)"}_myTokenize(e,t,i,r,s){s.enterLanguage(this._languageId);const o=e.length,a=t&&this._lexer.includeLF?e+` +`:e,l=a.length;let c=i.embeddedLanguageData,u=i.stack,d=0,h=null,f=!0;for(;f||d=l)break;f=!1;let I=this._lexer.tokenizer[_];if(!I&&(I=X4(this._lexer,_),!I))throw Tr(this._lexer,"tokenizer state is not defined: "+_);const O=a.substr(d);for(const M of I)if((d===0||!M.matchOnlyAtLineStart)&&(v=O.match(M.resolveRegex(_)),v)){y=v[0],C=M.action;break}}if(v||(v=[""],y=""),C||(d=this._lexer.maxStack)throw Tr(this._lexer,"maximum tokenizer stack size reached: ["+u.state+","+u.parent.state+",...]");u=u.push(_)}else if(C.next==="@pop"){if(u.depth<=1)throw Tr(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(x));u=u.pop()}else if(C.next==="@popall")u=u.popall();else{let I=mv(this._lexer,C.next,y,v,_);if(I[0]==="@"&&(I=I.substr(1)),X4(this._lexer,I))u=u.push(I);else throw Tr(this._lexer,"trying to set a next state '"+I+"' that is undefined in rule: "+this._safeRuleName(x))}}C.log&&typeof C.log=="string"&&nIt(this._lexer,this._lexer.languageId+": "+mv(this._lexer,C.log,y,v,_))}if(L===null)throw Tr(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(x));const D=I=>{const O=this._languageService.getLanguageIdByLanguageName(I)||this._languageService.getLanguageIdByMimeType(I)||I,M=this._getNestedEmbeddedLanguageData(O);if(d0)throw Tr(this._lexer,"groups cannot be nested: "+this._safeRuleName(x));if(v.length!==L.length+1)throw Tr(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(x));let I=0;for(let O=1;On});class Tce{static colorizeElement(e,t,i,r){r=r||{};const s=r.theme||"vs",o=r.mimeType||i.getAttribute("lang")||i.getAttribute("data-lang");if(!o)return console.error("Mode not detected"),Promise.resolve();const a=t.getLanguageIdByMimeType(o)||o;e.setTheme(s);const l=i.firstChild?i.firstChild.nodeValue:"";i.className+=" "+s;const c=u=>{const d=cIt?.createHTML(u)??u;i.innerHTML=d};return this.colorize(t,l||"",a,r).then(c,u=>console.error(u))}static async colorize(e,t,i,r){const s=e.languageIdCodec;let o=4;r&&typeof r.tabSize=="number"&&(o=r.tabSize),Nae(t)&&(t=t.substr(1));const a=om(t);if(!e.isRegisteredLanguageId(i))return swe(a,o,s);const l=await rs.getOrCreate(i);return l?uIt(a,o,l,s):swe(a,o,s)}static colorizeLine(e,t,i,r,s=4){const o=sd.isBasicASCII(e,t),a=sd.containsRTL(e,o,i);return WW(new n1(!1,!0,e,!1,o,a,0,r,[],s,0,0,0,0,-1,"none",!1,!1,null)).html}static colorizeModelLine(e,t,i=4){const r=e.getLineContent(t);e.tokenization.forceTokenization(t);const o=e.tokenization.getLineTokens(t).inflate();return this.colorizeLine(r,e.mightContainNonBasicASCII(),e.mightContainRTL(),o,i)}}function uIt(n,e,t,i){return new Promise((r,s)=>{const o=()=>{const a=dIt(n,e,t,i);if(t instanceof zN){const l=t.getLoadStatus();if(l.loaded===!1){l.promise.then(o,s);return}}r(a)};o()})}function swe(n,e,t){let i=[];const s=new Uint32Array(2);s[0]=0,s[1]=33587200;for(let o=0,a=n.length;o")}return i.join("")}function dIt(n,e,t,i){let r=[],s=t.getInitialState();for(let o=0,a=n.length;o"),s=c.endState}return r.join("")}var hIt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},fIt=function(n,e){return function(t,i){e(t,i,n)}};let c9=class{static{this.ID="editor.contrib.markerDecorations"}constructor(e,t){}dispose(){}};c9=hIt([fIt(1,Ule)],c9);Zn(c9.ID,c9,0);class n8e extends me{constructor(e,t){super(),this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._referenceDomElement=e,this._width=-1,this._height=-1,this._resizeObserver=null,this.measureReferenceDomElement(!1,t)}dispose(){this.stopObserving(),super.dispose()}getWidth(){return this._width}getHeight(){return this._height}startObserving(){if(!this._resizeObserver&&this._referenceDomElement){let e=null;const t=()=>{e?this.observe({width:e.width,height:e.height}):this.observe()};let i=!1,r=!1;const s=()=>{if(i&&!r)try{i=!1,r=!0,t()}finally{du(Ot(this._referenceDomElement),()=>{r=!1,s()})}};this._resizeObserver=new ResizeObserver(o=>{o&&o[0]&&o[0].contentRect?e={width:o[0].contentRect.width,height:o[0].contentRect.height}:e=null,i=!0,s()}),this._resizeObserver.observe(this._referenceDomElement)}}stopObserving(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}observe(e){this.measureReferenceDomElement(!0,e)}measureReferenceDomElement(e,t){let i=0,r=0;t?(i=t.width,r=t.height):this._referenceDomElement&&(i=this._referenceDomElement.clientWidth,r=this._referenceDomElement.clientHeight),i=Math.max(5,i),r=Math.max(5,r),(this._width!==i||this._height!==r)&&(this._width=i,this._height=r,e&&this._onDidChange.fire())}}class nw{static{this.items=[]}constructor(e,t){this.key=e,this.migrate=t}apply(e){const t=nw._read(e,this.key),i=s=>nw._read(e,s),r=(s,o)=>nw._write(e,s,o);this.migrate(t,i,r)}static _read(e,t){if(typeof e>"u")return;const i=t.indexOf(".");if(i>=0){const r=t.substring(0,i);return this._read(e[r],t.substring(i+1))}return e[t]}static _write(e,t,i){const r=t.indexOf(".");if(r>=0){const s=t.substring(0,r);e[s]=e[s]||{},this._write(e[s],t.substring(r+1),i);return}e[t]=i}}function $g(n,e){nw.items.push(new nw(n,e))}function vu(n,e){$g(n,(t,i,r)=>{if(typeof t<"u"){for(const[s,o]of e)if(t===s){r(n,o);return}}})}function gIt(n){nw.items.forEach(e=>e.apply(n))}vu("wordWrap",[[!0,"on"],[!1,"off"]]);vu("lineNumbers",[[!0,"on"],[!1,"off"]]);vu("cursorBlinking",[["visible","solid"]]);vu("renderWhitespace",[[!0,"boundary"],[!1,"none"]]);vu("renderLineHighlight",[[!0,"line"],[!1,"none"]]);vu("acceptSuggestionOnEnter",[[!0,"on"],[!1,"off"]]);vu("tabCompletion",[[!1,"off"],[!0,"onlySnippets"]]);vu("hover",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);vu("parameterHints",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);vu("autoIndent",[[!1,"advanced"],[!0,"full"]]);vu("matchBrackets",[[!0,"always"],[!1,"never"]]);vu("renderFinalNewline",[[!0,"on"],[!1,"off"]]);vu("cursorSmoothCaretAnimation",[[!0,"on"],[!1,"off"]]);vu("occurrencesHighlight",[[!0,"singleFile"],[!1,"off"]]);vu("wordBasedSuggestions",[[!0,"matchingDocuments"],[!1,"off"]]);$g("autoClosingBrackets",(n,e,t)=>{n===!1&&(t("autoClosingBrackets","never"),typeof e("autoClosingQuotes")>"u"&&t("autoClosingQuotes","never"),typeof e("autoSurround")>"u"&&t("autoSurround","never"))});$g("renderIndentGuides",(n,e,t)=>{typeof n<"u"&&(t("renderIndentGuides",void 0),typeof e("guides.indentation")>"u"&&t("guides.indentation",!!n))});$g("highlightActiveIndentGuide",(n,e,t)=>{typeof n<"u"&&(t("highlightActiveIndentGuide",void 0),typeof e("guides.highlightActiveIndentation")>"u"&&t("guides.highlightActiveIndentation",!!n))});const pIt={method:"showMethods",function:"showFunctions",constructor:"showConstructors",deprecated:"showDeprecated",field:"showFields",variable:"showVariables",class:"showClasses",struct:"showStructs",interface:"showInterfaces",module:"showModules",property:"showProperties",event:"showEvents",operator:"showOperators",unit:"showUnits",value:"showValues",constant:"showConstants",enum:"showEnums",enumMember:"showEnumMembers",keyword:"showKeywords",text:"showWords",color:"showColors",file:"showFiles",reference:"showReferences",folder:"showFolders",typeParameter:"showTypeParameters",snippet:"showSnippets"};$g("suggest.filteredTypes",(n,e,t)=>{if(n&&typeof n=="object"){for(const i of Object.entries(pIt))n[i[0]]===!1&&typeof e(`suggest.${i[1]}`)>"u"&&t(`suggest.${i[1]}`,!1);t("suggest.filteredTypes",void 0)}});$g("quickSuggestions",(n,e,t)=>{if(typeof n=="boolean"){const i=n?"on":"off";t("quickSuggestions",{comments:i,strings:i,other:i})}});$g("experimental.stickyScroll.enabled",(n,e,t)=>{typeof n=="boolean"&&(t("experimental.stickyScroll.enabled",void 0),typeof e("stickyScroll.enabled")>"u"&&t("stickyScroll.enabled",n))});$g("experimental.stickyScroll.maxLineCount",(n,e,t)=>{typeof n=="number"&&(t("experimental.stickyScroll.maxLineCount",void 0),typeof e("stickyScroll.maxLineCount")>"u"&&t("stickyScroll.maxLineCount",n))});$g("codeActionsOnSave",(n,e,t)=>{if(n&&typeof n=="object"){let i=!1;const r={};for(const s of Object.entries(n))typeof s[1]=="boolean"?(i=!0,r[s[0]]=s[1]?"explicit":"never"):r[s[0]]=s[1];i&&t("codeActionsOnSave",r)}});$g("codeActionWidget.includeNearbyQuickfixes",(n,e,t)=>{typeof n=="boolean"&&(t("codeActionWidget.includeNearbyQuickfixes",void 0),typeof e("codeActionWidget.includeNearbyQuickFixes")>"u"&&t("codeActionWidget.includeNearbyQuickFixes",n))});$g("lightbulb.enabled",(n,e,t)=>{typeof n=="boolean"&&t("lightbulb.enabled",n?void 0:"off")});class mIt{constructor(){this._tabFocus=!1,this._onDidChangeTabFocus=new fe,this.onDidChangeTabFocus=this._onDidChangeTabFocus.event}getTabFocusMode(){return this._tabFocus}setTabFocusMode(e){this._tabFocus=e,this._onDidChangeTabFocus.fire(this._tabFocus)}}const xE=new mIt;var _It=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},vIt=function(n,e){return function(t,i){e(t,i,n)}};let TJ=class extends me{constructor(e,t,i,r,s){super(),this._accessibilityService=s,this._onDidChange=this._register(new fe),this.onDidChange=this._onDidChange.event,this._onDidChangeFast=this._register(new fe),this.onDidChangeFast=this._onDidChangeFast.event,this._isDominatedByLongLines=!1,this._viewLineCount=1,this._lineNumbersDigitCount=1,this._reservedHeight=0,this._glyphMarginDecorationLaneCount=1,this._computeOptionsMemory=new w4e,this.isSimpleWidget=e,this.contextMenuId=t,this._containerObserver=this._register(new n8e(r,i.dimension)),this._targetWindowId=Ot(r).vscodeWindowId,this._rawOptions=owe(i),this._validatedOptions=vv.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(13)&&this._containerObserver.startObserving(),this._register(Pd.onDidChangeZoomLevel(()=>this._recomputeOptions())),this._register(xE.onDidChangeTabFocus(()=>this._recomputeOptions())),this._register(this._containerObserver.onDidChange(()=>this._recomputeOptions())),this._register(yX.onDidChange(()=>this._recomputeOptions())),this._register(cN.getInstance(Ot(r)).onDidChange(()=>this._recomputeOptions())),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>this._recomputeOptions()))}_recomputeOptions(){const e=this._computeOptions(),t=vv.checkEquals(this.options,e);t!==null&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){const e=this._readEnvConfiguration(),t=Gy.createFromValidatedSettings(this._validatedOptions,e.pixelRatio,this.isSimpleWidget),i=this._readFontInfo(t),r={memory:this._computeOptionsMemory,outerWidth:e.outerWidth,outerHeight:e.outerHeight-this._reservedHeight,fontInfo:i,extraEditorClassName:e.extraEditorClassName,isDominatedByLongLines:this._isDominatedByLongLines,viewLineCount:this._viewLineCount,lineNumbersDigitCount:this._lineNumbersDigitCount,emptySelectionClipboard:e.emptySelectionClipboard,pixelRatio:e.pixelRatio,tabFocusMode:xE.getTabFocusMode(),accessibilitySupport:e.accessibilitySupport,glyphMarginDecorationLaneCount:this._glyphMarginDecorationLaneCount};return vv.computeOptions(this._validatedOptions,r)}_readEnvConfiguration(){return{extraEditorClassName:yIt(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:Ky||Xd,pixelRatio:cN.getInstance(Qve(this._targetWindowId,!0).window).value,accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return yX.readFontInfo(Qve(this._targetWindowId,!0).window,e)}getRawOptions(){return this._rawOptions}updateOptions(e){const t=owe(e);vv.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=vv.validateOptions(this._rawOptions),this._recomputeOptions())}observeContainer(e){this._containerObserver.observe(e)}setIsDominatedByLongLines(e){this._isDominatedByLongLines!==e&&(this._isDominatedByLongLines=e,this._recomputeOptions())}setModelLineCount(e){const t=bIt(e);this._lineNumbersDigitCount!==t&&(this._lineNumbersDigitCount=t,this._recomputeOptions())}setViewLineCount(e){this._viewLineCount!==e&&(this._viewLineCount=e,this._recomputeOptions())}setReservedHeight(e){this._reservedHeight!==e&&(this._reservedHeight=e,this._recomputeOptions())}setGlyphMarginDecorationLaneCount(e){this._glyphMarginDecorationLaneCount!==e&&(this._glyphMarginDecorationLaneCount=e,this._recomputeOptions())}};TJ=_It([vIt(4,_u)],TJ);function bIt(n){let e=0;for(;n;)n=Math.floor(n/10),e++;return e||1}function yIt(){let n="";return!K_&&!G4e&&(n+="no-user-select "),K_&&(n+="no-minimap-shadow ",n+="enable-user-select "),Rn&&(n+="mac "),n}class wIt{constructor(){this._values=[]}_read(e){return this._values[e]}get(e){return this._values[e]}_write(e,t){this._values[e]=t}}class CIt{constructor(){this._values=[]}_read(e){if(e>=this._values.length)throw new Error("Cannot read uninitialized value");return this._values[e]}get(e){return this._read(e)}_write(e,t){this._values[e]=t}}class vv{static validateOptions(e){const t=new wIt;for(const i of vS){const r=i.name==="_never_"?void 0:e[i.name];t._write(i.id,i.validate(r))}return t}static computeOptions(e,t){const i=new CIt;for(const r of vS)i._write(r.id,r.compute(t,i,e._read(r.id)));return i}static _deepEquals(e,t){if(typeof e!="object"||typeof t!="object"||!e||!t)return e===t;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)?$r(e,t):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!vv._deepEquals(e[i],t[i]))return!1;return!0}static checkEquals(e,t){const i=[];let r=!1;for(const s of vS){const o=!vv._deepEquals(e._read(s.id),t._read(s.id));i[s.id]=o,o&&(r=!0)}return r?new y4e(i):null}static applyUpdate(e,t){let i=!1;for(const r of vS)if(t.hasOwnProperty(r.name)){const s=r.applyUpdate(e[r.name],t[r.name]);e[r.name]=s.newValue,i=i||s.didChange}return i}}function owe(n){const e=Qm(n);return gIt(e),e}var Mv;(function(n){const e={total:0,min:Number.MAX_VALUE,max:0},t={...e},i={...e},r={...e};let s=0;const o={keydown:0,input:0,render:0};function a(){_(),performance.mark("inputlatency/start"),performance.mark("keydown/start"),o.keydown=1,queueMicrotask(l)}n.onKeyDown=a;function l(){o.keydown===1&&(performance.mark("keydown/end"),o.keydown=2)}function c(){performance.mark("input/start"),o.input=1,m()}n.onBeforeInput=c;function u(){o.input===0&&c(),queueMicrotask(d)}n.onInput=u;function d(){o.input===1&&(performance.mark("input/end"),o.input=2)}function h(){_()}n.onKeyUp=h;function f(){_()}n.onSelectionChange=f;function g(){o.keydown===2&&o.input===2&&o.render===0&&(performance.mark("render/start"),o.render=1,queueMicrotask(p),m())}n.onRenderStart=g;function p(){o.render===1&&(performance.mark("render/end"),o.render=2)}function m(){setTimeout(_)}function _(){o.keydown===2&&o.input===2&&o.render===2&&(performance.mark("inputlatency/end"),performance.measure("keydown","keydown/start","keydown/end"),performance.measure("input","input/start","input/end"),performance.measure("render","render/start","render/end"),performance.measure("inputlatency","inputlatency/start","inputlatency/end"),v("keydown",e),v("input",t),v("render",i),v("inputlatency",r),s++,y())}function v(L,D){const I=performance.getEntriesByName(L)[0].duration;D.total+=I,D.min=Math.min(D.min,I),D.max=Math.max(D.max,I)}function y(){performance.clearMarks("keydown/start"),performance.clearMarks("keydown/end"),performance.clearMarks("input/start"),performance.clearMarks("input/end"),performance.clearMarks("render/start"),performance.clearMarks("render/end"),performance.clearMarks("inputlatency/start"),performance.clearMarks("inputlatency/end"),performance.clearMeasures("keydown"),performance.clearMeasures("input"),performance.clearMeasures("render"),performance.clearMeasures("inputlatency"),o.keydown=0,o.input=0,o.render=0}function C(){if(s===0)return;const L={keydown:x(e),input:x(t),render:x(i),total:x(r),sampleCount:s};return k(e),k(t),k(i),k(r),s=0,L}n.getAndClearMeasurements=C;function x(L){return{average:L.total/s,max:L.max,min:L.min}}function k(L){L.total=0,L.min=Number.MAX_VALUE,L.max=0}})(Mv||(Mv={}));class HW{constructor(e,t){this.x=e,this.y=t,this._pageCoordinatesBrand=void 0}toClientCoordinates(e){return new i8e(this.x-e.scrollX,this.y-e.scrollY)}}class i8e{constructor(e,t){this.clientX=e,this.clientY=t,this._clientCoordinatesBrand=void 0}toPageCoordinates(e){return new HW(this.clientX+e.scrollX,this.clientY+e.scrollY)}}class xIt{constructor(e,t,i,r){this.x=e,this.y=t,this.width=i,this.height=r,this._editorPagePositionBrand=void 0}}class SIt{constructor(e,t){this.x=e,this.y=t,this._positionRelativeToEditorBrand=void 0}}function Dce(n){const e=ms(n);return new xIt(e.left,e.top,e.width,e.height)}function Ice(n,e,t){const i=e.width/n.offsetWidth,r=e.height/n.offsetHeight,s=(t.x-e.x)/i,o=(t.y-e.y)/r;return new SIt(s,o)}class Nb extends qh{constructor(e,t,i){super(Ot(i),e),this._editorMouseEventBrand=void 0,this.isFromPointerCapture=t,this.pos=new HW(this.posx,this.posy),this.editorPos=Dce(i),this.relativePos=Ice(i,this.editorPos,this.pos)}}class kIt{constructor(e){this._editorViewDomNode=e}_create(e){return new Nb(e,!1,this._editorViewDomNode)}onContextMenu(e,t){return Ce(e,"contextmenu",i=>{t(this._create(i))})}onMouseUp(e,t){return Ce(e,"mouseup",i=>{t(this._create(i))})}onMouseDown(e,t){return Ce(e,je.MOUSE_DOWN,i=>{t(this._create(i))})}onPointerDown(e,t){return Ce(e,je.POINTER_DOWN,i=>{t(this._create(i),i.pointerId)})}onMouseLeave(e,t){return Ce(e,je.MOUSE_LEAVE,i=>{t(this._create(i))})}onMouseMove(e,t){return Ce(e,"mousemove",i=>t(this._create(i)))}}class EIt{constructor(e){this._editorViewDomNode=e}_create(e){return new Nb(e,!1,this._editorViewDomNode)}onPointerUp(e,t){return Ce(e,"pointerup",i=>{t(this._create(i))})}onPointerDown(e,t){return Ce(e,je.POINTER_DOWN,i=>{t(this._create(i),i.pointerId)})}onPointerLeave(e,t){return Ce(e,je.POINTER_LEAVE,i=>{t(this._create(i))})}onPointerMove(e,t){return Ce(e,"pointermove",i=>t(this._create(i)))}}class LIt extends me{constructor(e){super(),this._editorViewDomNode=e,this._globalPointerMoveMonitor=this._register(new e2),this._keydownListener=null}startMonitoring(e,t,i,r,s){this._keydownListener=Jr(e.ownerDocument,"keydown",o=>{o.toKeyCodeChord().isModifierKey()||this._globalPointerMoveMonitor.stopMonitoring(!0,o.browserEvent)},!0),this._globalPointerMoveMonitor.startMonitoring(e,t,i,o=>{r(new Nb(o,!0,this._editorViewDomNode))},o=>{this._keydownListener.dispose(),s(o)})}stopMonitoring(){this._globalPointerMoveMonitor.stopMonitoring(!0)}}class VW{static{this._idPool=0}constructor(e){this._editor=e,this._instanceId=++VW._idPool,this._counter=0,this._rules=new Map,this._garbageCollectionScheduler=new Ui(()=>this.garbageCollect(),1e3)}createClassNameRef(e){const t=this.getOrCreateRule(e);return t.increaseRefCount(),{className:t.className,dispose:()=>{t.decreaseRefCount(),this._garbageCollectionScheduler.schedule()}}}getOrCreateRule(e){const t=this.computeUniqueKey(e);let i=this._rules.get(t);if(!i){const r=this._counter++;i=new TIt(t,`dyn-rule-${this._instanceId}-${r}`,G6(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,e),this._rules.set(t,i)}return i}computeUniqueKey(e){return JSON.stringify(e)}garbageCollect(){for(const e of this._rules.values())e.hasReferences()||(this._rules.delete(e.key),e.dispose())}}class TIt{constructor(e,t,i,r){this.key=e,this.className=t,this.properties=r,this._referenceCount=0,this._styleElementDisposables=new ke,this._styleElement=id(i,void 0,this._styleElementDisposables),this._styleElement.textContent=this.getCssText(this.className,this.properties)}getCssText(e,t){let i=`.${e} {`;for(const r in t){const s=t[r];let o;typeof s=="object"?o=it(s.id):o=s;const a=DIt(r);i+=` ${a}: ${o};`}return i+=` -}`,i}dispose(){this._styleElementDisposables.dispose(),this._styleElement=void 0}increaseRefCount(){this._referenceCount++}decreaseRefCount(){this._referenceCount--}hasReferences(){return this._referenceCount>0}}function DIt(n){return n.replace(/(^[A-Z])/,([e])=>e.toLowerCase()).replace(/([A-Z])/g,([e])=>`-${e.toLowerCase()}`)}class _O extends me{constructor(){super(),this._shouldRender=!0}shouldRender(){return this._shouldRender}forceShouldRender(){this._shouldRender=!0}setShouldRender(){this._shouldRender=!0}onDidRender(){this._shouldRender=!1}onCompositionStart(e){return!1}onCompositionEnd(e){return!1}onConfigurationChanged(e){return!1}onCursorStateChanged(e){return!1}onDecorationsChanged(e){return!1}onFlushed(e){return!1}onFocusChanged(e){return!1}onLanguageConfigurationChanged(e){return!1}onLineMappingChanged(e){return!1}onLinesChanged(e){return!1}onLinesDeleted(e){return!1}onLinesInserted(e){return!1}onRevealRangeRequest(e){return!1}onScrollChanged(e){return!1}onThemeChanged(e){return!1}onTokensChanged(e){return!1}onTokensColorsChanged(e){return!1}onZonesChanged(e){return!1}handleEvents(e){let t=!1;for(let i=0,r=e.length;i=a.left?r.width=Math.max(r.width,a.left+a.width-r.left):(t[i++]=r,r=a)}return t[i++]=r,t}static _createHorizontalRangesFromClientRects(e,t,i){if(!e||e.length===0)return null;const r=[];for(let s=0,o=e.length;sl)return null;if(t=Math.min(l,Math.max(0,t)),r=Math.min(l,Math.max(0,r)),t===r&&i===s&&i===0&&!e.children[t].firstChild){const h=e.children[t].getClientRects();return o.markDidDomLayout(),this._createHorizontalRangesFromClientRects(h,o.clientRectDeltaLeft,o.clientRectScale)}t!==r&&r>0&&s===0&&(r--,s=1073741824);let c=e.children[t].firstChild,u=e.children[r].firstChild;if((!c||!u)&&(!c&&i===0&&t>0&&(c=e.children[t-1].firstChild,i=1073741824),!u&&s===0&&r>0&&(u=e.children[r-1].firstChild,s=1073741824)),!c||!u)return null;i=Math.min(c.textContent.length,Math.max(0,i)),s=Math.min(u.textContent.length,Math.max(0,s));const d=this._readClientRects(c,i,u,s,o.endNode);return o.markDidDomLayout(),this._createHorizontalRangesFromClientRects(d,o.clientRectDeltaLeft,o.clientRectScale)}}const PIt=function(){return hg?!0:!(zl||Xd||K_)}();let wk=!0;class lwe{constructor(e,t){this.themeType=t;const i=e.options,r=i.get(50);i.get(38)==="off"?this.renderWhitespace=i.get(100):this.renderWhitespace="none",this.renderControlCharacters=i.get(95),this.spaceWidth=r.spaceWidth,this.middotWidth=r.middotWidth,this.wsmiddotWidth=r.wsmiddotWidth,this.useMonospaceOptimizations=r.isMonospace&&!i.get(33),this.canUseHalfwidthRightwardsArrow=r.canUseHalfwidthRightwardsArrow,this.lineHeight=i.get(67),this.stopRenderingLineAfter=i.get(118),this.fontLigatures=i.get(51)}equals(e){return this.themeType===e.themeType&&this.renderWhitespace===e.renderWhitespace&&this.renderControlCharacters===e.renderControlCharacters&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.useMonospaceOptimizations===e.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter&&this.fontLigatures===e.fontLigatures}}class l_{static{this.CLASS_NAME="view-line"}constructor(e){this._options=e,this._isMaybeInvalid=!0,this._renderedViewLine=null}getDomNode(){return this._renderedViewLine&&this._renderedViewLine.domNode?this._renderedViewLine.domNode.domNode:null}setDomNode(e){if(this._renderedViewLine)this._renderedViewLine.domNode=Ci(e);else throw new Error("I have no rendered view line to set the dom node to...")}onContentChanged(){this._isMaybeInvalid=!0}onTokensChanged(){this._isMaybeInvalid=!0}onDecorationsChanged(){this._isMaybeInvalid=!0}onOptionsChanged(e){this._isMaybeInvalid=!0,this._options=e}onSelectionChanged(){return mg(this._options.themeType)||this._options.renderWhitespace==="selection"?(this._isMaybeInvalid=!0,!0):!1}renderLine(e,t,i,r,s){if(this._isMaybeInvalid===!1)return!1;this._isMaybeInvalid=!1;const o=r.getViewLineRenderingData(e),a=this._options,l=Ol.filter(o.inlineDecorations,e,o.minColumn,o.maxColumn);let c=null;if(mg(a.themeType)||this._options.renderWhitespace==="selection"){const f=r.selections;for(const g of f){if(g.endLineNumbere)continue;const p=g.startLineNumber===e?g.startColumn:o.minColumn,m=g.endLineNumber===e?g.endColumn:o.maxColumn;p');const d=mO(u,s);s.appendString("");let h=null;return wk&&PIt&&o.isBasicASCII&&a.useMonospaceOptimizations&&d.containsForeignElements===0&&(h=new Q4(this._renderedViewLine?this._renderedViewLine.domNode:null,u,d.characterMapping)),h||(h=s8e(this._renderedViewLine?this._renderedViewLine.domNode:null,u,d.characterMapping,d.containsRTL,d.containsForeignElements)),this._renderedViewLine=h,!0}layoutLine(e,t,i){this._renderedViewLine&&this._renderedViewLine.domNode&&(this._renderedViewLine.domNode.setTop(t),this._renderedViewLine.domNode.setHeight(i))}getWidth(e){return this._renderedViewLine?this._renderedViewLine.getWidth(e):0}getWidthIsFast(){return this._renderedViewLine?this._renderedViewLine.getWidthIsFast():!0}needsMonospaceFontCheck(){return this._renderedViewLine?this._renderedViewLine instanceof Q4:!1}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof Q4?this._renderedViewLine.monospaceAssumptionsAreValid():wk}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof Q4&&(this._renderedViewLine=this._renderedViewLine.toSlowRenderedLine())}getVisibleRangesForRange(e,t,i,r){if(!this._renderedViewLine)return null;t=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,t)),i=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,i));const s=this._renderedViewLine.input.stopRenderingLineAfter;if(s!==-1&&t>s+1&&i>s+1)return new awe(!0,[new iw(this.getWidth(r),0)]);s!==-1&&t>s+1&&(t=s+1),s!==-1&&i>s+1&&(i=s+1);const o=this._renderedViewLine.getVisibleRangesForRange(e,t,i,r);return o&&o.length>0?new awe(!1,o):null}getColumnOfNodeOffset(e,t){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(e,t):1}}class Q4{constructor(e,t,i){this._cachedWidth=-1,this.domNode=e,this.input=t;const r=Math.floor(t.lineContent.length/300);if(r>0){this._keyColumnPixelOffsetCache=new Float32Array(r);for(let s=0;s=2&&(console.warn("monospace assumptions have been violated, therefore disabling monospace optimizations!"),wk=!1)}return wk}toSlowRenderedLine(){return s8e(this.domNode,this.input,this._characterMapping,!1,0)}getVisibleRangesForRange(e,t,i,r){const s=this._getColumnPixelOffset(e,t,r),o=this._getColumnPixelOffset(e,i,r);return[new iw(s,o-s)]}_getColumnPixelOffset(e,t,i){if(t<=300){const c=this._characterMapping.getHorizontalOffset(t);return this._charWidth*c}const r=Math.floor((t-1)/300)-1,s=(r+1)*300+1;let o=-1;if(this._keyColumnPixelOffsetCache&&(o=this._keyColumnPixelOffsetCache[r],o===-1&&(o=this._actualReadPixelOffset(e,s,i),this._keyColumnPixelOffsetCache[r]=o)),o===-1){const c=this._characterMapping.getHorizontalOffset(t);return this._charWidth*c}const a=this._characterMapping.getHorizontalOffset(s),l=this._characterMapping.getHorizontalOffset(t);return o+this._charWidth*(l-a)}_getReadingTarget(e){return e.domNode.firstChild}_actualReadPixelOffset(e,t,i){if(!this.domNode)return-1;const r=this._characterMapping.getDomPosition(t),s=l5.readHorizontalRanges(this._getReadingTarget(this.domNode),r.partIndex,r.charIndex,r.partIndex,r.charIndex,i);return!s||s.length===0?-1:s[0].left}getColumnOfNodeOffset(e,t){return Ace(this._characterMapping,e,t)}}class r8e{constructor(e,t,i,r,s){if(this.domNode=e,this.input=t,this._characterMapping=i,this._isWhitespaceOnly=/^\s*$/.test(t.lineContent),this._containsForeignElements=s,this._cachedWidth=-1,this._pixelOffsetCache=null,!r||this._characterMapping.length===0){this._pixelOffsetCache=new Float32Array(Math.max(2,this._characterMapping.length+1));for(let o=0,a=this._characterMapping.length;o<=a;o++)this._pixelOffsetCache[o]=-1}}_getReadingTarget(e){return e.domNode.firstChild}getWidth(e){return this.domNode?(this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,e?.markDidDomLayout()),this._cachedWidth):0}getWidthIsFast(){return this._cachedWidth!==-1}getVisibleRangesForRange(e,t,i,r){if(!this.domNode)return null;if(this._pixelOffsetCache!==null){const s=this._readPixelOffset(this.domNode,e,t,r);if(s===-1)return null;const o=this._readPixelOffset(this.domNode,e,i,r);return o===-1?null:[new iw(s,o-s)]}return this._readVisibleRangesForRange(this.domNode,e,t,i,r)}_readVisibleRangesForRange(e,t,i,r,s){if(i===r){const o=this._readPixelOffset(e,t,i,s);return o===-1?null:[new iw(o,0)]}else return this._readRawVisibleRangesForRange(e,i,r,s)}_readPixelOffset(e,t,i,r){if(this._characterMapping.length===0){if(this._containsForeignElements===0||this._containsForeignElements===2)return 0;if(this._containsForeignElements===1)return this.getWidth(r);const s=this._getReadingTarget(e);return s.firstChild?(r.markDidDomLayout(),s.firstChild.offsetWidth):0}if(this._pixelOffsetCache!==null){const s=this._pixelOffsetCache[i];if(s!==-1)return s;const o=this._actualReadPixelOffset(e,t,i,r);return this._pixelOffsetCache[i]=o,o}return this._actualReadPixelOffset(e,t,i,r)}_actualReadPixelOffset(e,t,i,r){if(this._characterMapping.length===0){const l=l5.readHorizontalRanges(this._getReadingTarget(e),0,0,0,0,r);return!l||l.length===0?-1:l[0].left}if(i===this._characterMapping.length&&this._isWhitespaceOnly&&this._containsForeignElements===0)return this.getWidth(r);const s=this._characterMapping.getDomPosition(i),o=l5.readHorizontalRanges(this._getReadingTarget(e),s.partIndex,s.charIndex,s.partIndex,s.charIndex,r);if(!o||o.length===0)return-1;const a=o[0].left;if(this.input.isBasicASCII){const l=this._characterMapping.getHorizontalOffset(i),c=Math.round(this.input.spaceWidth*l);if(Math.abs(c-a)<=1)return c}return a}_readRawVisibleRangesForRange(e,t,i,r){if(t===1&&i===this._characterMapping.length)return[new iw(0,this.getWidth(r))];const s=this._characterMapping.getDomPosition(t),o=this._characterMapping.getDomPosition(i);return l5.readHorizontalRanges(this._getReadingTarget(e),s.partIndex,s.charIndex,o.partIndex,o.charIndex,r)}getColumnOfNodeOffset(e,t){return Ace(this._characterMapping,e,t)}}class OIt extends r8e{_readVisibleRangesForRange(e,t,i,r,s){const o=super._readVisibleRangesForRange(e,t,i,r,s);if(!o||o.length===0||i===r||i===1&&r===this._characterMapping.length)return o;if(!this.input.containsRTL){const a=this._readPixelOffset(e,t,r,s);if(a!==-1){const l=o[o.length-1];l.left=4&&e[0]===3&&e[3]===8}static isStrictChildOfViewLines(e){return e.length>4&&e[0]===3&&e[3]===8}static isChildOfScrollableElement(e){return e.length>=2&&e[0]===3&&e[1]===6}static isChildOfMinimap(e){return e.length>=2&&e[0]===3&&e[1]===9}static isChildOfContentWidgets(e){return e.length>=4&&e[0]===3&&e[3]===1}static isChildOfOverflowGuard(e){return e.length>=1&&e[0]===3}static isChildOfOverflowingContentWidgets(e){return e.length>=1&&e[0]===2}static isChildOfOverlayWidgets(e){return e.length>=2&&e[0]===3&&e[1]===4}static isChildOfOverflowingOverlayWidgets(e){return e.length>=1&&e[0]===5}}class SE{constructor(e,t,i){this.viewModel=e.viewModel;const r=e.configuration.options;this.layoutInfo=r.get(146),this.viewDomNode=t.viewDomNode,this.lineHeight=r.get(67),this.stickyTabStops=r.get(117),this.typicalHalfwidthCharacterWidth=r.get(50).typicalHalfwidthCharacterWidth,this.lastRenderData=i,this._context=e,this._viewHelper=t}getZoneAtCoord(e){return SE.getZoneAtCoord(this._context,e)}static getZoneAtCoord(e,t){const i=e.viewLayout.getWhitespaceAtVerticalOffset(t);if(i){const r=i.verticalOffset+i.height/2,s=e.viewModel.getLineCount();let o=null,a,l=null;return i.afterLineNumber!==s&&(l=new he(i.afterLineNumber+1,1)),i.afterLineNumber>0&&(o=new he(i.afterLineNumber,e.viewModel.getLineMaxColumn(i.afterLineNumber))),l===null?a=o:o===null?a=l:t=e.layoutInfo.glyphMarginLeft,this.isInContentArea=!this.isInMarginArea,this.mouseColumn=Math.max(0,ll._getMouseColumn(this.mouseContentHorizontalOffset,e.typicalHalfwidthCharacterWidth))}}class WIt extends $It{get target(){return this._useHitTestTarget?this.hitTestResult.value.hitTarget:this._eventTarget}get targetPath(){return this._targetPathCacheElement!==this.target&&(this._targetPathCacheElement=this.target,this._targetPathCacheValue=Ig.collect(this.target,this._ctx.viewDomNode)),this._targetPathCacheValue}constructor(e,t,i,r,s){super(e,t,i,r),this.hitTestResult=new kg(()=>ll.doHitTest(this._ctx,this)),this._targetPathCacheElement=null,this._targetPathCacheValue=new Uint8Array(0),this._ctx=e,this._eventTarget=s;const o=!!this._eventTarget;this._useHitTestTarget=!o}toString(){return`pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset} +}`,i}dispose(){this._styleElementDisposables.dispose(),this._styleElement=void 0}increaseRefCount(){this._referenceCount++}decreaseRefCount(){this._referenceCount--}hasReferences(){return this._referenceCount>0}}function DIt(n){return n.replace(/(^[A-Z])/,([e])=>e.toLowerCase()).replace(/([A-Z])/g,([e])=>`-${e.toLowerCase()}`)}class _O extends me{constructor(){super(),this._shouldRender=!0}shouldRender(){return this._shouldRender}forceShouldRender(){this._shouldRender=!0}setShouldRender(){this._shouldRender=!0}onDidRender(){this._shouldRender=!1}onCompositionStart(e){return!1}onCompositionEnd(e){return!1}onConfigurationChanged(e){return!1}onCursorStateChanged(e){return!1}onDecorationsChanged(e){return!1}onFlushed(e){return!1}onFocusChanged(e){return!1}onLanguageConfigurationChanged(e){return!1}onLineMappingChanged(e){return!1}onLinesChanged(e){return!1}onLinesDeleted(e){return!1}onLinesInserted(e){return!1}onRevealRangeRequest(e){return!1}onScrollChanged(e){return!1}onThemeChanged(e){return!1}onTokensChanged(e){return!1}onTokensColorsChanged(e){return!1}onZonesChanged(e){return!1}handleEvents(e){let t=!1;for(let i=0,r=e.length;i=a.left?r.width=Math.max(r.width,a.left+a.width-r.left):(t[i++]=r,r=a)}return t[i++]=r,t}static _createHorizontalRangesFromClientRects(e,t,i){if(!e||e.length===0)return null;const r=[];for(let s=0,o=e.length;sl)return null;if(t=Math.min(l,Math.max(0,t)),r=Math.min(l,Math.max(0,r)),t===r&&i===s&&i===0&&!e.children[t].firstChild){const h=e.children[t].getClientRects();return o.markDidDomLayout(),this._createHorizontalRangesFromClientRects(h,o.clientRectDeltaLeft,o.clientRectScale)}t!==r&&r>0&&s===0&&(r--,s=1073741824);let c=e.children[t].firstChild,u=e.children[r].firstChild;if((!c||!u)&&(!c&&i===0&&t>0&&(c=e.children[t-1].firstChild,i=1073741824),!u&&s===0&&r>0&&(u=e.children[r-1].firstChild,s=1073741824)),!c||!u)return null;i=Math.min(c.textContent.length,Math.max(0,i)),s=Math.min(u.textContent.length,Math.max(0,s));const d=this._readClientRects(c,i,u,s,o.endNode);return o.markDidDomLayout(),this._createHorizontalRangesFromClientRects(d,o.clientRectDeltaLeft,o.clientRectScale)}}const PIt=function(){return hg?!0:!(zl||Xd||K_)}();let wk=!0;class lwe{constructor(e,t){this.themeType=t;const i=e.options,r=i.get(50);i.get(38)==="off"?this.renderWhitespace=i.get(100):this.renderWhitespace="none",this.renderControlCharacters=i.get(95),this.spaceWidth=r.spaceWidth,this.middotWidth=r.middotWidth,this.wsmiddotWidth=r.wsmiddotWidth,this.useMonospaceOptimizations=r.isMonospace&&!i.get(33),this.canUseHalfwidthRightwardsArrow=r.canUseHalfwidthRightwardsArrow,this.lineHeight=i.get(67),this.stopRenderingLineAfter=i.get(118),this.fontLigatures=i.get(51)}equals(e){return this.themeType===e.themeType&&this.renderWhitespace===e.renderWhitespace&&this.renderControlCharacters===e.renderControlCharacters&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.useMonospaceOptimizations===e.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter&&this.fontLigatures===e.fontLigatures}}class l_{static{this.CLASS_NAME="view-line"}constructor(e){this._options=e,this._isMaybeInvalid=!0,this._renderedViewLine=null}getDomNode(){return this._renderedViewLine&&this._renderedViewLine.domNode?this._renderedViewLine.domNode.domNode:null}setDomNode(e){if(this._renderedViewLine)this._renderedViewLine.domNode=Ci(e);else throw new Error("I have no rendered view line to set the dom node to...")}onContentChanged(){this._isMaybeInvalid=!0}onTokensChanged(){this._isMaybeInvalid=!0}onDecorationsChanged(){this._isMaybeInvalid=!0}onOptionsChanged(e){this._isMaybeInvalid=!0,this._options=e}onSelectionChanged(){return mg(this._options.themeType)||this._options.renderWhitespace==="selection"?(this._isMaybeInvalid=!0,!0):!1}renderLine(e,t,i,r,s){if(this._isMaybeInvalid===!1)return!1;this._isMaybeInvalid=!1;const o=r.getViewLineRenderingData(e),a=this._options,l=Ol.filter(o.inlineDecorations,e,o.minColumn,o.maxColumn);let c=null;if(mg(a.themeType)||this._options.renderWhitespace==="selection"){const f=r.selections;for(const g of f){if(g.endLineNumbere)continue;const p=g.startLineNumber===e?g.startColumn:o.minColumn,m=g.endLineNumber===e?g.endColumn:o.maxColumn;p');const d=mO(u,s);s.appendString("");let h=null;return wk&&PIt&&o.isBasicASCII&&a.useMonospaceOptimizations&&d.containsForeignElements===0&&(h=new Q4(this._renderedViewLine?this._renderedViewLine.domNode:null,u,d.characterMapping)),h||(h=s8e(this._renderedViewLine?this._renderedViewLine.domNode:null,u,d.characterMapping,d.containsRTL,d.containsForeignElements)),this._renderedViewLine=h,!0}layoutLine(e,t,i){this._renderedViewLine&&this._renderedViewLine.domNode&&(this._renderedViewLine.domNode.setTop(t),this._renderedViewLine.domNode.setHeight(i))}getWidth(e){return this._renderedViewLine?this._renderedViewLine.getWidth(e):0}getWidthIsFast(){return this._renderedViewLine?this._renderedViewLine.getWidthIsFast():!0}needsMonospaceFontCheck(){return this._renderedViewLine?this._renderedViewLine instanceof Q4:!1}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof Q4?this._renderedViewLine.monospaceAssumptionsAreValid():wk}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof Q4&&(this._renderedViewLine=this._renderedViewLine.toSlowRenderedLine())}getVisibleRangesForRange(e,t,i,r){if(!this._renderedViewLine)return null;t=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,t)),i=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,i));const s=this._renderedViewLine.input.stopRenderingLineAfter;if(s!==-1&&t>s+1&&i>s+1)return new awe(!0,[new iw(this.getWidth(r),0)]);s!==-1&&t>s+1&&(t=s+1),s!==-1&&i>s+1&&(i=s+1);const o=this._renderedViewLine.getVisibleRangesForRange(e,t,i,r);return o&&o.length>0?new awe(!1,o):null}getColumnOfNodeOffset(e,t){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(e,t):1}}class Q4{constructor(e,t,i){this._cachedWidth=-1,this.domNode=e,this.input=t;const r=Math.floor(t.lineContent.length/300);if(r>0){this._keyColumnPixelOffsetCache=new Float32Array(r);for(let s=0;s=2&&(console.warn("monospace assumptions have been violated, therefore disabling monospace optimizations!"),wk=!1)}return wk}toSlowRenderedLine(){return s8e(this.domNode,this.input,this._characterMapping,!1,0)}getVisibleRangesForRange(e,t,i,r){const s=this._getColumnPixelOffset(e,t,r),o=this._getColumnPixelOffset(e,i,r);return[new iw(s,o-s)]}_getColumnPixelOffset(e,t,i){if(t<=300){const c=this._characterMapping.getHorizontalOffset(t);return this._charWidth*c}const r=Math.floor((t-1)/300)-1,s=(r+1)*300+1;let o=-1;if(this._keyColumnPixelOffsetCache&&(o=this._keyColumnPixelOffsetCache[r],o===-1&&(o=this._actualReadPixelOffset(e,s,i),this._keyColumnPixelOffsetCache[r]=o)),o===-1){const c=this._characterMapping.getHorizontalOffset(t);return this._charWidth*c}const a=this._characterMapping.getHorizontalOffset(s),l=this._characterMapping.getHorizontalOffset(t);return o+this._charWidth*(l-a)}_getReadingTarget(e){return e.domNode.firstChild}_actualReadPixelOffset(e,t,i){if(!this.domNode)return-1;const r=this._characterMapping.getDomPosition(t),s=lF.readHorizontalRanges(this._getReadingTarget(this.domNode),r.partIndex,r.charIndex,r.partIndex,r.charIndex,i);return!s||s.length===0?-1:s[0].left}getColumnOfNodeOffset(e,t){return Ace(this._characterMapping,e,t)}}class r8e{constructor(e,t,i,r,s){if(this.domNode=e,this.input=t,this._characterMapping=i,this._isWhitespaceOnly=/^\s*$/.test(t.lineContent),this._containsForeignElements=s,this._cachedWidth=-1,this._pixelOffsetCache=null,!r||this._characterMapping.length===0){this._pixelOffsetCache=new Float32Array(Math.max(2,this._characterMapping.length+1));for(let o=0,a=this._characterMapping.length;o<=a;o++)this._pixelOffsetCache[o]=-1}}_getReadingTarget(e){return e.domNode.firstChild}getWidth(e){return this.domNode?(this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,e?.markDidDomLayout()),this._cachedWidth):0}getWidthIsFast(){return this._cachedWidth!==-1}getVisibleRangesForRange(e,t,i,r){if(!this.domNode)return null;if(this._pixelOffsetCache!==null){const s=this._readPixelOffset(this.domNode,e,t,r);if(s===-1)return null;const o=this._readPixelOffset(this.domNode,e,i,r);return o===-1?null:[new iw(s,o-s)]}return this._readVisibleRangesForRange(this.domNode,e,t,i,r)}_readVisibleRangesForRange(e,t,i,r,s){if(i===r){const o=this._readPixelOffset(e,t,i,s);return o===-1?null:[new iw(o,0)]}else return this._readRawVisibleRangesForRange(e,i,r,s)}_readPixelOffset(e,t,i,r){if(this._characterMapping.length===0){if(this._containsForeignElements===0||this._containsForeignElements===2)return 0;if(this._containsForeignElements===1)return this.getWidth(r);const s=this._getReadingTarget(e);return s.firstChild?(r.markDidDomLayout(),s.firstChild.offsetWidth):0}if(this._pixelOffsetCache!==null){const s=this._pixelOffsetCache[i];if(s!==-1)return s;const o=this._actualReadPixelOffset(e,t,i,r);return this._pixelOffsetCache[i]=o,o}return this._actualReadPixelOffset(e,t,i,r)}_actualReadPixelOffset(e,t,i,r){if(this._characterMapping.length===0){const l=lF.readHorizontalRanges(this._getReadingTarget(e),0,0,0,0,r);return!l||l.length===0?-1:l[0].left}if(i===this._characterMapping.length&&this._isWhitespaceOnly&&this._containsForeignElements===0)return this.getWidth(r);const s=this._characterMapping.getDomPosition(i),o=lF.readHorizontalRanges(this._getReadingTarget(e),s.partIndex,s.charIndex,s.partIndex,s.charIndex,r);if(!o||o.length===0)return-1;const a=o[0].left;if(this.input.isBasicASCII){const l=this._characterMapping.getHorizontalOffset(i),c=Math.round(this.input.spaceWidth*l);if(Math.abs(c-a)<=1)return c}return a}_readRawVisibleRangesForRange(e,t,i,r){if(t===1&&i===this._characterMapping.length)return[new iw(0,this.getWidth(r))];const s=this._characterMapping.getDomPosition(t),o=this._characterMapping.getDomPosition(i);return lF.readHorizontalRanges(this._getReadingTarget(e),s.partIndex,s.charIndex,o.partIndex,o.charIndex,r)}getColumnOfNodeOffset(e,t){return Ace(this._characterMapping,e,t)}}class OIt extends r8e{_readVisibleRangesForRange(e,t,i,r,s){const o=super._readVisibleRangesForRange(e,t,i,r,s);if(!o||o.length===0||i===r||i===1&&r===this._characterMapping.length)return o;if(!this.input.containsRTL){const a=this._readPixelOffset(e,t,r,s);if(a!==-1){const l=o[o.length-1];l.left=4&&e[0]===3&&e[3]===8}static isStrictChildOfViewLines(e){return e.length>4&&e[0]===3&&e[3]===8}static isChildOfScrollableElement(e){return e.length>=2&&e[0]===3&&e[1]===6}static isChildOfMinimap(e){return e.length>=2&&e[0]===3&&e[1]===9}static isChildOfContentWidgets(e){return e.length>=4&&e[0]===3&&e[3]===1}static isChildOfOverflowGuard(e){return e.length>=1&&e[0]===3}static isChildOfOverflowingContentWidgets(e){return e.length>=1&&e[0]===2}static isChildOfOverlayWidgets(e){return e.length>=2&&e[0]===3&&e[1]===4}static isChildOfOverflowingOverlayWidgets(e){return e.length>=1&&e[0]===5}}class SE{constructor(e,t,i){this.viewModel=e.viewModel;const r=e.configuration.options;this.layoutInfo=r.get(146),this.viewDomNode=t.viewDomNode,this.lineHeight=r.get(67),this.stickyTabStops=r.get(117),this.typicalHalfwidthCharacterWidth=r.get(50).typicalHalfwidthCharacterWidth,this.lastRenderData=i,this._context=e,this._viewHelper=t}getZoneAtCoord(e){return SE.getZoneAtCoord(this._context,e)}static getZoneAtCoord(e,t){const i=e.viewLayout.getWhitespaceAtVerticalOffset(t);if(i){const r=i.verticalOffset+i.height/2,s=e.viewModel.getLineCount();let o=null,a,l=null;return i.afterLineNumber!==s&&(l=new he(i.afterLineNumber+1,1)),i.afterLineNumber>0&&(o=new he(i.afterLineNumber,e.viewModel.getLineMaxColumn(i.afterLineNumber))),l===null?a=o:o===null?a=l:t=e.layoutInfo.glyphMarginLeft,this.isInContentArea=!this.isInMarginArea,this.mouseColumn=Math.max(0,ll._getMouseColumn(this.mouseContentHorizontalOffset,e.typicalHalfwidthCharacterWidth))}}class WIt extends $It{get target(){return this._useHitTestTarget?this.hitTestResult.value.hitTarget:this._eventTarget}get targetPath(){return this._targetPathCacheElement!==this.target&&(this._targetPathCacheElement=this.target,this._targetPathCacheValue=Ig.collect(this.target,this._ctx.viewDomNode)),this._targetPathCacheValue}constructor(e,t,i,r,s){super(e,t,i,r),this.hitTestResult=new kg(()=>ll.doHitTest(this._ctx,this)),this._targetPathCacheElement=null,this._targetPathCacheValue=new Uint8Array(0),this._ctx=e,this._eventTarget=s;const o=!!this._eventTarget;this._useHitTestTarget=!o}toString(){return`pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset} target: ${this.target?this.target.outerHTML:null}`}get wouldBenefitFromHitTestTargetSwitch(){return!this._useHitTestTarget&&this.hitTestResult.value.hitTarget!==null&&this.target!==this.hitTestResult.value.hitTarget}switchToHitTestTarget(){this._useHitTestTarget=!0}_getMouseColumn(e=null){return e&&e.columno.contentLeft+o.width)continue;const a=e.getVerticalOffsetForLineNumber(o.position.lineNumber);if(a<=s&&s<=a+o.height)return t.fulfillContentText(o.position,null,{mightBeForeignElement:!1,injectedText:null})}}return null}static _hitTestViewZone(e,t){const i=e.getZoneAtCoord(t.mouseVerticalOffset);if(i){const r=t.isInContentArea?8:5;return t.fulfillViewZone(r,i.position,i)}return null}static _hitTestTextArea(e,t){return kl.isTextArea(t.targetPath)?e.lastRenderData.lastTextareaPosition?t.fulfillContentText(e.lastRenderData.lastTextareaPosition,null,{mightBeForeignElement:!1,injectedText:null}):t.fulfillTextarea():null}static _hitTestMargin(e,t){if(t.isInMarginArea){const i=e.getFullLineRangeAtCoord(t.mouseVerticalOffset),r=i.range.getStartPosition();let s=Math.abs(t.relativePos.x);const o={isAfterLines:i.isAfterLines,glyphMarginLeft:e.layoutInfo.glyphMarginLeft,glyphMarginWidth:e.layoutInfo.glyphMarginWidth,lineNumbersWidth:e.layoutInfo.lineNumbersWidth,offsetX:s};if(s-=e.layoutInfo.glyphMarginLeft,s<=e.layoutInfo.glyphMarginWidth){const a=e.viewModel.coordinatesConverter.convertViewPositionToModelPosition(i.range.getStartPosition()),l=e.viewModel.glyphLanes.getLanesAtLine(a.lineNumber);return o.glyphMarginLane=l[Math.floor(s/e.lineHeight)],t.fulfillMargin(2,r,i.range,o)}return s-=e.layoutInfo.glyphMarginWidth,s<=e.layoutInfo.lineNumbersWidth?t.fulfillMargin(3,r,i.range,o):(s-=e.layoutInfo.lineNumbersWidth,t.fulfillMargin(4,r,i.range,o))}return null}static _hitTestViewLines(e,t){if(!kl.isChildOfViewLines(t.targetPath))return null;if(e.isInTopPadding(t.mouseVerticalOffset))return t.fulfillContentEmpty(new he(1,1),cwe);if(e.isAfterLines(t.mouseVerticalOffset)||e.isInBottomPadding(t.mouseVerticalOffset)){const r=e.viewModel.getLineCount(),s=e.viewModel.getLineMaxColumn(r);return t.fulfillContentEmpty(new he(r,s),cwe)}if(kl.isStrictChildOfViewLines(t.targetPath)){const r=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset);if(e.viewModel.getLineLength(r)===0){const o=e.getLineWidth(r),a=Cq(t.mouseContentHorizontalOffset-o);return t.fulfillContentEmpty(new he(r,1),a)}const s=e.getLineWidth(r);if(t.mouseContentHorizontalOffset>=s){const o=Cq(t.mouseContentHorizontalOffset-s),a=new he(r,e.viewModel.getLineMaxColumn(r));return t.fulfillContentEmpty(a,o)}}const i=t.hitTestResult.value;return i.type===1?ll.createMouseTargetFromHitTestPosition(e,t,i.spanNode,i.position,i.injectedText):t.wouldBenefitFromHitTestTargetSwitch?(t.switchToHitTestTarget(),this._createMouseTarget(e,t)):t.fulfillUnknown()}static _hitTestMinimap(e,t){if(kl.isChildOfMinimap(t.targetPath)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),r=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new he(i,r))}return null}static _hitTestScrollbarSlider(e,t){if(kl.isChildOfScrollableElement(t.targetPath)&&t.target&&t.target.nodeType===1){const i=t.target.className;if(i&&/\b(slider|scrollbar)\b/.test(i)){const r=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),s=e.viewModel.getLineMaxColumn(r);return t.fulfillScrollbar(new he(r,s))}}return null}static _hitTestScrollbar(e,t){if(kl.isChildOfScrollableElement(t.targetPath)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),r=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new he(i,r))}return null}getMouseColumn(e){const t=this._context.configuration.options,i=t.get(146),r=this._context.viewLayout.getCurrentScrollLeft()+e.x-i.contentLeft;return ll._getMouseColumn(r,t.get(50).typicalHalfwidthCharacterWidth)}static _getMouseColumn(e,t){return e<0?1:Math.round(e/t)+1}static createMouseTargetFromHitTestPosition(e,t,i,r,s){const o=r.lineNumber,a=r.column,l=e.getLineWidth(o);if(t.mouseContentHorizontalOffset>l){const _=Cq(t.mouseContentHorizontalOffset-l);return t.fulfillContentEmpty(r,_)}const c=e.visibleRangeForPosition(o,a);if(!c)return t.fulfillUnknown(r);const u=c.left;if(Math.abs(t.mouseContentHorizontalOffset-u)<1)return t.fulfillContentText(r,null,{mightBeForeignElement:!!s,injectedText:s});const d=[];if(d.push({offset:c.left,column:a}),a>1){const _=e.visibleRangeForPosition(o,a-1);_&&d.push({offset:_.left,column:a-1})}const h=e.viewModel.getLineMaxColumn(o);if(a_.offset-v.offset);const f=t.pos.toClientCoordinates(Ot(e.viewDomNode)),g=i.getBoundingClientRect(),p=g.left<=f.clientX&&f.clientX<=g.right;let m=null;for(let _=1;_s)){const a=Math.floor((r+s)/2);let l=t.pos.y+(a-t.mouseVerticalOffset);l<=t.editorPos.y&&(l=t.editorPos.y+1),l>=t.editorPos.y+t.editorPos.height&&(l=t.editorPos.y+t.editorPos.height-1);const c=new HW(t.pos.x,l),u=this._actualDoHitTestWithCaretRangeFromPoint(e,c.toClientCoordinates(Ot(e.viewDomNode)));if(u.type===1)return u}return this._actualDoHitTestWithCaretRangeFromPoint(e,t.pos.toClientCoordinates(Ot(e.viewDomNode)))}static _actualDoHitTestWithCaretRangeFromPoint(e,t){const i=Iw(e.viewDomNode);let r;if(i?typeof i.caretRangeFromPoint>"u"?r=HIt(i,t.clientX,t.clientY):r=i.caretRangeFromPoint(t.clientX,t.clientY):r=e.viewDomNode.ownerDocument.caretRangeFromPoint(t.clientX,t.clientY),!r||!r.startContainer)return new Q0;const s=r.startContainer;if(s.nodeType===s.TEXT_NODE){const o=s.parentNode,a=o?o.parentNode:null,l=a?a.parentNode:null;return(l&&l.nodeType===l.ELEMENT_NODE?l.className:null)===l_.CLASS_NAME?_y.createFromDOMInfo(e,o,r.startOffset):new Q0(s.parentNode)}else if(s.nodeType===s.ELEMENT_NODE){const o=s.parentNode,a=o?o.parentNode:null;return(a&&a.nodeType===a.ELEMENT_NODE?a.className:null)===l_.CLASS_NAME?_y.createFromDOMInfo(e,s,s.textContent.length):new Q0(s)}return new Q0}static _doHitTestWithCaretPositionFromPoint(e,t){const i=e.viewDomNode.ownerDocument.caretPositionFromPoint(t.clientX,t.clientY);if(i.offsetNode.nodeType===i.offsetNode.TEXT_NODE){const r=i.offsetNode.parentNode,s=r?r.parentNode:null,o=s?s.parentNode:null;return(o&&o.nodeType===o.ELEMENT_NODE?o.className:null)===l_.CLASS_NAME?_y.createFromDOMInfo(e,i.offsetNode.parentNode,i.offset):new Q0(i.offsetNode.parentNode)}if(i.offsetNode.nodeType===i.offsetNode.ELEMENT_NODE){const r=i.offsetNode.parentNode,s=r&&r.nodeType===r.ELEMENT_NODE?r.className:null,o=r?r.parentNode:null,a=o&&o.nodeType===o.ELEMENT_NODE?o.className:null;if(s===l_.CLASS_NAME){const l=i.offsetNode.childNodes[Math.min(i.offset,i.offsetNode.childNodes.length-1)];if(l)return _y.createFromDOMInfo(e,l,0)}else if(a===l_.CLASS_NAME)return _y.createFromDOMInfo(e,i.offsetNode,0)}return new Q0(i.offsetNode)}static _snapToSoftTabBoundary(e,t){const i=t.getLineContent(e.lineNumber),{tabSize:r}=t.model.getOptions(),s=UN.atomicPosition(i,e.column-1,r,2);return s!==-1?new he(e.lineNumber,s+1):e}static doHitTest(e,t){let i=new Q0;if(typeof e.viewDomNode.ownerDocument.caretRangeFromPoint=="function"?i=this._doHitTestWithCaretRangeFromPoint(e,t):e.viewDomNode.ownerDocument.caretPositionFromPoint&&(i=this._doHitTestWithCaretPositionFromPoint(e,t.pos.toClientCoordinates(Ot(e.viewDomNode)))),i.type===1){const r=e.viewModel.getInjectedTextAt(i.position),s=e.viewModel.normalizePosition(i.position,2);(r||!s.equals(i.position))&&(i=new o8e(s,i.spanNode,r))}return i}}function HIt(n,e,t){const i=document.createRange();let r=n.elementFromPoint(e,t);if(r!==null){for(;r&&r.firstChild&&r.firstChild.nodeType!==r.firstChild.TEXT_NODE&&r.lastChild&&r.lastChild.firstChild;)r=r.lastChild;const s=r.getBoundingClientRect(),o=Ot(r),a=o.getComputedStyle(r,null).getPropertyValue("font-style"),l=o.getComputedStyle(r,null).getPropertyValue("font-variant"),c=o.getComputedStyle(r,null).getPropertyValue("font-weight"),u=o.getComputedStyle(r,null).getPropertyValue("font-size"),d=o.getComputedStyle(r,null).getPropertyValue("line-height"),h=o.getComputedStyle(r,null).getPropertyValue("font-family"),f=`${a} ${l} ${c} ${u}/${d} ${h}`,g=r.innerText;let p=s.left,m=0,_;if(e>s.left+s.width)m=g.length;else{const v=IS.getInstance();for(let y=0;ythis._createMouseTarget(o,a),o=>this._getMouseColumn(o))),this.lastMouseLeaveTime=-1,this._height=this._context.configuration.options.get(146).height;const r=new kIt(this.viewHelper.viewDomNode);this._register(r.onContextMenu(this.viewHelper.viewDomNode,o=>this._onContextMenu(o,!0))),this._register(r.onMouseMove(this.viewHelper.viewDomNode,o=>{this._onMouseMove(o),this._mouseLeaveMonitor||(this._mouseLeaveMonitor=Ce(this.viewHelper.viewDomNode.ownerDocument,"mousemove",a=>{this.viewHelper.viewDomNode.contains(a.target)||this._onMouseLeave(new Nb(a,!1,this.viewHelper.viewDomNode))}))})),this._register(r.onMouseUp(this.viewHelper.viewDomNode,o=>this._onMouseUp(o))),this._register(r.onMouseLeave(this.viewHelper.viewDomNode,o=>this._onMouseLeave(o)));let s=0;this._register(r.onPointerDown(this.viewHelper.viewDomNode,(o,a)=>{s=a})),this._register(Ce(this.viewHelper.viewDomNode,je.POINTER_UP,o=>{this._mouseDownOperation.onPointerUp()})),this._register(r.onMouseDown(this.viewHelper.viewDomNode,o=>this._onMouseDown(o,s))),this._setupMouseWheelZoomListener(),this._context.addEventHandler(this)}_setupMouseWheelZoomListener(){const e=hW.INSTANCE;let t=0,i=Pd.getZoomLevel(),r=!1,s=0;const o=l=>{if(this.viewController.emitMouseWheel(l),!this._context.configuration.options.get(76))return;const c=new Dw(l);if(e.acceptStandardWheelEvent(c),e.isPhysicalMouseWheel()){if(a(l)){const u=Pd.getZoomLevel(),d=c.deltaY>0?1:-1;Pd.setZoomLevel(u+d),c.preventDefault(),c.stopPropagation()}}else Date.now()-t>50&&(i=Pd.getZoomLevel(),r=a(l),s=0),t=Date.now(),s+=c.deltaY,r&&(Pd.setZoomLevel(i+s/5),c.preventDefault(),c.stopPropagation())};this._register(Ce(this.viewHelper.viewDomNode,je.MOUSE_WHEEL,o,{capture:!0,passive:!1}));function a(l){return Rn?(l.metaKey||l.ctrlKey)&&!l.shiftKey&&!l.altKey:l.ctrlKey&&!l.metaKey&&!l.shiftKey&&!l.altKey}}dispose(){this._context.removeEventHandler(this),this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),super.dispose()}onConfigurationChanged(e){if(e.hasChanged(146)){const t=this._context.configuration.options.get(146).height;this._height!==t&&(this._height=t,this._mouseDownOperation.onHeightChanged())}return!1}onCursorStateChanged(e){return this._mouseDownOperation.onCursorStateChanged(e),!1}onFocusChanged(e){return!1}getTargetAtClientPoint(e,t){const r=new i8e(e,t).toPageCoordinates(Ot(this.viewHelper.viewDomNode)),s=Dce(this.viewHelper.viewDomNode);if(r.ys.y+s.height||r.xs.x+s.width)return null;const o=Ice(this.viewHelper.viewDomNode,s,r);return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),s,r,o,null)}_createMouseTarget(e,t){let i=e.target;if(!this.viewHelper.viewDomNode.contains(i)){const r=Iw(this.viewHelper.viewDomNode);r&&(i=r.elementsFromPoint(e.posx,e.posy).find(s=>this.viewHelper.viewDomNode.contains(s)))}return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),e.editorPos,e.pos,e.relativePos,t?i:null)}_getMouseColumn(e){return this.mouseTargetFactory.getMouseColumn(e.relativePos)}_onContextMenu(e,t){this.viewController.emitContextMenu({event:e,target:this._createMouseTarget(e,t)})}_onMouseMove(e){this.mouseTargetFactory.mouseTargetIsWidget(e)||e.preventDefault(),!(this._mouseDownOperation.isActive()||e.timestamp{e.preventDefault(),this.viewHelper.focusTextArea()};if(u&&(r||o&&a))d(),this._mouseDownOperation.start(i.type,e,t);else if(s)e.preventDefault();else if(l){const h=i.detail;u&&this.viewHelper.shouldSuppressMouseDownOnViewZone(h.viewZoneId)&&(d(),this._mouseDownOperation.start(i.type,e,t),e.preventDefault())}else c&&this.viewHelper.shouldSuppressMouseDownOnWidget(i.detail)&&(d(),e.preventDefault());this.viewController.emitMouseDown({event:e,target:i})}}class VIt extends me{constructor(e,t,i,r,s,o){super(),this._context=e,this._viewController=t,this._viewHelper=i,this._mouseTargetFactory=r,this._createMouseTarget=s,this._getMouseColumn=o,this._mouseMoveMonitor=this._register(new LIt(this._viewHelper.viewDomNode)),this._topBottomDragScrolling=this._register(new zIt(this._context,this._viewHelper,this._mouseTargetFactory,(a,l,c)=>this._dispatchMouse(a,l,c))),this._mouseState=new Rce,this._currentSelection=new yt(1,1,1,1),this._isActive=!1,this._lastMouseEvent=null}dispose(){super.dispose()}isActive(){return this._isActive}_onMouseDownThenMove(e){this._lastMouseEvent=e,this._mouseState.setModifiers(e);const t=this._findMousePosition(e,!1);t&&(this._mouseState.isDragAndDrop?this._viewController.emitMouseDrag({event:e,target:t}):t.type===13&&(t.outsidePosition==="above"||t.outsidePosition==="below")?this._topBottomDragScrolling.start(t,e):(this._topBottomDragScrolling.stop(),this._dispatchMouse(t,!0,1)))}start(e,t,i){this._lastMouseEvent=t,this._mouseState.setStartedOnLineNumbers(e===3),this._mouseState.setStartButtons(t),this._mouseState.setModifiers(t);const r=this._findMousePosition(t,!0);if(!r||!r.position)return;this._mouseState.trySetCount(t.detail,r.position),t.detail=this._mouseState.count;const s=this._context.configuration.options;if(!s.get(92)&&s.get(35)&&!s.get(22)&&!this._mouseState.altKey&&t.detail<2&&!this._isActive&&!this._currentSelection.isEmpty()&&r.type===6&&r.position&&this._currentSelection.containsPosition(r.position)){this._mouseState.isDragAndDrop=!0,this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,i,t.buttons,o=>this._onMouseDownThenMove(o),o=>{const a=this._findMousePosition(this._lastMouseEvent,!1);Jm(o)?this._viewController.emitMouseDropCanceled():this._viewController.emitMouseDrop({event:this._lastMouseEvent,target:a?this._createMouseTarget(this._lastMouseEvent,!0):null}),this._stop()});return}this._mouseState.isDragAndDrop=!1,this._dispatchMouse(r,t.shiftKey,1),this._isActive||(this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,i,t.buttons,o=>this._onMouseDownThenMove(o),()=>this._stop()))}_stop(){this._isActive=!1,this._topBottomDragScrolling.stop()}onHeightChanged(){this._mouseMoveMonitor.stopMonitoring()}onPointerUp(){this._mouseMoveMonitor.stopMonitoring()}onCursorStateChanged(e){this._currentSelection=e.selections[0]}_getPositionOutsideEditor(e){const t=e.editorPos,i=this._context.viewModel,r=this._context.viewLayout,s=this._getMouseColumn(e);if(e.posyt.y+t.height){const a=e.posy-t.y-t.height,l=r.getCurrentScrollTop()+e.relativePos.y,c=SE.getZoneAtCoord(this._context,l);if(c){const d=this._helpPositionJumpOverViewZone(c);if(d)return cl.createOutsideEditor(s,d,"below",a)}const u=r.getLineNumberAtVerticalOffset(l);return cl.createOutsideEditor(s,new he(u,i.getLineMaxColumn(u)),"below",a)}const o=r.getLineNumberAtVerticalOffset(r.getCurrentScrollTop()+e.relativePos.y);if(e.posxt.x+t.width){const a=e.posx-t.x-t.width;return cl.createOutsideEditor(s,new he(o,i.getLineMaxColumn(o)),"right",a)}return null}_findMousePosition(e,t){const i=this._getPositionOutsideEditor(e);if(i)return i;const r=this._createMouseTarget(e,t);if(!r.position)return null;if(r.type===8||r.type===5){const o=this._helpPositionJumpOverViewZone(r.detail);if(o)return cl.createViewZone(r.type,r.element,r.mouseColumn,o,r.detail)}return r}_helpPositionJumpOverViewZone(e){const t=new he(this._currentSelection.selectionStartLineNumber,this._currentSelection.selectionStartColumn),i=e.positionBefore,r=e.positionAfter;return i&&r?i.isBefore(t)?i:r:null}_dispatchMouse(e,t,i){e.position&&this._viewController.dispatchMouse({position:e.position,mouseColumn:e.mouseColumn,startedOnLineNumbers:this._mouseState.startedOnLineNumbers,revealType:i,inSelectionMode:t,mouseDownCount:this._mouseState.count,altKey:this._mouseState.altKey,ctrlKey:this._mouseState.ctrlKey,metaKey:this._mouseState.metaKey,shiftKey:this._mouseState.shiftKey,leftButton:this._mouseState.leftButton,middleButton:this._mouseState.middleButton,onInjectedText:e.type===6&&e.detail.injectedText!==null})}}class zIt extends me{constructor(e,t,i,r){super(),this._context=e,this._viewHelper=t,this._mouseTargetFactory=i,this._dispatchMouse=r,this._operation=null}dispose(){super.dispose(),this.stop()}start(e,t){this._operation?this._operation.setPosition(e,t):this._operation=new UIt(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,e,t)}stop(){this._operation&&(this._operation.dispose(),this._operation=null)}}class UIt extends me{constructor(e,t,i,r,s,o){super(),this._context=e,this._viewHelper=t,this._mouseTargetFactory=i,this._dispatchMouse=r,this._position=s,this._mouseEvent=o,this._lastTime=Date.now(),this._animationFrameDisposable=du(Ot(o.browserEvent),()=>this._execute())}dispose(){this._animationFrameDisposable.dispose(),super.dispose()}setPosition(e,t){this._position=e,this._mouseEvent=t}_tick(){const e=Date.now(),t=e-this._lastTime;return this._lastTime=e,t}_getScrollSpeed(){const e=this._context.configuration.options.get(67),t=this._context.configuration.options.get(146).height/e,i=this._position.outsideDistance/e;return i<=1.5?Math.max(30,t*(1+i)):i<=3?Math.max(60,t*(2+i)):Math.max(200,t*(7+i))}_execute(){const e=this._context.configuration.options.get(67),t=this._getScrollSpeed(),i=this._tick(),r=t*(i/1e3)*e,s=this._position.outsidePosition==="above"?-r:r;this._context.viewModel.viewLayout.deltaScrollNow(0,s),this._viewHelper.renderNow();const o=this._context.viewLayout.getLinesViewportData(),a=this._position.outsidePosition==="above"?o.startLineNumber:o.endLineNumber;let l;{const c=Dce(this._viewHelper.viewDomNode),u=this._context.configuration.options.get(146).horizontalScrollbarHeight,d=new HW(this._mouseEvent.pos.x,c.y+c.height-u-.1),h=Ice(this._viewHelper.viewDomNode,c,d);l=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),c,d,h,null)}(!l.position||l.position.lineNumber!==a)&&(this._position.outsidePosition==="above"?l=cl.createOutsideEditor(this._position.mouseColumn,new he(a,1),"above",this._position.outsideDistance):l=cl.createOutsideEditor(this._position.mouseColumn,new he(a,this._context.viewModel.getLineMaxColumn(a)),"below",this._position.outsideDistance)),this._dispatchMouse(l,!0,2),this._animationFrameDisposable=du(Ot(l.element),()=>this._execute())}}class Rce{static{this.CLEAR_MOUSE_DOWN_COUNT_TIME=400}get altKey(){return this._altKey}get ctrlKey(){return this._ctrlKey}get metaKey(){return this._metaKey}get shiftKey(){return this._shiftKey}get leftButton(){return this._leftButton}get middleButton(){return this._middleButton}get startedOnLineNumbers(){return this._startedOnLineNumbers}constructor(){this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._leftButton=!1,this._middleButton=!1,this._startedOnLineNumbers=!1,this._lastMouseDownPosition=null,this._lastMouseDownPositionEqualCount=0,this._lastMouseDownCount=0,this._lastSetMouseDownCountTime=0,this.isDragAndDrop=!1}get count(){return this._lastMouseDownCount}setModifiers(e){this._altKey=e.altKey,this._ctrlKey=e.ctrlKey,this._metaKey=e.metaKey,this._shiftKey=e.shiftKey}setStartButtons(e){this._leftButton=e.leftButton,this._middleButton=e.middleButton}setStartedOnLineNumbers(e){this._startedOnLineNumbers=e}trySetCount(e,t){const i=new Date().getTime();i-this._lastSetMouseDownCountTime>Rce.CLEAR_MOUSE_DOWN_COUNT_TIME&&(e=1),this._lastSetMouseDownCountTime=i,e>this._lastMouseDownCount+1&&(e=this._lastMouseDownCount+1),this._lastMouseDownPosition&&this._lastMouseDownPosition.equals(t)?this._lastMouseDownPositionEqualCount++:this._lastMouseDownPositionEqualCount=1,this._lastMouseDownPosition=t,this._lastMouseDownCount=Math.min(e,this._lastMouseDownPositionEqualCount)}}class wa{static{this.EMPTY=new wa("",0,0,null,void 0)}constructor(e,t,i,r,s){this.value=e,this.selectionStart=t,this.selectionEnd=i,this.selection=r,this.newlineCountBeforeSelection=s}toString(){return`[ <${this.value}>, selectionStart: ${this.selectionStart}, selectionEnd: ${this.selectionEnd}]`}static readFromTextArea(e,t){const i=e.getValue(),r=e.getSelectionStart(),s=e.getSelectionEnd();let o;if(t){const a=i.substring(0,r),l=t.value.substring(0,t.selectionStart);a===l&&(o=t.newlineCountBeforeSelection)}return new wa(i,r,s,null,o)}collapseSelection(){return this.selectionStart===this.value.length?this:new wa(this.value,this.value.length,this.value.length,null,void 0)}writeToTextArea(e,t,i){t.setValue(e,this.value),i&&t.setSelectionRange(e,this.selectionStart,this.selectionEnd)}deduceEditorPosition(e){if(e<=this.selectionStart){const r=this.value.substring(e,this.selectionStart);return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,r,-1)}if(e>=this.selectionEnd){const r=this.value.substring(this.selectionEnd,e);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,r,1)}const t=this.value.substring(this.selectionStart,e);if(t.indexOf("…")===-1)return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,t,1);const i=this.value.substring(e,this.selectionEnd);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,i,-1)}_finishDeduceEditorPosition(e,t,i){let r=0,s=-1;for(;(s=t.indexOf(` `,s+1))!==-1;)r++;return[e,i*t.length,r]}static deduceInput(e,t,i){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};const r=Math.min(Cb(e.value,t.value),e.selectionStart,t.selectionStart),s=Math.min(V6(e.value,t.value),e.value.length-e.selectionEnd,t.value.length-t.selectionEnd);e.value.substring(r,e.value.length-s);const o=t.value.substring(r,t.value.length-s),a=e.selectionStart-r,l=e.selectionEnd-r,c=t.selectionStart-r,u=t.selectionEnd-r;if(c===u){const h=e.selectionStart-r;return{text:o,replacePrevCharCnt:h,replaceNextCharCnt:0,positionDelta:0}}const d=l-a;return{text:o,replacePrevCharCnt:d,replaceNextCharCnt:0,positionDelta:0}}static deduceAndroidCompositionInput(e,t){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};if(e.value===t.value)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:t.selectionEnd-e.selectionEnd};const i=Math.min(Cb(e.value,t.value),e.selectionEnd),r=Math.min(V6(e.value,t.value),e.value.length-e.selectionEnd),s=e.value.substring(i,e.value.length-r),o=t.value.substring(i,t.value.length-r);e.selectionStart-i;const a=e.selectionEnd-i;t.selectionStart-i;const l=t.selectionEnd-i;return{text:o,replacePrevCharCnt:a,replaceNextCharCnt:s.length-a,positionDelta:l-o.length}}}class AS{static _getPageOfLine(e,t){return Math.floor((e-1)/t)}static _getRangeForPage(e,t){const i=e*t,r=i+1,s=i+t;return new $(r,1,s+1,1)}static fromEditorSelection(e,t,i,r){const o=AS._getPageOfLine(t.startLineNumber,i),a=AS._getRangeForPage(o,i),l=AS._getPageOfLine(t.endLineNumber,i),c=AS._getRangeForPage(l,i);let u=a.intersectRanges(new $(1,1,t.startLineNumber,t.startColumn));if(r&&e.getValueLengthInRange(u,1)>500){const _=e.modifyPosition(u.getEndPosition(),-500);u=$.fromPositions(_,u.getEndPosition())}const d=e.getValueInRange(u,1),h=e.getLineCount(),f=e.getLineMaxColumn(h);let g=c.intersectRanges(new $(t.endLineNumber,t.endColumn,h,f));if(r&&e.getValueLengthInRange(g,1)>500){const _=e.modifyPosition(g.getStartPosition(),500);g=$.fromPositions(g.getStartPosition(),_)}const p=e.getValueInRange(g,1);let m;if(o===l||o+1===l)m=e.getValueInRange(t,1);else{const _=a.intersectRanges(t),v=c.intersectRanges(t);m=e.getValueInRange(_,1)+"…"+e.getValueInRange(v,1)}return r&&m.length>2*500&&(m=m.substring(0,500)+"…"+m.substring(m.length-500,m.length)),new wa(d+m+p,d.length,d.length+m.length,t,u.endLineNumber-u.startLineNumber)}}var jIt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},uwe=function(n,e){return function(t,i){e(t,i,n)}},u9;(function(n){n.Tap="-monaco-textarea-synthetic-tap"})(u9||(u9={}));const DJ={forceCopyWithSyntaxHighlighting:!1};class jN{static{this.INSTANCE=new jN}constructor(){this._lastState=null}set(e,t){this._lastState={lastCopiedValue:e,data:t}}get(e){return this._lastState&&this._lastState.lastCopiedValue===e?this._lastState.data:(this._lastState=null,null)}}class qIt{constructor(){this._lastTypeTextLength=0}handleCompositionUpdate(e){e=e||"";const t={text:e,replacePrevCharCnt:this._lastTypeTextLength,replaceNextCharCnt:0,positionDelta:0};return this._lastTypeTextLength=e.length,t}}let IJ=class extends me{get textAreaState(){return this._textAreaState}constructor(e,t,i,r,s,o){super(),this._host=e,this._textArea=t,this._OS=i,this._browser=r,this._accessibilityService=s,this._logService=o,this._onFocus=this._register(new fe),this.onFocus=this._onFocus.event,this._onBlur=this._register(new fe),this.onBlur=this._onBlur.event,this._onKeyDown=this._register(new fe),this.onKeyDown=this._onKeyDown.event,this._onKeyUp=this._register(new fe),this.onKeyUp=this._onKeyUp.event,this._onCut=this._register(new fe),this.onCut=this._onCut.event,this._onPaste=this._register(new fe),this.onPaste=this._onPaste.event,this._onType=this._register(new fe),this.onType=this._onType.event,this._onCompositionStart=this._register(new fe),this.onCompositionStart=this._onCompositionStart.event,this._onCompositionUpdate=this._register(new fe),this.onCompositionUpdate=this._onCompositionUpdate.event,this._onCompositionEnd=this._register(new fe),this.onCompositionEnd=this._onCompositionEnd.event,this._onSelectionChangeRequest=this._register(new fe),this.onSelectionChangeRequest=this._onSelectionChangeRequest.event,this._asyncFocusGainWriteScreenReaderContent=this._register(new To),this._asyncTriggerCut=this._register(new Ui(()=>this._onCut.fire(),0)),this._textAreaState=wa.EMPTY,this._selectionChangeListener=null,this._accessibilityService.isScreenReaderOptimized()&&this.writeNativeTextAreaContent("ctor"),this._register(Ge.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized,()=>{this._accessibilityService.isScreenReaderOptimized()&&!this._asyncFocusGainWriteScreenReaderContent.value?this._asyncFocusGainWriteScreenReaderContent.value=this._register(new Ui(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0)):this._asyncFocusGainWriteScreenReaderContent.clear()})),this._hasFocus=!1,this._currentComposition=null;let a=null;this._register(this._textArea.onKeyDown(l=>{const c=new or(l);(c.keyCode===114||this._currentComposition&&c.keyCode===1)&&c.stopPropagation(),c.equals(9)&&c.preventDefault(),a=c,this._onKeyDown.fire(c)})),this._register(this._textArea.onKeyUp(l=>{const c=new or(l);this._onKeyUp.fire(c)})),this._register(this._textArea.onCompositionStart(l=>{const c=new qIt;if(this._currentComposition){this._currentComposition=c;return}if(this._currentComposition=c,this._OS===2&&a&&a.equals(114)&&this._textAreaState.selectionStart===this._textAreaState.selectionEnd&&this._textAreaState.selectionStart>0&&this._textAreaState.value.substr(this._textAreaState.selectionStart-1,1)===l.data&&(a.code==="ArrowRight"||a.code==="ArrowLeft")){c.handleCompositionUpdate("x"),this._onCompositionStart.fire({data:l.data});return}if(this._browser.isAndroid){this._onCompositionStart.fire({data:l.data});return}this._onCompositionStart.fire({data:l.data})})),this._register(this._textArea.onCompositionUpdate(l=>{const c=this._currentComposition;if(!c)return;if(this._browser.isAndroid){const d=wa.readFromTextArea(this._textArea,this._textAreaState),h=wa.deduceAndroidCompositionInput(this._textAreaState,d);this._textAreaState=d,this._onType.fire(h),this._onCompositionUpdate.fire(l);return}const u=c.handleCompositionUpdate(l.data);this._textAreaState=wa.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(u),this._onCompositionUpdate.fire(l)})),this._register(this._textArea.onCompositionEnd(l=>{const c=this._currentComposition;if(!c)return;if(this._currentComposition=null,this._browser.isAndroid){const d=wa.readFromTextArea(this._textArea,this._textAreaState),h=wa.deduceAndroidCompositionInput(this._textAreaState,d);this._textAreaState=d,this._onType.fire(h),this._onCompositionEnd.fire();return}const u=c.handleCompositionUpdate(l.data);this._textAreaState=wa.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(u),this._onCompositionEnd.fire()})),this._register(this._textArea.onInput(l=>{if(this._textArea.setIgnoreSelectionChangeTime("received input event"),this._currentComposition)return;const c=wa.readFromTextArea(this._textArea,this._textAreaState),u=wa.deduceInput(this._textAreaState,c,this._OS===2);u.replacePrevCharCnt===0&&u.text.length===1&&(Co(u.text.charCodeAt(0))||u.text.charCodeAt(0)===127)||(this._textAreaState=c,(u.text!==""||u.replacePrevCharCnt!==0||u.replaceNextCharCnt!==0||u.positionDelta!==0)&&this._onType.fire(u))})),this._register(this._textArea.onCut(l=>{this._textArea.setIgnoreSelectionChangeTime("received cut event"),this._ensureClipboardGetsEditorSelection(l),this._asyncTriggerCut.schedule()})),this._register(this._textArea.onCopy(l=>{this._ensureClipboardGetsEditorSelection(l)})),this._register(this._textArea.onPaste(l=>{if(this._textArea.setIgnoreSelectionChangeTime("received paste event"),l.preventDefault(),!l.clipboardData)return;let[c,u]=AJ.getTextData(l.clipboardData);c&&(u=u||jN.INSTANCE.get(c),this._onPaste.fire({text:c,metadata:u}))})),this._register(this._textArea.onFocus(()=>{const l=this._hasFocus;this._setHasFocus(!0),this._accessibilityService.isScreenReaderOptimized()&&this._browser.isSafari&&!l&&this._hasFocus&&(this._asyncFocusGainWriteScreenReaderContent.value||(this._asyncFocusGainWriteScreenReaderContent.value=new Ui(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0)),this._asyncFocusGainWriteScreenReaderContent.value.schedule())})),this._register(this._textArea.onBlur(()=>{this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("blurWithoutCompositionEnd"),this._onCompositionEnd.fire()),this._setHasFocus(!1)})),this._register(this._textArea.onSyntheticTap(()=>{this._browser.isAndroid&&this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("tapWithoutCompositionEnd"),this._onCompositionEnd.fire())}))}_installSelectionChangeListener(){let e=0;return Ce(this._textArea.ownerDocument,"selectionchange",t=>{if(Mv.onSelectionChange(),!this._hasFocus||this._currentComposition||!this._browser.isChrome)return;const i=Date.now(),r=i-e;if(e=i,r<5)return;const s=i-this._textArea.getIgnoreSelectionChangeTime();if(this._textArea.resetSelectionChangeTime(),s<100||!this._textAreaState.selection)return;const o=this._textArea.getValue();if(this._textAreaState.value!==o)return;const a=this._textArea.getSelectionStart(),l=this._textArea.getSelectionEnd();if(this._textAreaState.selectionStart===a&&this._textAreaState.selectionEnd===l)return;const c=this._textAreaState.deduceEditorPosition(a),u=this._host.deduceModelPosition(c[0],c[1],c[2]),d=this._textAreaState.deduceEditorPosition(l),h=this._host.deduceModelPosition(d[0],d[1],d[2]),f=new yt(u.lineNumber,u.column,h.lineNumber,h.column);this._onSelectionChangeRequest.fire(f)})}dispose(){super.dispose(),this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null)}focusTextArea(){this._setHasFocus(!0),this.refreshFocusState()}isFocused(){return this._hasFocus}refreshFocusState(){this._setHasFocus(this._textArea.hasFocus())}_setHasFocus(e){this._hasFocus!==e&&(this._hasFocus=e,this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null),this._hasFocus&&(this._selectionChangeListener=this._installSelectionChangeListener()),this._hasFocus&&this.writeNativeTextAreaContent("focusgain"),this._hasFocus?this._onFocus.fire():this._onBlur.fire())}_setAndWriteTextAreaState(e,t){this._hasFocus||(t=t.collapseSelection()),t.writeToTextArea(e,this._textArea,this._hasFocus),this._textAreaState=t}writeNativeTextAreaContent(e){!this._accessibilityService.isScreenReaderOptimized()&&e==="render"||this._currentComposition||(this._logService.trace(`writeTextAreaState(reason: ${e})`),this._setAndWriteTextAreaState(e,this._host.getScreenReaderContent()))}_ensureClipboardGetsEditorSelection(e){const t=this._host.getDataToCopy(),i={version:1,isFromEmptySelection:t.isFromEmptySelection,multicursorText:t.multicursorText,mode:t.mode};jN.INSTANCE.set(this._browser.isFirefox?t.text.replace(/\r\n/g,` `):t.text,i),e.preventDefault(),e.clipboardData&&AJ.setTextData(e.clipboardData,t.text,t.html,i)}};IJ=jIt([uwe(4,_u),uwe(5,Da)],IJ);const AJ={getTextData(n){const e=n.getData(ps.text);let t=null;const i=n.getData("vscode-editor-data");if(typeof i=="string")try{t=JSON.parse(i),t.version!==1&&(t=null)}catch{}return e.length===0&&t===null&&n.files.length>0?[Array.prototype.slice.call(n.files,0).map(s=>s.name).join(` `),null]:[e,t]},setTextData(n,e,t,i){n.setData(ps.text,e),typeof t=="string"&&n.setData("text/html",t),n.setData("vscode-editor-data",JSON.stringify(i))}};class KIt extends me{get ownerDocument(){return this._actual.ownerDocument}constructor(e){super(),this._actual=e,this.onKeyDown=this._register(new $n(this._actual,"keydown")).event,this.onKeyUp=this._register(new $n(this._actual,"keyup")).event,this.onCompositionStart=this._register(new $n(this._actual,"compositionstart")).event,this.onCompositionUpdate=this._register(new $n(this._actual,"compositionupdate")).event,this.onCompositionEnd=this._register(new $n(this._actual,"compositionend")).event,this.onBeforeInput=this._register(new $n(this._actual,"beforeinput")).event,this.onInput=this._register(new $n(this._actual,"input")).event,this.onCut=this._register(new $n(this._actual,"cut")).event,this.onCopy=this._register(new $n(this._actual,"copy")).event,this.onPaste=this._register(new $n(this._actual,"paste")).event,this.onFocus=this._register(new $n(this._actual,"focus")).event,this.onBlur=this._register(new $n(this._actual,"blur")).event,this._onSyntheticTap=this._register(new fe),this.onSyntheticTap=this._onSyntheticTap.event,this._ignoreSelectionChangeTime=0,this._register(this.onKeyDown(()=>Mv.onKeyDown())),this._register(this.onBeforeInput(()=>Mv.onBeforeInput())),this._register(this.onInput(()=>Mv.onInput())),this._register(this.onKeyUp(()=>Mv.onKeyUp())),this._register(Ce(this._actual,u9.Tap,()=>this._onSyntheticTap.fire()))}hasFocus(){const e=Iw(this._actual);return e?e.activeElement===this._actual:this._actual.isConnected?ka()===this._actual:!1}setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}getIgnoreSelectionChangeTime(){return this._ignoreSelectionChangeTime}resetSelectionChangeTime(){this._ignoreSelectionChangeTime=0}getValue(){return this._actual.value}setValue(e,t){const i=this._actual;i.value!==t&&(this.setIgnoreSelectionChangeTime("setValue"),i.value=t)}getSelectionStart(){return this._actual.selectionDirection==="backward"?this._actual.selectionEnd:this._actual.selectionStart}getSelectionEnd(){return this._actual.selectionDirection==="backward"?this._actual.selectionStart:this._actual.selectionEnd}setSelectionRange(e,t,i){const r=this._actual;let s=null;const o=Iw(r);o?s=o.activeElement:s=ka();const a=Ot(s),l=s===r,c=r.selectionStart,u=r.selectionEnd;if(l&&c===t&&u===i){Xd&&a.parent!==a&&r.focus();return}if(l){this.setIgnoreSelectionChangeTime("setSelectionRange"),r.setSelectionRange(t,i),Xd&&a.parent!==a&&r.focus();return}try{const d=L0t(r);this.setIgnoreSelectionChangeTime("setSelectionRange"),r.focus(),r.setSelectionRange(t,i),T0t(r,d)}catch{}}}class GIt extends Nce{constructor(e,t,i){super(e,t,i),this._register(Fr.addTarget(this.viewHelper.linesContentDomNode)),this._register(Ce(this.viewHelper.linesContentDomNode,gr.Tap,s=>this.onTap(s))),this._register(Ce(this.viewHelper.linesContentDomNode,gr.Change,s=>this.onChange(s))),this._register(Ce(this.viewHelper.linesContentDomNode,gr.Contextmenu,s=>this._onContextMenu(new Nb(s,!1,this.viewHelper.viewDomNode),!1))),this._lastPointerType="mouse",this._register(Ce(this.viewHelper.linesContentDomNode,"pointerdown",s=>{const o=s.pointerType;if(o==="mouse"){this._lastPointerType="mouse";return}else o==="touch"?this._lastPointerType="touch":this._lastPointerType="pen"}));const r=new EIt(this.viewHelper.viewDomNode);this._register(r.onPointerMove(this.viewHelper.viewDomNode,s=>this._onMouseMove(s))),this._register(r.onPointerUp(this.viewHelper.viewDomNode,s=>this._onMouseUp(s))),this._register(r.onPointerLeave(this.viewHelper.viewDomNode,s=>this._onMouseLeave(s))),this._register(r.onPointerDown(this.viewHelper.viewDomNode,(s,o)=>this._onMouseDown(s,o)))}onTap(e){!e.initialTarget||!this.viewHelper.linesContentDomNode.contains(e.initialTarget)||(e.preventDefault(),this.viewHelper.focusTextArea(),this._dispatchGesture(e,!1))}onChange(e){this._lastPointerType==="touch"&&this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY),this._lastPointerType==="pen"&&this._dispatchGesture(e,!0)}_dispatchGesture(e,t){const i=this._createMouseTarget(new Nb(e,!1,this.viewHelper.viewDomNode),!1);i.position&&this.viewController.dispatchMouse({position:i.position,mouseColumn:i.position.column,startedOnLineNumbers:!1,revealType:1,mouseDownCount:e.tapCount,inSelectionMode:t,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,leftButton:!1,middleButton:!1,onInjectedText:i.type===6&&i.detail.injectedText!==null})}_onMouseDown(e,t){e.browserEvent.pointerType!=="touch"&&super._onMouseDown(e,t)}}class YIt extends Nce{constructor(e,t,i){super(e,t,i),this._register(Fr.addTarget(this.viewHelper.linesContentDomNode)),this._register(Ce(this.viewHelper.linesContentDomNode,gr.Tap,r=>this.onTap(r))),this._register(Ce(this.viewHelper.linesContentDomNode,gr.Change,r=>this.onChange(r))),this._register(Ce(this.viewHelper.linesContentDomNode,gr.Contextmenu,r=>this._onContextMenu(new Nb(r,!1,this.viewHelper.viewDomNode),!1)))}onTap(e){e.preventDefault(),this.viewHelper.focusTextArea();const t=this._createMouseTarget(new Nb(e,!1,this.viewHelper.viewDomNode),!1);if(t.position){const i=document.createEvent("CustomEvent");i.initEvent(u9.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(i),this.viewController.moveTo(t.position,1)}}onChange(e){this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY)}}class ZIt extends me{constructor(e,t,i){super(),(Sg||bpt&&p4e)&&Pae.pointerEvents?this.handler=this._register(new GIt(e,t,i)):Xi.TouchEvent?this.handler=this._register(new YIt(e,t,i)):this.handler=this._register(new Nce(e,t,i))}getTargetAtClientPoint(e,t){return this.handler.getTargetAtClientPoint(e,t)}}class kC extends _O{}class UW extends kC{static{this.CLASS_NAME="line-numbers"}constructor(e){super(),this._context=e,this._readConfig(),this._lastCursorModelPosition=new he(1,1),this._renderResult=null,this._activeLineNumber=1,this._context.addEventHandler(this)}_readConfig(){const e=this._context.configuration.options;this._lineHeight=e.get(67);const t=e.get(68);this._renderLineNumbers=t.renderType,this._renderCustomLineNumbers=t.renderFn,this._renderFinalNewline=e.get(96);const i=e.get(146);this._lineNumbersLeft=i.lineNumbersLeft,this._lineNumbersWidth=i.lineNumbersWidth}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return this._readConfig(),!0}onCursorStateChanged(e){const t=e.selections[0].getPosition();this._lastCursorModelPosition=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(t);let i=!1;return this._activeLineNumber!==t.lineNumber&&(this._activeLineNumber=t.lineNumber,i=!0),(this._renderLineNumbers===2||this._renderLineNumbers===3)&&(i=!0),i}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onDecorationsChanged(e){return e.affectsLineNumber}_getLineRenderLineNumber(e){const t=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new he(e,1));if(t.column!==1)return"";const i=t.lineNumber;if(this._renderCustomLineNumbers)return this._renderCustomLineNumbers(i);if(this._renderLineNumbers===2){const r=Math.abs(this._lastCursorModelPosition.lineNumber-i);return r===0?''+i+"":String(r)}if(this._renderLineNumbers===3){if(this._lastCursorModelPosition.lineNumber===i||i%10===0)return String(i);const r=this._context.viewModel.getLineCount();return i===r?String(i):""}return String(i)}prepareRender(e){if(this._renderLineNumbers===0){this._renderResult=null;return}const t=zl?this._lineHeight%2===0?" lh-even":" lh-odd":"",i=e.visibleRange.startLineNumber,r=e.visibleRange.endLineNumber,s=this._context.viewModel.getDecorationsInViewport(e.visibleRange).filter(c=>!!c.options.lineNumberClassName);s.sort((c,u)=>$.compareRangesUsingEnds(c.range,u.range));let o=0;const a=this._context.viewModel.getLineCount(),l=[];for(let c=i;c<=r;c++){const u=c-i;let d=this._getLineRenderLineNumber(c),h="";for(;o${d}`}this._renderResult=l}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}dh((n,e)=>{const t=n.getColor(Fkt),i=n.getColor(Xkt);i?e.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${i}; }`):t&&e.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${t.transparent(.4)}; }`)});class qN extends bu{static{this.CLASS_NAME="glyph-margin"}static{this.OUTER_CLASS_NAME="margin"}constructor(e){super(e);const t=this._context.configuration.options,i=t.get(146);this._canUseLayerHinting=!t.get(32),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._domNode=Ci(document.createElement("div")),this._domNode.setClassName(qN.OUTER_CLASS_NAME),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._glyphMarginBackgroundDomNode=Ci(document.createElement("div")),this._glyphMarginBackgroundDomNode.setClassName(qN.CLASS_NAME),this._domNode.appendChild(this._glyphMarginBackgroundDomNode)}dispose(){super.dispose()}getDomNode(){return this._domNode}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(146);return this._canUseLayerHinting=!t.get(32),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollTopChanged}prepareRender(e){}render(e){this._domNode.setLayerHinting(this._canUseLayerHinting),this._domNode.setContain("strict");const t=e.scrollTop-e.bigNumbersDelta;this._domNode.setTop(-t);const i=Math.min(e.scrollHeight,1e6);this._domNode.setHeight(i),this._domNode.setWidth(this._contentLeft),this._glyphMarginBackgroundDomNode.setLeft(this._glyphMarginLeft),this._glyphMarginBackgroundDomNode.setWidth(this._glyphMarginWidth),this._glyphMarginBackgroundDomNode.setHeight(i)}}const Ck="monaco-mouse-cursor-text";var XIt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},dwe=function(n,e){return function(t,i){e(t,i,n)}};class QIt{constructor(e,t,i,r,s){this._context=e,this.modelLineNumber=t,this.distanceToModelLineStart=i,this.widthOfHiddenLineTextBefore=r,this.distanceToModelLineEnd=s,this._visibleTextAreaBrand=void 0,this.startPosition=null,this.endPosition=null,this.visibleTextareaStart=null,this.visibleTextareaEnd=null,this._previousPresentation=null}prepareRender(e){const t=new he(this.modelLineNumber,this.distanceToModelLineStart+1),i=new he(this.modelLineNumber,this._context.viewModel.model.getLineMaxColumn(this.modelLineNumber)-this.distanceToModelLineEnd);this.startPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t),this.endPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i),this.startPosition.lineNumber===this.endPosition.lineNumber?(this.visibleTextareaStart=e.visibleRangeForPosition(this.startPosition),this.visibleTextareaEnd=e.visibleRangeForPosition(this.endPosition)):(this.visibleTextareaStart=null,this.visibleTextareaEnd=null)}definePresentation(e){return this._previousPresentation||(e?this._previousPresentation=e:this._previousPresentation={foreground:1,italic:!1,bold:!1,underline:!1,strikethrough:!1}),this._previousPresentation}}const xq=Xd;let NJ=class extends bu{constructor(e,t,i,r,s){super(e),this._keybindingService=r,this._instantiationService=s,this._primaryCursorPosition=new he(1,1),this._primaryCursorVisibleRange=null,this._viewController=t,this._visibleRangeProvider=i,this._scrollLeft=0,this._scrollTop=0;const o=this._context.configuration.options,a=o.get(146);this._setAccessibilityOptions(o),this._contentLeft=a.contentLeft,this._contentWidth=a.contentWidth,this._contentHeight=a.height,this._fontInfo=o.get(50),this._lineHeight=o.get(67),this._emptySelectionClipboard=o.get(37),this._copyWithSyntaxHighlighting=o.get(25),this._visibleTextArea=null,this._selections=[new yt(1,1,1,1)],this._modelSelections=[new yt(1,1,1,1)],this._lastRenderPosition=null,this.textArea=Ci(document.createElement("textarea")),Ig.write(this.textArea,7),this.textArea.setClassName(`inputarea ${Ck}`),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");const{tabSize:l}=this._context.viewModel.model.getOptions();this.textArea.domNode.style.tabSize=`${l*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("autocorrect","off"),this.textArea.setAttribute("autocapitalize","off"),this.textArea.setAttribute("autocomplete","off"),this.textArea.setAttribute("spellcheck","false"),this.textArea.setAttribute("aria-label",this._getAriaLabel(o)),this.textArea.setAttribute("aria-required",o.get(5)?"true":"false"),this.textArea.setAttribute("tabindex",String(o.get(125))),this.textArea.setAttribute("role","textbox"),this.textArea.setAttribute("aria-roledescription",w("editor","editor")),this.textArea.setAttribute("aria-multiline","true"),this.textArea.setAttribute("aria-autocomplete",o.get(92)?"none":"both"),this._ensureReadOnlyAttribute(),this.textAreaCover=Ci(document.createElement("div")),this.textAreaCover.setPosition("absolute");const c={getLineCount:()=>this._context.viewModel.getLineCount(),getLineMaxColumn:h=>this._context.viewModel.getLineMaxColumn(h),getValueInRange:(h,f)=>this._context.viewModel.getValueInRange(h,f),getValueLengthInRange:(h,f)=>this._context.viewModel.getValueLengthInRange(h,f),modifyPosition:(h,f)=>this._context.viewModel.modifyPosition(h,f)},u={getDataToCopy:()=>{const h=this._context.viewModel.getPlainTextToCopy(this._modelSelections,this._emptySelectionClipboard,Ta),f=this._context.viewModel.model.getEOL(),g=this._emptySelectionClipboard&&this._modelSelections.length===1&&this._modelSelections[0].isEmpty(),p=Array.isArray(h)?h:null,m=Array.isArray(h)?h.join(f):h;let _,v=null;if(DJ.forceCopyWithSyntaxHighlighting||this._copyWithSyntaxHighlighting&&m.length<65536){const y=this._context.viewModel.getRichTextToCopy(this._modelSelections,this._emptySelectionClipboard);y&&(_=y.html,v=y.mode)}return{isFromEmptySelection:g,multicursorText:p,text:m,html:_,mode:v}},getScreenReaderContent:()=>{if(this._accessibilitySupport===1){const h=this._selections[0];if(Rn&&h.isEmpty()){const g=h.getStartPosition();let p=this._getWordBeforePosition(g);if(p.length===0&&(p=this._getCharacterBeforePosition(g)),p.length>0)return new wa(p,p.length,p.length,$.fromPositions(g),0)}if(Rn&&!h.isEmpty()&&c.getValueLengthInRange(h,0)<500){const g=c.getValueInRange(h,0);return new wa(g,0,g.length,h,0)}if(K_&&!h.isEmpty()){const g="vscode-placeholder";return new wa(g,0,g.length,null,void 0)}return wa.EMPTY}if(Hve){const h=this._selections[0];if(h.isEmpty()){const f=h.getStartPosition(),[g,p]=this._getAndroidWordAtPosition(f);if(g.length>0)return new wa(g,p,p,$.fromPositions(f),0)}return wa.EMPTY}return AS.fromEditorSelection(c,this._selections[0],this._accessibilityPageSize,this._accessibilitySupport===0)},deduceModelPosition:(h,f,g)=>this._context.viewModel.deduceModelPositionRelativeToViewPosition(h,f,g)},d=this._register(new KIt(this.textArea.domNode));this._textAreaInput=this._register(this._instantiationService.createInstance(IJ,u,d,eu,{isAndroid:Hve,isChrome:GP,isFirefox:Xd,isSafari:K_})),this._register(this._textAreaInput.onKeyDown(h=>{this._viewController.emitKeyDown(h)})),this._register(this._textAreaInput.onKeyUp(h=>{this._viewController.emitKeyUp(h)})),this._register(this._textAreaInput.onPaste(h=>{let f=!1,g=null,p=null;h.metadata&&(f=this._emptySelectionClipboard&&!!h.metadata.isFromEmptySelection,g=typeof h.metadata.multicursorText<"u"?h.metadata.multicursorText:null,p=h.metadata.mode),this._viewController.paste(h.text,f,g,p)})),this._register(this._textAreaInput.onCut(()=>{this._viewController.cut()})),this._register(this._textAreaInput.onType(h=>{h.replacePrevCharCnt||h.replaceNextCharCnt||h.positionDelta?this._viewController.compositionType(h.text,h.replacePrevCharCnt,h.replaceNextCharCnt,h.positionDelta):this._viewController.type(h.text)})),this._register(this._textAreaInput.onSelectionChangeRequest(h=>{this._viewController.setSelection(h)})),this._register(this._textAreaInput.onCompositionStart(h=>{const f=this.textArea.domNode,g=this._modelSelections[0],{distanceToModelLineStart:p,widthOfHiddenTextBefore:m}=(()=>{const v=f.value.substring(0,Math.min(f.selectionStart,f.selectionEnd)),y=v.lastIndexOf(` `),C=v.substring(y+1),x=C.lastIndexOf(" "),k=C.length-x-1,L=g.getStartPosition(),D=Math.min(L.column-1,k),I=L.column-1-D,O=C.substring(0,C.length-D),{tabSize:M}=this._context.viewModel.model.getOptions(),B=JIt(this.textArea.domNode.ownerDocument,O,this._fontInfo,M);return{distanceToModelLineStart:I,widthOfHiddenTextBefore:B}})(),{distanceToModelLineEnd:_}=(()=>{const v=f.value.substring(Math.max(f.selectionStart,f.selectionEnd)),y=v.indexOf(` `),C=y===-1?v:v.substring(0,y),x=C.indexOf(" "),k=x===-1?C.length:C.length-x-1,L=g.getEndPosition(),D=Math.min(this._context.viewModel.model.getLineMaxColumn(L.lineNumber)-L.column,k);return{distanceToModelLineEnd:this._context.viewModel.model.getLineMaxColumn(L.lineNumber)-L.column-D}})();this._context.viewModel.revealRange("keyboard",!0,$.fromPositions(this._selections[0].getStartPosition()),0,1),this._visibleTextArea=new QIt(this._context,g.startLineNumber,p,m,_),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render(),this.textArea.setClassName(`inputarea ${Ck} ime-input`),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(this._textAreaInput.onCompositionUpdate(h=>{this._visibleTextArea&&(this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render())})),this._register(this._textAreaInput.onCompositionEnd(()=>{this._visibleTextArea=null,this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._render(),this.textArea.setClassName(`inputarea ${Ck}`),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()})),this._register(this._textAreaInput.onFocus(()=>{this._context.viewModel.setHasFocus(!0)})),this._register(this._textAreaInput.onBlur(()=>{this._context.viewModel.setHasFocus(!1)})),this._register(bI.onDidChange(()=>{this._ensureReadOnlyAttribute()}))}writeScreenReaderContent(e){this._textAreaInput.writeNativeTextAreaContent(e)}dispose(){super.dispose()}_getAndroidWordAtPosition(e){const t='`~!@#$%^&*()-=+[{]}\\|;:",.<>/?',i=this._context.viewModel.getLineContent(e.lineNumber),r=eh(t,[]);let s=!0,o=e.column,a=!0,l=e.column,c=0;for(;c<50&&(s||a);){if(s&&o<=1&&(s=!1),s){const u=i.charCodeAt(o-2);r.get(u)!==0?s=!1:o--}if(a&&l>i.length&&(a=!1),a){const u=i.charCodeAt(l-1);r.get(u)!==0?a=!1:l++}c++}return[i.substring(o-1,l-1),e.column-o]}_getWordBeforePosition(e){const t=this._context.viewModel.getLineContent(e.lineNumber),i=eh(this._context.configuration.options.get(132),[]);let r=e.column,s=0;for(;r>1;){const o=t.charCodeAt(r-2);if(i.get(o)!==0||s>50)return t.substring(r-1,e.column-1);s++,r--}return t.substring(0,e.column-1)}_getCharacterBeforePosition(e){if(e.column>1){const i=this._context.viewModel.getLineContent(e.lineNumber).charAt(e.column-2);if(!Co(i.charCodeAt(0)))return i}return""}_getAriaLabel(e){if(e.get(2)===1){const i=this._keybindingService.lookupKeybinding("editor.action.toggleScreenReaderAccessibilityMode")?.getAriaLabel(),r=this._keybindingService.lookupKeybinding("workbench.action.showCommands")?.getAriaLabel(),s=this._keybindingService.lookupKeybinding("workbench.action.openGlobalKeybindings")?.getAriaLabel(),o=w("accessibilityModeOff","The editor is not accessible at this time.");return i?w("accessibilityOffAriaLabel","{0} To enable screen reader optimized mode, use {1}",o,i):r?w("accessibilityOffAriaLabelNoKb","{0} To enable screen reader optimized mode, open the quick pick with {1} and run the command Toggle Screen Reader Accessibility Mode, which is currently not triggerable via keyboard.",o,r):s?w("accessibilityOffAriaLabelNoKbs","{0} Please assign a keybinding for the command Toggle Screen Reader Accessibility Mode by accessing the keybindings editor with {1} and run it.",o,s):o}return e.get(4)}_setAccessibilityOptions(e){this._accessibilitySupport=e.get(2);const t=e.get(3);this._accessibilitySupport===2&&t===Mg.accessibilityPageSize.defaultValue?this._accessibilityPageSize=500:this._accessibilityPageSize=t;const r=e.get(146).wrappingColumn;if(r!==-1&&this._accessibilitySupport!==1){const s=e.get(50);this._textAreaWrapping=!0,this._textAreaWidth=Math.round(r*s.typicalHalfwidthCharacterWidth)}else this._textAreaWrapping=!1,this._textAreaWidth=xq?0:1}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(146);this._setAccessibilityOptions(t),this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._contentHeight=i.height,this._fontInfo=t.get(50),this._lineHeight=t.get(67),this._emptySelectionClipboard=t.get(37),this._copyWithSyntaxHighlighting=t.get(25),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");const{tabSize:r}=this._context.viewModel.model.getOptions();return this.textArea.domNode.style.tabSize=`${r*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("aria-label",this._getAriaLabel(t)),this.textArea.setAttribute("aria-required",t.get(5)?"true":"false"),this.textArea.setAttribute("tabindex",String(t.get(125))),(e.hasChanged(34)||e.hasChanged(92))&&this._ensureReadOnlyAttribute(),e.hasChanged(2)&&this._textAreaInput.writeNativeTextAreaContent("strategy changed"),!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),this._modelSelections=e.modelSelections.slice(0),this._textAreaInput.writeNativeTextAreaContent("selection changed"),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}isFocused(){return this._textAreaInput.isFocused()}focusTextArea(){this._textAreaInput.focusTextArea()}getLastRenderData(){return this._lastRenderPosition}setAriaOptions(e){e.activeDescendant?(this.textArea.setAttribute("aria-haspopup","true"),this.textArea.setAttribute("aria-autocomplete","list"),this.textArea.setAttribute("aria-activedescendant",e.activeDescendant)):(this.textArea.setAttribute("aria-haspopup","false"),this.textArea.setAttribute("aria-autocomplete","both"),this.textArea.removeAttribute("aria-activedescendant")),e.role&&this.textArea.setAttribute("role",e.role)}_ensureReadOnlyAttribute(){const e=this._context.configuration.options;!bI.enabled||e.get(34)&&e.get(92)?this.textArea.setAttribute("readonly","true"):this.textArea.removeAttribute("readonly")}prepareRender(e){this._primaryCursorPosition=new he(this._selections[0].positionLineNumber,this._selections[0].positionColumn),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primaryCursorPosition),this._visibleTextArea?.prepareRender(e)}render(e){this._textAreaInput.writeNativeTextAreaContent("render"),this._render()}_render(){if(this._visibleTextArea){const i=this._visibleTextArea.visibleTextareaStart,r=this._visibleTextArea.visibleTextareaEnd,s=this._visibleTextArea.startPosition,o=this._visibleTextArea.endPosition;if(s&&o&&i&&r&&r.left>=this._scrollLeft&&i.left<=this._scrollLeft+this._contentWidth){const a=this._context.viewLayout.getVerticalOffsetForLineNumber(this._primaryCursorPosition.lineNumber)-this._scrollTop,l=this._newlinecount(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart));let c=this._visibleTextArea.widthOfHiddenLineTextBefore,u=this._contentLeft+i.left-this._scrollLeft,d=r.left-i.left+1;if(uthis._contentWidth&&(d=this._contentWidth);const h=this._context.viewModel.getViewLineData(s.lineNumber),f=h.tokens.findTokenIndexAtOffset(s.column-1),g=h.tokens.findTokenIndexAtOffset(o.column-1),p=f===g,m=this._visibleTextArea.definePresentation(p?h.tokens.getPresentation(f):null);this.textArea.domNode.scrollTop=l*this._lineHeight,this.textArea.domNode.scrollLeft=c,this._doRender({lastRenderPosition:null,top:a,left:u,width:d,height:this._lineHeight,useCover:!1,color:(rs.getColorMap()||[])[m.foreground],italic:m.italic,bold:m.bold,underline:m.underline,strikethrough:m.strikethrough})}return}if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}const e=this._contentLeft+this._primaryCursorVisibleRange.left-this._scrollLeft;if(ethis._contentLeft+this._contentWidth){this._renderAtTopLeft();return}const t=this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber)-this._scrollTop;if(t<0||t>this._contentHeight){this._renderAtTopLeft();return}if(Rn||this._accessibilitySupport===2){this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:this._lineHeight,useCover:!1}),this.textArea.domNode.scrollLeft=this._primaryCursorVisibleRange.left;const i=this._textAreaInput.textAreaState.newlineCountBeforeSelection??this._newlinecount(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart));this.textArea.domNode.scrollTop=i*this._lineHeight;return}this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:xq?0:1,useCover:!1})}_newlinecount(e){let t=0,i=-1;do{if(i=e.indexOf(` -`,i+1),i===-1)break;t++}while(!0);return t}_renderAtTopLeft(){this._doRender({lastRenderPosition:null,top:0,left:0,width:this._textAreaWidth,height:xq?0:1,useCover:!0})}_doRender(e){this._lastRenderPosition=e.lastRenderPosition;const t=this.textArea,i=this.textAreaCover;ta(t,this._fontInfo),t.setTop(e.top),t.setLeft(e.left),t.setWidth(e.width),t.setHeight(e.height),t.setColor(e.color?Te.Format.CSS.formatHex(e.color):""),t.setFontStyle(e.italic?"italic":""),e.bold&&t.setFontWeight("bold"),t.setTextDecoration(`${e.underline?" underline":""}${e.strikethrough?" line-through":""}`),i.setTop(e.useCover?e.top:0),i.setLeft(e.useCover?e.left:0),i.setWidth(e.useCover?e.width:0),i.setHeight(e.useCover?e.height:0);const r=this._context.configuration.options;r.get(57)?i.setClassName("monaco-editor-background textAreaCover "+qN.OUTER_CLASS_NAME):r.get(68).renderType!==0?i.setClassName("monaco-editor-background textAreaCover "+UW.CLASS_NAME):i.setClassName("monaco-editor-background textAreaCover")}};NJ=XIt([dwe(3,xi),dwe(4,Tt)],NJ);function JIt(n,e,t,i){if(e.length===0)return 0;const r=n.createElement("div");r.style.position="absolute",r.style.top="-50000px",r.style.width="50000px";const s=n.createElement("span");ta(s,t),s.style.whiteSpace="pre",s.style.tabSize=`${i*t.spaceWidth}px`,s.append(e),r.appendChild(s),n.body.appendChild(r);const o=s.offsetWidth;return r.remove(),o}const eAt=()=>!0,tAt=()=>!1,nAt=n=>n===" "||n===" ";class _x{static shouldRecreate(e){return e.hasChanged(146)||e.hasChanged(132)||e.hasChanged(37)||e.hasChanged(77)||e.hasChanged(79)||e.hasChanged(80)||e.hasChanged(6)||e.hasChanged(7)||e.hasChanged(11)||e.hasChanged(9)||e.hasChanged(10)||e.hasChanged(14)||e.hasChanged(129)||e.hasChanged(50)||e.hasChanged(92)||e.hasChanged(131)}constructor(e,t,i,r){this.languageConfigurationService=r,this._cursorMoveConfigurationBrand=void 0,this._languageId=e;const s=i.options,o=s.get(146),a=s.get(50);this.readOnly=s.get(92),this.tabSize=t.tabSize,this.indentSize=t.indentSize,this.insertSpaces=t.insertSpaces,this.stickyTabStops=s.get(117),this.lineHeight=a.lineHeight,this.typicalHalfwidthCharacterWidth=a.typicalHalfwidthCharacterWidth,this.pageSize=Math.max(1,Math.floor(o.height/this.lineHeight)-2),this.useTabStops=s.get(129),this.wordSeparators=s.get(132),this.emptySelectionClipboard=s.get(37),this.copyWithSyntaxHighlighting=s.get(25),this.multiCursorMergeOverlapping=s.get(77),this.multiCursorPaste=s.get(79),this.multiCursorLimit=s.get(80),this.autoClosingBrackets=s.get(6),this.autoClosingComments=s.get(7),this.autoClosingQuotes=s.get(11),this.autoClosingDelete=s.get(9),this.autoClosingOvertype=s.get(10),this.autoSurround=s.get(14),this.autoIndent=s.get(12),this.wordSegmenterLocales=s.get(131),this.surroundingPairs={},this._electricChars=null,this.shouldAutoCloseBefore={quote:this._getShouldAutoClose(e,this.autoClosingQuotes,!0),comment:this._getShouldAutoClose(e,this.autoClosingComments,!1),bracket:this._getShouldAutoClose(e,this.autoClosingBrackets,!1)},this.autoClosingPairs=this.languageConfigurationService.getLanguageConfiguration(e).getAutoClosingPairs();const l=this.languageConfigurationService.getLanguageConfiguration(e).getSurroundingPairs();if(l)for(const u of l)this.surroundingPairs[u.open]=u.close;const c=this.languageConfigurationService.getLanguageConfiguration(e).comments;this.blockCommentStartToken=c?.blockCommentStartToken??null}get electricChars(){if(!this._electricChars){this._electricChars={};const e=this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter?.getElectricCharacters();if(e)for(const t of e)this._electricChars[t]=!0}return this._electricChars}onElectricCharacter(e,t,i){const r=Iy(t,i-1),s=this.languageConfigurationService.getLanguageConfiguration(r.languageId).electricCharacter;return s?s.onElectricCharacter(e,r,i-r.firstCharOffset):null}normalizeIndentation(e){return jle(e,this.indentSize,this.insertSpaces)}_getShouldAutoClose(e,t,i){switch(t){case"beforeWhitespace":return nAt;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(e,i);case"always":return eAt;case"never":return tAt}}_getLanguageDefinedShouldAutoClose(e,t){const i=this.languageConfigurationService.getLanguageConfiguration(e).getAutoCloseBeforeSet(t);return r=>i.indexOf(r)!==-1}visibleColumnFromColumn(e,t){return co.visibleColumnFromColumn(e.getLineContent(t.lineNumber),t.column,this.tabSize)}columnFromVisibleColumn(e,t,i){const r=co.columnFromVisibleColumn(e.getLineContent(t),i,this.tabSize),s=e.getLineMinColumn(t);if(ro?o:r}}let ri=class a8e{static fromModelState(e){return new iAt(e)}static fromViewState(e){return new rAt(e)}static fromModelSelection(e){const t=yt.liftSelection(e),i=new Ko($.fromPositions(t.getSelectionStart()),0,0,t.getPosition(),0);return a8e.fromModelState(i)}static fromModelSelections(e){const t=[];for(let i=0,r=e.length;is,c=r>o,u=ro||_r||m0&&r--,vy.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,i.toViewLineNumber,r)}static columnSelectRight(e,t,i){let r=0;const s=Math.min(i.fromViewLineNumber,i.toViewLineNumber),o=Math.max(i.fromViewLineNumber,i.toViewLineNumber);for(let l=s;l<=o;l++){const c=t.getLineMaxColumn(l),u=e.visibleColumnFromColumn(t,new he(l,c));r=Math.max(r,u)}let a=i.toViewVisualColumn;return ae.getLineMinColumn(t.lineNumber))return t.delta(void 0,-V4e(e.getLineContent(t.lineNumber),t.column-1));if(t.lineNumber>1){const i=t.lineNumber-1;return new he(i,e.getLineMaxColumn(i))}else return t}static leftPositionAtomicSoftTabs(e,t,i){if(t.column<=e.getLineIndentColumn(t.lineNumber)){const r=e.getLineMinColumn(t.lineNumber),s=e.getLineContent(t.lineNumber),o=UN.atomicPosition(s,t.column-1,i,0);if(o!==-1&&o+1>=r)return new he(t.lineNumber,o+1)}return this.leftPosition(e,t)}static left(e,t,i){const r=e.stickyTabStops?Ni.leftPositionAtomicSoftTabs(t,i,e.tabSize):Ni.leftPosition(t,i);return new Sq(r.lineNumber,r.column,0)}static moveLeft(e,t,i,r,s){let o,a;if(i.hasSelection()&&!r)o=i.selection.startLineNumber,a=i.selection.startColumn;else{const l=i.position.delta(void 0,-(s-1)),c=t.normalizePosition(Ni.clipPositionColumn(l,t),0),u=Ni.left(e,t,c);o=u.lineNumber,a=u.column}return i.move(r,o,a,0)}static clipPositionColumn(e,t){return new he(e.lineNumber,Ni.clipRange(e.column,t.getLineMinColumn(e.lineNumber),t.getLineMaxColumn(e.lineNumber)))}static clipRange(e,t,i){return ei?i:e}static rightPosition(e,t,i){return iu?(i=u,a?r=t.getLineMaxColumn(i):r=Math.min(t.getLineMaxColumn(i),r)):r=e.columnFromVisibleColumn(t,i,c),f?s=0:s=c-co.visibleColumnFromColumn(t.getLineContent(i),r,e.tabSize),l!==void 0){const g=new he(i,r),p=t.normalizePosition(g,l);s=s+(r-p.column),i=p.lineNumber,r=p.column}return new Sq(i,r,s)}static down(e,t,i,r,s,o,a){return this.vertical(e,t,i,r,s,i+o,a,4)}static moveDown(e,t,i,r,s){let o,a;i.hasSelection()&&!r?(o=i.selection.endLineNumber,a=i.selection.endColumn):(o=i.position.lineNumber,a=i.position.column);let l=0,c;do if(c=Ni.down(e,t,o+l,a,i.leftoverVisibleColumns,s,!0),t.normalizePosition(new he(c.lineNumber,c.column),2).lineNumber>o)break;while(l++<10&&o+l1&&this._isBlankLine(t,s);)s--;for(;s>1&&!this._isBlankLine(t,s);)s--;return i.move(r,s,t.getLineMinColumn(s),0)}static moveToNextBlankLine(e,t,i,r){const s=t.getLineCount();let o=i.position.lineNumber;for(;o=h.length+1)return!1;const f=h.charAt(d.column-2),g=r.get(f);if(!g)return!1;if(Rb(f)){if(i==="never")return!1}else if(t==="never")return!1;const p=h.charAt(d.column-1);let m=!1;for(const _ of g)_.open===f&&_.close===p&&(m=!0);if(!m)return!1;if(e==="auto"){let _=!1;for(let v=0,y=a.length;v1){const s=t.getLineContent(r.lineNumber),o=yl(s),a=o===-1?s.length+1:o+1;if(r.column<=a){const l=i.visibleColumnFromColumn(t,r),c=co.prevIndentTabStop(l,i.indentSize),u=i.columnFromVisibleColumn(t,r.lineNumber,c);return new $(r.lineNumber,u,r.lineNumber,r.column)}}return $.fromPositions(Hw.getPositionAfterDeleteLeft(r,t),r)}static getPositionAfterDeleteLeft(e,t){if(e.column>1){const i=b_t(e.column-1,t.getLineContent(e.lineNumber));return e.with(void 0,i+1)}else if(e.lineNumber>1){const i=e.lineNumber-1;return new he(i,t.getLineMaxColumn(i))}else return e}static cut(e,t,i){const r=[];let s=null;i.sort((o,a)=>he.compare(o.getStartPosition(),a.getEndPosition()));for(let o=0,a=i.length;o1&&s?.endLineNumber!==c.lineNumber?(u=c.lineNumber-1,d=t.getLineMaxColumn(c.lineNumber-1),h=c.lineNumber,f=t.getLineMaxColumn(c.lineNumber)):(u=c.lineNumber,d=1,h=c.lineNumber,f=t.getLineMaxColumn(c.lineNumber));const g=new $(u,d,h,f);s=g,g.isEmpty()?r[o]=null:r[o]=new Sa(g,"")}else r[o]=null;else r[o]=new Sa(l,"")}return new Tc(0,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}}class yi{static _createWord(e,t,i,r,s){return{start:r,end:s,wordType:t,nextCharClass:i}}static _createIntlWord(e,t){return{start:e.index,end:e.index+e.segment.length,wordType:1,nextCharClass:t}}static _findPreviousWordOnLine(e,t,i){const r=t.getLineContent(i.lineNumber);return this._doFindPreviousWordOnLine(r,e,i)}static _doFindPreviousWordOnLine(e,t,i){let r=0;const s=t.findPrevIntlWordBeforeOrAtOffset(e,i.column-2);for(let o=i.column-2;o>=0;o--){const a=e.charCodeAt(o),l=t.get(a);if(s&&o===s.index)return this._createIntlWord(s,l);if(l===0){if(r===2)return this._createWord(e,r,l,o+1,this._findEndOfWord(e,t,r,o+1));r=1}else if(l===2){if(r===1)return this._createWord(e,r,l,o+1,this._findEndOfWord(e,t,r,o+1));r=2}else if(l===1&&r!==0)return this._createWord(e,r,l,o+1,this._findEndOfWord(e,t,r,o+1))}return r!==0?this._createWord(e,r,1,0,this._findEndOfWord(e,t,r,0)):null}static _findEndOfWord(e,t,i,r){const s=t.findNextIntlWordAtOrAfterOffset(e,r),o=e.length;for(let a=r;a=0;o--){const a=e.charCodeAt(o),l=t.get(a);if(s&&o===s.index)return o;if(l===1||i===1&&l===2||i===2&&l===0)return o+1}return 0}static moveWordLeft(e,t,i,r,s){let o=i.lineNumber,a=i.column;a===1&&o>1&&(o=o-1,a=t.getLineMaxColumn(o));let l=yi._findPreviousWordOnLine(e,t,new he(o,a));if(r===0)return new he(o,l?l.start+1:1);if(r===1)return!s&&l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=yi._findPreviousWordOnLine(e,t,new he(o,l.start+1))),new he(o,l?l.start+1:1);if(r===3){for(;l&&l.wordType===2;)l=yi._findPreviousWordOnLine(e,t,new he(o,l.start+1));return new he(o,l?l.start+1:1)}return l&&a<=l.end+1&&(l=yi._findPreviousWordOnLine(e,t,new he(o,l.start+1))),new he(o,l?l.end+1:1)}static _moveWordPartLeft(e,t){const i=t.lineNumber,r=e.getLineMaxColumn(i);if(t.column===1)return i>1?new he(i-1,e.getLineMaxColumn(i-1)):t;const s=e.getLineContent(i);for(let o=t.column-1;o>1;o--){const a=s.charCodeAt(o-2),l=s.charCodeAt(o-1);if(a===95&&l!==95)return new he(i,o);if(a===45&&l!==45)return new he(i,o);if((Tv(a)||w4(a))&&fp(l))return new he(i,o);if(fp(a)&&fp(l)&&o+1=l.start+1&&(l=yi._findNextWordOnLine(e,t,new he(s,l.end+1))),l?o=l.start+1:o=t.getLineMaxColumn(s);return new he(s,o)}static _moveWordPartRight(e,t){const i=t.lineNumber,r=e.getLineMaxColumn(i);if(t.column===r)return i1?c=1:(l--,c=r.getLineMaxColumn(l)):(u&&c<=u.end+1&&(u=yi._findPreviousWordOnLine(i,r,new he(l,u.start+1))),u?c=u.end+1:c>1?c=1:(l--,c=r.getLineMaxColumn(l))),new $(l,c,a.lineNumber,a.column)}static deleteInsideWord(e,t,i){if(!i.isEmpty())return i;const r=new he(i.positionLineNumber,i.positionColumn),s=this._deleteInsideWordWhitespace(t,r);return s||this._deleteInsideWordDetermineDeleteRange(e,t,r)}static _charAtIsWhitespace(e,t){const i=e.charCodeAt(t);return i===32||i===9}static _deleteInsideWordWhitespace(e,t){const i=e.getLineContent(t.lineNumber),r=i.length;if(r===0)return null;let s=Math.max(t.column-2,0);if(!this._charAtIsWhitespace(i,s))return null;let o=Math.min(t.column-1,r-1);if(!this._charAtIsWhitespace(i,o))return null;for(;s>0&&this._charAtIsWhitespace(i,s-1);)s--;for(;o+11?new $(i.lineNumber-1,t.getLineMaxColumn(i.lineNumber-1),i.lineNumber,1):i.lineNumberd.start+1<=i.column&&i.column<=d.end+1,a=(d,h)=>(d=Math.min(d,i.column),h=Math.max(h,i.column),new $(i.lineNumber,d,i.lineNumber,h)),l=d=>{let h=d.start+1,f=d.end+1,g=!1;for(;f-11&&this._charAtIsWhitespace(r,h-2);)h--;return a(h,f)},c=yi._findPreviousWordOnLine(e,t,i);if(c&&o(c))return l(c);const u=yi._findNextWordOnLine(e,t,i);return u&&o(u)?l(u):c&&u?a(c.end+1,u.start+1):c?a(c.start+1,c.end+1):u?a(u.start+1,u.end+1):a(1,s+1)}static _deleteWordPartLeft(e,t){if(!t.isEmpty())return t;const i=t.getPosition(),r=yi._moveWordPartLeft(e,i);return new $(i.lineNumber,i.column,r.lineNumber,r.column)}static _findFirstNonWhitespaceChar(e,t){const i=e.length;for(let r=t;r=h.start+1&&(h=yi._findNextWordOnLine(i,r,new he(l,h.end+1))),h?c=h.start+1:c!!e)}class qo{static addCursorDown(e,t,i){const r=[];let s=0;for(let o=0,a=t.length;oc&&(u=c,d=e.model.getLineMaxColumn(u)),ri.fromModelState(new Ko(new $(o.lineNumber,1,u,d),2,0,new he(u,d),0))}const l=t.modelState.selectionStart.getStartPosition().lineNumber;if(o.lineNumberl){const c=e.getLineCount();let u=a.lineNumber+1,d=1;return u>c&&(u=c,d=e.getLineMaxColumn(u)),ri.fromViewState(t.viewState.move(!0,u,d,0))}else{const c=t.modelState.selectionStart.getEndPosition();return ri.fromModelState(t.modelState.move(!0,c.lineNumber,c.column,0))}}static word(e,t,i,r){const s=e.model.validatePosition(r);return ri.fromModelState(yi.word(e.cursorConfig,e.model,t.modelState,i,s))}static cancelSelection(e,t){if(!t.modelState.hasSelection())return new ri(t.modelState,t.viewState);const i=t.viewState.position.lineNumber,r=t.viewState.position.column;return ri.fromViewState(new Ko(new $(i,r,i,r),0,0,new he(i,r),0))}static moveTo(e,t,i,r,s){if(i){if(t.modelState.selectionStartKind===1)return this.word(e,t,i,r);if(t.modelState.selectionStartKind===2)return this.line(e,t,i,r,s)}const o=e.model.validatePosition(r),a=s?e.coordinatesConverter.validateViewPosition(new he(s.lineNumber,s.column),o):e.coordinatesConverter.convertModelPositionToViewPosition(o);return ri.fromViewState(t.viewState.move(i,a.lineNumber,a.column,0))}static simpleMove(e,t,i,r,s,o){switch(i){case 0:return o===4?this._moveHalfLineLeft(e,t,r):this._moveLeft(e,t,r,s);case 1:return o===4?this._moveHalfLineRight(e,t,r):this._moveRight(e,t,r,s);case 2:return o===2?this._moveUpByViewLines(e,t,r,s):this._moveUpByModelLines(e,t,r,s);case 3:return o===2?this._moveDownByViewLines(e,t,r,s):this._moveDownByModelLines(e,t,r,s);case 4:return o===2?t.map(a=>ri.fromViewState(Ni.moveToPrevBlankLine(e.cursorConfig,e,a.viewState,r))):t.map(a=>ri.fromModelState(Ni.moveToPrevBlankLine(e.cursorConfig,e.model,a.modelState,r)));case 5:return o===2?t.map(a=>ri.fromViewState(Ni.moveToNextBlankLine(e.cursorConfig,e,a.viewState,r))):t.map(a=>ri.fromModelState(Ni.moveToNextBlankLine(e.cursorConfig,e.model,a.modelState,r)));case 6:return this._moveToViewMinColumn(e,t,r);case 7:return this._moveToViewFirstNonWhitespaceColumn(e,t,r);case 8:return this._moveToViewCenterColumn(e,t,r);case 9:return this._moveToViewMaxColumn(e,t,r);case 10:return this._moveToViewLastNonWhitespaceColumn(e,t,r);default:return null}}static viewportMove(e,t,i,r,s){const o=e.getCompletelyVisibleViewRange(),a=e.coordinatesConverter.convertViewRangeToModelRange(o);switch(i){case 11:{const l=this._firstLineNumberInRange(e.model,a,s),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],r,l,c)]}case 13:{const l=this._lastLineNumberInRange(e.model,a,s),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],r,l,c)]}case 12:{const l=Math.round((a.startLineNumber+a.endLineNumber)/2),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],r,l,c)]}case 14:{const l=[];for(let c=0,u=t.length;ci.endLineNumber-1?o=i.endLineNumber-1:sri.fromViewState(Ni.moveLeft(e.cursorConfig,e,s.viewState,i,r)))}static _moveHalfLineLeft(e,t,i){const r=[];for(let s=0,o=t.length;sri.fromViewState(Ni.moveRight(e.cursorConfig,e,s.viewState,i,r)))}static _moveHalfLineRight(e,t,i){const r=[];for(let s=0,o=t.length;s!0,tAt=()=>!1,nAt=n=>n===" "||n===" ";class _x{static shouldRecreate(e){return e.hasChanged(146)||e.hasChanged(132)||e.hasChanged(37)||e.hasChanged(77)||e.hasChanged(79)||e.hasChanged(80)||e.hasChanged(6)||e.hasChanged(7)||e.hasChanged(11)||e.hasChanged(9)||e.hasChanged(10)||e.hasChanged(14)||e.hasChanged(129)||e.hasChanged(50)||e.hasChanged(92)||e.hasChanged(131)}constructor(e,t,i,r){this.languageConfigurationService=r,this._cursorMoveConfigurationBrand=void 0,this._languageId=e;const s=i.options,o=s.get(146),a=s.get(50);this.readOnly=s.get(92),this.tabSize=t.tabSize,this.indentSize=t.indentSize,this.insertSpaces=t.insertSpaces,this.stickyTabStops=s.get(117),this.lineHeight=a.lineHeight,this.typicalHalfwidthCharacterWidth=a.typicalHalfwidthCharacterWidth,this.pageSize=Math.max(1,Math.floor(o.height/this.lineHeight)-2),this.useTabStops=s.get(129),this.wordSeparators=s.get(132),this.emptySelectionClipboard=s.get(37),this.copyWithSyntaxHighlighting=s.get(25),this.multiCursorMergeOverlapping=s.get(77),this.multiCursorPaste=s.get(79),this.multiCursorLimit=s.get(80),this.autoClosingBrackets=s.get(6),this.autoClosingComments=s.get(7),this.autoClosingQuotes=s.get(11),this.autoClosingDelete=s.get(9),this.autoClosingOvertype=s.get(10),this.autoSurround=s.get(14),this.autoIndent=s.get(12),this.wordSegmenterLocales=s.get(131),this.surroundingPairs={},this._electricChars=null,this.shouldAutoCloseBefore={quote:this._getShouldAutoClose(e,this.autoClosingQuotes,!0),comment:this._getShouldAutoClose(e,this.autoClosingComments,!1),bracket:this._getShouldAutoClose(e,this.autoClosingBrackets,!1)},this.autoClosingPairs=this.languageConfigurationService.getLanguageConfiguration(e).getAutoClosingPairs();const l=this.languageConfigurationService.getLanguageConfiguration(e).getSurroundingPairs();if(l)for(const u of l)this.surroundingPairs[u.open]=u.close;const c=this.languageConfigurationService.getLanguageConfiguration(e).comments;this.blockCommentStartToken=c?.blockCommentStartToken??null}get electricChars(){if(!this._electricChars){this._electricChars={};const e=this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter?.getElectricCharacters();if(e)for(const t of e)this._electricChars[t]=!0}return this._electricChars}onElectricCharacter(e,t,i){const r=Iy(t,i-1),s=this.languageConfigurationService.getLanguageConfiguration(r.languageId).electricCharacter;return s?s.onElectricCharacter(e,r,i-r.firstCharOffset):null}normalizeIndentation(e){return jle(e,this.indentSize,this.insertSpaces)}_getShouldAutoClose(e,t,i){switch(t){case"beforeWhitespace":return nAt;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(e,i);case"always":return eAt;case"never":return tAt}}_getLanguageDefinedShouldAutoClose(e,t){const i=this.languageConfigurationService.getLanguageConfiguration(e).getAutoCloseBeforeSet(t);return r=>i.indexOf(r)!==-1}visibleColumnFromColumn(e,t){return co.visibleColumnFromColumn(e.getLineContent(t.lineNumber),t.column,this.tabSize)}columnFromVisibleColumn(e,t,i){const r=co.columnFromVisibleColumn(e.getLineContent(t),i,this.tabSize),s=e.getLineMinColumn(t);if(ro?o:r}}let ri=class a8e{static fromModelState(e){return new iAt(e)}static fromViewState(e){return new rAt(e)}static fromModelSelection(e){const t=yt.liftSelection(e),i=new Ko($.fromPositions(t.getSelectionStart()),0,0,t.getPosition(),0);return a8e.fromModelState(i)}static fromModelSelections(e){const t=[];for(let i=0,r=e.length;is,c=r>o,u=ro||_r||m0&&r--,vy.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,i.toViewLineNumber,r)}static columnSelectRight(e,t,i){let r=0;const s=Math.min(i.fromViewLineNumber,i.toViewLineNumber),o=Math.max(i.fromViewLineNumber,i.toViewLineNumber);for(let l=s;l<=o;l++){const c=t.getLineMaxColumn(l),u=e.visibleColumnFromColumn(t,new he(l,c));r=Math.max(r,u)}let a=i.toViewVisualColumn;return ae.getLineMinColumn(t.lineNumber))return t.delta(void 0,-V4e(e.getLineContent(t.lineNumber),t.column-1));if(t.lineNumber>1){const i=t.lineNumber-1;return new he(i,e.getLineMaxColumn(i))}else return t}static leftPositionAtomicSoftTabs(e,t,i){if(t.column<=e.getLineIndentColumn(t.lineNumber)){const r=e.getLineMinColumn(t.lineNumber),s=e.getLineContent(t.lineNumber),o=UN.atomicPosition(s,t.column-1,i,0);if(o!==-1&&o+1>=r)return new he(t.lineNumber,o+1)}return this.leftPosition(e,t)}static left(e,t,i){const r=e.stickyTabStops?Ni.leftPositionAtomicSoftTabs(t,i,e.tabSize):Ni.leftPosition(t,i);return new Sq(r.lineNumber,r.column,0)}static moveLeft(e,t,i,r,s){let o,a;if(i.hasSelection()&&!r)o=i.selection.startLineNumber,a=i.selection.startColumn;else{const l=i.position.delta(void 0,-(s-1)),c=t.normalizePosition(Ni.clipPositionColumn(l,t),0),u=Ni.left(e,t,c);o=u.lineNumber,a=u.column}return i.move(r,o,a,0)}static clipPositionColumn(e,t){return new he(e.lineNumber,Ni.clipRange(e.column,t.getLineMinColumn(e.lineNumber),t.getLineMaxColumn(e.lineNumber)))}static clipRange(e,t,i){return ei?i:e}static rightPosition(e,t,i){return iu?(i=u,a?r=t.getLineMaxColumn(i):r=Math.min(t.getLineMaxColumn(i),r)):r=e.columnFromVisibleColumn(t,i,c),f?s=0:s=c-co.visibleColumnFromColumn(t.getLineContent(i),r,e.tabSize),l!==void 0){const g=new he(i,r),p=t.normalizePosition(g,l);s=s+(r-p.column),i=p.lineNumber,r=p.column}return new Sq(i,r,s)}static down(e,t,i,r,s,o,a){return this.vertical(e,t,i,r,s,i+o,a,4)}static moveDown(e,t,i,r,s){let o,a;i.hasSelection()&&!r?(o=i.selection.endLineNumber,a=i.selection.endColumn):(o=i.position.lineNumber,a=i.position.column);let l=0,c;do if(c=Ni.down(e,t,o+l,a,i.leftoverVisibleColumns,s,!0),t.normalizePosition(new he(c.lineNumber,c.column),2).lineNumber>o)break;while(l++<10&&o+l1&&this._isBlankLine(t,s);)s--;for(;s>1&&!this._isBlankLine(t,s);)s--;return i.move(r,s,t.getLineMinColumn(s),0)}static moveToNextBlankLine(e,t,i,r){const s=t.getLineCount();let o=i.position.lineNumber;for(;o=h.length+1)return!1;const f=h.charAt(d.column-2),g=r.get(f);if(!g)return!1;if(Rb(f)){if(i==="never")return!1}else if(t==="never")return!1;const p=h.charAt(d.column-1);let m=!1;for(const _ of g)_.open===f&&_.close===p&&(m=!0);if(!m)return!1;if(e==="auto"){let _=!1;for(let v=0,y=a.length;v1){const s=t.getLineContent(r.lineNumber),o=yl(s),a=o===-1?s.length+1:o+1;if(r.column<=a){const l=i.visibleColumnFromColumn(t,r),c=co.prevIndentTabStop(l,i.indentSize),u=i.columnFromVisibleColumn(t,r.lineNumber,c);return new $(r.lineNumber,u,r.lineNumber,r.column)}}return $.fromPositions(Hw.getPositionAfterDeleteLeft(r,t),r)}static getPositionAfterDeleteLeft(e,t){if(e.column>1){const i=b_t(e.column-1,t.getLineContent(e.lineNumber));return e.with(void 0,i+1)}else if(e.lineNumber>1){const i=e.lineNumber-1;return new he(i,t.getLineMaxColumn(i))}else return e}static cut(e,t,i){const r=[];let s=null;i.sort((o,a)=>he.compare(o.getStartPosition(),a.getEndPosition()));for(let o=0,a=i.length;o1&&s?.endLineNumber!==c.lineNumber?(u=c.lineNumber-1,d=t.getLineMaxColumn(c.lineNumber-1),h=c.lineNumber,f=t.getLineMaxColumn(c.lineNumber)):(u=c.lineNumber,d=1,h=c.lineNumber,f=t.getLineMaxColumn(c.lineNumber));const g=new $(u,d,h,f);s=g,g.isEmpty()?r[o]=null:r[o]=new Sa(g,"")}else r[o]=null;else r[o]=new Sa(l,"")}return new Tc(0,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}}class yi{static _createWord(e,t,i,r,s){return{start:r,end:s,wordType:t,nextCharClass:i}}static _createIntlWord(e,t){return{start:e.index,end:e.index+e.segment.length,wordType:1,nextCharClass:t}}static _findPreviousWordOnLine(e,t,i){const r=t.getLineContent(i.lineNumber);return this._doFindPreviousWordOnLine(r,e,i)}static _doFindPreviousWordOnLine(e,t,i){let r=0;const s=t.findPrevIntlWordBeforeOrAtOffset(e,i.column-2);for(let o=i.column-2;o>=0;o--){const a=e.charCodeAt(o),l=t.get(a);if(s&&o===s.index)return this._createIntlWord(s,l);if(l===0){if(r===2)return this._createWord(e,r,l,o+1,this._findEndOfWord(e,t,r,o+1));r=1}else if(l===2){if(r===1)return this._createWord(e,r,l,o+1,this._findEndOfWord(e,t,r,o+1));r=2}else if(l===1&&r!==0)return this._createWord(e,r,l,o+1,this._findEndOfWord(e,t,r,o+1))}return r!==0?this._createWord(e,r,1,0,this._findEndOfWord(e,t,r,0)):null}static _findEndOfWord(e,t,i,r){const s=t.findNextIntlWordAtOrAfterOffset(e,r),o=e.length;for(let a=r;a=0;o--){const a=e.charCodeAt(o),l=t.get(a);if(s&&o===s.index)return o;if(l===1||i===1&&l===2||i===2&&l===0)return o+1}return 0}static moveWordLeft(e,t,i,r,s){let o=i.lineNumber,a=i.column;a===1&&o>1&&(o=o-1,a=t.getLineMaxColumn(o));let l=yi._findPreviousWordOnLine(e,t,new he(o,a));if(r===0)return new he(o,l?l.start+1:1);if(r===1)return!s&&l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=yi._findPreviousWordOnLine(e,t,new he(o,l.start+1))),new he(o,l?l.start+1:1);if(r===3){for(;l&&l.wordType===2;)l=yi._findPreviousWordOnLine(e,t,new he(o,l.start+1));return new he(o,l?l.start+1:1)}return l&&a<=l.end+1&&(l=yi._findPreviousWordOnLine(e,t,new he(o,l.start+1))),new he(o,l?l.end+1:1)}static _moveWordPartLeft(e,t){const i=t.lineNumber,r=e.getLineMaxColumn(i);if(t.column===1)return i>1?new he(i-1,e.getLineMaxColumn(i-1)):t;const s=e.getLineContent(i);for(let o=t.column-1;o>1;o--){const a=s.charCodeAt(o-2),l=s.charCodeAt(o-1);if(a===95&&l!==95)return new he(i,o);if(a===45&&l!==45)return new he(i,o);if((Tv(a)||w4(a))&&fp(l))return new he(i,o);if(fp(a)&&fp(l)&&o+1=l.start+1&&(l=yi._findNextWordOnLine(e,t,new he(s,l.end+1))),l?o=l.start+1:o=t.getLineMaxColumn(s);return new he(s,o)}static _moveWordPartRight(e,t){const i=t.lineNumber,r=e.getLineMaxColumn(i);if(t.column===r)return i1?c=1:(l--,c=r.getLineMaxColumn(l)):(u&&c<=u.end+1&&(u=yi._findPreviousWordOnLine(i,r,new he(l,u.start+1))),u?c=u.end+1:c>1?c=1:(l--,c=r.getLineMaxColumn(l))),new $(l,c,a.lineNumber,a.column)}static deleteInsideWord(e,t,i){if(!i.isEmpty())return i;const r=new he(i.positionLineNumber,i.positionColumn),s=this._deleteInsideWordWhitespace(t,r);return s||this._deleteInsideWordDetermineDeleteRange(e,t,r)}static _charAtIsWhitespace(e,t){const i=e.charCodeAt(t);return i===32||i===9}static _deleteInsideWordWhitespace(e,t){const i=e.getLineContent(t.lineNumber),r=i.length;if(r===0)return null;let s=Math.max(t.column-2,0);if(!this._charAtIsWhitespace(i,s))return null;let o=Math.min(t.column-1,r-1);if(!this._charAtIsWhitespace(i,o))return null;for(;s>0&&this._charAtIsWhitespace(i,s-1);)s--;for(;o+11?new $(i.lineNumber-1,t.getLineMaxColumn(i.lineNumber-1),i.lineNumber,1):i.lineNumberd.start+1<=i.column&&i.column<=d.end+1,a=(d,h)=>(d=Math.min(d,i.column),h=Math.max(h,i.column),new $(i.lineNumber,d,i.lineNumber,h)),l=d=>{let h=d.start+1,f=d.end+1,g=!1;for(;f-11&&this._charAtIsWhitespace(r,h-2);)h--;return a(h,f)},c=yi._findPreviousWordOnLine(e,t,i);if(c&&o(c))return l(c);const u=yi._findNextWordOnLine(e,t,i);return u&&o(u)?l(u):c&&u?a(c.end+1,u.start+1):c?a(c.start+1,c.end+1):u?a(u.start+1,u.end+1):a(1,s+1)}static _deleteWordPartLeft(e,t){if(!t.isEmpty())return t;const i=t.getPosition(),r=yi._moveWordPartLeft(e,i);return new $(i.lineNumber,i.column,r.lineNumber,r.column)}static _findFirstNonWhitespaceChar(e,t){const i=e.length;for(let r=t;r=h.start+1&&(h=yi._findNextWordOnLine(i,r,new he(l,h.end+1))),h?c=h.start+1:c!!e)}class qo{static addCursorDown(e,t,i){const r=[];let s=0;for(let o=0,a=t.length;oc&&(u=c,d=e.model.getLineMaxColumn(u)),ri.fromModelState(new Ko(new $(o.lineNumber,1,u,d),2,0,new he(u,d),0))}const l=t.modelState.selectionStart.getStartPosition().lineNumber;if(o.lineNumberl){const c=e.getLineCount();let u=a.lineNumber+1,d=1;return u>c&&(u=c,d=e.getLineMaxColumn(u)),ri.fromViewState(t.viewState.move(!0,u,d,0))}else{const c=t.modelState.selectionStart.getEndPosition();return ri.fromModelState(t.modelState.move(!0,c.lineNumber,c.column,0))}}static word(e,t,i,r){const s=e.model.validatePosition(r);return ri.fromModelState(yi.word(e.cursorConfig,e.model,t.modelState,i,s))}static cancelSelection(e,t){if(!t.modelState.hasSelection())return new ri(t.modelState,t.viewState);const i=t.viewState.position.lineNumber,r=t.viewState.position.column;return ri.fromViewState(new Ko(new $(i,r,i,r),0,0,new he(i,r),0))}static moveTo(e,t,i,r,s){if(i){if(t.modelState.selectionStartKind===1)return this.word(e,t,i,r);if(t.modelState.selectionStartKind===2)return this.line(e,t,i,r,s)}const o=e.model.validatePosition(r),a=s?e.coordinatesConverter.validateViewPosition(new he(s.lineNumber,s.column),o):e.coordinatesConverter.convertModelPositionToViewPosition(o);return ri.fromViewState(t.viewState.move(i,a.lineNumber,a.column,0))}static simpleMove(e,t,i,r,s,o){switch(i){case 0:return o===4?this._moveHalfLineLeft(e,t,r):this._moveLeft(e,t,r,s);case 1:return o===4?this._moveHalfLineRight(e,t,r):this._moveRight(e,t,r,s);case 2:return o===2?this._moveUpByViewLines(e,t,r,s):this._moveUpByModelLines(e,t,r,s);case 3:return o===2?this._moveDownByViewLines(e,t,r,s):this._moveDownByModelLines(e,t,r,s);case 4:return o===2?t.map(a=>ri.fromViewState(Ni.moveToPrevBlankLine(e.cursorConfig,e,a.viewState,r))):t.map(a=>ri.fromModelState(Ni.moveToPrevBlankLine(e.cursorConfig,e.model,a.modelState,r)));case 5:return o===2?t.map(a=>ri.fromViewState(Ni.moveToNextBlankLine(e.cursorConfig,e,a.viewState,r))):t.map(a=>ri.fromModelState(Ni.moveToNextBlankLine(e.cursorConfig,e.model,a.modelState,r)));case 6:return this._moveToViewMinColumn(e,t,r);case 7:return this._moveToViewFirstNonWhitespaceColumn(e,t,r);case 8:return this._moveToViewCenterColumn(e,t,r);case 9:return this._moveToViewMaxColumn(e,t,r);case 10:return this._moveToViewLastNonWhitespaceColumn(e,t,r);default:return null}}static viewportMove(e,t,i,r,s){const o=e.getCompletelyVisibleViewRange(),a=e.coordinatesConverter.convertViewRangeToModelRange(o);switch(i){case 11:{const l=this._firstLineNumberInRange(e.model,a,s),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],r,l,c)]}case 13:{const l=this._lastLineNumberInRange(e.model,a,s),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],r,l,c)]}case 12:{const l=Math.round((a.startLineNumber+a.endLineNumber)/2),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],r,l,c)]}case 14:{const l=[];for(let c=0,u=t.length;ci.endLineNumber-1?o=i.endLineNumber-1:sri.fromViewState(Ni.moveLeft(e.cursorConfig,e,s.viewState,i,r)))}static _moveHalfLineLeft(e,t,i){const r=[];for(let s=0,o=t.length;sri.fromViewState(Ni.moveRight(e.cursorConfig,e,s.viewState,i,r)))}static _moveHalfLineRight(e,t,i){const r=[];for(let s=0,o=t.length;s{this.model.tokenization.forceTokenization(f);const g=this.model.tokenization.getLineTokens(f),p=this.model.getLineMaxColumn(f)-1;return Iy(g,p)};this.model.tokenization.forceTokenization(e.startLineNumber);const i=this.model.tokenization.getLineTokens(e.startLineNumber),r=Iy(i,e.startColumn-1),s=Fs.createEmpty("",r.languageIdCodec),o=e.startLineNumber-1;if(o===0||!(r.firstCharOffset===0))return s;const c=t(o);if(!(r.languageId===c.languageId))return s;const d=c.toIViewLineTokens();return this.indentationLineProcessor.getProcessedTokens(d)}}class l8e{constructor(e,t){this.model=e,this.languageConfigurationService=t}getProcessedLine(e,t){const i=(o,a)=>{const l=Ji(o);return a+o.substring(l.length)};this.model.tokenization.forceTokenization?.(e);const r=this.model.tokenization.getLineTokens(e);let s=this.getProcessedTokens(r).getLineContent();return t!==void 0&&(s=i(s,t)),s}getProcessedTokens(e){const t=l=>l===2||l===3||l===1,i=e.getLanguageId(0),s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew.getBracketRegExp({global:!0}),o=[];return e.forEach(l=>{const c=e.getStandardTokenType(l);let u=e.getTokenText(l);t(c)&&(u=u.replace(s,""));const d=e.getMetadata(l);o.push({text:u,metadata:d})}),Fs.createFromTextAndMetadata(o,e.languageIdCodec)}}function Fce(n,e){n.tokenization.forceTokenization(e.lineNumber);const t=n.tokenization.getLineTokens(e.lineNumber),i=Iy(t,e.column-1),r=i.firstCharOffset===0,s=t.getLanguageId(0)===i.languageId;return!r&&!s}function xk(n,e,t,i){e.tokenization.forceTokenization(t.startLineNumber);const r=e.getLanguageIdAtPosition(t.startLineNumber,t.startColumn),s=i.getLanguageConfiguration(r);if(!s)return null;const a=new Mce(e,i).getProcessedTokenContextAroundRange(t),l=a.previousLineProcessedTokens.getLineContent(),c=a.beforeRangeProcessedTokens.getLineContent(),u=a.afterRangeProcessedTokens.getLineContent(),d=s.onEnter(n,l,c,u);if(!d)return null;const h=d.indentAction;let f=d.appendText;const g=d.removeText||0;f?h===zs.Indent&&(f=" "+f):h===zs.Indent||h===zs.IndentOutdent?f=" ":f="";let p=H3e(e,t.startLineNumber,t.startColumn);return g&&(p=p.substring(0,p.length-g)),{indentAction:h,appendText:f,removeText:g,indentation:p}}var oAt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},aAt=function(n,e){return function(t,i){e(t,i,n)}},u5;const kq=Object.create(null);function N1(n,e){if(e<=0)return"";kq[n]||(kq[n]=["",n]);const t=kq[n];for(let i=t.length;i<=e;i++)t[i]=t[i-1]+n;return t[e]}let nh=u5=class{static unshiftIndent(e,t,i,r,s){const o=co.visibleColumnFromColumn(e,t,i);if(s){const a=N1(" ",r),c=co.prevIndentTabStop(o,r)/r;return N1(a,c)}else{const a=" ",c=co.prevRenderTabStop(o,i)/i;return N1(a,c)}}static shiftIndent(e,t,i,r,s){const o=co.visibleColumnFromColumn(e,t,i);if(s){const a=N1(" ",r),c=co.nextIndentTabStop(o,r)/r;return N1(a,c)}else{const a=" ",c=co.nextRenderTabStop(o,i)/i;return N1(a,c)}}constructor(e,t,i){this._languageConfigurationService=i,this._opts=t,this._selection=e,this._selectionId=null,this._useLastEditRangeForCursorEndPosition=!1,this._selectionStartColumnStaysPut=!1}_addEditOperation(e,t,i){this._useLastEditRangeForCursorEndPosition?e.addTrackedEditOperation(t,i):e.addEditOperation(t,i)}getEditOperations(e,t){const i=this._selection.startLineNumber;let r=this._selection.endLineNumber;this._selection.endColumn===1&&i!==r&&(r=r-1);const{tabSize:s,indentSize:o,insertSpaces:a}=this._opts,l=i===r;if(this._opts.useTabStops){this._selection.isEmpty()&&/^\s*$/.test(e.getLineContent(i))&&(this._useLastEditRangeForCursorEndPosition=!0);let c=0,u=0;for(let d=i;d<=r;d++,c=u){u=0;const h=e.getLineContent(d);let f=yl(h);if(this._opts.isUnshift&&(h.length===0||f===0)||!l&&!this._opts.isUnshift&&h.length===0)continue;if(f===-1&&(f=h.length),d>1&&co.visibleColumnFromColumn(h,f+1,s)%o!==0&&e.tokenization.isCheapToTokenize(d-1)){const m=xk(this._opts.autoIndent,e,new $(d-1,e.getLineMaxColumn(d-1),d-1,e.getLineMaxColumn(d-1)),this._languageConfigurationService);if(m){if(u=c,m.appendText)for(let _=0,v=m.appendText.length;_1){let r,s=-1;for(r=e-1;r>=1;r--){if(n.tokenization.getLanguageIdAtPosition(r,0)!==i)return s;const o=n.getLineContent(r);if(t.shouldIgnore(r)||/^\s+$/.test(o)||o===""){s=r;continue}return r}}return-1}function KN(n,e,t,i=!0,r){if(n<4)return null;const s=r.getLanguageConfiguration(e.tokenization.getLanguageId()).indentRulesSupport;if(!s)return null;const o=new Oce(e,s,r);if(t<=1)return{indentation:"",action:null};for(let l=t-1;l>0&&e.getLineContent(l)==="";l--)if(l===1)return{indentation:"",action:null};const a=uAt(e,t,o);if(a<0)return null;if(a<1)return{indentation:"",action:null};if(o.shouldIncrease(a)||o.shouldIndentNextLine(a)){const l=e.getLineContent(a);return{indentation:Ji(l),action:zs.Indent,line:a}}else if(o.shouldDecrease(a)){const l=e.getLineContent(a);return{indentation:Ji(l),action:null,line:a}}else{if(a===1)return{indentation:Ji(e.getLineContent(a)),action:null,line:a};const l=a-1,c=s.getIndentMetadata(e.getLineContent(l));if(!(c&3)&&c&4){let u=0;for(let d=l-1;d>0;d--)if(!o.shouldIndentNextLine(d)){u=d;break}return{indentation:Ji(e.getLineContent(u+1)),action:null,line:u+1}}if(i)return{indentation:Ji(e.getLineContent(a)),action:null,line:a};for(let u=a;u>0;u--){if(o.shouldIncrease(u))return{indentation:Ji(e.getLineContent(u)),action:zs.Indent,line:u};if(o.shouldIndentNextLine(u)){let d=0;for(let h=u-1;h>0;h--)if(!o.shouldIndentNextLine(u)){d=h;break}return{indentation:Ji(e.getLineContent(d+1)),action:null,line:d+1}}else if(o.shouldDecrease(u))return{indentation:Ji(e.getLineContent(u)),action:null,line:u}}return{indentation:Ji(e.getLineContent(1)),action:null,line:1}}}function RI(n,e,t,i,r,s){if(n<4)return null;const o=s.getLanguageConfiguration(t);if(!o)return null;const a=s.getLanguageConfiguration(t).indentRulesSupport;if(!a)return null;const l=new Oce(e,a,s),c=KN(n,e,i,void 0,s);if(c){const u=c.line;if(u!==void 0){let d=!0;for(let h=u;h0){const _=e.getLineContent(m);if(c.shouldIndentNextLine(_)&&c.shouldIncrease(p)){const y=KN(o,e,t.startLineNumber,!1,s)?.indentation;if(y!==void 0){const C=e.getLineContent(t.startLineNumber),x=Ji(C),L=r.shiftIndent(y)===x,D=/^\s*$/.test(g),I=n.autoClosingPairs.autoClosingPairsOpenByEnd.get(i),M=I&&I.length>0&&D;if(L&&M)return y}}}return null}function c8e(n,e,t){const i=t.getLanguageConfiguration(n.getLanguageId()).indentRulesSupport;return!i||e<1||e>n.getLineCount()?null:i.getIndentMetadata(n.getLineContent(e))}function fAt(n,e,t){return{tokenization:{getLineTokens:r=>r===e?t:n.tokenization.getLineTokens(r),getLanguageId:()=>n.getLanguageId(),getLanguageIdAtPosition:(r,s)=>n.getLanguageIdAtPosition(r,s)},getLineContent:r=>r===e?t.getLineContent():n.getLineContent(r)}}class gAt{static getEdits(e,t,i,r,s){if(!s&&this._isAutoIndentType(e,t,i)){const o=[];for(const l of i){const c=this._findActualIndentationForSelection(e,t,l,r);if(c===null)return;o.push({selection:l,indentation:c})}const a=RJ.getAutoClosingPairClose(e,t,i,r,!1);return this._getIndentationAndAutoClosingPairEdits(e,t,o,r,a)}}static _isAutoIndentType(e,t,i){if(e.autoIndent<4)return!1;for(let r=0,s=i.length;rWce(e,a),unshiftIndent:a=>f9(e,a)},e.languageConfigurationService);if(s===null)return null;const o=H3e(t,i.startLineNumber,i.startColumn);return s===e.normalizeIndentation(o)?null:s}static _getIndentationAndAutoClosingPairEdits(e,t,i,r,s){const o=i.map(({selection:l,indentation:c})=>{if(s!==null){const u=this._getEditFromIndentationAndSelection(e,t,c,l,r,!1);return new kAt(u,l,r,s)}else{const u=this._getEditFromIndentationAndSelection(e,t,c,l,r,!0);return G1(u.range,u.text,!1)}}),a={shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1};return new Tc(4,o,a)}static _getEditFromIndentationAndSelection(e,t,i,r,s,o=!0){const a=r.startLineNumber,l=t.getLineFirstNonWhitespaceColumn(a);let c=e.normalizeIndentation(i);if(l!==0){const d=t.getLineContent(a);c+=d.substring(l-1,r.startColumn-1)}return c+=o?s:"",{range:new $(a,1,r.endLineNumber,r.endColumn),text:c}}}class pAt{static getEdits(e,t,i,r,s,o){if(u8e(t,i,r,s,o))return this._runAutoClosingOvertype(e,r,o)}static _runAutoClosingOvertype(e,t,i){const r=[];for(let s=0,o=t.length;snew Sa(new $(a.positionLineNumber,a.positionColumn,a.positionLineNumber,a.positionColumn+1),"",!1));return new Tc(4,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}}class RJ{static getEdits(e,t,i,r,s,o){if(!o){const a=this.getAutoClosingPairClose(e,t,i,r,s);if(a!==null)return this._runAutoClosingOpenCharType(i,r,s,a)}}static _runAutoClosingOpenCharType(e,t,i,r){const s=[];for(let o=0,a=e.length;o{const p=g.getPosition();return s?{lineNumber:p.lineNumber,beforeColumn:p.column-r.length,afterColumn:p.column}:{lineNumber:p.lineNumber,beforeColumn:p.column,afterColumn:p.column}}),a=this._findAutoClosingPairOpen(e,t,o.map(g=>new he(g.lineNumber,g.beforeColumn)),r);if(!a)return null;let l,c;if(Rb(r)?(l=e.autoClosingQuotes,c=e.shouldAutoCloseBefore.quote):(e.blockCommentStartToken?a.open.includes(e.blockCommentStartToken):!1)?(l=e.autoClosingComments,c=e.shouldAutoCloseBefore.comment):(l=e.autoClosingBrackets,c=e.shouldAutoCloseBefore.bracket),l==="never")return null;const d=this._findContainedAutoClosingPair(e,a),h=d?d.close:"";let f=!0;for(const g of o){const{lineNumber:p,beforeColumn:m,afterColumn:_}=g,v=t.getLineContent(p),y=v.substring(0,m-1),C=v.substring(_-1);if(C.startsWith(h)||(f=!1),C.length>0){const D=C.charAt(0);if(!this._isBeforeClosingBrace(e,C)&&!c(D))return null}if(a.open.length===1&&(r==="'"||r==='"')&&l!=="always"){const D=eh(e.wordSeparators,[]);if(y.length>0){const I=y.charCodeAt(y.length-1);if(D.get(I)===0)return null}}if(!t.tokenization.isCheapToTokenize(p))return null;t.tokenization.forceTokenization(p);const x=t.tokenization.getLineTokens(p),k=Iy(x,m-1);if(!a.shouldAutoClose(k,m-k.firstCharOffset))return null;const L=a.findNeutralCharacter();if(L){const D=t.tokenization.getTokenTypeIfInsertingCharacter(p,m,L);if(!a.isOK(D))return null}}return f?a.close.substring(0,a.close.length-h.length):a.close}static _findContainedAutoClosingPair(e,t){if(t.open.length<=1)return null;const i=t.close.charAt(t.close.length-1),r=e.autoClosingPairs.autoClosingPairsCloseByEnd.get(i)||[];let s=null;for(const o of r)o.open!==t.open&&t.open.includes(o.open)&&t.close.endsWith(o.close)&&(!s||o.open.length>s.open.length)&&(s=o);return s}static _findAutoClosingPairOpen(e,t,i,r){const s=e.autoClosingPairs.autoClosingPairsOpenByEnd.get(r);if(!s)return null;let o=null;for(const a of s)if(o===null||a.open.length>o.open.length){let l=!0;for(const c of i)if(t.getValueInRange(new $(c.lineNumber,c.column-a.open.length+1,c.lineNumber,c.column))+r!==a.open){l=!1;break}l&&(o=a)}return o}static _isBeforeClosingBrace(e,t){const i=t.charAt(0),r=e.autoClosingPairs.autoClosingPairsOpenByStart.get(i)||[],s=e.autoClosingPairs.autoClosingPairsCloseByStart.get(i)||[],o=r.some(l=>t.startsWith(l.open)),a=s.some(l=>t.startsWith(l.close));return!o&&a}}class _At{static getEdits(e,t,i,r,s){if(!s&&this._isSurroundSelectionType(e,t,i,r))return this._runSurroundSelectionType(e,i,r)}static _runSurroundSelectionType(e,t,i){const r=[];for(let s=0,o=t.length;s{this.model.tokenization.forceTokenization(f);const g=this.model.tokenization.getLineTokens(f),p=this.model.getLineMaxColumn(f)-1;return Iy(g,p)};this.model.tokenization.forceTokenization(e.startLineNumber);const i=this.model.tokenization.getLineTokens(e.startLineNumber),r=Iy(i,e.startColumn-1),s=Fs.createEmpty("",r.languageIdCodec),o=e.startLineNumber-1;if(o===0||!(r.firstCharOffset===0))return s;const c=t(o);if(!(r.languageId===c.languageId))return s;const d=c.toIViewLineTokens();return this.indentationLineProcessor.getProcessedTokens(d)}}class l8e{constructor(e,t){this.model=e,this.languageConfigurationService=t}getProcessedLine(e,t){const i=(o,a)=>{const l=Ji(o);return a+o.substring(l.length)};this.model.tokenization.forceTokenization?.(e);const r=this.model.tokenization.getLineTokens(e);let s=this.getProcessedTokens(r).getLineContent();return t!==void 0&&(s=i(s,t)),s}getProcessedTokens(e){const t=l=>l===2||l===3||l===1,i=e.getLanguageId(0),s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew.getBracketRegExp({global:!0}),o=[];return e.forEach(l=>{const c=e.getStandardTokenType(l);let u=e.getTokenText(l);t(c)&&(u=u.replace(s,""));const d=e.getMetadata(l);o.push({text:u,metadata:d})}),Fs.createFromTextAndMetadata(o,e.languageIdCodec)}}function Fce(n,e){n.tokenization.forceTokenization(e.lineNumber);const t=n.tokenization.getLineTokens(e.lineNumber),i=Iy(t,e.column-1),r=i.firstCharOffset===0,s=t.getLanguageId(0)===i.languageId;return!r&&!s}function xk(n,e,t,i){e.tokenization.forceTokenization(t.startLineNumber);const r=e.getLanguageIdAtPosition(t.startLineNumber,t.startColumn),s=i.getLanguageConfiguration(r);if(!s)return null;const a=new Mce(e,i).getProcessedTokenContextAroundRange(t),l=a.previousLineProcessedTokens.getLineContent(),c=a.beforeRangeProcessedTokens.getLineContent(),u=a.afterRangeProcessedTokens.getLineContent(),d=s.onEnter(n,l,c,u);if(!d)return null;const h=d.indentAction;let f=d.appendText;const g=d.removeText||0;f?h===zs.Indent&&(f=" "+f):h===zs.Indent||h===zs.IndentOutdent?f=" ":f="";let p=H3e(e,t.startLineNumber,t.startColumn);return g&&(p=p.substring(0,p.length-g)),{indentAction:h,appendText:f,removeText:g,indentation:p}}var oAt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},aAt=function(n,e){return function(t,i){e(t,i,n)}},uF;const kq=Object.create(null);function N1(n,e){if(e<=0)return"";kq[n]||(kq[n]=["",n]);const t=kq[n];for(let i=t.length;i<=e;i++)t[i]=t[i-1]+n;return t[e]}let nh=uF=class{static unshiftIndent(e,t,i,r,s){const o=co.visibleColumnFromColumn(e,t,i);if(s){const a=N1(" ",r),c=co.prevIndentTabStop(o,r)/r;return N1(a,c)}else{const a=" ",c=co.prevRenderTabStop(o,i)/i;return N1(a,c)}}static shiftIndent(e,t,i,r,s){const o=co.visibleColumnFromColumn(e,t,i);if(s){const a=N1(" ",r),c=co.nextIndentTabStop(o,r)/r;return N1(a,c)}else{const a=" ",c=co.nextRenderTabStop(o,i)/i;return N1(a,c)}}constructor(e,t,i){this._languageConfigurationService=i,this._opts=t,this._selection=e,this._selectionId=null,this._useLastEditRangeForCursorEndPosition=!1,this._selectionStartColumnStaysPut=!1}_addEditOperation(e,t,i){this._useLastEditRangeForCursorEndPosition?e.addTrackedEditOperation(t,i):e.addEditOperation(t,i)}getEditOperations(e,t){const i=this._selection.startLineNumber;let r=this._selection.endLineNumber;this._selection.endColumn===1&&i!==r&&(r=r-1);const{tabSize:s,indentSize:o,insertSpaces:a}=this._opts,l=i===r;if(this._opts.useTabStops){this._selection.isEmpty()&&/^\s*$/.test(e.getLineContent(i))&&(this._useLastEditRangeForCursorEndPosition=!0);let c=0,u=0;for(let d=i;d<=r;d++,c=u){u=0;const h=e.getLineContent(d);let f=yl(h);if(this._opts.isUnshift&&(h.length===0||f===0)||!l&&!this._opts.isUnshift&&h.length===0)continue;if(f===-1&&(f=h.length),d>1&&co.visibleColumnFromColumn(h,f+1,s)%o!==0&&e.tokenization.isCheapToTokenize(d-1)){const m=xk(this._opts.autoIndent,e,new $(d-1,e.getLineMaxColumn(d-1),d-1,e.getLineMaxColumn(d-1)),this._languageConfigurationService);if(m){if(u=c,m.appendText)for(let _=0,v=m.appendText.length;_1){let r,s=-1;for(r=e-1;r>=1;r--){if(n.tokenization.getLanguageIdAtPosition(r,0)!==i)return s;const o=n.getLineContent(r);if(t.shouldIgnore(r)||/^\s+$/.test(o)||o===""){s=r;continue}return r}}return-1}function KN(n,e,t,i=!0,r){if(n<4)return null;const s=r.getLanguageConfiguration(e.tokenization.getLanguageId()).indentRulesSupport;if(!s)return null;const o=new Oce(e,s,r);if(t<=1)return{indentation:"",action:null};for(let l=t-1;l>0&&e.getLineContent(l)==="";l--)if(l===1)return{indentation:"",action:null};const a=uAt(e,t,o);if(a<0)return null;if(a<1)return{indentation:"",action:null};if(o.shouldIncrease(a)||o.shouldIndentNextLine(a)){const l=e.getLineContent(a);return{indentation:Ji(l),action:zs.Indent,line:a}}else if(o.shouldDecrease(a)){const l=e.getLineContent(a);return{indentation:Ji(l),action:null,line:a}}else{if(a===1)return{indentation:Ji(e.getLineContent(a)),action:null,line:a};const l=a-1,c=s.getIndentMetadata(e.getLineContent(l));if(!(c&3)&&c&4){let u=0;for(let d=l-1;d>0;d--)if(!o.shouldIndentNextLine(d)){u=d;break}return{indentation:Ji(e.getLineContent(u+1)),action:null,line:u+1}}if(i)return{indentation:Ji(e.getLineContent(a)),action:null,line:a};for(let u=a;u>0;u--){if(o.shouldIncrease(u))return{indentation:Ji(e.getLineContent(u)),action:zs.Indent,line:u};if(o.shouldIndentNextLine(u)){let d=0;for(let h=u-1;h>0;h--)if(!o.shouldIndentNextLine(u)){d=h;break}return{indentation:Ji(e.getLineContent(d+1)),action:null,line:d+1}}else if(o.shouldDecrease(u))return{indentation:Ji(e.getLineContent(u)),action:null,line:u}}return{indentation:Ji(e.getLineContent(1)),action:null,line:1}}}function RI(n,e,t,i,r,s){if(n<4)return null;const o=s.getLanguageConfiguration(t);if(!o)return null;const a=s.getLanguageConfiguration(t).indentRulesSupport;if(!a)return null;const l=new Oce(e,a,s),c=KN(n,e,i,void 0,s);if(c){const u=c.line;if(u!==void 0){let d=!0;for(let h=u;h0){const _=e.getLineContent(m);if(c.shouldIndentNextLine(_)&&c.shouldIncrease(p)){const y=KN(o,e,t.startLineNumber,!1,s)?.indentation;if(y!==void 0){const C=e.getLineContent(t.startLineNumber),x=Ji(C),L=r.shiftIndent(y)===x,D=/^\s*$/.test(g),I=n.autoClosingPairs.autoClosingPairsOpenByEnd.get(i),M=I&&I.length>0&&D;if(L&&M)return y}}}return null}function c8e(n,e,t){const i=t.getLanguageConfiguration(n.getLanguageId()).indentRulesSupport;return!i||e<1||e>n.getLineCount()?null:i.getIndentMetadata(n.getLineContent(e))}function fAt(n,e,t){return{tokenization:{getLineTokens:r=>r===e?t:n.tokenization.getLineTokens(r),getLanguageId:()=>n.getLanguageId(),getLanguageIdAtPosition:(r,s)=>n.getLanguageIdAtPosition(r,s)},getLineContent:r=>r===e?t.getLineContent():n.getLineContent(r)}}class gAt{static getEdits(e,t,i,r,s){if(!s&&this._isAutoIndentType(e,t,i)){const o=[];for(const l of i){const c=this._findActualIndentationForSelection(e,t,l,r);if(c===null)return;o.push({selection:l,indentation:c})}const a=RJ.getAutoClosingPairClose(e,t,i,r,!1);return this._getIndentationAndAutoClosingPairEdits(e,t,o,r,a)}}static _isAutoIndentType(e,t,i){if(e.autoIndent<4)return!1;for(let r=0,s=i.length;rWce(e,a),unshiftIndent:a=>f9(e,a)},e.languageConfigurationService);if(s===null)return null;const o=H3e(t,i.startLineNumber,i.startColumn);return s===e.normalizeIndentation(o)?null:s}static _getIndentationAndAutoClosingPairEdits(e,t,i,r,s){const o=i.map(({selection:l,indentation:c})=>{if(s!==null){const u=this._getEditFromIndentationAndSelection(e,t,c,l,r,!1);return new kAt(u,l,r,s)}else{const u=this._getEditFromIndentationAndSelection(e,t,c,l,r,!0);return G1(u.range,u.text,!1)}}),a={shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1};return new Tc(4,o,a)}static _getEditFromIndentationAndSelection(e,t,i,r,s,o=!0){const a=r.startLineNumber,l=t.getLineFirstNonWhitespaceColumn(a);let c=e.normalizeIndentation(i);if(l!==0){const d=t.getLineContent(a);c+=d.substring(l-1,r.startColumn-1)}return c+=o?s:"",{range:new $(a,1,r.endLineNumber,r.endColumn),text:c}}}class pAt{static getEdits(e,t,i,r,s,o){if(u8e(t,i,r,s,o))return this._runAutoClosingOvertype(e,r,o)}static _runAutoClosingOvertype(e,t,i){const r=[];for(let s=0,o=t.length;snew Sa(new $(a.positionLineNumber,a.positionColumn,a.positionLineNumber,a.positionColumn+1),"",!1));return new Tc(4,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}}class RJ{static getEdits(e,t,i,r,s,o){if(!o){const a=this.getAutoClosingPairClose(e,t,i,r,s);if(a!==null)return this._runAutoClosingOpenCharType(i,r,s,a)}}static _runAutoClosingOpenCharType(e,t,i,r){const s=[];for(let o=0,a=e.length;o{const p=g.getPosition();return s?{lineNumber:p.lineNumber,beforeColumn:p.column-r.length,afterColumn:p.column}:{lineNumber:p.lineNumber,beforeColumn:p.column,afterColumn:p.column}}),a=this._findAutoClosingPairOpen(e,t,o.map(g=>new he(g.lineNumber,g.beforeColumn)),r);if(!a)return null;let l,c;if(Rb(r)?(l=e.autoClosingQuotes,c=e.shouldAutoCloseBefore.quote):(e.blockCommentStartToken?a.open.includes(e.blockCommentStartToken):!1)?(l=e.autoClosingComments,c=e.shouldAutoCloseBefore.comment):(l=e.autoClosingBrackets,c=e.shouldAutoCloseBefore.bracket),l==="never")return null;const d=this._findContainedAutoClosingPair(e,a),h=d?d.close:"";let f=!0;for(const g of o){const{lineNumber:p,beforeColumn:m,afterColumn:_}=g,v=t.getLineContent(p),y=v.substring(0,m-1),C=v.substring(_-1);if(C.startsWith(h)||(f=!1),C.length>0){const D=C.charAt(0);if(!this._isBeforeClosingBrace(e,C)&&!c(D))return null}if(a.open.length===1&&(r==="'"||r==='"')&&l!=="always"){const D=eh(e.wordSeparators,[]);if(y.length>0){const I=y.charCodeAt(y.length-1);if(D.get(I)===0)return null}}if(!t.tokenization.isCheapToTokenize(p))return null;t.tokenization.forceTokenization(p);const x=t.tokenization.getLineTokens(p),k=Iy(x,m-1);if(!a.shouldAutoClose(k,m-k.firstCharOffset))return null;const L=a.findNeutralCharacter();if(L){const D=t.tokenization.getTokenTypeIfInsertingCharacter(p,m,L);if(!a.isOK(D))return null}}return f?a.close.substring(0,a.close.length-h.length):a.close}static _findContainedAutoClosingPair(e,t){if(t.open.length<=1)return null;const i=t.close.charAt(t.close.length-1),r=e.autoClosingPairs.autoClosingPairsCloseByEnd.get(i)||[];let s=null;for(const o of r)o.open!==t.open&&t.open.includes(o.open)&&t.close.endsWith(o.close)&&(!s||o.open.length>s.open.length)&&(s=o);return s}static _findAutoClosingPairOpen(e,t,i,r){const s=e.autoClosingPairs.autoClosingPairsOpenByEnd.get(r);if(!s)return null;let o=null;for(const a of s)if(o===null||a.open.length>o.open.length){let l=!0;for(const c of i)if(t.getValueInRange(new $(c.lineNumber,c.column-a.open.length+1,c.lineNumber,c.column))+r!==a.open){l=!1;break}l&&(o=a)}return o}static _isBeforeClosingBrace(e,t){const i=t.charAt(0),r=e.autoClosingPairs.autoClosingPairsOpenByStart.get(i)||[],s=e.autoClosingPairs.autoClosingPairsCloseByStart.get(i)||[],o=r.some(l=>t.startsWith(l.open)),a=s.some(l=>t.startsWith(l.close));return!o&&a}}class _At{static getEdits(e,t,i,r,s){if(!s&&this._isSurroundSelectionType(e,t,i,r))return this._runSurroundSelectionType(e,i,r)}static _runSurroundSelectionType(e,t,i){const r=[];for(let s=0,o=t.length;s=4){const l=dAt(e.autoIndent,t,r,{unshiftIndent:c=>f9(e,c),shiftIndent:c=>Wce(e,c),normalizeIndentation:c=>e.normalizeIndentation(c)},e.languageConfigurationService);if(l){let c=e.visibleColumnFromColumn(t,r.getEndPosition());const u=r.endColumn,d=t.getLineContent(r.endLineNumber),h=yl(d);if(h>=0?r=r.setEndPosition(r.endLineNumber,Math.max(r.endColumn,h+1)):r=r.setEndPosition(r.endLineNumber,t.getLineMaxColumn(r.endLineNumber)),i)return new c5(r,` +`+l;return i?new cF(r,u,!0):new d9(r,u,-1,c.length-l.length,!0)}else if(s.indentAction===zs.Outdent){const l=f9(e,s.indentation);return G1(r,` +`+e.normalizeIndentation(l+s.appendText),i)}}const o=t.getLineContent(r.startLineNumber),a=Ji(o).substring(0,r.startColumn-1);if(e.autoIndent>=4){const l=dAt(e.autoIndent,t,r,{unshiftIndent:c=>f9(e,c),shiftIndent:c=>Wce(e,c),normalizeIndentation:c=>e.normalizeIndentation(c)},e.languageConfigurationService);if(l){let c=e.visibleColumnFromColumn(t,r.getEndPosition());const u=r.endColumn,d=t.getLineContent(r.endLineNumber),h=yl(d);if(h>=0?r=r.setEndPosition(r.endLineNumber,Math.max(r.endColumn,h+1)):r=r.setEndPosition(r.endLineNumber,t.getLineMaxColumn(r.endLineNumber)),i)return new cF(r,` `+e.normalizeIndentation(l.afterEnter),!0);{let f=0;return u<=h+1&&(e.insertSpaces||(c=Math.ceil(c/e.indentSize)),f=Math.min(c+1-e.normalizeIndentation(l.afterEnter).length-1,0)),new d9(r,` `+e.normalizeIndentation(l.afterEnter),0,f,!0)}}}return G1(r,` -`+e.normalizeIndentation(a),i)}static lineInsertBefore(e,t,i){if(t===null||i===null)return[];const r=[];for(let s=0,o=i.length;sthis._compositionType(i,u,s,o,a,l));return new Tc(4,c,{shouldPushStackElementBefore:KW(e,4),shouldPushStackElementAfter:!1})}static _compositionType(e,t,i,r,s,o){if(!t.isEmpty())return null;const a=t.getPosition(),l=Math.max(1,a.column-r),c=Math.min(e.getLineMaxColumn(a.lineNumber),a.column+s),u=new $(a.lineNumber,l,a.lineNumber,c);return e.getValueInRange(u)===i&&o===0?null:new d9(u,i,0,o)}}class CAt{static getEdits(e,t,i){const r=[];for(let o=0,a=t.length;o1){let a;for(a=i-1;a>=1;a--){const u=t.getLineContent(a);if(pg(u)>=0)break}if(a<1)return null;const l=t.getLineMaxColumn(a),c=xk(e.autoIndent,t,new $(a,l,a,l),e.languageConfigurationService);c&&(s=c.indentation+c.appendText)}return r&&(r===zs.Indent&&(s=Wce(e,s)),r===zs.Outdent&&(s=f9(e,s)),s=e.normalizeIndentation(s)),s||null}static _replaceJumpToNextIndent(e,t,i,r){let s="";const o=i.getStartPosition();if(e.insertSpaces){const a=e.visibleColumnFromColumn(t,o),l=e.indentSize,c=l-a%l;for(let u=0;u2?c.charCodeAt(l.column-2):0)===92&&d)return!1;if(n.autoClosingOvertype==="auto"){let f=!1;for(let g=0,p=i.length;g{const r=t.get(ai).getFocusedCodeEditor();return r&&r.hasTextFocus()?this._runEditorCommand(t,r,i):!1}),e.addImplementation(1e3,"generic-dom-input-textarea",(t,i)=>{const r=ka();return r&&["input","textarea"].indexOf(r.tagName.toLowerCase())>=0?(this.runDOMCommand(r),!0):!1}),e.addImplementation(0,"generic-dom",(t,i)=>{const r=t.get(ai).getActiveCodeEditor();return r?(r.focus(),this._runEditorCommand(t,r,i)):!1})}_runEditorCommand(e,t,i){const r=this.runEditorCommand(e,t,i);return r||!0}}var Io;(function(n){class e extends fs{constructor(v){super(v),this._inSelectionMode=v.inSelectionMode}runCoreEditorCommand(v,y){if(!y.position)return;v.model.pushStackElement(),v.setCursorStates(y.source,3,[qo.moveTo(v,v.getPrimaryCursorState(),this._inSelectionMode,y.position,y.viewPosition)])&&y.revealType!==2&&v.revealAllCursors(y.source,!0,!0)}}n.MoveTo=Je(new e({id:"_moveTo",inSelectionMode:!1,precondition:void 0})),n.MoveToSelect=Je(new e({id:"_moveToSelect",inSelectionMode:!0,precondition:void 0}));class t extends fs{runCoreEditorCommand(v,y){v.model.pushStackElement();const C=this._getColumnSelectResult(v,v.getPrimaryCursorState(),v.getCursorColumnSelectData(),y);C!==null&&(v.setCursorStates(y.source,3,C.viewStates.map(x=>ri.fromViewState(x))),v.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:C.fromLineNumber,fromViewVisualColumn:C.fromVisualColumn,toViewLineNumber:C.toLineNumber,toViewVisualColumn:C.toVisualColumn}),C.reversed?v.revealTopMostCursor(y.source):v.revealBottomMostCursor(y.source))}}n.ColumnSelect=Je(new class extends t{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(_,v,y,C){if(typeof C.position>"u"||typeof C.viewPosition>"u"||typeof C.mouseColumn>"u")return null;const x=_.model.validatePosition(C.position),k=_.coordinatesConverter.validateViewPosition(new he(C.viewPosition.lineNumber,C.viewPosition.column),x),L=C.doColumnSelect?y.fromViewLineNumber:k.lineNumber,D=C.doColumnSelect?y.fromViewVisualColumn:C.mouseColumn-1;return vy.columnSelect(_.cursorConfig,_,L,D,k.lineNumber,C.mouseColumn-1)}}),n.CursorColumnSelectLeft=Je(new class extends t{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(_,v,y,C){return vy.columnSelectLeft(_.cursorConfig,_,y)}}),n.CursorColumnSelectRight=Je(new class extends t{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(_,v,y,C){return vy.columnSelectRight(_.cursorConfig,_,y)}});class i extends t{constructor(v){super(v),this._isPaged=v.isPaged}_getColumnSelectResult(v,y,C,x){return vy.columnSelectUp(v.cursorConfig,v,C,this._isPaged)}}n.CursorColumnSelectUp=Je(new i({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3600,linux:{primary:0}}})),n.CursorColumnSelectPageUp=Je(new i({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3595,linux:{primary:0}}}));class r extends t{constructor(v){super(v),this._isPaged=v.isPaged}_getColumnSelectResult(v,y,C,x){return vy.columnSelectDown(v.cursorConfig,v,C,this._isPaged)}}n.CursorColumnSelectDown=Je(new r({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3602,linux:{primary:0}}})),n.CursorColumnSelectPageDown=Je(new r({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3596,linux:{primary:0}}}));class s extends fs{constructor(){super({id:"cursorMove",precondition:void 0,metadata:h9.metadata})}runCoreEditorCommand(v,y){const C=h9.parse(y);C&&this._runCursorMove(v,y.source,C)}_runCursorMove(v,y,C){v.model.pushStackElement(),v.setCursorStates(y,3,s._move(v,v.getCursorStates(),C)),v.revealAllCursors(y,!0)}static _move(v,y,C){const x=C.select,k=C.value;switch(C.direction){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:return qo.simpleMove(v,y,C.direction,x,k,C.unit);case 11:case 13:case 12:case 14:return qo.viewportMove(v,y,C.direction,x,k);default:return null}}}n.CursorMoveImpl=s,n.CursorMove=Je(new s);class o extends fs{constructor(v){super(v),this._staticArgs=v.args}runCoreEditorCommand(v,y){let C=this._staticArgs;this._staticArgs.value===-1&&(C={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:y.pageSize||v.cursorConfig.pageSize}),v.model.pushStackElement(),v.setCursorStates(y.source,3,qo.simpleMove(v,v.getCursorStates(),C.direction,C.select,C.value,C.unit)),v.revealAllCursors(y.source,!0)}}n.CursorLeft=Je(new o({args:{direction:0,unit:0,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),n.CursorLeftSelect=Je(new o({args:{direction:0,unit:0,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1039}})),n.CursorRight=Je(new o({args:{direction:1,unit:0,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),n.CursorRightSelect=Je(new o({args:{direction:1,unit:0,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1041}})),n.CursorUp=Je(new o({args:{direction:2,unit:2,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),n.CursorUpSelect=Je(new o({args:{direction:2,unit:2,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),n.CursorPageUp=Je(new o({args:{direction:2,unit:2,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:11}})),n.CursorPageUpSelect=Je(new o({args:{direction:2,unit:2,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1035}})),n.CursorDown=Je(new o({args:{direction:3,unit:2,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),n.CursorDownSelect=Je(new o({args:{direction:3,unit:2,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),n.CursorPageDown=Je(new o({args:{direction:3,unit:2,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:12}})),n.CursorPageDownSelect=Je(new o({args:{direction:3,unit:2,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1036}})),n.CreateCursor=Je(new class extends fs{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(_,v){if(!v.position)return;let y;v.wholeLine?y=qo.line(_,_.getPrimaryCursorState(),!1,v.position,v.viewPosition):y=qo.moveTo(_,_.getPrimaryCursorState(),!1,v.position,v.viewPosition);const C=_.getCursorStates();if(C.length>1){const x=y.modelState?y.modelState.position:null,k=y.viewState?y.viewState.position:null;for(let L=0,D=C.length;Lk&&(x=k);const L=new $(x,1,x,_.model.getLineMaxColumn(x));let D=0;if(y.at)switch(y.at){case NS.RawAtArgument.Top:D=3;break;case NS.RawAtArgument.Center:D=1;break;case NS.RawAtArgument.Bottom:D=4;break}const I=_.coordinatesConverter.convertModelRangeToViewRange(L);_.revealRange(v.source,!1,I,D,0)}}),n.SelectAll=new class extends PJ{constructor(){super(pvt)}runDOMCommand(_){Xd&&(_.focus(),_.select()),_.ownerDocument.execCommand("selectAll")}runEditorCommand(_,v,y){const C=v._getViewModel();C&&this.runCoreEditorCommand(C,y)}runCoreEditorCommand(_,v){_.model.pushStackElement(),_.setCursorStates("keyboard",3,[qo.selectAll(_,_.getPrimaryCursorState())])}},n.SetSelection=Je(new class extends fs{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(_,v){v.selection&&(_.model.pushStackElement(),_.setCursorStates(v.source,3,[ri.fromModelSelection(v.selection)]))}})})(Io||(Io={}));const LAt=Le.and(Q.textInputFocus,Q.columnSelection);function d2(n,e){jl.registerKeybindingRule({id:n,primary:e,when:LAt,weight:_i+1})}d2(Io.CursorColumnSelectLeft.id,1039);d2(Io.CursorColumnSelectRight.id,1041);d2(Io.CursorColumnSelectUp.id,1040);d2(Io.CursorColumnSelectPageUp.id,1035);d2(Io.CursorColumnSelectDown.id,1042);d2(Io.CursorColumnSelectPageDown.id,1036);function gwe(n){return n.register(),n}var Sk;(function(n){class e extends fo{runEditorCommand(i,r,s){const o=r._getViewModel();o&&this.runCoreEditingCommand(r,o,s||{})}}n.CoreEditingCommand=e,n.LineBreakInsert=Je(new class extends e{constructor(){super({id:"lineBreakInsert",precondition:Q.writable,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(t,i,r){t.pushUndoStop(),t.executeCommands(this.id,qW.lineBreakInsert(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection)))}}),n.Outdent=Je(new class extends e{constructor(){super({id:"outdent",precondition:Q.writable,kbOpts:{weight:_i,kbExpr:Le.and(Q.editorTextFocus,Q.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(t,i,r){t.pushUndoStop(),t.executeCommands(this.id,bv.outdent(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection))),t.pushUndoStop()}}),n.Tab=Je(new class extends e{constructor(){super({id:"tab",precondition:Q.writable,kbOpts:{weight:_i,kbExpr:Le.and(Q.editorTextFocus,Q.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(t,i,r){t.pushUndoStop(),t.executeCommands(this.id,bv.tab(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection))),t.pushUndoStop()}}),n.DeleteLeft=Je(new class extends e{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(t,i,r){const[s,o]=Hw.deleteLeft(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection),i.getCursorAutoClosedCharacters());s&&t.pushUndoStop(),t.executeCommands(this.id,o),i.setPrevEditOperationType(2)}}),n.DeleteRight=Je(new class extends e{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(t,i,r){const[s,o]=Hw.deleteRight(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection));s&&t.pushUndoStop(),t.executeCommands(this.id,o),i.setPrevEditOperationType(3)}}),n.Undo=new class extends PJ{constructor(){super(T3e)}runDOMCommand(t){t.ownerDocument.execCommand("undo")}runEditorCommand(t,i,r){if(!(!i.hasModel()||i.getOption(92)===!0))return i.getModel().undo()}},n.Redo=new class extends PJ{constructor(){super(D3e)}runDOMCommand(t){t.ownerDocument.execCommand("redo")}runEditorCommand(t,i,r){if(!(!i.hasModel()||i.getOption(92)===!0))return i.getModel().redo()}}})(Sk||(Sk={}));class pwe extends X${constructor(e,t,i){super({id:e,precondition:void 0,metadata:i}),this._handlerId=t}runCommand(e,t){const i=e.get(ai).getFocusedCodeEditor();i&&i.trigger("keyboard",this._handlerId,t)}}function EC(n,e){gwe(new pwe("default:"+n,n)),gwe(new pwe(n,n,e))}EC("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]});EC("replacePreviousChar");EC("compositionType");EC("compositionStart");EC("compositionEnd");EC("paste");EC("cut");class TAt{constructor(e,t,i,r){this.configuration=e,this.viewModel=t,this.userInputEvents=i,this.commandDelegate=r}paste(e,t,i,r){this.commandDelegate.paste(e,t,i,r)}type(e){this.commandDelegate.type(e)}compositionType(e,t,i,r){this.commandDelegate.compositionType(e,t,i,r)}compositionStart(){this.commandDelegate.startComposition()}compositionEnd(){this.commandDelegate.endComposition()}cut(){this.commandDelegate.cut()}setSelection(e){Io.SetSelection.runCoreEditorCommand(this.viewModel,{source:"keyboard",selection:e})}_validateViewColumn(e){const t=this.viewModel.getLineMinColumn(e.lineNumber);return e.column=4?this._selectAll():e.mouseDownCount===3?this._hasMulticursorModifier(e)?e.inSelectionMode?this._lastCursorLineSelectDrag(e.position,e.revealType):this._lastCursorLineSelect(e.position,e.revealType):e.inSelectionMode?this._lineSelectDrag(e.position,e.revealType):this._lineSelect(e.position,e.revealType):e.mouseDownCount===2?e.onInjectedText||(this._hasMulticursorModifier(e)?this._lastCursorWordSelect(e.position,e.revealType):e.inSelectionMode?this._wordSelectDrag(e.position,e.revealType):this._wordSelect(e.position,e.revealType)):this._hasMulticursorModifier(e)?this._hasNonMulticursorModifier(e)||(e.shiftKey?this._columnSelect(e.position,e.mouseColumn,!0):e.inSelectionMode?this._lastCursorMoveToSelect(e.position,e.revealType):this._createCursor(e.position,!1)):e.inSelectionMode?e.altKey?this._columnSelect(e.position,e.mouseColumn,!0):r?this._columnSelect(e.position,e.mouseColumn,!0):this._moveToSelect(e.position,e.revealType):this.moveTo(e.position,e.revealType)}_usualArgs(e,t){return e=this._validateViewColumn(e),{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,revealType:t}}moveTo(e,t){Io.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_moveToSelect(e,t){Io.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_columnSelect(e,t,i){e=this._validateViewColumn(e),Io.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,mouseColumn:t,doColumnSelect:i})}_createCursor(e,t){e=this._validateViewColumn(e),Io.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,wholeLine:t})}_lastCursorMoveToSelect(e,t){Io.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_wordSelect(e,t){Io.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_wordSelectDrag(e,t){Io.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorWordSelect(e,t){Io.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lineSelect(e,t){Io.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lineSelectDrag(e,t){Io.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorLineSelect(e,t){Io.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorLineSelectDrag(e,t){Io.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_selectAll(){Io.SelectAll.runCoreEditorCommand(this.viewModel,{source:"mouse"})}_convertViewToModelPosition(e){return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(e)}emitKeyDown(e){this.userInputEvents.emitKeyDown(e)}emitKeyUp(e){this.userInputEvents.emitKeyUp(e)}emitContextMenu(e){this.userInputEvents.emitContextMenu(e)}emitMouseMove(e){this.userInputEvents.emitMouseMove(e)}emitMouseLeave(e){this.userInputEvents.emitMouseLeave(e)}emitMouseUp(e){this.userInputEvents.emitMouseUp(e)}emitMouseDown(e){this.userInputEvents.emitMouseDown(e)}emitMouseDrag(e){this.userInputEvents.emitMouseDrag(e)}emitMouseDrop(e){this.userInputEvents.emitMouseDrop(e)}emitMouseDropCanceled(){this.userInputEvents.emitMouseDropCanceled()}emitMouseWheel(e){this.userInputEvents.emitMouseWheel(e)}}class h8e{constructor(e){this._lineFactory=e,this._set(1,[])}flush(){this._set(1,[])}_set(e,t){this._lines=t,this._rendLineNumberStart=e}_get(){return{rendLineNumberStart:this._rendLineNumberStart,lines:this._lines}}getStartLineNumber(){return this._rendLineNumberStart}getEndLineNumber(){return this._rendLineNumberStart+this._lines.length-1}getCount(){return this._lines.length}getLine(e){const t=e-this._rendLineNumberStart;if(t<0||t>=this._lines.length)throw new fi("Illegal value for lineNumber");return this._lines[t]}onLinesDeleted(e,t){if(this.getCount()===0)return null;const i=this.getStartLineNumber(),r=this.getEndLineNumber();if(tr)return null;let s=0,o=0;for(let l=i;l<=r;l++){const c=l-this._rendLineNumberStart;e<=l&&l<=t&&(o===0?(s=c,o=1):o++)}if(e=r&&a<=s&&(this._lines[a-this._rendLineNumberStart].onContentChanged(),o=!0);return o}onLinesInserted(e,t){if(this.getCount()===0)return null;const i=t-e+1,r=this.getStartLineNumber(),s=this.getEndLineNumber();if(e<=r)return this._rendLineNumberStart+=i,null;if(e>s)return null;if(i+e>s)return this._lines.splice(e-this._rendLineNumberStart,s-e+1);const o=[];for(let d=0;di)continue;const l=Math.max(t,a.fromLineNumber),c=Math.min(i,a.toLineNumber);for(let u=l;u<=c;u++){const d=u-this._rendLineNumberStart;this._lines[d].onTokensChanged(),r=!0}}return r}}class f8e{constructor(e){this._lineFactory=e,this.domNode=this._createDomNode(),this._linesCollection=new h8e(this._lineFactory)}_createDomNode(){const e=Ci(document.createElement("div"));return e.setClassName("view-layer"),e.setPosition("absolute"),e.domNode.setAttribute("role","presentation"),e.domNode.setAttribute("aria-hidden","true"),e}onConfigurationChanged(e){return!!e.hasChanged(146)}onFlushed(e){return this._linesCollection.flush(),!0}onLinesChanged(e){return this._linesCollection.onLinesChanged(e.fromLineNumber,e.count)}onLinesDeleted(e){const t=this._linesCollection.onLinesDeleted(e.fromLineNumber,e.toLineNumber);if(t)for(let i=0,r=t.length;ie})}constructor(e,t,i){this._domNode=e,this._lineFactory=t,this._viewportData=i}render(e,t,i,r){const s={rendLineNumberStart:e.rendLineNumberStart,lines:e.lines.slice(0),linesLength:e.linesLength};if(s.rendLineNumberStart+s.linesLength-1t){const o=t,a=Math.min(i,s.rendLineNumberStart-1);o<=a&&(this._insertLinesBefore(s,o,a,r,t),s.linesLength+=a-o+1)}else if(s.rendLineNumberStart0&&(this._removeLinesBefore(s,o),s.linesLength-=o)}if(s.rendLineNumberStart=t,s.rendLineNumberStart+s.linesLength-1i){const o=Math.max(0,i-s.rendLineNumberStart+1),l=s.linesLength-1-o+1;l>0&&(this._removeLinesAfter(s,l),s.linesLength-=l)}return this._finishRendering(s,!1,r),s}_renderUntouchedLines(e,t,i,r,s){const o=e.rendLineNumberStart,a=e.lines;for(let l=t;l<=i;l++){const c=o+l;a[l].layoutLine(c,r[c-s],this._viewportData.lineHeight)}}_insertLinesBefore(e,t,i,r,s){const o=[];let a=0;for(let l=t;l<=i;l++)o[a++]=this._lineFactory.createLine();e.lines=o.concat(e.lines)}_removeLinesBefore(e,t){for(let i=0;i=0;a--){const l=e.lines[a];r[a]&&(l.setDomNode(o),o=o.previousSibling)}}_finishRenderingInvalidLines(e,t,i){const r=document.createElement("div");by._ttPolicy&&(t=by._ttPolicy.createHTML(t)),r.innerHTML=t;for(let s=0;snew DAt(this._dynamicOverlays)}),this.domNode=this._visibleLines.domNode;const i=this._context.configuration.options.get(50);ta(this.domNode,i),this.domNode.setClassName("view-overlays")}shouldRender(){if(super.shouldRender())return!0;for(let e=0,t=this._dynamicOverlays.length;ei.shouldRender());for(let i=0,r=t.length;i'),s.appendString(o),s.appendString(""),!0)}layoutLine(e,t,i){this._domNode&&(this._domNode.setTop(t),this._domNode.setHeight(i))}}class IAt extends g8e{constructor(e){super(e);const i=this._context.configuration.options.get(146);this._contentWidth=i.contentWidth,this.domNode.setHeight(0)}onConfigurationChanged(e){const i=this._context.configuration.options.get(146);return this._contentWidth=i.contentWidth,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollWidthChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e),this.domNode.setWidth(Math.max(e.scrollWidth,this._contentWidth))}}class AAt extends g8e{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(146);this._contentLeft=i.contentLeft,this.domNode.setClassName("margin-view-overlays"),this.domNode.setWidth(1),ta(this.domNode,t.get(50))}onConfigurationChanged(e){const t=this._context.configuration.options;ta(this.domNode,t.get(50));const i=t.get(146);return this._contentLeft=i.contentLeft,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollHeightChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e);const t=Math.min(e.scrollHeight,1e6);this.domNode.setHeight(t),this.domNode.setWidth(this._contentLeft)}}class GW{constructor(e){this.onKeyDown=null,this.onKeyUp=null,this.onContextMenu=null,this.onMouseMove=null,this.onMouseLeave=null,this.onMouseDown=null,this.onMouseUp=null,this.onMouseDrag=null,this.onMouseDrop=null,this.onMouseDropCanceled=null,this.onMouseWheel=null,this._coordinatesConverter=e}emitKeyDown(e){this.onKeyDown?.(e)}emitKeyUp(e){this.onKeyUp?.(e)}emitContextMenu(e){this.onContextMenu?.(this._convertViewToModelMouseEvent(e))}emitMouseMove(e){this.onMouseMove?.(this._convertViewToModelMouseEvent(e))}emitMouseLeave(e){this.onMouseLeave?.(this._convertViewToModelMouseEvent(e))}emitMouseDown(e){this.onMouseDown?.(this._convertViewToModelMouseEvent(e))}emitMouseUp(e){this.onMouseUp?.(this._convertViewToModelMouseEvent(e))}emitMouseDrag(e){this.onMouseDrag?.(this._convertViewToModelMouseEvent(e))}emitMouseDrop(e){this.onMouseDrop?.(this._convertViewToModelMouseEvent(e))}emitMouseDropCanceled(){this.onMouseDropCanceled?.()}emitMouseWheel(e){this.onMouseWheel?.(e)}_convertViewToModelMouseEvent(e){return e.target?{event:e.event,target:this._convertViewToModelMouseTarget(e.target)}:e}_convertViewToModelMouseTarget(e){return GW.convertViewToModelMouseTarget(e,this._coordinatesConverter)}static convertViewToModelMouseTarget(e,t){const i={...e};return i.position&&(i.position=t.convertViewPositionToModelPosition(i.position)),i.range&&(i.range=t.convertViewRangeToModelRange(i.range)),(i.type===5||i.type===8)&&(i.detail=this.convertViewToModelViewZoneData(i.detail,t)),i}static convertViewToModelViewZoneData(e,t){return{viewZoneId:e.viewZoneId,positionBefore:e.positionBefore?t.convertViewPositionToModelPosition(e.positionBefore):e.positionBefore,positionAfter:e.positionAfter?t.convertViewPositionToModelPosition(e.positionAfter):e.positionAfter,position:t.convertViewPositionToModelPosition(e.position),afterLineNumber:t.convertViewPositionToModelPosition(new he(e.afterLineNumber,1)).lineNumber}}}class NAt extends bu{constructor(e){super(e),this.blocks=[],this.contentWidth=-1,this.contentLeft=0,this.domNode=Ci(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("blockDecorations-container"),this.update()}update(){let e=!1;const i=this._context.configuration.options.get(146),r=i.contentWidth-i.verticalScrollbarWidth;this.contentWidth!==r&&(this.contentWidth=r,e=!0);const s=i.contentLeft;return this.contentLeft!==s&&(this.contentLeft=s,e=!0),e}dispose(){super.dispose()}onConfigurationChanged(e){return this.update()}onScrollChanged(e){return e.scrollTopChanged||e.scrollLeftChanged}onDecorationsChanged(e){return!0}onZonesChanged(e){return!0}prepareRender(e){}render(e){let t=0;const i=e.getDecorationsInViewport();for(const r of i){if(!r.options.blockClassName)continue;let s=this.blocks[t];s||(s=this.blocks[t]=Ci(document.createElement("div")),this.domNode.appendChild(s));let o,a;r.options.blockIsAfterEnd?(o=e.getVerticalOffsetAfterLineNumber(r.range.endLineNumber,!1),a=e.getVerticalOffsetAfterLineNumber(r.range.endLineNumber,!0)):(o=e.getVerticalOffsetForLineNumber(r.range.startLineNumber,!0),a=r.range.isEmpty()&&!r.options.blockDoesNotCollapse?e.getVerticalOffsetForLineNumber(r.range.startLineNumber,!1):e.getVerticalOffsetAfterLineNumber(r.range.endLineNumber,!0));const[l,c,u,d]=r.options.blockPadding??[0,0,0,0];s.setClassName("blockDecorations-block "+r.options.blockClassName),s.setLeft(this.contentLeft-d),s.setWidth(this.contentWidth+d+c),s.setTop(o-e.scrollTop-l),s.setHeight(a-o+l+u),t++}for(let r=t;r0?this.domNode.setDisplay("block"):this.domNode.setDisplay("none"),this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1}_layoutBoxInViewport(e,t,i,r){const s=e.top,o=s,a=e.top+e.height,l=r.viewportHeight-a,c=s-i,u=o>=i,d=a,h=l>=i;let f=e.left;return f+t>r.scrollLeft+r.viewportWidth&&(f=r.scrollLeft+r.viewportWidth-t),fl){const h=d-(l-r);d-=h,i-=h}if(d=p,v=d+i<=h.height-m;return this._fixedOverflowWidgets?{fitsAbove:_,aboveTop:Math.max(u,p),fitsBelow:v,belowTop:d,left:g}:{fitsAbove:_,aboveTop:s,fitsBelow:v,belowTop:o,left:f}}_prepareRenderWidgetAtExactPositionOverflowing(e){return new WT(e.top,e.left+this._contentLeft)}_getAnchorsCoordinates(e){const t=s(this._primaryAnchor.viewPosition,this._affinity,this._lineHeight),i=this._secondaryAnchor.viewPosition?.lineNumber===this._primaryAnchor.viewPosition?.lineNumber?this._secondaryAnchor.viewPosition:null,r=s(i,this._affinity,this._lineHeight);return{primary:t,secondary:r};function s(o,a,l){if(!o)return null;const c=e.visibleRangeForPosition(o);if(!c)return null;const u=o.column===1&&a===3?0:c.left,d=e.getVerticalOffsetForLineNumber(o.lineNumber)-e.scrollTop;return new mwe(d,u,l)}}_reduceAnchorCoordinates(e,t,i){if(!t)return e;const r=this._context.configuration.options.get(50);let s=t.left;return se.endLineNumber||this.domNode.setMaxWidth(this._maxWidth)}prepareRender(e){this._renderData=this._prepareRenderWidget(e)}render(e){if(!this._renderData||this._renderData.kind==="offViewport"){this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this._renderData?.kind==="offViewport"&&this._renderData.preserveFocus?this.domNode.setTop(-1e3):this.domNode.setVisibility("hidden")),typeof this._actual.afterRender=="function"&&Eq(this._actual.afterRender,this._actual,null);return}this.allowEditorOverflow?(this.domNode.setTop(this._renderData.coordinate.top),this.domNode.setLeft(this._renderData.coordinate.left)):(this.domNode.setTop(this._renderData.coordinate.top+e.scrollTop-e.bigNumbersDelta),this.domNode.setLeft(this._renderData.coordinate.left)),this._isVisible||(this.domNode.setVisibility("inherit"),this.domNode.setAttribute("monaco-visible-content-widget","true"),this._isVisible=!0),typeof this._actual.afterRender=="function"&&Eq(this._actual.afterRender,this._actual,this._renderData.position)}}class $T{constructor(e,t){this.modelPosition=e,this.viewPosition=t}}class WT{constructor(e,t){this.top=e,this.left=t,this._coordinateBrand=void 0}}class mwe{constructor(e,t,i){this.top=e,this.left=t,this.height=i,this._anchorCoordinateBrand=void 0}}function Eq(n,e,...t){try{return n.call(e,...t)}catch{return null}}class p8e extends kC{constructor(e){super(),this._context=e;const t=this._context.configuration.options,i=t.get(146);this._renderLineHighlight=t.get(97),this._renderLineHighlightOnlyWhenFocus=t.get(98),this._wordWrap=i.isViewportWrapping,this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._selectionIsEmpty=!0,this._focused=!1,this._cursorLineNumbers=[1],this._selections=[new yt(1,1,1,1)],this._renderData=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}_readFromSelections(){let e=!1;const t=new Set;for(const s of this._selections)t.add(s.positionLineNumber);const i=Array.from(t);i.sort((s,o)=>s-o),$r(this._cursorLineNumbers,i)||(this._cursorLineNumbers=i,e=!0);const r=this._selections.every(s=>s.isEmpty());return this._selectionIsEmpty!==r&&(this._selectionIsEmpty=r,e=!0),e}onThemeChanged(e){return this._readFromSelections()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(146);return this._renderLineHighlight=t.get(97),this._renderLineHighlightOnlyWhenFocus=t.get(98),this._wordWrap=i.isViewportWrapping,this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,!0}onCursorStateChanged(e){return this._selections=e.selections,this._readFromSelections()}onFlushed(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollWidthChanged||e.scrollTopChanged}onZonesChanged(e){return!0}onFocusChanged(e){return this._renderLineHighlightOnlyWhenFocus?(this._focused=e.isFocused,!0):!1}prepareRender(e){if(!this._shouldRenderThis()){this._renderData=null;return}const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,r=[];for(let o=t;o<=i;o++){const a=o-t;r[a]=""}if(this._wordWrap){const o=this._renderOne(e,!1);for(const a of this._cursorLineNumbers){const l=this._context.viewModel.coordinatesConverter,c=l.convertViewPositionToModelPosition(new he(a,1)).lineNumber,u=l.convertModelPositionToViewPosition(new he(c,1)).lineNumber,d=l.convertModelPositionToViewPosition(new he(c,this._context.viewModel.model.getLineMaxColumn(c))).lineNumber,h=Math.max(u,t),f=Math.min(d,i);for(let g=h;g<=f;g++){const p=g-t;r[p]=o}}}const s=this._renderOne(e,!0);for(const o of this._cursorLineNumbers){if(oi)continue;const a=o-t;r[a]=s}this._renderData=r}render(e,t){if(!this._renderData)return"";const i=t-e;return i>=this._renderData.length?"":this._renderData[i]}_shouldRenderInMargin(){return(this._renderLineHighlight==="gutter"||this._renderLineHighlight==="all")&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderInContent(){return(this._renderLineHighlight==="line"||this._renderLineHighlight==="all")&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}}class OAt extends p8e{_renderOne(e,t){return`

`}_shouldRenderThis(){return this._shouldRenderInContent()}_shouldRenderOther(){return this._shouldRenderInMargin()}}class MAt extends p8e{_renderOne(e,t){return`
`}_shouldRenderThis(){return!0}_shouldRenderOther(){return this._shouldRenderInContent()}}dh((n,e)=>{const t=n.getColor(E5e);if(t&&(e.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${t}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${t}; border: none; }`)),!t||t.isTransparent()||n.defines(iye)){const i=n.getColor(iye);i&&(e.addRule(`.monaco-editor .view-overlays .current-line-exact { border: 2px solid ${i}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-exact-margin { border: 2px solid ${i}; }`),mg(n.type)&&(e.addRule(".monaco-editor .view-overlays .current-line-exact { border-width: 1px; }"),e.addRule(".monaco-editor .margin-view-overlays .current-line-exact-margin { border-width: 1px; }")))}});class FAt extends kC{constructor(e){super(),this._context=e;const t=this._context.configuration.options;this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged||e.scrollWidthChanged}onZonesChanged(e){return!0}prepareRender(e){const t=e.getDecorationsInViewport();let i=[],r=0;for(let l=0,c=t.length;l{if(l.options.zIndexc.options.zIndex)return 1;const u=l.options.className,d=c.options.className;return ud?1:$.compareRangesUsingStarts(l.range,c.range)});const s=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber,a=[];for(let l=s;l<=o;l++){const c=l-s;a[c]=""}this._renderWholeLineDecorations(e,i,a),this._renderNormalDecorations(e,i,a),this._renderResult=a}_renderWholeLineDecorations(e,t,i){const r=e.visibleRange.startLineNumber,s=e.visibleRange.endLineNumber;for(let o=0,a=t.length;o',u=Math.max(l.range.startLineNumber,r),d=Math.min(l.range.endLineNumber,s);for(let h=u;h<=d;h++){const f=h-r;i[f]+=c}}}_renderNormalDecorations(e,t,i){const r=e.visibleRange.startLineNumber;let s=null,o=!1,a=null,l=!1;for(let c=0,u=t.length;c';a[h]+=_}}}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}class BAt extends bu{constructor(e,t,i,r){super(e);const s=this._context.configuration.options,o=s.get(104),a=s.get(75),l=s.get(40),c=s.get(107),u={listenOnDomNode:i.domNode,className:"editor-scrollable "+OX(e.theme.type),useShadows:!1,lazyRender:!0,vertical:o.vertical,horizontal:o.horizontal,verticalHasArrows:o.verticalHasArrows,horizontalHasArrows:o.horizontalHasArrows,verticalScrollbarSize:o.verticalScrollbarSize,verticalSliderSize:o.verticalSliderSize,horizontalScrollbarSize:o.horizontalScrollbarSize,horizontalSliderSize:o.horizontalSliderSize,handleMouseWheel:o.handleMouseWheel,alwaysConsumeMouseWheel:o.alwaysConsumeMouseWheel,arrowSize:o.arrowSize,mouseWheelScrollSensitivity:a,fastScrollSensitivity:l,scrollPredominantAxis:c,scrollByPage:o.scrollByPage};this.scrollbar=this._register(new fW(t.domNode,u,this._context.viewLayout.getScrollable())),Ig.write(this.scrollbar.getDomNode(),6),this.scrollbarDomNode=Ci(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();const d=(h,f,g)=>{const p={};{const m=h.scrollTop;m&&(p.scrollTop=this._context.viewLayout.getCurrentScrollTop()+m,h.scrollTop=0)}if(g){const m=h.scrollLeft;m&&(p.scrollLeft=this._context.viewLayout.getCurrentScrollLeft()+m,h.scrollLeft=0)}this._context.viewModel.viewLayout.setScrollPosition(p,1)};this._register(Ce(i.domNode,"scroll",h=>d(i.domNode,!0,!0))),this._register(Ce(t.domNode,"scroll",h=>d(t.domNode,!0,!1))),this._register(Ce(r.domNode,"scroll",h=>d(r.domNode,!0,!1))),this._register(Ce(this.scrollbarDomNode.domNode,"scroll",h=>d(this.scrollbarDomNode.domNode,!0,!1)))}dispose(){super.dispose()}_setLayout(){const e=this._context.configuration.options,t=e.get(146);this.scrollbarDomNode.setLeft(t.contentLeft),e.get(73).side==="right"?this.scrollbarDomNode.setWidth(t.contentWidth+t.minimap.minimapWidth):this.scrollbarDomNode.setWidth(t.contentWidth),this.scrollbarDomNode.setHeight(t.height)}getOverviewRulerLayoutInfo(){return this.scrollbar.getOverviewRulerLayoutInfo()}getDomNode(){return this.scrollbarDomNode}delegateVerticalScrollbarPointerDown(e){this.scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this.scrollbar.delegateScrollFromMouseWheelEvent(e)}onConfigurationChanged(e){if(e.hasChanged(104)||e.hasChanged(75)||e.hasChanged(40)){const t=this._context.configuration.options,i=t.get(104),r=t.get(75),s=t.get(40),o=t.get(107),a={vertical:i.vertical,horizontal:i.horizontal,verticalScrollbarSize:i.verticalScrollbarSize,horizontalScrollbarSize:i.horizontalScrollbarSize,scrollByPage:i.scrollByPage,handleMouseWheel:i.handleMouseWheel,mouseWheelScrollSensitivity:r,fastScrollSensitivity:s,scrollPredominantAxis:o};this.scrollbar.updateOptions(a)}return e.hasChanged(146)&&this._setLayout(),!0}onScrollChanged(e){return!0}onThemeChanged(e){return this.scrollbar.updateClassName("editor-scrollable "+OX(this._context.theme.type)),!0}prepareRender(e){}render(e){this.scrollbar.renderNow()}}class OJ{constructor(e,t,i,r,s){this.startLineNumber=e,this.endLineNumber=t,this.className=i,this.tooltip=r,this._decorationToRenderBrand=void 0,this.zIndex=s??0}}class $At{constructor(e,t,i){this.className=e,this.zIndex=t,this.tooltip=i}}class WAt{constructor(){this.decorations=[]}add(e){this.decorations.push(e)}getDecorations(){return this.decorations}}class m8e extends kC{_render(e,t,i){const r=[];for(let a=e;a<=t;a++){const l=a-e;r[l]=new WAt}if(i.length===0)return r;i.sort((a,l)=>a.className===l.className?a.startLineNumber===l.startLineNumber?a.endLineNumber-l.endLineNumber:a.startLineNumber-l.startLineNumber:a.classNamer)continue;const c=Math.max(a,i),u=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new he(c,0)),d=this._context.viewModel.glyphLanes.getLanesAtLine(u.lineNumber).indexOf(s.preference.lane);t.push(new zAt(c,d,s.preference.zIndex,s))}}_collectSortedGlyphRenderRequests(e){const t=[];return this._collectDecorationBasedGlyphRenderRequest(e,t),this._collectWidgetBasedGlyphRenderRequest(e,t),t.sort((i,r)=>i.lineNumber===r.lineNumber?i.laneIndex===r.laneIndex?i.zIndex===r.zIndex?r.type===i.type?i.type===0&&r.type===0?i.className0;){const r=t.peek();if(!r)break;const s=t.takeWhile(a=>a.lineNumber===r.lineNumber&&a.laneIndex===r.laneIndex);if(!s||s.length===0)break;const o=s[0];if(o.type===0){const a=[];for(const l of s){if(l.zIndex!==o.zIndex||l.type!==o.type)break;(a.length===0||a[a.length-1]!==l.className)&&a.push(l.className)}i.push(o.accept(a.join(" ")))}else o.widget.renderInfo={lineNumber:o.lineNumber,laneIndex:o.laneIndex}}this._decorationGlyphsToRender=i}render(e){if(!this._glyphMargin){for(const i of Object.values(this._widgets))i.domNode.setDisplay("none");for(;this._managedDomNodes.length>0;)this._managedDomNodes.pop()?.domNode.remove();return}const t=Math.round(this._glyphMarginWidth/this._glyphMarginDecorationLaneCount);for(const i of Object.values(this._widgets))if(!i.renderInfo)i.domNode.setDisplay("none");else{const r=e.viewportData.relativeVerticalOffset[i.renderInfo.lineNumber-e.viewportData.startLineNumber],s=this._glyphMarginLeft+i.renderInfo.laneIndex*this._lineHeight;i.domNode.setDisplay("block"),i.domNode.setTop(r),i.domNode.setLeft(s),i.domNode.setWidth(t),i.domNode.setHeight(this._lineHeight)}for(let i=0;ithis._decorationGlyphsToRender.length;)this._managedDomNodes.pop()?.domNode.remove()}}class VAt{constructor(e,t,i,r){this.lineNumber=e,this.laneIndex=t,this.zIndex=i,this.className=r,this.type=0}accept(e){return new UAt(this.lineNumber,this.laneIndex,e)}}class zAt{constructor(e,t,i,r){this.lineNumber=e,this.laneIndex=t,this.zIndex=i,this.widget=r,this.type=1}}class UAt{constructor(e,t,i){this.lineNumber=e,this.laneIndex=t,this.combinedClassName=i}}class jAt extends kC{constructor(e){super(),this._context=e,this._primaryPosition=null;const t=this._context.configuration.options,i=t.get(147),r=t.get(50);this._spaceWidth=r.spaceWidth,this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*r.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(16),this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(147),r=t.get(50);return this._spaceWidth=r.spaceWidth,this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*r.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(16),!0}onCursorStateChanged(e){const i=e.selections[0].getPosition();return this._primaryPosition?.equals(i)?!1:(this._primaryPosition=i,!0)}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onLanguageConfigurationChanged(e){return!0}prepareRender(e){if(!this._bracketPairGuideOptions.indentation&&this._bracketPairGuideOptions.bracketPairs===!1){this._renderResult=null;return}const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,r=e.scrollWidth,s=this._primaryPosition,o=this.getGuidesByLine(t,Math.min(i+1,this._context.viewModel.getLineCount()),s),a=[];for(let l=t;l<=i;l++){const c=l-t,u=o[c];let d="";const h=e.visibleRangeForPosition(new he(l,1))?.left??0;for(const f of u){const g=f.column===-1?h+(f.visibleColumn-1)*this._spaceWidth:e.visibleRangeForPosition(new he(l,f.column)).left;if(g>r||this._maxIndentLeft>0&&g>this._maxIndentLeft)break;const p=f.horizontalLine?f.horizontalLine.top?"horizontal-top":"horizontal-bottom":"vertical",m=f.horizontalLine?(e.visibleRangeForPosition(new he(l,f.horizontalLine.endColumn))?.left??g+this._spaceWidth)-g:this._spaceWidth;d+=`
`}a[c]=d}this._renderResult=a}getGuidesByLine(e,t,i){const r=this._bracketPairGuideOptions.bracketPairs!==!1?this._context.viewModel.getBracketGuidesInRangeByLine(e,t,i,{highlightActive:this._bracketPairGuideOptions.highlightActiveBracketPair,horizontalGuides:this._bracketPairGuideOptions.bracketPairsHorizontal===!0?Qy.Enabled:this._bracketPairGuideOptions.bracketPairsHorizontal==="active"?Qy.EnabledForActive:Qy.Disabled,includeInactive:this._bracketPairGuideOptions.bracketPairs===!0}):null,s=this._bracketPairGuideOptions.indentation?this._context.viewModel.getLinesIndentGuides(e,t):null;let o=0,a=0,l=0;if(this._bracketPairGuideOptions.highlightActiveIndentation!==!1&&i){const d=this._context.viewModel.getActiveIndentGuide(i.lineNumber,e,t);o=d.startLineNumber,a=d.endLineNumber,l=d.indent}const{indentSize:c}=this._context.viewModel.model.getOptions(),u=[];for(let d=e;d<=t;d++){const h=new Array;u.push(h);const f=r?r[d-e]:[],g=new q_(f),p=s?s[d-e]:0;for(let m=1;m<=p;m++){const _=(m-1)*c+1,v=(this._bracketPairGuideOptions.highlightActiveIndentation==="always"||f.length===0)&&o<=d&&d<=a&&m===l;h.push(...g.takeWhile(C=>C.visibleColumn<_)||[]);const y=g.peek();(!y||y.visibleColumn!==_||y.horizontalLine)&&h.push(new Ny(_,-1,`core-guide-indent lvl-${(m-1)%30}`+(v?" indent-active":""),null,-1,-1))}h.push(...g.takeWhile(m=>!0)||[])}return u}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}function vx(n){if(!(n&&n.isTransparent()))return n}dh((n,e)=>{const t=[{bracketColor:I5e,guideColor:aEt,guideColorActive:fEt},{bracketColor:A5e,guideColor:lEt,guideColorActive:gEt},{bracketColor:N5e,guideColor:cEt,guideColorActive:pEt},{bracketColor:R5e,guideColor:uEt,guideColorActive:mEt},{bracketColor:P5e,guideColor:dEt,guideColorActive:_Et},{bracketColor:O5e,guideColor:hEt,guideColorActive:vEt}],i=new q5e,r=[{indentColor:hO,indentColorActive:fO},{indentColor:Wkt,indentColorActive:jkt},{indentColor:Hkt,indentColorActive:qkt},{indentColor:Vkt,indentColorActive:Kkt},{indentColor:zkt,indentColorActive:Gkt},{indentColor:Ukt,indentColorActive:Ykt}],s=t.map(a=>{const l=n.getColor(a.bracketColor),c=n.getColor(a.guideColor),u=n.getColor(a.guideColorActive),d=vx(vx(c)??l?.transparent(.3)),h=vx(vx(u)??l);if(!(!d||!h))return{guideColor:d,guideColorActive:h}}).filter(Bp),o=r.map(a=>{const l=n.getColor(a.indentColor),c=n.getColor(a.indentColorActive),u=vx(l),d=vx(c);if(!(!u||!d))return{indentColor:u,indentColorActive:d}}).filter(Bp);if(s.length>0){for(let a=0;a<30;a++){const l=s[a%s.length];e.addRule(`.monaco-editor .${i.getInlineClassNameOfLevel(a).replace(/ /g,".")} { --guide-color: ${l.guideColor}; --guide-color-active: ${l.guideColorActive}; }`)}e.addRule(".monaco-editor .vertical { box-shadow: 1px 0 0 0 var(--guide-color) inset; }"),e.addRule(".monaco-editor .horizontal-top { border-top: 1px solid var(--guide-color); }"),e.addRule(".monaco-editor .horizontal-bottom { border-bottom: 1px solid var(--guide-color); }"),e.addRule(`.monaco-editor .vertical.${i.activeClassName} { box-shadow: 1px 0 0 0 var(--guide-color-active) inset; }`),e.addRule(`.monaco-editor .horizontal-top.${i.activeClassName} { border-top: 1px solid var(--guide-color-active); }`),e.addRule(`.monaco-editor .horizontal-bottom.${i.activeClassName} { border-bottom: 1px solid var(--guide-color-active); }`)}if(o.length>0){for(let a=0;a<30;a++){const l=o[a%o.length];e.addRule(`.monaco-editor .lines-content .core-guide-indent.lvl-${a} { --indent-color: ${l.indentColor}; --indent-color-active: ${l.indentColorActive}; }`)}e.addRule(".monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 var(--indent-color) inset; }"),e.addRule(".monaco-editor .lines-content .core-guide-indent.indent-active { box-shadow: 1px 0 0 0 var(--indent-color-active) inset; }")}});class Lq{get didDomLayout(){return this._didDomLayout}readClientRect(){if(!this._clientRectRead){this._clientRectRead=!0;const e=this._domNode.getBoundingClientRect();this.markDidDomLayout(),this._clientRectDeltaLeft=e.left,this._clientRectScale=e.width/this._domNode.offsetWidth}}get clientRectDeltaLeft(){return this._clientRectRead||this.readClientRect(),this._clientRectDeltaLeft}get clientRectScale(){return this._clientRectRead||this.readClientRect(),this._clientRectScale}constructor(e,t){this._domNode=e,this.endNode=t,this._didDomLayout=!1,this._clientRectDeltaLeft=0,this._clientRectScale=1,this._clientRectRead=!1}markDidDomLayout(){this._didDomLayout=!0}}class qAt{constructor(){this._currentVisibleRange=new $(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(e){this._currentVisibleRange=e}}class KAt{constructor(e,t,i,r,s,o,a){this.minimalReveal=e,this.lineNumber=t,this.startColumn=i,this.endColumn=r,this.startScrollTop=s,this.stopScrollTop=o,this.scrollType=a,this.type="range",this.minLineNumber=t,this.maxLineNumber=t}}class GAt{constructor(e,t,i,r,s){this.minimalReveal=e,this.selections=t,this.startScrollTop=i,this.stopScrollTop=r,this.scrollType=s,this.type="selections";let o=t[0].startLineNumber,a=t[0].endLineNumber;for(let l=1,c=t.length;lnew l_(this._viewLineOptions)}),this.domNode=this._visibleLines.domNode,Ig.write(this.domNode,8),this.domNode.setClassName(`view-lines ${Ck}`),ta(this.domNode,s),this._maxLineWidth=0,this._asyncUpdateLineWidths=new Ui(()=>{this._updateLineWidthsSlow()},200),this._asyncCheckMonospaceFontAssumptions=new Ui(()=>{this._checkMonospaceFontAssumptions()},2e3),this._lastRenderedData=new qAt,this._horizontalRevealRequest=null,this._stickyScrollEnabled=r.get(116).enabled,this._maxNumberStickyLines=r.get(116).maxLineCount}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e),e.hasChanged(147)&&(this._maxLineWidth=0);const t=this._context.configuration.options,i=t.get(50),r=t.get(147);return this._lineHeight=t.get(67),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._isViewportWrapping=r.isViewportWrapping,this._revealHorizontalRightPadding=t.get(101),this._cursorSurroundingLines=t.get(29),this._cursorSurroundingLinesStyle=t.get(30),this._canUseLayerHinting=!t.get(32),this._stickyScrollEnabled=t.get(116).enabled,this._maxNumberStickyLines=t.get(116).maxLineCount,ta(this.domNode,i),this._onOptionsMaybeChanged(),e.hasChanged(146)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){const e=this._context.configuration,t=new lwe(e,this._context.theme.type);if(!this._viewLineOptions.equals(t)){this._viewLineOptions=t;const i=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();for(let s=i;s<=r;s++)this._visibleLines.getVisibleLine(s).onOptionsChanged(this._viewLineOptions);return!0}return!1}onCursorStateChanged(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();let r=!1;for(let s=t;s<=i;s++)r=this._visibleLines.getVisibleLine(s).onSelectionChanged()||r;return r}onDecorationsChanged(e){{const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let r=t;r<=i;r++)this._visibleLines.getVisibleLine(r).onDecorationsChanged()}return!0}onFlushed(e){const t=this._visibleLines.onFlushed(e);return this._maxLineWidth=0,t}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onRevealRangeRequest(e){const t=this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(),e.source,e.minimalReveal,e.range,e.selections,e.verticalType);if(t===-1)return!1;let i=this._context.viewLayout.validateScrollPosition({scrollTop:t});e.revealHorizontal?e.range&&e.range.startLineNumber!==e.range.endLineNumber?i={scrollTop:i.scrollTop,scrollLeft:0}:e.range?this._horizontalRevealRequest=new KAt(e.minimalReveal,e.range.startLineNumber,e.range.startColumn,e.range.endColumn,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType):e.selections&&e.selections.length>0&&(this._horizontalRevealRequest=new GAt(e.minimalReveal,e.selections,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType)):this._horizontalRevealRequest=null;const s=Math.abs(this._context.viewLayout.getCurrentScrollTop()-i.scrollTop)<=this._lineHeight?1:e.scrollType;return this._context.viewModel.viewLayout.setScrollPosition(i,s),!0}onScrollChanged(e){if(this._horizontalRevealRequest&&e.scrollLeftChanged&&(this._horizontalRevealRequest=null),this._horizontalRevealRequest&&e.scrollTopChanged){const t=Math.min(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop),i=Math.max(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop);(e.scrollTopi)&&(this._horizontalRevealRequest=null)}return this.domNode.setWidth(e.scrollWidth),this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth),this._visibleLines.onZonesChanged(e)}onThemeChanged(e){return this._onOptionsMaybeChanged()}getPositionFromDOMInfo(e,t){const i=this._getViewLineDomNode(e);if(i===null)return null;const r=this._getLineNumberFor(i);if(r===-1||r<1||r>this._context.viewModel.getLineCount())return null;if(this._context.viewModel.getLineMaxColumn(r)===1)return new he(r,1);const s=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();if(ro)return null;let a=this._visibleLines.getVisibleLine(r).getColumnOfNodeOffset(e,t);const l=this._context.viewModel.getLineMinColumn(r);return ai)return-1;const r=new Lq(this.domNode.domNode,this._textRangeRestingSpot),s=this._visibleLines.getVisibleLine(e).getWidth(r);return this._updateLineWidthsSlowIfDomDidLayout(r),s}linesVisibleRangesForRange(e,t){if(this.shouldRender())return null;const i=e.endLineNumber,r=$.intersectRanges(e,this._lastRenderedData.getCurrentVisibleRange());if(!r)return null;const s=[];let o=0;const a=new Lq(this.domNode.domNode,this._textRangeRestingSpot);let l=0;t&&(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new he(r.startLineNumber,1)).lineNumber);const c=this._visibleLines.getStartLineNumber(),u=this._visibleLines.getEndLineNumber();for(let d=r.startLineNumber;d<=r.endLineNumber;d++){if(du)continue;const h=d===r.startLineNumber?r.startColumn:1,f=d!==r.endLineNumber,g=f?this._context.viewModel.getLineMaxColumn(d):r.endColumn,p=this._visibleLines.getVisibleLine(d).getVisibleRangesForRange(d,h,g,a);if(p){if(t&&dthis._visibleLines.getEndLineNumber())return null;const r=new Lq(this.domNode.domNode,this._textRangeRestingSpot),s=this._visibleLines.getVisibleLine(e).getVisibleRangesForRange(e,t,i,r);return this._updateLineWidthsSlowIfDomDidLayout(r),s}visibleRangeForPosition(e){const t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new RIt(t.outsideRenderedLine,t.ranges[0].left):null}_updateLineWidthsFast(){return this._updateLineWidths(!0)}_updateLineWidthsSlow(){this._updateLineWidths(!1)}_updateLineWidthsSlowIfDomDidLayout(e){e.didDomLayout&&(this._asyncUpdateLineWidths.isScheduled()||(this._asyncUpdateLineWidths.cancel(),this._updateLineWidthsSlow()))}_updateLineWidths(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();let r=1,s=!0;for(let o=t;o<=i;o++){const a=this._visibleLines.getVisibleLine(o);if(e&&!a.getWidthIsFast()){s=!1;continue}r=Math.max(r,a.getWidth(null))}return s&&t===1&&i===this._context.viewModel.getLineCount()&&(this._maxLineWidth=0),this._ensureMaxLineWidth(r),s}_checkMonospaceFontAssumptions(){let e=-1,t=-1;const i=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();for(let s=i;s<=r;s++){const o=this._visibleLines.getVisibleLine(s);if(o.needsMonospaceFontCheck()){const a=o.getWidth(null);a>t&&(t=a,e=s)}}if(e!==-1&&!this._visibleLines.getVisibleLine(e).monospaceAssumptionsAreValid())for(let s=i;s<=r;s++)this._visibleLines.getVisibleLine(s).onMonospaceAssumptionsInvalidated()}prepareRender(){throw new Error("Not supported")}render(){throw new Error("Not supported")}renderText(e){if(this._visibleLines.renderLines(e),this._lastRenderedData.setCurrentVisibleRange(e.visibleRange),this.domNode.setWidth(this._context.viewLayout.getScrollWidth()),this.domNode.setHeight(Math.min(this._context.viewLayout.getScrollHeight(),1e6)),this._horizontalRevealRequest){const i=this._horizontalRevealRequest;if(e.startLineNumber<=i.minLineNumber&&i.maxLineNumber<=e.endLineNumber){this._horizontalRevealRequest=null,this.onDidRender();const r=this._computeScrollLeftToReveal(i);r&&(this._isViewportWrapping||this._ensureMaxLineWidth(r.maxHorizontalOffset),this._context.viewModel.viewLayout.setScrollPosition({scrollLeft:r.scrollLeft},i.scrollType))}}if(this._updateLineWidthsFast()?this._asyncUpdateLineWidths.cancel():this._asyncUpdateLineWidths.schedule(),zl&&!this._asyncCheckMonospaceFontAssumptions.isScheduled()){const i=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();for(let s=i;s<=r;s++)if(this._visibleLines.getVisibleLine(s).needsMonospaceFontCheck()){this._asyncCheckMonospaceFontAssumptions.schedule();break}}this._linesContent.setLayerHinting(this._canUseLayerHinting),this._linesContent.setContain("strict");const t=this._context.viewLayout.getCurrentScrollTop()-e.bigNumbersDelta;this._linesContent.setTop(-t),this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft())}_ensureMaxLineWidth(e){const t=Math.ceil(e);this._maxLineWidth0){let _=s[0].startLineNumber,v=s[0].endLineNumber;for(let y=1,C=s.length;yl){if(!u)return-1;m=d}else if(o===5||o===6)if(o===6&&a<=d&&h<=c)m=a;else{const _=Math.max(5*this._lineHeight,l*.2),v=d-_,y=h-l;m=Math.max(y,v)}else if(o===1||o===2)if(o===2&&a<=d&&h<=c)m=a;else{const _=(d+h)/2;m=Math.max(0,_-l/2)}else m=this._computeMinimumScrolling(a,c,d,h,o===3,o===4);return m}_computeScrollLeftToReveal(e){const t=this._context.viewLayout.getCurrentViewport(),i=this._context.configuration.options.get(146),r=t.left,s=r+t.width-i.verticalScrollbarWidth;let o=1073741824,a=0;if(e.type==="range"){const c=this._visibleRangesForLineRange(e.lineNumber,e.startColumn,e.endColumn);if(!c)return null;for(const u of c.ranges)o=Math.min(o,Math.round(u.left)),a=Math.max(a,Math.round(u.left+u.width))}else for(const c of e.selections){if(c.startLineNumber!==c.endLineNumber)return null;const u=this._visibleRangesForLineRange(c.startLineNumber,c.startColumn,c.endColumn);if(!u)return null;for(const d of u.ranges)o=Math.min(o,Math.round(d.left)),a=Math.max(a,Math.round(d.left+d.width))}return e.minimalReveal||(o=Math.max(0,o-Hce.HORIZONTAL_EXTRA_PX),a+=this._revealHorizontalRightPadding),e.type==="selections"&&a-o>t.width?null:{scrollLeft:this._computeMinimumScrolling(r,s,o,a),maxHorizontalOffset:a}}_computeMinimumScrolling(e,t,i,r,s,o){e=e|0,t=t|0,i=i|0,r=r|0,s=!!s,o=!!o;const a=t-e;if(r-it)return Math.max(0,r-a)}else return i;return e}}class YAt extends m8e{constructor(e){super(),this._context=e;const i=this._context.configuration.options.get(146);this._decorationsLeft=i.decorationsLeft,this._decorationsWidth=i.decorationsWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const i=this._context.configuration.options.get(146);return this._decorationsLeft=i.decorationsLeft,this._decorationsWidth=i.decorationsWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getDecorations(e){const t=e.getDecorationsInViewport(),i=[];let r=0;for(let s=0,o=t.length;s',l=[];for(let c=t;c<=i;c++){const u=c-t,d=r[u].getDecorations();let h="";for(const f of d){let g='
';s[a]=c}this._renderResult=s}render(e,t){return this._renderResult?this._renderResult[t-e]:""}}class Fd{static{this.Empty=new Fd(0,0,0,0)}constructor(e,t,i,r){this._rgba8Brand=void 0,this.r=Fd._clamp(e),this.g=Fd._clamp(t),this.b=Fd._clamp(i),this.a=Fd._clamp(r)}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}static _clamp(e){return e<0?0:e>255?255:e|0}}class YW extends me{static{this._INSTANCE=null}static getInstance(){return this._INSTANCE||(this._INSTANCE=new YW),this._INSTANCE}constructor(){super(),this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._updateColorMap(),this._register(rs.onDidChange(e=>{e.changedColorMap&&this._updateColorMap()}))}_updateColorMap(){const e=rs.getColorMap();if(!e){this._colors=[Fd.Empty],this._backgroundIsLight=!0;return}this._colors=[Fd.Empty];for(let i=1;i=.5,this._onDidChange.fire(void 0)}getColor(e){return(e<1||e>=this._colors.length)&&(e=2),this._colors[e]}backgroundIsLight(){return this._backgroundIsLight}}const XAt=(()=>{const n=[];for(let e=32;e<=126;e++)n.push(e);return n.push(65533),n})(),QAt=(n,e)=>(n-=32,n<0||n>96?e<=2?(n+96)%96:95:n);class GN{constructor(e,t){this.scale=t,this._minimapCharRendererBrand=void 0,this.charDataNormal=GN.soften(e,12/15),this.charDataLight=GN.soften(e,50/60)}static soften(e,t){const i=new Uint8ClampedArray(e.length);for(let r=0,s=e.length;re.width||i+g>e.height){console.warn("bad render request outside image data");return}const p=u?this.charDataLight:this.charDataNormal,m=QAt(r,c),_=e.width*4,v=a.r,y=a.g,C=a.b,x=s.r-v,k=s.g-y,L=s.b-C,D=Math.max(o,l),I=e.data;let O=m*h*f,M=i*_+t*4;for(let B=0;Be.width||i+d>e.height){console.warn("bad render request outside image data");return}const h=e.width*4,f=.5*(s/255),g=o.r,p=o.g,m=o.b,_=r.r-g,v=r.g-p,y=r.b-m,C=g+_*f,x=p+v*f,k=m+y*f,L=Math.max(s,a),D=e.data;let I=i*h+t*4;for(let O=0;O{const e=new Uint8ClampedArray(n.length/2);for(let t=0;t>1]=_we[n[t]]<<4|_we[n[t+1]]&15;return e},bwe={1:wb(()=>vwe("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:wb(()=>vwe("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))};class PI{static create(e,t){if(this.lastCreated&&e===this.lastCreated.scale&&t===this.lastFontFamily)return this.lastCreated;let i;return bwe[e]?i=new GN(bwe[e](),e):i=PI.createFromSampleData(PI.createSampleData(t).data,e),this.lastFontFamily=t,this.lastCreated=i,i}static createSampleData(e){const t=document.createElement("canvas"),i=t.getContext("2d");t.style.height="16px",t.height=16,t.width=96*10,t.style.width=96*10+"px",i.fillStyle="#ffffff",i.font=`bold 16px ${e}`,i.textBaseline="middle";let r=0;for(const s of XAt)i.fillText(String.fromCharCode(s),r,16/2),r+=10;return i.getImageData(0,0,96*10,16)}static createFromSampleData(e,t){if(e.length!==61440)throw new Error("Unexpected source in MinimapCharRenderer");const r=PI._downsample(e,t);return new GN(r,t)}static _downsampleChar(e,t,i,r,s){const o=1*s,a=2*s;let l=r,c=0;for(let u=0;u0){const c=255/l;for(let u=0;uPI.create(this.fontScale,l.fontFamily)),this.defaultBackgroundColor=i.getColor(2),this.backgroundColor=kk._getMinimapBackground(t,this.defaultBackgroundColor),this.foregroundAlpha=kk._getMinimapForegroundOpacity(t)}static _getMinimapBackground(e,t){const i=e.getColor(Hyt);return i?new Fd(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}static _getMinimapForegroundOpacity(e){const t=e.getColor(Vyt);return t?Fd._clamp(Math.round(255*t.rgba.a)):255}static _getSectionHeaderColor(e,t){const i=e.getColor(cm);return i?new Fd(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}equals(e){return this.renderMinimap===e.renderMinimap&&this.size===e.size&&this.minimapHeightIsEditorHeight===e.minimapHeightIsEditorHeight&&this.scrollBeyondLastLine===e.scrollBeyondLastLine&&this.paddingTop===e.paddingTop&&this.paddingBottom===e.paddingBottom&&this.showSlider===e.showSlider&&this.autohide===e.autohide&&this.pixelRatio===e.pixelRatio&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.lineHeight===e.lineHeight&&this.minimapLeft===e.minimapLeft&&this.minimapWidth===e.minimapWidth&&this.minimapHeight===e.minimapHeight&&this.canvasInnerWidth===e.canvasInnerWidth&&this.canvasInnerHeight===e.canvasInnerHeight&&this.canvasOuterWidth===e.canvasOuterWidth&&this.canvasOuterHeight===e.canvasOuterHeight&&this.isSampling===e.isSampling&&this.editorHeight===e.editorHeight&&this.fontScale===e.fontScale&&this.minimapLineHeight===e.minimapLineHeight&&this.minimapCharWidth===e.minimapCharWidth&&this.sectionHeaderFontSize===e.sectionHeaderFontSize&&this.sectionHeaderLetterSpacing===e.sectionHeaderLetterSpacing&&this.defaultBackgroundColor&&this.defaultBackgroundColor.equals(e.defaultBackgroundColor)&&this.backgroundColor&&this.backgroundColor.equals(e.backgroundColor)&&this.foregroundAlpha===e.foregroundAlpha}}class OI{constructor(e,t,i,r,s,o,a,l,c){this.scrollTop=e,this.scrollHeight=t,this.sliderNeeded=i,this._computedSliderRatio=r,this.sliderTop=s,this.sliderHeight=o,this.topPaddingLineCount=a,this.startLineNumber=l,this.endLineNumber=c}getDesiredScrollTopFromDelta(e){return Math.round(this.scrollTop+e/this._computedSliderRatio)}getDesiredScrollTopFromTouchLocation(e){return Math.round((e-this.sliderHeight/2)/this._computedSliderRatio)}intersectWithViewport(e){const t=Math.max(this.startLineNumber,e.startLineNumber),i=Math.min(this.endLineNumber,e.endLineNumber);return t>i?null:[t,i]}getYForLineNumber(e,t){return+(e-this.startLineNumber+this.topPaddingLineCount)*t}static create(e,t,i,r,s,o,a,l,c,u,d){const h=e.pixelRatio,f=e.minimapLineHeight,g=Math.floor(e.canvasInnerHeight/f),p=e.lineHeight;if(e.minimapHeightIsEditorHeight){let k=l*e.lineHeight+e.paddingTop+e.paddingBottom;e.scrollBeyondLastLine&&(k+=Math.max(0,s-e.lineHeight-e.paddingBottom));const L=Math.max(1,Math.floor(s*s/k)),D=Math.max(0,e.minimapHeight-L),I=D/(u-s),O=c*I,M=D>0,B=Math.floor(e.canvasInnerHeight/e.minimapLineHeight),G=Math.floor(e.paddingTop/e.lineHeight);return new OI(c,u,M,I,O,L,G,1,Math.min(a,B))}let m;if(o&&i!==a){const k=i-t+1;m=Math.floor(k*f/h)}else{const k=s/p;m=Math.floor(k*f/h)}const _=Math.floor(e.paddingTop/p);let v=Math.floor(e.paddingBottom/p);if(e.scrollBeyondLastLine){const k=s/p;v=Math.max(v,k-1)}let y;if(v>0){const k=s/p;y=(_+a+v-k-1)*f/h}else y=Math.max(0,(_+a)*f/h-m);y=Math.min(e.minimapHeight-m,y);const C=y/(u-s),x=c*C;if(g>=_+a+v){const k=y>0;return new OI(c,u,k,C,x,m,_,1,a)}else{let k;t>1?k=t+_:k=Math.max(1,c/p);let L,D=Math.max(1,Math.floor(k-x*h/f));D<_?(L=_-D+1,D=1):(L=0,D=Math.max(1,D-_)),d&&d.scrollHeight===u&&(d.scrollTop>c&&(D=Math.min(D,d.startLineNumber),L=Math.max(L,d.topPaddingLineCount)),d.scrollTop=e.paddingTop?M=(t-D+L+O)*f/h:M=c/e.paddingTop*(L+O)*f/h,new OI(c,u,!0,C,M,m,L,D,I)}}}class ZW{static{this.INVALID=new ZW(-1)}constructor(e){this.dy=e}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}}class ywe{constructor(e,t,i){this.renderedLayout=e,this._imageData=t,this._renderedLines=new h8e({createLine:()=>ZW.INVALID}),this._renderedLines._set(e.startLineNumber,i)}linesEquals(e){if(!this.scrollEquals(e))return!1;const i=this._renderedLines._get().lines;for(let r=0,s=i.length;r1){for(let _=0,v=r-1;_0&&this.minimapLines[i-1]>=e;)i--;let r=this.modelLineToMinimapLine(t)-1;for(;r+1t)return null}return[i+1,r+1]}decorationLineRangeToMinimapLineRange(e,t){let i=this.modelLineToMinimapLine(e),r=this.modelLineToMinimapLine(t);return e!==t&&r===i&&(r===this.minimapLines.length?i>1&&i--:r++),[i,r]}onLinesDeleted(e){const t=e.toLineNumber-e.fromLineNumber+1;let i=this.minimapLines.length,r=0;for(let s=this.minimapLines.length-1;s>=0&&!(this.minimapLines[s]=0&&!(this.minimapLines[i]0,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight,viewportStartLineNumber:t,viewportEndLineNumber:i,viewportStartLineNumberVerticalOffset:e.getVerticalOffsetForLineNumber(t),scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight};this._actual.render(r)}_recreateLineSampling(){this._minimapSelections=null;const e=!!this._samplingState,[t,i]=YN.compute(this.options,this._context.viewModel.getLineCount(),this._samplingState);if(this._samplingState=t,e&&this._samplingState)for(const r of i)switch(r.type){case"deleted":this._actual.onLinesDeleted(r.deleteFromLineNumber,r.deleteToLineNumber);break;case"inserted":this._actual.onLinesInserted(r.insertFromLineNumber,r.insertToLineNumber);break;case"flush":this._actual.onFlushed();break}}getLineCount(){return this._samplingState?this._samplingState.minimapLines.length:this._context.viewModel.getLineCount()}getRealLineCount(){return this._context.viewModel.getLineCount()}getLineContent(e){return this._samplingState?this._context.viewModel.getLineContent(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineContent(e)}getLineMaxColumn(e){return this._samplingState?this._context.viewModel.getLineMaxColumn(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineMaxColumn(e)}getMinimapLinesRenderingData(e,t,i){if(this._samplingState){const r=[];for(let s=0,o=t-e+1;s!r.options.minimap?.sectionHeaderStyle);if(this._samplingState){const r=[];for(const s of i){if(!s.options.minimap)continue;const o=s.range,a=this._samplingState.modelLineToMinimapLine(o.startLineNumber),l=this._samplingState.modelLineToMinimapLine(o.endLineNumber);r.push(new J6e(new $(a,o.startColumn,l,o.endColumn),s.options))}return r}return i}getSectionHeaderDecorationsInViewport(e,t){const i=this.options.minimapLineHeight,s=this.options.sectionHeaderFontSize/i;return e=Math.floor(Math.max(1,e-s)),this._getMinimapDecorationsInViewport(e,t).filter(o=>!!o.options.minimap?.sectionHeaderStyle)}_getMinimapDecorationsInViewport(e,t){let i;if(this._samplingState){const r=this._samplingState.minimapLines[e-1],s=this._samplingState.minimapLines[t-1];i=new $(r,1,s,this._context.viewModel.getLineMaxColumn(s))}else i=new $(e,1,t,this._context.viewModel.getLineMaxColumn(t));return this._context.viewModel.getMinimapDecorationsInRange(i)}getSectionHeaderText(e,t){const i=e.options.minimap?.sectionHeaderText;if(!i)return null;const r=this._sectionHeaderCache.get(i);if(r)return r;const s=t(i);return this._sectionHeaderCache.set(i,s),s}getOptions(){return this._context.viewModel.model.getOptions()}revealLineNumber(e){this._samplingState&&(e=this._samplingState.minimapLines[e-1]),this._context.viewModel.revealRange("mouse",!1,new $(e,1,e,1),1,0)}setScrollTop(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e},1)}}class RS extends me{constructor(e,t){super(),this._renderDecorations=!1,this._gestureInProgress=!1,this._theme=e,this._model=t,this._lastRenderData=null,this._buffers=null,this._selectionColor=this._theme.getColor(m1e),this._domNode=Ci(document.createElement("div")),Ig.write(this._domNode,9),this._domNode.setClassName(this._getMinimapDomNodeClassName()),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._shadow=Ci(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=Ci(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=Ci(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=Ci(document.createElement("div")),this._slider.setPosition("absolute"),this._slider.setClassName("minimap-slider"),this._slider.setLayerHinting(!0),this._slider.setContain("strict"),this._domNode.appendChild(this._slider),this._sliderHorizontal=Ci(document.createElement("div")),this._sliderHorizontal.setPosition("absolute"),this._sliderHorizontal.setClassName("minimap-slider-horizontal"),this._slider.appendChild(this._sliderHorizontal),this._applyLayout(),this._pointerDownListener=Jr(this._domNode.domNode,je.POINTER_DOWN,i=>{if(i.preventDefault(),this._model.options.renderMinimap===0||!this._lastRenderData)return;if(this._model.options.size!=="proportional"){if(i.button===0&&this._lastRenderData){const c=ms(this._slider.domNode),u=c.top+c.height/2;this._startSliderDragging(i,u,this._lastRenderData.renderedLayout)}return}const s=this._model.options.minimapLineHeight,o=this._model.options.canvasInnerHeight/this._model.options.canvasOuterHeight*i.offsetY;let l=Math.floor(o/s)+this._lastRenderData.renderedLayout.startLineNumber-this._lastRenderData.renderedLayout.topPaddingLineCount;l=Math.min(l,this._model.getLineCount()),this._model.revealLineNumber(l)}),this._sliderPointerMoveMonitor=new e2,this._sliderPointerDownListener=Jr(this._slider.domNode,je.POINTER_DOWN,i=>{i.preventDefault(),i.stopPropagation(),i.button===0&&this._lastRenderData&&this._startSliderDragging(i,i.pageY,this._lastRenderData.renderedLayout)}),this._gestureDisposable=Fr.addTarget(this._domNode.domNode),this._sliderTouchStartListener=Ce(this._domNode.domNode,gr.Start,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(i))},{passive:!1}),this._sliderTouchMoveListener=Ce(this._domNode.domNode,gr.Change,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(i)},{passive:!1}),this._sliderTouchEndListener=Jr(this._domNode.domNode,gr.End,i=>{i.preventDefault(),i.stopPropagation(),this._gestureInProgress=!1,this._slider.toggleClassName("active",!1)})}_startSliderDragging(e,t,i){if(!e.target||!(e.target instanceof Element))return;const r=e.pageX;this._slider.toggleClassName("active",!0);const s=(o,a)=>{const l=ms(this._domNode.domNode),c=Math.min(Math.abs(a-r),Math.abs(a-l.left),Math.abs(a-l.left-l.width));if(Ta&&c>JAt){this._model.setScrollTop(i.scrollTop);return}const u=o-t;this._model.setScrollTop(i.getDesiredScrollTopFromDelta(u))};e.pageY!==t&&s(e.pageY,r),this._sliderPointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>s(o.pageY,o.pageX),()=>{this._slider.toggleClassName("active",!1)})}scrollDueToTouchEvent(e){const t=this._domNode.domNode.getBoundingClientRect().top,i=this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(e.pageY-t);this._model.setScrollTop(i)}dispose(){this._pointerDownListener.dispose(),this._sliderPointerMoveMonitor.dispose(),this._sliderPointerDownListener.dispose(),this._gestureDisposable.dispose(),this._sliderTouchStartListener.dispose(),this._sliderTouchMoveListener.dispose(),this._sliderTouchEndListener.dispose(),super.dispose()}_getMinimapDomNodeClassName(){const e=["minimap"];return this._model.options.showSlider==="always"?e.push("slider-always"):e.push("slider-mouseover"),this._model.options.autohide&&e.push("autohide"),e.join(" ")}getDomNode(){return this._domNode}_applyLayout(){this._domNode.setLeft(this._model.options.minimapLeft),this._domNode.setWidth(this._model.options.minimapWidth),this._domNode.setHeight(this._model.options.minimapHeight),this._shadow.setHeight(this._model.options.minimapHeight),this._canvas.setWidth(this._model.options.canvasOuterWidth),this._canvas.setHeight(this._model.options.canvasOuterHeight),this._canvas.domNode.width=this._model.options.canvasInnerWidth,this._canvas.domNode.height=this._model.options.canvasInnerHeight,this._decorationsCanvas.setWidth(this._model.options.canvasOuterWidth),this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight),this._decorationsCanvas.domNode.width=this._model.options.canvasInnerWidth,this._decorationsCanvas.domNode.height=this._model.options.canvasInnerHeight,this._slider.setWidth(this._model.options.minimapWidth)}_getBuffer(){return this._buffers||this._model.options.canvasInnerWidth>0&&this._model.options.canvasInnerHeight>0&&(this._buffers=new Vce(this._canvas.domNode.getContext("2d"),this._model.options.canvasInnerWidth,this._model.options.canvasInnerHeight,this._model.options.backgroundColor)),this._buffers?this._buffers.getBuffer():null}onDidChangeOptions(){this._lastRenderData=null,this._buffers=null,this._applyLayout(),this._domNode.setClassName(this._getMinimapDomNodeClassName())}onSelectionChanged(){return this._renderDecorations=!0,!0}onDecorationsChanged(){return this._renderDecorations=!0,!0}onFlushed(){return this._lastRenderData=null,!0}onLinesChanged(e,t){return this._lastRenderData?this._lastRenderData.onLinesChanged(e,t):!1}onLinesDeleted(e,t){return this._lastRenderData?.onLinesDeleted(e,t),!0}onLinesInserted(e,t){return this._lastRenderData?.onLinesInserted(e,t),!0}onScrollChanged(){return this._renderDecorations=!0,!0}onThemeChanged(){return this._selectionColor=this._theme.getColor(m1e),this._renderDecorations=!0,!0}onTokensChanged(e){return this._lastRenderData?this._lastRenderData.onTokensChanged(e):!1}onTokensColorsChanged(){return this._lastRenderData=null,this._buffers=null,!0}onZonesChanged(){return this._lastRenderData=null,!0}render(e){if(this._model.options.renderMinimap===0){this._shadow.setClassName("minimap-shadow-hidden"),this._sliderHorizontal.setWidth(0),this._sliderHorizontal.setHeight(0);return}e.scrollLeft+e.viewportWidth>=e.scrollWidth?this._shadow.setClassName("minimap-shadow-hidden"):this._shadow.setClassName("minimap-shadow-visible");const i=OI.create(this._model.options,e.viewportStartLineNumber,e.viewportEndLineNumber,e.viewportStartLineNumberVerticalOffset,e.viewportHeight,e.viewportContainsWhitespaceGaps,this._model.getLineCount(),this._model.getRealLineCount(),e.scrollTop,e.scrollHeight,this._lastRenderData?this._lastRenderData.renderedLayout:null);this._slider.setDisplay(i.sliderNeeded?"block":"none"),this._slider.setTop(i.sliderTop),this._slider.setHeight(i.sliderHeight),this._sliderHorizontal.setLeft(0),this._sliderHorizontal.setWidth(this._model.options.minimapWidth),this._sliderHorizontal.setTop(0),this._sliderHorizontal.setHeight(i.sliderHeight),this.renderDecorations(i),this._lastRenderData=this.renderLines(i)}renderDecorations(e){if(this._renderDecorations){this._renderDecorations=!1;const t=this._model.getSelections();t.sort($.compareRangesUsingStarts);const i=this._model.getMinimapDecorationsInViewport(e.startLineNumber,e.endLineNumber);i.sort((h,f)=>(h.options.zIndex||0)-(f.options.zIndex||0));const{canvasInnerWidth:r,canvasInnerHeight:s}=this._model.options,o=this._model.options.minimapLineHeight,a=this._model.options.minimapCharWidth,l=this._model.getOptions().tabSize,c=this._decorationsCanvas.domNode.getContext("2d");c.clearRect(0,0,r,s);const u=new wwe(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(c,t,u,e,o),this._renderDecorationsLineHighlights(c,i,u,e,o);const d=new wwe(e.startLineNumber,e.endLineNumber,null);this._renderSelectionsHighlights(c,t,d,e,o,l,a,r),this._renderDecorationsHighlights(c,i,d,e,o,l,a,r),this._renderSectionHeaders(e)}}_renderSelectionLineHighlights(e,t,i,r,s){if(!this._selectionColor||this._selectionColor.isTransparent())return;e.fillStyle=this._selectionColor.transparent(.5).toString();let o=0,a=0;for(const l of t){const c=r.intersectWithViewport(l);if(!c)continue;const[u,d]=c;for(let g=u;g<=d;g++)i.set(g,!0);const h=r.getYForLineNumber(u,s),f=r.getYForLineNumber(d,s);a>=h||(a>o&&e.fillRect(tp,o,e.canvas.width,a-o),o=h),a=f}a>o&&e.fillRect(tp,o,e.canvas.width,a-o)}_renderDecorationsLineHighlights(e,t,i,r,s){const o=new Map;for(let a=t.length-1;a>=0;a--){const l=t[a],c=l.options.minimap;if(!c||c.position!==1)continue;const u=r.intersectWithViewport(l.range);if(!u)continue;const[d,h]=u,f=c.getColor(this._theme.value);if(!f||f.isTransparent())continue;let g=o.get(f.toString());g||(g=f.transparent(.5).toString(),o.set(f.toString(),g)),e.fillStyle=g;for(let p=d;p<=h;p++){if(i.has(p))continue;i.set(p,!0);const m=r.getYForLineNumber(d,s);e.fillRect(tp,m,e.canvas.width,s)}}}_renderSelectionsHighlights(e,t,i,r,s,o,a,l){if(!(!this._selectionColor||this._selectionColor.isTransparent()))for(const c of t){const u=r.intersectWithViewport(c);if(!u)continue;const[d,h]=u;for(let f=d;f<=h;f++)this.renderDecorationOnLine(e,i,c,this._selectionColor,r,f,s,s,o,a,l)}}_renderDecorationsHighlights(e,t,i,r,s,o,a,l){for(const c of t){const u=c.options.minimap;if(!u)continue;const d=r.intersectWithViewport(c.range);if(!d)continue;const[h,f]=d,g=u.getColor(this._theme.value);if(!(!g||g.isTransparent()))for(let p=h;p<=f;p++)switch(u.position){case 1:this.renderDecorationOnLine(e,i,c.range,g,r,p,s,s,o,a,l);continue;case 2:{const m=r.getYForLineNumber(p,s);this.renderDecoration(e,g,2,m,eNt,s);continue}}}}renderDecorationOnLine(e,t,i,r,s,o,a,l,c,u,d){const h=s.getYForLineNumber(o,l);if(h+a<0||h>this._model.options.canvasInnerHeight)return;const{startLineNumber:f,endLineNumber:g}=i,p=f===o?i.startColumn:1,m=g===o?i.endColumn:this._model.getLineMaxColumn(o),_=this.getXOffsetForPosition(t,o,p,c,u,d),v=this.getXOffsetForPosition(t,o,m,c,u,d);this.renderDecoration(e,r,_,h,v-_,a)}getXOffsetForPosition(e,t,i,r,s,o){if(i===1)return tp;if((i-1)*s>=o)return o;let l=e.get(t);if(!l){const c=this._model.getLineContent(t);l=[tp];let u=tp;for(let d=1;d=o){l[d]=o;break}l[d]=g,u=g}e.set(t,l)}return i-1p.range.startLineNumber-m.range.startLineNumber);const g=RS._fitSectionHeader.bind(null,h,o-tp);for(const p of f){const m=e.getYForLineNumber(p.range.startLineNumber,t)+i,_=m-i,v=_+2,y=this._model.getSectionHeaderText(p,g);RS._renderSectionLabel(h,y,p.options.minimap?.sectionHeaderStyle===2,l,u,o,_,s,m,v)}}static _fitSectionHeader(e,t,i){if(!i)return i;const r="…",s=e.measureText(i).width,o=e.measureText(r).width;if(s<=t||s<=o)return i;const a=i.length,l=s/i.length,c=Math.floor((t-o)/l)-1;let u=Math.ceil(c/2);for(;u>0&&/\s/.test(i[u-1]);)--u;return i.substring(0,u)+r+i.substring(a-(c-u))}static _renderSectionLabel(e,t,i,r,s,o,a,l,c,u){t&&(e.fillStyle=r,e.fillRect(0,a,o,l),e.fillStyle=s,e.fillText(t,tp,c)),i&&(e.beginPath(),e.moveTo(0,u),e.lineTo(o,u),e.closePath(),e.stroke())}renderLines(e){const t=e.startLineNumber,i=e.endLineNumber,r=this._model.options.minimapLineHeight;if(this._lastRenderData&&this._lastRenderData.linesEquals(e)){const z=this._lastRenderData._get();return new ywe(e,z.imageData,z.lines)}const s=this._getBuffer();if(!s)return null;const[o,a,l]=RS._renderUntouchedLines(s,e.topPaddingLineCount,t,i,r,this._lastRenderData),c=this._model.getMinimapLinesRenderingData(t,i,l),u=this._model.getOptions().tabSize,d=this._model.options.defaultBackgroundColor,h=this._model.options.backgroundColor,f=this._model.options.foregroundAlpha,g=this._model.tokensColorTracker,p=g.backgroundIsLight(),m=this._model.options.renderMinimap,_=this._model.options.charRenderer(),v=this._model.options.fontScale,y=this._model.options.minimapCharWidth,x=(m===1?2:3)*v,k=r>x?Math.floor((r-x)/2):0,L=h.a/255,D=new Fd(Math.round((h.r-d.r)*L+d.r),Math.round((h.g-d.g)*L+d.g),Math.round((h.b-d.b)*L+d.b),255);let I=e.topPaddingLineCount*r;const O=[];for(let z=0,q=i-t+1;z=0&&Mv)return;const B=m.charCodeAt(x);if(B===9){const G=h-(x+k)%h;k+=G-1,C+=G*o}else if(B===32)C+=o;else{const G=xb(B)?2:1;for(let W=0;Wv)return}}}}}class wwe{constructor(e,t,i){this._startLineNumber=e,this._endLineNumber=t,this._defaultValue=i,this._values=[];for(let r=0,s=this._endLineNumber-this._startLineNumber+1;rthis._endLineNumber||(this._values[e-this._startLineNumber]=t)}get(e){return ethis._endLineNumber?this._defaultValue:this._values[e-this._startLineNumber]}}class nNt extends bu{constructor(e,t){super(e),this._viewDomNode=t;const r=this._context.configuration.options.get(146);this._widgets={},this._verticalScrollbarWidth=r.verticalScrollbarWidth,this._minimapWidth=r.minimap.minimapWidth,this._horizontalScrollbarHeight=r.horizontalScrollbarHeight,this._editorHeight=r.height,this._editorWidth=r.width,this._viewDomNodeRect={top:0,left:0,width:0,height:0},this._domNode=Ci(document.createElement("div")),Ig.write(this._domNode,4),this._domNode.setClassName("overlayWidgets"),this.overflowingOverlayWidgetsDomNode=Ci(document.createElement("div")),Ig.write(this.overflowingOverlayWidgetsDomNode,5),this.overflowingOverlayWidgetsDomNode.setClassName("overflowingOverlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(e){const i=this._context.configuration.options.get(146);return this._verticalScrollbarWidth=i.verticalScrollbarWidth,this._minimapWidth=i.minimap.minimapWidth,this._horizontalScrollbarHeight=i.horizontalScrollbarHeight,this._editorHeight=i.height,this._editorWidth=i.width,!0}addWidget(e){const t=Ci(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:null,domNode:t},t.setPosition("absolute"),t.setAttribute("widgetId",e.getId()),e.allowEditorOverflow?this.overflowingOverlayWidgetsDomNode.appendChild(t):this._domNode.appendChild(t),this.setShouldRender(),this._updateMaxMinWidth()}setWidgetPosition(e,t){const i=this._widgets[e.getId()],r=t?t.preference:null,s=t?.stackOridinal;return i.preference===r&&i.stack===s?(this._updateMaxMinWidth(),!1):(i.preference=r,i.stack=s,this.setShouldRender(),this._updateMaxMinWidth(),!0)}removeWidget(e){const t=e.getId();if(this._widgets.hasOwnProperty(t)){const r=this._widgets[t].domNode.domNode;delete this._widgets[t],r.remove(),this.setShouldRender(),this._updateMaxMinWidth()}}_updateMaxMinWidth(){let e=0;const t=Object.keys(this._widgets);for(let i=0,r=t.length;i0);t.sort((r,s)=>(this._widgets[r].stack||0)-(this._widgets[s].stack||0));for(let r=0,s=t.length;r=3){const s=Math.floor(r/3),o=Math.floor(r/3),a=r-s-o,l=e,c=l+s,u=l+s+a;return[[0,l,c,l,u,l,c,l],[0,s,a,s+a,o,s+a+o,a+o,s+a+o]]}else if(i===2){const s=Math.floor(r/2),o=r-s,a=e,l=a+s;return[[0,a,a,a,l,a,a,a],[0,s,s,s,o,s+o,s+o,s+o]]}else{const s=e,o=r;return[[0,s,s,s,s,s,s,s],[0,o,o,o,o,o,o,o]]}}equals(e){return this.lineHeight===e.lineHeight&&this.pixelRatio===e.pixelRatio&&this.overviewRulerLanes===e.overviewRulerLanes&&this.renderBorder===e.renderBorder&&this.borderColor===e.borderColor&&this.hideCursor===e.hideCursor&&this.cursorColorSingle===e.cursorColorSingle&&this.cursorColorPrimary===e.cursorColorPrimary&&this.cursorColorSecondary===e.cursorColorSecondary&&this.themeType===e.themeType&&Te.equals(this.backgroundColor,e.backgroundColor)&&this.top===e.top&&this.right===e.right&&this.domWidth===e.domWidth&&this.domHeight===e.domHeight&&this.canvasWidth===e.canvasWidth&&this.canvasHeight===e.canvasHeight}};class rNt extends bu{constructor(e){super(e),this._actualShouldRender=0,this._renderedDecorations=[],this._renderedCursorPositions=[],this._domNode=Ci(document.createElement("canvas")),this._domNode.setClassName("decorationsOverviewRuler"),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._domNode.setAttribute("aria-hidden","true"),this._updateSettings(!1),this._tokensColorTrackerListener=rs.onDidChange(t=>{t.changedColorMap&&this._updateSettings(!0)}),this._cursorPositions=[{position:new he(1,1),color:this._settings.cursorColorSingle}]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){const t=new iNt(this._context.configuration,this._context.theme);return this._settings&&this._settings.equals(t)?!1:(this._settings=t,this._domNode.setTop(this._settings.top),this._domNode.setRight(this._settings.right),this._domNode.setWidth(this._settings.domWidth),this._domNode.setHeight(this._settings.domHeight),this._domNode.domNode.width=this._settings.canvasWidth,this._domNode.domNode.height=this._settings.canvasHeight,e&&this._render(),!0)}_markRenderingIsNeeded(){return this._actualShouldRender=2,!0}_markRenderingIsMaybeNeeded(){return this._actualShouldRender=1,!0}onConfigurationChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}onCursorStateChanged(e){this._cursorPositions=[];for(let t=0,i=e.selections.length;t1&&(r=t===0?this._settings.cursorColorPrimary:this._settings.cursorColorSecondary),this._cursorPositions.push({position:e.selections[t].getPosition(),color:r})}return this._cursorPositions.sort((t,i)=>he.compare(t.position,i.position)),this._markRenderingIsMaybeNeeded()}onDecorationsChanged(e){return e.affectsOverviewRuler?this._markRenderingIsMaybeNeeded():!1}onFlushed(e){return this._markRenderingIsNeeded()}onScrollChanged(e){return e.scrollHeightChanged?this._markRenderingIsNeeded():!1}onZonesChanged(e){return this._markRenderingIsNeeded()}onThemeChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}getDomNode(){return this._domNode.domNode}prepareRender(e){}render(e){this._render(),this._actualShouldRender=0}_render(){const e=this._settings.backgroundColor;if(this._settings.overviewRulerLanes===0){this._domNode.setBackgroundColor(e?Te.Format.CSS.formatHexA(e):""),this._domNode.setDisplay("none");return}const t=this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme);if(t.sort(HN.compareByRenderingProps),this._actualShouldRender===1&&!HN.equalsArr(this._renderedDecorations,t)&&(this._actualShouldRender=2),this._actualShouldRender===1&&!$r(this._renderedCursorPositions,this._cursorPositions,(g,p)=>g.position.lineNumber===p.position.lineNumber&&g.color===p.color)&&(this._actualShouldRender=2),this._actualShouldRender===1)return;this._renderedDecorations=t,this._renderedCursorPositions=this._cursorPositions,this._domNode.setDisplay("block");const i=this._settings.canvasWidth,r=this._settings.canvasHeight,s=this._settings.lineHeight,o=this._context.viewLayout,a=this._context.viewLayout.getScrollHeight(),l=r/a,c=6*this._settings.pixelRatio|0,u=c/2|0,d=this._domNode.domNode.getContext("2d");e?e.isOpaque()?(d.fillStyle=Te.Format.CSS.formatHexA(e),d.fillRect(0,0,i,r)):(d.clearRect(0,0,i,r),d.fillStyle=Te.Format.CSS.formatHexA(e),d.fillRect(0,0,i,r)):d.clearRect(0,0,i,r);const h=this._settings.x,f=this._settings.w;for(const g of t){const p=g.color,m=g.data;d.fillStyle=p;let _=0,v=0,y=0;for(let C=0,x=m.length/3;Cr&&(B=r-u),I=B-u,O=B+u}I>y+1||k!==_?(C!==0&&d.fillRect(h[_],v,f[_],y-v),_=k,v=I,y=O):O>y&&(y=O)}d.fillRect(h[_],v,f[_],y-v)}if(!this._settings.hideCursor){const g=2*this._settings.pixelRatio|0,p=g/2|0,m=this._settings.x[7],_=this._settings.w[7];let v=-100,y=-100,C=null;for(let x=0,k=this._cursorPositions.length;xr&&(I=r-p);const O=I-p,M=O+g;O>y+1||L!==C?(x!==0&&C&&d.fillRect(m,v,_,y-v),v=O,y=M):M>y&&(y=M),C=L,d.fillStyle=L}C&&d.fillRect(m,v,_,y-v)}this._settings.renderBorder&&this._settings.borderColor&&this._settings.overviewRulerLanes>0&&(d.beginPath(),d.lineWidth=1,d.strokeStyle=this._settings.borderColor,d.moveTo(0,0),d.lineTo(0,r),d.moveTo(1,0),d.lineTo(i,0),d.stroke())}}class Cwe{constructor(e,t,i){this._colorZoneBrand=void 0,this.from=e|0,this.to=t|0,this.colorId=i|0}static compare(e,t){return e.colorId===t.colorId?e.from===t.from?e.to-t.to:e.from-t.from:e.colorId-t.colorId}}class v8e{constructor(e,t,i,r){this._overviewRulerZoneBrand=void 0,this.startLineNumber=e,this.endLineNumber=t,this.heightInLines=i,this.color=r,this._colorZone=null}static compare(e,t){return e.color===t.color?e.startLineNumber===t.startLineNumber?e.heightInLines===t.heightInLines?e.endLineNumber-t.endLineNumber:e.heightInLines-t.heightInLines:e.startLineNumber-t.startLineNumber:e.colori&&(p=i-m);const _=u.color;let v=this._color2Id[_];v||(v=++this._lastAssignedId,this._color2Id[_]=v,this._id2Color[v]=_);const y=new Cwe(p-m,p+m,v);u.setColorZone(y),a.push(y)}return this._colorZonesInvalid=!1,a.sort(Cwe.compare),a}}class oNt extends _O{constructor(e,t){super(),this._context=e;const i=this._context.configuration.options;this._domNode=Ci(document.createElement("canvas")),this._domNode.setClassName(t),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new sNt(r=>this._context.viewLayout.getVerticalOffsetForLineNumber(r)),this._zoneManager.setDOMWidth(0),this._zoneManager.setDOMHeight(0),this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight()),this._zoneManager.setLineHeight(i.get(67)),this._zoneManager.setPixelRatio(i.get(144)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return e.hasChanged(67)&&(this._zoneManager.setLineHeight(t.get(67)),this._render()),e.hasChanged(144)&&(this._zoneManager.setPixelRatio(t.get(144)),this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render()),!0}onFlushed(e){return this._render(),!0}onScrollChanged(e){return e.scrollHeightChanged&&(this._zoneManager.setOuterHeight(e.scrollHeight),this._render()),!0}onZonesChanged(e){return this._render(),!0}getDomNode(){return this._domNode.domNode}setLayout(e){this._domNode.setTop(e.top),this._domNode.setRight(e.right);let t=!1;t=this._zoneManager.setDOMWidth(e.width)||t,t=this._zoneManager.setDOMHeight(e.height)||t,t&&(this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render())}setZones(e){this._zoneManager.setZones(e),this._render()}_render(){if(this._zoneManager.getOuterHeight()===0)return!1;const e=this._zoneManager.getCanvasWidth(),t=this._zoneManager.getCanvasHeight(),i=this._zoneManager.resolveColorZones(),r=this._zoneManager.getId2Color(),s=this._domNode.domNode.getContext("2d");return s.clearRect(0,0,e,t),i.length>0&&this._renderOneLane(s,i,r,e),!0}_renderOneLane(e,t,i,r){let s=0,o=0,a=0;for(const l of t){const c=l.colorId,u=l.from,d=l.to;c!==s?(e.fillRect(0,o,r,a-o),s=c,e.fillStyle=i[s],o=u,a=d):a>=u?a=Math.max(a,d):(e.fillRect(0,o,r,a-o),o=u,a=d)}e.fillRect(0,o,r,a-o)}}class aNt extends bu{constructor(e){super(e),this.domNode=Ci(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("view-rulers"),this._renderedRulers=[];const t=this._context.configuration.options;this._rulers=t.get(103),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth}dispose(){super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._rulers=t.get(103),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,!0}onScrollChanged(e){return e.scrollHeightChanged}prepareRender(e){}_ensureRulersCount(){const e=this._renderedRulers.length,t=this._rulers.length;if(e===t)return;if(e0;){const a=Ci(document.createElement("div"));a.setClassName("view-ruler"),a.setWidth(s),this.domNode.appendChild(a),this._renderedRulers.push(a),o--}return}let i=e-t;for(;i>0;){const r=this._renderedRulers.pop();this.domNode.removeChild(r),i--}}render(e){this._ensureRulersCount();for(let t=0,i=this._rulers.length;t0;return this._shouldShow!==e?(this._shouldShow=e,!0):!1}getDomNode(){return this._domNode}_updateWidth(){const t=this._context.configuration.options.get(146);t.minimap.renderMinimap===0||t.minimap.minimapWidth>0&&t.minimap.minimapLeft===0?this._width=t.width:this._width=t.width-t.verticalScrollbarWidth}onConfigurationChanged(e){const i=this._context.configuration.options.get(104);return this._useShadows=i.useShadows,this._updateWidth(),this._updateShouldShow(),!0}onScrollChanged(e){return this._scrollTop=e.scrollTop,this._updateShouldShow()}prepareRender(e){}render(e){this._domNode.setWidth(this._width),this._domNode.setClassName(this._shouldShow?"scroll-decoration":"")}}class cNt{constructor(e){this.left=e.left,this.width=e.width,this.startStyle=null,this.endStyle=null}}class uNt{constructor(e,t){this.lineNumber=e,this.ranges=t}}function dNt(n){return new cNt(n)}function hNt(n){return new uNt(n.lineNumber,n.ranges.map(dNt))}class jo extends kC{static{this.SELECTION_CLASS_NAME="selected-text"}static{this.SELECTION_TOP_LEFT="top-left-radius"}static{this.SELECTION_BOTTOM_LEFT="bottom-left-radius"}static{this.SELECTION_TOP_RIGHT="top-right-radius"}static{this.SELECTION_BOTTOM_RIGHT="bottom-right-radius"}static{this.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background"}static{this.ROUNDED_PIECE_WIDTH=10}constructor(e){super(),this._previousFrameVisibleRangesWithStyle=[],this._context=e;const t=this._context.configuration.options;this._roundedSelection=t.get(102),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,this._selections=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._roundedSelection=t.get(102),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_visibleRangesHaveGaps(e){for(let t=0,i=e.length;t1)return!0;return!1}_enrichVisibleRangesWithStyle(e,t,i){const r=this._typicalHalfwidthCharacterWidth/4;let s=null,o=null;if(i&&i.length>0&&t.length>0){const a=t[0].lineNumber;if(a===e.startLineNumber)for(let c=0;!s&&c=0;c--)i[c].lineNumber===l&&(o=i[c].ranges[0]);s&&!s.startStyle&&(s=null),o&&!o.startStyle&&(o=null)}for(let a=0,l=t.length;a0){const g=t[a-1].ranges[0].left,p=t[a-1].ranges[0].left+t[a-1].ranges[0].width;e3(u-g)g&&(h.top=1),e3(d-p)'}_actualRenderOneSelection(e,t,i,r){if(r.length===0)return;const s=!!r[0].ranges[0].startStyle,o=r[0].lineNumber,a=r[r.length-1].lineNumber;for(let l=0,c=r.length;l1,c)}this._previousFrameVisibleRangesWithStyle=s,this._renderResult=t.map(([o,a])=>o+a)}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}dh((n,e)=>{const t=n.getColor(byt);t&&!t.isTransparent()&&e.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${t}; }`)});function e3(n){return n<0?-n:n}class xwe{constructor(e,t,i,r,s,o,a){this.top=e,this.left=t,this.paddingLeft=i,this.width=r,this.height=s,this.textContent=o,this.textContentClassName=a}}var v_;(function(n){n[n.Single=0]="Single",n[n.MultiPrimary=1]="MultiPrimary",n[n.MultiSecondary=2]="MultiSecondary"})(v_||(v_={}));class Swe{constructor(e,t){this._context=e;const i=this._context.configuration.options,r=i.get(50);this._cursorStyle=i.get(28),this._lineHeight=i.get(67),this._typicalHalfwidthCharacterWidth=r.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(i.get(31),this._typicalHalfwidthCharacterWidth),this._isVisible=!0,this._domNode=Ci(document.createElement("div")),this._domNode.setClassName(`cursor ${Ck}`),this._domNode.setHeight(this._lineHeight),this._domNode.setTop(0),this._domNode.setLeft(0),ta(this._domNode,r),this._domNode.setDisplay("none"),this._position=new he(1,1),this._pluralityClass="",this.setPlurality(t),this._lastRenderedContent="",this._renderData=null}getDomNode(){return this._domNode}getPosition(){return this._position}setPlurality(e){switch(e){default:case v_.Single:this._pluralityClass="";break;case v_.MultiPrimary:this._pluralityClass="cursor-primary";break;case v_.MultiSecondary:this._pluralityClass="cursor-secondary";break}}show(){this._isVisible||(this._domNode.setVisibility("inherit"),this._isVisible=!0)}hide(){this._isVisible&&(this._domNode.setVisibility("hidden"),this._isVisible=!1)}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(50);return this._cursorStyle=t.get(28),this._lineHeight=t.get(67),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(31),this._typicalHalfwidthCharacterWidth),ta(this._domNode,i),!0}onCursorPositionChanged(e,t){return t?this._domNode.domNode.style.transitionProperty="none":this._domNode.domNode.style.transitionProperty="",this._position=e,!0}_getGraphemeAwarePosition(){const{lineNumber:e,column:t}=this._position,i=this._context.viewModel.getLineContent(e),[r,s]=f_t(i,t-1);return[new he(e,r+1),i.substring(r,s)]}_prepareRender(e){let t="",i="";const[r,s]=this._getGraphemeAwarePosition();if(this._cursorStyle===Yo.Line||this._cursorStyle===Yo.LineThin){const h=e.visibleRangeForPosition(r);if(!h||h.outsideRenderedLine)return null;const f=Ot(this._domNode.domNode);let g;this._cursorStyle===Yo.Line?(g=ebe(f,this._lineCursorWidth>0?this._lineCursorWidth:2),g>2&&(t=s,i=this._getTokenClassName(r))):g=ebe(f,1);let p=h.left,m=0;g>=2&&p>=1&&(m=1,p-=m);const _=e.getVerticalOffsetForLineNumber(r.lineNumber)-e.bigNumbersDelta;return new xwe(_,p,m,g,this._lineHeight,t,i)}const o=e.linesVisibleRangesForRange(new $(r.lineNumber,r.column,r.lineNumber,r.column+s.length),!1);if(!o||o.length===0)return null;const a=o[0];if(a.outsideRenderedLine||a.ranges.length===0)return null;const l=a.ranges[0],c=s===" "?this._typicalHalfwidthCharacterWidth:l.width<1?this._typicalHalfwidthCharacterWidth:l.width;this._cursorStyle===Yo.Block&&(t=s,i=this._getTokenClassName(r));let u=e.getVerticalOffsetForLineNumber(r.lineNumber)-e.bigNumbersDelta,d=this._lineHeight;return(this._cursorStyle===Yo.Underline||this._cursorStyle===Yo.UnderlineThin)&&(u+=this._lineHeight-2,d=2),new xwe(u,l.left,0,c,d,t,i)}_getTokenClassName(e){const t=this._context.viewModel.getViewLineData(e.lineNumber),i=t.tokens.findTokenIndexAtOffset(e.column-1);return t.tokens.getClassName(i)}prepareRender(e){this._renderData=this._prepareRender(e)}render(e){return this._renderData?(this._lastRenderedContent!==this._renderData.textContent&&(this._lastRenderedContent=this._renderData.textContent,this._domNode.domNode.textContent=this._lastRenderedContent),this._domNode.setClassName(`cursor ${this._pluralityClass} ${Ck} ${this._renderData.textContentClassName}`),this._domNode.setDisplay("block"),this._domNode.setTop(this._renderData.top),this._domNode.setLeft(this._renderData.left),this._domNode.setPaddingLeft(this._renderData.paddingLeft),this._domNode.setWidth(this._renderData.width),this._domNode.setLineHeight(this._renderData.height),this._domNode.setHeight(this._renderData.height),{domNode:this._domNode.domNode,position:this._position,contentLeft:this._renderData.left,height:this._renderData.height,width:2}):(this._domNode.setDisplay("none"),null)}}class g9 extends bu{static{this.BLINK_INTERVAL=500}constructor(e){super(e);const t=this._context.configuration.options;this._readOnly=t.get(92),this._cursorBlinking=t.get(26),this._cursorStyle=t.get(28),this._cursorSmoothCaretAnimation=t.get(27),this._selectionIsEmpty=!0,this._isComposingInput=!1,this._isVisible=!1,this._primaryCursor=new Swe(this._context,v_.Single),this._secondaryCursors=[],this._renderData=[],this._domNode=Ci(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._updateDomClassName(),this._domNode.appendChild(this._primaryCursor.getDomNode()),this._startCursorBlinkAnimation=new hf,this._cursorFlatBlinkInterval=new $ae,this._blinkingEnabled=!1,this._editorHasFocus=!1,this._updateBlinking()}dispose(){super.dispose(),this._startCursorBlinkAnimation.dispose(),this._cursorFlatBlinkInterval.dispose()}getDomNode(){return this._domNode}onCompositionStart(e){return this._isComposingInput=!0,this._updateBlinking(),!0}onCompositionEnd(e){return this._isComposingInput=!1,this._updateBlinking(),!0}onConfigurationChanged(e){const t=this._context.configuration.options;this._readOnly=t.get(92),this._cursorBlinking=t.get(26),this._cursorStyle=t.get(28),this._cursorSmoothCaretAnimation=t.get(27),this._updateBlinking(),this._updateDomClassName(),this._primaryCursor.onConfigurationChanged(e);for(let i=0,r=this._secondaryCursors.length;it.length){const s=this._secondaryCursors.length-t.length;for(let o=0;o{for(let r=0,s=e.ranges.length;r{this._isVisible?this._hide():this._show()},g9.BLINK_INTERVAL,Ot(this._domNode.domNode)):this._startCursorBlinkAnimation.setIfNotSet(()=>{this._blinkingEnabled=!0,this._updateDomClassName()},g9.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let e="cursors-layer";switch(this._selectionIsEmpty||(e+=" has-selection"),this._cursorStyle){case Yo.Line:e+=" cursor-line-style";break;case Yo.Block:e+=" cursor-block-style";break;case Yo.Underline:e+=" cursor-underline-style";break;case Yo.LineThin:e+=" cursor-line-thin-style";break;case Yo.BlockOutline:e+=" cursor-block-outline-style";break;case Yo.UnderlineThin:e+=" cursor-underline-thin-style";break;default:e+=" cursor-line-style"}if(this._blinkingEnabled)switch(this._getCursorBlinking()){case 1:e+=" cursor-blink";break;case 2:e+=" cursor-smooth";break;case 3:e+=" cursor-phase";break;case 4:e+=" cursor-expand";break;case 5:e+=" cursor-solid";break;default:e+=" cursor-solid"}else e+=" cursor-solid";return(this._cursorSmoothCaretAnimation==="on"||this._cursorSmoothCaretAnimation==="explicit")&&(e+=" cursor-smooth-caret-animation"),e}_show(){this._primaryCursor.show();for(let e=0,t=this._secondaryCursors.length;e{const t=[{class:".cursor",foreground:LW,background:Vle},{class:".cursor-primary",foreground:L5e,background:Okt},{class:".cursor-secondary",foreground:T5e,background:Mkt}];for(const i of t){const r=n.getColor(i.foreground);if(r){let s=n.getColor(i.background);s||(s=r.opposite()),e.addRule(`.monaco-editor .cursors-layer ${i.class} { background-color: ${r}; border-color: ${r}; color: ${s}; }`),mg(n.type)&&e.addRule(`.monaco-editor .cursors-layer.has-selection ${i.class} { border-left: 1px solid ${s}; border-right: 1px solid ${s}; }`)}}});const Tq=()=>{throw new Error("Invalid change accessor")};class fNt extends bu{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(146);this._lineHeight=t.get(67),this._contentWidth=i.contentWidth,this._contentLeft=i.contentLeft,this.domNode=Ci(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.marginDomNode=Ci(document.createElement("div")),this.marginDomNode.setClassName("margin-view-zones"),this.marginDomNode.setPosition("absolute"),this.marginDomNode.setAttribute("role","presentation"),this.marginDomNode.setAttribute("aria-hidden","true"),this._zones={}}dispose(){super.dispose(),this._zones={}}_recomputeWhitespacesProps(){const e=this._context.viewLayout.getWhitespaces(),t=new Map;for(const r of e)t.set(r.id,r);let i=!1;return this._context.viewModel.changeWhitespace(r=>{const s=Object.keys(this._zones);for(let o=0,a=s.length;o{const r={addZone:s=>(t=!0,this._addZone(i,s)),removeZone:s=>{s&&(t=this._removeZone(i,s)||t)},layoutZone:s=>{s&&(t=this._layoutZone(i,s)||t)}};gNt(e,r),r.addZone=Tq,r.removeZone=Tq,r.layoutZone=Tq}),t}_addZone(e,t){const i=this._computeWhitespaceProps(t),s={whitespaceId:e.insertWhitespace(i.afterViewLineNumber,this._getZoneOrdinal(t),i.heightInPx,i.minWidthInPx),delegate:t,isInHiddenArea:i.isInHiddenArea,isVisible:!1,domNode:Ci(t.domNode),marginDomNode:t.marginDomNode?Ci(t.marginDomNode):null};return this._safeCallOnComputedHeight(s.delegate,i.heightInPx),s.domNode.setPosition("absolute"),s.domNode.domNode.style.width="100%",s.domNode.setDisplay("none"),s.domNode.setAttribute("monaco-view-zone",s.whitespaceId),this.domNode.appendChild(s.domNode),s.marginDomNode&&(s.marginDomNode.setPosition("absolute"),s.marginDomNode.domNode.style.width="100%",s.marginDomNode.setDisplay("none"),s.marginDomNode.setAttribute("monaco-view-zone",s.whitespaceId),this.marginDomNode.appendChild(s.marginDomNode)),this._zones[s.whitespaceId]=s,this.setShouldRender(),s.whitespaceId}_removeZone(e,t){if(this._zones.hasOwnProperty(t)){const i=this._zones[t];return delete this._zones[t],e.removeWhitespace(i.whitespaceId),i.domNode.removeAttribute("monaco-visible-view-zone"),i.domNode.removeAttribute("monaco-view-zone"),i.domNode.domNode.remove(),i.marginDomNode&&(i.marginDomNode.removeAttribute("monaco-visible-view-zone"),i.marginDomNode.removeAttribute("monaco-view-zone"),i.marginDomNode.domNode.remove()),this.setShouldRender(),!0}return!1}_layoutZone(e,t){if(this._zones.hasOwnProperty(t)){const i=this._zones[t],r=this._computeWhitespaceProps(i.delegate);return i.isInHiddenArea=r.isInHiddenArea,e.changeOneWhitespace(i.whitespaceId,r.afterViewLineNumber,r.heightInPx),this._safeCallOnComputedHeight(i.delegate,r.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(e){return this._zones.hasOwnProperty(e)?!!this._zones[e].delegate.suppressMouseDown:!1}_heightInPixels(e){return typeof e.heightInPx=="number"?e.heightInPx:typeof e.heightInLines=="number"?this._lineHeight*e.heightInLines:this._lineHeight}_minWidthInPixels(e){return typeof e.minWidthInPx=="number"?e.minWidthInPx:0}_safeCallOnComputedHeight(e,t){if(typeof e.onComputedHeight=="function")try{e.onComputedHeight(t)}catch(i){rn(i)}}_safeCallOnDomNodeTop(e,t){if(typeof e.onDomNodeTop=="function")try{e.onDomNodeTop(t)}catch(i){rn(i)}}prepareRender(e){}render(e){const t=e.viewportData.whitespaceViewportData,i={};let r=!1;for(const o of t)this._zones[o.id].isInHiddenArea||(i[o.id]=o,r=!0);const s=Object.keys(this._zones);for(let o=0,a=s.length;oa)continue;const f=h.startLineNumber===a?h.startColumn:c.minColumn,g=h.endLineNumber===a?h.endColumn:c.maxColumn;f=O.endOffset&&(I++,O=i&&i[I]),G!==9&&G!==32||h&&!k&&B<=D)continue;if(d&&B>=L&&B<=D&&G===32){const z=B-1>=0?a.charCodeAt(B-1):0,q=B+1=0?a.charCodeAt(B-1):0;if(G===32&&z!==32&&z!==9)continue}if(i&&(!O||O.startOffset>B||O.endOffset<=B))continue;const W=e.visibleRangeForPosition(new he(t,B+1));W&&(o?(M=Math.max(M,W.left),G===9?x+=this._renderArrow(f,m,W.left):x+=``):G===9?x+=`
${C?"→":"→"}
`:x+=`
${String.fromCharCode(y)}
`)}return o?(M=Math.round(M+m),``+x+""):x}_renderArrow(e,t,i){const r=t/7,s=t,o=e/2,a=i,l={x:0,y:r/2},c={x:100/125*s,y:l.y},u={x:c.x-.2*c.x,y:c.y+.2*c.x},d={x:u.x+.1*c.x,y:u.y+.1*c.x},h={x:d.x+.35*c.x,y:d.y-.35*c.x},f={x:h.x,y:-h.y},g={x:d.x,y:-d.y},p={x:u.x,y:-u.y},m={x:c.x,y:-c.y},_={x:l.x,y:-l.y};return``}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}class kwe{constructor(e){const t=e.options,i=t.get(50),r=t.get(38);r==="off"?(this.renderWhitespace="none",this.renderWithSVG=!1):r==="svg"?(this.renderWhitespace=t.get(100),this.renderWithSVG=!0):(this.renderWhitespace=t.get(100),this.renderWithSVG=!1),this.spaceWidth=i.spaceWidth,this.middotWidth=i.middotWidth,this.wsmiddotWidth=i.wsmiddotWidth,this.canUseHalfwidthRightwardsArrow=i.canUseHalfwidthRightwardsArrow,this.lineHeight=t.get(67),this.stopRenderingLineAfter=t.get(118)}equals(e){return this.renderWhitespace===e.renderWhitespace&&this.renderWithSVG===e.renderWithSVG&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter}}class mNt{constructor(e,t,i,r){this.selections=e,this.startLineNumber=t.startLineNumber|0,this.endLineNumber=t.endLineNumber|0,this.relativeVerticalOffset=t.relativeVerticalOffset,this.bigNumbersDelta=t.bigNumbersDelta|0,this.lineHeight=t.lineHeight|0,this.whitespaceViewportData=i,this._model=r,this.visibleRange=new $(t.startLineNumber,this._model.getLineMinColumn(t.startLineNumber),t.endLineNumber,this._model.getLineMaxColumn(t.endLineNumber))}getViewLineRenderingData(e){return this._model.getViewportViewLineRenderingData(this.visibleRange,e)}getDecorationsInViewport(){return this._model.getDecorationsInViewport(this.visibleRange)}}class _Nt{get type(){return this._theme.type}get value(){return this._theme}constructor(e){this._theme=e}update(e){this._theme=e}getColor(e){return this._theme.getColor(e)}}class vNt{constructor(e,t,i){this.configuration=e,this.theme=new _Nt(t),this.viewModel=i,this.viewLayout=i.viewLayout}addEventHandler(e){this.viewModel.addViewEventHandler(e)}removeEventHandler(e){this.viewModel.removeViewEventHandler(e)}}var bNt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},yNt=function(n,e){return function(t,i){e(t,i,n)}};let MJ=class extends _O{constructor(e,t,i,r,s,o,a){super(),this._instantiationService=a,this._shouldRecomputeGlyphMarginLanes=!1,this._selections=[new yt(1,1,1,1)],this._renderAnimationFrame=null;const l=new TAt(t,r,s,e);this._context=new vNt(t,i,r),this._context.addEventHandler(this),this._viewParts=[],this._textAreaHandler=this._instantiationService.createInstance(NJ,this._context,l,this._createTextAreaHandlerHelper()),this._viewParts.push(this._textAreaHandler),this._linesContent=Ci(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=Ci(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._overflowGuardContainer=Ci(document.createElement("div")),Ig.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._scrollbar=new BAt(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new Hce(this._context,this._linesContent),this._viewZones=new fNt(this._context),this._viewParts.push(this._viewZones);const c=new rNt(this._context);this._viewParts.push(c);const u=new lNt(this._context);this._viewParts.push(u);const d=new IAt(this._context);this._viewParts.push(d),d.addDynamicOverlay(new OAt(this._context)),d.addDynamicOverlay(new jo(this._context)),d.addDynamicOverlay(new jAt(this._context)),d.addDynamicOverlay(new FAt(this._context)),d.addDynamicOverlay(new pNt(this._context));const h=new AAt(this._context);this._viewParts.push(h),h.addDynamicOverlay(new MAt(this._context)),h.addDynamicOverlay(new ZAt(this._context)),h.addDynamicOverlay(new YAt(this._context)),h.addDynamicOverlay(new UW(this._context)),this._glyphMarginWidgets=new HAt(this._context),this._viewParts.push(this._glyphMarginWidgets);const f=new qN(this._context);f.getDomNode().appendChild(this._viewZones.marginDomNode),f.getDomNode().appendChild(h.getDomNode()),f.getDomNode().appendChild(this._glyphMarginWidgets.domNode),this._viewParts.push(f),this._contentWidgets=new RAt(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new g9(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new nNt(this._context,this.domNode),this._viewParts.push(this._overlayWidgets);const g=new aNt(this._context);this._viewParts.push(g);const p=new NAt(this._context);this._viewParts.push(p);const m=new tNt(this._context);if(this._viewParts.push(m),c){const _=this._scrollbar.getOverviewRulerLayoutInfo();_.parent.insertBefore(c.getDomNode(),_.insertBefore)}this._linesContent.appendChild(d.getDomNode()),this._linesContent.appendChild(g.domNode),this._linesContent.appendChild(this._viewZones.domNode),this._linesContent.appendChild(this._viewLines.getDomNode()),this._linesContent.appendChild(this._contentWidgets.domNode),this._linesContent.appendChild(this._viewCursors.getDomNode()),this._overflowGuardContainer.appendChild(f.getDomNode()),this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode()),this._overflowGuardContainer.appendChild(u.getDomNode()),this._overflowGuardContainer.appendChild(this._textAreaHandler.textArea),this._overflowGuardContainer.appendChild(this._textAreaHandler.textAreaCover),this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode()),this._overflowGuardContainer.appendChild(m.getDomNode()),this._overflowGuardContainer.appendChild(p.domNode),this.domNode.appendChild(this._overflowGuardContainer),o?(o.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode),o.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode)):(this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode),this.domNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode)),this._applyLayout(),this._pointerHandler=this._register(new ZIt(this._context,l,this._createPointerHandlerHelper()))}_computeGlyphMarginLanes(){const e=this._context.viewModel.model,t=this._context.viewModel.glyphLanes;let i=[],r=0;i=i.concat(e.getAllMarginDecorations().map(s=>{const o=s.options.glyphMargin?.position??af.Center;return r=Math.max(r,s.range.endLineNumber),{range:s.range,lane:o,persist:s.options.glyphMargin?.persistLane}})),i=i.concat(this._glyphMarginWidgets.getWidgets().map(s=>{const o=e.validateRange(s.preference.range);return r=Math.max(r,o.endLineNumber),{range:o,lane:s.preference.lane}})),i.sort((s,o)=>$.compareRangesUsingStarts(s.range,o.range)),t.reset(r);for(const s of i)t.push(s.lane,s.range,s.persist);return t}_createPointerHandlerHelper(){return{viewDomNode:this.domNode.domNode,linesContentDomNode:this._linesContent.domNode,viewLinesDomNode:this._viewLines.getDomNode().domNode,focusTextArea:()=>{this.focus()},dispatchTextAreaEvent:e=>{this._textAreaHandler.textArea.domNode.dispatchEvent(e)},getLastRenderData:()=>{const e=this._viewCursors.getLastRenderData()||[],t=this._textAreaHandler.getLastRenderData();return new BIt(e,t)},renderNow:()=>{this.render(!0,!1)},shouldSuppressMouseDownOnViewZone:e=>this._viewZones.shouldSuppressMouseDownOnViewZone(e),shouldSuppressMouseDownOnWidget:e=>this._contentWidgets.shouldSuppressMouseDownOnWidget(e),getPositionFromDOMInfo:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getPositionFromDOMInfo(e,t)),visibleRangeForPosition:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(new he(e,t))),getLineWidth:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getLineWidth(e))}}_createTextAreaHandlerHelper(){return{visibleRangeForPosition:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(e))}}_applyLayout(){const t=this._context.configuration.options.get(146);this.domNode.setWidth(t.width),this.domNode.setHeight(t.height),this._overflowGuardContainer.setWidth(t.width),this._overflowGuardContainer.setHeight(t.height),this._linesContent.setWidth(16777216),this._linesContent.setHeight(16777216)}_getEditorClassName(){const e=this._textAreaHandler.isFocused()?" focused":"";return this._context.configuration.options.get(143)+" "+OX(this._context.theme.type)+e}handleEvents(e){super.handleEvents(e),this._scheduleRender()}onConfigurationChanged(e){return this.domNode.setClassName(this._getEditorClassName()),this._applyLayout(),!1}onCursorStateChanged(e){return this._selections=e.selections,!1}onDecorationsChanged(e){return e.affectsGlyphMargin&&(this._shouldRecomputeGlyphMarginLanes=!0),!1}onFocusChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}onThemeChanged(e){return this._context.theme.update(e.theme),this.domNode.setClassName(this._getEditorClassName()),!1}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove(),this._context.removeEventHandler(this),this._viewLines.dispose();for(const e of this._viewParts)e.dispose();super.dispose()}_scheduleRender(){if(this._store.isDisposed)throw new fi;if(this._renderAnimationFrame===null){const e=this._createCoordinatedRendering();this._renderAnimationFrame=zce.INSTANCE.scheduleCoordinatedRendering({window:Ot(this.domNode?.domNode),prepareRenderText:()=>{if(this._store.isDisposed)throw new fi;try{return e.prepareRenderText()}finally{this._renderAnimationFrame=null}},renderText:()=>{if(this._store.isDisposed)throw new fi;return e.renderText()},prepareRender:(t,i)=>{if(this._store.isDisposed)throw new fi;return e.prepareRender(t,i)},render:(t,i)=>{if(this._store.isDisposed)throw new fi;return e.render(t,i)}})}}_flushAccumulatedAndRenderNow(){const e=this._createCoordinatedRendering();Fv(()=>e.prepareRenderText());const t=Fv(()=>e.renderText());if(t){const[i,r]=t;Fv(()=>e.prepareRender(i,r)),Fv(()=>e.render(i,r))}}_getViewPartsToRender(){const e=[];let t=0;for(const i of this._viewParts)i.shouldRender()&&(e[t++]=i);return e}_createCoordinatedRendering(){return{prepareRenderText:()=>{if(this._shouldRecomputeGlyphMarginLanes){this._shouldRecomputeGlyphMarginLanes=!1;const e=this._computeGlyphMarginLanes();this._context.configuration.setGlyphMarginDecorationLaneCount(e.requiredLanes)}Mv.onRenderStart()},renderText:()=>{if(!this.domNode.domNode.isConnected)return null;let e=this._getViewPartsToRender();if(!this._viewLines.shouldRender()&&e.length===0)return null;const t=this._context.viewLayout.getLinesViewportData();this._context.viewModel.setViewport(t.startLineNumber,t.endLineNumber,t.centeredLineNumber);const i=new mNt(this._selections,t,this._context.viewLayout.getWhitespaceViewportData(),this._context.viewModel);return this._contentWidgets.shouldRender()&&this._contentWidgets.onBeforeRender(i),this._viewLines.shouldRender()&&(this._viewLines.renderText(i),this._viewLines.onDidRender(),e=this._getViewPartsToRender()),[e,new AIt(this._context.viewLayout,i,this._viewLines)]},prepareRender:(e,t)=>{for(const i of e)i.prepareRender(t)},render:(e,t)=>{for(const i of e)i.render(t),i.onDidRender()}}}delegateVerticalScrollbarPointerDown(e){this._scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this._scrollbar.delegateScrollFromMouseWheelEvent(e)}restoreState(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft},1),this._context.viewModel.visibleLinesStabilized()}getOffsetForColumn(e,t){const i=this._context.viewModel.model.validatePosition({lineNumber:e,column:t}),r=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i);this._flushAccumulatedAndRenderNow();const s=this._viewLines.visibleRangeForPosition(new he(r.lineNumber,r.column));return s?s.left:-1}getTargetAtClientPoint(e,t){const i=this._pointerHandler.getTargetAtClientPoint(e,t);return i?GW.convertViewToModelMouseTarget(i,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new oNt(this._context,e)}change(e){this._viewZones.changeViewZones(e),this._scheduleRender()}render(e,t){if(t){this._viewLines.forceShouldRender();for(const i of this._viewParts)i.forceShouldRender()}e?this._flushAccumulatedAndRenderNow():this._scheduleRender()}writeScreenReaderContent(e){this._textAreaHandler.writeScreenReaderContent(e)}focus(){this._textAreaHandler.focusTextArea()}isFocused(){return this._textAreaHandler.isFocused()}setAriaOptions(e){this._textAreaHandler.setAriaOptions(e)}addContentWidget(e){this._contentWidgets.addWidget(e.widget),this.layoutContentWidget(e),this._scheduleRender()}layoutContentWidget(e){this._contentWidgets.setWidgetPosition(e.widget,e.position?.position??null,e.position?.secondaryPosition??null,e.position?.preference??null,e.position?.positionAffinity??null),this._scheduleRender()}removeContentWidget(e){this._contentWidgets.removeWidget(e.widget),this._scheduleRender()}addOverlayWidget(e){this._overlayWidgets.addWidget(e.widget),this.layoutOverlayWidget(e),this._scheduleRender()}layoutOverlayWidget(e){this._overlayWidgets.setWidgetPosition(e.widget,e.position)&&this._scheduleRender()}removeOverlayWidget(e){this._overlayWidgets.removeWidget(e.widget),this._scheduleRender()}addGlyphMarginWidget(e){this._glyphMarginWidgets.addWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}layoutGlyphMarginWidget(e){const t=e.position;this._glyphMarginWidgets.setWidgetPosition(e.widget,t)&&(this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender())}removeGlyphMarginWidget(e){this._glyphMarginWidgets.removeWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}};MJ=bNt([yNt(6,Tt)],MJ);function Fv(n){try{return n()}catch(e){return rn(e),null}}class zce{static{this.INSTANCE=new zce}constructor(){this._coordinatedRenderings=[],this._animationFrameRunners=new Map}scheduleCoordinatedRendering(e){return this._coordinatedRenderings.push(e),this._scheduleRender(e.window),{dispose:()=>{const t=this._coordinatedRenderings.indexOf(e);if(t!==-1&&(this._coordinatedRenderings.splice(t,1),this._coordinatedRenderings.length===0)){for(const[i,r]of this._animationFrameRunners)r.dispose();this._animationFrameRunners.clear()}}}}_scheduleRender(e){if(!this._animationFrameRunners.has(e)){const t=()=>{this._animationFrameRunners.delete(e),this._onRenderScheduled()};this._animationFrameRunners.set(e,K6(e,t,100))}}_onRenderScheduled(){const e=this._coordinatedRenderings.slice(0);this._coordinatedRenderings=[];for(const i of e)Fv(()=>i.prepareRenderText());const t=[];for(let i=0,r=e.length;is.renderText())}for(let i=0,r=e.length;is.prepareRender(a,l))}for(let i=0,r=e.length;is.render(a,l))}}}class MI{constructor(e,t,i,r,s){this.injectionOffsets=e,this.injectionOptions=t,this.breakOffsets=i,this.breakOffsetsVisibleColumn=r,this.wrappedTextIndentLength=s}getOutputLineCount(){return this.breakOffsets.length}getMinOutputOffset(e){return e>0?this.wrappedTextIndentLength:0}getLineLength(e){const t=e>0?this.breakOffsets[e-1]:0;let r=this.breakOffsets[e]-t;return e>0&&(r+=this.wrappedTextIndentLength),r}getMaxOutputOffset(e){return this.getLineLength(e)}translateToInputOffset(e,t){e>0&&(t=Math.max(0,t-this.wrappedTextIndentLength));let r=e===0?t:this.breakOffsets[e-1]+t;if(this.injectionOffsets!==null)for(let s=0;sthis.injectionOffsets[s];s++)r0?this.breakOffsets[s-1]:0,t===0)if(e<=o)r=s-1;else if(e>l)i=s+1;else break;else if(e=l)i=s+1;else break}let a=e-o;return s>0&&(a+=this.wrappedTextIndentLength),new t3(s,a)}normalizeOutputPosition(e,t,i){if(this.injectionOffsets!==null){const r=this.outputPositionToOffsetInInputWithInjections(e,t),s=this.normalizeOffsetInInputWithInjectionsAroundInjections(r,i);if(s!==r)return this.offsetInInputWithInjectionsToOutputPosition(s,i)}if(i===0){if(e>0&&t===this.getMinOutputOffset(e))return new t3(e-1,this.getMaxOutputOffset(e-1))}else if(i===1){const r=this.getOutputLineCount()-1;if(e0&&(t=Math.max(0,t-this.wrappedTextIndentLength)),(e>0?this.breakOffsets[e-1]:0)+t}normalizeOffsetInInputWithInjectionsAroundInjections(e,t){const i=this.getInjectedTextAtOffset(e);if(!i)return e;if(t===2){if(e===i.offsetInInputWithInjections+i.length&&Ewe(this.injectionOptions[i.injectedTextIndex].cursorStops))return i.offsetInInputWithInjections+i.length;{let r=i.offsetInInputWithInjections;if(Lwe(this.injectionOptions[i.injectedTextIndex].cursorStops))return r;let s=i.injectedTextIndex-1;for(;s>=0&&this.injectionOffsets[s]===this.injectionOffsets[i.injectedTextIndex]&&!(Ewe(this.injectionOptions[s].cursorStops)||(r-=this.injectionOptions[s].content.length,Lwe(this.injectionOptions[s].cursorStops)));)s--;return r}}else if(t===1||t===4){let r=i.offsetInInputWithInjections+i.length,s=i.injectedTextIndex;for(;s+1=0&&this.injectionOffsets[s-1]===this.injectionOffsets[s];)r-=this.injectionOptions[s-1].content.length,s--;return r}Z$()}getInjectedText(e,t){const i=this.outputPositionToOffsetInInputWithInjections(e,t),r=this.getInjectedTextAtOffset(i);return r?{options:this.injectionOptions[r.injectedTextIndex]}:null}getInjectedTextAtOffset(e){const t=this.injectionOffsets,i=this.injectionOptions;if(t!==null){let r=0;for(let s=0;se)break;if(e<=l)return{injectedTextIndex:s,offsetInInputWithInjections:a,length:o};r+=o}}}}function Ewe(n){return n==null?!0:n===Kh.Right||n===Kh.Both}function Lwe(n){return n==null?!0:n===Kh.Left||n===Kh.Both}class t3{constructor(e,t){this.outputLineIndex=e,this.outputOffset=t}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(e){return new he(e+this.outputLineIndex,this.outputOffset+1)}}const wNt=p0("domLineBreaksComputer",{createHTML:n=>n});class Uce{static create(e){return new Uce(new WeakRef(e))}constructor(e){this.targetWindow=e}createLineBreaksComputer(e,t,i,r,s){const o=[],a=[];return{addRequest:(l,c,u)=>{o.push(l),a.push(c)},finalize:()=>CNt(Lv(this.targetWindow.deref()),o,e,t,i,r,s,a)}}}function CNt(n,e,t,i,r,s,o,a){function l(I){const O=a[I];if(O){const M=Lg.applyInjectedText(e[I],O),B=O.map(W=>W.options),G=O.map(W=>W.column-1);return new MI(G,B,[M.length],[],0)}else return null}if(r===-1){const I=[];for(let O=0,M=e.length;Oc?(M=0,B=0):G=c-q}const W=O.substr(M),z=xNt(W,B,i,G,g,h);p[I]=M,m[I]=B,_[I]=W,v[I]=z[0],y[I]=z[1]}const C=g.build(),x=wNt?.createHTML(C)??C;f.innerHTML=x,f.style.position="absolute",f.style.top="10000",o==="keepAll"?(f.style.wordBreak="keep-all",f.style.overflowWrap="anywhere"):(f.style.wordBreak="inherit",f.style.overflowWrap="break-word"),n.document.body.appendChild(f);const k=document.createRange(),L=Array.prototype.slice.call(f.children,0),D=[];for(let I=0;Ij.options),ee=Z.map(j=>j.column-1)):(q=null,ee=null),D[I]=new MI(ee,q,M,z,G)}return f.remove(),D}function xNt(n,e,t,i,r,s){if(s!==0){const h=String(s);r.appendString('
');const o=n.length;let a=e,l=0;const c=[],u=[];let d=0");for(let h=0;h"),c[h]=l,u[h]=a;const f=d;d=h+1"),c[n.length]=l,u[n.length]=a,r.appendString("
"),[c,u]}function SNt(n,e,t,i){if(t.length<=1)return null;const r=Array.prototype.slice.call(e.children,0),s=[];try{FJ(n,r,i,0,null,t.length-1,null,s)}catch(o){return console.log(o),null}return s.length===0?null:(s.push(t.length),s)}function FJ(n,e,t,i,r,s,o,a){if(i===s||(r=r||Dq(n,e,t[i],t[i+1]),o=o||Dq(n,e,t[s],t[s+1]),Math.abs(r[0].top-o[0].top)<=.1))return;if(i+1===s){a.push(s);return}const l=i+(s-i)/2|0,c=Dq(n,e,t[l],t[l+1]);FJ(n,e,t,i,r,l,c,a),FJ(n,e,t,l,c,s,o,a)}function Dq(n,e,t,i){return n.setStart(e[t/16384|0].firstChild,t%16384),n.setEnd(e[i/16384|0].firstChild,i%16384),n.getClientRects()}class kNt extends me{constructor(){super(),this._editor=null,this._instantiationService=null,this._instances=this._register(new yae),this._pending=new Map,this._finishedInstantiation=[],this._finishedInstantiation[0]=!1,this._finishedInstantiation[1]=!1,this._finishedInstantiation[2]=!1,this._finishedInstantiation[3]=!1}initialize(e,t,i){this._editor=e,this._instantiationService=i;for(const r of t){if(this._pending.has(r.id)){rn(new Error(`Cannot have two contributions with the same id ${r.id}`));continue}this._pending.set(r.id,r)}this._instantiateSome(0),this._register(xD(Ot(this._editor.getDomNode()),()=>{this._instantiateSome(1)})),this._register(xD(Ot(this._editor.getDomNode()),()=>{this._instantiateSome(2)})),this._register(xD(Ot(this._editor.getDomNode()),()=>{this._instantiateSome(3)},5e3))}saveViewState(){const e={};for(const[t,i]of this._instances)typeof i.saveViewState=="function"&&(e[t]=i.saveViewState());return e}restoreViewState(e){for(const[t,i]of this._instances)typeof i.restoreViewState=="function"&&i.restoreViewState(e[t])}get(e){return this._instantiateById(e),this._instances.get(e)||null}onBeforeInteractionEvent(){this._instantiateSome(2)}onAfterModelAttached(){return xD(Ot(this._editor?.getDomNode()),()=>{this._instantiateSome(1)},50)}_instantiateSome(e){if(this._finishedInstantiation[e])return;this._finishedInstantiation[e]=!0;const t=this._findPendingContributionsByInstantiation(e);for(const i of t)this._instantiateById(i.id)}_findPendingContributionsByInstantiation(e){const t=[];for(const[,i]of this._pending)i.instantiation===e&&t.push(i);return t}_instantiateById(e){const t=this._pending.get(e);if(t){if(this._pending.delete(e),!this._instantiationService||!this._editor)throw new Error("Cannot instantiate contributions before being initialized!");try{const i=this._instantiationService.createInstance(t.ctor,this._editor);this._instances.set(t.id,i),typeof i.restoreViewState=="function"&&t.instantiation!==0&&console.warn(`Editor contribution '${t.id}' should be eager instantiated because it uses saveViewState / restoreViewState.`)}catch(i){rn(i)}}}}class b8e{constructor(e,t,i,r,s,o,a){this.id=e,this.label=t,this.alias=i,this.metadata=r,this._precondition=s,this._run=o,this._contextKeyService=a}isSupported(){return this._contextKeyService.contextMatchesRules(this._precondition)}run(e){return this.isSupported()?this._run(e):Promise.resolve(void 0)}}class jce{static create(e){return new jce(e.get(135),e.get(134))}constructor(e,t){this.classifier=new ENt(e,t)}createLineBreaksComputer(e,t,i,r,s){const o=[],a=[],l=[];return{addRequest:(c,u,d)=>{o.push(c),a.push(u),l.push(d)},finalize:()=>{const c=e.typicalFullwidthCharacterWidth/e.typicalHalfwidthCharacterWidth,u=[];for(let d=0,h=o.length;d=0&&e<256?this._asciiMap[e]:e>=12352&&e<=12543||e>=13312&&e<=19903||e>=19968&&e<=40959?3:this._map.get(e)||this._defaultValue}}let BJ=[],$J=[];function LNt(n,e,t,i,r,s,o,a){if(r===-1)return null;const l=t.length;if(l<=1)return null;const c=a==="keepAll",u=e.breakOffsets,d=e.breakOffsetsVisibleColumn,h=y8e(t,i,r,s,o),f=r-h,g=BJ,p=$J;let m=0,_=0,v=0,y=r;const C=u.length;let x=0;if(x>=0){let k=Math.abs(d[x]-y);for(;x+1=k)break;k=L,x++}}for(;xk&&(k=_,L=v);let D=0,I=0,O=0,M=0;if(L<=y){let G=L,W=k===0?0:t.charCodeAt(k-1),z=k===0?0:n.get(W),q=!0;for(let ee=k;ee_&&WJ(W,z,j,te,c)&&(D=Z,I=G),G+=le,G>y){Z>_?(O=Z,M=G-le):(O=ee+1,M=G),G-I>f&&(D=0),q=!1;break}W=j,z=te}if(q){m>0&&(g[m]=u[u.length-1],p[m]=d[u.length-1],m++);break}}if(D===0){let G=L,W=t.charCodeAt(k),z=n.get(W),q=!1;for(let ee=k-1;ee>=_;ee--){const Z=ee+1,j=t.charCodeAt(ee);if(j===9){q=!0;break}let te,le;if(Tw(j)?(ee--,te=0,le=2):(te=n.get(j),le=xb(j)?s:1),G<=y){if(O===0&&(O=Z,M=G),G<=y-f)break;if(WJ(j,te,W,z,c)){D=Z,I=G;break}}G-=le,W=j,z=te}if(D!==0){const ee=f-(M-I);if(ee<=i){const Z=t.charCodeAt(O);let j;Co(Z)?j=2:j=FI(Z,M,i,s),ee-j<0&&(D=0)}}if(q){x--;continue}}if(D===0&&(D=O,I=M),D<=_){const G=t.charCodeAt(_);Co(G)?(D=_+2,I=v+2):(D=_+1,I=v+FI(G,v,i,s))}for(_=D,g[m]=D,v=I,p[m]=I,m++,y=I+f;x<0||x=B)break;B=G,x++}}return m===0?null:(g.length=m,p.length=m,BJ=e.breakOffsets,$J=e.breakOffsetsVisibleColumn,e.breakOffsets=g,e.breakOffsetsVisibleColumn=p,e.wrappedTextIndentLength=h,e)}function TNt(n,e,t,i,r,s,o,a){const l=Lg.applyInjectedText(e,t);let c,u;if(t&&t.length>0?(c=t.map(I=>I.options),u=t.map(I=>I.column-1)):(c=null,u=null),r===-1)return c?new MI(u,c,[l.length],[],0):null;const d=l.length;if(d<=1)return c?new MI(u,c,[l.length],[],0):null;const h=a==="keepAll",f=y8e(l,i,r,s,o),g=r-f,p=[],m=[];let _=0,v=0,y=0,C=r,x=l.charCodeAt(0),k=n.get(x),L=FI(x,0,i,s),D=1;Co(x)&&(L+=1,x=l.charCodeAt(1),k=n.get(x),D++);for(let I=D;IC&&((v===0||L-y>g)&&(v=O,y=L-G),p[_]=v,m[_]=y,_++,C=y+g,v=0),x=M,k=B}return _===0&&(!t||t.length===0)?null:(p[_]=d,m[_]=L,new MI(u,c,p,m,f))}function FI(n,e,t,i){return n===9?t-e%t:xb(n)||n<32?i:1}function Twe(n,e){return e-n%e}function WJ(n,e,t,i,r){return t!==32&&(e===2&&i!==2||e!==1&&i===1||!r&&e===3&&i!==2||!r&&i===3&&e!==1)}function y8e(n,e,t,i,r){let s=0;if(r!==0){const o=yl(n);if(o!==-1){for(let l=0;lt&&(s=0)}}return s}let Dwe=class w8e{constructor(e){this._selTrackedRange=null,this._trackSelection=!0,this._setState(e,new Ko(new $(1,1,1,1),0,0,new he(1,1),0),new Ko(new $(1,1,1,1),0,0,new he(1,1),0))}dispose(e){this._removeTrackedRange(e)}startTrackingSelection(e){this._trackSelection=!0,this._updateTrackedRange(e)}stopTrackingSelection(e){this._trackSelection=!1,this._removeTrackedRange(e)}_updateTrackedRange(e){this._trackSelection&&(this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,this.modelState.selection,0))}_removeTrackedRange(e){this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,null,0)}asCursorState(){return new ri(this.modelState,this.viewState)}readSelectionFromMarkers(e){const t=e.model._getTrackedRange(this._selTrackedRange);return this.modelState.selection.isEmpty()&&!t.isEmpty()?yt.fromRange(t.collapseToEnd(),this.modelState.selection.getDirection()):yt.fromRange(t,this.modelState.selection.getDirection())}ensureValidState(e){this._setState(e,this.modelState,this.viewState)}setState(e,t,i){this._setState(e,t,i)}static _validatePositionWithCache(e,t,i,r){return t.equals(i)?r:e.normalizePosition(t,2)}static _validateViewState(e,t){const i=t.position,r=t.selectionStart.getStartPosition(),s=t.selectionStart.getEndPosition(),o=e.normalizePosition(i,2),a=this._validatePositionWithCache(e,r,i,o),l=this._validatePositionWithCache(e,s,r,a);return i.equals(o)&&r.equals(a)&&s.equals(l)?t:new Ko($.fromPositions(a,l),t.selectionStartKind,t.selectionStartLeftoverVisibleColumns+r.column-a.column,o,t.leftoverVisibleColumns+i.column-o.column)}_setState(e,t,i){if(i&&(i=w8e._validateViewState(e.viewModel,i)),t){const r=e.model.validateRange(t.selectionStart),s=t.selectionStart.equalsRange(r)?t.selectionStartLeftoverVisibleColumns:0,o=e.model.validatePosition(t.position),a=t.position.equals(o)?t.leftoverVisibleColumns:0;t=new Ko(r,t.selectionStartKind,s,o,a)}else{if(!i)return;const r=e.model.validateRange(e.coordinatesConverter.convertViewRangeToModelRange(i.selectionStart)),s=e.model.validatePosition(e.coordinatesConverter.convertViewPositionToModelPosition(i.position));t=new Ko(r,i.selectionStartKind,i.selectionStartLeftoverVisibleColumns,s,i.leftoverVisibleColumns)}if(i){const r=e.coordinatesConverter.validateViewRange(i.selectionStart,t.selectionStart),s=e.coordinatesConverter.validateViewPosition(i.position,t.position);i=new Ko(r,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,s,t.leftoverVisibleColumns)}else{const r=e.coordinatesConverter.convertModelPositionToViewPosition(new he(t.selectionStart.startLineNumber,t.selectionStart.startColumn)),s=e.coordinatesConverter.convertModelPositionToViewPosition(new he(t.selectionStart.endLineNumber,t.selectionStart.endColumn)),o=new $(r.lineNumber,r.column,s.lineNumber,s.column),a=e.coordinatesConverter.convertModelPositionToViewPosition(t.position);i=new Ko(o,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,a,t.leftoverVisibleColumns)}this.modelState=t,this.viewState=i,this._updateTrackedRange(e)}};class Iwe{constructor(e){this.context=e,this.cursors=[new Dwe(e)],this.lastAddedCursorIndex=0}dispose(){for(const e of this.cursors)e.dispose(this.context)}startTrackingSelections(){for(const e of this.cursors)e.startTrackingSelection(this.context)}stopTrackingSelections(){for(const e of this.cursors)e.stopTrackingSelection(this.context)}updateContext(e){this.context=e}ensureValidState(){for(const e of this.cursors)e.ensureValidState(this.context)}readSelectionFromMarkers(){return this.cursors.map(e=>e.readSelectionFromMarkers(this.context))}getAll(){return this.cursors.map(e=>e.asCursorState())}getViewPositions(){return this.cursors.map(e=>e.viewState.position)}getTopMostViewPosition(){return Obt(this.cursors,$l(e=>e.viewState.position,he.compare)).viewState.position}getBottomMostViewPosition(){return Pbt(this.cursors,$l(e=>e.viewState.position,he.compare)).viewState.position}getSelections(){return this.cursors.map(e=>e.modelState.selection)}getViewSelections(){return this.cursors.map(e=>e.viewState.selection)}setSelections(e){this.setStates(ri.fromModelSelections(e))}getPrimaryCursor(){return this.cursors[0].asCursorState()}setStates(e){e!==null&&(this.cursors[0].setState(this.context,e[0].modelState,e[0].viewState),this._setSecondaryStates(e.slice(1)))}_setSecondaryStates(e){const t=this.cursors.length-1,i=e.length;if(ti){const r=t-i;for(let s=0;s=e+1&&this.lastAddedCursorIndex--,this.cursors[e+1].dispose(this.context),this.cursors.splice(e+1,1)}normalize(){if(this.cursors.length===1)return;const e=this.cursors.slice(0),t=[];for(let i=0,r=e.length;ii.selection,$.compareRangesUsingStarts));for(let i=0;id&&p.index--;e.splice(d,1),t.splice(u,1),this._removeSecondaryCursor(d-1),i--}}}}class Awe{constructor(e,t,i,r){this._cursorContextBrand=void 0,this.model=e,this.viewModel=t,this.coordinatesConverter=i,this.cursorConfig=r}}class DNt{constructor(){this.type=0}}class INt{constructor(){this.type=1}}class ANt{constructor(e){this.type=2,this._source=e}hasChanged(e){return this._source.hasChanged(e)}}class NNt{constructor(e,t,i){this.selections=e,this.modelSelections=t,this.reason=i,this.type=3}}class R1{constructor(e){this.type=4,e?(this.affectsMinimap=e.affectsMinimap,this.affectsOverviewRuler=e.affectsOverviewRuler,this.affectsGlyphMargin=e.affectsGlyphMargin,this.affectsLineNumber=e.affectsLineNumber):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0,this.affectsGlyphMargin=!0,this.affectsLineNumber=!0)}}class n3{constructor(){this.type=5}}class RNt{constructor(e){this.type=6,this.isFocused=e}}class PNt{constructor(){this.type=7}}class i3{constructor(){this.type=8}}class C8e{constructor(e,t){this.fromLineNumber=e,this.count=t,this.type=9}}class HJ{constructor(e,t){this.type=10,this.fromLineNumber=e,this.toLineNumber=t}}class VJ{constructor(e,t){this.type=11,this.fromLineNumber=e,this.toLineNumber=t}}class BI{constructor(e,t,i,r,s,o,a){this.source=e,this.minimalReveal=t,this.range=i,this.selections=r,this.verticalType=s,this.revealHorizontal=o,this.scrollType=a,this.type=12}}class ONt{constructor(e){this.type=13,this.scrollWidth=e.scrollWidth,this.scrollLeft=e.scrollLeft,this.scrollHeight=e.scrollHeight,this.scrollTop=e.scrollTop,this.scrollWidthChanged=e.scrollWidthChanged,this.scrollLeftChanged=e.scrollLeftChanged,this.scrollHeightChanged=e.scrollHeightChanged,this.scrollTopChanged=e.scrollTopChanged}}class MNt{constructor(e){this.theme=e,this.type=14}}class FNt{constructor(e){this.type=15,this.ranges=e}}class BNt{constructor(){this.type=16}}let $Nt=class{constructor(){this.type=17}};class WNt extends me{constructor(){super(),this._onEvent=this._register(new fe),this.onEvent=this._onEvent.event,this._eventHandlers=[],this._viewEventQueue=null,this._isConsumingViewEventQueue=!1,this._collector=null,this._collectorCnt=0,this._outgoingEvents=[]}emitOutgoingEvent(e){this._addOutgoingEvent(e),this._emitOutgoingEvents()}_addOutgoingEvent(e){for(let t=0,i=this._outgoingEvents.length;t0;){if(this._collector||this._isConsumingViewEventQueue)return;const e=this._outgoingEvents.shift();e.isNoOp()||this._onEvent.fire(e)}}addViewEventHandler(e){for(let t=0,i=this._eventHandlers.length;t0&&this._emitMany(t)}this._emitOutgoingEvents()}emitSingleViewEvent(e){try{this.beginEmitViewEvents().emitViewEvent(e)}finally{this.endEmitViewEvents()}}_emitMany(e){this._viewEventQueue?this._viewEventQueue=this._viewEventQueue.concat(e):this._viewEventQueue=e,this._isConsumingViewEventQueue||this._consumeViewEventQueue()}_consumeViewEventQueue(){try{this._isConsumingViewEventQueue=!0,this._doConsumeQueue()}finally{this._isConsumingViewEventQueue=!1}}_doConsumeQueue(){for(;this._viewEventQueue;){const e=this._viewEventQueue;this._viewEventQueue=null;const t=this._eventHandlers.slice(0);for(const i of t)i.handleEvents(e)}}}class HNt{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(e){this.viewEvents.push(e)}emitOutgoingEvent(e){this.outgoingEvents.push(e)}}class qce{constructor(e,t,i,r){this.kind=0,this._oldContentWidth=e,this._oldContentHeight=t,this.contentWidth=i,this.contentHeight=r,this.contentWidthChanged=this._oldContentWidth!==this.contentWidth,this.contentHeightChanged=this._oldContentHeight!==this.contentHeight}isNoOp(){return!this.contentWidthChanged&&!this.contentHeightChanged}attemptToMerge(e){return e.kind!==this.kind?null:new qce(this._oldContentWidth,this._oldContentHeight,e.contentWidth,e.contentHeight)}}class Kce{constructor(e,t){this.kind=1,this.oldHasFocus=e,this.hasFocus=t}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(e){return e.kind!==this.kind?null:new Kce(this.oldHasFocus,e.hasFocus)}}class Gce{constructor(e,t,i,r,s,o,a,l){this.kind=2,this._oldScrollWidth=e,this._oldScrollLeft=t,this._oldScrollHeight=i,this._oldScrollTop=r,this.scrollWidth=s,this.scrollLeft=o,this.scrollHeight=a,this.scrollTop=l,this.scrollWidthChanged=this._oldScrollWidth!==this.scrollWidth,this.scrollLeftChanged=this._oldScrollLeft!==this.scrollLeft,this.scrollHeightChanged=this._oldScrollHeight!==this.scrollHeight,this.scrollTopChanged=this._oldScrollTop!==this.scrollTop}isNoOp(){return!this.scrollWidthChanged&&!this.scrollLeftChanged&&!this.scrollHeightChanged&&!this.scrollTopChanged}attemptToMerge(e){return e.kind!==this.kind?null:new Gce(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,e.scrollWidth,e.scrollLeft,e.scrollHeight,e.scrollTop)}}class VNt{constructor(){this.kind=3}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}}class zNt{constructor(){this.kind=4}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}}class p9{constructor(e,t,i,r,s,o,a){this.kind=6,this.oldSelections=e,this.selections=t,this.oldModelVersionId=i,this.modelVersionId=r,this.source=s,this.reason=o,this.reachedMaxCursorCount=a}static _selectionsAreEqual(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;const i=e.length,r=t.length;if(i!==r)return!1;for(let s=0;s0){const e=this._cursors.getSelections();for(let t=0;to&&(r=r.slice(0,o),s=!0);const a=$I.from(this._model,this);return this._cursors.setStates(r),this._cursors.normalize(),this._columnSelectData=null,this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,t,i,a,s)}setCursorColumnSelectData(e){this._columnSelectData=e}revealAll(e,t,i,r,s,o){const a=this._cursors.getViewPositions();let l=null,c=null;a.length>1?c=this._cursors.getViewSelections():l=$.fromPositions(a[0],a[0]),e.emitViewEvent(new BI(t,i,l,c,r,s,o))}revealPrimary(e,t,i,r,s,o){const l=[this._cursors.getPrimaryCursor().viewState.selection];e.emitViewEvent(new BI(t,i,null,l,r,s,o))}saveState(){const e=[],t=this._cursors.getSelections();for(let i=0,r=t.length;i0){const s=ri.fromModelSelections(i.resultingSelection);this.setStates(e,"modelChange",i.isUndoing?5:i.isRedoing?6:2,s)&&this.revealAll(e,"modelChange",!1,0,!0,0)}else{const s=this._cursors.readSelectionFromMarkers();this.setStates(e,"modelChange",2,ri.fromModelSelections(s))}}}getSelection(){return this._cursors.getPrimaryCursor().modelState.selection}getTopMostViewPosition(){return this._cursors.getTopMostViewPosition()}getBottomMostViewPosition(){return this._cursors.getBottomMostViewPosition()}getCursorColumnSelectData(){if(this._columnSelectData)return this._columnSelectData;const e=this._cursors.getPrimaryCursor(),t=e.viewState.selectionStart.getStartPosition(),i=e.viewState.position;return{isReal:!1,fromViewLineNumber:t.lineNumber,fromViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,t),toViewLineNumber:i.lineNumber,toViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,i)}}getSelections(){return this._cursors.getSelections()}setSelections(e,t,i,r){this.setStates(e,t,r,ri.fromModelSelections(i))}getPrevEditOperationType(){return this._prevEditOperationType}setPrevEditOperationType(e){this._prevEditOperationType=e}_pushAutoClosedAction(e,t){const i=[],r=[];for(let a=0,l=e.length;a0&&this._pushAutoClosedAction(i,r),this._prevEditOperationType=e.type}e.shouldPushStackElementAfter&&this._model.pushStackElement()}_interpretCommandResult(e){(!e||e.length===0)&&(e=this._cursors.readSelectionFromMarkers()),this._columnSelectData=null,this._cursors.setSelections(e),this._cursors.normalize()}_emitStateChangedIfNecessary(e,t,i,r,s){const o=$I.from(this._model,this);if(o.equals(r))return!1;const a=this._cursors.getSelections(),l=this._cursors.getViewSelections();if(e.emitViewEvent(new NNt(l,a,i)),!r||r.cursorState.length!==o.cursorState.length||o.cursorState.some((c,u)=>!c.modelState.equals(r.cursorState[u].modelState))){const c=r?r.cursorState.map(d=>d.modelState.selection):null,u=r?r.modelVersionId:0;e.emitOutgoingEvent(new p9(c,a,u,o.modelVersionId,t||"keyboard",i,s))}return!0}_findAutoClosingPairs(e){if(!e.length)return null;const t=[];for(let i=0,r=e.length;ithis._compositionType(i,u,s,o,a,l));return new Tc(4,c,{shouldPushStackElementBefore:KW(e,4),shouldPushStackElementAfter:!1})}static _compositionType(e,t,i,r,s,o){if(!t.isEmpty())return null;const a=t.getPosition(),l=Math.max(1,a.column-r),c=Math.min(e.getLineMaxColumn(a.lineNumber),a.column+s),u=new $(a.lineNumber,l,a.lineNumber,c);return e.getValueInRange(u)===i&&o===0?null:new d9(u,i,0,o)}}class CAt{static getEdits(e,t,i){const r=[];for(let o=0,a=t.length;o1){let a;for(a=i-1;a>=1;a--){const u=t.getLineContent(a);if(pg(u)>=0)break}if(a<1)return null;const l=t.getLineMaxColumn(a),c=xk(e.autoIndent,t,new $(a,l,a,l),e.languageConfigurationService);c&&(s=c.indentation+c.appendText)}return r&&(r===zs.Indent&&(s=Wce(e,s)),r===zs.Outdent&&(s=f9(e,s)),s=e.normalizeIndentation(s)),s||null}static _replaceJumpToNextIndent(e,t,i,r){let s="";const o=i.getStartPosition();if(e.insertSpaces){const a=e.visibleColumnFromColumn(t,o),l=e.indentSize,c=l-a%l;for(let u=0;u2?c.charCodeAt(l.column-2):0)===92&&d)return!1;if(n.autoClosingOvertype==="auto"){let f=!1;for(let g=0,p=i.length;g{const r=t.get(ai).getFocusedCodeEditor();return r&&r.hasTextFocus()?this._runEditorCommand(t,r,i):!1}),e.addImplementation(1e3,"generic-dom-input-textarea",(t,i)=>{const r=ka();return r&&["input","textarea"].indexOf(r.tagName.toLowerCase())>=0?(this.runDOMCommand(r),!0):!1}),e.addImplementation(0,"generic-dom",(t,i)=>{const r=t.get(ai).getActiveCodeEditor();return r?(r.focus(),this._runEditorCommand(t,r,i)):!1})}_runEditorCommand(e,t,i){const r=this.runEditorCommand(e,t,i);return r||!0}}var Io;(function(n){class e extends fs{constructor(v){super(v),this._inSelectionMode=v.inSelectionMode}runCoreEditorCommand(v,y){if(!y.position)return;v.model.pushStackElement(),v.setCursorStates(y.source,3,[qo.moveTo(v,v.getPrimaryCursorState(),this._inSelectionMode,y.position,y.viewPosition)])&&y.revealType!==2&&v.revealAllCursors(y.source,!0,!0)}}n.MoveTo=Je(new e({id:"_moveTo",inSelectionMode:!1,precondition:void 0})),n.MoveToSelect=Je(new e({id:"_moveToSelect",inSelectionMode:!0,precondition:void 0}));class t extends fs{runCoreEditorCommand(v,y){v.model.pushStackElement();const C=this._getColumnSelectResult(v,v.getPrimaryCursorState(),v.getCursorColumnSelectData(),y);C!==null&&(v.setCursorStates(y.source,3,C.viewStates.map(x=>ri.fromViewState(x))),v.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:C.fromLineNumber,fromViewVisualColumn:C.fromVisualColumn,toViewLineNumber:C.toLineNumber,toViewVisualColumn:C.toVisualColumn}),C.reversed?v.revealTopMostCursor(y.source):v.revealBottomMostCursor(y.source))}}n.ColumnSelect=Je(new class extends t{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(_,v,y,C){if(typeof C.position>"u"||typeof C.viewPosition>"u"||typeof C.mouseColumn>"u")return null;const x=_.model.validatePosition(C.position),k=_.coordinatesConverter.validateViewPosition(new he(C.viewPosition.lineNumber,C.viewPosition.column),x),L=C.doColumnSelect?y.fromViewLineNumber:k.lineNumber,D=C.doColumnSelect?y.fromViewVisualColumn:C.mouseColumn-1;return vy.columnSelect(_.cursorConfig,_,L,D,k.lineNumber,C.mouseColumn-1)}}),n.CursorColumnSelectLeft=Je(new class extends t{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(_,v,y,C){return vy.columnSelectLeft(_.cursorConfig,_,y)}}),n.CursorColumnSelectRight=Je(new class extends t{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(_,v,y,C){return vy.columnSelectRight(_.cursorConfig,_,y)}});class i extends t{constructor(v){super(v),this._isPaged=v.isPaged}_getColumnSelectResult(v,y,C,x){return vy.columnSelectUp(v.cursorConfig,v,C,this._isPaged)}}n.CursorColumnSelectUp=Je(new i({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3600,linux:{primary:0}}})),n.CursorColumnSelectPageUp=Je(new i({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3595,linux:{primary:0}}}));class r extends t{constructor(v){super(v),this._isPaged=v.isPaged}_getColumnSelectResult(v,y,C,x){return vy.columnSelectDown(v.cursorConfig,v,C,this._isPaged)}}n.CursorColumnSelectDown=Je(new r({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3602,linux:{primary:0}}})),n.CursorColumnSelectPageDown=Je(new r({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:3596,linux:{primary:0}}}));class s extends fs{constructor(){super({id:"cursorMove",precondition:void 0,metadata:h9.metadata})}runCoreEditorCommand(v,y){const C=h9.parse(y);C&&this._runCursorMove(v,y.source,C)}_runCursorMove(v,y,C){v.model.pushStackElement(),v.setCursorStates(y,3,s._move(v,v.getCursorStates(),C)),v.revealAllCursors(y,!0)}static _move(v,y,C){const x=C.select,k=C.value;switch(C.direction){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:return qo.simpleMove(v,y,C.direction,x,k,C.unit);case 11:case 13:case 12:case 14:return qo.viewportMove(v,y,C.direction,x,k);default:return null}}}n.CursorMoveImpl=s,n.CursorMove=Je(new s);class o extends fs{constructor(v){super(v),this._staticArgs=v.args}runCoreEditorCommand(v,y){let C=this._staticArgs;this._staticArgs.value===-1&&(C={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:y.pageSize||v.cursorConfig.pageSize}),v.model.pushStackElement(),v.setCursorStates(y.source,3,qo.simpleMove(v,v.getCursorStates(),C.direction,C.select,C.value,C.unit)),v.revealAllCursors(y.source,!0)}}n.CursorLeft=Je(new o({args:{direction:0,unit:0,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),n.CursorLeftSelect=Je(new o({args:{direction:0,unit:0,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1039}})),n.CursorRight=Je(new o({args:{direction:1,unit:0,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),n.CursorRightSelect=Je(new o({args:{direction:1,unit:0,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1041}})),n.CursorUp=Je(new o({args:{direction:2,unit:2,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),n.CursorUpSelect=Je(new o({args:{direction:2,unit:2,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),n.CursorPageUp=Je(new o({args:{direction:2,unit:2,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:11}})),n.CursorPageUpSelect=Je(new o({args:{direction:2,unit:2,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1035}})),n.CursorDown=Je(new o({args:{direction:3,unit:2,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),n.CursorDownSelect=Je(new o({args:{direction:3,unit:2,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),n.CursorPageDown=Je(new o({args:{direction:3,unit:2,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:12}})),n.CursorPageDownSelect=Je(new o({args:{direction:3,unit:2,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1036}})),n.CreateCursor=Je(new class extends fs{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(_,v){if(!v.position)return;let y;v.wholeLine?y=qo.line(_,_.getPrimaryCursorState(),!1,v.position,v.viewPosition):y=qo.moveTo(_,_.getPrimaryCursorState(),!1,v.position,v.viewPosition);const C=_.getCursorStates();if(C.length>1){const x=y.modelState?y.modelState.position:null,k=y.viewState?y.viewState.position:null;for(let L=0,D=C.length;Lk&&(x=k);const L=new $(x,1,x,_.model.getLineMaxColumn(x));let D=0;if(y.at)switch(y.at){case NS.RawAtArgument.Top:D=3;break;case NS.RawAtArgument.Center:D=1;break;case NS.RawAtArgument.Bottom:D=4;break}const I=_.coordinatesConverter.convertModelRangeToViewRange(L);_.revealRange(v.source,!1,I,D,0)}}),n.SelectAll=new class extends PJ{constructor(){super(pvt)}runDOMCommand(_){Xd&&(_.focus(),_.select()),_.ownerDocument.execCommand("selectAll")}runEditorCommand(_,v,y){const C=v._getViewModel();C&&this.runCoreEditorCommand(C,y)}runCoreEditorCommand(_,v){_.model.pushStackElement(),_.setCursorStates("keyboard",3,[qo.selectAll(_,_.getPrimaryCursorState())])}},n.SetSelection=Je(new class extends fs{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(_,v){v.selection&&(_.model.pushStackElement(),_.setCursorStates(v.source,3,[ri.fromModelSelection(v.selection)]))}})})(Io||(Io={}));const LAt=Le.and(Q.textInputFocus,Q.columnSelection);function d2(n,e){jl.registerKeybindingRule({id:n,primary:e,when:LAt,weight:_i+1})}d2(Io.CursorColumnSelectLeft.id,1039);d2(Io.CursorColumnSelectRight.id,1041);d2(Io.CursorColumnSelectUp.id,1040);d2(Io.CursorColumnSelectPageUp.id,1035);d2(Io.CursorColumnSelectDown.id,1042);d2(Io.CursorColumnSelectPageDown.id,1036);function gwe(n){return n.register(),n}var Sk;(function(n){class e extends fo{runEditorCommand(i,r,s){const o=r._getViewModel();o&&this.runCoreEditingCommand(r,o,s||{})}}n.CoreEditingCommand=e,n.LineBreakInsert=Je(new class extends e{constructor(){super({id:"lineBreakInsert",precondition:Q.writable,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(t,i,r){t.pushUndoStop(),t.executeCommands(this.id,qW.lineBreakInsert(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection)))}}),n.Outdent=Je(new class extends e{constructor(){super({id:"outdent",precondition:Q.writable,kbOpts:{weight:_i,kbExpr:Le.and(Q.editorTextFocus,Q.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(t,i,r){t.pushUndoStop(),t.executeCommands(this.id,bv.outdent(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection))),t.pushUndoStop()}}),n.Tab=Je(new class extends e{constructor(){super({id:"tab",precondition:Q.writable,kbOpts:{weight:_i,kbExpr:Le.and(Q.editorTextFocus,Q.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(t,i,r){t.pushUndoStop(),t.executeCommands(this.id,bv.tab(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection))),t.pushUndoStop()}}),n.DeleteLeft=Je(new class extends e{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(t,i,r){const[s,o]=Hw.deleteLeft(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection),i.getCursorAutoClosedCharacters());s&&t.pushUndoStop(),t.executeCommands(this.id,o),i.setPrevEditOperationType(2)}}),n.DeleteRight=Je(new class extends e{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:_i,kbExpr:Q.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(t,i,r){const[s,o]=Hw.deleteRight(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection));s&&t.pushUndoStop(),t.executeCommands(this.id,o),i.setPrevEditOperationType(3)}}),n.Undo=new class extends PJ{constructor(){super(T3e)}runDOMCommand(t){t.ownerDocument.execCommand("undo")}runEditorCommand(t,i,r){if(!(!i.hasModel()||i.getOption(92)===!0))return i.getModel().undo()}},n.Redo=new class extends PJ{constructor(){super(D3e)}runDOMCommand(t){t.ownerDocument.execCommand("redo")}runEditorCommand(t,i,r){if(!(!i.hasModel()||i.getOption(92)===!0))return i.getModel().redo()}}})(Sk||(Sk={}));class pwe extends X${constructor(e,t,i){super({id:e,precondition:void 0,metadata:i}),this._handlerId=t}runCommand(e,t){const i=e.get(ai).getFocusedCodeEditor();i&&i.trigger("keyboard",this._handlerId,t)}}function EC(n,e){gwe(new pwe("default:"+n,n)),gwe(new pwe(n,n,e))}EC("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]});EC("replacePreviousChar");EC("compositionType");EC("compositionStart");EC("compositionEnd");EC("paste");EC("cut");class TAt{constructor(e,t,i,r){this.configuration=e,this.viewModel=t,this.userInputEvents=i,this.commandDelegate=r}paste(e,t,i,r){this.commandDelegate.paste(e,t,i,r)}type(e){this.commandDelegate.type(e)}compositionType(e,t,i,r){this.commandDelegate.compositionType(e,t,i,r)}compositionStart(){this.commandDelegate.startComposition()}compositionEnd(){this.commandDelegate.endComposition()}cut(){this.commandDelegate.cut()}setSelection(e){Io.SetSelection.runCoreEditorCommand(this.viewModel,{source:"keyboard",selection:e})}_validateViewColumn(e){const t=this.viewModel.getLineMinColumn(e.lineNumber);return e.column=4?this._selectAll():e.mouseDownCount===3?this._hasMulticursorModifier(e)?e.inSelectionMode?this._lastCursorLineSelectDrag(e.position,e.revealType):this._lastCursorLineSelect(e.position,e.revealType):e.inSelectionMode?this._lineSelectDrag(e.position,e.revealType):this._lineSelect(e.position,e.revealType):e.mouseDownCount===2?e.onInjectedText||(this._hasMulticursorModifier(e)?this._lastCursorWordSelect(e.position,e.revealType):e.inSelectionMode?this._wordSelectDrag(e.position,e.revealType):this._wordSelect(e.position,e.revealType)):this._hasMulticursorModifier(e)?this._hasNonMulticursorModifier(e)||(e.shiftKey?this._columnSelect(e.position,e.mouseColumn,!0):e.inSelectionMode?this._lastCursorMoveToSelect(e.position,e.revealType):this._createCursor(e.position,!1)):e.inSelectionMode?e.altKey?this._columnSelect(e.position,e.mouseColumn,!0):r?this._columnSelect(e.position,e.mouseColumn,!0):this._moveToSelect(e.position,e.revealType):this.moveTo(e.position,e.revealType)}_usualArgs(e,t){return e=this._validateViewColumn(e),{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,revealType:t}}moveTo(e,t){Io.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_moveToSelect(e,t){Io.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_columnSelect(e,t,i){e=this._validateViewColumn(e),Io.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,mouseColumn:t,doColumnSelect:i})}_createCursor(e,t){e=this._validateViewColumn(e),Io.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,wholeLine:t})}_lastCursorMoveToSelect(e,t){Io.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_wordSelect(e,t){Io.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_wordSelectDrag(e,t){Io.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorWordSelect(e,t){Io.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lineSelect(e,t){Io.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lineSelectDrag(e,t){Io.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorLineSelect(e,t){Io.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorLineSelectDrag(e,t){Io.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_selectAll(){Io.SelectAll.runCoreEditorCommand(this.viewModel,{source:"mouse"})}_convertViewToModelPosition(e){return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(e)}emitKeyDown(e){this.userInputEvents.emitKeyDown(e)}emitKeyUp(e){this.userInputEvents.emitKeyUp(e)}emitContextMenu(e){this.userInputEvents.emitContextMenu(e)}emitMouseMove(e){this.userInputEvents.emitMouseMove(e)}emitMouseLeave(e){this.userInputEvents.emitMouseLeave(e)}emitMouseUp(e){this.userInputEvents.emitMouseUp(e)}emitMouseDown(e){this.userInputEvents.emitMouseDown(e)}emitMouseDrag(e){this.userInputEvents.emitMouseDrag(e)}emitMouseDrop(e){this.userInputEvents.emitMouseDrop(e)}emitMouseDropCanceled(){this.userInputEvents.emitMouseDropCanceled()}emitMouseWheel(e){this.userInputEvents.emitMouseWheel(e)}}class h8e{constructor(e){this._lineFactory=e,this._set(1,[])}flush(){this._set(1,[])}_set(e,t){this._lines=t,this._rendLineNumberStart=e}_get(){return{rendLineNumberStart:this._rendLineNumberStart,lines:this._lines}}getStartLineNumber(){return this._rendLineNumberStart}getEndLineNumber(){return this._rendLineNumberStart+this._lines.length-1}getCount(){return this._lines.length}getLine(e){const t=e-this._rendLineNumberStart;if(t<0||t>=this._lines.length)throw new fi("Illegal value for lineNumber");return this._lines[t]}onLinesDeleted(e,t){if(this.getCount()===0)return null;const i=this.getStartLineNumber(),r=this.getEndLineNumber();if(tr)return null;let s=0,o=0;for(let l=i;l<=r;l++){const c=l-this._rendLineNumberStart;e<=l&&l<=t&&(o===0?(s=c,o=1):o++)}if(e=r&&a<=s&&(this._lines[a-this._rendLineNumberStart].onContentChanged(),o=!0);return o}onLinesInserted(e,t){if(this.getCount()===0)return null;const i=t-e+1,r=this.getStartLineNumber(),s=this.getEndLineNumber();if(e<=r)return this._rendLineNumberStart+=i,null;if(e>s)return null;if(i+e>s)return this._lines.splice(e-this._rendLineNumberStart,s-e+1);const o=[];for(let d=0;di)continue;const l=Math.max(t,a.fromLineNumber),c=Math.min(i,a.toLineNumber);for(let u=l;u<=c;u++){const d=u-this._rendLineNumberStart;this._lines[d].onTokensChanged(),r=!0}}return r}}class f8e{constructor(e){this._lineFactory=e,this.domNode=this._createDomNode(),this._linesCollection=new h8e(this._lineFactory)}_createDomNode(){const e=Ci(document.createElement("div"));return e.setClassName("view-layer"),e.setPosition("absolute"),e.domNode.setAttribute("role","presentation"),e.domNode.setAttribute("aria-hidden","true"),e}onConfigurationChanged(e){return!!e.hasChanged(146)}onFlushed(e){return this._linesCollection.flush(),!0}onLinesChanged(e){return this._linesCollection.onLinesChanged(e.fromLineNumber,e.count)}onLinesDeleted(e){const t=this._linesCollection.onLinesDeleted(e.fromLineNumber,e.toLineNumber);if(t)for(let i=0,r=t.length;ie})}constructor(e,t,i){this._domNode=e,this._lineFactory=t,this._viewportData=i}render(e,t,i,r){const s={rendLineNumberStart:e.rendLineNumberStart,lines:e.lines.slice(0),linesLength:e.linesLength};if(s.rendLineNumberStart+s.linesLength-1t){const o=t,a=Math.min(i,s.rendLineNumberStart-1);o<=a&&(this._insertLinesBefore(s,o,a,r,t),s.linesLength+=a-o+1)}else if(s.rendLineNumberStart0&&(this._removeLinesBefore(s,o),s.linesLength-=o)}if(s.rendLineNumberStart=t,s.rendLineNumberStart+s.linesLength-1i){const o=Math.max(0,i-s.rendLineNumberStart+1),l=s.linesLength-1-o+1;l>0&&(this._removeLinesAfter(s,l),s.linesLength-=l)}return this._finishRendering(s,!1,r),s}_renderUntouchedLines(e,t,i,r,s){const o=e.rendLineNumberStart,a=e.lines;for(let l=t;l<=i;l++){const c=o+l;a[l].layoutLine(c,r[c-s],this._viewportData.lineHeight)}}_insertLinesBefore(e,t,i,r,s){const o=[];let a=0;for(let l=t;l<=i;l++)o[a++]=this._lineFactory.createLine();e.lines=o.concat(e.lines)}_removeLinesBefore(e,t){for(let i=0;i=0;a--){const l=e.lines[a];r[a]&&(l.setDomNode(o),o=o.previousSibling)}}_finishRenderingInvalidLines(e,t,i){const r=document.createElement("div");by._ttPolicy&&(t=by._ttPolicy.createHTML(t)),r.innerHTML=t;for(let s=0;snew DAt(this._dynamicOverlays)}),this.domNode=this._visibleLines.domNode;const i=this._context.configuration.options.get(50);ta(this.domNode,i),this.domNode.setClassName("view-overlays")}shouldRender(){if(super.shouldRender())return!0;for(let e=0,t=this._dynamicOverlays.length;ei.shouldRender());for(let i=0,r=t.length;i'),s.appendString(o),s.appendString(""),!0)}layoutLine(e,t,i){this._domNode&&(this._domNode.setTop(t),this._domNode.setHeight(i))}}class IAt extends g8e{constructor(e){super(e);const i=this._context.configuration.options.get(146);this._contentWidth=i.contentWidth,this.domNode.setHeight(0)}onConfigurationChanged(e){const i=this._context.configuration.options.get(146);return this._contentWidth=i.contentWidth,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollWidthChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e),this.domNode.setWidth(Math.max(e.scrollWidth,this._contentWidth))}}class AAt extends g8e{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(146);this._contentLeft=i.contentLeft,this.domNode.setClassName("margin-view-overlays"),this.domNode.setWidth(1),ta(this.domNode,t.get(50))}onConfigurationChanged(e){const t=this._context.configuration.options;ta(this.domNode,t.get(50));const i=t.get(146);return this._contentLeft=i.contentLeft,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollHeightChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e);const t=Math.min(e.scrollHeight,1e6);this.domNode.setHeight(t),this.domNode.setWidth(this._contentLeft)}}class GW{constructor(e){this.onKeyDown=null,this.onKeyUp=null,this.onContextMenu=null,this.onMouseMove=null,this.onMouseLeave=null,this.onMouseDown=null,this.onMouseUp=null,this.onMouseDrag=null,this.onMouseDrop=null,this.onMouseDropCanceled=null,this.onMouseWheel=null,this._coordinatesConverter=e}emitKeyDown(e){this.onKeyDown?.(e)}emitKeyUp(e){this.onKeyUp?.(e)}emitContextMenu(e){this.onContextMenu?.(this._convertViewToModelMouseEvent(e))}emitMouseMove(e){this.onMouseMove?.(this._convertViewToModelMouseEvent(e))}emitMouseLeave(e){this.onMouseLeave?.(this._convertViewToModelMouseEvent(e))}emitMouseDown(e){this.onMouseDown?.(this._convertViewToModelMouseEvent(e))}emitMouseUp(e){this.onMouseUp?.(this._convertViewToModelMouseEvent(e))}emitMouseDrag(e){this.onMouseDrag?.(this._convertViewToModelMouseEvent(e))}emitMouseDrop(e){this.onMouseDrop?.(this._convertViewToModelMouseEvent(e))}emitMouseDropCanceled(){this.onMouseDropCanceled?.()}emitMouseWheel(e){this.onMouseWheel?.(e)}_convertViewToModelMouseEvent(e){return e.target?{event:e.event,target:this._convertViewToModelMouseTarget(e.target)}:e}_convertViewToModelMouseTarget(e){return GW.convertViewToModelMouseTarget(e,this._coordinatesConverter)}static convertViewToModelMouseTarget(e,t){const i={...e};return i.position&&(i.position=t.convertViewPositionToModelPosition(i.position)),i.range&&(i.range=t.convertViewRangeToModelRange(i.range)),(i.type===5||i.type===8)&&(i.detail=this.convertViewToModelViewZoneData(i.detail,t)),i}static convertViewToModelViewZoneData(e,t){return{viewZoneId:e.viewZoneId,positionBefore:e.positionBefore?t.convertViewPositionToModelPosition(e.positionBefore):e.positionBefore,positionAfter:e.positionAfter?t.convertViewPositionToModelPosition(e.positionAfter):e.positionAfter,position:t.convertViewPositionToModelPosition(e.position),afterLineNumber:t.convertViewPositionToModelPosition(new he(e.afterLineNumber,1)).lineNumber}}}class NAt extends bu{constructor(e){super(e),this.blocks=[],this.contentWidth=-1,this.contentLeft=0,this.domNode=Ci(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("blockDecorations-container"),this.update()}update(){let e=!1;const i=this._context.configuration.options.get(146),r=i.contentWidth-i.verticalScrollbarWidth;this.contentWidth!==r&&(this.contentWidth=r,e=!0);const s=i.contentLeft;return this.contentLeft!==s&&(this.contentLeft=s,e=!0),e}dispose(){super.dispose()}onConfigurationChanged(e){return this.update()}onScrollChanged(e){return e.scrollTopChanged||e.scrollLeftChanged}onDecorationsChanged(e){return!0}onZonesChanged(e){return!0}prepareRender(e){}render(e){let t=0;const i=e.getDecorationsInViewport();for(const r of i){if(!r.options.blockClassName)continue;let s=this.blocks[t];s||(s=this.blocks[t]=Ci(document.createElement("div")),this.domNode.appendChild(s));let o,a;r.options.blockIsAfterEnd?(o=e.getVerticalOffsetAfterLineNumber(r.range.endLineNumber,!1),a=e.getVerticalOffsetAfterLineNumber(r.range.endLineNumber,!0)):(o=e.getVerticalOffsetForLineNumber(r.range.startLineNumber,!0),a=r.range.isEmpty()&&!r.options.blockDoesNotCollapse?e.getVerticalOffsetForLineNumber(r.range.startLineNumber,!1):e.getVerticalOffsetAfterLineNumber(r.range.endLineNumber,!0));const[l,c,u,d]=r.options.blockPadding??[0,0,0,0];s.setClassName("blockDecorations-block "+r.options.blockClassName),s.setLeft(this.contentLeft-d),s.setWidth(this.contentWidth+d+c),s.setTop(o-e.scrollTop-l),s.setHeight(a-o+l+u),t++}for(let r=t;r0?this.domNode.setDisplay("block"):this.domNode.setDisplay("none"),this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1}_layoutBoxInViewport(e,t,i,r){const s=e.top,o=s,a=e.top+e.height,l=r.viewportHeight-a,c=s-i,u=o>=i,d=a,h=l>=i;let f=e.left;return f+t>r.scrollLeft+r.viewportWidth&&(f=r.scrollLeft+r.viewportWidth-t),fl){const h=d-(l-r);d-=h,i-=h}if(d=p,v=d+i<=h.height-m;return this._fixedOverflowWidgets?{fitsAbove:_,aboveTop:Math.max(u,p),fitsBelow:v,belowTop:d,left:g}:{fitsAbove:_,aboveTop:s,fitsBelow:v,belowTop:o,left:f}}_prepareRenderWidgetAtExactPositionOverflowing(e){return new WT(e.top,e.left+this._contentLeft)}_getAnchorsCoordinates(e){const t=s(this._primaryAnchor.viewPosition,this._affinity,this._lineHeight),i=this._secondaryAnchor.viewPosition?.lineNumber===this._primaryAnchor.viewPosition?.lineNumber?this._secondaryAnchor.viewPosition:null,r=s(i,this._affinity,this._lineHeight);return{primary:t,secondary:r};function s(o,a,l){if(!o)return null;const c=e.visibleRangeForPosition(o);if(!c)return null;const u=o.column===1&&a===3?0:c.left,d=e.getVerticalOffsetForLineNumber(o.lineNumber)-e.scrollTop;return new mwe(d,u,l)}}_reduceAnchorCoordinates(e,t,i){if(!t)return e;const r=this._context.configuration.options.get(50);let s=t.left;return se.endLineNumber||this.domNode.setMaxWidth(this._maxWidth)}prepareRender(e){this._renderData=this._prepareRenderWidget(e)}render(e){if(!this._renderData||this._renderData.kind==="offViewport"){this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this._renderData?.kind==="offViewport"&&this._renderData.preserveFocus?this.domNode.setTop(-1e3):this.domNode.setVisibility("hidden")),typeof this._actual.afterRender=="function"&&Eq(this._actual.afterRender,this._actual,null);return}this.allowEditorOverflow?(this.domNode.setTop(this._renderData.coordinate.top),this.domNode.setLeft(this._renderData.coordinate.left)):(this.domNode.setTop(this._renderData.coordinate.top+e.scrollTop-e.bigNumbersDelta),this.domNode.setLeft(this._renderData.coordinate.left)),this._isVisible||(this.domNode.setVisibility("inherit"),this.domNode.setAttribute("monaco-visible-content-widget","true"),this._isVisible=!0),typeof this._actual.afterRender=="function"&&Eq(this._actual.afterRender,this._actual,this._renderData.position)}}class $T{constructor(e,t){this.modelPosition=e,this.viewPosition=t}}class WT{constructor(e,t){this.top=e,this.left=t,this._coordinateBrand=void 0}}class mwe{constructor(e,t,i){this.top=e,this.left=t,this.height=i,this._anchorCoordinateBrand=void 0}}function Eq(n,e,...t){try{return n.call(e,...t)}catch{return null}}class p8e extends kC{constructor(e){super(),this._context=e;const t=this._context.configuration.options,i=t.get(146);this._renderLineHighlight=t.get(97),this._renderLineHighlightOnlyWhenFocus=t.get(98),this._wordWrap=i.isViewportWrapping,this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._selectionIsEmpty=!0,this._focused=!1,this._cursorLineNumbers=[1],this._selections=[new yt(1,1,1,1)],this._renderData=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}_readFromSelections(){let e=!1;const t=new Set;for(const s of this._selections)t.add(s.positionLineNumber);const i=Array.from(t);i.sort((s,o)=>s-o),$r(this._cursorLineNumbers,i)||(this._cursorLineNumbers=i,e=!0);const r=this._selections.every(s=>s.isEmpty());return this._selectionIsEmpty!==r&&(this._selectionIsEmpty=r,e=!0),e}onThemeChanged(e){return this._readFromSelections()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(146);return this._renderLineHighlight=t.get(97),this._renderLineHighlightOnlyWhenFocus=t.get(98),this._wordWrap=i.isViewportWrapping,this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,!0}onCursorStateChanged(e){return this._selections=e.selections,this._readFromSelections()}onFlushed(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollWidthChanged||e.scrollTopChanged}onZonesChanged(e){return!0}onFocusChanged(e){return this._renderLineHighlightOnlyWhenFocus?(this._focused=e.isFocused,!0):!1}prepareRender(e){if(!this._shouldRenderThis()){this._renderData=null;return}const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,r=[];for(let o=t;o<=i;o++){const a=o-t;r[a]=""}if(this._wordWrap){const o=this._renderOne(e,!1);for(const a of this._cursorLineNumbers){const l=this._context.viewModel.coordinatesConverter,c=l.convertViewPositionToModelPosition(new he(a,1)).lineNumber,u=l.convertModelPositionToViewPosition(new he(c,1)).lineNumber,d=l.convertModelPositionToViewPosition(new he(c,this._context.viewModel.model.getLineMaxColumn(c))).lineNumber,h=Math.max(u,t),f=Math.min(d,i);for(let g=h;g<=f;g++){const p=g-t;r[p]=o}}}const s=this._renderOne(e,!0);for(const o of this._cursorLineNumbers){if(oi)continue;const a=o-t;r[a]=s}this._renderData=r}render(e,t){if(!this._renderData)return"";const i=t-e;return i>=this._renderData.length?"":this._renderData[i]}_shouldRenderInMargin(){return(this._renderLineHighlight==="gutter"||this._renderLineHighlight==="all")&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderInContent(){return(this._renderLineHighlight==="line"||this._renderLineHighlight==="all")&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}}class OAt extends p8e{_renderOne(e,t){return`
`}_shouldRenderThis(){return this._shouldRenderInContent()}_shouldRenderOther(){return this._shouldRenderInMargin()}}class MAt extends p8e{_renderOne(e,t){return`
`}_shouldRenderThis(){return!0}_shouldRenderOther(){return this._shouldRenderInContent()}}dh((n,e)=>{const t=n.getColor(EFe);if(t&&(e.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${t}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${t}; border: none; }`)),!t||t.isTransparent()||n.defines(iye)){const i=n.getColor(iye);i&&(e.addRule(`.monaco-editor .view-overlays .current-line-exact { border: 2px solid ${i}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-exact-margin { border: 2px solid ${i}; }`),mg(n.type)&&(e.addRule(".monaco-editor .view-overlays .current-line-exact { border-width: 1px; }"),e.addRule(".monaco-editor .margin-view-overlays .current-line-exact-margin { border-width: 1px; }")))}});class FAt extends kC{constructor(e){super(),this._context=e;const t=this._context.configuration.options;this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged||e.scrollWidthChanged}onZonesChanged(e){return!0}prepareRender(e){const t=e.getDecorationsInViewport();let i=[],r=0;for(let l=0,c=t.length;l{if(l.options.zIndexc.options.zIndex)return 1;const u=l.options.className,d=c.options.className;return ud?1:$.compareRangesUsingStarts(l.range,c.range)});const s=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber,a=[];for(let l=s;l<=o;l++){const c=l-s;a[c]=""}this._renderWholeLineDecorations(e,i,a),this._renderNormalDecorations(e,i,a),this._renderResult=a}_renderWholeLineDecorations(e,t,i){const r=e.visibleRange.startLineNumber,s=e.visibleRange.endLineNumber;for(let o=0,a=t.length;o',u=Math.max(l.range.startLineNumber,r),d=Math.min(l.range.endLineNumber,s);for(let h=u;h<=d;h++){const f=h-r;i[f]+=c}}}_renderNormalDecorations(e,t,i){const r=e.visibleRange.startLineNumber;let s=null,o=!1,a=null,l=!1;for(let c=0,u=t.length;c';a[h]+=_}}}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}class BAt extends bu{constructor(e,t,i,r){super(e);const s=this._context.configuration.options,o=s.get(104),a=s.get(75),l=s.get(40),c=s.get(107),u={listenOnDomNode:i.domNode,className:"editor-scrollable "+OX(e.theme.type),useShadows:!1,lazyRender:!0,vertical:o.vertical,horizontal:o.horizontal,verticalHasArrows:o.verticalHasArrows,horizontalHasArrows:o.horizontalHasArrows,verticalScrollbarSize:o.verticalScrollbarSize,verticalSliderSize:o.verticalSliderSize,horizontalScrollbarSize:o.horizontalScrollbarSize,horizontalSliderSize:o.horizontalSliderSize,handleMouseWheel:o.handleMouseWheel,alwaysConsumeMouseWheel:o.alwaysConsumeMouseWheel,arrowSize:o.arrowSize,mouseWheelScrollSensitivity:a,fastScrollSensitivity:l,scrollPredominantAxis:c,scrollByPage:o.scrollByPage};this.scrollbar=this._register(new fW(t.domNode,u,this._context.viewLayout.getScrollable())),Ig.write(this.scrollbar.getDomNode(),6),this.scrollbarDomNode=Ci(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();const d=(h,f,g)=>{const p={};{const m=h.scrollTop;m&&(p.scrollTop=this._context.viewLayout.getCurrentScrollTop()+m,h.scrollTop=0)}if(g){const m=h.scrollLeft;m&&(p.scrollLeft=this._context.viewLayout.getCurrentScrollLeft()+m,h.scrollLeft=0)}this._context.viewModel.viewLayout.setScrollPosition(p,1)};this._register(Ce(i.domNode,"scroll",h=>d(i.domNode,!0,!0))),this._register(Ce(t.domNode,"scroll",h=>d(t.domNode,!0,!1))),this._register(Ce(r.domNode,"scroll",h=>d(r.domNode,!0,!1))),this._register(Ce(this.scrollbarDomNode.domNode,"scroll",h=>d(this.scrollbarDomNode.domNode,!0,!1)))}dispose(){super.dispose()}_setLayout(){const e=this._context.configuration.options,t=e.get(146);this.scrollbarDomNode.setLeft(t.contentLeft),e.get(73).side==="right"?this.scrollbarDomNode.setWidth(t.contentWidth+t.minimap.minimapWidth):this.scrollbarDomNode.setWidth(t.contentWidth),this.scrollbarDomNode.setHeight(t.height)}getOverviewRulerLayoutInfo(){return this.scrollbar.getOverviewRulerLayoutInfo()}getDomNode(){return this.scrollbarDomNode}delegateVerticalScrollbarPointerDown(e){this.scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this.scrollbar.delegateScrollFromMouseWheelEvent(e)}onConfigurationChanged(e){if(e.hasChanged(104)||e.hasChanged(75)||e.hasChanged(40)){const t=this._context.configuration.options,i=t.get(104),r=t.get(75),s=t.get(40),o=t.get(107),a={vertical:i.vertical,horizontal:i.horizontal,verticalScrollbarSize:i.verticalScrollbarSize,horizontalScrollbarSize:i.horizontalScrollbarSize,scrollByPage:i.scrollByPage,handleMouseWheel:i.handleMouseWheel,mouseWheelScrollSensitivity:r,fastScrollSensitivity:s,scrollPredominantAxis:o};this.scrollbar.updateOptions(a)}return e.hasChanged(146)&&this._setLayout(),!0}onScrollChanged(e){return!0}onThemeChanged(e){return this.scrollbar.updateClassName("editor-scrollable "+OX(this._context.theme.type)),!0}prepareRender(e){}render(e){this.scrollbar.renderNow()}}class OJ{constructor(e,t,i,r,s){this.startLineNumber=e,this.endLineNumber=t,this.className=i,this.tooltip=r,this._decorationToRenderBrand=void 0,this.zIndex=s??0}}class $At{constructor(e,t,i){this.className=e,this.zIndex=t,this.tooltip=i}}class WAt{constructor(){this.decorations=[]}add(e){this.decorations.push(e)}getDecorations(){return this.decorations}}class m8e extends kC{_render(e,t,i){const r=[];for(let a=e;a<=t;a++){const l=a-e;r[l]=new WAt}if(i.length===0)return r;i.sort((a,l)=>a.className===l.className?a.startLineNumber===l.startLineNumber?a.endLineNumber-l.endLineNumber:a.startLineNumber-l.startLineNumber:a.classNamer)continue;const c=Math.max(a,i),u=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new he(c,0)),d=this._context.viewModel.glyphLanes.getLanesAtLine(u.lineNumber).indexOf(s.preference.lane);t.push(new zAt(c,d,s.preference.zIndex,s))}}_collectSortedGlyphRenderRequests(e){const t=[];return this._collectDecorationBasedGlyphRenderRequest(e,t),this._collectWidgetBasedGlyphRenderRequest(e,t),t.sort((i,r)=>i.lineNumber===r.lineNumber?i.laneIndex===r.laneIndex?i.zIndex===r.zIndex?r.type===i.type?i.type===0&&r.type===0?i.className0;){const r=t.peek();if(!r)break;const s=t.takeWhile(a=>a.lineNumber===r.lineNumber&&a.laneIndex===r.laneIndex);if(!s||s.length===0)break;const o=s[0];if(o.type===0){const a=[];for(const l of s){if(l.zIndex!==o.zIndex||l.type!==o.type)break;(a.length===0||a[a.length-1]!==l.className)&&a.push(l.className)}i.push(o.accept(a.join(" ")))}else o.widget.renderInfo={lineNumber:o.lineNumber,laneIndex:o.laneIndex}}this._decorationGlyphsToRender=i}render(e){if(!this._glyphMargin){for(const i of Object.values(this._widgets))i.domNode.setDisplay("none");for(;this._managedDomNodes.length>0;)this._managedDomNodes.pop()?.domNode.remove();return}const t=Math.round(this._glyphMarginWidth/this._glyphMarginDecorationLaneCount);for(const i of Object.values(this._widgets))if(!i.renderInfo)i.domNode.setDisplay("none");else{const r=e.viewportData.relativeVerticalOffset[i.renderInfo.lineNumber-e.viewportData.startLineNumber],s=this._glyphMarginLeft+i.renderInfo.laneIndex*this._lineHeight;i.domNode.setDisplay("block"),i.domNode.setTop(r),i.domNode.setLeft(s),i.domNode.setWidth(t),i.domNode.setHeight(this._lineHeight)}for(let i=0;ithis._decorationGlyphsToRender.length;)this._managedDomNodes.pop()?.domNode.remove()}}class VAt{constructor(e,t,i,r){this.lineNumber=e,this.laneIndex=t,this.zIndex=i,this.className=r,this.type=0}accept(e){return new UAt(this.lineNumber,this.laneIndex,e)}}class zAt{constructor(e,t,i,r){this.lineNumber=e,this.laneIndex=t,this.zIndex=i,this.widget=r,this.type=1}}class UAt{constructor(e,t,i){this.lineNumber=e,this.laneIndex=t,this.combinedClassName=i}}class jAt extends kC{constructor(e){super(),this._context=e,this._primaryPosition=null;const t=this._context.configuration.options,i=t.get(147),r=t.get(50);this._spaceWidth=r.spaceWidth,this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*r.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(16),this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(147),r=t.get(50);return this._spaceWidth=r.spaceWidth,this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*r.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(16),!0}onCursorStateChanged(e){const i=e.selections[0].getPosition();return this._primaryPosition?.equals(i)?!1:(this._primaryPosition=i,!0)}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onLanguageConfigurationChanged(e){return!0}prepareRender(e){if(!this._bracketPairGuideOptions.indentation&&this._bracketPairGuideOptions.bracketPairs===!1){this._renderResult=null;return}const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,r=e.scrollWidth,s=this._primaryPosition,o=this.getGuidesByLine(t,Math.min(i+1,this._context.viewModel.getLineCount()),s),a=[];for(let l=t;l<=i;l++){const c=l-t,u=o[c];let d="";const h=e.visibleRangeForPosition(new he(l,1))?.left??0;for(const f of u){const g=f.column===-1?h+(f.visibleColumn-1)*this._spaceWidth:e.visibleRangeForPosition(new he(l,f.column)).left;if(g>r||this._maxIndentLeft>0&&g>this._maxIndentLeft)break;const p=f.horizontalLine?f.horizontalLine.top?"horizontal-top":"horizontal-bottom":"vertical",m=f.horizontalLine?(e.visibleRangeForPosition(new he(l,f.horizontalLine.endColumn))?.left??g+this._spaceWidth)-g:this._spaceWidth;d+=`
`}a[c]=d}this._renderResult=a}getGuidesByLine(e,t,i){const r=this._bracketPairGuideOptions.bracketPairs!==!1?this._context.viewModel.getBracketGuidesInRangeByLine(e,t,i,{highlightActive:this._bracketPairGuideOptions.highlightActiveBracketPair,horizontalGuides:this._bracketPairGuideOptions.bracketPairsHorizontal===!0?Qy.Enabled:this._bracketPairGuideOptions.bracketPairsHorizontal==="active"?Qy.EnabledForActive:Qy.Disabled,includeInactive:this._bracketPairGuideOptions.bracketPairs===!0}):null,s=this._bracketPairGuideOptions.indentation?this._context.viewModel.getLinesIndentGuides(e,t):null;let o=0,a=0,l=0;if(this._bracketPairGuideOptions.highlightActiveIndentation!==!1&&i){const d=this._context.viewModel.getActiveIndentGuide(i.lineNumber,e,t);o=d.startLineNumber,a=d.endLineNumber,l=d.indent}const{indentSize:c}=this._context.viewModel.model.getOptions(),u=[];for(let d=e;d<=t;d++){const h=new Array;u.push(h);const f=r?r[d-e]:[],g=new q_(f),p=s?s[d-e]:0;for(let m=1;m<=p;m++){const _=(m-1)*c+1,v=(this._bracketPairGuideOptions.highlightActiveIndentation==="always"||f.length===0)&&o<=d&&d<=a&&m===l;h.push(...g.takeWhile(C=>C.visibleColumn<_)||[]);const y=g.peek();(!y||y.visibleColumn!==_||y.horizontalLine)&&h.push(new Ny(_,-1,`core-guide-indent lvl-${(m-1)%30}`+(v?" indent-active":""),null,-1,-1))}h.push(...g.takeWhile(m=>!0)||[])}return u}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}function vx(n){if(!(n&&n.isTransparent()))return n}dh((n,e)=>{const t=[{bracketColor:IFe,guideColor:aEt,guideColorActive:fEt},{bracketColor:AFe,guideColor:lEt,guideColorActive:gEt},{bracketColor:NFe,guideColor:cEt,guideColorActive:pEt},{bracketColor:RFe,guideColor:uEt,guideColorActive:mEt},{bracketColor:PFe,guideColor:dEt,guideColorActive:_Et},{bracketColor:OFe,guideColor:hEt,guideColorActive:vEt}],i=new qFe,r=[{indentColor:hO,indentColorActive:fO},{indentColor:Wkt,indentColorActive:jkt},{indentColor:Hkt,indentColorActive:qkt},{indentColor:Vkt,indentColorActive:Kkt},{indentColor:zkt,indentColorActive:Gkt},{indentColor:Ukt,indentColorActive:Ykt}],s=t.map(a=>{const l=n.getColor(a.bracketColor),c=n.getColor(a.guideColor),u=n.getColor(a.guideColorActive),d=vx(vx(c)??l?.transparent(.3)),h=vx(vx(u)??l);if(!(!d||!h))return{guideColor:d,guideColorActive:h}}).filter(Bp),o=r.map(a=>{const l=n.getColor(a.indentColor),c=n.getColor(a.indentColorActive),u=vx(l),d=vx(c);if(!(!u||!d))return{indentColor:u,indentColorActive:d}}).filter(Bp);if(s.length>0){for(let a=0;a<30;a++){const l=s[a%s.length];e.addRule(`.monaco-editor .${i.getInlineClassNameOfLevel(a).replace(/ /g,".")} { --guide-color: ${l.guideColor}; --guide-color-active: ${l.guideColorActive}; }`)}e.addRule(".monaco-editor .vertical { box-shadow: 1px 0 0 0 var(--guide-color) inset; }"),e.addRule(".monaco-editor .horizontal-top { border-top: 1px solid var(--guide-color); }"),e.addRule(".monaco-editor .horizontal-bottom { border-bottom: 1px solid var(--guide-color); }"),e.addRule(`.monaco-editor .vertical.${i.activeClassName} { box-shadow: 1px 0 0 0 var(--guide-color-active) inset; }`),e.addRule(`.monaco-editor .horizontal-top.${i.activeClassName} { border-top: 1px solid var(--guide-color-active); }`),e.addRule(`.monaco-editor .horizontal-bottom.${i.activeClassName} { border-bottom: 1px solid var(--guide-color-active); }`)}if(o.length>0){for(let a=0;a<30;a++){const l=o[a%o.length];e.addRule(`.monaco-editor .lines-content .core-guide-indent.lvl-${a} { --indent-color: ${l.indentColor}; --indent-color-active: ${l.indentColorActive}; }`)}e.addRule(".monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 var(--indent-color) inset; }"),e.addRule(".monaco-editor .lines-content .core-guide-indent.indent-active { box-shadow: 1px 0 0 0 var(--indent-color-active) inset; }")}});class Lq{get didDomLayout(){return this._didDomLayout}readClientRect(){if(!this._clientRectRead){this._clientRectRead=!0;const e=this._domNode.getBoundingClientRect();this.markDidDomLayout(),this._clientRectDeltaLeft=e.left,this._clientRectScale=e.width/this._domNode.offsetWidth}}get clientRectDeltaLeft(){return this._clientRectRead||this.readClientRect(),this._clientRectDeltaLeft}get clientRectScale(){return this._clientRectRead||this.readClientRect(),this._clientRectScale}constructor(e,t){this._domNode=e,this.endNode=t,this._didDomLayout=!1,this._clientRectDeltaLeft=0,this._clientRectScale=1,this._clientRectRead=!1}markDidDomLayout(){this._didDomLayout=!0}}class qAt{constructor(){this._currentVisibleRange=new $(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(e){this._currentVisibleRange=e}}class KAt{constructor(e,t,i,r,s,o,a){this.minimalReveal=e,this.lineNumber=t,this.startColumn=i,this.endColumn=r,this.startScrollTop=s,this.stopScrollTop=o,this.scrollType=a,this.type="range",this.minLineNumber=t,this.maxLineNumber=t}}class GAt{constructor(e,t,i,r,s){this.minimalReveal=e,this.selections=t,this.startScrollTop=i,this.stopScrollTop=r,this.scrollType=s,this.type="selections";let o=t[0].startLineNumber,a=t[0].endLineNumber;for(let l=1,c=t.length;lnew l_(this._viewLineOptions)}),this.domNode=this._visibleLines.domNode,Ig.write(this.domNode,8),this.domNode.setClassName(`view-lines ${Ck}`),ta(this.domNode,s),this._maxLineWidth=0,this._asyncUpdateLineWidths=new Ui(()=>{this._updateLineWidthsSlow()},200),this._asyncCheckMonospaceFontAssumptions=new Ui(()=>{this._checkMonospaceFontAssumptions()},2e3),this._lastRenderedData=new qAt,this._horizontalRevealRequest=null,this._stickyScrollEnabled=r.get(116).enabled,this._maxNumberStickyLines=r.get(116).maxLineCount}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e),e.hasChanged(147)&&(this._maxLineWidth=0);const t=this._context.configuration.options,i=t.get(50),r=t.get(147);return this._lineHeight=t.get(67),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._isViewportWrapping=r.isViewportWrapping,this._revealHorizontalRightPadding=t.get(101),this._cursorSurroundingLines=t.get(29),this._cursorSurroundingLinesStyle=t.get(30),this._canUseLayerHinting=!t.get(32),this._stickyScrollEnabled=t.get(116).enabled,this._maxNumberStickyLines=t.get(116).maxLineCount,ta(this.domNode,i),this._onOptionsMaybeChanged(),e.hasChanged(146)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){const e=this._context.configuration,t=new lwe(e,this._context.theme.type);if(!this._viewLineOptions.equals(t)){this._viewLineOptions=t;const i=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();for(let s=i;s<=r;s++)this._visibleLines.getVisibleLine(s).onOptionsChanged(this._viewLineOptions);return!0}return!1}onCursorStateChanged(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();let r=!1;for(let s=t;s<=i;s++)r=this._visibleLines.getVisibleLine(s).onSelectionChanged()||r;return r}onDecorationsChanged(e){{const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let r=t;r<=i;r++)this._visibleLines.getVisibleLine(r).onDecorationsChanged()}return!0}onFlushed(e){const t=this._visibleLines.onFlushed(e);return this._maxLineWidth=0,t}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onRevealRangeRequest(e){const t=this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(),e.source,e.minimalReveal,e.range,e.selections,e.verticalType);if(t===-1)return!1;let i=this._context.viewLayout.validateScrollPosition({scrollTop:t});e.revealHorizontal?e.range&&e.range.startLineNumber!==e.range.endLineNumber?i={scrollTop:i.scrollTop,scrollLeft:0}:e.range?this._horizontalRevealRequest=new KAt(e.minimalReveal,e.range.startLineNumber,e.range.startColumn,e.range.endColumn,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType):e.selections&&e.selections.length>0&&(this._horizontalRevealRequest=new GAt(e.minimalReveal,e.selections,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType)):this._horizontalRevealRequest=null;const s=Math.abs(this._context.viewLayout.getCurrentScrollTop()-i.scrollTop)<=this._lineHeight?1:e.scrollType;return this._context.viewModel.viewLayout.setScrollPosition(i,s),!0}onScrollChanged(e){if(this._horizontalRevealRequest&&e.scrollLeftChanged&&(this._horizontalRevealRequest=null),this._horizontalRevealRequest&&e.scrollTopChanged){const t=Math.min(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop),i=Math.max(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop);(e.scrollTopi)&&(this._horizontalRevealRequest=null)}return this.domNode.setWidth(e.scrollWidth),this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth),this._visibleLines.onZonesChanged(e)}onThemeChanged(e){return this._onOptionsMaybeChanged()}getPositionFromDOMInfo(e,t){const i=this._getViewLineDomNode(e);if(i===null)return null;const r=this._getLineNumberFor(i);if(r===-1||r<1||r>this._context.viewModel.getLineCount())return null;if(this._context.viewModel.getLineMaxColumn(r)===1)return new he(r,1);const s=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();if(ro)return null;let a=this._visibleLines.getVisibleLine(r).getColumnOfNodeOffset(e,t);const l=this._context.viewModel.getLineMinColumn(r);return ai)return-1;const r=new Lq(this.domNode.domNode,this._textRangeRestingSpot),s=this._visibleLines.getVisibleLine(e).getWidth(r);return this._updateLineWidthsSlowIfDomDidLayout(r),s}linesVisibleRangesForRange(e,t){if(this.shouldRender())return null;const i=e.endLineNumber,r=$.intersectRanges(e,this._lastRenderedData.getCurrentVisibleRange());if(!r)return null;const s=[];let o=0;const a=new Lq(this.domNode.domNode,this._textRangeRestingSpot);let l=0;t&&(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new he(r.startLineNumber,1)).lineNumber);const c=this._visibleLines.getStartLineNumber(),u=this._visibleLines.getEndLineNumber();for(let d=r.startLineNumber;d<=r.endLineNumber;d++){if(du)continue;const h=d===r.startLineNumber?r.startColumn:1,f=d!==r.endLineNumber,g=f?this._context.viewModel.getLineMaxColumn(d):r.endColumn,p=this._visibleLines.getVisibleLine(d).getVisibleRangesForRange(d,h,g,a);if(p){if(t&&dthis._visibleLines.getEndLineNumber())return null;const r=new Lq(this.domNode.domNode,this._textRangeRestingSpot),s=this._visibleLines.getVisibleLine(e).getVisibleRangesForRange(e,t,i,r);return this._updateLineWidthsSlowIfDomDidLayout(r),s}visibleRangeForPosition(e){const t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new RIt(t.outsideRenderedLine,t.ranges[0].left):null}_updateLineWidthsFast(){return this._updateLineWidths(!0)}_updateLineWidthsSlow(){this._updateLineWidths(!1)}_updateLineWidthsSlowIfDomDidLayout(e){e.didDomLayout&&(this._asyncUpdateLineWidths.isScheduled()||(this._asyncUpdateLineWidths.cancel(),this._updateLineWidthsSlow()))}_updateLineWidths(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();let r=1,s=!0;for(let o=t;o<=i;o++){const a=this._visibleLines.getVisibleLine(o);if(e&&!a.getWidthIsFast()){s=!1;continue}r=Math.max(r,a.getWidth(null))}return s&&t===1&&i===this._context.viewModel.getLineCount()&&(this._maxLineWidth=0),this._ensureMaxLineWidth(r),s}_checkMonospaceFontAssumptions(){let e=-1,t=-1;const i=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();for(let s=i;s<=r;s++){const o=this._visibleLines.getVisibleLine(s);if(o.needsMonospaceFontCheck()){const a=o.getWidth(null);a>t&&(t=a,e=s)}}if(e!==-1&&!this._visibleLines.getVisibleLine(e).monospaceAssumptionsAreValid())for(let s=i;s<=r;s++)this._visibleLines.getVisibleLine(s).onMonospaceAssumptionsInvalidated()}prepareRender(){throw new Error("Not supported")}render(){throw new Error("Not supported")}renderText(e){if(this._visibleLines.renderLines(e),this._lastRenderedData.setCurrentVisibleRange(e.visibleRange),this.domNode.setWidth(this._context.viewLayout.getScrollWidth()),this.domNode.setHeight(Math.min(this._context.viewLayout.getScrollHeight(),1e6)),this._horizontalRevealRequest){const i=this._horizontalRevealRequest;if(e.startLineNumber<=i.minLineNumber&&i.maxLineNumber<=e.endLineNumber){this._horizontalRevealRequest=null,this.onDidRender();const r=this._computeScrollLeftToReveal(i);r&&(this._isViewportWrapping||this._ensureMaxLineWidth(r.maxHorizontalOffset),this._context.viewModel.viewLayout.setScrollPosition({scrollLeft:r.scrollLeft},i.scrollType))}}if(this._updateLineWidthsFast()?this._asyncUpdateLineWidths.cancel():this._asyncUpdateLineWidths.schedule(),zl&&!this._asyncCheckMonospaceFontAssumptions.isScheduled()){const i=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();for(let s=i;s<=r;s++)if(this._visibleLines.getVisibleLine(s).needsMonospaceFontCheck()){this._asyncCheckMonospaceFontAssumptions.schedule();break}}this._linesContent.setLayerHinting(this._canUseLayerHinting),this._linesContent.setContain("strict");const t=this._context.viewLayout.getCurrentScrollTop()-e.bigNumbersDelta;this._linesContent.setTop(-t),this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft())}_ensureMaxLineWidth(e){const t=Math.ceil(e);this._maxLineWidth0){let _=s[0].startLineNumber,v=s[0].endLineNumber;for(let y=1,C=s.length;yl){if(!u)return-1;m=d}else if(o===5||o===6)if(o===6&&a<=d&&h<=c)m=a;else{const _=Math.max(5*this._lineHeight,l*.2),v=d-_,y=h-l;m=Math.max(y,v)}else if(o===1||o===2)if(o===2&&a<=d&&h<=c)m=a;else{const _=(d+h)/2;m=Math.max(0,_-l/2)}else m=this._computeMinimumScrolling(a,c,d,h,o===3,o===4);return m}_computeScrollLeftToReveal(e){const t=this._context.viewLayout.getCurrentViewport(),i=this._context.configuration.options.get(146),r=t.left,s=r+t.width-i.verticalScrollbarWidth;let o=1073741824,a=0;if(e.type==="range"){const c=this._visibleRangesForLineRange(e.lineNumber,e.startColumn,e.endColumn);if(!c)return null;for(const u of c.ranges)o=Math.min(o,Math.round(u.left)),a=Math.max(a,Math.round(u.left+u.width))}else for(const c of e.selections){if(c.startLineNumber!==c.endLineNumber)return null;const u=this._visibleRangesForLineRange(c.startLineNumber,c.startColumn,c.endColumn);if(!u)return null;for(const d of u.ranges)o=Math.min(o,Math.round(d.left)),a=Math.max(a,Math.round(d.left+d.width))}return e.minimalReveal||(o=Math.max(0,o-Hce.HORIZONTAL_EXTRA_PX),a+=this._revealHorizontalRightPadding),e.type==="selections"&&a-o>t.width?null:{scrollLeft:this._computeMinimumScrolling(r,s,o,a),maxHorizontalOffset:a}}_computeMinimumScrolling(e,t,i,r,s,o){e=e|0,t=t|0,i=i|0,r=r|0,s=!!s,o=!!o;const a=t-e;if(r-it)return Math.max(0,r-a)}else return i;return e}}class YAt extends m8e{constructor(e){super(),this._context=e;const i=this._context.configuration.options.get(146);this._decorationsLeft=i.decorationsLeft,this._decorationsWidth=i.decorationsWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const i=this._context.configuration.options.get(146);return this._decorationsLeft=i.decorationsLeft,this._decorationsWidth=i.decorationsWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getDecorations(e){const t=e.getDecorationsInViewport(),i=[];let r=0;for(let s=0,o=t.length;s',l=[];for(let c=t;c<=i;c++){const u=c-t,d=r[u].getDecorations();let h="";for(const f of d){let g='
';s[a]=c}this._renderResult=s}render(e,t){return this._renderResult?this._renderResult[t-e]:""}}class Fd{static{this.Empty=new Fd(0,0,0,0)}constructor(e,t,i,r){this._rgba8Brand=void 0,this.r=Fd._clamp(e),this.g=Fd._clamp(t),this.b=Fd._clamp(i),this.a=Fd._clamp(r)}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}static _clamp(e){return e<0?0:e>255?255:e|0}}class YW extends me{static{this._INSTANCE=null}static getInstance(){return this._INSTANCE||(this._INSTANCE=new YW),this._INSTANCE}constructor(){super(),this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._updateColorMap(),this._register(rs.onDidChange(e=>{e.changedColorMap&&this._updateColorMap()}))}_updateColorMap(){const e=rs.getColorMap();if(!e){this._colors=[Fd.Empty],this._backgroundIsLight=!0;return}this._colors=[Fd.Empty];for(let i=1;i=.5,this._onDidChange.fire(void 0)}getColor(e){return(e<1||e>=this._colors.length)&&(e=2),this._colors[e]}backgroundIsLight(){return this._backgroundIsLight}}const XAt=(()=>{const n=[];for(let e=32;e<=126;e++)n.push(e);return n.push(65533),n})(),QAt=(n,e)=>(n-=32,n<0||n>96?e<=2?(n+96)%96:95:n);class GN{constructor(e,t){this.scale=t,this._minimapCharRendererBrand=void 0,this.charDataNormal=GN.soften(e,12/15),this.charDataLight=GN.soften(e,50/60)}static soften(e,t){const i=new Uint8ClampedArray(e.length);for(let r=0,s=e.length;re.width||i+g>e.height){console.warn("bad render request outside image data");return}const p=u?this.charDataLight:this.charDataNormal,m=QAt(r,c),_=e.width*4,v=a.r,y=a.g,C=a.b,x=s.r-v,k=s.g-y,L=s.b-C,D=Math.max(o,l),I=e.data;let O=m*h*f,M=i*_+t*4;for(let B=0;Be.width||i+d>e.height){console.warn("bad render request outside image data");return}const h=e.width*4,f=.5*(s/255),g=o.r,p=o.g,m=o.b,_=r.r-g,v=r.g-p,y=r.b-m,C=g+_*f,x=p+v*f,k=m+y*f,L=Math.max(s,a),D=e.data;let I=i*h+t*4;for(let O=0;O{const e=new Uint8ClampedArray(n.length/2);for(let t=0;t>1]=_we[n[t]]<<4|_we[n[t+1]]&15;return e},bwe={1:wb(()=>vwe("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:wb(()=>vwe("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))};class PI{static create(e,t){if(this.lastCreated&&e===this.lastCreated.scale&&t===this.lastFontFamily)return this.lastCreated;let i;return bwe[e]?i=new GN(bwe[e](),e):i=PI.createFromSampleData(PI.createSampleData(t).data,e),this.lastFontFamily=t,this.lastCreated=i,i}static createSampleData(e){const t=document.createElement("canvas"),i=t.getContext("2d");t.style.height="16px",t.height=16,t.width=96*10,t.style.width=96*10+"px",i.fillStyle="#ffffff",i.font=`bold 16px ${e}`,i.textBaseline="middle";let r=0;for(const s of XAt)i.fillText(String.fromCharCode(s),r,16/2),r+=10;return i.getImageData(0,0,96*10,16)}static createFromSampleData(e,t){if(e.length!==61440)throw new Error("Unexpected source in MinimapCharRenderer");const r=PI._downsample(e,t);return new GN(r,t)}static _downsampleChar(e,t,i,r,s){const o=1*s,a=2*s;let l=r,c=0;for(let u=0;u0){const c=255/l;for(let u=0;uPI.create(this.fontScale,l.fontFamily)),this.defaultBackgroundColor=i.getColor(2),this.backgroundColor=kk._getMinimapBackground(t,this.defaultBackgroundColor),this.foregroundAlpha=kk._getMinimapForegroundOpacity(t)}static _getMinimapBackground(e,t){const i=e.getColor(Hyt);return i?new Fd(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}static _getMinimapForegroundOpacity(e){const t=e.getColor(Vyt);return t?Fd._clamp(Math.round(255*t.rgba.a)):255}static _getSectionHeaderColor(e,t){const i=e.getColor(cm);return i?new Fd(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}equals(e){return this.renderMinimap===e.renderMinimap&&this.size===e.size&&this.minimapHeightIsEditorHeight===e.minimapHeightIsEditorHeight&&this.scrollBeyondLastLine===e.scrollBeyondLastLine&&this.paddingTop===e.paddingTop&&this.paddingBottom===e.paddingBottom&&this.showSlider===e.showSlider&&this.autohide===e.autohide&&this.pixelRatio===e.pixelRatio&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.lineHeight===e.lineHeight&&this.minimapLeft===e.minimapLeft&&this.minimapWidth===e.minimapWidth&&this.minimapHeight===e.minimapHeight&&this.canvasInnerWidth===e.canvasInnerWidth&&this.canvasInnerHeight===e.canvasInnerHeight&&this.canvasOuterWidth===e.canvasOuterWidth&&this.canvasOuterHeight===e.canvasOuterHeight&&this.isSampling===e.isSampling&&this.editorHeight===e.editorHeight&&this.fontScale===e.fontScale&&this.minimapLineHeight===e.minimapLineHeight&&this.minimapCharWidth===e.minimapCharWidth&&this.sectionHeaderFontSize===e.sectionHeaderFontSize&&this.sectionHeaderLetterSpacing===e.sectionHeaderLetterSpacing&&this.defaultBackgroundColor&&this.defaultBackgroundColor.equals(e.defaultBackgroundColor)&&this.backgroundColor&&this.backgroundColor.equals(e.backgroundColor)&&this.foregroundAlpha===e.foregroundAlpha}}class OI{constructor(e,t,i,r,s,o,a,l,c){this.scrollTop=e,this.scrollHeight=t,this.sliderNeeded=i,this._computedSliderRatio=r,this.sliderTop=s,this.sliderHeight=o,this.topPaddingLineCount=a,this.startLineNumber=l,this.endLineNumber=c}getDesiredScrollTopFromDelta(e){return Math.round(this.scrollTop+e/this._computedSliderRatio)}getDesiredScrollTopFromTouchLocation(e){return Math.round((e-this.sliderHeight/2)/this._computedSliderRatio)}intersectWithViewport(e){const t=Math.max(this.startLineNumber,e.startLineNumber),i=Math.min(this.endLineNumber,e.endLineNumber);return t>i?null:[t,i]}getYForLineNumber(e,t){return+(e-this.startLineNumber+this.topPaddingLineCount)*t}static create(e,t,i,r,s,o,a,l,c,u,d){const h=e.pixelRatio,f=e.minimapLineHeight,g=Math.floor(e.canvasInnerHeight/f),p=e.lineHeight;if(e.minimapHeightIsEditorHeight){let k=l*e.lineHeight+e.paddingTop+e.paddingBottom;e.scrollBeyondLastLine&&(k+=Math.max(0,s-e.lineHeight-e.paddingBottom));const L=Math.max(1,Math.floor(s*s/k)),D=Math.max(0,e.minimapHeight-L),I=D/(u-s),O=c*I,M=D>0,B=Math.floor(e.canvasInnerHeight/e.minimapLineHeight),G=Math.floor(e.paddingTop/e.lineHeight);return new OI(c,u,M,I,O,L,G,1,Math.min(a,B))}let m;if(o&&i!==a){const k=i-t+1;m=Math.floor(k*f/h)}else{const k=s/p;m=Math.floor(k*f/h)}const _=Math.floor(e.paddingTop/p);let v=Math.floor(e.paddingBottom/p);if(e.scrollBeyondLastLine){const k=s/p;v=Math.max(v,k-1)}let y;if(v>0){const k=s/p;y=(_+a+v-k-1)*f/h}else y=Math.max(0,(_+a)*f/h-m);y=Math.min(e.minimapHeight-m,y);const C=y/(u-s),x=c*C;if(g>=_+a+v){const k=y>0;return new OI(c,u,k,C,x,m,_,1,a)}else{let k;t>1?k=t+_:k=Math.max(1,c/p);let L,D=Math.max(1,Math.floor(k-x*h/f));D<_?(L=_-D+1,D=1):(L=0,D=Math.max(1,D-_)),d&&d.scrollHeight===u&&(d.scrollTop>c&&(D=Math.min(D,d.startLineNumber),L=Math.max(L,d.topPaddingLineCount)),d.scrollTop=e.paddingTop?M=(t-D+L+O)*f/h:M=c/e.paddingTop*(L+O)*f/h,new OI(c,u,!0,C,M,m,L,D,I)}}}class ZW{static{this.INVALID=new ZW(-1)}constructor(e){this.dy=e}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}}class ywe{constructor(e,t,i){this.renderedLayout=e,this._imageData=t,this._renderedLines=new h8e({createLine:()=>ZW.INVALID}),this._renderedLines._set(e.startLineNumber,i)}linesEquals(e){if(!this.scrollEquals(e))return!1;const i=this._renderedLines._get().lines;for(let r=0,s=i.length;r1){for(let _=0,v=r-1;_0&&this.minimapLines[i-1]>=e;)i--;let r=this.modelLineToMinimapLine(t)-1;for(;r+1t)return null}return[i+1,r+1]}decorationLineRangeToMinimapLineRange(e,t){let i=this.modelLineToMinimapLine(e),r=this.modelLineToMinimapLine(t);return e!==t&&r===i&&(r===this.minimapLines.length?i>1&&i--:r++),[i,r]}onLinesDeleted(e){const t=e.toLineNumber-e.fromLineNumber+1;let i=this.minimapLines.length,r=0;for(let s=this.minimapLines.length-1;s>=0&&!(this.minimapLines[s]=0&&!(this.minimapLines[i]0,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight,viewportStartLineNumber:t,viewportEndLineNumber:i,viewportStartLineNumberVerticalOffset:e.getVerticalOffsetForLineNumber(t),scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight};this._actual.render(r)}_recreateLineSampling(){this._minimapSelections=null;const e=!!this._samplingState,[t,i]=YN.compute(this.options,this._context.viewModel.getLineCount(),this._samplingState);if(this._samplingState=t,e&&this._samplingState)for(const r of i)switch(r.type){case"deleted":this._actual.onLinesDeleted(r.deleteFromLineNumber,r.deleteToLineNumber);break;case"inserted":this._actual.onLinesInserted(r.insertFromLineNumber,r.insertToLineNumber);break;case"flush":this._actual.onFlushed();break}}getLineCount(){return this._samplingState?this._samplingState.minimapLines.length:this._context.viewModel.getLineCount()}getRealLineCount(){return this._context.viewModel.getLineCount()}getLineContent(e){return this._samplingState?this._context.viewModel.getLineContent(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineContent(e)}getLineMaxColumn(e){return this._samplingState?this._context.viewModel.getLineMaxColumn(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineMaxColumn(e)}getMinimapLinesRenderingData(e,t,i){if(this._samplingState){const r=[];for(let s=0,o=t-e+1;s!r.options.minimap?.sectionHeaderStyle);if(this._samplingState){const r=[];for(const s of i){if(!s.options.minimap)continue;const o=s.range,a=this._samplingState.modelLineToMinimapLine(o.startLineNumber),l=this._samplingState.modelLineToMinimapLine(o.endLineNumber);r.push(new J6e(new $(a,o.startColumn,l,o.endColumn),s.options))}return r}return i}getSectionHeaderDecorationsInViewport(e,t){const i=this.options.minimapLineHeight,s=this.options.sectionHeaderFontSize/i;return e=Math.floor(Math.max(1,e-s)),this._getMinimapDecorationsInViewport(e,t).filter(o=>!!o.options.minimap?.sectionHeaderStyle)}_getMinimapDecorationsInViewport(e,t){let i;if(this._samplingState){const r=this._samplingState.minimapLines[e-1],s=this._samplingState.minimapLines[t-1];i=new $(r,1,s,this._context.viewModel.getLineMaxColumn(s))}else i=new $(e,1,t,this._context.viewModel.getLineMaxColumn(t));return this._context.viewModel.getMinimapDecorationsInRange(i)}getSectionHeaderText(e,t){const i=e.options.minimap?.sectionHeaderText;if(!i)return null;const r=this._sectionHeaderCache.get(i);if(r)return r;const s=t(i);return this._sectionHeaderCache.set(i,s),s}getOptions(){return this._context.viewModel.model.getOptions()}revealLineNumber(e){this._samplingState&&(e=this._samplingState.minimapLines[e-1]),this._context.viewModel.revealRange("mouse",!1,new $(e,1,e,1),1,0)}setScrollTop(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e},1)}}class RS extends me{constructor(e,t){super(),this._renderDecorations=!1,this._gestureInProgress=!1,this._theme=e,this._model=t,this._lastRenderData=null,this._buffers=null,this._selectionColor=this._theme.getColor(m1e),this._domNode=Ci(document.createElement("div")),Ig.write(this._domNode,9),this._domNode.setClassName(this._getMinimapDomNodeClassName()),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._shadow=Ci(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=Ci(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=Ci(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=Ci(document.createElement("div")),this._slider.setPosition("absolute"),this._slider.setClassName("minimap-slider"),this._slider.setLayerHinting(!0),this._slider.setContain("strict"),this._domNode.appendChild(this._slider),this._sliderHorizontal=Ci(document.createElement("div")),this._sliderHorizontal.setPosition("absolute"),this._sliderHorizontal.setClassName("minimap-slider-horizontal"),this._slider.appendChild(this._sliderHorizontal),this._applyLayout(),this._pointerDownListener=Jr(this._domNode.domNode,je.POINTER_DOWN,i=>{if(i.preventDefault(),this._model.options.renderMinimap===0||!this._lastRenderData)return;if(this._model.options.size!=="proportional"){if(i.button===0&&this._lastRenderData){const c=ms(this._slider.domNode),u=c.top+c.height/2;this._startSliderDragging(i,u,this._lastRenderData.renderedLayout)}return}const s=this._model.options.minimapLineHeight,o=this._model.options.canvasInnerHeight/this._model.options.canvasOuterHeight*i.offsetY;let l=Math.floor(o/s)+this._lastRenderData.renderedLayout.startLineNumber-this._lastRenderData.renderedLayout.topPaddingLineCount;l=Math.min(l,this._model.getLineCount()),this._model.revealLineNumber(l)}),this._sliderPointerMoveMonitor=new e2,this._sliderPointerDownListener=Jr(this._slider.domNode,je.POINTER_DOWN,i=>{i.preventDefault(),i.stopPropagation(),i.button===0&&this._lastRenderData&&this._startSliderDragging(i,i.pageY,this._lastRenderData.renderedLayout)}),this._gestureDisposable=Fr.addTarget(this._domNode.domNode),this._sliderTouchStartListener=Ce(this._domNode.domNode,gr.Start,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(i))},{passive:!1}),this._sliderTouchMoveListener=Ce(this._domNode.domNode,gr.Change,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(i)},{passive:!1}),this._sliderTouchEndListener=Jr(this._domNode.domNode,gr.End,i=>{i.preventDefault(),i.stopPropagation(),this._gestureInProgress=!1,this._slider.toggleClassName("active",!1)})}_startSliderDragging(e,t,i){if(!e.target||!(e.target instanceof Element))return;const r=e.pageX;this._slider.toggleClassName("active",!0);const s=(o,a)=>{const l=ms(this._domNode.domNode),c=Math.min(Math.abs(a-r),Math.abs(a-l.left),Math.abs(a-l.left-l.width));if(Ta&&c>JAt){this._model.setScrollTop(i.scrollTop);return}const u=o-t;this._model.setScrollTop(i.getDesiredScrollTopFromDelta(u))};e.pageY!==t&&s(e.pageY,r),this._sliderPointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>s(o.pageY,o.pageX),()=>{this._slider.toggleClassName("active",!1)})}scrollDueToTouchEvent(e){const t=this._domNode.domNode.getBoundingClientRect().top,i=this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(e.pageY-t);this._model.setScrollTop(i)}dispose(){this._pointerDownListener.dispose(),this._sliderPointerMoveMonitor.dispose(),this._sliderPointerDownListener.dispose(),this._gestureDisposable.dispose(),this._sliderTouchStartListener.dispose(),this._sliderTouchMoveListener.dispose(),this._sliderTouchEndListener.dispose(),super.dispose()}_getMinimapDomNodeClassName(){const e=["minimap"];return this._model.options.showSlider==="always"?e.push("slider-always"):e.push("slider-mouseover"),this._model.options.autohide&&e.push("autohide"),e.join(" ")}getDomNode(){return this._domNode}_applyLayout(){this._domNode.setLeft(this._model.options.minimapLeft),this._domNode.setWidth(this._model.options.minimapWidth),this._domNode.setHeight(this._model.options.minimapHeight),this._shadow.setHeight(this._model.options.minimapHeight),this._canvas.setWidth(this._model.options.canvasOuterWidth),this._canvas.setHeight(this._model.options.canvasOuterHeight),this._canvas.domNode.width=this._model.options.canvasInnerWidth,this._canvas.domNode.height=this._model.options.canvasInnerHeight,this._decorationsCanvas.setWidth(this._model.options.canvasOuterWidth),this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight),this._decorationsCanvas.domNode.width=this._model.options.canvasInnerWidth,this._decorationsCanvas.domNode.height=this._model.options.canvasInnerHeight,this._slider.setWidth(this._model.options.minimapWidth)}_getBuffer(){return this._buffers||this._model.options.canvasInnerWidth>0&&this._model.options.canvasInnerHeight>0&&(this._buffers=new Vce(this._canvas.domNode.getContext("2d"),this._model.options.canvasInnerWidth,this._model.options.canvasInnerHeight,this._model.options.backgroundColor)),this._buffers?this._buffers.getBuffer():null}onDidChangeOptions(){this._lastRenderData=null,this._buffers=null,this._applyLayout(),this._domNode.setClassName(this._getMinimapDomNodeClassName())}onSelectionChanged(){return this._renderDecorations=!0,!0}onDecorationsChanged(){return this._renderDecorations=!0,!0}onFlushed(){return this._lastRenderData=null,!0}onLinesChanged(e,t){return this._lastRenderData?this._lastRenderData.onLinesChanged(e,t):!1}onLinesDeleted(e,t){return this._lastRenderData?.onLinesDeleted(e,t),!0}onLinesInserted(e,t){return this._lastRenderData?.onLinesInserted(e,t),!0}onScrollChanged(){return this._renderDecorations=!0,!0}onThemeChanged(){return this._selectionColor=this._theme.getColor(m1e),this._renderDecorations=!0,!0}onTokensChanged(e){return this._lastRenderData?this._lastRenderData.onTokensChanged(e):!1}onTokensColorsChanged(){return this._lastRenderData=null,this._buffers=null,!0}onZonesChanged(){return this._lastRenderData=null,!0}render(e){if(this._model.options.renderMinimap===0){this._shadow.setClassName("minimap-shadow-hidden"),this._sliderHorizontal.setWidth(0),this._sliderHorizontal.setHeight(0);return}e.scrollLeft+e.viewportWidth>=e.scrollWidth?this._shadow.setClassName("minimap-shadow-hidden"):this._shadow.setClassName("minimap-shadow-visible");const i=OI.create(this._model.options,e.viewportStartLineNumber,e.viewportEndLineNumber,e.viewportStartLineNumberVerticalOffset,e.viewportHeight,e.viewportContainsWhitespaceGaps,this._model.getLineCount(),this._model.getRealLineCount(),e.scrollTop,e.scrollHeight,this._lastRenderData?this._lastRenderData.renderedLayout:null);this._slider.setDisplay(i.sliderNeeded?"block":"none"),this._slider.setTop(i.sliderTop),this._slider.setHeight(i.sliderHeight),this._sliderHorizontal.setLeft(0),this._sliderHorizontal.setWidth(this._model.options.minimapWidth),this._sliderHorizontal.setTop(0),this._sliderHorizontal.setHeight(i.sliderHeight),this.renderDecorations(i),this._lastRenderData=this.renderLines(i)}renderDecorations(e){if(this._renderDecorations){this._renderDecorations=!1;const t=this._model.getSelections();t.sort($.compareRangesUsingStarts);const i=this._model.getMinimapDecorationsInViewport(e.startLineNumber,e.endLineNumber);i.sort((h,f)=>(h.options.zIndex||0)-(f.options.zIndex||0));const{canvasInnerWidth:r,canvasInnerHeight:s}=this._model.options,o=this._model.options.minimapLineHeight,a=this._model.options.minimapCharWidth,l=this._model.getOptions().tabSize,c=this._decorationsCanvas.domNode.getContext("2d");c.clearRect(0,0,r,s);const u=new wwe(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(c,t,u,e,o),this._renderDecorationsLineHighlights(c,i,u,e,o);const d=new wwe(e.startLineNumber,e.endLineNumber,null);this._renderSelectionsHighlights(c,t,d,e,o,l,a,r),this._renderDecorationsHighlights(c,i,d,e,o,l,a,r),this._renderSectionHeaders(e)}}_renderSelectionLineHighlights(e,t,i,r,s){if(!this._selectionColor||this._selectionColor.isTransparent())return;e.fillStyle=this._selectionColor.transparent(.5).toString();let o=0,a=0;for(const l of t){const c=r.intersectWithViewport(l);if(!c)continue;const[u,d]=c;for(let g=u;g<=d;g++)i.set(g,!0);const h=r.getYForLineNumber(u,s),f=r.getYForLineNumber(d,s);a>=h||(a>o&&e.fillRect(tp,o,e.canvas.width,a-o),o=h),a=f}a>o&&e.fillRect(tp,o,e.canvas.width,a-o)}_renderDecorationsLineHighlights(e,t,i,r,s){const o=new Map;for(let a=t.length-1;a>=0;a--){const l=t[a],c=l.options.minimap;if(!c||c.position!==1)continue;const u=r.intersectWithViewport(l.range);if(!u)continue;const[d,h]=u,f=c.getColor(this._theme.value);if(!f||f.isTransparent())continue;let g=o.get(f.toString());g||(g=f.transparent(.5).toString(),o.set(f.toString(),g)),e.fillStyle=g;for(let p=d;p<=h;p++){if(i.has(p))continue;i.set(p,!0);const m=r.getYForLineNumber(d,s);e.fillRect(tp,m,e.canvas.width,s)}}}_renderSelectionsHighlights(e,t,i,r,s,o,a,l){if(!(!this._selectionColor||this._selectionColor.isTransparent()))for(const c of t){const u=r.intersectWithViewport(c);if(!u)continue;const[d,h]=u;for(let f=d;f<=h;f++)this.renderDecorationOnLine(e,i,c,this._selectionColor,r,f,s,s,o,a,l)}}_renderDecorationsHighlights(e,t,i,r,s,o,a,l){for(const c of t){const u=c.options.minimap;if(!u)continue;const d=r.intersectWithViewport(c.range);if(!d)continue;const[h,f]=d,g=u.getColor(this._theme.value);if(!(!g||g.isTransparent()))for(let p=h;p<=f;p++)switch(u.position){case 1:this.renderDecorationOnLine(e,i,c.range,g,r,p,s,s,o,a,l);continue;case 2:{const m=r.getYForLineNumber(p,s);this.renderDecoration(e,g,2,m,eNt,s);continue}}}}renderDecorationOnLine(e,t,i,r,s,o,a,l,c,u,d){const h=s.getYForLineNumber(o,l);if(h+a<0||h>this._model.options.canvasInnerHeight)return;const{startLineNumber:f,endLineNumber:g}=i,p=f===o?i.startColumn:1,m=g===o?i.endColumn:this._model.getLineMaxColumn(o),_=this.getXOffsetForPosition(t,o,p,c,u,d),v=this.getXOffsetForPosition(t,o,m,c,u,d);this.renderDecoration(e,r,_,h,v-_,a)}getXOffsetForPosition(e,t,i,r,s,o){if(i===1)return tp;if((i-1)*s>=o)return o;let l=e.get(t);if(!l){const c=this._model.getLineContent(t);l=[tp];let u=tp;for(let d=1;d=o){l[d]=o;break}l[d]=g,u=g}e.set(t,l)}return i-1p.range.startLineNumber-m.range.startLineNumber);const g=RS._fitSectionHeader.bind(null,h,o-tp);for(const p of f){const m=e.getYForLineNumber(p.range.startLineNumber,t)+i,_=m-i,v=_+2,y=this._model.getSectionHeaderText(p,g);RS._renderSectionLabel(h,y,p.options.minimap?.sectionHeaderStyle===2,l,u,o,_,s,m,v)}}static _fitSectionHeader(e,t,i){if(!i)return i;const r="…",s=e.measureText(i).width,o=e.measureText(r).width;if(s<=t||s<=o)return i;const a=i.length,l=s/i.length,c=Math.floor((t-o)/l)-1;let u=Math.ceil(c/2);for(;u>0&&/\s/.test(i[u-1]);)--u;return i.substring(0,u)+r+i.substring(a-(c-u))}static _renderSectionLabel(e,t,i,r,s,o,a,l,c,u){t&&(e.fillStyle=r,e.fillRect(0,a,o,l),e.fillStyle=s,e.fillText(t,tp,c)),i&&(e.beginPath(),e.moveTo(0,u),e.lineTo(o,u),e.closePath(),e.stroke())}renderLines(e){const t=e.startLineNumber,i=e.endLineNumber,r=this._model.options.minimapLineHeight;if(this._lastRenderData&&this._lastRenderData.linesEquals(e)){const z=this._lastRenderData._get();return new ywe(e,z.imageData,z.lines)}const s=this._getBuffer();if(!s)return null;const[o,a,l]=RS._renderUntouchedLines(s,e.topPaddingLineCount,t,i,r,this._lastRenderData),c=this._model.getMinimapLinesRenderingData(t,i,l),u=this._model.getOptions().tabSize,d=this._model.options.defaultBackgroundColor,h=this._model.options.backgroundColor,f=this._model.options.foregroundAlpha,g=this._model.tokensColorTracker,p=g.backgroundIsLight(),m=this._model.options.renderMinimap,_=this._model.options.charRenderer(),v=this._model.options.fontScale,y=this._model.options.minimapCharWidth,x=(m===1?2:3)*v,k=r>x?Math.floor((r-x)/2):0,L=h.a/255,D=new Fd(Math.round((h.r-d.r)*L+d.r),Math.round((h.g-d.g)*L+d.g),Math.round((h.b-d.b)*L+d.b),255);let I=e.topPaddingLineCount*r;const O=[];for(let z=0,q=i-t+1;z=0&&Mv)return;const B=m.charCodeAt(x);if(B===9){const G=h-(x+k)%h;k+=G-1,C+=G*o}else if(B===32)C+=o;else{const G=xb(B)?2:1;for(let W=0;Wv)return}}}}}class wwe{constructor(e,t,i){this._startLineNumber=e,this._endLineNumber=t,this._defaultValue=i,this._values=[];for(let r=0,s=this._endLineNumber-this._startLineNumber+1;rthis._endLineNumber||(this._values[e-this._startLineNumber]=t)}get(e){return ethis._endLineNumber?this._defaultValue:this._values[e-this._startLineNumber]}}class nNt extends bu{constructor(e,t){super(e),this._viewDomNode=t;const r=this._context.configuration.options.get(146);this._widgets={},this._verticalScrollbarWidth=r.verticalScrollbarWidth,this._minimapWidth=r.minimap.minimapWidth,this._horizontalScrollbarHeight=r.horizontalScrollbarHeight,this._editorHeight=r.height,this._editorWidth=r.width,this._viewDomNodeRect={top:0,left:0,width:0,height:0},this._domNode=Ci(document.createElement("div")),Ig.write(this._domNode,4),this._domNode.setClassName("overlayWidgets"),this.overflowingOverlayWidgetsDomNode=Ci(document.createElement("div")),Ig.write(this.overflowingOverlayWidgetsDomNode,5),this.overflowingOverlayWidgetsDomNode.setClassName("overflowingOverlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(e){const i=this._context.configuration.options.get(146);return this._verticalScrollbarWidth=i.verticalScrollbarWidth,this._minimapWidth=i.minimap.minimapWidth,this._horizontalScrollbarHeight=i.horizontalScrollbarHeight,this._editorHeight=i.height,this._editorWidth=i.width,!0}addWidget(e){const t=Ci(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:null,domNode:t},t.setPosition("absolute"),t.setAttribute("widgetId",e.getId()),e.allowEditorOverflow?this.overflowingOverlayWidgetsDomNode.appendChild(t):this._domNode.appendChild(t),this.setShouldRender(),this._updateMaxMinWidth()}setWidgetPosition(e,t){const i=this._widgets[e.getId()],r=t?t.preference:null,s=t?.stackOridinal;return i.preference===r&&i.stack===s?(this._updateMaxMinWidth(),!1):(i.preference=r,i.stack=s,this.setShouldRender(),this._updateMaxMinWidth(),!0)}removeWidget(e){const t=e.getId();if(this._widgets.hasOwnProperty(t)){const r=this._widgets[t].domNode.domNode;delete this._widgets[t],r.remove(),this.setShouldRender(),this._updateMaxMinWidth()}}_updateMaxMinWidth(){let e=0;const t=Object.keys(this._widgets);for(let i=0,r=t.length;i0);t.sort((r,s)=>(this._widgets[r].stack||0)-(this._widgets[s].stack||0));for(let r=0,s=t.length;r=3){const s=Math.floor(r/3),o=Math.floor(r/3),a=r-s-o,l=e,c=l+s,u=l+s+a;return[[0,l,c,l,u,l,c,l],[0,s,a,s+a,o,s+a+o,a+o,s+a+o]]}else if(i===2){const s=Math.floor(r/2),o=r-s,a=e,l=a+s;return[[0,a,a,a,l,a,a,a],[0,s,s,s,o,s+o,s+o,s+o]]}else{const s=e,o=r;return[[0,s,s,s,s,s,s,s],[0,o,o,o,o,o,o,o]]}}equals(e){return this.lineHeight===e.lineHeight&&this.pixelRatio===e.pixelRatio&&this.overviewRulerLanes===e.overviewRulerLanes&&this.renderBorder===e.renderBorder&&this.borderColor===e.borderColor&&this.hideCursor===e.hideCursor&&this.cursorColorSingle===e.cursorColorSingle&&this.cursorColorPrimary===e.cursorColorPrimary&&this.cursorColorSecondary===e.cursorColorSecondary&&this.themeType===e.themeType&&Te.equals(this.backgroundColor,e.backgroundColor)&&this.top===e.top&&this.right===e.right&&this.domWidth===e.domWidth&&this.domHeight===e.domHeight&&this.canvasWidth===e.canvasWidth&&this.canvasHeight===e.canvasHeight}};class rNt extends bu{constructor(e){super(e),this._actualShouldRender=0,this._renderedDecorations=[],this._renderedCursorPositions=[],this._domNode=Ci(document.createElement("canvas")),this._domNode.setClassName("decorationsOverviewRuler"),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._domNode.setAttribute("aria-hidden","true"),this._updateSettings(!1),this._tokensColorTrackerListener=rs.onDidChange(t=>{t.changedColorMap&&this._updateSettings(!0)}),this._cursorPositions=[{position:new he(1,1),color:this._settings.cursorColorSingle}]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){const t=new iNt(this._context.configuration,this._context.theme);return this._settings&&this._settings.equals(t)?!1:(this._settings=t,this._domNode.setTop(this._settings.top),this._domNode.setRight(this._settings.right),this._domNode.setWidth(this._settings.domWidth),this._domNode.setHeight(this._settings.domHeight),this._domNode.domNode.width=this._settings.canvasWidth,this._domNode.domNode.height=this._settings.canvasHeight,e&&this._render(),!0)}_markRenderingIsNeeded(){return this._actualShouldRender=2,!0}_markRenderingIsMaybeNeeded(){return this._actualShouldRender=1,!0}onConfigurationChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}onCursorStateChanged(e){this._cursorPositions=[];for(let t=0,i=e.selections.length;t1&&(r=t===0?this._settings.cursorColorPrimary:this._settings.cursorColorSecondary),this._cursorPositions.push({position:e.selections[t].getPosition(),color:r})}return this._cursorPositions.sort((t,i)=>he.compare(t.position,i.position)),this._markRenderingIsMaybeNeeded()}onDecorationsChanged(e){return e.affectsOverviewRuler?this._markRenderingIsMaybeNeeded():!1}onFlushed(e){return this._markRenderingIsNeeded()}onScrollChanged(e){return e.scrollHeightChanged?this._markRenderingIsNeeded():!1}onZonesChanged(e){return this._markRenderingIsNeeded()}onThemeChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}getDomNode(){return this._domNode.domNode}prepareRender(e){}render(e){this._render(),this._actualShouldRender=0}_render(){const e=this._settings.backgroundColor;if(this._settings.overviewRulerLanes===0){this._domNode.setBackgroundColor(e?Te.Format.CSS.formatHexA(e):""),this._domNode.setDisplay("none");return}const t=this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme);if(t.sort(HN.compareByRenderingProps),this._actualShouldRender===1&&!HN.equalsArr(this._renderedDecorations,t)&&(this._actualShouldRender=2),this._actualShouldRender===1&&!$r(this._renderedCursorPositions,this._cursorPositions,(g,p)=>g.position.lineNumber===p.position.lineNumber&&g.color===p.color)&&(this._actualShouldRender=2),this._actualShouldRender===1)return;this._renderedDecorations=t,this._renderedCursorPositions=this._cursorPositions,this._domNode.setDisplay("block");const i=this._settings.canvasWidth,r=this._settings.canvasHeight,s=this._settings.lineHeight,o=this._context.viewLayout,a=this._context.viewLayout.getScrollHeight(),l=r/a,c=6*this._settings.pixelRatio|0,u=c/2|0,d=this._domNode.domNode.getContext("2d");e?e.isOpaque()?(d.fillStyle=Te.Format.CSS.formatHexA(e),d.fillRect(0,0,i,r)):(d.clearRect(0,0,i,r),d.fillStyle=Te.Format.CSS.formatHexA(e),d.fillRect(0,0,i,r)):d.clearRect(0,0,i,r);const h=this._settings.x,f=this._settings.w;for(const g of t){const p=g.color,m=g.data;d.fillStyle=p;let _=0,v=0,y=0;for(let C=0,x=m.length/3;Cr&&(B=r-u),I=B-u,O=B+u}I>y+1||k!==_?(C!==0&&d.fillRect(h[_],v,f[_],y-v),_=k,v=I,y=O):O>y&&(y=O)}d.fillRect(h[_],v,f[_],y-v)}if(!this._settings.hideCursor){const g=2*this._settings.pixelRatio|0,p=g/2|0,m=this._settings.x[7],_=this._settings.w[7];let v=-100,y=-100,C=null;for(let x=0,k=this._cursorPositions.length;xr&&(I=r-p);const O=I-p,M=O+g;O>y+1||L!==C?(x!==0&&C&&d.fillRect(m,v,_,y-v),v=O,y=M):M>y&&(y=M),C=L,d.fillStyle=L}C&&d.fillRect(m,v,_,y-v)}this._settings.renderBorder&&this._settings.borderColor&&this._settings.overviewRulerLanes>0&&(d.beginPath(),d.lineWidth=1,d.strokeStyle=this._settings.borderColor,d.moveTo(0,0),d.lineTo(0,r),d.moveTo(1,0),d.lineTo(i,0),d.stroke())}}class Cwe{constructor(e,t,i){this._colorZoneBrand=void 0,this.from=e|0,this.to=t|0,this.colorId=i|0}static compare(e,t){return e.colorId===t.colorId?e.from===t.from?e.to-t.to:e.from-t.from:e.colorId-t.colorId}}class v8e{constructor(e,t,i,r){this._overviewRulerZoneBrand=void 0,this.startLineNumber=e,this.endLineNumber=t,this.heightInLines=i,this.color=r,this._colorZone=null}static compare(e,t){return e.color===t.color?e.startLineNumber===t.startLineNumber?e.heightInLines===t.heightInLines?e.endLineNumber-t.endLineNumber:e.heightInLines-t.heightInLines:e.startLineNumber-t.startLineNumber:e.colori&&(p=i-m);const _=u.color;let v=this._color2Id[_];v||(v=++this._lastAssignedId,this._color2Id[_]=v,this._id2Color[v]=_);const y=new Cwe(p-m,p+m,v);u.setColorZone(y),a.push(y)}return this._colorZonesInvalid=!1,a.sort(Cwe.compare),a}}class oNt extends _O{constructor(e,t){super(),this._context=e;const i=this._context.configuration.options;this._domNode=Ci(document.createElement("canvas")),this._domNode.setClassName(t),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new sNt(r=>this._context.viewLayout.getVerticalOffsetForLineNumber(r)),this._zoneManager.setDOMWidth(0),this._zoneManager.setDOMHeight(0),this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight()),this._zoneManager.setLineHeight(i.get(67)),this._zoneManager.setPixelRatio(i.get(144)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return e.hasChanged(67)&&(this._zoneManager.setLineHeight(t.get(67)),this._render()),e.hasChanged(144)&&(this._zoneManager.setPixelRatio(t.get(144)),this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render()),!0}onFlushed(e){return this._render(),!0}onScrollChanged(e){return e.scrollHeightChanged&&(this._zoneManager.setOuterHeight(e.scrollHeight),this._render()),!0}onZonesChanged(e){return this._render(),!0}getDomNode(){return this._domNode.domNode}setLayout(e){this._domNode.setTop(e.top),this._domNode.setRight(e.right);let t=!1;t=this._zoneManager.setDOMWidth(e.width)||t,t=this._zoneManager.setDOMHeight(e.height)||t,t&&(this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render())}setZones(e){this._zoneManager.setZones(e),this._render()}_render(){if(this._zoneManager.getOuterHeight()===0)return!1;const e=this._zoneManager.getCanvasWidth(),t=this._zoneManager.getCanvasHeight(),i=this._zoneManager.resolveColorZones(),r=this._zoneManager.getId2Color(),s=this._domNode.domNode.getContext("2d");return s.clearRect(0,0,e,t),i.length>0&&this._renderOneLane(s,i,r,e),!0}_renderOneLane(e,t,i,r){let s=0,o=0,a=0;for(const l of t){const c=l.colorId,u=l.from,d=l.to;c!==s?(e.fillRect(0,o,r,a-o),s=c,e.fillStyle=i[s],o=u,a=d):a>=u?a=Math.max(a,d):(e.fillRect(0,o,r,a-o),o=u,a=d)}e.fillRect(0,o,r,a-o)}}class aNt extends bu{constructor(e){super(e),this.domNode=Ci(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("view-rulers"),this._renderedRulers=[];const t=this._context.configuration.options;this._rulers=t.get(103),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth}dispose(){super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._rulers=t.get(103),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,!0}onScrollChanged(e){return e.scrollHeightChanged}prepareRender(e){}_ensureRulersCount(){const e=this._renderedRulers.length,t=this._rulers.length;if(e===t)return;if(e0;){const a=Ci(document.createElement("div"));a.setClassName("view-ruler"),a.setWidth(s),this.domNode.appendChild(a),this._renderedRulers.push(a),o--}return}let i=e-t;for(;i>0;){const r=this._renderedRulers.pop();this.domNode.removeChild(r),i--}}render(e){this._ensureRulersCount();for(let t=0,i=this._rulers.length;t0;return this._shouldShow!==e?(this._shouldShow=e,!0):!1}getDomNode(){return this._domNode}_updateWidth(){const t=this._context.configuration.options.get(146);t.minimap.renderMinimap===0||t.minimap.minimapWidth>0&&t.minimap.minimapLeft===0?this._width=t.width:this._width=t.width-t.verticalScrollbarWidth}onConfigurationChanged(e){const i=this._context.configuration.options.get(104);return this._useShadows=i.useShadows,this._updateWidth(),this._updateShouldShow(),!0}onScrollChanged(e){return this._scrollTop=e.scrollTop,this._updateShouldShow()}prepareRender(e){}render(e){this._domNode.setWidth(this._width),this._domNode.setClassName(this._shouldShow?"scroll-decoration":"")}}class cNt{constructor(e){this.left=e.left,this.width=e.width,this.startStyle=null,this.endStyle=null}}class uNt{constructor(e,t){this.lineNumber=e,this.ranges=t}}function dNt(n){return new cNt(n)}function hNt(n){return new uNt(n.lineNumber,n.ranges.map(dNt))}class jo extends kC{static{this.SELECTION_CLASS_NAME="selected-text"}static{this.SELECTION_TOP_LEFT="top-left-radius"}static{this.SELECTION_BOTTOM_LEFT="bottom-left-radius"}static{this.SELECTION_TOP_RIGHT="top-right-radius"}static{this.SELECTION_BOTTOM_RIGHT="bottom-right-radius"}static{this.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background"}static{this.ROUNDED_PIECE_WIDTH=10}constructor(e){super(),this._previousFrameVisibleRangesWithStyle=[],this._context=e;const t=this._context.configuration.options;this._roundedSelection=t.get(102),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,this._selections=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._roundedSelection=t.get(102),this._typicalHalfwidthCharacterWidth=t.get(50).typicalHalfwidthCharacterWidth,!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_visibleRangesHaveGaps(e){for(let t=0,i=e.length;t1)return!0;return!1}_enrichVisibleRangesWithStyle(e,t,i){const r=this._typicalHalfwidthCharacterWidth/4;let s=null,o=null;if(i&&i.length>0&&t.length>0){const a=t[0].lineNumber;if(a===e.startLineNumber)for(let c=0;!s&&c=0;c--)i[c].lineNumber===l&&(o=i[c].ranges[0]);s&&!s.startStyle&&(s=null),o&&!o.startStyle&&(o=null)}for(let a=0,l=t.length;a0){const g=t[a-1].ranges[0].left,p=t[a-1].ranges[0].left+t[a-1].ranges[0].width;e3(u-g)g&&(h.top=1),e3(d-p)'}_actualRenderOneSelection(e,t,i,r){if(r.length===0)return;const s=!!r[0].ranges[0].startStyle,o=r[0].lineNumber,a=r[r.length-1].lineNumber;for(let l=0,c=r.length;l1,c)}this._previousFrameVisibleRangesWithStyle=s,this._renderResult=t.map(([o,a])=>o+a)}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}dh((n,e)=>{const t=n.getColor(byt);t&&!t.isTransparent()&&e.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${t}; }`)});function e3(n){return n<0?-n:n}class xwe{constructor(e,t,i,r,s,o,a){this.top=e,this.left=t,this.paddingLeft=i,this.width=r,this.height=s,this.textContent=o,this.textContentClassName=a}}var v_;(function(n){n[n.Single=0]="Single",n[n.MultiPrimary=1]="MultiPrimary",n[n.MultiSecondary=2]="MultiSecondary"})(v_||(v_={}));class Swe{constructor(e,t){this._context=e;const i=this._context.configuration.options,r=i.get(50);this._cursorStyle=i.get(28),this._lineHeight=i.get(67),this._typicalHalfwidthCharacterWidth=r.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(i.get(31),this._typicalHalfwidthCharacterWidth),this._isVisible=!0,this._domNode=Ci(document.createElement("div")),this._domNode.setClassName(`cursor ${Ck}`),this._domNode.setHeight(this._lineHeight),this._domNode.setTop(0),this._domNode.setLeft(0),ta(this._domNode,r),this._domNode.setDisplay("none"),this._position=new he(1,1),this._pluralityClass="",this.setPlurality(t),this._lastRenderedContent="",this._renderData=null}getDomNode(){return this._domNode}getPosition(){return this._position}setPlurality(e){switch(e){default:case v_.Single:this._pluralityClass="";break;case v_.MultiPrimary:this._pluralityClass="cursor-primary";break;case v_.MultiSecondary:this._pluralityClass="cursor-secondary";break}}show(){this._isVisible||(this._domNode.setVisibility("inherit"),this._isVisible=!0)}hide(){this._isVisible&&(this._domNode.setVisibility("hidden"),this._isVisible=!1)}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(50);return this._cursorStyle=t.get(28),this._lineHeight=t.get(67),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(31),this._typicalHalfwidthCharacterWidth),ta(this._domNode,i),!0}onCursorPositionChanged(e,t){return t?this._domNode.domNode.style.transitionProperty="none":this._domNode.domNode.style.transitionProperty="",this._position=e,!0}_getGraphemeAwarePosition(){const{lineNumber:e,column:t}=this._position,i=this._context.viewModel.getLineContent(e),[r,s]=f_t(i,t-1);return[new he(e,r+1),i.substring(r,s)]}_prepareRender(e){let t="",i="";const[r,s]=this._getGraphemeAwarePosition();if(this._cursorStyle===Yo.Line||this._cursorStyle===Yo.LineThin){const h=e.visibleRangeForPosition(r);if(!h||h.outsideRenderedLine)return null;const f=Ot(this._domNode.domNode);let g;this._cursorStyle===Yo.Line?(g=ebe(f,this._lineCursorWidth>0?this._lineCursorWidth:2),g>2&&(t=s,i=this._getTokenClassName(r))):g=ebe(f,1);let p=h.left,m=0;g>=2&&p>=1&&(m=1,p-=m);const _=e.getVerticalOffsetForLineNumber(r.lineNumber)-e.bigNumbersDelta;return new xwe(_,p,m,g,this._lineHeight,t,i)}const o=e.linesVisibleRangesForRange(new $(r.lineNumber,r.column,r.lineNumber,r.column+s.length),!1);if(!o||o.length===0)return null;const a=o[0];if(a.outsideRenderedLine||a.ranges.length===0)return null;const l=a.ranges[0],c=s===" "?this._typicalHalfwidthCharacterWidth:l.width<1?this._typicalHalfwidthCharacterWidth:l.width;this._cursorStyle===Yo.Block&&(t=s,i=this._getTokenClassName(r));let u=e.getVerticalOffsetForLineNumber(r.lineNumber)-e.bigNumbersDelta,d=this._lineHeight;return(this._cursorStyle===Yo.Underline||this._cursorStyle===Yo.UnderlineThin)&&(u+=this._lineHeight-2,d=2),new xwe(u,l.left,0,c,d,t,i)}_getTokenClassName(e){const t=this._context.viewModel.getViewLineData(e.lineNumber),i=t.tokens.findTokenIndexAtOffset(e.column-1);return t.tokens.getClassName(i)}prepareRender(e){this._renderData=this._prepareRender(e)}render(e){return this._renderData?(this._lastRenderedContent!==this._renderData.textContent&&(this._lastRenderedContent=this._renderData.textContent,this._domNode.domNode.textContent=this._lastRenderedContent),this._domNode.setClassName(`cursor ${this._pluralityClass} ${Ck} ${this._renderData.textContentClassName}`),this._domNode.setDisplay("block"),this._domNode.setTop(this._renderData.top),this._domNode.setLeft(this._renderData.left),this._domNode.setPaddingLeft(this._renderData.paddingLeft),this._domNode.setWidth(this._renderData.width),this._domNode.setLineHeight(this._renderData.height),this._domNode.setHeight(this._renderData.height),{domNode:this._domNode.domNode,position:this._position,contentLeft:this._renderData.left,height:this._renderData.height,width:2}):(this._domNode.setDisplay("none"),null)}}class g9 extends bu{static{this.BLINK_INTERVAL=500}constructor(e){super(e);const t=this._context.configuration.options;this._readOnly=t.get(92),this._cursorBlinking=t.get(26),this._cursorStyle=t.get(28),this._cursorSmoothCaretAnimation=t.get(27),this._selectionIsEmpty=!0,this._isComposingInput=!1,this._isVisible=!1,this._primaryCursor=new Swe(this._context,v_.Single),this._secondaryCursors=[],this._renderData=[],this._domNode=Ci(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._updateDomClassName(),this._domNode.appendChild(this._primaryCursor.getDomNode()),this._startCursorBlinkAnimation=new hf,this._cursorFlatBlinkInterval=new $ae,this._blinkingEnabled=!1,this._editorHasFocus=!1,this._updateBlinking()}dispose(){super.dispose(),this._startCursorBlinkAnimation.dispose(),this._cursorFlatBlinkInterval.dispose()}getDomNode(){return this._domNode}onCompositionStart(e){return this._isComposingInput=!0,this._updateBlinking(),!0}onCompositionEnd(e){return this._isComposingInput=!1,this._updateBlinking(),!0}onConfigurationChanged(e){const t=this._context.configuration.options;this._readOnly=t.get(92),this._cursorBlinking=t.get(26),this._cursorStyle=t.get(28),this._cursorSmoothCaretAnimation=t.get(27),this._updateBlinking(),this._updateDomClassName(),this._primaryCursor.onConfigurationChanged(e);for(let i=0,r=this._secondaryCursors.length;it.length){const s=this._secondaryCursors.length-t.length;for(let o=0;o{for(let r=0,s=e.ranges.length;r{this._isVisible?this._hide():this._show()},g9.BLINK_INTERVAL,Ot(this._domNode.domNode)):this._startCursorBlinkAnimation.setIfNotSet(()=>{this._blinkingEnabled=!0,this._updateDomClassName()},g9.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let e="cursors-layer";switch(this._selectionIsEmpty||(e+=" has-selection"),this._cursorStyle){case Yo.Line:e+=" cursor-line-style";break;case Yo.Block:e+=" cursor-block-style";break;case Yo.Underline:e+=" cursor-underline-style";break;case Yo.LineThin:e+=" cursor-line-thin-style";break;case Yo.BlockOutline:e+=" cursor-block-outline-style";break;case Yo.UnderlineThin:e+=" cursor-underline-thin-style";break;default:e+=" cursor-line-style"}if(this._blinkingEnabled)switch(this._getCursorBlinking()){case 1:e+=" cursor-blink";break;case 2:e+=" cursor-smooth";break;case 3:e+=" cursor-phase";break;case 4:e+=" cursor-expand";break;case 5:e+=" cursor-solid";break;default:e+=" cursor-solid"}else e+=" cursor-solid";return(this._cursorSmoothCaretAnimation==="on"||this._cursorSmoothCaretAnimation==="explicit")&&(e+=" cursor-smooth-caret-animation"),e}_show(){this._primaryCursor.show();for(let e=0,t=this._secondaryCursors.length;e{const t=[{class:".cursor",foreground:LW,background:Vle},{class:".cursor-primary",foreground:LFe,background:Okt},{class:".cursor-secondary",foreground:TFe,background:Mkt}];for(const i of t){const r=n.getColor(i.foreground);if(r){let s=n.getColor(i.background);s||(s=r.opposite()),e.addRule(`.monaco-editor .cursors-layer ${i.class} { background-color: ${r}; border-color: ${r}; color: ${s}; }`),mg(n.type)&&e.addRule(`.monaco-editor .cursors-layer.has-selection ${i.class} { border-left: 1px solid ${s}; border-right: 1px solid ${s}; }`)}}});const Tq=()=>{throw new Error("Invalid change accessor")};class fNt extends bu{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(146);this._lineHeight=t.get(67),this._contentWidth=i.contentWidth,this._contentLeft=i.contentLeft,this.domNode=Ci(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.marginDomNode=Ci(document.createElement("div")),this.marginDomNode.setClassName("margin-view-zones"),this.marginDomNode.setPosition("absolute"),this.marginDomNode.setAttribute("role","presentation"),this.marginDomNode.setAttribute("aria-hidden","true"),this._zones={}}dispose(){super.dispose(),this._zones={}}_recomputeWhitespacesProps(){const e=this._context.viewLayout.getWhitespaces(),t=new Map;for(const r of e)t.set(r.id,r);let i=!1;return this._context.viewModel.changeWhitespace(r=>{const s=Object.keys(this._zones);for(let o=0,a=s.length;o{const r={addZone:s=>(t=!0,this._addZone(i,s)),removeZone:s=>{s&&(t=this._removeZone(i,s)||t)},layoutZone:s=>{s&&(t=this._layoutZone(i,s)||t)}};gNt(e,r),r.addZone=Tq,r.removeZone=Tq,r.layoutZone=Tq}),t}_addZone(e,t){const i=this._computeWhitespaceProps(t),s={whitespaceId:e.insertWhitespace(i.afterViewLineNumber,this._getZoneOrdinal(t),i.heightInPx,i.minWidthInPx),delegate:t,isInHiddenArea:i.isInHiddenArea,isVisible:!1,domNode:Ci(t.domNode),marginDomNode:t.marginDomNode?Ci(t.marginDomNode):null};return this._safeCallOnComputedHeight(s.delegate,i.heightInPx),s.domNode.setPosition("absolute"),s.domNode.domNode.style.width="100%",s.domNode.setDisplay("none"),s.domNode.setAttribute("monaco-view-zone",s.whitespaceId),this.domNode.appendChild(s.domNode),s.marginDomNode&&(s.marginDomNode.setPosition("absolute"),s.marginDomNode.domNode.style.width="100%",s.marginDomNode.setDisplay("none"),s.marginDomNode.setAttribute("monaco-view-zone",s.whitespaceId),this.marginDomNode.appendChild(s.marginDomNode)),this._zones[s.whitespaceId]=s,this.setShouldRender(),s.whitespaceId}_removeZone(e,t){if(this._zones.hasOwnProperty(t)){const i=this._zones[t];return delete this._zones[t],e.removeWhitespace(i.whitespaceId),i.domNode.removeAttribute("monaco-visible-view-zone"),i.domNode.removeAttribute("monaco-view-zone"),i.domNode.domNode.remove(),i.marginDomNode&&(i.marginDomNode.removeAttribute("monaco-visible-view-zone"),i.marginDomNode.removeAttribute("monaco-view-zone"),i.marginDomNode.domNode.remove()),this.setShouldRender(),!0}return!1}_layoutZone(e,t){if(this._zones.hasOwnProperty(t)){const i=this._zones[t],r=this._computeWhitespaceProps(i.delegate);return i.isInHiddenArea=r.isInHiddenArea,e.changeOneWhitespace(i.whitespaceId,r.afterViewLineNumber,r.heightInPx),this._safeCallOnComputedHeight(i.delegate,r.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(e){return this._zones.hasOwnProperty(e)?!!this._zones[e].delegate.suppressMouseDown:!1}_heightInPixels(e){return typeof e.heightInPx=="number"?e.heightInPx:typeof e.heightInLines=="number"?this._lineHeight*e.heightInLines:this._lineHeight}_minWidthInPixels(e){return typeof e.minWidthInPx=="number"?e.minWidthInPx:0}_safeCallOnComputedHeight(e,t){if(typeof e.onComputedHeight=="function")try{e.onComputedHeight(t)}catch(i){rn(i)}}_safeCallOnDomNodeTop(e,t){if(typeof e.onDomNodeTop=="function")try{e.onDomNodeTop(t)}catch(i){rn(i)}}prepareRender(e){}render(e){const t=e.viewportData.whitespaceViewportData,i={};let r=!1;for(const o of t)this._zones[o.id].isInHiddenArea||(i[o.id]=o,r=!0);const s=Object.keys(this._zones);for(let o=0,a=s.length;oa)continue;const f=h.startLineNumber===a?h.startColumn:c.minColumn,g=h.endLineNumber===a?h.endColumn:c.maxColumn;f=O.endOffset&&(I++,O=i&&i[I]),G!==9&&G!==32||h&&!k&&B<=D)continue;if(d&&B>=L&&B<=D&&G===32){const z=B-1>=0?a.charCodeAt(B-1):0,q=B+1=0?a.charCodeAt(B-1):0;if(G===32&&z!==32&&z!==9)continue}if(i&&(!O||O.startOffset>B||O.endOffset<=B))continue;const W=e.visibleRangeForPosition(new he(t,B+1));W&&(o?(M=Math.max(M,W.left),G===9?x+=this._renderArrow(f,m,W.left):x+=``):G===9?x+=`
${C?"→":"→"}
`:x+=`
${String.fromCharCode(y)}
`)}return o?(M=Math.round(M+m),``+x+""):x}_renderArrow(e,t,i){const r=t/7,s=t,o=e/2,a=i,l={x:0,y:r/2},c={x:100/125*s,y:l.y},u={x:c.x-.2*c.x,y:c.y+.2*c.x},d={x:u.x+.1*c.x,y:u.y+.1*c.x},h={x:d.x+.35*c.x,y:d.y-.35*c.x},f={x:h.x,y:-h.y},g={x:d.x,y:-d.y},p={x:u.x,y:-u.y},m={x:c.x,y:-c.y},_={x:l.x,y:-l.y};return``}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}class kwe{constructor(e){const t=e.options,i=t.get(50),r=t.get(38);r==="off"?(this.renderWhitespace="none",this.renderWithSVG=!1):r==="svg"?(this.renderWhitespace=t.get(100),this.renderWithSVG=!0):(this.renderWhitespace=t.get(100),this.renderWithSVG=!1),this.spaceWidth=i.spaceWidth,this.middotWidth=i.middotWidth,this.wsmiddotWidth=i.wsmiddotWidth,this.canUseHalfwidthRightwardsArrow=i.canUseHalfwidthRightwardsArrow,this.lineHeight=t.get(67),this.stopRenderingLineAfter=t.get(118)}equals(e){return this.renderWhitespace===e.renderWhitespace&&this.renderWithSVG===e.renderWithSVG&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter}}class mNt{constructor(e,t,i,r){this.selections=e,this.startLineNumber=t.startLineNumber|0,this.endLineNumber=t.endLineNumber|0,this.relativeVerticalOffset=t.relativeVerticalOffset,this.bigNumbersDelta=t.bigNumbersDelta|0,this.lineHeight=t.lineHeight|0,this.whitespaceViewportData=i,this._model=r,this.visibleRange=new $(t.startLineNumber,this._model.getLineMinColumn(t.startLineNumber),t.endLineNumber,this._model.getLineMaxColumn(t.endLineNumber))}getViewLineRenderingData(e){return this._model.getViewportViewLineRenderingData(this.visibleRange,e)}getDecorationsInViewport(){return this._model.getDecorationsInViewport(this.visibleRange)}}class _Nt{get type(){return this._theme.type}get value(){return this._theme}constructor(e){this._theme=e}update(e){this._theme=e}getColor(e){return this._theme.getColor(e)}}class vNt{constructor(e,t,i){this.configuration=e,this.theme=new _Nt(t),this.viewModel=i,this.viewLayout=i.viewLayout}addEventHandler(e){this.viewModel.addViewEventHandler(e)}removeEventHandler(e){this.viewModel.removeViewEventHandler(e)}}var bNt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},yNt=function(n,e){return function(t,i){e(t,i,n)}};let MJ=class extends _O{constructor(e,t,i,r,s,o,a){super(),this._instantiationService=a,this._shouldRecomputeGlyphMarginLanes=!1,this._selections=[new yt(1,1,1,1)],this._renderAnimationFrame=null;const l=new TAt(t,r,s,e);this._context=new vNt(t,i,r),this._context.addEventHandler(this),this._viewParts=[],this._textAreaHandler=this._instantiationService.createInstance(NJ,this._context,l,this._createTextAreaHandlerHelper()),this._viewParts.push(this._textAreaHandler),this._linesContent=Ci(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=Ci(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._overflowGuardContainer=Ci(document.createElement("div")),Ig.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._scrollbar=new BAt(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new Hce(this._context,this._linesContent),this._viewZones=new fNt(this._context),this._viewParts.push(this._viewZones);const c=new rNt(this._context);this._viewParts.push(c);const u=new lNt(this._context);this._viewParts.push(u);const d=new IAt(this._context);this._viewParts.push(d),d.addDynamicOverlay(new OAt(this._context)),d.addDynamicOverlay(new jo(this._context)),d.addDynamicOverlay(new jAt(this._context)),d.addDynamicOverlay(new FAt(this._context)),d.addDynamicOverlay(new pNt(this._context));const h=new AAt(this._context);this._viewParts.push(h),h.addDynamicOverlay(new MAt(this._context)),h.addDynamicOverlay(new ZAt(this._context)),h.addDynamicOverlay(new YAt(this._context)),h.addDynamicOverlay(new UW(this._context)),this._glyphMarginWidgets=new HAt(this._context),this._viewParts.push(this._glyphMarginWidgets);const f=new qN(this._context);f.getDomNode().appendChild(this._viewZones.marginDomNode),f.getDomNode().appendChild(h.getDomNode()),f.getDomNode().appendChild(this._glyphMarginWidgets.domNode),this._viewParts.push(f),this._contentWidgets=new RAt(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new g9(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new nNt(this._context,this.domNode),this._viewParts.push(this._overlayWidgets);const g=new aNt(this._context);this._viewParts.push(g);const p=new NAt(this._context);this._viewParts.push(p);const m=new tNt(this._context);if(this._viewParts.push(m),c){const _=this._scrollbar.getOverviewRulerLayoutInfo();_.parent.insertBefore(c.getDomNode(),_.insertBefore)}this._linesContent.appendChild(d.getDomNode()),this._linesContent.appendChild(g.domNode),this._linesContent.appendChild(this._viewZones.domNode),this._linesContent.appendChild(this._viewLines.getDomNode()),this._linesContent.appendChild(this._contentWidgets.domNode),this._linesContent.appendChild(this._viewCursors.getDomNode()),this._overflowGuardContainer.appendChild(f.getDomNode()),this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode()),this._overflowGuardContainer.appendChild(u.getDomNode()),this._overflowGuardContainer.appendChild(this._textAreaHandler.textArea),this._overflowGuardContainer.appendChild(this._textAreaHandler.textAreaCover),this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode()),this._overflowGuardContainer.appendChild(m.getDomNode()),this._overflowGuardContainer.appendChild(p.domNode),this.domNode.appendChild(this._overflowGuardContainer),o?(o.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode),o.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode)):(this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode),this.domNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode)),this._applyLayout(),this._pointerHandler=this._register(new ZIt(this._context,l,this._createPointerHandlerHelper()))}_computeGlyphMarginLanes(){const e=this._context.viewModel.model,t=this._context.viewModel.glyphLanes;let i=[],r=0;i=i.concat(e.getAllMarginDecorations().map(s=>{const o=s.options.glyphMargin?.position??af.Center;return r=Math.max(r,s.range.endLineNumber),{range:s.range,lane:o,persist:s.options.glyphMargin?.persistLane}})),i=i.concat(this._glyphMarginWidgets.getWidgets().map(s=>{const o=e.validateRange(s.preference.range);return r=Math.max(r,o.endLineNumber),{range:o,lane:s.preference.lane}})),i.sort((s,o)=>$.compareRangesUsingStarts(s.range,o.range)),t.reset(r);for(const s of i)t.push(s.lane,s.range,s.persist);return t}_createPointerHandlerHelper(){return{viewDomNode:this.domNode.domNode,linesContentDomNode:this._linesContent.domNode,viewLinesDomNode:this._viewLines.getDomNode().domNode,focusTextArea:()=>{this.focus()},dispatchTextAreaEvent:e=>{this._textAreaHandler.textArea.domNode.dispatchEvent(e)},getLastRenderData:()=>{const e=this._viewCursors.getLastRenderData()||[],t=this._textAreaHandler.getLastRenderData();return new BIt(e,t)},renderNow:()=>{this.render(!0,!1)},shouldSuppressMouseDownOnViewZone:e=>this._viewZones.shouldSuppressMouseDownOnViewZone(e),shouldSuppressMouseDownOnWidget:e=>this._contentWidgets.shouldSuppressMouseDownOnWidget(e),getPositionFromDOMInfo:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getPositionFromDOMInfo(e,t)),visibleRangeForPosition:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(new he(e,t))),getLineWidth:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getLineWidth(e))}}_createTextAreaHandlerHelper(){return{visibleRangeForPosition:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(e))}}_applyLayout(){const t=this._context.configuration.options.get(146);this.domNode.setWidth(t.width),this.domNode.setHeight(t.height),this._overflowGuardContainer.setWidth(t.width),this._overflowGuardContainer.setHeight(t.height),this._linesContent.setWidth(16777216),this._linesContent.setHeight(16777216)}_getEditorClassName(){const e=this._textAreaHandler.isFocused()?" focused":"";return this._context.configuration.options.get(143)+" "+OX(this._context.theme.type)+e}handleEvents(e){super.handleEvents(e),this._scheduleRender()}onConfigurationChanged(e){return this.domNode.setClassName(this._getEditorClassName()),this._applyLayout(),!1}onCursorStateChanged(e){return this._selections=e.selections,!1}onDecorationsChanged(e){return e.affectsGlyphMargin&&(this._shouldRecomputeGlyphMarginLanes=!0),!1}onFocusChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}onThemeChanged(e){return this._context.theme.update(e.theme),this.domNode.setClassName(this._getEditorClassName()),!1}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove(),this._context.removeEventHandler(this),this._viewLines.dispose();for(const e of this._viewParts)e.dispose();super.dispose()}_scheduleRender(){if(this._store.isDisposed)throw new fi;if(this._renderAnimationFrame===null){const e=this._createCoordinatedRendering();this._renderAnimationFrame=zce.INSTANCE.scheduleCoordinatedRendering({window:Ot(this.domNode?.domNode),prepareRenderText:()=>{if(this._store.isDisposed)throw new fi;try{return e.prepareRenderText()}finally{this._renderAnimationFrame=null}},renderText:()=>{if(this._store.isDisposed)throw new fi;return e.renderText()},prepareRender:(t,i)=>{if(this._store.isDisposed)throw new fi;return e.prepareRender(t,i)},render:(t,i)=>{if(this._store.isDisposed)throw new fi;return e.render(t,i)}})}}_flushAccumulatedAndRenderNow(){const e=this._createCoordinatedRendering();Fv(()=>e.prepareRenderText());const t=Fv(()=>e.renderText());if(t){const[i,r]=t;Fv(()=>e.prepareRender(i,r)),Fv(()=>e.render(i,r))}}_getViewPartsToRender(){const e=[];let t=0;for(const i of this._viewParts)i.shouldRender()&&(e[t++]=i);return e}_createCoordinatedRendering(){return{prepareRenderText:()=>{if(this._shouldRecomputeGlyphMarginLanes){this._shouldRecomputeGlyphMarginLanes=!1;const e=this._computeGlyphMarginLanes();this._context.configuration.setGlyphMarginDecorationLaneCount(e.requiredLanes)}Mv.onRenderStart()},renderText:()=>{if(!this.domNode.domNode.isConnected)return null;let e=this._getViewPartsToRender();if(!this._viewLines.shouldRender()&&e.length===0)return null;const t=this._context.viewLayout.getLinesViewportData();this._context.viewModel.setViewport(t.startLineNumber,t.endLineNumber,t.centeredLineNumber);const i=new mNt(this._selections,t,this._context.viewLayout.getWhitespaceViewportData(),this._context.viewModel);return this._contentWidgets.shouldRender()&&this._contentWidgets.onBeforeRender(i),this._viewLines.shouldRender()&&(this._viewLines.renderText(i),this._viewLines.onDidRender(),e=this._getViewPartsToRender()),[e,new AIt(this._context.viewLayout,i,this._viewLines)]},prepareRender:(e,t)=>{for(const i of e)i.prepareRender(t)},render:(e,t)=>{for(const i of e)i.render(t),i.onDidRender()}}}delegateVerticalScrollbarPointerDown(e){this._scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this._scrollbar.delegateScrollFromMouseWheelEvent(e)}restoreState(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft},1),this._context.viewModel.visibleLinesStabilized()}getOffsetForColumn(e,t){const i=this._context.viewModel.model.validatePosition({lineNumber:e,column:t}),r=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i);this._flushAccumulatedAndRenderNow();const s=this._viewLines.visibleRangeForPosition(new he(r.lineNumber,r.column));return s?s.left:-1}getTargetAtClientPoint(e,t){const i=this._pointerHandler.getTargetAtClientPoint(e,t);return i?GW.convertViewToModelMouseTarget(i,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new oNt(this._context,e)}change(e){this._viewZones.changeViewZones(e),this._scheduleRender()}render(e,t){if(t){this._viewLines.forceShouldRender();for(const i of this._viewParts)i.forceShouldRender()}e?this._flushAccumulatedAndRenderNow():this._scheduleRender()}writeScreenReaderContent(e){this._textAreaHandler.writeScreenReaderContent(e)}focus(){this._textAreaHandler.focusTextArea()}isFocused(){return this._textAreaHandler.isFocused()}setAriaOptions(e){this._textAreaHandler.setAriaOptions(e)}addContentWidget(e){this._contentWidgets.addWidget(e.widget),this.layoutContentWidget(e),this._scheduleRender()}layoutContentWidget(e){this._contentWidgets.setWidgetPosition(e.widget,e.position?.position??null,e.position?.secondaryPosition??null,e.position?.preference??null,e.position?.positionAffinity??null),this._scheduleRender()}removeContentWidget(e){this._contentWidgets.removeWidget(e.widget),this._scheduleRender()}addOverlayWidget(e){this._overlayWidgets.addWidget(e.widget),this.layoutOverlayWidget(e),this._scheduleRender()}layoutOverlayWidget(e){this._overlayWidgets.setWidgetPosition(e.widget,e.position)&&this._scheduleRender()}removeOverlayWidget(e){this._overlayWidgets.removeWidget(e.widget),this._scheduleRender()}addGlyphMarginWidget(e){this._glyphMarginWidgets.addWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}layoutGlyphMarginWidget(e){const t=e.position;this._glyphMarginWidgets.setWidgetPosition(e.widget,t)&&(this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender())}removeGlyphMarginWidget(e){this._glyphMarginWidgets.removeWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}};MJ=bNt([yNt(6,Tt)],MJ);function Fv(n){try{return n()}catch(e){return rn(e),null}}class zce{static{this.INSTANCE=new zce}constructor(){this._coordinatedRenderings=[],this._animationFrameRunners=new Map}scheduleCoordinatedRendering(e){return this._coordinatedRenderings.push(e),this._scheduleRender(e.window),{dispose:()=>{const t=this._coordinatedRenderings.indexOf(e);if(t!==-1&&(this._coordinatedRenderings.splice(t,1),this._coordinatedRenderings.length===0)){for(const[i,r]of this._animationFrameRunners)r.dispose();this._animationFrameRunners.clear()}}}}_scheduleRender(e){if(!this._animationFrameRunners.has(e)){const t=()=>{this._animationFrameRunners.delete(e),this._onRenderScheduled()};this._animationFrameRunners.set(e,K6(e,t,100))}}_onRenderScheduled(){const e=this._coordinatedRenderings.slice(0);this._coordinatedRenderings=[];for(const i of e)Fv(()=>i.prepareRenderText());const t=[];for(let i=0,r=e.length;is.renderText())}for(let i=0,r=e.length;is.prepareRender(a,l))}for(let i=0,r=e.length;is.render(a,l))}}}class MI{constructor(e,t,i,r,s){this.injectionOffsets=e,this.injectionOptions=t,this.breakOffsets=i,this.breakOffsetsVisibleColumn=r,this.wrappedTextIndentLength=s}getOutputLineCount(){return this.breakOffsets.length}getMinOutputOffset(e){return e>0?this.wrappedTextIndentLength:0}getLineLength(e){const t=e>0?this.breakOffsets[e-1]:0;let r=this.breakOffsets[e]-t;return e>0&&(r+=this.wrappedTextIndentLength),r}getMaxOutputOffset(e){return this.getLineLength(e)}translateToInputOffset(e,t){e>0&&(t=Math.max(0,t-this.wrappedTextIndentLength));let r=e===0?t:this.breakOffsets[e-1]+t;if(this.injectionOffsets!==null)for(let s=0;sthis.injectionOffsets[s];s++)r0?this.breakOffsets[s-1]:0,t===0)if(e<=o)r=s-1;else if(e>l)i=s+1;else break;else if(e=l)i=s+1;else break}let a=e-o;return s>0&&(a+=this.wrappedTextIndentLength),new t3(s,a)}normalizeOutputPosition(e,t,i){if(this.injectionOffsets!==null){const r=this.outputPositionToOffsetInInputWithInjections(e,t),s=this.normalizeOffsetInInputWithInjectionsAroundInjections(r,i);if(s!==r)return this.offsetInInputWithInjectionsToOutputPosition(s,i)}if(i===0){if(e>0&&t===this.getMinOutputOffset(e))return new t3(e-1,this.getMaxOutputOffset(e-1))}else if(i===1){const r=this.getOutputLineCount()-1;if(e0&&(t=Math.max(0,t-this.wrappedTextIndentLength)),(e>0?this.breakOffsets[e-1]:0)+t}normalizeOffsetInInputWithInjectionsAroundInjections(e,t){const i=this.getInjectedTextAtOffset(e);if(!i)return e;if(t===2){if(e===i.offsetInInputWithInjections+i.length&&Ewe(this.injectionOptions[i.injectedTextIndex].cursorStops))return i.offsetInInputWithInjections+i.length;{let r=i.offsetInInputWithInjections;if(Lwe(this.injectionOptions[i.injectedTextIndex].cursorStops))return r;let s=i.injectedTextIndex-1;for(;s>=0&&this.injectionOffsets[s]===this.injectionOffsets[i.injectedTextIndex]&&!(Ewe(this.injectionOptions[s].cursorStops)||(r-=this.injectionOptions[s].content.length,Lwe(this.injectionOptions[s].cursorStops)));)s--;return r}}else if(t===1||t===4){let r=i.offsetInInputWithInjections+i.length,s=i.injectedTextIndex;for(;s+1=0&&this.injectionOffsets[s-1]===this.injectionOffsets[s];)r-=this.injectionOptions[s-1].content.length,s--;return r}Z$()}getInjectedText(e,t){const i=this.outputPositionToOffsetInInputWithInjections(e,t),r=this.getInjectedTextAtOffset(i);return r?{options:this.injectionOptions[r.injectedTextIndex]}:null}getInjectedTextAtOffset(e){const t=this.injectionOffsets,i=this.injectionOptions;if(t!==null){let r=0;for(let s=0;se)break;if(e<=l)return{injectedTextIndex:s,offsetInInputWithInjections:a,length:o};r+=o}}}}function Ewe(n){return n==null?!0:n===Kh.Right||n===Kh.Both}function Lwe(n){return n==null?!0:n===Kh.Left||n===Kh.Both}class t3{constructor(e,t){this.outputLineIndex=e,this.outputOffset=t}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(e){return new he(e+this.outputLineIndex,this.outputOffset+1)}}const wNt=p0("domLineBreaksComputer",{createHTML:n=>n});class Uce{static create(e){return new Uce(new WeakRef(e))}constructor(e){this.targetWindow=e}createLineBreaksComputer(e,t,i,r,s){const o=[],a=[];return{addRequest:(l,c,u)=>{o.push(l),a.push(c)},finalize:()=>CNt(Lv(this.targetWindow.deref()),o,e,t,i,r,s,a)}}}function CNt(n,e,t,i,r,s,o,a){function l(I){const O=a[I];if(O){const M=Lg.applyInjectedText(e[I],O),B=O.map(W=>W.options),G=O.map(W=>W.column-1);return new MI(G,B,[M.length],[],0)}else return null}if(r===-1){const I=[];for(let O=0,M=e.length;Oc?(M=0,B=0):G=c-q}const W=O.substr(M),z=xNt(W,B,i,G,g,h);p[I]=M,m[I]=B,_[I]=W,v[I]=z[0],y[I]=z[1]}const C=g.build(),x=wNt?.createHTML(C)??C;f.innerHTML=x,f.style.position="absolute",f.style.top="10000",o==="keepAll"?(f.style.wordBreak="keep-all",f.style.overflowWrap="anywhere"):(f.style.wordBreak="inherit",f.style.overflowWrap="break-word"),n.document.body.appendChild(f);const k=document.createRange(),L=Array.prototype.slice.call(f.children,0),D=[];for(let I=0;Ij.options),ee=Z.map(j=>j.column-1)):(q=null,ee=null),D[I]=new MI(ee,q,M,z,G)}return f.remove(),D}function xNt(n,e,t,i,r,s){if(s!==0){const h=String(s);r.appendString('
');const o=n.length;let a=e,l=0;const c=[],u=[];let d=0");for(let h=0;h"),c[h]=l,u[h]=a;const f=d;d=h+1"),c[n.length]=l,u[n.length]=a,r.appendString("
"),[c,u]}function SNt(n,e,t,i){if(t.length<=1)return null;const r=Array.prototype.slice.call(e.children,0),s=[];try{FJ(n,r,i,0,null,t.length-1,null,s)}catch(o){return console.log(o),null}return s.length===0?null:(s.push(t.length),s)}function FJ(n,e,t,i,r,s,o,a){if(i===s||(r=r||Dq(n,e,t[i],t[i+1]),o=o||Dq(n,e,t[s],t[s+1]),Math.abs(r[0].top-o[0].top)<=.1))return;if(i+1===s){a.push(s);return}const l=i+(s-i)/2|0,c=Dq(n,e,t[l],t[l+1]);FJ(n,e,t,i,r,l,c,a),FJ(n,e,t,l,c,s,o,a)}function Dq(n,e,t,i){return n.setStart(e[t/16384|0].firstChild,t%16384),n.setEnd(e[i/16384|0].firstChild,i%16384),n.getClientRects()}class kNt extends me{constructor(){super(),this._editor=null,this._instantiationService=null,this._instances=this._register(new yae),this._pending=new Map,this._finishedInstantiation=[],this._finishedInstantiation[0]=!1,this._finishedInstantiation[1]=!1,this._finishedInstantiation[2]=!1,this._finishedInstantiation[3]=!1}initialize(e,t,i){this._editor=e,this._instantiationService=i;for(const r of t){if(this._pending.has(r.id)){rn(new Error(`Cannot have two contributions with the same id ${r.id}`));continue}this._pending.set(r.id,r)}this._instantiateSome(0),this._register(xD(Ot(this._editor.getDomNode()),()=>{this._instantiateSome(1)})),this._register(xD(Ot(this._editor.getDomNode()),()=>{this._instantiateSome(2)})),this._register(xD(Ot(this._editor.getDomNode()),()=>{this._instantiateSome(3)},5e3))}saveViewState(){const e={};for(const[t,i]of this._instances)typeof i.saveViewState=="function"&&(e[t]=i.saveViewState());return e}restoreViewState(e){for(const[t,i]of this._instances)typeof i.restoreViewState=="function"&&i.restoreViewState(e[t])}get(e){return this._instantiateById(e),this._instances.get(e)||null}onBeforeInteractionEvent(){this._instantiateSome(2)}onAfterModelAttached(){return xD(Ot(this._editor?.getDomNode()),()=>{this._instantiateSome(1)},50)}_instantiateSome(e){if(this._finishedInstantiation[e])return;this._finishedInstantiation[e]=!0;const t=this._findPendingContributionsByInstantiation(e);for(const i of t)this._instantiateById(i.id)}_findPendingContributionsByInstantiation(e){const t=[];for(const[,i]of this._pending)i.instantiation===e&&t.push(i);return t}_instantiateById(e){const t=this._pending.get(e);if(t){if(this._pending.delete(e),!this._instantiationService||!this._editor)throw new Error("Cannot instantiate contributions before being initialized!");try{const i=this._instantiationService.createInstance(t.ctor,this._editor);this._instances.set(t.id,i),typeof i.restoreViewState=="function"&&t.instantiation!==0&&console.warn(`Editor contribution '${t.id}' should be eager instantiated because it uses saveViewState / restoreViewState.`)}catch(i){rn(i)}}}}class b8e{constructor(e,t,i,r,s,o,a){this.id=e,this.label=t,this.alias=i,this.metadata=r,this._precondition=s,this._run=o,this._contextKeyService=a}isSupported(){return this._contextKeyService.contextMatchesRules(this._precondition)}run(e){return this.isSupported()?this._run(e):Promise.resolve(void 0)}}class jce{static create(e){return new jce(e.get(135),e.get(134))}constructor(e,t){this.classifier=new ENt(e,t)}createLineBreaksComputer(e,t,i,r,s){const o=[],a=[],l=[];return{addRequest:(c,u,d)=>{o.push(c),a.push(u),l.push(d)},finalize:()=>{const c=e.typicalFullwidthCharacterWidth/e.typicalHalfwidthCharacterWidth,u=[];for(let d=0,h=o.length;d=0&&e<256?this._asciiMap[e]:e>=12352&&e<=12543||e>=13312&&e<=19903||e>=19968&&e<=40959?3:this._map.get(e)||this._defaultValue}}let BJ=[],$J=[];function LNt(n,e,t,i,r,s,o,a){if(r===-1)return null;const l=t.length;if(l<=1)return null;const c=a==="keepAll",u=e.breakOffsets,d=e.breakOffsetsVisibleColumn,h=y8e(t,i,r,s,o),f=r-h,g=BJ,p=$J;let m=0,_=0,v=0,y=r;const C=u.length;let x=0;if(x>=0){let k=Math.abs(d[x]-y);for(;x+1=k)break;k=L,x++}}for(;xk&&(k=_,L=v);let D=0,I=0,O=0,M=0;if(L<=y){let G=L,W=k===0?0:t.charCodeAt(k-1),z=k===0?0:n.get(W),q=!0;for(let ee=k;ee_&&WJ(W,z,j,te,c)&&(D=Z,I=G),G+=le,G>y){Z>_?(O=Z,M=G-le):(O=ee+1,M=G),G-I>f&&(D=0),q=!1;break}W=j,z=te}if(q){m>0&&(g[m]=u[u.length-1],p[m]=d[u.length-1],m++);break}}if(D===0){let G=L,W=t.charCodeAt(k),z=n.get(W),q=!1;for(let ee=k-1;ee>=_;ee--){const Z=ee+1,j=t.charCodeAt(ee);if(j===9){q=!0;break}let te,le;if(Tw(j)?(ee--,te=0,le=2):(te=n.get(j),le=xb(j)?s:1),G<=y){if(O===0&&(O=Z,M=G),G<=y-f)break;if(WJ(j,te,W,z,c)){D=Z,I=G;break}}G-=le,W=j,z=te}if(D!==0){const ee=f-(M-I);if(ee<=i){const Z=t.charCodeAt(O);let j;Co(Z)?j=2:j=FI(Z,M,i,s),ee-j<0&&(D=0)}}if(q){x--;continue}}if(D===0&&(D=O,I=M),D<=_){const G=t.charCodeAt(_);Co(G)?(D=_+2,I=v+2):(D=_+1,I=v+FI(G,v,i,s))}for(_=D,g[m]=D,v=I,p[m]=I,m++,y=I+f;x<0||x=B)break;B=G,x++}}return m===0?null:(g.length=m,p.length=m,BJ=e.breakOffsets,$J=e.breakOffsetsVisibleColumn,e.breakOffsets=g,e.breakOffsetsVisibleColumn=p,e.wrappedTextIndentLength=h,e)}function TNt(n,e,t,i,r,s,o,a){const l=Lg.applyInjectedText(e,t);let c,u;if(t&&t.length>0?(c=t.map(I=>I.options),u=t.map(I=>I.column-1)):(c=null,u=null),r===-1)return c?new MI(u,c,[l.length],[],0):null;const d=l.length;if(d<=1)return c?new MI(u,c,[l.length],[],0):null;const h=a==="keepAll",f=y8e(l,i,r,s,o),g=r-f,p=[],m=[];let _=0,v=0,y=0,C=r,x=l.charCodeAt(0),k=n.get(x),L=FI(x,0,i,s),D=1;Co(x)&&(L+=1,x=l.charCodeAt(1),k=n.get(x),D++);for(let I=D;IC&&((v===0||L-y>g)&&(v=O,y=L-G),p[_]=v,m[_]=y,_++,C=y+g,v=0),x=M,k=B}return _===0&&(!t||t.length===0)?null:(p[_]=d,m[_]=L,new MI(u,c,p,m,f))}function FI(n,e,t,i){return n===9?t-e%t:xb(n)||n<32?i:1}function Twe(n,e){return e-n%e}function WJ(n,e,t,i,r){return t!==32&&(e===2&&i!==2||e!==1&&i===1||!r&&e===3&&i!==2||!r&&i===3&&e!==1)}function y8e(n,e,t,i,r){let s=0;if(r!==0){const o=yl(n);if(o!==-1){for(let l=0;lt&&(s=0)}}return s}let Dwe=class w8e{constructor(e){this._selTrackedRange=null,this._trackSelection=!0,this._setState(e,new Ko(new $(1,1,1,1),0,0,new he(1,1),0),new Ko(new $(1,1,1,1),0,0,new he(1,1),0))}dispose(e){this._removeTrackedRange(e)}startTrackingSelection(e){this._trackSelection=!0,this._updateTrackedRange(e)}stopTrackingSelection(e){this._trackSelection=!1,this._removeTrackedRange(e)}_updateTrackedRange(e){this._trackSelection&&(this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,this.modelState.selection,0))}_removeTrackedRange(e){this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,null,0)}asCursorState(){return new ri(this.modelState,this.viewState)}readSelectionFromMarkers(e){const t=e.model._getTrackedRange(this._selTrackedRange);return this.modelState.selection.isEmpty()&&!t.isEmpty()?yt.fromRange(t.collapseToEnd(),this.modelState.selection.getDirection()):yt.fromRange(t,this.modelState.selection.getDirection())}ensureValidState(e){this._setState(e,this.modelState,this.viewState)}setState(e,t,i){this._setState(e,t,i)}static _validatePositionWithCache(e,t,i,r){return t.equals(i)?r:e.normalizePosition(t,2)}static _validateViewState(e,t){const i=t.position,r=t.selectionStart.getStartPosition(),s=t.selectionStart.getEndPosition(),o=e.normalizePosition(i,2),a=this._validatePositionWithCache(e,r,i,o),l=this._validatePositionWithCache(e,s,r,a);return i.equals(o)&&r.equals(a)&&s.equals(l)?t:new Ko($.fromPositions(a,l),t.selectionStartKind,t.selectionStartLeftoverVisibleColumns+r.column-a.column,o,t.leftoverVisibleColumns+i.column-o.column)}_setState(e,t,i){if(i&&(i=w8e._validateViewState(e.viewModel,i)),t){const r=e.model.validateRange(t.selectionStart),s=t.selectionStart.equalsRange(r)?t.selectionStartLeftoverVisibleColumns:0,o=e.model.validatePosition(t.position),a=t.position.equals(o)?t.leftoverVisibleColumns:0;t=new Ko(r,t.selectionStartKind,s,o,a)}else{if(!i)return;const r=e.model.validateRange(e.coordinatesConverter.convertViewRangeToModelRange(i.selectionStart)),s=e.model.validatePosition(e.coordinatesConverter.convertViewPositionToModelPosition(i.position));t=new Ko(r,i.selectionStartKind,i.selectionStartLeftoverVisibleColumns,s,i.leftoverVisibleColumns)}if(i){const r=e.coordinatesConverter.validateViewRange(i.selectionStart,t.selectionStart),s=e.coordinatesConverter.validateViewPosition(i.position,t.position);i=new Ko(r,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,s,t.leftoverVisibleColumns)}else{const r=e.coordinatesConverter.convertModelPositionToViewPosition(new he(t.selectionStart.startLineNumber,t.selectionStart.startColumn)),s=e.coordinatesConverter.convertModelPositionToViewPosition(new he(t.selectionStart.endLineNumber,t.selectionStart.endColumn)),o=new $(r.lineNumber,r.column,s.lineNumber,s.column),a=e.coordinatesConverter.convertModelPositionToViewPosition(t.position);i=new Ko(o,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,a,t.leftoverVisibleColumns)}this.modelState=t,this.viewState=i,this._updateTrackedRange(e)}};class Iwe{constructor(e){this.context=e,this.cursors=[new Dwe(e)],this.lastAddedCursorIndex=0}dispose(){for(const e of this.cursors)e.dispose(this.context)}startTrackingSelections(){for(const e of this.cursors)e.startTrackingSelection(this.context)}stopTrackingSelections(){for(const e of this.cursors)e.stopTrackingSelection(this.context)}updateContext(e){this.context=e}ensureValidState(){for(const e of this.cursors)e.ensureValidState(this.context)}readSelectionFromMarkers(){return this.cursors.map(e=>e.readSelectionFromMarkers(this.context))}getAll(){return this.cursors.map(e=>e.asCursorState())}getViewPositions(){return this.cursors.map(e=>e.viewState.position)}getTopMostViewPosition(){return Obt(this.cursors,$l(e=>e.viewState.position,he.compare)).viewState.position}getBottomMostViewPosition(){return Pbt(this.cursors,$l(e=>e.viewState.position,he.compare)).viewState.position}getSelections(){return this.cursors.map(e=>e.modelState.selection)}getViewSelections(){return this.cursors.map(e=>e.viewState.selection)}setSelections(e){this.setStates(ri.fromModelSelections(e))}getPrimaryCursor(){return this.cursors[0].asCursorState()}setStates(e){e!==null&&(this.cursors[0].setState(this.context,e[0].modelState,e[0].viewState),this._setSecondaryStates(e.slice(1)))}_setSecondaryStates(e){const t=this.cursors.length-1,i=e.length;if(ti){const r=t-i;for(let s=0;s=e+1&&this.lastAddedCursorIndex--,this.cursors[e+1].dispose(this.context),this.cursors.splice(e+1,1)}normalize(){if(this.cursors.length===1)return;const e=this.cursors.slice(0),t=[];for(let i=0,r=e.length;ii.selection,$.compareRangesUsingStarts));for(let i=0;id&&p.index--;e.splice(d,1),t.splice(u,1),this._removeSecondaryCursor(d-1),i--}}}}class Awe{constructor(e,t,i,r){this._cursorContextBrand=void 0,this.model=e,this.viewModel=t,this.coordinatesConverter=i,this.cursorConfig=r}}class DNt{constructor(){this.type=0}}class INt{constructor(){this.type=1}}class ANt{constructor(e){this.type=2,this._source=e}hasChanged(e){return this._source.hasChanged(e)}}class NNt{constructor(e,t,i){this.selections=e,this.modelSelections=t,this.reason=i,this.type=3}}class R1{constructor(e){this.type=4,e?(this.affectsMinimap=e.affectsMinimap,this.affectsOverviewRuler=e.affectsOverviewRuler,this.affectsGlyphMargin=e.affectsGlyphMargin,this.affectsLineNumber=e.affectsLineNumber):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0,this.affectsGlyphMargin=!0,this.affectsLineNumber=!0)}}class n3{constructor(){this.type=5}}class RNt{constructor(e){this.type=6,this.isFocused=e}}class PNt{constructor(){this.type=7}}class i3{constructor(){this.type=8}}class C8e{constructor(e,t){this.fromLineNumber=e,this.count=t,this.type=9}}class HJ{constructor(e,t){this.type=10,this.fromLineNumber=e,this.toLineNumber=t}}class VJ{constructor(e,t){this.type=11,this.fromLineNumber=e,this.toLineNumber=t}}class BI{constructor(e,t,i,r,s,o,a){this.source=e,this.minimalReveal=t,this.range=i,this.selections=r,this.verticalType=s,this.revealHorizontal=o,this.scrollType=a,this.type=12}}class ONt{constructor(e){this.type=13,this.scrollWidth=e.scrollWidth,this.scrollLeft=e.scrollLeft,this.scrollHeight=e.scrollHeight,this.scrollTop=e.scrollTop,this.scrollWidthChanged=e.scrollWidthChanged,this.scrollLeftChanged=e.scrollLeftChanged,this.scrollHeightChanged=e.scrollHeightChanged,this.scrollTopChanged=e.scrollTopChanged}}class MNt{constructor(e){this.theme=e,this.type=14}}class FNt{constructor(e){this.type=15,this.ranges=e}}class BNt{constructor(){this.type=16}}let $Nt=class{constructor(){this.type=17}};class WNt extends me{constructor(){super(),this._onEvent=this._register(new fe),this.onEvent=this._onEvent.event,this._eventHandlers=[],this._viewEventQueue=null,this._isConsumingViewEventQueue=!1,this._collector=null,this._collectorCnt=0,this._outgoingEvents=[]}emitOutgoingEvent(e){this._addOutgoingEvent(e),this._emitOutgoingEvents()}_addOutgoingEvent(e){for(let t=0,i=this._outgoingEvents.length;t0;){if(this._collector||this._isConsumingViewEventQueue)return;const e=this._outgoingEvents.shift();e.isNoOp()||this._onEvent.fire(e)}}addViewEventHandler(e){for(let t=0,i=this._eventHandlers.length;t0&&this._emitMany(t)}this._emitOutgoingEvents()}emitSingleViewEvent(e){try{this.beginEmitViewEvents().emitViewEvent(e)}finally{this.endEmitViewEvents()}}_emitMany(e){this._viewEventQueue?this._viewEventQueue=this._viewEventQueue.concat(e):this._viewEventQueue=e,this._isConsumingViewEventQueue||this._consumeViewEventQueue()}_consumeViewEventQueue(){try{this._isConsumingViewEventQueue=!0,this._doConsumeQueue()}finally{this._isConsumingViewEventQueue=!1}}_doConsumeQueue(){for(;this._viewEventQueue;){const e=this._viewEventQueue;this._viewEventQueue=null;const t=this._eventHandlers.slice(0);for(const i of t)i.handleEvents(e)}}}class HNt{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(e){this.viewEvents.push(e)}emitOutgoingEvent(e){this.outgoingEvents.push(e)}}class qce{constructor(e,t,i,r){this.kind=0,this._oldContentWidth=e,this._oldContentHeight=t,this.contentWidth=i,this.contentHeight=r,this.contentWidthChanged=this._oldContentWidth!==this.contentWidth,this.contentHeightChanged=this._oldContentHeight!==this.contentHeight}isNoOp(){return!this.contentWidthChanged&&!this.contentHeightChanged}attemptToMerge(e){return e.kind!==this.kind?null:new qce(this._oldContentWidth,this._oldContentHeight,e.contentWidth,e.contentHeight)}}class Kce{constructor(e,t){this.kind=1,this.oldHasFocus=e,this.hasFocus=t}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(e){return e.kind!==this.kind?null:new Kce(this.oldHasFocus,e.hasFocus)}}class Gce{constructor(e,t,i,r,s,o,a,l){this.kind=2,this._oldScrollWidth=e,this._oldScrollLeft=t,this._oldScrollHeight=i,this._oldScrollTop=r,this.scrollWidth=s,this.scrollLeft=o,this.scrollHeight=a,this.scrollTop=l,this.scrollWidthChanged=this._oldScrollWidth!==this.scrollWidth,this.scrollLeftChanged=this._oldScrollLeft!==this.scrollLeft,this.scrollHeightChanged=this._oldScrollHeight!==this.scrollHeight,this.scrollTopChanged=this._oldScrollTop!==this.scrollTop}isNoOp(){return!this.scrollWidthChanged&&!this.scrollLeftChanged&&!this.scrollHeightChanged&&!this.scrollTopChanged}attemptToMerge(e){return e.kind!==this.kind?null:new Gce(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,e.scrollWidth,e.scrollLeft,e.scrollHeight,e.scrollTop)}}class VNt{constructor(){this.kind=3}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}}class zNt{constructor(){this.kind=4}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}}class p9{constructor(e,t,i,r,s,o,a){this.kind=6,this.oldSelections=e,this.selections=t,this.oldModelVersionId=i,this.modelVersionId=r,this.source=s,this.reason=o,this.reachedMaxCursorCount=a}static _selectionsAreEqual(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;const i=e.length,r=t.length;if(i!==r)return!1;for(let s=0;s0){const e=this._cursors.getSelections();for(let t=0;to&&(r=r.slice(0,o),s=!0);const a=$I.from(this._model,this);return this._cursors.setStates(r),this._cursors.normalize(),this._columnSelectData=null,this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,t,i,a,s)}setCursorColumnSelectData(e){this._columnSelectData=e}revealAll(e,t,i,r,s,o){const a=this._cursors.getViewPositions();let l=null,c=null;a.length>1?c=this._cursors.getViewSelections():l=$.fromPositions(a[0],a[0]),e.emitViewEvent(new BI(t,i,l,c,r,s,o))}revealPrimary(e,t,i,r,s,o){const l=[this._cursors.getPrimaryCursor().viewState.selection];e.emitViewEvent(new BI(t,i,null,l,r,s,o))}saveState(){const e=[],t=this._cursors.getSelections();for(let i=0,r=t.length;i0){const s=ri.fromModelSelections(i.resultingSelection);this.setStates(e,"modelChange",i.isUndoing?5:i.isRedoing?6:2,s)&&this.revealAll(e,"modelChange",!1,0,!0,0)}else{const s=this._cursors.readSelectionFromMarkers();this.setStates(e,"modelChange",2,ri.fromModelSelections(s))}}}getSelection(){return this._cursors.getPrimaryCursor().modelState.selection}getTopMostViewPosition(){return this._cursors.getTopMostViewPosition()}getBottomMostViewPosition(){return this._cursors.getBottomMostViewPosition()}getCursorColumnSelectData(){if(this._columnSelectData)return this._columnSelectData;const e=this._cursors.getPrimaryCursor(),t=e.viewState.selectionStart.getStartPosition(),i=e.viewState.position;return{isReal:!1,fromViewLineNumber:t.lineNumber,fromViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,t),toViewLineNumber:i.lineNumber,toViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,i)}}getSelections(){return this._cursors.getSelections()}setSelections(e,t,i,r){this.setStates(e,t,r,ri.fromModelSelections(i))}getPrevEditOperationType(){return this._prevEditOperationType}setPrevEditOperationType(e){this._prevEditOperationType=e}_pushAutoClosedAction(e,t){const i=[],r=[];for(let a=0,l=e.length;a0&&this._pushAutoClosedAction(i,r),this._prevEditOperationType=e.type}e.shouldPushStackElementAfter&&this._model.pushStackElement()}_interpretCommandResult(e){(!e||e.length===0)&&(e=this._cursors.readSelectionFromMarkers()),this._columnSelectData=null,this._cursors.setSelections(e),this._cursors.normalize()}_emitStateChangedIfNecessary(e,t,i,r,s){const o=$I.from(this._model,this);if(o.equals(r))return!1;const a=this._cursors.getSelections(),l=this._cursors.getViewSelections();if(e.emitViewEvent(new NNt(l,a,i)),!r||r.cursorState.length!==o.cursorState.length||o.cursorState.some((c,u)=>!c.modelState.equals(r.cursorState[u].modelState))){const c=r?r.cursorState.map(d=>d.modelState.selection):null,u=r?r.modelVersionId:0;e.emitOutgoingEvent(new p9(c,a,u,o.modelVersionId,t||"keyboard",i,s))}return!0}_findAutoClosingPairs(e){if(!e.length)return null;const t=[];for(let i=0,r=e.length;i=0)return null;const o=s.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);if(!o)return null;const a=o[1],l=this.context.cursorConfig.autoClosingPairs.autoClosingPairsCloseSingleChar.get(a);if(!l||l.length!==1)return null;const c=l[0].open,u=s.text.length-o[2].length-1,d=s.text.lastIndexOf(c,u-1);if(d===-1)return null;t.push([d,u])}return t}executeEdits(e,t,i,r){let s=null;t==="snippet"&&(s=this._findAutoClosingPairs(i)),s&&(i[0]._isTracked=!0);const o=[],a=[],l=this._model.pushEditOperations(this.getSelections(),i,c=>{if(s)for(let d=0,h=s.length;d0&&this._pushAutoClosedAction(o,a)}_executeEdit(e,t,i,r=0){if(this.context.cursorConfig.readOnly)return;const s=$I.from(this._model,this);this._cursors.stopTrackingSelections(),this._isHandling=!0;try{this._cursors.ensureValidState(),e()}catch(o){rn(o)}this._isHandling=!1,this._cursors.startTrackingSelections(),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(t,i,r,s,!1)&&this.revealAll(t,i,!1,0,!0,0)}getAutoClosedCharacters(){return Nwe.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(e){this._compositionState=new WI(this._model,this.getSelections())}endComposition(e,t){const i=this._compositionState?this._compositionState.deduceOutcome(this._model,this.getSelections()):null;this._compositionState=null,this._executeEdit(()=>{t==="keyboard"&&this._executeEditOperation(bv.compositionEndWithInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,i,this.getSelections(),this.getAutoClosedCharacters()))},e,t)}type(e,t,i){this._executeEdit(()=>{if(i==="keyboard"){const r=t.length;let s=0;for(;s{const c=l.getPosition();return new yt(c.lineNumber,c.column+s,c.lineNumber,c.column+s)});this.setSelections(e,o,a,0)}return}this._executeEdit(()=>{this._executeEditOperation(bv.compositionType(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),t,i,r,s))},e,o)}paste(e,t,i,r,s){this._executeEdit(()=>{this._executeEditOperation(bv.paste(this.context.cursorConfig,this._model,this.getSelections(),t,i,r||[]))},e,s,4)}cut(e,t){this._executeEdit(()=>{this._executeEditOperation(Hw.cut(this.context.cursorConfig,this._model,this.getSelections()))},e,t)}executeCommand(e,t,i){this._executeEdit(()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new Tc(0,[t],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}))},e,i)}executeCommands(e,t,i){this._executeEdit(()=>{this._executeEditOperation(new Tc(0,t,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}))},e,i)}}class $I{static from(e,t){return new $I(e.getVersionId(),t.getCursorStates())}constructor(e,t){this.modelVersionId=e,this.cursorState=t}equals(e){if(!e||this.modelVersionId!==e.modelVersionId||this.cursorState.length!==e.cursorState.length)return!1;for(let t=0,i=this.cursorState.length;t=t.length||!t[i].strictContainsRange(e[i]))return!1;return!0}}class QNt{static executeCommands(e,t,i){const r={model:e,selectionsBefore:t,trackedRanges:[],trackedRangesDirection:[]},s=this._innerExecuteCommands(r,i);for(let o=0,a=r.trackedRanges.length;o0&&(o[0]._isTracked=!0);let a=e.model.pushEditOperations(e.selectionsBefore,o,c=>{const u=[];for(let f=0;ff.identifier.minor-g.identifier.minor,h=[];for(let f=0;f0?(u[f].sort(d),h[f]=t[f].computeCursorState(e.model,{getInverseEditOperations:()=>u[f],getTrackedSelection:g=>{const p=parseInt(g,10),m=e.model._getTrackedRange(e.trackedRanges[p]);return e.trackedRangesDirection[p]===0?new yt(m.startLineNumber,m.startColumn,m.endLineNumber,m.endColumn):new yt(m.endLineNumber,m.endColumn,m.startLineNumber,m.startColumn)}})):h[f]=e.selectionsBefore[f];return h});a||(a=e.selectionsBefore);const l=[];for(const c in s)s.hasOwnProperty(c)&&l.push(parseInt(c,10));l.sort((c,u)=>u-c);for(const c of l)a.splice(c,1);return a}static _arrayIsEmpty(e){for(let t=0,i=e.length;t{$.isEmpty(d)&&h===""||r.push({identifier:{major:t,minor:s++},range:d,text:h,forceMoveMarkers:f,isAutoWhitespaceEdit:i.insertsAutoWhitespace})};let a=!1;const u={addEditOperation:o,addTrackedEditOperation:(d,h,f)=>{a=!0,o(d,h,f)},trackSelection:(d,h)=>{const f=yt.liftSelection(d);let g;if(f.isEmpty())if(typeof h=="boolean")h?g=2:g=3;else{const _=e.model.getLineMaxColumn(f.startLineNumber);f.startColumn===_?g=2:g=3}else g=1;const p=e.trackedRanges.length,m=e.model._setTrackedRange(null,f,g);return e.trackedRanges[p]=m,e.trackedRangesDirection[p]=f.getDirection(),p.toString()}};try{i.getEditOperations(e.model,u)}catch(d){return rn(d),{operations:[],hadTrackedEditOperation:!1}}return{operations:r,hadTrackedEditOperation:a}}static _getLoserCursorMap(e){e=e.slice(0),e.sort((i,r)=>-$.compareRangesUsingEnds(i.range,r.range));const t={};for(let i=1;is.identifier.major?o=r.identifier.major:o=s.identifier.major,t[o.toString()]=!0;for(let a=0;a0&&i--}}return t}}class JNt{constructor(e,t,i){this.text=e,this.startSelection=t,this.endSelection=i}}class WI{static _capture(e,t){const i=[];for(const r of t){if(r.startLineNumber!==r.endLineNumber)return null;i.push(new JNt(e.getLineContent(r.startLineNumber),r.startColumn-1,r.endColumn-1))}return i}constructor(e,t){this._original=WI._capture(e,t)}deduceOutcome(e,t){if(!this._original)return null;const i=WI._capture(e,t);if(!i||this._original.length!==i.length)return null;const r=[];for(let s=0,o=this._original.length;s>>1;t===e[o].afterLineNumber?i{t=!0,r=r|0,s=s|0,o=o|0,a=a|0;const l=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new tRt(l,r,s,o,a)),l},changeOneWhitespace:(r,s,o)=>{t=!0,s=s|0,o=o|0,this._pendingChanges.change({id:r,newAfterLineNumber:s,newHeight:o})},removeWhitespace:r=>{t=!0,this._pendingChanges.remove({id:r})}})}finally{this._pendingChanges.commit(this)}return t}_commitPendingChanges(e,t,i){if((e.length>0||i.length>0)&&(this._minWidth=-1),e.length+t.length+i.length<=1){for(const l of e)this._insertWhitespace(l);for(const l of t)this._changeOneWhitespace(l.id,l.newAfterLineNumber,l.newHeight);for(const l of i){const c=this._findWhitespaceIndex(l.id);c!==-1&&this._removeWhitespace(c)}return}const r=new Set;for(const l of i)r.add(l.id);const s=new Map;for(const l of t)s.set(l.id,l);const o=l=>{const c=[];for(const u of l)if(!r.has(u.id)){if(s.has(u.id)){const d=s.get(u.id);u.afterLineNumber=d.newAfterLineNumber,u.height=d.newHeight}c.push(u)}return c},a=o(this._arr).concat(o(e));a.sort((l,c)=>l.afterLineNumber===c.afterLineNumber?l.ordinal-c.ordinal:l.afterLineNumber-c.afterLineNumber),this._arr=a,this._prefixSumValidIndex=-1}_checkPendingChanges(){this._pendingChanges.mustCommit()&&this._pendingChanges.commit(this)}_insertWhitespace(e){const t=zJ.findInsertionIndex(this._arr,e.afterLineNumber,e.ordinal);this._arr.splice(t,0,e),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,t-1)}_findWhitespaceIndex(e){const t=this._arr;for(let i=0,r=t.length;it&&(this._arr[i].afterLineNumber-=t-e+1)}}onLinesInserted(e,t){this._checkPendingChanges(),e=e|0,t=t|0,this._lineCount+=t-e+1;for(let i=0,r=this._arr.length;i=t.length||t[a+1].afterLineNumber>=e)return a;i=a+1|0}else r=a-1|0}return-1}_findFirstWhitespaceAfterLineNumber(e){e=e|0;const i=this._findLastWhitespaceBeforeLineNumber(e)+1;return i1?i=this._lineHeight*(e-1):i=0;const r=this.getWhitespaceAccumulatedHeightBeforeLineNumber(e-(t?1:0));return i+r+this._paddingTop}getVerticalOffsetAfterLineNumber(e,t=!1){this._checkPendingChanges(),e=e|0;const i=this._lineHeight*e,r=this.getWhitespaceAccumulatedHeightBeforeLineNumber(e+(t?1:0));return i+r+this._paddingTop}getWhitespaceMinWidth(){if(this._checkPendingChanges(),this._minWidth===-1){let e=0;for(let t=0,i=this._arr.length;tt}isInTopPadding(e){return this._paddingTop===0?!1:(this._checkPendingChanges(),e=t-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(e){if(this._checkPendingChanges(),e=e|0,e<0)return 1;const t=this._lineCount|0,i=this._lineHeight;let r=1,s=t;for(;r=a+i)r=o+1;else{if(e>=a)return o;s=o}}return r>t?t:r}getLinesViewportData(e,t){this._checkPendingChanges(),e=e|0,t=t|0;const i=this._lineHeight,r=this.getLineNumberAtOrAfterVerticalOffset(e)|0,s=this.getVerticalOffsetForLineNumber(r)|0;let o=this._lineCount|0,a=this.getFirstWhitespaceIndexAfterLineNumber(r)|0;const l=this.getWhitespacesCount()|0;let c,u;a===-1?(a=l,u=o+1,c=0):(u=this.getAfterLineNumberForWhitespaceIndex(a)|0,c=this.getHeightForWhitespaceIndex(a)|0);let d=s,h=d;const f=5e5;let g=0;s>=f&&(g=Math.floor(s/f)*f,g=Math.floor(g/i)*i,h-=g);const p=[],m=e+(t-e)/2;let _=-1;for(let x=r;x<=o;x++){if(_===-1){const k=d,L=d+i;(k<=m&&mm)&&(_=x)}for(d+=i,p[x-r]=h,h+=i;u===x;)h+=c,d+=c,a++,a>=l?u=o+1:(u=this.getAfterLineNumberForWhitespaceIndex(a)|0,c=this.getHeightForWhitespaceIndex(a)|0);if(d>=t){o=x;break}}_===-1&&(_=o);const v=this.getVerticalOffsetForLineNumber(o)|0;let y=r,C=o;return yt&&C--,{bigNumbersDelta:g,startLineNumber:r,endLineNumber:o,relativeVerticalOffset:p,centeredLineNumber:_,completelyVisibleStartLineNumber:y,completelyVisibleEndLineNumber:C,lineHeight:this._lineHeight}}getVerticalOffsetForWhitespaceIndex(e){this._checkPendingChanges(),e=e|0;const t=this.getAfterLineNumberForWhitespaceIndex(e);let i;t>=1?i=this._lineHeight*t:i=0;let r;return e>0?r=this.getWhitespacesAccumulatedHeight(e-1):r=0,i+r+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(e){this._checkPendingChanges(),e=e|0;let t=0,i=this.getWhitespacesCount()-1;if(i<0)return-1;const r=this.getVerticalOffsetForWhitespaceIndex(i),s=this.getHeightForWhitespaceIndex(i);if(e>=r+s)return-1;for(;t=a+l)t=o+1;else{if(e>=a)return o;i=o}}return t}getWhitespaceAtVerticalOffset(e){this._checkPendingChanges(),e=e|0;const t=this.getWhitespaceIndexAtOrAfterVerticallOffset(e);if(t<0||t>=this.getWhitespacesCount())return null;const i=this.getVerticalOffsetForWhitespaceIndex(t);if(i>e)return null;const r=this.getHeightForWhitespaceIndex(t),s=this.getIdForWhitespaceIndex(t),o=this.getAfterLineNumberForWhitespaceIndex(t);return{id:s,afterLineNumber:o,verticalOffset:i,height:r}}getWhitespaceViewportData(e,t){this._checkPendingChanges(),e=e|0,t=t|0;const i=this.getWhitespaceIndexAtOrAfterVerticallOffset(e),r=this.getWhitespacesCount()-1;if(i<0)return[];const s=[];for(let o=i;o<=r;o++){const a=this.getVerticalOffsetForWhitespaceIndex(o),l=this.getHeightForWhitespaceIndex(o);if(a>=t)break;s.push({id:this.getIdForWhitespaceIndex(o),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(o),verticalOffset:a,height:l})}return s}getWhitespaces(){return this._checkPendingChanges(),this._arr.slice(0)}getWhitespacesCount(){return this._checkPendingChanges(),this._arr.length}getIdForWhitespaceIndex(e){return this._checkPendingChanges(),e=e|0,this._arr[e].id}getAfterLineNumberForWhitespaceIndex(e){return this._checkPendingChanges(),e=e|0,this._arr[e].afterLineNumber}getHeightForWhitespaceIndex(e){return this._checkPendingChanges(),e=e|0,this._arr[e].height}};const iRt=125;class OD{constructor(e,t,i,r){e=e|0,t=t|0,i=i|0,r=r|0,e<0&&(e=0),t<0&&(t=0),i<0&&(i=0),r<0&&(r=0),this.width=e,this.contentWidth=t,this.scrollWidth=Math.max(e,t),this.height=i,this.contentHeight=r,this.scrollHeight=Math.max(i,r)}equals(e){return this.width===e.width&&this.contentWidth===e.contentWidth&&this.height===e.height&&this.contentHeight===e.contentHeight}}class rRt extends me{constructor(e,t){super(),this._onDidContentSizeChange=this._register(new fe),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._dimensions=new OD(0,0,0,0),this._scrollable=this._register(new t2({forceIntegerValues:!0,smoothScrollDuration:e,scheduleAtNextAnimationFrame:t})),this.onDidScroll=this._scrollable.onScroll}getScrollable(){return this._scrollable}setSmoothScrollDuration(e){this._scrollable.setSmoothScrollDuration(e)}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}getScrollDimensions(){return this._dimensions}setScrollDimensions(e){if(this._dimensions.equals(e))return;const t=this._dimensions;this._dimensions=e,this._scrollable.setScrollDimensions({width:e.width,scrollWidth:e.scrollWidth,height:e.height,scrollHeight:e.scrollHeight},!0);const i=t.contentWidth!==e.contentWidth,r=t.contentHeight!==e.contentHeight;(i||r)&&this._onDidContentSizeChange.fire(new qce(t.contentWidth,t.contentHeight,e.contentWidth,e.contentHeight))}getFutureScrollPosition(){return this._scrollable.getFutureScrollPosition()}getCurrentScrollPosition(){return this._scrollable.getCurrentScrollPosition()}setScrollPositionNow(e){this._scrollable.setScrollPositionNow(e)}setScrollPositionSmooth(e){this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}}class sRt extends me{constructor(e,t,i){super(),this._configuration=e;const r=this._configuration.options,s=r.get(146),o=r.get(84);this._linesLayout=new nRt(t,r.get(67),o.top,o.bottom),this._maxLineWidth=0,this._overlayWidgetsMinWidth=0,this._scrollable=this._register(new rRt(0,i)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new OD(s.contentWidth,0,s.height,0)),this.onDidScroll=this._scrollable.onDidScroll,this.onDidContentSizeChange=this._scrollable.onDidContentSizeChange,this._updateHeight()}dispose(){super.dispose()}getScrollable(){return this._scrollable.getScrollable()}onHeightMaybeChanged(){this._updateHeight()}_configureSmoothScrollDuration(){this._scrollable.setSmoothScrollDuration(this._configuration.options.get(115)?iRt:0)}onConfigurationChanged(e){const t=this._configuration.options;if(e.hasChanged(67)&&this._linesLayout.setLineHeight(t.get(67)),e.hasChanged(84)){const i=t.get(84);this._linesLayout.setPadding(i.top,i.bottom)}if(e.hasChanged(146)){const i=t.get(146),r=i.contentWidth,s=i.height,o=this._scrollable.getScrollDimensions(),a=o.contentWidth;this._scrollable.setScrollDimensions(new OD(r,o.contentWidth,s,this._getContentHeight(r,s,a)))}else this._updateHeight();e.hasChanged(115)&&this._configureSmoothScrollDuration()}onFlushed(e){this._linesLayout.onFlushed(e)}onLinesDeleted(e,t){this._linesLayout.onLinesDeleted(e,t)}onLinesInserted(e,t){this._linesLayout.onLinesInserted(e,t)}_getHorizontalScrollbarHeight(e,t){const r=this._configuration.options.get(104);return r.horizontal===2||e>=t?0:r.horizontalScrollbarSize}_getContentHeight(e,t,i){const r=this._configuration.options;let s=this._linesLayout.getLinesTotalHeight();return r.get(106)?s+=Math.max(0,t-r.get(67)-r.get(84).bottom):r.get(104).ignoreHorizontalScrollbarInContentHeight||(s+=this._getHorizontalScrollbarHeight(e,i)),s}_updateHeight(){const e=this._scrollable.getScrollDimensions(),t=e.width,i=e.height,r=e.contentWidth;this._scrollable.setScrollDimensions(new OD(t,e.contentWidth,i,this._getContentHeight(t,i,r)))}getCurrentViewport(){const e=this._scrollable.getScrollDimensions(),t=this._scrollable.getCurrentScrollPosition();return new nwe(t.scrollTop,t.scrollLeft,e.width,e.height)}getFutureViewport(){const e=this._scrollable.getScrollDimensions(),t=this._scrollable.getFutureScrollPosition();return new nwe(t.scrollTop,t.scrollLeft,e.width,e.height)}_computeContentWidth(){const e=this._configuration.options,t=this._maxLineWidth,i=e.get(147),r=e.get(50),s=e.get(146);if(i.isViewportWrapping){const o=e.get(73);return t>s.contentWidth+r.typicalHalfwidthCharacterWidth&&o.enabled&&o.side==="right"?t+s.verticalScrollbarWidth:t}else{const o=e.get(105)*r.typicalHalfwidthCharacterWidth,a=this._linesLayout.getWhitespaceMinWidth();return Math.max(t+o+s.verticalScrollbarWidth,a,this._overlayWidgetsMinWidth)}}setMaxLineWidth(e){this._maxLineWidth=e,this._updateContentWidth()}setOverlayWidgetsMinWidth(e){this._overlayWidgetsMinWidth=e,this._updateContentWidth()}_updateContentWidth(){const e=this._scrollable.getScrollDimensions();this._scrollable.setScrollDimensions(new OD(e.width,this._computeContentWidth(),e.height,e.contentHeight)),this._updateHeight()}saveState(){const e=this._scrollable.getFutureScrollPosition(),t=e.scrollTop,i=this._linesLayout.getLineNumberAtOrAfterVerticalOffset(t),r=this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(i);return{scrollTop:t,scrollTopWithoutViewZones:t-r,scrollLeft:e.scrollLeft}}changeWhitespace(e){const t=this._linesLayout.changeWhitespace(e);return t&&this.onHeightMaybeChanged(),t}getVerticalOffsetForLineNumber(e,t=!1){return this._linesLayout.getVerticalOffsetForLineNumber(e,t)}getVerticalOffsetAfterLineNumber(e,t=!1){return this._linesLayout.getVerticalOffsetAfterLineNumber(e,t)}isAfterLines(e){return this._linesLayout.isAfterLines(e)}isInTopPadding(e){return this._linesLayout.isInTopPadding(e)}isInBottomPadding(e){return this._linesLayout.isInBottomPadding(e)}getLineNumberAtVerticalOffset(e){return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(e)}getWhitespaceAtVerticalOffset(e){return this._linesLayout.getWhitespaceAtVerticalOffset(e)}getLinesViewportData(){const e=this.getCurrentViewport();return this._linesLayout.getLinesViewportData(e.top,e.top+e.height)}getLinesViewportDataAtScrollTop(e){const t=this._scrollable.getScrollDimensions();return e+t.height>t.scrollHeight&&(e=t.scrollHeight-t.height),e<0&&(e=0),this._linesLayout.getLinesViewportData(e,e+t.height)}getWhitespaceViewportData(){const e=this.getCurrentViewport();return this._linesLayout.getWhitespaceViewportData(e.top,e.top+e.height)}getWhitespaces(){return this._linesLayout.getWhitespaces()}getContentWidth(){return this._scrollable.getScrollDimensions().contentWidth}getScrollWidth(){return this._scrollable.getScrollDimensions().scrollWidth}getContentHeight(){return this._scrollable.getScrollDimensions().contentHeight}getScrollHeight(){return this._scrollable.getScrollDimensions().scrollHeight}getCurrentScrollLeft(){return this._scrollable.getCurrentScrollPosition().scrollLeft}getCurrentScrollTop(){return this._scrollable.getCurrentScrollPosition().scrollTop}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}setScrollPosition(e,t){t===1?this._scrollable.setScrollPositionNow(e):this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}deltaScrollNow(e,t){const i=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollLeft:i.scrollLeft+e,scrollTop:i.scrollTop+t})}}class oRt{constructor(e,t,i,r,s){this.editorId=e,this.model=t,this.configuration=i,this._linesCollection=r,this._coordinatesConverter=s,this._decorationsCache=Object.create(null),this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}_clearCachedModelDecorationsResolver(){this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}dispose(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}reset(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}onModelDecorationsChanged(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}onLineMappingChanged(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}_getOrCreateViewModelDecoration(e){const t=e.id;let i=this._decorationsCache[t];if(!i){const r=e.range,s=e.options;let o;if(s.isWholeLine){const a=this._coordinatesConverter.convertModelPositionToViewPosition(new he(r.startLineNumber,1),0,!1,!0),l=this._coordinatesConverter.convertModelPositionToViewPosition(new he(r.endLineNumber,this.model.getLineMaxColumn(r.endLineNumber)),1);o=new $(a.lineNumber,a.column,l.lineNumber,l.column)}else o=this._coordinatesConverter.convertModelRangeToViewRange(r,1);i=new J6e(o,s),this._decorationsCache[t]=i}return i}getMinimapDecorationsInRange(e){return this._getDecorationsInRange(e,!0,!1).decorations}getDecorationsViewportData(e){let t=this._cachedModelDecorationsResolver!==null;return t=t&&e.equalsRange(this._cachedModelDecorationsResolverViewRange),t||(this._cachedModelDecorationsResolver=this._getDecorationsInRange(e,!1,!1),this._cachedModelDecorationsResolverViewRange=e),this._cachedModelDecorationsResolver}getInlineDecorationsOnLine(e,t=!1,i=!1){const r=new $(e,this._linesCollection.getViewLineMinColumn(e),e,this._linesCollection.getViewLineMaxColumn(e));return this._getDecorationsInRange(r,t,i).inlineDecorations[0]}_getDecorationsInRange(e,t,i){const r=this._linesCollection.getDecorationsInRange(e,this.editorId,R6(this.configuration.options),t,i),s=e.startLineNumber,o=e.endLineNumber,a=[];let l=0;const c=[];for(let u=s;u<=o;u++)c[u-s]=[];for(let u=0,d=r.length;ut===1)}function Xce(n,e){return x8e(n,e.range,t=>t===2)}function x8e(n,e,t){for(let i=e.startLineNumber;i<=e.endLineNumber;i++){const r=n.tokenization.getLineTokens(i),s=i===e.startLineNumber,o=i===e.endLineNumber;let a=s?r.findTokenIndexAtOffset(e.startColumn-1):0;for(;ae.endColumn-1);){if(!t(r.getStandardTokenType(a)))return!1;a++}}return!0}function Iq(n,e){return n===null?e?XW.INSTANCE:QW.INSTANCE:new aRt(n,e)}class aRt{constructor(e,t){this._projectionData=e,this._isVisible=t}isVisible(){return this._isVisible}setVisible(e){return this._isVisible=e,this}getProjectionData(){return this._projectionData}getViewLineCount(){return this._isVisible?this._projectionData.getOutputLineCount():0}getViewLineContent(e,t,i){this._assertVisible();const r=i>0?this._projectionData.breakOffsets[i-1]:0,s=this._projectionData.breakOffsets[i];let o;if(this._projectionData.injectionOffsets!==null){const a=this._projectionData.injectionOffsets.map((c,u)=>new Lg(0,0,c+1,this._projectionData.injectionOptions[u],0));o=Lg.applyInjectedText(e.getLineContent(t),a).substring(r,s)}else o=e.getValueInRange({startLineNumber:t,startColumn:r+1,endLineNumber:t,endColumn:s+1});return i>0&&(o=Rwe(this._projectionData.wrappedTextIndentLength)+o),o}getViewLineLength(e,t,i){return this._assertVisible(),this._projectionData.getLineLength(i)}getViewLineMinColumn(e,t,i){return this._assertVisible(),this._projectionData.getMinOutputOffset(i)+1}getViewLineMaxColumn(e,t,i){return this._assertVisible(),this._projectionData.getMaxOutputOffset(i)+1}getViewLineData(e,t,i){const r=new Array;return this.getViewLinesData(e,t,i,1,0,[!0],r),r[0]}getViewLinesData(e,t,i,r,s,o,a){this._assertVisible();const l=this._projectionData,c=l.injectionOffsets,u=l.injectionOptions;let d=null;if(c){d=[];let f=0,g=0;for(let p=0;p0?l.breakOffsets[p-1]:0,v=l.breakOffsets[p];for(;gv)break;if(_0?l.wrappedTextIndentLength:0,D=L+Math.max(C-_,0),I=L+Math.min(x-_,v-_);D!==I&&m.push(new JDt(D,I,k.inlineClassName,k.inlineClassNameAffectsLetterSpacing))}}if(x<=v)f+=y,g++;else break}}}let h;c?h=e.tokenization.getLineTokens(t).withInserted(c.map((f,g)=>({offset:f,text:u[g].content,tokenMetadata:Fs.defaultTokenMetadata}))):h=e.tokenization.getLineTokens(t);for(let f=i;f0?r.wrappedTextIndentLength:0,o=i>0?r.breakOffsets[i-1]:0,a=r.breakOffsets[i],l=e.sliceAndInflate(o,a,s);let c=l.getLineContent();i>0&&(c=Rwe(r.wrappedTextIndentLength)+c);const u=this._projectionData.getMinOutputOffset(i)+1,d=c.length+1,h=i+1=Aq.length)for(let e=1;e<=n;e++)Aq[e]=lRt(e);return Aq[n]}function lRt(n){return new Array(n+1).join(" ")}class cRt{constructor(e,t,i,r,s,o,a,l,c,u){this._editorId=e,this.model=t,this._validModelVersionId=-1,this._domLineBreaksComputerFactory=i,this._monospaceLineBreaksComputerFactory=r,this.fontInfo=s,this.tabSize=o,this.wrappingStrategy=a,this.wrappingColumn=l,this.wrappingIndent=c,this.wordBreak=u,this._constructLines(!0,null)}dispose(){this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[])}createCoordinatesConverter(){return new dRt(this)}_constructLines(e,t){this.modelLineProjections=[],e&&(this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[]));const i=this.model.getLinesContent(),r=this.model.getInjectedTextDecorations(this._editorId),s=i.length,o=this.createLineBreaksComputer(),a=new q_(Lg.fromDecorations(r));for(let p=0;p_.lineNumber===p+1);o.addRequest(i[p],m,t?t[p]:null)}const l=o.finalize(),c=[],u=this.hiddenAreasDecorationIds.map(p=>this.model.getDecorationRange(p)).sort($.compareRangesUsingStarts);let d=1,h=0,f=-1,g=f+1=d&&m<=h,v=Iq(l[p],!_);c[p]=v.getViewLineCount(),this.modelLineProjections[p]=v}this._validModelVersionId=this.model.getVersionId(),this.projectedModelLineLineCounts=new b1t(c)}getHiddenAreas(){return this.hiddenAreasDecorationIds.map(e=>this.model.getDecorationRange(e))}setHiddenAreas(e){const t=e.map(h=>this.model.validateRange(h)),i=uRt(t),r=this.hiddenAreasDecorationIds.map(h=>this.model.getDecorationRange(h)).sort($.compareRangesUsingStarts);if(i.length===r.length){let h=!1;for(let f=0;f({range:h,options:un.EMPTY}));this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,s);const o=i;let a=1,l=0,c=-1,u=c+1=a&&f<=l?this.modelLineProjections[h].isVisible()&&(this.modelLineProjections[h]=this.modelLineProjections[h].setVisible(!1),g=!0):(d=!0,this.modelLineProjections[h].isVisible()||(this.modelLineProjections[h]=this.modelLineProjections[h].setVisible(!0),g=!0)),g){const p=this.modelLineProjections[h].getViewLineCount();this.projectedModelLineLineCounts.setValue(h,p)}}return d||this.setHiddenAreas([]),!0}modelPositionIsVisible(e,t){return e<1||e>this.modelLineProjections.length?!1:this.modelLineProjections[e-1].isVisible()}getModelLineViewLineCount(e){return e<1||e>this.modelLineProjections.length?1:this.modelLineProjections[e-1].getViewLineCount()}setTabSize(e){return this.tabSize===e?!1:(this.tabSize=e,this._constructLines(!1,null),!0)}setWrappingSettings(e,t,i,r,s){const o=this.fontInfo.equals(e),a=this.wrappingStrategy===t,l=this.wrappingColumn===i,c=this.wrappingIndent===r,u=this.wordBreak===s;if(o&&a&&l&&c&&u)return!1;const d=o&&a&&!l&&c&&u;this.fontInfo=e,this.wrappingStrategy=t,this.wrappingColumn=i,this.wrappingIndent=r,this.wordBreak=s;let h=null;if(d){h=[];for(let f=0,g=this.modelLineProjections.length;f2&&!this.modelLineProjections[t-2].isVisible(),o=t===1?1:this.projectedModelLineLineCounts.getPrefixSum(t-1)+1;let a=0;const l=[],c=[];for(let u=0,d=r.length;ul?(u=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,d=u+l-1,g=d+1,p=g+(s-l)-1,c=!0):st?t:e|0}getActiveIndentGuide(e,t,i){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t),i=this._toValidViewLineNumber(i);const r=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),s=this.convertViewPositionToModelPosition(t,this.getViewLineMinColumn(t)),o=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),a=this.model.guides.getActiveIndentGuide(r.lineNumber,s.lineNumber,o.lineNumber),l=this.convertModelPositionToViewPosition(a.startLineNumber,1),c=this.convertModelPositionToViewPosition(a.endLineNumber,this.model.getLineMaxColumn(a.endLineNumber));return{startLineNumber:l.lineNumber,endLineNumber:c.lineNumber,indent:a.indent}}getViewLineInfo(e){e=this._toValidViewLineNumber(e);const t=this.projectedModelLineLineCounts.getIndexOf(e-1),i=t.index,r=t.remainder;return new Pwe(i+1,r)}getMinColumnOfViewLine(e){return this.modelLineProjections[e.modelLineNumber-1].getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getMaxColumnOfViewLine(e){return this.modelLineProjections[e.modelLineNumber-1].getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getModelStartPositionOfViewLine(e){const t=this.modelLineProjections[e.modelLineNumber-1],i=t.getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx),r=t.getModelColumnOfViewPosition(e.modelLineWrappedLineIdx,i);return new he(e.modelLineNumber,r)}getModelEndPositionOfViewLine(e){const t=this.modelLineProjections[e.modelLineNumber-1],i=t.getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx),r=t.getModelColumnOfViewPosition(e.modelLineWrappedLineIdx,i);return new he(e.modelLineNumber,r)}getViewLineInfosGroupedByModelRanges(e,t){const i=this.getViewLineInfo(e),r=this.getViewLineInfo(t),s=new Array;let o=this.getModelStartPositionOfViewLine(i),a=new Array;for(let l=i.modelLineNumber;l<=r.modelLineNumber;l++){const c=this.modelLineProjections[l-1];if(c.isVisible()){const u=l===i.modelLineNumber?i.modelLineWrappedLineIdx:0,d=l===r.modelLineNumber?r.modelLineWrappedLineIdx+1:c.getViewLineCount();for(let h=u;h{if(f.forWrappedLinesAfterColumn!==-1&&this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,f.forWrappedLinesAfterColumn).lineNumber>=u.modelLineWrappedLineIdx||f.forWrappedLinesBeforeOrAtColumn!==-1&&this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,f.forWrappedLinesBeforeOrAtColumn).lineNumberu.modelLineWrappedLineIdx)return}const p=this.convertModelPositionToViewPosition(u.modelLineNumber,f.horizontalLine.endColumn),m=this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,f.horizontalLine.endColumn);return m.lineNumber===u.modelLineWrappedLineIdx?new Ny(f.visibleColumn,g,f.className,new xI(f.horizontalLine.top,p.column),-1,-1):m.lineNumber!!f))}}return o}getViewLinesIndentGuides(e,t){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);const i=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),r=this.convertViewPositionToModelPosition(t,this.getViewLineMaxColumn(t));let s=[];const o=[],a=[],l=i.lineNumber-1,c=r.lineNumber-1;let u=null;for(let g=l;g<=c;g++){const p=this.modelLineProjections[g];if(p.isVisible()){const m=p.getViewLineNumberOfModelPosition(0,g===l?i.column:1),_=p.getViewLineNumberOfModelPosition(0,this.model.getLineMaxColumn(g+1)),v=_-m+1;let y=0;v>1&&p.getViewLineMinColumn(this.model,g+1,_)===1&&(y=m===0?1:2),o.push(v),a.push(y),u===null&&(u=new he(g+1,0))}else u!==null&&(s=s.concat(this.model.guides.getLinesIndentGuides(u.lineNumber,g)),u=null)}u!==null&&(s=s.concat(this.model.guides.getLinesIndentGuides(u.lineNumber,r.lineNumber)),u=null);const d=t-e+1,h=new Array(d);let f=0;for(let g=0,p=s.length;gt&&(g=!0,f=t-s+1),d.getViewLinesData(this.model,c+1,h,f,s-e,i,l),s+=f,g)break}return l}validateViewPosition(e,t,i){e=this._toValidViewLineNumber(e);const r=this.projectedModelLineLineCounts.getIndexOf(e-1),s=r.index,o=r.remainder,a=this.modelLineProjections[s],l=a.getViewLineMinColumn(this.model,s+1,o),c=a.getViewLineMaxColumn(this.model,s+1,o);tc&&(t=c);const u=a.getModelColumnOfViewPosition(o,t);return this.model.validatePosition(new he(s+1,u)).equals(i)?new he(e,t):this.convertModelPositionToViewPosition(i.lineNumber,i.column)}validateViewRange(e,t){const i=this.validateViewPosition(e.startLineNumber,e.startColumn,t.getStartPosition()),r=this.validateViewPosition(e.endLineNumber,e.endColumn,t.getEndPosition());return new $(i.lineNumber,i.column,r.lineNumber,r.column)}convertViewPositionToModelPosition(e,t){const i=this.getViewLineInfo(e),r=this.modelLineProjections[i.modelLineNumber-1].getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return this.model.validatePosition(new he(i.modelLineNumber,r))}convertViewRangeToModelRange(e){const t=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),i=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);return new $(t.lineNumber,t.column,i.lineNumber,i.column)}convertModelPositionToViewPosition(e,t,i=2,r=!1,s=!1){const o=this.model.validatePosition(new he(e,t)),a=o.lineNumber,l=o.column;let c=a-1,u=!1;if(s)for(;c0&&!this.modelLineProjections[c].isVisible();)c--,u=!0;if(c===0&&!this.modelLineProjections[c].isVisible())return new he(r?0:1,1);const d=1+this.projectedModelLineLineCounts.getPrefixSum(c);let h;return u?s?h=this.modelLineProjections[c].getViewPositionOfModelPosition(d,1,i):h=this.modelLineProjections[c].getViewPositionOfModelPosition(d,this.model.getLineMaxColumn(c+1),i):h=this.modelLineProjections[a-1].getViewPositionOfModelPosition(d,l,i),h}convertModelRangeToViewRange(e,t=0){if(e.isEmpty()){const i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,t);return $.fromPositions(i)}else{const i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,1),r=this.convertModelPositionToViewPosition(e.endLineNumber,e.endColumn,0);return new $(i.lineNumber,i.column,r.lineNumber,r.column)}}getViewLineNumberOfModelPosition(e,t){let i=e-1;if(this.modelLineProjections[i].isVisible()){const s=1+this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections[i].getViewLineNumberOfModelPosition(s,t)}for(;i>0&&!this.modelLineProjections[i].isVisible();)i--;if(i===0&&!this.modelLineProjections[i].isVisible())return 1;const r=1+this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections[i].getViewLineNumberOfModelPosition(r,this.model.getLineMaxColumn(i+1))}getDecorationsInRange(e,t,i,r,s){const o=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),a=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);if(a.lineNumber-o.lineNumber<=e.endLineNumber-e.startLineNumber)return this.model.getDecorationsInRange(new $(o.lineNumber,1,a.lineNumber,a.column),t,i,r,s);let l=[];const c=o.lineNumber-1,u=a.lineNumber-1;let d=null;for(let p=c;p<=u;p++)if(this.modelLineProjections[p].isVisible())d===null&&(d=new he(p+1,p===c?o.column:1));else if(d!==null){const _=this.model.getLineMaxColumn(p);l=l.concat(this.model.getDecorationsInRange(new $(d.lineNumber,d.column,p,_),t,i,r)),d=null}d!==null&&(l=l.concat(this.model.getDecorationsInRange(new $(d.lineNumber,d.column,a.lineNumber,a.column),t,i,r)),d=null),l.sort((p,m)=>{const _=$.compareRangesUsingStarts(p.range,m.range);return _===0?p.idm.id?1:0:_});const h=[];let f=0,g=null;for(const p of l){const m=p.id;g!==m&&(g=m,h[f++]=p)}return h}getInjectedTextAt(e){const t=this.getViewLineInfo(e.lineNumber);return this.modelLineProjections[t.modelLineNumber-1].getInjectedTextAt(t.modelLineWrappedLineIdx,e.column)}normalizePosition(e,t){const i=this.getViewLineInfo(e.lineNumber);return this.modelLineProjections[i.modelLineNumber-1].normalizePosition(i.modelLineWrappedLineIdx,e,t)}getLineIndentColumn(e){const t=this.getViewLineInfo(e);return t.modelLineWrappedLineIdx===0?this.model.getLineIndentColumn(t.modelLineNumber):0}}function uRt(n){if(n.length===0)return[];const e=n.slice();e.sort($.compareRangesUsingStarts);const t=[];let i=e[0].startLineNumber,r=e[0].endLineNumber;for(let s=1,o=e.length;sr+1?(t.push(new $(i,1,r,1)),i=a.startLineNumber,r=a.endLineNumber):a.endLineNumber>r&&(r=a.endLineNumber)}return t.push(new $(i,1,r,1)),t}class Pwe{constructor(e,t){this.modelLineNumber=e,this.modelLineWrappedLineIdx=t}}class Owe{constructor(e,t){this.modelRange=e,this.viewLines=t}}class dRt{constructor(e){this._lines=e}convertViewPositionToModelPosition(e){return this._lines.convertViewPositionToModelPosition(e.lineNumber,e.column)}convertViewRangeToModelRange(e){return this._lines.convertViewRangeToModelRange(e)}validateViewPosition(e,t){return this._lines.validateViewPosition(e.lineNumber,e.column,t)}validateViewRange(e,t){return this._lines.validateViewRange(e,t)}convertModelPositionToViewPosition(e,t,i,r){return this._lines.convertModelPositionToViewPosition(e.lineNumber,e.column,t,i,r)}convertModelRangeToViewRange(e,t){return this._lines.convertModelRangeToViewRange(e,t)}modelPositionIsVisible(e){return this._lines.modelPositionIsVisible(e.lineNumber,e.column)}getModelLineViewLineCount(e){return this._lines.getModelLineViewLineCount(e)}getViewLineNumberOfModelPosition(e,t){return this._lines.getViewLineNumberOfModelPosition(e,t)}}class hRt{constructor(e){this.model=e}dispose(){}createCoordinatesConverter(){return new fRt(this)}getHiddenAreas(){return[]}setHiddenAreas(e){return!1}setTabSize(e){return!1}setWrappingSettings(e,t,i,r){return!1}createLineBreaksComputer(){const e=[];return{addRequest:(t,i,r)=>{e.push(null)},finalize:()=>e}}onModelFlushed(){}onModelLinesDeleted(e,t,i){return new HJ(t,i)}onModelLinesInserted(e,t,i,r){return new VJ(t,i)}onModelLineChanged(e,t,i){return[!1,new C8e(t,1),null,null]}acceptVersionId(e){}getViewLineCount(){return this.model.getLineCount()}getActiveIndentGuide(e,t,i){return{startLineNumber:e,endLineNumber:e,indent:0}}getViewLinesBracketGuides(e,t,i){return new Array(t-e+1).fill([])}getViewLinesIndentGuides(e,t){const i=t-e+1,r=new Array(i);for(let s=0;st)}getModelLineViewLineCount(e){return 1}getViewLineNumberOfModelPosition(e,t){return e}}const P1=af.Right;class gRt{constructor(e){this.persist=0,this._requiredLanes=1,this.lanes=new Uint8Array(Math.ceil((e+1)*P1/8))}reset(e){const t=Math.ceil((e+1)*P1/8);this.lanes.length>>3]|=1<>>3]&1<>>3]&1<this._updateConfigurationViewLineCountNow(),0)),this._hasFocus=!1,this._viewportStart=Qce.create(this.model),this.glyphLanes=new gRt(0),this.model.isTooLargeForTokenization())this._lines=new hRt(this.model);else{const d=this._configuration.options,h=d.get(50),f=d.get(140),g=d.get(147),p=d.get(139),m=d.get(130);this._lines=new cRt(this._editorId,this.model,r,s,h,this.model.getOptions().tabSize,f,g.wrappingColumn,p,m)}this.coordinatesConverter=this._lines.createCoordinatesConverter(),this._cursor=this._register(new XNt(i,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new sRt(this._configuration,this.getLineCount(),o)),this._register(this.viewLayout.onDidScroll(d=>{d.scrollTopChanged&&this._handleVisibleLinesChanged(),d.scrollTopChanged&&this._viewportStart.invalidate(),this._eventDispatcher.emitSingleViewEvent(new ONt(d)),this._eventDispatcher.emitOutgoingEvent(new Gce(d.oldScrollWidth,d.oldScrollLeft,d.oldScrollHeight,d.oldScrollTop,d.scrollWidth,d.scrollLeft,d.scrollHeight,d.scrollTop))})),this._register(this.viewLayout.onDidContentSizeChange(d=>{this._eventDispatcher.emitOutgoingEvent(d)})),this._decorations=new oRt(this._editorId,this.model,this._configuration,this._lines,this.coordinatesConverter),this._registerModelEvents(),this._register(this._configuration.onDidChangeFast(d=>{try{const h=this._eventDispatcher.beginEmitViewEvents();this._onConfigurationChanged(h,d)}finally{this._eventDispatcher.endEmitViewEvents()}})),this._register(YW.getInstance().onDidChange(()=>{this._eventDispatcher.emitSingleViewEvent(new BNt)})),this._register(this._themeService.onDidColorThemeChange(d=>{this._invalidateDecorationsColorCache(),this._eventDispatcher.emitSingleViewEvent(new MNt(d))})),this._updateConfigurationViewLineCountNow()}dispose(){super.dispose(),this._decorations.dispose(),this._lines.dispose(),this._viewportStart.dispose(),this._eventDispatcher.dispose()}createLineBreaksComputer(){return this._lines.createLineBreaksComputer()}addViewEventHandler(e){this._eventDispatcher.addViewEventHandler(e)}removeViewEventHandler(e){this._eventDispatcher.removeViewEventHandler(e)}_updateConfigurationViewLineCountNow(){this._configuration.setViewLineCount(this._lines.getViewLineCount())}getModelVisibleRanges(){const e=this.viewLayout.getLinesViewportData(),t=new $(e.startLineNumber,this.getLineMinColumn(e.startLineNumber),e.endLineNumber,this.getLineMaxColumn(e.endLineNumber));return this._toModelVisibleRanges(t)}visibleLinesStabilized(){const e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!0)}_handleVisibleLinesChanged(){const e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!1)}setHasFocus(e){this._hasFocus=e,this._cursor.setHasFocus(e),this._eventDispatcher.emitSingleViewEvent(new RNt(e)),this._eventDispatcher.emitOutgoingEvent(new Kce(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new DNt)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new INt)}_captureStableViewport(){if(this._viewportStart.isValid&&this.viewLayout.getCurrentScrollTop()>0){const e=new he(this._viewportStart.viewLineNumber,this.getLineMinColumn(this._viewportStart.viewLineNumber)),t=this.coordinatesConverter.convertViewPositionToModelPosition(e);return new Fwe(t,this._viewportStart.startLineDelta)}return new Fwe(null,0)}_onConfigurationChanged(e,t){const i=this._captureStableViewport(),r=this._configuration.options,s=r.get(50),o=r.get(140),a=r.get(147),l=r.get(139),c=r.get(130);this._lines.setWrappingSettings(s,o,a.wrappingColumn,l,c)&&(e.emitViewEvent(new n3),e.emitViewEvent(new i3),e.emitViewEvent(new R1(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount()),this._updateConfigurationViewLineCount.schedule()),t.hasChanged(92)&&(this._decorations.reset(),e.emitViewEvent(new R1(null))),t.hasChanged(99)&&(this._decorations.reset(),e.emitViewEvent(new R1(null))),e.emitViewEvent(new ANt(t)),this.viewLayout.onConfigurationChanged(t),i.recoverViewportStart(this.coordinatesConverter,this.viewLayout),_x.shouldRecreate(t)&&(this.cursorConfig=new _x(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig))}_registerModelEvents(){this._register(this.model.onDidChangeContentOrInjectedText(e=>{try{const i=this._eventDispatcher.beginEmitViewEvents();let r=!1,s=!1;const o=e instanceof Jy?e.rawContentChangedEvent.changes:e.changes,a=e instanceof Jy?e.rawContentChangedEvent.versionId:null,l=this._lines.createLineBreaksComputer();for(const d of o)switch(d.changeType){case 4:{for(let h=0;h!p.ownerId||p.ownerId===this._editorId)),l.addRequest(f,g,null)}break}case 2:{let h=null;d.injectedText&&(h=d.injectedText.filter(f=>!f.ownerId||f.ownerId===this._editorId)),l.addRequest(d.detail,h,null);break}}const c=l.finalize(),u=new q_(c);for(const d of o)switch(d.changeType){case 1:{this._lines.onModelFlushed(),i.emitViewEvent(new n3),this._decorations.reset(),this.viewLayout.onFlushed(this.getLineCount()),r=!0;break}case 3:{const h=this._lines.onModelLinesDeleted(a,d.fromLineNumber,d.toLineNumber);h!==null&&(i.emitViewEvent(h),this.viewLayout.onLinesDeleted(h.fromLineNumber,h.toLineNumber)),r=!0;break}case 4:{const h=u.takeCount(d.detail.length),f=this._lines.onModelLinesInserted(a,d.fromLineNumber,d.toLineNumber,h);f!==null&&(i.emitViewEvent(f),this.viewLayout.onLinesInserted(f.fromLineNumber,f.toLineNumber)),r=!0;break}case 2:{const h=u.dequeue(),[f,g,p,m]=this._lines.onModelLineChanged(a,d.lineNumber,h);s=f,g&&i.emitViewEvent(g),p&&(i.emitViewEvent(p),this.viewLayout.onLinesInserted(p.fromLineNumber,p.toLineNumber)),m&&(i.emitViewEvent(m),this.viewLayout.onLinesDeleted(m.fromLineNumber,m.toLineNumber));break}case 5:break}a!==null&&this._lines.acceptVersionId(a),this.viewLayout.onHeightMaybeChanged(),!r&&s&&(i.emitViewEvent(new i3),i.emitViewEvent(new R1(null)),this._cursor.onLineMappingChanged(i),this._decorations.onLineMappingChanged())}finally{this._eventDispatcher.endEmitViewEvents()}const t=this._viewportStart.isValid;if(this._viewportStart.invalidate(),this._configuration.setModelLineCount(this.model.getLineCount()),this._updateConfigurationViewLineCountNow(),!this._hasFocus&&this.model.getAttachedEditorCount()>=2&&t){const i=this.model._getTrackedRange(this._viewportStart.modelTrackedRange);if(i){const r=this.coordinatesConverter.convertModelPositionToViewPosition(i.getStartPosition()),s=this.viewLayout.getVerticalOffsetForLineNumber(r.lineNumber);this.viewLayout.setScrollPosition({scrollTop:s+this._viewportStart.startLineDelta},1)}}try{const i=this._eventDispatcher.beginEmitViewEvents();e instanceof Jy&&i.emitOutgoingEvent(new GNt(e.contentChangedEvent)),this._cursor.onModelContentChanged(i,e)}finally{this._eventDispatcher.endEmitViewEvents()}this._handleVisibleLinesChanged()})),this._register(this.model.onDidChangeTokens(e=>{const t=[];for(let i=0,r=e.ranges.length;i{this._eventDispatcher.emitSingleViewEvent(new PNt),this.cursorConfig=new _x(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new KNt(e))})),this._register(this.model.onDidChangeLanguage(e=>{this.cursorConfig=new _x(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new qNt(e))})),this._register(this.model.onDidChangeOptions(e=>{if(this._lines.setTabSize(this.model.getOptions().tabSize)){try{const t=this._eventDispatcher.beginEmitViewEvents();t.emitViewEvent(new n3),t.emitViewEvent(new i3),t.emitViewEvent(new R1(null)),this._cursor.onLineMappingChanged(t),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}this.cursorConfig=new _x(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new YNt(e))})),this._register(this.model.onDidChangeDecorations(e=>{this._decorations.onModelDecorationsChanged(),this._eventDispatcher.emitSingleViewEvent(new R1(e)),this._eventDispatcher.emitOutgoingEvent(new jNt(e))}))}setHiddenAreas(e,t){this.hiddenAreasModel.setHiddenAreas(t,e);const i=this.hiddenAreasModel.getMergedRanges();if(i===this.previousHiddenAreas)return;this.previousHiddenAreas=i;const r=this._captureStableViewport();let s=!1;try{const o=this._eventDispatcher.beginEmitViewEvents();s=this._lines.setHiddenAreas(i),s&&(o.emitViewEvent(new n3),o.emitViewEvent(new i3),o.emitViewEvent(new R1(null)),this._cursor.onLineMappingChanged(o),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount()),this.viewLayout.onHeightMaybeChanged());const a=r.viewportStartModelPosition?.lineNumber;a&&i.some(c=>c.startLineNumber<=a&&a<=c.endLineNumber)||r.recoverViewportStart(this.coordinatesConverter,this.viewLayout)}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule(),s&&this._eventDispatcher.emitOutgoingEvent(new zNt)}getVisibleRangesPlusViewportAboveBelow(){const e=this._configuration.options.get(146),t=this._configuration.options.get(67),i=Math.max(20,Math.round(e.height/t)),r=this.viewLayout.getLinesViewportData(),s=Math.max(1,r.completelyVisibleStartLineNumber-i),o=Math.min(this.getLineCount(),r.completelyVisibleEndLineNumber+i);return this._toModelVisibleRanges(new $(s,this.getLineMinColumn(s),o,this.getLineMaxColumn(o)))}getVisibleRanges(){const e=this.getCompletelyVisibleViewRange();return this._toModelVisibleRanges(e)}getHiddenAreas(){return this._lines.getHiddenAreas()}_toModelVisibleRanges(e){const t=this.coordinatesConverter.convertViewRangeToModelRange(e),i=this._lines.getHiddenAreas();if(i.length===0)return[t];const r=[];let s=0,o=t.startLineNumber,a=t.startColumn;const l=t.endLineNumber,c=t.endColumn;for(let u=0,d=i.length;ul||(o"u")return this._reduceRestoreStateCompatibility(e);const t=this.model.validatePosition(e.firstPosition),i=this.coordinatesConverter.convertModelPositionToViewPosition(t),r=this.viewLayout.getVerticalOffsetForLineNumber(i.lineNumber)-e.firstPositionDeltaTop;return{scrollLeft:e.scrollLeft,scrollTop:r}}_reduceRestoreStateCompatibility(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTopWithoutViewZones}}getTabSize(){return this.model.getOptions().tabSize}getLineCount(){return this._lines.getViewLineCount()}setViewport(e,t,i){this._viewportStart.update(this,e)}getActiveIndentGuide(e,t,i){return this._lines.getActiveIndentGuide(e,t,i)}getLinesIndentGuides(e,t){return this._lines.getViewLinesIndentGuides(e,t)}getBracketGuidesInRangeByLine(e,t,i,r){return this._lines.getViewLinesBracketGuides(e,t,i,r)}getLineContent(e){return this._lines.getViewLineContent(e)}getLineLength(e){return this._lines.getViewLineLength(e)}getLineMinColumn(e){return this._lines.getViewLineMinColumn(e)}getLineMaxColumn(e){return this._lines.getViewLineMaxColumn(e)}getLineFirstNonWhitespaceColumn(e){const t=yl(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){const t=pg(this.getLineContent(e));return t===-1?0:t+2}getMinimapDecorationsInRange(e){return this._decorations.getMinimapDecorationsInRange(e)}getDecorationsInViewport(e){return this._decorations.getDecorationsViewportData(e).decorations}getInjectedTextAt(e){return this._lines.getInjectedTextAt(e)}getViewportViewLineRenderingData(e,t){const r=this._decorations.getDecorationsViewportData(e).inlineDecorations[t-e.startLineNumber];return this._getViewLineRenderingData(t,r)}getViewLineRenderingData(e){const t=this._decorations.getInlineDecorationsOnLine(e);return this._getViewLineRenderingData(e,t)}_getViewLineRenderingData(e,t){const i=this.model.mightContainRTL(),r=this.model.mightContainNonBasicASCII(),s=this.getTabSize(),o=this._lines.getViewLineData(e);return o.inlineDecorations&&(t=[...t,...o.inlineDecorations.map(a=>a.toInlineDecoration(e))]),new sd(o.minColumn,o.maxColumn,o.content,o.continuesWithWrappedLine,i,r,o.tokens,t,s,o.startVisibleColumn)}getViewLineData(e){return this._lines.getViewLineData(e)}getMinimapLinesRenderingData(e,t,i){const r=this._lines.getViewLinesData(e,t,i);return new QDt(this.getTabSize(),r)}getAllOverviewRulerDecorations(e){const t=this.model.getOverviewRulerDecorations(this._editorId,R6(this._configuration.options)),i=new mRt;for(const r of t){const s=r.options,o=s.overviewRuler;if(!o)continue;const a=o.position;if(a===0)continue;const l=o.getColor(e.value),c=this.coordinatesConverter.getViewLineNumberOfModelPosition(r.range.startLineNumber,r.range.startColumn),u=this.coordinatesConverter.getViewLineNumberOfModelPosition(r.range.endLineNumber,r.range.endColumn);i.accept(l,s.zIndex,c,u,a)}return i.asArray}_invalidateDecorationsColorCache(){const e=this.model.getOverviewRulerDecorations();for(const t of e)t.options.overviewRuler?.invalidateCachedColor(),t.options.minimap?.invalidateCachedColor()}getValueInRange(e,t){const i=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueInRange(i,t)}getValueLengthInRange(e,t){const i=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueLengthInRange(i,t)}modifyPosition(e,t){const i=this.coordinatesConverter.convertViewPositionToModelPosition(e),r=this.model.modifyPosition(i,t);return this.coordinatesConverter.convertModelPositionToViewPosition(r)}deduceModelPositionRelativeToViewPosition(e,t,i){const r=this.coordinatesConverter.convertViewPositionToModelPosition(e);this.model.getEOL().length===2&&(t<0?t-=i:t+=i);const o=this.model.getOffsetAt(r)+t;return this.model.getPositionAt(o)}getPlainTextToCopy(e,t,i){const r=i?`\r `:this.model.getEOL();e=e.slice(0),e.sort($.compareRangesUsingStarts);let s=!1,o=!1;for(const l of e)l.isEmpty()?s=!0:o=!0;if(!o){if(!t)return"";const l=e.map(u=>u.startLineNumber);let c="";for(let u=0;u0&&l[u-1]===l[u]||(c+=this.model.getLineContent(l[u])+r);return c}if(s&&t){const l=[];let c=0;for(const u of e){const d=u.startLineNumber;u.isEmpty()?d!==c&&l.push(this.model.getLineContent(d)):l.push(this.model.getValueInRange(u,i?2:0)),c=d}return l.length===1?l[0]:l}const a=[];for(const l of e)l.isEmpty()||a.push(this.model.getValueInRange(l,i?2:0));return a.length===1?a[0]:a}getRichTextToCopy(e,t){const i=this.model.getLanguageId();if(i===Hl||e.length!==1)return null;let r=e[0];if(r.isEmpty()){if(!t)return null;const u=r.startLineNumber;r=new $(u,this.model.getLineMinColumn(u),u,this.model.getLineMaxColumn(u))}const s=this._configuration.options.get(50),o=this._getColorMap(),l=/[:;\\\/<>]/.test(s.fontFamily)||s.fontFamily===Wl.fontFamily;let c;return l?c=Wl.fontFamily:(c=s.fontFamily,c=c.replace(/"/g,"'"),/[,']/.test(c)||/[+ ]/.test(c)&&(c=`'${c}'`),c=`${c}, ${Wl.fontFamily}`),{mode:i,html:`
`+this._getHTMLToCopy(r,o)+"
"}}_getHTMLToCopy(e,t){const i=e.startLineNumber,r=e.startColumn,s=e.endLineNumber,o=e.endColumn,a=this.getTabSize();let l="";for(let c=i;c<=s;c++){const u=this.model.tokenization.getLineTokens(c),d=u.getLineContent(),h=c===i?r-1:0,f=c===s?o-1:d.length;d===""?l+="
":l+=Sxt(d,u.inflate(),t,h,f,a,Ta)}return l}_getColorMap(){const e=rs.getColorMap(),t=["#000000"];if(e)for(let i=1,r=e.length;ithis._cursor.setStates(r,e,t,i))}getCursorColumnSelectData(){return this._cursor.getCursorColumnSelectData()}getCursorAutoClosedCharacters(){return this._cursor.getAutoClosedCharacters()}setCursorColumnSelectData(e){this._cursor.setCursorColumnSelectData(e)}getPrevEditOperationType(){return this._cursor.getPrevEditOperationType()}setPrevEditOperationType(e){this._cursor.setPrevEditOperationType(e)}getSelection(){return this._cursor.getSelection()}getSelections(){return this._cursor.getSelections()}getPosition(){return this._cursor.getPrimaryCursorState().modelState.position}setSelections(e,t,i=0){this._withViewEventsCollector(r=>this._cursor.setSelections(r,e,t,i))}saveCursorState(){return this._cursor.saveState()}restoreCursorState(e){this._withViewEventsCollector(t=>this._cursor.restoreState(t,e))}_executeCursorEdit(e){if(this._cursor.context.cursorConfig.readOnly){this._eventDispatcher.emitOutgoingEvent(new UNt);return}this._withViewEventsCollector(e)}executeEdits(e,t,i){this._executeCursorEdit(r=>this._cursor.executeEdits(r,e,t,i))}startComposition(){this._executeCursorEdit(e=>this._cursor.startComposition(e))}endComposition(e){this._executeCursorEdit(t=>this._cursor.endComposition(t,e))}type(e,t){this._executeCursorEdit(i=>this._cursor.type(i,e,t))}compositionType(e,t,i,r,s){this._executeCursorEdit(o=>this._cursor.compositionType(o,e,t,i,r,s))}paste(e,t,i,r){this._executeCursorEdit(s=>this._cursor.paste(s,e,t,i,r))}cut(e){this._executeCursorEdit(t=>this._cursor.cut(t,e))}executeCommand(e,t){this._executeCursorEdit(i=>this._cursor.executeCommand(i,e,t))}executeCommands(e,t){this._executeCursorEdit(i=>this._cursor.executeCommands(i,e,t))}revealAllCursors(e,t,i=!1){this._withViewEventsCollector(r=>this._cursor.revealAll(r,e,i,0,t,0))}revealPrimaryCursor(e,t,i=!1){this._withViewEventsCollector(r=>this._cursor.revealPrimary(r,e,i,0,t,0))}revealTopMostCursor(e){const t=this._cursor.getTopMostViewPosition(),i=new $(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(r=>r.emitViewEvent(new BI(e,!1,i,null,0,!0,0)))}revealBottomMostCursor(e){const t=this._cursor.getBottomMostViewPosition(),i=new $(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(r=>r.emitViewEvent(new BI(e,!1,i,null,0,!0,0)))}revealRange(e,t,i,r,s){this._withViewEventsCollector(o=>o.emitViewEvent(new BI(e,!1,i,null,r,t,s)))}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new $Nt),this._eventDispatcher.emitOutgoingEvent(new VNt))}_withViewEventsCollector(e){return this._transactionalTarget.batchChanges(()=>{try{const t=this._eventDispatcher.beginEmitViewEvents();return e(t)}finally{this._eventDispatcher.endEmitViewEvents()}})}batchEvents(e){this._withViewEventsCollector(()=>{e()})}normalizePosition(e,t){return this._lines.normalizePosition(e,t)}getLineIndentColumn(e){return this._lines.getLineIndentColumn(e)}};class Qce{static create(e){const t=e._setTrackedRange(null,new $(1,1,1,1),1);return new Qce(e,1,!1,t,0)}get viewLineNumber(){return this._viewLineNumber}get isValid(){return this._isValid}get modelTrackedRange(){return this._modelTrackedRange}get startLineDelta(){return this._startLineDelta}constructor(e,t,i,r,s){this._model=e,this._viewLineNumber=t,this._isValid=i,this._modelTrackedRange=r,this._startLineDelta=s}dispose(){this._model._setTrackedRange(this._modelTrackedRange,null,1)}update(e,t){const i=e.coordinatesConverter.convertViewPositionToModelPosition(new he(t,e.getLineMinColumn(t))),r=e.model._setTrackedRange(this._modelTrackedRange,new $(i.lineNumber,i.column,i.lineNumber,i.column),1),s=e.viewLayout.getVerticalOffsetForLineNumber(t),o=e.viewLayout.getCurrentScrollTop();this._viewLineNumber=t,this._isValid=!0,this._modelTrackedRange=r,this._startLineDelta=o-s}invalidate(){this._isValid=!1}}class mRt{constructor(){this._asMap=Object.create(null),this.asArray=[]}accept(e,t,i,r,s){const o=this._asMap[e];if(o){const a=o.data,l=a[a.length-3],c=a[a.length-1];if(l===s&&c+1>=i){r>c&&(a[a.length-1]=r);return}a.push(s,i,r)}else{const a=new HN(e,t,[s,i,r]);this._asMap[e]=a,this.asArray.push(a)}}}class _Rt{constructor(){this.hiddenAreas=new Map,this.shouldRecompute=!1,this.ranges=[]}setHiddenAreas(e,t){const i=this.hiddenAreas.get(e);i&&Mwe(i,t)||(this.hiddenAreas.set(e,t),this.shouldRecompute=!0)}getMergedRanges(){if(!this.shouldRecompute)return this.ranges;this.shouldRecompute=!1;const e=Array.from(this.hiddenAreas.values()).reduce((t,i)=>vRt(t,i),[]);return Mwe(this.ranges,e)?this.ranges:(this.ranges=e,this.ranges)}}function vRt(n,e){const t=[];let i=0,r=0;for(;i=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Nm=function(n,e){return function(t,i){e(t,i,n)}},Y1;let ZN=class extends me{static{Y1=this}static{this.dropIntoEditorDecorationOptions=un.register({description:"workbench-dnd-target",className:"dnd-target"})}get isSimpleWidget(){return this._configuration.isSimpleWidget}get contextMenuId(){return this._configuration.contextMenuId}constructor(e,t,i,r,s,o,a,l,c,u,d,h){super(),this.languageConfigurationService=d,this._deliveryQueue=xmt(),this._contributions=this._register(new kNt),this._onDidDispose=this._register(new fe),this.onDidDispose=this._onDidDispose.event,this._onDidChangeModelContent=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelContent=this._onDidChangeModelContent.event,this._onDidChangeModelLanguage=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelLanguage=this._onDidChangeModelLanguage.event,this._onDidChangeModelLanguageConfiguration=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelLanguageConfiguration=this._onDidChangeModelLanguageConfiguration.event,this._onDidChangeModelOptions=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelOptions=this._onDidChangeModelOptions.event,this._onDidChangeModelDecorations=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelDecorations=this._onDidChangeModelDecorations.event,this._onDidChangeModelTokens=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelTokens=this._onDidChangeModelTokens.event,this._onDidChangeConfiguration=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._onWillChangeModel=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onWillChangeModel=this._onWillChangeModel.event,this._onDidChangeModel=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeModel=this._onDidChangeModel.event,this._onDidChangeCursorPosition=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeCursorPosition=this._onDidChangeCursorPosition.event,this._onDidChangeCursorSelection=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeCursorSelection=this._onDidChangeCursorSelection.event,this._onDidAttemptReadOnlyEdit=this._register(new sl(this._contributions,this._deliveryQueue)),this.onDidAttemptReadOnlyEdit=this._onDidAttemptReadOnlyEdit.event,this._onDidLayoutChange=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidLayoutChange=this._onDidLayoutChange.event,this._editorTextFocus=this._register(new Bwe({deliveryQueue:this._deliveryQueue})),this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue,this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse,this._editorWidgetFocus=this._register(new Bwe({deliveryQueue:this._deliveryQueue})),this.onDidFocusEditorWidget=this._editorWidgetFocus.onDidChangeToTrue,this.onDidBlurEditorWidget=this._editorWidgetFocus.onDidChangeToFalse,this._onWillType=this._register(new sl(this._contributions,this._deliveryQueue)),this.onWillType=this._onWillType.event,this._onDidType=this._register(new sl(this._contributions,this._deliveryQueue)),this.onDidType=this._onDidType.event,this._onDidCompositionStart=this._register(new sl(this._contributions,this._deliveryQueue)),this.onDidCompositionStart=this._onDidCompositionStart.event,this._onDidCompositionEnd=this._register(new sl(this._contributions,this._deliveryQueue)),this.onDidCompositionEnd=this._onDidCompositionEnd.event,this._onDidPaste=this._register(new sl(this._contributions,this._deliveryQueue)),this.onDidPaste=this._onDidPaste.event,this._onMouseUp=this._register(new sl(this._contributions,this._deliveryQueue)),this.onMouseUp=this._onMouseUp.event,this._onMouseDown=this._register(new sl(this._contributions,this._deliveryQueue)),this.onMouseDown=this._onMouseDown.event,this._onMouseDrag=this._register(new sl(this._contributions,this._deliveryQueue)),this.onMouseDrag=this._onMouseDrag.event,this._onMouseDrop=this._register(new sl(this._contributions,this._deliveryQueue)),this.onMouseDrop=this._onMouseDrop.event,this._onMouseDropCanceled=this._register(new sl(this._contributions,this._deliveryQueue)),this.onMouseDropCanceled=this._onMouseDropCanceled.event,this._onDropIntoEditor=this._register(new sl(this._contributions,this._deliveryQueue)),this.onDropIntoEditor=this._onDropIntoEditor.event,this._onContextMenu=this._register(new sl(this._contributions,this._deliveryQueue)),this.onContextMenu=this._onContextMenu.event,this._onMouseMove=this._register(new sl(this._contributions,this._deliveryQueue)),this.onMouseMove=this._onMouseMove.event,this._onMouseLeave=this._register(new sl(this._contributions,this._deliveryQueue)),this.onMouseLeave=this._onMouseLeave.event,this._onMouseWheel=this._register(new sl(this._contributions,this._deliveryQueue)),this.onMouseWheel=this._onMouseWheel.event,this._onKeyUp=this._register(new sl(this._contributions,this._deliveryQueue)),this.onKeyUp=this._onKeyUp.event,this._onKeyDown=this._register(new sl(this._contributions,this._deliveryQueue)),this.onKeyDown=this._onKeyDown.event,this._onDidContentSizeChange=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._onDidScrollChange=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidScrollChange=this._onDidScrollChange.event,this._onDidChangeViewZones=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeViewZones=this._onDidChangeViewZones.event,this._onDidChangeHiddenAreas=this._register(new fe({deliveryQueue:this._deliveryQueue})),this.onDidChangeHiddenAreas=this._onDidChangeHiddenAreas.event,this._updateCounter=0,this._onBeginUpdate=this._register(new fe),this.onBeginUpdate=this._onBeginUpdate.event,this._onEndUpdate=this._register(new fe),this.onEndUpdate=this._onEndUpdate.event,this._actions=new Map,this._bannerDomNode=null,this._dropIntoEditorDecorations=this.createDecorationsCollection(),s.willCreateCodeEditor();const f={...t};this._domElement=e,this._overflowWidgetsDomNode=f.overflowWidgetsDomNode,delete f.overflowWidgetsDomNode,this._id=++yRt,this._decorationTypeKeysToIds={},this._decorationTypeSubtypes={},this._telemetryData=i.telemetryData,this._configuration=this._register(this._createConfiguration(i.isSimpleWidget||!1,i.contextMenuId??(i.isSimpleWidget?ce.SimpleEditorContext:ce.EditorContext),f,u)),this._register(this._configuration.onDidChange(m=>{this._onDidChangeConfiguration.fire(m);const _=this._configuration.options;if(m.hasChanged(146)){const v=_.get(146);this._onDidLayoutChange.fire(v)}})),this._contextKeyService=this._register(a.createScoped(this._domElement)),this._notificationService=c,this._codeEditorService=s,this._commandService=o,this._themeService=l,this._register(new CRt(this,this._contextKeyService)),this._register(new xRt(this,this._contextKeyService,h)),this._instantiationService=this._register(r.createChild(new c2([jt,this._contextKeyService]))),this._modelData=null,this._focusTracker=new SRt(e,this._overflowWidgetsDomNode),this._register(this._focusTracker.onChange(()=>{this._editorWidgetFocus.setValue(this._focusTracker.hasFocus())})),this._contentWidgets={},this._overlayWidgets={},this._glyphMarginWidgets={};let g;Array.isArray(i.contributions)?g=i.contributions:g=Zy.getEditorContributions(),this._contributions.initialize(this,g,this._instantiationService);for(const m of Zy.getEditorActions()){if(this._actions.has(m.id)){rn(new Error(`Cannot have two actions with the same id ${m.id}`));continue}const _=new b8e(m.id,m.label,m.alias,m.metadata,m.precondition??void 0,v=>this._instantiationService.invokeFunction(y=>Promise.resolve(m.runEditorCommand(y,this,v))),this._contextKeyService);this._actions.set(_.id,_)}const p=()=>!this._configuration.options.get(92)&&this._configuration.options.get(36).enabled;this._register(new O0t(this._domElement,{onDragOver:m=>{if(!p())return;const _=this.getTargetAtClientPoint(m.clientX,m.clientY);_?.position&&this.showDropIndicatorAt(_.position)},onDrop:async m=>{if(!p()||(this.removeDropIndicator(),!m.dataTransfer))return;const _=this.getTargetAtClientPoint(m.clientX,m.clientY);_?.position&&this._onDropIntoEditor.fire({position:_.position,event:m})},onDragLeave:()=>{this.removeDropIndicator()},onDragEnd:()=>{this.removeDropIndicator()}})),this._codeEditorService.addCodeEditor(this)}writeScreenReaderContent(e){this._modelData?.view.writeScreenReaderContent(e)}_createConfiguration(e,t,i,r){return new TJ(e,t,i,this._domElement,r)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return pO.ICodeEditor}dispose(){this._codeEditorService.removeCodeEditor(this),this._focusTracker.dispose(),this._actions.clear(),this._contentWidgets={},this._overlayWidgets={},this._removeDecorationTypes(),this._postDetachModelCleanup(this._detachModel()),this._onDidDispose.fire(),super.dispose()}invokeWithinContext(e){return this._instantiationService.invokeFunction(e)}updateOptions(e){this._configuration.updateOptions(e||{})}getOptions(){return this._configuration.options}getOption(e){return this._configuration.options.get(e)}getRawOptions(){return this._configuration.getRawOptions()}getOverflowWidgetsDomNode(){return this._overflowWidgetsDomNode}getConfiguredWordAtPosition(e){return this._modelData?yi.getWordAtPosition(this._modelData.model,this._configuration.options.get(132),this._configuration.options.get(131),e):null}getValue(e=null){if(!this._modelData)return"";const t=!!(e&&e.preserveBOM);let i=0;return e&&e.lineEnding&&e.lineEnding===` `?i=1:e&&e.lineEnding&&e.lineEnding===`\r -`&&(i=2),this._modelData.model.getValue(i,t)}setValue(e){try{if(this._beginUpdate(),!this._modelData)return;this._modelData.model.setValue(e)}finally{this._endUpdate()}}getModel(){return this._modelData?this._modelData.model:null}setModel(e=null){try{this._beginUpdate();const t=e;if(this._modelData===null&&t===null||this._modelData&&this._modelData.model===t)return;const i={oldModelUrl:this._modelData?.model.uri||null,newModelUrl:t?.uri||null};this._onWillChangeModel.fire(i);const r=this.hasTextFocus(),s=this._detachModel();this._attachModel(t),r&&this.hasModel()&&this.focus(),this._removeDecorationTypes(),this._onDidChangeModel.fire(i),this._postDetachModelCleanup(s),this._contributionsDisposable=this._contributions.onAfterModelAttached()}finally{this._endUpdate()}}_removeDecorationTypes(){if(this._decorationTypeKeysToIds={},this._decorationTypeSubtypes){for(const e in this._decorationTypeSubtypes){const t=this._decorationTypeSubtypes[e];for(const i in t)this._removeDecorationType(e+"-"+i)}this._decorationTypeSubtypes={}}}getVisibleRanges(){return this._modelData?this._modelData.viewModel.getVisibleRanges():[]}getVisibleRangesPlusViewportAboveBelow(){return this._modelData?this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow():[]}getWhitespaces(){return this._modelData?this._modelData.viewModel.viewLayout.getWhitespaces():[]}static _getVerticalOffsetAfterPosition(e,t,i,r){const s=e.model.validatePosition({lineNumber:t,column:i}),o=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(s);return e.viewModel.viewLayout.getVerticalOffsetAfterLineNumber(o.lineNumber,r)}getTopForLineNumber(e,t=!1){return this._modelData?Y1._getVerticalOffsetForPosition(this._modelData,e,1,t):-1}getTopForPosition(e,t){return this._modelData?Y1._getVerticalOffsetForPosition(this._modelData,e,t,!1):-1}static _getVerticalOffsetForPosition(e,t,i,r=!1){const s=e.model.validatePosition({lineNumber:t,column:i}),o=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(s);return e.viewModel.viewLayout.getVerticalOffsetForLineNumber(o.lineNumber,r)}getBottomForLineNumber(e,t=!1){if(!this._modelData)return-1;const i=this._modelData.model.getLineMaxColumn(e);return Y1._getVerticalOffsetAfterPosition(this._modelData,e,i,t)}setHiddenAreas(e,t){this._modelData?.viewModel.setHiddenAreas(e.map(i=>$.lift(i)),t)}getVisibleColumnFromPosition(e){if(!this._modelData)return e.column;const t=this._modelData.model.validatePosition(e),i=this._modelData.model.getOptions().tabSize;return co.visibleColumnFromColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,i)+1}getPosition(){return this._modelData?this._modelData.viewModel.getPosition():null}setPosition(e,t="api"){if(this._modelData){if(!he.isIPosition(e))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,[{selectionStartLineNumber:e.lineNumber,selectionStartColumn:e.column,positionLineNumber:e.lineNumber,positionColumn:e.column}])}}_sendRevealRange(e,t,i,r){if(!this._modelData)return;if(!$.isIRange(e))throw new Error("Invalid arguments");const s=this._modelData.model.validateRange(e),o=this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(s);this._modelData.viewModel.revealRange("api",i,o,t,r)}revealLine(e,t=0){this._revealLine(e,0,t)}revealLineInCenter(e,t=0){this._revealLine(e,1,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._revealLine(e,2,t)}revealLineNearTop(e,t=0){this._revealLine(e,5,t)}_revealLine(e,t,i){if(typeof e!="number")throw new Error("Invalid arguments");this._sendRevealRange(new $(e,1,e,1),t,!1,i)}revealPosition(e,t=0){this._revealPosition(e,0,!0,t)}revealPositionInCenter(e,t=0){this._revealPosition(e,1,!0,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._revealPosition(e,2,!0,t)}revealPositionNearTop(e,t=0){this._revealPosition(e,5,!0,t)}_revealPosition(e,t,i,r){if(!he.isIPosition(e))throw new Error("Invalid arguments");this._sendRevealRange(new $(e.lineNumber,e.column,e.lineNumber,e.column),t,i,r)}getSelection(){return this._modelData?this._modelData.viewModel.getSelection():null}getSelections(){return this._modelData?this._modelData.viewModel.getSelections():null}setSelection(e,t="api"){const i=yt.isISelection(e),r=$.isIRange(e);if(!i&&!r)throw new Error("Invalid arguments");if(i)this._setSelectionImpl(e,t);else if(r){const s={selectionStartLineNumber:e.startLineNumber,selectionStartColumn:e.startColumn,positionLineNumber:e.endLineNumber,positionColumn:e.endColumn};this._setSelectionImpl(s,t)}}_setSelectionImpl(e,t){if(!this._modelData)return;const i=new yt(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn);this._modelData.viewModel.setSelections(t,[i])}revealLines(e,t,i=0){this._revealLines(e,t,0,i)}revealLinesInCenter(e,t,i=0){this._revealLines(e,t,1,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._revealLines(e,t,2,i)}revealLinesNearTop(e,t,i=0){this._revealLines(e,t,5,i)}_revealLines(e,t,i,r){if(typeof e!="number"||typeof t!="number")throw new Error("Invalid arguments");this._sendRevealRange(new $(e,1,t,1),i,!1,r)}revealRange(e,t=0,i=!1,r=!0){this._revealRange(e,i?1:0,r,t)}revealRangeInCenter(e,t=0){this._revealRange(e,1,!0,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._revealRange(e,2,!0,t)}revealRangeNearTop(e,t=0){this._revealRange(e,5,!0,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._revealRange(e,6,!0,t)}revealRangeAtTop(e,t=0){this._revealRange(e,3,!0,t)}_revealRange(e,t,i,r){if(!$.isIRange(e))throw new Error("Invalid arguments");this._sendRevealRange($.lift(e),t,i,r)}setSelections(e,t="api",i=0){if(this._modelData){if(!e||e.length===0)throw new Error("Invalid arguments");for(let r=0,s=e.length;r0&&this._modelData.viewModel.restoreCursorState(i):this._modelData.viewModel.restoreCursorState([i]),this._contributions.restoreViewState(t.contributionsState||{});const r=this._modelData.viewModel.reduceRestoreState(t.viewState);this._modelData.view.restoreState(r)}}handleInitialized(){this._getViewModel()?.visibleLinesStabilized()}getContribution(e){return this._contributions.get(e)}getActions(){return Array.from(this._actions.values())}getSupportedActions(){let e=this.getActions();return e=e.filter(t=>t.isSupported()),e}getAction(e){return this._actions.get(e)||null}trigger(e,t,i){i=i||{};try{switch(this._beginUpdate(),t){case"compositionStart":this._startComposition();return;case"compositionEnd":this._endComposition(e);return;case"type":{const s=i;this._type(e,s.text||"");return}case"replacePreviousChar":{const s=i;this._compositionType(e,s.text||"",s.replaceCharCnt||0,0,0);return}case"compositionType":{const s=i;this._compositionType(e,s.text||"",s.replacePrevCharCnt||0,s.replaceNextCharCnt||0,s.positionDelta||0);return}case"paste":{const s=i;this._paste(e,s.text||"",s.pasteOnNewLine||!1,s.multicursorText||null,s.mode||null,s.clipboardEvent);return}case"cut":this._cut(e);return}const r=this.getAction(t);if(r){Promise.resolve(r.run(i)).then(void 0,rn);return}if(!this._modelData||this._triggerEditorCommand(e,t,i))return;this._triggerCommand(t,i)}finally{this._endUpdate()}}_triggerCommand(e,t){this._commandService.executeCommand(e,t)}_startComposition(){this._modelData&&(this._modelData.viewModel.startComposition(),this._onDidCompositionStart.fire())}_endComposition(e){this._modelData&&(this._modelData.viewModel.endComposition(e),this._onDidCompositionEnd.fire())}_type(e,t){!this._modelData||t.length===0||(e==="keyboard"&&this._onWillType.fire(t),this._modelData.viewModel.type(t,e),e==="keyboard"&&this._onDidType.fire(t))}_compositionType(e,t,i,r,s){this._modelData&&this._modelData.viewModel.compositionType(t,i,r,s,e)}_paste(e,t,i,r,s,o){if(!this._modelData)return;const a=this._modelData.viewModel,l=a.getSelection().getStartPosition();a.paste(t,i,r,e);const c=a.getSelection().getStartPosition();e==="keyboard"&&this._onDidPaste.fire({clipboardEvent:o,range:new $(l.lineNumber,l.column,c.lineNumber,c.column),languageId:s})}_cut(e){this._modelData&&this._modelData.viewModel.cut(e)}_triggerEditorCommand(e,t,i){const r=Zy.getEditorCommand(t);return r?(i=i||{},i.source=e,this._instantiationService.invokeFunction(s=>{Promise.resolve(r.runEditorCommand(s,this,i)).then(void 0,rn)}),!0):!1}_getViewModel(){return this._modelData?this._modelData.viewModel:null}pushUndoStop(){return!this._modelData||this._configuration.options.get(92)?!1:(this._modelData.model.pushStackElement(),!0)}popUndoStop(){return!this._modelData||this._configuration.options.get(92)?!1:(this._modelData.model.popStackElement(),!0)}executeEdits(e,t,i){if(!this._modelData||this._configuration.options.get(92))return!1;let r;return i?Array.isArray(i)?r=()=>i:r=i:r=()=>null,this._modelData.viewModel.executeEdits(e,t,r),!0}executeCommand(e,t){this._modelData&&this._modelData.viewModel.executeCommand(t,e)}executeCommands(e,t){this._modelData&&this._modelData.viewModel.executeCommands(t,e)}createDecorationsCollection(e){return new kRt(this,e)}changeDecorations(e){return this._modelData?this._modelData.model.changeDecorations(e,this._id):null}getLineDecorations(e){return this._modelData?this._modelData.model.getLineDecorations(e,this._id,R6(this._configuration.options)):null}getDecorationsInRange(e){return this._modelData?this._modelData.model.getDecorationsInRange(e,this._id,R6(this._configuration.options)):null}deltaDecorations(e,t){return this._modelData?e.length===0&&t.length===0?e:this._modelData.model.deltaDecorations(e,t,this._id):[]}removeDecorations(e){!this._modelData||e.length===0||this._modelData.model.changeDecorations(t=>{t.deltaDecorations(e,[])})}removeDecorationsByType(e){const t=this._decorationTypeKeysToIds[e];t&&this.changeDecorations(i=>i.deltaDecorations(t,[])),this._decorationTypeKeysToIds.hasOwnProperty(e)&&delete this._decorationTypeKeysToIds[e],this._decorationTypeSubtypes.hasOwnProperty(e)&&delete this._decorationTypeSubtypes[e]}getLayoutInfo(){return this._configuration.options.get(146)}createOverviewRuler(e){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.createOverviewRuler(e)}getContainerDomNode(){return this._domElement}getDomNode(){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.domNode.domNode}delegateVerticalScrollbarPointerDown(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateScrollFromMouseWheelEvent(e)}layout(e,t=!1){this._configuration.observeContainer(e),t||this.render()}focus(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.focus()}hasTextFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isFocused()}hasWidgetFocus(){return this._focusTracker&&this._focusTracker.hasFocus()}addContentWidget(e){const t={widget:e,position:e.getPosition()};this._contentWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a content widget with the same id:"+e.getId()),this._contentWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addContentWidget(t)}layoutContentWidget(e){const t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){const i=this._contentWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutContentWidget(i)}}removeContentWidget(e){const t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){const i=this._contentWidgets[t];delete this._contentWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeContentWidget(i)}}addOverlayWidget(e){const t={widget:e,position:e.getPosition()};this._overlayWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting an overlay widget with the same id."),this._overlayWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addOverlayWidget(t)}layoutOverlayWidget(e){const t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){const i=this._overlayWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutOverlayWidget(i)}}removeOverlayWidget(e){const t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){const i=this._overlayWidgets[t];delete this._overlayWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeOverlayWidget(i)}}addGlyphMarginWidget(e){const t={widget:e,position:e.getPosition()};this._glyphMarginWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a glyph margin widget with the same id."),this._glyphMarginWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addGlyphMarginWidget(t)}layoutGlyphMarginWidget(e){const t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){const i=this._glyphMarginWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutGlyphMarginWidget(i)}}removeGlyphMarginWidget(e){const t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){const i=this._glyphMarginWidgets[t];delete this._glyphMarginWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeGlyphMarginWidget(i)}}changeViewZones(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.change(e)}getTargetAtClientPoint(e,t){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.getTargetAtClientPoint(e,t)}getScrolledVisiblePosition(e){if(!this._modelData||!this._modelData.hasRealView)return null;const t=this._modelData.model.validatePosition(e),i=this._configuration.options,r=i.get(146),s=Y1._getVerticalOffsetForPosition(this._modelData,t.lineNumber,t.column)-this.getScrollTop(),o=this._modelData.view.getOffsetForColumn(t.lineNumber,t.column)+r.glyphMarginWidth+r.lineNumbersWidth+r.decorationsWidth-this.getScrollLeft();return{top:s,left:o,height:i.get(67)}}getOffsetForColumn(e,t){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getOffsetForColumn(e,t)}render(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!0,e)})}setAriaOptions(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.setAriaOptions(e)}applyFontInfo(e){ta(e,this._configuration.options.get(50))}setBanner(e,t){this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),this._bannerDomNode=e,this._configuration.setReservedHeight(e?t:0),this._bannerDomNode&&this._domElement.prepend(this._bannerDomNode)}_attachModel(e){if(!e){this._modelData=null;return}const t=[];this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._configuration.setIsDominatedByLongLines(e.isDominatedByLongLines()),this._configuration.setModelLineCount(e.getLineCount());const i=e.onBeforeAttached(),r=new pRt(this._id,this._configuration,e,Uce.create(Ot(this._domElement)),jce.create(this._configuration.options),a=>du(Ot(this._domElement),a),this.languageConfigurationService,this._themeService,i,{batchChanges:a=>{try{return this._beginUpdate(),a()}finally{this._endUpdate()}}});t.push(e.onWillDispose(()=>this.setModel(null))),t.push(r.onEvent(a=>{switch(a.kind){case 0:this._onDidContentSizeChange.fire(a);break;case 1:this._editorTextFocus.setValue(a.hasFocus);break;case 2:this._onDidScrollChange.fire(a);break;case 3:this._onDidChangeViewZones.fire();break;case 4:this._onDidChangeHiddenAreas.fire();break;case 5:this._onDidAttemptReadOnlyEdit.fire();break;case 6:{if(a.reachedMaxCursorCount){const d=this.getOption(80),h=w("cursors.maximum","The number of cursors has been limited to {0}. Consider using [find and replace](https://code.visualstudio.com/docs/editor/codebasics#_find-and-replace) for larger changes or increase the editor multi cursor limit setting.",d);this._notificationService.prompt(iW.Warning,h,[{label:"Find and Replace",run:()=>{this._commandService.executeCommand("editor.action.startFindReplaceAction")}},{label:w("goToSetting","Increase Multi Cursor Limit"),run:()=>{this._commandService.executeCommand("workbench.action.openSettings2",{query:"editor.multiCursorLimit"})}}])}const l=[];for(let d=0,h=a.selections.length;d{this._paste("keyboard",s,o,a,l)},type:s=>{this._type("keyboard",s)},compositionType:(s,o,a,l)=>{this._compositionType("keyboard",s,o,a,l)},startComposition:()=>{this._startComposition()},endComposition:()=>{this._endComposition("keyboard")},cut:()=>{this._cut("keyboard")}}:t={paste:(s,o,a,l)=>{const c={text:s,pasteOnNewLine:o,multicursorText:a,mode:l};this._commandService.executeCommand("paste",c)},type:s=>{const o={text:s};this._commandService.executeCommand("type",o)},compositionType:(s,o,a,l)=>{if(a||l){const c={text:s,replacePrevCharCnt:o,replaceNextCharCnt:a,positionDelta:l};this._commandService.executeCommand("compositionType",c)}else{const c={text:s,replaceCharCnt:o};this._commandService.executeCommand("replacePreviousChar",c)}},startComposition:()=>{this._commandService.executeCommand("compositionStart",{})},endComposition:()=>{this._commandService.executeCommand("compositionEnd",{})},cut:()=>{this._commandService.executeCommand("cut",{})}};const i=new GW(e.coordinatesConverter);return i.onKeyDown=s=>this._onKeyDown.fire(s),i.onKeyUp=s=>this._onKeyUp.fire(s),i.onContextMenu=s=>this._onContextMenu.fire(s),i.onMouseMove=s=>this._onMouseMove.fire(s),i.onMouseLeave=s=>this._onMouseLeave.fire(s),i.onMouseDown=s=>this._onMouseDown.fire(s),i.onMouseUp=s=>this._onMouseUp.fire(s),i.onMouseDrag=s=>this._onMouseDrag.fire(s),i.onMouseDrop=s=>this._onMouseDrop.fire(s),i.onMouseDropCanceled=s=>this._onMouseDropCanceled.fire(s),i.onMouseWheel=s=>this._onMouseWheel.fire(s),[new MJ(t,this._configuration,this._themeService.getColorTheme(),e,i,this._overflowWidgetsDomNode,this._instantiationService),!0]}_postDetachModelCleanup(e){e?.removeAllDecorationsWithOwnerId(this._id)}_detachModel(){if(this._contributionsDisposable?.dispose(),this._contributionsDisposable=void 0,!this._modelData)return null;const e=this._modelData.model,t=this._modelData.hasRealView?this._modelData.view.domNode.domNode:null;return this._modelData.dispose(),this._modelData=null,this._domElement.removeAttribute("data-mode-id"),t&&this._domElement.contains(t)&&t.remove(),this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),e}_removeDecorationType(e){this._codeEditorService.removeDecorationType(e)}hasModel(){return this._modelData!==null}showDropIndicatorAt(e){const t=[{range:new $(e.lineNumber,e.column,e.lineNumber,e.column),options:Y1.dropIntoEditorDecorationOptions}];this._dropIntoEditorDecorations.set(t),this.revealPosition(e,1)}removeDropIndicator(){this._dropIntoEditorDecorations.clear()}setContextValue(e,t){this._contextKeyService.createKey(e,t)}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&this._onBeginUpdate.fire()}_endUpdate(){this._updateCounter--,this._updateCounter===0&&this._onEndUpdate.fire()}};ZN=Y1=bRt([Nm(3,Tt),Nm(4,ai),Nm(5,_r),Nm(6,jt),Nm(7,go),Nm(8,Ts),Nm(9,_u),Nm(10,Zr),Nm(11,dt)],ZN);let yRt=0;class wRt{constructor(e,t,i,r,s,o){this.model=e,this.viewModel=t,this.view=i,this.hasRealView=r,this.listenersToRemove=s,this.attachedView=o}dispose(){er(this.listenersToRemove),this.model.onBeforeDetached(this.attachedView),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}}class Bwe extends me{constructor(e){super(),this._emitterOptions=e,this._onDidChangeToTrue=this._register(new fe(this._emitterOptions)),this.onDidChangeToTrue=this._onDidChangeToTrue.event,this._onDidChangeToFalse=this._register(new fe(this._emitterOptions)),this.onDidChangeToFalse=this._onDidChangeToFalse.event,this._value=0}setValue(e){const t=e?2:1;this._value!==t&&(this._value=t,this._value===2?this._onDidChangeToTrue.fire():this._value===1&&this._onDidChangeToFalse.fire())}}class sl extends fe{constructor(e,t){super({deliveryQueue:t}),this._contributions=e}fire(e){this._contributions.onBeforeInteractionEvent(),super.fire(e)}}class CRt extends me{constructor(e,t){super(),this._editor=e,t.createKey("editorId",e.getId()),this._editorSimpleInput=Q.editorSimpleInput.bindTo(t),this._editorFocus=Q.focus.bindTo(t),this._textInputFocus=Q.textInputFocus.bindTo(t),this._editorTextFocus=Q.editorTextFocus.bindTo(t),this._tabMovesFocus=Q.tabMovesFocus.bindTo(t),this._editorReadonly=Q.readOnly.bindTo(t),this._inDiffEditor=Q.inDiffEditor.bindTo(t),this._editorColumnSelection=Q.columnSelection.bindTo(t),this._hasMultipleSelections=Q.hasMultipleSelections.bindTo(t),this._hasNonEmptySelection=Q.hasNonEmptySelection.bindTo(t),this._canUndo=Q.canUndo.bindTo(t),this._canRedo=Q.canRedo.bindTo(t),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromConfig())),this._register(this._editor.onDidChangeCursorSelection(()=>this._updateFromSelection())),this._register(this._editor.onDidFocusEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidFocusEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidChangeModel(()=>this._updateFromModel())),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromModel())),this._register(xE.onDidChangeTabFocus(i=>this._tabMovesFocus.set(i))),this._updateFromConfig(),this._updateFromSelection(),this._updateFromFocus(),this._updateFromModel(),this._editorSimpleInput.set(this._editor.isSimpleWidget)}_updateFromConfig(){const e=this._editor.getOptions();this._tabMovesFocus.set(xE.getTabFocusMode()),this._editorReadonly.set(e.get(92)),this._inDiffEditor.set(e.get(61)),this._editorColumnSelection.set(e.get(22))}_updateFromSelection(){const e=this._editor.getSelections();e?(this._hasMultipleSelections.set(e.length>1),this._hasNonEmptySelection.set(e.some(t=>!t.isEmpty()))):(this._hasMultipleSelections.reset(),this._hasNonEmptySelection.reset())}_updateFromFocus(){this._editorFocus.set(this._editor.hasWidgetFocus()&&!this._editor.isSimpleWidget),this._editorTextFocus.set(this._editor.hasTextFocus()&&!this._editor.isSimpleWidget),this._textInputFocus.set(this._editor.hasTextFocus())}_updateFromModel(){const e=this._editor.getModel();this._canUndo.set(!!(e&&e.canUndo())),this._canRedo.set(!!(e&&e.canRedo()))}}class xRt extends me{constructor(e,t,i){super(),this._editor=e,this._contextKeyService=t,this._languageFeaturesService=i,this._langId=Q.languageId.bindTo(t),this._hasCompletionItemProvider=Q.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=Q.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=Q.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=Q.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=Q.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=Q.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=Q.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=Q.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=Q.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=Q.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=Q.hasReferenceProvider.bindTo(t),this._hasRenameProvider=Q.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=Q.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=Q.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=Q.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=Q.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=Q.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=Q.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInEmbeddedEditor=Q.isInEmbeddedEditor.bindTo(t);const r=()=>this._update();this._register(e.onDidChangeModel(r)),this._register(e.onDidChangeModelLanguage(r)),this._register(i.completionProvider.onDidChange(r)),this._register(i.codeActionProvider.onDidChange(r)),this._register(i.codeLensProvider.onDidChange(r)),this._register(i.definitionProvider.onDidChange(r)),this._register(i.declarationProvider.onDidChange(r)),this._register(i.implementationProvider.onDidChange(r)),this._register(i.typeDefinitionProvider.onDidChange(r)),this._register(i.hoverProvider.onDidChange(r)),this._register(i.documentHighlightProvider.onDidChange(r)),this._register(i.documentSymbolProvider.onDidChange(r)),this._register(i.referenceProvider.onDidChange(r)),this._register(i.renameProvider.onDidChange(r)),this._register(i.documentFormattingEditProvider.onDidChange(r)),this._register(i.documentRangeFormattingEditProvider.onDidChange(r)),this._register(i.signatureHelpProvider.onDidChange(r)),this._register(i.inlayHintsProvider.onDidChange(r)),r()}dispose(){super.dispose()}reset(){this._contextKeyService.bufferChangeEvents(()=>{this._langId.reset(),this._hasCompletionItemProvider.reset(),this._hasCodeActionsProvider.reset(),this._hasCodeLensProvider.reset(),this._hasDefinitionProvider.reset(),this._hasDeclarationProvider.reset(),this._hasImplementationProvider.reset(),this._hasTypeDefinitionProvider.reset(),this._hasHoverProvider.reset(),this._hasDocumentHighlightProvider.reset(),this._hasDocumentSymbolProvider.reset(),this._hasReferenceProvider.reset(),this._hasRenameProvider.reset(),this._hasDocumentFormattingProvider.reset(),this._hasDocumentSelectionFormattingProvider.reset(),this._hasSignatureHelpProvider.reset(),this._isInEmbeddedEditor.reset()})}_update(){const e=this._editor.getModel();if(!e){this.reset();return}this._contextKeyService.bufferChangeEvents(()=>{this._langId.set(e.getLanguageId()),this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(e)),this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(e)),this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(e)),this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(e)),this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(e)),this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(e)),this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(e)),this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(e)),this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(e)),this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(e)),this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(e)),this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(e)),this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(e)),this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(e)),this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(e)||this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(e).length+this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._isInEmbeddedEditor.set(e.uri.scheme===sn.walkThroughSnippet||e.uri.scheme===sn.vscodeChatCodeBlock)})}}class SRt extends me{constructor(e,t){super(),this._onChange=this._register(new fe),this.onChange=this._onChange.event,this._hadFocus=void 0,this._hasDomElementFocus=!1,this._domFocusTracker=this._register(Eg(e)),this._overflowWidgetsDomNodeHasFocus=!1,this._register(this._domFocusTracker.onDidFocus(()=>{this._hasDomElementFocus=!0,this._update()})),this._register(this._domFocusTracker.onDidBlur(()=>{this._hasDomElementFocus=!1,this._update()})),t&&(this._overflowWidgetsDomNode=this._register(Eg(t)),this._register(this._overflowWidgetsDomNode.onDidFocus(()=>{this._overflowWidgetsDomNodeHasFocus=!0,this._update()})),this._register(this._overflowWidgetsDomNode.onDidBlur(()=>{this._overflowWidgetsDomNodeHasFocus=!1,this._update()})))}_update(){const e=this._hasDomElementFocus||this._overflowWidgetsDomNodeHasFocus;this._hadFocus!==e&&(this._hadFocus=e,this._onChange.fire(void 0))}hasFocus(){return this._hadFocus??!1}}class kRt{get length(){return this._decorationIds.length}constructor(e,t){this._editor=e,this._decorationIds=[],this._isChangingDecorations=!1,Array.isArray(t)&&t.length>0&&this.set(t)}onDidChange(e,t,i){return this._editor.onDidChangeModelDecorations(r=>{this._isChangingDecorations||e.call(t,r)},i)}getRange(e){return!this._editor.hasModel()||e>=this._decorationIds.length?null:this._editor.getModel().getDecorationRange(this._decorationIds[e])}getRanges(){if(!this._editor.hasModel())return[];const e=this._editor.getModel(),t=[];for(const i of this._decorationIds){const r=e.getDecorationRange(i);r&&t.push(r)}return t}has(e){return this._decorationIds.includes(e.id)}clear(){this._decorationIds.length!==0&&this.set([])}set(e){try{this._isChangingDecorations=!0,this._editor.changeDecorations(t=>{this._decorationIds=t.deltaDecorations(this._decorationIds,e)})}finally{this._isChangingDecorations=!1}return this._decorationIds}append(e){let t=[];try{this._isChangingDecorations=!0,this._editor.changeDecorations(i=>{t=i.deltaDecorations([],e),this._decorationIds=this._decorationIds.concat(t)})}finally{this._isChangingDecorations=!1}return t}}const ERt=encodeURIComponent("");function Nq(n){return ERt+encodeURIComponent(n.toString())+LRt}const TRt=encodeURIComponent('');function IRt(n){return TRt+encodeURIComponent(n.toString())+DRt}dh((n,e)=>{const t=n.getColor(aW);t&&e.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${Nq(t)}") repeat-x bottom left; }`);const i=n.getColor(X_);i&&e.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${Nq(i)}") repeat-x bottom left; }`);const r=n.getColor(Xp);r&&e.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${Nq(r)}") repeat-x bottom left; }`);const s=n.getColor(_yt);s&&e.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${IRt(s)}") no-repeat bottom left; }`);const o=n.getColor(eEt);o&&e.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${o.rgba.a}; }`)});class Ag{static capture(e){if(e.getScrollTop()===0||e.hasPendingScrollAnimation())return new Ag(e.getScrollTop(),e.getContentHeight(),null,0,null);let t=null,i=0;const r=e.getVisibleRanges();if(r.length>0){t=r[0].getStartPosition();const s=e.getTopForPosition(t.lineNumber,t.column);i=e.getScrollTop()-s}return new Ag(e.getScrollTop(),e.getContentHeight(),t,i,e.getPosition())}constructor(e,t,i,r,s){this._initialScrollTop=e,this._initialContentHeight=t,this._visiblePosition=i,this._visiblePositionScrollDelta=r,this._cursorPosition=s}restore(e){if(!(this._initialContentHeight===e.getContentHeight()&&this._initialScrollTop===e.getScrollTop())&&this._visiblePosition){const t=e.getTopForPosition(this._visiblePosition.lineNumber,this._visiblePosition.column);e.setScrollTop(t+this._visiblePositionScrollDelta)}}restoreRelativeVerticalPositionOfCursor(e){if(this._initialContentHeight===e.getContentHeight()&&this._initialScrollTop===e.getScrollTop())return;const t=e.getPosition();if(!this._cursorPosition||!t)return;const i=e.getTopForLineNumber(t.lineNumber)-e.getTopForLineNumber(this._cursorPosition.lineNumber);e.setScrollTop(e.getScrollTop()+i,1)}}function ARt(n,e,t,i){if(n.length===0)return e;if(e.length===0)return n;const r=[];let s=0,o=0;for(;su?(r.push(l),o++):(r.push(i(a,l)),s++,o++)}for(;s`Apply decorations from ${e.debugName}`},r=>{const s=e.read(r);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function PS(n,e){return n.appendChild(e),Lt(()=>{e.remove()})}function NRt(n,e){return n.prepend(e),Lt(()=>{e.remove()})}class S8e extends me{get width(){return this._width}get height(){return this._height}get automaticLayout(){return this._automaticLayout}constructor(e,t){super(),this._automaticLayout=!1,this.elementSizeObserver=this._register(new n8e(e,t)),this._width=Sn(this,this.elementSizeObserver.getWidth()),this._height=Sn(this,this.elementSizeObserver.getHeight()),this._register(this.elementSizeObserver.onDidChange(i=>qr(r=>{this._width.set(this.elementSizeObserver.getWidth(),r),this._height.set(this.elementSizeObserver.getHeight(),r)})))}observe(e){this.elementSizeObserver.observe(e)}setAutomaticLayout(e){this._automaticLayout=e,e?this.elementSizeObserver.startObserving():this.elementSizeObserver.stopObserving()}}function $we(n,e,t){let i=e.get(),r=i,s=i;const o=Sn("animatedValue",i);let a=-1;const l=300;let c;t.add(lO({createEmptyChangeSummary:()=>({animate:!1}),handleChange:(d,h)=>(d.didChange(e)&&(h.animate=h.animate||d.change),!0)},(d,h)=>{c!==void 0&&(n.cancelAnimationFrame(c),c=void 0),r=s,i=e.read(d),a=Date.now()-(h.animate?0:l),u()}));function u(){const d=Date.now()-a;s=Math.floor(RRt(d,r,i-r,l)),d{this._actualTop.set(i,void 0)},this.onComputedHeight=i=>{this._actualHeight.set(i,void 0)}}}class eue{static{this._counter=0}constructor(e,t){this._editor=e,this._domElement=t,this._overlayWidgetId=`managedOverlayWidget-${eue._counter++}`,this._overlayWidget={getId:()=>this._overlayWidgetId,getDomNode:()=>this._domElement,getPosition:()=>null},this._editor.addOverlayWidget(this._overlayWidget)}dispose(){this._editor.removeOverlayWidget(this._overlayWidget)}}function J_(n,e){return tn(t=>{for(let[i,r]of Object.entries(e))r&&typeof r=="object"&&"read"in r&&(r=r.read(t)),typeof r=="number"&&(r=`${r}px`),i=i.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),n.style[i]=r})}function _9(n,e,t,i){const r=new ke,s=[];return r.add(wc((o,a)=>{const l=e.read(o),c=new Map,u=new Map;t&&t(!0),n.changeViewZones(d=>{for(const h of s)d.removeZone(h),i?.delete(h);s.length=0;for(const h of l){const f=d.addZone(h);h.setZoneId&&h.setZoneId(f),s.push(f),i?.add(f),c.set(h,f)}}),t&&t(!1),a.add(lO({createEmptyChangeSummary(){return{zoneIds:[]}},handleChange(d,h){const f=u.get(d.changedObservable);return f!==void 0&&h.zoneIds.push(f),!0}},(d,h)=>{for(const f of l)f.onChange&&(u.set(f.onChange,c.get(f)),f.onChange.read(d));t&&t(!0),n.changeViewZones(f=>{for(const g of h.zoneIds)f.layoutZone(g)}),t&&t(!1)}))})),r.add({dispose(){t&&t(!0),n.changeViewZones(o=>{for(const a of s)o.removeZone(a)}),i?.clear(),t&&t(!1)}}),r}class PRt extends Kr{dispose(){super.dispose(!0)}}function Wwe(n,e){const t=hN(e,r=>r.original.startLineNumber<=n.lineNumber);if(!t)return $.fromPositions(n);if(t.original.endLineNumberExclusive<=n.lineNumber){const r=n.lineNumber-t.original.endLineNumberExclusive+t.modified.endLineNumberExclusive;return $.fromPositions(new he(r,n.column))}if(!t.innerChanges)return $.fromPositions(new he(t.modified.startLineNumber,1));const i=hN(t.innerChanges,r=>r.originalRange.getStartPosition().isBeforeOrEqual(n));if(!i){const r=n.lineNumber-t.original.startLineNumber+t.modified.startLineNumber;return $.fromPositions(new he(r,n.column))}if(i.originalRange.containsPosition(n))return i.modifiedRange;{const r=ORt(i.originalRange.getEndPosition(),n);return $.fromPositions(r.addToPosition(i.modifiedRange.getEndPosition()))}}function ORt(n,e){return n.lineNumber===e.lineNumber?new _c(0,e.column-n.column):new _c(e.lineNumber-n.lineNumber,e.column-1)}function MRt(n,e){let t;return n.filter(i=>{const r=e(i,t);return t=i,r})}class v9{static create(e,t=void 0){return new Hwe(e,e,t)}static createWithDisposable(e,t,i=void 0){const r=new ke;return r.add(t),r.add(e),new Hwe(e,r,i)}}class Hwe extends v9{constructor(e,t,i){super(),this.object=e,this._disposable=t,this._debugOwner=i,this._refCount=1,this._isDisposed=!1,this._owners=[],i&&this._addOwner(i)}_addOwner(e){e&&this._owners.push(e)}createNewRef(e){return this._refCount++,e&&this._addOwner(e),new FRt(this,e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._decreaseRefCount(this._debugOwner))}_decreaseRefCount(e){if(this._refCount--,this._refCount===0&&this._disposable.dispose(),e){const t=this._owners.indexOf(e);t!==-1&&this._owners.splice(t,1)}}}class FRt extends v9{constructor(e,t){super(),this._base=e,this._debugOwner=t,this._isDisposed=!1}get object(){return this._base.object}createNewRef(e){return this._base.createNewRef(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._base._decreaseRefCount(this._debugOwner))}}var tue=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},nue=function(n,e){return function(t,i){e(t,i,n)}};const BRt=kr("diff-review-insert",ze.add,w("accessibleDiffViewerInsertIcon","Icon for 'Insert' in accessible diff viewer.")),$Rt=kr("diff-review-remove",ze.remove,w("accessibleDiffViewerRemoveIcon","Icon for 'Remove' in accessible diff viewer.")),WRt=kr("diff-review-close",ze.close,w("accessibleDiffViewerCloseIcon","Icon for 'Close' in accessible diff viewer."));let Py=class extends me{static{this._ttPolicy=p0("diffReview",{createHTML:e=>e})}constructor(e,t,i,r,s,o,a,l,c){super(),this._parentNode=e,this._visible=t,this._setVisible=i,this._canClose=r,this._width=s,this._height=o,this._diffs=a,this._models=l,this._instantiationService=c,this._state=Jb(this,(u,d)=>{const h=this._visible.read(u);if(this._parentNode.style.visibility=h?"visible":"hidden",!h)return null;const f=d.add(this._instantiationService.createInstance(UJ,this._diffs,this._models,this._setVisible,this._canClose)),g=d.add(this._instantiationService.createInstance(jJ,this._parentNode,f,this._width,this._height,this._models));return{model:f,view:g}}).recomputeInitiallyAndOnChange(this._store)}next(){qr(e=>{const t=this._visible.get();this._setVisible(!0,e),t&&this._state.get().model.nextGroup(e)})}prev(){qr(e=>{this._setVisible(!0,e),this._state.get().model.previousGroup(e)})}close(){qr(e=>{this._setVisible(!1,e)})}};Py=tue([nue(8,Tt)],Py);let UJ=class extends me{constructor(e,t,i,r,s){super(),this._diffs=e,this._models=t,this._setVisible=i,this.canClose=r,this._accessibilitySignalService=s,this._groups=Sn(this,[]),this._currentGroupIdx=Sn(this,0),this._currentElementIdx=Sn(this,0),this.groups=this._groups,this.currentGroup=this._currentGroupIdx.map((o,a)=>this._groups.read(a)[o]),this.currentGroupIndex=this._currentGroupIdx,this.currentElement=this._currentElementIdx.map((o,a)=>this.currentGroup.read(a)?.lines[o]),this._register(tn(o=>{const a=this._diffs.read(o);if(!a){this._groups.set([],void 0);return}const l=HRt(a,this._models.getOriginalModel().getLineCount(),this._models.getModifiedModel().getLineCount());qr(c=>{const u=this._models.getModifiedPosition();if(u){const d=l.findIndex(h=>u?.lineNumber{const a=this.currentElement.read(o);a?.type===Nl.Deleted?this._accessibilitySignalService.playSignal(Ai.diffLineDeleted,{source:"accessibleDiffViewer.currentElementChanged"}):a?.type===Nl.Added&&this._accessibilitySignalService.playSignal(Ai.diffLineInserted,{source:"accessibleDiffViewer.currentElementChanged"})})),this._register(tn(o=>{const a=this.currentElement.read(o);if(a&&a.type!==Nl.Header){const l=a.modifiedLineNumber??a.diff.modified.startLineNumber;this._models.modifiedSetSelection($.fromPositions(new he(l,1)))}}))}_goToGroupDelta(e,t){const i=this.groups.get();!i||i.length<=1||Fw(t,r=>{this._currentGroupIdx.set(Dn.ofLength(i.length).clipCyclic(this._currentGroupIdx.get()+e),r),this._currentElementIdx.set(0,r)})}nextGroup(e){this._goToGroupDelta(1,e)}previousGroup(e){this._goToGroupDelta(-1,e)}_goToLineDelta(e){const t=this.currentGroup.get();!t||t.lines.length<=1||qr(i=>{this._currentElementIdx.set(Dn.ofLength(t.lines.length).clip(this._currentElementIdx.get()+e),i)})}goToNextLine(){this._goToLineDelta(1)}goToPreviousLine(){this._goToLineDelta(-1)}goToLine(e){const t=this.currentGroup.get();if(!t)return;const i=t.lines.indexOf(e);i!==-1&&qr(r=>{this._currentElementIdx.set(i,r)})}revealCurrentElementInEditor(){if(!this.canClose.get())return;this._setVisible(!1,void 0);const e=this.currentElement.get();e&&(e.type===Nl.Deleted?this._models.originalReveal($.fromPositions(new he(e.originalLineNumber,1))):this._models.modifiedReveal(e.type!==Nl.Header?$.fromPositions(new he(e.modifiedLineNumber,1)):void 0))}close(){this.canClose.get()&&(this._setVisible(!1,void 0),this._models.modifiedFocus())}};UJ=tue([nue(4,t1)],UJ);const HT=3;function HRt(n,e,t){const i=[];for(const r of dae(n,(s,o)=>o.modified.startLineNumber-s.modified.endLineNumberExclusive<2*HT)){const s=[];s.push(new zRt);const o=new gn(Math.max(1,r[0].original.startLineNumber-HT),Math.min(r[r.length-1].original.endLineNumberExclusive+HT,e+1)),a=new gn(Math.max(1,r[0].modified.startLineNumber-HT),Math.min(r[r.length-1].modified.endLineNumberExclusive+HT,t+1));r4e(r,(u,d)=>{const h=new gn(u?u.original.endLineNumberExclusive:o.startLineNumber,d?d.original.startLineNumber:o.endLineNumberExclusive),f=new gn(u?u.modified.endLineNumberExclusive:a.startLineNumber,d?d.modified.startLineNumber:a.endLineNumberExclusive);h.forEach(g=>{s.push(new qRt(g,f.startLineNumber+(g-h.startLineNumber)))}),d&&(d.original.forEach(g=>{s.push(new URt(d,g))}),d.modified.forEach(g=>{s.push(new jRt(d,g))}))});const l=r[0].modified.join(r[r.length-1].modified),c=r[0].original.join(r[r.length-1].original);i.push(new VRt(new gl(l,c),s))}return i}var Nl;(function(n){n[n.Header=0]="Header",n[n.Unchanged=1]="Unchanged",n[n.Deleted=2]="Deleted",n[n.Added=3]="Added"})(Nl||(Nl={}));class VRt{constructor(e,t){this.range=e,this.lines=t}}class zRt{constructor(){this.type=Nl.Header}}class URt{constructor(e,t){this.diff=e,this.originalLineNumber=t,this.type=Nl.Deleted,this.modifiedLineNumber=void 0}}class jRt{constructor(e,t){this.diff=e,this.modifiedLineNumber=t,this.type=Nl.Added,this.originalLineNumber=void 0}}class qRt{constructor(e,t){this.originalLineNumber=e,this.modifiedLineNumber=t,this.type=Nl.Unchanged}}let jJ=class extends me{constructor(e,t,i,r,s,o){super(),this._element=e,this._model=t,this._width=i,this._height=r,this._models=s,this._languageService=o,this.domNode=this._element,this.domNode.className="monaco-component diff-review monaco-editor-background";const a=document.createElement("div");a.className="diff-review-actions",this._actionBar=this._register(new ed(a)),this._register(tn(l=>{this._actionBar.clear(),this._model.canClose.read(l)&&this._actionBar.push(new su("diffreview.close",w("label.close","Close"),"close-diff-review "+zt.asClassName(WRt),!0,async()=>t.close()),{label:!1,icon:!0})})),this._content=document.createElement("div"),this._content.className="diff-review-content",this._content.setAttribute("role","code"),this._scrollbar=this._register(new tO(this._content,{})),ea(this.domNode,this._scrollbar.getDomNode(),a),this._register(tn(l=>{this._height.read(l),this._width.read(l),this._scrollbar.scanDomNode()})),this._register(Lt(()=>{ea(this.domNode)})),this._register(J_(this.domNode,{width:this._width,height:this._height})),this._register(J_(this._content,{width:this._width,height:this._height})),this._register(wc((l,c)=>{this._model.currentGroup.read(l),this._render(c)})),this._register(Jr(this.domNode,"keydown",l=>{(l.equals(18)||l.equals(2066)||l.equals(530))&&(l.preventDefault(),this._model.goToNextLine()),(l.equals(16)||l.equals(2064)||l.equals(528))&&(l.preventDefault(),this._model.goToPreviousLine()),(l.equals(9)||l.equals(2057)||l.equals(521)||l.equals(1033))&&(l.preventDefault(),this._model.close()),(l.equals(10)||l.equals(3))&&(l.preventDefault(),this._model.revealCurrentElementInEditor())}))}_render(e){const t=this._models.getOriginalOptions(),i=this._models.getModifiedOptions(),r=document.createElement("div");r.className="diff-review-table",r.setAttribute("role","list"),r.setAttribute("aria-label",w("ariaLabel","Accessible Diff Viewer. Use arrow up and down to navigate.")),ta(r,i.get(50)),ea(this._content,r);const s=this._models.getOriginalModel(),o=this._models.getModifiedModel();if(!s||!o)return;const a=s.getOptions(),l=o.getOptions(),c=i.get(67),u=this._model.currentGroup.get();for(const d of u?.lines||[]){if(!u)break;let h;if(d.type===Nl.Header){const g=document.createElement("div");g.className="diff-review-row",g.setAttribute("role","listitem");const p=u.range,m=this._model.currentGroupIndex.get(),_=this._model.groups.get().length,v=k=>k===0?w("no_lines_changed","no lines changed"):k===1?w("one_line_changed","1 line changed"):w("more_lines_changed","{0} lines changed",k),y=v(p.original.length),C=v(p.modified.length);g.setAttribute("aria-label",w({key:"header",comment:["This is the ARIA label for a git diff header.","A git diff header looks like this: @@ -154,12 +159,39 @@.","That encodes that at original line 154 (which is now line 159), 12 lines were removed/changed with 39 lines.","Variables 0 and 1 refer to the diff index out of total number of diffs.","Variables 2 and 4 will be numbers (a line number).",'Variables 3 and 5 will be "no lines changed", "1 line changed" or "X lines changed", localized separately.']},"Difference {0} of {1}: original line {2}, {3}, modified line {4}, {5}",m+1,_,p.original.startLineNumber,y,p.modified.startLineNumber,C));const x=document.createElement("div");x.className="diff-review-cell diff-review-summary",x.appendChild(document.createTextNode(`${m+1}/${_}: @@ -${p.original.startLineNumber},${p.original.length} +${p.modified.startLineNumber},${p.modified.length} @@`)),g.appendChild(x),h=g}else h=this._createRow(d,c,this._width.get(),t,s,a,i,o,l);r.appendChild(h);const f=St(g=>this._model.currentElement.read(g)===d);e.add(tn(g=>{const p=f.read(g);h.tabIndex=p?0:-1,p&&h.focus()})),e.add(Ce(h,"focus",()=>{this._model.goToLine(d)}))}this._scrollbar.scanDomNode()}_createRow(e,t,i,r,s,o,a,l,c){const u=r.get(146),d=u.glyphMarginWidth+u.lineNumbersWidth,h=a.get(146),f=10+h.glyphMarginWidth+h.lineNumbersWidth;let g="diff-review-row",p="";const m="diff-review-spacer";let _=null;switch(e.type){case Nl.Added:g="diff-review-row line-insert",p=" char-insert",_=BRt;break;case Nl.Deleted:g="diff-review-row line-delete",p=" char-delete",_=$Rt;break}const v=document.createElement("div");v.style.minWidth=i+"px",v.className=g,v.setAttribute("role","listitem"),v.ariaLevel="";const y=document.createElement("div");y.className="diff-review-cell",y.style.height=`${t}px`,v.appendChild(y);const C=document.createElement("span");C.style.width=d+"px",C.style.minWidth=d+"px",C.className="diff-review-line-number"+p,e.originalLineNumber!==void 0?C.appendChild(document.createTextNode(String(e.originalLineNumber))):C.innerText=" ",y.appendChild(C);const x=document.createElement("span");x.style.width=f+"px",x.style.minWidth=f+"px",x.style.paddingRight="10px",x.className="diff-review-line-number"+p,e.modifiedLineNumber!==void 0?x.appendChild(document.createTextNode(String(e.modifiedLineNumber))):x.innerText=" ",y.appendChild(x);const k=document.createElement("span");if(k.className=m,_){const I=document.createElement("span");I.className=zt.asClassName(_),I.innerText="  ",k.appendChild(I)}else k.innerText="  ";y.appendChild(k);let L;if(e.modifiedLineNumber!==void 0){let I=this._getLineHtml(l,a,c.tabSize,e.modifiedLineNumber,this._languageService.languageIdCodec);Py._ttPolicy&&(I=Py._ttPolicy.createHTML(I)),y.insertAdjacentHTML("beforeend",I),L=l.getLineContent(e.modifiedLineNumber)}else{let I=this._getLineHtml(s,r,o.tabSize,e.originalLineNumber,this._languageService.languageIdCodec);Py._ttPolicy&&(I=Py._ttPolicy.createHTML(I)),y.insertAdjacentHTML("beforeend",I),L=s.getLineContent(e.originalLineNumber)}L.length===0&&(L=w("blankLine","blank"));let D="";switch(e.type){case Nl.Unchanged:e.originalLineNumber===e.modifiedLineNumber?D=w({key:"unchangedLine",comment:["The placeholders are contents of the line and should not be translated."]},"{0} unchanged line {1}",L,e.originalLineNumber):D=w("equalLine","{0} original line {1} modified line {2}",L,e.originalLineNumber,e.modifiedLineNumber);break;case Nl.Added:D=w("insertLine","+ {0} modified line {1}",L,e.modifiedLineNumber);break;case Nl.Deleted:D=w("deleteLine","- {0} original line {1}",L,e.originalLineNumber);break}return v.setAttribute("aria-label",D),v}_getLineHtml(e,t,i,r,s){const o=e.getLineContent(r),a=t.get(50),l=Fs.createEmpty(o,s),c=sd.isBasicASCII(o,e.mightContainNonBasicASCII()),u=sd.containsRTL(o,c,e.mightContainRTL());return WW(new n1(a.isMonospace&&!t.get(33),a.canUseHalfwidthRightwardsArrow,o,!1,c,u,0,l,[],i,0,a.spaceWidth,a.middotWidth,a.wsmiddotWidth,t.get(118),t.get(100),t.get(95),t.get(51)!==zh.OFF,null)).html}};jJ=tue([nue(5,Hr)],jJ);class KRt{constructor(e){this.editors=e}getOriginalModel(){return this.editors.original.getModel()}getOriginalOptions(){return this.editors.original.getOptions()}originalReveal(e){this.editors.original.revealRange(e),this.editors.original.setSelection(e),this.editors.original.focus()}getModifiedModel(){return this.editors.modified.getModel()}getModifiedOptions(){return this.editors.modified.getOptions()}modifiedReveal(e){e&&(this.editors.modified.revealRange(e),this.editors.modified.setSelection(e)),this.editors.modified.focus()}modifiedSetSelection(e){this.editors.modified.setSelection(e)}modifiedFocus(){this.editors.modified.focus()}getModifiedPosition(){return this.editors.modified.getPosition()??void 0}}J("diffEditor.move.border","#8b8b8b9c",w("diffEditor.move.border","The border color for text that got moved in the diff editor."));J("diffEditor.moveActive.border","#FFA500",w("diffEditor.moveActive.border","The active border color for text that got moved in the diff editor."));J("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},w("diffEditor.unchangedRegionShadow","The color of the shadow around unchanged region widgets."));const GRt=kr("diff-insert",ze.add,w("diffInsertIcon","Line decoration for inserts in the diff editor.")),k8e=kr("diff-remove",ze.remove,w("diffRemoveIcon","Line decoration for removals in the diff editor.")),b9=un.register({className:"line-insert",description:"line-insert",isWholeLine:!0,linesDecorationsClassName:"insert-sign "+zt.asClassName(GRt),marginClassName:"gutter-insert"}),XN=un.register({className:"line-delete",description:"line-delete",isWholeLine:!0,linesDecorationsClassName:"delete-sign "+zt.asClassName(k8e),marginClassName:"gutter-delete"}),Vwe=un.register({className:"line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),zwe=un.register({className:"line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),y9=un.register({className:"char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),iue=un.register({className:"char-insert",description:"char-insert",isWholeLine:!0}),rue=un.register({className:"char-insert diff-range-empty",description:"char-insert diff-range-empty"}),kE=un.register({className:"char-delete",description:"char-delete",shouldFillLineOnLineBreak:!0}),sue=un.register({className:"char-delete",description:"char-delete",isWholeLine:!0}),oue=un.register({className:"char-delete diff-range-empty",description:"char-delete diff-range-empty"});var E8e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},qJ=function(n,e){return function(t,i){e(t,i,n)}},Z1;const vO=On("diffProviderFactoryService");let KJ=class{constructor(e){this.instantiationService=e}createDiffProvider(e){return this.instantiationService.createInstance(GJ,e)}};KJ=E8e([qJ(0,Tt)],KJ);Vn(vO,KJ,1);let GJ=class{static{Z1=this}static{this.diffCache=new Map}constructor(e,t,i){this.editorWorkerService=t,this.telemetryService=i,this.onDidChangeEventEmitter=new fe,this.onDidChange=this.onDidChangeEventEmitter.event,this.diffAlgorithm="advanced",this.diffAlgorithmOnDidChangeSubscription=void 0,this.setOptions(e)}dispose(){this.diffAlgorithmOnDidChangeSubscription?.dispose()}async computeDiff(e,t,i,r){if(typeof this.diffAlgorithm!="string")return this.diffAlgorithm.computeDiff(e,t,i,r);if(e.isDisposed()||t.isDisposed())return{changes:[],identical:!0,quitEarly:!1,moves:[]};if(e.getLineCount()===1&&e.getLineMaxColumn(1)===1)return t.getLineCount()===1&&t.getLineMaxColumn(1)===1?{changes:[],identical:!0,quitEarly:!1,moves:[]}:{changes:[new Ju(new gn(1,2),new gn(1,t.getLineCount()+1),[new Mu(e.getFullModelRange(),t.getFullModelRange())])],identical:!1,quitEarly:!1,moves:[]};const s=JSON.stringify([e.uri.toString(),t.uri.toString()]),o=JSON.stringify([e.id,t.id,e.getAlternativeVersionId(),t.getAlternativeVersionId(),JSON.stringify(i)]),a=Z1.diffCache.get(s);if(a&&a.context===o)return a.result;const l=Bo.create(),c=await this.editorWorkerService.computeDiff(e.uri,t.uri,i,this.diffAlgorithm),u=l.elapsed();if(this.telemetryService.publicLog2("diffEditor.computeDiff",{timeMs:u,timedOut:c?.quitEarly??!0,detectedMoves:i.computeMoves?c?.moves.length??0:-1}),r.isCancellationRequested)return{changes:[],identical:!1,quitEarly:!0,moves:[]};if(!c)throw new Error("no diff result available");return Z1.diffCache.size>10&&Z1.diffCache.delete(Z1.diffCache.keys().next().value),Z1.diffCache.set(s,{result:c,context:o}),c}setOptions(e){let t=!1;e.diffAlgorithm&&this.diffAlgorithm!==e.diffAlgorithm&&(this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.diffAlgorithmOnDidChangeSubscription=void 0,this.diffAlgorithm=e.diffAlgorithm,typeof e.diffAlgorithm!="string"&&(this.diffAlgorithmOnDidChangeSubscription=e.diffAlgorithm.onDidChange(()=>this.onDidChangeEventEmitter.fire())),t=!0),t&&this.onDidChangeEventEmitter.fire()}};GJ=Z1=E8e([qJ(1,Oc),qJ(2,Qa)],GJ);function JW(){return dZ&&!!dZ.VSCODE_DEV}function L8e(n){if(JW()){const e=YRt();return e.add(n),{dispose(){e.delete(n)}}}else return{dispose(){}}}function YRt(){r3||(r3=new Set);const n=globalThis;return n.$hotReload_applyNewExports||(n.$hotReload_applyNewExports=e=>{const t={config:{mode:void 0},...e},i=[];for(const r of r3){const s=r(t);s&&i.push(s)}if(i.length>0)return r=>{let s=!1;for(const o of i)o(r)&&(s=!0);return s}}),r3}let r3;JW()&&L8e(({oldExports:n,newSrc:e,config:t})=>{if(t.mode==="patch-prototype")return i=>{for(const r in i){const s=i[r];if(console.log(`[hot-reload] Patching prototype methods of '${r}'`,{exportedItem:s}),typeof s=="function"&&s.prototype){const o=n[r];if(o){for(const a of Object.getOwnPropertyNames(s.prototype)){const l=Object.getOwnPropertyDescriptor(s.prototype,a),c=Object.getOwnPropertyDescriptor(o.prototype,a);l?.value?.toString()!==c?.value?.toString()&&console.log(`[hot-reload] Patching prototype method '${r}.${a}'`),Object.defineProperty(o.prototype,a,l)}i[r]=o}}}return!0}});function Yc(n,e){return ZRt([n],e),n}function ZRt(n,e){JW()&&xa("reload",i=>L8e(({oldExports:r})=>{if([...Object.values(r)].some(s=>n.includes(s)))return s=>(i(void 0),!0)})).read(e)}var XRt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},QRt=function(n,e){return function(t,i){e(t,i,n)}};let YJ=class extends me{setActiveMovedText(e){this._activeMovedText.set(e,void 0)}constructor(e,t,i){super(),this.model=e,this._options=t,this._diffProviderFactoryService=i,this._isDiffUpToDate=Sn(this,!1),this.isDiffUpToDate=this._isDiffUpToDate,this._diff=Sn(this,void 0),this.diff=this._diff,this._unchangedRegions=Sn(this,void 0),this.unchangedRegions=St(this,a=>this._options.hideUnchangedRegions.read(a)?this._unchangedRegions.read(a)?.regions??[]:(qr(l=>{for(const c of this._unchangedRegions.get()?.regions||[])c.collapseAll(l)}),[])),this.movedTextToCompare=Sn(this,void 0),this._activeMovedText=Sn(this,void 0),this._hoveredMovedText=Sn(this,void 0),this.activeMovedText=St(this,a=>this.movedTextToCompare.read(a)??this._hoveredMovedText.read(a)??this._activeMovedText.read(a)),this._cancellationTokenSource=new Kr,this._diffProvider=St(this,a=>{const l=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:this._options.diffAlgorithm.read(a)}),c=xa("onDidChange",l.onDidChange);return{diffProvider:l,onChangeSignal:c}}),this._register(Lt(()=>this._cancellationTokenSource.cancel()));const r=r2("contentChangedSignal"),s=this._register(new Ui(()=>r.trigger(void 0),200));this._register(tn(a=>{const l=this._unchangedRegions.read(a);if(!l||l.regions.some(g=>g.isDragged.read(a)))return;const c=l.originalDecorationIds.map(g=>e.original.getDecorationRange(g)).map(g=>g?gn.fromRangeInclusive(g):void 0),u=l.modifiedDecorationIds.map(g=>e.modified.getDecorationRange(g)).map(g=>g?gn.fromRangeInclusive(g):void 0),d=l.regions.map((g,p)=>!c[p]||!u[p]?void 0:new Bv(c[p].startLineNumber,u[p].startLineNumber,c[p].length,g.visibleLineCountTop.read(a),g.visibleLineCountBottom.read(a))).filter(Bp),h=[];let f=!1;for(const g of dae(d,(p,m)=>p.getHiddenModifiedRange(a).endLineNumberExclusive===m.getHiddenModifiedRange(a).startLineNumber))if(g.length>1){f=!0;const p=g.reduce((_,v)=>_+v.lineCount,0),m=new Bv(g[0].originalLineNumber,g[0].modifiedLineNumber,p,g[0].visibleLineCountTop.get(),g[g.length-1].visibleLineCountBottom.get());h.push(m)}else h.push(g[0]);if(f){const g=e.original.deltaDecorations(l.originalDecorationIds,h.map(m=>({range:m.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),p=e.modified.deltaDecorations(l.modifiedDecorationIds,h.map(m=>({range:m.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));qr(m=>{this._unchangedRegions.set({regions:h,originalDecorationIds:g,modifiedDecorationIds:p},m)})}}));const o=(a,l,c)=>{const u=Bv.fromDiffs(a.changes,e.original.getLineCount(),e.modified.getLineCount(),this._options.hideUnchangedRegionsMinimumLineCount.read(c),this._options.hideUnchangedRegionsContextLineCount.read(c));let d;const h=this._unchangedRegions.get();if(h){const m=h.originalDecorationIds.map(C=>e.original.getDecorationRange(C)).map(C=>C?gn.fromRangeInclusive(C):void 0),_=h.modifiedDecorationIds.map(C=>e.modified.getDecorationRange(C)).map(C=>C?gn.fromRangeInclusive(C):void 0);let y=MRt(h.regions.map((C,x)=>{if(!m[x]||!_[x])return;const k=m[x].length;return new Bv(m[x].startLineNumber,_[x].startLineNumber,k,Math.min(C.visibleLineCountTop.get(),k),Math.min(C.visibleLineCountBottom.get(),k-C.visibleLineCountTop.get()))}).filter(Bp),(C,x)=>!x||C.modifiedLineNumber>=x.modifiedLineNumber+x.lineCount&&C.originalLineNumber>=x.originalLineNumber+x.lineCount).map(C=>new gl(C.getHiddenOriginalRange(c),C.getHiddenModifiedRange(c)));y=gl.clip(y,gn.ofLength(1,e.original.getLineCount()),gn.ofLength(1,e.modified.getLineCount())),d=gl.inverse(y,e.original.getLineCount(),e.modified.getLineCount())}const f=[];if(d)for(const m of u){const _=d.filter(v=>v.original.intersectsStrict(m.originalUnchangedRange)&&v.modified.intersectsStrict(m.modifiedUnchangedRange));f.push(...m.setVisibleRanges(_,l))}else f.push(...u);const g=e.original.deltaDecorations(h?.originalDecorationIds||[],f.map(m=>({range:m.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),p=e.modified.deltaDecorations(h?.modifiedDecorationIds||[],f.map(m=>({range:m.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));this._unchangedRegions.set({regions:f,originalDecorationIds:g,modifiedDecorationIds:p},l)};this._register(e.modified.onDidChangeContent(a=>{if(this._diff.get()){const c=m_.fromModelContentChanges(a.changes);this._lastDiff,e.original,e.modified}this._isDiffUpToDate.set(!1,void 0),s.schedule()})),this._register(e.original.onDidChangeContent(a=>{if(this._diff.get()){const c=m_.fromModelContentChanges(a.changes);this._lastDiff,e.original,e.modified}this._isDiffUpToDate.set(!1,void 0),s.schedule()})),this._register(wc(async(a,l)=>{this._options.hideUnchangedRegionsMinimumLineCount.read(a),this._options.hideUnchangedRegionsContextLineCount.read(a),s.cancel(),r.read(a);const c=this._diffProvider.read(a);c.onChangeSignal.read(a),Yc(G3e,a),Yc(NX,a),this._isDiffUpToDate.set(!1,void 0);let u=[];l.add(e.original.onDidChangeContent(f=>{const g=m_.fromModelContentChanges(f.changes);u=$8(u,g)}));let d=[];l.add(e.modified.onDidChangeContent(f=>{const g=m_.fromModelContentChanges(f.changes);d=$8(d,g)}));let h=await c.diffProvider.computeDiff(e.original,e.modified,{ignoreTrimWhitespace:this._options.ignoreTrimWhitespace.read(a),maxComputationTimeMs:this._options.maxComputationTimeMs.read(a),computeMoves:this._options.showMoves.read(a)},this._cancellationTokenSource.token);this._cancellationTokenSource.token.isCancellationRequested||e.original.isDisposed()||e.modified.isDisposed()||(h=JRt(h,e.original,e.modified),h=(e.original,e.modified,void 0)??h,h=(e.original,e.modified,void 0)??h,qr(f=>{o(h,f),this._lastDiff=h;const g=aue.fromDiffResult(h);this._diff.set(g,f),this._isDiffUpToDate.set(!0,f);const p=this.movedTextToCompare.get();this.movedTextToCompare.set(p?this._lastDiff.moves.find(m=>m.lineRangeMapping.modified.intersect(p.lineRangeMapping.modified)):void 0,f)}))}))}ensureModifiedLineIsVisible(e,t,i){if(this.diff.get()?.mappings.length===0)return;const r=this._unchangedRegions.get()?.regions||[];for(const s of r)if(s.getHiddenModifiedRange(void 0).contains(e)){s.showModifiedLine(e,t,i);return}}ensureOriginalLineIsVisible(e,t,i){if(this.diff.get()?.mappings.length===0)return;const r=this._unchangedRegions.get()?.regions||[];for(const s of r)if(s.getHiddenOriginalRange(void 0).contains(e)){s.showOriginalLine(e,t,i);return}}async waitForDiff(){await h5e(this.isDiffUpToDate,e=>e)}serializeState(){return{collapsedRegions:this._unchangedRegions.get()?.regions.map(t=>({range:t.getHiddenModifiedRange(void 0).serialize()}))}}restoreSerializedState(e){const t=e.collapsedRegions?.map(r=>gn.deserialize(r.range)),i=this._unchangedRegions.get();!i||!t||qr(r=>{for(const s of i.regions)for(const o of t)if(s.modifiedUnchangedRange.intersect(o)){s.setHiddenModifiedRange(o,r);break}})}};YJ=XRt([QRt(2,vO)],YJ);function JRt(n,e,t){return{changes:n.changes.map(i=>new Ju(i.original,i.modified,i.innerChanges?i.innerChanges.map(r=>ePt(r,e,t)):void 0)),moves:n.moves,identical:n.identical,quitEarly:n.quitEarly}}function ePt(n,e,t){let i=n.originalRange,r=n.modifiedRange;return i.startColumn===1&&r.startColumn===1&&(i.endColumn!==1||r.endColumn!==1)&&i.endColumn===e.getLineMaxColumn(i.endLineNumber)&&r.endColumn===t.getLineMaxColumn(r.endLineNumber)&&i.endLineNumbernew T8e(t)),e.moves||[],e.identical,e.quitEarly)}constructor(e,t,i,r){this.mappings=e,this.movedTexts=t,this.identical=i,this.quitEarly=r}}class T8e{constructor(e){this.lineRangeMapping=e}}class Bv{static fromDiffs(e,t,i,r,s){const o=Ju.inverse(e,t,i),a=[];for(const l of o){let c=l.original.startLineNumber,u=l.modified.startLineNumber,d=l.original.length;const h=c===1&&u===1,f=c+d===t+1&&u+d===i+1;(h||f)&&d>=s+r?(h&&!f&&(d-=s),f&&!h&&(c+=s,u+=s,d-=s),a.push(new Bv(c,u,d,0,0))):d>=s*2+r&&(c+=s,u+=s,d-=s*2,a.push(new Bv(c,u,d,0,0)))}return a}get originalUnchangedRange(){return gn.ofLength(this.originalLineNumber,this.lineCount)}get modifiedUnchangedRange(){return gn.ofLength(this.modifiedLineNumber,this.lineCount)}constructor(e,t,i,r,s){this.originalLineNumber=e,this.modifiedLineNumber=t,this.lineCount=i,this._visibleLineCountTop=Sn(this,0),this.visibleLineCountTop=this._visibleLineCountTop,this._visibleLineCountBottom=Sn(this,0),this.visibleLineCountBottom=this._visibleLineCountBottom,this._shouldHideControls=St(this,l=>this.visibleLineCountTop.read(l)+this.visibleLineCountBottom.read(l)===this.lineCount&&!this.isDragged.read(l)),this.isDragged=Sn(this,void 0);const o=Math.max(Math.min(r,this.lineCount),0),a=Math.max(Math.min(s,this.lineCount-r),0);rbe(r===o),rbe(s===a),this._visibleLineCountTop.set(o,void 0),this._visibleLineCountBottom.set(a,void 0)}setVisibleRanges(e,t){const i=[],r=new Md(e.map(l=>l.modified)).subtractFrom(this.modifiedUnchangedRange);let s=this.originalLineNumber,o=this.modifiedLineNumber;const a=this.modifiedLineNumber+this.lineCount;if(r.ranges.length===0)this.showAll(t),i.push(this);else{let l=0;for(const c of r.ranges){const u=l===r.ranges.length-1;l++;const d=(u?a:c.endLineNumberExclusive)-o,h=new Bv(s,o,d,0,0);h.setHiddenModifiedRange(c,t),i.push(h),s=h.originalUnchangedRange.endLineNumberExclusive,o=h.modifiedUnchangedRange.endLineNumberExclusive}}return i}shouldHideControls(e){return this._shouldHideControls.read(e)}getHiddenOriginalRange(e){return gn.ofLength(this.originalLineNumber+this._visibleLineCountTop.read(e),this.lineCount-this._visibleLineCountTop.read(e)-this._visibleLineCountBottom.read(e))}getHiddenModifiedRange(e){return gn.ofLength(this.modifiedLineNumber+this._visibleLineCountTop.read(e),this.lineCount-this._visibleLineCountTop.read(e)-this._visibleLineCountBottom.read(e))}setHiddenModifiedRange(e,t){const i=e.startLineNumber-this.modifiedLineNumber,r=this.modifiedLineNumber+this.lineCount-e.endLineNumberExclusive;this.setState(i,r,t)}getMaxVisibleLineCountTop(){return this.lineCount-this._visibleLineCountBottom.get()}getMaxVisibleLineCountBottom(){return this.lineCount-this._visibleLineCountTop.get()}showMoreAbove(e=10,t){const i=this.getMaxVisibleLineCountTop();this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+e,i),t)}showMoreBelow(e=10,t){const i=this.lineCount-this._visibleLineCountTop.get();this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+e,i),t)}showAll(e){this._visibleLineCountBottom.set(this.lineCount-this._visibleLineCountTop.get(),e)}showModifiedLine(e,t,i){const r=e+1-(this.modifiedLineNumber+this._visibleLineCountTop.get()),s=this.modifiedLineNumber-this._visibleLineCountBottom.get()+this.lineCount-e;t===0&&r{this._contextMenuService.showContextMenu({domForShadowRoot:h?i.getDomNode()??void 0:void 0,getAnchor:()=>({x:g,y:p}),getActions:()=>{const m=[],_=r.modified.isEmpty;return m.push(new su("diff.clipboard.copyDeletedContent",_?r.original.length>1?w("diff.clipboard.copyDeletedLinesContent.label","Copy deleted lines"):w("diff.clipboard.copyDeletedLinesContent.single.label","Copy deleted line"):r.original.length>1?w("diff.clipboard.copyChangedLinesContent.label","Copy changed lines"):w("diff.clipboard.copyChangedLinesContent.single.label","Copy changed line"),void 0,!0,async()=>{const y=this._originalTextModel.getValueInRange(r.original.toExclusiveRange());await this._clipboardService.writeText(y)})),r.original.length>1&&m.push(new su("diff.clipboard.copyDeletedLineContent",_?w("diff.clipboard.copyDeletedLineContent.label","Copy deleted line ({0})",r.original.startLineNumber+d):w("diff.clipboard.copyChangedLineContent.label","Copy changed line ({0})",r.original.startLineNumber+d),void 0,!0,async()=>{let y=this._originalTextModel.getLineContent(r.original.startLineNumber+d);y===""&&(y=this._originalTextModel.getEndOfLineSequence()===0?` +`&&(i=2),this._modelData.model.getValue(i,t)}setValue(e){try{if(this._beginUpdate(),!this._modelData)return;this._modelData.model.setValue(e)}finally{this._endUpdate()}}getModel(){return this._modelData?this._modelData.model:null}setModel(e=null){try{this._beginUpdate();const t=e;if(this._modelData===null&&t===null||this._modelData&&this._modelData.model===t)return;const i={oldModelUrl:this._modelData?.model.uri||null,newModelUrl:t?.uri||null};this._onWillChangeModel.fire(i);const r=this.hasTextFocus(),s=this._detachModel();this._attachModel(t),r&&this.hasModel()&&this.focus(),this._removeDecorationTypes(),this._onDidChangeModel.fire(i),this._postDetachModelCleanup(s),this._contributionsDisposable=this._contributions.onAfterModelAttached()}finally{this._endUpdate()}}_removeDecorationTypes(){if(this._decorationTypeKeysToIds={},this._decorationTypeSubtypes){for(const e in this._decorationTypeSubtypes){const t=this._decorationTypeSubtypes[e];for(const i in t)this._removeDecorationType(e+"-"+i)}this._decorationTypeSubtypes={}}}getVisibleRanges(){return this._modelData?this._modelData.viewModel.getVisibleRanges():[]}getVisibleRangesPlusViewportAboveBelow(){return this._modelData?this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow():[]}getWhitespaces(){return this._modelData?this._modelData.viewModel.viewLayout.getWhitespaces():[]}static _getVerticalOffsetAfterPosition(e,t,i,r){const s=e.model.validatePosition({lineNumber:t,column:i}),o=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(s);return e.viewModel.viewLayout.getVerticalOffsetAfterLineNumber(o.lineNumber,r)}getTopForLineNumber(e,t=!1){return this._modelData?Y1._getVerticalOffsetForPosition(this._modelData,e,1,t):-1}getTopForPosition(e,t){return this._modelData?Y1._getVerticalOffsetForPosition(this._modelData,e,t,!1):-1}static _getVerticalOffsetForPosition(e,t,i,r=!1){const s=e.model.validatePosition({lineNumber:t,column:i}),o=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(s);return e.viewModel.viewLayout.getVerticalOffsetForLineNumber(o.lineNumber,r)}getBottomForLineNumber(e,t=!1){if(!this._modelData)return-1;const i=this._modelData.model.getLineMaxColumn(e);return Y1._getVerticalOffsetAfterPosition(this._modelData,e,i,t)}setHiddenAreas(e,t){this._modelData?.viewModel.setHiddenAreas(e.map(i=>$.lift(i)),t)}getVisibleColumnFromPosition(e){if(!this._modelData)return e.column;const t=this._modelData.model.validatePosition(e),i=this._modelData.model.getOptions().tabSize;return co.visibleColumnFromColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,i)+1}getPosition(){return this._modelData?this._modelData.viewModel.getPosition():null}setPosition(e,t="api"){if(this._modelData){if(!he.isIPosition(e))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,[{selectionStartLineNumber:e.lineNumber,selectionStartColumn:e.column,positionLineNumber:e.lineNumber,positionColumn:e.column}])}}_sendRevealRange(e,t,i,r){if(!this._modelData)return;if(!$.isIRange(e))throw new Error("Invalid arguments");const s=this._modelData.model.validateRange(e),o=this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(s);this._modelData.viewModel.revealRange("api",i,o,t,r)}revealLine(e,t=0){this._revealLine(e,0,t)}revealLineInCenter(e,t=0){this._revealLine(e,1,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._revealLine(e,2,t)}revealLineNearTop(e,t=0){this._revealLine(e,5,t)}_revealLine(e,t,i){if(typeof e!="number")throw new Error("Invalid arguments");this._sendRevealRange(new $(e,1,e,1),t,!1,i)}revealPosition(e,t=0){this._revealPosition(e,0,!0,t)}revealPositionInCenter(e,t=0){this._revealPosition(e,1,!0,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._revealPosition(e,2,!0,t)}revealPositionNearTop(e,t=0){this._revealPosition(e,5,!0,t)}_revealPosition(e,t,i,r){if(!he.isIPosition(e))throw new Error("Invalid arguments");this._sendRevealRange(new $(e.lineNumber,e.column,e.lineNumber,e.column),t,i,r)}getSelection(){return this._modelData?this._modelData.viewModel.getSelection():null}getSelections(){return this._modelData?this._modelData.viewModel.getSelections():null}setSelection(e,t="api"){const i=yt.isISelection(e),r=$.isIRange(e);if(!i&&!r)throw new Error("Invalid arguments");if(i)this._setSelectionImpl(e,t);else if(r){const s={selectionStartLineNumber:e.startLineNumber,selectionStartColumn:e.startColumn,positionLineNumber:e.endLineNumber,positionColumn:e.endColumn};this._setSelectionImpl(s,t)}}_setSelectionImpl(e,t){if(!this._modelData)return;const i=new yt(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn);this._modelData.viewModel.setSelections(t,[i])}revealLines(e,t,i=0){this._revealLines(e,t,0,i)}revealLinesInCenter(e,t,i=0){this._revealLines(e,t,1,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._revealLines(e,t,2,i)}revealLinesNearTop(e,t,i=0){this._revealLines(e,t,5,i)}_revealLines(e,t,i,r){if(typeof e!="number"||typeof t!="number")throw new Error("Invalid arguments");this._sendRevealRange(new $(e,1,t,1),i,!1,r)}revealRange(e,t=0,i=!1,r=!0){this._revealRange(e,i?1:0,r,t)}revealRangeInCenter(e,t=0){this._revealRange(e,1,!0,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._revealRange(e,2,!0,t)}revealRangeNearTop(e,t=0){this._revealRange(e,5,!0,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._revealRange(e,6,!0,t)}revealRangeAtTop(e,t=0){this._revealRange(e,3,!0,t)}_revealRange(e,t,i,r){if(!$.isIRange(e))throw new Error("Invalid arguments");this._sendRevealRange($.lift(e),t,i,r)}setSelections(e,t="api",i=0){if(this._modelData){if(!e||e.length===0)throw new Error("Invalid arguments");for(let r=0,s=e.length;r0&&this._modelData.viewModel.restoreCursorState(i):this._modelData.viewModel.restoreCursorState([i]),this._contributions.restoreViewState(t.contributionsState||{});const r=this._modelData.viewModel.reduceRestoreState(t.viewState);this._modelData.view.restoreState(r)}}handleInitialized(){this._getViewModel()?.visibleLinesStabilized()}getContribution(e){return this._contributions.get(e)}getActions(){return Array.from(this._actions.values())}getSupportedActions(){let e=this.getActions();return e=e.filter(t=>t.isSupported()),e}getAction(e){return this._actions.get(e)||null}trigger(e,t,i){i=i||{};try{switch(this._beginUpdate(),t){case"compositionStart":this._startComposition();return;case"compositionEnd":this._endComposition(e);return;case"type":{const s=i;this._type(e,s.text||"");return}case"replacePreviousChar":{const s=i;this._compositionType(e,s.text||"",s.replaceCharCnt||0,0,0);return}case"compositionType":{const s=i;this._compositionType(e,s.text||"",s.replacePrevCharCnt||0,s.replaceNextCharCnt||0,s.positionDelta||0);return}case"paste":{const s=i;this._paste(e,s.text||"",s.pasteOnNewLine||!1,s.multicursorText||null,s.mode||null,s.clipboardEvent);return}case"cut":this._cut(e);return}const r=this.getAction(t);if(r){Promise.resolve(r.run(i)).then(void 0,rn);return}if(!this._modelData||this._triggerEditorCommand(e,t,i))return;this._triggerCommand(t,i)}finally{this._endUpdate()}}_triggerCommand(e,t){this._commandService.executeCommand(e,t)}_startComposition(){this._modelData&&(this._modelData.viewModel.startComposition(),this._onDidCompositionStart.fire())}_endComposition(e){this._modelData&&(this._modelData.viewModel.endComposition(e),this._onDidCompositionEnd.fire())}_type(e,t){!this._modelData||t.length===0||(e==="keyboard"&&this._onWillType.fire(t),this._modelData.viewModel.type(t,e),e==="keyboard"&&this._onDidType.fire(t))}_compositionType(e,t,i,r,s){this._modelData&&this._modelData.viewModel.compositionType(t,i,r,s,e)}_paste(e,t,i,r,s,o){if(!this._modelData)return;const a=this._modelData.viewModel,l=a.getSelection().getStartPosition();a.paste(t,i,r,e);const c=a.getSelection().getStartPosition();e==="keyboard"&&this._onDidPaste.fire({clipboardEvent:o,range:new $(l.lineNumber,l.column,c.lineNumber,c.column),languageId:s})}_cut(e){this._modelData&&this._modelData.viewModel.cut(e)}_triggerEditorCommand(e,t,i){const r=Zy.getEditorCommand(t);return r?(i=i||{},i.source=e,this._instantiationService.invokeFunction(s=>{Promise.resolve(r.runEditorCommand(s,this,i)).then(void 0,rn)}),!0):!1}_getViewModel(){return this._modelData?this._modelData.viewModel:null}pushUndoStop(){return!this._modelData||this._configuration.options.get(92)?!1:(this._modelData.model.pushStackElement(),!0)}popUndoStop(){return!this._modelData||this._configuration.options.get(92)?!1:(this._modelData.model.popStackElement(),!0)}executeEdits(e,t,i){if(!this._modelData||this._configuration.options.get(92))return!1;let r;return i?Array.isArray(i)?r=()=>i:r=i:r=()=>null,this._modelData.viewModel.executeEdits(e,t,r),!0}executeCommand(e,t){this._modelData&&this._modelData.viewModel.executeCommand(t,e)}executeCommands(e,t){this._modelData&&this._modelData.viewModel.executeCommands(t,e)}createDecorationsCollection(e){return new kRt(this,e)}changeDecorations(e){return this._modelData?this._modelData.model.changeDecorations(e,this._id):null}getLineDecorations(e){return this._modelData?this._modelData.model.getLineDecorations(e,this._id,R6(this._configuration.options)):null}getDecorationsInRange(e){return this._modelData?this._modelData.model.getDecorationsInRange(e,this._id,R6(this._configuration.options)):null}deltaDecorations(e,t){return this._modelData?e.length===0&&t.length===0?e:this._modelData.model.deltaDecorations(e,t,this._id):[]}removeDecorations(e){!this._modelData||e.length===0||this._modelData.model.changeDecorations(t=>{t.deltaDecorations(e,[])})}removeDecorationsByType(e){const t=this._decorationTypeKeysToIds[e];t&&this.changeDecorations(i=>i.deltaDecorations(t,[])),this._decorationTypeKeysToIds.hasOwnProperty(e)&&delete this._decorationTypeKeysToIds[e],this._decorationTypeSubtypes.hasOwnProperty(e)&&delete this._decorationTypeSubtypes[e]}getLayoutInfo(){return this._configuration.options.get(146)}createOverviewRuler(e){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.createOverviewRuler(e)}getContainerDomNode(){return this._domElement}getDomNode(){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.domNode.domNode}delegateVerticalScrollbarPointerDown(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateScrollFromMouseWheelEvent(e)}layout(e,t=!1){this._configuration.observeContainer(e),t||this.render()}focus(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.focus()}hasTextFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isFocused()}hasWidgetFocus(){return this._focusTracker&&this._focusTracker.hasFocus()}addContentWidget(e){const t={widget:e,position:e.getPosition()};this._contentWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a content widget with the same id:"+e.getId()),this._contentWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addContentWidget(t)}layoutContentWidget(e){const t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){const i=this._contentWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutContentWidget(i)}}removeContentWidget(e){const t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){const i=this._contentWidgets[t];delete this._contentWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeContentWidget(i)}}addOverlayWidget(e){const t={widget:e,position:e.getPosition()};this._overlayWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting an overlay widget with the same id."),this._overlayWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addOverlayWidget(t)}layoutOverlayWidget(e){const t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){const i=this._overlayWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutOverlayWidget(i)}}removeOverlayWidget(e){const t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){const i=this._overlayWidgets[t];delete this._overlayWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeOverlayWidget(i)}}addGlyphMarginWidget(e){const t={widget:e,position:e.getPosition()};this._glyphMarginWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a glyph margin widget with the same id."),this._glyphMarginWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addGlyphMarginWidget(t)}layoutGlyphMarginWidget(e){const t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){const i=this._glyphMarginWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutGlyphMarginWidget(i)}}removeGlyphMarginWidget(e){const t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){const i=this._glyphMarginWidgets[t];delete this._glyphMarginWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeGlyphMarginWidget(i)}}changeViewZones(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.change(e)}getTargetAtClientPoint(e,t){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.getTargetAtClientPoint(e,t)}getScrolledVisiblePosition(e){if(!this._modelData||!this._modelData.hasRealView)return null;const t=this._modelData.model.validatePosition(e),i=this._configuration.options,r=i.get(146),s=Y1._getVerticalOffsetForPosition(this._modelData,t.lineNumber,t.column)-this.getScrollTop(),o=this._modelData.view.getOffsetForColumn(t.lineNumber,t.column)+r.glyphMarginWidth+r.lineNumbersWidth+r.decorationsWidth-this.getScrollLeft();return{top:s,left:o,height:i.get(67)}}getOffsetForColumn(e,t){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getOffsetForColumn(e,t)}render(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!0,e)})}setAriaOptions(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.setAriaOptions(e)}applyFontInfo(e){ta(e,this._configuration.options.get(50))}setBanner(e,t){this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),this._bannerDomNode=e,this._configuration.setReservedHeight(e?t:0),this._bannerDomNode&&this._domElement.prepend(this._bannerDomNode)}_attachModel(e){if(!e){this._modelData=null;return}const t=[];this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._configuration.setIsDominatedByLongLines(e.isDominatedByLongLines()),this._configuration.setModelLineCount(e.getLineCount());const i=e.onBeforeAttached(),r=new pRt(this._id,this._configuration,e,Uce.create(Ot(this._domElement)),jce.create(this._configuration.options),a=>du(Ot(this._domElement),a),this.languageConfigurationService,this._themeService,i,{batchChanges:a=>{try{return this._beginUpdate(),a()}finally{this._endUpdate()}}});t.push(e.onWillDispose(()=>this.setModel(null))),t.push(r.onEvent(a=>{switch(a.kind){case 0:this._onDidContentSizeChange.fire(a);break;case 1:this._editorTextFocus.setValue(a.hasFocus);break;case 2:this._onDidScrollChange.fire(a);break;case 3:this._onDidChangeViewZones.fire();break;case 4:this._onDidChangeHiddenAreas.fire();break;case 5:this._onDidAttemptReadOnlyEdit.fire();break;case 6:{if(a.reachedMaxCursorCount){const d=this.getOption(80),h=w("cursors.maximum","The number of cursors has been limited to {0}. Consider using [find and replace](https://code.visualstudio.com/docs/editor/codebasics#_find-and-replace) for larger changes or increase the editor multi cursor limit setting.",d);this._notificationService.prompt(iW.Warning,h,[{label:"Find and Replace",run:()=>{this._commandService.executeCommand("editor.action.startFindReplaceAction")}},{label:w("goToSetting","Increase Multi Cursor Limit"),run:()=>{this._commandService.executeCommand("workbench.action.openSettings2",{query:"editor.multiCursorLimit"})}}])}const l=[];for(let d=0,h=a.selections.length;d{this._paste("keyboard",s,o,a,l)},type:s=>{this._type("keyboard",s)},compositionType:(s,o,a,l)=>{this._compositionType("keyboard",s,o,a,l)},startComposition:()=>{this._startComposition()},endComposition:()=>{this._endComposition("keyboard")},cut:()=>{this._cut("keyboard")}}:t={paste:(s,o,a,l)=>{const c={text:s,pasteOnNewLine:o,multicursorText:a,mode:l};this._commandService.executeCommand("paste",c)},type:s=>{const o={text:s};this._commandService.executeCommand("type",o)},compositionType:(s,o,a,l)=>{if(a||l){const c={text:s,replacePrevCharCnt:o,replaceNextCharCnt:a,positionDelta:l};this._commandService.executeCommand("compositionType",c)}else{const c={text:s,replaceCharCnt:o};this._commandService.executeCommand("replacePreviousChar",c)}},startComposition:()=>{this._commandService.executeCommand("compositionStart",{})},endComposition:()=>{this._commandService.executeCommand("compositionEnd",{})},cut:()=>{this._commandService.executeCommand("cut",{})}};const i=new GW(e.coordinatesConverter);return i.onKeyDown=s=>this._onKeyDown.fire(s),i.onKeyUp=s=>this._onKeyUp.fire(s),i.onContextMenu=s=>this._onContextMenu.fire(s),i.onMouseMove=s=>this._onMouseMove.fire(s),i.onMouseLeave=s=>this._onMouseLeave.fire(s),i.onMouseDown=s=>this._onMouseDown.fire(s),i.onMouseUp=s=>this._onMouseUp.fire(s),i.onMouseDrag=s=>this._onMouseDrag.fire(s),i.onMouseDrop=s=>this._onMouseDrop.fire(s),i.onMouseDropCanceled=s=>this._onMouseDropCanceled.fire(s),i.onMouseWheel=s=>this._onMouseWheel.fire(s),[new MJ(t,this._configuration,this._themeService.getColorTheme(),e,i,this._overflowWidgetsDomNode,this._instantiationService),!0]}_postDetachModelCleanup(e){e?.removeAllDecorationsWithOwnerId(this._id)}_detachModel(){if(this._contributionsDisposable?.dispose(),this._contributionsDisposable=void 0,!this._modelData)return null;const e=this._modelData.model,t=this._modelData.hasRealView?this._modelData.view.domNode.domNode:null;return this._modelData.dispose(),this._modelData=null,this._domElement.removeAttribute("data-mode-id"),t&&this._domElement.contains(t)&&t.remove(),this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),e}_removeDecorationType(e){this._codeEditorService.removeDecorationType(e)}hasModel(){return this._modelData!==null}showDropIndicatorAt(e){const t=[{range:new $(e.lineNumber,e.column,e.lineNumber,e.column),options:Y1.dropIntoEditorDecorationOptions}];this._dropIntoEditorDecorations.set(t),this.revealPosition(e,1)}removeDropIndicator(){this._dropIntoEditorDecorations.clear()}setContextValue(e,t){this._contextKeyService.createKey(e,t)}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&this._onBeginUpdate.fire()}_endUpdate(){this._updateCounter--,this._updateCounter===0&&this._onEndUpdate.fire()}};ZN=Y1=bRt([Nm(3,Tt),Nm(4,ai),Nm(5,_r),Nm(6,jt),Nm(7,go),Nm(8,Ts),Nm(9,_u),Nm(10,Zr),Nm(11,dt)],ZN);let yRt=0;class wRt{constructor(e,t,i,r,s,o){this.model=e,this.viewModel=t,this.view=i,this.hasRealView=r,this.listenersToRemove=s,this.attachedView=o}dispose(){er(this.listenersToRemove),this.model.onBeforeDetached(this.attachedView),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}}class Bwe extends me{constructor(e){super(),this._emitterOptions=e,this._onDidChangeToTrue=this._register(new fe(this._emitterOptions)),this.onDidChangeToTrue=this._onDidChangeToTrue.event,this._onDidChangeToFalse=this._register(new fe(this._emitterOptions)),this.onDidChangeToFalse=this._onDidChangeToFalse.event,this._value=0}setValue(e){const t=e?2:1;this._value!==t&&(this._value=t,this._value===2?this._onDidChangeToTrue.fire():this._value===1&&this._onDidChangeToFalse.fire())}}class sl extends fe{constructor(e,t){super({deliveryQueue:t}),this._contributions=e}fire(e){this._contributions.onBeforeInteractionEvent(),super.fire(e)}}class CRt extends me{constructor(e,t){super(),this._editor=e,t.createKey("editorId",e.getId()),this._editorSimpleInput=Q.editorSimpleInput.bindTo(t),this._editorFocus=Q.focus.bindTo(t),this._textInputFocus=Q.textInputFocus.bindTo(t),this._editorTextFocus=Q.editorTextFocus.bindTo(t),this._tabMovesFocus=Q.tabMovesFocus.bindTo(t),this._editorReadonly=Q.readOnly.bindTo(t),this._inDiffEditor=Q.inDiffEditor.bindTo(t),this._editorColumnSelection=Q.columnSelection.bindTo(t),this._hasMultipleSelections=Q.hasMultipleSelections.bindTo(t),this._hasNonEmptySelection=Q.hasNonEmptySelection.bindTo(t),this._canUndo=Q.canUndo.bindTo(t),this._canRedo=Q.canRedo.bindTo(t),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromConfig())),this._register(this._editor.onDidChangeCursorSelection(()=>this._updateFromSelection())),this._register(this._editor.onDidFocusEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidFocusEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidChangeModel(()=>this._updateFromModel())),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromModel())),this._register(xE.onDidChangeTabFocus(i=>this._tabMovesFocus.set(i))),this._updateFromConfig(),this._updateFromSelection(),this._updateFromFocus(),this._updateFromModel(),this._editorSimpleInput.set(this._editor.isSimpleWidget)}_updateFromConfig(){const e=this._editor.getOptions();this._tabMovesFocus.set(xE.getTabFocusMode()),this._editorReadonly.set(e.get(92)),this._inDiffEditor.set(e.get(61)),this._editorColumnSelection.set(e.get(22))}_updateFromSelection(){const e=this._editor.getSelections();e?(this._hasMultipleSelections.set(e.length>1),this._hasNonEmptySelection.set(e.some(t=>!t.isEmpty()))):(this._hasMultipleSelections.reset(),this._hasNonEmptySelection.reset())}_updateFromFocus(){this._editorFocus.set(this._editor.hasWidgetFocus()&&!this._editor.isSimpleWidget),this._editorTextFocus.set(this._editor.hasTextFocus()&&!this._editor.isSimpleWidget),this._textInputFocus.set(this._editor.hasTextFocus())}_updateFromModel(){const e=this._editor.getModel();this._canUndo.set(!!(e&&e.canUndo())),this._canRedo.set(!!(e&&e.canRedo()))}}class xRt extends me{constructor(e,t,i){super(),this._editor=e,this._contextKeyService=t,this._languageFeaturesService=i,this._langId=Q.languageId.bindTo(t),this._hasCompletionItemProvider=Q.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=Q.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=Q.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=Q.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=Q.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=Q.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=Q.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=Q.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=Q.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=Q.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=Q.hasReferenceProvider.bindTo(t),this._hasRenameProvider=Q.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=Q.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=Q.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=Q.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=Q.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=Q.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=Q.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInEmbeddedEditor=Q.isInEmbeddedEditor.bindTo(t);const r=()=>this._update();this._register(e.onDidChangeModel(r)),this._register(e.onDidChangeModelLanguage(r)),this._register(i.completionProvider.onDidChange(r)),this._register(i.codeActionProvider.onDidChange(r)),this._register(i.codeLensProvider.onDidChange(r)),this._register(i.definitionProvider.onDidChange(r)),this._register(i.declarationProvider.onDidChange(r)),this._register(i.implementationProvider.onDidChange(r)),this._register(i.typeDefinitionProvider.onDidChange(r)),this._register(i.hoverProvider.onDidChange(r)),this._register(i.documentHighlightProvider.onDidChange(r)),this._register(i.documentSymbolProvider.onDidChange(r)),this._register(i.referenceProvider.onDidChange(r)),this._register(i.renameProvider.onDidChange(r)),this._register(i.documentFormattingEditProvider.onDidChange(r)),this._register(i.documentRangeFormattingEditProvider.onDidChange(r)),this._register(i.signatureHelpProvider.onDidChange(r)),this._register(i.inlayHintsProvider.onDidChange(r)),r()}dispose(){super.dispose()}reset(){this._contextKeyService.bufferChangeEvents(()=>{this._langId.reset(),this._hasCompletionItemProvider.reset(),this._hasCodeActionsProvider.reset(),this._hasCodeLensProvider.reset(),this._hasDefinitionProvider.reset(),this._hasDeclarationProvider.reset(),this._hasImplementationProvider.reset(),this._hasTypeDefinitionProvider.reset(),this._hasHoverProvider.reset(),this._hasDocumentHighlightProvider.reset(),this._hasDocumentSymbolProvider.reset(),this._hasReferenceProvider.reset(),this._hasRenameProvider.reset(),this._hasDocumentFormattingProvider.reset(),this._hasDocumentSelectionFormattingProvider.reset(),this._hasSignatureHelpProvider.reset(),this._isInEmbeddedEditor.reset()})}_update(){const e=this._editor.getModel();if(!e){this.reset();return}this._contextKeyService.bufferChangeEvents(()=>{this._langId.set(e.getLanguageId()),this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(e)),this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(e)),this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(e)),this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(e)),this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(e)),this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(e)),this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(e)),this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(e)),this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(e)),this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(e)),this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(e)),this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(e)),this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(e)),this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(e)),this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(e)||this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(e).length+this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._isInEmbeddedEditor.set(e.uri.scheme===sn.walkThroughSnippet||e.uri.scheme===sn.vscodeChatCodeBlock)})}}class SRt extends me{constructor(e,t){super(),this._onChange=this._register(new fe),this.onChange=this._onChange.event,this._hadFocus=void 0,this._hasDomElementFocus=!1,this._domFocusTracker=this._register(Eg(e)),this._overflowWidgetsDomNodeHasFocus=!1,this._register(this._domFocusTracker.onDidFocus(()=>{this._hasDomElementFocus=!0,this._update()})),this._register(this._domFocusTracker.onDidBlur(()=>{this._hasDomElementFocus=!1,this._update()})),t&&(this._overflowWidgetsDomNode=this._register(Eg(t)),this._register(this._overflowWidgetsDomNode.onDidFocus(()=>{this._overflowWidgetsDomNodeHasFocus=!0,this._update()})),this._register(this._overflowWidgetsDomNode.onDidBlur(()=>{this._overflowWidgetsDomNodeHasFocus=!1,this._update()})))}_update(){const e=this._hasDomElementFocus||this._overflowWidgetsDomNodeHasFocus;this._hadFocus!==e&&(this._hadFocus=e,this._onChange.fire(void 0))}hasFocus(){return this._hadFocus??!1}}class kRt{get length(){return this._decorationIds.length}constructor(e,t){this._editor=e,this._decorationIds=[],this._isChangingDecorations=!1,Array.isArray(t)&&t.length>0&&this.set(t)}onDidChange(e,t,i){return this._editor.onDidChangeModelDecorations(r=>{this._isChangingDecorations||e.call(t,r)},i)}getRange(e){return!this._editor.hasModel()||e>=this._decorationIds.length?null:this._editor.getModel().getDecorationRange(this._decorationIds[e])}getRanges(){if(!this._editor.hasModel())return[];const e=this._editor.getModel(),t=[];for(const i of this._decorationIds){const r=e.getDecorationRange(i);r&&t.push(r)}return t}has(e){return this._decorationIds.includes(e.id)}clear(){this._decorationIds.length!==0&&this.set([])}set(e){try{this._isChangingDecorations=!0,this._editor.changeDecorations(t=>{this._decorationIds=t.deltaDecorations(this._decorationIds,e)})}finally{this._isChangingDecorations=!1}return this._decorationIds}append(e){let t=[];try{this._isChangingDecorations=!0,this._editor.changeDecorations(i=>{t=i.deltaDecorations([],e),this._decorationIds=this._decorationIds.concat(t)})}finally{this._isChangingDecorations=!1}return t}}const ERt=encodeURIComponent("");function Nq(n){return ERt+encodeURIComponent(n.toString())+LRt}const TRt=encodeURIComponent('');function IRt(n){return TRt+encodeURIComponent(n.toString())+DRt}dh((n,e)=>{const t=n.getColor(aW);t&&e.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${Nq(t)}") repeat-x bottom left; }`);const i=n.getColor(X_);i&&e.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${Nq(i)}") repeat-x bottom left; }`);const r=n.getColor(Xp);r&&e.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${Nq(r)}") repeat-x bottom left; }`);const s=n.getColor(_yt);s&&e.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${IRt(s)}") no-repeat bottom left; }`);const o=n.getColor(eEt);o&&e.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${o.rgba.a}; }`)});class Ag{static capture(e){if(e.getScrollTop()===0||e.hasPendingScrollAnimation())return new Ag(e.getScrollTop(),e.getContentHeight(),null,0,null);let t=null,i=0;const r=e.getVisibleRanges();if(r.length>0){t=r[0].getStartPosition();const s=e.getTopForPosition(t.lineNumber,t.column);i=e.getScrollTop()-s}return new Ag(e.getScrollTop(),e.getContentHeight(),t,i,e.getPosition())}constructor(e,t,i,r,s){this._initialScrollTop=e,this._initialContentHeight=t,this._visiblePosition=i,this._visiblePositionScrollDelta=r,this._cursorPosition=s}restore(e){if(!(this._initialContentHeight===e.getContentHeight()&&this._initialScrollTop===e.getScrollTop())&&this._visiblePosition){const t=e.getTopForPosition(this._visiblePosition.lineNumber,this._visiblePosition.column);e.setScrollTop(t+this._visiblePositionScrollDelta)}}restoreRelativeVerticalPositionOfCursor(e){if(this._initialContentHeight===e.getContentHeight()&&this._initialScrollTop===e.getScrollTop())return;const t=e.getPosition();if(!this._cursorPosition||!t)return;const i=e.getTopForLineNumber(t.lineNumber)-e.getTopForLineNumber(this._cursorPosition.lineNumber);e.setScrollTop(e.getScrollTop()+i,1)}}function ARt(n,e,t,i){if(n.length===0)return e;if(e.length===0)return n;const r=[];let s=0,o=0;for(;su?(r.push(l),o++):(r.push(i(a,l)),s++,o++)}for(;s`Apply decorations from ${e.debugName}`},r=>{const s=e.read(r);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function PS(n,e){return n.appendChild(e),Lt(()=>{e.remove()})}function NRt(n,e){return n.prepend(e),Lt(()=>{e.remove()})}class S8e extends me{get width(){return this._width}get height(){return this._height}get automaticLayout(){return this._automaticLayout}constructor(e,t){super(),this._automaticLayout=!1,this.elementSizeObserver=this._register(new n8e(e,t)),this._width=kn(this,this.elementSizeObserver.getWidth()),this._height=kn(this,this.elementSizeObserver.getHeight()),this._register(this.elementSizeObserver.onDidChange(i=>qr(r=>{this._width.set(this.elementSizeObserver.getWidth(),r),this._height.set(this.elementSizeObserver.getHeight(),r)})))}observe(e){this.elementSizeObserver.observe(e)}setAutomaticLayout(e){this._automaticLayout=e,e?this.elementSizeObserver.startObserving():this.elementSizeObserver.stopObserving()}}function $we(n,e,t){let i=e.get(),r=i,s=i;const o=kn("animatedValue",i);let a=-1;const l=300;let c;t.add(lO({createEmptyChangeSummary:()=>({animate:!1}),handleChange:(d,h)=>(d.didChange(e)&&(h.animate=h.animate||d.change),!0)},(d,h)=>{c!==void 0&&(n.cancelAnimationFrame(c),c=void 0),r=s,i=e.read(d),a=Date.now()-(h.animate?0:l),u()}));function u(){const d=Date.now()-a;s=Math.floor(RRt(d,r,i-r,l)),d{this._actualTop.set(i,void 0)},this.onComputedHeight=i=>{this._actualHeight.set(i,void 0)}}}class eue{static{this._counter=0}constructor(e,t){this._editor=e,this._domElement=t,this._overlayWidgetId=`managedOverlayWidget-${eue._counter++}`,this._overlayWidget={getId:()=>this._overlayWidgetId,getDomNode:()=>this._domElement,getPosition:()=>null},this._editor.addOverlayWidget(this._overlayWidget)}dispose(){this._editor.removeOverlayWidget(this._overlayWidget)}}function J_(n,e){return tn(t=>{for(let[i,r]of Object.entries(e))r&&typeof r=="object"&&"read"in r&&(r=r.read(t)),typeof r=="number"&&(r=`${r}px`),i=i.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),n.style[i]=r})}function _9(n,e,t,i){const r=new ke,s=[];return r.add(wc((o,a)=>{const l=e.read(o),c=new Map,u=new Map;t&&t(!0),n.changeViewZones(d=>{for(const h of s)d.removeZone(h),i?.delete(h);s.length=0;for(const h of l){const f=d.addZone(h);h.setZoneId&&h.setZoneId(f),s.push(f),i?.add(f),c.set(h,f)}}),t&&t(!1),a.add(lO({createEmptyChangeSummary(){return{zoneIds:[]}},handleChange(d,h){const f=u.get(d.changedObservable);return f!==void 0&&h.zoneIds.push(f),!0}},(d,h)=>{for(const f of l)f.onChange&&(u.set(f.onChange,c.get(f)),f.onChange.read(d));t&&t(!0),n.changeViewZones(f=>{for(const g of h.zoneIds)f.layoutZone(g)}),t&&t(!1)}))})),r.add({dispose(){t&&t(!0),n.changeViewZones(o=>{for(const a of s)o.removeZone(a)}),i?.clear(),t&&t(!1)}}),r}class PRt extends Kr{dispose(){super.dispose(!0)}}function Wwe(n,e){const t=hN(e,r=>r.original.startLineNumber<=n.lineNumber);if(!t)return $.fromPositions(n);if(t.original.endLineNumberExclusive<=n.lineNumber){const r=n.lineNumber-t.original.endLineNumberExclusive+t.modified.endLineNumberExclusive;return $.fromPositions(new he(r,n.column))}if(!t.innerChanges)return $.fromPositions(new he(t.modified.startLineNumber,1));const i=hN(t.innerChanges,r=>r.originalRange.getStartPosition().isBeforeOrEqual(n));if(!i){const r=n.lineNumber-t.original.startLineNumber+t.modified.startLineNumber;return $.fromPositions(new he(r,n.column))}if(i.originalRange.containsPosition(n))return i.modifiedRange;{const r=ORt(i.originalRange.getEndPosition(),n);return $.fromPositions(r.addToPosition(i.modifiedRange.getEndPosition()))}}function ORt(n,e){return n.lineNumber===e.lineNumber?new _c(0,e.column-n.column):new _c(e.lineNumber-n.lineNumber,e.column-1)}function MRt(n,e){let t;return n.filter(i=>{const r=e(i,t);return t=i,r})}class v9{static create(e,t=void 0){return new Hwe(e,e,t)}static createWithDisposable(e,t,i=void 0){const r=new ke;return r.add(t),r.add(e),new Hwe(e,r,i)}}class Hwe extends v9{constructor(e,t,i){super(),this.object=e,this._disposable=t,this._debugOwner=i,this._refCount=1,this._isDisposed=!1,this._owners=[],i&&this._addOwner(i)}_addOwner(e){e&&this._owners.push(e)}createNewRef(e){return this._refCount++,e&&this._addOwner(e),new FRt(this,e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._decreaseRefCount(this._debugOwner))}_decreaseRefCount(e){if(this._refCount--,this._refCount===0&&this._disposable.dispose(),e){const t=this._owners.indexOf(e);t!==-1&&this._owners.splice(t,1)}}}class FRt extends v9{constructor(e,t){super(),this._base=e,this._debugOwner=t,this._isDisposed=!1}get object(){return this._base.object}createNewRef(e){return this._base.createNewRef(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._base._decreaseRefCount(this._debugOwner))}}var tue=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},nue=function(n,e){return function(t,i){e(t,i,n)}};const BRt=kr("diff-review-insert",ze.add,w("accessibleDiffViewerInsertIcon","Icon for 'Insert' in accessible diff viewer.")),$Rt=kr("diff-review-remove",ze.remove,w("accessibleDiffViewerRemoveIcon","Icon for 'Remove' in accessible diff viewer.")),WRt=kr("diff-review-close",ze.close,w("accessibleDiffViewerCloseIcon","Icon for 'Close' in accessible diff viewer."));let Py=class extends me{static{this._ttPolicy=p0("diffReview",{createHTML:e=>e})}constructor(e,t,i,r,s,o,a,l,c){super(),this._parentNode=e,this._visible=t,this._setVisible=i,this._canClose=r,this._width=s,this._height=o,this._diffs=a,this._models=l,this._instantiationService=c,this._state=Jb(this,(u,d)=>{const h=this._visible.read(u);if(this._parentNode.style.visibility=h?"visible":"hidden",!h)return null;const f=d.add(this._instantiationService.createInstance(UJ,this._diffs,this._models,this._setVisible,this._canClose)),g=d.add(this._instantiationService.createInstance(jJ,this._parentNode,f,this._width,this._height,this._models));return{model:f,view:g}}).recomputeInitiallyAndOnChange(this._store)}next(){qr(e=>{const t=this._visible.get();this._setVisible(!0,e),t&&this._state.get().model.nextGroup(e)})}prev(){qr(e=>{this._setVisible(!0,e),this._state.get().model.previousGroup(e)})}close(){qr(e=>{this._setVisible(!1,e)})}};Py=tue([nue(8,Tt)],Py);let UJ=class extends me{constructor(e,t,i,r,s){super(),this._diffs=e,this._models=t,this._setVisible=i,this.canClose=r,this._accessibilitySignalService=s,this._groups=kn(this,[]),this._currentGroupIdx=kn(this,0),this._currentElementIdx=kn(this,0),this.groups=this._groups,this.currentGroup=this._currentGroupIdx.map((o,a)=>this._groups.read(a)[o]),this.currentGroupIndex=this._currentGroupIdx,this.currentElement=this._currentElementIdx.map((o,a)=>this.currentGroup.read(a)?.lines[o]),this._register(tn(o=>{const a=this._diffs.read(o);if(!a){this._groups.set([],void 0);return}const l=HRt(a,this._models.getOriginalModel().getLineCount(),this._models.getModifiedModel().getLineCount());qr(c=>{const u=this._models.getModifiedPosition();if(u){const d=l.findIndex(h=>u?.lineNumber{const a=this.currentElement.read(o);a?.type===Nl.Deleted?this._accessibilitySignalService.playSignal(Ai.diffLineDeleted,{source:"accessibleDiffViewer.currentElementChanged"}):a?.type===Nl.Added&&this._accessibilitySignalService.playSignal(Ai.diffLineInserted,{source:"accessibleDiffViewer.currentElementChanged"})})),this._register(tn(o=>{const a=this.currentElement.read(o);if(a&&a.type!==Nl.Header){const l=a.modifiedLineNumber??a.diff.modified.startLineNumber;this._models.modifiedSetSelection($.fromPositions(new he(l,1)))}}))}_goToGroupDelta(e,t){const i=this.groups.get();!i||i.length<=1||Fw(t,r=>{this._currentGroupIdx.set(Dn.ofLength(i.length).clipCyclic(this._currentGroupIdx.get()+e),r),this._currentElementIdx.set(0,r)})}nextGroup(e){this._goToGroupDelta(1,e)}previousGroup(e){this._goToGroupDelta(-1,e)}_goToLineDelta(e){const t=this.currentGroup.get();!t||t.lines.length<=1||qr(i=>{this._currentElementIdx.set(Dn.ofLength(t.lines.length).clip(this._currentElementIdx.get()+e),i)})}goToNextLine(){this._goToLineDelta(1)}goToPreviousLine(){this._goToLineDelta(-1)}goToLine(e){const t=this.currentGroup.get();if(!t)return;const i=t.lines.indexOf(e);i!==-1&&qr(r=>{this._currentElementIdx.set(i,r)})}revealCurrentElementInEditor(){if(!this.canClose.get())return;this._setVisible(!1,void 0);const e=this.currentElement.get();e&&(e.type===Nl.Deleted?this._models.originalReveal($.fromPositions(new he(e.originalLineNumber,1))):this._models.modifiedReveal(e.type!==Nl.Header?$.fromPositions(new he(e.modifiedLineNumber,1)):void 0))}close(){this.canClose.get()&&(this._setVisible(!1,void 0),this._models.modifiedFocus())}};UJ=tue([nue(4,t1)],UJ);const HT=3;function HRt(n,e,t){const i=[];for(const r of dae(n,(s,o)=>o.modified.startLineNumber-s.modified.endLineNumberExclusive<2*HT)){const s=[];s.push(new zRt);const o=new gn(Math.max(1,r[0].original.startLineNumber-HT),Math.min(r[r.length-1].original.endLineNumberExclusive+HT,e+1)),a=new gn(Math.max(1,r[0].modified.startLineNumber-HT),Math.min(r[r.length-1].modified.endLineNumberExclusive+HT,t+1));r4e(r,(u,d)=>{const h=new gn(u?u.original.endLineNumberExclusive:o.startLineNumber,d?d.original.startLineNumber:o.endLineNumberExclusive),f=new gn(u?u.modified.endLineNumberExclusive:a.startLineNumber,d?d.modified.startLineNumber:a.endLineNumberExclusive);h.forEach(g=>{s.push(new qRt(g,f.startLineNumber+(g-h.startLineNumber)))}),d&&(d.original.forEach(g=>{s.push(new URt(d,g))}),d.modified.forEach(g=>{s.push(new jRt(d,g))}))});const l=r[0].modified.join(r[r.length-1].modified),c=r[0].original.join(r[r.length-1].original);i.push(new VRt(new gl(l,c),s))}return i}var Nl;(function(n){n[n.Header=0]="Header",n[n.Unchanged=1]="Unchanged",n[n.Deleted=2]="Deleted",n[n.Added=3]="Added"})(Nl||(Nl={}));class VRt{constructor(e,t){this.range=e,this.lines=t}}class zRt{constructor(){this.type=Nl.Header}}class URt{constructor(e,t){this.diff=e,this.originalLineNumber=t,this.type=Nl.Deleted,this.modifiedLineNumber=void 0}}class jRt{constructor(e,t){this.diff=e,this.modifiedLineNumber=t,this.type=Nl.Added,this.originalLineNumber=void 0}}class qRt{constructor(e,t){this.originalLineNumber=e,this.modifiedLineNumber=t,this.type=Nl.Unchanged}}let jJ=class extends me{constructor(e,t,i,r,s,o){super(),this._element=e,this._model=t,this._width=i,this._height=r,this._models=s,this._languageService=o,this.domNode=this._element,this.domNode.className="monaco-component diff-review monaco-editor-background";const a=document.createElement("div");a.className="diff-review-actions",this._actionBar=this._register(new ed(a)),this._register(tn(l=>{this._actionBar.clear(),this._model.canClose.read(l)&&this._actionBar.push(new su("diffreview.close",w("label.close","Close"),"close-diff-review "+zt.asClassName(WRt),!0,async()=>t.close()),{label:!1,icon:!0})})),this._content=document.createElement("div"),this._content.className="diff-review-content",this._content.setAttribute("role","code"),this._scrollbar=this._register(new tO(this._content,{})),ea(this.domNode,this._scrollbar.getDomNode(),a),this._register(tn(l=>{this._height.read(l),this._width.read(l),this._scrollbar.scanDomNode()})),this._register(Lt(()=>{ea(this.domNode)})),this._register(J_(this.domNode,{width:this._width,height:this._height})),this._register(J_(this._content,{width:this._width,height:this._height})),this._register(wc((l,c)=>{this._model.currentGroup.read(l),this._render(c)})),this._register(Jr(this.domNode,"keydown",l=>{(l.equals(18)||l.equals(2066)||l.equals(530))&&(l.preventDefault(),this._model.goToNextLine()),(l.equals(16)||l.equals(2064)||l.equals(528))&&(l.preventDefault(),this._model.goToPreviousLine()),(l.equals(9)||l.equals(2057)||l.equals(521)||l.equals(1033))&&(l.preventDefault(),this._model.close()),(l.equals(10)||l.equals(3))&&(l.preventDefault(),this._model.revealCurrentElementInEditor())}))}_render(e){const t=this._models.getOriginalOptions(),i=this._models.getModifiedOptions(),r=document.createElement("div");r.className="diff-review-table",r.setAttribute("role","list"),r.setAttribute("aria-label",w("ariaLabel","Accessible Diff Viewer. Use arrow up and down to navigate.")),ta(r,i.get(50)),ea(this._content,r);const s=this._models.getOriginalModel(),o=this._models.getModifiedModel();if(!s||!o)return;const a=s.getOptions(),l=o.getOptions(),c=i.get(67),u=this._model.currentGroup.get();for(const d of u?.lines||[]){if(!u)break;let h;if(d.type===Nl.Header){const g=document.createElement("div");g.className="diff-review-row",g.setAttribute("role","listitem");const p=u.range,m=this._model.currentGroupIndex.get(),_=this._model.groups.get().length,v=k=>k===0?w("no_lines_changed","no lines changed"):k===1?w("one_line_changed","1 line changed"):w("more_lines_changed","{0} lines changed",k),y=v(p.original.length),C=v(p.modified.length);g.setAttribute("aria-label",w({key:"header",comment:["This is the ARIA label for a git diff header.","A git diff header looks like this: @@ -154,12 +159,39 @@.","That encodes that at original line 154 (which is now line 159), 12 lines were removed/changed with 39 lines.","Variables 0 and 1 refer to the diff index out of total number of diffs.","Variables 2 and 4 will be numbers (a line number).",'Variables 3 and 5 will be "no lines changed", "1 line changed" or "X lines changed", localized separately.']},"Difference {0} of {1}: original line {2}, {3}, modified line {4}, {5}",m+1,_,p.original.startLineNumber,y,p.modified.startLineNumber,C));const x=document.createElement("div");x.className="diff-review-cell diff-review-summary",x.appendChild(document.createTextNode(`${m+1}/${_}: @@ -${p.original.startLineNumber},${p.original.length} +${p.modified.startLineNumber},${p.modified.length} @@`)),g.appendChild(x),h=g}else h=this._createRow(d,c,this._width.get(),t,s,a,i,o,l);r.appendChild(h);const f=St(g=>this._model.currentElement.read(g)===d);e.add(tn(g=>{const p=f.read(g);h.tabIndex=p?0:-1,p&&h.focus()})),e.add(Ce(h,"focus",()=>{this._model.goToLine(d)}))}this._scrollbar.scanDomNode()}_createRow(e,t,i,r,s,o,a,l,c){const u=r.get(146),d=u.glyphMarginWidth+u.lineNumbersWidth,h=a.get(146),f=10+h.glyphMarginWidth+h.lineNumbersWidth;let g="diff-review-row",p="";const m="diff-review-spacer";let _=null;switch(e.type){case Nl.Added:g="diff-review-row line-insert",p=" char-insert",_=BRt;break;case Nl.Deleted:g="diff-review-row line-delete",p=" char-delete",_=$Rt;break}const v=document.createElement("div");v.style.minWidth=i+"px",v.className=g,v.setAttribute("role","listitem"),v.ariaLevel="";const y=document.createElement("div");y.className="diff-review-cell",y.style.height=`${t}px`,v.appendChild(y);const C=document.createElement("span");C.style.width=d+"px",C.style.minWidth=d+"px",C.className="diff-review-line-number"+p,e.originalLineNumber!==void 0?C.appendChild(document.createTextNode(String(e.originalLineNumber))):C.innerText=" ",y.appendChild(C);const x=document.createElement("span");x.style.width=f+"px",x.style.minWidth=f+"px",x.style.paddingRight="10px",x.className="diff-review-line-number"+p,e.modifiedLineNumber!==void 0?x.appendChild(document.createTextNode(String(e.modifiedLineNumber))):x.innerText=" ",y.appendChild(x);const k=document.createElement("span");if(k.className=m,_){const I=document.createElement("span");I.className=zt.asClassName(_),I.innerText="  ",k.appendChild(I)}else k.innerText="  ";y.appendChild(k);let L;if(e.modifiedLineNumber!==void 0){let I=this._getLineHtml(l,a,c.tabSize,e.modifiedLineNumber,this._languageService.languageIdCodec);Py._ttPolicy&&(I=Py._ttPolicy.createHTML(I)),y.insertAdjacentHTML("beforeend",I),L=l.getLineContent(e.modifiedLineNumber)}else{let I=this._getLineHtml(s,r,o.tabSize,e.originalLineNumber,this._languageService.languageIdCodec);Py._ttPolicy&&(I=Py._ttPolicy.createHTML(I)),y.insertAdjacentHTML("beforeend",I),L=s.getLineContent(e.originalLineNumber)}L.length===0&&(L=w("blankLine","blank"));let D="";switch(e.type){case Nl.Unchanged:e.originalLineNumber===e.modifiedLineNumber?D=w({key:"unchangedLine",comment:["The placeholders are contents of the line and should not be translated."]},"{0} unchanged line {1}",L,e.originalLineNumber):D=w("equalLine","{0} original line {1} modified line {2}",L,e.originalLineNumber,e.modifiedLineNumber);break;case Nl.Added:D=w("insertLine","+ {0} modified line {1}",L,e.modifiedLineNumber);break;case Nl.Deleted:D=w("deleteLine","- {0} original line {1}",L,e.originalLineNumber);break}return v.setAttribute("aria-label",D),v}_getLineHtml(e,t,i,r,s){const o=e.getLineContent(r),a=t.get(50),l=Fs.createEmpty(o,s),c=sd.isBasicASCII(o,e.mightContainNonBasicASCII()),u=sd.containsRTL(o,c,e.mightContainRTL());return WW(new n1(a.isMonospace&&!t.get(33),a.canUseHalfwidthRightwardsArrow,o,!1,c,u,0,l,[],i,0,a.spaceWidth,a.middotWidth,a.wsmiddotWidth,t.get(118),t.get(100),t.get(95),t.get(51)!==zh.OFF,null)).html}};jJ=tue([nue(5,Hr)],jJ);class KRt{constructor(e){this.editors=e}getOriginalModel(){return this.editors.original.getModel()}getOriginalOptions(){return this.editors.original.getOptions()}originalReveal(e){this.editors.original.revealRange(e),this.editors.original.setSelection(e),this.editors.original.focus()}getModifiedModel(){return this.editors.modified.getModel()}getModifiedOptions(){return this.editors.modified.getOptions()}modifiedReveal(e){e&&(this.editors.modified.revealRange(e),this.editors.modified.setSelection(e)),this.editors.modified.focus()}modifiedSetSelection(e){this.editors.modified.setSelection(e)}modifiedFocus(){this.editors.modified.focus()}getModifiedPosition(){return this.editors.modified.getPosition()??void 0}}J("diffEditor.move.border","#8b8b8b9c",w("diffEditor.move.border","The border color for text that got moved in the diff editor."));J("diffEditor.moveActive.border","#FFA500",w("diffEditor.moveActive.border","The active border color for text that got moved in the diff editor."));J("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},w("diffEditor.unchangedRegionShadow","The color of the shadow around unchanged region widgets."));const GRt=kr("diff-insert",ze.add,w("diffInsertIcon","Line decoration for inserts in the diff editor.")),k8e=kr("diff-remove",ze.remove,w("diffRemoveIcon","Line decoration for removals in the diff editor.")),b9=un.register({className:"line-insert",description:"line-insert",isWholeLine:!0,linesDecorationsClassName:"insert-sign "+zt.asClassName(GRt),marginClassName:"gutter-insert"}),XN=un.register({className:"line-delete",description:"line-delete",isWholeLine:!0,linesDecorationsClassName:"delete-sign "+zt.asClassName(k8e),marginClassName:"gutter-delete"}),Vwe=un.register({className:"line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),zwe=un.register({className:"line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),y9=un.register({className:"char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),iue=un.register({className:"char-insert",description:"char-insert",isWholeLine:!0}),rue=un.register({className:"char-insert diff-range-empty",description:"char-insert diff-range-empty"}),kE=un.register({className:"char-delete",description:"char-delete",shouldFillLineOnLineBreak:!0}),sue=un.register({className:"char-delete",description:"char-delete",isWholeLine:!0}),oue=un.register({className:"char-delete diff-range-empty",description:"char-delete diff-range-empty"});var E8e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},qJ=function(n,e){return function(t,i){e(t,i,n)}},Z1;const vO=On("diffProviderFactoryService");let KJ=class{constructor(e){this.instantiationService=e}createDiffProvider(e){return this.instantiationService.createInstance(GJ,e)}};KJ=E8e([qJ(0,Tt)],KJ);Vn(vO,KJ,1);let GJ=class{static{Z1=this}static{this.diffCache=new Map}constructor(e,t,i){this.editorWorkerService=t,this.telemetryService=i,this.onDidChangeEventEmitter=new fe,this.onDidChange=this.onDidChangeEventEmitter.event,this.diffAlgorithm="advanced",this.diffAlgorithmOnDidChangeSubscription=void 0,this.setOptions(e)}dispose(){this.diffAlgorithmOnDidChangeSubscription?.dispose()}async computeDiff(e,t,i,r){if(typeof this.diffAlgorithm!="string")return this.diffAlgorithm.computeDiff(e,t,i,r);if(e.isDisposed()||t.isDisposed())return{changes:[],identical:!0,quitEarly:!1,moves:[]};if(e.getLineCount()===1&&e.getLineMaxColumn(1)===1)return t.getLineCount()===1&&t.getLineMaxColumn(1)===1?{changes:[],identical:!0,quitEarly:!1,moves:[]}:{changes:[new Ju(new gn(1,2),new gn(1,t.getLineCount()+1),[new Mu(e.getFullModelRange(),t.getFullModelRange())])],identical:!1,quitEarly:!1,moves:[]};const s=JSON.stringify([e.uri.toString(),t.uri.toString()]),o=JSON.stringify([e.id,t.id,e.getAlternativeVersionId(),t.getAlternativeVersionId(),JSON.stringify(i)]),a=Z1.diffCache.get(s);if(a&&a.context===o)return a.result;const l=Bo.create(),c=await this.editorWorkerService.computeDiff(e.uri,t.uri,i,this.diffAlgorithm),u=l.elapsed();if(this.telemetryService.publicLog2("diffEditor.computeDiff",{timeMs:u,timedOut:c?.quitEarly??!0,detectedMoves:i.computeMoves?c?.moves.length??0:-1}),r.isCancellationRequested)return{changes:[],identical:!1,quitEarly:!0,moves:[]};if(!c)throw new Error("no diff result available");return Z1.diffCache.size>10&&Z1.diffCache.delete(Z1.diffCache.keys().next().value),Z1.diffCache.set(s,{result:c,context:o}),c}setOptions(e){let t=!1;e.diffAlgorithm&&this.diffAlgorithm!==e.diffAlgorithm&&(this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.diffAlgorithmOnDidChangeSubscription=void 0,this.diffAlgorithm=e.diffAlgorithm,typeof e.diffAlgorithm!="string"&&(this.diffAlgorithmOnDidChangeSubscription=e.diffAlgorithm.onDidChange(()=>this.onDidChangeEventEmitter.fire())),t=!0),t&&this.onDidChangeEventEmitter.fire()}};GJ=Z1=E8e([qJ(1,Oc),qJ(2,Qa)],GJ);function JW(){return dZ&&!!dZ.VSCODE_DEV}function L8e(n){if(JW()){const e=YRt();return e.add(n),{dispose(){e.delete(n)}}}else return{dispose(){}}}function YRt(){r3||(r3=new Set);const n=globalThis;return n.$hotReload_applyNewExports||(n.$hotReload_applyNewExports=e=>{const t={config:{mode:void 0},...e},i=[];for(const r of r3){const s=r(t);s&&i.push(s)}if(i.length>0)return r=>{let s=!1;for(const o of i)o(r)&&(s=!0);return s}}),r3}let r3;JW()&&L8e(({oldExports:n,newSrc:e,config:t})=>{if(t.mode==="patch-prototype")return i=>{for(const r in i){const s=i[r];if(console.log(`[hot-reload] Patching prototype methods of '${r}'`,{exportedItem:s}),typeof s=="function"&&s.prototype){const o=n[r];if(o){for(const a of Object.getOwnPropertyNames(s.prototype)){const l=Object.getOwnPropertyDescriptor(s.prototype,a),c=Object.getOwnPropertyDescriptor(o.prototype,a);l?.value?.toString()!==c?.value?.toString()&&console.log(`[hot-reload] Patching prototype method '${r}.${a}'`),Object.defineProperty(o.prototype,a,l)}i[r]=o}}}return!0}});function Yc(n,e){return ZRt([n],e),n}function ZRt(n,e){JW()&&xa("reload",i=>L8e(({oldExports:r})=>{if([...Object.values(r)].some(s=>n.includes(s)))return s=>(i(void 0),!0)})).read(e)}var XRt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},QRt=function(n,e){return function(t,i){e(t,i,n)}};let YJ=class extends me{setActiveMovedText(e){this._activeMovedText.set(e,void 0)}constructor(e,t,i){super(),this.model=e,this._options=t,this._diffProviderFactoryService=i,this._isDiffUpToDate=kn(this,!1),this.isDiffUpToDate=this._isDiffUpToDate,this._diff=kn(this,void 0),this.diff=this._diff,this._unchangedRegions=kn(this,void 0),this.unchangedRegions=St(this,a=>this._options.hideUnchangedRegions.read(a)?this._unchangedRegions.read(a)?.regions??[]:(qr(l=>{for(const c of this._unchangedRegions.get()?.regions||[])c.collapseAll(l)}),[])),this.movedTextToCompare=kn(this,void 0),this._activeMovedText=kn(this,void 0),this._hoveredMovedText=kn(this,void 0),this.activeMovedText=St(this,a=>this.movedTextToCompare.read(a)??this._hoveredMovedText.read(a)??this._activeMovedText.read(a)),this._cancellationTokenSource=new Kr,this._diffProvider=St(this,a=>{const l=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:this._options.diffAlgorithm.read(a)}),c=xa("onDidChange",l.onDidChange);return{diffProvider:l,onChangeSignal:c}}),this._register(Lt(()=>this._cancellationTokenSource.cancel()));const r=r2("contentChangedSignal"),s=this._register(new Ui(()=>r.trigger(void 0),200));this._register(tn(a=>{const l=this._unchangedRegions.read(a);if(!l||l.regions.some(g=>g.isDragged.read(a)))return;const c=l.originalDecorationIds.map(g=>e.original.getDecorationRange(g)).map(g=>g?gn.fromRangeInclusive(g):void 0),u=l.modifiedDecorationIds.map(g=>e.modified.getDecorationRange(g)).map(g=>g?gn.fromRangeInclusive(g):void 0),d=l.regions.map((g,p)=>!c[p]||!u[p]?void 0:new Bv(c[p].startLineNumber,u[p].startLineNumber,c[p].length,g.visibleLineCountTop.read(a),g.visibleLineCountBottom.read(a))).filter(Bp),h=[];let f=!1;for(const g of dae(d,(p,m)=>p.getHiddenModifiedRange(a).endLineNumberExclusive===m.getHiddenModifiedRange(a).startLineNumber))if(g.length>1){f=!0;const p=g.reduce((_,v)=>_+v.lineCount,0),m=new Bv(g[0].originalLineNumber,g[0].modifiedLineNumber,p,g[0].visibleLineCountTop.get(),g[g.length-1].visibleLineCountBottom.get());h.push(m)}else h.push(g[0]);if(f){const g=e.original.deltaDecorations(l.originalDecorationIds,h.map(m=>({range:m.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),p=e.modified.deltaDecorations(l.modifiedDecorationIds,h.map(m=>({range:m.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));qr(m=>{this._unchangedRegions.set({regions:h,originalDecorationIds:g,modifiedDecorationIds:p},m)})}}));const o=(a,l,c)=>{const u=Bv.fromDiffs(a.changes,e.original.getLineCount(),e.modified.getLineCount(),this._options.hideUnchangedRegionsMinimumLineCount.read(c),this._options.hideUnchangedRegionsContextLineCount.read(c));let d;const h=this._unchangedRegions.get();if(h){const m=h.originalDecorationIds.map(C=>e.original.getDecorationRange(C)).map(C=>C?gn.fromRangeInclusive(C):void 0),_=h.modifiedDecorationIds.map(C=>e.modified.getDecorationRange(C)).map(C=>C?gn.fromRangeInclusive(C):void 0);let y=MRt(h.regions.map((C,x)=>{if(!m[x]||!_[x])return;const k=m[x].length;return new Bv(m[x].startLineNumber,_[x].startLineNumber,k,Math.min(C.visibleLineCountTop.get(),k),Math.min(C.visibleLineCountBottom.get(),k-C.visibleLineCountTop.get()))}).filter(Bp),(C,x)=>!x||C.modifiedLineNumber>=x.modifiedLineNumber+x.lineCount&&C.originalLineNumber>=x.originalLineNumber+x.lineCount).map(C=>new gl(C.getHiddenOriginalRange(c),C.getHiddenModifiedRange(c)));y=gl.clip(y,gn.ofLength(1,e.original.getLineCount()),gn.ofLength(1,e.modified.getLineCount())),d=gl.inverse(y,e.original.getLineCount(),e.modified.getLineCount())}const f=[];if(d)for(const m of u){const _=d.filter(v=>v.original.intersectsStrict(m.originalUnchangedRange)&&v.modified.intersectsStrict(m.modifiedUnchangedRange));f.push(...m.setVisibleRanges(_,l))}else f.push(...u);const g=e.original.deltaDecorations(h?.originalDecorationIds||[],f.map(m=>({range:m.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),p=e.modified.deltaDecorations(h?.modifiedDecorationIds||[],f.map(m=>({range:m.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));this._unchangedRegions.set({regions:f,originalDecorationIds:g,modifiedDecorationIds:p},l)};this._register(e.modified.onDidChangeContent(a=>{if(this._diff.get()){const c=m_.fromModelContentChanges(a.changes);this._lastDiff,e.original,e.modified}this._isDiffUpToDate.set(!1,void 0),s.schedule()})),this._register(e.original.onDidChangeContent(a=>{if(this._diff.get()){const c=m_.fromModelContentChanges(a.changes);this._lastDiff,e.original,e.modified}this._isDiffUpToDate.set(!1,void 0),s.schedule()})),this._register(wc(async(a,l)=>{this._options.hideUnchangedRegionsMinimumLineCount.read(a),this._options.hideUnchangedRegionsContextLineCount.read(a),s.cancel(),r.read(a);const c=this._diffProvider.read(a);c.onChangeSignal.read(a),Yc(G3e,a),Yc(NX,a),this._isDiffUpToDate.set(!1,void 0);let u=[];l.add(e.original.onDidChangeContent(f=>{const g=m_.fromModelContentChanges(f.changes);u=$8(u,g)}));let d=[];l.add(e.modified.onDidChangeContent(f=>{const g=m_.fromModelContentChanges(f.changes);d=$8(d,g)}));let h=await c.diffProvider.computeDiff(e.original,e.modified,{ignoreTrimWhitespace:this._options.ignoreTrimWhitespace.read(a),maxComputationTimeMs:this._options.maxComputationTimeMs.read(a),computeMoves:this._options.showMoves.read(a)},this._cancellationTokenSource.token);this._cancellationTokenSource.token.isCancellationRequested||e.original.isDisposed()||e.modified.isDisposed()||(h=JRt(h,e.original,e.modified),h=(e.original,e.modified,void 0)??h,h=(e.original,e.modified,void 0)??h,qr(f=>{o(h,f),this._lastDiff=h;const g=aue.fromDiffResult(h);this._diff.set(g,f),this._isDiffUpToDate.set(!0,f);const p=this.movedTextToCompare.get();this.movedTextToCompare.set(p?this._lastDiff.moves.find(m=>m.lineRangeMapping.modified.intersect(p.lineRangeMapping.modified)):void 0,f)}))}))}ensureModifiedLineIsVisible(e,t,i){if(this.diff.get()?.mappings.length===0)return;const r=this._unchangedRegions.get()?.regions||[];for(const s of r)if(s.getHiddenModifiedRange(void 0).contains(e)){s.showModifiedLine(e,t,i);return}}ensureOriginalLineIsVisible(e,t,i){if(this.diff.get()?.mappings.length===0)return;const r=this._unchangedRegions.get()?.regions||[];for(const s of r)if(s.getHiddenOriginalRange(void 0).contains(e)){s.showOriginalLine(e,t,i);return}}async waitForDiff(){await hFe(this.isDiffUpToDate,e=>e)}serializeState(){return{collapsedRegions:this._unchangedRegions.get()?.regions.map(t=>({range:t.getHiddenModifiedRange(void 0).serialize()}))}}restoreSerializedState(e){const t=e.collapsedRegions?.map(r=>gn.deserialize(r.range)),i=this._unchangedRegions.get();!i||!t||qr(r=>{for(const s of i.regions)for(const o of t)if(s.modifiedUnchangedRange.intersect(o)){s.setHiddenModifiedRange(o,r);break}})}};YJ=XRt([QRt(2,vO)],YJ);function JRt(n,e,t){return{changes:n.changes.map(i=>new Ju(i.original,i.modified,i.innerChanges?i.innerChanges.map(r=>ePt(r,e,t)):void 0)),moves:n.moves,identical:n.identical,quitEarly:n.quitEarly}}function ePt(n,e,t){let i=n.originalRange,r=n.modifiedRange;return i.startColumn===1&&r.startColumn===1&&(i.endColumn!==1||r.endColumn!==1)&&i.endColumn===e.getLineMaxColumn(i.endLineNumber)&&r.endColumn===t.getLineMaxColumn(r.endLineNumber)&&i.endLineNumbernew T8e(t)),e.moves||[],e.identical,e.quitEarly)}constructor(e,t,i,r){this.mappings=e,this.movedTexts=t,this.identical=i,this.quitEarly=r}}class T8e{constructor(e){this.lineRangeMapping=e}}class Bv{static fromDiffs(e,t,i,r,s){const o=Ju.inverse(e,t,i),a=[];for(const l of o){let c=l.original.startLineNumber,u=l.modified.startLineNumber,d=l.original.length;const h=c===1&&u===1,f=c+d===t+1&&u+d===i+1;(h||f)&&d>=s+r?(h&&!f&&(d-=s),f&&!h&&(c+=s,u+=s,d-=s),a.push(new Bv(c,u,d,0,0))):d>=s*2+r&&(c+=s,u+=s,d-=s*2,a.push(new Bv(c,u,d,0,0)))}return a}get originalUnchangedRange(){return gn.ofLength(this.originalLineNumber,this.lineCount)}get modifiedUnchangedRange(){return gn.ofLength(this.modifiedLineNumber,this.lineCount)}constructor(e,t,i,r,s){this.originalLineNumber=e,this.modifiedLineNumber=t,this.lineCount=i,this._visibleLineCountTop=kn(this,0),this.visibleLineCountTop=this._visibleLineCountTop,this._visibleLineCountBottom=kn(this,0),this.visibleLineCountBottom=this._visibleLineCountBottom,this._shouldHideControls=St(this,l=>this.visibleLineCountTop.read(l)+this.visibleLineCountBottom.read(l)===this.lineCount&&!this.isDragged.read(l)),this.isDragged=kn(this,void 0);const o=Math.max(Math.min(r,this.lineCount),0),a=Math.max(Math.min(s,this.lineCount-r),0);rbe(r===o),rbe(s===a),this._visibleLineCountTop.set(o,void 0),this._visibleLineCountBottom.set(a,void 0)}setVisibleRanges(e,t){const i=[],r=new Md(e.map(l=>l.modified)).subtractFrom(this.modifiedUnchangedRange);let s=this.originalLineNumber,o=this.modifiedLineNumber;const a=this.modifiedLineNumber+this.lineCount;if(r.ranges.length===0)this.showAll(t),i.push(this);else{let l=0;for(const c of r.ranges){const u=l===r.ranges.length-1;l++;const d=(u?a:c.endLineNumberExclusive)-o,h=new Bv(s,o,d,0,0);h.setHiddenModifiedRange(c,t),i.push(h),s=h.originalUnchangedRange.endLineNumberExclusive,o=h.modifiedUnchangedRange.endLineNumberExclusive}}return i}shouldHideControls(e){return this._shouldHideControls.read(e)}getHiddenOriginalRange(e){return gn.ofLength(this.originalLineNumber+this._visibleLineCountTop.read(e),this.lineCount-this._visibleLineCountTop.read(e)-this._visibleLineCountBottom.read(e))}getHiddenModifiedRange(e){return gn.ofLength(this.modifiedLineNumber+this._visibleLineCountTop.read(e),this.lineCount-this._visibleLineCountTop.read(e)-this._visibleLineCountBottom.read(e))}setHiddenModifiedRange(e,t){const i=e.startLineNumber-this.modifiedLineNumber,r=this.modifiedLineNumber+this.lineCount-e.endLineNumberExclusive;this.setState(i,r,t)}getMaxVisibleLineCountTop(){return this.lineCount-this._visibleLineCountBottom.get()}getMaxVisibleLineCountBottom(){return this.lineCount-this._visibleLineCountTop.get()}showMoreAbove(e=10,t){const i=this.getMaxVisibleLineCountTop();this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+e,i),t)}showMoreBelow(e=10,t){const i=this.lineCount-this._visibleLineCountTop.get();this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+e,i),t)}showAll(e){this._visibleLineCountBottom.set(this.lineCount-this._visibleLineCountTop.get(),e)}showModifiedLine(e,t,i){const r=e+1-(this.modifiedLineNumber+this._visibleLineCountTop.get()),s=this.modifiedLineNumber-this._visibleLineCountBottom.get()+this.lineCount-e;t===0&&r{this._contextMenuService.showContextMenu({domForShadowRoot:h?i.getDomNode()??void 0:void 0,getAnchor:()=>({x:g,y:p}),getActions:()=>{const m=[],_=r.modified.isEmpty;return m.push(new su("diff.clipboard.copyDeletedContent",_?r.original.length>1?w("diff.clipboard.copyDeletedLinesContent.label","Copy deleted lines"):w("diff.clipboard.copyDeletedLinesContent.single.label","Copy deleted line"):r.original.length>1?w("diff.clipboard.copyChangedLinesContent.label","Copy changed lines"):w("diff.clipboard.copyChangedLinesContent.single.label","Copy changed line"),void 0,!0,async()=>{const y=this._originalTextModel.getValueInRange(r.original.toExclusiveRange());await this._clipboardService.writeText(y)})),r.original.length>1&&m.push(new su("diff.clipboard.copyDeletedLineContent",_?w("diff.clipboard.copyDeletedLineContent.label","Copy deleted line ({0})",r.original.startLineNumber+d):w("diff.clipboard.copyChangedLineContent.label","Copy changed line ({0})",r.original.startLineNumber+d),void 0,!0,async()=>{let y=this._originalTextModel.getLineContent(r.original.startLineNumber+d);y===""&&(y=this._originalTextModel.getEndOfLineSequence()===0?` `:`\r -`),await this._clipboardService.writeText(y)})),i.getOption(92)||m.push(new su("diff.inline.revertChange",w("diff.inline.revertChange.label","Revert this change"),void 0,!0,async()=>{this._editor.revert(this._diff)})),m},autoSelectFirstItem:!0})};this._register(Jr(this._diffActions,"mousedown",g=>{if(!g.leftButton)return;const{top:p,height:m}=ms(this._diffActions),_=Math.floor(u/3);g.preventDefault(),f(g.posx,p+m+_)})),this._register(i.onMouseMove(g=>{(g.target.type===8||g.target.type===5)&&g.target.detail.viewZoneId===this._getViewZoneId()?(d=this._updateLightBulbPosition(this._marginDomNode,g.event.browserEvent.y,u),this.visibility=!0):this.visibility=!1})),this._register(i.onMouseDown(g=>{g.event.leftButton&&(g.target.type===8||g.target.type===5)&&g.target.detail.viewZoneId===this._getViewZoneId()&&(g.event.preventDefault(),d=this._updateLightBulbPosition(this._marginDomNode,g.event.browserEvent.y,u),f(g.event.posx,g.event.posy+u))}))}_updateLightBulbPosition(e,t,i){const{top:r}=ms(e),s=t-r,o=Math.floor(s/i),a=o*i;if(this._diffActions.style.top=`${a}px`,this._viewLineCounts){let l=0;for(let c=0;cn});function nPt(n,e,t,i){ta(i,e.fontInfo);const r=t.length>0,s=new XL(1e4);let o=0,a=0;const l=[];for(let h=0;h');const l=e.getLineContent(),c=sd.isBasicASCII(l,r),u=sd.containsRTL(l,c,s),d=mO(new n1(o.fontInfo.isMonospace&&!o.disableMonospaceOptimizations,o.fontInfo.canUseHalfwidthRightwardsArrow,l,!1,c,u,0,e,t,o.tabSize,0,o.fontInfo.spaceWidth,o.fontInfo.middotWidth,o.fontInfo.wsmiddotWidth,o.stopRenderingLineAfter,o.renderWhitespace,o.renderControlCharacters,o.fontLigatures!==zh.OFF,null),a);return a.appendString(""),d.characterMapping.getHorizontalOffset(d.characterMapping.length)}var rPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},qwe=function(n,e){return function(t,i){e(t,i,n)}};let ZJ=class extends me{constructor(e,t,i,r,s,o,a,l,c,u){super(),this._targetWindow=e,this._editors=t,this._diffModel=i,this._options=r,this._diffEditorWidget=s,this._canIgnoreViewZoneUpdateEvent=o,this._origViewZonesToIgnore=a,this._modViewZonesToIgnore=l,this._clipboardService=c,this._contextMenuService=u,this._originalTopPadding=Sn(this,0),this._originalScrollOffset=Sn(this,0),this._originalScrollOffsetAnimated=$we(this._targetWindow,this._originalScrollOffset,this._store),this._modifiedTopPadding=Sn(this,0),this._modifiedScrollOffset=Sn(this,0),this._modifiedScrollOffsetAnimated=$we(this._targetWindow,this._modifiedScrollOffset,this._store);const d=Sn("invalidateAlignmentsState",0),h=this._register(new Ui(()=>{d.set(d.get()+1,void 0)},0));this._register(this._editors.original.onDidChangeViewZones(y=>{this._canIgnoreViewZoneUpdateEvent()||h.schedule()})),this._register(this._editors.modified.onDidChangeViewZones(y=>{this._canIgnoreViewZoneUpdateEvent()||h.schedule()})),this._register(this._editors.original.onDidChangeConfiguration(y=>{(y.hasChanged(147)||y.hasChanged(67))&&h.schedule()})),this._register(this._editors.modified.onDidChangeConfiguration(y=>{(y.hasChanged(147)||y.hasChanged(67))&&h.schedule()}));const f=this._diffModel.map(y=>y?Bi(this,y.model.original.onDidChangeTokens,()=>y.model.original.tokenization.backgroundTokenizationState===2):void 0).map((y,C)=>y?.read(C)),g=St(y=>{const C=this._diffModel.read(y),x=C?.diff.read(y);if(!C||!x)return null;d.read(y);const L=this._options.renderSideBySide.read(y);return Kwe(this._editors.original,this._editors.modified,x.mappings,this._origViewZonesToIgnore,this._modViewZonesToIgnore,L)}),p=St(y=>{const C=this._diffModel.read(y)?.movedTextToCompare.read(y);if(!C)return null;d.read(y);const x=C.changes.map(k=>new T8e(k));return Kwe(this._editors.original,this._editors.modified,x,this._origViewZonesToIgnore,this._modViewZonesToIgnore,!0)});function m(){const y=document.createElement("div");return y.className="diagonal-fill",y}const _=this._register(new ke);this.viewZones=Jb(this,(y,C)=>{_.clear();const x=g.read(y)||[],k=[],L=[],D=this._modifiedTopPadding.read(y);D>0&&L.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:D,showInHiddenAreas:!0,suppressMouseDown:!0});const I=this._originalTopPadding.read(y);I>0&&k.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:I,showInHiddenAreas:!0,suppressMouseDown:!0});const O=this._options.renderSideBySide.read(y),M=O?void 0:this._editors.modified._getViewModel()?.createLineBreaksComputer();if(M){const j=this._editors.original.getModel();for(const te of x)if(te.diff)for(let le=te.originalRange.startLineNumber;lej.getLineCount())return{orig:k,mod:L};M?.addRequest(j.getLineContent(le),null,null)}}const B=M?.finalize()??[];let G=0;const W=this._editors.modified.getOption(67),z=this._diffModel.read(y)?.movedTextToCompare.read(y),q=this._editors.original.getModel()?.mightContainNonBasicASCII()??!1,ee=this._editors.original.getModel()?.mightContainRTL()??!1,Z=lue.fromEditor(this._editors.modified);for(const j of x)if(j.diff&&!O&&(!this._options.useTrueInlineDiffRendering.read(y)||!cue(j.diff))){if(!j.originalRange.isEmpty){f.read(y);const le=document.createElement("div");le.classList.add("view-lines","line-delete","monaco-mouse-cursor-text");const ue=this._editors.original.getModel();if(j.originalRange.endLineNumberExclusive-1>ue.getLineCount())return{orig:k,mod:L};const de=new iPt(j.originalRange.mapToLineArray(_t=>ue.tokenization.getLineTokens(_t)),j.originalRange.mapToLineArray(_t=>B[G++]),q,ee),we=[];for(const _t of j.diff.innerChanges||[])we.push(new AI(_t.originalRange.delta(-(j.diff.original.startLineNumber-1)),kE.className,0));const xe=nPt(de,Z,we,le),Me=document.createElement("div");if(Me.className="inline-deleted-margin-view-zone",ta(Me,Z.fontInfo),this._options.renderIndicators.read(y))for(let _t=0;_tLv(Re),Me,this._editors.modified,j.diff,this._diffEditorWidget,xe.viewLineCounts,this._editors.original.getModel(),this._contextMenuService,this._clipboardService));for(let _t=0;_t1&&k.push({afterLineNumber:j.originalRange.startLineNumber+_t,domNode:m(),heightInPx:(Qe-1)*W,showInHiddenAreas:!0,suppressMouseDown:!0})}L.push({afterLineNumber:j.modifiedRange.startLineNumber-1,domNode:le,heightInPx:xe.heightInLines*W,minWidthInPx:xe.minWidthInPx,marginDomNode:Me,setZoneId(_t){Re=_t},showInHiddenAreas:!0,suppressMouseDown:!0})}const te=document.createElement("div");te.className="gutter-delete",k.push({afterLineNumber:j.originalRange.endLineNumberExclusive-1,domNode:m(),heightInPx:j.modifiedHeightInPx,marginDomNode:te,showInHiddenAreas:!0,suppressMouseDown:!0})}else{const te=j.modifiedHeightInPx-j.originalHeightInPx;if(te>0){if(z?.lineRangeMapping.original.delta(-1).deltaLength(2).contains(j.originalRange.endLineNumberExclusive-1))continue;k.push({afterLineNumber:j.originalRange.endLineNumberExclusive-1,domNode:m(),heightInPx:te,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let le=function(){const de=document.createElement("div");return de.className="arrow-revert-change "+zt.asClassName(ze.arrowRight),C.add(Ce(de,"mousedown",we=>we.stopPropagation())),C.add(Ce(de,"click",we=>{we.stopPropagation(),s.revert(j.diff)})),qe("div",{},de)};if(z?.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(j.modifiedRange.endLineNumberExclusive-1))continue;let ue;j.diff&&j.diff.modified.isEmpty&&this._options.shouldRenderOldRevertArrows.read(y)&&(ue=le()),L.push({afterLineNumber:j.modifiedRange.endLineNumberExclusive-1,domNode:m(),heightInPx:-te,marginDomNode:ue,showInHiddenAreas:!0,suppressMouseDown:!0})}}for(const j of p.read(y)??[]){if(!z?.lineRangeMapping.original.intersect(j.originalRange)||!z?.lineRangeMapping.modified.intersect(j.modifiedRange))continue;const te=j.modifiedHeightInPx-j.originalHeightInPx;te>0?k.push({afterLineNumber:j.originalRange.endLineNumberExclusive-1,domNode:m(),heightInPx:te,showInHiddenAreas:!0,suppressMouseDown:!0}):L.push({afterLineNumber:j.modifiedRange.endLineNumberExclusive-1,domNode:m(),heightInPx:-te,showInHiddenAreas:!0,suppressMouseDown:!0})}return{orig:k,mod:L}});let v=!1;this._register(this._editors.original.onDidScrollChange(y=>{y.scrollLeftChanged&&!v&&(v=!0,this._editors.modified.setScrollLeft(y.scrollLeft),v=!1)})),this._register(this._editors.modified.onDidScrollChange(y=>{y.scrollLeftChanged&&!v&&(v=!0,this._editors.original.setScrollLeft(y.scrollLeft),v=!1)})),this._originalScrollTop=Bi(this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=Bi(this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._register(tn(y=>{const C=this._originalScrollTop.read(y)-(this._originalScrollOffsetAnimated.get()-this._modifiedScrollOffsetAnimated.read(y))-(this._originalTopPadding.get()-this._modifiedTopPadding.read(y));C!==this._editors.modified.getScrollTop()&&this._editors.modified.setScrollTop(C,1)})),this._register(tn(y=>{const C=this._modifiedScrollTop.read(y)-(this._modifiedScrollOffsetAnimated.get()-this._originalScrollOffsetAnimated.read(y))-(this._modifiedTopPadding.get()-this._originalTopPadding.read(y));C!==this._editors.original.getScrollTop()&&this._editors.original.setScrollTop(C,1)})),this._register(tn(y=>{const C=this._diffModel.read(y)?.movedTextToCompare.read(y);let x=0;if(C){const k=this._editors.original.getTopForLineNumber(C.lineRangeMapping.original.startLineNumber,!0)-this._originalTopPadding.get();x=this._editors.modified.getTopForLineNumber(C.lineRangeMapping.modified.startLineNumber,!0)-this._modifiedTopPadding.get()-k}x>0?(this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(x,void 0)):x<0?(this._modifiedTopPadding.set(-x,void 0),this._originalTopPadding.set(0,void 0)):setTimeout(()=>{this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(0,void 0)},400),this._editors.modified.hasTextFocus()?this._originalScrollOffset.set(this._modifiedScrollOffset.get()-x,void 0,!0):this._modifiedScrollOffset.set(this._originalScrollOffset.get()+x,void 0,!0)}))}};ZJ=rPt([qwe(8,b0),qwe(9,mu)],ZJ);function Kwe(n,e,t,i,r,s){const o=new q_(Gwe(n,i)),a=new q_(Gwe(e,r)),l=n.getOption(67),c=e.getOption(67),u=[];let d=0,h=0;function f(g,p){for(;;){let m=o.peek(),_=a.peek();if(m&&m.lineNumber>=g&&(m=void 0),_&&_.lineNumber>=p&&(_=void 0),!m&&!_)break;const v=m?m.lineNumber-d:Number.MAX_VALUE,y=_?_.lineNumber-h:Number.MAX_VALUE;vy?(a.dequeue(),m={lineNumber:_.lineNumber-h+d,heightInPx:0}):(o.dequeue(),a.dequeue()),u.push({originalRange:gn.ofLength(m.lineNumber,1),modifiedRange:gn.ofLength(_.lineNumber,1),originalHeightInPx:l+m.heightInPx,modifiedHeightInPx:c+_.heightInPx,diff:void 0})}}for(const g of t){let y=function(C,x,k=!1){if(CM.lineNumberM+B.heightInPx,0)??0,O=a.takeWhile(M=>M.lineNumberM+B.heightInPx,0)??0;u.push({originalRange:L,modifiedRange:D,originalHeightInPx:L.length*l+I,modifiedHeightInPx:D.length*c+O,diff:g.lineRangeMapping}),v=C,_=x};const p=g.lineRangeMapping;f(p.original.startLineNumber,p.modified.startLineNumber);let m=!0,_=p.modified.startLineNumber,v=p.original.startLineNumber;if(s)for(const C of p.innerChanges||[]){C.originalRange.startColumn>1&&C.modifiedRange.startColumn>1&&y(C.originalRange.startLineNumber,C.modifiedRange.startLineNumber);const x=n.getModel(),k=C.originalRange.endLineNumber<=x.getLineCount()?x.getLineMaxColumn(C.originalRange.endLineNumber):Number.MAX_SAFE_INTEGER;C.originalRange.endColumn1&&i.push({lineNumber:l,heightInPx:o*(c-1)})}for(const l of n.getWhitespaces()){if(e.has(l.id))continue;const c=l.afterLineNumber===0?0:s.convertViewPositionToModelPosition(new he(l.afterLineNumber,1)).lineNumber;t.push({lineNumber:c,heightInPx:l.height})}return ARt(t,i,l=>l.lineNumber,(l,c)=>({lineNumber:l.lineNumber,heightInPx:l.heightInPx+c.heightInPx}))}function cue(n){return n.innerChanges?n.innerChanges.every(e=>Ywe(e.modifiedRange)&&Ywe(e.originalRange)||e.originalRange.equalsRange(new $(1,1,1,1))):!1}function Ywe(n){return n.startLineNumber===n.endLineNumber}class rw extends me{static{this.movedCodeBlockPadding=4}constructor(e,t,i,r,s){super(),this._rootElement=e,this._diffModel=t,this._originalEditorLayoutInfo=i,this._modifiedEditorLayoutInfo=r,this._editors=s,this._originalScrollTop=Bi(this,this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=Bi(this,this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._viewZonesChanged=xa("onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this.width=Sn(this,0),this._modifiedViewZonesChangedSignal=xa("modified.onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this._originalViewZonesChangedSignal=xa("original.onDidChangeViewZones",this._editors.original.onDidChangeViewZones),this._state=Jb(this,(u,d)=>{this._element.replaceChildren();const h=this._diffModel.read(u),f=h?.diff.read(u)?.movedTexts;if(!f||f.length===0){this.width.set(0,void 0);return}this._viewZonesChanged.read(u);const g=this._originalEditorLayoutInfo.read(u),p=this._modifiedEditorLayoutInfo.read(u);if(!g||!p){this.width.set(0,void 0);return}this._modifiedViewZonesChangedSignal.read(u),this._originalViewZonesChangedSignal.read(u);const m=f.map(L=>{function D(ee,Z){const j=Z.getTopForLineNumber(ee.startLineNumber,!0),te=Z.getTopForLineNumber(ee.endLineNumberExclusive,!0);return(j+te)/2}const I=D(L.lineRangeMapping.original,this._editors.original),O=this._originalScrollTop.read(u),M=D(L.lineRangeMapping.modified,this._editors.modified),B=this._modifiedScrollTop.read(u),G=I-O,W=M-B,z=Math.min(I,M),q=Math.max(I,M);return{range:new Dn(z,q),from:G,to:W,fromWithoutScroll:I,toWithoutScroll:M,move:L}});m.sort(ept($l(L=>L.fromWithoutScroll>L.toWithoutScroll,tpt),$l(L=>L.fromWithoutScroll>L.toWithoutScroll?L.fromWithoutScroll:-L.toWithoutScroll,Xh)));const _=uue.compute(m.map(L=>L.range)),v=10,y=g.verticalScrollbarWidth,C=(_.getTrackCount()-1)*10+v*2,x=y+C+(p.contentLeft-rw.movedCodeBlockPadding);let k=0;for(const L of m){const D=_.getTrack(k),I=y+v+D*10,O=15,M=15,B=x,G=p.glyphMarginWidth+p.lineNumbersWidth,W=18,z=document.createElementNS("http://www.w3.org/2000/svg","rect");z.classList.add("arrow-rectangle"),z.setAttribute("x",`${B-G}`),z.setAttribute("y",`${L.to-W/2}`),z.setAttribute("width",`${G}`),z.setAttribute("height",`${W}`),this._element.appendChild(z);const q=document.createElementNS("http://www.w3.org/2000/svg","g"),ee=document.createElementNS("http://www.w3.org/2000/svg","path");ee.setAttribute("d",`M 0 ${L.from} L ${I} ${L.from} L ${I} ${L.to} L ${B-M} ${L.to}`),ee.setAttribute("fill","none"),q.appendChild(ee);const Z=document.createElementNS("http://www.w3.org/2000/svg","polygon");Z.classList.add("arrow"),d.add(tn(j=>{ee.classList.toggle("currentMove",L.move===h.activeMovedText.read(j)),Z.classList.toggle("currentMove",L.move===h.activeMovedText.read(j))})),Z.setAttribute("points",`${B-M},${L.to-O/2} ${B},${L.to} ${B-M},${L.to+O/2}`),q.appendChild(Z),this._element.appendChild(q),k++}this.width.set(C,void 0)}),this._element=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("class","moved-blocks-lines"),this._rootElement.appendChild(this._element),this._register(Lt(()=>this._element.remove())),this._register(tn(u=>{const d=this._originalEditorLayoutInfo.read(u),h=this._modifiedEditorLayoutInfo.read(u);!d||!h||(this._element.style.left=`${d.width-d.verticalScrollbarWidth}px`,this._element.style.height=`${d.height}px`,this._element.style.width=`${d.verticalScrollbarWidth+d.contentLeft-rw.movedCodeBlockPadding+this.width.read(u)}px`)})),this._register(s2(this._state));const o=St(u=>{const h=this._diffModel.read(u)?.diff.read(u);return h?h.movedTexts.map(f=>({move:f,original:new OS(Hd(f.lineRangeMapping.original.startLineNumber-1),18),modified:new OS(Hd(f.lineRangeMapping.modified.startLineNumber-1),18)})):[]});this._register(_9(this._editors.original,o.map(u=>u.map(d=>d.original)))),this._register(_9(this._editors.modified,o.map(u=>u.map(d=>d.modified)))),this._register(wc((u,d)=>{const h=o.read(u);for(const f of h)d.add(new Zwe(this._editors.original,f.original,f.move,"original",this._diffModel.get())),d.add(new Zwe(this._editors.modified,f.modified,f.move,"modified",this._diffModel.get()))}));const a=xa("original.onDidFocusEditorWidget",u=>this._editors.original.onDidFocusEditorWidget(()=>setTimeout(()=>u(void 0),0))),l=xa("modified.onDidFocusEditorWidget",u=>this._editors.modified.onDidFocusEditorWidget(()=>setTimeout(()=>u(void 0),0)));let c="modified";this._register(lO({createEmptyChangeSummary:()=>{},handleChange:(u,d)=>(u.didChange(a)&&(c="original"),u.didChange(l)&&(c="modified"),!0)},u=>{a.read(u),l.read(u);const d=this._diffModel.read(u);if(!d)return;const h=d.diff.read(u);let f;if(h&&c==="original"){const g=this._editors.originalCursor.read(u);g&&(f=h.movedTexts.find(p=>p.lineRangeMapping.original.contains(g.lineNumber)))}if(h&&c==="modified"){const g=this._editors.modifiedCursor.read(u);g&&(f=h.movedTexts.find(p=>p.lineRangeMapping.modified.contains(g.lineNumber)))}f!==d.movedTextToCompare.get()&&d.movedTextToCompare.set(void 0,void 0),d.setActiveMovedText(f)}))}}class uue{static compute(e){const t=[],i=[];for(const r of e){let s=t.findIndex(o=>!o.intersectsStrict(r));s===-1&&(t.length>=6?s=Mbt(t,$l(a=>a.intersectWithRangeLength(r),Xh)):(s=t.length,t.push(new ele))),t[s].addRange(r),i.push(s)}return new uue(t.length,i)}constructor(e,t){this._trackCount=e,this.trackPerLineIdx=t}getTrack(e){return this.trackPerLineIdx[e]}getTrackCount(){return this._trackCount}}class Zwe extends Jce{constructor(e,t,i,r,s){const o=An("div.diff-hidden-lines-widget");super(e,t,o.root),this._editor=e,this._move=i,this._kind=r,this._diffModel=s,this._nodes=An("div.diff-moved-code-block",{style:{marginRight:"4px"}},[An("div.text-content@textContent"),An("div.action-bar@actionBar")]),o.root.appendChild(this._nodes.root);const a=Bi(this._editor.onDidLayoutChange,()=>this._editor.getLayoutInfo());this._register(J_(this._nodes.root,{paddingRight:a.map(h=>h.verticalScrollbarWidth)}));let l;i.changes.length>0?l=this._kind==="original"?w("codeMovedToWithChanges","Code moved with changes to line {0}-{1}",this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):w("codeMovedFromWithChanges","Code moved with changes from line {0}-{1}",this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1):l=this._kind==="original"?w("codeMovedTo","Code moved to line {0}-{1}",this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):w("codeMovedFrom","Code moved from line {0}-{1}",this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1);const c=this._register(new ed(this._nodes.actionBar,{highlightToggledItems:!0})),u=new su("",l,"",!1);c.push(u,{icon:!1,label:!0});const d=new su("","Compare",zt.asClassName(ze.compareChanges),!0,()=>{this._editor.focus(),this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get()===i?void 0:this._move,void 0)});this._register(tn(h=>{const f=this._diffModel.movedTextToCompare.read(h)===i;d.checked=f})),c.push(d,{icon:!1,label:!0})}}class sPt extends me{constructor(e,t,i,r){super(),this._editors=e,this._diffModel=t,this._options=i,this._decorations=St(this,s=>{const o=this._diffModel.read(s),a=o?.diff.read(s);if(!a)return null;const l=this._diffModel.read(s).movedTextToCompare.read(s),c=this._options.renderIndicators.read(s),u=this._options.showEmptyDecorations.read(s),d=[],h=[];if(!l)for(const g of a.mappings)if(g.lineRangeMapping.original.isEmpty||d.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:c?XN:zwe}),g.lineRangeMapping.modified.isEmpty||h.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:c?b9:Vwe}),g.lineRangeMapping.modified.isEmpty||g.lineRangeMapping.original.isEmpty)g.lineRangeMapping.original.isEmpty||d.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:sue}),g.lineRangeMapping.modified.isEmpty||h.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:iue});else{const p=this._options.useTrueInlineDiffRendering.read(s)&&cue(g.lineRangeMapping);for(const m of g.lineRangeMapping.innerChanges||[])if(g.lineRangeMapping.original.contains(m.originalRange.startLineNumber)&&d.push({range:m.originalRange,options:m.originalRange.isEmpty()&&u?oue:kE}),g.lineRangeMapping.modified.contains(m.modifiedRange.startLineNumber)&&h.push({range:m.modifiedRange,options:m.modifiedRange.isEmpty()&&u&&!p?rue:y9}),p){const _=o.model.original.getValueInRange(m.originalRange);h.push({range:m.modifiedRange,options:{description:"deleted-text",before:{content:_,inlineClassName:"inline-deleted-text"},zIndex:1e5,showIfCollapsed:!0}})}}if(l)for(const g of l.changes){const p=g.original.toInclusiveRange();p&&d.push({range:p,options:c?XN:zwe});const m=g.modified.toInclusiveRange();m&&h.push({range:m,options:c?b9:Vwe});for(const _ of g.innerChanges||[])d.push({range:_.originalRange,options:kE}),h.push({range:_.modifiedRange,options:y9})}const f=this._diffModel.read(s).activeMovedText.read(s);for(const g of a.movedTexts)d.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:{description:"moved",blockClassName:"movedOriginal"+(g===f?" currentMove":""),blockPadding:[rw.movedCodeBlockPadding,0,rw.movedCodeBlockPadding,rw.movedCodeBlockPadding]}}),h.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:{description:"moved",blockClassName:"movedModified"+(g===f?" currentMove":""),blockPadding:[4,0,4,4]}});return{originalDecorations:d,modifiedDecorations:h}}),this._register(m9(this._editors.original,this._decorations.map(s=>s?.originalDecorations||[]))),this._register(m9(this._editors.modified,this._decorations.map(s=>s?.modifiedDecorations||[])))}}class oPt{resetSash(){this._sashRatio.set(void 0,void 0)}constructor(e,t){this._options=e,this.dimensions=t,this.sashLeft=oO(this,i=>{const r=this._sashRatio.read(i)??this._options.splitViewDefaultRatio.read(i);return this._computeSashLeft(r,i)},(i,r)=>{const s=this.dimensions.width.get();this._sashRatio.set(i/s,r)}),this._sashRatio=Sn(this,void 0)}_computeSashLeft(e,t){const i=this.dimensions.width.read(t),r=Math.floor(this._options.splitViewDefaultRatio.read(t)*i),s=this._options.enableSplitViewResizing.read(t)?Math.floor(e*i):r,o=100;return i<=o*2?r:si-o?i-o:s}}class D8e extends me{constructor(e,t,i,r,s,o){super(),this._domNode=e,this._dimensions=t,this._enabled=i,this._boundarySashes=r,this.sashLeft=s,this._resetSash=o,this._sash=this._register(new $a(this._domNode,{getVerticalSashTop:a=>0,getVerticalSashLeft:a=>this.sashLeft.get(),getVerticalSashHeight:a=>this._dimensions.height.get()},{orientation:0})),this._startSashPosition=void 0,this._register(this._sash.onDidStart(()=>{this._startSashPosition=this.sashLeft.get()})),this._register(this._sash.onDidChange(a=>{this.sashLeft.set(this._startSashPosition+(a.currentX-a.startX),void 0)})),this._register(this._sash.onDidEnd(()=>this._sash.layout())),this._register(this._sash.onDidReset(()=>this._resetSash())),this._register(tn(a=>{const l=this._boundarySashes.read(a);l&&(this._sash.orthogonalEndSash=l.bottom)})),this._register(tn(a=>{const l=this._enabled.read(a);this._sash.state=l?3:0,this.sashLeft.read(a),this._dimensions.height.read(a),this._sash.layout()}))}}class aPt extends me{constructor(e,t,i){super(),this._editor=e,this._domNode=t,this.itemProvider=i,this.scrollTop=Bi(this,this._editor.onDidScrollChange,o=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(o=>o===0),this.modelAttached=Bi(this,this._editor.onDidChangeModel,o=>this._editor.hasModel()),this.editorOnDidChangeViewZones=xa("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=xa("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=r2("domNodeSizeChanged"),this.views=new Map,this._domNode.className="gutter monaco-editor";const r=this._domNode.appendChild(An("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),s=new ResizeObserver(()=>{qr(o=>{this.domNodeSizeChanged.trigger(o)})});s.observe(this._domNode),this._register(Lt(()=>s.disconnect())),this._register(tn(o=>{r.className=this.isScrollTopZero.read(o)?"":"scroll-decoration"})),this._register(tn(o=>this.render(o)))}dispose(){super.dispose(),ea(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);const t=this.scrollTop.read(e),i=this._editor.getVisibleRanges(),r=new Set(this.views.keys()),s=Dn.ofStartAndLength(0,this._domNode.clientHeight);if(!s.isEmpty)for(const o of i){const a=new gn(o.startLineNumber,o.endLineNumber+1),l=this.itemProvider.getIntersectingGutterItems(a,e);qr(c=>{for(const u of l){if(!u.range.intersect(a))continue;r.delete(u.id);let d=this.views.get(u.id);if(d)d.item.set(u,c);else{const p=document.createElement("div");this._domNode.appendChild(p);const m=Sn("item",u),_=this.itemProvider.createView(m,p);d=new lPt(m,_,p),this.views.set(u.id,d)}const h=u.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(u.range.startLineNumber,!0)-t:this._editor.getBottomForLineNumber(u.range.startLineNumber-1,!1)-t,g=(u.range.endLineNumberExclusive===1?Math.max(h,this._editor.getTopForLineNumber(u.range.startLineNumber,!1)-t):Math.max(h,this._editor.getBottomForLineNumber(u.range.endLineNumberExclusive-1,!0)-t))-h;d.domNode.style.top=`${h}px`,d.domNode.style.height=`${g}px`,d.gutterItemView.layout(Dn.ofStartAndLength(h,g),s)}})}for(const o of r){const a=this.views.get(o);a.gutterItemView.dispose(),a.domNode.remove(),this.views.delete(o)}}}class lPt{constructor(e,t,i){this.item=e,this.gutterItemView=t,this.domNode=i}}class I8e extends Aw{constructor(e){super(),this._getContext=e}runAction(e,t){const i=this._getContext();return super.runAction(e,i)}}class Xwe extends j3e{constructor(e){super(),this._textModel=e}getValueOfRange(e){return this._textModel.getValueInRange(e)}get length(){const e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new _c(e-1,t)}}let cPt=class extends me{constructor(e,t,i={orientation:0}){super(),this.submenuActionViewItems=[],this.hasSecondaryActions=!1,this._onDidChangeDropdownVisibility=this._register(new kmt),this.onDidChangeDropdownVisibility=this._onDidChangeDropdownVisibility.event,this.disposables=this._register(new ke),i.hoverDelegate=i.hoverDelegate??this._register(_E()),this.options=i,this.toggleMenuAction=this._register(new QN(()=>this.toggleMenuActionViewItem?.show(),i.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",e.appendChild(this.element),this.actionBar=this._register(new ed(this.element,{orientation:i.orientation,ariaLabel:i.ariaLabel,actionRunner:i.actionRunner,allowContextMenu:i.allowContextMenu,highlightToggledItems:i.highlightToggledItems,hoverDelegate:i.hoverDelegate,actionViewItemProvider:(r,s)=>{if(r.id===QN.ID)return this.toggleMenuActionViewItem=new D8(r,r.menuActions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:zt.asClassNameArray(i.moreIcon??ze.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,isMenu:!0,hoverDelegate:this.options.hoverDelegate}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(i.actionViewItemProvider){const o=i.actionViewItemProvider(r,s);if(o)return o}if(r instanceof rE){const o=new D8(r,r.actions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:r.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,hoverDelegate:this.options.hoverDelegate});return o.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(o),this.disposables.add(this._onDidChangeDropdownVisibility.add(o.onDidChangeVisibility)),o}}}))}set actionRunner(e){this.actionBar.actionRunner=e}get actionRunner(){return this.actionBar.actionRunner}getElement(){return this.element}getItemAction(e){return this.actionBar.getAction(e)}setActions(e,t){this.clear();const i=e?e.slice(0):[];this.hasSecondaryActions=!!(t&&t.length>0),this.hasSecondaryActions&&t&&(this.toggleMenuAction.menuActions=t.slice(0),i.push(this.toggleMenuAction)),i.forEach(r=>{this.actionBar.push(r,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(r)})})}getKeybindingLabel(e){return this.options.getKeyBinding?.(e)?.getLabel()??void 0}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),super.dispose()}};class QN extends su{static{this.ID="toolbar.toggle.more"}constructor(e,t){t=t||w("moreActions","More Actions..."),super(QN.ID,t,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=e}async run(){this.toggleDropdownMenu()}get menuActions(){return this._menuActions}set menuActions(e){this._menuActions=e}}var A8e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},$h=function(n,e){return function(t,i){e(t,i,n)}};let JN=class extends cPt{constructor(e,t,i,r,s,o,a,l){super(e,s,{getKeyBinding:u=>o.lookupKeybinding(u.id)??void 0,...t,allowContextMenu:!0,skipTelemetry:typeof t?.telemetrySource=="string"}),this._options=t,this._menuService=i,this._contextKeyService=r,this._contextMenuService=s,this._keybindingService=o,this._commandService=a,this._sessionDisposables=this._store.add(new ke);const c=t?.telemetrySource;c&&this._store.add(this.actionBar.onDidRun(u=>l.publicLog2("workbenchActionExecuted",{id:u.action.id,from:c})))}setActions(e,t=[],i){this._sessionDisposables.clear();const r=e.slice(),s=t.slice(),o=[];let a=0;const l=[];let c=!1;if(this._options?.hiddenItemStrategy!==-1)for(let u=0;uf?.id)),d=this._options.overflowBehavior.maxItems-u.size;let h=0;for(let f=0;f=d&&(r[f]=void 0,l[f]=g))}}Lve(r),Lve(l),super.setActions(r,na.join(l,s)),(o.length>0||r.length>0)&&this._sessionDisposables.add(Ce(this.getElement(),"contextmenu",u=>{const d=new qh(Ot(this.getElement()),u),h=this.getItemAction(d.target);if(!h)return;d.preventDefault(),d.stopPropagation();const f=[];if(h instanceof ou&&h.menuKeybinding)f.push(h.menuKeybinding);else if(!(h instanceof ck||h instanceof QN)){const p=!!this._keybindingService.lookupKeybinding(h.id);f.push(K6e(this._commandService,this._keybindingService,h.id,void 0,p))}if(o.length>0){let p=!1;if(a===1&&this._options?.hiddenItemStrategy===0){p=!0;for(let m=0;mthis._menuService.resetHiddenStates(i)}))),g.length!==0&&this._contextMenuService.showContextMenu({getAnchor:()=>d,getActions:()=>g,menuId:this._options?.contextMenu,menuActionOptions:{renderShortTitle:!0,...this._options?.menuOptions},skipTelemetry:typeof this._options?.telemetrySource=="string",contextKeyService:this._contextKeyService})}))}};JN=A8e([$h(2,ld),$h(3,jt),$h(4,mu),$h(5,xi),$h(6,_r),$h(7,Qa)],JN);let w9=class extends JN{constructor(e,t,i,r,s,o,a,l,c){super(e,{resetMenu:t,...i},r,s,o,a,l,c),this._onDidChangeMenuItems=this._store.add(new fe),this.onDidChangeMenuItems=this._onDidChangeMenuItems.event;const u=this._store.add(r.createMenu(t,s,{emitEventsForSubmenuChanges:!0})),d=()=>{const h=[],f=[];EW(u,i?.menuOptions,{primary:h,secondary:f},i?.toolbarOptions?.primaryGroup,i?.toolbarOptions?.shouldInlineSubmenu,i?.toolbarOptions?.useSeparatorsInPrimaryActions),e.classList.toggle("has-no-actions",h.length===0&&f.length===0),super.setActions(h,f)};this._store.add(u.onDidChange(()=>{d(),this._onDidChangeMenuItems.fire(this)})),d()}setActions(){throw new fi("This toolbar is populated from a menu.")}};w9=A8e([$h(3,ld),$h(4,jt),$h(5,mu),$h(6,xi),$h(7,_r),$h(8,Qa)],w9);var N8e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},d5=function(n,e){return function(t,i){e(t,i,n)}};const Rq=[],s3=35;let XJ=class extends me{constructor(e,t,i,r,s,o,a,l,c){super(),this._diffModel=t,this._editors=i,this._options=r,this._sashLayout=s,this._boundarySashes=o,this._instantiationService=a,this._contextKeyService=l,this._menuService=c,this._menu=this._register(this._menuService.createMenu(ce.DiffEditorHunkToolbar,this._contextKeyService)),this._actions=Bi(this,this._menu.onDidChange,()=>this._menu.getActions()),this._hasActions=this._actions.map(u=>u.length>0),this._showSash=St(this,u=>this._options.renderSideBySide.read(u)&&this._hasActions.read(u)),this.width=St(this,u=>this._hasActions.read(u)?s3:0),this.elements=An("div.gutter@gutter",{style:{position:"absolute",height:"100%",width:s3+"px"}},[]),this._currentDiff=St(this,u=>{const d=this._diffModel.read(u);if(!d)return;const h=d.diff.read(u)?.mappings,f=this._editors.modifiedCursor.read(u);if(f)return h?.find(g=>g.lineRangeMapping.modified.contains(f.lineNumber))}),this._selectedDiffs=St(this,u=>{const h=this._diffModel.read(u)?.diff.read(u);if(!h)return Rq;const f=this._editors.modifiedSelections.read(u);if(f.every(_=>_.isEmpty()))return Rq;const g=new Md(f.map(_=>gn.fromRangeInclusive(_))),m=h.mappings.filter(_=>_.lineRangeMapping.innerChanges&&g.intersects(_.lineRangeMapping.modified)).map(_=>({mapping:_,rangeMappings:_.lineRangeMapping.innerChanges.filter(v=>f.some(y=>$.areIntersecting(v.modifiedRange,y)))}));return m.length===0||m.every(_=>_.rangeMappings.length===0)?Rq:m}),this._register(NRt(e,this.elements.root)),this._register(Ce(this.elements.root,"click",()=>{this._editors.modified.focus()})),this._register(J_(this.elements.root,{display:this._hasActions.map(u=>u?"block":"none")})),hl(this,u=>this._showSash.read(u)?new D8e(e,this._sashLayout.dimensions,this._options.enableSplitViewResizing,this._boundarySashes,oO(this,h=>this._sashLayout.sashLeft.read(h)-s3,(h,f)=>this._sashLayout.sashLeft.set(h+s3,f)),()=>this._sashLayout.resetSash()):void 0).recomputeInitiallyAndOnChange(this._store),this._register(new aPt(this._editors.modified,this.elements.root,{getIntersectingGutterItems:(u,d)=>{const h=this._diffModel.read(d);if(!h)return[];const f=h.diff.read(d);if(!f)return[];const g=this._selectedDiffs.read(d);if(g.length>0){const m=Ju.fromRangeMappings(g.flatMap(_=>_.rangeMappings));return[new Qwe(m,!0,ce.DiffEditorSelectionToolbar,void 0,h.model.original.uri,h.model.modified.uri)]}const p=this._currentDiff.read(d);return f.mappings.map(m=>new Qwe(m.lineRangeMapping.withInnerChangesFromLineRanges(),m.lineRangeMapping===p?.lineRangeMapping,ce.DiffEditorHunkToolbar,void 0,h.model.original.uri,h.model.modified.uri))},createView:(u,d)=>this._instantiationService.createInstance(QJ,u,d,this)})),this._register(Ce(this.elements.gutter,je.MOUSE_WHEEL,u=>{this._editors.modified.getOption(104).handleMouseWheel&&this._editors.modified.delegateScrollFromMouseWheelEvent(u)},{passive:!1}))}computeStagedValue(e){const t=e.innerChanges??[],i=new Xwe(this._editors.modifiedModel.get()),r=new Xwe(this._editors.original.getModel());return new nle(t.map(a=>a.toTextEdit(i))).apply(r)}layout(e){this.elements.gutter.style.left=e+"px"}};XJ=N8e([d5(6,Tt),d5(7,jt),d5(8,ld)],XJ);class Qwe{constructor(e,t,i,r,s,o){this.mapping=e,this.showAlways=t,this.menuId=i,this.rangeOverride=r,this.originalUri=s,this.modifiedUri=o}get id(){return this.mapping.modified.toString()}get range(){return this.rangeOverride??this.mapping.modified}}let QJ=class extends me{constructor(e,t,i,r){super(),this._item=e,this._elements=An("div.gutterItem",{style:{height:"20px",width:"34px"}},[An("div.background@background",{},[]),An("div.buttons@buttons",{},[])]),this._showAlways=this._item.map(this,o=>o.showAlways),this._menuId=this._item.map(this,o=>o.menuId),this._isSmall=Sn(this,!1),this._lastItemRange=void 0,this._lastViewRange=void 0;const s=this._register(r.createInstance(uE,"element",!0,{position:{hoverPosition:1}}));this._register(PS(t,this._elements.root)),this._register(tn(o=>{const a=this._showAlways.read(o);this._elements.root.classList.toggle("noTransition",!0),this._elements.root.classList.toggle("showAlways",a),setTimeout(()=>{this._elements.root.classList.toggle("noTransition",!1)},0)})),this._register(wc((o,a)=>{this._elements.buttons.replaceChildren();const l=a.add(r.createInstance(w9,this._elements.buttons,this._menuId.read(o),{orientation:1,hoverDelegate:s,toolbarOptions:{primaryGroup:c=>c.startsWith("primary")},overflowBehavior:{maxItems:this._isSmall.read(o)?1:3},hiddenItemStrategy:0,actionRunner:new I8e(()=>{const c=this._item.get(),u=c.mapping;return{mapping:u,originalWithModifiedChanges:i.computeStagedValue(u),originalUri:c.originalUri,modifiedUri:c.modifiedUri}}),menuOptions:{shouldForwardArgs:!0}}));a.add(l.onDidChangeMenuItems(()=>{this._lastItemRange&&this.layout(this._lastItemRange,this._lastViewRange)}))}))}layout(e,t){this._lastItemRange=e,this._lastViewRange=t;let i=this._elements.buttons.clientHeight;this._isSmall.set(this._item.get().mapping.original.startLineNumber===1&&e.length<30,void 0),i=this._elements.buttons.clientHeight;const r=e.length/2-i/2,s=i;let o=e.start+r;const a=Dn.tryCreate(s,t.endExclusive-s-i),l=Dn.tryCreate(e.start+s,e.endExclusive-i-s);l&&a&&l.start{const r=yy._map.get(e);r&&(yy._map.delete(e),r.dispose(),i.dispose())})}return t}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&(this._currentTransaction=new i2(()=>{}))}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){const e=this._currentTransaction;this._currentTransaction=void 0,e.finish()}}constructor(e){super(),this.editor=e,this._updateCounter=0,this._currentTransaction=void 0,this._model=Sn(this,this.editor.getModel()),this.model=this._model,this.isReadonly=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(92)),this._versionId=CQ({owner:this,lazy:!0},this.editor.getModel()?.getVersionId()??null),this.versionId=this._versionId,this._selections=CQ({owner:this,equalsFn:bQ(k8(yt.selectionsEqual)),lazy:!0},this.editor.getSelections()??null),this.selections=this._selections,this.isFocused=Bi(this,t=>{const i=this.editor.onDidFocusEditorWidget(t),r=this.editor.onDidBlurEditorWidget(t);return{dispose(){i.dispose(),r.dispose()}}},()=>this.editor.hasWidgetFocus()),this.value=oO(this,t=>(this.versionId.read(t),this.model.read(t)?.getValue()??""),(t,i)=>{const r=this.model.get();r!==null&&t!==r.getValue()&&r.setValue(t)}),this.valueIsEmpty=St(this,t=>(this.versionId.read(t),this.editor.getModel()?.getValueLength()===0)),this.cursorSelection=$u({owner:this,equalsFn:bQ(yt.selectionsEqual)},t=>this.selections.read(t)?.[0]??null),this.onDidType=r2(this),this.scrollTop=Bi(this.editor.onDidScrollChange,()=>this.editor.getScrollTop()),this.scrollLeft=Bi(this.editor.onDidScrollChange,()=>this.editor.getScrollLeft()),this.layoutInfo=Bi(this.editor.onDidLayoutChange,()=>this.editor.getLayoutInfo()),this.layoutInfoContentLeft=this.layoutInfo.map(t=>t.contentLeft),this.layoutInfoDecorationsLeft=this.layoutInfo.map(t=>t.decorationsLeft),this.contentWidth=Bi(this.editor.onDidContentSizeChange,()=>this.editor.getContentWidth()),this._overlayWidgetCounter=0,this._register(this.editor.onBeginUpdate(()=>this._beginUpdate())),this._register(this.editor.onEndUpdate(()=>this._endUpdate())),this._register(this.editor.onDidChangeModel(()=>{this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidType(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidType.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeModelContent(t=>{this._beginUpdate();try{this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeCursorSelection(t=>{this._beginUpdate();try{this._selections.set(this.editor.getSelections(),this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}}))}forceUpdate(e){this._beginUpdate();try{return this._forceUpdate(),e?e(this._currentTransaction):void 0}finally{this._endUpdate()}}_forceUpdate(){this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,void 0),this._selections.set(this.editor.getSelections(),this._currentTransaction,void 0)}finally{this._endUpdate()}}getOption(e){return Bi(this,t=>this.editor.onDidChangeConfiguration(i=>{i.hasChanged(e)&&t(void 0)}),()=>this.editor.getOption(e))}setDecorations(e){const t=new ke,i=this.editor.createDecorationsCollection();return t.add(aO({owner:this,debugName:()=>`Apply decorations from ${e.debugName}`},r=>{const s=e.read(r);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}createOverlayWidget(e){const t="observableOverlayWidget"+this._overlayWidgetCounter++,i={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow,getMinContentWidthInPx:()=>e.minContentWidthInPx.get()};this.editor.addOverlayWidget(i);const r=tn(s=>{e.position.read(s),e.minContentWidthInPx.read(s),this.editor.layoutOverlayWidget(i)});return Lt(()=>{r.dispose(),this.editor.removeOverlayWidget(i)})}}function JJ(n,e){return ISt({createEmptyChangeSummary:()=>({deltas:[],didChange:!1}),handleChange:(t,i)=>{if(t.didChange(n)){const r=t.change;r!==void 0&&i.deltas.push(r),i.didChange=!0}return!0}},(t,i)=>{const r=n.read(t);i.didChange&&e(r,i.deltas)})}function uPt(n,e){const t=new ke,i=JJ(n,(r,s)=>{t.clear(),e(r,s,t)});return{dispose(){i.dispose(),t.dispose()}}}var dPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},hPt=function(n,e){return function(t,i){e(t,i,n)}},h5;let C9=class extends me{static{h5=this}static{this._breadcrumbsSourceFactory=Sn(h5,()=>({dispose(){},getBreadcrumbItems(e,t){return[]}}))}static setBreadcrumbsSourceFactory(e){this._breadcrumbsSourceFactory.set(e,void 0)}get isUpdatingHiddenAreas(){return this._isUpdatingHiddenAreas}constructor(e,t,i,r){super(),this._editors=e,this._diffModel=t,this._options=i,this._instantiationService=r,this._modifiedOutlineSource=hl(this,l=>{const c=this._editors.modifiedModel.read(l),u=h5._breadcrumbsSourceFactory.read(l);return!c||!u?void 0:u(c,this._instantiationService)}),this._isUpdatingHiddenAreas=!1,this._register(this._editors.original.onDidChangeCursorPosition(l=>{if(l.reason===1)return;const c=this._diffModel.get();qr(u=>{for(const d of this._editors.original.getSelections()||[])c?.ensureOriginalLineIsVisible(d.getStartPosition().lineNumber,0,u),c?.ensureOriginalLineIsVisible(d.getEndPosition().lineNumber,0,u)})})),this._register(this._editors.modified.onDidChangeCursorPosition(l=>{if(l.reason===1)return;const c=this._diffModel.get();qr(u=>{for(const d of this._editors.modified.getSelections()||[])c?.ensureModifiedLineIsVisible(d.getStartPosition().lineNumber,0,u),c?.ensureModifiedLineIsVisible(d.getEndPosition().lineNumber,0,u)})}));const s=this._diffModel.map((l,c)=>{const u=l?.unchangedRegions.read(c)??[];return u.length===1&&u[0].modifiedLineNumber===1&&u[0].lineCount===this._editors.modifiedModel.read(c)?.getLineCount()?[]:u});this.viewZones=Jb(this,(l,c)=>{const u=this._modifiedOutlineSource.read(l);if(!u)return{origViewZones:[],modViewZones:[]};const d=[],h=[],f=this._options.renderSideBySide.read(l),g=this._options.compactMode.read(l),p=s.read(l);for(let m=0;m_.getHiddenOriginalRange(C).startLineNumber-1),y=new OS(v,12);d.push(y),c.add(new Jwe(this._editors.original,y,_,!f))}{const v=St(this,C=>_.getHiddenModifiedRange(C).startLineNumber-1),y=new OS(v,12);h.push(y),c.add(new Jwe(this._editors.modified,y,_))}}else{{const v=St(this,C=>_.getHiddenOriginalRange(C).startLineNumber-1),y=new OS(v,24);d.push(y),c.add(new eCe(this._editors.original,y,_,_.originalUnchangedRange,!f,u,C=>this._diffModel.get().ensureModifiedLineIsVisible(C,2,void 0),this._options))}{const v=St(this,C=>_.getHiddenModifiedRange(C).startLineNumber-1),y=new OS(v,24);h.push(y),c.add(new eCe(this._editors.modified,y,_,_.modifiedUnchangedRange,!1,u,C=>this._diffModel.get().ensureModifiedLineIsVisible(C,2,void 0),this._options))}}}return{origViewZones:d,modViewZones:h}});const o={description:"unchanged lines",className:"diff-unchanged-lines",isWholeLine:!0},a={description:"Fold Unchanged",glyphMarginHoverMessage:new za(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(w("foldUnchanged","Fold Unchanged Region")),glyphMarginClassName:"fold-unchanged "+zt.asClassName(ze.fold),zIndex:10001};this._register(m9(this._editors.original,St(this,l=>{const c=s.read(l),u=c.map(d=>({range:d.originalUnchangedRange.toInclusiveRange(),options:o}));for(const d of c)d.shouldHideControls(l)&&u.push({range:$.fromPositions(new he(d.originalLineNumber,1)),options:a});return u}))),this._register(m9(this._editors.modified,St(this,l=>{const c=s.read(l),u=c.map(d=>({range:d.modifiedUnchangedRange.toInclusiveRange(),options:o}));for(const d of c)d.shouldHideControls(l)&&u.push({range:gn.ofLength(d.modifiedLineNumber,1).toInclusiveRange(),options:a});return u}))),this._register(tn(l=>{const c=s.read(l);this._isUpdatingHiddenAreas=!0;try{this._editors.original.setHiddenAreas(c.map(u=>u.getHiddenOriginalRange(l).toInclusiveRange()).filter(Bp)),this._editors.modified.setHiddenAreas(c.map(u=>u.getHiddenModifiedRange(l).toInclusiveRange()).filter(Bp))}finally{this._isUpdatingHiddenAreas=!1}})),this._register(this._editors.modified.onMouseUp(l=>{if(!l.event.rightButton&&l.target.position&&l.target.element?.className.includes("fold-unchanged")){const c=l.target.position.lineNumber,u=this._diffModel.get();if(!u)return;const d=u.unchangedRegions.get().find(h=>h.modifiedUnchangedRange.includes(c));if(!d)return;d.collapseAll(void 0),l.event.stopPropagation(),l.event.preventDefault()}})),this._register(this._editors.original.onMouseUp(l=>{if(!l.event.rightButton&&l.target.position&&l.target.element?.className.includes("fold-unchanged")){const c=l.target.position.lineNumber,u=this._diffModel.get();if(!u)return;const d=u.unchangedRegions.get().find(h=>h.originalUnchangedRange.includes(c));if(!d)return;d.collapseAll(void 0),l.event.stopPropagation(),l.event.preventDefault()}}))}};C9=h5=dPt([hPt(3,Tt)],C9);class Jwe extends Jce{constructor(e,t,i,r=!1){const s=An("div.diff-hidden-lines-widget");super(e,t,s.root),this._unchangedRegion=i,this._hide=r,this._nodes=An("div.diff-hidden-lines-compact",[An("div.line-left",[]),An("div.text@text",[]),An("div.line-right",[])]),s.root.appendChild(this._nodes.root),this._hide&&this._nodes.root.replaceChildren(),this._register(tn(o=>{if(!this._hide){const a=this._unchangedRegion.getHiddenModifiedRange(o).length,l=w("hiddenLines","{0} hidden lines",a);this._nodes.text.innerText=l}}))}}class eCe extends Jce{constructor(e,t,i,r,s,o,a,l){const c=An("div.diff-hidden-lines-widget");super(e,t,c.root),this._editor=e,this._unchangedRegion=i,this._unchangedRegionRange=r,this._hide=s,this._modifiedOutlineSource=o,this._revealModifiedHiddenLine=a,this._options=l,this._nodes=An("div.diff-hidden-lines",[An("div.top@top",{title:w("diff.hiddenLines.top","Click or drag to show more above")}),An("div.center@content",{style:{display:"flex"}},[An("div@first",{style:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0"}},[qe("a",{title:w("showUnchangedRegion","Show Unchanged Region"),role:"button",onclick:()=>{this._unchangedRegion.showAll(void 0)}},...ob("$(unfold)"))]),An("div@others",{style:{display:"flex",justifyContent:"center",alignItems:"center"}})]),An("div.bottom@bottom",{title:w("diff.bottom","Click or drag to show more below"),role:"button"})]),c.root.appendChild(this._nodes.root),this._hide?ea(this._nodes.first):this._register(J_(this._nodes.first,{width:Jc(this._editor).layoutInfoContentLeft})),this._register(tn(d=>{const h=this._unchangedRegion.visibleLineCountTop.read(d)+this._unchangedRegion.visibleLineCountBottom.read(d)===this._unchangedRegion.lineCount;this._nodes.bottom.classList.toggle("canMoveTop",!h),this._nodes.bottom.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(d)>0),this._nodes.top.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(d)>0),this._nodes.top.classList.toggle("canMoveBottom",!h);const f=this._unchangedRegion.isDragged.read(d),g=this._editor.getDomNode();g&&(g.classList.toggle("draggingUnchangedRegion",!!f),f==="top"?(g.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(d)>0),g.classList.toggle("canMoveBottom",!h)):f==="bottom"?(g.classList.toggle("canMoveTop",!h),g.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(d)>0)):(g.classList.toggle("canMoveTop",!1),g.classList.toggle("canMoveBottom",!1)))}));const u=this._editor;this._register(Ce(this._nodes.top,"mousedown",d=>{if(d.button!==0)return;this._nodes.top.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),d.preventDefault();const h=d.clientY;let f=!1;const g=this._unchangedRegion.visibleLineCountTop.get();this._unchangedRegion.isDragged.set("top",void 0);const p=Ot(this._nodes.top),m=Ce(p,"mousemove",v=>{const C=v.clientY-h;f=f||Math.abs(C)>2;const x=Math.round(C/u.getOption(67)),k=Math.max(0,Math.min(g+x,this._unchangedRegion.getMaxVisibleLineCountTop()));this._unchangedRegion.visibleLineCountTop.set(k,void 0)}),_=Ce(p,"mouseup",v=>{f||this._unchangedRegion.showMoreAbove(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0),this._nodes.top.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),this._unchangedRegion.isDragged.set(void 0,void 0),m.dispose(),_.dispose()})})),this._register(Ce(this._nodes.bottom,"mousedown",d=>{if(d.button!==0)return;this._nodes.bottom.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),d.preventDefault();const h=d.clientY;let f=!1;const g=this._unchangedRegion.visibleLineCountBottom.get();this._unchangedRegion.isDragged.set("bottom",void 0);const p=Ot(this._nodes.bottom),m=Ce(p,"mousemove",v=>{const C=v.clientY-h;f=f||Math.abs(C)>2;const x=Math.round(C/u.getOption(67)),k=Math.max(0,Math.min(g-x,this._unchangedRegion.getMaxVisibleLineCountBottom())),L=this._unchangedRegionRange.endLineNumberExclusive>u.getModel().getLineCount()?u.getContentHeight():u.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.visibleLineCountBottom.set(k,void 0);const D=this._unchangedRegionRange.endLineNumberExclusive>u.getModel().getLineCount()?u.getContentHeight():u.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);u.setScrollTop(u.getScrollTop()+(D-L))}),_=Ce(p,"mouseup",v=>{if(this._unchangedRegion.isDragged.set(void 0,void 0),!f){const y=u.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.showMoreBelow(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0);const C=u.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);u.setScrollTop(u.getScrollTop()+(C-y))}this._nodes.bottom.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),m.dispose(),_.dispose()})})),this._register(tn(d=>{const h=[];if(!this._hide){const f=i.getHiddenModifiedRange(d).length,g=w("hiddenLines","{0} hidden lines",f),p=qe("span",{title:w("diff.hiddenLines.expandAll","Double click to unfold")},g);p.addEventListener("dblclick",v=>{v.button===0&&(v.preventDefault(),this._unchangedRegion.showAll(void 0))}),h.push(p);const m=this._unchangedRegion.getHiddenModifiedRange(d),_=this._modifiedOutlineSource.getBreadcrumbItems(m,d);if(_.length>0){h.push(qe("span",void 0,"  |  "));for(let v=0;v<_.length;v++){const y=_[v],C=$6.toIcon(y.kind),x=An("div.breadcrumb-item",{style:{display:"flex",alignItems:"center"}},[Pw(C)," ",y.name,...v===_.length-1?[]:[Pw(ze.chevronRight)]]).root;h.push(x),x.onclick=()=>{this._revealModifiedHiddenLine(y.startLineNumber)}}}}ea(this._nodes.others,...h)}))}}var fPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gPt=function(n,e){return function(t,i){e(t,i,n)}},Df;let eR=class extends me{static{Df=this}static{this.ONE_OVERVIEW_WIDTH=15}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=this.ONE_OVERVIEW_WIDTH*2}constructor(e,t,i,r,s,o,a){super(),this._editors=e,this._rootElement=t,this._diffModel=i,this._rootWidth=r,this._rootHeight=s,this._modifiedEditorLayoutInfo=o,this._themeService=a,this.width=Df.ENTIRE_DIFF_OVERVIEW_WIDTH;const l=Bi(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),c=St(h=>{const f=l.read(h),g=f.getColor(Iyt)||(f.getColor(Tyt)||zX).transparent(2),p=f.getColor(Ayt)||(f.getColor(Dyt)||UX).transparent(2);return{insertColor:g,removeColor:p}}),u=Ci(document.createElement("div"));u.setClassName("diffViewport"),u.setPosition("absolute");const d=An("div.diffOverview",{style:{position:"absolute",top:"0px",width:Df.ENTIRE_DIFF_OVERVIEW_WIDTH+"px"}}).root;this._register(PS(d,u.domNode)),this._register(Jr(d,je.POINTER_DOWN,h=>{this._editors.modified.delegateVerticalScrollbarPointerDown(h)})),this._register(Ce(d,je.MOUSE_WHEEL,h=>{this._editors.modified.delegateScrollFromMouseWheelEvent(h)},{passive:!1})),this._register(PS(this._rootElement,d)),this._register(wc((h,f)=>{const g=this._diffModel.read(h),p=this._editors.original.createOverviewRuler("original diffOverviewRuler");p&&(f.add(p),f.add(PS(d,p.getDomNode())));const m=this._editors.modified.createOverviewRuler("modified diffOverviewRuler");if(m&&(f.add(m),f.add(PS(d,m.getDomNode()))),!p||!m)return;const _=xa("viewZoneChanged",this._editors.original.onDidChangeViewZones),v=xa("viewZoneChanged",this._editors.modified.onDidChangeViewZones),y=xa("hiddenRangesChanged",this._editors.original.onDidChangeHiddenAreas),C=xa("hiddenRangesChanged",this._editors.modified.onDidChangeHiddenAreas);f.add(tn(x=>{_.read(x),v.read(x),y.read(x),C.read(x);const k=c.read(x),L=g?.diff.read(x)?.mappings;function D(M,B,G){const W=G._getViewModel();return W?M.filter(z=>z.length>0).map(z=>{const q=W.coordinatesConverter.convertModelPositionToViewPosition(new he(z.startLineNumber,1)),ee=W.coordinatesConverter.convertModelPositionToViewPosition(new he(z.endLineNumberExclusive,1)),Z=ee.lineNumber-q.lineNumber;return new v8e(q.lineNumber,ee.lineNumber,Z,B.toString())}):[]}const I=D((L||[]).map(M=>M.lineRangeMapping.original),k.removeColor,this._editors.original),O=D((L||[]).map(M=>M.lineRangeMapping.modified),k.insertColor,this._editors.modified);p?.setZones(I),m?.setZones(O)})),f.add(tn(x=>{const k=this._rootHeight.read(x),L=this._rootWidth.read(x),D=this._modifiedEditorLayoutInfo.read(x);if(D){const I=Df.ENTIRE_DIFF_OVERVIEW_WIDTH-2*Df.ONE_OVERVIEW_WIDTH;p.setLayout({top:0,height:k,right:I+Df.ONE_OVERVIEW_WIDTH,width:Df.ONE_OVERVIEW_WIDTH}),m.setLayout({top:0,height:k,right:0,width:Df.ONE_OVERVIEW_WIDTH});const O=this._editors.modifiedScrollTop.read(x),M=this._editors.modifiedScrollHeight.read(x),B=this._editors.modified.getOption(104),G=new hE(B.verticalHasArrows?B.arrowSize:0,B.verticalScrollbarSize,0,D.height,M,O);u.setTop(G.getSliderPosition()),u.setHeight(G.getSliderSize())}else u.setTop(0),u.setHeight(0);d.style.height=k+"px",d.style.left=L-Df.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",u.setWidth(Df.ENTIRE_DIFF_OVERVIEW_WIDTH)}))}))}};eR=Df=fPt([gPt(6,go)],eR);const Pq=[];class pPt extends me{constructor(e,t,i,r){super(),this._editors=e,this._diffModel=t,this._options=i,this._widget=r,this._selectedDiffs=St(this,s=>{const a=this._diffModel.read(s)?.diff.read(s);if(!a)return Pq;const l=this._editors.modifiedSelections.read(s);if(l.every(h=>h.isEmpty()))return Pq;const c=new Md(l.map(h=>gn.fromRangeInclusive(h))),d=a.mappings.filter(h=>h.lineRangeMapping.innerChanges&&c.intersects(h.lineRangeMapping.modified)).map(h=>({mapping:h,rangeMappings:h.lineRangeMapping.innerChanges.filter(f=>l.some(g=>$.areIntersecting(f.modifiedRange,g)))}));return d.length===0||d.every(h=>h.rangeMappings.length===0)?Pq:d}),this._register(wc((s,o)=>{if(!this._options.shouldRenderOldRevertArrows.read(s))return;const a=this._diffModel.read(s),l=a?.diff.read(s);if(!a||!l||a.movedTextToCompare.read(s))return;const c=[],u=this._selectedDiffs.read(s),d=new Set(u.map(h=>h.mapping));if(u.length>0){const h=this._editors.modifiedSelections.read(s),f=o.add(new x9(h[h.length-1].positionLineNumber,this._widget,u.flatMap(g=>g.rangeMappings),!0));this._editors.modified.addGlyphMarginWidget(f),c.push(f)}for(const h of l.mappings)if(!d.has(h)&&!h.lineRangeMapping.modified.isEmpty&&h.lineRangeMapping.innerChanges){const f=o.add(new x9(h.lineRangeMapping.modified.startLineNumber,this._widget,h.lineRangeMapping,!1));this._editors.modified.addGlyphMarginWidget(f),c.push(f)}o.add(Lt(()=>{for(const h of c)this._editors.modified.removeGlyphMarginWidget(h)}))}))}}class x9 extends me{static{this.counter=0}getId(){return this._id}constructor(e,t,i,r){super(),this._lineNumber=e,this._widget=t,this._diffs=i,this._revertSelection=r,this._id=`revertButton${x9.counter++}`,this._domNode=An("div.revertButton",{title:this._revertSelection?w("revertSelectedChanges","Revert Selected Changes"):w("revertChange","Revert Change")},[Pw(ze.arrowRight)]).root,this._register(Ce(this._domNode,je.MOUSE_DOWN,s=>{s.button!==2&&(s.stopPropagation(),s.preventDefault())})),this._register(Ce(this._domNode,je.MOUSE_UP,s=>{s.stopPropagation(),s.preventDefault()})),this._register(Ce(this._domNode,je.CLICK,s=>{this._diffs instanceof gl?this._widget.revert(this._diffs):this._widget.revertRangeMappings(this._diffs),s.stopPropagation(),s.preventDefault()}))}getDomNode(){return this._domNode}getPosition(){return{lane:af.Right,range:{startColumn:1,startLineNumber:this._lineNumber,endColumn:1,endLineNumber:this._lineNumber},zIndex:10001}}}function mPt(n,e,t){return NSt({debugName:()=>`Configuration Key "${n}"`},i=>t.onDidChangeConfiguration(r=>{r.affectsConfiguration(n)&&i(r)}),()=>t.getValue(n)??e)}function Rf(n,e,t){const i=n.bindTo(e);return aO({debugName:()=>`Set Context Key "${n.key}"`},r=>{i.set(t(r))})}var _Pt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},tCe=function(n,e){return function(t,i){e(t,i,n)}};let eee=class extends me{get onDidContentSizeChange(){return this._onDidContentSizeChange.event}constructor(e,t,i,r,s,o,a){super(),this.originalEditorElement=e,this.modifiedEditorElement=t,this._options=i,this._argCodeEditorWidgetOptions=r,this._createInnerEditor=s,this._instantiationService=o,this._keybindingService=a,this.original=this._register(this._createLeftHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.originalEditor||{})),this.modified=this._register(this._createRightHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.modifiedEditor||{})),this._onDidContentSizeChange=this._register(new fe),this.modifiedScrollTop=Bi(this,this.modified.onDidScrollChange,()=>this.modified.getScrollTop()),this.modifiedScrollHeight=Bi(this,this.modified.onDidScrollChange,()=>this.modified.getScrollHeight()),this.modifiedObs=Jc(this.modified),this.originalObs=Jc(this.original),this.modifiedModel=this.modifiedObs.model,this.modifiedSelections=Bi(this,this.modified.onDidChangeCursorSelection,()=>this.modified.getSelections()??[]),this.modifiedCursor=$u({owner:this,equalsFn:he.equals},l=>this.modifiedSelections.read(l)[0]?.getPosition()??new he(1,1)),this.originalCursor=Bi(this,this.original.onDidChangeCursorPosition,()=>this.original.getPosition()??new he(1,1)),this._argCodeEditorWidgetOptions=null,this._register(lO({createEmptyChangeSummary:()=>({}),handleChange:(l,c)=>(l.didChange(i.editorOptions)&&Object.assign(c,l.change.changedOptions),!0)},(l,c)=>{i.editorOptions.read(l),this._options.renderSideBySide.read(l),this.modified.updateOptions(this._adjustOptionsForRightHandSide(l,c)),this.original.updateOptions(this._adjustOptionsForLeftHandSide(l,c))}))}_createLeftHandSideEditor(e,t){const i=this._adjustOptionsForLeftHandSide(void 0,e),r=this._constructInnerEditor(this._instantiationService,this.originalEditorElement,i,t);return r.setContextValue("isInDiffLeftEditor",!0),r}_createRightHandSideEditor(e,t){const i=this._adjustOptionsForRightHandSide(void 0,e),r=this._constructInnerEditor(this._instantiationService,this.modifiedEditorElement,i,t);return r.setContextValue("isInDiffRightEditor",!0),r}_constructInnerEditor(e,t,i,r){const s=this._createInnerEditor(e,t,i,r);return this._register(s.onDidContentSizeChange(o=>{const a=this.original.getContentWidth()+this.modified.getContentWidth()+eR.ENTIRE_DIFF_OVERVIEW_WIDTH,l=Math.max(this.modified.getContentHeight(),this.original.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:l,contentWidth:a,contentHeightChanged:o.contentHeightChanged,contentWidthChanged:o.contentWidthChanged})})),s}_adjustOptionsForLeftHandSide(e,t){const i=this._adjustOptionsForSubEditor(t);return this._options.renderSideBySide.get()?(i.unicodeHighlight=this._options.editorOptions.get().unicodeHighlight||{},i.wordWrapOverride1=this._options.diffWordWrap.get()):(i.wordWrapOverride1="off",i.wordWrapOverride2="off",i.stickyScroll={enabled:!1},i.unicodeHighlight={nonBasicASCII:!1,ambiguousCharacters:!1,invisibleCharacters:!1}),i.glyphMargin=this._options.renderSideBySide.get(),t.originalAriaLabel&&(i.ariaLabel=t.originalAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.readOnly=!this._options.originalEditable.get(),i.dropIntoEditor={enabled:!i.readOnly},i.extraEditorClassName="original-in-monaco-diff-editor",i}_adjustOptionsForRightHandSide(e,t){const i=this._adjustOptionsForSubEditor(t);return t.modifiedAriaLabel&&(i.ariaLabel=t.modifiedAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.wordWrapOverride1=this._options.diffWordWrap.get(),i.revealHorizontalRightPadding=Mg.revealHorizontalRightPadding.defaultValue+eR.ENTIRE_DIFF_OVERVIEW_WIDTH,i.scrollbar.verticalHasArrows=!1,i.extraEditorClassName="modified-in-monaco-diff-editor",i}_adjustOptionsForSubEditor(e){const t={...e,dimension:{height:0,width:0}};return t.inDiffEditor=!0,t.automaticLayout=!1,t.scrollbar={...t.scrollbar||{}},t.folding=!1,t.codeLens=this._options.diffCodeLens.get(),t.fixedOverflowWidgets=!0,t.minimap={...t.minimap||{}},t.minimap.enabled=!1,this._options.hideUnchangedRegions.get()?t.stickyScroll={enabled:!1}:t.stickyScroll=this._options.editorOptions.get().stickyScroll,t}_updateAriaLabel(e){e||(e="");const t=w("diff-aria-navigation-tip"," use {0} to open the accessibility help.",this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel());return this._options.accessibilityVerbose.get()?e+t:e?e.replaceAll(t,""):""}};eee=_Pt([tCe(5,Tt),tCe(6,xi)],eee);class due extends me{constructor(){super(...arguments),this._id=++due.idCounter,this._onDidDispose=this._register(new fe),this.onDidDispose=this._onDidDispose.event}static{this.idCounter=0}getId(){return this.getEditorType()+":v2:"+this._id}getVisibleColumnFromPosition(e){return this._targetEditor.getVisibleColumnFromPosition(e)}getPosition(){return this._targetEditor.getPosition()}setPosition(e,t="api"){this._targetEditor.setPosition(e,t)}revealLine(e,t=0){this._targetEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._targetEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._targetEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._targetEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._targetEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._targetEditor.revealPositionNearTop(e,t)}getSelection(){return this._targetEditor.getSelection()}getSelections(){return this._targetEditor.getSelections()}setSelection(e,t="api"){this._targetEditor.setSelection(e,t)}setSelections(e,t="api"){this._targetEditor.setSelections(e,t)}revealLines(e,t,i=0){this._targetEditor.revealLines(e,t,i)}revealLinesInCenter(e,t,i=0){this._targetEditor.revealLinesInCenter(e,t,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._targetEditor.revealLinesInCenterIfOutsideViewport(e,t,i)}revealLinesNearTop(e,t,i=0){this._targetEditor.revealLinesNearTop(e,t,i)}revealRange(e,t=0,i=!1,r=!0){this._targetEditor.revealRange(e,t,i,r)}revealRangeInCenter(e,t=0){this._targetEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._targetEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._targetEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._targetEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._targetEditor.getSupportedActions()}focus(){this._targetEditor.focus()}trigger(e,t,i){this._targetEditor.trigger(e,t,i)}createDecorationsCollection(e){return this._targetEditor.createDecorationsCollection(e)}changeDecorations(e){return this._targetEditor.changeDecorations(e)}}var vPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},bPt=function(n,e){return function(t,i){e(t,i,n)}};let tee=class{get editorOptions(){return this._options}constructor(e,t){this._accessibilityService=t,this._diffEditorWidth=Sn(this,0),this._screenReaderMode=Bi(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this.couldShowInlineViewBecauseOfSize=St(this,r=>this._options.read(r).renderSideBySide&&this._diffEditorWidth.read(r)<=this._options.read(r).renderSideBySideInlineBreakpoint),this.renderOverviewRuler=St(this,r=>this._options.read(r).renderOverviewRuler),this.renderSideBySide=St(this,r=>this.compactMode.read(r)&&this.shouldRenderInlineViewInSmartMode.read(r)?!1:this._options.read(r).renderSideBySide&&!(this._options.read(r).useInlineViewWhenSpaceIsLimited&&this.couldShowInlineViewBecauseOfSize.read(r)&&!this._screenReaderMode.read(r))),this.readOnly=St(this,r=>this._options.read(r).readOnly),this.shouldRenderOldRevertArrows=St(this,r=>!(!this._options.read(r).renderMarginRevertIcon||!this.renderSideBySide.read(r)||this.readOnly.read(r)||this.shouldRenderGutterMenu.read(r))),this.shouldRenderGutterMenu=St(this,r=>this._options.read(r).renderGutterMenu),this.renderIndicators=St(this,r=>this._options.read(r).renderIndicators),this.enableSplitViewResizing=St(this,r=>this._options.read(r).enableSplitViewResizing),this.splitViewDefaultRatio=St(this,r=>this._options.read(r).splitViewDefaultRatio),this.ignoreTrimWhitespace=St(this,r=>this._options.read(r).ignoreTrimWhitespace),this.maxComputationTimeMs=St(this,r=>this._options.read(r).maxComputationTime),this.showMoves=St(this,r=>this._options.read(r).experimental.showMoves&&this.renderSideBySide.read(r)),this.isInEmbeddedEditor=St(this,r=>this._options.read(r).isInEmbeddedEditor),this.diffWordWrap=St(this,r=>this._options.read(r).diffWordWrap),this.originalEditable=St(this,r=>this._options.read(r).originalEditable),this.diffCodeLens=St(this,r=>this._options.read(r).diffCodeLens),this.accessibilityVerbose=St(this,r=>this._options.read(r).accessibilityVerbose),this.diffAlgorithm=St(this,r=>this._options.read(r).diffAlgorithm),this.showEmptyDecorations=St(this,r=>this._options.read(r).experimental.showEmptyDecorations),this.onlyShowAccessibleDiffViewer=St(this,r=>this._options.read(r).onlyShowAccessibleDiffViewer),this.compactMode=St(this,r=>this._options.read(r).compactMode),this.trueInlineDiffRenderingEnabled=St(this,r=>this._options.read(r).experimental.useTrueInlineView),this.useTrueInlineDiffRendering=St(this,r=>!this.renderSideBySide.read(r)&&this.trueInlineDiffRenderingEnabled.read(r)),this.hideUnchangedRegions=St(this,r=>this._options.read(r).hideUnchangedRegions.enabled),this.hideUnchangedRegionsRevealLineCount=St(this,r=>this._options.read(r).hideUnchangedRegions.revealLineCount),this.hideUnchangedRegionsContextLineCount=St(this,r=>this._options.read(r).hideUnchangedRegions.contextLineCount),this.hideUnchangedRegionsMinimumLineCount=St(this,r=>this._options.read(r).hideUnchangedRegions.minimumLineCount),this._model=Sn(this,void 0),this.shouldRenderInlineViewInSmartMode=this._model.map(this,r=>MSt(this,s=>{const o=r?.diff.read(s);return o?yPt(o,this.trueInlineDiffRenderingEnabled.read(s)):void 0})).flatten().map(this,r=>!!r),this.inlineViewHideOriginalLineNumbers=this.compactMode;const i={...e,...nCe(e,la)};this._options=Sn(this,i)}updateOptions(e){const t=nCe(e,this._options.get()),i={...this._options.get(),...e,...t};this._options.set(i,void 0,{changedOptions:e})}setWidth(e){this._diffEditorWidth.set(e,void 0)}setModel(e){this._model.set(e,void 0)}};tee=vPt([bPt(1,_u)],tee);function yPt(n,e){return n.mappings.every(t=>wPt(t.lineRangeMapping)||CPt(t.lineRangeMapping)||e&&cue(t.lineRangeMapping))}function wPt(n){return n.original.length===0}function CPt(n){return n.modified.length===0}function nCe(n,e){return{enableSplitViewResizing:Et(n.enableSplitViewResizing,e.enableSplitViewResizing),splitViewDefaultRatio:Cpt(n.splitViewDefaultRatio,.5,.1,.9),renderSideBySide:Et(n.renderSideBySide,e.renderSideBySide),renderMarginRevertIcon:Et(n.renderMarginRevertIcon,e.renderMarginRevertIcon),maxComputationTime:V1(n.maxComputationTime,e.maxComputationTime,0,1073741824),maxFileSize:V1(n.maxFileSize,e.maxFileSize,0,1073741824),ignoreTrimWhitespace:Et(n.ignoreTrimWhitespace,e.ignoreTrimWhitespace),renderIndicators:Et(n.renderIndicators,e.renderIndicators),originalEditable:Et(n.originalEditable,e.originalEditable),diffCodeLens:Et(n.diffCodeLens,e.diffCodeLens),renderOverviewRuler:Et(n.renderOverviewRuler,e.renderOverviewRuler),diffWordWrap:is(n.diffWordWrap,e.diffWordWrap,["off","on","inherit"]),diffAlgorithm:is(n.diffAlgorithm,e.diffAlgorithm,["legacy","advanced"],{smart:"legacy",experimental:"advanced"}),accessibilityVerbose:Et(n.accessibilityVerbose,e.accessibilityVerbose),experimental:{showMoves:Et(n.experimental?.showMoves,e.experimental.showMoves),showEmptyDecorations:Et(n.experimental?.showEmptyDecorations,e.experimental.showEmptyDecorations),useTrueInlineView:Et(n.experimental?.useTrueInlineView,e.experimental.useTrueInlineView)},hideUnchangedRegions:{enabled:Et(n.hideUnchangedRegions?.enabled??n.experimental?.collapseUnchangedRegions,e.hideUnchangedRegions.enabled),contextLineCount:V1(n.hideUnchangedRegions?.contextLineCount,e.hideUnchangedRegions.contextLineCount,0,1073741824),minimumLineCount:V1(n.hideUnchangedRegions?.minimumLineCount,e.hideUnchangedRegions.minimumLineCount,0,1073741824),revealLineCount:V1(n.hideUnchangedRegions?.revealLineCount,e.hideUnchangedRegions.revealLineCount,0,1073741824)},isInEmbeddedEditor:Et(n.isInEmbeddedEditor,e.isInEmbeddedEditor),onlyShowAccessibleDiffViewer:Et(n.onlyShowAccessibleDiffViewer,e.onlyShowAccessibleDiffViewer),renderSideBySideInlineBreakpoint:V1(n.renderSideBySideInlineBreakpoint,e.renderSideBySideInlineBreakpoint,0,1073741824),useInlineViewWhenSpaceIsLimited:Et(n.useInlineViewWhenSpaceIsLimited,e.useInlineViewWhenSpaceIsLimited),renderGutterMenu:Et(n.renderGutterMenu,e.renderGutterMenu),compactMode:Et(n.compactMode,e.compactMode)}}var xPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},VT=function(n,e){return function(t,i){e(t,i,n)}};let e0=class extends due{get onDidContentSizeChange(){return this._editors.onDidContentSizeChange}constructor(e,t,i,r,s,o,a,l){super(),this._domElement=e,this._parentContextKeyService=r,this._parentInstantiationService=s,this._accessibilitySignalService=a,this._editorProgressService=l,this.elements=An("div.monaco-diff-editor.side-by-side",{style:{position:"relative",height:"100%"}},[An("div.editor.original@original",{style:{position:"absolute",height:"100%"}}),An("div.editor.modified@modified",{style:{position:"absolute",height:"100%"}}),An("div.accessibleDiffViewer@accessibleDiffViewer",{style:{position:"absolute",height:"100%"}})]),this._diffModelSrc=this._register(TN(this,void 0)),this._diffModel=St(this,C=>this._diffModelSrc.read(C)?.object),this.onDidChangeModel=Ge.fromObservableLight(this._diffModel),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._domElement)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new c2([jt,this._contextKeyService]))),this._boundarySashes=Sn(this,void 0),this._accessibleDiffViewerShouldBeVisible=Sn(this,!1),this._accessibleDiffViewerVisible=St(this,C=>this._options.onlyShowAccessibleDiffViewer.read(C)?!0:this._accessibleDiffViewerShouldBeVisible.read(C)),this._movedBlocksLinesPart=Sn(this,void 0),this._layoutInfo=St(this,C=>{const x=this._rootSizeObserver.width.read(C),k=this._rootSizeObserver.height.read(C);this._rootSizeObserver.automaticLayout?this.elements.root.style.height="100%":this.elements.root.style.height=k+"px";const L=this._sash.read(C),D=this._gutter.read(C),I=D?.width.read(C)??0,O=this._overviewRulerPart.read(C)?.width??0;let M,B,G,W,z;if(!!L){const ee=L.sashLeft.read(C),Z=this._movedBlocksLinesPart.read(C)?.width.read(C)??0;M=0,B=ee-I-Z,z=ee-I,G=ee,W=x-G-O}else{z=0;const ee=this._options.inlineViewHideOriginalLineNumbers.read(C);M=I,ee?B=0:B=Math.max(5,this._editors.originalObs.layoutInfoDecorationsLeft.read(C)),G=I+B,W=x-G-O}return this.elements.original.style.left=M+"px",this.elements.original.style.width=B+"px",this._editors.original.layout({width:B,height:k},!0),D?.layout(z),this.elements.modified.style.left=G+"px",this.elements.modified.style.width=W+"px",this._editors.modified.layout({width:W,height:k},!0),{modifiedEditor:this._editors.modified.getLayoutInfo(),originalEditor:this._editors.original.getLayoutInfo()}}),this._diffValue=this._diffModel.map((C,x)=>C?.diff.read(x)),this.onDidUpdateDiff=Ge.fromObservableLight(this._diffValue),o.willCreateDiffEditor(),this._contextKeyService.createKey("isInDiffEditor",!0),this._domElement.appendChild(this.elements.root),this._register(Lt(()=>this.elements.root.remove())),this._rootSizeObserver=this._register(new S8e(this.elements.root,t.dimension)),this._rootSizeObserver.setAutomaticLayout(t.automaticLayout??!1),this._options=this._instantiationService.createInstance(tee,t),this._register(tn(C=>{this._options.setWidth(this._rootSizeObserver.width.read(C))})),this._contextKeyService.createKey(Q.isEmbeddedDiffEditor.key,!1),this._register(Rf(Q.isEmbeddedDiffEditor,this._contextKeyService,C=>this._options.isInEmbeddedEditor.read(C))),this._register(Rf(Q.comparingMovedCode,this._contextKeyService,C=>!!this._diffModel.read(C)?.movedTextToCompare.read(C))),this._register(Rf(Q.diffEditorRenderSideBySideInlineBreakpointReached,this._contextKeyService,C=>this._options.couldShowInlineViewBecauseOfSize.read(C))),this._register(Rf(Q.diffEditorInlineMode,this._contextKeyService,C=>!this._options.renderSideBySide.read(C))),this._register(Rf(Q.hasChanges,this._contextKeyService,C=>(this._diffModel.read(C)?.diff.read(C)?.mappings.length??0)>0)),this._editors=this._register(this._instantiationService.createInstance(eee,this.elements.original,this.elements.modified,this._options,i,(C,x,k,L)=>this._createInnerEditor(C,x,k,L))),this._register(Rf(Q.diffEditorOriginalWritable,this._contextKeyService,C=>this._options.originalEditable.read(C))),this._register(Rf(Q.diffEditorModifiedWritable,this._contextKeyService,C=>!this._options.readOnly.read(C))),this._register(Rf(Q.diffEditorOriginalUri,this._contextKeyService,C=>this._diffModel.read(C)?.model.original.uri.toString()??"")),this._register(Rf(Q.diffEditorModifiedUri,this._contextKeyService,C=>this._diffModel.read(C)?.model.modified.uri.toString()??"")),this._overviewRulerPart=hl(this,C=>this._options.renderOverviewRuler.read(C)?this._instantiationService.createInstance(Yc(eR,C),this._editors,this.elements.root,this._diffModel,this._rootSizeObserver.width,this._rootSizeObserver.height,this._layoutInfo.map(x=>x.modifiedEditor)):void 0).recomputeInitiallyAndOnChange(this._store);const c={height:this._rootSizeObserver.height,width:this._rootSizeObserver.width.map((C,x)=>C-(this._overviewRulerPart.read(x)?.width??0))};this._sashLayout=new oPt(this._options,c),this._sash=hl(this,C=>{const x=this._options.renderSideBySide.read(C);return this.elements.root.classList.toggle("side-by-side",x),x?new D8e(this.elements.root,c,this._options.enableSplitViewResizing,this._boundarySashes,this._sashLayout.sashLeft,()=>this._sashLayout.resetSash()):void 0}).recomputeInitiallyAndOnChange(this._store);const u=hl(this,C=>this._instantiationService.createInstance(Yc(C9,C),this._editors,this._diffModel,this._options)).recomputeInitiallyAndOnChange(this._store);hl(this,C=>this._instantiationService.createInstance(Yc(sPt,C),this._editors,this._diffModel,this._options,this)).recomputeInitiallyAndOnChange(this._store);const d=new Set,h=new Set;let f=!1;const g=hl(this,C=>this._instantiationService.createInstance(Yc(ZJ,C),Ot(this._domElement),this._editors,this._diffModel,this._options,this,()=>f||u.get().isUpdatingHiddenAreas,d,h)).recomputeInitiallyAndOnChange(this._store),p=St(this,C=>{const x=g.read(C).viewZones.read(C).orig,k=u.read(C).viewZones.read(C).origViewZones;return x.concat(k)}),m=St(this,C=>{const x=g.read(C).viewZones.read(C).mod,k=u.read(C).viewZones.read(C).modViewZones;return x.concat(k)});this._register(_9(this._editors.original,p,C=>{f=C},d));let _;this._register(_9(this._editors.modified,m,C=>{f=C,f?_=Ag.capture(this._editors.modified):(_?.restore(this._editors.modified),_=void 0)},h)),this._accessibleDiffViewer=hl(this,C=>this._instantiationService.createInstance(Yc(Py,C),this.elements.accessibleDiffViewer,this._accessibleDiffViewerVisible,(x,k)=>this._accessibleDiffViewerShouldBeVisible.set(x,k),this._options.onlyShowAccessibleDiffViewer.map(x=>!x),this._rootSizeObserver.width,this._rootSizeObserver.height,this._diffModel.map((x,k)=>x?.diff.read(k)?.mappings.map(L=>L.lineRangeMapping)),new KRt(this._editors))).recomputeInitiallyAndOnChange(this._store);const v=this._accessibleDiffViewerVisible.map(C=>C?"hidden":"visible");this._register(J_(this.elements.modified,{visibility:v})),this._register(J_(this.elements.original,{visibility:v})),this._createDiffEditorContributions(),o.addDiffEditor(this),this._gutter=hl(this,C=>this._options.shouldRenderGutterMenu.read(C)?this._instantiationService.createInstance(Yc(XJ,C),this.elements.root,this._diffModel,this._editors,this._options,this._sashLayout,this._boundarySashes):void 0),this._register(s2(this._layoutInfo)),hl(this,C=>new(Yc(rw,C))(this.elements.root,this._diffModel,this._layoutInfo.map(x=>x.originalEditor),this._layoutInfo.map(x=>x.modifiedEditor),this._editors)).recomputeInitiallyAndOnChange(this._store,C=>{this._movedBlocksLinesPart.set(C,void 0)}),this._register(Ge.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition,C=>this._handleCursorPositionChange(C,!0))),this._register(Ge.runAndSubscribe(this._editors.original.onDidChangeCursorPosition,C=>this._handleCursorPositionChange(C,!1)));const y=this._diffModel.map(this,(C,x)=>{if(C)return C.diff.read(x)===void 0&&!C.isDiffUpToDate.read(x)});this._register(wc((C,x)=>{if(y.read(C)===!0){const k=this._editorProgressService.show(!0,1e3);x.add(Lt(()=>k.done()))}})),this._register(wc((C,x)=>{x.add(new(Yc(pPt,C))(this._editors,this._diffModel,this._options,this))})),this._register(wc((C,x)=>{const k=this._diffModel.read(C);if(k)for(const L of[k.model.original,k.model.modified])x.add(L.onWillDispose(D=>{rn(new fi("TextModel got disposed before DiffEditorWidget model got reset")),this.setModel(null)}))})),this._register(tn(C=>{this._options.setModel(this._diffModel.read(C))}))}_createInnerEditor(e,t,i,r){return e.createInstance(ZN,t,i,r)}_createDiffEditorContributions(){const e=Zy.getDiffEditorContributions();for(const t of e)try{this._register(this._instantiationService.createInstance(t.ctor,this))}catch(i){rn(i)}}get _targetEditor(){return this._editors.modified}getEditorType(){return pO.IDiffEditor}layout(e){this._rootSizeObserver.observe(e)}hasTextFocus(){return this._editors.original.hasTextFocus()||this._editors.modified.hasTextFocus()}saveViewState(){const e=this._editors.original.saveViewState(),t=this._editors.modified.saveViewState();return{original:e,modified:t,modelState:this._diffModel.get()?.serializeState()}}restoreViewState(e){if(e&&e.original&&e.modified){const t=e;this._editors.original.restoreViewState(t.original),this._editors.modified.restoreViewState(t.modified),t.modelState&&this._diffModel.get()?.restoreSerializedState(t.modelState)}}handleInitialized(){this._editors.original.handleInitialized(),this._editors.modified.handleInitialized()}createViewModel(e){return this._instantiationService.createInstance(YJ,e,this._options)}getModel(){return this._diffModel.get()?.model??null}setModel(e){const t=e?"model"in e?v9.create(e).createNewRef(this):v9.create(this.createViewModel(e),this):null;this.setDiffModel(t)}setDiffModel(e,t){const i=this._diffModel.get();!e&&i&&this._accessibleDiffViewer.get().close(),this._diffModel.get()!==e?.object&&Fw(t,r=>{const s=e?.object;Bi.batchEventsGlobally(r,()=>{this._editors.original.setModel(s?s.model.original:null),this._editors.modified.setModel(s?s.model.modified:null)});const o=this._diffModelSrc.get()?.createNewRef(this);this._diffModelSrc.set(e?.createNewRef(this),r),setTimeout(()=>{o?.dispose()},0)})}updateOptions(e){this._options.updateOptions(e)}getContainerDomNode(){return this._domElement}getOriginalEditor(){return this._editors.original}getModifiedEditor(){return this._editors.modified}getLineChanges(){const e=this._diffModel.get()?.diff.get();return e?SPt(e):null}revert(e){const t=this._diffModel.get();!t||!t.isDiffUpToDate.get()||this._editors.modified.executeEdits("diffEditor",[{range:e.modified.toExclusiveRange(),text:t.model.original.getValueInRange(e.original.toExclusiveRange())}])}revertRangeMappings(e){const t=this._diffModel.get();if(!t||!t.isDiffUpToDate.get())return;const i=e.map(r=>({range:r.modifiedRange,text:t.model.original.getValueInRange(r.originalRange)}));this._editors.modified.executeEdits("diffEditor",i)}_goTo(e){this._editors.modified.setPosition(new he(e.lineRangeMapping.modified.startLineNumber,1)),this._editors.modified.revealRangeInCenter(e.lineRangeMapping.modified.toExclusiveRange())}goToDiff(e){const t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;const i=this._editors.modified.getPosition().lineNumber;let r;e==="next"?r=t.find(s=>s.lineRangeMapping.modified.startLineNumber>i)??t[0]:r=hN(t,s=>s.lineRangeMapping.modified.startLineNumber{const t=e.diff.get()?.mappings;!t||t.length===0||this._goTo(t[0])})}accessibleDiffViewerNext(){this._accessibleDiffViewer.get().next()}accessibleDiffViewerPrev(){this._accessibleDiffViewer.get().prev()}async waitForDiff(){const e=this._diffModel.get();e&&await e.waitForDiff()}mapToOtherSide(){const e=this._editors.modified.hasWidgetFocus(),t=e?this._editors.modified:this._editors.original,i=e?this._editors.original:this._editors.modified;let r;const s=t.getSelection();if(s){const o=this._diffModel.get()?.diff.get()?.mappings.map(a=>e?a.lineRangeMapping.flip():a.lineRangeMapping);if(o){const a=Wwe(s.getStartPosition(),o),l=Wwe(s.getEndPosition(),o);r=$.plusRange(a,l)}}return{destination:i,destinationSelection:r}}switchSide(){const{destination:e,destinationSelection:t}=this.mapToOtherSide();e.focus(),t&&e.setSelection(t)}exitCompareMove(){const e=this._diffModel.get();e&&e.movedTextToCompare.set(void 0,void 0)}collapseAllUnchangedRegions(){const e=this._diffModel.get()?.unchangedRegions.get();e&&qr(t=>{for(const i of e)i.collapseAll(t)})}showAllUnchangedRegions(){const e=this._diffModel.get()?.unchangedRegions.get();e&&qr(t=>{for(const i of e)i.showAll(t)})}_handleCursorPositionChange(e,t){if(e?.reason===3){const i=this._diffModel.get()?.diff.get()?.mappings.find(r=>t?r.lineRangeMapping.modified.contains(e.position.lineNumber):r.lineRangeMapping.original.contains(e.position.lineNumber));i?.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal(Ai.diffLineDeleted,{source:"diffEditor.cursorPositionChanged"}):i?.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal(Ai.diffLineInserted,{source:"diffEditor.cursorPositionChanged"}):i&&this._accessibilitySignalService.playSignal(Ai.diffLineModified,{source:"diffEditor.cursorPositionChanged"})}}};e0=xPt([VT(3,jt),VT(4,Tt),VT(5,ai),VT(6,t1),VT(7,Qb)],e0);function SPt(n){return n.mappings.map(e=>{const t=e.lineRangeMapping;let i,r,s,o,a=t.innerChanges;return t.original.isEmpty?(i=t.original.startLineNumber-1,r=0,a=void 0):(i=t.original.startLineNumber,r=t.original.endLineNumberExclusive-1),t.modified.isEmpty?(s=t.modified.startLineNumber-1,o=0,a=void 0):(s=t.modified.startLineNumber,o=t.modified.endLineNumberExclusive-1),{originalStartLineNumber:i,originalEndLineNumber:r,modifiedStartLineNumber:s,modifiedEndLineNumber:o,charChanges:a?.map(l=>({originalStartLineNumber:l.originalRange.startLineNumber,originalStartColumn:l.originalRange.startColumn,originalEndLineNumber:l.originalRange.endLineNumber,originalEndColumn:l.originalRange.endColumn,modifiedStartLineNumber:l.modifiedRange.startLineNumber,modifiedStartColumn:l.modifiedRange.startColumn,modifiedEndLineNumber:l.modifiedRange.endLineNumber,modifiedEndColumn:l.modifiedRange.endColumn}))}})}var hue=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},br=function(n,e){return function(t,i){e(t,i,n)}};let kPt=0,iCe=!1;function EPt(n){if(!n){if(iCe)return;iCe=!0}Lxt(n||Xi.document.body)}let S9=class extends ZN{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f){const g={...t};g.ariaLabel=g.ariaLabel||mQ.editorViewAccessibleLabel,super(e,g,{},i,r,s,o,c,u,d,h,f),l instanceof CE?this._standaloneKeybindingService=l:this._standaloneKeybindingService=null,EPt(g.ariaContainerElement),HSt((p,m)=>i.createInstance(uE,p,m,{})),VSt(a)}addCommand(e,t,i){if(!this._standaloneKeybindingService)return console.warn("Cannot add command because the editor is configured with an unrecognized KeybindingService"),null;const r="DYNAMIC_"+ ++kPt,s=Le.deserialize(i);return this._standaloneKeybindingService.addDynamicKeybinding(r,e,t,s),r}createContextKey(e,t){return this._contextKeyService.createKey(e,t)}addAction(e){if(typeof e.id!="string"||typeof e.label!="string"||typeof e.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");if(!this._standaloneKeybindingService)return console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),me.None;const t=e.id,i=e.label,r=Le.and(Le.equals("editorId",this.getId()),Le.deserialize(e.precondition)),s=e.keybindings,o=Le.and(r,Le.deserialize(e.keybindingContext)),a=e.contextMenuGroupId||null,l=e.contextMenuOrder||0,c=(f,...g)=>Promise.resolve(e.run(this,...g)),u=new ke,d=this.getId()+":"+t;if(u.add(Un.registerCommand(d,c)),a){const f={command:{id:d,title:i},when:r,group:a,order:l};u.add(Fo.appendMenuItem(ce.EditorContext,f))}if(Array.isArray(s))for(const f of s)u.add(this._standaloneKeybindingService.addDynamicKeybinding(d,f,c,o));const h=new b8e(d,i,i,void 0,r,(...f)=>Promise.resolve(e.run(this,...f)),this._contextKeyService);return this._actions.set(t,h),u.add(Lt(()=>{this._actions.delete(t)})),u}_triggerCommand(e,t){if(this._codeEditorService instanceof a8)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};S9=hue([br(2,Tt),br(3,ai),br(4,_r),br(5,jt),br(6,um),br(7,xi),br(8,go),br(9,Ts),br(10,_u),br(11,Zr),br(12,dt)],S9);let nee=class extends S9{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f,g,p,m){const _={...t};a9(d,_,!1);const v=c.registerEditorContainer(e);typeof _.theme=="string"&&c.setTheme(_.theme),typeof _.autoDetectHighContrast<"u"&&c.setAutoDetectHighContrast(!!_.autoDetectHighContrast);const y=_.model;delete _.model,super(e,_,i,r,s,o,a,l,c,u,h,p,m),this._configurationService=d,this._standaloneThemeService=c,this._register(v);let C;if(typeof y>"u"){const x=g.getLanguageIdByMimeType(_.language)||_.language||Hl;C=R8e(f,g,_.value||"",x,void 0),this._ownsModel=!0}else C=y,this._ownsModel=!1;if(this._attachModel(C),C){const x={oldModelUrl:null,newModelUrl:C.uri};this._onDidChangeModel.fire(x)}}dispose(){super.dispose()}updateOptions(e){a9(this._configurationService,e,!1),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_postDetachModelCleanup(e){super._postDetachModelCleanup(e),e&&this._ownsModel&&(e.dispose(),this._ownsModel=!1)}};nee=hue([br(2,Tt),br(3,ai),br(4,_r),br(5,jt),br(6,um),br(7,xi),br(8,hd),br(9,Ts),br(10,kn),br(11,_u),br(12,Sr),br(13,Hr),br(14,Zr),br(15,dt)],nee);let iee=class extends e0{constructor(e,t,i,r,s,o,a,l,c,u,d,h){const f={...t};a9(l,f,!0);const g=o.registerEditorContainer(e);typeof f.theme=="string"&&o.setTheme(f.theme),typeof f.autoDetectHighContrast<"u"&&o.setAutoDetectHighContrast(!!f.autoDetectHighContrast),super(e,f,{},r,i,s,h,u),this._configurationService=l,this._standaloneThemeService=o,this._register(g)}dispose(){super.dispose()}updateOptions(e){a9(this._configurationService,e,!0),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_createInnerEditor(e,t,i){return e.createInstance(S9,t,i)}getOriginalEditor(){return super.getOriginalEditor()}getModifiedEditor(){return super.getModifiedEditor()}addCommand(e,t,i){return this.getModifiedEditor().addCommand(e,t,i)}createContextKey(e,t){return this.getModifiedEditor().createContextKey(e,t)}addAction(e){return this.getModifiedEditor().addAction(e)}};iee=hue([br(2,Tt),br(3,jt),br(4,ai),br(5,hd),br(6,Ts),br(7,kn),br(8,mu),br(9,Qb),br(10,b0),br(11,t1)],iee);function R8e(n,e,t,i,r){if(t=t||"",!i){const s=t.indexOf(` -`);let o=t;return s!==-1&&(o=t.substring(0,s)),rCe(n,t,e.createByFilepathOrFirstLine(r||null,o),r)}return rCe(n,t,e.createById(i),r)}function rCe(n,e,t,i){return n.createModel(e,t,i)}var LPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},sCe=function(n,e){return function(t,i){e(t,i,n)}};class TPt{constructor(e,t){this.viewModel=e,this.deltaScrollVertical=t}getId(){return this.viewModel}}let k9=class extends me{constructor(e,t,i,r,s){super(),this._container=e,this._overflowWidgetsDomNode=t,this._workbenchUIElementFactory=i,this._instantiationService=r,this._viewModel=Sn(this,void 0),this._collapsed=St(this,l=>this._viewModel.read(l)?.collapsed.read(l)),this._editorContentHeight=Sn(this,500),this.contentHeight=St(this,l=>(this._collapsed.read(l)?0:this._editorContentHeight.read(l))+this._outerEditorHeight),this._modifiedContentWidth=Sn(this,0),this._modifiedWidth=Sn(this,0),this._originalContentWidth=Sn(this,0),this._originalWidth=Sn(this,0),this.maxScroll=St(this,l=>{const c=this._modifiedContentWidth.read(l)-this._modifiedWidth.read(l),u=this._originalContentWidth.read(l)-this._originalWidth.read(l);return c>u?{maxScroll:c,width:this._modifiedWidth.read(l)}:{maxScroll:u,width:this._originalWidth.read(l)}}),this._elements=An("div.multiDiffEntry",[An("div.header@header",[An("div.header-content",[An("div.collapse-button@collapseButton"),An("div.file-path",[An("div.title.modified.show-file-icons@primaryPath",[]),An("div.status.deleted@status",["R"]),An("div.title.original.show-file-icons@secondaryPath",[])]),An("div.actions@actions")])]),An("div.editorParent",[An("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(e0,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode},{})),this.isModifedFocused=Jc(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=Jc(this.editor.getOriginalEditor()).isFocused,this.isFocused=St(this,l=>this.isModifedFocused.read(l)||this.isOriginalFocused.read(l)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new ke),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;const o=new V8(this._elements.collapseButton,{});this._register(tn(l=>{o.element.className="",o.icon=this._collapsed.read(l)?ze.chevronRight:ze.chevronDown})),this._register(o.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._register(tn(l=>{this._elements.editor.style.display=this._collapsed.read(l)?"none":"block"})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(l=>{const c=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(c,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(l=>{const c=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(c,void 0)})),this._register(this.editor.onDidContentSizeChange(l=>{ID(c=>{this._editorContentHeight.set(l.contentHeight,c),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),c),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),c)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(l=>{if(this._isSettingScrollTop||!l.scrollTopChanged||!this._data)return;const c=l.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(c)})),this._register(tn(l=>{const c=this._viewModel.read(l)?.isActive.read(l);this._elements.root.classList.toggle("active",c)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(s.createScoped(this._elements.actions));const a=this._register(this._instantiationService.createChild(new c2([jt,this._contextKeyService])));this._register(a.createInstance(w9,this._elements.actions,ce.MultiDiffEditorFileToolbar,{actionRunner:this._register(new I8e(()=>this._viewModel.get()?.modifiedUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:l=>l.startsWith("navigation")},actionViewItemProvider:(l,c)=>x5e(a,l,c)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){this._data=e;function t(r){return{...r,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(!e){ID(r=>{this._viewModel.set(void 0,r),this.editor.setDiffModel(null,r),this._dataStore.clear()});return}const i=e.viewModel.documentDiffItem;if(ID(r=>{this._resourceLabel?.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:e.viewModel.modifiedUri===void 0});let s=!1,o=!1,a=!1,l="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(l="R",s=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(l="A",a=!0):(l="D",o=!0),this._elements.status.classList.toggle("renamed",s),this._elements.status.classList.toggle("deleted",o),this._elements.status.classList.toggle("added",a),this._elements.status.innerText=l,this._resourceLabel2?.setUri(s?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,r),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,r),this.editor.updateOptions(t(i.options??{}))}),i.onOptionsDidChange&&this._dataStore.add(i.onOptionsDidChange(()=>{this.editor.updateOptions(t(i.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,r=>{r||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(const[r,s]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(r,s)}render(e,t,i,r){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";const s=e.length-this._headerHeight,o=Math.max(0,Math.min(r.start-e.start,s));this._elements.header.style.transform=`translateY(${o}px)`,ID(a=>{this.editor.layout({width:t-2*8-2*1,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=i,this.editor.getOriginalEditor().setScrollTop(i)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",o>0||i>0),this._elements.header.classList.toggle("collapsed",o===s)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};k9=LPt([sCe(3,Tt),sCe(4,jt)],k9);class DPt{constructor(e){this._create=e,this._unused=new Set,this._used=new Set,this._itemData=new Map}getUnusedObj(e){let t;if(this._unused.size===0)t=this._create(e),this._itemData.set(t,e);else{const i=[...this._unused.values()];t=i.find(r=>this._itemData.get(r).getId()===e.getId())??i[0],this._unused.delete(t),this._itemData.set(t,e),t.setData(e)}return this._used.add(t),{object:t,dispose:()=>{this._used.delete(t),this._unused.size>5?t.dispose():this._unused.add(t)}}}dispose(){for(const e of this._used)e.dispose();for(const e of this._unused)e.dispose();this._used.clear(),this._unused.clear()}}var IPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},oCe=function(n,e){return function(t,i){e(t,i,n)}};let ree=class extends me{constructor(e,t,i,r,s,o){super(),this._element=e,this._dimension=t,this._viewModel=i,this._workbenchUIElementFactory=r,this._parentContextKeyService=s,this._parentInstantiationService=o,this._scrollableElements=An("div.scrollContent",[An("div@content",{style:{overflow:"hidden"}}),An("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new t2({forceIntegerValues:!1,scheduleAtNextAnimationFrame:l=>du(Ot(this._element),l),smoothScrollDuration:100})),this._scrollableElement=this._register(new fW(this._scrollableElements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this._elements=An("div.monaco-component.multiDiffEditor",{},[An("div",{},[this._scrollableElement.getDomNode()]),An("div.placeholder@placeholder",{},[An("div",[w("noChangedFiles","No Changed Files")])])]),this._sizeObserver=this._register(new S8e(this._element,void 0)),this._objectPool=this._register(new DPt(l=>{const c=this._instantiationService.createInstance(k9,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return c.setData(l),c})),this.scrollTop=Bi(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=Bi(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=Jb(this,(l,c)=>{const u=this._viewModel.read(l);if(!u)return{items:[],getItem:g=>{throw new fi}};const d=u.items.read(l),h=new Map;return{items:d.map(g=>{const p=c.add(new APt(g,this._objectPool,this.scrollLeft,_=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+_})})),m=this._lastDocStates?.[p.getKey()];return m&&qr(_=>{p.setViewState(m,_)}),h.set(g,p),p}),getItem:g=>h.get(g)}}),this._viewItems=this._viewItemsInfo.map(this,l=>l.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(l,c)=>l.reduce((u,d)=>u+d.contentHeight.read(c)+this._spaceBetweenPx,0)),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new c2([jt,this._contextKeyService]))),this._lastDocStates={},this._contextKeyService.createKey(Q.inMultiDiffEditor.key,!0),this._register(wc((l,c)=>{const u=this._viewModel.read(l);if(u&&u.contextKeys)for(const[d,h]of Object.entries(u.contextKeys)){const f=this._contextKeyService.createKey(d,void 0);f.set(h),c.add(Lt(()=>f.reset()))}}));const a=this._parentContextKeyService.createKey(Q.multiDiffEditorAllCollapsed.key,!1);this._register(tn(l=>{const c=this._viewModel.read(l);if(c){const u=c.items.read(l).every(d=>d.collapsed.read(l));a.set(u)}})),this._register(tn(l=>{const c=this._dimension.read(l);this._sizeObserver.observe(c)})),this._register(tn(l=>{const c=this._viewItems.read(l);this._elements.placeholder.classList.toggle("visible",c.length===0)})),this._scrollableElements.content.style.position="relative",this._register(tn(l=>{const c=this._sizeObserver.height.read(l);this._scrollableElements.root.style.height=`${c}px`;const u=this._totalHeight.read(l);this._scrollableElements.content.style.height=`${u}px`;const d=this._sizeObserver.width.read(l);let h=d;const f=this._viewItems.read(l),g=tle(f,$l(p=>p.maxScroll.read(l).maxScroll,Xh));if(g){const p=g.maxScroll.read(l);h=d+p.maxScroll}this._scrollableElement.setScrollDimensions({width:d,height:c,scrollHeight:u,scrollWidth:h})})),e.replaceChildren(this._elements.root),this._register(Lt(()=>{e.replaceChildren()})),this._register(this._register(tn(l=>{ID(c=>{this.render(l)})})))}render(e){const t=this.scrollTop.read(e);let i=0,r=0,s=0;const o=this._sizeObserver.height.read(e),a=Dn.ofStartAndLength(t,o),l=this._sizeObserver.width.read(e);for(const c of this._viewItems.read(e)){const u=c.contentHeight.read(e),d=Math.min(u,o),h=Dn.ofStartAndLength(r,d),f=Dn.ofStartAndLength(s,u);if(f.isBefore(a))i-=u-d,c.hide();else if(f.isAfter(a))c.hide();else{const g=Math.max(0,Math.min(a.start-f.start,u-d));i-=g;const p=Dn.ofStartAndLength(t+i,o);c.render(h,g,l,p)}r+=d+this._spaceBetweenPx,s+=u+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+i)}px)`}};ree=IPt([oCe(4,jt),oCe(5,Tt)],ree);class APt extends me{constructor(e,t,i,r){super(),this.viewModel=e,this._objectPool=t,this._scrollLeft=i,this._deltaScrollVertical=r,this._templateRef=this._register(TN(this,void 0)),this.contentHeight=St(this,s=>this._templateRef.read(s)?.object.contentHeight?.read(s)??this.viewModel.lastTemplateData.read(s).contentHeight),this.maxScroll=St(this,s=>this._templateRef.read(s)?.object.maxScroll.read(s)??{maxScroll:0,scrollWidth:0}),this.template=St(this,s=>this._templateRef.read(s)?.object),this._isHidden=Sn(this,!1),this._isFocused=St(this,s=>this.template.read(s)?.isFocused.read(s)??!1),this.viewModel.setIsFocused(this._isFocused,void 0),this._register(tn(s=>{const o=this._scrollLeft.read(s);this._templateRef.read(s)?.object.setScrollLeft(o)})),this._register(tn(s=>{const o=this._templateRef.read(s);!o||!this._isHidden.read(s)||o.object.isFocused.read(s)||this._clear()}))}dispose(){this._clear(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.documentDiffItem.modified?.uri.toString()})`}getKey(){return this.viewModel.getKey()}setViewState(e,t){this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);const i=this.viewModel.lastTemplateData.get(),r=e.selections?.map(yt.liftSelection);this.viewModel.lastTemplateData.set({...i,selections:r},t);const s=this._templateRef.get();s&&r&&s.object.editor.setSelections(r)}_updateTemplateData(e){const t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){const e=this._templateRef.get();e&&qr(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,i,r){this._isHidden.set(!1,void 0);let s=this._templateRef.get();if(!s){s=this._objectPool.getUnusedObj(new TPt(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(s,void 0);const o=this.viewModel.lastTemplateData.get().selections;o&&s.object.editor.setSelections(o)}s.object.render(e,i,t,r)}}J("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},w("multiDiffEditor.headerBackground","The background color of the diff editor's header"));J("multiDiffEditor.background",lf,w("multiDiffEditor.background","The background color of the multi file diff editor"));J("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},w("multiDiffEditor.border","The border color of the multi file diff editor"));var NPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},RPt=function(n,e){return function(t,i){e(t,i,n)}};let see=class extends me{constructor(e,t,i){super(),this._element=e,this._workbenchUIElementFactory=t,this._instantiationService=i,this._dimension=Sn(this,void 0),this._viewModel=Sn(this,void 0),this._widgetImpl=Jb(this,(r,s)=>(Yc(k9,r),s.add(this._instantiationService.createInstance(Yc(ree,r),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory)))),this._register(s2(this._widgetImpl))}};see=NPt([RPt(2,Tt)],see);function PPt(n,e,t){return Yt.initialize(t||{}).createInstance(nee,n,e)}function OPt(n){return Yt.get(ai).onCodeEditorAdd(t=>{n(t)})}function MPt(n){return Yt.get(ai).onDiffEditorAdd(t=>{n(t)})}function FPt(){return Yt.get(ai).listCodeEditors()}function BPt(){return Yt.get(ai).listDiffEditors()}function $Pt(n,e,t){return Yt.initialize(t||{}).createInstance(iee,n,e)}function WPt(n,e){const t=Yt.initialize(e||{});return new see(n,{},t)}function HPt(n){if(typeof n.id!="string"||typeof n.run!="function")throw new Error("Invalid command descriptor, `id` and `run` are required properties!");return Un.registerCommand(n.id,n.run)}function VPt(n){if(typeof n.id!="string"||typeof n.label!="string"||typeof n.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");const e=Le.deserialize(n.precondition),t=(r,...s)=>fo.runEditorCommand(r,s,e,(o,a,l)=>Promise.resolve(n.run(a,...l))),i=new ke;if(i.add(Un.registerCommand(n.id,t)),n.contextMenuGroupId){const r={command:{id:n.id,title:n.label},when:e,group:n.contextMenuGroupId,order:n.contextMenuOrder||0};i.add(Fo.appendMenuItem(ce.EditorContext,r))}if(Array.isArray(n.keybindings)){const r=Yt.get(xi);if(!(r instanceof CE))console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");else{const s=Le.and(e,Le.deserialize(n.keybindingContext));i.add(r.addDynamicKeybindings(n.keybindings.map(o=>({keybinding:o,command:n.id,when:s}))))}}return i}function zPt(n){return P8e([n])}function P8e(n){const e=Yt.get(xi);return e instanceof CE?e.addDynamicKeybindings(n.map(t=>({keybinding:t.keybinding,command:t.command,commandArgs:t.commandArgs,when:Le.deserialize(t.when)}))):(console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),me.None)}function UPt(n,e,t){const i=Yt.get(Hr),r=i.getLanguageIdByMimeType(e)||e;return R8e(Yt.get(Sr),i,n,r,t)}function jPt(n,e){const t=Yt.get(Hr),i=t.getLanguageIdByMimeType(e)||e||Hl;n.setLanguage(t.createById(i))}function qPt(n,e,t){n&&Yt.get(dm).changeOne(e,n.uri,t)}function KPt(n){Yt.get(dm).changeAll(n,[])}function GPt(n){return Yt.get(dm).read(n)}function YPt(n){return Yt.get(dm).onMarkerChanged(n)}function ZPt(n){return Yt.get(Sr).getModel(n)}function XPt(){return Yt.get(Sr).getModels()}function QPt(n){return Yt.get(Sr).onModelAdded(n)}function JPt(n){return Yt.get(Sr).onModelRemoved(n)}function eOt(n){return Yt.get(Sr).onModelLanguageChanged(t=>{n({model:t.model,oldLanguage:t.oldLanguageId})})}function tOt(n){return FDt(Yt.get(Sr),n)}function nOt(n,e){const t=Yt.get(Hr),i=Yt.get(hd);return Tce.colorizeElement(i,t,n,e).then(()=>{i.registerEditorContainer(n)})}function iOt(n,e,t){const i=Yt.get(Hr);return Yt.get(hd).registerEditorContainer(Xi.document.body),Tce.colorize(i,n,e,t)}function rOt(n,e,t=4){return Yt.get(hd).registerEditorContainer(Xi.document.body),Tce.colorizeModelLine(n,e,t)}function sOt(n){const e=rs.get(n);return e||{getInitialState:()=>gE,tokenize:(t,i,r)=>Nle(n,r)}}function oOt(n,e){rs.getOrCreate(e);const t=sOt(e),i=om(n),r=[];let s=t.getInitialState();for(let o=0,a=i.length;o{if(!i)return null;const s=t.options?.selection;let o;return s&&typeof s.endLineNumber=="number"&&typeof s.endColumn=="number"?o=s:s&&(o={lineNumber:s.startLineNumber,column:s.startColumn}),await n.openCodeEditor(i,t.resource,o)?i:null})}function fOt(){return{create:PPt,getEditors:FPt,getDiffEditors:BPt,onDidCreateEditor:OPt,onDidCreateDiffEditor:MPt,createDiffEditor:$Pt,addCommand:HPt,addEditorAction:VPt,addKeybindingRule:zPt,addKeybindingRules:P8e,createModel:UPt,setModelLanguage:jPt,setModelMarkers:qPt,getModelMarkers:GPt,removeAllMarkers:KPt,onDidChangeMarkers:YPt,getModels:XPt,getModel:ZPt,onDidCreateModel:QPt,onWillDisposeModel:JPt,onDidChangeModelLanguage:eOt,createWebWorker:tOt,colorizeElement:nOt,colorize:iOt,colorizeModelLine:rOt,tokenize:oOt,defineTheme:aOt,setTheme:lOt,remeasureFonts:cOt,registerCommand:uOt,registerLinkOpener:dOt,registerEditorOpener:hOt,AccessibilitySupport:vZ,ContentWidgetPositionPreference:SZ,CursorChangeReason:kZ,DefaultEndOfLine:EZ,EditorAutoIndentStrategy:TZ,EditorOption:DZ,EndOfLinePreference:IZ,EndOfLineSequence:AZ,MinimapPosition:VZ,MinimapSectionHeaderStyle:zZ,MouseTargetType:UZ,OverlayWidgetPositionPreference:KZ,OverviewRulerLane:GZ,GlyphMarginLane:NZ,RenderLineNumbersType:XZ,RenderMinimap:QZ,ScrollbarVisibility:eX,ScrollType:JZ,TextEditorCursorBlinkingStyle:oX,TextEditorCursorStyle:aX,TrackedRangeStickiness:lX,WrappingIndent:cX,InjectedTextCursorStops:OZ,PositionAffinity:ZZ,ShowLightbulbIconMode:nX,ConfigurationChangedEvent:y4e,BareFontInfo:Gy,FontInfo:bX,TextModelResolvedOptions:UF,FindMatch:dN,ApplyUpdateResult:fI,EditorZoom:Pd,createMultiFileDiffEditor:WPt,EditorType:pO,EditorOptions:Mg}}function gOt(n,e){if(!e||!Array.isArray(e))return!1;for(const t of e)if(!n(t))return!1;return!0}function o3(n,e){return typeof n=="boolean"?n:e}function aCe(n,e){return typeof n=="string"?n:e}function pOt(n){const e={};for(const t of n)e[t]=!0;return e}function lCe(n,e=!1){e&&(n=n.map(function(i){return i.toLowerCase()}));const t=pOt(n);return e?function(i){return t[i.toLowerCase()]!==void 0&&t.hasOwnProperty(i.toLowerCase())}:function(i){return t[i]!==void 0&&t.hasOwnProperty(i)}}function oee(n,e,t){e=e.replace(/@@/g,"");let i=0,r;do r=!1,e=e.replace(/@(\w+)/g,function(o,a){r=!0;let l="";if(typeof n[a]=="string")l=n[a];else if(n[a]&&n[a]instanceof RegExp)l=n[a].source;else throw n[a]===void 0?Tr(n,"language definition does not contain attribute '"+a+"', used at: "+e):Tr(n,"attribute reference '"+a+"' must be a string, used at: "+e);return my(l)?"":"(?:"+l+")"}),i++;while(r&&i<5);e=e.replace(/\x01/g,"@");const s=(n.ignoreCase?"i":"")+(n.unicode?"u":"");if(t&&e.match(/\$[sS](\d\d?)/g)){let a=null,l=null;return c=>(l&&a===c||(a=c,l=new RegExp(iIt(n,e,c),s)),l)}return new RegExp(e,s)}function mOt(n,e,t,i){if(i<0)return n;if(i=100){i=i-100;const r=t.split(".");if(r.unshift(t),i=0&&(i.tokenSubst=!0),typeof t.bracket=="string")if(t.bracket==="@open")i.bracket=1;else if(t.bracket==="@close")i.bracket=-1;else throw Tr(n,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw Tr(n,"the next state must be a string value in rule: "+e);{let r=t.next;if(!/^(@pop|@push|@popall)$/.test(r)&&(r[0]==="@"&&(r=r.substr(1)),r.indexOf("$")<0&&!rIt(n,mv(n,r,"",[],""))))throw Tr(n,"the next state '"+t.next+"' is not defined in rule: "+e);i.next=r}}return typeof t.goBack=="number"&&(i.goBack=t.goBack),typeof t.switchTo=="string"&&(i.switchTo=t.switchTo),typeof t.log=="string"&&(i.log=t.log),typeof t.nextEmbedded=="string"&&(i.nextEmbedded=t.nextEmbedded,n.usesEmbedded=!0),i}}else if(Array.isArray(t)){const i=[];for(let r=0,s=t.length;r0&&i[0]==="^",this.name=this.name+": "+i,this.regex=oee(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")",!0)}setAction(e,t){this.action=aee(e,this.name,t)}resolveRegex(e){return this.regex instanceof RegExp?this.regex:this.regex(e)}}function O8e(n,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");const t={languageId:n,includeLF:o3(e.includeLF,!1),noThrow:!1,maxStack:100,start:typeof e.start=="string"?e.start:null,ignoreCase:o3(e.ignoreCase,!1),unicode:o3(e.unicode,!1),tokenPostfix:aCe(e.tokenPostfix,"."+n),defaultToken:aCe(e.defaultToken,"source"),usesEmbedded:!1,stateNames:{},tokenizer:{},brackets:[]},i=e;i.languageId=n,i.includeLF=t.includeLF,i.ignoreCase=t.ignoreCase,i.unicode=t.unicode,i.noThrow=t.noThrow,i.usesEmbedded=t.usesEmbedded,i.stateNames=e.tokenizer,i.defaultToken=t.defaultToken;function r(o,a,l){for(const c of l){let u=c.include;if(u){if(typeof u!="string")throw Tr(t,"an 'include' attribute must be a string at: "+o);if(u[0]==="@"&&(u=u.substr(1)),!e.tokenizer[u])throw Tr(t,"include target '"+u+"' is not defined at: "+o);r(o+"."+u,a,e.tokenizer[u])}else{const d=new vOt(o);if(Array.isArray(c)&&c.length>=1&&c.length<=3)if(d.setRegex(i,c[0]),c.length>=3)if(typeof c[1]=="string")d.setAction(i,{token:c[1],next:c[2]});else if(typeof c[1]=="object"){const h=c[1];h.next=c[2],d.setAction(i,h)}else throw Tr(t,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+o);else d.setAction(i,c[1]);else{if(!c.regex)throw Tr(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+o);c.name&&typeof c.name=="string"&&(d.name=c.name),c.matchOnlyAtStart&&(d.matchOnlyAtLineStart=o3(c.matchOnlyAtLineStart,!1)),d.setRegex(i,c.regex),d.setAction(i,c.action)}a.push(d)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw Tr(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(const o in e.tokenizer)if(e.tokenizer.hasOwnProperty(o)){t.start||(t.start=o);const a=e.tokenizer[o];t.tokenizer[o]=new Array,r("tokenizer."+o,t.tokenizer[o],a)}if(t.usesEmbedded=i.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw Tr(t,"the 'brackets' attribute must be defined as an array")}else e.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];const s=[];for(const o of e.brackets){let a=o;if(a&&Array.isArray(a)&&a.length===3&&(a={token:a[2],open:a[0],close:a[1]}),a.open===a.close)throw Tr(t,"open and close brackets in a 'brackets' attribute must be different: "+a.open+` - hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")s.push({token:a.token+t.tokenPostfix,open:R_(t,a.open),close:R_(t,a.close)});else throw Tr(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=s,t.noThrow=!0,t}function bOt(n){sE.registerLanguage(n)}function yOt(){let n=[];return n=n.concat(sE.getLanguages()),n}function wOt(n){return Yt.get(Hr).languageIdCodec.encodeLanguageId(n)}function COt(n,e){return Yt.withServices(()=>{const i=Yt.get(Hr).onDidRequestRichLanguageFeatures(r=>{r===n&&(i.dispose(),e())});return i})}function xOt(n,e){return Yt.withServices(()=>{const i=Yt.get(Hr).onDidRequestBasicLanguageFeatures(r=>{r===n&&(i.dispose(),e())});return i})}function SOt(n,e){if(!Yt.get(Hr).isRegisteredLanguageId(n))throw new Error(`Cannot set configuration for unknown language ${n}`);return Yt.get(Zr).register(n,e,100)}class kOt{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if(typeof this._actual.tokenize=="function")return tR.adaptTokenize(this._languageId,this._actual,e,i);throw new Error("Not supported!")}tokenizeEncoded(e,t,i){const r=this._actual.tokenizeEncoded(e,i);return new P$(r.tokens,r.endState)}}class tR{constructor(e,t,i,r){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=r}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const i=[];let r=0;for(let s=0,o=e.length;s0&&s[o-1]===h)continue;let f=d.startIndex;c===0?f=0:f{const i=await Promise.resolve(e.create());return i?EOt(i)?F8e(n,i):new zN(Yt.get(Hr),Yt.get(hd),n,O8e(n,i),Yt.get(kn)):null});return rs.registerFactory(n,t)}function DOt(n,e){if(!Yt.get(Hr).isRegisteredLanguageId(n))throw new Error(`Cannot set tokens provider for unknown language ${n}`);return M8e(e)?fue(n,{create:()=>e}):rs.register(n,F8e(n,e))}function IOt(n,e){const t=i=>new zN(Yt.get(Hr),Yt.get(hd),n,O8e(n,i),Yt.get(kn));return M8e(e)?fue(n,{create:()=>e}):rs.register(n,t(e))}function AOt(n,e){return Yt.get(dt).referenceProvider.register(n,e)}function NOt(n,e){return Yt.get(dt).renameProvider.register(n,e)}function ROt(n,e){return Yt.get(dt).newSymbolNamesProvider.register(n,e)}function POt(n,e){return Yt.get(dt).signatureHelpProvider.register(n,e)}function OOt(n,e){return Yt.get(dt).hoverProvider.register(n,{provideHover:async(i,r,s,o)=>{const a=i.getWordAtPosition(r);return Promise.resolve(e.provideHover(i,r,s,o)).then(l=>{if(l)return!l.range&&a&&(l.range=new $(r.lineNumber,a.startColumn,r.lineNumber,a.endColumn)),l.range||(l.range=new $(r.lineNumber,r.column,r.lineNumber,r.column)),l})}})}function MOt(n,e){return Yt.get(dt).documentSymbolProvider.register(n,e)}function FOt(n,e){return Yt.get(dt).documentHighlightProvider.register(n,e)}function BOt(n,e){return Yt.get(dt).linkedEditingRangeProvider.register(n,e)}function $Ot(n,e){return Yt.get(dt).definitionProvider.register(n,e)}function WOt(n,e){return Yt.get(dt).implementationProvider.register(n,e)}function HOt(n,e){return Yt.get(dt).typeDefinitionProvider.register(n,e)}function VOt(n,e){return Yt.get(dt).codeLensProvider.register(n,e)}function zOt(n,e,t){return Yt.get(dt).codeActionProvider.register(n,{providedCodeActionKinds:t?.providedCodeActionKinds,documentation:t?.documentation,provideCodeActions:(r,s,o,a)=>{const c=Yt.get(dm).read({resource:r.uri}).filter(u=>$.areIntersectingOrTouching(u,s));return e.provideCodeActions(r,s,{markers:c,only:o.only,trigger:o.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function UOt(n,e){return Yt.get(dt).documentFormattingEditProvider.register(n,e)}function jOt(n,e){return Yt.get(dt).documentRangeFormattingEditProvider.register(n,e)}function qOt(n,e){return Yt.get(dt).onTypeFormattingEditProvider.register(n,e)}function KOt(n,e){return Yt.get(dt).linkProvider.register(n,e)}function GOt(n,e){return Yt.get(dt).completionProvider.register(n,e)}function YOt(n,e){return Yt.get(dt).colorProvider.register(n,e)}function ZOt(n,e){return Yt.get(dt).foldingRangeProvider.register(n,e)}function XOt(n,e){return Yt.get(dt).declarationProvider.register(n,e)}function QOt(n,e){return Yt.get(dt).selectionRangeProvider.register(n,e)}function JOt(n,e){return Yt.get(dt).documentSemanticTokensProvider.register(n,e)}function eMt(n,e){return Yt.get(dt).documentRangeSemanticTokensProvider.register(n,e)}function tMt(n,e){return Yt.get(dt).inlineCompletionsProvider.register(n,e)}function nMt(n,e){return Yt.get(dt).inlineEditProvider.register(n,e)}function iMt(n,e){return Yt.get(dt).inlayHintsProvider.register(n,e)}function rMt(){return{register:bOt,getLanguages:yOt,onLanguage:COt,onLanguageEncountered:xOt,getEncodedLanguageId:wOt,setLanguageConfiguration:SOt,setColorMap:TOt,registerTokensProviderFactory:fue,setTokensProvider:DOt,setMonarchTokensProvider:IOt,registerReferenceProvider:AOt,registerRenameProvider:NOt,registerNewSymbolNameProvider:ROt,registerCompletionItemProvider:GOt,registerSignatureHelpProvider:POt,registerHoverProvider:OOt,registerDocumentSymbolProvider:MOt,registerDocumentHighlightProvider:FOt,registerLinkedEditingRangeProvider:BOt,registerDefinitionProvider:$Ot,registerImplementationProvider:WOt,registerTypeDefinitionProvider:HOt,registerCodeLensProvider:VOt,registerCodeActionProvider:zOt,registerDocumentFormattingEditProvider:UOt,registerDocumentRangeFormattingEditProvider:jOt,registerOnTypeFormattingEditProvider:qOt,registerLinkProvider:KOt,registerColorProvider:YOt,registerFoldingRangeProvider:ZOt,registerDeclarationProvider:XOt,registerSelectionRangeProvider:QOt,registerDocumentSemanticTokensProvider:JOt,registerDocumentRangeSemanticTokensProvider:eMt,registerInlineCompletionsProvider:tMt,registerInlineEditProvider:nMt,registerInlayHintsProvider:iMt,DocumentHighlightKind:LZ,CompletionItemKind:wZ,CompletionItemTag:CZ,CompletionItemInsertTextRule:yZ,SymbolKind:rX,SymbolTag:sX,IndentAction:PZ,CompletionTriggerKind:xZ,SignatureHelpTriggerKind:iX,InlayHintKind:MZ,InlineCompletionTriggerKind:FZ,InlineEditTriggerKind:BZ,CodeActionTriggerType:bZ,NewSymbolNameTag:jZ,NewSymbolNameTriggerKind:qZ,PartialAcceptTriggerKind:YZ,HoverVerbosityAction:RZ,FoldingRangeKind:jL,SelectedSuggestionInfo:M4e}}const gue=On("IEditorCancelService"),B8e=new et("cancellableOperation",!1,w("cancellableOperation","Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));Vn(gue,class{constructor(){this._tokens=new WeakMap}add(n,e){let t=this._tokens.get(n);t||(t=n.invokeWithinContext(r=>{const s=B8e.bindTo(r.get(jt)),o=new Rl;return{key:s,tokens:o}}),this._tokens.set(n,t));let i;return t.key.set(!0),i=t.tokens.push(e),()=>{i&&(i(),t.key.set(!t.tokens.isEmpty()),i=void 0)}}cancel(n){const e=this._tokens.get(n);if(!e)return;const t=e.tokens.pop();t&&(t.cancel(),e.key.set(!e.tokens.isEmpty()))}},1);class sMt extends Kr{constructor(e,t){super(t),this.editor=e,this._unregister=e.invokeWithinContext(i=>i.get(gue).add(e,this))}dispose(){this._unregister(),super.dispose()}}Je(new class extends fo{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:B8e})}runEditorCommand(n,e){n.get(gue).cancel(e)}});let $8e=class lee{constructor(e,t){if(this.flags=t,this.flags&1){const i=e.getModel();this.modelVersionId=i?Lw("{0}#{1}",i.uri.toString(),i.getVersionId()):null}else this.modelVersionId=null;this.flags&4?this.position=e.getPosition():this.position=null,this.flags&2?this.selection=e.getSelection():this.selection=null,this.flags&8?(this.scrollLeft=e.getScrollLeft(),this.scrollTop=e.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(e){if(!(e instanceof lee))return!1;const t=e;return!(this.modelVersionId!==t.modelVersionId||this.scrollLeft!==t.scrollLeft||this.scrollTop!==t.scrollTop||!this.position&&t.position||this.position&&!t.position||this.position&&t.position&&!this.position.equals(t.position)||!this.selection&&t.selection||this.selection&&!t.selection||this.selection&&t.selection&&!this.selection.equalsRange(t.selection))}validate(e){return this._equals(new lee(e,this.flags))}};class Pb extends sMt{constructor(e,t,i,r){super(e,r),this._listener=new ke,t&4&&this._listener.add(e.onDidChangeCursorPosition(s=>{(!i||!$.containsPosition(i,s.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(s=>{(!i||!$.containsRange(i,s.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(s=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(s=>this.cancel())),this._listener.add(e.onDidChangeModelContent(s=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}}class pue extends Kr{constructor(e,t){super(t),this._listener=e.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}}function im(n){return n&&typeof n.getEditorType=="function"?n.getEditorType()===pO.ICodeEditor:!1}function mue(n){return n&&typeof n.getEditorType=="function"?n.getEditorType()===pO.IDiffEditor:!1}function oMt(n){return!!n&&typeof n=="object"&&typeof n.onDidChangeActiveEditor=="function"}function W8e(n){return im(n)?n:mue(n)?n.getModifiedEditor():oMt(n)&&im(n.activeCodeEditor)?n.activeCodeEditor:null}class EE{static _handleEolEdits(e,t){let i;const r=[];for(const s of t)typeof s.eol=="number"&&(i=s.eol),s.range&&typeof s.text=="string"&&r.push(s);return typeof i=="number"&&e.hasModel()&&e.getModel().pushEOL(i),r}static _isFullModelReplaceEdit(e,t){if(!e.hasModel())return!1;const i=e.getModel(),r=i.validateRange(t.range);return i.getFullModelRange().equalsRange(r)}static execute(e,t,i){i&&e.pushUndoStop();const r=Ag.capture(e),s=EE._handleEolEdits(e,t);s.length===1&&EE._isFullModelReplaceEdit(e,s[0])?e.executeEdits("formatEditsCommand",s.map(o=>jr.replace($.lift(o.range),o.text))):e.executeEdits("formatEditsCommand",s.map(o=>jr.replaceMove($.lift(o.range),o.text))),i&&e.pushUndoStop(),r.restoreRelativeVerticalPositionOfCursor(e)}}class cCe{constructor(e){this.value=e,this._lower=e.toLowerCase()}static toKey(e){return typeof e=="string"?e.toLowerCase():e._lower}}class aMt{constructor(e){if(this._set=new Set,e)for(const t of e)this.add(t)}add(e){this._set.add(cCe.toKey(e))}has(e){return this._set.has(cCe.toKey(e))}}function H8e(n,e,t){const i=[],r=new aMt,s=n.ordered(t);for(const a of s)i.push(a),a.extensionId&&r.add(a.extensionId);const o=e.ordered(t);for(const a of o){if(a.extensionId){if(r.has(a.extensionId))continue;r.add(a.extensionId)}i.push({displayName:a.displayName,extensionId:a.extensionId,provideDocumentFormattingEdits(l,c,u){return a.provideDocumentRangeFormattingEdits(l,l.getFullModelRange(),c,u)}})}return i}class LE{static{this._selectors=new Rl}static setFormatterSelector(e){return{dispose:LE._selectors.unshift(e)}}static async select(e,t,i,r){if(e.length===0)return;const s=zn.first(LE._selectors);if(s)return await s(e,t,i,r)}}async function V8e(n,e,t,i,r,s,o){const a=n.get(Tt),{documentRangeFormattingEditProvider:l}=n.get(dt),c=im(e)?e.getModel():e,u=l.ordered(c),d=await LE.select(u,c,i,2);d&&(r.report(d),await a.invokeFunction(lMt,d,e,t,s,o))}async function lMt(n,e,t,i,r,s){const o=n.get(Oc),a=n.get(Da),l=n.get(t1);let c,u;im(t)?(c=t.getModel(),u=new Pb(t,5,void 0,r)):(c=t,u=new pue(t,r));const d=[];let h=0;for(const _ of fae(i).sort($.compareRangesUsingStarts))h>0&&$.areIntersectingOrTouching(d[h-1],_)?d[h-1]=$.fromPositions(d[h-1].getStartPosition(),_.getEndPosition()):h=d.push(_);const f=async _=>{a.trace("[format][provideDocumentRangeFormattingEdits] (request)",e.extensionId?.value,_);const v=await e.provideDocumentRangeFormattingEdits(c,_,c.getFormattingOptions(),u.token)||[];return a.trace("[format][provideDocumentRangeFormattingEdits] (response)",e.extensionId?.value,v),v},g=(_,v)=>{if(!_.length||!v.length)return!1;const y=_.reduce((C,x)=>$.plusRange(C,x.range),_[0].range);if(!v.some(C=>$.intersectRanges(y,C.range)))return!1;for(const C of _)for(const x of v)if($.intersectRanges(C.range,x.range))return!0;return!1},p=[],m=[];try{if(typeof e.provideDocumentRangesFormattingEdits=="function"){a.trace("[format][provideDocumentRangeFormattingEdits] (request)",e.extensionId?.value,d);const _=await e.provideDocumentRangesFormattingEdits(c,d,c.getFormattingOptions(),u.token)||[];a.trace("[format][provideDocumentRangeFormattingEdits] (response)",e.extensionId?.value,_),m.push(_)}else{for(const _ of d){if(u.token.isCancellationRequested)return!0;m.push(await f(_))}for(let _=0;_({text:y.text,range:$.lift(y.range),forceMoveMarkers:!0})),y=>{for(const{range:C}of y)if($.areIntersectingOrTouching(C,v))return[new yt(C.startLineNumber,C.startColumn,C.endLineNumber,C.endColumn)];return null})}return l.playSignal(Ai.format,{userGesture:s}),!0}async function cMt(n,e,t,i,r,s){const o=n.get(Tt),a=n.get(dt),l=im(e)?e.getModel():e,c=H8e(a.documentFormattingEditProvider,a.documentRangeFormattingEditProvider,l),u=await LE.select(c,l,t,1);u&&(i.report(u),await o.invokeFunction(uMt,u,e,t,r,s))}async function uMt(n,e,t,i,r,s){const o=n.get(Oc),a=n.get(t1);let l,c;im(t)?(l=t.getModel(),c=new Pb(t,5,void 0,r)):(l=t,c=new pue(t,r));let u;try{const d=await e.provideDocumentFormattingEdits(l,l.getFormattingOptions(),c.token);if(u=await o.computeMoreMinimalEdits(l.uri,d),c.token.isCancellationRequested)return!0}finally{c.dispose()}if(!u||u.length===0)return!1;if(im(t))EE.execute(t,u,i!==2),i!==2&&t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{const[{range:d}]=u,h=new yt(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn);l.pushEditOperations([h],u.map(f=>({text:f.text,range:$.lift(f.range),forceMoveMarkers:!0})),f=>{for(const{range:g}of f)if($.areIntersectingOrTouching(g,h))return[new yt(g.startLineNumber,g.startColumn,g.endLineNumber,g.endColumn)];return null})}return a.playSignal(Ai.format,{userGesture:s}),!0}async function dMt(n,e,t,i,r,s){const o=e.documentRangeFormattingEditProvider.ordered(t);for(const a of o){const l=await Promise.resolve(a.provideDocumentRangeFormattingEdits(t,i,r,s)).catch(vs);if(bl(l))return await n.computeMoreMinimalEdits(t.uri,l)}}async function hMt(n,e,t,i,r){const s=H8e(e.documentFormattingEditProvider,e.documentRangeFormattingEditProvider,t);for(const o of s){const a=await Promise.resolve(o.provideDocumentFormattingEdits(t,i,r)).catch(vs);if(bl(a))return await n.computeMoreMinimalEdits(t.uri,a)}}function z8e(n,e,t,i,r,s,o){const a=e.onTypeFormattingEditProvider.ordered(t);return a.length===0||a[0].autoFormatTriggerCharacters.indexOf(r)<0?Promise.resolve(void 0):Promise.resolve(a[0].provideOnTypeFormattingEdits(t,i,r,s,o)).catch(vs).then(l=>n.computeMoreMinimalEdits(t.uri,l))}Un.registerCommand("_executeFormatRangeProvider",async function(n,...e){const[t,i,r]=e;oi(Pt.isUri(t)),oi($.isIRange(i));const s=n.get(Nc),o=n.get(Oc),a=n.get(dt),l=await s.createModelReference(t);try{return dMt(o,a,l.object.textEditorModel,$.lift(i),r,yn.None)}finally{l.dispose()}});Un.registerCommand("_executeFormatDocumentProvider",async function(n,...e){const[t,i]=e;oi(Pt.isUri(t));const r=n.get(Nc),s=n.get(Oc),o=n.get(dt),a=await r.createModelReference(t);try{return hMt(s,o,a.object.textEditorModel,i,yn.None)}finally{a.dispose()}});Un.registerCommand("_executeFormatOnTypeProvider",async function(n,...e){const[t,i,r,s]=e;oi(Pt.isUri(t)),oi(he.isIPosition(i)),oi(typeof r=="string");const o=n.get(Nc),a=n.get(Oc),l=n.get(dt),c=await o.createModelReference(t);try{return z8e(a,l,c.object.textEditorModel,he.lift(i),r,s,yn.None)}finally{c.dispose()}});Mg.wrappingIndent.defaultValue=0;Mg.glyphMargin.defaultValue=!1;Mg.autoIndent.defaultValue=3;Mg.overviewRulerLanes.defaultValue=2;LE.setFormatterSelector((n,e,t)=>Promise.resolve(n[0]));const Zl=F4e();Zl.editor=fOt();Zl.languages=rMt();const U8e=Zl.CancellationTokenSource,j8e=Zl.Emitter,q8e=Zl.KeyCode,K8e=Zl.KeyMod,G8e=Zl.Position,Y8e=Zl.Range,Z8e=Zl.Selection,X8e=Zl.SelectionDirection,Q8e=Zl.MarkerSeverity,J8e=Zl.MarkerTag,e9e=Zl.Uri,t9e=Zl.Token,n9e=Zl.editor,i9e=Zl.languages,fMt=globalThis.MonacoEnvironment;(fMt?.globalAPI||typeof define=="function"&&define.amd)&&(globalThis.monaco=Zl);typeof globalThis.require<"u"&&typeof globalThis.require.config=="function"&&globalThis.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});const el=Object.freeze(Object.defineProperty({__proto__:null,CancellationTokenSource:U8e,Emitter:j8e,KeyCode:q8e,KeyMod:K8e,MarkerSeverity:Q8e,MarkerTag:J8e,Position:G8e,Range:Y8e,Selection:Z8e,SelectionDirection:X8e,Token:t9e,Uri:e9e,editor:n9e,languages:i9e},Symbol.toStringTag,{value:"Module"}));/*!----------------------------------------------------------------------------- +`),await this._clipboardService.writeText(y)})),i.getOption(92)||m.push(new su("diff.inline.revertChange",w("diff.inline.revertChange.label","Revert this change"),void 0,!0,async()=>{this._editor.revert(this._diff)})),m},autoSelectFirstItem:!0})};this._register(Jr(this._diffActions,"mousedown",g=>{if(!g.leftButton)return;const{top:p,height:m}=ms(this._diffActions),_=Math.floor(u/3);g.preventDefault(),f(g.posx,p+m+_)})),this._register(i.onMouseMove(g=>{(g.target.type===8||g.target.type===5)&&g.target.detail.viewZoneId===this._getViewZoneId()?(d=this._updateLightBulbPosition(this._marginDomNode,g.event.browserEvent.y,u),this.visibility=!0):this.visibility=!1})),this._register(i.onMouseDown(g=>{g.event.leftButton&&(g.target.type===8||g.target.type===5)&&g.target.detail.viewZoneId===this._getViewZoneId()&&(g.event.preventDefault(),d=this._updateLightBulbPosition(this._marginDomNode,g.event.browserEvent.y,u),f(g.event.posx,g.event.posy+u))}))}_updateLightBulbPosition(e,t,i){const{top:r}=ms(e),s=t-r,o=Math.floor(s/i),a=o*i;if(this._diffActions.style.top=`${a}px`,this._viewLineCounts){let l=0;for(let c=0;cn});function nPt(n,e,t,i){ta(i,e.fontInfo);const r=t.length>0,s=new XL(1e4);let o=0,a=0;const l=[];for(let h=0;h');const l=e.getLineContent(),c=sd.isBasicASCII(l,r),u=sd.containsRTL(l,c,s),d=mO(new n1(o.fontInfo.isMonospace&&!o.disableMonospaceOptimizations,o.fontInfo.canUseHalfwidthRightwardsArrow,l,!1,c,u,0,e,t,o.tabSize,0,o.fontInfo.spaceWidth,o.fontInfo.middotWidth,o.fontInfo.wsmiddotWidth,o.stopRenderingLineAfter,o.renderWhitespace,o.renderControlCharacters,o.fontLigatures!==zh.OFF,null),a);return a.appendString(""),d.characterMapping.getHorizontalOffset(d.characterMapping.length)}var rPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},qwe=function(n,e){return function(t,i){e(t,i,n)}};let ZJ=class extends me{constructor(e,t,i,r,s,o,a,l,c,u){super(),this._targetWindow=e,this._editors=t,this._diffModel=i,this._options=r,this._diffEditorWidget=s,this._canIgnoreViewZoneUpdateEvent=o,this._origViewZonesToIgnore=a,this._modViewZonesToIgnore=l,this._clipboardService=c,this._contextMenuService=u,this._originalTopPadding=kn(this,0),this._originalScrollOffset=kn(this,0),this._originalScrollOffsetAnimated=$we(this._targetWindow,this._originalScrollOffset,this._store),this._modifiedTopPadding=kn(this,0),this._modifiedScrollOffset=kn(this,0),this._modifiedScrollOffsetAnimated=$we(this._targetWindow,this._modifiedScrollOffset,this._store);const d=kn("invalidateAlignmentsState",0),h=this._register(new Ui(()=>{d.set(d.get()+1,void 0)},0));this._register(this._editors.original.onDidChangeViewZones(y=>{this._canIgnoreViewZoneUpdateEvent()||h.schedule()})),this._register(this._editors.modified.onDidChangeViewZones(y=>{this._canIgnoreViewZoneUpdateEvent()||h.schedule()})),this._register(this._editors.original.onDidChangeConfiguration(y=>{(y.hasChanged(147)||y.hasChanged(67))&&h.schedule()})),this._register(this._editors.modified.onDidChangeConfiguration(y=>{(y.hasChanged(147)||y.hasChanged(67))&&h.schedule()}));const f=this._diffModel.map(y=>y?Bi(this,y.model.original.onDidChangeTokens,()=>y.model.original.tokenization.backgroundTokenizationState===2):void 0).map((y,C)=>y?.read(C)),g=St(y=>{const C=this._diffModel.read(y),x=C?.diff.read(y);if(!C||!x)return null;d.read(y);const L=this._options.renderSideBySide.read(y);return Kwe(this._editors.original,this._editors.modified,x.mappings,this._origViewZonesToIgnore,this._modViewZonesToIgnore,L)}),p=St(y=>{const C=this._diffModel.read(y)?.movedTextToCompare.read(y);if(!C)return null;d.read(y);const x=C.changes.map(k=>new T8e(k));return Kwe(this._editors.original,this._editors.modified,x,this._origViewZonesToIgnore,this._modViewZonesToIgnore,!0)});function m(){const y=document.createElement("div");return y.className="diagonal-fill",y}const _=this._register(new ke);this.viewZones=Jb(this,(y,C)=>{_.clear();const x=g.read(y)||[],k=[],L=[],D=this._modifiedTopPadding.read(y);D>0&&L.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:D,showInHiddenAreas:!0,suppressMouseDown:!0});const I=this._originalTopPadding.read(y);I>0&&k.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:I,showInHiddenAreas:!0,suppressMouseDown:!0});const O=this._options.renderSideBySide.read(y),M=O?void 0:this._editors.modified._getViewModel()?.createLineBreaksComputer();if(M){const j=this._editors.original.getModel();for(const te of x)if(te.diff)for(let le=te.originalRange.startLineNumber;lej.getLineCount())return{orig:k,mod:L};M?.addRequest(j.getLineContent(le),null,null)}}const B=M?.finalize()??[];let G=0;const W=this._editors.modified.getOption(67),z=this._diffModel.read(y)?.movedTextToCompare.read(y),q=this._editors.original.getModel()?.mightContainNonBasicASCII()??!1,ee=this._editors.original.getModel()?.mightContainRTL()??!1,Z=lue.fromEditor(this._editors.modified);for(const j of x)if(j.diff&&!O&&(!this._options.useTrueInlineDiffRendering.read(y)||!cue(j.diff))){if(!j.originalRange.isEmpty){f.read(y);const le=document.createElement("div");le.classList.add("view-lines","line-delete","monaco-mouse-cursor-text");const ue=this._editors.original.getModel();if(j.originalRange.endLineNumberExclusive-1>ue.getLineCount())return{orig:k,mod:L};const de=new iPt(j.originalRange.mapToLineArray(_t=>ue.tokenization.getLineTokens(_t)),j.originalRange.mapToLineArray(_t=>B[G++]),q,ee),we=[];for(const _t of j.diff.innerChanges||[])we.push(new AI(_t.originalRange.delta(-(j.diff.original.startLineNumber-1)),kE.className,0));const xe=nPt(de,Z,we,le),Me=document.createElement("div");if(Me.className="inline-deleted-margin-view-zone",ta(Me,Z.fontInfo),this._options.renderIndicators.read(y))for(let _t=0;_tLv(Re),Me,this._editors.modified,j.diff,this._diffEditorWidget,xe.viewLineCounts,this._editors.original.getModel(),this._contextMenuService,this._clipboardService));for(let _t=0;_t1&&k.push({afterLineNumber:j.originalRange.startLineNumber+_t,domNode:m(),heightInPx:(Qe-1)*W,showInHiddenAreas:!0,suppressMouseDown:!0})}L.push({afterLineNumber:j.modifiedRange.startLineNumber-1,domNode:le,heightInPx:xe.heightInLines*W,minWidthInPx:xe.minWidthInPx,marginDomNode:Me,setZoneId(_t){Re=_t},showInHiddenAreas:!0,suppressMouseDown:!0})}const te=document.createElement("div");te.className="gutter-delete",k.push({afterLineNumber:j.originalRange.endLineNumberExclusive-1,domNode:m(),heightInPx:j.modifiedHeightInPx,marginDomNode:te,showInHiddenAreas:!0,suppressMouseDown:!0})}else{const te=j.modifiedHeightInPx-j.originalHeightInPx;if(te>0){if(z?.lineRangeMapping.original.delta(-1).deltaLength(2).contains(j.originalRange.endLineNumberExclusive-1))continue;k.push({afterLineNumber:j.originalRange.endLineNumberExclusive-1,domNode:m(),heightInPx:te,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let le=function(){const de=document.createElement("div");return de.className="arrow-revert-change "+zt.asClassName(ze.arrowRight),C.add(Ce(de,"mousedown",we=>we.stopPropagation())),C.add(Ce(de,"click",we=>{we.stopPropagation(),s.revert(j.diff)})),qe("div",{},de)};if(z?.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(j.modifiedRange.endLineNumberExclusive-1))continue;let ue;j.diff&&j.diff.modified.isEmpty&&this._options.shouldRenderOldRevertArrows.read(y)&&(ue=le()),L.push({afterLineNumber:j.modifiedRange.endLineNumberExclusive-1,domNode:m(),heightInPx:-te,marginDomNode:ue,showInHiddenAreas:!0,suppressMouseDown:!0})}}for(const j of p.read(y)??[]){if(!z?.lineRangeMapping.original.intersect(j.originalRange)||!z?.lineRangeMapping.modified.intersect(j.modifiedRange))continue;const te=j.modifiedHeightInPx-j.originalHeightInPx;te>0?k.push({afterLineNumber:j.originalRange.endLineNumberExclusive-1,domNode:m(),heightInPx:te,showInHiddenAreas:!0,suppressMouseDown:!0}):L.push({afterLineNumber:j.modifiedRange.endLineNumberExclusive-1,domNode:m(),heightInPx:-te,showInHiddenAreas:!0,suppressMouseDown:!0})}return{orig:k,mod:L}});let v=!1;this._register(this._editors.original.onDidScrollChange(y=>{y.scrollLeftChanged&&!v&&(v=!0,this._editors.modified.setScrollLeft(y.scrollLeft),v=!1)})),this._register(this._editors.modified.onDidScrollChange(y=>{y.scrollLeftChanged&&!v&&(v=!0,this._editors.original.setScrollLeft(y.scrollLeft),v=!1)})),this._originalScrollTop=Bi(this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=Bi(this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._register(tn(y=>{const C=this._originalScrollTop.read(y)-(this._originalScrollOffsetAnimated.get()-this._modifiedScrollOffsetAnimated.read(y))-(this._originalTopPadding.get()-this._modifiedTopPadding.read(y));C!==this._editors.modified.getScrollTop()&&this._editors.modified.setScrollTop(C,1)})),this._register(tn(y=>{const C=this._modifiedScrollTop.read(y)-(this._modifiedScrollOffsetAnimated.get()-this._originalScrollOffsetAnimated.read(y))-(this._modifiedTopPadding.get()-this._originalTopPadding.read(y));C!==this._editors.original.getScrollTop()&&this._editors.original.setScrollTop(C,1)})),this._register(tn(y=>{const C=this._diffModel.read(y)?.movedTextToCompare.read(y);let x=0;if(C){const k=this._editors.original.getTopForLineNumber(C.lineRangeMapping.original.startLineNumber,!0)-this._originalTopPadding.get();x=this._editors.modified.getTopForLineNumber(C.lineRangeMapping.modified.startLineNumber,!0)-this._modifiedTopPadding.get()-k}x>0?(this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(x,void 0)):x<0?(this._modifiedTopPadding.set(-x,void 0),this._originalTopPadding.set(0,void 0)):setTimeout(()=>{this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(0,void 0)},400),this._editors.modified.hasTextFocus()?this._originalScrollOffset.set(this._modifiedScrollOffset.get()-x,void 0,!0):this._modifiedScrollOffset.set(this._originalScrollOffset.get()+x,void 0,!0)}))}};ZJ=rPt([qwe(8,b0),qwe(9,mu)],ZJ);function Kwe(n,e,t,i,r,s){const o=new q_(Gwe(n,i)),a=new q_(Gwe(e,r)),l=n.getOption(67),c=e.getOption(67),u=[];let d=0,h=0;function f(g,p){for(;;){let m=o.peek(),_=a.peek();if(m&&m.lineNumber>=g&&(m=void 0),_&&_.lineNumber>=p&&(_=void 0),!m&&!_)break;const v=m?m.lineNumber-d:Number.MAX_VALUE,y=_?_.lineNumber-h:Number.MAX_VALUE;vy?(a.dequeue(),m={lineNumber:_.lineNumber-h+d,heightInPx:0}):(o.dequeue(),a.dequeue()),u.push({originalRange:gn.ofLength(m.lineNumber,1),modifiedRange:gn.ofLength(_.lineNumber,1),originalHeightInPx:l+m.heightInPx,modifiedHeightInPx:c+_.heightInPx,diff:void 0})}}for(const g of t){let y=function(C,x,k=!1){if(CM.lineNumberM+B.heightInPx,0)??0,O=a.takeWhile(M=>M.lineNumberM+B.heightInPx,0)??0;u.push({originalRange:L,modifiedRange:D,originalHeightInPx:L.length*l+I,modifiedHeightInPx:D.length*c+O,diff:g.lineRangeMapping}),v=C,_=x};const p=g.lineRangeMapping;f(p.original.startLineNumber,p.modified.startLineNumber);let m=!0,_=p.modified.startLineNumber,v=p.original.startLineNumber;if(s)for(const C of p.innerChanges||[]){C.originalRange.startColumn>1&&C.modifiedRange.startColumn>1&&y(C.originalRange.startLineNumber,C.modifiedRange.startLineNumber);const x=n.getModel(),k=C.originalRange.endLineNumber<=x.getLineCount()?x.getLineMaxColumn(C.originalRange.endLineNumber):Number.MAX_SAFE_INTEGER;C.originalRange.endColumn1&&i.push({lineNumber:l,heightInPx:o*(c-1)})}for(const l of n.getWhitespaces()){if(e.has(l.id))continue;const c=l.afterLineNumber===0?0:s.convertViewPositionToModelPosition(new he(l.afterLineNumber,1)).lineNumber;t.push({lineNumber:c,heightInPx:l.height})}return ARt(t,i,l=>l.lineNumber,(l,c)=>({lineNumber:l.lineNumber,heightInPx:l.heightInPx+c.heightInPx}))}function cue(n){return n.innerChanges?n.innerChanges.every(e=>Ywe(e.modifiedRange)&&Ywe(e.originalRange)||e.originalRange.equalsRange(new $(1,1,1,1))):!1}function Ywe(n){return n.startLineNumber===n.endLineNumber}class rw extends me{static{this.movedCodeBlockPadding=4}constructor(e,t,i,r,s){super(),this._rootElement=e,this._diffModel=t,this._originalEditorLayoutInfo=i,this._modifiedEditorLayoutInfo=r,this._editors=s,this._originalScrollTop=Bi(this,this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=Bi(this,this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._viewZonesChanged=xa("onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this.width=kn(this,0),this._modifiedViewZonesChangedSignal=xa("modified.onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this._originalViewZonesChangedSignal=xa("original.onDidChangeViewZones",this._editors.original.onDidChangeViewZones),this._state=Jb(this,(u,d)=>{this._element.replaceChildren();const h=this._diffModel.read(u),f=h?.diff.read(u)?.movedTexts;if(!f||f.length===0){this.width.set(0,void 0);return}this._viewZonesChanged.read(u);const g=this._originalEditorLayoutInfo.read(u),p=this._modifiedEditorLayoutInfo.read(u);if(!g||!p){this.width.set(0,void 0);return}this._modifiedViewZonesChangedSignal.read(u),this._originalViewZonesChangedSignal.read(u);const m=f.map(L=>{function D(ee,Z){const j=Z.getTopForLineNumber(ee.startLineNumber,!0),te=Z.getTopForLineNumber(ee.endLineNumberExclusive,!0);return(j+te)/2}const I=D(L.lineRangeMapping.original,this._editors.original),O=this._originalScrollTop.read(u),M=D(L.lineRangeMapping.modified,this._editors.modified),B=this._modifiedScrollTop.read(u),G=I-O,W=M-B,z=Math.min(I,M),q=Math.max(I,M);return{range:new Dn(z,q),from:G,to:W,fromWithoutScroll:I,toWithoutScroll:M,move:L}});m.sort(ept($l(L=>L.fromWithoutScroll>L.toWithoutScroll,tpt),$l(L=>L.fromWithoutScroll>L.toWithoutScroll?L.fromWithoutScroll:-L.toWithoutScroll,Xh)));const _=uue.compute(m.map(L=>L.range)),v=10,y=g.verticalScrollbarWidth,C=(_.getTrackCount()-1)*10+v*2,x=y+C+(p.contentLeft-rw.movedCodeBlockPadding);let k=0;for(const L of m){const D=_.getTrack(k),I=y+v+D*10,O=15,M=15,B=x,G=p.glyphMarginWidth+p.lineNumbersWidth,W=18,z=document.createElementNS("http://www.w3.org/2000/svg","rect");z.classList.add("arrow-rectangle"),z.setAttribute("x",`${B-G}`),z.setAttribute("y",`${L.to-W/2}`),z.setAttribute("width",`${G}`),z.setAttribute("height",`${W}`),this._element.appendChild(z);const q=document.createElementNS("http://www.w3.org/2000/svg","g"),ee=document.createElementNS("http://www.w3.org/2000/svg","path");ee.setAttribute("d",`M 0 ${L.from} L ${I} ${L.from} L ${I} ${L.to} L ${B-M} ${L.to}`),ee.setAttribute("fill","none"),q.appendChild(ee);const Z=document.createElementNS("http://www.w3.org/2000/svg","polygon");Z.classList.add("arrow"),d.add(tn(j=>{ee.classList.toggle("currentMove",L.move===h.activeMovedText.read(j)),Z.classList.toggle("currentMove",L.move===h.activeMovedText.read(j))})),Z.setAttribute("points",`${B-M},${L.to-O/2} ${B},${L.to} ${B-M},${L.to+O/2}`),q.appendChild(Z),this._element.appendChild(q),k++}this.width.set(C,void 0)}),this._element=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("class","moved-blocks-lines"),this._rootElement.appendChild(this._element),this._register(Lt(()=>this._element.remove())),this._register(tn(u=>{const d=this._originalEditorLayoutInfo.read(u),h=this._modifiedEditorLayoutInfo.read(u);!d||!h||(this._element.style.left=`${d.width-d.verticalScrollbarWidth}px`,this._element.style.height=`${d.height}px`,this._element.style.width=`${d.verticalScrollbarWidth+d.contentLeft-rw.movedCodeBlockPadding+this.width.read(u)}px`)})),this._register(s2(this._state));const o=St(u=>{const h=this._diffModel.read(u)?.diff.read(u);return h?h.movedTexts.map(f=>({move:f,original:new OS(Hd(f.lineRangeMapping.original.startLineNumber-1),18),modified:new OS(Hd(f.lineRangeMapping.modified.startLineNumber-1),18)})):[]});this._register(_9(this._editors.original,o.map(u=>u.map(d=>d.original)))),this._register(_9(this._editors.modified,o.map(u=>u.map(d=>d.modified)))),this._register(wc((u,d)=>{const h=o.read(u);for(const f of h)d.add(new Zwe(this._editors.original,f.original,f.move,"original",this._diffModel.get())),d.add(new Zwe(this._editors.modified,f.modified,f.move,"modified",this._diffModel.get()))}));const a=xa("original.onDidFocusEditorWidget",u=>this._editors.original.onDidFocusEditorWidget(()=>setTimeout(()=>u(void 0),0))),l=xa("modified.onDidFocusEditorWidget",u=>this._editors.modified.onDidFocusEditorWidget(()=>setTimeout(()=>u(void 0),0)));let c="modified";this._register(lO({createEmptyChangeSummary:()=>{},handleChange:(u,d)=>(u.didChange(a)&&(c="original"),u.didChange(l)&&(c="modified"),!0)},u=>{a.read(u),l.read(u);const d=this._diffModel.read(u);if(!d)return;const h=d.diff.read(u);let f;if(h&&c==="original"){const g=this._editors.originalCursor.read(u);g&&(f=h.movedTexts.find(p=>p.lineRangeMapping.original.contains(g.lineNumber)))}if(h&&c==="modified"){const g=this._editors.modifiedCursor.read(u);g&&(f=h.movedTexts.find(p=>p.lineRangeMapping.modified.contains(g.lineNumber)))}f!==d.movedTextToCompare.get()&&d.movedTextToCompare.set(void 0,void 0),d.setActiveMovedText(f)}))}}class uue{static compute(e){const t=[],i=[];for(const r of e){let s=t.findIndex(o=>!o.intersectsStrict(r));s===-1&&(t.length>=6?s=Mbt(t,$l(a=>a.intersectWithRangeLength(r),Xh)):(s=t.length,t.push(new ele))),t[s].addRange(r),i.push(s)}return new uue(t.length,i)}constructor(e,t){this._trackCount=e,this.trackPerLineIdx=t}getTrack(e){return this.trackPerLineIdx[e]}getTrackCount(){return this._trackCount}}class Zwe extends Jce{constructor(e,t,i,r,s){const o=An("div.diff-hidden-lines-widget");super(e,t,o.root),this._editor=e,this._move=i,this._kind=r,this._diffModel=s,this._nodes=An("div.diff-moved-code-block",{style:{marginRight:"4px"}},[An("div.text-content@textContent"),An("div.action-bar@actionBar")]),o.root.appendChild(this._nodes.root);const a=Bi(this._editor.onDidLayoutChange,()=>this._editor.getLayoutInfo());this._register(J_(this._nodes.root,{paddingRight:a.map(h=>h.verticalScrollbarWidth)}));let l;i.changes.length>0?l=this._kind==="original"?w("codeMovedToWithChanges","Code moved with changes to line {0}-{1}",this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):w("codeMovedFromWithChanges","Code moved with changes from line {0}-{1}",this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1):l=this._kind==="original"?w("codeMovedTo","Code moved to line {0}-{1}",this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):w("codeMovedFrom","Code moved from line {0}-{1}",this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1);const c=this._register(new ed(this._nodes.actionBar,{highlightToggledItems:!0})),u=new su("",l,"",!1);c.push(u,{icon:!1,label:!0});const d=new su("","Compare",zt.asClassName(ze.compareChanges),!0,()=>{this._editor.focus(),this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get()===i?void 0:this._move,void 0)});this._register(tn(h=>{const f=this._diffModel.movedTextToCompare.read(h)===i;d.checked=f})),c.push(d,{icon:!1,label:!0})}}class sPt extends me{constructor(e,t,i,r){super(),this._editors=e,this._diffModel=t,this._options=i,this._decorations=St(this,s=>{const o=this._diffModel.read(s),a=o?.diff.read(s);if(!a)return null;const l=this._diffModel.read(s).movedTextToCompare.read(s),c=this._options.renderIndicators.read(s),u=this._options.showEmptyDecorations.read(s),d=[],h=[];if(!l)for(const g of a.mappings)if(g.lineRangeMapping.original.isEmpty||d.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:c?XN:zwe}),g.lineRangeMapping.modified.isEmpty||h.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:c?b9:Vwe}),g.lineRangeMapping.modified.isEmpty||g.lineRangeMapping.original.isEmpty)g.lineRangeMapping.original.isEmpty||d.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:sue}),g.lineRangeMapping.modified.isEmpty||h.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:iue});else{const p=this._options.useTrueInlineDiffRendering.read(s)&&cue(g.lineRangeMapping);for(const m of g.lineRangeMapping.innerChanges||[])if(g.lineRangeMapping.original.contains(m.originalRange.startLineNumber)&&d.push({range:m.originalRange,options:m.originalRange.isEmpty()&&u?oue:kE}),g.lineRangeMapping.modified.contains(m.modifiedRange.startLineNumber)&&h.push({range:m.modifiedRange,options:m.modifiedRange.isEmpty()&&u&&!p?rue:y9}),p){const _=o.model.original.getValueInRange(m.originalRange);h.push({range:m.modifiedRange,options:{description:"deleted-text",before:{content:_,inlineClassName:"inline-deleted-text"},zIndex:1e5,showIfCollapsed:!0}})}}if(l)for(const g of l.changes){const p=g.original.toInclusiveRange();p&&d.push({range:p,options:c?XN:zwe});const m=g.modified.toInclusiveRange();m&&h.push({range:m,options:c?b9:Vwe});for(const _ of g.innerChanges||[])d.push({range:_.originalRange,options:kE}),h.push({range:_.modifiedRange,options:y9})}const f=this._diffModel.read(s).activeMovedText.read(s);for(const g of a.movedTexts)d.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:{description:"moved",blockClassName:"movedOriginal"+(g===f?" currentMove":""),blockPadding:[rw.movedCodeBlockPadding,0,rw.movedCodeBlockPadding,rw.movedCodeBlockPadding]}}),h.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:{description:"moved",blockClassName:"movedModified"+(g===f?" currentMove":""),blockPadding:[4,0,4,4]}});return{originalDecorations:d,modifiedDecorations:h}}),this._register(m9(this._editors.original,this._decorations.map(s=>s?.originalDecorations||[]))),this._register(m9(this._editors.modified,this._decorations.map(s=>s?.modifiedDecorations||[])))}}class oPt{resetSash(){this._sashRatio.set(void 0,void 0)}constructor(e,t){this._options=e,this.dimensions=t,this.sashLeft=oO(this,i=>{const r=this._sashRatio.read(i)??this._options.splitViewDefaultRatio.read(i);return this._computeSashLeft(r,i)},(i,r)=>{const s=this.dimensions.width.get();this._sashRatio.set(i/s,r)}),this._sashRatio=kn(this,void 0)}_computeSashLeft(e,t){const i=this.dimensions.width.read(t),r=Math.floor(this._options.splitViewDefaultRatio.read(t)*i),s=this._options.enableSplitViewResizing.read(t)?Math.floor(e*i):r,o=100;return i<=o*2?r:si-o?i-o:s}}class D8e extends me{constructor(e,t,i,r,s,o){super(),this._domNode=e,this._dimensions=t,this._enabled=i,this._boundarySashes=r,this.sashLeft=s,this._resetSash=o,this._sash=this._register(new $a(this._domNode,{getVerticalSashTop:a=>0,getVerticalSashLeft:a=>this.sashLeft.get(),getVerticalSashHeight:a=>this._dimensions.height.get()},{orientation:0})),this._startSashPosition=void 0,this._register(this._sash.onDidStart(()=>{this._startSashPosition=this.sashLeft.get()})),this._register(this._sash.onDidChange(a=>{this.sashLeft.set(this._startSashPosition+(a.currentX-a.startX),void 0)})),this._register(this._sash.onDidEnd(()=>this._sash.layout())),this._register(this._sash.onDidReset(()=>this._resetSash())),this._register(tn(a=>{const l=this._boundarySashes.read(a);l&&(this._sash.orthogonalEndSash=l.bottom)})),this._register(tn(a=>{const l=this._enabled.read(a);this._sash.state=l?3:0,this.sashLeft.read(a),this._dimensions.height.read(a),this._sash.layout()}))}}class aPt extends me{constructor(e,t,i){super(),this._editor=e,this._domNode=t,this.itemProvider=i,this.scrollTop=Bi(this,this._editor.onDidScrollChange,o=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(o=>o===0),this.modelAttached=Bi(this,this._editor.onDidChangeModel,o=>this._editor.hasModel()),this.editorOnDidChangeViewZones=xa("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=xa("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=r2("domNodeSizeChanged"),this.views=new Map,this._domNode.className="gutter monaco-editor";const r=this._domNode.appendChild(An("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),s=new ResizeObserver(()=>{qr(o=>{this.domNodeSizeChanged.trigger(o)})});s.observe(this._domNode),this._register(Lt(()=>s.disconnect())),this._register(tn(o=>{r.className=this.isScrollTopZero.read(o)?"":"scroll-decoration"})),this._register(tn(o=>this.render(o)))}dispose(){super.dispose(),ea(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);const t=this.scrollTop.read(e),i=this._editor.getVisibleRanges(),r=new Set(this.views.keys()),s=Dn.ofStartAndLength(0,this._domNode.clientHeight);if(!s.isEmpty)for(const o of i){const a=new gn(o.startLineNumber,o.endLineNumber+1),l=this.itemProvider.getIntersectingGutterItems(a,e);qr(c=>{for(const u of l){if(!u.range.intersect(a))continue;r.delete(u.id);let d=this.views.get(u.id);if(d)d.item.set(u,c);else{const p=document.createElement("div");this._domNode.appendChild(p);const m=kn("item",u),_=this.itemProvider.createView(m,p);d=new lPt(m,_,p),this.views.set(u.id,d)}const h=u.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(u.range.startLineNumber,!0)-t:this._editor.getBottomForLineNumber(u.range.startLineNumber-1,!1)-t,g=(u.range.endLineNumberExclusive===1?Math.max(h,this._editor.getTopForLineNumber(u.range.startLineNumber,!1)-t):Math.max(h,this._editor.getBottomForLineNumber(u.range.endLineNumberExclusive-1,!0)-t))-h;d.domNode.style.top=`${h}px`,d.domNode.style.height=`${g}px`,d.gutterItemView.layout(Dn.ofStartAndLength(h,g),s)}})}for(const o of r){const a=this.views.get(o);a.gutterItemView.dispose(),a.domNode.remove(),this.views.delete(o)}}}class lPt{constructor(e,t,i){this.item=e,this.gutterItemView=t,this.domNode=i}}class I8e extends Aw{constructor(e){super(),this._getContext=e}runAction(e,t){const i=this._getContext();return super.runAction(e,i)}}class Xwe extends j3e{constructor(e){super(),this._textModel=e}getValueOfRange(e){return this._textModel.getValueInRange(e)}get length(){const e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new _c(e-1,t)}}let cPt=class extends me{constructor(e,t,i={orientation:0}){super(),this.submenuActionViewItems=[],this.hasSecondaryActions=!1,this._onDidChangeDropdownVisibility=this._register(new kmt),this.onDidChangeDropdownVisibility=this._onDidChangeDropdownVisibility.event,this.disposables=this._register(new ke),i.hoverDelegate=i.hoverDelegate??this._register(_E()),this.options=i,this.toggleMenuAction=this._register(new QN(()=>this.toggleMenuActionViewItem?.show(),i.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",e.appendChild(this.element),this.actionBar=this._register(new ed(this.element,{orientation:i.orientation,ariaLabel:i.ariaLabel,actionRunner:i.actionRunner,allowContextMenu:i.allowContextMenu,highlightToggledItems:i.highlightToggledItems,hoverDelegate:i.hoverDelegate,actionViewItemProvider:(r,s)=>{if(r.id===QN.ID)return this.toggleMenuActionViewItem=new D8(r,r.menuActions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:zt.asClassNameArray(i.moreIcon??ze.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,isMenu:!0,hoverDelegate:this.options.hoverDelegate}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(i.actionViewItemProvider){const o=i.actionViewItemProvider(r,s);if(o)return o}if(r instanceof rE){const o=new D8(r,r.actions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:r.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,hoverDelegate:this.options.hoverDelegate});return o.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(o),this.disposables.add(this._onDidChangeDropdownVisibility.add(o.onDidChangeVisibility)),o}}}))}set actionRunner(e){this.actionBar.actionRunner=e}get actionRunner(){return this.actionBar.actionRunner}getElement(){return this.element}getItemAction(e){return this.actionBar.getAction(e)}setActions(e,t){this.clear();const i=e?e.slice(0):[];this.hasSecondaryActions=!!(t&&t.length>0),this.hasSecondaryActions&&t&&(this.toggleMenuAction.menuActions=t.slice(0),i.push(this.toggleMenuAction)),i.forEach(r=>{this.actionBar.push(r,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(r)})})}getKeybindingLabel(e){return this.options.getKeyBinding?.(e)?.getLabel()??void 0}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),super.dispose()}};class QN extends su{static{this.ID="toolbar.toggle.more"}constructor(e,t){t=t||w("moreActions","More Actions..."),super(QN.ID,t,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=e}async run(){this.toggleDropdownMenu()}get menuActions(){return this._menuActions}set menuActions(e){this._menuActions=e}}var A8e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},$h=function(n,e){return function(t,i){e(t,i,n)}};let JN=class extends cPt{constructor(e,t,i,r,s,o,a,l){super(e,s,{getKeyBinding:u=>o.lookupKeybinding(u.id)??void 0,...t,allowContextMenu:!0,skipTelemetry:typeof t?.telemetrySource=="string"}),this._options=t,this._menuService=i,this._contextKeyService=r,this._contextMenuService=s,this._keybindingService=o,this._commandService=a,this._sessionDisposables=this._store.add(new ke);const c=t?.telemetrySource;c&&this._store.add(this.actionBar.onDidRun(u=>l.publicLog2("workbenchActionExecuted",{id:u.action.id,from:c})))}setActions(e,t=[],i){this._sessionDisposables.clear();const r=e.slice(),s=t.slice(),o=[];let a=0;const l=[];let c=!1;if(this._options?.hiddenItemStrategy!==-1)for(let u=0;uf?.id)),d=this._options.overflowBehavior.maxItems-u.size;let h=0;for(let f=0;f=d&&(r[f]=void 0,l[f]=g))}}Lve(r),Lve(l),super.setActions(r,na.join(l,s)),(o.length>0||r.length>0)&&this._sessionDisposables.add(Ce(this.getElement(),"contextmenu",u=>{const d=new qh(Ot(this.getElement()),u),h=this.getItemAction(d.target);if(!h)return;d.preventDefault(),d.stopPropagation();const f=[];if(h instanceof ou&&h.menuKeybinding)f.push(h.menuKeybinding);else if(!(h instanceof ck||h instanceof QN)){const p=!!this._keybindingService.lookupKeybinding(h.id);f.push(K6e(this._commandService,this._keybindingService,h.id,void 0,p))}if(o.length>0){let p=!1;if(a===1&&this._options?.hiddenItemStrategy===0){p=!0;for(let m=0;mthis._menuService.resetHiddenStates(i)}))),g.length!==0&&this._contextMenuService.showContextMenu({getAnchor:()=>d,getActions:()=>g,menuId:this._options?.contextMenu,menuActionOptions:{renderShortTitle:!0,...this._options?.menuOptions},skipTelemetry:typeof this._options?.telemetrySource=="string",contextKeyService:this._contextKeyService})}))}};JN=A8e([$h(2,ld),$h(3,jt),$h(4,mu),$h(5,xi),$h(6,_r),$h(7,Qa)],JN);let w9=class extends JN{constructor(e,t,i,r,s,o,a,l,c){super(e,{resetMenu:t,...i},r,s,o,a,l,c),this._onDidChangeMenuItems=this._store.add(new fe),this.onDidChangeMenuItems=this._onDidChangeMenuItems.event;const u=this._store.add(r.createMenu(t,s,{emitEventsForSubmenuChanges:!0})),d=()=>{const h=[],f=[];EW(u,i?.menuOptions,{primary:h,secondary:f},i?.toolbarOptions?.primaryGroup,i?.toolbarOptions?.shouldInlineSubmenu,i?.toolbarOptions?.useSeparatorsInPrimaryActions),e.classList.toggle("has-no-actions",h.length===0&&f.length===0),super.setActions(h,f)};this._store.add(u.onDidChange(()=>{d(),this._onDidChangeMenuItems.fire(this)})),d()}setActions(){throw new fi("This toolbar is populated from a menu.")}};w9=A8e([$h(3,ld),$h(4,jt),$h(5,mu),$h(6,xi),$h(7,_r),$h(8,Qa)],w9);var N8e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},dF=function(n,e){return function(t,i){e(t,i,n)}};const Rq=[],s3=35;let XJ=class extends me{constructor(e,t,i,r,s,o,a,l,c){super(),this._diffModel=t,this._editors=i,this._options=r,this._sashLayout=s,this._boundarySashes=o,this._instantiationService=a,this._contextKeyService=l,this._menuService=c,this._menu=this._register(this._menuService.createMenu(ce.DiffEditorHunkToolbar,this._contextKeyService)),this._actions=Bi(this,this._menu.onDidChange,()=>this._menu.getActions()),this._hasActions=this._actions.map(u=>u.length>0),this._showSash=St(this,u=>this._options.renderSideBySide.read(u)&&this._hasActions.read(u)),this.width=St(this,u=>this._hasActions.read(u)?s3:0),this.elements=An("div.gutter@gutter",{style:{position:"absolute",height:"100%",width:s3+"px"}},[]),this._currentDiff=St(this,u=>{const d=this._diffModel.read(u);if(!d)return;const h=d.diff.read(u)?.mappings,f=this._editors.modifiedCursor.read(u);if(f)return h?.find(g=>g.lineRangeMapping.modified.contains(f.lineNumber))}),this._selectedDiffs=St(this,u=>{const h=this._diffModel.read(u)?.diff.read(u);if(!h)return Rq;const f=this._editors.modifiedSelections.read(u);if(f.every(_=>_.isEmpty()))return Rq;const g=new Md(f.map(_=>gn.fromRangeInclusive(_))),m=h.mappings.filter(_=>_.lineRangeMapping.innerChanges&&g.intersects(_.lineRangeMapping.modified)).map(_=>({mapping:_,rangeMappings:_.lineRangeMapping.innerChanges.filter(v=>f.some(y=>$.areIntersecting(v.modifiedRange,y)))}));return m.length===0||m.every(_=>_.rangeMappings.length===0)?Rq:m}),this._register(NRt(e,this.elements.root)),this._register(Ce(this.elements.root,"click",()=>{this._editors.modified.focus()})),this._register(J_(this.elements.root,{display:this._hasActions.map(u=>u?"block":"none")})),hl(this,u=>this._showSash.read(u)?new D8e(e,this._sashLayout.dimensions,this._options.enableSplitViewResizing,this._boundarySashes,oO(this,h=>this._sashLayout.sashLeft.read(h)-s3,(h,f)=>this._sashLayout.sashLeft.set(h+s3,f)),()=>this._sashLayout.resetSash()):void 0).recomputeInitiallyAndOnChange(this._store),this._register(new aPt(this._editors.modified,this.elements.root,{getIntersectingGutterItems:(u,d)=>{const h=this._diffModel.read(d);if(!h)return[];const f=h.diff.read(d);if(!f)return[];const g=this._selectedDiffs.read(d);if(g.length>0){const m=Ju.fromRangeMappings(g.flatMap(_=>_.rangeMappings));return[new Qwe(m,!0,ce.DiffEditorSelectionToolbar,void 0,h.model.original.uri,h.model.modified.uri)]}const p=this._currentDiff.read(d);return f.mappings.map(m=>new Qwe(m.lineRangeMapping.withInnerChangesFromLineRanges(),m.lineRangeMapping===p?.lineRangeMapping,ce.DiffEditorHunkToolbar,void 0,h.model.original.uri,h.model.modified.uri))},createView:(u,d)=>this._instantiationService.createInstance(QJ,u,d,this)})),this._register(Ce(this.elements.gutter,je.MOUSE_WHEEL,u=>{this._editors.modified.getOption(104).handleMouseWheel&&this._editors.modified.delegateScrollFromMouseWheelEvent(u)},{passive:!1}))}computeStagedValue(e){const t=e.innerChanges??[],i=new Xwe(this._editors.modifiedModel.get()),r=new Xwe(this._editors.original.getModel());return new nle(t.map(a=>a.toTextEdit(i))).apply(r)}layout(e){this.elements.gutter.style.left=e+"px"}};XJ=N8e([dF(6,Tt),dF(7,jt),dF(8,ld)],XJ);class Qwe{constructor(e,t,i,r,s,o){this.mapping=e,this.showAlways=t,this.menuId=i,this.rangeOverride=r,this.originalUri=s,this.modifiedUri=o}get id(){return this.mapping.modified.toString()}get range(){return this.rangeOverride??this.mapping.modified}}let QJ=class extends me{constructor(e,t,i,r){super(),this._item=e,this._elements=An("div.gutterItem",{style:{height:"20px",width:"34px"}},[An("div.background@background",{},[]),An("div.buttons@buttons",{},[])]),this._showAlways=this._item.map(this,o=>o.showAlways),this._menuId=this._item.map(this,o=>o.menuId),this._isSmall=kn(this,!1),this._lastItemRange=void 0,this._lastViewRange=void 0;const s=this._register(r.createInstance(uE,"element",!0,{position:{hoverPosition:1}}));this._register(PS(t,this._elements.root)),this._register(tn(o=>{const a=this._showAlways.read(o);this._elements.root.classList.toggle("noTransition",!0),this._elements.root.classList.toggle("showAlways",a),setTimeout(()=>{this._elements.root.classList.toggle("noTransition",!1)},0)})),this._register(wc((o,a)=>{this._elements.buttons.replaceChildren();const l=a.add(r.createInstance(w9,this._elements.buttons,this._menuId.read(o),{orientation:1,hoverDelegate:s,toolbarOptions:{primaryGroup:c=>c.startsWith("primary")},overflowBehavior:{maxItems:this._isSmall.read(o)?1:3},hiddenItemStrategy:0,actionRunner:new I8e(()=>{const c=this._item.get(),u=c.mapping;return{mapping:u,originalWithModifiedChanges:i.computeStagedValue(u),originalUri:c.originalUri,modifiedUri:c.modifiedUri}}),menuOptions:{shouldForwardArgs:!0}}));a.add(l.onDidChangeMenuItems(()=>{this._lastItemRange&&this.layout(this._lastItemRange,this._lastViewRange)}))}))}layout(e,t){this._lastItemRange=e,this._lastViewRange=t;let i=this._elements.buttons.clientHeight;this._isSmall.set(this._item.get().mapping.original.startLineNumber===1&&e.length<30,void 0),i=this._elements.buttons.clientHeight;const r=e.length/2-i/2,s=i;let o=e.start+r;const a=Dn.tryCreate(s,t.endExclusive-s-i),l=Dn.tryCreate(e.start+s,e.endExclusive-i-s);l&&a&&l.start{const r=yy._map.get(e);r&&(yy._map.delete(e),r.dispose(),i.dispose())})}return t}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&(this._currentTransaction=new i2(()=>{}))}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){const e=this._currentTransaction;this._currentTransaction=void 0,e.finish()}}constructor(e){super(),this.editor=e,this._updateCounter=0,this._currentTransaction=void 0,this._model=kn(this,this.editor.getModel()),this.model=this._model,this.isReadonly=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(92)),this._versionId=CQ({owner:this,lazy:!0},this.editor.getModel()?.getVersionId()??null),this.versionId=this._versionId,this._selections=CQ({owner:this,equalsFn:bQ(k8(yt.selectionsEqual)),lazy:!0},this.editor.getSelections()??null),this.selections=this._selections,this.isFocused=Bi(this,t=>{const i=this.editor.onDidFocusEditorWidget(t),r=this.editor.onDidBlurEditorWidget(t);return{dispose(){i.dispose(),r.dispose()}}},()=>this.editor.hasWidgetFocus()),this.value=oO(this,t=>(this.versionId.read(t),this.model.read(t)?.getValue()??""),(t,i)=>{const r=this.model.get();r!==null&&t!==r.getValue()&&r.setValue(t)}),this.valueIsEmpty=St(this,t=>(this.versionId.read(t),this.editor.getModel()?.getValueLength()===0)),this.cursorSelection=$u({owner:this,equalsFn:bQ(yt.selectionsEqual)},t=>this.selections.read(t)?.[0]??null),this.onDidType=r2(this),this.scrollTop=Bi(this.editor.onDidScrollChange,()=>this.editor.getScrollTop()),this.scrollLeft=Bi(this.editor.onDidScrollChange,()=>this.editor.getScrollLeft()),this.layoutInfo=Bi(this.editor.onDidLayoutChange,()=>this.editor.getLayoutInfo()),this.layoutInfoContentLeft=this.layoutInfo.map(t=>t.contentLeft),this.layoutInfoDecorationsLeft=this.layoutInfo.map(t=>t.decorationsLeft),this.contentWidth=Bi(this.editor.onDidContentSizeChange,()=>this.editor.getContentWidth()),this._overlayWidgetCounter=0,this._register(this.editor.onBeginUpdate(()=>this._beginUpdate())),this._register(this.editor.onEndUpdate(()=>this._endUpdate())),this._register(this.editor.onDidChangeModel(()=>{this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidType(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidType.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeModelContent(t=>{this._beginUpdate();try{this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeCursorSelection(t=>{this._beginUpdate();try{this._selections.set(this.editor.getSelections(),this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}}))}forceUpdate(e){this._beginUpdate();try{return this._forceUpdate(),e?e(this._currentTransaction):void 0}finally{this._endUpdate()}}_forceUpdate(){this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,void 0),this._selections.set(this.editor.getSelections(),this._currentTransaction,void 0)}finally{this._endUpdate()}}getOption(e){return Bi(this,t=>this.editor.onDidChangeConfiguration(i=>{i.hasChanged(e)&&t(void 0)}),()=>this.editor.getOption(e))}setDecorations(e){const t=new ke,i=this.editor.createDecorationsCollection();return t.add(aO({owner:this,debugName:()=>`Apply decorations from ${e.debugName}`},r=>{const s=e.read(r);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}createOverlayWidget(e){const t="observableOverlayWidget"+this._overlayWidgetCounter++,i={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow,getMinContentWidthInPx:()=>e.minContentWidthInPx.get()};this.editor.addOverlayWidget(i);const r=tn(s=>{e.position.read(s),e.minContentWidthInPx.read(s),this.editor.layoutOverlayWidget(i)});return Lt(()=>{r.dispose(),this.editor.removeOverlayWidget(i)})}}function JJ(n,e){return ISt({createEmptyChangeSummary:()=>({deltas:[],didChange:!1}),handleChange:(t,i)=>{if(t.didChange(n)){const r=t.change;r!==void 0&&i.deltas.push(r),i.didChange=!0}return!0}},(t,i)=>{const r=n.read(t);i.didChange&&e(r,i.deltas)})}function uPt(n,e){const t=new ke,i=JJ(n,(r,s)=>{t.clear(),e(r,s,t)});return{dispose(){i.dispose(),t.dispose()}}}var dPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},hPt=function(n,e){return function(t,i){e(t,i,n)}},hF;let C9=class extends me{static{hF=this}static{this._breadcrumbsSourceFactory=kn(hF,()=>({dispose(){},getBreadcrumbItems(e,t){return[]}}))}static setBreadcrumbsSourceFactory(e){this._breadcrumbsSourceFactory.set(e,void 0)}get isUpdatingHiddenAreas(){return this._isUpdatingHiddenAreas}constructor(e,t,i,r){super(),this._editors=e,this._diffModel=t,this._options=i,this._instantiationService=r,this._modifiedOutlineSource=hl(this,l=>{const c=this._editors.modifiedModel.read(l),u=hF._breadcrumbsSourceFactory.read(l);return!c||!u?void 0:u(c,this._instantiationService)}),this._isUpdatingHiddenAreas=!1,this._register(this._editors.original.onDidChangeCursorPosition(l=>{if(l.reason===1)return;const c=this._diffModel.get();qr(u=>{for(const d of this._editors.original.getSelections()||[])c?.ensureOriginalLineIsVisible(d.getStartPosition().lineNumber,0,u),c?.ensureOriginalLineIsVisible(d.getEndPosition().lineNumber,0,u)})})),this._register(this._editors.modified.onDidChangeCursorPosition(l=>{if(l.reason===1)return;const c=this._diffModel.get();qr(u=>{for(const d of this._editors.modified.getSelections()||[])c?.ensureModifiedLineIsVisible(d.getStartPosition().lineNumber,0,u),c?.ensureModifiedLineIsVisible(d.getEndPosition().lineNumber,0,u)})}));const s=this._diffModel.map((l,c)=>{const u=l?.unchangedRegions.read(c)??[];return u.length===1&&u[0].modifiedLineNumber===1&&u[0].lineCount===this._editors.modifiedModel.read(c)?.getLineCount()?[]:u});this.viewZones=Jb(this,(l,c)=>{const u=this._modifiedOutlineSource.read(l);if(!u)return{origViewZones:[],modViewZones:[]};const d=[],h=[],f=this._options.renderSideBySide.read(l),g=this._options.compactMode.read(l),p=s.read(l);for(let m=0;m_.getHiddenOriginalRange(C).startLineNumber-1),y=new OS(v,12);d.push(y),c.add(new Jwe(this._editors.original,y,_,!f))}{const v=St(this,C=>_.getHiddenModifiedRange(C).startLineNumber-1),y=new OS(v,12);h.push(y),c.add(new Jwe(this._editors.modified,y,_))}}else{{const v=St(this,C=>_.getHiddenOriginalRange(C).startLineNumber-1),y=new OS(v,24);d.push(y),c.add(new eCe(this._editors.original,y,_,_.originalUnchangedRange,!f,u,C=>this._diffModel.get().ensureModifiedLineIsVisible(C,2,void 0),this._options))}{const v=St(this,C=>_.getHiddenModifiedRange(C).startLineNumber-1),y=new OS(v,24);h.push(y),c.add(new eCe(this._editors.modified,y,_,_.modifiedUnchangedRange,!1,u,C=>this._diffModel.get().ensureModifiedLineIsVisible(C,2,void 0),this._options))}}}return{origViewZones:d,modViewZones:h}});const o={description:"unchanged lines",className:"diff-unchanged-lines",isWholeLine:!0},a={description:"Fold Unchanged",glyphMarginHoverMessage:new za(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(w("foldUnchanged","Fold Unchanged Region")),glyphMarginClassName:"fold-unchanged "+zt.asClassName(ze.fold),zIndex:10001};this._register(m9(this._editors.original,St(this,l=>{const c=s.read(l),u=c.map(d=>({range:d.originalUnchangedRange.toInclusiveRange(),options:o}));for(const d of c)d.shouldHideControls(l)&&u.push({range:$.fromPositions(new he(d.originalLineNumber,1)),options:a});return u}))),this._register(m9(this._editors.modified,St(this,l=>{const c=s.read(l),u=c.map(d=>({range:d.modifiedUnchangedRange.toInclusiveRange(),options:o}));for(const d of c)d.shouldHideControls(l)&&u.push({range:gn.ofLength(d.modifiedLineNumber,1).toInclusiveRange(),options:a});return u}))),this._register(tn(l=>{const c=s.read(l);this._isUpdatingHiddenAreas=!0;try{this._editors.original.setHiddenAreas(c.map(u=>u.getHiddenOriginalRange(l).toInclusiveRange()).filter(Bp)),this._editors.modified.setHiddenAreas(c.map(u=>u.getHiddenModifiedRange(l).toInclusiveRange()).filter(Bp))}finally{this._isUpdatingHiddenAreas=!1}})),this._register(this._editors.modified.onMouseUp(l=>{if(!l.event.rightButton&&l.target.position&&l.target.element?.className.includes("fold-unchanged")){const c=l.target.position.lineNumber,u=this._diffModel.get();if(!u)return;const d=u.unchangedRegions.get().find(h=>h.modifiedUnchangedRange.includes(c));if(!d)return;d.collapseAll(void 0),l.event.stopPropagation(),l.event.preventDefault()}})),this._register(this._editors.original.onMouseUp(l=>{if(!l.event.rightButton&&l.target.position&&l.target.element?.className.includes("fold-unchanged")){const c=l.target.position.lineNumber,u=this._diffModel.get();if(!u)return;const d=u.unchangedRegions.get().find(h=>h.originalUnchangedRange.includes(c));if(!d)return;d.collapseAll(void 0),l.event.stopPropagation(),l.event.preventDefault()}}))}};C9=hF=dPt([hPt(3,Tt)],C9);class Jwe extends Jce{constructor(e,t,i,r=!1){const s=An("div.diff-hidden-lines-widget");super(e,t,s.root),this._unchangedRegion=i,this._hide=r,this._nodes=An("div.diff-hidden-lines-compact",[An("div.line-left",[]),An("div.text@text",[]),An("div.line-right",[])]),s.root.appendChild(this._nodes.root),this._hide&&this._nodes.root.replaceChildren(),this._register(tn(o=>{if(!this._hide){const a=this._unchangedRegion.getHiddenModifiedRange(o).length,l=w("hiddenLines","{0} hidden lines",a);this._nodes.text.innerText=l}}))}}class eCe extends Jce{constructor(e,t,i,r,s,o,a,l){const c=An("div.diff-hidden-lines-widget");super(e,t,c.root),this._editor=e,this._unchangedRegion=i,this._unchangedRegionRange=r,this._hide=s,this._modifiedOutlineSource=o,this._revealModifiedHiddenLine=a,this._options=l,this._nodes=An("div.diff-hidden-lines",[An("div.top@top",{title:w("diff.hiddenLines.top","Click or drag to show more above")}),An("div.center@content",{style:{display:"flex"}},[An("div@first",{style:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0"}},[qe("a",{title:w("showUnchangedRegion","Show Unchanged Region"),role:"button",onclick:()=>{this._unchangedRegion.showAll(void 0)}},...ob("$(unfold)"))]),An("div@others",{style:{display:"flex",justifyContent:"center",alignItems:"center"}})]),An("div.bottom@bottom",{title:w("diff.bottom","Click or drag to show more below"),role:"button"})]),c.root.appendChild(this._nodes.root),this._hide?ea(this._nodes.first):this._register(J_(this._nodes.first,{width:Jc(this._editor).layoutInfoContentLeft})),this._register(tn(d=>{const h=this._unchangedRegion.visibleLineCountTop.read(d)+this._unchangedRegion.visibleLineCountBottom.read(d)===this._unchangedRegion.lineCount;this._nodes.bottom.classList.toggle("canMoveTop",!h),this._nodes.bottom.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(d)>0),this._nodes.top.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(d)>0),this._nodes.top.classList.toggle("canMoveBottom",!h);const f=this._unchangedRegion.isDragged.read(d),g=this._editor.getDomNode();g&&(g.classList.toggle("draggingUnchangedRegion",!!f),f==="top"?(g.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(d)>0),g.classList.toggle("canMoveBottom",!h)):f==="bottom"?(g.classList.toggle("canMoveTop",!h),g.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(d)>0)):(g.classList.toggle("canMoveTop",!1),g.classList.toggle("canMoveBottom",!1)))}));const u=this._editor;this._register(Ce(this._nodes.top,"mousedown",d=>{if(d.button!==0)return;this._nodes.top.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),d.preventDefault();const h=d.clientY;let f=!1;const g=this._unchangedRegion.visibleLineCountTop.get();this._unchangedRegion.isDragged.set("top",void 0);const p=Ot(this._nodes.top),m=Ce(p,"mousemove",v=>{const C=v.clientY-h;f=f||Math.abs(C)>2;const x=Math.round(C/u.getOption(67)),k=Math.max(0,Math.min(g+x,this._unchangedRegion.getMaxVisibleLineCountTop()));this._unchangedRegion.visibleLineCountTop.set(k,void 0)}),_=Ce(p,"mouseup",v=>{f||this._unchangedRegion.showMoreAbove(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0),this._nodes.top.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),this._unchangedRegion.isDragged.set(void 0,void 0),m.dispose(),_.dispose()})})),this._register(Ce(this._nodes.bottom,"mousedown",d=>{if(d.button!==0)return;this._nodes.bottom.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),d.preventDefault();const h=d.clientY;let f=!1;const g=this._unchangedRegion.visibleLineCountBottom.get();this._unchangedRegion.isDragged.set("bottom",void 0);const p=Ot(this._nodes.bottom),m=Ce(p,"mousemove",v=>{const C=v.clientY-h;f=f||Math.abs(C)>2;const x=Math.round(C/u.getOption(67)),k=Math.max(0,Math.min(g-x,this._unchangedRegion.getMaxVisibleLineCountBottom())),L=this._unchangedRegionRange.endLineNumberExclusive>u.getModel().getLineCount()?u.getContentHeight():u.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.visibleLineCountBottom.set(k,void 0);const D=this._unchangedRegionRange.endLineNumberExclusive>u.getModel().getLineCount()?u.getContentHeight():u.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);u.setScrollTop(u.getScrollTop()+(D-L))}),_=Ce(p,"mouseup",v=>{if(this._unchangedRegion.isDragged.set(void 0,void 0),!f){const y=u.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.showMoreBelow(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0);const C=u.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);u.setScrollTop(u.getScrollTop()+(C-y))}this._nodes.bottom.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),m.dispose(),_.dispose()})})),this._register(tn(d=>{const h=[];if(!this._hide){const f=i.getHiddenModifiedRange(d).length,g=w("hiddenLines","{0} hidden lines",f),p=qe("span",{title:w("diff.hiddenLines.expandAll","Double click to unfold")},g);p.addEventListener("dblclick",v=>{v.button===0&&(v.preventDefault(),this._unchangedRegion.showAll(void 0))}),h.push(p);const m=this._unchangedRegion.getHiddenModifiedRange(d),_=this._modifiedOutlineSource.getBreadcrumbItems(m,d);if(_.length>0){h.push(qe("span",void 0,"  |  "));for(let v=0;v<_.length;v++){const y=_[v],C=$6.toIcon(y.kind),x=An("div.breadcrumb-item",{style:{display:"flex",alignItems:"center"}},[Pw(C)," ",y.name,...v===_.length-1?[]:[Pw(ze.chevronRight)]]).root;h.push(x),x.onclick=()=>{this._revealModifiedHiddenLine(y.startLineNumber)}}}}ea(this._nodes.others,...h)}))}}var fPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gPt=function(n,e){return function(t,i){e(t,i,n)}},Df;let eR=class extends me{static{Df=this}static{this.ONE_OVERVIEW_WIDTH=15}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=this.ONE_OVERVIEW_WIDTH*2}constructor(e,t,i,r,s,o,a){super(),this._editors=e,this._rootElement=t,this._diffModel=i,this._rootWidth=r,this._rootHeight=s,this._modifiedEditorLayoutInfo=o,this._themeService=a,this.width=Df.ENTIRE_DIFF_OVERVIEW_WIDTH;const l=Bi(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),c=St(h=>{const f=l.read(h),g=f.getColor(Iyt)||(f.getColor(Tyt)||zX).transparent(2),p=f.getColor(Ayt)||(f.getColor(Dyt)||UX).transparent(2);return{insertColor:g,removeColor:p}}),u=Ci(document.createElement("div"));u.setClassName("diffViewport"),u.setPosition("absolute");const d=An("div.diffOverview",{style:{position:"absolute",top:"0px",width:Df.ENTIRE_DIFF_OVERVIEW_WIDTH+"px"}}).root;this._register(PS(d,u.domNode)),this._register(Jr(d,je.POINTER_DOWN,h=>{this._editors.modified.delegateVerticalScrollbarPointerDown(h)})),this._register(Ce(d,je.MOUSE_WHEEL,h=>{this._editors.modified.delegateScrollFromMouseWheelEvent(h)},{passive:!1})),this._register(PS(this._rootElement,d)),this._register(wc((h,f)=>{const g=this._diffModel.read(h),p=this._editors.original.createOverviewRuler("original diffOverviewRuler");p&&(f.add(p),f.add(PS(d,p.getDomNode())));const m=this._editors.modified.createOverviewRuler("modified diffOverviewRuler");if(m&&(f.add(m),f.add(PS(d,m.getDomNode()))),!p||!m)return;const _=xa("viewZoneChanged",this._editors.original.onDidChangeViewZones),v=xa("viewZoneChanged",this._editors.modified.onDidChangeViewZones),y=xa("hiddenRangesChanged",this._editors.original.onDidChangeHiddenAreas),C=xa("hiddenRangesChanged",this._editors.modified.onDidChangeHiddenAreas);f.add(tn(x=>{_.read(x),v.read(x),y.read(x),C.read(x);const k=c.read(x),L=g?.diff.read(x)?.mappings;function D(M,B,G){const W=G._getViewModel();return W?M.filter(z=>z.length>0).map(z=>{const q=W.coordinatesConverter.convertModelPositionToViewPosition(new he(z.startLineNumber,1)),ee=W.coordinatesConverter.convertModelPositionToViewPosition(new he(z.endLineNumberExclusive,1)),Z=ee.lineNumber-q.lineNumber;return new v8e(q.lineNumber,ee.lineNumber,Z,B.toString())}):[]}const I=D((L||[]).map(M=>M.lineRangeMapping.original),k.removeColor,this._editors.original),O=D((L||[]).map(M=>M.lineRangeMapping.modified),k.insertColor,this._editors.modified);p?.setZones(I),m?.setZones(O)})),f.add(tn(x=>{const k=this._rootHeight.read(x),L=this._rootWidth.read(x),D=this._modifiedEditorLayoutInfo.read(x);if(D){const I=Df.ENTIRE_DIFF_OVERVIEW_WIDTH-2*Df.ONE_OVERVIEW_WIDTH;p.setLayout({top:0,height:k,right:I+Df.ONE_OVERVIEW_WIDTH,width:Df.ONE_OVERVIEW_WIDTH}),m.setLayout({top:0,height:k,right:0,width:Df.ONE_OVERVIEW_WIDTH});const O=this._editors.modifiedScrollTop.read(x),M=this._editors.modifiedScrollHeight.read(x),B=this._editors.modified.getOption(104),G=new hE(B.verticalHasArrows?B.arrowSize:0,B.verticalScrollbarSize,0,D.height,M,O);u.setTop(G.getSliderPosition()),u.setHeight(G.getSliderSize())}else u.setTop(0),u.setHeight(0);d.style.height=k+"px",d.style.left=L-Df.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",u.setWidth(Df.ENTIRE_DIFF_OVERVIEW_WIDTH)}))}))}};eR=Df=fPt([gPt(6,go)],eR);const Pq=[];class pPt extends me{constructor(e,t,i,r){super(),this._editors=e,this._diffModel=t,this._options=i,this._widget=r,this._selectedDiffs=St(this,s=>{const a=this._diffModel.read(s)?.diff.read(s);if(!a)return Pq;const l=this._editors.modifiedSelections.read(s);if(l.every(h=>h.isEmpty()))return Pq;const c=new Md(l.map(h=>gn.fromRangeInclusive(h))),d=a.mappings.filter(h=>h.lineRangeMapping.innerChanges&&c.intersects(h.lineRangeMapping.modified)).map(h=>({mapping:h,rangeMappings:h.lineRangeMapping.innerChanges.filter(f=>l.some(g=>$.areIntersecting(f.modifiedRange,g)))}));return d.length===0||d.every(h=>h.rangeMappings.length===0)?Pq:d}),this._register(wc((s,o)=>{if(!this._options.shouldRenderOldRevertArrows.read(s))return;const a=this._diffModel.read(s),l=a?.diff.read(s);if(!a||!l||a.movedTextToCompare.read(s))return;const c=[],u=this._selectedDiffs.read(s),d=new Set(u.map(h=>h.mapping));if(u.length>0){const h=this._editors.modifiedSelections.read(s),f=o.add(new x9(h[h.length-1].positionLineNumber,this._widget,u.flatMap(g=>g.rangeMappings),!0));this._editors.modified.addGlyphMarginWidget(f),c.push(f)}for(const h of l.mappings)if(!d.has(h)&&!h.lineRangeMapping.modified.isEmpty&&h.lineRangeMapping.innerChanges){const f=o.add(new x9(h.lineRangeMapping.modified.startLineNumber,this._widget,h.lineRangeMapping,!1));this._editors.modified.addGlyphMarginWidget(f),c.push(f)}o.add(Lt(()=>{for(const h of c)this._editors.modified.removeGlyphMarginWidget(h)}))}))}}class x9 extends me{static{this.counter=0}getId(){return this._id}constructor(e,t,i,r){super(),this._lineNumber=e,this._widget=t,this._diffs=i,this._revertSelection=r,this._id=`revertButton${x9.counter++}`,this._domNode=An("div.revertButton",{title:this._revertSelection?w("revertSelectedChanges","Revert Selected Changes"):w("revertChange","Revert Change")},[Pw(ze.arrowRight)]).root,this._register(Ce(this._domNode,je.MOUSE_DOWN,s=>{s.button!==2&&(s.stopPropagation(),s.preventDefault())})),this._register(Ce(this._domNode,je.MOUSE_UP,s=>{s.stopPropagation(),s.preventDefault()})),this._register(Ce(this._domNode,je.CLICK,s=>{this._diffs instanceof gl?this._widget.revert(this._diffs):this._widget.revertRangeMappings(this._diffs),s.stopPropagation(),s.preventDefault()}))}getDomNode(){return this._domNode}getPosition(){return{lane:af.Right,range:{startColumn:1,startLineNumber:this._lineNumber,endColumn:1,endLineNumber:this._lineNumber},zIndex:10001}}}function mPt(n,e,t){return NSt({debugName:()=>`Configuration Key "${n}"`},i=>t.onDidChangeConfiguration(r=>{r.affectsConfiguration(n)&&i(r)}),()=>t.getValue(n)??e)}function Rf(n,e,t){const i=n.bindTo(e);return aO({debugName:()=>`Set Context Key "${n.key}"`},r=>{i.set(t(r))})}var _Pt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},tCe=function(n,e){return function(t,i){e(t,i,n)}};let eee=class extends me{get onDidContentSizeChange(){return this._onDidContentSizeChange.event}constructor(e,t,i,r,s,o,a){super(),this.originalEditorElement=e,this.modifiedEditorElement=t,this._options=i,this._argCodeEditorWidgetOptions=r,this._createInnerEditor=s,this._instantiationService=o,this._keybindingService=a,this.original=this._register(this._createLeftHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.originalEditor||{})),this.modified=this._register(this._createRightHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.modifiedEditor||{})),this._onDidContentSizeChange=this._register(new fe),this.modifiedScrollTop=Bi(this,this.modified.onDidScrollChange,()=>this.modified.getScrollTop()),this.modifiedScrollHeight=Bi(this,this.modified.onDidScrollChange,()=>this.modified.getScrollHeight()),this.modifiedObs=Jc(this.modified),this.originalObs=Jc(this.original),this.modifiedModel=this.modifiedObs.model,this.modifiedSelections=Bi(this,this.modified.onDidChangeCursorSelection,()=>this.modified.getSelections()??[]),this.modifiedCursor=$u({owner:this,equalsFn:he.equals},l=>this.modifiedSelections.read(l)[0]?.getPosition()??new he(1,1)),this.originalCursor=Bi(this,this.original.onDidChangeCursorPosition,()=>this.original.getPosition()??new he(1,1)),this._argCodeEditorWidgetOptions=null,this._register(lO({createEmptyChangeSummary:()=>({}),handleChange:(l,c)=>(l.didChange(i.editorOptions)&&Object.assign(c,l.change.changedOptions),!0)},(l,c)=>{i.editorOptions.read(l),this._options.renderSideBySide.read(l),this.modified.updateOptions(this._adjustOptionsForRightHandSide(l,c)),this.original.updateOptions(this._adjustOptionsForLeftHandSide(l,c))}))}_createLeftHandSideEditor(e,t){const i=this._adjustOptionsForLeftHandSide(void 0,e),r=this._constructInnerEditor(this._instantiationService,this.originalEditorElement,i,t);return r.setContextValue("isInDiffLeftEditor",!0),r}_createRightHandSideEditor(e,t){const i=this._adjustOptionsForRightHandSide(void 0,e),r=this._constructInnerEditor(this._instantiationService,this.modifiedEditorElement,i,t);return r.setContextValue("isInDiffRightEditor",!0),r}_constructInnerEditor(e,t,i,r){const s=this._createInnerEditor(e,t,i,r);return this._register(s.onDidContentSizeChange(o=>{const a=this.original.getContentWidth()+this.modified.getContentWidth()+eR.ENTIRE_DIFF_OVERVIEW_WIDTH,l=Math.max(this.modified.getContentHeight(),this.original.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:l,contentWidth:a,contentHeightChanged:o.contentHeightChanged,contentWidthChanged:o.contentWidthChanged})})),s}_adjustOptionsForLeftHandSide(e,t){const i=this._adjustOptionsForSubEditor(t);return this._options.renderSideBySide.get()?(i.unicodeHighlight=this._options.editorOptions.get().unicodeHighlight||{},i.wordWrapOverride1=this._options.diffWordWrap.get()):(i.wordWrapOverride1="off",i.wordWrapOverride2="off",i.stickyScroll={enabled:!1},i.unicodeHighlight={nonBasicASCII:!1,ambiguousCharacters:!1,invisibleCharacters:!1}),i.glyphMargin=this._options.renderSideBySide.get(),t.originalAriaLabel&&(i.ariaLabel=t.originalAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.readOnly=!this._options.originalEditable.get(),i.dropIntoEditor={enabled:!i.readOnly},i.extraEditorClassName="original-in-monaco-diff-editor",i}_adjustOptionsForRightHandSide(e,t){const i=this._adjustOptionsForSubEditor(t);return t.modifiedAriaLabel&&(i.ariaLabel=t.modifiedAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.wordWrapOverride1=this._options.diffWordWrap.get(),i.revealHorizontalRightPadding=Mg.revealHorizontalRightPadding.defaultValue+eR.ENTIRE_DIFF_OVERVIEW_WIDTH,i.scrollbar.verticalHasArrows=!1,i.extraEditorClassName="modified-in-monaco-diff-editor",i}_adjustOptionsForSubEditor(e){const t={...e,dimension:{height:0,width:0}};return t.inDiffEditor=!0,t.automaticLayout=!1,t.scrollbar={...t.scrollbar||{}},t.folding=!1,t.codeLens=this._options.diffCodeLens.get(),t.fixedOverflowWidgets=!0,t.minimap={...t.minimap||{}},t.minimap.enabled=!1,this._options.hideUnchangedRegions.get()?t.stickyScroll={enabled:!1}:t.stickyScroll=this._options.editorOptions.get().stickyScroll,t}_updateAriaLabel(e){e||(e="");const t=w("diff-aria-navigation-tip"," use {0} to open the accessibility help.",this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel());return this._options.accessibilityVerbose.get()?e+t:e?e.replaceAll(t,""):""}};eee=_Pt([tCe(5,Tt),tCe(6,xi)],eee);class due extends me{constructor(){super(...arguments),this._id=++due.idCounter,this._onDidDispose=this._register(new fe),this.onDidDispose=this._onDidDispose.event}static{this.idCounter=0}getId(){return this.getEditorType()+":v2:"+this._id}getVisibleColumnFromPosition(e){return this._targetEditor.getVisibleColumnFromPosition(e)}getPosition(){return this._targetEditor.getPosition()}setPosition(e,t="api"){this._targetEditor.setPosition(e,t)}revealLine(e,t=0){this._targetEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._targetEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._targetEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._targetEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._targetEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._targetEditor.revealPositionNearTop(e,t)}getSelection(){return this._targetEditor.getSelection()}getSelections(){return this._targetEditor.getSelections()}setSelection(e,t="api"){this._targetEditor.setSelection(e,t)}setSelections(e,t="api"){this._targetEditor.setSelections(e,t)}revealLines(e,t,i=0){this._targetEditor.revealLines(e,t,i)}revealLinesInCenter(e,t,i=0){this._targetEditor.revealLinesInCenter(e,t,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._targetEditor.revealLinesInCenterIfOutsideViewport(e,t,i)}revealLinesNearTop(e,t,i=0){this._targetEditor.revealLinesNearTop(e,t,i)}revealRange(e,t=0,i=!1,r=!0){this._targetEditor.revealRange(e,t,i,r)}revealRangeInCenter(e,t=0){this._targetEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._targetEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._targetEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._targetEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._targetEditor.getSupportedActions()}focus(){this._targetEditor.focus()}trigger(e,t,i){this._targetEditor.trigger(e,t,i)}createDecorationsCollection(e){return this._targetEditor.createDecorationsCollection(e)}changeDecorations(e){return this._targetEditor.changeDecorations(e)}}var vPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},bPt=function(n,e){return function(t,i){e(t,i,n)}};let tee=class{get editorOptions(){return this._options}constructor(e,t){this._accessibilityService=t,this._diffEditorWidth=kn(this,0),this._screenReaderMode=Bi(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this.couldShowInlineViewBecauseOfSize=St(this,r=>this._options.read(r).renderSideBySide&&this._diffEditorWidth.read(r)<=this._options.read(r).renderSideBySideInlineBreakpoint),this.renderOverviewRuler=St(this,r=>this._options.read(r).renderOverviewRuler),this.renderSideBySide=St(this,r=>this.compactMode.read(r)&&this.shouldRenderInlineViewInSmartMode.read(r)?!1:this._options.read(r).renderSideBySide&&!(this._options.read(r).useInlineViewWhenSpaceIsLimited&&this.couldShowInlineViewBecauseOfSize.read(r)&&!this._screenReaderMode.read(r))),this.readOnly=St(this,r=>this._options.read(r).readOnly),this.shouldRenderOldRevertArrows=St(this,r=>!(!this._options.read(r).renderMarginRevertIcon||!this.renderSideBySide.read(r)||this.readOnly.read(r)||this.shouldRenderGutterMenu.read(r))),this.shouldRenderGutterMenu=St(this,r=>this._options.read(r).renderGutterMenu),this.renderIndicators=St(this,r=>this._options.read(r).renderIndicators),this.enableSplitViewResizing=St(this,r=>this._options.read(r).enableSplitViewResizing),this.splitViewDefaultRatio=St(this,r=>this._options.read(r).splitViewDefaultRatio),this.ignoreTrimWhitespace=St(this,r=>this._options.read(r).ignoreTrimWhitespace),this.maxComputationTimeMs=St(this,r=>this._options.read(r).maxComputationTime),this.showMoves=St(this,r=>this._options.read(r).experimental.showMoves&&this.renderSideBySide.read(r)),this.isInEmbeddedEditor=St(this,r=>this._options.read(r).isInEmbeddedEditor),this.diffWordWrap=St(this,r=>this._options.read(r).diffWordWrap),this.originalEditable=St(this,r=>this._options.read(r).originalEditable),this.diffCodeLens=St(this,r=>this._options.read(r).diffCodeLens),this.accessibilityVerbose=St(this,r=>this._options.read(r).accessibilityVerbose),this.diffAlgorithm=St(this,r=>this._options.read(r).diffAlgorithm),this.showEmptyDecorations=St(this,r=>this._options.read(r).experimental.showEmptyDecorations),this.onlyShowAccessibleDiffViewer=St(this,r=>this._options.read(r).onlyShowAccessibleDiffViewer),this.compactMode=St(this,r=>this._options.read(r).compactMode),this.trueInlineDiffRenderingEnabled=St(this,r=>this._options.read(r).experimental.useTrueInlineView),this.useTrueInlineDiffRendering=St(this,r=>!this.renderSideBySide.read(r)&&this.trueInlineDiffRenderingEnabled.read(r)),this.hideUnchangedRegions=St(this,r=>this._options.read(r).hideUnchangedRegions.enabled),this.hideUnchangedRegionsRevealLineCount=St(this,r=>this._options.read(r).hideUnchangedRegions.revealLineCount),this.hideUnchangedRegionsContextLineCount=St(this,r=>this._options.read(r).hideUnchangedRegions.contextLineCount),this.hideUnchangedRegionsMinimumLineCount=St(this,r=>this._options.read(r).hideUnchangedRegions.minimumLineCount),this._model=kn(this,void 0),this.shouldRenderInlineViewInSmartMode=this._model.map(this,r=>MSt(this,s=>{const o=r?.diff.read(s);return o?yPt(o,this.trueInlineDiffRenderingEnabled.read(s)):void 0})).flatten().map(this,r=>!!r),this.inlineViewHideOriginalLineNumbers=this.compactMode;const i={...e,...nCe(e,la)};this._options=kn(this,i)}updateOptions(e){const t=nCe(e,this._options.get()),i={...this._options.get(),...e,...t};this._options.set(i,void 0,{changedOptions:e})}setWidth(e){this._diffEditorWidth.set(e,void 0)}setModel(e){this._model.set(e,void 0)}};tee=vPt([bPt(1,_u)],tee);function yPt(n,e){return n.mappings.every(t=>wPt(t.lineRangeMapping)||CPt(t.lineRangeMapping)||e&&cue(t.lineRangeMapping))}function wPt(n){return n.original.length===0}function CPt(n){return n.modified.length===0}function nCe(n,e){return{enableSplitViewResizing:Et(n.enableSplitViewResizing,e.enableSplitViewResizing),splitViewDefaultRatio:Cpt(n.splitViewDefaultRatio,.5,.1,.9),renderSideBySide:Et(n.renderSideBySide,e.renderSideBySide),renderMarginRevertIcon:Et(n.renderMarginRevertIcon,e.renderMarginRevertIcon),maxComputationTime:V1(n.maxComputationTime,e.maxComputationTime,0,1073741824),maxFileSize:V1(n.maxFileSize,e.maxFileSize,0,1073741824),ignoreTrimWhitespace:Et(n.ignoreTrimWhitespace,e.ignoreTrimWhitespace),renderIndicators:Et(n.renderIndicators,e.renderIndicators),originalEditable:Et(n.originalEditable,e.originalEditable),diffCodeLens:Et(n.diffCodeLens,e.diffCodeLens),renderOverviewRuler:Et(n.renderOverviewRuler,e.renderOverviewRuler),diffWordWrap:is(n.diffWordWrap,e.diffWordWrap,["off","on","inherit"]),diffAlgorithm:is(n.diffAlgorithm,e.diffAlgorithm,["legacy","advanced"],{smart:"legacy",experimental:"advanced"}),accessibilityVerbose:Et(n.accessibilityVerbose,e.accessibilityVerbose),experimental:{showMoves:Et(n.experimental?.showMoves,e.experimental.showMoves),showEmptyDecorations:Et(n.experimental?.showEmptyDecorations,e.experimental.showEmptyDecorations),useTrueInlineView:Et(n.experimental?.useTrueInlineView,e.experimental.useTrueInlineView)},hideUnchangedRegions:{enabled:Et(n.hideUnchangedRegions?.enabled??n.experimental?.collapseUnchangedRegions,e.hideUnchangedRegions.enabled),contextLineCount:V1(n.hideUnchangedRegions?.contextLineCount,e.hideUnchangedRegions.contextLineCount,0,1073741824),minimumLineCount:V1(n.hideUnchangedRegions?.minimumLineCount,e.hideUnchangedRegions.minimumLineCount,0,1073741824),revealLineCount:V1(n.hideUnchangedRegions?.revealLineCount,e.hideUnchangedRegions.revealLineCount,0,1073741824)},isInEmbeddedEditor:Et(n.isInEmbeddedEditor,e.isInEmbeddedEditor),onlyShowAccessibleDiffViewer:Et(n.onlyShowAccessibleDiffViewer,e.onlyShowAccessibleDiffViewer),renderSideBySideInlineBreakpoint:V1(n.renderSideBySideInlineBreakpoint,e.renderSideBySideInlineBreakpoint,0,1073741824),useInlineViewWhenSpaceIsLimited:Et(n.useInlineViewWhenSpaceIsLimited,e.useInlineViewWhenSpaceIsLimited),renderGutterMenu:Et(n.renderGutterMenu,e.renderGutterMenu),compactMode:Et(n.compactMode,e.compactMode)}}var xPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},VT=function(n,e){return function(t,i){e(t,i,n)}};let e0=class extends due{get onDidContentSizeChange(){return this._editors.onDidContentSizeChange}constructor(e,t,i,r,s,o,a,l){super(),this._domElement=e,this._parentContextKeyService=r,this._parentInstantiationService=s,this._accessibilitySignalService=a,this._editorProgressService=l,this.elements=An("div.monaco-diff-editor.side-by-side",{style:{position:"relative",height:"100%"}},[An("div.editor.original@original",{style:{position:"absolute",height:"100%"}}),An("div.editor.modified@modified",{style:{position:"absolute",height:"100%"}}),An("div.accessibleDiffViewer@accessibleDiffViewer",{style:{position:"absolute",height:"100%"}})]),this._diffModelSrc=this._register(TN(this,void 0)),this._diffModel=St(this,C=>this._diffModelSrc.read(C)?.object),this.onDidChangeModel=Ge.fromObservableLight(this._diffModel),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._domElement)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new c2([jt,this._contextKeyService]))),this._boundarySashes=kn(this,void 0),this._accessibleDiffViewerShouldBeVisible=kn(this,!1),this._accessibleDiffViewerVisible=St(this,C=>this._options.onlyShowAccessibleDiffViewer.read(C)?!0:this._accessibleDiffViewerShouldBeVisible.read(C)),this._movedBlocksLinesPart=kn(this,void 0),this._layoutInfo=St(this,C=>{const x=this._rootSizeObserver.width.read(C),k=this._rootSizeObserver.height.read(C);this._rootSizeObserver.automaticLayout?this.elements.root.style.height="100%":this.elements.root.style.height=k+"px";const L=this._sash.read(C),D=this._gutter.read(C),I=D?.width.read(C)??0,O=this._overviewRulerPart.read(C)?.width??0;let M,B,G,W,z;if(!!L){const ee=L.sashLeft.read(C),Z=this._movedBlocksLinesPart.read(C)?.width.read(C)??0;M=0,B=ee-I-Z,z=ee-I,G=ee,W=x-G-O}else{z=0;const ee=this._options.inlineViewHideOriginalLineNumbers.read(C);M=I,ee?B=0:B=Math.max(5,this._editors.originalObs.layoutInfoDecorationsLeft.read(C)),G=I+B,W=x-G-O}return this.elements.original.style.left=M+"px",this.elements.original.style.width=B+"px",this._editors.original.layout({width:B,height:k},!0),D?.layout(z),this.elements.modified.style.left=G+"px",this.elements.modified.style.width=W+"px",this._editors.modified.layout({width:W,height:k},!0),{modifiedEditor:this._editors.modified.getLayoutInfo(),originalEditor:this._editors.original.getLayoutInfo()}}),this._diffValue=this._diffModel.map((C,x)=>C?.diff.read(x)),this.onDidUpdateDiff=Ge.fromObservableLight(this._diffValue),o.willCreateDiffEditor(),this._contextKeyService.createKey("isInDiffEditor",!0),this._domElement.appendChild(this.elements.root),this._register(Lt(()=>this.elements.root.remove())),this._rootSizeObserver=this._register(new S8e(this.elements.root,t.dimension)),this._rootSizeObserver.setAutomaticLayout(t.automaticLayout??!1),this._options=this._instantiationService.createInstance(tee,t),this._register(tn(C=>{this._options.setWidth(this._rootSizeObserver.width.read(C))})),this._contextKeyService.createKey(Q.isEmbeddedDiffEditor.key,!1),this._register(Rf(Q.isEmbeddedDiffEditor,this._contextKeyService,C=>this._options.isInEmbeddedEditor.read(C))),this._register(Rf(Q.comparingMovedCode,this._contextKeyService,C=>!!this._diffModel.read(C)?.movedTextToCompare.read(C))),this._register(Rf(Q.diffEditorRenderSideBySideInlineBreakpointReached,this._contextKeyService,C=>this._options.couldShowInlineViewBecauseOfSize.read(C))),this._register(Rf(Q.diffEditorInlineMode,this._contextKeyService,C=>!this._options.renderSideBySide.read(C))),this._register(Rf(Q.hasChanges,this._contextKeyService,C=>(this._diffModel.read(C)?.diff.read(C)?.mappings.length??0)>0)),this._editors=this._register(this._instantiationService.createInstance(eee,this.elements.original,this.elements.modified,this._options,i,(C,x,k,L)=>this._createInnerEditor(C,x,k,L))),this._register(Rf(Q.diffEditorOriginalWritable,this._contextKeyService,C=>this._options.originalEditable.read(C))),this._register(Rf(Q.diffEditorModifiedWritable,this._contextKeyService,C=>!this._options.readOnly.read(C))),this._register(Rf(Q.diffEditorOriginalUri,this._contextKeyService,C=>this._diffModel.read(C)?.model.original.uri.toString()??"")),this._register(Rf(Q.diffEditorModifiedUri,this._contextKeyService,C=>this._diffModel.read(C)?.model.modified.uri.toString()??"")),this._overviewRulerPart=hl(this,C=>this._options.renderOverviewRuler.read(C)?this._instantiationService.createInstance(Yc(eR,C),this._editors,this.elements.root,this._diffModel,this._rootSizeObserver.width,this._rootSizeObserver.height,this._layoutInfo.map(x=>x.modifiedEditor)):void 0).recomputeInitiallyAndOnChange(this._store);const c={height:this._rootSizeObserver.height,width:this._rootSizeObserver.width.map((C,x)=>C-(this._overviewRulerPart.read(x)?.width??0))};this._sashLayout=new oPt(this._options,c),this._sash=hl(this,C=>{const x=this._options.renderSideBySide.read(C);return this.elements.root.classList.toggle("side-by-side",x),x?new D8e(this.elements.root,c,this._options.enableSplitViewResizing,this._boundarySashes,this._sashLayout.sashLeft,()=>this._sashLayout.resetSash()):void 0}).recomputeInitiallyAndOnChange(this._store);const u=hl(this,C=>this._instantiationService.createInstance(Yc(C9,C),this._editors,this._diffModel,this._options)).recomputeInitiallyAndOnChange(this._store);hl(this,C=>this._instantiationService.createInstance(Yc(sPt,C),this._editors,this._diffModel,this._options,this)).recomputeInitiallyAndOnChange(this._store);const d=new Set,h=new Set;let f=!1;const g=hl(this,C=>this._instantiationService.createInstance(Yc(ZJ,C),Ot(this._domElement),this._editors,this._diffModel,this._options,this,()=>f||u.get().isUpdatingHiddenAreas,d,h)).recomputeInitiallyAndOnChange(this._store),p=St(this,C=>{const x=g.read(C).viewZones.read(C).orig,k=u.read(C).viewZones.read(C).origViewZones;return x.concat(k)}),m=St(this,C=>{const x=g.read(C).viewZones.read(C).mod,k=u.read(C).viewZones.read(C).modViewZones;return x.concat(k)});this._register(_9(this._editors.original,p,C=>{f=C},d));let _;this._register(_9(this._editors.modified,m,C=>{f=C,f?_=Ag.capture(this._editors.modified):(_?.restore(this._editors.modified),_=void 0)},h)),this._accessibleDiffViewer=hl(this,C=>this._instantiationService.createInstance(Yc(Py,C),this.elements.accessibleDiffViewer,this._accessibleDiffViewerVisible,(x,k)=>this._accessibleDiffViewerShouldBeVisible.set(x,k),this._options.onlyShowAccessibleDiffViewer.map(x=>!x),this._rootSizeObserver.width,this._rootSizeObserver.height,this._diffModel.map((x,k)=>x?.diff.read(k)?.mappings.map(L=>L.lineRangeMapping)),new KRt(this._editors))).recomputeInitiallyAndOnChange(this._store);const v=this._accessibleDiffViewerVisible.map(C=>C?"hidden":"visible");this._register(J_(this.elements.modified,{visibility:v})),this._register(J_(this.elements.original,{visibility:v})),this._createDiffEditorContributions(),o.addDiffEditor(this),this._gutter=hl(this,C=>this._options.shouldRenderGutterMenu.read(C)?this._instantiationService.createInstance(Yc(XJ,C),this.elements.root,this._diffModel,this._editors,this._options,this._sashLayout,this._boundarySashes):void 0),this._register(s2(this._layoutInfo)),hl(this,C=>new(Yc(rw,C))(this.elements.root,this._diffModel,this._layoutInfo.map(x=>x.originalEditor),this._layoutInfo.map(x=>x.modifiedEditor),this._editors)).recomputeInitiallyAndOnChange(this._store,C=>{this._movedBlocksLinesPart.set(C,void 0)}),this._register(Ge.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition,C=>this._handleCursorPositionChange(C,!0))),this._register(Ge.runAndSubscribe(this._editors.original.onDidChangeCursorPosition,C=>this._handleCursorPositionChange(C,!1)));const y=this._diffModel.map(this,(C,x)=>{if(C)return C.diff.read(x)===void 0&&!C.isDiffUpToDate.read(x)});this._register(wc((C,x)=>{if(y.read(C)===!0){const k=this._editorProgressService.show(!0,1e3);x.add(Lt(()=>k.done()))}})),this._register(wc((C,x)=>{x.add(new(Yc(pPt,C))(this._editors,this._diffModel,this._options,this))})),this._register(wc((C,x)=>{const k=this._diffModel.read(C);if(k)for(const L of[k.model.original,k.model.modified])x.add(L.onWillDispose(D=>{rn(new fi("TextModel got disposed before DiffEditorWidget model got reset")),this.setModel(null)}))})),this._register(tn(C=>{this._options.setModel(this._diffModel.read(C))}))}_createInnerEditor(e,t,i,r){return e.createInstance(ZN,t,i,r)}_createDiffEditorContributions(){const e=Zy.getDiffEditorContributions();for(const t of e)try{this._register(this._instantiationService.createInstance(t.ctor,this))}catch(i){rn(i)}}get _targetEditor(){return this._editors.modified}getEditorType(){return pO.IDiffEditor}layout(e){this._rootSizeObserver.observe(e)}hasTextFocus(){return this._editors.original.hasTextFocus()||this._editors.modified.hasTextFocus()}saveViewState(){const e=this._editors.original.saveViewState(),t=this._editors.modified.saveViewState();return{original:e,modified:t,modelState:this._diffModel.get()?.serializeState()}}restoreViewState(e){if(e&&e.original&&e.modified){const t=e;this._editors.original.restoreViewState(t.original),this._editors.modified.restoreViewState(t.modified),t.modelState&&this._diffModel.get()?.restoreSerializedState(t.modelState)}}handleInitialized(){this._editors.original.handleInitialized(),this._editors.modified.handleInitialized()}createViewModel(e){return this._instantiationService.createInstance(YJ,e,this._options)}getModel(){return this._diffModel.get()?.model??null}setModel(e){const t=e?"model"in e?v9.create(e).createNewRef(this):v9.create(this.createViewModel(e),this):null;this.setDiffModel(t)}setDiffModel(e,t){const i=this._diffModel.get();!e&&i&&this._accessibleDiffViewer.get().close(),this._diffModel.get()!==e?.object&&Fw(t,r=>{const s=e?.object;Bi.batchEventsGlobally(r,()=>{this._editors.original.setModel(s?s.model.original:null),this._editors.modified.setModel(s?s.model.modified:null)});const o=this._diffModelSrc.get()?.createNewRef(this);this._diffModelSrc.set(e?.createNewRef(this),r),setTimeout(()=>{o?.dispose()},0)})}updateOptions(e){this._options.updateOptions(e)}getContainerDomNode(){return this._domElement}getOriginalEditor(){return this._editors.original}getModifiedEditor(){return this._editors.modified}getLineChanges(){const e=this._diffModel.get()?.diff.get();return e?SPt(e):null}revert(e){const t=this._diffModel.get();!t||!t.isDiffUpToDate.get()||this._editors.modified.executeEdits("diffEditor",[{range:e.modified.toExclusiveRange(),text:t.model.original.getValueInRange(e.original.toExclusiveRange())}])}revertRangeMappings(e){const t=this._diffModel.get();if(!t||!t.isDiffUpToDate.get())return;const i=e.map(r=>({range:r.modifiedRange,text:t.model.original.getValueInRange(r.originalRange)}));this._editors.modified.executeEdits("diffEditor",i)}_goTo(e){this._editors.modified.setPosition(new he(e.lineRangeMapping.modified.startLineNumber,1)),this._editors.modified.revealRangeInCenter(e.lineRangeMapping.modified.toExclusiveRange())}goToDiff(e){const t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;const i=this._editors.modified.getPosition().lineNumber;let r;e==="next"?r=t.find(s=>s.lineRangeMapping.modified.startLineNumber>i)??t[0]:r=hN(t,s=>s.lineRangeMapping.modified.startLineNumber{const t=e.diff.get()?.mappings;!t||t.length===0||this._goTo(t[0])})}accessibleDiffViewerNext(){this._accessibleDiffViewer.get().next()}accessibleDiffViewerPrev(){this._accessibleDiffViewer.get().prev()}async waitForDiff(){const e=this._diffModel.get();e&&await e.waitForDiff()}mapToOtherSide(){const e=this._editors.modified.hasWidgetFocus(),t=e?this._editors.modified:this._editors.original,i=e?this._editors.original:this._editors.modified;let r;const s=t.getSelection();if(s){const o=this._diffModel.get()?.diff.get()?.mappings.map(a=>e?a.lineRangeMapping.flip():a.lineRangeMapping);if(o){const a=Wwe(s.getStartPosition(),o),l=Wwe(s.getEndPosition(),o);r=$.plusRange(a,l)}}return{destination:i,destinationSelection:r}}switchSide(){const{destination:e,destinationSelection:t}=this.mapToOtherSide();e.focus(),t&&e.setSelection(t)}exitCompareMove(){const e=this._diffModel.get();e&&e.movedTextToCompare.set(void 0,void 0)}collapseAllUnchangedRegions(){const e=this._diffModel.get()?.unchangedRegions.get();e&&qr(t=>{for(const i of e)i.collapseAll(t)})}showAllUnchangedRegions(){const e=this._diffModel.get()?.unchangedRegions.get();e&&qr(t=>{for(const i of e)i.showAll(t)})}_handleCursorPositionChange(e,t){if(e?.reason===3){const i=this._diffModel.get()?.diff.get()?.mappings.find(r=>t?r.lineRangeMapping.modified.contains(e.position.lineNumber):r.lineRangeMapping.original.contains(e.position.lineNumber));i?.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal(Ai.diffLineDeleted,{source:"diffEditor.cursorPositionChanged"}):i?.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal(Ai.diffLineInserted,{source:"diffEditor.cursorPositionChanged"}):i&&this._accessibilitySignalService.playSignal(Ai.diffLineModified,{source:"diffEditor.cursorPositionChanged"})}}};e0=xPt([VT(3,jt),VT(4,Tt),VT(5,ai),VT(6,t1),VT(7,Qb)],e0);function SPt(n){return n.mappings.map(e=>{const t=e.lineRangeMapping;let i,r,s,o,a=t.innerChanges;return t.original.isEmpty?(i=t.original.startLineNumber-1,r=0,a=void 0):(i=t.original.startLineNumber,r=t.original.endLineNumberExclusive-1),t.modified.isEmpty?(s=t.modified.startLineNumber-1,o=0,a=void 0):(s=t.modified.startLineNumber,o=t.modified.endLineNumberExclusive-1),{originalStartLineNumber:i,originalEndLineNumber:r,modifiedStartLineNumber:s,modifiedEndLineNumber:o,charChanges:a?.map(l=>({originalStartLineNumber:l.originalRange.startLineNumber,originalStartColumn:l.originalRange.startColumn,originalEndLineNumber:l.originalRange.endLineNumber,originalEndColumn:l.originalRange.endColumn,modifiedStartLineNumber:l.modifiedRange.startLineNumber,modifiedStartColumn:l.modifiedRange.startColumn,modifiedEndLineNumber:l.modifiedRange.endLineNumber,modifiedEndColumn:l.modifiedRange.endColumn}))}})}var hue=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},br=function(n,e){return function(t,i){e(t,i,n)}};let kPt=0,iCe=!1;function EPt(n){if(!n){if(iCe)return;iCe=!0}Lxt(n||Xi.document.body)}let S9=class extends ZN{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f){const g={...t};g.ariaLabel=g.ariaLabel||mQ.editorViewAccessibleLabel,super(e,g,{},i,r,s,o,c,u,d,h,f),l instanceof CE?this._standaloneKeybindingService=l:this._standaloneKeybindingService=null,EPt(g.ariaContainerElement),HSt((p,m)=>i.createInstance(uE,p,m,{})),VSt(a)}addCommand(e,t,i){if(!this._standaloneKeybindingService)return console.warn("Cannot add command because the editor is configured with an unrecognized KeybindingService"),null;const r="DYNAMIC_"+ ++kPt,s=Le.deserialize(i);return this._standaloneKeybindingService.addDynamicKeybinding(r,e,t,s),r}createContextKey(e,t){return this._contextKeyService.createKey(e,t)}addAction(e){if(typeof e.id!="string"||typeof e.label!="string"||typeof e.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");if(!this._standaloneKeybindingService)return console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),me.None;const t=e.id,i=e.label,r=Le.and(Le.equals("editorId",this.getId()),Le.deserialize(e.precondition)),s=e.keybindings,o=Le.and(r,Le.deserialize(e.keybindingContext)),a=e.contextMenuGroupId||null,l=e.contextMenuOrder||0,c=(f,...g)=>Promise.resolve(e.run(this,...g)),u=new ke,d=this.getId()+":"+t;if(u.add(Un.registerCommand(d,c)),a){const f={command:{id:d,title:i},when:r,group:a,order:l};u.add(Fo.appendMenuItem(ce.EditorContext,f))}if(Array.isArray(s))for(const f of s)u.add(this._standaloneKeybindingService.addDynamicKeybinding(d,f,c,o));const h=new b8e(d,i,i,void 0,r,(...f)=>Promise.resolve(e.run(this,...f)),this._contextKeyService);return this._actions.set(t,h),u.add(Lt(()=>{this._actions.delete(t)})),u}_triggerCommand(e,t){if(this._codeEditorService instanceof a8)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};S9=hue([br(2,Tt),br(3,ai),br(4,_r),br(5,jt),br(6,um),br(7,xi),br(8,go),br(9,Ts),br(10,_u),br(11,Zr),br(12,dt)],S9);let nee=class extends S9{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f,g,p,m){const _={...t};a9(d,_,!1);const v=c.registerEditorContainer(e);typeof _.theme=="string"&&c.setTheme(_.theme),typeof _.autoDetectHighContrast<"u"&&c.setAutoDetectHighContrast(!!_.autoDetectHighContrast);const y=_.model;delete _.model,super(e,_,i,r,s,o,a,l,c,u,h,p,m),this._configurationService=d,this._standaloneThemeService=c,this._register(v);let C;if(typeof y>"u"){const x=g.getLanguageIdByMimeType(_.language)||_.language||Hl;C=R8e(f,g,_.value||"",x,void 0),this._ownsModel=!0}else C=y,this._ownsModel=!1;if(this._attachModel(C),C){const x={oldModelUrl:null,newModelUrl:C.uri};this._onDidChangeModel.fire(x)}}dispose(){super.dispose()}updateOptions(e){a9(this._configurationService,e,!1),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_postDetachModelCleanup(e){super._postDetachModelCleanup(e),e&&this._ownsModel&&(e.dispose(),this._ownsModel=!1)}};nee=hue([br(2,Tt),br(3,ai),br(4,_r),br(5,jt),br(6,um),br(7,xi),br(8,hd),br(9,Ts),br(10,En),br(11,_u),br(12,Sr),br(13,Hr),br(14,Zr),br(15,dt)],nee);let iee=class extends e0{constructor(e,t,i,r,s,o,a,l,c,u,d,h){const f={...t};a9(l,f,!0);const g=o.registerEditorContainer(e);typeof f.theme=="string"&&o.setTheme(f.theme),typeof f.autoDetectHighContrast<"u"&&o.setAutoDetectHighContrast(!!f.autoDetectHighContrast),super(e,f,{},r,i,s,h,u),this._configurationService=l,this._standaloneThemeService=o,this._register(g)}dispose(){super.dispose()}updateOptions(e){a9(this._configurationService,e,!0),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_createInnerEditor(e,t,i){return e.createInstance(S9,t,i)}getOriginalEditor(){return super.getOriginalEditor()}getModifiedEditor(){return super.getModifiedEditor()}addCommand(e,t,i){return this.getModifiedEditor().addCommand(e,t,i)}createContextKey(e,t){return this.getModifiedEditor().createContextKey(e,t)}addAction(e){return this.getModifiedEditor().addAction(e)}};iee=hue([br(2,Tt),br(3,jt),br(4,ai),br(5,hd),br(6,Ts),br(7,En),br(8,mu),br(9,Qb),br(10,b0),br(11,t1)],iee);function R8e(n,e,t,i,r){if(t=t||"",!i){const s=t.indexOf(` +`);let o=t;return s!==-1&&(o=t.substring(0,s)),rCe(n,t,e.createByFilepathOrFirstLine(r||null,o),r)}return rCe(n,t,e.createById(i),r)}function rCe(n,e,t,i){return n.createModel(e,t,i)}var LPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},sCe=function(n,e){return function(t,i){e(t,i,n)}};class TPt{constructor(e,t){this.viewModel=e,this.deltaScrollVertical=t}getId(){return this.viewModel}}let k9=class extends me{constructor(e,t,i,r,s){super(),this._container=e,this._overflowWidgetsDomNode=t,this._workbenchUIElementFactory=i,this._instantiationService=r,this._viewModel=kn(this,void 0),this._collapsed=St(this,l=>this._viewModel.read(l)?.collapsed.read(l)),this._editorContentHeight=kn(this,500),this.contentHeight=St(this,l=>(this._collapsed.read(l)?0:this._editorContentHeight.read(l))+this._outerEditorHeight),this._modifiedContentWidth=kn(this,0),this._modifiedWidth=kn(this,0),this._originalContentWidth=kn(this,0),this._originalWidth=kn(this,0),this.maxScroll=St(this,l=>{const c=this._modifiedContentWidth.read(l)-this._modifiedWidth.read(l),u=this._originalContentWidth.read(l)-this._originalWidth.read(l);return c>u?{maxScroll:c,width:this._modifiedWidth.read(l)}:{maxScroll:u,width:this._originalWidth.read(l)}}),this._elements=An("div.multiDiffEntry",[An("div.header@header",[An("div.header-content",[An("div.collapse-button@collapseButton"),An("div.file-path",[An("div.title.modified.show-file-icons@primaryPath",[]),An("div.status.deleted@status",["R"]),An("div.title.original.show-file-icons@secondaryPath",[])]),An("div.actions@actions")])]),An("div.editorParent",[An("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(e0,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode},{})),this.isModifedFocused=Jc(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=Jc(this.editor.getOriginalEditor()).isFocused,this.isFocused=St(this,l=>this.isModifedFocused.read(l)||this.isOriginalFocused.read(l)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new ke),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;const o=new V8(this._elements.collapseButton,{});this._register(tn(l=>{o.element.className="",o.icon=this._collapsed.read(l)?ze.chevronRight:ze.chevronDown})),this._register(o.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._register(tn(l=>{this._elements.editor.style.display=this._collapsed.read(l)?"none":"block"})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(l=>{const c=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(c,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(l=>{const c=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(c,void 0)})),this._register(this.editor.onDidContentSizeChange(l=>{ID(c=>{this._editorContentHeight.set(l.contentHeight,c),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),c),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),c)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(l=>{if(this._isSettingScrollTop||!l.scrollTopChanged||!this._data)return;const c=l.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(c)})),this._register(tn(l=>{const c=this._viewModel.read(l)?.isActive.read(l);this._elements.root.classList.toggle("active",c)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(s.createScoped(this._elements.actions));const a=this._register(this._instantiationService.createChild(new c2([jt,this._contextKeyService])));this._register(a.createInstance(w9,this._elements.actions,ce.MultiDiffEditorFileToolbar,{actionRunner:this._register(new I8e(()=>this._viewModel.get()?.modifiedUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:l=>l.startsWith("navigation")},actionViewItemProvider:(l,c)=>xFe(a,l,c)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){this._data=e;function t(r){return{...r,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(!e){ID(r=>{this._viewModel.set(void 0,r),this.editor.setDiffModel(null,r),this._dataStore.clear()});return}const i=e.viewModel.documentDiffItem;if(ID(r=>{this._resourceLabel?.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:e.viewModel.modifiedUri===void 0});let s=!1,o=!1,a=!1,l="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(l="R",s=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(l="A",a=!0):(l="D",o=!0),this._elements.status.classList.toggle("renamed",s),this._elements.status.classList.toggle("deleted",o),this._elements.status.classList.toggle("added",a),this._elements.status.innerText=l,this._resourceLabel2?.setUri(s?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,r),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,r),this.editor.updateOptions(t(i.options??{}))}),i.onOptionsDidChange&&this._dataStore.add(i.onOptionsDidChange(()=>{this.editor.updateOptions(t(i.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,r=>{r||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(const[r,s]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(r,s)}render(e,t,i,r){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";const s=e.length-this._headerHeight,o=Math.max(0,Math.min(r.start-e.start,s));this._elements.header.style.transform=`translateY(${o}px)`,ID(a=>{this.editor.layout({width:t-2*8-2*1,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=i,this.editor.getOriginalEditor().setScrollTop(i)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",o>0||i>0),this._elements.header.classList.toggle("collapsed",o===s)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};k9=LPt([sCe(3,Tt),sCe(4,jt)],k9);class DPt{constructor(e){this._create=e,this._unused=new Set,this._used=new Set,this._itemData=new Map}getUnusedObj(e){let t;if(this._unused.size===0)t=this._create(e),this._itemData.set(t,e);else{const i=[...this._unused.values()];t=i.find(r=>this._itemData.get(r).getId()===e.getId())??i[0],this._unused.delete(t),this._itemData.set(t,e),t.setData(e)}return this._used.add(t),{object:t,dispose:()=>{this._used.delete(t),this._unused.size>5?t.dispose():this._unused.add(t)}}}dispose(){for(const e of this._used)e.dispose();for(const e of this._unused)e.dispose();this._used.clear(),this._unused.clear()}}var IPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},oCe=function(n,e){return function(t,i){e(t,i,n)}};let ree=class extends me{constructor(e,t,i,r,s,o){super(),this._element=e,this._dimension=t,this._viewModel=i,this._workbenchUIElementFactory=r,this._parentContextKeyService=s,this._parentInstantiationService=o,this._scrollableElements=An("div.scrollContent",[An("div@content",{style:{overflow:"hidden"}}),An("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new t2({forceIntegerValues:!1,scheduleAtNextAnimationFrame:l=>du(Ot(this._element),l),smoothScrollDuration:100})),this._scrollableElement=this._register(new fW(this._scrollableElements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this._elements=An("div.monaco-component.multiDiffEditor",{},[An("div",{},[this._scrollableElement.getDomNode()]),An("div.placeholder@placeholder",{},[An("div",[w("noChangedFiles","No Changed Files")])])]),this._sizeObserver=this._register(new S8e(this._element,void 0)),this._objectPool=this._register(new DPt(l=>{const c=this._instantiationService.createInstance(k9,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return c.setData(l),c})),this.scrollTop=Bi(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=Bi(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=Jb(this,(l,c)=>{const u=this._viewModel.read(l);if(!u)return{items:[],getItem:g=>{throw new fi}};const d=u.items.read(l),h=new Map;return{items:d.map(g=>{const p=c.add(new APt(g,this._objectPool,this.scrollLeft,_=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+_})})),m=this._lastDocStates?.[p.getKey()];return m&&qr(_=>{p.setViewState(m,_)}),h.set(g,p),p}),getItem:g=>h.get(g)}}),this._viewItems=this._viewItemsInfo.map(this,l=>l.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(l,c)=>l.reduce((u,d)=>u+d.contentHeight.read(c)+this._spaceBetweenPx,0)),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new c2([jt,this._contextKeyService]))),this._lastDocStates={},this._contextKeyService.createKey(Q.inMultiDiffEditor.key,!0),this._register(wc((l,c)=>{const u=this._viewModel.read(l);if(u&&u.contextKeys)for(const[d,h]of Object.entries(u.contextKeys)){const f=this._contextKeyService.createKey(d,void 0);f.set(h),c.add(Lt(()=>f.reset()))}}));const a=this._parentContextKeyService.createKey(Q.multiDiffEditorAllCollapsed.key,!1);this._register(tn(l=>{const c=this._viewModel.read(l);if(c){const u=c.items.read(l).every(d=>d.collapsed.read(l));a.set(u)}})),this._register(tn(l=>{const c=this._dimension.read(l);this._sizeObserver.observe(c)})),this._register(tn(l=>{const c=this._viewItems.read(l);this._elements.placeholder.classList.toggle("visible",c.length===0)})),this._scrollableElements.content.style.position="relative",this._register(tn(l=>{const c=this._sizeObserver.height.read(l);this._scrollableElements.root.style.height=`${c}px`;const u=this._totalHeight.read(l);this._scrollableElements.content.style.height=`${u}px`;const d=this._sizeObserver.width.read(l);let h=d;const f=this._viewItems.read(l),g=tle(f,$l(p=>p.maxScroll.read(l).maxScroll,Xh));if(g){const p=g.maxScroll.read(l);h=d+p.maxScroll}this._scrollableElement.setScrollDimensions({width:d,height:c,scrollHeight:u,scrollWidth:h})})),e.replaceChildren(this._elements.root),this._register(Lt(()=>{e.replaceChildren()})),this._register(this._register(tn(l=>{ID(c=>{this.render(l)})})))}render(e){const t=this.scrollTop.read(e);let i=0,r=0,s=0;const o=this._sizeObserver.height.read(e),a=Dn.ofStartAndLength(t,o),l=this._sizeObserver.width.read(e);for(const c of this._viewItems.read(e)){const u=c.contentHeight.read(e),d=Math.min(u,o),h=Dn.ofStartAndLength(r,d),f=Dn.ofStartAndLength(s,u);if(f.isBefore(a))i-=u-d,c.hide();else if(f.isAfter(a))c.hide();else{const g=Math.max(0,Math.min(a.start-f.start,u-d));i-=g;const p=Dn.ofStartAndLength(t+i,o);c.render(h,g,l,p)}r+=d+this._spaceBetweenPx,s+=u+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+i)}px)`}};ree=IPt([oCe(4,jt),oCe(5,Tt)],ree);class APt extends me{constructor(e,t,i,r){super(),this.viewModel=e,this._objectPool=t,this._scrollLeft=i,this._deltaScrollVertical=r,this._templateRef=this._register(TN(this,void 0)),this.contentHeight=St(this,s=>this._templateRef.read(s)?.object.contentHeight?.read(s)??this.viewModel.lastTemplateData.read(s).contentHeight),this.maxScroll=St(this,s=>this._templateRef.read(s)?.object.maxScroll.read(s)??{maxScroll:0,scrollWidth:0}),this.template=St(this,s=>this._templateRef.read(s)?.object),this._isHidden=kn(this,!1),this._isFocused=St(this,s=>this.template.read(s)?.isFocused.read(s)??!1),this.viewModel.setIsFocused(this._isFocused,void 0),this._register(tn(s=>{const o=this._scrollLeft.read(s);this._templateRef.read(s)?.object.setScrollLeft(o)})),this._register(tn(s=>{const o=this._templateRef.read(s);!o||!this._isHidden.read(s)||o.object.isFocused.read(s)||this._clear()}))}dispose(){this._clear(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.documentDiffItem.modified?.uri.toString()})`}getKey(){return this.viewModel.getKey()}setViewState(e,t){this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);const i=this.viewModel.lastTemplateData.get(),r=e.selections?.map(yt.liftSelection);this.viewModel.lastTemplateData.set({...i,selections:r},t);const s=this._templateRef.get();s&&r&&s.object.editor.setSelections(r)}_updateTemplateData(e){const t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){const e=this._templateRef.get();e&&qr(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,i,r){this._isHidden.set(!1,void 0);let s=this._templateRef.get();if(!s){s=this._objectPool.getUnusedObj(new TPt(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(s,void 0);const o=this.viewModel.lastTemplateData.get().selections;o&&s.object.editor.setSelections(o)}s.object.render(e,i,t,r)}}J("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},w("multiDiffEditor.headerBackground","The background color of the diff editor's header"));J("multiDiffEditor.background",lf,w("multiDiffEditor.background","The background color of the multi file diff editor"));J("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},w("multiDiffEditor.border","The border color of the multi file diff editor"));var NPt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},RPt=function(n,e){return function(t,i){e(t,i,n)}};let see=class extends me{constructor(e,t,i){super(),this._element=e,this._workbenchUIElementFactory=t,this._instantiationService=i,this._dimension=kn(this,void 0),this._viewModel=kn(this,void 0),this._widgetImpl=Jb(this,(r,s)=>(Yc(k9,r),s.add(this._instantiationService.createInstance(Yc(ree,r),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory)))),this._register(s2(this._widgetImpl))}};see=NPt([RPt(2,Tt)],see);function PPt(n,e,t){return Yt.initialize(t||{}).createInstance(nee,n,e)}function OPt(n){return Yt.get(ai).onCodeEditorAdd(t=>{n(t)})}function MPt(n){return Yt.get(ai).onDiffEditorAdd(t=>{n(t)})}function FPt(){return Yt.get(ai).listCodeEditors()}function BPt(){return Yt.get(ai).listDiffEditors()}function $Pt(n,e,t){return Yt.initialize(t||{}).createInstance(iee,n,e)}function WPt(n,e){const t=Yt.initialize(e||{});return new see(n,{},t)}function HPt(n){if(typeof n.id!="string"||typeof n.run!="function")throw new Error("Invalid command descriptor, `id` and `run` are required properties!");return Un.registerCommand(n.id,n.run)}function VPt(n){if(typeof n.id!="string"||typeof n.label!="string"||typeof n.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");const e=Le.deserialize(n.precondition),t=(r,...s)=>fo.runEditorCommand(r,s,e,(o,a,l)=>Promise.resolve(n.run(a,...l))),i=new ke;if(i.add(Un.registerCommand(n.id,t)),n.contextMenuGroupId){const r={command:{id:n.id,title:n.label},when:e,group:n.contextMenuGroupId,order:n.contextMenuOrder||0};i.add(Fo.appendMenuItem(ce.EditorContext,r))}if(Array.isArray(n.keybindings)){const r=Yt.get(xi);if(!(r instanceof CE))console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");else{const s=Le.and(e,Le.deserialize(n.keybindingContext));i.add(r.addDynamicKeybindings(n.keybindings.map(o=>({keybinding:o,command:n.id,when:s}))))}}return i}function zPt(n){return P8e([n])}function P8e(n){const e=Yt.get(xi);return e instanceof CE?e.addDynamicKeybindings(n.map(t=>({keybinding:t.keybinding,command:t.command,commandArgs:t.commandArgs,when:Le.deserialize(t.when)}))):(console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),me.None)}function UPt(n,e,t){const i=Yt.get(Hr),r=i.getLanguageIdByMimeType(e)||e;return R8e(Yt.get(Sr),i,n,r,t)}function jPt(n,e){const t=Yt.get(Hr),i=t.getLanguageIdByMimeType(e)||e||Hl;n.setLanguage(t.createById(i))}function qPt(n,e,t){n&&Yt.get(dm).changeOne(e,n.uri,t)}function KPt(n){Yt.get(dm).changeAll(n,[])}function GPt(n){return Yt.get(dm).read(n)}function YPt(n){return Yt.get(dm).onMarkerChanged(n)}function ZPt(n){return Yt.get(Sr).getModel(n)}function XPt(){return Yt.get(Sr).getModels()}function QPt(n){return Yt.get(Sr).onModelAdded(n)}function JPt(n){return Yt.get(Sr).onModelRemoved(n)}function eOt(n){return Yt.get(Sr).onModelLanguageChanged(t=>{n({model:t.model,oldLanguage:t.oldLanguageId})})}function tOt(n){return FDt(Yt.get(Sr),n)}function nOt(n,e){const t=Yt.get(Hr),i=Yt.get(hd);return Tce.colorizeElement(i,t,n,e).then(()=>{i.registerEditorContainer(n)})}function iOt(n,e,t){const i=Yt.get(Hr);return Yt.get(hd).registerEditorContainer(Xi.document.body),Tce.colorize(i,n,e,t)}function rOt(n,e,t=4){return Yt.get(hd).registerEditorContainer(Xi.document.body),Tce.colorizeModelLine(n,e,t)}function sOt(n){const e=rs.get(n);return e||{getInitialState:()=>gE,tokenize:(t,i,r)=>Nle(n,r)}}function oOt(n,e){rs.getOrCreate(e);const t=sOt(e),i=om(n),r=[];let s=t.getInitialState();for(let o=0,a=i.length;o{if(!i)return null;const s=t.options?.selection;let o;return s&&typeof s.endLineNumber=="number"&&typeof s.endColumn=="number"?o=s:s&&(o={lineNumber:s.startLineNumber,column:s.startColumn}),await n.openCodeEditor(i,t.resource,o)?i:null})}function fOt(){return{create:PPt,getEditors:FPt,getDiffEditors:BPt,onDidCreateEditor:OPt,onDidCreateDiffEditor:MPt,createDiffEditor:$Pt,addCommand:HPt,addEditorAction:VPt,addKeybindingRule:zPt,addKeybindingRules:P8e,createModel:UPt,setModelLanguage:jPt,setModelMarkers:qPt,getModelMarkers:GPt,removeAllMarkers:KPt,onDidChangeMarkers:YPt,getModels:XPt,getModel:ZPt,onDidCreateModel:QPt,onWillDisposeModel:JPt,onDidChangeModelLanguage:eOt,createWebWorker:tOt,colorizeElement:nOt,colorize:iOt,colorizeModelLine:rOt,tokenize:oOt,defineTheme:aOt,setTheme:lOt,remeasureFonts:cOt,registerCommand:uOt,registerLinkOpener:dOt,registerEditorOpener:hOt,AccessibilitySupport:vZ,ContentWidgetPositionPreference:SZ,CursorChangeReason:kZ,DefaultEndOfLine:EZ,EditorAutoIndentStrategy:TZ,EditorOption:DZ,EndOfLinePreference:IZ,EndOfLineSequence:AZ,MinimapPosition:VZ,MinimapSectionHeaderStyle:zZ,MouseTargetType:UZ,OverlayWidgetPositionPreference:KZ,OverviewRulerLane:GZ,GlyphMarginLane:NZ,RenderLineNumbersType:XZ,RenderMinimap:QZ,ScrollbarVisibility:eX,ScrollType:JZ,TextEditorCursorBlinkingStyle:oX,TextEditorCursorStyle:aX,TrackedRangeStickiness:lX,WrappingIndent:cX,InjectedTextCursorStops:OZ,PositionAffinity:ZZ,ShowLightbulbIconMode:nX,ConfigurationChangedEvent:y4e,BareFontInfo:Gy,FontInfo:bX,TextModelResolvedOptions:U5,FindMatch:dN,ApplyUpdateResult:fI,EditorZoom:Pd,createMultiFileDiffEditor:WPt,EditorType:pO,EditorOptions:Mg}}function gOt(n,e){if(!e||!Array.isArray(e))return!1;for(const t of e)if(!n(t))return!1;return!0}function o3(n,e){return typeof n=="boolean"?n:e}function aCe(n,e){return typeof n=="string"?n:e}function pOt(n){const e={};for(const t of n)e[t]=!0;return e}function lCe(n,e=!1){e&&(n=n.map(function(i){return i.toLowerCase()}));const t=pOt(n);return e?function(i){return t[i.toLowerCase()]!==void 0&&t.hasOwnProperty(i.toLowerCase())}:function(i){return t[i]!==void 0&&t.hasOwnProperty(i)}}function oee(n,e,t){e=e.replace(/@@/g,"");let i=0,r;do r=!1,e=e.replace(/@(\w+)/g,function(o,a){r=!0;let l="";if(typeof n[a]=="string")l=n[a];else if(n[a]&&n[a]instanceof RegExp)l=n[a].source;else throw n[a]===void 0?Tr(n,"language definition does not contain attribute '"+a+"', used at: "+e):Tr(n,"attribute reference '"+a+"' must be a string, used at: "+e);return my(l)?"":"(?:"+l+")"}),i++;while(r&&i<5);e=e.replace(/\x01/g,"@");const s=(n.ignoreCase?"i":"")+(n.unicode?"u":"");if(t&&e.match(/\$[sS](\d\d?)/g)){let a=null,l=null;return c=>(l&&a===c||(a=c,l=new RegExp(iIt(n,e,c),s)),l)}return new RegExp(e,s)}function mOt(n,e,t,i){if(i<0)return n;if(i=100){i=i-100;const r=t.split(".");if(r.unshift(t),i=0&&(i.tokenSubst=!0),typeof t.bracket=="string")if(t.bracket==="@open")i.bracket=1;else if(t.bracket==="@close")i.bracket=-1;else throw Tr(n,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw Tr(n,"the next state must be a string value in rule: "+e);{let r=t.next;if(!/^(@pop|@push|@popall)$/.test(r)&&(r[0]==="@"&&(r=r.substr(1)),r.indexOf("$")<0&&!rIt(n,mv(n,r,"",[],""))))throw Tr(n,"the next state '"+t.next+"' is not defined in rule: "+e);i.next=r}}return typeof t.goBack=="number"&&(i.goBack=t.goBack),typeof t.switchTo=="string"&&(i.switchTo=t.switchTo),typeof t.log=="string"&&(i.log=t.log),typeof t.nextEmbedded=="string"&&(i.nextEmbedded=t.nextEmbedded,n.usesEmbedded=!0),i}}else if(Array.isArray(t)){const i=[];for(let r=0,s=t.length;r0&&i[0]==="^",this.name=this.name+": "+i,this.regex=oee(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")",!0)}setAction(e,t){this.action=aee(e,this.name,t)}resolveRegex(e){return this.regex instanceof RegExp?this.regex:this.regex(e)}}function O8e(n,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");const t={languageId:n,includeLF:o3(e.includeLF,!1),noThrow:!1,maxStack:100,start:typeof e.start=="string"?e.start:null,ignoreCase:o3(e.ignoreCase,!1),unicode:o3(e.unicode,!1),tokenPostfix:aCe(e.tokenPostfix,"."+n),defaultToken:aCe(e.defaultToken,"source"),usesEmbedded:!1,stateNames:{},tokenizer:{},brackets:[]},i=e;i.languageId=n,i.includeLF=t.includeLF,i.ignoreCase=t.ignoreCase,i.unicode=t.unicode,i.noThrow=t.noThrow,i.usesEmbedded=t.usesEmbedded,i.stateNames=e.tokenizer,i.defaultToken=t.defaultToken;function r(o,a,l){for(const c of l){let u=c.include;if(u){if(typeof u!="string")throw Tr(t,"an 'include' attribute must be a string at: "+o);if(u[0]==="@"&&(u=u.substr(1)),!e.tokenizer[u])throw Tr(t,"include target '"+u+"' is not defined at: "+o);r(o+"."+u,a,e.tokenizer[u])}else{const d=new vOt(o);if(Array.isArray(c)&&c.length>=1&&c.length<=3)if(d.setRegex(i,c[0]),c.length>=3)if(typeof c[1]=="string")d.setAction(i,{token:c[1],next:c[2]});else if(typeof c[1]=="object"){const h=c[1];h.next=c[2],d.setAction(i,h)}else throw Tr(t,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+o);else d.setAction(i,c[1]);else{if(!c.regex)throw Tr(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+o);c.name&&typeof c.name=="string"&&(d.name=c.name),c.matchOnlyAtStart&&(d.matchOnlyAtLineStart=o3(c.matchOnlyAtLineStart,!1)),d.setRegex(i,c.regex),d.setAction(i,c.action)}a.push(d)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw Tr(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(const o in e.tokenizer)if(e.tokenizer.hasOwnProperty(o)){t.start||(t.start=o);const a=e.tokenizer[o];t.tokenizer[o]=new Array,r("tokenizer."+o,t.tokenizer[o],a)}if(t.usesEmbedded=i.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw Tr(t,"the 'brackets' attribute must be defined as an array")}else e.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];const s=[];for(const o of e.brackets){let a=o;if(a&&Array.isArray(a)&&a.length===3&&(a={token:a[2],open:a[0],close:a[1]}),a.open===a.close)throw Tr(t,"open and close brackets in a 'brackets' attribute must be different: "+a.open+` + hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")s.push({token:a.token+t.tokenPostfix,open:R_(t,a.open),close:R_(t,a.close)});else throw Tr(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=s,t.noThrow=!0,t}function bOt(n){sE.registerLanguage(n)}function yOt(){let n=[];return n=n.concat(sE.getLanguages()),n}function wOt(n){return Yt.get(Hr).languageIdCodec.encodeLanguageId(n)}function COt(n,e){return Yt.withServices(()=>{const i=Yt.get(Hr).onDidRequestRichLanguageFeatures(r=>{r===n&&(i.dispose(),e())});return i})}function xOt(n,e){return Yt.withServices(()=>{const i=Yt.get(Hr).onDidRequestBasicLanguageFeatures(r=>{r===n&&(i.dispose(),e())});return i})}function SOt(n,e){if(!Yt.get(Hr).isRegisteredLanguageId(n))throw new Error(`Cannot set configuration for unknown language ${n}`);return Yt.get(Zr).register(n,e,100)}class kOt{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if(typeof this._actual.tokenize=="function")return tR.adaptTokenize(this._languageId,this._actual,e,i);throw new Error("Not supported!")}tokenizeEncoded(e,t,i){const r=this._actual.tokenizeEncoded(e,i);return new P$(r.tokens,r.endState)}}class tR{constructor(e,t,i,r){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=r}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const i=[];let r=0;for(let s=0,o=e.length;s0&&s[o-1]===h)continue;let f=d.startIndex;c===0?f=0:f{const i=await Promise.resolve(e.create());return i?EOt(i)?F8e(n,i):new zN(Yt.get(Hr),Yt.get(hd),n,O8e(n,i),Yt.get(En)):null});return rs.registerFactory(n,t)}function DOt(n,e){if(!Yt.get(Hr).isRegisteredLanguageId(n))throw new Error(`Cannot set tokens provider for unknown language ${n}`);return M8e(e)?fue(n,{create:()=>e}):rs.register(n,F8e(n,e))}function IOt(n,e){const t=i=>new zN(Yt.get(Hr),Yt.get(hd),n,O8e(n,i),Yt.get(En));return M8e(e)?fue(n,{create:()=>e}):rs.register(n,t(e))}function AOt(n,e){return Yt.get(dt).referenceProvider.register(n,e)}function NOt(n,e){return Yt.get(dt).renameProvider.register(n,e)}function ROt(n,e){return Yt.get(dt).newSymbolNamesProvider.register(n,e)}function POt(n,e){return Yt.get(dt).signatureHelpProvider.register(n,e)}function OOt(n,e){return Yt.get(dt).hoverProvider.register(n,{provideHover:async(i,r,s,o)=>{const a=i.getWordAtPosition(r);return Promise.resolve(e.provideHover(i,r,s,o)).then(l=>{if(l)return!l.range&&a&&(l.range=new $(r.lineNumber,a.startColumn,r.lineNumber,a.endColumn)),l.range||(l.range=new $(r.lineNumber,r.column,r.lineNumber,r.column)),l})}})}function MOt(n,e){return Yt.get(dt).documentSymbolProvider.register(n,e)}function FOt(n,e){return Yt.get(dt).documentHighlightProvider.register(n,e)}function BOt(n,e){return Yt.get(dt).linkedEditingRangeProvider.register(n,e)}function $Ot(n,e){return Yt.get(dt).definitionProvider.register(n,e)}function WOt(n,e){return Yt.get(dt).implementationProvider.register(n,e)}function HOt(n,e){return Yt.get(dt).typeDefinitionProvider.register(n,e)}function VOt(n,e){return Yt.get(dt).codeLensProvider.register(n,e)}function zOt(n,e,t){return Yt.get(dt).codeActionProvider.register(n,{providedCodeActionKinds:t?.providedCodeActionKinds,documentation:t?.documentation,provideCodeActions:(r,s,o,a)=>{const c=Yt.get(dm).read({resource:r.uri}).filter(u=>$.areIntersectingOrTouching(u,s));return e.provideCodeActions(r,s,{markers:c,only:o.only,trigger:o.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function UOt(n,e){return Yt.get(dt).documentFormattingEditProvider.register(n,e)}function jOt(n,e){return Yt.get(dt).documentRangeFormattingEditProvider.register(n,e)}function qOt(n,e){return Yt.get(dt).onTypeFormattingEditProvider.register(n,e)}function KOt(n,e){return Yt.get(dt).linkProvider.register(n,e)}function GOt(n,e){return Yt.get(dt).completionProvider.register(n,e)}function YOt(n,e){return Yt.get(dt).colorProvider.register(n,e)}function ZOt(n,e){return Yt.get(dt).foldingRangeProvider.register(n,e)}function XOt(n,e){return Yt.get(dt).declarationProvider.register(n,e)}function QOt(n,e){return Yt.get(dt).selectionRangeProvider.register(n,e)}function JOt(n,e){return Yt.get(dt).documentSemanticTokensProvider.register(n,e)}function eMt(n,e){return Yt.get(dt).documentRangeSemanticTokensProvider.register(n,e)}function tMt(n,e){return Yt.get(dt).inlineCompletionsProvider.register(n,e)}function nMt(n,e){return Yt.get(dt).inlineEditProvider.register(n,e)}function iMt(n,e){return Yt.get(dt).inlayHintsProvider.register(n,e)}function rMt(){return{register:bOt,getLanguages:yOt,onLanguage:COt,onLanguageEncountered:xOt,getEncodedLanguageId:wOt,setLanguageConfiguration:SOt,setColorMap:TOt,registerTokensProviderFactory:fue,setTokensProvider:DOt,setMonarchTokensProvider:IOt,registerReferenceProvider:AOt,registerRenameProvider:NOt,registerNewSymbolNameProvider:ROt,registerCompletionItemProvider:GOt,registerSignatureHelpProvider:POt,registerHoverProvider:OOt,registerDocumentSymbolProvider:MOt,registerDocumentHighlightProvider:FOt,registerLinkedEditingRangeProvider:BOt,registerDefinitionProvider:$Ot,registerImplementationProvider:WOt,registerTypeDefinitionProvider:HOt,registerCodeLensProvider:VOt,registerCodeActionProvider:zOt,registerDocumentFormattingEditProvider:UOt,registerDocumentRangeFormattingEditProvider:jOt,registerOnTypeFormattingEditProvider:qOt,registerLinkProvider:KOt,registerColorProvider:YOt,registerFoldingRangeProvider:ZOt,registerDeclarationProvider:XOt,registerSelectionRangeProvider:QOt,registerDocumentSemanticTokensProvider:JOt,registerDocumentRangeSemanticTokensProvider:eMt,registerInlineCompletionsProvider:tMt,registerInlineEditProvider:nMt,registerInlayHintsProvider:iMt,DocumentHighlightKind:LZ,CompletionItemKind:wZ,CompletionItemTag:CZ,CompletionItemInsertTextRule:yZ,SymbolKind:rX,SymbolTag:sX,IndentAction:PZ,CompletionTriggerKind:xZ,SignatureHelpTriggerKind:iX,InlayHintKind:MZ,InlineCompletionTriggerKind:FZ,InlineEditTriggerKind:BZ,CodeActionTriggerType:bZ,NewSymbolNameTag:jZ,NewSymbolNameTriggerKind:qZ,PartialAcceptTriggerKind:YZ,HoverVerbosityAction:RZ,FoldingRangeKind:jL,SelectedSuggestionInfo:M4e}}const gue=On("IEditorCancelService"),B8e=new et("cancellableOperation",!1,w("cancellableOperation","Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));Vn(gue,class{constructor(){this._tokens=new WeakMap}add(n,e){let t=this._tokens.get(n);t||(t=n.invokeWithinContext(r=>{const s=B8e.bindTo(r.get(jt)),o=new Rl;return{key:s,tokens:o}}),this._tokens.set(n,t));let i;return t.key.set(!0),i=t.tokens.push(e),()=>{i&&(i(),t.key.set(!t.tokens.isEmpty()),i=void 0)}}cancel(n){const e=this._tokens.get(n);if(!e)return;const t=e.tokens.pop();t&&(t.cancel(),e.key.set(!e.tokens.isEmpty()))}},1);class sMt extends Kr{constructor(e,t){super(t),this.editor=e,this._unregister=e.invokeWithinContext(i=>i.get(gue).add(e,this))}dispose(){this._unregister(),super.dispose()}}Je(new class extends fo{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:B8e})}runEditorCommand(n,e){n.get(gue).cancel(e)}});let $8e=class lee{constructor(e,t){if(this.flags=t,this.flags&1){const i=e.getModel();this.modelVersionId=i?Lw("{0}#{1}",i.uri.toString(),i.getVersionId()):null}else this.modelVersionId=null;this.flags&4?this.position=e.getPosition():this.position=null,this.flags&2?this.selection=e.getSelection():this.selection=null,this.flags&8?(this.scrollLeft=e.getScrollLeft(),this.scrollTop=e.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(e){if(!(e instanceof lee))return!1;const t=e;return!(this.modelVersionId!==t.modelVersionId||this.scrollLeft!==t.scrollLeft||this.scrollTop!==t.scrollTop||!this.position&&t.position||this.position&&!t.position||this.position&&t.position&&!this.position.equals(t.position)||!this.selection&&t.selection||this.selection&&!t.selection||this.selection&&t.selection&&!this.selection.equalsRange(t.selection))}validate(e){return this._equals(new lee(e,this.flags))}};class Pb extends sMt{constructor(e,t,i,r){super(e,r),this._listener=new ke,t&4&&this._listener.add(e.onDidChangeCursorPosition(s=>{(!i||!$.containsPosition(i,s.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(s=>{(!i||!$.containsRange(i,s.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(s=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(s=>this.cancel())),this._listener.add(e.onDidChangeModelContent(s=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}}class pue extends Kr{constructor(e,t){super(t),this._listener=e.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}}function im(n){return n&&typeof n.getEditorType=="function"?n.getEditorType()===pO.ICodeEditor:!1}function mue(n){return n&&typeof n.getEditorType=="function"?n.getEditorType()===pO.IDiffEditor:!1}function oMt(n){return!!n&&typeof n=="object"&&typeof n.onDidChangeActiveEditor=="function"}function W8e(n){return im(n)?n:mue(n)?n.getModifiedEditor():oMt(n)&&im(n.activeCodeEditor)?n.activeCodeEditor:null}class EE{static _handleEolEdits(e,t){let i;const r=[];for(const s of t)typeof s.eol=="number"&&(i=s.eol),s.range&&typeof s.text=="string"&&r.push(s);return typeof i=="number"&&e.hasModel()&&e.getModel().pushEOL(i),r}static _isFullModelReplaceEdit(e,t){if(!e.hasModel())return!1;const i=e.getModel(),r=i.validateRange(t.range);return i.getFullModelRange().equalsRange(r)}static execute(e,t,i){i&&e.pushUndoStop();const r=Ag.capture(e),s=EE._handleEolEdits(e,t);s.length===1&&EE._isFullModelReplaceEdit(e,s[0])?e.executeEdits("formatEditsCommand",s.map(o=>jr.replace($.lift(o.range),o.text))):e.executeEdits("formatEditsCommand",s.map(o=>jr.replaceMove($.lift(o.range),o.text))),i&&e.pushUndoStop(),r.restoreRelativeVerticalPositionOfCursor(e)}}class cCe{constructor(e){this.value=e,this._lower=e.toLowerCase()}static toKey(e){return typeof e=="string"?e.toLowerCase():e._lower}}class aMt{constructor(e){if(this._set=new Set,e)for(const t of e)this.add(t)}add(e){this._set.add(cCe.toKey(e))}has(e){return this._set.has(cCe.toKey(e))}}function H8e(n,e,t){const i=[],r=new aMt,s=n.ordered(t);for(const a of s)i.push(a),a.extensionId&&r.add(a.extensionId);const o=e.ordered(t);for(const a of o){if(a.extensionId){if(r.has(a.extensionId))continue;r.add(a.extensionId)}i.push({displayName:a.displayName,extensionId:a.extensionId,provideDocumentFormattingEdits(l,c,u){return a.provideDocumentRangeFormattingEdits(l,l.getFullModelRange(),c,u)}})}return i}class LE{static{this._selectors=new Rl}static setFormatterSelector(e){return{dispose:LE._selectors.unshift(e)}}static async select(e,t,i,r){if(e.length===0)return;const s=zn.first(LE._selectors);if(s)return await s(e,t,i,r)}}async function V8e(n,e,t,i,r,s,o){const a=n.get(Tt),{documentRangeFormattingEditProvider:l}=n.get(dt),c=im(e)?e.getModel():e,u=l.ordered(c),d=await LE.select(u,c,i,2);d&&(r.report(d),await a.invokeFunction(lMt,d,e,t,s,o))}async function lMt(n,e,t,i,r,s){const o=n.get(Oc),a=n.get(Da),l=n.get(t1);let c,u;im(t)?(c=t.getModel(),u=new Pb(t,5,void 0,r)):(c=t,u=new pue(t,r));const d=[];let h=0;for(const _ of fae(i).sort($.compareRangesUsingStarts))h>0&&$.areIntersectingOrTouching(d[h-1],_)?d[h-1]=$.fromPositions(d[h-1].getStartPosition(),_.getEndPosition()):h=d.push(_);const f=async _=>{a.trace("[format][provideDocumentRangeFormattingEdits] (request)",e.extensionId?.value,_);const v=await e.provideDocumentRangeFormattingEdits(c,_,c.getFormattingOptions(),u.token)||[];return a.trace("[format][provideDocumentRangeFormattingEdits] (response)",e.extensionId?.value,v),v},g=(_,v)=>{if(!_.length||!v.length)return!1;const y=_.reduce((C,x)=>$.plusRange(C,x.range),_[0].range);if(!v.some(C=>$.intersectRanges(y,C.range)))return!1;for(const C of _)for(const x of v)if($.intersectRanges(C.range,x.range))return!0;return!1},p=[],m=[];try{if(typeof e.provideDocumentRangesFormattingEdits=="function"){a.trace("[format][provideDocumentRangeFormattingEdits] (request)",e.extensionId?.value,d);const _=await e.provideDocumentRangesFormattingEdits(c,d,c.getFormattingOptions(),u.token)||[];a.trace("[format][provideDocumentRangeFormattingEdits] (response)",e.extensionId?.value,_),m.push(_)}else{for(const _ of d){if(u.token.isCancellationRequested)return!0;m.push(await f(_))}for(let _=0;_({text:y.text,range:$.lift(y.range),forceMoveMarkers:!0})),y=>{for(const{range:C}of y)if($.areIntersectingOrTouching(C,v))return[new yt(C.startLineNumber,C.startColumn,C.endLineNumber,C.endColumn)];return null})}return l.playSignal(Ai.format,{userGesture:s}),!0}async function cMt(n,e,t,i,r,s){const o=n.get(Tt),a=n.get(dt),l=im(e)?e.getModel():e,c=H8e(a.documentFormattingEditProvider,a.documentRangeFormattingEditProvider,l),u=await LE.select(c,l,t,1);u&&(i.report(u),await o.invokeFunction(uMt,u,e,t,r,s))}async function uMt(n,e,t,i,r,s){const o=n.get(Oc),a=n.get(t1);let l,c;im(t)?(l=t.getModel(),c=new Pb(t,5,void 0,r)):(l=t,c=new pue(t,r));let u;try{const d=await e.provideDocumentFormattingEdits(l,l.getFormattingOptions(),c.token);if(u=await o.computeMoreMinimalEdits(l.uri,d),c.token.isCancellationRequested)return!0}finally{c.dispose()}if(!u||u.length===0)return!1;if(im(t))EE.execute(t,u,i!==2),i!==2&&t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{const[{range:d}]=u,h=new yt(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn);l.pushEditOperations([h],u.map(f=>({text:f.text,range:$.lift(f.range),forceMoveMarkers:!0})),f=>{for(const{range:g}of f)if($.areIntersectingOrTouching(g,h))return[new yt(g.startLineNumber,g.startColumn,g.endLineNumber,g.endColumn)];return null})}return a.playSignal(Ai.format,{userGesture:s}),!0}async function dMt(n,e,t,i,r,s){const o=e.documentRangeFormattingEditProvider.ordered(t);for(const a of o){const l=await Promise.resolve(a.provideDocumentRangeFormattingEdits(t,i,r,s)).catch(vs);if(bl(l))return await n.computeMoreMinimalEdits(t.uri,l)}}async function hMt(n,e,t,i,r){const s=H8e(e.documentFormattingEditProvider,e.documentRangeFormattingEditProvider,t);for(const o of s){const a=await Promise.resolve(o.provideDocumentFormattingEdits(t,i,r)).catch(vs);if(bl(a))return await n.computeMoreMinimalEdits(t.uri,a)}}function z8e(n,e,t,i,r,s,o){const a=e.onTypeFormattingEditProvider.ordered(t);return a.length===0||a[0].autoFormatTriggerCharacters.indexOf(r)<0?Promise.resolve(void 0):Promise.resolve(a[0].provideOnTypeFormattingEdits(t,i,r,s,o)).catch(vs).then(l=>n.computeMoreMinimalEdits(t.uri,l))}Un.registerCommand("_executeFormatRangeProvider",async function(n,...e){const[t,i,r]=e;oi(Pt.isUri(t)),oi($.isIRange(i));const s=n.get(Nc),o=n.get(Oc),a=n.get(dt),l=await s.createModelReference(t);try{return dMt(o,a,l.object.textEditorModel,$.lift(i),r,yn.None)}finally{l.dispose()}});Un.registerCommand("_executeFormatDocumentProvider",async function(n,...e){const[t,i]=e;oi(Pt.isUri(t));const r=n.get(Nc),s=n.get(Oc),o=n.get(dt),a=await r.createModelReference(t);try{return hMt(s,o,a.object.textEditorModel,i,yn.None)}finally{a.dispose()}});Un.registerCommand("_executeFormatOnTypeProvider",async function(n,...e){const[t,i,r,s]=e;oi(Pt.isUri(t)),oi(he.isIPosition(i)),oi(typeof r=="string");const o=n.get(Nc),a=n.get(Oc),l=n.get(dt),c=await o.createModelReference(t);try{return z8e(a,l,c.object.textEditorModel,he.lift(i),r,s,yn.None)}finally{c.dispose()}});Mg.wrappingIndent.defaultValue=0;Mg.glyphMargin.defaultValue=!1;Mg.autoIndent.defaultValue=3;Mg.overviewRulerLanes.defaultValue=2;LE.setFormatterSelector((n,e,t)=>Promise.resolve(n[0]));const Zl=F4e();Zl.editor=fOt();Zl.languages=rMt();const U8e=Zl.CancellationTokenSource,j8e=Zl.Emitter,q8e=Zl.KeyCode,K8e=Zl.KeyMod,G8e=Zl.Position,Y8e=Zl.Range,Z8e=Zl.Selection,X8e=Zl.SelectionDirection,Q8e=Zl.MarkerSeverity,J8e=Zl.MarkerTag,e9e=Zl.Uri,t9e=Zl.Token,n9e=Zl.editor,i9e=Zl.languages,fMt=globalThis.MonacoEnvironment;(fMt?.globalAPI||typeof define=="function"&&define.amd)&&(globalThis.monaco=Zl);typeof globalThis.require<"u"&&typeof globalThis.require.config=="function"&&globalThis.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});const el=Object.freeze(Object.defineProperty({__proto__:null,CancellationTokenSource:U8e,Emitter:j8e,KeyCode:q8e,KeyMod:K8e,MarkerSeverity:Q8e,MarkerTag:J8e,Position:G8e,Range:Y8e,Selection:Z8e,SelectionDirection:X8e,Token:t9e,Uri:e9e,editor:n9e,languages:i9e},Symbol.toStringTag,{value:"Module"}));/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) * Released under the MIT license @@ -804,16 +804,16 @@ ${e.toString()}`}}class i9{constructor(e=new c2,t=!1,i,r=_Dt){this._services=e,t * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) * Released under the MIT license * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt - *-----------------------------------------------------------------------------*/var YMt=Object.defineProperty,ZMt=Object.getOwnPropertyDescriptor,XMt=Object.getOwnPropertyNames,QMt=Object.prototype.hasOwnProperty,JMt=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of XMt(e))!QMt.call(n,r)&&r!==t&&YMt(n,r,{get:()=>e[r],enumerable:!(i=ZMt(e,r))||i.enumerable});return n},e4t=(n,e,t)=>(JMt(n,e,"default"),t),t4t="5.4.5",TE={};e4t(TE,el);var g9e=(n=>(n[n.None=0]="None",n[n.CommonJS=1]="CommonJS",n[n.AMD=2]="AMD",n[n.UMD=3]="UMD",n[n.System=4]="System",n[n.ES2015=5]="ES2015",n[n.ESNext=99]="ESNext",n))(g9e||{}),p9e=(n=>(n[n.None=0]="None",n[n.Preserve=1]="Preserve",n[n.React=2]="React",n[n.ReactNative=3]="ReactNative",n[n.ReactJSX=4]="ReactJSX",n[n.ReactJSXDev=5]="ReactJSXDev",n))(p9e||{}),m9e=(n=>(n[n.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",n[n.LineFeed=1]="LineFeed",n))(m9e||{}),_9e=(n=>(n[n.ES3=0]="ES3",n[n.ES5=1]="ES5",n[n.ES2015=2]="ES2015",n[n.ES2016=3]="ES2016",n[n.ES2017=4]="ES2017",n[n.ES2018=5]="ES2018",n[n.ES2019=6]="ES2019",n[n.ES2020=7]="ES2020",n[n.ESNext=99]="ESNext",n[n.JSON=100]="JSON",n[n.Latest=99]="Latest",n))(_9e||{}),v9e=(n=>(n[n.Classic=1]="Classic",n[n.NodeJs=2]="NodeJs",n))(v9e||{}),b9e=class{constructor(n,e,t,i,r){this._onDidChange=new TE.Emitter,this._onDidExtraLibsChange=new TE.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(n),this.setDiagnosticsOptions(e),this.setWorkerOptions(t),this.setInlayHintsOptions(i),this.setModeConfiguration(r),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(n,e){let t;if(typeof e>"u"?t=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t=e,this._extraLibs[t]&&this._extraLibs[t].content===n)return{dispose:()=>{}};let i=1;return this._removedExtraLibs[t]&&(i=this._removedExtraLibs[t]+1),this._extraLibs[t]&&(i=this._extraLibs[t].version+1),this._extraLibs[t]={content:n,version:i},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let r=this._extraLibs[t];r&&r.version===i&&(delete this._extraLibs[t],this._removedExtraLibs[t]=i,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(n){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),n&&n.length>0)for(const e of n){const t=e.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=e.content;let r=1;this._removedExtraLibs[t]&&(r=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i,version:r}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(n){this._compilerOptions=n||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(n){this._diagnosticsOptions=n||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(n){this._workerOptions=n||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(n){this._inlayHintsOptions=n||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(n){}setEagerModelSync(n){this._eagerModelSync=n}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(n){this._modeConfiguration=n||Object.create(null),this._onDidChange.fire(void 0)}},n4t=t4t,y9e={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},wue=new b9e({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},y9e),w9e=new b9e({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},y9e),i4t=()=>rH().then(n=>n.getTypeScriptWorker()),r4t=()=>rH().then(n=>n.getJavaScriptWorker());TE.languages.typescript={ModuleKind:g9e,JsxEmit:p9e,NewLineKind:m9e,ScriptTarget:_9e,ModuleResolutionKind:v9e,typescriptVersion:n4t,typescriptDefaults:wue,javascriptDefaults:w9e,getTypeScriptWorker:i4t,getJavaScriptWorker:r4t};function rH(){return At(()=>Promise.resolve().then(()=>$Zt),void 0,import.meta.url)}TE.languages.onLanguage("typescript",()=>rH().then(n=>n.setupTypeScript(wue)));TE.languages.onLanguage("javascript",()=>rH().then(n=>n.setupJavaScript(w9e)));class s4t extends Gl{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Gt("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:ze.map,toggled:Le.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Le.has("isInDiffEditor"),menu:{when:Le.has("isInDiffEditor"),id:ce.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(kn),r=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",r)}}class C9e extends Gl{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Gt("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:Le.has("isInDiffEditor")})}run(e,...t){const i=e.get(kn),r=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",r)}}class x9e extends Gl{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Gt("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:Le.has("isInDiffEditor")})}run(e,...t){const i=e.get(kn),r=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",r)}}const yO=Gt("diffEditor","Diff Editor");class o4t extends Fg{constructor(){super({id:"diffEditor.switchSide",title:Gt("switchSide","Switch Side"),icon:ze.arrowSwap,precondition:Le.has("isInDiffEditor"),f1:!0,category:yO})}runEditorCommand(e,t,i){const r=f2(e);if(r instanceof e0){if(i&&i.dryRun)return{destinationSelection:r.mapToOtherSide().destinationSelection};r.switchSide()}}}class a4t extends Fg{constructor(){super({id:"diffEditor.exitCompareMove",title:Gt("exitCompareMove","Exit Compare Move"),icon:ze.close,precondition:Q.comparingMovedCode,f1:!1,category:yO,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const r=f2(e);r instanceof e0&&r.exitCompareMove()}}class l4t extends Fg{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Gt("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:ze.fold,precondition:Le.has("isInDiffEditor"),f1:!0,category:yO})}runEditorCommand(e,t,...i){const r=f2(e);r instanceof e0&&r.collapseAllUnchangedRegions()}}class c4t extends Fg{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Gt("showAllUnchangedRegions","Show All Unchanged Regions"),icon:ze.unfold,precondition:Le.has("isInDiffEditor"),f1:!0,category:yO})}runEditorCommand(e,t,...i){const r=f2(e);r instanceof e0&&r.showAllUnchangedRegions()}}class cee extends Gl{constructor(){super({id:"diffEditor.revert",title:Gt("revert","Revert"),f1:!1,category:yO})}run(e,t){const i=u4t(e,t.originalUri,t.modifiedUri);i instanceof e0&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const S9e=Gt("accessibleDiffViewer","Accessible Diff Viewer");class wO extends Gl{static{this.id="editor.action.accessibleDiffViewer.next"}constructor(){super({id:wO.id,title:Gt("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:S9e,precondition:Le.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){f2(e)?.accessibleDiffViewerNext()}}class sH extends Gl{static{this.id="editor.action.accessibleDiffViewer.prev"}constructor(){super({id:sH.id,title:Gt("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:S9e,precondition:Le.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){f2(e)?.accessibleDiffViewerPrev()}}function u4t(n,e,t){return n.get(ai).listDiffEditors().find(s=>{const o=s.getModifiedEditor(),a=s.getOriginalEditor();return o&&o.getModel()?.uri.toString()===t.toString()&&a&&a.getModel()?.uri.toString()===e.toString()})||null}function f2(n){const t=n.get(ai).listDiffEditors(),i=ka();if(i)for(const r of t){const s=r.getContainerDomNode();if(d4t(s,i))return r}return null}function d4t(n,e){let t=e;for(;t;){if(t===n)return!0;t=t.parentElement}return!1}lr(s4t);lr(C9e);lr(x9e);Fo.appendMenuItem(ce.EditorTitle,{command:{id:new x9e().desc.id,title:w("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:Le.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:Le.has("isInDiffEditor")},order:11,group:"1_diff",when:Le.and(Q.diffEditorRenderSideBySideInlineBreakpointReached,Le.has("isInDiffEditor"))});Fo.appendMenuItem(ce.EditorTitle,{command:{id:new C9e().desc.id,title:w("showMoves","Show Moved Code Blocks"),icon:ze.move,toggled:YL.create("config.diffEditor.experimental.showMoves",!0),precondition:Le.has("isInDiffEditor")},order:10,group:"1_diff",when:Le.has("isInDiffEditor")});lr(cee);for(const n of[{icon:ze.arrowRight,key:Q.diffEditorInlineMode.toNegated()},{icon:ze.discard,key:Q.diffEditorInlineMode}])Fo.appendMenuItem(ce.DiffEditorHunkToolbar,{command:{id:new cee().desc.id,title:w("revertHunk","Revert Block"),icon:n.icon},when:Le.and(Q.diffEditorModifiedWritable,n.key),order:5,group:"primary"}),Fo.appendMenuItem(ce.DiffEditorSelectionToolbar,{command:{id:new cee().desc.id,title:w("revertSelection","Revert Selection"),icon:n.icon},when:Le.and(Q.diffEditorModifiedWritable,n.key),order:5,group:"primary"});lr(o4t);lr(a4t);lr(l4t);lr(c4t);Fo.appendMenuItem(ce.EditorTitle,{command:{id:wO.id,title:w("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:Le.has("isInDiffEditor")},order:10,group:"2_diff",when:Le.and(Q.accessibleDiffViewerVisible.negate(),Le.has("isInDiffEditor"))});Un.registerCommandAlias("editor.action.diffReview.next",wO.id);lr(wO);Un.registerCommandAlias("editor.action.diffReview.prev",sH.id);lr(sH);var h4t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},f4t=function(n,e){return function(t,i){e(t,i,n)}},uee;const oH=new et("selectionAnchorSet",!1);let Ob=class{static{uee=this}static{this.ID="editor.contrib.selectionAnchorController"}static get(e){return e.getContribution(uee.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=oH.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(yt.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new za().appendText(w("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),ql(w("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(yt.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};Ob=uee=h4t([f4t(1,jt)],Ob);class g4t extends ot{constructor(){super({id:"editor.action.setSelectionAnchor",label:w("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2080),weight:100}})}async run(e,t){Ob.get(t)?.setSelectionAnchor()}}class p4t extends ot{constructor(){super({id:"editor.action.goToSelectionAnchor",label:w("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:oH})}async run(e,t){Ob.get(t)?.goToSelectionAnchor()}}class m4t extends ot{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:w("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:oH,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2089),weight:100}})}async run(e,t){Ob.get(t)?.selectFromAnchorToCursor()}}class _4t extends ot{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:w("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:oH,kbOpts:{kbExpr:Q.editorTextFocus,primary:9,weight:100}})}async run(e,t){Ob.get(t)?.cancelSelectionAnchor()}}Zn(Ob.ID,Ob,4);Pe(g4t);Pe(p4t);Pe(m4t);Pe(_4t);const v4t=J("editorOverviewRuler.bracketMatchForeground","#A0A0A0",w("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class b4t extends ot{constructor(){super({id:"editor.action.jumpToBracket",label:w("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:3165,weight:100}})}run(e,t){P_.get(t)?.jumpToBracket()}}class y4t extends ot{constructor(){super({id:"editor.action.selectToBracket",label:w("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Gt("smartSelect.selectToBracketDescription","Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){let r=!0;i&&i.selectBrackets===!1&&(r=!1),P_.get(t)?.selectToBracket(r)}}class w4t extends ot{constructor(){super({id:"editor.action.removeBrackets",label:w("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:2561,weight:100}})}run(e,t){P_.get(t)?.removeBrackets(this.id)}}class C4t{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}class P_ extends me{static{this.ID="editor.contrib.bracketMatchingController"}static get(e){return e.getContribution(P_.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Ui(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(72),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(72)&&(this._matchBrackets=this._editor.getOption(72),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const r=i.getStartPosition(),s=e.bracketPairs.matchBracket(r);let o=null;if(s)s[0].containsPosition(r)&&!s[1].containsPosition(r)?o=s[1].getStartPosition():s[1].containsPosition(r)&&(o=s[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(r);if(a)o=a[1].getStartPosition();else{const l=e.bracketPairs.findNextBracket(r);l&&l.range&&(o=l.range.getStartPosition())}}return o?new yt(o.lineNumber,o.column,o.lineNumber,o.column):new yt(r.lineNumber,r.column,r.lineNumber,r.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(r=>{const s=r.getStartPosition();let o=t.bracketPairs.matchBracket(s);if(!o&&(o=t.bracketPairs.findEnclosingBrackets(s),!o)){const c=t.bracketPairs.findNextBracket(s);c&&c.range&&(o=t.bracketPairs.matchBracket(c.range.getStartPosition()))}let a=null,l=null;if(o){o.sort($.compareRangesUsingStarts);const[c,u]=o;if(a=e?c.getStartPosition():c.getEndPosition(),l=e?u.getEndPosition():u.getStartPosition(),u.containsPosition(s)){const d=a;a=l,l=d}}a&&l&&i.push(new yt(a.lineNumber,a.column,l.lineNumber,l.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const r=i.getPosition();let s=t.bracketPairs.matchBracket(r);s||(s=t.bracketPairs.findEnclosingBrackets(r)),s&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:s[0],text:""},{range:s[1],text:""}]),this._editor.pushUndoStop())})}static{this._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=un.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:ss(v4t),position:Qu.Center}})}static{this._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=un.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const r=i.brackets;r&&(e[t++]={range:r[0],options:i.options},e[t++]={range:r[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let r=[];this._lastVersionId===i&&(r=this._lastBracketsData);const s=[];let o=0;for(let d=0,h=e.length;d1&&s.sort(he.compare);const a=[];let l=0,c=0;const u=r.length;for(let d=0,h=s.length;d0&&(t.pushUndoStop(),t.executeCommands(this.id,r),t.pushUndoStop())}}Pe(E4t);const aH=function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let n;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?n=crypto.getRandomValues.bind(crypto):n=function(i){for(let r=0;rn,asFile:()=>{},value:typeof n=="string"?n:void 0}}function L4t(n,e,t){const i={id:aH(),name:n,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class E9e{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return zn.some(this,([i,r])=>r.asFile())&&t.push("files"),T9e(E9(e),t)}get(e){return this._entries.get(this.toKey(e))?.[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return E9(e)}}function E9(n){return n.toLowerCase()}function L9e(n,e){return T9e(E9(n),e.map(E9))}function T9e(n,e){if(n==="*/*")return e.length>0;if(e.includes(n))return!0;const t=n.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,r,s]=t;return s==="*"?e.some(o=>o.startsWith(r+"/")):!1}const lH=Object.freeze({create:n=>j_(n.map(e=>e.toString())).join(`\r + *-----------------------------------------------------------------------------*/var YMt=Object.defineProperty,ZMt=Object.getOwnPropertyDescriptor,XMt=Object.getOwnPropertyNames,QMt=Object.prototype.hasOwnProperty,JMt=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of XMt(e))!QMt.call(n,r)&&r!==t&&YMt(n,r,{get:()=>e[r],enumerable:!(i=ZMt(e,r))||i.enumerable});return n},e4t=(n,e,t)=>(JMt(n,e,"default"),t),t4t="5.4.5",TE={};e4t(TE,el);var g9e=(n=>(n[n.None=0]="None",n[n.CommonJS=1]="CommonJS",n[n.AMD=2]="AMD",n[n.UMD=3]="UMD",n[n.System=4]="System",n[n.ES2015=5]="ES2015",n[n.ESNext=99]="ESNext",n))(g9e||{}),p9e=(n=>(n[n.None=0]="None",n[n.Preserve=1]="Preserve",n[n.React=2]="React",n[n.ReactNative=3]="ReactNative",n[n.ReactJSX=4]="ReactJSX",n[n.ReactJSXDev=5]="ReactJSXDev",n))(p9e||{}),m9e=(n=>(n[n.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",n[n.LineFeed=1]="LineFeed",n))(m9e||{}),_9e=(n=>(n[n.ES3=0]="ES3",n[n.ES5=1]="ES5",n[n.ES2015=2]="ES2015",n[n.ES2016=3]="ES2016",n[n.ES2017=4]="ES2017",n[n.ES2018=5]="ES2018",n[n.ES2019=6]="ES2019",n[n.ES2020=7]="ES2020",n[n.ESNext=99]="ESNext",n[n.JSON=100]="JSON",n[n.Latest=99]="Latest",n))(_9e||{}),v9e=(n=>(n[n.Classic=1]="Classic",n[n.NodeJs=2]="NodeJs",n))(v9e||{}),b9e=class{constructor(n,e,t,i,r){this._onDidChange=new TE.Emitter,this._onDidExtraLibsChange=new TE.Emitter,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(n),this.setDiagnosticsOptions(e),this.setWorkerOptions(t),this.setInlayHintsOptions(i),this.setModeConfiguration(r),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(n,e){let t;if(typeof e>"u"?t=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t=e,this._extraLibs[t]&&this._extraLibs[t].content===n)return{dispose:()=>{}};let i=1;return this._removedExtraLibs[t]&&(i=this._removedExtraLibs[t]+1),this._extraLibs[t]&&(i=this._extraLibs[t].version+1),this._extraLibs[t]={content:n,version:i},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let r=this._extraLibs[t];r&&r.version===i&&(delete this._extraLibs[t],this._removedExtraLibs[t]=i,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(n){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),n&&n.length>0)for(const e of n){const t=e.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=e.content;let r=1;this._removedExtraLibs[t]&&(r=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i,version:r}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(n){this._compilerOptions=n||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(n){this._diagnosticsOptions=n||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(n){this._workerOptions=n||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(n){this._inlayHintsOptions=n||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(n){}setEagerModelSync(n){this._eagerModelSync=n}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(n){this._modeConfiguration=n||Object.create(null),this._onDidChange.fire(void 0)}},n4t=t4t,y9e={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},wue=new b9e({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},y9e),w9e=new b9e({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},y9e),i4t=()=>rH().then(n=>n.getTypeScriptWorker()),r4t=()=>rH().then(n=>n.getJavaScriptWorker());TE.languages.typescript={ModuleKind:g9e,JsxEmit:p9e,NewLineKind:m9e,ScriptTarget:_9e,ModuleResolutionKind:v9e,typescriptVersion:n4t,typescriptDefaults:wue,javascriptDefaults:w9e,getTypeScriptWorker:i4t,getJavaScriptWorker:r4t};function rH(){return At(()=>Promise.resolve().then(()=>$Zt),void 0,import.meta.url)}TE.languages.onLanguage("typescript",()=>rH().then(n=>n.setupTypeScript(wue)));TE.languages.onLanguage("javascript",()=>rH().then(n=>n.setupJavaScript(w9e)));class s4t extends Gl{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:Gt("toggleCollapseUnchangedRegions","Toggle Collapse Unchanged Regions"),icon:ze.map,toggled:Le.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Le.has("isInDiffEditor"),menu:{when:Le.has("isInDiffEditor"),id:ce.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(En),r=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",r)}}class C9e extends Gl{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:Gt("toggleShowMovedCodeBlocks","Toggle Show Moved Code Blocks"),precondition:Le.has("isInDiffEditor")})}run(e,...t){const i=e.get(En),r=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",r)}}class x9e extends Gl{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:Gt("toggleUseInlineViewWhenSpaceIsLimited","Toggle Use Inline View When Space Is Limited"),precondition:Le.has("isInDiffEditor")})}run(e,...t){const i=e.get(En),r=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",r)}}const yO=Gt("diffEditor","Diff Editor");class o4t extends Fg{constructor(){super({id:"diffEditor.switchSide",title:Gt("switchSide","Switch Side"),icon:ze.arrowSwap,precondition:Le.has("isInDiffEditor"),f1:!0,category:yO})}runEditorCommand(e,t,i){const r=f2(e);if(r instanceof e0){if(i&&i.dryRun)return{destinationSelection:r.mapToOtherSide().destinationSelection};r.switchSide()}}}class a4t extends Fg{constructor(){super({id:"diffEditor.exitCompareMove",title:Gt("exitCompareMove","Exit Compare Move"),icon:ze.close,precondition:Q.comparingMovedCode,f1:!1,category:yO,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const r=f2(e);r instanceof e0&&r.exitCompareMove()}}class l4t extends Fg{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:Gt("collapseAllUnchangedRegions","Collapse All Unchanged Regions"),icon:ze.fold,precondition:Le.has("isInDiffEditor"),f1:!0,category:yO})}runEditorCommand(e,t,...i){const r=f2(e);r instanceof e0&&r.collapseAllUnchangedRegions()}}class c4t extends Fg{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:Gt("showAllUnchangedRegions","Show All Unchanged Regions"),icon:ze.unfold,precondition:Le.has("isInDiffEditor"),f1:!0,category:yO})}runEditorCommand(e,t,...i){const r=f2(e);r instanceof e0&&r.showAllUnchangedRegions()}}class cee extends Gl{constructor(){super({id:"diffEditor.revert",title:Gt("revert","Revert"),f1:!1,category:yO})}run(e,t){const i=u4t(e,t.originalUri,t.modifiedUri);i instanceof e0&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const S9e=Gt("accessibleDiffViewer","Accessible Diff Viewer");class wO extends Gl{static{this.id="editor.action.accessibleDiffViewer.next"}constructor(){super({id:wO.id,title:Gt("editor.action.accessibleDiffViewer.next","Go to Next Difference"),category:S9e,precondition:Le.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){f2(e)?.accessibleDiffViewerNext()}}class sH extends Gl{static{this.id="editor.action.accessibleDiffViewer.prev"}constructor(){super({id:sH.id,title:Gt("editor.action.accessibleDiffViewer.prev","Go to Previous Difference"),category:S9e,precondition:Le.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){f2(e)?.accessibleDiffViewerPrev()}}function u4t(n,e,t){return n.get(ai).listDiffEditors().find(s=>{const o=s.getModifiedEditor(),a=s.getOriginalEditor();return o&&o.getModel()?.uri.toString()===t.toString()&&a&&a.getModel()?.uri.toString()===e.toString()})||null}function f2(n){const t=n.get(ai).listDiffEditors(),i=ka();if(i)for(const r of t){const s=r.getContainerDomNode();if(d4t(s,i))return r}return null}function d4t(n,e){let t=e;for(;t;){if(t===n)return!0;t=t.parentElement}return!1}lr(s4t);lr(C9e);lr(x9e);Fo.appendMenuItem(ce.EditorTitle,{command:{id:new x9e().desc.id,title:w("useInlineViewWhenSpaceIsLimited","Use Inline View When Space Is Limited"),toggled:Le.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:Le.has("isInDiffEditor")},order:11,group:"1_diff",when:Le.and(Q.diffEditorRenderSideBySideInlineBreakpointReached,Le.has("isInDiffEditor"))});Fo.appendMenuItem(ce.EditorTitle,{command:{id:new C9e().desc.id,title:w("showMoves","Show Moved Code Blocks"),icon:ze.move,toggled:YL.create("config.diffEditor.experimental.showMoves",!0),precondition:Le.has("isInDiffEditor")},order:10,group:"1_diff",when:Le.has("isInDiffEditor")});lr(cee);for(const n of[{icon:ze.arrowRight,key:Q.diffEditorInlineMode.toNegated()},{icon:ze.discard,key:Q.diffEditorInlineMode}])Fo.appendMenuItem(ce.DiffEditorHunkToolbar,{command:{id:new cee().desc.id,title:w("revertHunk","Revert Block"),icon:n.icon},when:Le.and(Q.diffEditorModifiedWritable,n.key),order:5,group:"primary"}),Fo.appendMenuItem(ce.DiffEditorSelectionToolbar,{command:{id:new cee().desc.id,title:w("revertSelection","Revert Selection"),icon:n.icon},when:Le.and(Q.diffEditorModifiedWritable,n.key),order:5,group:"primary"});lr(o4t);lr(a4t);lr(l4t);lr(c4t);Fo.appendMenuItem(ce.EditorTitle,{command:{id:wO.id,title:w("Open Accessible Diff Viewer","Open Accessible Diff Viewer"),precondition:Le.has("isInDiffEditor")},order:10,group:"2_diff",when:Le.and(Q.accessibleDiffViewerVisible.negate(),Le.has("isInDiffEditor"))});Un.registerCommandAlias("editor.action.diffReview.next",wO.id);lr(wO);Un.registerCommandAlias("editor.action.diffReview.prev",sH.id);lr(sH);var h4t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},f4t=function(n,e){return function(t,i){e(t,i,n)}},uee;const oH=new et("selectionAnchorSet",!1);let Ob=class{static{uee=this}static{this.ID="editor.contrib.selectionAnchorController"}static get(e){return e.getContribution(uee.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=oH.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(yt.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new za().appendText(w("selectionAnchor","Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),ql(w("anchorSet","Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(yt.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};Ob=uee=h4t([f4t(1,jt)],Ob);class g4t extends ot{constructor(){super({id:"editor.action.setSelectionAnchor",label:w("setSelectionAnchor","Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2080),weight:100}})}async run(e,t){Ob.get(t)?.setSelectionAnchor()}}class p4t extends ot{constructor(){super({id:"editor.action.goToSelectionAnchor",label:w("goToSelectionAnchor","Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:oH})}async run(e,t){Ob.get(t)?.goToSelectionAnchor()}}class m4t extends ot{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:w("selectFromAnchorToCursor","Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:oH,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2089),weight:100}})}async run(e,t){Ob.get(t)?.selectFromAnchorToCursor()}}class _4t extends ot{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:w("cancelSelectionAnchor","Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:oH,kbOpts:{kbExpr:Q.editorTextFocus,primary:9,weight:100}})}async run(e,t){Ob.get(t)?.cancelSelectionAnchor()}}Zn(Ob.ID,Ob,4);Pe(g4t);Pe(p4t);Pe(m4t);Pe(_4t);const v4t=J("editorOverviewRuler.bracketMatchForeground","#A0A0A0",w("overviewRulerBracketMatchForeground","Overview ruler marker color for matching brackets."));class b4t extends ot{constructor(){super({id:"editor.action.jumpToBracket",label:w("smartSelect.jumpBracket","Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:3165,weight:100}})}run(e,t){P_.get(t)?.jumpToBracket()}}class y4t extends ot{constructor(){super({id:"editor.action.selectToBracket",label:w("smartSelect.selectToBracket","Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Gt("smartSelect.selectToBracketDescription","Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){let r=!0;i&&i.selectBrackets===!1&&(r=!1),P_.get(t)?.selectToBracket(r)}}class w4t extends ot{constructor(){super({id:"editor.action.removeBrackets",label:w("smartSelect.removeBrackets","Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:2561,weight:100}})}run(e,t){P_.get(t)?.removeBrackets(this.id)}}class C4t{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}class P_ extends me{static{this.ID="editor.contrib.bracketMatchingController"}static get(e){return e.getContribution(P_.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Ui(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(72),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(72)&&(this._matchBrackets=this._editor.getOption(72),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const r=i.getStartPosition(),s=e.bracketPairs.matchBracket(r);let o=null;if(s)s[0].containsPosition(r)&&!s[1].containsPosition(r)?o=s[1].getStartPosition():s[1].containsPosition(r)&&(o=s[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(r);if(a)o=a[1].getStartPosition();else{const l=e.bracketPairs.findNextBracket(r);l&&l.range&&(o=l.range.getStartPosition())}}return o?new yt(o.lineNumber,o.column,o.lineNumber,o.column):new yt(r.lineNumber,r.column,r.lineNumber,r.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(r=>{const s=r.getStartPosition();let o=t.bracketPairs.matchBracket(s);if(!o&&(o=t.bracketPairs.findEnclosingBrackets(s),!o)){const c=t.bracketPairs.findNextBracket(s);c&&c.range&&(o=t.bracketPairs.matchBracket(c.range.getStartPosition()))}let a=null,l=null;if(o){o.sort($.compareRangesUsingStarts);const[c,u]=o;if(a=e?c.getStartPosition():c.getEndPosition(),l=e?u.getEndPosition():u.getStartPosition(),u.containsPosition(s)){const d=a;a=l,l=d}}a&&l&&i.push(new yt(a.lineNumber,a.column,l.lineNumber,l.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const r=i.getPosition();let s=t.bracketPairs.matchBracket(r);s||(s=t.bracketPairs.findEnclosingBrackets(r)),s&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:s[0],text:""},{range:s[1],text:""}]),this._editor.pushUndoStop())})}static{this._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=un.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:ss(v4t),position:Qu.Center}})}static{this._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=un.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const r=i.brackets;r&&(e[t++]={range:r[0],options:i.options},e[t++]={range:r[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let r=[];this._lastVersionId===i&&(r=this._lastBracketsData);const s=[];let o=0;for(let d=0,h=e.length;d1&&s.sort(he.compare);const a=[];let l=0,c=0;const u=r.length;for(let d=0,h=s.length;d0&&(t.pushUndoStop(),t.executeCommands(this.id,r),t.pushUndoStop())}}Pe(E4t);const aH=function(){if(typeof crypto=="object"&&typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let n;typeof crypto=="object"&&typeof crypto.getRandomValues=="function"?n=crypto.getRandomValues.bind(crypto):n=function(i){for(let r=0;rn,asFile:()=>{},value:typeof n=="string"?n:void 0}}function L4t(n,e,t){const i={id:aH(),name:n,uri:e,data:t};return{asString:async()=>"",asFile:()=>i,value:void 0}}class E9e{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return zn.some(this,([i,r])=>r.asFile())&&t.push("files"),T9e(E9(e),t)}get(e){return this._entries.get(this.toKey(e))?.[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return E9(e)}}function E9(n){return n.toLowerCase()}function L9e(n,e){return T9e(E9(n),e.map(E9))}function T9e(n,e){if(n==="*/*")return e.length>0;if(e.includes(n))return!0;const t=n.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,r,s]=t;return s==="*"?e.some(o=>o.startsWith(r+"/")):!1}const lH=Object.freeze({create:n=>j_(n.map(e=>e.toString())).join(`\r `),split:n=>n.split(`\r -`),parse:n=>lH.split(n).filter(e=>!e.startsWith("#"))});class sr{static{this.sep="."}static{this.None=new sr("@@none@@")}static{this.Empty=new sr("")}constructor(e){this.value=e}equals(e){return this.value===e.value}contains(e){return this.equals(e)||this.value===""||e.value.startsWith(this.value+sr.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new sr((this.value?[this.value,...e]:e).join(sr.sep))}}const hCe={EDITORS:"CodeEditors",FILES:"CodeFiles"};class T4t{}const D4t={DragAndDropContribution:"workbench.contributions.dragAndDrop"};Yr.add(D4t.DragAndDropContribution,new T4t);class L9{static{this.INSTANCE=new L9}constructor(){}static getInstance(){return L9.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}}function D9e(n){const e=new E9e;for(const t of n.items){const i=t.type;if(t.kind==="string"){const r=new Promise(s=>t.getAsString(s));e.append(i,Cue(r))}else if(t.kind==="file"){const r=t.getAsFile();r&&e.append(i,I4t(r))}}return e}function I4t(n){const e=n.path?Pt.parse(n.path):void 0;return L4t(n.name,e,async()=>new Uint8Array(await n.arrayBuffer()))}const A4t=Object.freeze([hCe.EDITORS,hCe.FILES,DN.RESOURCES,DN.INTERNAL_URI_LIST]);function I9e(n,e=!1){const t=D9e(n),i=t.get(DN.INTERNAL_URI_LIST);if(i)t.replace(ps.uriList,i);else if(e||!t.has(ps.uriList)){const r=[];for(const s of n.items){const o=s.getAsFile();if(o){const a=o.path;try{a?r.push(Pt.file(a).toString()):r.push(Pt.parse(o.name,!0).toString())}catch{}}}r.length&&t.replace(ps.uriList,Cue(lH.create(r)))}for(const r of A4t)t.delete(r);return t}var xue=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},nR=function(n,e){return function(t,i){e(t,i,n)}};class Sue{async provideDocumentPasteEdits(e,t,i,r,s){const o=await this.getEdit(i,s);if(o)return{edits:[{insertText:o.insertText,title:o.title,kind:o.kind,handledMimeType:o.handledMimeType,yieldTo:o.yieldTo}],dispose(){}}}async provideDocumentDropEdits(e,t,i,r){const s=await this.getEdit(i,r);if(s)return{edits:[{insertText:s.insertText,title:s.title,kind:s.kind,handledMimeType:s.handledMimeType,yieldTo:s.yieldTo}],dispose(){}}}}class Vw extends Sue{constructor(){super(...arguments),this.kind=Vw.kind,this.dropMimeTypes=[ps.text],this.pasteMimeTypes=[ps.text]}static{this.id="text"}static{this.kind=new sr("text.plain")}async getEdit(e,t){const i=e.get(ps.text);if(!i||e.has(ps.uriList))return;const r=await i.asString();return{handledMimeType:ps.text,title:w("text.label","Insert Plain Text"),insertText:r,kind:this.kind}}}class A9e extends Sue{constructor(){super(...arguments),this.kind=new sr("uri.absolute"),this.dropMimeTypes=[ps.uriList],this.pasteMimeTypes=[ps.uriList]}async getEdit(e,t){const i=await N9e(e);if(!i.length||t.isCancellationRequested)return;let r=0;const s=i.map(({uri:a,originalText:l})=>a.scheme===sn.file?a.fsPath:(r++,l)).join(" ");let o;return r>0?o=i.length>1?w("defaultDropProvider.uriList.uris","Insert Uris"):w("defaultDropProvider.uriList.uri","Insert Uri"):o=i.length>1?w("defaultDropProvider.uriList.paths","Insert Paths"):w("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:ps.uriList,insertText:s,title:o,kind:this.kind}}}let T9=class extends Sue{constructor(e){super(),this._workspaceContextService=e,this.kind=new sr("uri.relative"),this.dropMimeTypes=[ps.uriList],this.pasteMimeTypes=[ps.uriList]}async getEdit(e,t){const i=await N9e(e);if(!i.length||t.isCancellationRequested)return;const r=rf(i.map(({uri:s})=>{const o=this._workspaceContextService.getWorkspaceFolder(s);return o?UCt(o.uri,s):void 0}));if(r.length)return{handledMimeType:ps.uriList,insertText:r.join(" "),title:i.length>1?w("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):w("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};T9=xue([nR(0,Mw)],T9);class N4t{constructor(){this.kind=new sr("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:ps.text}]}async provideDocumentPasteEdits(e,t,i,r,s){if(r.triggerKind!==sN.PasteAs&&!r.only?.contains(this.kind))return;const a=await i.get("text/html")?.asString();if(!(!a||s.isCancellationRequested))return{dispose(){},edits:[{insertText:a,yieldTo:this._yieldTo,title:w("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function N9e(n){const e=n.get(ps.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const r of lH.parse(t))try{i.push({uri:Pt.parse(r),originalText:r})}catch{}return i}let dee=class extends me{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new Vw)),this._register(e.documentDropEditProvider.register("*",new A9e)),this._register(e.documentDropEditProvider.register("*",new T9(t)))}};dee=xue([nR(0,dt),nR(1,Mw)],dee);let hee=class extends me{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new Vw)),this._register(e.documentPasteEditProvider.register("*",new A9e)),this._register(e.documentPasteEditProvider.register("*",new T9(t))),this._register(e.documentPasteEditProvider.register("*",new N4t))}};hee=xue([nR(0,dt),nR(1,Mw)],hee);class Pf{constructor(){this.value="",this.pos=0}static{this._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13}}static isDigitCharacter(e){return e>=48&&e<=57}static isVariableCharacter(e){return e===95||e>=97&&e<=122||e>=65&&e<=90}text(e){this.value=e,this.pos=0}tokenText(e){return this.value.substr(e.pos,e.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};const e=this.pos;let t=0,i=this.value.charCodeAt(e),r;if(r=Pf._table[i],typeof r=="number")return this.pos+=1,{type:r,pos:e,len:1};if(Pf.isDigitCharacter(i)){r=8;do t+=1,i=this.value.charCodeAt(e+t);while(Pf.isDigitCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}if(Pf.isVariableCharacter(i)){r=9;do i=this.value.charCodeAt(e+ ++t);while(Pf.isVariableCharacter(i)||Pf.isDigitCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}r=10;do t+=1,i=this.value.charCodeAt(e+t);while(!isNaN(i)&&typeof Pf._table[i]>"u"&&!Pf.isDigitCharacter(i)&&!Pf.isVariableCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}}class g2{constructor(){this._children=[]}appendChild(e){return e instanceof Xc&&this._children[this._children.length-1]instanceof Xc?this._children[this._children.length-1].value+=e.value:(e.parent=this,this._children.push(e)),this}replace(e,t){const{parent:i}=e,r=i.children.indexOf(e),s=i.children.slice(0);s.splice(r,1,...t),i._children=s,function o(a,l){for(const c of a)c.parent=l,o(c.children,c)}(t,i)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let e=this;for(;;){if(!e)return;if(e instanceof CO)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let Xc=class R9e extends g2{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new R9e(this.value)}};class P9e extends g2{}class Nd extends P9e{static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.indext.index?1:0}constructor(e){super(),this.index=e}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof p2?this._children[0]:void 0}clone(){const e=new Nd(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class p2 extends g2{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof Xc&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new p2;return this.options.forEach(e.appendChild,e),e}}class kue extends g2{constructor(){super(...arguments),this.regexp=new RegExp("")}resolve(e){const t=this;let i=!1,r=e.replace(this.regexp,function(){return i=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!i&&this._children.some(s=>s instanceof Uf&&!!s.elseValue)&&(r=this._replace([])),r}_replace(e){let t="";for(const i of this._children)if(i instanceof Uf){let r=e[i.index]||"";r=i.resolve(r),t+=r}else t+=i.toString();return t}toString(){return""}clone(){const e=new kue;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}}class Uf extends g2{constructor(e,t,i,r){super(),this.index=e,this.shorthandName=t,this.ifValue=i,this.elseValue=r}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toPascalCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map(i=>i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}_toCamelCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map((i,r)=>r===0?i.charAt(0).toLowerCase()+i.substr(1):i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}clone(){return new Uf(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class iR extends P9e{constructor(e){super(),this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new Xc(t)],!0):!1}clone(){const e=new iR(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function fCe(n,e){const t=[...n];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class CO extends g2{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof Nd&&(e.push(i),t=!t||t.indexr===e?(i=!0,!1):(t+=r.len(),!0)),i?t:-1}fullLen(e){let t=0;return fCe([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof Nd&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof iR&&t.resolve(e)&&(this._placeholders=void 0),!0)),this}appendChild(e){return this._placeholders=void 0,super.appendChild(e)}replace(e,t){return this._placeholders=void 0,super.replace(e,t)}clone(){const e=new CO;return this._children=this.children.map(t=>t.clone()),e}walk(e){fCe(this.children,e)}}class zw{constructor(){this._scanner=new Pf,this._token={type:14,pos:0,len:0}}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(e){return/\${?CLIPBOARD/.test(e)}parse(e,t,i){const r=new CO;return this.parseFragment(e,r),this.ensureFinalTabstop(r,i??!1,t??!1),r}parseFragment(e,t){const i=t.children.length;for(this._scanner.text(e),this._token=this._scanner.next();this._parse(t););const r=new Map,s=[];t.walk(l=>(l instanceof Nd&&(l.isFinalTabstop?r.set(0,void 0):!r.has(l.index)&&l.children.length>0?r.set(l.index,l.children):s.push(l)),!0));const o=(l,c)=>{const u=r.get(l.index);if(!u)return;const d=new Nd(l.index);d.transform=l.transform;for(const h of u){const f=h.clone();d.appendChild(f),f instanceof Nd&&r.has(f.index)&&!c.has(f.index)&&(c.add(f.index),o(f,c),c.delete(f.index))}t.replace(l,[d])},a=new Set;for(const l of s)o(l,a);return t.children.slice(i)}ensureFinalTabstop(e,t,i){(t||i&&e.placeholders.length>0)&&(e.placeholders.find(s=>s.index===0)||e.appendChild(new Nd(0)))}_accept(e,t){if(e===void 0||this._token.type===e){const i=t?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),i}return!1}_backTo(e){return this._scanner.pos=e.pos+e.len,this._token=e,!1}_until(e){const t=this._token;for(;this._token.type!==e;){if(this._token.type===14)return!1;if(this._token.type===5){const r=this._scanner.next();if(r.type!==0&&r.type!==4&&r.type!==5)return!1}this._token=this._scanner.next()}const i=this._scanner.value.substring(t.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),i}_parse(e){return this._parseEscaped(e)||this._parseTabstopOrVariableName(e)||this._parseComplexPlaceholder(e)||this._parseComplexVariable(e)||this._parseAnything(e)}_parseEscaped(e){let t;return(t=this._accept(5,!0))?(t=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||t,e.appendChild(new Xc(t)),!0):!1}_parseTabstopOrVariableName(e){let t;const i=this._token;return this._accept(0)&&(t=this._accept(9,!0)||this._accept(8,!0))?(e.appendChild(/^\d+$/.test(t)?new Nd(Number(t)):new iR(t)),!0):this._backTo(i)}_parseComplexPlaceholder(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(8,!0))))return this._backTo(i);const s=new Nd(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Xc("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const o=new p2;for(;;){if(this._parseChoiceElement(o)){if(this._accept(2))continue;if(this._accept(7)&&(s.appendChild(o),this._accept(4)))return e.appendChild(s),!0}return this._backTo(i),!1}}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseChoiceElement(e){const t=this._token,i=[];for(;!(this._token.type===2||this._token.type===7);){let r;if((r=this._accept(5,!0))?r=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||r:r=this._accept(void 0,!0),!r)return this._backTo(t),!1;i.push(r)}return i.length===0?(this._backTo(t),!1):(e.appendChild(new Xc(i.join(""))),!0)}_parseComplexVariable(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(9,!0))))return this._backTo(i);const s=new iR(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Xc("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseTransform(e){const t=new kue;let i="",r="";for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(6,!0)||s,i+=s;continue}if(this._token.type!==14){i+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(5,!0)||this._accept(6,!0)||s,t.appendChild(new Xc(s));continue}if(!(this._parseFormatString(t)||this._parseAnything(t)))return!1}for(;!this._accept(4);){if(this._token.type!==14){r+=this._accept(void 0,!0);continue}return!1}try{t.regexp=new RegExp(i,r)}catch{return!1}return e.transform=t,!0}_parseFormatString(e){const t=this._token;if(!this._accept(0))return!1;let i=!1;this._accept(3)&&(i=!0);const r=this._accept(8,!0);if(r)if(i){if(this._accept(4))return e.appendChild(new Uf(Number(r))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Uf(Number(r))),!0;else return this._backTo(t),!1;if(this._accept(6)){const s=this._accept(9,!0);return!s||!this._accept(4)?(this._backTo(t),!1):(e.appendChild(new Uf(Number(r),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new Uf(Number(r),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new Uf(Number(r),void 0,void 0,s)),!0}else if(this._accept(13)){const s=this._until(1);if(s){const o=this._until(4);if(o)return e.appendChild(new Uf(Number(r),void 0,s,o)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new Uf(Number(r),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new Xc(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function O9e(n,e,t){return(typeof t.insertText=="string"?t.insertText==="":t.insertText.snippet==="")?{edits:t.additionalEdit?.edits??[]}:{edits:[...e.map(i=>new ab(n,{range:i,text:typeof t.insertText=="string"?zw.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...t.additionalEdit?.edits??[]]}}function M9e(n){function e(o,a){return"mimeType"in o?o.mimeType===a.handledMimeType:!!a.kind&&o.kind.contains(a.kind)}const t=new Map;for(const o of n)for(const a of o.yieldTo??[])for(const l of n)if(l!==o&&e(a,l)){let c=t.get(o);c||(c=[],t.set(o,c)),c.push(l)}if(!t.size)return Array.from(n);const i=new Set,r=[];function s(o){if(!o.length)return[];const a=o[0];if(r.includes(a))return console.warn("Yield to cycle detected",a),o;if(i.has(a))return s(o.slice(1));let l=[];const c=t.get(a);return c&&(r.push(a),l=s(c),r.pop()),i.add(a),[...l,a,...s(o.slice(1))]}return s(Array.from(n))}var R4t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},P4t=function(n,e){return function(t,i){e(t,i,n)}};const O4t=un.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:q4e,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class Eue extends me{static{this.baseId="editor.widget.inlineProgressWidget"}constructor(e,t,i,r,s){super(),this.typeId=e,this.editor=t,this.range=i,this.delegate=s,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(r),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(e){this.domNode=qe(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=qe("span.icon");this.domNode.append(t),t.classList.add(...zt.asClassNameArray(ze.loading),"codicon-modifier-spin");const i=()=>{const r=this.editor.getOption(67);this.domNode.style.height=`${r}px`,this.domNode.style.width=`${Math.ceil(.8*r)}px`};i(),this._register(this.editor.onDidChangeConfiguration(r=>{(r.hasChanged(52)||r.hasChanged(67))&&i()})),this._register(Ce(this.domNode,je.CLICK,r=>{this.delegate.cancel()}))}getId(){return Eue.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}}let D9=class extends me{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new To),this._currentWidget=this._register(new To),this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,i,r,s){const o=this._operationIdPool++;this._currentOperation=o,this.clear(),this._showPromise.value=Sb(()=>{const a=$.fromPositions(e);this._currentDecorations.set([{range:a,options:O4t}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(Eue,this.id,this._editor,a,t,r))},s??this._showDelay);try{return await i}finally{this._currentOperation===o&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};D9=R4t([P4t(2,Tt)],D9);var M4t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gCe=function(n,e){return function(t,i){e(t,i,n)}},f5;let au=class{static{f5=this}static{this.ID="editor.contrib.messageController"}static{this.MESSAGE_VISIBLE=new et("messageVisible",!1,w("messageVisible","Whether the editor is currently showing an inline message"))}static get(e){return e.getContribution(f5.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new To,this._messageListeners=new ke,this._mouseOverMessage=!1,this._editor=e,this._visible=f5.MESSAGE_VISIBLE.bindTo(t)}dispose(){this._message?.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){ql(bg(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=bg(e)?vW(e,{actionHandler:{callback:r=>{this.closeMessage(),Rle(this._openerService,r,bg(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new pCe(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(Ge.debounce(this._editor.onDidBlurEditorText,(r,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&xo(ka(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(Ce(this._messageWidget.value.getDomNode(),je.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Ce(this._messageWidget.value.getDomNode(),je.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(r=>{r.target.position&&(i?i.containsPosition(r.target.position)||this.closeMessage():i=new $(t.lineNumber-3,1,r.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(pCe.fadeOut(this._messageWidget.value))}};au=f5=M4t([gCe(1,jt),gCe(2,Pc)],au);const F4t=fo.bindToContribution(au.get);Je(new F4t({id:"leaveEditorMessage",precondition:au.MESSAGE_VISIBLE,handler:n=>n.closeMessage(),kbOpts:{weight:130,primary:9}}));let pCe=class{static fadeOut(e){const t=()=>{e.dispose(),clearTimeout(i),e.getDomNode().removeEventListener("animationend",t)},i=setTimeout(t,110);return e.getDomNode().addEventListener("animationend",t),e.getDomNode().classList.add("fadeOut"),{dispose:t}}constructor(e,{lineNumber:t,column:i},r){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=e,this._editor.revealLinesInCenterIfOutsideViewport(t,t,0),this._position={lineNumber:t,column:i},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const s=document.createElement("div");s.classList.add("anchor","top"),this._domNode.appendChild(s);const o=document.createElement("div");typeof r=="string"?(o.classList.add("message"),o.textContent=r):(r.classList.add("message"),o.appendChild(r)),this._domNode.appendChild(o);const a=document.createElement("div");a.classList.add("anchor","below"),this._domNode.appendChild(a),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle("below",e===2)}};Zn(au.ID,au,4);function Mq(n,e){return e&&(n.stack||n.stacktrace)?w("stackTrace.format","{0}: {1}",_Ce(n),mCe(n.stack)||mCe(n.stacktrace)):_Ce(n)}function mCe(n){return Array.isArray(n)?n.join(` +`),parse:n=>lH.split(n).filter(e=>!e.startsWith("#"))});class sr{static{this.sep="."}static{this.None=new sr("@@none@@")}static{this.Empty=new sr("")}constructor(e){this.value=e}equals(e){return this.value===e.value}contains(e){return this.equals(e)||this.value===""||e.value.startsWith(this.value+sr.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new sr((this.value?[this.value,...e]:e).join(sr.sep))}}const hCe={EDITORS:"CodeEditors",FILES:"CodeFiles"};class T4t{}const D4t={DragAndDropContribution:"workbench.contributions.dragAndDrop"};Yr.add(D4t.DragAndDropContribution,new T4t);class L9{static{this.INSTANCE=new L9}constructor(){}static getInstance(){return L9.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}}function D9e(n){const e=new E9e;for(const t of n.items){const i=t.type;if(t.kind==="string"){const r=new Promise(s=>t.getAsString(s));e.append(i,Cue(r))}else if(t.kind==="file"){const r=t.getAsFile();r&&e.append(i,I4t(r))}}return e}function I4t(n){const e=n.path?Pt.parse(n.path):void 0;return L4t(n.name,e,async()=>new Uint8Array(await n.arrayBuffer()))}const A4t=Object.freeze([hCe.EDITORS,hCe.FILES,DN.RESOURCES,DN.INTERNAL_URI_LIST]);function I9e(n,e=!1){const t=D9e(n),i=t.get(DN.INTERNAL_URI_LIST);if(i)t.replace(ps.uriList,i);else if(e||!t.has(ps.uriList)){const r=[];for(const s of n.items){const o=s.getAsFile();if(o){const a=o.path;try{a?r.push(Pt.file(a).toString()):r.push(Pt.parse(o.name,!0).toString())}catch{}}}r.length&&t.replace(ps.uriList,Cue(lH.create(r)))}for(const r of A4t)t.delete(r);return t}var xue=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},nR=function(n,e){return function(t,i){e(t,i,n)}};class Sue{async provideDocumentPasteEdits(e,t,i,r,s){const o=await this.getEdit(i,s);if(o)return{edits:[{insertText:o.insertText,title:o.title,kind:o.kind,handledMimeType:o.handledMimeType,yieldTo:o.yieldTo}],dispose(){}}}async provideDocumentDropEdits(e,t,i,r){const s=await this.getEdit(i,r);if(s)return{edits:[{insertText:s.insertText,title:s.title,kind:s.kind,handledMimeType:s.handledMimeType,yieldTo:s.yieldTo}],dispose(){}}}}class Vw extends Sue{constructor(){super(...arguments),this.kind=Vw.kind,this.dropMimeTypes=[ps.text],this.pasteMimeTypes=[ps.text]}static{this.id="text"}static{this.kind=new sr("text.plain")}async getEdit(e,t){const i=e.get(ps.text);if(!i||e.has(ps.uriList))return;const r=await i.asString();return{handledMimeType:ps.text,title:w("text.label","Insert Plain Text"),insertText:r,kind:this.kind}}}class A9e extends Sue{constructor(){super(...arguments),this.kind=new sr("uri.absolute"),this.dropMimeTypes=[ps.uriList],this.pasteMimeTypes=[ps.uriList]}async getEdit(e,t){const i=await N9e(e);if(!i.length||t.isCancellationRequested)return;let r=0;const s=i.map(({uri:a,originalText:l})=>a.scheme===sn.file?a.fsPath:(r++,l)).join(" ");let o;return r>0?o=i.length>1?w("defaultDropProvider.uriList.uris","Insert Uris"):w("defaultDropProvider.uriList.uri","Insert Uri"):o=i.length>1?w("defaultDropProvider.uriList.paths","Insert Paths"):w("defaultDropProvider.uriList.path","Insert Path"),{handledMimeType:ps.uriList,insertText:s,title:o,kind:this.kind}}}let T9=class extends Sue{constructor(e){super(),this._workspaceContextService=e,this.kind=new sr("uri.relative"),this.dropMimeTypes=[ps.uriList],this.pasteMimeTypes=[ps.uriList]}async getEdit(e,t){const i=await N9e(e);if(!i.length||t.isCancellationRequested)return;const r=rf(i.map(({uri:s})=>{const o=this._workspaceContextService.getWorkspaceFolder(s);return o?UCt(o.uri,s):void 0}));if(r.length)return{handledMimeType:ps.uriList,insertText:r.join(" "),title:i.length>1?w("defaultDropProvider.uriList.relativePaths","Insert Relative Paths"):w("defaultDropProvider.uriList.relativePath","Insert Relative Path"),kind:this.kind}}};T9=xue([nR(0,Mw)],T9);class N4t{constructor(){this.kind=new sr("html"),this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:ps.text}]}async provideDocumentPasteEdits(e,t,i,r,s){if(r.triggerKind!==sN.PasteAs&&!r.only?.contains(this.kind))return;const a=await i.get("text/html")?.asString();if(!(!a||s.isCancellationRequested))return{dispose(){},edits:[{insertText:a,yieldTo:this._yieldTo,title:w("pasteHtmlLabel","Insert HTML"),kind:this.kind}]}}}async function N9e(n){const e=n.get(ps.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const r of lH.parse(t))try{i.push({uri:Pt.parse(r),originalText:r})}catch{}return i}let dee=class extends me{constructor(e,t){super(),this._register(e.documentDropEditProvider.register("*",new Vw)),this._register(e.documentDropEditProvider.register("*",new A9e)),this._register(e.documentDropEditProvider.register("*",new T9(t)))}};dee=xue([nR(0,dt),nR(1,Mw)],dee);let hee=class extends me{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register("*",new Vw)),this._register(e.documentPasteEditProvider.register("*",new A9e)),this._register(e.documentPasteEditProvider.register("*",new T9(t))),this._register(e.documentPasteEditProvider.register("*",new N4t))}};hee=xue([nR(0,dt),nR(1,Mw)],hee);class Pf{constructor(){this.value="",this.pos=0}static{this._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13}}static isDigitCharacter(e){return e>=48&&e<=57}static isVariableCharacter(e){return e===95||e>=97&&e<=122||e>=65&&e<=90}text(e){this.value=e,this.pos=0}tokenText(e){return this.value.substr(e.pos,e.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};const e=this.pos;let t=0,i=this.value.charCodeAt(e),r;if(r=Pf._table[i],typeof r=="number")return this.pos+=1,{type:r,pos:e,len:1};if(Pf.isDigitCharacter(i)){r=8;do t+=1,i=this.value.charCodeAt(e+t);while(Pf.isDigitCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}if(Pf.isVariableCharacter(i)){r=9;do i=this.value.charCodeAt(e+ ++t);while(Pf.isVariableCharacter(i)||Pf.isDigitCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}r=10;do t+=1,i=this.value.charCodeAt(e+t);while(!isNaN(i)&&typeof Pf._table[i]>"u"&&!Pf.isDigitCharacter(i)&&!Pf.isVariableCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}}class g2{constructor(){this._children=[]}appendChild(e){return e instanceof Xc&&this._children[this._children.length-1]instanceof Xc?this._children[this._children.length-1].value+=e.value:(e.parent=this,this._children.push(e)),this}replace(e,t){const{parent:i}=e,r=i.children.indexOf(e),s=i.children.slice(0);s.splice(r,1,...t),i._children=s,function o(a,l){for(const c of a)c.parent=l,o(c.children,c)}(t,i)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let e=this;for(;;){if(!e)return;if(e instanceof CO)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}let Xc=class R9e extends g2{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new R9e(this.value)}};class P9e extends g2{}class Nd extends P9e{static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.indext.index?1:0}constructor(e){super(),this.index=e}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof p2?this._children[0]:void 0}clone(){const e=new Nd(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class p2 extends g2{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof Xc&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new p2;return this.options.forEach(e.appendChild,e),e}}class kue extends g2{constructor(){super(...arguments),this.regexp=new RegExp("")}resolve(e){const t=this;let i=!1,r=e.replace(this.regexp,function(){return i=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!i&&this._children.some(s=>s instanceof Uf&&!!s.elseValue)&&(r=this._replace([])),r}_replace(e){let t="";for(const i of this._children)if(i instanceof Uf){let r=e[i.index]||"";r=i.resolve(r),t+=r}else t+=i.toString();return t}toString(){return""}clone(){const e=new kue;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}}class Uf extends g2{constructor(e,t,i,r){super(),this.index=e,this.shorthandName=t,this.ifValue=i,this.elseValue=r}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toPascalCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map(i=>i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}_toCamelCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map((i,r)=>r===0?i.charAt(0).toLowerCase()+i.substr(1):i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}clone(){return new Uf(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class iR extends P9e{constructor(e){super(),this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new Xc(t)],!0):!1}clone(){const e=new iR(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function fCe(n,e){const t=[...n];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class CO extends g2{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof Nd&&(e.push(i),t=!t||t.indexr===e?(i=!0,!1):(t+=r.len(),!0)),i?t:-1}fullLen(e){let t=0;return fCe([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof Nd&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof iR&&t.resolve(e)&&(this._placeholders=void 0),!0)),this}appendChild(e){return this._placeholders=void 0,super.appendChild(e)}replace(e,t){return this._placeholders=void 0,super.replace(e,t)}clone(){const e=new CO;return this._children=this.children.map(t=>t.clone()),e}walk(e){fCe(this.children,e)}}class zw{constructor(){this._scanner=new Pf,this._token={type:14,pos:0,len:0}}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(e){return/\${?CLIPBOARD/.test(e)}parse(e,t,i){const r=new CO;return this.parseFragment(e,r),this.ensureFinalTabstop(r,i??!1,t??!1),r}parseFragment(e,t){const i=t.children.length;for(this._scanner.text(e),this._token=this._scanner.next();this._parse(t););const r=new Map,s=[];t.walk(l=>(l instanceof Nd&&(l.isFinalTabstop?r.set(0,void 0):!r.has(l.index)&&l.children.length>0?r.set(l.index,l.children):s.push(l)),!0));const o=(l,c)=>{const u=r.get(l.index);if(!u)return;const d=new Nd(l.index);d.transform=l.transform;for(const h of u){const f=h.clone();d.appendChild(f),f instanceof Nd&&r.has(f.index)&&!c.has(f.index)&&(c.add(f.index),o(f,c),c.delete(f.index))}t.replace(l,[d])},a=new Set;for(const l of s)o(l,a);return t.children.slice(i)}ensureFinalTabstop(e,t,i){(t||i&&e.placeholders.length>0)&&(e.placeholders.find(s=>s.index===0)||e.appendChild(new Nd(0)))}_accept(e,t){if(e===void 0||this._token.type===e){const i=t?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),i}return!1}_backTo(e){return this._scanner.pos=e.pos+e.len,this._token=e,!1}_until(e){const t=this._token;for(;this._token.type!==e;){if(this._token.type===14)return!1;if(this._token.type===5){const r=this._scanner.next();if(r.type!==0&&r.type!==4&&r.type!==5)return!1}this._token=this._scanner.next()}const i=this._scanner.value.substring(t.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),i}_parse(e){return this._parseEscaped(e)||this._parseTabstopOrVariableName(e)||this._parseComplexPlaceholder(e)||this._parseComplexVariable(e)||this._parseAnything(e)}_parseEscaped(e){let t;return(t=this._accept(5,!0))?(t=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||t,e.appendChild(new Xc(t)),!0):!1}_parseTabstopOrVariableName(e){let t;const i=this._token;return this._accept(0)&&(t=this._accept(9,!0)||this._accept(8,!0))?(e.appendChild(/^\d+$/.test(t)?new Nd(Number(t)):new iR(t)),!0):this._backTo(i)}_parseComplexPlaceholder(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(8,!0))))return this._backTo(i);const s=new Nd(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Xc("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const o=new p2;for(;;){if(this._parseChoiceElement(o)){if(this._accept(2))continue;if(this._accept(7)&&(s.appendChild(o),this._accept(4)))return e.appendChild(s),!0}return this._backTo(i),!1}}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseChoiceElement(e){const t=this._token,i=[];for(;!(this._token.type===2||this._token.type===7);){let r;if((r=this._accept(5,!0))?r=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||r:r=this._accept(void 0,!0),!r)return this._backTo(t),!1;i.push(r)}return i.length===0?(this._backTo(t),!1):(e.appendChild(new Xc(i.join(""))),!0)}_parseComplexVariable(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(9,!0))))return this._backTo(i);const s=new iR(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Xc("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseTransform(e){const t=new kue;let i="",r="";for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(6,!0)||s,i+=s;continue}if(this._token.type!==14){i+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(5,!0)||this._accept(6,!0)||s,t.appendChild(new Xc(s));continue}if(!(this._parseFormatString(t)||this._parseAnything(t)))return!1}for(;!this._accept(4);){if(this._token.type!==14){r+=this._accept(void 0,!0);continue}return!1}try{t.regexp=new RegExp(i,r)}catch{return!1}return e.transform=t,!0}_parseFormatString(e){const t=this._token;if(!this._accept(0))return!1;let i=!1;this._accept(3)&&(i=!0);const r=this._accept(8,!0);if(r)if(i){if(this._accept(4))return e.appendChild(new Uf(Number(r))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Uf(Number(r))),!0;else return this._backTo(t),!1;if(this._accept(6)){const s=this._accept(9,!0);return!s||!this._accept(4)?(this._backTo(t),!1):(e.appendChild(new Uf(Number(r),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new Uf(Number(r),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new Uf(Number(r),void 0,void 0,s)),!0}else if(this._accept(13)){const s=this._until(1);if(s){const o=this._until(4);if(o)return e.appendChild(new Uf(Number(r),void 0,s,o)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new Uf(Number(r),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new Xc(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function O9e(n,e,t){return(typeof t.insertText=="string"?t.insertText==="":t.insertText.snippet==="")?{edits:t.additionalEdit?.edits??[]}:{edits:[...e.map(i=>new ab(n,{range:i,text:typeof t.insertText=="string"?zw.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...t.additionalEdit?.edits??[]]}}function M9e(n){function e(o,a){return"mimeType"in o?o.mimeType===a.handledMimeType:!!a.kind&&o.kind.contains(a.kind)}const t=new Map;for(const o of n)for(const a of o.yieldTo??[])for(const l of n)if(l!==o&&e(a,l)){let c=t.get(o);c||(c=[],t.set(o,c)),c.push(l)}if(!t.size)return Array.from(n);const i=new Set,r=[];function s(o){if(!o.length)return[];const a=o[0];if(r.includes(a))return console.warn("Yield to cycle detected",a),o;if(i.has(a))return s(o.slice(1));let l=[];const c=t.get(a);return c&&(r.push(a),l=s(c),r.pop()),i.add(a),[...l,a,...s(o.slice(1))]}return s(Array.from(n))}var R4t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},P4t=function(n,e){return function(t,i){e(t,i,n)}};const O4t=un.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:q4e,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class Eue extends me{static{this.baseId="editor.widget.inlineProgressWidget"}constructor(e,t,i,r,s){super(),this.typeId=e,this.editor=t,this.range=i,this.delegate=s,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(r),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(e){this.domNode=qe(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=qe("span.icon");this.domNode.append(t),t.classList.add(...zt.asClassNameArray(ze.loading),"codicon-modifier-spin");const i=()=>{const r=this.editor.getOption(67);this.domNode.style.height=`${r}px`,this.domNode.style.width=`${Math.ceil(.8*r)}px`};i(),this._register(this.editor.onDidChangeConfiguration(r=>{(r.hasChanged(52)||r.hasChanged(67))&&i()})),this._register(Ce(this.domNode,je.CLICK,r=>{this.delegate.cancel()}))}getId(){return Eue.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}}let D9=class extends me{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new To),this._currentWidget=this._register(new To),this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,i,r,s){const o=this._operationIdPool++;this._currentOperation=o,this.clear(),this._showPromise.value=Sb(()=>{const a=$.fromPositions(e);this._currentDecorations.set([{range:a,options:O4t}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(Eue,this.id,this._editor,a,t,r))},s??this._showDelay);try{return await i}finally{this._currentOperation===o&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};D9=R4t([P4t(2,Tt)],D9);var M4t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gCe=function(n,e){return function(t,i){e(t,i,n)}},fF;let au=class{static{fF=this}static{this.ID="editor.contrib.messageController"}static{this.MESSAGE_VISIBLE=new et("messageVisible",!1,w("messageVisible","Whether the editor is currently showing an inline message"))}static get(e){return e.getContribution(fF.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new To,this._messageListeners=new ke,this._mouseOverMessage=!1,this._editor=e,this._visible=fF.MESSAGE_VISIBLE.bindTo(t)}dispose(){this._message?.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){ql(bg(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=bg(e)?vW(e,{actionHandler:{callback:r=>{this.closeMessage(),Rle(this._openerService,r,bg(e)?e.isTrusted:void 0)},disposables:this._messageListeners}}):void 0,this._messageWidget.value=new pCe(this._editor,t,typeof e=="string"?e:this._message.element),this._messageListeners.add(Ge.debounce(this._editor.onDidBlurEditorText,(r,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&xo(ka(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add(Ce(this._messageWidget.value.getDomNode(),je.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Ce(this._messageWidget.value.getDomNode(),je.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(r=>{r.target.position&&(i?i.containsPosition(r.target.position)||this.closeMessage():i=new $(t.lineNumber-3,1,r.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(pCe.fadeOut(this._messageWidget.value))}};au=fF=M4t([gCe(1,jt),gCe(2,Pc)],au);const F4t=fo.bindToContribution(au.get);Je(new F4t({id:"leaveEditorMessage",precondition:au.MESSAGE_VISIBLE,handler:n=>n.closeMessage(),kbOpts:{weight:130,primary:9}}));let pCe=class{static fadeOut(e){const t=()=>{e.dispose(),clearTimeout(i),e.getDomNode().removeEventListener("animationend",t)},i=setTimeout(t,110);return e.getDomNode().addEventListener("animationend",t),e.getDomNode().classList.add("fadeOut"),{dispose:t}}constructor(e,{lineNumber:t,column:i},r){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=e,this._editor.revealLinesInCenterIfOutsideViewport(t,t,0),this._position={lineNumber:t,column:i},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const s=document.createElement("div");s.classList.add("anchor","top"),this._domNode.appendChild(s);const o=document.createElement("div");typeof r=="string"?(o.classList.add("message"),o.textContent=r):(r.classList.add("message"),o.appendChild(r)),this._domNode.appendChild(o);const a=document.createElement("div");a.classList.add("anchor","below"),this._domNode.appendChild(a),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle("below",e===2)}};Zn(au.ID,au,4);function Mq(n,e){return e&&(n.stack||n.stacktrace)?w("stackTrace.format","{0}: {1}",_Ce(n),mCe(n.stack)||mCe(n.stacktrace)):_Ce(n)}function mCe(n){return Array.isArray(n)?n.join(` `):n}function _Ce(n){return n.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${n.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof n.code=="string"&&typeof n.errno=="number"&&typeof n.syscall=="string"?w("nodeExceptionMessage","A system error occurred ({0})",n.message):n.message||w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}function I9(n=null,e=!1){if(!n)return w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.");if(Array.isArray(n)){const t=rf(n),i=I9(t[0],e);return t.length>1?w("error.moreErrors","{0} ({1} errors in total)",i,t.length):i}if(yc(n))return n;if(n.detail){const t=n.detail;if(t.error)return Mq(t.error,e);if(t.exception)return Mq(t.exception,e)}return n.stack?Mq(n,e):n.message?n.message:w("error.defaultMessage","An unknown error occurred. Please consult the log for more details.")}var F9e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ek=function(n,e){return function(t,i){e(t,i,n)}},fee;let gee=class extends me{static{fee=this}static{this.baseId="editor.widget.postEditWidget"}constructor(e,t,i,r,s,o,a,l,c,u){super(),this.typeId=e,this.editor=t,this.showCommand=r,this.range=s,this.edits=o,this.onSelectNewEdit=a,this._contextMenuService=l,this._keybindingService=u,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(c),this.visibleContext.set(!0),this._register(Lt(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Lt(()=>this.editor.removeContentWidget(this))),this._register(this.editor.onDidChangeCursorPosition(d=>{s.containsPosition(d.position)||this.dispose()})),this._register(Ge.runAndSubscribe(u.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}_updateButtonTitle(){const e=this._keybindingService.lookupKeybinding(this.showCommand.id)?.getLabel();this.button.element.title=this.showCommand.label+(e?` (${e})`:"")}create(){this.domNode=qe(".post-edit-widget"),this.button=this._register(new V8(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Ce(this.domNode,je.CLICK,()=>this.showSelector()))}getId(){return fee.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const e=ms(this.button.element);return{x:e.left+e.width,y:e.top+e.height}},getActions:()=>this.edits.allEdits.map((e,t)=>Yy({id:"",label:e.title,checked:t===this.edits.activeEditIndex,run:()=>{if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}}))})}};gee=fee=F9e([Ek(7,mu),Ek(8,jt),Ek(9,xi)],gee);let A9=class extends me{constructor(e,t,i,r,s,o,a){super(),this._id=e,this._editor=t,this._visibleContext=i,this._showCommand=r,this._instantiationService=s,this._bulkEditService=o,this._notificationService=a,this._currentWidget=this._register(new To),this._register(Ge.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,i,r,s){const o=this._editor.getModel();if(!o||!e.length)return;const a=t.allEdits.at(t.activeEditIndex);if(!a)return;const l=async m=>{const _=this._editor.getModel();_&&(await _.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:m,allEdits:t.allEdits},i,r,s))},c=(m,_)=>{uh(m)||(this._notificationService.error(_),i&&this.show(e[0],t,l))};let u;try{u=await r(a,s)}catch(m){return c(m,w("resolveError",`Error resolving edit '{0}': {1}`,a.title,I9(m)))}if(s.isCancellationRequested)return;const d=O9e(o.uri,e,u),h=e[0],f=o.deltaDecorations([],[{range:h,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let g,p;try{g=await this._bulkEditService.apply(d,{editor:this._editor,token:s}),p=o.getDecorationRange(f[0])}catch(m){return c(m,w("applyError",`Error applying edit '{0}': -{1}`,a.title,I9(m)))}finally{o.deltaDecorations(f,[])}s.isCancellationRequested||i&&g.isApplied&&t.allEdits.length>1&&this.show(p??h,t,l)}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(gee,this._id,this._editor,this._visibleContext,this._showCommand,e,t,i))}clear(){this._currentWidget.clear()}tryShowSelector(){this._currentWidget.value?.showSelector()}};A9=F9e([Ek(4,Tt),Ek(5,rO),Ek(6,Ts)],A9);var B4t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},bx=function(n,e){return function(t,i){e(t,i,n)}},X1;const B9e="editor.changePasteType",Lue=new et("pasteWidgetVisible",!1,w("pasteWidgetVisible","Whether the paste widget is showing")),Fq="application/vnd.code.copyMetadata";let t0=class extends me{static{X1=this}static{this.ID="editor.contrib.copyPasteActionController"}static get(e){return e.getContribution(X1.ID)}constructor(e,t,i,r,s,o,a){super(),this._bulkEditService=i,this._clipboardService=r,this._languageFeaturesService=s,this._quickInputService=o,this._progressService=a,this._editor=e;const l=e.getContainerDomNode();this._register(Ce(l,"copy",c=>this.handleCopy(c))),this._register(Ce(l,"cut",c=>this.handleCopy(c))),this._register(Ce(l,"paste",c=>this.handlePaste(c),!0)),this._pasteProgressManager=this._register(new D9("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(A9,"pasteIntoEditor",e,Lue,{id:B9e,label:w("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},GL().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(85).enabled}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){if(!this._editor.hasTextFocus()||(this._clipboardService.clearInternalState?.(),!e.clipboardData||!this.isPasteAsEnabled()))return;const t=this._editor.getModel(),i=this._editor.getSelections();if(!t||!i?.length)return;const r=this._editor.getOption(37);let s=i;const o=i.length===1&&i[0].isEmpty();if(o){if(!r)return;s=[new $(s[0].startLineNumber,1,s[0].startLineNumber,1+t.getLineLength(s[0].startLineNumber))]}const a=this._editor._getViewModel()?.getPlainTextToCopy(i,r,Ta),c={multicursorText:Array.isArray(a)?a:null,pasteOnNewLine:o,mode:null},u=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(p=>!!p.prepareDocumentPaste);if(!u.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:c});return}const d=D9e(e.clipboardData),h=u.flatMap(p=>p.copyMimeTypes??[]),f=aH();this.setCopyMetadata(e.clipboardData,{id:f,providerCopyMimeTypes:h,defaultPastePayload:c});const g=ko(async p=>{const m=rf(await Promise.all(u.map(async _=>{try{return await _.prepareDocumentPaste(t,s,d,p)}catch(v){console.error(v);return}})));m.reverse();for(const _ of m)for(const[v,y]of _)d.replace(v,y);return d});X1._currentCopyOperation?.dataTransferPromise.cancel(),X1._currentCopyOperation={handle:f,dataTransferPromise:g}}async handlePaste(e){if(!e.clipboardData||!this._editor.hasTextFocus())return;au.get(this._editor)?.closeMessage(),this._currentPasteOperation?.cancel(),this._currentPasteOperation=void 0;const t=this._editor.getModel(),i=this._editor.getSelections();if(!i?.length||!t||this._editor.getOption(92)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;const r=this.fetchCopyMetadata(e),s=I9e(e.clipboardData);s.delete(Fq);const o=[...e.clipboardData.types,...r?.providerCopyMimeTypes??[],ps.uriList],a=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(l=>{const c=this._pasteAsActionContext?.preferred;return c&&l.providedPasteEditKinds&&!this.providerMatchesPreference(l,c)?!1:l.pasteMimeTypes?.some(u=>L9e(u,o))});if(!a.length){this._pasteAsActionContext?.preferred&&this.showPasteAsNoEditMessage(i,this._pasteAsActionContext.preferred);return}e.preventDefault(),e.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,a,i,s,r):this.doPasteInline(a,i,s,r,e)}showPasteAsNoEditMessage(e,t){au.get(this._editor)?.showMessage(w("pasteAsError","No paste edits for '{0}' found",t instanceof sr?t.value:t.providerId),e[0].getStartPosition())}doPasteInline(e,t,i,r,s){const o=this._editor;if(!o.hasModel())return;const a=new Pb(o,3,void 0),l=ko(async c=>{const u=this._editor;if(!u.hasModel())return;const d=u.getModel(),h=new ke,f=h.add(new Kr(c));h.add(a.token.onCancellationRequested(()=>f.cancel()));const g=f.token;try{if(await this.mergeInDataFromCopy(i,r,g),g.isCancellationRequested)return;const p=e.filter(v=>this.isSupportedPasteProvider(v,i));if(!p.length||p.length===1&&p[0]instanceof Vw)return this.applyDefaultPasteHandler(i,r,g,s);const m={triggerKind:sN.Automatic},_=await this.getPasteEdits(p,i,d,t,m,g);if(h.add(_),g.isCancellationRequested)return;if(_.edits.length===1&&_.edits[0].provider instanceof Vw)return this.applyDefaultPasteHandler(i,r,g,s);if(_.edits.length){const v=u.getOption(85).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:0,allEdits:_.edits},v,(y,C)=>new Promise((x,k)=>{(async()=>{try{const L=y.provider.resolveDocumentPasteEdit?.(y,C),D=new KL,I=L&&await this._pasteProgressManager.showWhile(t[0].getEndPosition(),w("resolveProcess","Resolving paste edit. Click to cancel"),Promise.race([D.p,L]),{cancel:()=>(D.cancel(),k(new sf))},0);return I&&(y.additionalEdit=I.additionalEdit),x(y)}catch(L){return k(L)}})()}),g)}await this.applyDefaultPasteHandler(i,r,g,s)}finally{h.dispose(),this._currentPasteOperation===l&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),w("pasteIntoEditorProgress","Running paste handlers. Click to cancel and do basic paste"),l,{cancel:async()=>{try{if(l.cancel(),a.token.isCancellationRequested)return;await this.applyDefaultPasteHandler(i,r,a.token,s)}finally{a.dispose()}}}).then(()=>{a.dispose()}),this._currentPasteOperation=l}showPasteAsPick(e,t,i,r,s){const o=ko(async a=>{const l=this._editor;if(!l.hasModel())return;const c=l.getModel(),u=new ke,d=u.add(new Pb(l,3,void 0,a));try{if(await this.mergeInDataFromCopy(r,s,d.token),d.token.isCancellationRequested)return;let h=t.filter(_=>this.isSupportedPasteProvider(_,r,e));e&&(h=h.filter(_=>this.providerMatchesPreference(_,e)));const f={triggerKind:sN.PasteAs,only:e&&e instanceof sr?e:void 0};let g=u.add(await this.getPasteEdits(h,r,c,i,f,d.token));if(d.token.isCancellationRequested)return;if(e&&(g={edits:g.edits.filter(_=>e instanceof sr?e.contains(_.kind):e.providerId===_.provider.id),dispose:g.dispose}),!g.edits.length){f.only&&this.showPasteAsNoEditMessage(i,f.only);return}let p;if(e?p=g.edits.at(0):p=(await this._quickInputService.pick(g.edits.map(v=>({label:v.title,description:v.kind?.value,edit:v})),{placeHolder:w("pasteAsPickerPlaceholder","Select Paste Action")}))?.edit,!p)return;const m=O9e(c.uri,i,p);await this._bulkEditService.apply(m,{editor:this._editor})}finally{u.dispose(),this._currentPasteOperation===o&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:w("pasteAsProgress","Running paste handlers")},()=>o)}setCopyMetadata(e,t){e.setData(Fq,JSON.stringify(t))}fetchCopyMetadata(e){if(!e.clipboardData)return;const t=e.clipboardData.getData(Fq);if(t)try{return JSON.parse(t)}catch{return}const[i,r]=AJ.getTextData(e.clipboardData);if(r)return{defaultPastePayload:{mode:r.mode,multicursorText:r.multicursorText??null,pasteOnNewLine:!!r.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,i){if(t?.id&&X1._currentCopyOperation?.handle===t.id){const r=await X1._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[s,o]of r)e.replace(s,o)}if(!e.has(ps.uriList)){const r=await this._clipboardService.readResources();if(i.isCancellationRequested)return;r.length&&e.append(ps.uriList,Cue(lH.create(r)))}}async getPasteEdits(e,t,i,r,s,o){const a=new ke,l=await YP(Promise.all(e.map(async u=>{try{const d=await u.provideDocumentPasteEdits?.(i,r,t,s,o);return d&&a.add(d),d?.edits?.map(h=>({...h,provider:u}))}catch(d){uh(d)||console.error(d);return}})),o),c=rf(l??[]).flat().filter(u=>!s.only||s.only.contains(u.kind));return{edits:M9e(c),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,r){const o=await(e.get(ps.text)??e.get("text"))?.asString()??"";if(i.isCancellationRequested)return;const a={clipboardEvent:r,text:o,pasteOnNewLine:t?.defaultPastePayload.pasteOnNewLine??!1,multicursorText:t?.defaultPastePayload.multicursorText??null,mode:null};this._editor.trigger("keyboard","paste",a)}isSupportedPasteProvider(e,t,i){return e.pasteMimeTypes?.some(r=>t.matches(r))?!i||this.providerMatchesPreference(e,i):!1}providerMatchesPreference(e,t){return t instanceof sr?e.providedPasteEditKinds?e.providedPasteEditKinds.some(i=>t.contains(i)):!0:e.id===t.providerId}};t0=X1=B4t([bx(1,Tt),bx(2,rO),bx(3,b0),bx(4,dt),bx(5,hh),bx(6,t5e)],t0);const Uw="9_cutcopypaste",$4t=hg||document.queryCommandSupported("cut"),$9e=hg||document.queryCommandSupported("copy"),W4t=typeof navigator.clipboard>"u"||Xd?document.queryCommandSupported("paste"):!0;function Tue(n){return n.register(),n}const H4t=$4t?Tue(new ZL({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:hg?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:ce.MenubarEditMenu,group:"2_ccp",title:w({key:"miCut",comment:["&& denotes a mnemonic"]},"Cu&&t"),order:1},{menuId:ce.EditorContext,group:Uw,title:w("actions.clipboard.cutLabel","Cut"),when:Q.writable,order:1},{menuId:ce.CommandPalette,group:"",title:w("actions.clipboard.cutLabel","Cut"),order:1},{menuId:ce.SimpleEditorContext,group:Uw,title:w("actions.clipboard.cutLabel","Cut"),when:Q.writable,order:1}]})):void 0,V4t=$9e?Tue(new ZL({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:hg?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:ce.MenubarEditMenu,group:"2_ccp",title:w({key:"miCopy",comment:["&& denotes a mnemonic"]},"&&Copy"),order:2},{menuId:ce.EditorContext,group:Uw,title:w("actions.clipboard.copyLabel","Copy"),order:2},{menuId:ce.CommandPalette,group:"",title:w("actions.clipboard.copyLabel","Copy"),order:1},{menuId:ce.SimpleEditorContext,group:Uw,title:w("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;Fo.appendMenuItem(ce.MenubarEditMenu,{submenu:ce.MenubarCopy,title:Gt("copy as","Copy As"),group:"2_ccp",order:3});Fo.appendMenuItem(ce.EditorContext,{submenu:ce.EditorContextCopy,title:Gt("copy as","Copy As"),group:Uw,order:3});Fo.appendMenuItem(ce.EditorContext,{submenu:ce.EditorContextShare,title:Gt("share","Share"),group:"11_share",order:-1,when:Le.and(Le.notEquals("resourceScheme","output"),Q.editorTextFocus)});Fo.appendMenuItem(ce.ExplorerContext,{submenu:ce.ExplorerContextShare,title:Gt("share","Share"),group:"11_share",order:-1});const Bq=W4t?Tue(new ZL({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:hg?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:ce.MenubarEditMenu,group:"2_ccp",title:w({key:"miPaste",comment:["&& denotes a mnemonic"]},"&&Paste"),order:4},{menuId:ce.EditorContext,group:Uw,title:w("actions.clipboard.pasteLabel","Paste"),when:Q.writable,order:4},{menuId:ce.CommandPalette,group:"",title:w("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:ce.SimpleEditorContext,group:Uw,title:w("actions.clipboard.pasteLabel","Paste"),when:Q.writable,order:4}]})):void 0;class z4t extends ot{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:w("actions.clipboard.copyWithSyntaxHighlightingLabel","Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(DJ.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),DJ.forceCopyWithSyntaxHighlighting=!1)}}function W9e(n,e){n&&(n.addImplementation(1e4,"code-editor",(t,i)=>{const r=t.get(ai).getFocusedCodeEditor();if(r&&r.hasTextFocus()){const s=r.getOption(37),o=r.getSelection();return o&&o.isEmpty()&&!s||r.getContainerDomNode().ownerDocument.execCommand(e),!0}return!1}),n.addImplementation(0,"generic-dom",(t,i)=>(GL().execCommand(e),!0)))}W9e(H4t,"cut");W9e(V4t,"copy");Bq&&(Bq.addImplementation(1e4,"code-editor",(n,e)=>{const t=n.get(ai),i=n.get(b0),r=t.getFocusedCodeEditor();return r&&r.hasTextFocus()?r.getContainerDomNode().ownerDocument.execCommand("paste")?t0.get(r)?.finishedPaste()??Promise.resolve():pC?(async()=>{const o=await i.readText();if(o!==""){const a=jN.INSTANCE.get(o);let l=!1,c=null,u=null;a&&(l=r.getOption(37)&&!!a.isFromEmptySelection,c=typeof a.multicursorText<"u"?a.multicursorText:null,u=a.mode),r.trigger("keyboard","paste",{text:o,pasteOnNewLine:l,multicursorText:c,mode:u})}})():!0:!1}),Bq.addImplementation(0,"generic-dom",(n,e)=>(GL().execCommand("paste"),!0)));$9e&&Pe(z4t);const Dr=new class{constructor(){this.QuickFix=new sr("quickfix"),this.Refactor=new sr("refactor"),this.RefactorExtract=this.Refactor.append("extract"),this.RefactorInline=this.Refactor.append("inline"),this.RefactorMove=this.Refactor.append("move"),this.RefactorRewrite=this.Refactor.append("rewrite"),this.Notebook=new sr("notebook"),this.Source=new sr("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var hu;(function(n){n.Refactor="refactor",n.RefactorPreview="refactor preview",n.Lightbulb="lightbulb",n.Default="other (default)",n.SourceAction="source action",n.QuickFix="quick fix action",n.FixAll="fix all",n.OrganizeImports="organize imports",n.AutoFix="auto fix",n.QuickFixHover="quick fix hover window",n.OnSave="save participants",n.ProblemsView="problems view"})(hu||(hu={}));function U4t(n,e){return!(n.include&&!n.include.intersects(e)||n.excludes&&n.excludes.some(t=>H9e(e,t,n.include))||!n.includeSourceActions&&Dr.Source.contains(e))}function j4t(n,e){const t=e.kind?new sr(e.kind):void 0;return!(n.include&&(!t||!n.include.contains(t))||n.excludes&&t&&n.excludes.some(i=>H9e(t,i,n.include))||!n.includeSourceActions&&t&&Dr.Source.contains(t)||n.onlyIncludePreferredActions&&!e.isPreferred)}function H9e(n,e,t){return!(!e.contains(n)||t&&e.contains(t))}class xp{static fromUser(e,t){return!e||typeof e!="object"?new xp(t.kind,t.apply,!1):new xp(xp.getKindFromUser(e,t.kind),xp.getApplyFromUser(e,t.apply),xp.getPreferredUser(e))}static getApplyFromUser(e,t){switch(typeof e.apply=="string"?e.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return t}}static getKindFromUser(e,t){return typeof e.kind=="string"?new sr(e.kind):t}static getPreferredUser(e){return typeof e.preferred=="boolean"?e.preferred:!1}constructor(e,t,i){this.kind=e,this.apply=t,this.preferred=i}}class q4t{constructor(e,t,i){this.action=e,this.provider=t,this.highlightRange=i}async resolve(e){if(this.provider?.resolveCodeAction&&!this.action.edit){let t;try{t=await this.provider.resolveCodeAction(this.action,e)}catch(i){vs(i)}t&&(this.action.edit=t.edit)}return this}}const V9e="editor.action.codeAction",Due="editor.action.quickFix",z9e="editor.action.autoFix",U9e="editor.action.refactor",j9e="editor.action.sourceAction",pee="editor.action.organizeImports",mee="editor.action.fixAll";class VI extends me{static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:bl(e.diagnostics)?bl(t.diagnostics)?VI.codeActionsPreferredComparator(e,t):-1:bl(t.diagnostics)?1:VI.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(VI.codeActionsComparator),this.validActions=this.allActions.filter(({action:r})=>!r.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&Dr.QuickFix.contains(new sr(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}}const vCe={actions:[],documentation:void 0};async function MS(n,e,t,i,r,s){const o=i.filter||{},a={...o,excludes:[...o.excludes||[],Dr.Notebook]},l={only:o.include?.value,trigger:i.type},c=new pue(e,s),u=i.type===2,d=K4t(n,e,u?a:o),h=new ke,f=d.map(async p=>{try{r.report(p);const m=await p.provideCodeActions(e,t,l,c.token);if(m&&h.add(m),c.token.isCancellationRequested)return vCe;const _=(m?.actions||[]).filter(y=>y&&j4t(o,y)),v=Y4t(p,_,o.include);return{actions:_.map(y=>new q4t(y,p)),documentation:v}}catch(m){if(uh(m))throw m;return vs(m),vCe}}),g=n.onDidChange(()=>{const p=n.all(e);$r(p,d)||c.cancel()});try{const p=await Promise.all(f),m=p.map(v=>v.actions).flat(),_=[...rf(p.map(v=>v.documentation)),...G4t(n,e,i,m)];return new VI(m,_,h)}finally{g.dispose(),c.dispose()}}function K4t(n,e,t){return n.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(r=>U4t(t,new sr(r))):!0)}function*G4t(n,e,t,i){if(e&&i.length)for(const r of n.all(e))r._getAdditionalMenuItems&&(yield*r._getAdditionalMenuItems?.({trigger:t.type,only:t.filter?.include?.value},i.map(s=>s.action)))}function Y4t(n,e,t){if(!n.documentation)return;const i=n.documentation.map(r=>({kind:new sr(r.kind),command:r.command}));if(t){let r;for(const s of i)s.kind.contains(t)&&(r?r.kind.contains(s.kind)&&(r=s):r=s);if(r)return r?.command}for(const r of e)if(r.kind){for(const s of i)if(s.kind.contains(new sr(r.kind)))return s.command}}var Oy;(function(n){n.OnSave="onSave",n.FromProblemsView="fromProblemsView",n.FromCodeActions="fromCodeActions",n.FromAILightbulb="fromAILightbulb"})(Oy||(Oy={}));async function Z4t(n,e,t,i,r=yn.None){const s=n.get(rO),o=n.get(_r),a=n.get(Qa),l=n.get(Ts);if(a.publicLog2("codeAction.applyCodeAction",{codeActionTitle:e.action.title,codeActionKind:e.action.kind,codeActionIsPreferred:!!e.action.isPreferred,reason:t}),await e.resolve(r),!r.isCancellationRequested&&!(e.action.edit?.edits.length&&!(await s.apply(e.action.edit,{editor:i?.editor,label:e.action.title,quotableLabel:e.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:t!==Oy.OnSave,showPreview:i?.preview})).isApplied)&&e.action.command)try{await o.executeCommand(e.action.command.id,...e.action.command.arguments||[])}catch(c){const u=X4t(c);l.error(typeof u=="string"?u:w("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function X4t(n){return typeof n=="string"?n:n instanceof Error&&typeof n.message=="string"?n.message:void 0}Un.registerCommand("_executeCodeActionProvider",async function(n,e,t,i,r){if(!(e instanceof Pt))throw qd();const{codeActionProvider:s}=n.get(dt),o=n.get(Sr).getModel(e);if(!o)throw qd();const a=yt.isISelection(t)?yt.liftSelection(t):$.isIRange(t)?o.validateRange(t):void 0;if(!a)throw qd();const l=typeof i=="string"?new sr(i):void 0,c=await MS(s,o,a,{type:1,triggerAction:hu.Default,filter:{includeSourceActions:!0,include:l}},p_.None,yn.None),u=[],d=Math.min(c.validActions.length,typeof r=="number"?r:0);for(let h=0;hh.action)}finally{setTimeout(()=>c.dispose(),100)}});var Q4t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},J4t=function(n,e){return function(t,i){e(t,i,n)}},_ee;let vee=class{static{_ee=this}static{this.codeActionCommands=[U9e,V9e,j9e,pee,mee]}constructor(e){this.keybindingService=e}getResolver(){const e=new kg(()=>this.keybindingService.getKeybindings().filter(t=>_ee.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===pee?i={kind:Dr.SourceOrganizeImports.value}:t.command===mee&&(i={kind:Dr.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...xp.fromUser(i,{kind:sr.None,apply:"never"})}}));return t=>{if(t.kind)return this.bestKeybindingForCodeAction(t,e.value)?.resolvedKeybinding}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;const i=new sr(e.kind);return t.filter(r=>r.kind.contains(i)).filter(r=>r.preferred?e.isPreferred:!0).reduceRight((r,s)=>r?r.kind.contains(s.kind)?s:r:s,void 0)}};vee=_ee=Q4t([J4t(0,xi)],vee);J("symbolIcon.arrayForeground",In,w("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.booleanForeground",In,w("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.classForeground","The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.colorForeground",In,w("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.constantForeground",In,w("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.constructorForeground","The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.enumeratorForeground","The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.enumeratorMemberForeground","The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.eventForeground","The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.fieldForeground","The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.fileForeground",In,w("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.folderForeground",In,w("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.functionForeground","The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.interfaceForeground","The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.keyForeground",In,w("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.keywordForeground",In,w("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.methodForeground","The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.moduleForeground",In,w("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.namespaceForeground",In,w("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.nullForeground",In,w("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.numberForeground",In,w("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.objectForeground",In,w("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.operatorForeground",In,w("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.packageForeground",In,w("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.propertyForeground",In,w("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.referenceForeground",In,w("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.snippetForeground",In,w("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.stringForeground",In,w("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.structForeground",In,w("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.textForeground",In,w("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.typeParameterForeground",In,w("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.unitForeground",In,w("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.variableForeground","The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const q9e=Object.freeze({kind:sr.Empty,title:w("codeAction.widget.id.more","More Actions...")}),e3t=Object.freeze([{kind:Dr.QuickFix,title:w("codeAction.widget.id.quickfix","Quick Fix")},{kind:Dr.RefactorExtract,title:w("codeAction.widget.id.extract","Extract"),icon:ze.wrench},{kind:Dr.RefactorInline,title:w("codeAction.widget.id.inline","Inline"),icon:ze.wrench},{kind:Dr.RefactorRewrite,title:w("codeAction.widget.id.convert","Rewrite"),icon:ze.wrench},{kind:Dr.RefactorMove,title:w("codeAction.widget.id.move","Move"),icon:ze.wrench},{kind:Dr.SurroundWith,title:w("codeAction.widget.id.surround","Surround With"),icon:ze.surroundWith},{kind:Dr.Source,title:w("codeAction.widget.id.source","Source Action"),icon:ze.symbolFile},q9e]);function t3t(n,e,t){if(!e)return n.map(s=>({kind:"action",item:s,group:q9e,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!s.action.edit?.edits.length}));const i=e3t.map(s=>({group:s,actions:[]}));for(const s of n){const o=s.action.kind?new sr(s.action.kind):sr.None;for(const a of i)if(a.group.kind.contains(o)){a.actions.push(s);break}}const r=[];for(const s of i)if(s.actions.length){r.push({kind:"header",group:s.group});for(const o of s.actions){const a=s.group;r.push({kind:"action",item:o,group:o.action.isAI?{title:a.title,kind:a.kind,icon:ze.sparkle}:a,label:o.action.title,disabled:!!o.action.disabled,keybinding:t(o.action)})}}return r}var n3t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},i3t=function(n,e){return function(t,i){e(t,i,n)}},Zx;const bCe=kr("gutter-lightbulb",ze.lightBulb,w("gutterLightbulbWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor.")),yCe=kr("gutter-lightbulb-auto-fix",ze.lightbulbAutofix,w("gutterLightbulbAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")),wCe=kr("gutter-lightbulb-sparkle",ze.lightbulbSparkle,w("gutterLightbulbAIFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")),CCe=kr("gutter-lightbulb-aifix-auto-fix",ze.lightbulbSparkleAutofix,w("gutterLightbulbAIFixAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")),xCe=kr("gutter-lightbulb-sparkle-filled",ze.sparkleFilled,w("gutterLightbulbSparkleFilledWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available."));var Of;(function(n){n.Hidden={type:0};class e{constructor(i,r,s,o){this.actions=i,this.trigger=r,this.editorPosition=s,this.widgetPosition=o,this.type=1}}n.Showing=e})(Of||(Of={}));let rR=class extends me{static{Zx=this}static{this.GUTTER_DECORATION=un.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:zt.asClassName(ze.lightBulb),glyphMargin:{position:af.Left},stickiness:1})}static{this.ID="editor.contrib.lightbulbWidget"}static{this._posPref=[0]}constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new fe),this.onClick=this._onClick.event,this._state=Of.Hidden,this._gutterState=Of.Hidden,this._iconClasses=[],this.lightbulbClasses=["codicon-"+bCe.id,"codicon-"+CCe.id,"codicon-"+yCe.id,"codicon-"+wCe.id,"codicon-"+xCe.id],this.gutterDecoration=Zx.GUTTER_DECORATION,this._domNode=qe("div.lightBulbWidget"),this._domNode.role="listbox",this._register(Fr.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(i=>{const r=this._editor.getModel();(this.state.type!==1||!r||this.state.editorPosition.lineNumber>=r.getLineCount())&&this.hide(),(this.gutterState.type!==1||!r||this.gutterState.editorPosition.lineNumber>=r.getLineCount())&&this.gutterHide()})),this._register(m0t(this._domNode,i=>{if(this.state.type!==1)return;this._editor.focus(),i.preventDefault();const{top:r,height:s}=ms(this._domNode),o=this._editor.getOption(67);let a=Math.floor(o/3);this.state.widgetPosition.position!==null&&this.state.widgetPosition.position.lineNumber{(i.buttons&1)===1&&this.hide()})),this._register(Ge.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel=this._keybindingService.lookupKeybinding(z9e)?.getLabel()??void 0,this._quickFixKbLabel=this._keybindingService.lookupKeybinding(Due)?.getLabel()??void 0,this._updateLightBulbTitleAndIcon()})),this._register(this._editor.onMouseDown(async i=>{if(!i.target.element||!this.lightbulbClasses.some(l=>i.target.element&&i.target.element.classList.contains(l))||this.gutterState.type!==1)return;this._editor.focus();const{top:r,height:s}=ms(i.target.element),o=this._editor.getOption(67);let a=Math.floor(o/3);this.gutterState.widgetPosition.position!==null&&this.gutterState.widgetPosition.position.lineNumber22,g=x=>x>2&&this._editor.getTopForLineNumber(x)===this._editor.getTopForLineNumber(x-1),p=this._editor.getLineDecorations(a);let m=!1;if(p)for(const x of p){const k=x.options.glyphMarginClassName;if(k&&!this.lightbulbClasses.some(L=>k.includes(L))){m=!0;break}}let _=a,v=1;if(!f){const x=k=>{const L=o.getLineContent(k);return/^\s*$|^\s+/.test(L)||L.length<=v};if(a>1&&!g(a-1)){const k=o.getLineCount(),L=a===k,D=a>1&&x(a-1),I=!L&&x(a+1),O=x(a),M=!I&&!D;if(!I&&!D&&!m)return this.gutterState=new Of.Showing(e,t,i,{position:{lineNumber:_,column:v},preference:Zx._posPref}),this.renderGutterLightbub(),this.hide();D||L||D&&!O?_-=1:(I||M&&O)&&(_+=1)}else if(a===1&&(a===o.getLineCount()||!x(a+1)&&!x(a)))if(this.gutterState=new Of.Showing(e,t,i,{position:{lineNumber:_,column:v},preference:Zx._posPref}),m)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(a{this._gutterDecorationID=t.addDecoration(new $(e,0,e,0),this.gutterDecoration)})}_removeGutterDecoration(e){this._editor.changeDecorations(t=>{t.removeDecoration(e),this._gutterDecorationID=void 0})}_updateGutterDecoration(e,t){this._editor.changeDecorations(i=>{i.changeDecoration(e,new $(t,0,t,0)),i.changeDecorationOptions(e,this.gutterDecoration)})}_updateLightbulbTitle(e,t){this.state.type===1&&(t?this.title=w("codeActionAutoRun","Run: {0}",this.state.actions.validActions[0].action.title):e&&this._preferredKbLabel?this.title=w("preferredcodeActionWithKb","Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):!e&&this._quickFixKbLabel?this.title=w("codeActionWithKb","Show Code Actions ({0})",this._quickFixKbLabel):e||(this.title=w("codeAction","Show Code Actions")))}set title(e){this._domNode.title=e}};rR=Zx=n3t([i3t(1,xi)],rR);var K9e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},bee=function(n,e){return function(t,i){e(t,i,n)}};const G9e="acceptSelectedCodeAction",Y9e="previewSelectedCodeAction";class r3t{get templateId(){return"header"}renderTemplate(e){e.classList.add("group-header");const t=document.createElement("span");return e.append(t),{container:e,text:t}}renderElement(e,t,i){i.text.textContent=e.group?.title??""}disposeTemplate(e){}}let yee=class{get templateId(){return"action"}constructor(e,t){this._supportsPreview=e,this._keybindingService=t}renderTemplate(e){e.classList.add(this.templateId);const t=document.createElement("div");t.className="icon",e.append(t);const i=document.createElement("span");i.className="title",e.append(i);const r=new l2(e,eu);return{container:e,icon:t,text:i,keybinding:r}}renderElement(e,t,i){if(e.group?.icon?(i.icon.className=zt.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=it(e.group.icon.color.id))):(i.icon.className=zt.asClassName(ze.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=Z9e(e.label),i.keybinding.set(e.keybinding),A0t(!!e.keybinding,i.keybinding.element);const r=this._keybindingService.lookupKeybinding(G9e)?.getLabel(),s=this._keybindingService.lookupKeybinding(Y9e)?.getLabel();i.container.classList.toggle("option-disabled",e.disabled),e.disabled?i.container.title=e.label:r&&s?this._supportsPreview&&e.canPreview?i.container.title=w({key:"label-preview",comment:['placeholders are keybindings, e.g "F2 to Apply, Shift+F2 to Preview"']},"{0} to Apply, {1} to Preview",r,s):i.container.title=w({key:"label",comment:['placeholder is a keybinding, e.g "F2 to Apply"']},"{0} to Apply",r):i.container.title=""}disposeTemplate(e){e.keybinding.dispose()}};yee=K9e([bee(1,xi)],yee);class s3t extends UIEvent{constructor(){super("acceptSelectedAction")}}class SCe extends UIEvent{constructor(){super("previewSelectedAction")}}function o3t(n){if(n.kind==="action")return n.label}let wee=class extends me{constructor(e,t,i,r,s,o){super(),this._delegate=r,this._contextViewService=s,this._keybindingService=o,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new Kr),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const a={getHeight:l=>l.kind==="header"?this._headerLineHeight:this._actionLineHeight,getTemplateId:l=>l.kind};this._list=this._register(new dd(e,this.domNode,a,[new yee(t,this._keybindingService),new r3t],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:o3t},accessibilityProvider:{getAriaLabel:l=>{if(l.kind==="action"){let c=l.label?Z9e(l?.label):"";return l.disabled&&(c=w({key:"customQuickFixWidget.labels",comment:["Action widget labels for accessibility."]},"{0}, Disabled Reason: {1}",c,l.disabled)),c}return null},getWidgetAriaLabel:()=>w({key:"customQuickFixWidget",comment:["An action widget option"]},"Action Widget"),getRole:l=>l.kind==="action"?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(yC),this._register(this._list.onMouseClick(l=>this.onListClick(l))),this._register(this._list.onMouseOver(l=>this.onListHover(l))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(l=>this.onListSelection(l))),this._allMenuItems=i,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(e){return!e.disabled&&e.kind==="action"}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._contextViewService.hideContextView()}layout(e){const t=this._allMenuItems.filter(l=>l.kind==="header").length,r=this._allMenuItems.length*this._actionLineHeight+t*this._headerLineHeight-t*this._actionLineHeight;this._list.layout(r);let s=e;if(this._allMenuItems.length>=50)s=380;else{const l=this._allMenuItems.map((c,u)=>{const d=this.domNode.ownerDocument.getElementById(this._list.getElementID(u));if(d){d.style.width="auto";const h=d.getBoundingClientRect().width;return d.style.width="",h}return 0});s=Math.max(...l,e)}const a=Math.min(r,this.domNode.ownerDocument.body.clientHeight*.7);return this._list.layout(a,s),this.domNode.style.height=`${a}px`,this._list.domFocus(),s}focusPrevious(){this._list.focusPrevious(1,!0,void 0,this.focusCondition)}focusNext(){this._list.focusNext(1,!0,void 0,this.focusCondition)}acceptSelected(e){const t=this._list.getFocus();if(t.length===0)return;const i=t[0],r=this._list.element(i);if(!this.focusCondition(r))return;const s=e?new SCe:new s3t;this._list.setSelection([i],s)}onListSelection(e){if(!e.elements.length)return;const t=e.elements[0];t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof SCe):this._list.setSelection([])}onFocus(){const e=this._list.getFocus();if(e.length===0)return;const t=e[0],i=this._list.element(t);this._delegate.onFocus?.(i.item)}async onListHover(e){const t=e.element;if(t&&t.item&&this.focusCondition(t)){if(this._delegate.onHover&&!t.disabled&&t.kind==="action"){const i=await this._delegate.onHover(t.item,this.cts.token);t.canPreview=i?i.canPreview:void 0}e.index&&this._list.splice(e.index,1,[t])}this._list.setFocus(typeof e.index=="number"?[e.index]:[])}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};wee=K9e([bee(4,m0),bee(5,xi)],wee);function Z9e(n){return n.replace(/\r\n|\r|\n/g," ")}var a3t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},$q=function(n,e){return function(t,i){e(t,i,n)}};J("actionBar.toggledBackground",eO,w("actionBar.toggledBackground","Background color for toggled action items in action bar."));const jw={Visible:new et("codeActionMenuVisible",!1,w("codeActionMenuVisible","Whether the action widget list is visible"))},LC=On("actionWidgetService");let qw=class extends me{get isVisible(){return jw.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new To)}show(e,t,i,r,s,o,a){const l=jw.Visible.bindTo(this._contextKeyService),c=this._instantiationService.createInstance(wee,e,t,i,r);this._contextViewService.showContextView({getAnchor:()=>s,render:u=>(l.set(!0),this._renderWidget(u,c,a??[])),onHide:u=>{l.reset(),this._onWidgetClosed(u)}},o,!1)}acceptSelected(e){this._list.value?.acceptSelected(e)}focusPrevious(){this._list?.value?.focusPrevious()}focusNext(){this._list?.value?.focusNext()}hide(e){this._list.value?.hide(e),this._list.clear()}_renderWidget(e,t,i){const r=document.createElement("div");if(r.classList.add("action-widget"),e.appendChild(r),this._list.value=t,this._list.value)r.appendChild(this._list.value.domNode);else throw new Error("List has no value");const s=new ke,o=document.createElement("div"),a=e.appendChild(o);a.classList.add("context-view-block"),s.add(Ce(a,je.MOUSE_DOWN,f=>f.stopPropagation()));const l=document.createElement("div"),c=e.appendChild(l);c.classList.add("context-view-pointerBlock"),s.add(Ce(c,je.POINTER_MOVE,()=>c.remove())),s.add(Ce(c,je.MOUSE_DOWN,()=>c.remove()));let u=0;if(i.length){const f=this._createActionBar(".action-widget-action-bar",i);f&&(r.appendChild(f.getContainer().parentElement),s.add(f),u=f.getContainer().offsetWidth)}const d=this._list.value?.layout(u);r.style.width=`${d}px`;const h=s.add(Eg(e));return s.add(h.onDidBlur(()=>this.hide(!0))),s}_createActionBar(e,t){if(!t.length)return;const i=qe(e),r=new ed(i);return r.push(t,{icon:!1,label:!0}),r}_onWidgetClosed(e){this._list.value?.hide(e)}};qw=a3t([$q(0,m0),$q(1,jt),$q(2,Tt)],qw);Vn(LC,qw,1);const xO=1100;lr(class extends Gl{constructor(){super({id:"hideCodeActionWidget",title:Gt("hideCodeActionWidget.title","Hide action widget"),precondition:jw.Visible,keybinding:{weight:xO,primary:9,secondary:[1033]}})}run(n){n.get(LC).hide(!0)}});lr(class extends Gl{constructor(){super({id:"selectPrevCodeAction",title:Gt("selectPrevCodeAction.title","Select previous action"),precondition:jw.Visible,keybinding:{weight:xO,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(n){const e=n.get(LC);e instanceof qw&&e.focusPrevious()}});lr(class extends Gl{constructor(){super({id:"selectNextCodeAction",title:Gt("selectNextCodeAction.title","Select next action"),precondition:jw.Visible,keybinding:{weight:xO,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(n){const e=n.get(LC);e instanceof qw&&e.focusNext()}});lr(class extends Gl{constructor(){super({id:G9e,title:Gt("acceptSelected.title","Accept selected action"),precondition:jw.Visible,keybinding:{weight:xO,primary:3,secondary:[2137]}})}run(n){const e=n.get(LC);e instanceof qw&&e.acceptSelected()}});lr(class extends Gl{constructor(){super({id:Y9e,title:Gt("previewSelected.title","Preview selected action"),precondition:jw.Visible,keybinding:{weight:xO,primary:2051}})}run(n){const e=n.get(LC);e instanceof qw&&e.acceptSelected(!0)}});const X9e=new et("supportedCodeAction",""),kCe="_typescript.applyFixAllCodeAction";class l3t extends me{constructor(e,t,i,r=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=r,this._autoTriggerTimer=this._register(new hf),this._register(this._markerService.onMarkerChanged(s=>this._onMarkerChanges(s))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){const t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){const t=this._editor.getModel();t&&e.some(i=>kN(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:hu.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;const t=this._editor.getSelection();if(e.type===1)return t;const i=this._editor.getOption(65).enabled;if(i!==Oh.Off){{if(i===Oh.On)return t;if(i===Oh.OnCode){if(!t.isEmpty())return t;const s=this._editor.getModel(),{lineNumber:o,column:a}=t.getPosition(),l=s.getLineContent(o);if(l.length===0)return;if(a===1){if(/\s/.test(l[0]))return}else if(a===s.getLineMaxColumn(o)){if(/\s/.test(l[l.length-1]))return}else if(/\s/.test(l[a-2])&&/\s/.test(l[a-1]))return}}return t}}}var wy;(function(n){n.Empty={type:0};class e{constructor(i,r,s){this.trigger=i,this.position=r,this._cancellablePromise=s,this.type=1,this.actions=s.catch(o=>{if(uh(o))return Q9e;throw o})}cancel(){this._cancellablePromise.cancel()}}n.Triggered=e})(wy||(wy={}));const Q9e=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class c3t extends me{constructor(e,t,i,r,s,o,a){super(),this._editor=e,this._registry=t,this._markerService=i,this._progressService=s,this._configurationService=o,this._telemetryService=a,this._codeActionOracle=this._register(new To),this._state=wy.Empty,this._onDidChangeState=this._register(new fe),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=X9e.bindTo(r),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._register(this._editor.onDidChangeConfiguration(l=>{l.hasChanged(65)&&this._update()})),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(wy.Empty,!0))}_settingEnabledNearbyQuickfixes(){const e=this._editor?.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:e?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(wy.Empty);const e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(92)){const t=this._registry.all(e).flatMap(i=>i.providedCodeActionKinds??[]);this._supportedCodeActions.set(t.join(" ")),this._codeActionOracle.value=new l3t(this._editor,this._markerService,i=>{if(!i){this.setState(wy.Empty);return}const r=i.selection.getStartPosition(),s=ko(async l=>{if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===hu.QuickFix||i.trigger.filter?.include?.contains(Dr.QuickFix))){const c=await MS(this._registry,e,i.selection,i.trigger,p_.None,l),u=[...c.allActions];if(l.isCancellationRequested)return Q9e;const d=c.validActions?.some(f=>f.action.kind?Dr.QuickFix.contains(new sr(f.action.kind)):!1),h=this._markerService.read({resource:e.uri});if(d){for(const f of c.validActions)f.action.command?.arguments?.some(g=>typeof g=="string"&&g.includes(kCe))&&(f.action.diagnostics=[...h.filter(g=>g.relatedInformation)]);return{validActions:c.validActions,allActions:u,documentation:c.documentation,hasAutoFix:c.hasAutoFix,hasAIFix:c.hasAIFix,allAIFixes:c.allAIFixes,dispose:()=>{c.dispose()}}}else if(!d&&h.length>0){const f=i.selection.getPosition();let g=f,p=Number.MAX_VALUE;const m=[...c.validActions];for(const v of h){const y=v.endColumn,C=v.endLineNumber,x=v.startLineNumber;if(C===f.lineNumber||x===f.lineNumber){g=new he(C,y);const k={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:i.trigger.filter?.include?i.trigger.filter?.include:Dr.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:i.trigger.context?.notAvailableMessage||"",position:g}},L=new yt(g.lineNumber,g.column,g.lineNumber,g.column),D=await MS(this._registry,e,L,k,p_.None,l);if(D.validActions.length!==0){for(const I of D.validActions)I.action.command?.arguments?.some(O=>typeof O=="string"&&O.includes(kCe))&&(I.action.diagnostics=[...h.filter(O=>O.relatedInformation)]);c.allActions.length===0&&u.push(...D.allActions),Math.abs(f.column-y)C.findIndex(x=>x.action.title===v.action.title)===y);return _.sort((v,y)=>v.action.isPreferred&&!y.action.isPreferred?-1:!v.action.isPreferred&&y.action.isPreferred||v.action.isAI&&!y.action.isAI?1:!v.action.isAI&&y.action.isAI?-1:0),{validActions:_,allActions:u,documentation:c.documentation,hasAutoFix:c.hasAutoFix,hasAIFix:c.hasAIFix,allAIFixes:c.allAIFixes,dispose:()=>{c.dispose()}}}}if(i.trigger.type===1){const c=new Bo,u=await MS(this._registry,e,i.selection,i.trigger,p_.None,l);return this._telemetryService&&this._telemetryService.publicLog2("codeAction.invokedDurations",{codeActions:u.validActions.length,duration:c.elapsed()}),u}return MS(this._registry,e,i.selection,i.trigger,p_.None,l)});i.trigger.type===1&&this._progressService?.showWhile(s,250);const o=new wy.Triggered(i.trigger,r,s);let a=!1;this._state.type===1&&(a=this._state.trigger.type===1&&o.type===1&&o.trigger.type===2&&this._state.position!==o.position),a?setTimeout(()=>{this.setState(o)},500):this.setState(o)},void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:hu.Default})}else this._supportedCodeActions.reset()}trigger(e){this._codeActionOracle.value?.trigger(e)}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}}var u3t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Jg=function(n,e){return function(t,i){e(t,i,n)}},Xx;const d3t="quickfix-edit-highlight";let DE=class extends me{static{Xx=this}static{this.ID="editor.contrib.codeActionController"}static get(e){return e.getContribution(Xx.ID)}constructor(e,t,i,r,s,o,a,l,c,u,d){super(),this._commandService=a,this._configurationService=l,this._actionWidgetService=c,this._instantiationService=u,this._telemetryService=d,this._activeCodeActions=this._register(new To),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new c3t(this._editor,s.codeActionProvider,t,i,o,l,this._telemetryService)),this._register(this._model.onDidChangeState(h=>this.update(h))),this._lightBulbWidget=new kg(()=>{const h=this._editor.getContribution(rR.ID);return h&&this._register(h.onClick(f=>this.showCodeActionsFromLightbulb(f.actions,f))),h}),this._resolver=r.createInstance(vee),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(e,t){if(e.allAIFixes&&e.validActions.length===1){const i=e.validActions[0],r=i.action.command;r&&r.id==="inlineChat.start"&&r.arguments&&r.arguments.length>=1&&(r.arguments[0]={...r.arguments[0],autoSend:!1}),await this._applyCodeAction(i,!1,!1,Oy.FromAILightbulb);return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,i){return this.showCodeActionList(t,i,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(e,t,i,r){if(!this._editor.hasModel())return;au.get(this._editor)?.closeMessage();const s=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:i,autoApply:r,context:{notAvailableMessage:e,position:s}})}_trigger(e){return this._model.trigger(e)}async _applyCodeAction(e,t,i,r){try{await this._instantiationService.invokeFunction(Z4t,e,r,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:hu.QuickFix,filter:{}})}}hideLightBulbWidget(){this._lightBulbWidget.rawValue?.hide(),this._lightBulbWidget.rawValue?.gutterHide()}async update(e){if(e.type!==1){this.hideLightBulbWidget();return}let t;try{t=await e.actions}catch(r){rn(r);return}if(!(this._disposed||this._editor.getSelection()?.startLineNumber!==e.position.lineNumber))if(this._lightBulbWidget.value?.update(t,e.trigger,e.position),e.trigger.type===1){if(e.trigger.filter?.include){const s=this.tryGetValidActionToApply(e.trigger,t);if(s){try{this.hideLightBulbWidget(),await this._applyCodeAction(s,!1,!1,Oy.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const o=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(o&&o.action.disabled){au.get(this._editor)?.showMessage(o.action.disabled,e.trigger.context.position),t.dispose();return}}}const r=!!e.trigger.filter?.include;if(e.trigger.context&&(!t.allActions.length||!r&&!t.validActions.length)){au.get(this._editor)?.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=t,t.dispose();return}this._activeCodeActions.value=t,this.showCodeActionList(t,this.toCoords(e.position),{includeDisabledActions:r,fromLightbulb:!1})}else this._actionWidgetService.isVisible?t.dispose():this._activeCodeActions.value=t}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:i})=>i.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}static{this.DECORATION=un.register({description:"quickfix-highlight",className:d3t})}async showCodeActionList(e,t,i){const r=this._editor.createDecorationsCollection(),s=this._editor.getDomNode();if(!s)return;const o=i.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!o.length)return;const a=he.isIPosition(t)?this.toCoords(t):t,l={onSelect:async(c,u)=>{this._applyCodeAction(c,!0,!!u,i.fromLightbulb?Oy.FromAILightbulb:Oy.FromCodeActions),this._actionWidgetService.hide(!1),r.clear()},onHide:c=>{this._editor?.focus(),r.clear()},onHover:async(c,u)=>{if(u.isCancellationRequested)return;let d=!1;const h=c.action.kind;if(h){const f=new sr(h);d=[Dr.RefactorExtract,Dr.RefactorInline,Dr.RefactorRewrite,Dr.RefactorMove,Dr.Source].some(p=>p.contains(f))}return{canPreview:d||!!c.action.edit?.edits.length}},onFocus:c=>{if(c&&c.action){const u=c.action.ranges,d=c.action.diagnostics;if(r.clear(),u&&u.length>0){const h=d&&d?.length>1?d.map(f=>({range:f,options:Xx.DECORATION})):u.map(f=>({range:f,options:Xx.DECORATION}));r.set(h)}else if(d&&d.length>0){const h=d.map(g=>({range:g,options:Xx.DECORATION}));r.set(h);const f=d[0];if(f.startLineNumber&&f.startColumn){const g=this._editor.getModel()?.getWordAtPosition({lineNumber:f.startLineNumber,column:f.startColumn})?.word;Qp(w("editingNewSelection","Context: {0} at line {1} and column {2}.",g,f.startLineNumber,f.startColumn))}}}else r.clear()}};this._actionWidgetService.show("codeActionWidget",!0,t3t(o,this._shouldShowHeaders(),this._resolver.getResolver()),l,a,s,this._getActionBarActions(e,t,i))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(e),i=ms(this._editor.getDomNode()),r=i.left+t.left,s=i.top+t.top+t.height;return{x:r,y:s}}_shouldShowHeaders(){const e=this._editor?.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:e?.uri})}_getActionBarActions(e,t,i){if(i.fromLightbulb)return[];const r=e.documentation.map(s=>({id:s.id,label:s.title,tooltip:s.tooltip??"",class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(s.id,...s.arguments??[])}));return i.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&r.push(this._showDisabled?{id:"hideMoreActions",label:w("hideMoreActions","Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:w("showMoreActions","Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),r}};DE=Xx=u3t([Jg(1,dm),Jg(2,jt),Jg(3,Tt),Jg(4,dt),Jg(5,Qb),Jg(6,_r),Jg(7,kn),Jg(8,LC),Jg(9,Tt),Jg(10,Qa)],DE);dh((n,e)=>{((r,s)=>{s&&e.addRule(`.monaco-editor ${r} { background-color: ${s}; }`)})(".quickfix-edit-highlight",n.getColor(g_));const i=n.getColor(Av);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${mg(n.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function SO(n){return Le.regex(X9e.keys()[0],new RegExp("(\\s|^)"+nd(n.value)+"\\b"))}const Iue={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:w("args.schema.kind","Kind of the code action to run.")},apply:{type:"string",description:w("args.schema.apply","Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[w("args.schema.apply.first","Always apply the first returned code action."),w("args.schema.apply.ifSingle","Apply the first returned code action if it is the only one."),w("args.schema.apply.never","Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:w("args.schema.preferred","Controls if only preferred code actions should be returned.")}}};function TC(n,e,t,i,r=hu.Default){n.hasModel()&&DE.get(n)?.manualTriggerAtCurrentPosition(e,r,t,i)}class h3t extends ot{constructor(){super({id:Due,label:w("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:Le.and(Q.writable,Q.hasCodeActionsProvider),kbOpts:{kbExpr:Q.textInputFocus,primary:2137,weight:100}})}run(e,t){return TC(t,w("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,hu.QuickFix)}}class f3t extends fo{constructor(){super({id:V9e,precondition:Le.and(Q.writable,Q.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:Iue}]}})}runEditorCommand(e,t,i){const r=xp.fromUser(i,{kind:sr.Empty,apply:"ifSingle"});return TC(t,typeof i?.kind=="string"?r.preferred?w("editor.action.codeAction.noneMessage.preferred.kind","No preferred code actions for '{0}' available",i.kind):w("editor.action.codeAction.noneMessage.kind","No code actions for '{0}' available",i.kind):r.preferred?w("editor.action.codeAction.noneMessage.preferred","No preferred code actions available"):w("editor.action.codeAction.noneMessage","No code actions available"),{include:r.kind,includeSourceActions:!0,onlyIncludePreferredActions:r.preferred},r.apply)}}class g3t extends ot{constructor(){super({id:U9e,label:w("refactor.label","Refactor..."),alias:"Refactor...",precondition:Le.and(Q.writable,Q.hasCodeActionsProvider),kbOpts:{kbExpr:Q.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Le.and(Q.writable,SO(Dr.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:Iue}]}})}run(e,t,i){const r=xp.fromUser(i,{kind:Dr.Refactor,apply:"never"});return TC(t,typeof i?.kind=="string"?r.preferred?w("editor.action.refactor.noneMessage.preferred.kind","No preferred refactorings for '{0}' available",i.kind):w("editor.action.refactor.noneMessage.kind","No refactorings for '{0}' available",i.kind):r.preferred?w("editor.action.refactor.noneMessage.preferred","No preferred refactorings available"):w("editor.action.refactor.noneMessage","No refactorings available"),{include:Dr.Refactor.contains(r.kind)?r.kind:sr.None,onlyIncludePreferredActions:r.preferred},r.apply,hu.Refactor)}}class p3t extends ot{constructor(){super({id:j9e,label:w("source.label","Source Action..."),alias:"Source Action...",precondition:Le.and(Q.writable,Q.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Le.and(Q.writable,SO(Dr.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:Iue}]}})}run(e,t,i){const r=xp.fromUser(i,{kind:Dr.Source,apply:"never"});return TC(t,typeof i?.kind=="string"?r.preferred?w("editor.action.source.noneMessage.preferred.kind","No preferred source actions for '{0}' available",i.kind):w("editor.action.source.noneMessage.kind","No source actions for '{0}' available",i.kind):r.preferred?w("editor.action.source.noneMessage.preferred","No preferred source actions available"):w("editor.action.source.noneMessage","No source actions available"),{include:Dr.Source.contains(r.kind)?r.kind:sr.None,includeSourceActions:!0,onlyIncludePreferredActions:r.preferred},r.apply,hu.SourceAction)}}class m3t extends ot{constructor(){super({id:pee,label:w("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:Le.and(Q.writable,SO(Dr.SourceOrganizeImports)),kbOpts:{kbExpr:Q.textInputFocus,primary:1581,weight:100}})}run(e,t){return TC(t,w("editor.action.organize.noneMessage","No organize imports action available"),{include:Dr.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",hu.OrganizeImports)}}class _3t extends ot{constructor(){super({id:mee,label:w("fixAll.label","Fix All"),alias:"Fix All",precondition:Le.and(Q.writable,SO(Dr.SourceFixAll))})}run(e,t){return TC(t,w("fixAll.noneMessage","No fix all action available"),{include:Dr.SourceFixAll,includeSourceActions:!0},"ifSingle",hu.FixAll)}}class v3t extends ot{constructor(){super({id:z9e,label:w("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:Le.and(Q.writable,SO(Dr.QuickFix)),kbOpts:{kbExpr:Q.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return TC(t,w("editor.action.autoFix.noneMessage","No auto fixes available"),{include:Dr.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",hu.AutoFix)}}Zn(DE.ID,DE,3);Zn(rR.ID,rR,4);Pe(h3t);Pe(g3t);Pe(p3t);Pe(m3t);Pe(v3t);Pe(_3t);Je(new f3t);Yr.as(ff.Configuration).registerConfiguration({...sO,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:w("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});Yr.as(ff.Configuration).registerConfiguration({...sO,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:w("includeNearbyQuickFixes","Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});Yr.as(ff.Configuration).registerConfiguration({...sO,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:5,markdownDescription:w("triggerOnFocusChange","Enable triggering {0} when {1} is set to {2}. Code Actions must be set to {3} to be triggered for window and focus changes.","`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});class Cee{constructor(){this.lenses=[],this._disposables=new ke}dispose(){this._disposables.dispose()}get isDisposed(){return this._disposables.isDisposed}add(e,t){this._disposables.add(e);for(const i of e.lenses)this.lenses.push({symbol:i,provider:t})}}async function J9e(n,e,t){const i=n.ordered(e),r=new Map,s=new Cee,o=i.map(async(a,l)=>{r.set(a,l);try{const c=await Promise.resolve(a.provideCodeLenses(e,t));c&&s.add(c,a)}catch(c){vs(c)}});return await Promise.all(o),s.lenses=s.lenses.sort((a,l)=>a.symbol.range.startLineNumberl.symbol.range.startLineNumber?1:r.get(a.provider)r.get(l.provider)?1:a.symbol.range.startColumnl.symbol.range.startColumn?1:0),s}Un.registerCommand("_executeCodeLensProvider",function(n,...e){let[t,i]=e;oi(Pt.isUri(t)),oi(typeof i=="number"||!i);const{codeLensProvider:r}=n.get(dt),s=n.get(Sr).getModel(t);if(!s)throw qd();const o=[],a=new ke;return J9e(r,s,yn.None).then(l=>{a.add(l);const c=[];for(const u of l.lenses)i==null||u.symbol.command?o.push(u.symbol):i-- >0&&u.provider.resolveCodeLens&&c.push(Promise.resolve(u.provider.resolveCodeLens(s,u.symbol,yn.None)).then(d=>o.push(d||u.symbol)));return Promise.all(c)}).then(()=>o).finally(()=>{setTimeout(()=>a.dispose(),100)})});var b3t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},y3t=function(n,e){return function(t,i){e(t,i,n)}};const e7e=On("ICodeLensCache");class ECe{constructor(e,t){this.lineCount=e,this.data=t}}let xee=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new lm(20,.75);const t="codelens/cache";xD(Xi,()=>e.remove(t,1));const i="codelens/cache2",r=e.get(i,1,"{}");this._deserialize(r);const s=Ge.filter(e.onWillSaveState,o=>o.reason===AN.SHUTDOWN);Ge.once(s)(o=>{e.store(i,this._serialize(),1,1)})}put(e,t){const i=t.lenses.map(o=>({range:o.symbol.range,command:o.symbol.command&&{id:"",title:o.symbol.command?.title}})),r=new Cee;r.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new ECe(e.getLineCount(),r);this._cache.set(e.uri.toString(),s)}get(e){const t=this._cache.get(e.uri.toString());return t&&t.lineCount===e.getLineCount()?t.data:void 0}delete(e){this._cache.delete(e.uri.toString())}_serialize(){const e=Object.create(null);for(const[t,i]of this._cache){const r=new Set;for(const s of i.data.lenses)r.add(s.symbol.range.startLineNumber);e[t]={lineCount:i.lineCount,lines:[...r.values()]}}return JSON.stringify(e)}_deserialize(e){try{const t=JSON.parse(e);for(const i in t){const r=t[i],s=[];for(const a of r.lines)s.push({range:new $(a,1,a,11)});const o=new Cee;o.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new ECe(r.lineCount,o))}}catch{}}};xee=b3t([y3t(0,pf)],xee);Vn(e7e,xee,1);class w3t{constructor(e,t,i){this.afterColumn=1073741824,this.afterLineNumber=e,this.heightInPx=t,this._onHeight=i,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(e){this._lastHeight===void 0?this._lastHeight=e:this._lastHeight!==e&&(this._lastHeight=e,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}}class N9{static{this._idPool=0}constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${N9._idPool++}`,this.updatePosition(t),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(e,t){this._commands.clear();const i=[];let r=!1;for(let s=0;s{c.symbol.command&&l.push(c.symbol),i.addDecoration({range:c.symbol.range,options:LCe},d=>this._decorationIds[u]=d),a?a=$.plusRange(a,c.symbol.range):a=$.lift(c.symbol.range)}),this._viewZone=new w3t(a.startLineNumber-1,s,o),this._viewZoneId=r.addZone(this._viewZone),l.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(l,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new N9(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t?.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((e,t)=>{const i=this._editor.getModel().getDecorationRange(e),r=this._data[t].symbol;return!!(i&&$.isEmpty(r.range)===i.isEmpty())})}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach((i,r)=>{t.addDecoration({range:i.symbol.range,options:LCe},s=>this._decorationIds[r]=s)})}updateHeight(e,t){this._viewZone.heightInPx=e,t.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(e){if(!this._viewZone.isVisible())return null;for(let t=0;t=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},zT=function(n,e){return function(t,i){e(t,i,n)}};let sR=class{static{this.ID="css.editor.codeLens"}constructor(e,t,i,r,s,o){this._editor=e,this._languageFeaturesService=t,this._commandService=r,this._notificationService=s,this._codeLensCache=o,this._disposables=new ke,this._localToDispose=new ke,this._lenses=[],this._oldCodeLensModels=new ke,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Ui(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{(a.hasChanged(50)||a.hasChanged(19)||a.hasChanged(18))&&this._updateLensStyle(),a.hasChanged(17)&&this._onModelChange()})),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),this._currentCodeLensModel?.dispose()}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(67)/this._editor.getOption(52));let t=this._editor.getOption(19);return(!t||t<5)&&(t=this._editor.getOption(52)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(18),r=this._editor.getOption(50),{style:s}=this._editor.getContainerDomNode();s.setProperty("--vscode-editorCodeLens-lineHeight",`${e}px`),s.setProperty("--vscode-editorCodeLens-fontSize",`${t}px`),s.setProperty("--vscode-editorCodeLens-fontFeatureSettings",r.fontFeatureSettings),i&&(s.setProperty("--vscode-editorCodeLens-fontFamily",i),s.setProperty("--vscode-editorCodeLens-fontFamilyDefault",Wl.fontFamily)),this._editor.changeViewZones(o=>{for(const a of this._lenses)a.updateHeight(e,o)})}_localDispose(){this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=void 0,this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),this._currentCodeLensModel?.dispose()}_onModelChange(){this._localDispose();const e=this._editor.getModel();if(!e||!this._editor.getOption(17)||e.isTooLargeForTokenization())return;const t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e)){t&&Sb(()=>{const r=this._codeLensCache.get(e);t===r&&(this._codeLensCache.delete(e),this._onModelChange())},30*1e3,this._localToDispose);return}for(const r of this._languageFeaturesService.codeLensProvider.all(e))if(typeof r.onDidChange=="function"){const s=r.onDidChange(()=>i.schedule());this._localToDispose.add(s)}const i=new Ui(()=>{const r=Date.now();this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=ko(s=>J9e(this._languageFeaturesService.codeLensProvider,e,s)),this._getCodeLensModelPromise.then(s=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=s,this._codeLensCache.put(e,s);const o=this._provideCodeLensDebounce.update(e,Date.now()-r);i.delay=o,this._renderCodeLensSymbols(s),this._resolveCodeLensesInViewportSoon()},rn)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(Lt(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._editor.changeDecorations(r=>{this._editor.changeViewZones(s=>{const o=[];let a=-1;this._lenses.forEach(c=>{!c.isValid()||a===c.getLineNumber()?o.push(c):(c.update(s),a=c.getLineNumber())});const l=new Wq;o.forEach(c=>{c.dispose(l,s),this._lenses.splice(this._lenses.indexOf(c),1)}),l.commit(r)})}),i.schedule(),this._resolveCodeLensesScheduler.cancel(),this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorText(()=>{i.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{i.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(r=>{r.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(Lt(()=>{if(this._editor.getModel()){const r=Ag.capture(this._editor);this._editor.changeDecorations(s=>{this._editor.changeViewZones(o=>{this._disposeAllLenses(s,o)})}),r.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(r=>{if(r.target.type!==9)return;let s=r.target.element;if(s?.tagName==="SPAN"&&(s=s.parentElement),s?.tagName==="A")for(const o of this._lenses){const a=o.getCommand(s);if(a){this._commandService.executeCommand(a.id,...a.arguments||[]).catch(l=>this._notificationService.error(l));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new Wq;for(const r of this._lenses)r.dispose(i,t);e&&i.commit(e),this._lenses.length=0}_renderCodeLensSymbols(e){if(!this._editor.hasModel())return;const t=this._editor.getModel().getLineCount(),i=[];let r;for(const a of e.lenses){const l=a.symbol.range.startLineNumber;l<1||l>t||(r&&r[r.length-1].symbol.range.startLineNumber===l?r.push(a):(r=[a],i.push(r)))}if(!i.length&&!this._lenses.length)return;const s=Ag.capture(this._editor),o=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(l=>{const c=new Wq;let u=0,d=0;for(;dthis._resolveCodeLensesInViewportSoon())),u++,d++)}for(;uthis._resolveCodeLensesInViewportSoon())),d++;c.commit(a)})}),s.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0;const e=this._editor.getModel();if(!e)return;const t=[],i=[];if(this._lenses.forEach(o=>{const a=o.computeIfNecessary(e);a&&(t.push(a),i.push(o))}),t.length===0)return;const r=Date.now(),s=ko(o=>{const a=t.map((l,c)=>{const u=new Array(l.length),d=l.map((h,f)=>!h.symbol.command&&typeof h.provider.resolveCodeLens=="function"?Promise.resolve(h.provider.resolveCodeLens(e,h.symbol,o)).then(g=>{u[f]=g},vs):(u[f]=h.symbol,Promise.resolve(void 0)));return Promise.all(d).then(()=>{!o.isCancellationRequested&&!i[c].isDisposed()&&i[c].updateCommands(u)})});return Promise.all(a)});this._resolveCodeLensesPromise=s,this._resolveCodeLensesPromise.then(()=>{const o=this._resolveCodeLensesDebounce.update(e,Date.now()-r);this._resolveCodeLensesScheduler.delay=o,this._currentCodeLensModel&&this._codeLensCache.put(e,this._currentCodeLensModel),this._oldCodeLensModels.clear(),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},o=>{rn(o),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,this._currentCodeLensModel?.isDisposed?void 0:this._currentCodeLensModel}};sR=C3t([zT(1,dt),zT(2,cd),zT(3,_r),zT(4,Ts),zT(5,e7e)],sR);Zn(sR.ID,sR,1);Pe(class extends ot{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:Q.hasCodeLensProvider,label:w("showLensOnLine","Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}async run(e,t){if(!t.hasModel())return;const i=e.get(hh),r=e.get(_r),s=e.get(Ts),o=t.getSelection().positionLineNumber,a=t.getContribution(sR.ID);if(!a)return;const l=await a.getModel();if(!l)return;const c=[];for(const h of l.lenses)h.symbol.command&&h.symbol.range.startLineNumber===o&&c.push({label:h.symbol.command.title,command:h.symbol.command});if(c.length===0)return;const u=await i.pick(c,{canPickMany:!1,placeHolder:w("placeHolder","Select a command")});if(!u)return;let d=u.command;if(l.isDisposed){const f=(await a.getModel())?.lenses.find(g=>g.symbol.range.startLineNumber===o&&g.symbol.command?.title===d.title);if(!f||!f.symbol.command)return;d=f.symbol.command}try{await r.executeCommand(d.id,...d.arguments||[])}catch(h){s.error(h)}}});var t7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},See=function(n,e){return function(t,i){e(t,i,n)}};let oR=class{constructor(e){this._editorWorkerService=e}async provideDocumentColors(e,t){return this._editorWorkerService.computeDefaultDocumentColors(e.uri)}provideColorPresentations(e,t,i){const r=t.range,s=t.color,o=s.alpha,a=new Te(new Jn(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),o)),l=o?Te.Format.CSS.formatRGB(a):Te.Format.CSS.formatRGBA(a),c=o?Te.Format.CSS.formatHSL(a):Te.Format.CSS.formatHSLA(a),u=o?Te.Format.CSS.formatHex(a):Te.Format.CSS.formatHexA(a),d=[];return d.push({label:l,textEdit:{range:r,text:l}}),d.push({label:c,textEdit:{range:r,text:c}}),d.push({label:u,textEdit:{range:r,text:u}}),d}};oR=t7e([See(0,Oc)],oR);let kee=class extends me{constructor(e,t){super(),this._register(e.colorProvider.register("*",new oR(t)))}};kee=t7e([See(0,dt),See(1,Oc)],kee);u2(kee);async function n7e(n,e,t,i=!0){return Aue(new x3t,n,e,t,i)}function i7e(n,e,t,i){return Promise.resolve(t.provideColorPresentations(n,e,i))}class x3t{constructor(){}async compute(e,t,i,r){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const o of s)r.push({colorInfo:o,provider:e});return Array.isArray(s)}}class S3t{constructor(){}async compute(e,t,i,r){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const o of s)r.push({range:o.range,color:[o.color.red,o.color.green,o.color.blue,o.color.alpha]});return Array.isArray(s)}}class k3t{constructor(e){this.colorInfo=e}async compute(e,t,i,r){const s=await e.provideColorPresentations(t,this.colorInfo,yn.None);return Array.isArray(s)&&r.push(...s),Array.isArray(s)}}async function Aue(n,e,t,i,r){let s=!1,o;const a=[],l=e.ordered(t);for(let c=l.length-1;c>=0;c--){const u=l[c];if(u instanceof oR)o=u;else try{await n.compute(u,t,i,a)&&(s=!0)}catch(d){vs(d)}}return s?a:o&&r?(await n.compute(o,t,i,a),a):[]}function r7e(n,e){const{colorProvider:t}=n.get(dt),i=n.get(Sr).getModel(e);if(!i)throw qd();const r=n.get(kn).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:r}}Un.registerCommand("_executeDocumentColorProvider",function(n,...e){const[t]=e;if(!(t instanceof Pt))throw qd();const{model:i,colorProviderRegistry:r,isDefaultColorDecoratorsEnabled:s}=r7e(n,t);return Aue(new S3t,r,i,yn.None,s)});Un.registerCommand("_executeColorPresentationProvider",function(n,...e){const[t,i]=e,{uri:r,range:s}=i;if(!(r instanceof Pt)||!Array.isArray(t)||t.length!==4||!$.isIRange(s))throw qd();const{model:o,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:l}=r7e(n,r),[c,u,d,h]=t;return Aue(new k3t({range:s,color:{red:c,green:u,blue:d,alpha:h}}),a,o,yn.None,l)});var E3t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Hq=function(n,e){return function(t,i){e(t,i,n)}},Eee;const s7e=Object.create({});let IE=class extends me{static{Eee=this}static{this.ID="editor.contrib.colorDetector"}static{this.RECOMPUTE_TIME=1e3}constructor(e,t,i,r){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new ke),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new VW(this._editor),this._decoratorLimitReporter=new L3t,this._colorDecorationClassRefs=this._register(new ke),this._debounceInformation=r.for(i.colorProvider,"Document Colors",{min:Eee.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(i.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(s=>{const o=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(148);const a=o!==this._isColorDecoratorsEnabled||s.hasChanged(21),l=s.hasChanged(148);(a||l)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(148),this.updateColors()}isEnabled(){const e=this._editor.getModel();if(!e)return!1;const t=e.getLanguageId(),i=this._configurationService.getValue(t);if(i&&typeof i=="object"){const r=i.colorDecorators;if(r&&r.enable!==void 0&&!r.enable)return r.enable}return this._editor.getOption(20)}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new hf,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=ko(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new Bo(!1),r=await n7e(this._languageFeaturesService.colorProvider,t,e,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(t,i.elapsed()),r});try{const e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){rn(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){const t=e.map(i=>({range:{startLineNumber:i.colorInfo.range.startLineNumber,startColumn:i.colorInfo.range.startColumn,endLineNumber:i.colorInfo.range.endLineNumber,endColumn:i.colorInfo.range.endColumn},options:un.EMPTY}));this._editor.changeDecorations(i=>{this._decorationsIds=i.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((r,s)=>this._colorDatas.set(r,e[s]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();const t=[],i=this._editor.getOption(21);for(let s=0;sthis._colorDatas.has(r.id));return i.length===0?null:this._colorDatas.get(i[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}};IE=Eee=E3t([Hq(1,kn),Hq(2,dt),Hq(3,cd)],IE);class L3t{constructor(){this._onDidChange=new fe,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}Zn(IE.ID,IE,1);class T3t{get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(e,t,i){this.presentationIndex=i,this._onColorFlushed=new fe,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new fe,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new fe,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let i=-1;for(let r=0;r{this.backgroundColor=o.getColor(f8)||Te.white})),this._register(Ce(this._pickedColorNode,je.CLICK,()=>this.model.selectNextColorPresentation())),this._register(Ce(this._originalColorNode,je.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=Te.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.showingStandaloneColorPicker&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new I3t(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=Te.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class I3t extends me{constructor(e){super(),this._onClicked=this._register(new fe),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),Ne(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),Ne(this._button,t),Ne(t,Hu(".button"+zt.asCSSSelector(kr("color-picker-close",ze.close,w("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._register(Ce(this._button,je.CLICK,()=>{this._onClicked.fire()}))}}class A3t extends me{constructor(e,t,i,r=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=Hu(".colorpicker-body"),Ne(e,this._domNode),this._saturationBox=new N3t(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new R3t(this._domNode,this.model,r),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new P3t(this._domNode,this.model,r),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),r&&(this._insertButton=this._register(new O3t(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){const i=this.model.color.hsva;this.model.color=new Te(new Lp(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new Te(new Lp(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new Te(new Lp(i===360?0:i,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}}class N3t extends me{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new fe,this.onColorFlushed=this._onColorFlushed.event,this._domNode=Hu(".saturation-wrap"),Ne(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Ne(this._domNode,this._canvas),this.selection=Hu(".saturation-selection"),Ne(this._domNode,this.selection),this.layout(),this._register(Ce(this._domNode,je.POINTER_DOWN,r=>this.onPointerDown(r))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new e2);const t=ms(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>this.onDidChangePosition(r.pageX-t.left,r.pageY-t.top),()=>null);const i=Ce(e.target.ownerDocument,je.POINTER_UP,()=>{this._onColorFlushed.fire(),i.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){const i=Math.max(0,Math.min(1,e/this.width)),r=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(i,r),this._onDidChange.fire({s:i,v:r})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();const e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){const e=this.model.color.hsva,t=new Te(new Lp(e.h,1,1,1)),i=this._canvas.getContext("2d"),r=i.createLinearGradient(0,0,this._canvas.width,0);r.addColorStop(0,"rgba(255, 255, 255, 1)"),r.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),r.addColorStop(1,"rgba(255, 255, 255, 0)");const s=i.createLinearGradient(0,0,0,this._canvas.height);s.addColorStop(0,"rgba(0, 0, 0, 0)"),s.addColorStop(1,"rgba(0, 0, 0, 1)"),i.rect(0,0,this._canvas.width,this._canvas.height),i.fillStyle=Te.Format.CSS.format(t),i.fill(),i.fillStyle=r,i.fill(),i.fillStyle=s,i.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const t=e.hsva;this.paintSelection(t.s,t.v)}}class o7e extends me{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new fe,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=Ne(e,Hu(".standalone-strip")),this.overlay=Ne(this.domNode,Hu(".standalone-overlay"))):(this.domNode=Ne(e,Hu(".strip")),this.overlay=Ne(this.domNode,Hu(".overlay"))),this.slider=Ne(this.domNode,Hu(".slider")),this.slider.style.top="0px",this._register(Ce(this.domNode,je.POINTER_DOWN,r=>this.onPointerDown(r))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){const t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._register(new e2),i=ms(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,s=>this.onDidChangeTop(s.pageY-i.top),()=>null);const r=Ce(e.target.ownerDocument,je.POINTER_UP,()=>{this._onColorFlushed.fire(),r.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){const t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}}class R3t extends o7e{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(e){super.onDidChangeColor(e);const{r:t,g:i,b:r}=e.rgba,s=new Te(new Jn(t,i,r,1)),o=new Te(new Jn(t,i,r,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${o} 100%)`}getValue(e){return e.hsva.a}}class P3t extends o7e{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class O3t extends me{constructor(e){super(),this._onClicked=this._register(new fe),this.onClicked=this._onClicked.event,this._button=Ne(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(Ce(this._button,je.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}class M3t extends ud{constructor(e,t,i,r,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(cN.getInstance(Ot(e)).onDidChange(()=>this.layout())),this._domNode=Hu(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new D3t(this._domNode,this.model,r,s)),this.body=this._register(new A3t(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}}class Vq{constructor(e,t,i,r){this.priority=e,this.range=t,this.initialMousePosX=i,this.initialMousePosY=r,this.type=1}equals(e){return e.type===1&&this.range.equalsRange(e.range)}canAdoptVisibleHover(e,t){return e.type===1&&t.lineNumber===this.range.startLineNumber}}class g5{constructor(e,t,i,r,s,o){this.priority=e,this.owner=t,this.range=i,this.initialMousePosX=r,this.initialMousePosY=s,this.supportsMarkerHover=o,this.type=2}equals(e){return e.type===2&&this.owner===e.owner}canAdoptVisibleHover(e,t){return e.type===2&&this.owner===e.owner}}class Kw{constructor(e){this.renderedHoverParts=e}dispose(){for(const e of this.renderedHoverParts)e.dispose()}}const DC=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};var a7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},l7e=function(n,e){return function(t,i){e(t,i,n)}};class F3t{constructor(e,t,i,r){this.owner=e,this.range=t,this.model=i,this.provider=r,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let aR=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return to.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const r=IE.get(this._editor);if(!r)return[];for(const s of t){if(!r.isColorDecoration(s))continue;const o=r.getColorData(s.range.getStartPosition());if(o)return[await c7e(this,this._editor.getModel(),o.colorInfo,o.provider)]}return[]}renderHoverParts(e,t){const i=u7e(this,this._editor,this._themeService,t,e);if(!i)return new Kw([]);this._colorPicker=i.colorPicker;const r={hoverPart:i.hoverPart,hoverElement:this._colorPicker.domNode,dispose(){i.disposables.dispose()}};return new Kw([r])}handleResize(){this._colorPicker?.layout()}isColorPickerVisible(){return!!this._colorPicker}};aR=a7e([l7e(1,go)],aR);class B3t{constructor(e,t,i,r){this.owner=e,this.range=t,this.model=i,this.provider=r}}let lR=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!IE.get(this._editor))return null;const s=await n7e(i,this._editor.getModel(),yn.None);let o=null,a=null;for(const d of s){const h=d.colorInfo;$.containsRange(h.range,e.range)&&(o=h,a=d.provider)}const l=o??e,c=a??t,u=!!o;return{colorHover:await c7e(this,this._editor.getModel(),l,c),foundInEditor:u}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new $(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await p5(this._editor.getModel(),t,this._color,i,e),i=d7e(this._editor,i,t))}renderHoverParts(e,t){return u7e(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};lR=a7e([l7e(1,go)],lR);async function c7e(n,e,t,i){const r=e.getValueInRange(t.range),{red:s,green:o,blue:a,alpha:l}=t.color,c=new Jn(Math.round(s*255),Math.round(o*255),Math.round(a*255),l),u=new Te(c),d=await i7e(e,t,i,yn.None),h=new T3t(u,[],0);return h.colorPresentations=d||[],h.guessColorPresentation(u,r),n instanceof aR?new F3t(n,$.lift(t.range),h,i):new B3t(n,$.lift(t.range),h,i)}function u7e(n,e,t,i,r){if(i.length===0||!e.hasModel())return;if(r.setMinimumDimensions){const h=e.getOption(67)+8;r.setMinimumDimensions(new vi(302,h))}const s=new ke,o=i[0],a=e.getModel(),l=o.model,c=s.add(new M3t(r.fragment,l,e.getOption(144),t,n instanceof lR));let u=!1,d=new $(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn);if(n instanceof lR){const h=o.model.color;n.color=h,p5(a,l,h,d,o),s.add(l.onColorFlushed(f=>{n.color=f}))}else s.add(l.onColorFlushed(async h=>{await p5(a,l,h,d,o),u=!0,d=d7e(e,d,l)}));return s.add(l.onDidChangeColor(h=>{p5(a,l,h,d,o)})),s.add(e.onDidChangeModelContent(h=>{u?u=!1:(r.hide(),e.focus())})),{hoverPart:o,colorPicker:c,disposables:s}}function d7e(n,e,t){const i=[],r=t.presentation.textEdit??{range:e,text:t.presentation.label,forceMoveMarkers:!1};i.push(r),t.presentation.additionalTextEdits&&i.push(...t.presentation.additionalTextEdits);const s=$.lift(r.range),o=n.getModel()._setTrackedRange(null,s,3);return n.executeEdits("colorpicker",i),n.pushUndoStop(),n.getModel()._getTrackedRange(o)??s}async function p5(n,e,t,i,r){const s=await i7e(n,{range:i,color:{red:t.rgba.r/255,green:t.rgba.g/255,blue:t.rgba.b/255,alpha:t.rgba.a}},r.provider,yn.None);e.colorPresentations=s||[]}const h7e="editor.action.showHover",$3t="editor.action.showDefinitionPreviewHover",W3t="editor.action.scrollUpHover",H3t="editor.action.scrollDownHover",V3t="editor.action.scrollLeftHover",z3t="editor.action.scrollRightHover",U3t="editor.action.pageUpHover",j3t="editor.action.pageDownHover",q3t="editor.action.goToTopHover",K3t="editor.action.goToBottomHover",cH="editor.action.increaseHoverVerbosityLevel",G3t=w({key:"increaseHoverVerbosityLevel",comment:["Label for action that will increase the hover verbosity level."]},"Increase Hover Verbosity Level"),uH="editor.action.decreaseHoverVerbosityLevel",Y3t=w({key:"decreaseHoverVerbosityLevel",comment:["Label for action that will decrease the hover verbosity level."]},"Decrease Hover Verbosity Level"),f7e="editor.action.inlineSuggest.commit",g7e="editor.action.inlineSuggest.showPrevious",p7e="editor.action.inlineSuggest.showNext";var Nue=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Wh=function(n,e){return function(t,i){e(t,i,n)}},m5;let Lee=class extends me{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=St(this,r=>{const s=this.model.read(r)?.primaryGhostText.read(r);if(!this.alwaysShowToolbar.read(r)||!s||s.parts.length===0)return this.sessionPosition=void 0,null;const o=s.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==s.lineNumber&&(this.sessionPosition=void 0);const a=new he(s.lineNumber,Math.min(o,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(wc((r,s)=>{const o=this.model.read(r);if(!o||!this.alwaysShowToolbar.read(r))return;const a=Jb((c,u)=>{const d=u.add(this.instantiationService.createInstance(AE,this.editor,!0,this.position,o.selectedInlineCompletionIndex,o.inlineCompletionsCount,o.activeCommands));return e.addContentWidget(d),u.add(Lt(()=>e.removeContentWidget(d))),u.add(tn(h=>{this.position.read(h)&&o.lastTriggerKind.read(h)!==gg.Explicit&&o.triggerExplicitly()})),d}),l=cO(this,(c,u)=>!!this.position.read(c)||!!u);s.add(tn(c=>{l.read(c)&&a.read(c)}))}))}};Lee=Nue([Wh(2,Tt)],Lee);const Z3t=kr("inline-suggestion-hints-next",ze.chevronRight,w("parameterHintsNextIcon","Icon for show next parameter hint.")),X3t=kr("inline-suggestion-hints-previous",ze.chevronLeft,w("parameterHintsPreviousIcon","Icon for show previous parameter hint."));let AE=class extends me{static{m5=this}static{this._dropDownVisible=!1}static get dropDownVisible(){return this._dropDownVisible}static{this.id=0}createCommandAction(e,t,i){const r=new su(e,t,i,!0,()=>this._commandService.executeCommand(e)),s=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let o=t;return s&&(o=w({key:"content",comment:["A label","A keybinding"]},"{0} ({1})",t,s.getLabel())),r.tooltip=o,r}constructor(e,t,i,r,s,o,a,l,c,u,d){super(),this.editor=e,this.withBorder=t,this._position=i,this._currentSuggestionIdx=r,this._suggestionCount=s,this._extraCommands=o,this._commandService=a,this.keybindingService=c,this._contextKeyService=u,this._menuService=d,this.id=`InlineSuggestionHintsContentWidget${m5.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=An("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[An("div@toolBar")]),this.previousAction=this.createCommandAction(g7e,w("previous","Previous"),zt.asClassName(X3t)),this.availableSuggestionCountAction=new su("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(p7e,w("next","Next"),zt.asClassName(Z3t)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(ce.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Ui(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Ui(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.toolBar=this._register(l.createInstance(Tee,this.nodes.toolBar,ce.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:h=>h.startsWith("primary")},actionViewItemProvider:(h,f)=>{if(h instanceof ou)return l.createInstance(J3t,h,void 0);if(h===this.availableSuggestionCountAction){const g=new Q3t(void 0,h,{label:!0,icon:!1});return g.setClass("availableSuggestionCount"),g}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(h=>{m5._dropDownVisible=h})),this._register(tn(h=>{this._position.read(h),this.editor.layoutContentWidget(this)})),this._register(tn(h=>{const f=this._suggestionCount.read(h),g=this._currentSuggestionIdx.read(h);f!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${g+1}/${f}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),f!==void 0&&f>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(tn(h=>{const g=this._extraCommands.read(h).map(p=>({class:void 0,id:p.id,enabled:!0,tooltip:p.tooltip||"",label:p.title,run:m=>this._commandService.executeCommand(p.id)}));for(const[p,m]of this.inlineCompletionsActionsMenus.getActions())for(const _ of m)_ instanceof ou&&g.push(_);g.length>0&&g.unshift(new na),this.toolBar.setAdditionalSecondaryActions(g)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};AE=m5=Nue([Wh(6,_r),Wh(7,Tt),Wh(8,xi),Wh(9,jt),Wh(10,ld)],AE);class Q3t extends vE{constructor(){super(...arguments),this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}updateTooltip(){}}let J3t=class extends Db{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=An("div.keybinding").root;this._register(new l2(t,eu,{disableTitle:!0,...P6e})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},Tee=class extends JN{constructor(e,t,i,r,s,o,a,l,c){super(e,{resetMenu:t,...i},r,s,o,a,l,c),this.menuId=t,this.options2=i,this.menuService=r,this.contextKeyService=s,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){const e=[],t=[];EW(this.menu,this.options2?.menuOptions,{primary:e,secondary:t},this.options2?.toolbarOptions?.primaryGroup,this.options2?.toolbarOptions?.shouldInlineSubmenu,this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){$r(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){$r(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};Tee=Nue([Wh(3,ld),Wh(4,jt),Wh(5,mu),Wh(6,xi),Wh(7,_r),Wh(8,Qa)],Tee);function dH(n,e,t){const i=ms(n);return!(ei.left+i.width||ti.top+i.height)}let eFt=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class m7e extends me{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new fe),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Ui(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new Ui(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new Ui(()=>this._triggerLoadingMessage(),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t=!0){this._state=e,t&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=B_t(e=>this._computer.computeAsync(e)),(async()=>{try{for await(const e of this._asyncIterable)e&&(this._result.push(e),this._fireResult());this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0)}catch(e){rn(e)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync())),this._setState(this._asyncIterableDone?0:3)}_triggerLoadingMessage(){this._state===3&&this._setState(4)}_fireResult(){if(this._state===1||this._state===2)return;const e=this._state===0,t=this._state===4;this._onResult.fire(new eFt(this._result.slice(0),e,t))}start(e){if(e===0)this._state===0&&(this._setState(1),this._firstWaitScheduler.schedule(this._firstWaitTime),this._loadingMessageScheduler.schedule(this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(),this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break;case 2:this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break}}cancel(){this._firstWaitScheduler.cancel(),this._secondWaitScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._setState(0,!1)}}class Rue{constructor(){this._onDidWillResize=new fe,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new fe,this.onDidResize=this._onDidResize.event,this._sashListener=new ke,this._size=new vi(0,0),this._minSize=new vi(0,0),this._maxSize=new vi(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new $a(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new $a(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new $a(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:z8.North}),this._southSash=new $a(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:z8.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let e,t=0,i=0;this._sashListener.add(Ge.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{e===void 0&&(this._onDidWillResize.fire(),e=this._size,t=0,i=0)})),this._sashListener.add(Ge.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{e!==void 0&&(e=void 0,t=0,i=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(r=>{e&&(i=r.currentX-r.startX,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(r=>{e&&(i=-(r.currentX-r.startX),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(r=>{e&&(t=-(r.currentY-r.startY),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(r=>{e&&(t=r.currentY-r.startY,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(Ge.any(this._eastSash.onDidReset,this._westSash.onDidReset)(r=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(Ge.any(this._northSash.onDidReset,this._southSash.onDidReset)(r=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(e,t,i,r){this._northSash.state=e?3:0,this._eastSash.state=t?3:0,this._southSash.state=i?3:0,this._westSash.state=r?3:0}layout(e=this.size.height,t=this.size.width){const{height:i,width:r}=this._minSize,{height:s,width:o}=this._maxSize;e=Math.max(i,Math.min(s,e)),t=Math.max(r,Math.min(o,t));const a=new vi(t,e);vi.equals(a,this._size)||(this.domNode.style.height=e+"px",this.domNode.style.width=t+"px",this._size=a,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(e){this._maxSize=e}get maxSize(){return this._maxSize}set minSize(e){this._minSize=e}get minSize(){return this._minSize}set preferredSize(e){this._preferredSize=e}get preferredSize(){return this._preferredSize}}const tFt=30,nFt=24;class iFt extends me{constructor(e,t=new vi(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new Rue),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=vi.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(i=>{this._resize(new vi(i.dimension.width,i.dimension.height)),i.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){return this._contentPosition?.position?he.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:ms(t).top+i.top-tFt}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const r=ms(t),s=kb(t.ownerDocument.body),o=r.top+i.top+i.height;return s.height-o-nFt}_findPositionPreference(e,t){const i=Math.min(this._availableVerticalSpaceBelow(t)??1/0,e),r=Math.min(this._availableVerticalSpaceAbove(t)??1/0,e),s=Math.min(Math.max(r,i),e),o=Math.min(e,s);let a;return this._editor.getOption(60).above?a=o<=r?1:2:a=o<=i?2:1,a===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),a}_resize(e){this._resizableNode.layout(e.height,e.width)}}var rFt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},a3=function(n,e){return function(t,i){e(t,i,n)}},rp;const DCe=30,sFt=6;let Dee=class extends iFt{static{rp=this}static{this.ID="editor.contrib.resizableContentHoverWidget"}static{this._lastDimensions=new vi(0,0)}get isVisibleFromKeyboard(){return this._renderedHover?.source===1}get isVisible(){return this._hoverVisibleKey.get()??!1}get isFocused(){return this._hoverFocusedKey.get()??!1}constructor(e,t,i,r,s){const o=e.getOption(67)+8,a=150,l=new vi(a,o);super(e,l),this._configurationService=i,this._accessibilityService=r,this._keybindingService=s,this._hover=this._register(new yle),this._onDidResize=this._register(new fe),this.onDidResize=this._onDidResize.event,this._minimumSize=l,this._hoverVisibleKey=Q.hoverVisible.bindTo(t),this._hoverFocusedKey=Q.hoverFocused.bindTo(t),Ne(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(u=>{u.hasChanged(50)&&this._updateFont()}));const c=this._register(Eg(this._resizableNode.domNode));this._register(c.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(c.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}dispose(){super.dispose(),this._renderedHover?.dispose(),this._editor.removeContentWidget(this)}getId(){return rp.ID}static _applyDimensions(e,t,i){const r=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.width=r,e.style.height=s}_setContentsDomNodeDimensions(e,t){const i=this._hover.contentsDomNode;return rp._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return rp._applyDimensions(i,e,t)}_setHoverWidgetDimensions(e,t){this._setContentsDomNodeDimensions(e,t),this._setContainerDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,i){const r=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.maxWidth=r,e.style.maxHeight=s}_setHoverWidgetMaxDimensions(e,t){rp._applyMaxDimensions(this._hover.contentsDomNode,e,t),rp._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none");const t=e.width,i=e.height;this._setHoverWidgetDimensions(t,i)}_updateResizableNodeMaxDimensions(){const e=this._findMaximumRenderingWidth()??1/0,t=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new vi(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){rp._lastDimensions=new vi(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),this._onDidResize.fire()}_findAvailableSpaceVertically(){const e=this._renderedHover?.showAtPosition;if(e)return this._positionPreference===1?this._availableVerticalSpaceAbove(e):this._availableVerticalSpaceBelow(e)}_findMaximumRenderingHeight(){const e=this._findAvailableSpaceVertically();if(!e)return;let t=sFt;return Array.from(this._hover.contentsDomNode.children).forEach(i=>{t+=i.clientHeight}),Math.min(e,t)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;const e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth-2;return e||this._hover.containerDomNode.clientWidththis._renderedHover.closestMouseDistance+4?!1:(this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,r),!0)}_setRenderedHover(e){this._renderedHover?.dispose(),this._renderedHover=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){const{fontSize:e,lineHeight:t}=this._editor.getOption(50),i=this._hover.contentsDomNode;i.style.fontSize=`${e}px`,i.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(s=>this._editor.applyFontInfo(s))}_updateContent(e){const t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const e=Math.max(this._editor.getLayoutInfo().height/4,250,rp._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,rp._lastDimensions.width);this._setHoverWidgetMaxDimensions(t,e)}_render(e){this._setRenderedHover(e),this._updateFont(),this._updateContent(e.domNode),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){return this._renderedHover?{position:this._renderedHover.showAtPosition,secondaryPosition:this._renderedHover.showAtSecondaryPosition,positionAffinity:this._renderedHover.shouldAppearBeforeContent?3:void 0,preference:[this._positionPreference??1]}:null}show(e){if(!this._editor||!this._editor.hasModel())return;this._render(e);const t=h_(this._hover.containerDomNode),i=e.showAtPosition;this._positionPreference=this._findPositionPreference(t,i)??1,this.onContentsChanged(),e.shouldFocus&&this._hover.containerDomNode.focus(),this._onDidResize.fire();const s=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&MFe(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel()??"");s&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+s)}hide(){if(!this._renderedHover)return;const e=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();this._setRenderedHover(void 0),this._resizableNode.maxSize=new vi(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){const e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto")}setMinimumDimensions(e){this._minimumSize=new vi(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new vi(e,this._minimumSize.height)}onContentsChanged(){this._removeConstraintsRenderNormally();const e=this._hover.containerDomNode;let t=h_(e),i=qc(e);if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=h_(e),i=qc(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),this._renderedHover?.showAtPosition){const r=h_(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(r,this._renderedHover.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-DCe})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+DCe})}pageUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};Dee=rp=rFt([a3(1,jt),a3(2,kn),a3(3,_u),a3(4,xi)],Dee);function ICe(n,e,t,i,r,s){const o=t+r/2,a=i+s/2,l=Math.max(Math.abs(n-o)-r/2,0),c=Math.max(Math.abs(e-a)-s/2,0);return Math.sqrt(l*l+c*c)}class R9{get anchor(){return this._anchor}set anchor(e){this._anchor=e}get shouldFocus(){return this._shouldFocus}set shouldFocus(e){this._shouldFocus=e}get source(){return this._source}set source(e){this._source=e}get insistOnKeepingHoverVisible(){return this._insistOnKeepingHoverVisible}set insistOnKeepingHoverVisible(e){this._insistOnKeepingHoverVisible=e}constructor(e,t){this._editor=e,this._participants=t,this._anchor=null,this._shouldFocus=!1,this._source=0,this._insistOnKeepingHoverVisible=!1}static _getLineDecorations(e,t){if(t.type!==1&&!t.supportsMarkerHover)return[];const i=e.getModel(),r=t.range.startLineNumber;if(r>i.getLineCount())return[];const s=i.getLineMaxColumn(r);return e.getLineDecorations(r).filter(o=>{if(o.options.isWholeLine)return!0;const a=o.range.startLineNumber===r?o.range.startColumn:1,l=o.range.endLineNumber===r?o.range.endColumn:s;if(o.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>l)return!1}else if(a>t.range.startColumn||t.range.endColumn>l)return!1;return!0})}computeAsync(e){const t=this._anchor;if(!this._editor.hasModel()||!t)return to.EMPTY;const i=R9._getLineDecorations(this._editor,t);return to.merge(this._participants.map(r=>r.computeAsync?r.computeAsync(t,i,e):to.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=R9._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return rf(t)}}class _7e{constructor(e,t,i){this.anchor=e,this.hoverParts=t,this.isComplete=i}filter(e){const t=this.hoverParts.filter(i=>i.isValidForHoverAnchor(e));return t.length===this.hoverParts.length?this:new oFt(this,this.anchor,t,this.isComplete)}}class oFt extends _7e{constructor(e,t,i,r){super(t,i,r),this.original=e}filter(e){return this.original.filter(e)}}var aFt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},lFt=function(n,e){return function(t,i){e(t,i,n)}};const ACe=qe;let P9=class extends me{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this.actions=[],this._hasContent=!1,this.hoverElement=ACe("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=Ne(this.hoverElement,ACe("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const r=this._register(gW.render(this.actionsElement,e,i));return this.actions.push(r),r}append(e){const t=Ne(this.actionsElement,e);return this._hasContent=!0,t}};P9=aFt([lFt(0,xi)],P9);class cFt{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function uFt(n,e,t,i,r){const s=await Promise.resolve(n.provideHover(t,i,r)).catch(vs);if(!(!s||!dFt(s)))return new cFt(n,s,e)}function Pue(n,e,t,i,r=!1){const o=n.ordered(e,r).map((a,l)=>uFt(a,l,e,t,i));return to.fromPromises(o).coalesce()}function v7e(n,e,t,i,r=!1){return Pue(n,e,t,i,r).map(s=>s.hover).toPromise()}Rc("_executeHoverProvider",(n,e,t)=>{const i=n.get(dt);return v7e(i.hoverProvider,e,t,yn.None)});Rc("_executeHoverProvider_recursive",(n,e,t)=>{const i=n.get(dt);return v7e(i.hoverProvider,e,t,yn.None,!0)});function dFt(n){const e=typeof n.range<"u",t=typeof n.contents<"u"&&n.contents&&n.contents.length>0;return e&&t}var hFt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},O1=function(n,e){return function(t,i){e(t,i,n)}};const FS=qe,fFt=kr("hover-increase-verbosity",ze.add,w("increaseHoverVerbosity","Icon for increaseing hover verbosity.")),gFt=kr("hover-decrease-verbosity",ze.remove,w("decreaseHoverVerbosity","Icon for decreasing hover verbosity."));class Uh{constructor(e,t,i,r,s,o=void 0){this.owner=e,this.range=t,this.contents=i,this.isBeforeContent=r,this.ordinal=s,this.source=o}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}class b7e{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){switch(e){case Zc.Increase:return this.hover.canIncreaseVerbosity??!1;case Zc.Decrease:return this.hover.canDecreaseVerbosity??!1}}}let cR=class{constructor(e,t,i,r,s,o,a,l){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=r,this._languageFeaturesService=s,this._keybindingService=o,this._hoverService=a,this._commandService=l,this.hoverOrdinal=3}createLoadingMessage(e){return new Uh(this,e.range,[new za().appendText(w("modesContentHover.loading","Loading..."))],!1,2e3)}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),r=e.range.startLineNumber,s=i.getLineMaxColumn(r),o=[];let a=1e3;const l=i.getLineLength(r),c=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),u=this._editor.getOption(118),d=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:c});let h=!1;u>=0&&l>u&&e.range.startColumn>=u&&(h=!0,o.push(new Uh(this,e.range,[{value:w("stopped rendering","Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!h&&typeof d=="number"&&l>=d&&o.push(new Uh(this,e.range,[{value:w("too many characters","Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,a++));let f=!1;for(const g of t){const p=g.range.startLineNumber===r?g.range.startColumn:1,m=g.range.endLineNumber===r?g.range.endColumn:s,_=g.options.hoverMessage;if(!_||fE(_))continue;g.options.beforeContentClassName&&(f=!0);const v=new $(e.range.startLineNumber,p,e.range.startLineNumber,m);o.push(new Uh(this,v,fae(_),f,a++))}return o}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return to.EMPTY;const r=this._editor.getModel(),s=this._languageFeaturesService.hoverProvider;return s.has(r)?this._getMarkdownHovers(s,r,e,i):to.EMPTY}_getMarkdownHovers(e,t,i,r){const s=i.range.getStartPosition();return Pue(e,t,s,r).filter(l=>!fE(l.hover.contents)).map(l=>{const c=l.hover.range?$.lift(l.hover.range):i.range,u=new b7e(l.hover,l.provider,s);return new Uh(this,c,l.hover.contents,!1,l.ordinal,u)})}renderHoverParts(e,t){return this._renderedHoverParts=new pFt(t,e.fragment,this,this._editor,this._languageService,this._openerService,this._commandService,this._keybindingService,this._hoverService,this._configurationService,e.onContentsChanged),this._renderedHoverParts}updateMarkdownHoverVerbosityLevel(e,t,i){return Promise.resolve(this._renderedHoverParts?.updateMarkdownHoverPartVerbosityLevel(e,t,i))}};cR=hFt([O1(1,Hr),O1(2,Pc),O1(3,kn),O1(4,dt),O1(5,xi),O1(6,um),O1(7,_r)],cR);class l3{constructor(e,t,i){this.hoverPart=e,this.hoverElement=t,this.disposables=i}dispose(){this.disposables.dispose()}}class pFt{constructor(e,t,i,r,s,o,a,l,c,u,d){this._hoverParticipant=i,this._editor=r,this._languageService=s,this._openerService=o,this._commandService=a,this._keybindingService=l,this._hoverService=c,this._configurationService=u,this._onFinishedRendering=d,this._ongoingHoverOperations=new Map,this._disposables=new ke,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(Lt(()=>{this.renderedHoverParts.forEach(h=>{h.dispose()}),this._ongoingHoverOperations.forEach(h=>{h.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,i){return e.sort($l(r=>r.ordinal,Xh)),e.map(r=>{const s=this._renderHoverPart(r,i);return t.appendChild(s.hoverElement),s})}_renderHoverPart(e,t){const i=this._renderMarkdownHover(e,t),r=i.hoverElement,s=e.source,o=new ke;if(o.add(i),!s)return new l3(e,r,o);const a=s.supportsVerbosityAction(Zc.Increase),l=s.supportsVerbosityAction(Zc.Decrease);if(!a&&!l)return new l3(e,r,o);const c=FS("div.verbosity-actions");return r.prepend(c),o.add(this._renderHoverExpansionAction(c,Zc.Increase,a)),o.add(this._renderHoverExpansionAction(c,Zc.Decrease,l)),new l3(e,r,o)}_renderMarkdownHover(e,t){return y7e(this._editor,e,this._languageService,this._openerService,t)}_renderHoverExpansionAction(e,t,i){const r=new ke,s=t===Zc.Increase,o=Ne(e,FS(zt.asCSSSelector(s?fFt:gFt)));o.tabIndex=0;const a=new uE("mouse",!1,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService);if(r.add(this._hoverService.setupManagedHover(a,o,_Ft(this._keybindingService,t))),!i)return o.classList.add("disabled"),r;o.classList.add("enabled");const l=()=>this._commandService.executeCommand(t===Zc.Increase?cH:uH);return r.add(new FFe(o,l)),r.add(new BFe(o,l,[3,10])),r}async updateMarkdownHoverPartVerbosityLevel(e,t,i=!0){const r=this._editor.getModel();if(!r)return;const s=this._getRenderedHoverPartAtIndex(t),o=s?.hoverPart.source;if(!s||!o?.supportsVerbosityAction(e))return;const a=await this._fetchHover(o,r,e);if(!a)return;const l=new b7e(a,o.hoverProvider,o.hoverPosition),c=s.hoverPart,u=new Uh(this._hoverParticipant,c.range,a.contents,c.isBeforeContent,c.ordinal,l),d=this._renderHoverPart(u,this._onFinishedRendering);return this._replaceRenderedHoverPartAtIndex(t,d,u),i&&this._focusOnHoverPartWithIndex(t),{hoverPart:u,hoverElement:d.hoverElement}}async _fetchHover(e,t,i){let r=i===Zc.Increase?1:-1;const s=e.hoverProvider,o=this._ongoingHoverOperations.get(s);o&&(o.tokenSource.cancel(),r+=o.verbosityDelta);const a=new Kr;this._ongoingHoverOperations.set(s,{verbosityDelta:r,tokenSource:a});const l={verbosityRequest:{verbosityDelta:r,previousHover:e.hover}};let c;try{c=await Promise.resolve(s.provideHover(t,e.hoverPosition,a.token,l))}catch(u){vs(u)}return a.dispose(),this._ongoingHoverOperations.delete(s),c}_replaceRenderedHoverPartAtIndex(e,t,i){if(e>=this.renderedHoverParts.length||e<0)return;const r=this.renderedHoverParts[e],s=r.hoverElement,o=t.hoverElement,a=Array.from(o.children);s.replaceChildren(...a);const l=new l3(i,s,t.disposables);s.focus(),r.dispose(),this.renderedHoverParts[e]=l}_focusOnHoverPartWithIndex(e){this.renderedHoverParts[e].hoverElement.focus()}_getRenderedHoverPartAtIndex(e){return this.renderedHoverParts[e]}dispose(){this._disposables.dispose()}}function mFt(n,e,t,i,r){e.sort($l(o=>o.ordinal,Xh));const s=[];for(const o of e)s.push(y7e(t,o,i,r,n.onContentsChanged));return new Kw(s)}function y7e(n,e,t,i,r){const s=new ke,o=FS("div.hover-row"),a=FS("div.hover-row-contents");o.appendChild(a);const l=e.contents;for(const u of l){if(fE(u))continue;const d=FS("div.markdown-hover"),h=Ne(d,FS("div.hover-contents")),f=s.add(new Q_({editor:n},t,i));s.add(f.onDidRenderAsync(()=>{h.className="hover-contents code-hover-contents",r()}));const g=s.add(f.render(u));h.appendChild(g.element),a.appendChild(d)}return{hoverPart:e,hoverElement:o,dispose(){s.dispose()}}}function _Ft(n,e){switch(e){case Zc.Increase:{const t=n.lookupKeybinding(cH);return t?w("increaseVerbosityWithKb","Increase Hover Verbosity ({0})",t.getLabel()):w("increaseVerbosity","Increase Hover Verbosity")}case Zc.Decrease:{const t=n.lookupKeybinding(uH);return t?w("decreaseVerbosityWithKb","Decrease Hover Verbosity ({0})",t.getLabel()):w("decreaseVerbosity","Decrease Hover Verbosity")}}}function Iee(n,e){return!!n[e]}class zq{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=Iee(e.event,t.triggerModifier),this.hasSideBySideModifier=Iee(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class NCe{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=Iee(e,t.triggerModifier)}}class c3{constructor(e,t,i,r){this.triggerKey=e,this.triggerModifier=t,this.triggerSideBySideKey=i,this.triggerSideBySideModifier=r}equals(e){return this.triggerKey===e.triggerKey&&this.triggerModifier===e.triggerModifier&&this.triggerSideBySideKey===e.triggerSideBySideKey&&this.triggerSideBySideModifier===e.triggerSideBySideModifier}}function RCe(n){return n==="altKey"?Rn?new c3(57,"metaKey",6,"altKey"):new c3(5,"ctrlKey",6,"altKey"):Rn?new c3(6,"altKey",57,"metaKey"):new c3(6,"altKey",5,"ctrlKey")}class hH extends me{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new fe),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new fe),this.onExecute=this._onExecute.event,this._onCancel=this._register(new fe),this.onCancel=this._onCancel.event,this._editor=e,this._extractLineNumberFromMouseEvent=t?.extractLineNumberFromMouseEvent??(i=>i.target.position?i.target.position.lineNumber:0),this._opts=RCe(this._editor.getOption(78)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(i=>{if(i.hasChanged(78)){const r=RCe(this._editor.getOption(78));if(this._opts.equals(r))return;this._opts=r,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(i=>this._onEditorMouseMove(new zq(i,this._opts)))),this._register(this._editor.onMouseDown(i=>this._onEditorMouseDown(new zq(i,this._opts)))),this._register(this._editor.onMouseUp(i=>this._onEditorMouseUp(new zq(i,this._opts)))),this._register(this._editor.onKeyDown(i=>this._onEditorKeyDown(new NCe(i,this._opts)))),this._register(this._editor.onKeyUp(i=>this._onEditorKeyUp(new NCe(i,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(i=>this._onDidChangeCursorSelection(i))),this._register(this._editor.onDidChangeModel(i=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(i=>{(i.scrollTopChanged||i.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){const t=this._extractLineNumberFromMouseEvent(e);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}class w7e{constructor(e,t){this.range=e,this.direction=t}}class Oue{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new Oue(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}async resolve(e){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,e.isCancellationRequested?void 0:this.resolve(e);this._isResolved||(this._currentResolve=this._doResolve(e).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(e){try{const t=await Promise.resolve(this.provider.resolveInlayHint(this.hint,e));this.hint.tooltip=t?.tooltip??this.hint.tooltip,this.hint.label=t?.label??this.hint.label,this.hint.textEdits=t?.textEdits??this.hint.textEdits,this._isResolved=!0}catch(t){vs(t),this._isResolved=!1}}}class Lk{static{this._emptyInlayHintList=Object.freeze({dispose(){},hints:[]})}static async create(e,t,i,r){const s=[],o=e.ordered(t).reverse().map(a=>i.map(async l=>{try{const c=await a.provideInlayHints(t,l,r);(c?.hints.length||a.onDidChangeInlayHints)&&s.push([c??Lk._emptyInlayHintList,a])}catch(c){vs(c)}}));if(await Promise.all(o.flat()),r.isCancellationRequested||t.isDisposed())throw new sf;return new Lk(i,s,t)}constructor(e,t,i){this._disposables=new ke,this.ranges=e,this.provider=new Set;const r=[];for(const[s,o]of t){this._disposables.add(s),this.provider.add(o);for(const a of s.hints){const l=i.validatePosition(a.position);let c="before";const u=Lk._getRangeAtPosition(i,l);let d;u.getStartPosition().isBefore(l)?(d=$.fromPositions(u.getStartPosition(),l),c="after"):(d=$.fromPositions(l,u.getEndPosition()),c="before"),r.push(new Oue(a,new w7e(d,c),o))}}this.items=r.sort((s,o)=>he.compare(s.hint.position,o.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,r=e.getWordAtPosition(t);if(r)return new $(i,r.startColumn,i,r.endColumn);e.tokenization.tokenizeIfCheap(i);const s=e.tokenization.getLineTokens(i),o=t.column-1,a=s.findTokenIndexAtOffset(o);let l=s.getStartOffset(a),c=s.getEndOffset(a);return c-l===1&&(l===o&&a>1?(l=s.getStartOffset(a-1),c=s.getEndOffset(a-1)):c===o&&a=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Rm=function(n,e){return function(t,i){e(t,i,n)}};let cf=class extends ZN{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f){super(e,{...r.getRawOptions(),overflowWidgetsDomNode:r.getOverflowWidgetsDomNode()},i,s,o,a,l,c,u,d,h,f),this._parentEditor=r,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(r.onDidChangeConfiguration(g=>this._onParentConfigurationChanged(g)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){A$(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};cf=bFt([Rm(4,Tt),Rm(5,ai),Rm(6,_r),Rm(7,jt),Rm(8,go),Rm(9,Ts),Rm(10,_u),Rm(11,Zr),Rm(12,dt)],cf);const PCe=new Te(new Jn(0,122,204)),yFt={showArrow:!0,showFrame:!0,className:"",frameColor:PCe,arrowColor:PCe,keepEditorSelection:!1},wFt="vs.editor.contrib.zoneWidget";class CFt{constructor(e,t,i,r,s,o,a,l){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=r,this.showInHiddenAreas=a,this.ordinal=l,this._onDomNodeTop=s,this._onComputedHeight=o}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class xFt{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}let SFt=class C7e{static{this._IdGenerator=new Ile(".arrow-decoration-")}constructor(e){this._editor=e,this._ruleName=C7e._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),vX(this._ruleName)}set color(e){this._color!==e&&(this._color=e,this._updateStyle())}set height(e){this._height!==e&&(this._height=e,this._updateStyle())}_updateStyle(){vX(this._ruleName),Y6(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(e){e.column===1&&(e={lineNumber:e.lineNumber,column:2}),this._decorations.set([{range:$.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}};class kFt{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new ke,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=Qm(t),A$(this.options,yFt,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(i=>{const r=this._getWidth(i);this.domNode.style.width=r+"px",this.domNode.style.left=this._getLeft(i)+"px",this._onWidth(r)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new SFt(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(e){e.frameColor&&(this.options.frameColor=e.frameColor),e.arrowColor&&(this.options.arrowColor=e.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){const e=this.options.arrowColor.toString();this._arrow.color=e}}_getWidth(e){return e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}_getLeft(e){return e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+"px"}_onViewZoneHeight(e){if(this.domNode.style.height=`${e}px`,this.container){const t=e-this._decoratingElementsHeight();this.container.style.height=`${t}px`;const i=this.editor.getLayoutInfo();this._doLayout(t,this._getWidth(i))}this._resizeSash?.layout()}get position(){const e=this._positionMarkerId.getRange(0);if(e)return e.getStartPosition()}show(e,t){const i=$.isIRange(e)?$.lift(e):$.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:un.EMPTY}])}hide(){this._viewZone&&(this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._arrow?.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const e=this.editor.getOption(67);let t=0;if(this.options.showArrow){const i=Math.round(e/3);t+=2*i}if(this.options.showFrame){const i=Math.round(e/9);t+=2*i}return t}_showImpl(e,t){const i=e.getStartPosition(),r=this.editor.getLayoutInfo(),s=this._getWidth(r);this.domNode.style.width=`${s}px`,this.domNode.style.left=this._getLeft(r)+"px";const o=document.createElement("div");o.style.overflow="hidden";const a=this.editor.getOption(67);if(!this.options.allowUnlimitedHeight){const h=Math.max(12,this.editor.getLayoutInfo().height/a*.8);t=Math.min(t,h)}let l=0,c=0;if(this._arrow&&this.options.showArrow&&(l=Math.round(a/3),this._arrow.height=l,this._arrow.show(i)),this.options.showFrame&&(c=Math.round(a/9)),this.editor.changeViewZones(h=>{this._viewZone&&h.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new CFt(o,i.lineNumber,i.column,t,f=>this._onViewZoneTop(f),f=>this._onViewZoneHeight(f),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=h.addZone(this._viewZone),this._overlayWidget=new xFt(wFt+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const h=this.options.frameWidth?this.options.frameWidth:c;this.container.style.borderTopWidth=h+"px",this.container.style.borderBottomWidth=h+"px"}const u=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=l+"px",this.container.style.height=u+"px",this.container.style.overflow="hidden"),this._doLayout(u,s),this.options.keepEditorSelection||this.editor.setSelection(e);const d=this.editor.getModel();if(d){const h=d.validateRange(new $(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(h,h.startLineNumber===d.getLineCount())}}revealRange(e,t){t?this.editor.revealLineNearTop(e.endLineNumber,0):this.editor.revealRange(e,0)}setCssClass(e,t){this.container&&(t&&this.container.classList.remove(t),this.container.classList.add(e))}_onWidth(e){}_doLayout(e,t){}_relayout(e){this._viewZone&&this._viewZone.heightInLines!==e&&this.editor.changeViewZones(t=>{this._viewZone&&(this._viewZone.heightInLines=e,t.layoutZone(this._viewZone.id))})}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new $a(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let e;this._disposables.add(this._resizeSash.onDidStart(t=>{this._viewZone&&(e={startY:t.startY,heightInLines:this._viewZone.heightInLines})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{e=void 0})),this._disposables.add(this._resizeSash.onDidChange(t=>{if(e){const i=(t.currentY-e.startY)/this.editor.getOption(67),r=i<0?Math.ceil(i):Math.floor(i),s=e.heightInLines+r;s>5&&s<35&&this._relayout(s)}}))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const e=this.editor.getLayoutInfo();return e.width-e.minimap.minimapWidth}}var x7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},S7e=function(n,e){return function(t,i){e(t,i,n)}};const k7e=On("IPeekViewService");Vn(k7e,class{constructor(){this._widgets=new Map}addExclusiveWidget(n,e){const t=this._widgets.get(n);t&&(t.listener.dispose(),t.widget.dispose());const i=()=>{const r=this._widgets.get(n);r&&r.widget===e&&(r.listener.dispose(),this._widgets.delete(n))};this._widgets.set(n,{widget:e,listener:e.onDidClose(i)})}},1);var Dc;(function(n){n.inPeekEditor=new et("inReferenceSearchEditor",!0,w("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),n.notInPeekEditor=n.inPeekEditor.toNegated()})(Dc||(Dc={}));let O9=class{static{this.ID="editor.contrib.referenceController"}constructor(e,t){e instanceof cf&&Dc.inPeekEditor.bindTo(t)}dispose(){}};O9=x7e([S7e(1,jt)],O9);Zn(O9.ID,O9,0);function EFt(n){const e=n.get(ai).getFocusedCodeEditor();return e instanceof cf?e.getParentEditor():e}const LFt={headerBackgroundColor:Te.white,primaryHeadingColor:Te.fromHex("#333333"),secondaryHeadingColor:Te.fromHex("#6c6c6cb3")};let M9=class extends kFt{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new fe,this.onDidClose=this._onDidClose.event,A$(this.options,LFt,!1)}dispose(){this.disposed||(this.disposed=!0,super.dispose(),this._onDidClose.fire(this))}style(e){const t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();const e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=qe(".head"),this._bodyElement=qe(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=qe(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Jr(this._titleElement,"click",s=>this._onTitleClick(s))),Ne(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=qe("span.filename"),this._secondaryHeading=qe("span.dirname"),this._metaHeading=qe("span.meta"),Ne(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=qe(".peekview-actions");Ne(this._headElement,i);const r=this._getActionBarOptions();this._actionbarWidget=new ed(i,r),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new su("peekview.close",w("label.close","Close"),zt.asClassName(ze.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:x5e.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:Jo(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Qc(this._metaHeading)):Al(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}const i=Math.ceil(this.editor.getOption(67)*1.2),r=Math.round(e-(i+2));this._doLayoutHead(i,t),this._doLayoutBody(r,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};M9=x7e([S7e(2,Tt)],M9);const TFt=J("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Te.black,hcLight:Te.white},w("peekViewTitleBackground","Background color of the peek view title area.")),E7e=J("peekViewTitleLabel.foreground",{dark:Te.white,light:Te.black,hcDark:Te.white,hcLight:cm},w("peekViewTitleForeground","Color of the peek view title.")),L7e=J("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},w("peekViewTitleInfoForeground","Color of the peek view title info.")),DFt=J("peekView.border",{dark:Xp,light:Xp,hcDark:Yn,hcLight:Yn},w("peekViewBorder","Color of the peek view borders and arrow.")),IFt=J("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Te.black,hcLight:Te.white},w("peekViewResultsBackground","Background color of the peek view result list."));J("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Te.white,hcLight:cm},w("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));J("peekViewResult.fileForeground",{dark:Te.white,light:"#1E1E1E",hcDark:Te.white,hcLight:cm},w("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));J("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},w("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));J("peekViewResult.selectionForeground",{dark:Te.white,light:"#6C6C6C",hcDark:Te.white,hcLight:cm},w("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const T7e=J("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Te.black,hcLight:Te.white},w("peekViewEditorBackground","Background color of the peek view editor."));J("peekViewEditorGutter.background",T7e,w("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));J("peekViewEditorStickyScroll.background",T7e,w("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));J("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},w("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));J("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},w("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));J("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Ar,hcLight:Ar},w("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class Mb{constructor(e,t,i,r){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=r,this.id=nQ.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(e){this._range=e,this._rangeCallback(this)}get ariaMessage(){const e=this.parent.getPreview(this)?.preview(this.range);return e?w({key:"aria.oneReference.preview",comment:["Placeholders are: 0: filename, 1:line number, 2: column number, 3: preview snippet of source code"]},"{0} in {1} on line {2} at column {3}",e.value,th(this.uri),this.range.startLineNumber,this.range.startColumn):w("aria.oneReference","in {0} on line {1} at column {2}",th(this.uri),this.range.startLineNumber,this.range.startColumn)}}class AFt{constructor(e){this._modelReference=e}dispose(){this._modelReference.dispose()}preview(e,t=8){const i=this._modelReference.object.textEditorModel;if(!i)return;const{startLineNumber:r,startColumn:s,endLineNumber:o,endColumn:a}=e,l=i.getWordUntilPosition({lineNumber:r,column:s-t}),c=new $(r,l.startColumn,r,s),u=new $(o,a,o,1073741824),d=i.getValueInRange(c).replace(/^\s+/,""),h=i.getValueInRange(e),f=i.getValueInRange(u).replace(/\s+$/,"");return{value:d+h+f,highlight:{start:d.length,end:d.length+h.length}}}}class uR{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new so}dispose(){er(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?w("aria.fileReferences.1","1 symbol in {0}, full path {1}",th(this.uri),this.uri.fsPath):w("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,th(this.uri),this.uri.fsPath)}async resolve(e){if(this._previews.size!==0)return this;for(const t of this.children)if(!this._previews.has(t.uri))try{const i=await e.createModelReference(t.uri);this._previews.set(t.uri,new AFt(i))}catch(i){rn(i)}return this}}class lu{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new fe,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(lu._compareReferences);let r;for(const s of e)if((!r||!Nr.isEqual(r.uri,s.uri,!0))&&(r=new uR(this,s.uri),this.groups.push(r)),r.children.length===0||lu._compareReferences(s,r.children[r.children.length-1])!==0){const o=new Mb(i===s,r,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(o),r.children.push(o)}}dispose(){er(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new lu(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?w("aria.result.0","No results found"):this.references.length===1?w("aria.result.1","Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?w("aria.result.n1","Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):w("aria.result.nm","Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(e,t){const{parent:i}=e;let r=i.children.indexOf(e);const s=i.children.length,o=i.parent.groups.length;return o===1||t&&r+10?(t?r=(r+1)%s:r=(r+s-1)%s,i.children[r]):(r=i.parent.groups.indexOf(i),t?(r=(r+1)%o,i.parent.groups[r].children[0]):(r=(r+o-1)%o,i.parent.groups[r].children[i.parent.groups[r].children.length-1]))}nearestReference(e,t){const i=this.references.map((r,s)=>({idx:s,prefixLen:Cb(r.uri.toString(),e.toString()),offsetDist:Math.abs(r.range.startLineNumber-t.lineNumber)*100+Math.abs(r.range.startColumn-t.column)})).sort((r,s)=>r.prefixLen>s.prefixLen?-1:r.prefixLens.offsetDist?1:0)[0];if(i)return this.references[i.idx]}referenceAt(e,t){for(const i of this.references)if(i.uri.toString()===e.toString()&&$.containsPosition(i.range,t))return i}firstReference(){for(const e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return Nr.compare(e.uri,t.uri)||$.compareRangesUsingStarts(e.range,t.range)}}var fH=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gH=function(n,e){return function(t,i){e(t,i,n)}},Aee;let Nee=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof lu||e instanceof uR}getChildren(e){if(e instanceof lu)return e.groups;if(e instanceof uR)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};Nee=fH([gH(0,Nc)],Nee);class NFt{getHeight(){return 23}getTemplateId(e){return e instanceof uR?F9.id:pH.id}}let Ree=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){if(e instanceof Mb){const t=e.parent.getPreview(e)?.preview(e.range);if(t)return t.value}return th(e.uri)}};Ree=fH([gH(0,xi)],Ree);class RFt{getId(e){return e instanceof Mb?e.id:e.uri}}let Pee=class extends me{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new Q8(i,{supportHighlights:!0})),this.badge=new YQ(Ne(i,qe(".count")),{},w5e),e.appendChild(i)}set(e,t){const i=mW(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(i,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});const r=e.children.length;this.badge.setCount(r),r>1?this.badge.setTitleFormat(w("referencesCount","{0} references",r)):this.badge.setTitleFormat(w("referenceCount","{0} reference",r))}};Pee=fH([gH(1,pE)],Pee);let F9=class{static{Aee=this}static{this.id="FileReferencesRenderer"}constructor(e){this._instantiationService=e,this.templateId=Aee.id}renderTemplate(e){return this._instantiationService.createInstance(Pee,e)}renderElement(e,t,i){i.set(e.element,nO(e.filterData))}disposeTemplate(e){e.dispose()}};F9=Aee=fH([gH(0,Tt)],F9);class PFt extends me{constructor(e){super(),this.label=this._register(new cb(e))}set(e,t){const i=e.parent.getPreview(e)?.preview(e.range);if(!i||!i.value)this.label.set(`${th(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:r,highlight:s}=i;t&&!vg.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(r,nO(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(r,[s]))}}}class pH{constructor(){this.templateId=pH.id}static{this.id="OneReferenceRenderer"}renderTemplate(e){return new PFt(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}}class OFt{getWidgetAriaLabel(){return w("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var MFt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},yx=function(n,e){return function(t,i){e(t,i,n)}};class Mue{static{this.DecorationOptions=un.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"})}constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new ke,this._callOnModelChange=new ke,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const e=this._editor.getModel();if(e){for(const t of this._model.references)if(t.uri.toString()===e.uri.toString()){this._addDecorations(t.parent);return}}}_addDecorations(e){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));const t=[],i=[];for(let r=0,s=e.children.length;r{const s=r.deltaDecorations([],t);for(let o=0;o{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(BFt,"ReferencesWidget",this._treeContainer,new NFt,[this._instantiationService.createInstance(F9),this._instantiationService.createInstance(pH)],this._instantiationService.createInstance(Nee),i),this._splitView.addView({onDidChange:Ge.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},j8.Distribute),this._splitView.addView({onDidChange:Ge.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:s=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${s}px`,this._tree.layout(this._dim.height,s)}},j8.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));const r=(s,o)=>{s instanceof Mb&&(o==="show"&&this._revealReference(s,!1),this._onDidSelectReference.fire({element:s,kind:o,source:"tree"}))};this._disposables.add(this._tree.onDidOpen(s=>{s.sideBySide?r(s.element,"side"):s.editorOptions.pinned?r(s.element,"goto"):r(s.element,"show")})),Al(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new vi(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=w("noResults","No results"),Qc(this._messageContainer),Promise.resolve(void 0)):(Al(this._messageContainer),this._decorationsManager=new Mue(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{const{event:t,target:i}=e;if(t.detail!==2)return;const r=this._getFocusedReference();r&&this._onDidSelectReference.fire({element:{uri:r.uri,range:i.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),Qc(this._treeContainer),Qc(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[e]=this._tree.getFocus();if(e instanceof Mb)return e;if(e instanceof uR&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==sn.inMemory?this.setTitle(WCt(e.uri),this._uriLabel.getUriLabel(mW(e.uri))):this.setTitle(w("peekView.alternateTitle","References"));const i=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));const r=await i;if(!this._model){r.dispose();return}er(this._previewModelReference);const s=r.object;if(s){const o=this._preview.getModel()===s.textEditorModel?0:1,a=$.lift(e.range).collapseToStart();this._previewModelReference=r,this._preview.setModel(s.textEditorModel),this._preview.setSelection(a),this._preview.revealRangeInCenter(a,o)}else this._preview.setModel(this._previewNotAvailableMessage),r.dispose()}};Oee=MFt([yx(3,go),yx(4,Nc),yx(5,Tt),yx(6,k7e),yx(7,pE),yx(8,xi)],Oee);var $Ft=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},wx=function(n,e){return function(t,i){e(t,i,n)}},_5;const IC=new et("referenceSearchVisible",!1,w("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let Gw=class{static{_5=this}static{this.ID="editor.contrib.referencesController"}static get(e){return e.getContribution(_5.ID)}constructor(e,t,i,r,s,o,a,l){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=r,this._notificationService=s,this._instantiationService=o,this._storageService=a,this._configurationService=l,this._disposables=new ke,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=IC.bindTo(i)}dispose(){this._referenceSearchVisible.reset(),this._disposables.dispose(),this._widget?.dispose(),this._model?.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(e,t,i){let r;if(this._widget&&(r=this._widget.position),this.closeWidget(),r&&e.containsPosition(r))return;this._peekMode=i,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));const s="peekViewLayout",o=FFt.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(Oee,this._editor,this._defaultTreeKeyboardSupport,o),this._widget.setTitle(w("labelLoading","Loading...")),this._widget.show(e),this._disposables.add(this._widget.onDidClose(()=>{t.cancel(),this._widget?(this._storageService.store(s,JSON.stringify(this._widget.layoutData),0,1),this._widget.isClosing||this.closeWidget(),this._widget=void 0):this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(l=>{const{element:c,kind:u}=l;if(c)switch(u){case"open":(l.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(c,!1,!1);break;case"side":this.openReference(c,!0,!1);break;case"goto":i?this._gotoReference(c,!0):this.openReference(c,!1,!0);break}}));const a=++this._requestIdPool;t.then(l=>{if(a!==this._requestIdPool||!this._widget){l.dispose();return}return this._model?.dispose(),this._model=l,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(w("metaTitle.N","{0} ({1})",this._model.title,this._model.references.length));const c=this._editor.getModel().uri,u=new he(e.startLineNumber,e.startColumn),d=this._model.nearestReference(c,u);if(d)return this._widget.setSelection(d).then(()=>{this._widget&&this._editor.getOption(87)==="editor"&&this._widget.focusOnPreviewEditor()})}})},l=>{this._notificationService.error(l)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;const t=this._widget.position;if(!t)return;const i=this._model.nearestReference(this._editor.getModel().uri,t);if(!i)return;const r=this._model.nextOrPreviousReference(i,e),s=this._editor.hasTextFocus(),o=this._widget.isPreviewEditorFocused();await this._widget.setSelection(r),await this._gotoReference(r,!1),s?this._editor.focus():this._widget&&o&&this._widget.focusOnPreviewEditor()}async revealReference(e){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(e)}closeWidget(e=!0){this._widget?.dispose(),this._model?.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(e,t){this._widget?.hide(),this._ignoreModelChangeEvent=!0;const i=$.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:i,selectionSource:"code.jump",pinned:t}},this._editor).then(r=>{if(this._ignoreModelChangeEvent=!1,!r||!this._widget){this.closeWidget();return}if(this._editor===r)this._widget.show(i),this._widget.focusOnReferenceTree();else{const s=_5.get(r),o=this._model.clone();this.closeWidget(),r.focus(),s?.toggleWidget(i,ko(a=>Promise.resolve(o)),this._peekMode??!1)}},r=>{this._ignoreModelChangeEvent=!1,rn(r)})}openReference(e,t,i){t||this.closeWidget();const{uri:r,range:s}=e;this._editorService.openCodeEditor({resource:r,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor,t)}};Gw=_5=$Ft([wx(2,jt),wx(3,ai),wx(4,Ts),wx(5,Tt),wx(6,pf),wx(7,kn)],Gw);function AC(n,e){const t=EFt(n);if(!t)return;const i=Gw.get(t);i&&e(i)}jl.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:js(2089,60),when:Le.or(IC,Dc.inPeekEditor),handler(n){AC(n,e=>{e.changeFocusBetweenPreviewAndReferences()})}});jl.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Le.or(IC,Dc.inPeekEditor),handler(n){AC(n,e=>{e.goToNextOrPreviousReference(!0)})}});jl.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Le.or(IC,Dc.inPeekEditor),handler(n){AC(n,e=>{e.goToNextOrPreviousReference(!1)})}});Un.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");Un.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");Un.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");Un.registerCommand("closeReferenceSearch",n=>AC(n,e=>e.closeWidget()));jl.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Le.and(Dc.inPeekEditor,Le.not("config.editor.stablePeek"))});jl.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Le.and(IC,Le.not("config.editor.stablePeek"),Le.or(Q.editorTextFocus,k6e.negate()))});jl.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Le.and(IC,T6e,mce.negate(),_ce.negate()),handler(n){const t=n.get(fh).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Mb&&AC(n,i=>i.revealReference(t[0]))}});jl.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Le.and(IC,T6e,mce.negate(),_ce.negate()),handler(n){const t=n.get(fh).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Mb&&AC(n,i=>i.openReference(t[0],!0,!0))}});Un.registerCommand("openReference",n=>{const t=n.get(fh).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Mb&&AC(n,i=>i.openReference(t[0],!1,!0))});var D7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},FD=function(n,e){return function(t,i){e(t,i,n)}};const Fue=new et("hasSymbols",!1,w("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),mH=On("ISymbolNavigationService");let Mee=class{constructor(e,t,i,r){this._editorService=t,this._notificationService=i,this._keybindingService=r,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=Fue.bindTo(e)}reset(){this._ctxHasSymbols.reset(),this._currentState?.dispose(),this._currentMessage?.dispose(),this._currentModel=void 0,this._currentIdx=-1}put(e){const t=e.parent.parent;if(t.references.length<=1){this.reset();return}this._currentModel=t,this._currentIdx=t.references.indexOf(e),this._ctxHasSymbols.set(!0),this._showMessage();const i=new Fee(this._editorService),r=i.onDidChange(s=>{if(this._ignoreEditorChange)return;const o=this._editorService.getActiveCodeEditor();if(!o)return;const a=o.getModel(),l=o.getPosition();if(!a||!l)return;let c=!1,u=!1;for(const d of t.references)if(kN(d.uri,a.uri))c=!0,u=u||$.containsPosition(d.range,l);else if(c)break;(!c||!u)&&this.reset()});this._currentState=Qh(i,r)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:$.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){this._currentMessage?.dispose();const e=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),t=e?w("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,e.getLabel()):w("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};Mee=D7e([FD(0,jt),FD(1,ai),FD(2,Ts),FD(3,xi)],Mee);Vn(mH,Mee,1);Je(new class extends fo{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:Fue,kbOpts:{weight:100,primary:70}})}runEditorCommand(n,e){return n.get(mH).revealNext(e)}});jl.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:Fue,primary:9,handler(n){n.get(mH).reset()}});let Fee=class{constructor(e){this._listener=new Map,this._disposables=new ke,this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._disposables.add(e.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(e.onCodeEditorAdd(this._onDidAddEditor,this)),e.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),er(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,Qh(e.onDidChangeCursorPosition(t=>this._onDidChange.fire({editor:e})),e.onDidChangeModelContent(t=>this._onDidChange.fire({editor:e}))))}_onDidRemoveEditor(e){this._listener.get(e)?.dispose(),this._listener.delete(e)}};Fee=D7e([FD(0,ai)],Fee);function Bee(n,e){return e.uri.scheme===n.uri.scheme?!0:!mX(e.uri,sn.walkThroughSnippet,sn.vscodeChatCodeBlock,sn.vscodeChatCodeCompareBlock)}async function kO(n,e,t,i,r){const o=t.ordered(n,i).map(l=>Promise.resolve(r(l,n,e)).then(void 0,c=>{vs(c)})),a=await Promise.all(o);return rf(a.flat()).filter(l=>Bee(n,l))}function EO(n,e,t,i,r){return kO(e,t,n,i,(s,o,a)=>s.provideDefinition(o,a,r))}function Bue(n,e,t,i,r){return kO(e,t,n,i,(s,o,a)=>s.provideDeclaration(o,a,r))}function $ue(n,e,t,i,r){return kO(e,t,n,i,(s,o,a)=>s.provideImplementation(o,a,r))}function Wue(n,e,t,i,r){return kO(e,t,n,i,(s,o,a)=>s.provideTypeDefinition(o,a,r))}function LO(n,e,t,i,r,s){return kO(e,t,n,r,async(o,a,l)=>{const c=(await o.provideReferences(a,l,{includeDeclaration:!0},s))?.filter(d=>Bee(a,d));if(!i||!c||c.length!==2)return c;const u=(await o.provideReferences(a,l,{includeDeclaration:!1},s))?.filter(d=>Bee(a,d));return u&&u.length===1?u:c})}async function fm(n){const e=await n(),t=new lu(e,""),i=t.references.map(r=>r.link);return t.dispose(),i}Rc("_executeDefinitionProvider",(n,e,t)=>{const i=n.get(dt),r=EO(i.definitionProvider,e,t,!1,yn.None);return fm(()=>r)});Rc("_executeDefinitionProvider_recursive",(n,e,t)=>{const i=n.get(dt),r=EO(i.definitionProvider,e,t,!0,yn.None);return fm(()=>r)});Rc("_executeTypeDefinitionProvider",(n,e,t)=>{const i=n.get(dt),r=Wue(i.typeDefinitionProvider,e,t,!1,yn.None);return fm(()=>r)});Rc("_executeTypeDefinitionProvider_recursive",(n,e,t)=>{const i=n.get(dt),r=Wue(i.typeDefinitionProvider,e,t,!0,yn.None);return fm(()=>r)});Rc("_executeDeclarationProvider",(n,e,t)=>{const i=n.get(dt),r=Bue(i.declarationProvider,e,t,!1,yn.None);return fm(()=>r)});Rc("_executeDeclarationProvider_recursive",(n,e,t)=>{const i=n.get(dt),r=Bue(i.declarationProvider,e,t,!0,yn.None);return fm(()=>r)});Rc("_executeReferenceProvider",(n,e,t)=>{const i=n.get(dt),r=LO(i.referenceProvider,e,t,!1,!1,yn.None);return fm(()=>r)});Rc("_executeReferenceProvider_recursive",(n,e,t)=>{const i=n.get(dt),r=LO(i.referenceProvider,e,t,!1,!0,yn.None);return fm(()=>r)});Rc("_executeImplementationProvider",(n,e,t)=>{const i=n.get(dt),r=$ue(i.implementationProvider,e,t,!1,yn.None);return fm(()=>r)});Rc("_executeImplementationProvider_recursive",(n,e,t)=>{const i=n.get(dt),r=$ue(i.implementationProvider,e,t,!0,yn.None);return fm(()=>r)});Fo.appendMenuItem(ce.EditorContext,{submenu:ce.EditorContextPeek,title:w("peek.submenu","Peek"),group:"navigation",order:100});class NE{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof NE||he.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}class lc extends Fg{static{this._allSymbolNavigationCommands=new Map}static{this._activeAlternativeCommands=new Set}static all(){return lc._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of zn.wrap(t.menu))(i.id===ce.EditorContext||i.id===ce.EditorContextPeek)&&(i.when=Le.and(e.precondition,i.when));return t}constructor(e,t){super(lc._patchConfig(t)),this.configuration=e,lc._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,r){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(Ts),o=e.get(ai),a=e.get(Qb),l=e.get(mH),c=e.get(dt),u=e.get(Tt),d=t.getModel(),h=t.getPosition(),f=NE.is(i)?i:new NE(d,h),g=new Pb(t,5),p=YP(this._getLocationModel(c,f.model,f.position,g.token),g.token).then(async m=>{if(!m||g.token.isCancellationRequested)return;ql(m.ariaMessage);let _;if(m.referenceAt(d.uri,h)){const y=this._getAlternativeCommand(t);!lc._activeAlternativeCommands.has(y)&&lc._allSymbolNavigationCommands.has(y)&&(_=lc._allSymbolNavigationCommands.get(y))}const v=m.references.length;if(v===0){if(!this.configuration.muteMessage){const y=d.getWordAtPosition(h);au.get(t)?.showMessage(this._getNoResultFoundMessage(y),h)}}else if(v===1&&_)lc._activeAlternativeCommands.add(this.desc.id),u.invokeFunction(y=>_.runEditorCommand(y,t,i,r).finally(()=>{lc._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(o,l,t,m,r)},m=>{s.error(m)}).finally(()=>{g.dispose()});return a.showWhile(p,250),p}async _onResult(e,t,i,r,s){const o=this._getGoToPreference(i);if(!(i instanceof cf)&&(this.configuration.openInPeek||o==="peek"&&r.references.length>1))this._openInPeek(i,r,s);else{const a=r.firstReference(),l=r.references.length>1&&o==="gotoAndPeek",c=await this._openReference(i,e,a,this.configuration.openToSide,!l);l&&c?this._openInPeek(c,r,s):r.dispose(),o==="goto"&&t.put(a)}}async _openReference(e,t,i,r,s){let o;if(Qmt(i)&&(o=i.targetSelectionRange),o||(o=i.range),!o)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:$.collapseToStart(o),selectionRevealType:3,selectionSource:"code.jump"}},e,r);if(a){if(s){const l=a.getModel(),c=a.createDecorationsCollection([{range:o,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===l&&c.clear()},350)}return a}}_openInPeek(e,t,i){const r=Gw.get(e);r&&e.hasModel()?r.toggleWidget(i??e.getSelection(),ko(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}}class TO extends lc{async _getLocationModel(e,t,i,r){return new lu(await EO(e.definitionProvider,t,i,!1,r),w("def.title","Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?w("noResultWord","No definition found for '{0}'",e.word):w("generic.noResults","No definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleDefinitions}}lr(class $ee extends TO{static{this.id="editor.action.revealDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:$ee.id,title:{...Gt("actions.goToDecl.label","Go to Definition"),mnemonicTitle:w({key:"miGotoDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Definition")},precondition:Q.hasDefinitionProvider,keybinding:[{when:Q.editorTextFocus,primary:70,weight:100},{when:Le.and(Q.editorTextFocus,x6e),primary:2118,weight:100}],menu:[{id:ce.EditorContext,group:"navigation",order:1.1},{id:ce.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),Un.registerCommandAlias("editor.action.goToDeclaration",$ee.id)}});lr(class Wee extends TO{static{this.id="editor.action.revealDefinitionAside"}constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Wee.id,title:Gt("actions.goToDeclToSide.label","Open Definition to the Side"),precondition:Le.and(Q.hasDefinitionProvider,Q.isInEmbeddedEditor.toNegated()),keybinding:[{when:Q.editorTextFocus,primary:js(2089,70),weight:100},{when:Le.and(Q.editorTextFocus,x6e),primary:js(2089,2118),weight:100}]}),Un.registerCommandAlias("editor.action.openDeclarationToTheSide",Wee.id)}});lr(class Hee extends TO{static{this.id="editor.action.peekDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Hee.id,title:Gt("actions.previewDecl.label","Peek Definition"),precondition:Le.and(Q.hasDefinitionProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),keybinding:{when:Q.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:ce.EditorContextPeek,group:"peek",order:2}}),Un.registerCommandAlias("editor.action.previewDeclaration",Hee.id)}});class I7e extends lc{async _getLocationModel(e,t,i,r){return new lu(await Bue(e.declarationProvider,t,i,!1,r),w("decl.title","Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?w("decl.noResultWord","No declaration found for '{0}'",e.word):w("decl.generic.noResults","No declaration found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(58).multipleDeclarations}}lr(class A7e extends I7e{static{this.id="editor.action.revealDeclaration"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:A7e.id,title:{...Gt("actions.goToDeclaration.label","Go to Declaration"),mnemonicTitle:w({key:"miGotoDeclaration",comment:["&& denotes a mnemonic"]},"Go to &&Declaration")},precondition:Le.and(Q.hasDeclarationProvider,Q.isInEmbeddedEditor.toNegated()),menu:[{id:ce.EditorContext,group:"navigation",order:1.3},{id:ce.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?w("decl.noResultWord","No declaration found for '{0}'",e.word):w("decl.generic.noResults","No declaration found")}});lr(class extends I7e{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:Gt("actions.peekDecl.label","Peek Declaration"),precondition:Le.and(Q.hasDeclarationProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),menu:{id:ce.EditorContextPeek,group:"peek",order:3}})}});class N7e extends lc{async _getLocationModel(e,t,i,r){return new lu(await Wue(e.typeDefinitionProvider,t,i,!1,r),w("typedef.title","Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?w("goToTypeDefinition.noResultWord","No type definition found for '{0}'",e.word):w("goToTypeDefinition.generic.noResults","No type definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleTypeDefinitions}}lr(class R7e extends N7e{static{this.ID="editor.action.goToTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:R7e.ID,title:{...Gt("actions.goToTypeDefinition.label","Go to Type Definition"),mnemonicTitle:w({key:"miGotoTypeDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Type Definition")},precondition:Q.hasTypeDefinitionProvider,keybinding:{when:Q.editorTextFocus,primary:0,weight:100},menu:[{id:ce.EditorContext,group:"navigation",order:1.4},{id:ce.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}});lr(class P7e extends N7e{static{this.ID="editor.action.peekTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:P7e.ID,title:Gt("actions.peekTypeDefinition.label","Peek Type Definition"),precondition:Le.and(Q.hasTypeDefinitionProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),menu:{id:ce.EditorContextPeek,group:"peek",order:4}})}});class O7e extends lc{async _getLocationModel(e,t,i,r){return new lu(await $ue(e.implementationProvider,t,i,!1,r),w("impl.title","Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?w("goToImplementation.noResultWord","No implementation found for '{0}'",e.word):w("goToImplementation.generic.noResults","No implementation found")}_getAlternativeCommand(e){return e.getOption(58).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(58).multipleImplementations}}lr(class M7e extends O7e{static{this.ID="editor.action.goToImplementation"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:M7e.ID,title:{...Gt("actions.goToImplementation.label","Go to Implementations"),mnemonicTitle:w({key:"miGotoImplementation",comment:["&& denotes a mnemonic"]},"Go to &&Implementations")},precondition:Q.hasImplementationProvider,keybinding:{when:Q.editorTextFocus,primary:2118,weight:100},menu:[{id:ce.EditorContext,group:"navigation",order:1.45},{id:ce.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}});lr(class F7e extends O7e{static{this.ID="editor.action.peekImplementation"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:F7e.ID,title:Gt("actions.peekImplementation.label","Peek Implementations"),precondition:Le.and(Q.hasImplementationProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),keybinding:{when:Q.editorTextFocus,primary:3142,weight:100},menu:{id:ce.EditorContextPeek,group:"peek",order:5}})}});class B7e extends lc{_getNoResultFoundMessage(e){return e?w("references.no","No references found for '{0}'",e.word):w("references.noGeneric","No references found")}_getAlternativeCommand(e){return e.getOption(58).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(58).multipleReferences}}lr(class extends B7e{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...Gt("goToReferences.label","Go to References"),mnemonicTitle:w({key:"miGotoReference",comment:["&& denotes a mnemonic"]},"Go to &&References")},precondition:Le.and(Q.hasReferenceProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),keybinding:{when:Q.editorTextFocus,primary:1094,weight:100},menu:[{id:ce.EditorContext,group:"navigation",order:1.45},{id:ce.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,r){return new lu(await LO(e.referenceProvider,t,i,!0,!1,r),w("ref.title","References"))}});lr(class extends B7e{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:Gt("references.action.label","Peek References"),precondition:Le.and(Q.hasReferenceProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),menu:{id:ce.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,r){return new lu(await LO(e.referenceProvider,t,i,!1,!1,r),w("ref.title","References"))}});class WFt extends lc{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:Gt("label.generic","Go to Any Symbol"),precondition:Le.and(Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,r){return new lu(this._references,w("generic.title","Locations"))}_getNoResultFoundMessage(e){return e&&w("generic.noResult","No results for '{0}'",e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}Un.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Pt},{name:"position",description:"The position at which to start",constraint:he.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(n,e,t,i,r,s,o)=>{oi(Pt.isUri(e)),oi(he.isIPosition(t)),oi(Array.isArray(i)),oi(typeof r>"u"||typeof r=="string"),oi(typeof o>"u"||typeof o=="boolean");const a=n.get(ai),l=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(im(l))return l.setPosition(t),l.revealPositionInCenterIfOutsideViewport(t,0),l.invokeWithinContext(c=>{const u=new class extends WFt{_getNoResultFoundMessage(d){return s||super._getNoResultFoundMessage(d)}}({muteMessage:!s,openInPeek:!!o,openToSide:!1},i,r);c.get(Tt).invokeFunction(u.run.bind(u),l)})}});Un.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Pt},{name:"position",description:"The position at which to start",constraint:he.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"}]},handler:async(n,e,t,i,r)=>{n.get(_r).executeCommand("editor.action.goToLocations",e,t,i,r,void 0,!0)}});Un.registerCommand({id:"editor.action.findReferences",handler:(n,e,t)=>{oi(Pt.isUri(e)),oi(he.isIPosition(t));const i=n.get(dt),r=n.get(ai);return r.openCodeEditor({resource:e},r.getFocusedCodeEditor()).then(s=>{if(!im(s)||!s.hasModel())return;const o=Gw.get(s);if(!o)return;const a=ko(c=>LO(i.referenceProvider,s.getModel(),he.lift(t),!1,!1,c).then(u=>new lu(u,w("ref.title","References")))),l=new $(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(o.toggleWidget(l,a,!1))})}});Un.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function HFt(n,e,t,i){const r=n.get(Nc),s=n.get(mu),o=n.get(_r),a=n.get(Tt),l=n.get(Ts);if(await i.item.resolve(yn.None),!i.part.location)return;const c=i.part.location,u=[],d=new Set(Fo.getMenuItems(ce.EditorContext).map(f=>lk(f)?f.command.id:aH()));for(const f of lc.all())d.has(f.desc.id)&&u.push(new su(f.desc.id,ou.label(f.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const g=await r.createModelReference(c.uri);try{const p=new NE(g.object.textEditorModel,$.getStartPosition(c.range)),m=i.item.anchor.range;await a.invokeFunction(f.runEditorCommand.bind(f),e,p,m)}finally{g.dispose()}}));if(i.part.command){const{command:f}=i.part;u.push(new na),u.push(new su(f.id,f.title,void 0,!0,async()=>{try{await o.executeCommand(f.id,...f.arguments??[])}catch(g){l.notify({severity:iW.Error,source:i.item.provider.displayName,message:g})}}))}const h=e.getOption(128);s.showContextMenu({domForShadowRoot:h?e.getDomNode()??void 0:void 0,getAnchor:()=>{const f=ms(t);return{x:f.left,y:f.top+f.height+8}},getActions:()=>u,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function $7e(n,e,t,i){const s=await n.get(Nc).createModelReference(i.uri);await t.invokeWithinContext(async o=>{const a=e.hasSideBySideModifier,l=o.get(jt),c=Dc.inPeekEditor.getValue(l),u=!a&&t.getOption(89)&&!c;return new TO({openToSide:a,openInPeek:u,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(o,new NE(s.object.textEditorModel,$.getStartPosition(i.range)),$.lift(i.range))}),s.dispose()}var VFt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Cx=function(n,e){return function(t,i){e(t,i,n)}},Qx;class B9{constructor(){this._entries=new lm(50)}get(e){const t=B9._key(e);return this._entries.get(t)}set(e,t){const i=B9._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const W7e=On("IInlayHintsCache");Vn(W7e,B9,1);class Vee{constructor(e,t){this.item=e,this.index=t}get part(){const e=this.item.hint.label;return typeof e=="string"?{label:e}:e[this.index]}}class zFt{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}let dR=class{static{Qx=this}static{this.ID="editor.contrib.InlayHints"}static{this._MAX_DECORATORS=1500}static{this._MAX_LABEL_LEN=43}static get(e){return e.getContribution(Qx.ID)??void 0}constructor(e,t,i,r,s,o,a){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=r,this._commandService=s,this._notificationService=o,this._instaService=a,this._disposables=new ke,this._sessionDisposables=new ke,this._decorationsMetadata=new Map,this._ruleFactory=new VW(this._editor),this._activeRenderMode=0,this._debounceInfo=i.for(t.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(t.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(l=>{l.hasChanged(142)&&this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const e=this._editor.getOption(142);if(e.enabled==="off")return;const t=this._editor.getModel();if(!t||!this._languageFeaturesService.inlayHintsProvider.has(t))return;if(e.enabled==="on")this._activeRenderMode=0;else{let a,l;e.enabled==="onUnlessPressed"?(a=0,l=1):(a=1,l=0),this._activeRenderMode=a,this._sessionDisposables.add(f_.getInstance().event(c=>{if(!this._editor.hasModel())return;const u=c.altKey&&c.ctrlKey&&!(c.shiftKey||c.metaKey)?l:a;if(u!==this._activeRenderMode){this._activeRenderMode=u;const d=this._editor.getModel(),h=this._copyInlayHintsWithCurrentAnchor(d);this._updateHintsDecorators([d.getFullModelRange()],h),o.schedule(0)}}))}const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(Lt(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let r;const s=new Set,o=new Ui(async()=>{const a=Date.now();r?.dispose(!0),r=new Kr;const l=t.onWillDispose(()=>r?.cancel());try{const c=r.token,u=await Lk.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),c);if(o.delay=this._debounceInfo.update(t,Date.now()-a),c.isCancellationRequested){u.dispose();return}for(const d of u.provider)typeof d.onDidChangeInlayHints=="function"&&!s.has(d)&&(s.add(d),this._sessionDisposables.add(d.onDidChangeInlayHints(()=>{o.isScheduled()||o.schedule()})));this._sessionDisposables.add(u),this._updateHintsDecorators(u.ranges,u.items),this._cacheHintsForFastRestore(t)}catch(c){rn(c)}finally{r.dispose(),l.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(o),this._sessionDisposables.add(Lt(()=>r?.dispose(!0))),o.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(a=>{(a.scrollTopChanged||!o.isScheduled())&&o.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeModelContent(a=>{r?.cancel();const l=Math.max(o.delay,1250);o.schedule(l)})),this._sessionDisposables.add(this._installDblClickGesture(()=>o.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new ke,t=e.add(new hH(this._editor)),i=new ke;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown(r=>{const[s]=r,o=this._getInlayHintLabelPart(s),a=this._editor.getModel();if(!o||!a){i.clear();return}const l=new Kr;i.add(Lt(()=>l.dispose(!0))),o.item.resolve(l.token),this._activeInlayHintPart=o.part.command||o.part.location?new zFt(o,s.hasTriggerModifier):void 0;const c=a.validatePosition(o.item.hint.position).lineNumber,u=new $(c,1,c,a.getLineMaxColumn(c)),d=this._getInlineHintsForRange(u);this._updateHintsDecorators([u],d),i.add(Lt(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([u],d)}))})),e.add(t.onCancel(()=>i.clear())),e.add(t.onExecute(async r=>{const s=this._getInlayHintLabelPart(r);if(s){const o=s.part;o.location?this._instaService.invokeFunction($7e,r,this._editor,o.location):mZ.is(o.command)&&await this._invokeCommand(o.command,s.item)}})),e}_getInlineHintsForRange(e){const t=new Set;for(const i of this._decorationsMetadata.values())e.containsRange(i.item.anchor.range)&&t.add(i.item);return Array.from(t)}_installDblClickGesture(e){return this._editor.onMouseUp(async t=>{if(t.event.detail!==2)return;const i=this._getInlayHintLabelPart(t);if(i&&(t.event.preventDefault(),await i.item.resolve(yn.None),bl(i.item.hint.textEdits))){const r=i.item.hint.textEdits.map(s=>jr.replace($.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",r),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!Eo(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(HFt,this._editor,e.event.target,t)})}_getInlayHintLabelPart(e){if(e.target.type!==6)return;const t=e.target.detail.injectedText?.options;if(t instanceof Ab&&t?.attachedData instanceof Vee)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:iW.Error,source:t.provider.displayName,message:i})}}_cacheHintsForFastRestore(e){const t=this._copyInlayHintsWithCurrentAnchor(e);this._inlayHintsCache.set(e,t)}_copyInlayHintsWithCurrentAnchor(e){const t=new Map;for(const[i,r]of this._decorationsMetadata){if(t.has(r.item))continue;const s=e.getDecorationRange(i);if(s){const o=new w7e(s,r.item.anchor.direction),a=r.item.with({anchor:o});t.set(r.item,a)}}return Array.from(t.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),r=[];for(const s of i.sort($.compareRangesUsingStarts)){const o=t.validateRange(new $(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));r.length===0||!$.areIntersectingOrTouching(r[r.length-1],o)?r.push(o):r[r.length-1]=$.plusRange(r[r.length-1],o)}return r}_updateHintsDecorators(e,t){const i=[],r=(g,p,m,_,v)=>{const y={content:m,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:p.className,cursorStops:_,attachedData:v};i.push({item:g,classNameRef:p,decoration:{range:g.anchor.range,options:{description:"InlayHint",showIfCollapsed:g.anchor.range.isEmpty(),collapseOnReplaceEdit:!g.anchor.range.isEmpty(),stickiness:0,[g.anchor.direction]:this._activeRenderMode===0?y:void 0}}})},s=(g,p)=>{const m=this._ruleFactory.createClassNameRef({width:`${o/3|0}px`,display:"inline-block"});r(g,m," ",p?Kh.Right:Kh.None)},{fontSize:o,fontFamily:a,padding:l,isUniform:c}=this._getLayoutInfo(),u="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(u,a);let d={line:0,totalLen:0};for(const g of t){if(d.line!==g.anchor.range.startLineNumber&&(d={line:g.anchor.range.startLineNumber,totalLen:0}),d.totalLen>Qx._MAX_LABEL_LEN)continue;g.hint.paddingLeft&&s(g,!1);const p=typeof g.hint.label=="string"?[{label:g.hint.label}]:g.hint.label;for(let m=0;m0&&(x=x.slice(0,-L)+"…",k=!0),r(g,this._ruleFactory.createClassNameRef(C),UFt(x),y&&!g.hint.paddingRight?Kh.Right:Kh.None,new Vee(g,m)),k)break}if(g.hint.paddingRight&&s(g,!0),i.length>Qx._MAX_DECORATORS)break}const h=[];for(const[g,p]of this._decorationsMetadata){const m=this._editor.getModel()?.getDecorationRange(g);m&&e.some(_=>_.containsRange(m))&&(h.push(g),p.classNameRef.dispose(),this._decorationsMetadata.delete(g))}const f=Ag.capture(this._editor);this._editor.changeDecorations(g=>{const p=g.deltaDecorations(h,i.map(m=>m.decoration));for(let m=0;mi)&&(s=i);const o=e.fontFamily||r;return{fontSize:s,fontFamily:o,padding:t,isUniform:!t&&o===r&&s===i}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}};dR=Qx=VFt([Cx(1,dt),Cx(2,cd),Cx(3,W7e),Cx(4,_r),Cx(5,Ts),Cx(6,Tt)],dR);function UFt(n){return n.replace(/[ \t]/g," ")}Un.registerCommand("_executeInlayHintProvider",async(n,...e)=>{const[t,i]=e;oi(Pt.isUri(t)),oi($.isIRange(i));const{inlayHintsProvider:r}=n.get(dt),s=await n.get(Nc).createModelReference(t);try{const o=await Lk.create(r,s.object.textEditorModel,[$.lift(i)],yn.None),a=o.items.map(l=>l.hint);return setTimeout(()=>o.dispose(),0),a}finally{s.dispose()}});var jFt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},U0=function(n,e){return function(t,i){e(t,i,n)}};class OCe extends g5{constructor(e,t,i,r){super(10,t,e.item.anchor.range,i,r,!0),this.part=e}}let $9=class extends cR{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,o,l,r,s,c),this._resolverService=a,this.hoverOrdinal=6}suggestHoverAnchor(e){if(!dR.get(this._editor)||e.target.type!==6)return null;const i=e.target.detail.injectedText?.options;return i instanceof Ab&&i.attachedData instanceof Vee?new OCe(i.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof OCe?new to(async r=>{const{part:s}=e;if(await s.item.resolve(i),i.isCancellationRequested)return;let o;typeof s.item.hint.tooltip=="string"?o=new za().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(o=s.item.hint.tooltip),o&&r.emitOne(new Uh(this,e.range,[o],!1,0)),bl(s.item.hint.textEdits)&&r.emitOne(new Uh(this,e.range,[new za().appendText(w("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new za().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&r.emitOne(new Uh(this,e.range,[a],!1,1)),s.part.location||s.part.command){let c;const d=this._editor.getOption(78)==="altKey"?Rn?w("links.navigate.kb.meta.mac","cmd + click"):w("links.navigate.kb.meta","ctrl + click"):Rn?w("links.navigate.kb.alt.mac","option + click"):w("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?c=new za().appendText(w("hint.defAndCommand","Go to Definition ({0}), right click for more",d)):s.part.location?c=new za().appendText(w("hint.def","Go to Definition ({0})",d)):s.part.command&&(c=new za(`[${w("hint.cmd","Execute Command")}](${vFt(s.part.command)} "${s.part.command.title}") (${d})`,{isTrusted:!0})),c&&r.emitOne(new Uh(this,e.range,[c],!1,1e4))}const l=await this._resolveInlayHintLabelPartHover(s,i);for await(const c of l)r.emitOne(c)}):to.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return to.EMPTY;const{uri:i,range:r}=e.part.location,s=await this._resolverService.createModelReference(i);try{const o=s.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(o)?Pue(this._languageFeaturesService.hoverProvider,o,new he(r.startLineNumber,r.startColumn),t).filter(a=>!fE(a.hover.contents)).map(a=>new Uh(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):to.EMPTY}finally{s.dispose()}}};$9=jFt([U0(1,Hr),U0(2,Pc),U0(3,xi),U0(4,um),U0(5,kn),U0(6,Nc),U0(7,dt),U0(8,_r)],$9);class Hue extends me{constructor(e,t,i,r,s,o){super();const a=t.anchor,l=t.hoverParts;this._renderedHoverParts=this._register(new Vue(e,i,l,o,s));const{showAtPosition:c,showAtSecondaryPosition:u}=Hue.computeHoverPositions(e,a.range,l);this.shouldAppearBeforeContent=l.some(d=>d.isBeforeContent),this.showAtPosition=c,this.showAtSecondaryPosition=u,this.initialMousePosX=a.initialMousePosX,this.initialMousePosY=a.initialMousePosY,this.shouldFocus=r.shouldFocus,this.source=r.source}get domNode(){return this._renderedHoverParts.domNode}get domNodeHasChildren(){return this._renderedHoverParts.domNodeHasChildren}get focusedHoverPartIndex(){return this._renderedHoverParts.focusedHoverPartIndex}async updateHoverVerbosityLevel(e,t,i){this._renderedHoverParts.updateHoverVerbosityLevel(e,t,i)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(e,t,i){let r=1;if(e.hasModel()){const u=e._getViewModel(),d=u.coordinatesConverter,h=d.convertModelRangeToViewRange(t),f=u.getLineMinColumn(h.startLineNumber),g=new he(h.startLineNumber,f);r=d.convertViewPositionToModelPosition(g).column}const s=t.startLineNumber;let o=t.startColumn,a;for(const u of i){const d=u.range,h=d.startLineNumber===s,f=d.endLineNumber===s;if(h&&f){const p=d.startColumn,m=Math.min(o,p);o=Math.max(m,r)}u.forceShowAtRange&&(a=d)}let l,c;if(a){const u=a.getStartPosition();l=u,c=u}else l=t.getStartPosition(),c=new he(s,o);return{showAtPosition:l,showAtSecondaryPosition:c}}}class qFt{constructor(e,t){this._statusBar=t,e.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}}class Vue extends me{static{this._DECORATION_OPTIONS=un.register({description:"content-hover-highlight",className:"hoverHighlight"})}constructor(e,t,i,r,s){super(),this._renderedParts=[],this._focusedHoverPartIndex=-1,this._context=s,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(t,i,s,r)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(e,i)),this._updateMarkdownAndColorParticipantInfo(t)}_createEditorDecorations(e,t){if(t.length===0)return me.None;let i=t[0].range;for(const s of t){const o=s.range;i=$.plusRange(i,o)}const r=e.createDecorationsCollection();return r.set([{range:i,options:Vue._DECORATION_OPTIONS}]),Lt(()=>{r.clear()})}_renderParts(e,t,i,r){const s=new P9(r),o={fragment:this._fragment,statusBar:s,...i},a=new ke;for(const c of e){const u=this._renderHoverPartsForParticipant(t,c,o);a.add(u);for(const d of u.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:c,hoverPart:d.hoverPart,hoverElement:d.hoverElement})}const l=this._renderStatusBar(this._fragment,s);return l&&(a.add(l),this._renderedParts.push({type:"statusBar",hoverElement:l.hoverElement,actions:l.actions})),Lt(()=>{a.dispose()})}_renderHoverPartsForParticipant(e,t,i){const r=e.filter(o=>o.owner===t);return r.length>0?t.renderHoverParts(i,r):new Kw([])}_renderStatusBar(e,t){if(t.hasContent)return new qFt(e,t)}_registerListenersOnRenderedParts(){const e=new ke;return this._renderedParts.forEach((t,i)=>{const r=t.hoverElement;r.tabIndex=0,e.add(Ce(r,je.FOCUS_IN,s=>{s.stopPropagation(),this._focusedHoverPartIndex=i})),e.add(Ce(r,je.FOCUS_OUT,s=>{s.stopPropagation(),this._focusedHoverPartIndex=-1}))}),e}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof cR&&!(i instanceof $9));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof aR)}async updateHoverVerbosityLevel(e,t,i){if(!this._markdownHoverParticipant)return;const r=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,t);if(r===void 0)return;const s=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e,r,i);s&&(this._renderedParts[t]={type:"hoverPart",participant:this._markdownHoverParticipant,hoverPart:s.hoverPart,hoverElement:s.hoverElement},this._context.onContentsChanged())}isColorPickerVisible(){return this._colorHoverParticipant?.isColorPickerVisible()??!1}_normalizedIndexToMarkdownHoverIndexRange(e,t){const i=this._renderedParts[t];if(!i||i.type!=="hoverPart"||!(i.participant===e))return;const s=this._renderedParts.findIndex(o=>o.type==="hoverPart"&&o.participant===e);if(s===-1)throw new fi;return t-s}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}}var KFt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},MCe=function(n,e){return function(t,i){e(t,i,n)}};let zee=class extends me{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._onContentsChanged=this._register(new fe),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(Dee,this._editor)),this._participants=this._initializeHoverParticipants(),this._computer=new R9(this._editor,this._participants),this._hoverOperation=this._register(new m7e(this._editor,this._computer)),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of DC.getAll()){const i=this._instantiationService.createInstance(t,this._editor);e.push(i)}return e.sort((t,i)=>t.hoverOrdinal-i.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach(t=>t.handleResize?.())})),e}_registerListeners(){this._register(this._hoverOperation.onResult(t=>{if(!this._computer.anchor)return;const i=t.hasLoadingMessage?this._addLoadingMessage(t.value):t.value;this._withResult(new _7e(this._computer.anchor,i,t.isComplete))}));const e=this._contentHoverWidget.getDomNode();this._register(Jr(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Jr(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(rs.onDidChange(()=>{this._contentHoverWidget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)}))}_startShowingOrUpdateHover(e,t,i,r,s){if(!(this._contentHoverWidget.position&&this._currentResult))return e?(this._startHoverOperationIfNecessary(e,t,i,r,!1),!0):!1;const a=this._editor.getOption(60).sticky,l=s&&this._contentHoverWidget.isMouseGettingCloser(s.event.posx,s.event.posy);return a&&l?(e&&this._startHoverOperationIfNecessary(e,t,i,r,!0),!0):e?this._currentResult.anchor.equals(e)?!0:e.canAdoptVisibleHover(this._currentResult.anchor,this._contentHoverWidget.position)?(this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,i,r,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,i,r,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,i,r,s){this._computer.anchor&&this._computer.anchor.equals(e)||(this._hoverOperation.cancel(),this._computer.anchor=e,this._computer.shouldFocus=r,this._computer.source=i,this._computer.insistOnKeepingHoverVisible=s,this._hoverOperation.start(t))}_setCurrentResult(e){let t=e;if(this._currentResult===t)return;t&&t.hoverParts.length===0&&(t=null),this._currentResult=t,this._currentResult?this._showHover(this._currentResult):this._hideHover()}_addLoadingMessage(e){if(!this._computer.anchor)return e;for(const t of this._participants){if(!t.createLoadingMessage)continue;const i=t.createLoadingMessage(this._computer.anchor);if(i)return e.slice(0).concat([i])}return e}_withResult(e){if(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete||this._setCurrentResult(e),!e.isComplete)return;const r=e.hoverParts.length===0,s=this._computer.insistOnKeepingHoverVisible;r&&s||this._setCurrentResult(e)}_showHover(e){const t=this._getHoverContext();this._renderedContentHover=new Hue(this._editor,e,this._participants,this._computer,t,this._keybindingService),this._renderedContentHover.domNodeHasChildren?this._contentHoverWidget.show(this._renderedContentHover):this._renderedContentHover.dispose()}_hideHover(){this._contentHoverWidget.hide()}_getHoverContext(){return{hide:()=>{this.hide()},onContentsChanged:()=>{this._onContentsChanged.fire(),this._contentHoverWidget.onContentsChanged()},setMinimumDimensions:r=>{this._contentHoverWidget.setMinimumDimensions(r)}}}showsOrWillShow(e){if(this._contentHoverWidget.isResizing)return!0;const i=this._findHoverAnchorCandidates(e);if(!(i.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,e);const s=i[0];return this._startShowingOrUpdateHover(s,0,0,!1,e)}_findHoverAnchorCandidates(e){const t=[];for(const r of this._participants){if(!r.suggestHoverAnchor)continue;const s=r.suggestHoverAnchor(e);s&&t.push(s)}const i=e.target;switch(i.type){case 6:{t.push(new Vq(0,i.range,e.event.posx,e.event.posy));break}case 7:{const r=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;if(!(!i.detail.isAfterLines&&typeof i.detail.horizontalDistanceToText=="number"&&i.detail.horizontalDistanceToTexts.priority-r.priority),t}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!dH(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,r){this._startShowingOrUpdateHover(new Vq(0,e,void 0,void 0),t,i,r,null)}async updateHoverVerbosityLevel(e,t,i){this._renderedContentHover?.updateHoverVerbosityLevel(e,t,i)}focusedHoverPartIndex(){return this._renderedContentHover?.focusedHoverPartIndex??-1}containsNode(e){return e?this._contentHoverWidget.getDomNode().contains(e):!1}focus(){this._contentHoverWidget.focus()}scrollUp(){this._contentHoverWidget.scrollUp()}scrollDown(){this._contentHoverWidget.scrollDown()}scrollLeft(){this._contentHoverWidget.scrollLeft()}scrollRight(){this._contentHoverWidget.scrollRight()}pageUp(){this._contentHoverWidget.pageUp()}pageDown(){this._contentHoverWidget.pageDown()}goToTop(){this._contentHoverWidget.goToTop()}goToBottom(){this._contentHoverWidget.goToBottom()}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}getDomNode(){return this._contentHoverWidget.getDomNode()}get isColorPickerVisible(){return this._renderedContentHover?.isColorPickerVisible()??!1}get isVisibleFromKeyboard(){return this._contentHoverWidget.isVisibleFromKeyboard}get isVisible(){return this._contentHoverWidget.isVisible}get isFocused(){return this._contentHoverWidget.isFocused}get isResizing(){return this._contentHoverWidget.isResizing}get widget(){return this._contentHoverWidget}};zee=KFt([MCe(1,Tt),MCe(2,xi)],zee);var GFt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},FCe=function(n,e){return function(t,i){e(t,i,n)}},Uee;const YFt=!1;let wl=class extends me{static{Uee=this}static{this.ID="editor.contrib.contentHover"}constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._onHoverContentsChanged=this._register(new fe),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new ke,this._hoverState={mouseDown:!1,activatedByDecoratorClick:!1},this._reactToEditorMouseMoveRunner=this._register(new Ui(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}static get(e){return e.getContribution(Uee.ID)}_hookListeners(){const e=this._editor.getOption(60);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._shouldNotHideCurrentHoverWidget(e)&&this._hideWidgets()}_shouldNotHideCurrentHoverWidget(e){return this._isMouseOnContentHoverWidget(e)||this._isContentWidgetResizing()}_isMouseOnContentHoverWidget(e){const t=this._contentWidget?.getDomNode();return t?dH(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._shouldNotHideCurrentHoverWidget(e))||this._hideWidgets()}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=(o,a)=>{const l=this._isMouseOnContentHoverWidget(o);return a&&l},r=o=>{const a=this._isMouseOnContentHoverWidget(o),l=this._contentWidget?.isColorPickerVisible??!1;return a&&l},s=(o,a)=>(a&&this._contentWidget?.containsNode(o.event.browserEvent.view?.document.activeElement)&&!o.event.browserEvent.view?.getSelection()?.isCollapsed)??!1;return i(e,t)||r(e)||s(e,t)}_onEditorMouseMove(e){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._mouseMoveEvent=e,this._contentWidget?.isFocused||this._contentWidget?.isResizing))return;const t=this._hoverSettings.sticky;if(t&&this._contentWidget?.isVisibleFromKeyboard)return;if(this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}const r=this._hoverSettings.hidingDelay;if(this._contentWidget?.isVisible&&t&&r>0){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(r);return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){if(!e)return;const i=e.target.element?.classList.contains("colorpicker-color-decoration"),r=this._editor.getOption(149),s=this._hoverSettings.enabled,o=this._hoverState.activatedByDecoratorClick;if(i&&(r==="click"&&!o||r==="hover"&&!s&&!YFt||r==="clickAndHover"&&!s&&!o)||!i&&!s&&!o){this._hideWidgets();return}this._tryShowHoverWidget(e)||this._hideWidgets()}_tryShowHoverWidget(e){return this._getOrCreateContentWidget().showsOrWillShow(e)}_onKeyDown(e){if(!this._editor.hasModel())return;const t=this._keybindingService.softDispatch(e,this._editor.getDomNode()),i=t.kind===1||t.kind===2&&(t.commandId===h7e||t.commandId===cH||t.commandId===uH)&&this._contentWidget?.isVisible;e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4||i||this._hideWidgets()}_hideWidgets(){this._hoverState.mouseDown&&this._contentWidget?.isColorPickerVisible||AE.dropDownVisible||(this._hoverState.activatedByDecoratorClick=!1,this._contentWidget?.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(zee,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()))),this._contentWidget}showContentHover(e,t,i,r,s=!1){this._hoverState.activatedByDecoratorClick=s,this._getOrCreateContentWidget().startShowingAtRange(e,t,i,r)}_isContentWidgetResizing(){return this._contentWidget?.widget.isResizing||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}updateHoverVerbosityLevel(e,t,i){this._getOrCreateContentWidget().updateHoverVerbosityLevel(e,t,i)}focus(){this._contentWidget?.focus()}scrollUp(){this._contentWidget?.scrollUp()}scrollDown(){this._contentWidget?.scrollDown()}scrollLeft(){this._contentWidget?.scrollLeft()}scrollRight(){this._contentWidget?.scrollRight()}pageUp(){this._contentWidget?.pageUp()}pageDown(){this._contentWidget?.pageDown()}goToTop(){this._contentWidget?.goToTop()}goToBottom(){this._contentWidget?.goToBottom()}get isColorPickerVisible(){return this._contentWidget?.isColorPickerVisible}get isHoverVisible(){return this._contentWidget?.isVisible}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._contentWidget?.dispose()}};wl=Uee=GFt([FCe(1,Tt),FCe(2,xi)],wl);class BCe extends me{static{this.ID="editor.contrib.colorContribution"}constructor(e){super(),this._editor=e,this._register(e.onMouseDown(t=>this.onMouseDown(t)))}dispose(){super.dispose()}onMouseDown(e){const t=this._editor.getOption(149);if(t!=="click"&&t!=="clickAndHover")return;const i=e.target;if(i.type!==6||!i.detail.injectedText||i.detail.injectedText.options.attachedData!==s7e||!i.range)return;const r=this._editor.getContribution(wl.ID);if(r&&!r.isColorPickerVisible){const s=new $(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);r.showContentHover(s,1,0,!1,!0)}}}Zn(BCe.ID,BCe,2);DC.register(aR);var H7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},BS=function(n,e){return function(t,i){e(t,i,n)}},jee,qee;let Yw=class extends me{static{jee=this}static{this.ID="editor.contrib.standaloneColorPickerController"}constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=Q.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=Q.standaloneColorPickerFocused.bindTo(t)}showOrFocus(){this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||this._standaloneColorPickerWidget?.focus():this._standaloneColorPickerWidget=this._instantiationService.createInstance(Kee,this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused))}hide(){this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerWidget?.hide(),this._editor.focus()}insertColor(){this._standaloneColorPickerWidget?.updateEditor(),this.hide()}static get(e){return e.getContribution(jee.ID)}};Yw=jee=H7e([BS(1,jt),BS(2,Tt)],Yw);Zn(Yw.ID,Yw,1);const $Ce=8,ZFt=22;let Kee=class extends me{static{qee=this}static{this.ID="editor.contrib.standaloneColorPickerWidget"}constructor(e,t,i,r,s,o,a){super(),this._editor=e,this._standaloneColorPickerVisible=t,this._standaloneColorPickerFocused=i,this._keybindingService=s,this._languageFeaturesService=o,this._editorWorkerService=a,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new fe),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=r.createInstance(lR,this._editor),this._position=this._editor._getViewModel()?.getPrimaryCursorState().modelState.position;const l=this._editor.getSelection(),c=l?{startLineNumber:l.startLineNumber,startColumn:l.startColumn,endLineNumber:l.endLineNumber,endColumn:l.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},u=this._register(Eg(this._body));this._register(u.onDidBlur(d=>{this.hide()})),this._register(u.onDidFocus(d=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(d=>{const h=d.target.element?.classList;h&&h.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(d=>{this._render(d.value,d.foundInEditor)})),this._start(c),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return qee.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const e=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){const t=await this._computeAsync(e);t&&this._onResult.fire(new XFt(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;const t={range:e,color:{red:0,green:0,blue:0,alpha:1}},i=await this._standaloneColorPickerParticipant.createColorHover(t,new oR(this._editorWorkerService),this._languageFeaturesService.colorProvider);return i?{result:i.colorHover,foundInEditor:i.foundInEditor}:null}_render(e,t){const i=document.createDocumentFragment(),r=this._register(new P9(this._keybindingService)),s={fragment:i,statusBar:r,onContentsChanged:()=>{},hide:()=>this.hide()};this._colorHover=e;const o=this._standaloneColorPickerParticipant.renderHoverParts(s,[e]);if(!o)return;this._register(o.disposables);const a=o.colorPicker;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(i),a.layout();const l=a.body,c=l.saturationBox.domNode.clientWidth,u=l.domNode.clientWidth-c-ZFt-$Ce,d=a.body.enterButton;d?.onClicked(()=>{this.updateEditor(),this.hide()});const h=a.header,f=h.pickedColorNode;f.style.width=c+$Ce+"px";const g=h.originalColorNode;g.style.width=u+"px",a.header.closeButton?.onClicked(()=>{this.hide()}),t&&(d&&(d.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}};Kee=qee=H7e([BS(3,Tt),BS(4,xi),BS(5,dt),BS(6,Oc)],Kee);class XFt{constructor(e,t){this.value=e,this.foundInEditor=t}}class QFt extends Fg{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...Gt("showOrFocusStandaloneColorPicker","Show or Focus Standalone Color Picker"),mnemonicTitle:w({key:"mishowOrFocusStandaloneColorPicker",comment:["&& denotes a mnemonic"]},"&&Show or Focus Standalone Color Picker")},precondition:void 0,menu:[{id:ce.CommandPalette}],metadata:{description:Gt("showOrFocusStandaloneColorPickerDescription","Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(e,t){Yw.get(t)?.showOrFocus()}}class JFt extends ot{constructor(){super({id:"editor.action.hideColorPicker",label:w({key:"hideColorPicker",comment:["Action that hides the color picker"]},"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:Q.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:Gt("hideColorPickerDescription","Hide the standalone color picker.")}})}run(e,t){Yw.get(t)?.hide()}}class e5t extends ot{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:w({key:"insertColorWithStandaloneColorPicker",comment:["Action that inserts color with standalone color picker"]},"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:Q.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:Gt("insertColorWithStandaloneColorPickerDescription","Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){Yw.get(t)?.insertColor()}}Pe(JFt);Pe(e5t);lr(QFt);class $v{constructor(e,t,i){this.languageConfigurationService=i,this._selection=e,this._insertSpace=t,this._usedEndToken=null}static _haystackHasNeedleAtOffset(e,t,i){if(i<0)return!1;const r=t.length,s=e.length;if(i+r>s)return!1;for(let o=0;o=65&&a<=90&&a+32===l)&&!(l>=65&&l<=90&&l+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,r,s,o){const a=e.startLineNumber,l=e.startColumn,c=e.endLineNumber,u=e.endColumn,d=s.getLineContent(a),h=s.getLineContent(c);let f=d.lastIndexOf(t,l-1+t.length),g=h.indexOf(i,u-1-i.length);if(f!==-1&&g!==-1)if(a===c)d.substring(f+t.length,g).indexOf(i)>=0&&(f=-1,g=-1);else{const m=d.substring(f+t.length),_=h.substring(0,g);(m.indexOf(i)>=0||_.indexOf(i)>=0)&&(f=-1,g=-1)}let p;f!==-1&&g!==-1?(r&&f+t.length0&&h.charCodeAt(g-1)===32&&(i=" "+i,g-=1),p=$v._createRemoveBlockCommentOperations(new $(a,f+t.length+1,c,g+1),t,i)):(p=$v._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=p.length===1?i:null);for(const m of p)o.addTrackedEditOperation(m.range,m.text)}static _createRemoveBlockCommentOperations(e,t,i){const r=[];return $.isEmpty(e)?r.push(jr.delete(new $(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(r.push(jr.delete(new $(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),r.push(jr.delete(new $(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),r}static _createAddBlockCommentOperations(e,t,i,r){const s=[];return $.isEmpty(e)?s.push(jr.replace(new $(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(jr.insert(new he(e.startLineNumber,e.startColumn),t+(r?" ":""))),s.push(jr.insert(new he(e.endLineNumber,e.endColumn),(r?" ":"")+i))),s}getEditOperations(e,t){const i=this._selection.startLineNumber,r=this._selection.startColumn;e.tokenization.tokenizeIfCheap(i);const s=e.getLanguageIdAtPosition(i,r),o=this.languageConfigurationService.getLanguageConfiguration(s).comments;!o||!o.blockCommentStartToken||!o.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,o.blockCommentStartToken,o.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length===2){const r=i[0],s=i[1];return new yt(r.range.endLineNumber,r.range.endColumn,s.range.startLineNumber,s.range.startColumn)}else{const r=i[0].range,s=this._usedEndToken?-this._usedEndToken.length-1:0;return new yt(r.endLineNumber,r.endColumn+s,r.endLineNumber,r.endColumn+s)}}}class jm{constructor(e,t,i,r,s,o,a){this.languageConfigurationService=e,this._selection=t,this._indentSize=i,this._type=r,this._insertSpace=s,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=o,this._ignoreFirstLine=a||!1}static _gatherPreflightCommentStrings(e,t,i,r){e.tokenization.tokenizeIfCheap(t);const s=e.getLanguageIdAtPosition(t,1),o=r.getLanguageConfiguration(s).comments,a=o?o.lineCommentToken:null;if(!a)return null;const l=[];for(let c=0,u=i-t+1;cs?t[l].commentStrOffset=o-1:t[l].commentStrOffset=o}}}class zue extends ot{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(Zr);if(!t.hasModel())return;const r=t.getModel(),s=[],o=r.getOptions(),a=t.getOption(23),l=t.getSelections().map((u,d)=>({selection:u,index:d,ignoreFirstLine:!1}));l.sort((u,d)=>$.compareRangesUsingStarts(u.selection,d.selection));let c=l[0];for(let u=1;u=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},M1=function(n,e){return function(t,i){e(t,i,n)}},Gee;let RE=class{static{Gee=this}static{this.ID="editor.contrib.contextmenu"}static get(e){return e.getContribution(Gee.ID)}constructor(e,t,i,r,s,o,a,l){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=r,this._keybindingService=s,this._menuService=o,this._configurationService=a,this._workspaceContextService=l,this._toDispose=new ke,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(c=>this._onContextMenu(c))),this._toDispose.add(this._editor.onMouseWheel(c=>{if(this._contextMenuIsBeingShownCount>0){const u=this._contextViewService.getContextViewElement(),d=c.srcElement;d.shadowRoot&&Iw(u)===d.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(c=>{this._editor.getOption(24)&&c.keyCode===58&&(c.preventDefault(),c.stopPropagation(),this.showContextMenu())}))}_onContextMenu(e){if(!this._editor.hasModel())return;if(!this._editor.getOption(24)){this._editor.focus(),e.target.position&&!this._editor.getSelection().containsPosition(e.target.position)&&this._editor.setPosition(e.target.position);return}if(e.target.type===12||e.target.type===6&&e.target.detail.injectedText)return;if(e.event.preventDefault(),e.event.stopPropagation(),e.target.type===11)return this._showScrollbarContextMenu(e.event);if(e.target.type!==6&&e.target.type!==7&&e.target.type!==1)return;if(this._editor.focus(),e.target.position){let i=!1;for(const r of this._editor.getSelections())if(r.containsPosition(e.target.position)){i=!0;break}i||this._editor.setPosition(e.target.position)}let t=null;e.target.type!==1&&(t=e.event),this.showContextMenu(t)}showContextMenu(e){if(!this._editor.getOption(24)||!this._editor.hasModel())return;const t=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);t.length>0&&this._doShowContextMenu(t,e)}_getMenuActions(e,t){const i=[],r=this._menuService.getMenuActions(t,this._contextKeyService,{arg:e.uri});for(const s of r){const[,o]=s;let a=0;for(const l of o)if(l instanceof ck){const c=this._getMenuActions(e,l.item.submenu);c.length>0&&(i.push(new rE(l.id,l.label,c)),a++)}else i.push(l),a++;a&&i.push(new na)}return i.length&&i.pop(),i}_doShowContextMenu(e,t=null){if(!this._editor.hasModel())return;const i=this._editor.getOption(60);this._editor.updateOptions({hover:{enabled:!1}});let r=t;if(!r){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const o=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),a=ms(this._editor.getDomNode()),l=a.left+o.left,c=a.top+o.top+o.height;r={x:l,y:c}}const s=this._editor.getOption(128)&&!Sg;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:s?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,getAnchor:()=>r,getActions:()=>e,getActionViewItem:o=>{const a=this._keybindingFor(o);if(a)return new vE(o,o,{label:!0,keybinding:a.getLabel(),isMenu:!0});const l=o;return typeof l.getActionViewItem=="function"?l.getActionViewItem():new vE(o,o,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:o=>this._keybindingFor(o),onHide:o=>{this._contextMenuIsBeingShownCount--,this._editor.updateOptions({hover:i})}})}_showScrollbarContextMenu(e){if(!this._editor.hasModel()||uSt(this._workspaceContextService.getWorkspace()))return;const t=this._editor.getOption(73);let i=0;const r=c=>({id:`menu-action-${++i}`,label:c.label,tooltip:"",class:void 0,enabled:typeof c.enabled>"u"?!0:c.enabled,checked:c.checked,run:c.run}),s=(c,u)=>new rE(`menu-action-${++i}`,c,u,void 0),o=(c,u,d,h,f)=>{if(!u)return r({label:c,enabled:u,run:()=>{}});const g=m=>()=>{this._configurationService.updateValue(d,m)},p=[];for(const m of f)p.push(r({label:m.label,checked:h===m.value,run:g(m.value)}));return s(c,p)},a=[];a.push(r({label:w("context.minimap.minimap","Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new na),a.push(r({label:w("context.minimap.renderCharacters","Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(o(w("context.minimap.size","Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:w("context.minimap.size.proportional","Proportional"),value:"proportional"},{label:w("context.minimap.size.fill","Fill"),value:"fill"},{label:w("context.minimap.size.fit","Fit"),value:"fit"}])),a.push(o(w("context.minimap.slider","Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:w("context.minimap.slider.mouseover","Mouse Over"),value:"mouseover"},{label:w("context.minimap.slider.always","Always"),value:"always"}]));const l=this._editor.getOption(128)&&!Sg;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:l?this._editor.getDomNode():void 0,getAnchor:()=>e,getActions:()=>a,onHide:c=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};RE=Gee=s5t([M1(1,mu),M1(2,m0),M1(3,jt),M1(4,xi),M1(5,ld),M1(6,kn),M1(7,Mw)],RE);class o5t extends ot{constructor(){super({id:"editor.action.showContextMenu",label:w("action.showContextMenu.label","Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:1092,weight:100}})}run(e,t){RE.get(t)?.showContextMenu()}}Zn(RE.ID,RE,2);Pe(o5t);class Uq{constructor(e){this.selections=e}equals(e){const t=this.selections.length,i=e.selections.length;if(t!==i)return!1;for(let r=0;r{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeModelContent(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeCursorSelection(t=>{if(this._isCursorUndoRedo||!t.oldSelections||t.oldModelVersionId!==t.modelVersionId)return;const i=new Uq(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new jq(i,e.getScrollTop(),e.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new jq(new Uq(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new jq(new Uq(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(e){this._isCursorUndoRedo=!0,this._editor.setSelections(e.cursorState.selections),this._editor.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),this._isCursorUndoRedo=!1}}class a5t extends ot{constructor(){super({id:"cursorUndo",label:w("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:2099,weight:100}})}run(e,t,i){PE.get(t)?.cursorUndo()}}class l5t extends ot{constructor(){super({id:"cursorRedo",label:w("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){PE.get(t)?.cursorRedo()}}Zn(PE.ID,PE,0);Pe(a5t);Pe(l5t);class c5t{constructor(e,t,i){this.selection=e,this.targetPosition=t,this.copy=i,this.targetSelection=null}getEditOperations(e,t){const i=e.getValueInRange(this.selection);if(this.copy||t.addEditOperation(this.selection,null),t.addEditOperation(new $(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),i),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new yt(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new yt(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumberthis._onEditorMouseDown(t))),this._register(this._editor.onMouseUp(t=>this._onEditorMouseUp(t))),this._register(this._editor.onMouseDrag(t=>this._onEditorMouseDrag(t))),this._register(this._editor.onMouseDrop(t=>this._onEditorMouseDrop(t))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(t=>this.onEditorKeyDown(t))),this._register(this._editor.onKeyUp(t=>this.onEditorKeyUp(t))),this._register(this._editor.onDidBlurEditorWidget(()=>this.onEditorBlur())),this._register(this._editor.onDidBlurEditorText(()=>this.onEditorBlur())),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(e){!this._editor.getOption(35)||this._editor.getOption(22)||(xx(e)&&(this._modifierPressed=!0),this._mouseDown&&xx(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(xx(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===Tk.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(e){this._mouseDown=!0}_onEditorMouseUp(e){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(e){const t=e.target;if(this._dragSelection===null){const r=(this._editor.getSelections()||[]).filter(s=>t.position&&s.containsPosition(t.position));if(r.length===1)this._dragSelection=r[0];else return}xx(e.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),t.position&&(this._dragSelection.containsPosition(t.position)?this._removeDecoration():this.showAt(t.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(e){if(e.target&&(this._hitContent(e.target)||this._hitMargin(e.target))&&e.target.position){const t=new he(e.target.position.lineNumber,e.target.position.column);if(this._dragSelection===null){let i=null;if(e.event.shiftKey){const r=this._editor.getSelection();if(r){const{selectionStartLineNumber:s,selectionStartColumn:o}=r;i=[new yt(s,o,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(r=>r.containsPosition(t)?new yt(t.lineNumber,t.column,t.lineNumber,t.column):r);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(xx(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(Tk.ID,new c5t(this._dragSelection,t,xx(e.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}static{this._DECORATION_OPTIONS=un.register({description:"dnd-target",className:"dnd-target"})}showAt(e){this._dndDecorationIds.set([{range:new $(e.lineNumber,e.column,e.lineNumber,e.column),options:Tk._DECORATION_OPTIONS}]),this._editor.revealPosition(e,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(e){return e.type===6||e.type===7}_hitMargin(e){return e.type===2||e.type===3||e.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}}Zn(Tk.ID,Tk,2);Zn(t0.ID,t0,0);u2(hee);Je(new class extends fo{constructor(){super({id:B9e,precondition:Lue,kbOpts:{weight:100,primary:2137}})}runEditorCommand(n,e){return t0.get(e)?.changePasteType()}});Je(new class extends fo{constructor(){super({id:"editor.hidePasteWidget",precondition:Lue,kbOpts:{weight:100,primary:9}})}runEditorCommand(n,e){t0.get(e)?.clearWidgets()}});Pe(class V7e extends ot{static{this.argsSchema={type:"object",properties:{kind:{type:"string",description:w("pasteAs.kind","The kind of the paste edit to try applying. If not provided or there are multiple edits for this kind, the editor will show a picker.")}}}}constructor(){super({id:"editor.action.pasteAs",label:w("pasteAs","Paste As..."),alias:"Paste As...",precondition:Q.writable,metadata:{description:"Paste as",args:[{name:"args",schema:V7e.argsSchema}]}})}run(e,t,i){let r=typeof i?.kind=="string"?i.kind:void 0;return!r&&i&&(r=typeof i.id=="string"?i.id:void 0),t0.get(t)?.pasteAs(r?new sr(r):void 0)}});Pe(class extends ot{constructor(){super({id:"editor.action.pasteAsText",label:w("pasteAsText","Paste as Text"),alias:"Paste as Text",precondition:Q.writable})}run(n,e){return t0.get(e)?.pasteAs({providerId:Vw.id})}});class u5t{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(e){if(e&&this._dragOperations.has(e)){const t=this._dragOperations.get(e);return this._dragOperations.delete(e),t}}}class WCe{constructor(e){this.identifier=e}}const z7e=On("treeViewsDndService");Vn(z7e,u5t,1);var d5t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},u3=function(n,e){return function(t,i){e(t,i,n)}},Yee;const U7e="editor.experimental.dropIntoEditor.defaultProvider",j7e="editor.changeDropType",Uue=new et("dropWidgetVisible",!1,w("dropWidgetVisible","Whether the drop widget is showing"));let OE=class extends me{static{Yee=this}static{this.ID="editor.contrib.dropIntoEditorController"}static get(e){return e.getContribution(Yee.ID)}constructor(e,t,i,r,s){super(),this._configService=i,this._languageFeaturesService=r,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=L9.getInstance(),this._dropProgressManager=this._register(t.createInstance(D9,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(A9,"dropIntoEditor",e,Uue,{id:j7e,label:w("postDropWidgetTitle","Show drop options...")})),this._register(e.onDropIntoEditor(o=>this.onDropIntoEditor(e,o.position,o.event)))}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,i){if(!i.dataTransfer||!e.hasModel())return;this._currentOperation?.cancel(),e.focus(),e.setPosition(t);const r=ko(async s=>{const o=new ke,a=o.add(new Pb(e,1,void 0,s));try{const l=await this.extractDataTransferData(i);if(l.size===0||a.token.isCancellationRequested)return;const c=e.getModel();if(!c)return;const u=this._languageFeaturesService.documentDropEditProvider.ordered(c).filter(h=>h.dropMimeTypes?h.dropMimeTypes.some(f=>l.matches(f)):!0),d=o.add(await this.getDropEdits(u,c,t,l,a));if(a.token.isCancellationRequested)return;if(d.edits.length){const h=this.getInitialActiveEditIndex(c,d.edits),f=e.getOption(36).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([$.fromPositions(t)],{activeEditIndex:h,allEdits:d.edits},f,async g=>g,s)}}finally{o.dispose(),this._currentOperation===r&&(this._currentOperation=void 0)}});this._dropProgressManager.showWhile(t,w("dropIntoEditorProgress","Running drop handlers. Click to cancel"),r,{cancel:()=>r.cancel()}),this._currentOperation=r}async getDropEdits(e,t,i,r,s){const o=new ke,a=await YP(Promise.all(e.map(async c=>{try{const u=await c.provideDocumentDropEdits(t,i,r,s.token);return u&&o.add(u),u?.edits.map(d=>({...d,providerId:c.id}))}catch(u){console.error(u)}})),s.token),l=rf(a??[]).flat();return{edits:M9e(l),dispose:()=>o.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(U7e,{resource:e.uri});for(const[r,s]of Object.entries(i)){const o=new sr(s),a=t.findIndex(l=>o.value===l.providerId&&l.handledMimeType&&L9e(r,[l.handledMimeType]));if(a>=0)return a}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new E9e;const t=I9e(e.dataTransfer);if(this.treeItemsTransfer.hasData(WCe.prototype)){const i=this.treeItemsTransfer.getData(WCe.prototype);if(Array.isArray(i))for(const r of i){const s=await this._treeViewsDragAndDropService.removeDragOperationTransfer(r.identifier);if(s)for(const[o,a]of s)t.replace(o,a)}}return t}};OE=Yee=d5t([u3(1,Tt),u3(2,kn),u3(3,dt),u3(4,z7e)],OE);Zn(OE.ID,OE,2);u2(dee);Je(new class extends fo{constructor(){super({id:j7e,precondition:Uue,kbOpts:{weight:100,primary:2137}})}runEditorCommand(n,e,t){OE.get(e)?.changeDropType()}});Je(new class extends fo{constructor(){super({id:"editor.hideDropWidget",precondition:Uue,kbOpts:{weight:100,primary:9}})}runEditorCommand(n,e,t){OE.get(e)?.clearWidgets()}});Yr.as(ff.Configuration).registerConfiguration({...sO,properties:{[U7e]:{type:"object",scope:5,description:w("defaultProviderDescription","Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});class Th{constructor(e){this._editor=e,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){const e=this._findScopeDecorationIds.map(t=>this._editor.getModel().getDecorationRange(t)).filter(t=>!!t);if(e.length)return e}return null}getStartPosition(){return this._startPosition}setStartPosition(e){this._startPosition=e,this.setCurrentFindMatch(null)}_getDecorationIndex(e){const t=this._decorations.indexOf(e);return t>=0?t+1:1}getDecorationRangeAt(e){const t=e{if(this._highlightedDecorationId!==null&&(r.changeDecorationOptions(this._highlightedDecorationId,Th._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,r.changeDecorationOptions(this._highlightedDecorationId,Th._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(r.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),t!==null){let s=this._editor.getModel().getDecorationRange(t);if(s.startLineNumber!==s.endLineNumber&&s.endColumn===1){const o=s.endLineNumber-1,a=this._editor.getModel().getLineMaxColumn(o);s=new $(s.startLineNumber,s.startColumn,o,a)}this._rangeHighlightDecorationId=r.addDecoration(s,Th._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let r=Th._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){r=Th._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),c=this._editor.getLayoutInfo().height/a,u=Math.max(2,Math.ceil(3/c));let d=e[0].range.startLineNumber,h=e[0].range.endLineNumber;for(let f=1,g=e.length;f=p.startLineNumber?p.endLineNumber>h&&(h=p.endLineNumber):(s.push({range:new $(d,1,h,1),options:Th._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),d=p.startLineNumber,h=p.endLineNumber)}s.push({range:new $(d,1,h,1),options:Th._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const o=new Array(e.length);for(let a=0,l=e.length;ai.removeDecoration(a)),this._findScopeDecorationIds=[]),t?.length&&(this._findScopeDecorationIds=t.map(a=>i.addDecoration(a,Th._FIND_SCOPE_DECORATION)))})}matchBeforePosition(e){if(this._decorations.length===0)return null;for(let t=this._decorations.length-1;t>=0;t--){const i=this._decorations[t],r=this._editor.getModel().getDecorationRange(i);if(!(!r||r.endLineNumber>e.lineNumber)){if(r.endLineNumbere.column))return r}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(e){if(this._decorations.length===0)return null;for(let t=0,i=this._decorations.length;te.lineNumber)return s;if(!(s.startColumn0){const i=[];for(let o=0;o$.compareRangesUsingStarts(o.range,a.range));const r=[];let s=i[0];for(let o=1;o0?e[0].toUpperCase()+e.substr(1):n[0][0].toUpperCase()!==n[0][0]&&e.length>0?e[0].toLowerCase()+e.substr(1):e}else return e}function HCe(n,e,t){return n[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&n[0].split(t).length===e.split(t).length}function VCe(n,e,t){const i=e.split(t),r=n[0].split(t);let s="";return i.forEach((o,a)=>{s+=q7e([r[a]],o)+t}),s.slice(0,-1)}class zCe{constructor(e){this.staticValue=e,this.kind=0}}class f5t{constructor(e){this.pieces=e,this.kind=1}}class ME{static fromStaticValue(e){return new ME([sw.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new zCe(""):e.length===1&&e[0].staticValue!==null?this._state=new zCe(e[0].staticValue):this._state=new f5t(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?q7e(e,this._state.staticValue):this._state.staticValue;let i="";for(let r=0,s=this._state.pieces.length;r0){const l=[],c=o.caseOps.length;let u=0;for(let d=0,h=a.length;d=c){l.push(a.slice(d));break}switch(o.caseOps[u]){case"U":l.push(a[d].toUpperCase());break;case"u":l.push(a[d].toUpperCase()),u++;break;case"L":l.push(a[d].toLowerCase());break;case"l":l.push(a[d].toLowerCase()),u++;break;default:l.push(a[d])}}a=l.join("")}i+=a}return i}static _substitute(e,t){if(t===null)return"";if(e===0)return t[0];let i="";for(;e>0;){if(e=r)break;const o=n.charCodeAt(i);switch(o){case 92:t.emitUnchanged(i-1),t.emitStatic("\\",i+1);break;case 110:t.emitUnchanged(i-1),t.emitStatic(` -`,i+1);break;case 116:t.emitUnchanged(i-1),t.emitStatic(" ",i+1);break;case 117:case 85:case 108:case 76:t.emitUnchanged(i-1),t.emitStatic("",i+1),e.push(String.fromCharCode(o));break}continue}if(s===36){if(i++,i>=r)break;const o=n.charCodeAt(i);if(o===36){t.emitUnchanged(i-1),t.emitStatic("$",i+1);continue}if(o===48||o===38){t.emitUnchanged(i-1),t.emitMatchIndex(0,i+1,e),e.length=0;continue}if(49<=o&&o<=57){let a=o-48;if(i+1{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(i=>{(i.reason===3||i.reason===5||i.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(i=>{this._ignoreModelContentChanged||(i.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(i=>this._onStateChanged(i))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,er(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(e){this._isDisposed||this._editor.hasModel()&&(e.searchString||e.isReplaceRevealed||e.isRegex||e.wholeWord||e.matchCase||e.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor)},m5t)):e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor))}static _getSearchRange(e,t){return t||e.getFullModelRange()}research(e,t){let i=null;typeof t<"u"?t!==null&&(Array.isArray(t)?i=t:i=[t]):i=this._decorations.getFindScopes(),i!==null&&(i=i.map(a=>{if(a.startLineNumber!==a.endLineNumber){let l=a.endLineNumber;return a.endColumn===1&&(l=l-1),new $(a.startLineNumber,1,l,this._editor.getModel().getLineMaxColumn(l))}return a}));const r=this._findMatches(i,!1,Wv);this._decorations.set(r,i);const s=this._editor.getSelection();let o=this._decorations.getCurrentMatchesPosition(s);if(o===0&&r.length>0){const a=gN(r.map(l=>l.range),l=>$.compareRangesUsingStarts(l,s)>=0);o=a>0?a-1+1:o}this._state.changeMatchInfo(o,this._decorations.getCount(),void 0),e&&this._editor.getOption(41).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const e=this._decorations.getFindScope();return e&&this._editor.revealRangeInCenterIfOutsideViewport(e,0),!0}return!1}_setCurrentFindMatch(e){const t=this._decorations.setCurrentFindMatch(e);this._state.changeMatchInfo(t,this._decorations.getCount(),e),this._editor.setSelection(e),this._editor.revealRangeInCenterIfOutsideViewport(e,0)}_prevSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:r}=e;const s=this._editor.getModel();return t||r===1?(i===1?i=s.getLineCount():i--,r=s.getLineMaxColumn(i)):r--,new he(i,r)}_moveToPrevMatch(e,t=!1){if(!this._state.canNavigateBack()){const u=this._decorations.matchAfterPosition(e);u&&this._setCurrentFindMatch(u);return}if(this._decorations.getCount()=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:r}=e;const s=this._editor.getModel();return t||r===s.getLineMaxColumn(i)?(i===s.getLineCount()?i=1:i++,r=1):r++,new he(i,r)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()zI._getSearchRange(this._editor.getModel(),s));return this._editor.getModel().findMatches(this._state.searchString,r,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t,i)}replaceAll(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();e===null&&this._state.matchesCount>=Wv?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const t=new j1(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null).parseSearchRequest();if(!t)return;let i=t.regex;if(!i.multiline){let d="mu";i.ignoreCase&&(d+="i"),i.global&&(d+="g"),i=new RegExp(i.source,d)}const r=this._editor.getModel(),s=r.getValue(1),o=r.getFullModelRange(),a=this._getReplacePattern();let l;const c=this._state.preserveCase;a.hasReplacementPatterns||c?l=s.replace(i,function(){return a.buildReplaceString(arguments,c)}):l=s.replace(i,a.buildReplaceString(null,c));const u=new Pce(o,l,this._editor.getSelection());this._executeEditorCommand("replaceAll",u)}_regularReplaceAll(e){const t=this._getReplacePattern(),i=this._findMatches(e,t.hasReplacementPatterns||this._state.preserveCase,1073741824),r=[];for(let o=0,a=i.length;oo.range),r);this._executeEditorCommand("replaceAll",s)}selectAllMatches(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();let i=this._findMatches(e,!1,1073741824).map(s=>new yt(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn));const r=this._editor.getSelection();for(let s=0,o=i.length;sthis._hide(),2e3)),this._isVisible=!1,this._editor=e,this._state=t,this._keybindingService=i,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");const r={inputActiveOptionBorder:it(cW),inputActiveOptionForeground:it(uW),inputActiveOptionBackground:it(eO)},s=this._register(_E());this.caseSensitive=this._register(new l6e({appendTitle:this._keybindingLabelFor(wr.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverDelegate:s,...r})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange(()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)})),this.wholeWords=this._register(new c6e({appendTitle:this._keybindingLabelFor(wr.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverDelegate:s,...r})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange(()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)})),this.regex=this._register(new u6e({appendTitle:this._keybindingLabelFor(wr.ToggleRegexCommand),isChecked:this._state.isRegex,hoverDelegate:s,...r})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange(()=>{this._state.change({isRegex:this.regex.checked},!1)})),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange(o=>{let a=!1;o.isRegex&&(this.regex.checked=this._state.isRegex,a=!0),o.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,a=!0),o.matchCase&&(this.caseSensitive.checked=this._state.matchCase,a=!0),!this._state.isRevealed&&a&&this._revealTemporarily()})),this._register(Ce(this._domNode,je.MOUSE_LEAVE,o=>this._onMouseLeave())),this._register(Ce(this._domNode,"mouseover",o=>this._onMouseOver()))}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return que.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseLeave(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}}function m3(n,e){return n===1?!0:n===2?!1:e}class _5t extends me{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return m3(this._isRegexOverride,this._isRegex)}get wholeWord(){return m3(this._wholeWordOverride,this._wholeWord)}get matchCase(){return m3(this._matchCaseOverride,this._matchCase)}get preserveCase(){return m3(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}constructor(){super(),this._onFindReplaceStateChange=this._register(new fe),this.onFindReplaceStateChange=this._onFindReplaceStateChange.event,this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}changeMatchInfo(e,t,i){const r={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;t===0&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,r.matchesPosition=!0,s=!0),this._matchesCount!==t&&(this._matchesCount=t,r.matchesCount=!0,s=!0),typeof i<"u"&&($.equalsRange(this._currentMatch,i)||(this._currentMatch=i,r.currentMatch=!0,s=!0)),s&&this._onFindReplaceStateChange.fire(r)}change(e,t,i=!0){const r={moveCursor:t,updateHistory:i,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;const o=this.isRegex,a=this.wholeWord,l=this.matchCase,c=this.preserveCase;typeof e.searchString<"u"&&this._searchString!==e.searchString&&(this._searchString=e.searchString,r.searchString=!0,s=!0),typeof e.replaceString<"u"&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,r.replaceString=!0,s=!0),typeof e.isRevealed<"u"&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,r.isRevealed=!0,s=!0),typeof e.isReplaceRevealed<"u"&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,r.isReplaceRevealed=!0,s=!0),typeof e.isRegex<"u"&&(this._isRegex=e.isRegex),typeof e.wholeWord<"u"&&(this._wholeWord=e.wholeWord),typeof e.matchCase<"u"&&(this._matchCase=e.matchCase),typeof e.preserveCase<"u"&&(this._preserveCase=e.preserveCase),typeof e.searchScope<"u"&&(e.searchScope?.every(u=>this._searchScope?.some(d=>!$.equalsRange(d,u)))||(this._searchScope=e.searchScope,r.searchScope=!0,s=!0)),typeof e.loop<"u"&&this._loop!==e.loop&&(this._loop=e.loop,r.loop=!0,s=!0),typeof e.isSearching<"u"&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,r.isSearching=!0,s=!0),typeof e.filters<"u"&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,r.filters=!0,s=!0),this._isRegexOverride=typeof e.isRegexOverride<"u"?e.isRegexOverride:0,this._wholeWordOverride=typeof e.wholeWordOverride<"u"?e.wholeWordOverride:0,this._matchCaseOverride=typeof e.matchCaseOverride<"u"?e.matchCaseOverride:0,this._preserveCaseOverride=typeof e.preserveCaseOverride<"u"?e.preserveCaseOverride:0,o!==this.isRegex&&(s=!0,r.isRegex=!0),a!==this.wholeWord&&(s=!0,r.wholeWord=!0),l!==this.matchCase&&(s=!0,r.matchCase=!0),c!==this.preserveCase&&(s=!0,r.preserveCase=!0),s&&this._onFindReplaceStateChange.fire(r)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition=Wv}}const v5t=w("defaultLabel","input"),b5t=w("label.preserveCaseToggle","Preserve Case");class y5t extends o2{constructor(e){super({icon:ze.preserveCase,title:b5t+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Yl("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class w5t extends ud{constructor(e,t,i,r){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new fe),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new fe),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new fe),this._onInput=this._register(new fe),this._onKeyUp=this._register(new fe),this._onPreserveCaseKeyDown=this._register(new fe),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=t,this.placeholder=r.placeholder||"",this.validation=r.validation,this.label=r.label||v5t;const s=r.appendPreserveCaseLabel||"",o=r.history||[],a=!!r.flexibleHeight,l=!!r.flexibleWidth,c=r.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new d6e(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:o,showHistoryHint:r.showHistoryHint,flexibleHeight:a,flexibleWidth:l,flexibleMaxHeight:c,inputBoxStyles:r.inputBoxStyles})),this.preserveCase=this._register(new y5t({appendTitle:s,isChecked:!1,...r.toggleStyles})),this._register(this.preserveCase.onChange(h=>{this._onDidOptionChange.fire(h),!h&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(h=>{this._onPreserveCaseKeyDown.fire(h)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;const u=[this.preserveCase.domNode];this.onkeydown(this.domNode,h=>{if(h.equals(15)||h.equals(17)||h.equals(9)){const f=u.indexOf(this.domNode.ownerDocument.activeElement);if(f>=0){let g=-1;h.equals(17)?g=(f+1)%u.length:h.equals(15)&&(f===0?g=u.length-1:g=f-1),h.equals(9)?(u[f].blur(),this.inputBox.focus()):g>=0&&u[g].focus(),Hn.stop(h,!0)}}});const d=document.createElement("div");d.className="controls",d.style.display=this._showOptionButtons?"block":"none",d.appendChild(this.preserveCase.domNode),this.domNode.appendChild(d),e?.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,h=>this._onKeyDown.fire(h)),this.onkeyup(this.inputBox.inputElement,h=>this._onKeyUp.fire(h)),this.oninput(this.inputBox.inputElement,h=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,h=>this._onMouseDown.fire(h))}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setEnabled(e){e?this.enable():this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}validate(){this.inputBox?.validate()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=e+"px"}dispose(){super.dispose()}}var K7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},G7e=function(n,e){return function(t,i){e(t,i,n)}};const Kue=new et("suggestWidgetVisible",!1,w("suggestWidgetVisible","Whether suggestion are visible")),Gue="historyNavigationWidgetFocus",Y7e="historyNavigationForwardsEnabled",Z7e="historyNavigationBackwardsEnabled";let UI;const _3=[];function X7e(n,e){if(_3.includes(e))throw new Error("Cannot register the same widget multiple times");_3.push(e);const t=new ke,i=new et(Gue,!1).bindTo(n),r=new et(Y7e,!0).bindTo(n),s=new et(Z7e,!0).bindTo(n),o=()=>{i.set(!0),UI=e},a=()=>{i.set(!1),UI===e&&(UI=void 0)};return H$(e.element)&&o(),t.add(e.onDidFocus(()=>o())),t.add(e.onDidBlur(()=>a())),t.add(Lt(()=>{_3.splice(_3.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:r,historyNavigationBackwardsEnablement:s,dispose(){t.dispose()}}}let Zee=class extends h6e{constructor(e,t,i,r){super(e,t,i);const s=this._register(r.createScoped(this.inputBox.element));this._register(X7e(s,this.inputBox))}};Zee=K7e([G7e(3,jt)],Zee);let Xee=class extends w5t{constructor(e,t,i,r,s=!1){super(e,t,s,i);const o=this._register(r.createScoped(this.inputBox.element));this._register(X7e(o,this.inputBox))}};Xee=K7e([G7e(3,jt)],Xee);jl.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Le.and(Le.has(Gue),Le.equals(Z7e,!0),Le.not("isComposing"),Kue.isEqualTo(!1)),primary:16,secondary:[528],handler:n=>{UI?.showPreviousValue()}});jl.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Le.and(Le.has(Gue),Le.equals(Y7e,!0),Le.not("isComposing"),Kue.isEqualTo(!1)),primary:18,secondary:[530],handler:n=>{UI?.showNextValue()}});function UCe(n){return n.lookupKeybinding("history.showPrevious")?.getElectronAccelerator()==="Up"&&n.lookupKeybinding("history.showNext")?.getElectronAccelerator()==="Down"}const jCe=kr("find-collapsed",ze.chevronRight,w("findCollapsedIcon","Icon to indicate that the editor find widget is collapsed.")),qCe=kr("find-expanded",ze.chevronDown,w("findExpandedIcon","Icon to indicate that the editor find widget is expanded.")),C5t=kr("find-selection",ze.selection,w("findSelectionIcon","Icon for 'Find in Selection' in the editor find widget.")),x5t=kr("find-replace",ze.replace,w("findReplaceIcon","Icon for 'Replace' in the editor find widget.")),S5t=kr("find-replace-all",ze.replaceAll,w("findReplaceAllIcon","Icon for 'Replace All' in the editor find widget.")),k5t=kr("find-previous-match",ze.arrowUp,w("findPreviousMatchIcon","Icon for 'Find Previous' in the editor find widget.")),E5t=kr("find-next-match",ze.arrowDown,w("findNextMatchIcon","Icon for 'Find Next' in the editor find widget.")),L5t=w("label.findDialog","Find / Replace"),T5t=w("label.find","Find"),D5t=w("placeholder.find","Find"),I5t=w("label.previousMatchButton","Previous Match"),A5t=w("label.nextMatchButton","Next Match"),N5t=w("label.toggleSelectionFind","Find in Selection"),R5t=w("label.closeButton","Close"),P5t=w("label.replace","Replace"),O5t=w("placeholder.replace","Replace"),M5t=w("label.replaceButton","Replace"),F5t=w("label.replaceAllButton","Replace All"),B5t=w("label.toggleReplaceButton","Toggle Replace"),$5t=w("title.matchesCountLimit","Only the first {0} results are highlighted, but all find operations work on the entire text.",Wv),W5t=w("label.matchesLocation","{0} of {1}"),KCe=w("label.noResults","No results"),ep=419,H5t=275,V5t=H5t-54;let UT=69;const z5t=33,GCe="ctrlEnterReplaceAll.windows.donotask",YCe=Rn?256:2048;class qq{constructor(e){this.afterLineNumber=e,this.heightInPx=z5t,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function ZCe(n,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){n.stopPropagation();return}}function XCe(n,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEndthis._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(d=>this._onStateChanged(d))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(d=>{if(d.hasChanged(92)&&(this._codeEditor.getOption(92)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),d.hasChanged(146)&&this._tryUpdateWidgetWidth(),d.hasChanged(2)&&this.updateAccessibilitySupport(),d.hasChanged(41)){const h=this._codeEditor.getOption(41).loop;this._state.change({loop:h},!1);const f=this._codeEditor.getOption(41).addExtraSpaceOnTop;f&&!this._viewZone&&(this._viewZone=new qq(0),this._showViewZone()),!f&&this._viewZone&&this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{this._isVisible&&this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){const d=await this._controller.getGlobalBufferTerm();d&&d!==this._state.searchString&&(this._state.change({searchString:d},!1),this._findInput.select())}})),this._findInputFocused=_H.bindTo(o),this._findFocusTracker=this._register(Eg(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus(()=>{this._findInputFocused.set(!0),this._updateSearchScope()})),this._register(this._findFocusTracker.onDidBlur(()=>{this._findInputFocused.set(!1)})),this._replaceInputFocused=jue.bindTo(o),this._replaceFocusTracker=this._register(Eg(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus(()=>{this._replaceInputFocused.set(!0),this._updateSearchScope()})),this._register(this._replaceFocusTracker.onDidBlur(()=>{this._replaceInputFocused.set(!1)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(41).addExtraSpaceOnTop&&(this._viewZone=new qq(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(d=>{if(d.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}getId(){return Yue.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(e){if(e.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(e.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),e.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),e.isReplaceRevealed&&(this._state.isReplaceRevealed?!this._codeEditor.getOption(92)&&!this._isReplaceVisible&&(this._isReplaceVisible=!0,this._replaceInput.width=qc(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(e.isRevealed||e.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),e.isRegex&&this._findInput.setRegex(this._state.isRegex),e.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),e.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),e.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),e.searchScope&&(this._state.searchScope?this._toggleSelectionFind.checked=!0:this._toggleSelectionFind.checked=!1,this._updateToggleSelectionFindButton()),e.searchString||e.matchesCount||e.matchesPosition){const t=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle("no-results",t),this._updateMatchesCount(),this._updateButtons()}(e.searchString||e.currentMatch)&&this._layoutViewZone(),e.updateHistory&&this._delayedUpdateHistory(),e.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,rn)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){this._matchesCount.style.minWidth=UT+"px",this._state.matchesCount>=Wv?this._matchesCount.title=$5t:this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=Wv&&(t+="+");let i=String(this._state.matchesPosition);i==="0"&&(i="?"),e=Lw(W5t,i,t)}else e=KCe;this._matchesCount.appendChild(document.createTextNode(e)),ql(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),UT=Math.max(UT,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===KCe)return i===""?w("ariaSearchNoResultEmpty","{0} found",e):w("ariaSearchNoResult","{0} found for '{1}'",e,i);if(t){const r=w("ariaSearchNoResultWithLineNum","{0} found for '{1}', at {2}",e,i,t.startLineNumber+":"+t.startColumn),s=this._codeEditor.getModel();return s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1?`${s.getLineContent(t.startLineNumber)}, ${r}`:r}return w("ariaSearchNoResultWithLineNumNoCurrentMatch","{0} found for '{1}'",e,i)}_updateToggleSelectionFindButton(){const e=this._codeEditor.getSelection(),t=e?e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn:!1,i=this._toggleSelectionFind.checked;this._isVisible&&(i||t)?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);const e=this._state.searchString.length>0,t=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);const i=!this._codeEditor.getOption(92);this._toggleReplaceBtn.setEnabled(this._isVisible&&i)}_reveal(){if(this._revealTimeouts.forEach(e=>{clearTimeout(e)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const e=this._codeEditor.getSelection();switch(this._codeEditor.getOption(41).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":{const i=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=i;break}}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout(()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false")},0)),this._revealTimeouts.push(setTimeout(()=>{this._findInput.validate()},200)),this._codeEditor.layoutOverlayWidget(this);let t=!0;if(this._codeEditor.getOption(41).seedSearchStringFromSelection&&e){const i=this._codeEditor.getDomNode();if(i){const r=ms(i),s=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),o=r.left+(s?s.left:0),a=s?s.top:0;if(this._viewZone&&ae.startLineNumber&&(t=!1);const l=u3e(this._domNode).left;o>l&&(t=!1);const c=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());r.left+(c?c.left:0)>l&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach(t=>{clearTimeout(t)}),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),e&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(e){if(!this._codeEditor.getOption(41).addExtraSpaceOnTop){this._removeViewZone();return}if(!this._isVisible)return;const i=this._viewZone;this._viewZoneId!==void 0||!i||this._codeEditor.changeViewZones(r=>{i.heightInPx=this._getHeight(),this._viewZoneId=r.addZone(i),this._codeEditor.setScrollTop(e||this._codeEditor.getScrollTop()+i.heightInPx)})}_showViewZone(e=!0){if(!this._isVisible||!this._codeEditor.getOption(41).addExtraSpaceOnTop)return;this._viewZone===void 0&&(this._viewZone=new qq(0));const i=this._viewZone;this._codeEditor.changeViewZones(r=>{if(this._viewZoneId!==void 0){const s=this._getHeight();if(s===i.heightInPx)return;const o=s-i.heightInPx;i.heightInPx=s,r.layoutZone(this._viewZoneId),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+o);return}else{let s=this._getHeight();if(s-=this._codeEditor.getOption(84).top,s<=0)return;i.heightInPx=s,this._viewZoneId=r.addZone(i),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s)}})}_removeViewZone(){this._codeEditor.changeViewZones(e=>{this._viewZoneId!==void 0&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))})}_tryUpdateWidgetWidth(){if(!this._isVisible||!this._domNode.isConnected)return;const e=this._codeEditor.getLayoutInfo();if(e.contentWidth<=0){this._domNode.classList.add("hiddenEditor");return}else this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");const i=e.width,r=e.minimap.minimapWidth;let s=!1,o=!1,a=!1;if(this._resized&&qc(this._domNode)>ep){this._domNode.style.maxWidth=`${i-28-r-15}px`,this._replaceInput.width=qc(this._findInput.domNode);return}if(ep+28+r>=i&&(o=!0),ep+28+r-UT>=i&&(a=!0),ep+28+r-UT>=i+50&&(s=!0),this._domNode.classList.toggle("collapsed-find-widget",s),this._domNode.classList.toggle("narrow-find-widget",a),this._domNode.classList.toggle("reduced-find-widget",o),!a&&!s&&(this._domNode.style.maxWidth=`${i-28-r-15}px`),this._findInput.layout({collapsedFindWidget:s,narrowFindWidget:a,reducedFindWidget:o}),this._resized){const l=this._findInput.inputBox.element.clientWidth;l>0&&(this._replaceInput.width=l)}else this._isReplaceVisible&&(this._replaceInput.width=qc(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){const e=this._getHeight();return this._cachedHeight!==null&&this._cachedHeight===e?!1:(this._cachedHeight=e,this._domNode.style.height=`${e}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){const e=this._codeEditor.getSelections();e.map(t=>{t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1)));const i=this._state.currentMatch;return t.startLineNumber!==t.endLineNumber&&!$.equalsRange(t,i)?t:null}).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(YCe|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(` +{1}`,a.title,I9(m)))}finally{o.deltaDecorations(f,[])}s.isCancellationRequested||i&&g.isApplied&&t.allEdits.length>1&&this.show(p??h,t,l)}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(gee,this._id,this._editor,this._visibleContext,this._showCommand,e,t,i))}clear(){this._currentWidget.clear()}tryShowSelector(){this._currentWidget.value?.showSelector()}};A9=F9e([Ek(4,Tt),Ek(5,rO),Ek(6,Ts)],A9);var B4t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},bx=function(n,e){return function(t,i){e(t,i,n)}},X1;const B9e="editor.changePasteType",Lue=new et("pasteWidgetVisible",!1,w("pasteWidgetVisible","Whether the paste widget is showing")),Fq="application/vnd.code.copyMetadata";let t0=class extends me{static{X1=this}static{this.ID="editor.contrib.copyPasteActionController"}static get(e){return e.getContribution(X1.ID)}constructor(e,t,i,r,s,o,a){super(),this._bulkEditService=i,this._clipboardService=r,this._languageFeaturesService=s,this._quickInputService=o,this._progressService=a,this._editor=e;const l=e.getContainerDomNode();this._register(Ce(l,"copy",c=>this.handleCopy(c))),this._register(Ce(l,"cut",c=>this.handleCopy(c))),this._register(Ce(l,"paste",c=>this.handlePaste(c),!0)),this._pasteProgressManager=this._register(new D9("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(A9,"pasteIntoEditor",e,Lue,{id:B9e,label:w("postPasteWidgetTitle","Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(e){this._editor.focus();try{this._pasteAsActionContext={preferred:e},GL().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(85).enabled}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){if(!this._editor.hasTextFocus()||(this._clipboardService.clearInternalState?.(),!e.clipboardData||!this.isPasteAsEnabled()))return;const t=this._editor.getModel(),i=this._editor.getSelections();if(!t||!i?.length)return;const r=this._editor.getOption(37);let s=i;const o=i.length===1&&i[0].isEmpty();if(o){if(!r)return;s=[new $(s[0].startLineNumber,1,s[0].startLineNumber,1+t.getLineLength(s[0].startLineNumber))]}const a=this._editor._getViewModel()?.getPlainTextToCopy(i,r,Ta),c={multicursorText:Array.isArray(a)?a:null,pasteOnNewLine:o,mode:null},u=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(p=>!!p.prepareDocumentPaste);if(!u.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:c});return}const d=D9e(e.clipboardData),h=u.flatMap(p=>p.copyMimeTypes??[]),f=aH();this.setCopyMetadata(e.clipboardData,{id:f,providerCopyMimeTypes:h,defaultPastePayload:c});const g=ko(async p=>{const m=rf(await Promise.all(u.map(async _=>{try{return await _.prepareDocumentPaste(t,s,d,p)}catch(v){console.error(v);return}})));m.reverse();for(const _ of m)for(const[v,y]of _)d.replace(v,y);return d});X1._currentCopyOperation?.dataTransferPromise.cancel(),X1._currentCopyOperation={handle:f,dataTransferPromise:g}}async handlePaste(e){if(!e.clipboardData||!this._editor.hasTextFocus())return;au.get(this._editor)?.closeMessage(),this._currentPasteOperation?.cancel(),this._currentPasteOperation=void 0;const t=this._editor.getModel(),i=this._editor.getSelections();if(!i?.length||!t||this._editor.getOption(92)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;const r=this.fetchCopyMetadata(e),s=I9e(e.clipboardData);s.delete(Fq);const o=[...e.clipboardData.types,...r?.providerCopyMimeTypes??[],ps.uriList],a=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(l=>{const c=this._pasteAsActionContext?.preferred;return c&&l.providedPasteEditKinds&&!this.providerMatchesPreference(l,c)?!1:l.pasteMimeTypes?.some(u=>L9e(u,o))});if(!a.length){this._pasteAsActionContext?.preferred&&this.showPasteAsNoEditMessage(i,this._pasteAsActionContext.preferred);return}e.preventDefault(),e.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,a,i,s,r):this.doPasteInline(a,i,s,r,e)}showPasteAsNoEditMessage(e,t){au.get(this._editor)?.showMessage(w("pasteAsError","No paste edits for '{0}' found",t instanceof sr?t.value:t.providerId),e[0].getStartPosition())}doPasteInline(e,t,i,r,s){const o=this._editor;if(!o.hasModel())return;const a=new Pb(o,3,void 0),l=ko(async c=>{const u=this._editor;if(!u.hasModel())return;const d=u.getModel(),h=new ke,f=h.add(new Kr(c));h.add(a.token.onCancellationRequested(()=>f.cancel()));const g=f.token;try{if(await this.mergeInDataFromCopy(i,r,g),g.isCancellationRequested)return;const p=e.filter(v=>this.isSupportedPasteProvider(v,i));if(!p.length||p.length===1&&p[0]instanceof Vw)return this.applyDefaultPasteHandler(i,r,g,s);const m={triggerKind:sN.Automatic},_=await this.getPasteEdits(p,i,d,t,m,g);if(h.add(_),g.isCancellationRequested)return;if(_.edits.length===1&&_.edits[0].provider instanceof Vw)return this.applyDefaultPasteHandler(i,r,g,s);if(_.edits.length){const v=u.getOption(85).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:0,allEdits:_.edits},v,(y,C)=>new Promise((x,k)=>{(async()=>{try{const L=y.provider.resolveDocumentPasteEdit?.(y,C),D=new KL,I=L&&await this._pasteProgressManager.showWhile(t[0].getEndPosition(),w("resolveProcess","Resolving paste edit. Click to cancel"),Promise.race([D.p,L]),{cancel:()=>(D.cancel(),k(new sf))},0);return I&&(y.additionalEdit=I.additionalEdit),x(y)}catch(L){return k(L)}})()}),g)}await this.applyDefaultPasteHandler(i,r,g,s)}finally{h.dispose(),this._currentPasteOperation===l&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),w("pasteIntoEditorProgress","Running paste handlers. Click to cancel and do basic paste"),l,{cancel:async()=>{try{if(l.cancel(),a.token.isCancellationRequested)return;await this.applyDefaultPasteHandler(i,r,a.token,s)}finally{a.dispose()}}}).then(()=>{a.dispose()}),this._currentPasteOperation=l}showPasteAsPick(e,t,i,r,s){const o=ko(async a=>{const l=this._editor;if(!l.hasModel())return;const c=l.getModel(),u=new ke,d=u.add(new Pb(l,3,void 0,a));try{if(await this.mergeInDataFromCopy(r,s,d.token),d.token.isCancellationRequested)return;let h=t.filter(_=>this.isSupportedPasteProvider(_,r,e));e&&(h=h.filter(_=>this.providerMatchesPreference(_,e)));const f={triggerKind:sN.PasteAs,only:e&&e instanceof sr?e:void 0};let g=u.add(await this.getPasteEdits(h,r,c,i,f,d.token));if(d.token.isCancellationRequested)return;if(e&&(g={edits:g.edits.filter(_=>e instanceof sr?e.contains(_.kind):e.providerId===_.provider.id),dispose:g.dispose}),!g.edits.length){f.only&&this.showPasteAsNoEditMessage(i,f.only);return}let p;if(e?p=g.edits.at(0):p=(await this._quickInputService.pick(g.edits.map(v=>({label:v.title,description:v.kind?.value,edit:v})),{placeHolder:w("pasteAsPickerPlaceholder","Select Paste Action")}))?.edit,!p)return;const m=O9e(c.uri,i,p);await this._bulkEditService.apply(m,{editor:this._editor})}finally{u.dispose(),this._currentPasteOperation===o&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:w("pasteAsProgress","Running paste handlers")},()=>o)}setCopyMetadata(e,t){e.setData(Fq,JSON.stringify(t))}fetchCopyMetadata(e){if(!e.clipboardData)return;const t=e.clipboardData.getData(Fq);if(t)try{return JSON.parse(t)}catch{return}const[i,r]=AJ.getTextData(e.clipboardData);if(r)return{defaultPastePayload:{mode:r.mode,multicursorText:r.multicursorText??null,pasteOnNewLine:!!r.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,i){if(t?.id&&X1._currentCopyOperation?.handle===t.id){const r=await X1._currentCopyOperation.dataTransferPromise;if(i.isCancellationRequested)return;for(const[s,o]of r)e.replace(s,o)}if(!e.has(ps.uriList)){const r=await this._clipboardService.readResources();if(i.isCancellationRequested)return;r.length&&e.append(ps.uriList,Cue(lH.create(r)))}}async getPasteEdits(e,t,i,r,s,o){const a=new ke,l=await YP(Promise.all(e.map(async u=>{try{const d=await u.provideDocumentPasteEdits?.(i,r,t,s,o);return d&&a.add(d),d?.edits?.map(h=>({...h,provider:u}))}catch(d){uh(d)||console.error(d);return}})),o),c=rf(l??[]).flat().filter(u=>!s.only||s.only.contains(u.kind));return{edits:M9e(c),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,r){const o=await(e.get(ps.text)??e.get("text"))?.asString()??"";if(i.isCancellationRequested)return;const a={clipboardEvent:r,text:o,pasteOnNewLine:t?.defaultPastePayload.pasteOnNewLine??!1,multicursorText:t?.defaultPastePayload.multicursorText??null,mode:null};this._editor.trigger("keyboard","paste",a)}isSupportedPasteProvider(e,t,i){return e.pasteMimeTypes?.some(r=>t.matches(r))?!i||this.providerMatchesPreference(e,i):!1}providerMatchesPreference(e,t){return t instanceof sr?e.providedPasteEditKinds?e.providedPasteEditKinds.some(i=>t.contains(i)):!0:e.id===t.providerId}};t0=X1=B4t([bx(1,Tt),bx(2,rO),bx(3,b0),bx(4,dt),bx(5,hh),bx(6,tFe)],t0);const Uw="9_cutcopypaste",$4t=hg||document.queryCommandSupported("cut"),$9e=hg||document.queryCommandSupported("copy"),W4t=typeof navigator.clipboard>"u"||Xd?document.queryCommandSupported("paste"):!0;function Tue(n){return n.register(),n}const H4t=$4t?Tue(new ZL({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:hg?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:ce.MenubarEditMenu,group:"2_ccp",title:w({key:"miCut",comment:["&& denotes a mnemonic"]},"Cu&&t"),order:1},{menuId:ce.EditorContext,group:Uw,title:w("actions.clipboard.cutLabel","Cut"),when:Q.writable,order:1},{menuId:ce.CommandPalette,group:"",title:w("actions.clipboard.cutLabel","Cut"),order:1},{menuId:ce.SimpleEditorContext,group:Uw,title:w("actions.clipboard.cutLabel","Cut"),when:Q.writable,order:1}]})):void 0,V4t=$9e?Tue(new ZL({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:hg?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:ce.MenubarEditMenu,group:"2_ccp",title:w({key:"miCopy",comment:["&& denotes a mnemonic"]},"&&Copy"),order:2},{menuId:ce.EditorContext,group:Uw,title:w("actions.clipboard.copyLabel","Copy"),order:2},{menuId:ce.CommandPalette,group:"",title:w("actions.clipboard.copyLabel","Copy"),order:1},{menuId:ce.SimpleEditorContext,group:Uw,title:w("actions.clipboard.copyLabel","Copy"),order:2}]})):void 0;Fo.appendMenuItem(ce.MenubarEditMenu,{submenu:ce.MenubarCopy,title:Gt("copy as","Copy As"),group:"2_ccp",order:3});Fo.appendMenuItem(ce.EditorContext,{submenu:ce.EditorContextCopy,title:Gt("copy as","Copy As"),group:Uw,order:3});Fo.appendMenuItem(ce.EditorContext,{submenu:ce.EditorContextShare,title:Gt("share","Share"),group:"11_share",order:-1,when:Le.and(Le.notEquals("resourceScheme","output"),Q.editorTextFocus)});Fo.appendMenuItem(ce.ExplorerContext,{submenu:ce.ExplorerContextShare,title:Gt("share","Share"),group:"11_share",order:-1});const Bq=W4t?Tue(new ZL({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:hg?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:ce.MenubarEditMenu,group:"2_ccp",title:w({key:"miPaste",comment:["&& denotes a mnemonic"]},"&&Paste"),order:4},{menuId:ce.EditorContext,group:Uw,title:w("actions.clipboard.pasteLabel","Paste"),when:Q.writable,order:4},{menuId:ce.CommandPalette,group:"",title:w("actions.clipboard.pasteLabel","Paste"),order:1},{menuId:ce.SimpleEditorContext,group:Uw,title:w("actions.clipboard.pasteLabel","Paste"),when:Q.writable,order:4}]})):void 0;class z4t extends ot{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:w("actions.clipboard.copyWithSyntaxHighlightingLabel","Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:0,weight:100}})}run(e,t){!t.hasModel()||!t.getOption(37)&&t.getSelection().isEmpty()||(DJ.forceCopyWithSyntaxHighlighting=!0,t.focus(),t.getContainerDomNode().ownerDocument.execCommand("copy"),DJ.forceCopyWithSyntaxHighlighting=!1)}}function W9e(n,e){n&&(n.addImplementation(1e4,"code-editor",(t,i)=>{const r=t.get(ai).getFocusedCodeEditor();if(r&&r.hasTextFocus()){const s=r.getOption(37),o=r.getSelection();return o&&o.isEmpty()&&!s||r.getContainerDomNode().ownerDocument.execCommand(e),!0}return!1}),n.addImplementation(0,"generic-dom",(t,i)=>(GL().execCommand(e),!0)))}W9e(H4t,"cut");W9e(V4t,"copy");Bq&&(Bq.addImplementation(1e4,"code-editor",(n,e)=>{const t=n.get(ai),i=n.get(b0),r=t.getFocusedCodeEditor();return r&&r.hasTextFocus()?r.getContainerDomNode().ownerDocument.execCommand("paste")?t0.get(r)?.finishedPaste()??Promise.resolve():pC?(async()=>{const o=await i.readText();if(o!==""){const a=jN.INSTANCE.get(o);let l=!1,c=null,u=null;a&&(l=r.getOption(37)&&!!a.isFromEmptySelection,c=typeof a.multicursorText<"u"?a.multicursorText:null,u=a.mode),r.trigger("keyboard","paste",{text:o,pasteOnNewLine:l,multicursorText:c,mode:u})}})():!0:!1}),Bq.addImplementation(0,"generic-dom",(n,e)=>(GL().execCommand("paste"),!0)));$9e&&Pe(z4t);const Dr=new class{constructor(){this.QuickFix=new sr("quickfix"),this.Refactor=new sr("refactor"),this.RefactorExtract=this.Refactor.append("extract"),this.RefactorInline=this.Refactor.append("inline"),this.RefactorMove=this.Refactor.append("move"),this.RefactorRewrite=this.Refactor.append("rewrite"),this.Notebook=new sr("notebook"),this.Source=new sr("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var hu;(function(n){n.Refactor="refactor",n.RefactorPreview="refactor preview",n.Lightbulb="lightbulb",n.Default="other (default)",n.SourceAction="source action",n.QuickFix="quick fix action",n.FixAll="fix all",n.OrganizeImports="organize imports",n.AutoFix="auto fix",n.QuickFixHover="quick fix hover window",n.OnSave="save participants",n.ProblemsView="problems view"})(hu||(hu={}));function U4t(n,e){return!(n.include&&!n.include.intersects(e)||n.excludes&&n.excludes.some(t=>H9e(e,t,n.include))||!n.includeSourceActions&&Dr.Source.contains(e))}function j4t(n,e){const t=e.kind?new sr(e.kind):void 0;return!(n.include&&(!t||!n.include.contains(t))||n.excludes&&t&&n.excludes.some(i=>H9e(t,i,n.include))||!n.includeSourceActions&&t&&Dr.Source.contains(t)||n.onlyIncludePreferredActions&&!e.isPreferred)}function H9e(n,e,t){return!(!e.contains(n)||t&&e.contains(t))}class xp{static fromUser(e,t){return!e||typeof e!="object"?new xp(t.kind,t.apply,!1):new xp(xp.getKindFromUser(e,t.kind),xp.getApplyFromUser(e,t.apply),xp.getPreferredUser(e))}static getApplyFromUser(e,t){switch(typeof e.apply=="string"?e.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return t}}static getKindFromUser(e,t){return typeof e.kind=="string"?new sr(e.kind):t}static getPreferredUser(e){return typeof e.preferred=="boolean"?e.preferred:!1}constructor(e,t,i){this.kind=e,this.apply=t,this.preferred=i}}class q4t{constructor(e,t,i){this.action=e,this.provider=t,this.highlightRange=i}async resolve(e){if(this.provider?.resolveCodeAction&&!this.action.edit){let t;try{t=await this.provider.resolveCodeAction(this.action,e)}catch(i){vs(i)}t&&(this.action.edit=t.edit)}return this}}const V9e="editor.action.codeAction",Due="editor.action.quickFix",z9e="editor.action.autoFix",U9e="editor.action.refactor",j9e="editor.action.sourceAction",pee="editor.action.organizeImports",mee="editor.action.fixAll";class VI extends me{static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:bl(e.diagnostics)?bl(t.diagnostics)?VI.codeActionsPreferredComparator(e,t):-1:bl(t.diagnostics)?1:VI.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(VI.codeActionsComparator),this.validActions=this.allActions.filter(({action:r})=>!r.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&Dr.QuickFix.contains(new sr(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}}const vCe={actions:[],documentation:void 0};async function MS(n,e,t,i,r,s){const o=i.filter||{},a={...o,excludes:[...o.excludes||[],Dr.Notebook]},l={only:o.include?.value,trigger:i.type},c=new pue(e,s),u=i.type===2,d=K4t(n,e,u?a:o),h=new ke,f=d.map(async p=>{try{r.report(p);const m=await p.provideCodeActions(e,t,l,c.token);if(m&&h.add(m),c.token.isCancellationRequested)return vCe;const _=(m?.actions||[]).filter(y=>y&&j4t(o,y)),v=Y4t(p,_,o.include);return{actions:_.map(y=>new q4t(y,p)),documentation:v}}catch(m){if(uh(m))throw m;return vs(m),vCe}}),g=n.onDidChange(()=>{const p=n.all(e);$r(p,d)||c.cancel()});try{const p=await Promise.all(f),m=p.map(v=>v.actions).flat(),_=[...rf(p.map(v=>v.documentation)),...G4t(n,e,i,m)];return new VI(m,_,h)}finally{g.dispose(),c.dispose()}}function K4t(n,e,t){return n.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(r=>U4t(t,new sr(r))):!0)}function*G4t(n,e,t,i){if(e&&i.length)for(const r of n.all(e))r._getAdditionalMenuItems&&(yield*r._getAdditionalMenuItems?.({trigger:t.type,only:t.filter?.include?.value},i.map(s=>s.action)))}function Y4t(n,e,t){if(!n.documentation)return;const i=n.documentation.map(r=>({kind:new sr(r.kind),command:r.command}));if(t){let r;for(const s of i)s.kind.contains(t)&&(r?r.kind.contains(s.kind)&&(r=s):r=s);if(r)return r?.command}for(const r of e)if(r.kind){for(const s of i)if(s.kind.contains(new sr(r.kind)))return s.command}}var Oy;(function(n){n.OnSave="onSave",n.FromProblemsView="fromProblemsView",n.FromCodeActions="fromCodeActions",n.FromAILightbulb="fromAILightbulb"})(Oy||(Oy={}));async function Z4t(n,e,t,i,r=yn.None){const s=n.get(rO),o=n.get(_r),a=n.get(Qa),l=n.get(Ts);if(a.publicLog2("codeAction.applyCodeAction",{codeActionTitle:e.action.title,codeActionKind:e.action.kind,codeActionIsPreferred:!!e.action.isPreferred,reason:t}),await e.resolve(r),!r.isCancellationRequested&&!(e.action.edit?.edits.length&&!(await s.apply(e.action.edit,{editor:i?.editor,label:e.action.title,quotableLabel:e.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:t!==Oy.OnSave,showPreview:i?.preview})).isApplied)&&e.action.command)try{await o.executeCommand(e.action.command.id,...e.action.command.arguments||[])}catch(c){const u=X4t(c);l.error(typeof u=="string"?u:w("applyCodeActionFailed","An unknown error occurred while applying the code action"))}}function X4t(n){return typeof n=="string"?n:n instanceof Error&&typeof n.message=="string"?n.message:void 0}Un.registerCommand("_executeCodeActionProvider",async function(n,e,t,i,r){if(!(e instanceof Pt))throw qd();const{codeActionProvider:s}=n.get(dt),o=n.get(Sr).getModel(e);if(!o)throw qd();const a=yt.isISelection(t)?yt.liftSelection(t):$.isIRange(t)?o.validateRange(t):void 0;if(!a)throw qd();const l=typeof i=="string"?new sr(i):void 0,c=await MS(s,o,a,{type:1,triggerAction:hu.Default,filter:{includeSourceActions:!0,include:l}},p_.None,yn.None),u=[],d=Math.min(c.validActions.length,typeof r=="number"?r:0);for(let h=0;hh.action)}finally{setTimeout(()=>c.dispose(),100)}});var Q4t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},J4t=function(n,e){return function(t,i){e(t,i,n)}},_ee;let vee=class{static{_ee=this}static{this.codeActionCommands=[U9e,V9e,j9e,pee,mee]}constructor(e){this.keybindingService=e}getResolver(){const e=new kg(()=>this.keybindingService.getKeybindings().filter(t=>_ee.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===pee?i={kind:Dr.SourceOrganizeImports.value}:t.command===mee&&(i={kind:Dr.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...xp.fromUser(i,{kind:sr.None,apply:"never"})}}));return t=>{if(t.kind)return this.bestKeybindingForCodeAction(t,e.value)?.resolvedKeybinding}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;const i=new sr(e.kind);return t.filter(r=>r.kind.contains(i)).filter(r=>r.preferred?e.isPreferred:!0).reduceRight((r,s)=>r?r.kind.contains(s.kind)?s:r:s,void 0)}};vee=_ee=Q4t([J4t(0,xi)],vee);J("symbolIcon.arrayForeground",In,w("symbolIcon.arrayForeground","The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.booleanForeground",In,w("symbolIcon.booleanForeground","The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.classForeground","The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.colorForeground",In,w("symbolIcon.colorForeground","The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.constantForeground",In,w("symbolIcon.constantForeground","The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.constructorForeground","The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.enumeratorForeground","The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.enumeratorMemberForeground","The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},w("symbolIcon.eventForeground","The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.fieldForeground","The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.fileForeground",In,w("symbolIcon.fileForeground","The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.folderForeground",In,w("symbolIcon.folderForeground","The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.functionForeground","The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.interfaceForeground","The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.keyForeground",In,w("symbolIcon.keyForeground","The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.keywordForeground",In,w("symbolIcon.keywordForeground","The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},w("symbolIcon.methodForeground","The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.moduleForeground",In,w("symbolIcon.moduleForeground","The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.namespaceForeground",In,w("symbolIcon.namespaceForeground","The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.nullForeground",In,w("symbolIcon.nullForeground","The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.numberForeground",In,w("symbolIcon.numberForeground","The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.objectForeground",In,w("symbolIcon.objectForeground","The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.operatorForeground",In,w("symbolIcon.operatorForeground","The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.packageForeground",In,w("symbolIcon.packageForeground","The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.propertyForeground",In,w("symbolIcon.propertyForeground","The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.referenceForeground",In,w("symbolIcon.referenceForeground","The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.snippetForeground",In,w("symbolIcon.snippetForeground","The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.stringForeground",In,w("symbolIcon.stringForeground","The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.structForeground",In,w("symbolIcon.structForeground","The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.textForeground",In,w("symbolIcon.textForeground","The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.typeParameterForeground",In,w("symbolIcon.typeParameterForeground","The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.unitForeground",In,w("symbolIcon.unitForeground","The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));J("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},w("symbolIcon.variableForeground","The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const q9e=Object.freeze({kind:sr.Empty,title:w("codeAction.widget.id.more","More Actions...")}),e3t=Object.freeze([{kind:Dr.QuickFix,title:w("codeAction.widget.id.quickfix","Quick Fix")},{kind:Dr.RefactorExtract,title:w("codeAction.widget.id.extract","Extract"),icon:ze.wrench},{kind:Dr.RefactorInline,title:w("codeAction.widget.id.inline","Inline"),icon:ze.wrench},{kind:Dr.RefactorRewrite,title:w("codeAction.widget.id.convert","Rewrite"),icon:ze.wrench},{kind:Dr.RefactorMove,title:w("codeAction.widget.id.move","Move"),icon:ze.wrench},{kind:Dr.SurroundWith,title:w("codeAction.widget.id.surround","Surround With"),icon:ze.surroundWith},{kind:Dr.Source,title:w("codeAction.widget.id.source","Source Action"),icon:ze.symbolFile},q9e]);function t3t(n,e,t){if(!e)return n.map(s=>({kind:"action",item:s,group:q9e,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!s.action.edit?.edits.length}));const i=e3t.map(s=>({group:s,actions:[]}));for(const s of n){const o=s.action.kind?new sr(s.action.kind):sr.None;for(const a of i)if(a.group.kind.contains(o)){a.actions.push(s);break}}const r=[];for(const s of i)if(s.actions.length){r.push({kind:"header",group:s.group});for(const o of s.actions){const a=s.group;r.push({kind:"action",item:o,group:o.action.isAI?{title:a.title,kind:a.kind,icon:ze.sparkle}:a,label:o.action.title,disabled:!!o.action.disabled,keybinding:t(o.action)})}}return r}var n3t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},i3t=function(n,e){return function(t,i){e(t,i,n)}},Zx;const bCe=kr("gutter-lightbulb",ze.lightBulb,w("gutterLightbulbWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor.")),yCe=kr("gutter-lightbulb-auto-fix",ze.lightbulbAutofix,w("gutterLightbulbAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")),wCe=kr("gutter-lightbulb-sparkle",ze.lightbulbSparkle,w("gutterLightbulbAIFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")),CCe=kr("gutter-lightbulb-aifix-auto-fix",ze.lightbulbSparkleAutofix,w("gutterLightbulbAIFixAutoFixWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")),xCe=kr("gutter-lightbulb-sparkle-filled",ze.sparkleFilled,w("gutterLightbulbSparkleFilledWidget","Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available."));var Of;(function(n){n.Hidden={type:0};class e{constructor(i,r,s,o){this.actions=i,this.trigger=r,this.editorPosition=s,this.widgetPosition=o,this.type=1}}n.Showing=e})(Of||(Of={}));let rR=class extends me{static{Zx=this}static{this.GUTTER_DECORATION=un.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:zt.asClassName(ze.lightBulb),glyphMargin:{position:af.Left},stickiness:1})}static{this.ID="editor.contrib.lightbulbWidget"}static{this._posPref=[0]}constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new fe),this.onClick=this._onClick.event,this._state=Of.Hidden,this._gutterState=Of.Hidden,this._iconClasses=[],this.lightbulbClasses=["codicon-"+bCe.id,"codicon-"+CCe.id,"codicon-"+yCe.id,"codicon-"+wCe.id,"codicon-"+xCe.id],this.gutterDecoration=Zx.GUTTER_DECORATION,this._domNode=qe("div.lightBulbWidget"),this._domNode.role="listbox",this._register(Fr.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(i=>{const r=this._editor.getModel();(this.state.type!==1||!r||this.state.editorPosition.lineNumber>=r.getLineCount())&&this.hide(),(this.gutterState.type!==1||!r||this.gutterState.editorPosition.lineNumber>=r.getLineCount())&&this.gutterHide()})),this._register(m0t(this._domNode,i=>{if(this.state.type!==1)return;this._editor.focus(),i.preventDefault();const{top:r,height:s}=ms(this._domNode),o=this._editor.getOption(67);let a=Math.floor(o/3);this.state.widgetPosition.position!==null&&this.state.widgetPosition.position.lineNumber{(i.buttons&1)===1&&this.hide()})),this._register(Ge.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel=this._keybindingService.lookupKeybinding(z9e)?.getLabel()??void 0,this._quickFixKbLabel=this._keybindingService.lookupKeybinding(Due)?.getLabel()??void 0,this._updateLightBulbTitleAndIcon()})),this._register(this._editor.onMouseDown(async i=>{if(!i.target.element||!this.lightbulbClasses.some(l=>i.target.element&&i.target.element.classList.contains(l))||this.gutterState.type!==1)return;this._editor.focus();const{top:r,height:s}=ms(i.target.element),o=this._editor.getOption(67);let a=Math.floor(o/3);this.gutterState.widgetPosition.position!==null&&this.gutterState.widgetPosition.position.lineNumber22,g=x=>x>2&&this._editor.getTopForLineNumber(x)===this._editor.getTopForLineNumber(x-1),p=this._editor.getLineDecorations(a);let m=!1;if(p)for(const x of p){const k=x.options.glyphMarginClassName;if(k&&!this.lightbulbClasses.some(L=>k.includes(L))){m=!0;break}}let _=a,v=1;if(!f){const x=k=>{const L=o.getLineContent(k);return/^\s*$|^\s+/.test(L)||L.length<=v};if(a>1&&!g(a-1)){const k=o.getLineCount(),L=a===k,D=a>1&&x(a-1),I=!L&&x(a+1),O=x(a),M=!I&&!D;if(!I&&!D&&!m)return this.gutterState=new Of.Showing(e,t,i,{position:{lineNumber:_,column:v},preference:Zx._posPref}),this.renderGutterLightbub(),this.hide();D||L||D&&!O?_-=1:(I||M&&O)&&(_+=1)}else if(a===1&&(a===o.getLineCount()||!x(a+1)&&!x(a)))if(this.gutterState=new Of.Showing(e,t,i,{position:{lineNumber:_,column:v},preference:Zx._posPref}),m)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(a{this._gutterDecorationID=t.addDecoration(new $(e,0,e,0),this.gutterDecoration)})}_removeGutterDecoration(e){this._editor.changeDecorations(t=>{t.removeDecoration(e),this._gutterDecorationID=void 0})}_updateGutterDecoration(e,t){this._editor.changeDecorations(i=>{i.changeDecoration(e,new $(t,0,t,0)),i.changeDecorationOptions(e,this.gutterDecoration)})}_updateLightbulbTitle(e,t){this.state.type===1&&(t?this.title=w("codeActionAutoRun","Run: {0}",this.state.actions.validActions[0].action.title):e&&this._preferredKbLabel?this.title=w("preferredcodeActionWithKb","Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):!e&&this._quickFixKbLabel?this.title=w("codeActionWithKb","Show Code Actions ({0})",this._quickFixKbLabel):e||(this.title=w("codeAction","Show Code Actions")))}set title(e){this._domNode.title=e}};rR=Zx=n3t([i3t(1,xi)],rR);var K9e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},bee=function(n,e){return function(t,i){e(t,i,n)}};const G9e="acceptSelectedCodeAction",Y9e="previewSelectedCodeAction";class r3t{get templateId(){return"header"}renderTemplate(e){e.classList.add("group-header");const t=document.createElement("span");return e.append(t),{container:e,text:t}}renderElement(e,t,i){i.text.textContent=e.group?.title??""}disposeTemplate(e){}}let yee=class{get templateId(){return"action"}constructor(e,t){this._supportsPreview=e,this._keybindingService=t}renderTemplate(e){e.classList.add(this.templateId);const t=document.createElement("div");t.className="icon",e.append(t);const i=document.createElement("span");i.className="title",e.append(i);const r=new l2(e,eu);return{container:e,icon:t,text:i,keybinding:r}}renderElement(e,t,i){if(e.group?.icon?(i.icon.className=zt.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=it(e.group.icon.color.id))):(i.icon.className=zt.asClassName(ze.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;i.text.textContent=Z9e(e.label),i.keybinding.set(e.keybinding),A0t(!!e.keybinding,i.keybinding.element);const r=this._keybindingService.lookupKeybinding(G9e)?.getLabel(),s=this._keybindingService.lookupKeybinding(Y9e)?.getLabel();i.container.classList.toggle("option-disabled",e.disabled),e.disabled?i.container.title=e.label:r&&s?this._supportsPreview&&e.canPreview?i.container.title=w({key:"label-preview",comment:['placeholders are keybindings, e.g "F2 to Apply, Shift+F2 to Preview"']},"{0} to Apply, {1} to Preview",r,s):i.container.title=w({key:"label",comment:['placeholder is a keybinding, e.g "F2 to Apply"']},"{0} to Apply",r):i.container.title=""}disposeTemplate(e){e.keybinding.dispose()}};yee=K9e([bee(1,xi)],yee);class s3t extends UIEvent{constructor(){super("acceptSelectedAction")}}class SCe extends UIEvent{constructor(){super("previewSelectedAction")}}function o3t(n){if(n.kind==="action")return n.label}let wee=class extends me{constructor(e,t,i,r,s,o){super(),this._delegate=r,this._contextViewService=s,this._keybindingService=o,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new Kr),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const a={getHeight:l=>l.kind==="header"?this._headerLineHeight:this._actionLineHeight,getTemplateId:l=>l.kind};this._list=this._register(new dd(e,this.domNode,a,[new yee(t,this._keybindingService),new r3t],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:o3t},accessibilityProvider:{getAriaLabel:l=>{if(l.kind==="action"){let c=l.label?Z9e(l?.label):"";return l.disabled&&(c=w({key:"customQuickFixWidget.labels",comment:["Action widget labels for accessibility."]},"{0}, Disabled Reason: {1}",c,l.disabled)),c}return null},getWidgetAriaLabel:()=>w({key:"customQuickFixWidget",comment:["An action widget option"]},"Action Widget"),getRole:l=>l.kind==="action"?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(yC),this._register(this._list.onMouseClick(l=>this.onListClick(l))),this._register(this._list.onMouseOver(l=>this.onListHover(l))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(l=>this.onListSelection(l))),this._allMenuItems=i,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(e){return!e.disabled&&e.kind==="action"}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._contextViewService.hideContextView()}layout(e){const t=this._allMenuItems.filter(l=>l.kind==="header").length,r=this._allMenuItems.length*this._actionLineHeight+t*this._headerLineHeight-t*this._actionLineHeight;this._list.layout(r);let s=e;if(this._allMenuItems.length>=50)s=380;else{const l=this._allMenuItems.map((c,u)=>{const d=this.domNode.ownerDocument.getElementById(this._list.getElementID(u));if(d){d.style.width="auto";const h=d.getBoundingClientRect().width;return d.style.width="",h}return 0});s=Math.max(...l,e)}const a=Math.min(r,this.domNode.ownerDocument.body.clientHeight*.7);return this._list.layout(a,s),this.domNode.style.height=`${a}px`,this._list.domFocus(),s}focusPrevious(){this._list.focusPrevious(1,!0,void 0,this.focusCondition)}focusNext(){this._list.focusNext(1,!0,void 0,this.focusCondition)}acceptSelected(e){const t=this._list.getFocus();if(t.length===0)return;const i=t[0],r=this._list.element(i);if(!this.focusCondition(r))return;const s=e?new SCe:new s3t;this._list.setSelection([i],s)}onListSelection(e){if(!e.elements.length)return;const t=e.elements[0];t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof SCe):this._list.setSelection([])}onFocus(){const e=this._list.getFocus();if(e.length===0)return;const t=e[0],i=this._list.element(t);this._delegate.onFocus?.(i.item)}async onListHover(e){const t=e.element;if(t&&t.item&&this.focusCondition(t)){if(this._delegate.onHover&&!t.disabled&&t.kind==="action"){const i=await this._delegate.onHover(t.item,this.cts.token);t.canPreview=i?i.canPreview:void 0}e.index&&this._list.splice(e.index,1,[t])}this._list.setFocus(typeof e.index=="number"?[e.index]:[])}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};wee=K9e([bee(4,m0),bee(5,xi)],wee);function Z9e(n){return n.replace(/\r\n|\r|\n/g," ")}var a3t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},$q=function(n,e){return function(t,i){e(t,i,n)}};J("actionBar.toggledBackground",eO,w("actionBar.toggledBackground","Background color for toggled action items in action bar."));const jw={Visible:new et("codeActionMenuVisible",!1,w("codeActionMenuVisible","Whether the action widget list is visible"))},LC=On("actionWidgetService");let qw=class extends me{get isVisible(){return jw.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new To)}show(e,t,i,r,s,o,a){const l=jw.Visible.bindTo(this._contextKeyService),c=this._instantiationService.createInstance(wee,e,t,i,r);this._contextViewService.showContextView({getAnchor:()=>s,render:u=>(l.set(!0),this._renderWidget(u,c,a??[])),onHide:u=>{l.reset(),this._onWidgetClosed(u)}},o,!1)}acceptSelected(e){this._list.value?.acceptSelected(e)}focusPrevious(){this._list?.value?.focusPrevious()}focusNext(){this._list?.value?.focusNext()}hide(e){this._list.value?.hide(e),this._list.clear()}_renderWidget(e,t,i){const r=document.createElement("div");if(r.classList.add("action-widget"),e.appendChild(r),this._list.value=t,this._list.value)r.appendChild(this._list.value.domNode);else throw new Error("List has no value");const s=new ke,o=document.createElement("div"),a=e.appendChild(o);a.classList.add("context-view-block"),s.add(Ce(a,je.MOUSE_DOWN,f=>f.stopPropagation()));const l=document.createElement("div"),c=e.appendChild(l);c.classList.add("context-view-pointerBlock"),s.add(Ce(c,je.POINTER_MOVE,()=>c.remove())),s.add(Ce(c,je.MOUSE_DOWN,()=>c.remove()));let u=0;if(i.length){const f=this._createActionBar(".action-widget-action-bar",i);f&&(r.appendChild(f.getContainer().parentElement),s.add(f),u=f.getContainer().offsetWidth)}const d=this._list.value?.layout(u);r.style.width=`${d}px`;const h=s.add(Eg(e));return s.add(h.onDidBlur(()=>this.hide(!0))),s}_createActionBar(e,t){if(!t.length)return;const i=qe(e),r=new ed(i);return r.push(t,{icon:!1,label:!0}),r}_onWidgetClosed(e){this._list.value?.hide(e)}};qw=a3t([$q(0,m0),$q(1,jt),$q(2,Tt)],qw);Vn(LC,qw,1);const xO=1100;lr(class extends Gl{constructor(){super({id:"hideCodeActionWidget",title:Gt("hideCodeActionWidget.title","Hide action widget"),precondition:jw.Visible,keybinding:{weight:xO,primary:9,secondary:[1033]}})}run(n){n.get(LC).hide(!0)}});lr(class extends Gl{constructor(){super({id:"selectPrevCodeAction",title:Gt("selectPrevCodeAction.title","Select previous action"),precondition:jw.Visible,keybinding:{weight:xO,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(n){const e=n.get(LC);e instanceof qw&&e.focusPrevious()}});lr(class extends Gl{constructor(){super({id:"selectNextCodeAction",title:Gt("selectNextCodeAction.title","Select next action"),precondition:jw.Visible,keybinding:{weight:xO,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(n){const e=n.get(LC);e instanceof qw&&e.focusNext()}});lr(class extends Gl{constructor(){super({id:G9e,title:Gt("acceptSelected.title","Accept selected action"),precondition:jw.Visible,keybinding:{weight:xO,primary:3,secondary:[2137]}})}run(n){const e=n.get(LC);e instanceof qw&&e.acceptSelected()}});lr(class extends Gl{constructor(){super({id:Y9e,title:Gt("previewSelected.title","Preview selected action"),precondition:jw.Visible,keybinding:{weight:xO,primary:2051}})}run(n){const e=n.get(LC);e instanceof qw&&e.acceptSelected(!0)}});const X9e=new et("supportedCodeAction",""),kCe="_typescript.applyFixAllCodeAction";class l3t extends me{constructor(e,t,i,r=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=r,this._autoTriggerTimer=this._register(new hf),this._register(this._markerService.onMarkerChanged(s=>this._onMarkerChanges(s))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){const t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){const t=this._editor.getModel();t&&e.some(i=>kN(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:hu.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;const t=this._editor.getSelection();if(e.type===1)return t;const i=this._editor.getOption(65).enabled;if(i!==Oh.Off){{if(i===Oh.On)return t;if(i===Oh.OnCode){if(!t.isEmpty())return t;const s=this._editor.getModel(),{lineNumber:o,column:a}=t.getPosition(),l=s.getLineContent(o);if(l.length===0)return;if(a===1){if(/\s/.test(l[0]))return}else if(a===s.getLineMaxColumn(o)){if(/\s/.test(l[l.length-1]))return}else if(/\s/.test(l[a-2])&&/\s/.test(l[a-1]))return}}return t}}}var wy;(function(n){n.Empty={type:0};class e{constructor(i,r,s){this.trigger=i,this.position=r,this._cancellablePromise=s,this.type=1,this.actions=s.catch(o=>{if(uh(o))return Q9e;throw o})}cancel(){this._cancellablePromise.cancel()}}n.Triggered=e})(wy||(wy={}));const Q9e=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class c3t extends me{constructor(e,t,i,r,s,o,a){super(),this._editor=e,this._registry=t,this._markerService=i,this._progressService=s,this._configurationService=o,this._telemetryService=a,this._codeActionOracle=this._register(new To),this._state=wy.Empty,this._onDidChangeState=this._register(new fe),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=X9e.bindTo(r),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._register(this._editor.onDidChangeConfiguration(l=>{l.hasChanged(65)&&this._update()})),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(wy.Empty,!0))}_settingEnabledNearbyQuickfixes(){const e=this._editor?.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:e?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(wy.Empty);const e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(92)){const t=this._registry.all(e).flatMap(i=>i.providedCodeActionKinds??[]);this._supportedCodeActions.set(t.join(" ")),this._codeActionOracle.value=new l3t(this._editor,this._markerService,i=>{if(!i){this.setState(wy.Empty);return}const r=i.selection.getStartPosition(),s=ko(async l=>{if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===hu.QuickFix||i.trigger.filter?.include?.contains(Dr.QuickFix))){const c=await MS(this._registry,e,i.selection,i.trigger,p_.None,l),u=[...c.allActions];if(l.isCancellationRequested)return Q9e;const d=c.validActions?.some(f=>f.action.kind?Dr.QuickFix.contains(new sr(f.action.kind)):!1),h=this._markerService.read({resource:e.uri});if(d){for(const f of c.validActions)f.action.command?.arguments?.some(g=>typeof g=="string"&&g.includes(kCe))&&(f.action.diagnostics=[...h.filter(g=>g.relatedInformation)]);return{validActions:c.validActions,allActions:u,documentation:c.documentation,hasAutoFix:c.hasAutoFix,hasAIFix:c.hasAIFix,allAIFixes:c.allAIFixes,dispose:()=>{c.dispose()}}}else if(!d&&h.length>0){const f=i.selection.getPosition();let g=f,p=Number.MAX_VALUE;const m=[...c.validActions];for(const v of h){const y=v.endColumn,C=v.endLineNumber,x=v.startLineNumber;if(C===f.lineNumber||x===f.lineNumber){g=new he(C,y);const k={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:i.trigger.filter?.include?i.trigger.filter?.include:Dr.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:i.trigger.context?.notAvailableMessage||"",position:g}},L=new yt(g.lineNumber,g.column,g.lineNumber,g.column),D=await MS(this._registry,e,L,k,p_.None,l);if(D.validActions.length!==0){for(const I of D.validActions)I.action.command?.arguments?.some(O=>typeof O=="string"&&O.includes(kCe))&&(I.action.diagnostics=[...h.filter(O=>O.relatedInformation)]);c.allActions.length===0&&u.push(...D.allActions),Math.abs(f.column-y)C.findIndex(x=>x.action.title===v.action.title)===y);return _.sort((v,y)=>v.action.isPreferred&&!y.action.isPreferred?-1:!v.action.isPreferred&&y.action.isPreferred||v.action.isAI&&!y.action.isAI?1:!v.action.isAI&&y.action.isAI?-1:0),{validActions:_,allActions:u,documentation:c.documentation,hasAutoFix:c.hasAutoFix,hasAIFix:c.hasAIFix,allAIFixes:c.allAIFixes,dispose:()=>{c.dispose()}}}}if(i.trigger.type===1){const c=new Bo,u=await MS(this._registry,e,i.selection,i.trigger,p_.None,l);return this._telemetryService&&this._telemetryService.publicLog2("codeAction.invokedDurations",{codeActions:u.validActions.length,duration:c.elapsed()}),u}return MS(this._registry,e,i.selection,i.trigger,p_.None,l)});i.trigger.type===1&&this._progressService?.showWhile(s,250);const o=new wy.Triggered(i.trigger,r,s);let a=!1;this._state.type===1&&(a=this._state.trigger.type===1&&o.type===1&&o.trigger.type===2&&this._state.position!==o.position),a?setTimeout(()=>{this.setState(o)},500):this.setState(o)},void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:hu.Default})}else this._supportedCodeActions.reset()}trigger(e){this._codeActionOracle.value?.trigger(e)}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}}var u3t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Jg=function(n,e){return function(t,i){e(t,i,n)}},Xx;const d3t="quickfix-edit-highlight";let DE=class extends me{static{Xx=this}static{this.ID="editor.contrib.codeActionController"}static get(e){return e.getContribution(Xx.ID)}constructor(e,t,i,r,s,o,a,l,c,u,d){super(),this._commandService=a,this._configurationService=l,this._actionWidgetService=c,this._instantiationService=u,this._telemetryService=d,this._activeCodeActions=this._register(new To),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new c3t(this._editor,s.codeActionProvider,t,i,o,l,this._telemetryService)),this._register(this._model.onDidChangeState(h=>this.update(h))),this._lightBulbWidget=new kg(()=>{const h=this._editor.getContribution(rR.ID);return h&&this._register(h.onClick(f=>this.showCodeActionsFromLightbulb(f.actions,f))),h}),this._resolver=r.createInstance(vee),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(e,t){if(e.allAIFixes&&e.validActions.length===1){const i=e.validActions[0],r=i.action.command;r&&r.id==="inlineChat.start"&&r.arguments&&r.arguments.length>=1&&(r.arguments[0]={...r.arguments[0],autoSend:!1}),await this._applyCodeAction(i,!1,!1,Oy.FromAILightbulb);return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,i){return this.showCodeActionList(t,i,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(e,t,i,r){if(!this._editor.hasModel())return;au.get(this._editor)?.closeMessage();const s=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:i,autoApply:r,context:{notAvailableMessage:e,position:s}})}_trigger(e){return this._model.trigger(e)}async _applyCodeAction(e,t,i,r){try{await this._instantiationService.invokeFunction(Z4t,e,r,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:hu.QuickFix,filter:{}})}}hideLightBulbWidget(){this._lightBulbWidget.rawValue?.hide(),this._lightBulbWidget.rawValue?.gutterHide()}async update(e){if(e.type!==1){this.hideLightBulbWidget();return}let t;try{t=await e.actions}catch(r){rn(r);return}if(!(this._disposed||this._editor.getSelection()?.startLineNumber!==e.position.lineNumber))if(this._lightBulbWidget.value?.update(t,e.trigger,e.position),e.trigger.type===1){if(e.trigger.filter?.include){const s=this.tryGetValidActionToApply(e.trigger,t);if(s){try{this.hideLightBulbWidget(),await this._applyCodeAction(s,!1,!1,Oy.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const o=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(o&&o.action.disabled){au.get(this._editor)?.showMessage(o.action.disabled,e.trigger.context.position),t.dispose();return}}}const r=!!e.trigger.filter?.include;if(e.trigger.context&&(!t.allActions.length||!r&&!t.validActions.length)){au.get(this._editor)?.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=t,t.dispose();return}this._activeCodeActions.value=t,this.showCodeActionList(t,this.toCoords(e.position),{includeDisabledActions:r,fromLightbulb:!1})}else this._actionWidgetService.isVisible?t.dispose():this._activeCodeActions.value=t}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:i})=>i.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}static{this.DECORATION=un.register({description:"quickfix-highlight",className:d3t})}async showCodeActionList(e,t,i){const r=this._editor.createDecorationsCollection(),s=this._editor.getDomNode();if(!s)return;const o=i.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!o.length)return;const a=he.isIPosition(t)?this.toCoords(t):t,l={onSelect:async(c,u)=>{this._applyCodeAction(c,!0,!!u,i.fromLightbulb?Oy.FromAILightbulb:Oy.FromCodeActions),this._actionWidgetService.hide(!1),r.clear()},onHide:c=>{this._editor?.focus(),r.clear()},onHover:async(c,u)=>{if(u.isCancellationRequested)return;let d=!1;const h=c.action.kind;if(h){const f=new sr(h);d=[Dr.RefactorExtract,Dr.RefactorInline,Dr.RefactorRewrite,Dr.RefactorMove,Dr.Source].some(p=>p.contains(f))}return{canPreview:d||!!c.action.edit?.edits.length}},onFocus:c=>{if(c&&c.action){const u=c.action.ranges,d=c.action.diagnostics;if(r.clear(),u&&u.length>0){const h=d&&d?.length>1?d.map(f=>({range:f,options:Xx.DECORATION})):u.map(f=>({range:f,options:Xx.DECORATION}));r.set(h)}else if(d&&d.length>0){const h=d.map(g=>({range:g,options:Xx.DECORATION}));r.set(h);const f=d[0];if(f.startLineNumber&&f.startColumn){const g=this._editor.getModel()?.getWordAtPosition({lineNumber:f.startLineNumber,column:f.startColumn})?.word;Qp(w("editingNewSelection","Context: {0} at line {1} and column {2}.",g,f.startLineNumber,f.startColumn))}}}else r.clear()}};this._actionWidgetService.show("codeActionWidget",!0,t3t(o,this._shouldShowHeaders(),this._resolver.getResolver()),l,a,s,this._getActionBarActions(e,t,i))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(e),i=ms(this._editor.getDomNode()),r=i.left+t.left,s=i.top+t.top+t.height;return{x:r,y:s}}_shouldShowHeaders(){const e=this._editor?.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:e?.uri})}_getActionBarActions(e,t,i){if(i.fromLightbulb)return[];const r=e.documentation.map(s=>({id:s.id,label:s.title,tooltip:s.tooltip??"",class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(s.id,...s.arguments??[])}));return i.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&r.push(this._showDisabled?{id:"hideMoreActions",label:w("hideMoreActions","Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:w("showMoreActions","Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),r}};DE=Xx=u3t([Jg(1,dm),Jg(2,jt),Jg(3,Tt),Jg(4,dt),Jg(5,Qb),Jg(6,_r),Jg(7,En),Jg(8,LC),Jg(9,Tt),Jg(10,Qa)],DE);dh((n,e)=>{((r,s)=>{s&&e.addRule(`.monaco-editor ${r} { background-color: ${s}; }`)})(".quickfix-edit-highlight",n.getColor(g_));const i=n.getColor(Av);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${mg(n.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function SO(n){return Le.regex(X9e.keys()[0],new RegExp("(\\s|^)"+nd(n.value)+"\\b"))}const Iue={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:w("args.schema.kind","Kind of the code action to run.")},apply:{type:"string",description:w("args.schema.apply","Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[w("args.schema.apply.first","Always apply the first returned code action."),w("args.schema.apply.ifSingle","Apply the first returned code action if it is the only one."),w("args.schema.apply.never","Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:w("args.schema.preferred","Controls if only preferred code actions should be returned.")}}};function TC(n,e,t,i,r=hu.Default){n.hasModel()&&DE.get(n)?.manualTriggerAtCurrentPosition(e,r,t,i)}class h3t extends ot{constructor(){super({id:Due,label:w("quickfix.trigger.label","Quick Fix..."),alias:"Quick Fix...",precondition:Le.and(Q.writable,Q.hasCodeActionsProvider),kbOpts:{kbExpr:Q.textInputFocus,primary:2137,weight:100}})}run(e,t){return TC(t,w("editor.action.quickFix.noneMessage","No code actions available"),void 0,void 0,hu.QuickFix)}}class f3t extends fo{constructor(){super({id:V9e,precondition:Le.and(Q.writable,Q.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:Iue}]}})}runEditorCommand(e,t,i){const r=xp.fromUser(i,{kind:sr.Empty,apply:"ifSingle"});return TC(t,typeof i?.kind=="string"?r.preferred?w("editor.action.codeAction.noneMessage.preferred.kind","No preferred code actions for '{0}' available",i.kind):w("editor.action.codeAction.noneMessage.kind","No code actions for '{0}' available",i.kind):r.preferred?w("editor.action.codeAction.noneMessage.preferred","No preferred code actions available"):w("editor.action.codeAction.noneMessage","No code actions available"),{include:r.kind,includeSourceActions:!0,onlyIncludePreferredActions:r.preferred},r.apply)}}class g3t extends ot{constructor(){super({id:U9e,label:w("refactor.label","Refactor..."),alias:"Refactor...",precondition:Le.and(Q.writable,Q.hasCodeActionsProvider),kbOpts:{kbExpr:Q.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Le.and(Q.writable,SO(Dr.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:Iue}]}})}run(e,t,i){const r=xp.fromUser(i,{kind:Dr.Refactor,apply:"never"});return TC(t,typeof i?.kind=="string"?r.preferred?w("editor.action.refactor.noneMessage.preferred.kind","No preferred refactorings for '{0}' available",i.kind):w("editor.action.refactor.noneMessage.kind","No refactorings for '{0}' available",i.kind):r.preferred?w("editor.action.refactor.noneMessage.preferred","No preferred refactorings available"):w("editor.action.refactor.noneMessage","No refactorings available"),{include:Dr.Refactor.contains(r.kind)?r.kind:sr.None,onlyIncludePreferredActions:r.preferred},r.apply,hu.Refactor)}}class p3t extends ot{constructor(){super({id:j9e,label:w("source.label","Source Action..."),alias:"Source Action...",precondition:Le.and(Q.writable,Q.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Le.and(Q.writable,SO(Dr.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:Iue}]}})}run(e,t,i){const r=xp.fromUser(i,{kind:Dr.Source,apply:"never"});return TC(t,typeof i?.kind=="string"?r.preferred?w("editor.action.source.noneMessage.preferred.kind","No preferred source actions for '{0}' available",i.kind):w("editor.action.source.noneMessage.kind","No source actions for '{0}' available",i.kind):r.preferred?w("editor.action.source.noneMessage.preferred","No preferred source actions available"):w("editor.action.source.noneMessage","No source actions available"),{include:Dr.Source.contains(r.kind)?r.kind:sr.None,includeSourceActions:!0,onlyIncludePreferredActions:r.preferred},r.apply,hu.SourceAction)}}class m3t extends ot{constructor(){super({id:pee,label:w("organizeImports.label","Organize Imports"),alias:"Organize Imports",precondition:Le.and(Q.writable,SO(Dr.SourceOrganizeImports)),kbOpts:{kbExpr:Q.textInputFocus,primary:1581,weight:100}})}run(e,t){return TC(t,w("editor.action.organize.noneMessage","No organize imports action available"),{include:Dr.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",hu.OrganizeImports)}}class _3t extends ot{constructor(){super({id:mee,label:w("fixAll.label","Fix All"),alias:"Fix All",precondition:Le.and(Q.writable,SO(Dr.SourceFixAll))})}run(e,t){return TC(t,w("fixAll.noneMessage","No fix all action available"),{include:Dr.SourceFixAll,includeSourceActions:!0},"ifSingle",hu.FixAll)}}class v3t extends ot{constructor(){super({id:z9e,label:w("autoFix.label","Auto Fix..."),alias:"Auto Fix...",precondition:Le.and(Q.writable,SO(Dr.QuickFix)),kbOpts:{kbExpr:Q.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return TC(t,w("editor.action.autoFix.noneMessage","No auto fixes available"),{include:Dr.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",hu.AutoFix)}}Zn(DE.ID,DE,3);Zn(rR.ID,rR,4);Pe(h3t);Pe(g3t);Pe(p3t);Pe(m3t);Pe(v3t);Pe(_3t);Je(new f3t);Yr.as(ff.Configuration).registerConfiguration({...sO,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:w("showCodeActionHeaders","Enable/disable showing group headers in the Code Action menu."),default:!0}}});Yr.as(ff.Configuration).registerConfiguration({...sO,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:w("includeNearbyQuickFixes","Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});Yr.as(ff.Configuration).registerConfiguration({...sO,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:5,markdownDescription:w("triggerOnFocusChange","Enable triggering {0} when {1} is set to {2}. Code Actions must be set to {3} to be triggered for window and focus changes.","`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});class Cee{constructor(){this.lenses=[],this._disposables=new ke}dispose(){this._disposables.dispose()}get isDisposed(){return this._disposables.isDisposed}add(e,t){this._disposables.add(e);for(const i of e.lenses)this.lenses.push({symbol:i,provider:t})}}async function J9e(n,e,t){const i=n.ordered(e),r=new Map,s=new Cee,o=i.map(async(a,l)=>{r.set(a,l);try{const c=await Promise.resolve(a.provideCodeLenses(e,t));c&&s.add(c,a)}catch(c){vs(c)}});return await Promise.all(o),s.lenses=s.lenses.sort((a,l)=>a.symbol.range.startLineNumberl.symbol.range.startLineNumber?1:r.get(a.provider)r.get(l.provider)?1:a.symbol.range.startColumnl.symbol.range.startColumn?1:0),s}Un.registerCommand("_executeCodeLensProvider",function(n,...e){let[t,i]=e;oi(Pt.isUri(t)),oi(typeof i=="number"||!i);const{codeLensProvider:r}=n.get(dt),s=n.get(Sr).getModel(t);if(!s)throw qd();const o=[],a=new ke;return J9e(r,s,yn.None).then(l=>{a.add(l);const c=[];for(const u of l.lenses)i==null||u.symbol.command?o.push(u.symbol):i-- >0&&u.provider.resolveCodeLens&&c.push(Promise.resolve(u.provider.resolveCodeLens(s,u.symbol,yn.None)).then(d=>o.push(d||u.symbol)));return Promise.all(c)}).then(()=>o).finally(()=>{setTimeout(()=>a.dispose(),100)})});var b3t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},y3t=function(n,e){return function(t,i){e(t,i,n)}};const e7e=On("ICodeLensCache");class ECe{constructor(e,t){this.lineCount=e,this.data=t}}let xee=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new lm(20,.75);const t="codelens/cache";xD(Xi,()=>e.remove(t,1));const i="codelens/cache2",r=e.get(i,1,"{}");this._deserialize(r);const s=Ge.filter(e.onWillSaveState,o=>o.reason===AN.SHUTDOWN);Ge.once(s)(o=>{e.store(i,this._serialize(),1,1)})}put(e,t){const i=t.lenses.map(o=>({range:o.symbol.range,command:o.symbol.command&&{id:"",title:o.symbol.command?.title}})),r=new Cee;r.add({lenses:i,dispose:()=>{}},this._fakeProvider);const s=new ECe(e.getLineCount(),r);this._cache.set(e.uri.toString(),s)}get(e){const t=this._cache.get(e.uri.toString());return t&&t.lineCount===e.getLineCount()?t.data:void 0}delete(e){this._cache.delete(e.uri.toString())}_serialize(){const e=Object.create(null);for(const[t,i]of this._cache){const r=new Set;for(const s of i.data.lenses)r.add(s.symbol.range.startLineNumber);e[t]={lineCount:i.lineCount,lines:[...r.values()]}}return JSON.stringify(e)}_deserialize(e){try{const t=JSON.parse(e);for(const i in t){const r=t[i],s=[];for(const a of r.lines)s.push({range:new $(a,1,a,11)});const o=new Cee;o.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(i,new ECe(r.lineCount,o))}}catch{}}};xee=b3t([y3t(0,pf)],xee);Vn(e7e,xee,1);class w3t{constructor(e,t,i){this.afterColumn=1073741824,this.afterLineNumber=e,this.heightInPx=t,this._onHeight=i,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(e){this._lastHeight===void 0?this._lastHeight=e:this._lastHeight!==e&&(this._lastHeight=e,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}}class N9{static{this._idPool=0}constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${N9._idPool++}`,this.updatePosition(t),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(e,t){this._commands.clear();const i=[];let r=!1;for(let s=0;s{c.symbol.command&&l.push(c.symbol),i.addDecoration({range:c.symbol.range,options:LCe},d=>this._decorationIds[u]=d),a?a=$.plusRange(a,c.symbol.range):a=$.lift(c.symbol.range)}),this._viewZone=new w3t(a.startLineNumber-1,s,o),this._viewZoneId=r.addZone(this._viewZone),l.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(l,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new N9(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t?.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((e,t)=>{const i=this._editor.getModel().getDecorationRange(e),r=this._data[t].symbol;return!!(i&&$.isEmpty(r.range)===i.isEmpty())})}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach((i,r)=>{t.addDecoration({range:i.symbol.range,options:LCe},s=>this._decorationIds[r]=s)})}updateHeight(e,t){this._viewZone.heightInPx=e,t.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(e){if(!this._viewZone.isVisible())return null;for(let t=0;t=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},zT=function(n,e){return function(t,i){e(t,i,n)}};let sR=class{static{this.ID="css.editor.codeLens"}constructor(e,t,i,r,s,o){this._editor=e,this._languageFeaturesService=t,this._commandService=r,this._notificationService=s,this._codeLensCache=o,this._disposables=new ke,this._localToDispose=new ke,this._lenses=[],this._oldCodeLensModels=new ke,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Ui(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{(a.hasChanged(50)||a.hasChanged(19)||a.hasChanged(18))&&this._updateLensStyle(),a.hasChanged(17)&&this._onModelChange()})),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),this._currentCodeLensModel?.dispose()}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(67)/this._editor.getOption(52));let t=this._editor.getOption(19);return(!t||t<5)&&(t=this._editor.getOption(52)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(18),r=this._editor.getOption(50),{style:s}=this._editor.getContainerDomNode();s.setProperty("--vscode-editorCodeLens-lineHeight",`${e}px`),s.setProperty("--vscode-editorCodeLens-fontSize",`${t}px`),s.setProperty("--vscode-editorCodeLens-fontFeatureSettings",r.fontFeatureSettings),i&&(s.setProperty("--vscode-editorCodeLens-fontFamily",i),s.setProperty("--vscode-editorCodeLens-fontFamilyDefault",Wl.fontFamily)),this._editor.changeViewZones(o=>{for(const a of this._lenses)a.updateHeight(e,o)})}_localDispose(){this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=void 0,this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),this._currentCodeLensModel?.dispose()}_onModelChange(){this._localDispose();const e=this._editor.getModel();if(!e||!this._editor.getOption(17)||e.isTooLargeForTokenization())return;const t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e)){t&&Sb(()=>{const r=this._codeLensCache.get(e);t===r&&(this._codeLensCache.delete(e),this._onModelChange())},30*1e3,this._localToDispose);return}for(const r of this._languageFeaturesService.codeLensProvider.all(e))if(typeof r.onDidChange=="function"){const s=r.onDidChange(()=>i.schedule());this._localToDispose.add(s)}const i=new Ui(()=>{const r=Date.now();this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=ko(s=>J9e(this._languageFeaturesService.codeLensProvider,e,s)),this._getCodeLensModelPromise.then(s=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=s,this._codeLensCache.put(e,s);const o=this._provideCodeLensDebounce.update(e,Date.now()-r);i.delay=o,this._renderCodeLensSymbols(s),this._resolveCodeLensesInViewportSoon()},rn)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(Lt(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._editor.changeDecorations(r=>{this._editor.changeViewZones(s=>{const o=[];let a=-1;this._lenses.forEach(c=>{!c.isValid()||a===c.getLineNumber()?o.push(c):(c.update(s),a=c.getLineNumber())});const l=new Wq;o.forEach(c=>{c.dispose(l,s),this._lenses.splice(this._lenses.indexOf(c),1)}),l.commit(r)})}),i.schedule(),this._resolveCodeLensesScheduler.cancel(),this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorText(()=>{i.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{i.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(r=>{r.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(Lt(()=>{if(this._editor.getModel()){const r=Ag.capture(this._editor);this._editor.changeDecorations(s=>{this._editor.changeViewZones(o=>{this._disposeAllLenses(s,o)})}),r.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(r=>{if(r.target.type!==9)return;let s=r.target.element;if(s?.tagName==="SPAN"&&(s=s.parentElement),s?.tagName==="A")for(const o of this._lenses){const a=o.getCommand(s);if(a){this._commandService.executeCommand(a.id,...a.arguments||[]).catch(l=>this._notificationService.error(l));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new Wq;for(const r of this._lenses)r.dispose(i,t);e&&i.commit(e),this._lenses.length=0}_renderCodeLensSymbols(e){if(!this._editor.hasModel())return;const t=this._editor.getModel().getLineCount(),i=[];let r;for(const a of e.lenses){const l=a.symbol.range.startLineNumber;l<1||l>t||(r&&r[r.length-1].symbol.range.startLineNumber===l?r.push(a):(r=[a],i.push(r)))}if(!i.length&&!this._lenses.length)return;const s=Ag.capture(this._editor),o=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(l=>{const c=new Wq;let u=0,d=0;for(;dthis._resolveCodeLensesInViewportSoon())),u++,d++)}for(;uthis._resolveCodeLensesInViewportSoon())),d++;c.commit(a)})}),s.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0;const e=this._editor.getModel();if(!e)return;const t=[],i=[];if(this._lenses.forEach(o=>{const a=o.computeIfNecessary(e);a&&(t.push(a),i.push(o))}),t.length===0)return;const r=Date.now(),s=ko(o=>{const a=t.map((l,c)=>{const u=new Array(l.length),d=l.map((h,f)=>!h.symbol.command&&typeof h.provider.resolveCodeLens=="function"?Promise.resolve(h.provider.resolveCodeLens(e,h.symbol,o)).then(g=>{u[f]=g},vs):(u[f]=h.symbol,Promise.resolve(void 0)));return Promise.all(d).then(()=>{!o.isCancellationRequested&&!i[c].isDisposed()&&i[c].updateCommands(u)})});return Promise.all(a)});this._resolveCodeLensesPromise=s,this._resolveCodeLensesPromise.then(()=>{const o=this._resolveCodeLensesDebounce.update(e,Date.now()-r);this._resolveCodeLensesScheduler.delay=o,this._currentCodeLensModel&&this._codeLensCache.put(e,this._currentCodeLensModel),this._oldCodeLensModels.clear(),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},o=>{rn(o),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,this._currentCodeLensModel?.isDisposed?void 0:this._currentCodeLensModel}};sR=C3t([zT(1,dt),zT(2,cd),zT(3,_r),zT(4,Ts),zT(5,e7e)],sR);Zn(sR.ID,sR,1);Pe(class extends ot{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:Q.hasCodeLensProvider,label:w("showLensOnLine","Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}async run(e,t){if(!t.hasModel())return;const i=e.get(hh),r=e.get(_r),s=e.get(Ts),o=t.getSelection().positionLineNumber,a=t.getContribution(sR.ID);if(!a)return;const l=await a.getModel();if(!l)return;const c=[];for(const h of l.lenses)h.symbol.command&&h.symbol.range.startLineNumber===o&&c.push({label:h.symbol.command.title,command:h.symbol.command});if(c.length===0)return;const u=await i.pick(c,{canPickMany:!1,placeHolder:w("placeHolder","Select a command")});if(!u)return;let d=u.command;if(l.isDisposed){const f=(await a.getModel())?.lenses.find(g=>g.symbol.range.startLineNumber===o&&g.symbol.command?.title===d.title);if(!f||!f.symbol.command)return;d=f.symbol.command}try{await r.executeCommand(d.id,...d.arguments||[])}catch(h){s.error(h)}}});var t7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},See=function(n,e){return function(t,i){e(t,i,n)}};let oR=class{constructor(e){this._editorWorkerService=e}async provideDocumentColors(e,t){return this._editorWorkerService.computeDefaultDocumentColors(e.uri)}provideColorPresentations(e,t,i){const r=t.range,s=t.color,o=s.alpha,a=new Te(new Jn(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),o)),l=o?Te.Format.CSS.formatRGB(a):Te.Format.CSS.formatRGBA(a),c=o?Te.Format.CSS.formatHSL(a):Te.Format.CSS.formatHSLA(a),u=o?Te.Format.CSS.formatHex(a):Te.Format.CSS.formatHexA(a),d=[];return d.push({label:l,textEdit:{range:r,text:l}}),d.push({label:c,textEdit:{range:r,text:c}}),d.push({label:u,textEdit:{range:r,text:u}}),d}};oR=t7e([See(0,Oc)],oR);let kee=class extends me{constructor(e,t){super(),this._register(e.colorProvider.register("*",new oR(t)))}};kee=t7e([See(0,dt),See(1,Oc)],kee);u2(kee);async function n7e(n,e,t,i=!0){return Aue(new x3t,n,e,t,i)}function i7e(n,e,t,i){return Promise.resolve(t.provideColorPresentations(n,e,i))}class x3t{constructor(){}async compute(e,t,i,r){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const o of s)r.push({colorInfo:o,provider:e});return Array.isArray(s)}}class S3t{constructor(){}async compute(e,t,i,r){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const o of s)r.push({range:o.range,color:[o.color.red,o.color.green,o.color.blue,o.color.alpha]});return Array.isArray(s)}}class k3t{constructor(e){this.colorInfo=e}async compute(e,t,i,r){const s=await e.provideColorPresentations(t,this.colorInfo,yn.None);return Array.isArray(s)&&r.push(...s),Array.isArray(s)}}async function Aue(n,e,t,i,r){let s=!1,o;const a=[],l=e.ordered(t);for(let c=l.length-1;c>=0;c--){const u=l[c];if(u instanceof oR)o=u;else try{await n.compute(u,t,i,a)&&(s=!0)}catch(d){vs(d)}}return s?a:o&&r?(await n.compute(o,t,i,a),a):[]}function r7e(n,e){const{colorProvider:t}=n.get(dt),i=n.get(Sr).getModel(e);if(!i)throw qd();const r=n.get(En).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,isDefaultColorDecoratorsEnabled:r}}Un.registerCommand("_executeDocumentColorProvider",function(n,...e){const[t]=e;if(!(t instanceof Pt))throw qd();const{model:i,colorProviderRegistry:r,isDefaultColorDecoratorsEnabled:s}=r7e(n,t);return Aue(new S3t,r,i,yn.None,s)});Un.registerCommand("_executeColorPresentationProvider",function(n,...e){const[t,i]=e,{uri:r,range:s}=i;if(!(r instanceof Pt)||!Array.isArray(t)||t.length!==4||!$.isIRange(s))throw qd();const{model:o,colorProviderRegistry:a,isDefaultColorDecoratorsEnabled:l}=r7e(n,r),[c,u,d,h]=t;return Aue(new k3t({range:s,color:{red:c,green:u,blue:d,alpha:h}}),a,o,yn.None,l)});var E3t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Hq=function(n,e){return function(t,i){e(t,i,n)}},Eee;const s7e=Object.create({});let IE=class extends me{static{Eee=this}static{this.ID="editor.contrib.colorDetector"}static{this.RECOMPUTE_TIME=1e3}constructor(e,t,i,r){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new ke),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new VW(this._editor),this._decoratorLimitReporter=new L3t,this._colorDecorationClassRefs=this._register(new ke),this._debounceInformation=r.for(i.colorProvider,"Document Colors",{min:Eee.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(i.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(s=>{const o=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(148);const a=o!==this._isColorDecoratorsEnabled||s.hasChanged(21),l=s.hasChanged(148);(a||l)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(148),this.updateColors()}isEnabled(){const e=this._editor.getModel();if(!e)return!1;const t=e.getLanguageId(),i=this._configurationService.getValue(t);if(i&&typeof i=="object"){const r=i.colorDecorators;if(r&&r.enable!==void 0&&!r.enable)return r.enable}return this._editor.getOption(20)}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new hf,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=ko(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new Bo(!1),r=await n7e(this._languageFeaturesService.colorProvider,t,e,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(t,i.elapsed()),r});try{const e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){rn(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){const t=e.map(i=>({range:{startLineNumber:i.colorInfo.range.startLineNumber,startColumn:i.colorInfo.range.startColumn,endLineNumber:i.colorInfo.range.endLineNumber,endColumn:i.colorInfo.range.endColumn},options:un.EMPTY}));this._editor.changeDecorations(i=>{this._decorationsIds=i.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((r,s)=>this._colorDatas.set(r,e[s]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();const t=[],i=this._editor.getOption(21);for(let s=0;sthis._colorDatas.has(r.id));return i.length===0?null:this._colorDatas.get(i[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}};IE=Eee=E3t([Hq(1,En),Hq(2,dt),Hq(3,cd)],IE);class L3t{constructor(){this._onDidChange=new fe,this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}Zn(IE.ID,IE,1);class T3t{get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(e,t,i){this.presentationIndex=i,this._onColorFlushed=new fe,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new fe,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new fe,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let i=-1;for(let r=0;r{this.backgroundColor=o.getColor(f8)||Te.white})),this._register(Ce(this._pickedColorNode,je.CLICK,()=>this.model.selectNextColorPresentation())),this._register(Ce(this._originalColorNode,je.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=Te.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.showingStandaloneColorPicker&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new I3t(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=Te.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class I3t extends me{constructor(e){super(),this._onClicked=this._register(new fe),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),Ne(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),Ne(this._button,t),Ne(t,Hu(".button"+zt.asCSSSelector(kr("color-picker-close",ze.close,w("closeIcon","Icon to close the color picker"))))).classList.add("close-icon"),this._register(Ce(this._button,je.CLICK,()=>{this._onClicked.fire()}))}}class A3t extends me{constructor(e,t,i,r=!1){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=Hu(".colorpicker-body"),Ne(e,this._domNode),this._saturationBox=new N3t(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new R3t(this._domNode,this.model,r),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new P3t(this._domNode,this.model,r),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),r&&(this._insertButton=this._register(new O3t(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){const i=this.model.color.hsva;this.model.color=new Te(new Lp(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new Te(new Lp(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new Te(new Lp(i===360?0:i,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}}class N3t extends me{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new fe,this.onColorFlushed=this._onColorFlushed.event,this._domNode=Hu(".saturation-wrap"),Ne(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Ne(this._domNode,this._canvas),this.selection=Hu(".saturation-selection"),Ne(this._domNode,this.selection),this.layout(),this._register(Ce(this._domNode,je.POINTER_DOWN,r=>this.onPointerDown(r))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new e2);const t=ms(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>this.onDidChangePosition(r.pageX-t.left,r.pageY-t.top),()=>null);const i=Ce(e.target.ownerDocument,je.POINTER_UP,()=>{this._onColorFlushed.fire(),i.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){const i=Math.max(0,Math.min(1,e/this.width)),r=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(i,r),this._onDidChange.fire({s:i,v:r})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();const e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){const e=this.model.color.hsva,t=new Te(new Lp(e.h,1,1,1)),i=this._canvas.getContext("2d"),r=i.createLinearGradient(0,0,this._canvas.width,0);r.addColorStop(0,"rgba(255, 255, 255, 1)"),r.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),r.addColorStop(1,"rgba(255, 255, 255, 0)");const s=i.createLinearGradient(0,0,0,this._canvas.height);s.addColorStop(0,"rgba(0, 0, 0, 0)"),s.addColorStop(1,"rgba(0, 0, 0, 1)"),i.rect(0,0,this._canvas.width,this._canvas.height),i.fillStyle=Te.Format.CSS.format(t),i.fill(),i.fillStyle=r,i.fill(),i.fillStyle=s,i.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const t=e.hsva;this.paintSelection(t.s,t.v)}}class o7e extends me{constructor(e,t,i=!1){super(),this.model=t,this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new fe,this.onColorFlushed=this._onColorFlushed.event,i?(this.domNode=Ne(e,Hu(".standalone-strip")),this.overlay=Ne(this.domNode,Hu(".standalone-overlay"))):(this.domNode=Ne(e,Hu(".strip")),this.overlay=Ne(this.domNode,Hu(".overlay"))),this.slider=Ne(this.domNode,Hu(".slider")),this.slider.style.top="0px",this._register(Ce(this.domNode,je.POINTER_DOWN,r=>this.onPointerDown(r))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){const t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._register(new e2),i=ms(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,s=>this.onDidChangeTop(s.pageY-i.top),()=>null);const r=Ce(e.target.ownerDocument,je.POINTER_UP,()=>{this._onColorFlushed.fire(),r.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){const t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}}class R3t extends o7e{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(e){super.onDidChangeColor(e);const{r:t,g:i,b:r}=e.rgba,s=new Te(new Jn(t,i,r,1)),o=new Te(new Jn(t,i,r,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${o} 100%)`}getValue(e){return e.hsva.a}}class P3t extends o7e{constructor(e,t,i=!1){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}class O3t extends me{constructor(e){super(),this._onClicked=this._register(new fe),this.onClicked=this._onClicked.event,this._button=Ne(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(Ce(this._button,je.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}class M3t extends ud{constructor(e,t,i,r,s=!1){super(),this.model=t,this.pixelRatio=i,this._register(cN.getInstance(Ot(e)).onDidChange(()=>this.layout())),this._domNode=Hu(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new D3t(this._domNode,this.model,r,s)),this.body=this._register(new A3t(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}}class Vq{constructor(e,t,i,r){this.priority=e,this.range=t,this.initialMousePosX=i,this.initialMousePosY=r,this.type=1}equals(e){return e.type===1&&this.range.equalsRange(e.range)}canAdoptVisibleHover(e,t){return e.type===1&&t.lineNumber===this.range.startLineNumber}}class gF{constructor(e,t,i,r,s,o){this.priority=e,this.owner=t,this.range=i,this.initialMousePosX=r,this.initialMousePosY=s,this.supportsMarkerHover=o,this.type=2}equals(e){return e.type===2&&this.owner===e.owner}canAdoptVisibleHover(e,t){return e.type===2&&this.owner===e.owner}}class Kw{constructor(e){this.renderedHoverParts=e}dispose(){for(const e of this.renderedHoverParts)e.dispose()}}const DC=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};var a7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},l7e=function(n,e){return function(t,i){e(t,i,n)}};class F3t{constructor(e,t,i,r){this.owner=e,this.range=t,this.model=i,this.provider=r,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let aR=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t){return[]}computeAsync(e,t,i){return to.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];const r=IE.get(this._editor);if(!r)return[];for(const s of t){if(!r.isColorDecoration(s))continue;const o=r.getColorData(s.range.getStartPosition());if(o)return[await c7e(this,this._editor.getModel(),o.colorInfo,o.provider)]}return[]}renderHoverParts(e,t){const i=u7e(this,this._editor,this._themeService,t,e);if(!i)return new Kw([]);this._colorPicker=i.colorPicker;const r={hoverPart:i.hoverPart,hoverElement:this._colorPicker.domNode,dispose(){i.disposables.dispose()}};return new Kw([r])}handleResize(){this._colorPicker?.layout()}isColorPickerVisible(){return!!this._colorPicker}};aR=a7e([l7e(1,go)],aR);class B3t{constructor(e,t,i,r){this.owner=e,this.range=t,this.model=i,this.provider=r}}let lR=class{constructor(e,t){this._editor=e,this._themeService=t,this._color=null}async createColorHover(e,t,i){if(!this._editor.hasModel()||!IE.get(this._editor))return null;const s=await n7e(i,this._editor.getModel(),yn.None);let o=null,a=null;for(const d of s){const h=d.colorInfo;$.containsRange(h.range,e.range)&&(o=h,a=d.provider)}const l=o??e,c=a??t,u=!!o;return{colorHover:await c7e(this,this._editor.getModel(),l,c),foundInEditor:u}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new $(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await pF(this._editor.getModel(),t,this._color,i,e),i=d7e(this._editor,i,t))}renderHoverParts(e,t){return u7e(this,this._editor,this._themeService,t,e)}set color(e){this._color=e}get color(){return this._color}};lR=a7e([l7e(1,go)],lR);async function c7e(n,e,t,i){const r=e.getValueInRange(t.range),{red:s,green:o,blue:a,alpha:l}=t.color,c=new Jn(Math.round(s*255),Math.round(o*255),Math.round(a*255),l),u=new Te(c),d=await i7e(e,t,i,yn.None),h=new T3t(u,[],0);return h.colorPresentations=d||[],h.guessColorPresentation(u,r),n instanceof aR?new F3t(n,$.lift(t.range),h,i):new B3t(n,$.lift(t.range),h,i)}function u7e(n,e,t,i,r){if(i.length===0||!e.hasModel())return;if(r.setMinimumDimensions){const h=e.getOption(67)+8;r.setMinimumDimensions(new vi(302,h))}const s=new ke,o=i[0],a=e.getModel(),l=o.model,c=s.add(new M3t(r.fragment,l,e.getOption(144),t,n instanceof lR));let u=!1,d=new $(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn);if(n instanceof lR){const h=o.model.color;n.color=h,pF(a,l,h,d,o),s.add(l.onColorFlushed(f=>{n.color=f}))}else s.add(l.onColorFlushed(async h=>{await pF(a,l,h,d,o),u=!0,d=d7e(e,d,l)}));return s.add(l.onDidChangeColor(h=>{pF(a,l,h,d,o)})),s.add(e.onDidChangeModelContent(h=>{u?u=!1:(r.hide(),e.focus())})),{hoverPart:o,colorPicker:c,disposables:s}}function d7e(n,e,t){const i=[],r=t.presentation.textEdit??{range:e,text:t.presentation.label,forceMoveMarkers:!1};i.push(r),t.presentation.additionalTextEdits&&i.push(...t.presentation.additionalTextEdits);const s=$.lift(r.range),o=n.getModel()._setTrackedRange(null,s,3);return n.executeEdits("colorpicker",i),n.pushUndoStop(),n.getModel()._getTrackedRange(o)??s}async function pF(n,e,t,i,r){const s=await i7e(n,{range:i,color:{red:t.rgba.r/255,green:t.rgba.g/255,blue:t.rgba.b/255,alpha:t.rgba.a}},r.provider,yn.None);e.colorPresentations=s||[]}const h7e="editor.action.showHover",$3t="editor.action.showDefinitionPreviewHover",W3t="editor.action.scrollUpHover",H3t="editor.action.scrollDownHover",V3t="editor.action.scrollLeftHover",z3t="editor.action.scrollRightHover",U3t="editor.action.pageUpHover",j3t="editor.action.pageDownHover",q3t="editor.action.goToTopHover",K3t="editor.action.goToBottomHover",cH="editor.action.increaseHoverVerbosityLevel",G3t=w({key:"increaseHoverVerbosityLevel",comment:["Label for action that will increase the hover verbosity level."]},"Increase Hover Verbosity Level"),uH="editor.action.decreaseHoverVerbosityLevel",Y3t=w({key:"decreaseHoverVerbosityLevel",comment:["Label for action that will decrease the hover verbosity level."]},"Decrease Hover Verbosity Level"),f7e="editor.action.inlineSuggest.commit",g7e="editor.action.inlineSuggest.showPrevious",p7e="editor.action.inlineSuggest.showNext";var Nue=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Wh=function(n,e){return function(t,i){e(t,i,n)}},mF;let Lee=class extends me{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).showToolbar==="always"),this.sessionPosition=void 0,this.position=St(this,r=>{const s=this.model.read(r)?.primaryGhostText.read(r);if(!this.alwaysShowToolbar.read(r)||!s||s.parts.length===0)return this.sessionPosition=void 0,null;const o=s.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==s.lineNumber&&(this.sessionPosition=void 0);const a=new he(s.lineNumber,Math.min(o,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(wc((r,s)=>{const o=this.model.read(r);if(!o||!this.alwaysShowToolbar.read(r))return;const a=Jb((c,u)=>{const d=u.add(this.instantiationService.createInstance(AE,this.editor,!0,this.position,o.selectedInlineCompletionIndex,o.inlineCompletionsCount,o.activeCommands));return e.addContentWidget(d),u.add(Lt(()=>e.removeContentWidget(d))),u.add(tn(h=>{this.position.read(h)&&o.lastTriggerKind.read(h)!==gg.Explicit&&o.triggerExplicitly()})),d}),l=cO(this,(c,u)=>!!this.position.read(c)||!!u);s.add(tn(c=>{l.read(c)&&a.read(c)}))}))}};Lee=Nue([Wh(2,Tt)],Lee);const Z3t=kr("inline-suggestion-hints-next",ze.chevronRight,w("parameterHintsNextIcon","Icon for show next parameter hint.")),X3t=kr("inline-suggestion-hints-previous",ze.chevronLeft,w("parameterHintsPreviousIcon","Icon for show previous parameter hint."));let AE=class extends me{static{mF=this}static{this._dropDownVisible=!1}static get dropDownVisible(){return this._dropDownVisible}static{this.id=0}createCommandAction(e,t,i){const r=new su(e,t,i,!0,()=>this._commandService.executeCommand(e)),s=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let o=t;return s&&(o=w({key:"content",comment:["A label","A keybinding"]},"{0} ({1})",t,s.getLabel())),r.tooltip=o,r}constructor(e,t,i,r,s,o,a,l,c,u,d){super(),this.editor=e,this.withBorder=t,this._position=i,this._currentSuggestionIdx=r,this._suggestionCount=s,this._extraCommands=o,this._commandService=a,this.keybindingService=c,this._contextKeyService=u,this._menuService=d,this.id=`InlineSuggestionHintsContentWidget${mF.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=An("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[An("div@toolBar")]),this.previousAction=this.createCommandAction(g7e,w("previous","Previous"),zt.asClassName(X3t)),this.availableSuggestionCountAction=new su("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(p7e,w("next","Next"),zt.asClassName(Z3t)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(ce.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Ui(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Ui(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this.toolBar=this._register(l.createInstance(Tee,this.nodes.toolBar,ce.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:h=>h.startsWith("primary")},actionViewItemProvider:(h,f)=>{if(h instanceof ou)return l.createInstance(J3t,h,void 0);if(h===this.availableSuggestionCountAction){const g=new Q3t(void 0,h,{label:!0,icon:!1});return g.setClass("availableSuggestionCount"),g}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(h=>{mF._dropDownVisible=h})),this._register(tn(h=>{this._position.read(h),this.editor.layoutContentWidget(this)})),this._register(tn(h=>{const f=this._suggestionCount.read(h),g=this._currentSuggestionIdx.read(h);f!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${g+1}/${f}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),f!==void 0&&f>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(tn(h=>{const g=this._extraCommands.read(h).map(p=>({class:void 0,id:p.id,enabled:!0,tooltip:p.tooltip||"",label:p.title,run:m=>this._commandService.executeCommand(p.id)}));for(const[p,m]of this.inlineCompletionsActionsMenus.getActions())for(const _ of m)_ instanceof ou&&g.push(_);g.length>0&&g.unshift(new na),this.toolBar.setAdditionalSecondaryActions(g)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};AE=mF=Nue([Wh(6,_r),Wh(7,Tt),Wh(8,xi),Wh(9,jt),Wh(10,ld)],AE);class Q3t extends vE{constructor(){super(...arguments),this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}updateTooltip(){}}let J3t=class extends Db{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=An("div.keybinding").root;this._register(new l2(t,eu,{disableTitle:!0,...P6e})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},Tee=class extends JN{constructor(e,t,i,r,s,o,a,l,c){super(e,{resetMenu:t,...i},r,s,o,a,l,c),this.menuId=t,this.options2=i,this.menuService=r,this.contextKeyService=s,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){const e=[],t=[];EW(this.menu,this.options2?.menuOptions,{primary:e,secondary:t},this.options2?.toolbarOptions?.primaryGroup,this.options2?.toolbarOptions?.shouldInlineSubmenu,this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){$r(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){$r(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};Tee=Nue([Wh(3,ld),Wh(4,jt),Wh(5,mu),Wh(6,xi),Wh(7,_r),Wh(8,Qa)],Tee);function dH(n,e,t){const i=ms(n);return!(ei.left+i.width||ti.top+i.height)}let e5t=class{constructor(e,t,i){this.value=e,this.isComplete=t,this.hasLoadingMessage=i}};class m7e extends me{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new fe),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Ui(()=>this._triggerAsyncComputation(),0)),this._secondWaitScheduler=this._register(new Ui(()=>this._triggerSyncComputation(),0)),this._loadingMessageScheduler=this._register(new Ui(()=>this._triggerLoadingMessage(),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t=!0){this._state=e,t&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=B_t(e=>this._computer.computeAsync(e)),(async()=>{try{for await(const e of this._asyncIterable)e&&(this._result.push(e),this._fireResult());this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0)}catch(e){rn(e)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync())),this._setState(this._asyncIterableDone?0:3)}_triggerLoadingMessage(){this._state===3&&this._setState(4)}_fireResult(){if(this._state===1||this._state===2)return;const e=this._state===0,t=this._state===4;this._onResult.fire(new e5t(this._result.slice(0),e,t))}start(e){if(e===0)this._state===0&&(this._setState(1),this._firstWaitScheduler.schedule(this._firstWaitTime),this._loadingMessageScheduler.schedule(this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(),this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break;case 2:this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break}}cancel(){this._firstWaitScheduler.cancel(),this._secondWaitScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._setState(0,!1)}}class Rue{constructor(){this._onDidWillResize=new fe,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new fe,this.onDidResize=this._onDidResize.event,this._sashListener=new ke,this._size=new vi(0,0),this._minSize=new vi(0,0),this._maxSize=new vi(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new $a(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new $a(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new $a(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:z8.North}),this._southSash=new $a(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:z8.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let e,t=0,i=0;this._sashListener.add(Ge.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{e===void 0&&(this._onDidWillResize.fire(),e=this._size,t=0,i=0)})),this._sashListener.add(Ge.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{e!==void 0&&(e=void 0,t=0,i=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(r=>{e&&(i=r.currentX-r.startX,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(r=>{e&&(i=-(r.currentX-r.startX),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(r=>{e&&(t=-(r.currentY-r.startY),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(r=>{e&&(t=r.currentY-r.startY,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(Ge.any(this._eastSash.onDidReset,this._westSash.onDidReset)(r=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(Ge.any(this._northSash.onDidReset,this._southSash.onDidReset)(r=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(e,t,i,r){this._northSash.state=e?3:0,this._eastSash.state=t?3:0,this._southSash.state=i?3:0,this._westSash.state=r?3:0}layout(e=this.size.height,t=this.size.width){const{height:i,width:r}=this._minSize,{height:s,width:o}=this._maxSize;e=Math.max(i,Math.min(s,e)),t=Math.max(r,Math.min(o,t));const a=new vi(t,e);vi.equals(a,this._size)||(this.domNode.style.height=e+"px",this.domNode.style.width=t+"px",this._size=a,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(e){this._maxSize=e}get maxSize(){return this._maxSize}set minSize(e){this._minSize=e}get minSize(){return this._minSize}set preferredSize(e){this._preferredSize=e}get preferredSize(){return this._preferredSize}}const t5t=30,n5t=24;class i5t extends me{constructor(e,t=new vi(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new Rue),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=vi.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(i=>{this._resize(new vi(i.dimension.width,i.dimension.height)),i.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){return this._contentPosition?.position?he.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:ms(t).top+i.top-t5t}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const r=ms(t),s=kb(t.ownerDocument.body),o=r.top+i.top+i.height;return s.height-o-n5t}_findPositionPreference(e,t){const i=Math.min(this._availableVerticalSpaceBelow(t)??1/0,e),r=Math.min(this._availableVerticalSpaceAbove(t)??1/0,e),s=Math.min(Math.max(r,i),e),o=Math.min(e,s);let a;return this._editor.getOption(60).above?a=o<=r?1:2:a=o<=i?2:1,a===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),a}_resize(e){this._resizableNode.layout(e.height,e.width)}}var r5t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},a3=function(n,e){return function(t,i){e(t,i,n)}},rp;const DCe=30,s5t=6;let Dee=class extends i5t{static{rp=this}static{this.ID="editor.contrib.resizableContentHoverWidget"}static{this._lastDimensions=new vi(0,0)}get isVisibleFromKeyboard(){return this._renderedHover?.source===1}get isVisible(){return this._hoverVisibleKey.get()??!1}get isFocused(){return this._hoverFocusedKey.get()??!1}constructor(e,t,i,r,s){const o=e.getOption(67)+8,a=150,l=new vi(a,o);super(e,l),this._configurationService=i,this._accessibilityService=r,this._keybindingService=s,this._hover=this._register(new yle),this._onDidResize=this._register(new fe),this.onDidResize=this._onDidResize.event,this._minimumSize=l,this._hoverVisibleKey=Q.hoverVisible.bindTo(t),this._hoverFocusedKey=Q.hoverFocused.bindTo(t),Ne(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(u=>{u.hasChanged(50)&&this._updateFont()}));const c=this._register(Eg(this._resizableNode.domNode));this._register(c.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(c.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}dispose(){super.dispose(),this._renderedHover?.dispose(),this._editor.removeContentWidget(this)}getId(){return rp.ID}static _applyDimensions(e,t,i){const r=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.width=r,e.style.height=s}_setContentsDomNodeDimensions(e,t){const i=this._hover.contentsDomNode;return rp._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return rp._applyDimensions(i,e,t)}_setHoverWidgetDimensions(e,t){this._setContentsDomNodeDimensions(e,t),this._setContainerDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,i){const r=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.maxWidth=r,e.style.maxHeight=s}_setHoverWidgetMaxDimensions(e,t){rp._applyMaxDimensions(this._hover.contentsDomNode,e,t),rp._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none");const t=e.width,i=e.height;this._setHoverWidgetDimensions(t,i)}_updateResizableNodeMaxDimensions(){const e=this._findMaximumRenderingWidth()??1/0,t=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new vi(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){rp._lastDimensions=new vi(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),this._onDidResize.fire()}_findAvailableSpaceVertically(){const e=this._renderedHover?.showAtPosition;if(e)return this._positionPreference===1?this._availableVerticalSpaceAbove(e):this._availableVerticalSpaceBelow(e)}_findMaximumRenderingHeight(){const e=this._findAvailableSpaceVertically();if(!e)return;let t=s5t;return Array.from(this._hover.contentsDomNode.children).forEach(i=>{t+=i.clientHeight}),Math.min(e,t)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;const e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth-2;return e||this._hover.containerDomNode.clientWidththis._renderedHover.closestMouseDistance+4?!1:(this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,r),!0)}_setRenderedHover(e){this._renderedHover?.dispose(),this._renderedHover=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){const{fontSize:e,lineHeight:t}=this._editor.getOption(50),i=this._hover.contentsDomNode;i.style.fontSize=`${e}px`,i.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(s=>this._editor.applyFontInfo(s))}_updateContent(e){const t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const e=Math.max(this._editor.getLayoutInfo().height/4,250,rp._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,500,rp._lastDimensions.width);this._setHoverWidgetMaxDimensions(t,e)}_render(e){this._setRenderedHover(e),this._updateFont(),this._updateContent(e.domNode),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){return this._renderedHover?{position:this._renderedHover.showAtPosition,secondaryPosition:this._renderedHover.showAtSecondaryPosition,positionAffinity:this._renderedHover.shouldAppearBeforeContent?3:void 0,preference:[this._positionPreference??1]}:null}show(e){if(!this._editor||!this._editor.hasModel())return;this._render(e);const t=h_(this._hover.containerDomNode),i=e.showAtPosition;this._positionPreference=this._findPositionPreference(t,i)??1,this.onContentsChanged(),e.shouldFocus&&this._hover.containerDomNode.focus(),this._onDidResize.fire();const s=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&M5e(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel()??"");s&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+s)}hide(){if(!this._renderedHover)return;const e=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();this._setRenderedHover(void 0),this._resizableNode.maxSize=new vi(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){const e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto")}setMinimumDimensions(e){this._minimumSize=new vi(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new vi(e,this._minimumSize.height)}onContentsChanged(){this._removeConstraintsRenderNormally();const e=this._hover.containerDomNode;let t=h_(e),i=qc(e);if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=h_(e),i=qc(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),this._renderedHover?.showAtPosition){const r=h_(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(r,this._renderedHover.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-DCe})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+DCe})}pageUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};Dee=rp=r5t([a3(1,jt),a3(2,En),a3(3,_u),a3(4,xi)],Dee);function ICe(n,e,t,i,r,s){const o=t+r/2,a=i+s/2,l=Math.max(Math.abs(n-o)-r/2,0),c=Math.max(Math.abs(e-a)-s/2,0);return Math.sqrt(l*l+c*c)}class R9{get anchor(){return this._anchor}set anchor(e){this._anchor=e}get shouldFocus(){return this._shouldFocus}set shouldFocus(e){this._shouldFocus=e}get source(){return this._source}set source(e){this._source=e}get insistOnKeepingHoverVisible(){return this._insistOnKeepingHoverVisible}set insistOnKeepingHoverVisible(e){this._insistOnKeepingHoverVisible=e}constructor(e,t){this._editor=e,this._participants=t,this._anchor=null,this._shouldFocus=!1,this._source=0,this._insistOnKeepingHoverVisible=!1}static _getLineDecorations(e,t){if(t.type!==1&&!t.supportsMarkerHover)return[];const i=e.getModel(),r=t.range.startLineNumber;if(r>i.getLineCount())return[];const s=i.getLineMaxColumn(r);return e.getLineDecorations(r).filter(o=>{if(o.options.isWholeLine)return!0;const a=o.range.startLineNumber===r?o.range.startColumn:1,l=o.range.endLineNumber===r?o.range.endColumn:s;if(o.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>l)return!1}else if(a>t.range.startColumn||t.range.endColumn>l)return!1;return!0})}computeAsync(e){const t=this._anchor;if(!this._editor.hasModel()||!t)return to.EMPTY;const i=R9._getLineDecorations(this._editor,t);return to.merge(this._participants.map(r=>r.computeAsync?r.computeAsync(t,i,e):to.EMPTY))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const e=R9._getLineDecorations(this._editor,this._anchor);let t=[];for(const i of this._participants)t=t.concat(i.computeSync(this._anchor,e));return rf(t)}}class _7e{constructor(e,t,i){this.anchor=e,this.hoverParts=t,this.isComplete=i}filter(e){const t=this.hoverParts.filter(i=>i.isValidForHoverAnchor(e));return t.length===this.hoverParts.length?this:new o5t(this,this.anchor,t,this.isComplete)}}class o5t extends _7e{constructor(e,t,i,r){super(t,i,r),this.original=e}filter(e){return this.original.filter(e)}}var a5t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},l5t=function(n,e){return function(t,i){e(t,i,n)}};const ACe=qe;let P9=class extends me{get hasContent(){return this._hasContent}constructor(e){super(),this._keybindingService=e,this.actions=[],this._hasContent=!1,this.hoverElement=ACe("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=Ne(this.hoverElement,ACe("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const r=this._register(gW.render(this.actionsElement,e,i));return this.actions.push(r),r}append(e){const t=Ne(this.actionsElement,e);return this._hasContent=!0,t}};P9=a5t([l5t(0,xi)],P9);class c5t{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function u5t(n,e,t,i,r){const s=await Promise.resolve(n.provideHover(t,i,r)).catch(vs);if(!(!s||!d5t(s)))return new c5t(n,s,e)}function Pue(n,e,t,i,r=!1){const o=n.ordered(e,r).map((a,l)=>u5t(a,l,e,t,i));return to.fromPromises(o).coalesce()}function v7e(n,e,t,i,r=!1){return Pue(n,e,t,i,r).map(s=>s.hover).toPromise()}Rc("_executeHoverProvider",(n,e,t)=>{const i=n.get(dt);return v7e(i.hoverProvider,e,t,yn.None)});Rc("_executeHoverProvider_recursive",(n,e,t)=>{const i=n.get(dt);return v7e(i.hoverProvider,e,t,yn.None,!0)});function d5t(n){const e=typeof n.range<"u",t=typeof n.contents<"u"&&n.contents&&n.contents.length>0;return e&&t}var h5t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},O1=function(n,e){return function(t,i){e(t,i,n)}};const FS=qe,f5t=kr("hover-increase-verbosity",ze.add,w("increaseHoverVerbosity","Icon for increaseing hover verbosity.")),g5t=kr("hover-decrease-verbosity",ze.remove,w("decreaseHoverVerbosity","Icon for decreasing hover verbosity."));class Uh{constructor(e,t,i,r,s,o=void 0){this.owner=e,this.range=t,this.contents=i,this.isBeforeContent=r,this.ordinal=s,this.source=o}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}class b7e{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){switch(e){case Zc.Increase:return this.hover.canIncreaseVerbosity??!1;case Zc.Decrease:return this.hover.canDecreaseVerbosity??!1}}}let cR=class{constructor(e,t,i,r,s,o,a,l){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=r,this._languageFeaturesService=s,this._keybindingService=o,this._hoverService=a,this._commandService=l,this.hoverOrdinal=3}createLoadingMessage(e){return new Uh(this,e.range,[new za().appendText(w("modesContentHover.loading","Loading..."))],!1,2e3)}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),r=e.range.startLineNumber,s=i.getLineMaxColumn(r),o=[];let a=1e3;const l=i.getLineLength(r),c=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),u=this._editor.getOption(118),d=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:c});let h=!1;u>=0&&l>u&&e.range.startColumn>=u&&(h=!0,o.push(new Uh(this,e.range,[{value:w("stopped rendering","Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!h&&typeof d=="number"&&l>=d&&o.push(new Uh(this,e.range,[{value:w("too many characters","Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,a++));let f=!1;for(const g of t){const p=g.range.startLineNumber===r?g.range.startColumn:1,m=g.range.endLineNumber===r?g.range.endColumn:s,_=g.options.hoverMessage;if(!_||fE(_))continue;g.options.beforeContentClassName&&(f=!0);const v=new $(e.range.startLineNumber,p,e.range.startLineNumber,m);o.push(new Uh(this,v,fae(_),f,a++))}return o}computeAsync(e,t,i){if(!this._editor.hasModel()||e.type!==1)return to.EMPTY;const r=this._editor.getModel(),s=this._languageFeaturesService.hoverProvider;return s.has(r)?this._getMarkdownHovers(s,r,e,i):to.EMPTY}_getMarkdownHovers(e,t,i,r){const s=i.range.getStartPosition();return Pue(e,t,s,r).filter(l=>!fE(l.hover.contents)).map(l=>{const c=l.hover.range?$.lift(l.hover.range):i.range,u=new b7e(l.hover,l.provider,s);return new Uh(this,c,l.hover.contents,!1,l.ordinal,u)})}renderHoverParts(e,t){return this._renderedHoverParts=new p5t(t,e.fragment,this,this._editor,this._languageService,this._openerService,this._commandService,this._keybindingService,this._hoverService,this._configurationService,e.onContentsChanged),this._renderedHoverParts}updateMarkdownHoverVerbosityLevel(e,t,i){return Promise.resolve(this._renderedHoverParts?.updateMarkdownHoverPartVerbosityLevel(e,t,i))}};cR=h5t([O1(1,Hr),O1(2,Pc),O1(3,En),O1(4,dt),O1(5,xi),O1(6,um),O1(7,_r)],cR);class l3{constructor(e,t,i){this.hoverPart=e,this.hoverElement=t,this.disposables=i}dispose(){this.disposables.dispose()}}class p5t{constructor(e,t,i,r,s,o,a,l,c,u,d){this._hoverParticipant=i,this._editor=r,this._languageService=s,this._openerService=o,this._commandService=a,this._keybindingService=l,this._hoverService=c,this._configurationService=u,this._onFinishedRendering=d,this._ongoingHoverOperations=new Map,this._disposables=new ke,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(Lt(()=>{this.renderedHoverParts.forEach(h=>{h.dispose()}),this._ongoingHoverOperations.forEach(h=>{h.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,i){return e.sort($l(r=>r.ordinal,Xh)),e.map(r=>{const s=this._renderHoverPart(r,i);return t.appendChild(s.hoverElement),s})}_renderHoverPart(e,t){const i=this._renderMarkdownHover(e,t),r=i.hoverElement,s=e.source,o=new ke;if(o.add(i),!s)return new l3(e,r,o);const a=s.supportsVerbosityAction(Zc.Increase),l=s.supportsVerbosityAction(Zc.Decrease);if(!a&&!l)return new l3(e,r,o);const c=FS("div.verbosity-actions");return r.prepend(c),o.add(this._renderHoverExpansionAction(c,Zc.Increase,a)),o.add(this._renderHoverExpansionAction(c,Zc.Decrease,l)),new l3(e,r,o)}_renderMarkdownHover(e,t){return y7e(this._editor,e,this._languageService,this._openerService,t)}_renderHoverExpansionAction(e,t,i){const r=new ke,s=t===Zc.Increase,o=Ne(e,FS(zt.asCSSSelector(s?f5t:g5t)));o.tabIndex=0;const a=new uE("mouse",!1,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService);if(r.add(this._hoverService.setupManagedHover(a,o,_5t(this._keybindingService,t))),!i)return o.classList.add("disabled"),r;o.classList.add("enabled");const l=()=>this._commandService.executeCommand(t===Zc.Increase?cH:uH);return r.add(new F5e(o,l)),r.add(new B5e(o,l,[3,10])),r}async updateMarkdownHoverPartVerbosityLevel(e,t,i=!0){const r=this._editor.getModel();if(!r)return;const s=this._getRenderedHoverPartAtIndex(t),o=s?.hoverPart.source;if(!s||!o?.supportsVerbosityAction(e))return;const a=await this._fetchHover(o,r,e);if(!a)return;const l=new b7e(a,o.hoverProvider,o.hoverPosition),c=s.hoverPart,u=new Uh(this._hoverParticipant,c.range,a.contents,c.isBeforeContent,c.ordinal,l),d=this._renderHoverPart(u,this._onFinishedRendering);return this._replaceRenderedHoverPartAtIndex(t,d,u),i&&this._focusOnHoverPartWithIndex(t),{hoverPart:u,hoverElement:d.hoverElement}}async _fetchHover(e,t,i){let r=i===Zc.Increase?1:-1;const s=e.hoverProvider,o=this._ongoingHoverOperations.get(s);o&&(o.tokenSource.cancel(),r+=o.verbosityDelta);const a=new Kr;this._ongoingHoverOperations.set(s,{verbosityDelta:r,tokenSource:a});const l={verbosityRequest:{verbosityDelta:r,previousHover:e.hover}};let c;try{c=await Promise.resolve(s.provideHover(t,e.hoverPosition,a.token,l))}catch(u){vs(u)}return a.dispose(),this._ongoingHoverOperations.delete(s),c}_replaceRenderedHoverPartAtIndex(e,t,i){if(e>=this.renderedHoverParts.length||e<0)return;const r=this.renderedHoverParts[e],s=r.hoverElement,o=t.hoverElement,a=Array.from(o.children);s.replaceChildren(...a);const l=new l3(i,s,t.disposables);s.focus(),r.dispose(),this.renderedHoverParts[e]=l}_focusOnHoverPartWithIndex(e){this.renderedHoverParts[e].hoverElement.focus()}_getRenderedHoverPartAtIndex(e){return this.renderedHoverParts[e]}dispose(){this._disposables.dispose()}}function m5t(n,e,t,i,r){e.sort($l(o=>o.ordinal,Xh));const s=[];for(const o of e)s.push(y7e(t,o,i,r,n.onContentsChanged));return new Kw(s)}function y7e(n,e,t,i,r){const s=new ke,o=FS("div.hover-row"),a=FS("div.hover-row-contents");o.appendChild(a);const l=e.contents;for(const u of l){if(fE(u))continue;const d=FS("div.markdown-hover"),h=Ne(d,FS("div.hover-contents")),f=s.add(new Q_({editor:n},t,i));s.add(f.onDidRenderAsync(()=>{h.className="hover-contents code-hover-contents",r()}));const g=s.add(f.render(u));h.appendChild(g.element),a.appendChild(d)}return{hoverPart:e,hoverElement:o,dispose(){s.dispose()}}}function _5t(n,e){switch(e){case Zc.Increase:{const t=n.lookupKeybinding(cH);return t?w("increaseVerbosityWithKb","Increase Hover Verbosity ({0})",t.getLabel()):w("increaseVerbosity","Increase Hover Verbosity")}case Zc.Decrease:{const t=n.lookupKeybinding(uH);return t?w("decreaseVerbosityWithKb","Decrease Hover Verbosity ({0})",t.getLabel()):w("decreaseVerbosity","Decrease Hover Verbosity")}}}function Iee(n,e){return!!n[e]}class zq{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.hasTriggerModifier=Iee(e.event,t.triggerModifier),this.hasSideBySideModifier=Iee(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class NCe{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=Iee(e,t.triggerModifier)}}class c3{constructor(e,t,i,r){this.triggerKey=e,this.triggerModifier=t,this.triggerSideBySideKey=i,this.triggerSideBySideModifier=r}equals(e){return this.triggerKey===e.triggerKey&&this.triggerModifier===e.triggerModifier&&this.triggerSideBySideKey===e.triggerSideBySideKey&&this.triggerSideBySideModifier===e.triggerSideBySideModifier}}function RCe(n){return n==="altKey"?Rn?new c3(57,"metaKey",6,"altKey"):new c3(5,"ctrlKey",6,"altKey"):Rn?new c3(6,"altKey",57,"metaKey"):new c3(6,"altKey",5,"ctrlKey")}class hH extends me{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new fe),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new fe),this.onExecute=this._onExecute.event,this._onCancel=this._register(new fe),this.onCancel=this._onCancel.event,this._editor=e,this._extractLineNumberFromMouseEvent=t?.extractLineNumberFromMouseEvent??(i=>i.target.position?i.target.position.lineNumber:0),this._opts=RCe(this._editor.getOption(78)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(i=>{if(i.hasChanged(78)){const r=RCe(this._editor.getOption(78));if(this._opts.equals(r))return;this._opts=r,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(i=>this._onEditorMouseMove(new zq(i,this._opts)))),this._register(this._editor.onMouseDown(i=>this._onEditorMouseDown(new zq(i,this._opts)))),this._register(this._editor.onMouseUp(i=>this._onEditorMouseUp(new zq(i,this._opts)))),this._register(this._editor.onKeyDown(i=>this._onEditorKeyDown(new NCe(i,this._opts)))),this._register(this._editor.onKeyUp(i=>this._onEditorKeyUp(new NCe(i,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(i=>this._onDidChangeCursorSelection(i))),this._register(this._editor.onDidChangeModel(i=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(i=>{(i.scrollTopChanged||i.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){const t=this._extractLineNumberFromMouseEvent(e);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}class w7e{constructor(e,t){this.range=e,this.direction=t}}class Oue{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new Oue(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}async resolve(e){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,e.isCancellationRequested?void 0:this.resolve(e);this._isResolved||(this._currentResolve=this._doResolve(e).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(e){try{const t=await Promise.resolve(this.provider.resolveInlayHint(this.hint,e));this.hint.tooltip=t?.tooltip??this.hint.tooltip,this.hint.label=t?.label??this.hint.label,this.hint.textEdits=t?.textEdits??this.hint.textEdits,this._isResolved=!0}catch(t){vs(t),this._isResolved=!1}}}class Lk{static{this._emptyInlayHintList=Object.freeze({dispose(){},hints:[]})}static async create(e,t,i,r){const s=[],o=e.ordered(t).reverse().map(a=>i.map(async l=>{try{const c=await a.provideInlayHints(t,l,r);(c?.hints.length||a.onDidChangeInlayHints)&&s.push([c??Lk._emptyInlayHintList,a])}catch(c){vs(c)}}));if(await Promise.all(o.flat()),r.isCancellationRequested||t.isDisposed())throw new sf;return new Lk(i,s,t)}constructor(e,t,i){this._disposables=new ke,this.ranges=e,this.provider=new Set;const r=[];for(const[s,o]of t){this._disposables.add(s),this.provider.add(o);for(const a of s.hints){const l=i.validatePosition(a.position);let c="before";const u=Lk._getRangeAtPosition(i,l);let d;u.getStartPosition().isBefore(l)?(d=$.fromPositions(u.getStartPosition(),l),c="after"):(d=$.fromPositions(l,u.getEndPosition()),c="before"),r.push(new Oue(a,new w7e(d,c),o))}}this.items=r.sort((s,o)=>he.compare(s.hint.position,o.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,r=e.getWordAtPosition(t);if(r)return new $(i,r.startColumn,i,r.endColumn);e.tokenization.tokenizeIfCheap(i);const s=e.tokenization.getLineTokens(i),o=t.column-1,a=s.findTokenIndexAtOffset(o);let l=s.getStartOffset(a),c=s.getEndOffset(a);return c-l===1&&(l===o&&a>1?(l=s.getStartOffset(a-1),c=s.getEndOffset(a-1)):c===o&&a=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Rm=function(n,e){return function(t,i){e(t,i,n)}};let cf=class extends ZN{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f){super(e,{...r.getRawOptions(),overflowWidgetsDomNode:r.getOverflowWidgetsDomNode()},i,s,o,a,l,c,u,d,h,f),this._parentEditor=r,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(r.onDidChangeConfiguration(g=>this._onParentConfigurationChanged(g)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){A$(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};cf=b5t([Rm(4,Tt),Rm(5,ai),Rm(6,_r),Rm(7,jt),Rm(8,go),Rm(9,Ts),Rm(10,_u),Rm(11,Zr),Rm(12,dt)],cf);const PCe=new Te(new Jn(0,122,204)),y5t={showArrow:!0,showFrame:!0,className:"",frameColor:PCe,arrowColor:PCe,keepEditorSelection:!1},w5t="vs.editor.contrib.zoneWidget";class C5t{constructor(e,t,i,r,s,o,a,l){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=r,this.showInHiddenAreas=a,this.ordinal=l,this._onDomNodeTop=s,this._onComputedHeight=o}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class x5t{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}let S5t=class C7e{static{this._IdGenerator=new Ile(".arrow-decoration-")}constructor(e){this._editor=e,this._ruleName=C7e._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),vX(this._ruleName)}set color(e){this._color!==e&&(this._color=e,this._updateStyle())}set height(e){this._height!==e&&(this._height=e,this._updateStyle())}_updateStyle(){vX(this._ruleName),Y6(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(e){e.column===1&&(e={lineNumber:e.lineNumber,column:2}),this._decorations.set([{range:$.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}};class k5t{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new ke,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=Qm(t),A$(this.options,y5t,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(i=>{const r=this._getWidth(i);this.domNode.style.width=r+"px",this.domNode.style.left=this._getLeft(i)+"px",this._onWidth(r)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new S5t(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(e){e.frameColor&&(this.options.frameColor=e.frameColor),e.arrowColor&&(this.options.arrowColor=e.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){const e=this.options.arrowColor.toString();this._arrow.color=e}}_getWidth(e){return e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}_getLeft(e){return e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+"px"}_onViewZoneHeight(e){if(this.domNode.style.height=`${e}px`,this.container){const t=e-this._decoratingElementsHeight();this.container.style.height=`${t}px`;const i=this.editor.getLayoutInfo();this._doLayout(t,this._getWidth(i))}this._resizeSash?.layout()}get position(){const e=this._positionMarkerId.getRange(0);if(e)return e.getStartPosition()}show(e,t){const i=$.isIRange(e)?$.lift(e):$.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:un.EMPTY}])}hide(){this._viewZone&&(this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._arrow?.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const e=this.editor.getOption(67);let t=0;if(this.options.showArrow){const i=Math.round(e/3);t+=2*i}if(this.options.showFrame){const i=Math.round(e/9);t+=2*i}return t}_showImpl(e,t){const i=e.getStartPosition(),r=this.editor.getLayoutInfo(),s=this._getWidth(r);this.domNode.style.width=`${s}px`,this.domNode.style.left=this._getLeft(r)+"px";const o=document.createElement("div");o.style.overflow="hidden";const a=this.editor.getOption(67);if(!this.options.allowUnlimitedHeight){const h=Math.max(12,this.editor.getLayoutInfo().height/a*.8);t=Math.min(t,h)}let l=0,c=0;if(this._arrow&&this.options.showArrow&&(l=Math.round(a/3),this._arrow.height=l,this._arrow.show(i)),this.options.showFrame&&(c=Math.round(a/9)),this.editor.changeViewZones(h=>{this._viewZone&&h.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new C5t(o,i.lineNumber,i.column,t,f=>this._onViewZoneTop(f),f=>this._onViewZoneHeight(f),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=h.addZone(this._viewZone),this._overlayWidget=new x5t(w5t+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this.container&&this.options.showFrame){const h=this.options.frameWidth?this.options.frameWidth:c;this.container.style.borderTopWidth=h+"px",this.container.style.borderBottomWidth=h+"px"}const u=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=l+"px",this.container.style.height=u+"px",this.container.style.overflow="hidden"),this._doLayout(u,s),this.options.keepEditorSelection||this.editor.setSelection(e);const d=this.editor.getModel();if(d){const h=d.validateRange(new $(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(h,h.startLineNumber===d.getLineCount())}}revealRange(e,t){t?this.editor.revealLineNearTop(e.endLineNumber,0):this.editor.revealRange(e,0)}setCssClass(e,t){this.container&&(t&&this.container.classList.remove(t),this.container.classList.add(e))}_onWidth(e){}_doLayout(e,t){}_relayout(e){this._viewZone&&this._viewZone.heightInLines!==e&&this.editor.changeViewZones(t=>{this._viewZone&&(this._viewZone.heightInLines=e,t.layoutZone(this._viewZone.id))})}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new $a(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let e;this._disposables.add(this._resizeSash.onDidStart(t=>{this._viewZone&&(e={startY:t.startY,heightInLines:this._viewZone.heightInLines})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{e=void 0})),this._disposables.add(this._resizeSash.onDidChange(t=>{if(e){const i=(t.currentY-e.startY)/this.editor.getOption(67),r=i<0?Math.ceil(i):Math.floor(i),s=e.heightInLines+r;s>5&&s<35&&this._relayout(s)}}))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const e=this.editor.getLayoutInfo();return e.width-e.minimap.minimapWidth}}var x7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},S7e=function(n,e){return function(t,i){e(t,i,n)}};const k7e=On("IPeekViewService");Vn(k7e,class{constructor(){this._widgets=new Map}addExclusiveWidget(n,e){const t=this._widgets.get(n);t&&(t.listener.dispose(),t.widget.dispose());const i=()=>{const r=this._widgets.get(n);r&&r.widget===e&&(r.listener.dispose(),this._widgets.delete(n))};this._widgets.set(n,{widget:e,listener:e.onDidClose(i)})}},1);var Dc;(function(n){n.inPeekEditor=new et("inReferenceSearchEditor",!0,w("inReferenceSearchEditor","Whether the current code editor is embedded inside peek")),n.notInPeekEditor=n.inPeekEditor.toNegated()})(Dc||(Dc={}));let O9=class{static{this.ID="editor.contrib.referenceController"}constructor(e,t){e instanceof cf&&Dc.inPeekEditor.bindTo(t)}dispose(){}};O9=x7e([S7e(1,jt)],O9);Zn(O9.ID,O9,0);function E5t(n){const e=n.get(ai).getFocusedCodeEditor();return e instanceof cf?e.getParentEditor():e}const L5t={headerBackgroundColor:Te.white,primaryHeadingColor:Te.fromHex("#333333"),secondaryHeadingColor:Te.fromHex("#6c6c6cb3")};let M9=class extends k5t{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new fe,this.onDidClose=this._onDidClose.event,A$(this.options,L5t,!1)}dispose(){this.disposed||(this.disposed=!0,super.dispose(),this._onDidClose.fire(this))}style(e){const t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();const e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=qe(".head"),this._bodyElement=qe(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=qe(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Jr(this._titleElement,"click",s=>this._onTitleClick(s))),Ne(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=qe("span.filename"),this._secondaryHeading=qe("span.dirname"),this._metaHeading=qe("span.meta"),Ne(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=qe(".peekview-actions");Ne(this._headElement,i);const r=this._getActionBarOptions();this._actionbarWidget=new ed(i,r),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(new su("peekview.close",w("label.close","Close"),zt.asClassName(ze.close),!0,()=>(this.dispose(),Promise.resolve())),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:xFe.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:Jo(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Qc(this._metaHeading)):Al(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}const i=Math.ceil(this.editor.getOption(67)*1.2),r=Math.round(e-(i+2));this._doLayoutHead(i,t),this._doLayoutBody(r,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};M9=x7e([S7e(2,Tt)],M9);const T5t=J("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Te.black,hcLight:Te.white},w("peekViewTitleBackground","Background color of the peek view title area.")),E7e=J("peekViewTitleLabel.foreground",{dark:Te.white,light:Te.black,hcDark:Te.white,hcLight:cm},w("peekViewTitleForeground","Color of the peek view title.")),L7e=J("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},w("peekViewTitleInfoForeground","Color of the peek view title info.")),D5t=J("peekView.border",{dark:Xp,light:Xp,hcDark:Yn,hcLight:Yn},w("peekViewBorder","Color of the peek view borders and arrow.")),I5t=J("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Te.black,hcLight:Te.white},w("peekViewResultsBackground","Background color of the peek view result list."));J("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Te.white,hcLight:cm},w("peekViewResultsMatchForeground","Foreground color for line nodes in the peek view result list."));J("peekViewResult.fileForeground",{dark:Te.white,light:"#1E1E1E",hcDark:Te.white,hcLight:cm},w("peekViewResultsFileForeground","Foreground color for file nodes in the peek view result list."));J("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},w("peekViewResultsSelectionBackground","Background color of the selected entry in the peek view result list."));J("peekViewResult.selectionForeground",{dark:Te.white,light:"#6C6C6C",hcDark:Te.white,hcLight:cm},w("peekViewResultsSelectionForeground","Foreground color of the selected entry in the peek view result list."));const T7e=J("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Te.black,hcLight:Te.white},w("peekViewEditorBackground","Background color of the peek view editor."));J("peekViewEditorGutter.background",T7e,w("peekViewEditorGutterBackground","Background color of the gutter in the peek view editor."));J("peekViewEditorStickyScroll.background",T7e,w("peekViewEditorStickScrollBackground","Background color of sticky scroll in the peek view editor."));J("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},w("peekViewResultsMatchHighlight","Match highlight color in the peek view result list."));J("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},w("peekViewEditorMatchHighlight","Match highlight color in the peek view editor."));J("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Ar,hcLight:Ar},w("peekViewEditorMatchHighlightBorder","Match highlight border in the peek view editor."));class Mb{constructor(e,t,i,r){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=r,this.id=nQ.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(e){this._range=e,this._rangeCallback(this)}get ariaMessage(){const e=this.parent.getPreview(this)?.preview(this.range);return e?w({key:"aria.oneReference.preview",comment:["Placeholders are: 0: filename, 1:line number, 2: column number, 3: preview snippet of source code"]},"{0} in {1} on line {2} at column {3}",e.value,th(this.uri),this.range.startLineNumber,this.range.startColumn):w("aria.oneReference","in {0} on line {1} at column {2}",th(this.uri),this.range.startLineNumber,this.range.startColumn)}}class A5t{constructor(e){this._modelReference=e}dispose(){this._modelReference.dispose()}preview(e,t=8){const i=this._modelReference.object.textEditorModel;if(!i)return;const{startLineNumber:r,startColumn:s,endLineNumber:o,endColumn:a}=e,l=i.getWordUntilPosition({lineNumber:r,column:s-t}),c=new $(r,l.startColumn,r,s),u=new $(o,a,o,1073741824),d=i.getValueInRange(c).replace(/^\s+/,""),h=i.getValueInRange(e),f=i.getValueInRange(u).replace(/\s+$/,"");return{value:d+h+f,highlight:{start:d.length,end:d.length+h.length}}}}class uR{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new so}dispose(){er(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?w("aria.fileReferences.1","1 symbol in {0}, full path {1}",th(this.uri),this.uri.fsPath):w("aria.fileReferences.N","{0} symbols in {1}, full path {2}",e,th(this.uri),this.uri.fsPath)}async resolve(e){if(this._previews.size!==0)return this;for(const t of this.children)if(!this._previews.has(t.uri))try{const i=await e.createModelReference(t.uri);this._previews.set(t.uri,new A5t(i))}catch(i){rn(i)}return this}}class lu{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new fe,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(lu._compareReferences);let r;for(const s of e)if((!r||!Nr.isEqual(r.uri,s.uri,!0))&&(r=new uR(this,s.uri),this.groups.push(r)),r.children.length===0||lu._compareReferences(s,r.children[r.children.length-1])!==0){const o=new Mb(i===s,r,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(o),r.children.push(o)}}dispose(){er(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new lu(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?w("aria.result.0","No results found"):this.references.length===1?w("aria.result.1","Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?w("aria.result.n1","Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):w("aria.result.nm","Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(e,t){const{parent:i}=e;let r=i.children.indexOf(e);const s=i.children.length,o=i.parent.groups.length;return o===1||t&&r+10?(t?r=(r+1)%s:r=(r+s-1)%s,i.children[r]):(r=i.parent.groups.indexOf(i),t?(r=(r+1)%o,i.parent.groups[r].children[0]):(r=(r+o-1)%o,i.parent.groups[r].children[i.parent.groups[r].children.length-1]))}nearestReference(e,t){const i=this.references.map((r,s)=>({idx:s,prefixLen:Cb(r.uri.toString(),e.toString()),offsetDist:Math.abs(r.range.startLineNumber-t.lineNumber)*100+Math.abs(r.range.startColumn-t.column)})).sort((r,s)=>r.prefixLen>s.prefixLen?-1:r.prefixLens.offsetDist?1:0)[0];if(i)return this.references[i.idx]}referenceAt(e,t){for(const i of this.references)if(i.uri.toString()===e.toString()&&$.containsPosition(i.range,t))return i}firstReference(){for(const e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return Nr.compare(e.uri,t.uri)||$.compareRangesUsingStarts(e.range,t.range)}}var fH=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gH=function(n,e){return function(t,i){e(t,i,n)}},Aee;let Nee=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof lu||e instanceof uR}getChildren(e){if(e instanceof lu)return e.groups;if(e instanceof uR)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};Nee=fH([gH(0,Nc)],Nee);class N5t{getHeight(){return 23}getTemplateId(e){return e instanceof uR?F9.id:pH.id}}let Ree=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){if(e instanceof Mb){const t=e.parent.getPreview(e)?.preview(e.range);if(t)return t.value}return th(e.uri)}};Ree=fH([gH(0,xi)],Ree);class R5t{getId(e){return e instanceof Mb?e.id:e.uri}}let Pee=class extends me{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new Q8(i,{supportHighlights:!0})),this.badge=new YQ(Ne(i,qe(".count")),{},wFe),e.appendChild(i)}set(e,t){const i=mW(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(i,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});const r=e.children.length;this.badge.setCount(r),r>1?this.badge.setTitleFormat(w("referencesCount","{0} references",r)):this.badge.setTitleFormat(w("referenceCount","{0} reference",r))}};Pee=fH([gH(1,pE)],Pee);let F9=class{static{Aee=this}static{this.id="FileReferencesRenderer"}constructor(e){this._instantiationService=e,this.templateId=Aee.id}renderTemplate(e){return this._instantiationService.createInstance(Pee,e)}renderElement(e,t,i){i.set(e.element,nO(e.filterData))}disposeTemplate(e){e.dispose()}};F9=Aee=fH([gH(0,Tt)],F9);class P5t extends me{constructor(e){super(),this.label=this._register(new cb(e))}set(e,t){const i=e.parent.getPreview(e)?.preview(e.range);if(!i||!i.value)this.label.set(`${th(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:r,highlight:s}=i;t&&!vg.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(r,nO(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(r,[s]))}}}class pH{constructor(){this.templateId=pH.id}static{this.id="OneReferenceRenderer"}renderTemplate(e){return new P5t(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}}class O5t{getWidgetAriaLabel(){return w("treeAriaLabel","References")}getAriaLabel(e){return e.ariaMessage}}var M5t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},yx=function(n,e){return function(t,i){e(t,i,n)}};class Mue{static{this.DecorationOptions=un.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"})}constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new ke,this._callOnModelChange=new ke,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const e=this._editor.getModel();if(e){for(const t of this._model.references)if(t.uri.toString()===e.uri.toString()){this._addDecorations(t.parent);return}}}_addDecorations(e){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));const t=[],i=[];for(let r=0,s=e.children.length;r{const s=r.deltaDecorations([],t);for(let o=0;o{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(B5t,"ReferencesWidget",this._treeContainer,new N5t,[this._instantiationService.createInstance(F9),this._instantiationService.createInstance(pH)],this._instantiationService.createInstance(Nee),i),this._splitView.addView({onDidChange:Ge.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},j8.Distribute),this._splitView.addView({onDidChange:Ge.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:s=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${s}px`,this._tree.layout(this._dim.height,s)}},j8.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));const r=(s,o)=>{s instanceof Mb&&(o==="show"&&this._revealReference(s,!1),this._onDidSelectReference.fire({element:s,kind:o,source:"tree"}))};this._disposables.add(this._tree.onDidOpen(s=>{s.sideBySide?r(s.element,"side"):s.editorOptions.pinned?r(s.element,"goto"):r(s.element,"show")})),Al(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new vi(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=w("noResults","No results"),Qc(this._messageContainer),Promise.resolve(void 0)):(Al(this._messageContainer),this._decorationsManager=new Mue(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{const{event:t,target:i}=e;if(t.detail!==2)return;const r=this._getFocusedReference();r&&this._onDidSelectReference.fire({element:{uri:r.uri,range:i.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),Qc(this._treeContainer),Qc(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[e]=this._tree.getFocus();if(e instanceof Mb)return e;if(e instanceof uR&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==sn.inMemory?this.setTitle(WCt(e.uri),this._uriLabel.getUriLabel(mW(e.uri))):this.setTitle(w("peekView.alternateTitle","References"));const i=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));const r=await i;if(!this._model){r.dispose();return}er(this._previewModelReference);const s=r.object;if(s){const o=this._preview.getModel()===s.textEditorModel?0:1,a=$.lift(e.range).collapseToStart();this._previewModelReference=r,this._preview.setModel(s.textEditorModel),this._preview.setSelection(a),this._preview.revealRangeInCenter(a,o)}else this._preview.setModel(this._previewNotAvailableMessage),r.dispose()}};Oee=M5t([yx(3,go),yx(4,Nc),yx(5,Tt),yx(6,k7e),yx(7,pE),yx(8,xi)],Oee);var $5t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},wx=function(n,e){return function(t,i){e(t,i,n)}},_F;const IC=new et("referenceSearchVisible",!1,w("referenceSearchVisible","Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let Gw=class{static{_F=this}static{this.ID="editor.contrib.referencesController"}static get(e){return e.getContribution(_F.ID)}constructor(e,t,i,r,s,o,a,l){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=r,this._notificationService=s,this._instantiationService=o,this._storageService=a,this._configurationService=l,this._disposables=new ke,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=IC.bindTo(i)}dispose(){this._referenceSearchVisible.reset(),this._disposables.dispose(),this._widget?.dispose(),this._model?.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(e,t,i){let r;if(this._widget&&(r=this._widget.position),this.closeWidget(),r&&e.containsPosition(r))return;this._peekMode=i,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));const s="peekViewLayout",o=F5t.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(Oee,this._editor,this._defaultTreeKeyboardSupport,o),this._widget.setTitle(w("labelLoading","Loading...")),this._widget.show(e),this._disposables.add(this._widget.onDidClose(()=>{t.cancel(),this._widget?(this._storageService.store(s,JSON.stringify(this._widget.layoutData),0,1),this._widget.isClosing||this.closeWidget(),this._widget=void 0):this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(l=>{const{element:c,kind:u}=l;if(c)switch(u){case"open":(l.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(c,!1,!1);break;case"side":this.openReference(c,!0,!1);break;case"goto":i?this._gotoReference(c,!0):this.openReference(c,!1,!0);break}}));const a=++this._requestIdPool;t.then(l=>{if(a!==this._requestIdPool||!this._widget){l.dispose();return}return this._model?.dispose(),this._model=l,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(w("metaTitle.N","{0} ({1})",this._model.title,this._model.references.length));const c=this._editor.getModel().uri,u=new he(e.startLineNumber,e.startColumn),d=this._model.nearestReference(c,u);if(d)return this._widget.setSelection(d).then(()=>{this._widget&&this._editor.getOption(87)==="editor"&&this._widget.focusOnPreviewEditor()})}})},l=>{this._notificationService.error(l)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;const t=this._widget.position;if(!t)return;const i=this._model.nearestReference(this._editor.getModel().uri,t);if(!i)return;const r=this._model.nextOrPreviousReference(i,e),s=this._editor.hasTextFocus(),o=this._widget.isPreviewEditorFocused();await this._widget.setSelection(r),await this._gotoReference(r,!1),s?this._editor.focus():this._widget&&o&&this._widget.focusOnPreviewEditor()}async revealReference(e){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(e)}closeWidget(e=!0){this._widget?.dispose(),this._model?.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(e,t){this._widget?.hide(),this._ignoreModelChangeEvent=!0;const i=$.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:i,selectionSource:"code.jump",pinned:t}},this._editor).then(r=>{if(this._ignoreModelChangeEvent=!1,!r||!this._widget){this.closeWidget();return}if(this._editor===r)this._widget.show(i),this._widget.focusOnReferenceTree();else{const s=_F.get(r),o=this._model.clone();this.closeWidget(),r.focus(),s?.toggleWidget(i,ko(a=>Promise.resolve(o)),this._peekMode??!1)}},r=>{this._ignoreModelChangeEvent=!1,rn(r)})}openReference(e,t,i){t||this.closeWidget();const{uri:r,range:s}=e;this._editorService.openCodeEditor({resource:r,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor,t)}};Gw=_F=$5t([wx(2,jt),wx(3,ai),wx(4,Ts),wx(5,Tt),wx(6,pf),wx(7,En)],Gw);function AC(n,e){const t=E5t(n);if(!t)return;const i=Gw.get(t);i&&e(i)}jl.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:js(2089,60),when:Le.or(IC,Dc.inPeekEditor),handler(n){AC(n,e=>{e.changeFocusBetweenPreviewAndReferences()})}});jl.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Le.or(IC,Dc.inPeekEditor),handler(n){AC(n,e=>{e.goToNextOrPreviousReference(!0)})}});jl.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Le.or(IC,Dc.inPeekEditor),handler(n){AC(n,e=>{e.goToNextOrPreviousReference(!1)})}});Un.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");Un.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");Un.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");Un.registerCommand("closeReferenceSearch",n=>AC(n,e=>e.closeWidget()));jl.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Le.and(Dc.inPeekEditor,Le.not("config.editor.stablePeek"))});jl.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Le.and(IC,Le.not("config.editor.stablePeek"),Le.or(Q.editorTextFocus,k6e.negate()))});jl.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Le.and(IC,T6e,mce.negate(),_ce.negate()),handler(n){const t=n.get(fh).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Mb&&AC(n,i=>i.revealReference(t[0]))}});jl.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Le.and(IC,T6e,mce.negate(),_ce.negate()),handler(n){const t=n.get(fh).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Mb&&AC(n,i=>i.openReference(t[0],!0,!0))}});Un.registerCommand("openReference",n=>{const t=n.get(fh).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Mb&&AC(n,i=>i.openReference(t[0],!1,!0))});var D7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},FD=function(n,e){return function(t,i){e(t,i,n)}};const Fue=new et("hasSymbols",!1,w("hasSymbols","Whether there are symbol locations that can be navigated via keyboard-only.")),mH=On("ISymbolNavigationService");let Mee=class{constructor(e,t,i,r){this._editorService=t,this._notificationService=i,this._keybindingService=r,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=Fue.bindTo(e)}reset(){this._ctxHasSymbols.reset(),this._currentState?.dispose(),this._currentMessage?.dispose(),this._currentModel=void 0,this._currentIdx=-1}put(e){const t=e.parent.parent;if(t.references.length<=1){this.reset();return}this._currentModel=t,this._currentIdx=t.references.indexOf(e),this._ctxHasSymbols.set(!0),this._showMessage();const i=new Fee(this._editorService),r=i.onDidChange(s=>{if(this._ignoreEditorChange)return;const o=this._editorService.getActiveCodeEditor();if(!o)return;const a=o.getModel(),l=o.getPosition();if(!a||!l)return;let c=!1,u=!1;for(const d of t.references)if(kN(d.uri,a.uri))c=!0,u=u||$.containsPosition(d.range,l);else if(c)break;(!c||!u)&&this.reset()});this._currentState=Qh(i,r)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:$.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){this._currentMessage?.dispose();const e=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),t=e?w("location.kb","Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,e.getLabel()):w("location","Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};Mee=D7e([FD(0,jt),FD(1,ai),FD(2,Ts),FD(3,xi)],Mee);Vn(mH,Mee,1);Je(new class extends fo{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:Fue,kbOpts:{weight:100,primary:70}})}runEditorCommand(n,e){return n.get(mH).revealNext(e)}});jl.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:Fue,primary:9,handler(n){n.get(mH).reset()}});let Fee=class{constructor(e){this._listener=new Map,this._disposables=new ke,this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._disposables.add(e.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(e.onCodeEditorAdd(this._onDidAddEditor,this)),e.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),er(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,Qh(e.onDidChangeCursorPosition(t=>this._onDidChange.fire({editor:e})),e.onDidChangeModelContent(t=>this._onDidChange.fire({editor:e}))))}_onDidRemoveEditor(e){this._listener.get(e)?.dispose(),this._listener.delete(e)}};Fee=D7e([FD(0,ai)],Fee);function Bee(n,e){return e.uri.scheme===n.uri.scheme?!0:!mX(e.uri,sn.walkThroughSnippet,sn.vscodeChatCodeBlock,sn.vscodeChatCodeCompareBlock)}async function kO(n,e,t,i,r){const o=t.ordered(n,i).map(l=>Promise.resolve(r(l,n,e)).then(void 0,c=>{vs(c)})),a=await Promise.all(o);return rf(a.flat()).filter(l=>Bee(n,l))}function EO(n,e,t,i,r){return kO(e,t,n,i,(s,o,a)=>s.provideDefinition(o,a,r))}function Bue(n,e,t,i,r){return kO(e,t,n,i,(s,o,a)=>s.provideDeclaration(o,a,r))}function $ue(n,e,t,i,r){return kO(e,t,n,i,(s,o,a)=>s.provideImplementation(o,a,r))}function Wue(n,e,t,i,r){return kO(e,t,n,i,(s,o,a)=>s.provideTypeDefinition(o,a,r))}function LO(n,e,t,i,r,s){return kO(e,t,n,r,async(o,a,l)=>{const c=(await o.provideReferences(a,l,{includeDeclaration:!0},s))?.filter(d=>Bee(a,d));if(!i||!c||c.length!==2)return c;const u=(await o.provideReferences(a,l,{includeDeclaration:!1},s))?.filter(d=>Bee(a,d));return u&&u.length===1?u:c})}async function fm(n){const e=await n(),t=new lu(e,""),i=t.references.map(r=>r.link);return t.dispose(),i}Rc("_executeDefinitionProvider",(n,e,t)=>{const i=n.get(dt),r=EO(i.definitionProvider,e,t,!1,yn.None);return fm(()=>r)});Rc("_executeDefinitionProvider_recursive",(n,e,t)=>{const i=n.get(dt),r=EO(i.definitionProvider,e,t,!0,yn.None);return fm(()=>r)});Rc("_executeTypeDefinitionProvider",(n,e,t)=>{const i=n.get(dt),r=Wue(i.typeDefinitionProvider,e,t,!1,yn.None);return fm(()=>r)});Rc("_executeTypeDefinitionProvider_recursive",(n,e,t)=>{const i=n.get(dt),r=Wue(i.typeDefinitionProvider,e,t,!0,yn.None);return fm(()=>r)});Rc("_executeDeclarationProvider",(n,e,t)=>{const i=n.get(dt),r=Bue(i.declarationProvider,e,t,!1,yn.None);return fm(()=>r)});Rc("_executeDeclarationProvider_recursive",(n,e,t)=>{const i=n.get(dt),r=Bue(i.declarationProvider,e,t,!0,yn.None);return fm(()=>r)});Rc("_executeReferenceProvider",(n,e,t)=>{const i=n.get(dt),r=LO(i.referenceProvider,e,t,!1,!1,yn.None);return fm(()=>r)});Rc("_executeReferenceProvider_recursive",(n,e,t)=>{const i=n.get(dt),r=LO(i.referenceProvider,e,t,!1,!0,yn.None);return fm(()=>r)});Rc("_executeImplementationProvider",(n,e,t)=>{const i=n.get(dt),r=$ue(i.implementationProvider,e,t,!1,yn.None);return fm(()=>r)});Rc("_executeImplementationProvider_recursive",(n,e,t)=>{const i=n.get(dt),r=$ue(i.implementationProvider,e,t,!0,yn.None);return fm(()=>r)});Fo.appendMenuItem(ce.EditorContext,{submenu:ce.EditorContextPeek,title:w("peek.submenu","Peek"),group:"navigation",order:100});class NE{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof NE||he.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}class lc extends Fg{static{this._allSymbolNavigationCommands=new Map}static{this._activeAlternativeCommands=new Set}static all(){return lc._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of zn.wrap(t.menu))(i.id===ce.EditorContext||i.id===ce.EditorContextPeek)&&(i.when=Le.and(e.precondition,i.when));return t}constructor(e,t){super(lc._patchConfig(t)),this.configuration=e,lc._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,r){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(Ts),o=e.get(ai),a=e.get(Qb),l=e.get(mH),c=e.get(dt),u=e.get(Tt),d=t.getModel(),h=t.getPosition(),f=NE.is(i)?i:new NE(d,h),g=new Pb(t,5),p=YP(this._getLocationModel(c,f.model,f.position,g.token),g.token).then(async m=>{if(!m||g.token.isCancellationRequested)return;ql(m.ariaMessage);let _;if(m.referenceAt(d.uri,h)){const y=this._getAlternativeCommand(t);!lc._activeAlternativeCommands.has(y)&&lc._allSymbolNavigationCommands.has(y)&&(_=lc._allSymbolNavigationCommands.get(y))}const v=m.references.length;if(v===0){if(!this.configuration.muteMessage){const y=d.getWordAtPosition(h);au.get(t)?.showMessage(this._getNoResultFoundMessage(y),h)}}else if(v===1&&_)lc._activeAlternativeCommands.add(this.desc.id),u.invokeFunction(y=>_.runEditorCommand(y,t,i,r).finally(()=>{lc._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(o,l,t,m,r)},m=>{s.error(m)}).finally(()=>{g.dispose()});return a.showWhile(p,250),p}async _onResult(e,t,i,r,s){const o=this._getGoToPreference(i);if(!(i instanceof cf)&&(this.configuration.openInPeek||o==="peek"&&r.references.length>1))this._openInPeek(i,r,s);else{const a=r.firstReference(),l=r.references.length>1&&o==="gotoAndPeek",c=await this._openReference(i,e,a,this.configuration.openToSide,!l);l&&c?this._openInPeek(c,r,s):r.dispose(),o==="goto"&&t.put(a)}}async _openReference(e,t,i,r,s){let o;if(Qmt(i)&&(o=i.targetSelectionRange),o||(o=i.range),!o)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:$.collapseToStart(o),selectionRevealType:3,selectionSource:"code.jump"}},e,r);if(a){if(s){const l=a.getModel(),c=a.createDecorationsCollection([{range:o,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===l&&c.clear()},350)}return a}}_openInPeek(e,t,i){const r=Gw.get(e);r&&e.hasModel()?r.toggleWidget(i??e.getSelection(),ko(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}}class TO extends lc{async _getLocationModel(e,t,i,r){return new lu(await EO(e.definitionProvider,t,i,!1,r),w("def.title","Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?w("noResultWord","No definition found for '{0}'",e.word):w("generic.noResults","No definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleDefinitions}}lr(class $ee extends TO{static{this.id="editor.action.revealDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:$ee.id,title:{...Gt("actions.goToDecl.label","Go to Definition"),mnemonicTitle:w({key:"miGotoDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Definition")},precondition:Q.hasDefinitionProvider,keybinding:[{when:Q.editorTextFocus,primary:70,weight:100},{when:Le.and(Q.editorTextFocus,x6e),primary:2118,weight:100}],menu:[{id:ce.EditorContext,group:"navigation",order:1.1},{id:ce.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),Un.registerCommandAlias("editor.action.goToDeclaration",$ee.id)}});lr(class Wee extends TO{static{this.id="editor.action.revealDefinitionAside"}constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Wee.id,title:Gt("actions.goToDeclToSide.label","Open Definition to the Side"),precondition:Le.and(Q.hasDefinitionProvider,Q.isInEmbeddedEditor.toNegated()),keybinding:[{when:Q.editorTextFocus,primary:js(2089,70),weight:100},{when:Le.and(Q.editorTextFocus,x6e),primary:js(2089,2118),weight:100}]}),Un.registerCommandAlias("editor.action.openDeclarationToTheSide",Wee.id)}});lr(class Hee extends TO{static{this.id="editor.action.peekDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Hee.id,title:Gt("actions.previewDecl.label","Peek Definition"),precondition:Le.and(Q.hasDefinitionProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),keybinding:{when:Q.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:ce.EditorContextPeek,group:"peek",order:2}}),Un.registerCommandAlias("editor.action.previewDeclaration",Hee.id)}});class I7e extends lc{async _getLocationModel(e,t,i,r){return new lu(await Bue(e.declarationProvider,t,i,!1,r),w("decl.title","Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?w("decl.noResultWord","No declaration found for '{0}'",e.word):w("decl.generic.noResults","No declaration found")}_getAlternativeCommand(e){return e.getOption(58).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(58).multipleDeclarations}}lr(class A7e extends I7e{static{this.id="editor.action.revealDeclaration"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:A7e.id,title:{...Gt("actions.goToDeclaration.label","Go to Declaration"),mnemonicTitle:w({key:"miGotoDeclaration",comment:["&& denotes a mnemonic"]},"Go to &&Declaration")},precondition:Le.and(Q.hasDeclarationProvider,Q.isInEmbeddedEditor.toNegated()),menu:[{id:ce.EditorContext,group:"navigation",order:1.3},{id:ce.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?w("decl.noResultWord","No declaration found for '{0}'",e.word):w("decl.generic.noResults","No declaration found")}});lr(class extends I7e{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:Gt("actions.peekDecl.label","Peek Declaration"),precondition:Le.and(Q.hasDeclarationProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),menu:{id:ce.EditorContextPeek,group:"peek",order:3}})}});class N7e extends lc{async _getLocationModel(e,t,i,r){return new lu(await Wue(e.typeDefinitionProvider,t,i,!1,r),w("typedef.title","Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?w("goToTypeDefinition.noResultWord","No type definition found for '{0}'",e.word):w("goToTypeDefinition.generic.noResults","No type definition found")}_getAlternativeCommand(e){return e.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(58).multipleTypeDefinitions}}lr(class R7e extends N7e{static{this.ID="editor.action.goToTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:R7e.ID,title:{...Gt("actions.goToTypeDefinition.label","Go to Type Definition"),mnemonicTitle:w({key:"miGotoTypeDefinition",comment:["&& denotes a mnemonic"]},"Go to &&Type Definition")},precondition:Q.hasTypeDefinitionProvider,keybinding:{when:Q.editorTextFocus,primary:0,weight:100},menu:[{id:ce.EditorContext,group:"navigation",order:1.4},{id:ce.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}});lr(class P7e extends N7e{static{this.ID="editor.action.peekTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:P7e.ID,title:Gt("actions.peekTypeDefinition.label","Peek Type Definition"),precondition:Le.and(Q.hasTypeDefinitionProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),menu:{id:ce.EditorContextPeek,group:"peek",order:4}})}});class O7e extends lc{async _getLocationModel(e,t,i,r){return new lu(await $ue(e.implementationProvider,t,i,!1,r),w("impl.title","Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?w("goToImplementation.noResultWord","No implementation found for '{0}'",e.word):w("goToImplementation.generic.noResults","No implementation found")}_getAlternativeCommand(e){return e.getOption(58).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(58).multipleImplementations}}lr(class M7e extends O7e{static{this.ID="editor.action.goToImplementation"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:M7e.ID,title:{...Gt("actions.goToImplementation.label","Go to Implementations"),mnemonicTitle:w({key:"miGotoImplementation",comment:["&& denotes a mnemonic"]},"Go to &&Implementations")},precondition:Q.hasImplementationProvider,keybinding:{when:Q.editorTextFocus,primary:2118,weight:100},menu:[{id:ce.EditorContext,group:"navigation",order:1.45},{id:ce.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}});lr(class F7e extends O7e{static{this.ID="editor.action.peekImplementation"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:F7e.ID,title:Gt("actions.peekImplementation.label","Peek Implementations"),precondition:Le.and(Q.hasImplementationProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),keybinding:{when:Q.editorTextFocus,primary:3142,weight:100},menu:{id:ce.EditorContextPeek,group:"peek",order:5}})}});class B7e extends lc{_getNoResultFoundMessage(e){return e?w("references.no","No references found for '{0}'",e.word):w("references.noGeneric","No references found")}_getAlternativeCommand(e){return e.getOption(58).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(58).multipleReferences}}lr(class extends B7e{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...Gt("goToReferences.label","Go to References"),mnemonicTitle:w({key:"miGotoReference",comment:["&& denotes a mnemonic"]},"Go to &&References")},precondition:Le.and(Q.hasReferenceProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),keybinding:{when:Q.editorTextFocus,primary:1094,weight:100},menu:[{id:ce.EditorContext,group:"navigation",order:1.45},{id:ce.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,r){return new lu(await LO(e.referenceProvider,t,i,!0,!1,r),w("ref.title","References"))}});lr(class extends B7e{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:Gt("references.action.label","Peek References"),precondition:Le.and(Q.hasReferenceProvider,Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated()),menu:{id:ce.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,r){return new lu(await LO(e.referenceProvider,t,i,!1,!1,r),w("ref.title","References"))}});class W5t extends lc{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:Gt("label.generic","Go to Any Symbol"),precondition:Le.and(Dc.notInPeekEditor,Q.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,r){return new lu(this._references,w("generic.title","Locations"))}_getNoResultFoundMessage(e){return e&&w("generic.noResult","No results for '{0}'",e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}Un.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Pt},{name:"position",description:"The position at which to start",constraint:he.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(n,e,t,i,r,s,o)=>{oi(Pt.isUri(e)),oi(he.isIPosition(t)),oi(Array.isArray(i)),oi(typeof r>"u"||typeof r=="string"),oi(typeof o>"u"||typeof o=="boolean");const a=n.get(ai),l=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(im(l))return l.setPosition(t),l.revealPositionInCenterIfOutsideViewport(t,0),l.invokeWithinContext(c=>{const u=new class extends W5t{_getNoResultFoundMessage(d){return s||super._getNoResultFoundMessage(d)}}({muteMessage:!s,openInPeek:!!o,openToSide:!1},i,r);c.get(Tt).invokeFunction(u.run.bind(u),l)})}});Un.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:Pt},{name:"position",description:"The position at which to start",constraint:he.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"}]},handler:async(n,e,t,i,r)=>{n.get(_r).executeCommand("editor.action.goToLocations",e,t,i,r,void 0,!0)}});Un.registerCommand({id:"editor.action.findReferences",handler:(n,e,t)=>{oi(Pt.isUri(e)),oi(he.isIPosition(t));const i=n.get(dt),r=n.get(ai);return r.openCodeEditor({resource:e},r.getFocusedCodeEditor()).then(s=>{if(!im(s)||!s.hasModel())return;const o=Gw.get(s);if(!o)return;const a=ko(c=>LO(i.referenceProvider,s.getModel(),he.lift(t),!1,!1,c).then(u=>new lu(u,w("ref.title","References")))),l=new $(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(o.toggleWidget(l,a,!1))})}});Un.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function H5t(n,e,t,i){const r=n.get(Nc),s=n.get(mu),o=n.get(_r),a=n.get(Tt),l=n.get(Ts);if(await i.item.resolve(yn.None),!i.part.location)return;const c=i.part.location,u=[],d=new Set(Fo.getMenuItems(ce.EditorContext).map(f=>lk(f)?f.command.id:aH()));for(const f of lc.all())d.has(f.desc.id)&&u.push(new su(f.desc.id,ou.label(f.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const g=await r.createModelReference(c.uri);try{const p=new NE(g.object.textEditorModel,$.getStartPosition(c.range)),m=i.item.anchor.range;await a.invokeFunction(f.runEditorCommand.bind(f),e,p,m)}finally{g.dispose()}}));if(i.part.command){const{command:f}=i.part;u.push(new na),u.push(new su(f.id,f.title,void 0,!0,async()=>{try{await o.executeCommand(f.id,...f.arguments??[])}catch(g){l.notify({severity:iW.Error,source:i.item.provider.displayName,message:g})}}))}const h=e.getOption(128);s.showContextMenu({domForShadowRoot:h?e.getDomNode()??void 0:void 0,getAnchor:()=>{const f=ms(t);return{x:f.left,y:f.top+f.height+8}},getActions:()=>u,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function $7e(n,e,t,i){const s=await n.get(Nc).createModelReference(i.uri);await t.invokeWithinContext(async o=>{const a=e.hasSideBySideModifier,l=o.get(jt),c=Dc.inPeekEditor.getValue(l),u=!a&&t.getOption(89)&&!c;return new TO({openToSide:a,openInPeek:u,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(o,new NE(s.object.textEditorModel,$.getStartPosition(i.range)),$.lift(i.range))}),s.dispose()}var V5t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Cx=function(n,e){return function(t,i){e(t,i,n)}},Qx;class B9{constructor(){this._entries=new lm(50)}get(e){const t=B9._key(e);return this._entries.get(t)}set(e,t){const i=B9._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const W7e=On("IInlayHintsCache");Vn(W7e,B9,1);class Vee{constructor(e,t){this.item=e,this.index=t}get part(){const e=this.item.hint.label;return typeof e=="string"?{label:e}:e[this.index]}}class z5t{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}let dR=class{static{Qx=this}static{this.ID="editor.contrib.InlayHints"}static{this._MAX_DECORATORS=1500}static{this._MAX_LABEL_LEN=43}static get(e){return e.getContribution(Qx.ID)??void 0}constructor(e,t,i,r,s,o,a){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=r,this._commandService=s,this._notificationService=o,this._instaService=a,this._disposables=new ke,this._sessionDisposables=new ke,this._decorationsMetadata=new Map,this._ruleFactory=new VW(this._editor),this._activeRenderMode=0,this._debounceInfo=i.for(t.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(t.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(l=>{l.hasChanged(142)&&this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const e=this._editor.getOption(142);if(e.enabled==="off")return;const t=this._editor.getModel();if(!t||!this._languageFeaturesService.inlayHintsProvider.has(t))return;if(e.enabled==="on")this._activeRenderMode=0;else{let a,l;e.enabled==="onUnlessPressed"?(a=0,l=1):(a=1,l=0),this._activeRenderMode=a,this._sessionDisposables.add(f_.getInstance().event(c=>{if(!this._editor.hasModel())return;const u=c.altKey&&c.ctrlKey&&!(c.shiftKey||c.metaKey)?l:a;if(u!==this._activeRenderMode){this._activeRenderMode=u;const d=this._editor.getModel(),h=this._copyInlayHintsWithCurrentAnchor(d);this._updateHintsDecorators([d.getFullModelRange()],h),o.schedule(0)}}))}const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(Lt(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let r;const s=new Set,o=new Ui(async()=>{const a=Date.now();r?.dispose(!0),r=new Kr;const l=t.onWillDispose(()=>r?.cancel());try{const c=r.token,u=await Lk.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),c);if(o.delay=this._debounceInfo.update(t,Date.now()-a),c.isCancellationRequested){u.dispose();return}for(const d of u.provider)typeof d.onDidChangeInlayHints=="function"&&!s.has(d)&&(s.add(d),this._sessionDisposables.add(d.onDidChangeInlayHints(()=>{o.isScheduled()||o.schedule()})));this._sessionDisposables.add(u),this._updateHintsDecorators(u.ranges,u.items),this._cacheHintsForFastRestore(t)}catch(c){rn(c)}finally{r.dispose(),l.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(o),this._sessionDisposables.add(Lt(()=>r?.dispose(!0))),o.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(a=>{(a.scrollTopChanged||!o.isScheduled())&&o.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeModelContent(a=>{r?.cancel();const l=Math.max(o.delay,1250);o.schedule(l)})),this._sessionDisposables.add(this._installDblClickGesture(()=>o.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new ke,t=e.add(new hH(this._editor)),i=new ke;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown(r=>{const[s]=r,o=this._getInlayHintLabelPart(s),a=this._editor.getModel();if(!o||!a){i.clear();return}const l=new Kr;i.add(Lt(()=>l.dispose(!0))),o.item.resolve(l.token),this._activeInlayHintPart=o.part.command||o.part.location?new z5t(o,s.hasTriggerModifier):void 0;const c=a.validatePosition(o.item.hint.position).lineNumber,u=new $(c,1,c,a.getLineMaxColumn(c)),d=this._getInlineHintsForRange(u);this._updateHintsDecorators([u],d),i.add(Lt(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([u],d)}))})),e.add(t.onCancel(()=>i.clear())),e.add(t.onExecute(async r=>{const s=this._getInlayHintLabelPart(r);if(s){const o=s.part;o.location?this._instaService.invokeFunction($7e,r,this._editor,o.location):mZ.is(o.command)&&await this._invokeCommand(o.command,s.item)}})),e}_getInlineHintsForRange(e){const t=new Set;for(const i of this._decorationsMetadata.values())e.containsRange(i.item.anchor.range)&&t.add(i.item);return Array.from(t)}_installDblClickGesture(e){return this._editor.onMouseUp(async t=>{if(t.event.detail!==2)return;const i=this._getInlayHintLabelPart(t);if(i&&(t.event.preventDefault(),await i.item.resolve(yn.None),bl(i.item.hint.textEdits))){const r=i.item.hint.textEdits.map(s=>jr.replace($.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",r),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!Eo(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(H5t,this._editor,e.event.target,t)})}_getInlayHintLabelPart(e){if(e.target.type!==6)return;const t=e.target.detail.injectedText?.options;if(t instanceof Ab&&t?.attachedData instanceof Vee)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:iW.Error,source:t.provider.displayName,message:i})}}_cacheHintsForFastRestore(e){const t=this._copyInlayHintsWithCurrentAnchor(e);this._inlayHintsCache.set(e,t)}_copyInlayHintsWithCurrentAnchor(e){const t=new Map;for(const[i,r]of this._decorationsMetadata){if(t.has(r.item))continue;const s=e.getDecorationRange(i);if(s){const o=new w7e(s,r.item.anchor.direction),a=r.item.with({anchor:o});t.set(r.item,a)}}return Array.from(t.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),r=[];for(const s of i.sort($.compareRangesUsingStarts)){const o=t.validateRange(new $(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));r.length===0||!$.areIntersectingOrTouching(r[r.length-1],o)?r.push(o):r[r.length-1]=$.plusRange(r[r.length-1],o)}return r}_updateHintsDecorators(e,t){const i=[],r=(g,p,m,_,v)=>{const y={content:m,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:p.className,cursorStops:_,attachedData:v};i.push({item:g,classNameRef:p,decoration:{range:g.anchor.range,options:{description:"InlayHint",showIfCollapsed:g.anchor.range.isEmpty(),collapseOnReplaceEdit:!g.anchor.range.isEmpty(),stickiness:0,[g.anchor.direction]:this._activeRenderMode===0?y:void 0}}})},s=(g,p)=>{const m=this._ruleFactory.createClassNameRef({width:`${o/3|0}px`,display:"inline-block"});r(g,m," ",p?Kh.Right:Kh.None)},{fontSize:o,fontFamily:a,padding:l,isUniform:c}=this._getLayoutInfo(),u="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(u,a);let d={line:0,totalLen:0};for(const g of t){if(d.line!==g.anchor.range.startLineNumber&&(d={line:g.anchor.range.startLineNumber,totalLen:0}),d.totalLen>Qx._MAX_LABEL_LEN)continue;g.hint.paddingLeft&&s(g,!1);const p=typeof g.hint.label=="string"?[{label:g.hint.label}]:g.hint.label;for(let m=0;m0&&(x=x.slice(0,-L)+"…",k=!0),r(g,this._ruleFactory.createClassNameRef(C),U5t(x),y&&!g.hint.paddingRight?Kh.Right:Kh.None,new Vee(g,m)),k)break}if(g.hint.paddingRight&&s(g,!0),i.length>Qx._MAX_DECORATORS)break}const h=[];for(const[g,p]of this._decorationsMetadata){const m=this._editor.getModel()?.getDecorationRange(g);m&&e.some(_=>_.containsRange(m))&&(h.push(g),p.classNameRef.dispose(),this._decorationsMetadata.delete(g))}const f=Ag.capture(this._editor);this._editor.changeDecorations(g=>{const p=g.deltaDecorations(h,i.map(m=>m.decoration));for(let m=0;mi)&&(s=i);const o=e.fontFamily||r;return{fontSize:s,fontFamily:o,padding:t,isUniform:!t&&o===r&&s===i}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}};dR=Qx=V5t([Cx(1,dt),Cx(2,cd),Cx(3,W7e),Cx(4,_r),Cx(5,Ts),Cx(6,Tt)],dR);function U5t(n){return n.replace(/[ \t]/g," ")}Un.registerCommand("_executeInlayHintProvider",async(n,...e)=>{const[t,i]=e;oi(Pt.isUri(t)),oi($.isIRange(i));const{inlayHintsProvider:r}=n.get(dt),s=await n.get(Nc).createModelReference(t);try{const o=await Lk.create(r,s.object.textEditorModel,[$.lift(i)],yn.None),a=o.items.map(l=>l.hint);return setTimeout(()=>o.dispose(),0),a}finally{s.dispose()}});var j5t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},U0=function(n,e){return function(t,i){e(t,i,n)}};class OCe extends gF{constructor(e,t,i,r){super(10,t,e.item.anchor.range,i,r,!0),this.part=e}}let $9=class extends cR{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,o,l,r,s,c),this._resolverService=a,this.hoverOrdinal=6}suggestHoverAnchor(e){if(!dR.get(this._editor)||e.target.type!==6)return null;const i=e.target.detail.injectedText?.options;return i instanceof Ab&&i.attachedData instanceof Vee?new OCe(i.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i){return e instanceof OCe?new to(async r=>{const{part:s}=e;if(await s.item.resolve(i),i.isCancellationRequested)return;let o;typeof s.item.hint.tooltip=="string"?o=new za().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(o=s.item.hint.tooltip),o&&r.emitOne(new Uh(this,e.range,[o],!1,0)),bl(s.item.hint.textEdits)&&r.emitOne(new Uh(this,e.range,[new za().appendText(w("hint.dbl","Double-click to insert"))],!1,10001));let a;if(typeof s.part.tooltip=="string"?a=new za().appendText(s.part.tooltip):s.part.tooltip&&(a=s.part.tooltip),a&&r.emitOne(new Uh(this,e.range,[a],!1,1)),s.part.location||s.part.command){let c;const d=this._editor.getOption(78)==="altKey"?Rn?w("links.navigate.kb.meta.mac","cmd + click"):w("links.navigate.kb.meta","ctrl + click"):Rn?w("links.navigate.kb.alt.mac","option + click"):w("links.navigate.kb.alt","alt + click");s.part.location&&s.part.command?c=new za().appendText(w("hint.defAndCommand","Go to Definition ({0}), right click for more",d)):s.part.location?c=new za().appendText(w("hint.def","Go to Definition ({0})",d)):s.part.command&&(c=new za(`[${w("hint.cmd","Execute Command")}](${v5t(s.part.command)} "${s.part.command.title}") (${d})`,{isTrusted:!0})),c&&r.emitOne(new Uh(this,e.range,[c],!1,1e4))}const l=await this._resolveInlayHintLabelPartHover(s,i);for await(const c of l)r.emitOne(c)}):to.EMPTY}async _resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return to.EMPTY;const{uri:i,range:r}=e.part.location,s=await this._resolverService.createModelReference(i);try{const o=s.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(o)?Pue(this._languageFeaturesService.hoverProvider,o,new he(r.startLineNumber,r.startColumn),t).filter(a=>!fE(a.hover.contents)).map(a=>new Uh(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal)):to.EMPTY}finally{s.dispose()}}};$9=j5t([U0(1,Hr),U0(2,Pc),U0(3,xi),U0(4,um),U0(5,En),U0(6,Nc),U0(7,dt),U0(8,_r)],$9);class Hue extends me{constructor(e,t,i,r,s,o){super();const a=t.anchor,l=t.hoverParts;this._renderedHoverParts=this._register(new Vue(e,i,l,o,s));const{showAtPosition:c,showAtSecondaryPosition:u}=Hue.computeHoverPositions(e,a.range,l);this.shouldAppearBeforeContent=l.some(d=>d.isBeforeContent),this.showAtPosition=c,this.showAtSecondaryPosition=u,this.initialMousePosX=a.initialMousePosX,this.initialMousePosY=a.initialMousePosY,this.shouldFocus=r.shouldFocus,this.source=r.source}get domNode(){return this._renderedHoverParts.domNode}get domNodeHasChildren(){return this._renderedHoverParts.domNodeHasChildren}get focusedHoverPartIndex(){return this._renderedHoverParts.focusedHoverPartIndex}async updateHoverVerbosityLevel(e,t,i){this._renderedHoverParts.updateHoverVerbosityLevel(e,t,i)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(e,t,i){let r=1;if(e.hasModel()){const u=e._getViewModel(),d=u.coordinatesConverter,h=d.convertModelRangeToViewRange(t),f=u.getLineMinColumn(h.startLineNumber),g=new he(h.startLineNumber,f);r=d.convertViewPositionToModelPosition(g).column}const s=t.startLineNumber;let o=t.startColumn,a;for(const u of i){const d=u.range,h=d.startLineNumber===s,f=d.endLineNumber===s;if(h&&f){const p=d.startColumn,m=Math.min(o,p);o=Math.max(m,r)}u.forceShowAtRange&&(a=d)}let l,c;if(a){const u=a.getStartPosition();l=u,c=u}else l=t.getStartPosition(),c=new he(s,o);return{showAtPosition:l,showAtSecondaryPosition:c}}}class q5t{constructor(e,t){this._statusBar=t,e.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}}class Vue extends me{static{this._DECORATION_OPTIONS=un.register({description:"content-hover-highlight",className:"hoverHighlight"})}constructor(e,t,i,r,s){super(),this._renderedParts=[],this._focusedHoverPartIndex=-1,this._context=s,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(t,i,s,r)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(e,i)),this._updateMarkdownAndColorParticipantInfo(t)}_createEditorDecorations(e,t){if(t.length===0)return me.None;let i=t[0].range;for(const s of t){const o=s.range;i=$.plusRange(i,o)}const r=e.createDecorationsCollection();return r.set([{range:i,options:Vue._DECORATION_OPTIONS}]),Lt(()=>{r.clear()})}_renderParts(e,t,i,r){const s=new P9(r),o={fragment:this._fragment,statusBar:s,...i},a=new ke;for(const c of e){const u=this._renderHoverPartsForParticipant(t,c,o);a.add(u);for(const d of u.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:c,hoverPart:d.hoverPart,hoverElement:d.hoverElement})}const l=this._renderStatusBar(this._fragment,s);return l&&(a.add(l),this._renderedParts.push({type:"statusBar",hoverElement:l.hoverElement,actions:l.actions})),Lt(()=>{a.dispose()})}_renderHoverPartsForParticipant(e,t,i){const r=e.filter(o=>o.owner===t);return r.length>0?t.renderHoverParts(i,r):new Kw([])}_renderStatusBar(e,t){if(t.hasContent)return new q5t(e,t)}_registerListenersOnRenderedParts(){const e=new ke;return this._renderedParts.forEach((t,i)=>{const r=t.hoverElement;r.tabIndex=0,e.add(Ce(r,je.FOCUS_IN,s=>{s.stopPropagation(),this._focusedHoverPartIndex=i})),e.add(Ce(r,je.FOCUS_OUT,s=>{s.stopPropagation(),this._focusedHoverPartIndex=-1}))}),e}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof cR&&!(i instanceof $9));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof aR)}async updateHoverVerbosityLevel(e,t,i){if(!this._markdownHoverParticipant)return;const r=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,t);if(r===void 0)return;const s=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e,r,i);s&&(this._renderedParts[t]={type:"hoverPart",participant:this._markdownHoverParticipant,hoverPart:s.hoverPart,hoverElement:s.hoverElement},this._context.onContentsChanged())}isColorPickerVisible(){return this._colorHoverParticipant?.isColorPickerVisible()??!1}_normalizedIndexToMarkdownHoverIndexRange(e,t){const i=this._renderedParts[t];if(!i||i.type!=="hoverPart"||!(i.participant===e))return;const s=this._renderedParts.findIndex(o=>o.type==="hoverPart"&&o.participant===e);if(s===-1)throw new fi;return t-s}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}}var K5t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},MCe=function(n,e){return function(t,i){e(t,i,n)}};let zee=class extends me{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._currentResult=null,this._onContentsChanged=this._register(new fe),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(Dee,this._editor)),this._participants=this._initializeHoverParticipants(),this._computer=new R9(this._editor,this._participants),this._hoverOperation=this._register(new m7e(this._editor,this._computer)),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of DC.getAll()){const i=this._instantiationService.createInstance(t,this._editor);e.push(i)}return e.sort((t,i)=>t.hoverOrdinal-i.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach(t=>t.handleResize?.())})),e}_registerListeners(){this._register(this._hoverOperation.onResult(t=>{if(!this._computer.anchor)return;const i=t.hasLoadingMessage?this._addLoadingMessage(t.value):t.value;this._withResult(new _7e(this._computer.anchor,i,t.isComplete))}));const e=this._contentHoverWidget.getDomNode();this._register(Jr(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Jr(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(rs.onDidChange(()=>{this._contentHoverWidget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)}))}_startShowingOrUpdateHover(e,t,i,r,s){if(!(this._contentHoverWidget.position&&this._currentResult))return e?(this._startHoverOperationIfNecessary(e,t,i,r,!1),!0):!1;const a=this._editor.getOption(60).sticky,l=s&&this._contentHoverWidget.isMouseGettingCloser(s.event.posx,s.event.posy);return a&&l?(e&&this._startHoverOperationIfNecessary(e,t,i,r,!0),!0):e?this._currentResult.anchor.equals(e)?!0:e.canAdoptVisibleHover(this._currentResult.anchor,this._contentHoverWidget.position)?(this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,i,r,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,i,r,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,i,r,s){this._computer.anchor&&this._computer.anchor.equals(e)||(this._hoverOperation.cancel(),this._computer.anchor=e,this._computer.shouldFocus=r,this._computer.source=i,this._computer.insistOnKeepingHoverVisible=s,this._hoverOperation.start(t))}_setCurrentResult(e){let t=e;if(this._currentResult===t)return;t&&t.hoverParts.length===0&&(t=null),this._currentResult=t,this._currentResult?this._showHover(this._currentResult):this._hideHover()}_addLoadingMessage(e){if(!this._computer.anchor)return e;for(const t of this._participants){if(!t.createLoadingMessage)continue;const i=t.createLoadingMessage(this._computer.anchor);if(i)return e.slice(0).concat([i])}return e}_withResult(e){if(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete||this._setCurrentResult(e),!e.isComplete)return;const r=e.hoverParts.length===0,s=this._computer.insistOnKeepingHoverVisible;r&&s||this._setCurrentResult(e)}_showHover(e){const t=this._getHoverContext();this._renderedContentHover=new Hue(this._editor,e,this._participants,this._computer,t,this._keybindingService),this._renderedContentHover.domNodeHasChildren?this._contentHoverWidget.show(this._renderedContentHover):this._renderedContentHover.dispose()}_hideHover(){this._contentHoverWidget.hide()}_getHoverContext(){return{hide:()=>{this.hide()},onContentsChanged:()=>{this._onContentsChanged.fire(),this._contentHoverWidget.onContentsChanged()},setMinimumDimensions:r=>{this._contentHoverWidget.setMinimumDimensions(r)}}}showsOrWillShow(e){if(this._contentHoverWidget.isResizing)return!0;const i=this._findHoverAnchorCandidates(e);if(!(i.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,e);const s=i[0];return this._startShowingOrUpdateHover(s,0,0,!1,e)}_findHoverAnchorCandidates(e){const t=[];for(const r of this._participants){if(!r.suggestHoverAnchor)continue;const s=r.suggestHoverAnchor(e);s&&t.push(s)}const i=e.target;switch(i.type){case 6:{t.push(new Vq(0,i.range,e.event.posx,e.event.posy));break}case 7:{const r=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;if(!(!i.detail.isAfterLines&&typeof i.detail.horizontalDistanceToText=="number"&&i.detail.horizontalDistanceToTexts.priority-r.priority),t}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!dH(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,r){this._startShowingOrUpdateHover(new Vq(0,e,void 0,void 0),t,i,r,null)}async updateHoverVerbosityLevel(e,t,i){this._renderedContentHover?.updateHoverVerbosityLevel(e,t,i)}focusedHoverPartIndex(){return this._renderedContentHover?.focusedHoverPartIndex??-1}containsNode(e){return e?this._contentHoverWidget.getDomNode().contains(e):!1}focus(){this._contentHoverWidget.focus()}scrollUp(){this._contentHoverWidget.scrollUp()}scrollDown(){this._contentHoverWidget.scrollDown()}scrollLeft(){this._contentHoverWidget.scrollLeft()}scrollRight(){this._contentHoverWidget.scrollRight()}pageUp(){this._contentHoverWidget.pageUp()}pageDown(){this._contentHoverWidget.pageDown()}goToTop(){this._contentHoverWidget.goToTop()}goToBottom(){this._contentHoverWidget.goToBottom()}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}getDomNode(){return this._contentHoverWidget.getDomNode()}get isColorPickerVisible(){return this._renderedContentHover?.isColorPickerVisible()??!1}get isVisibleFromKeyboard(){return this._contentHoverWidget.isVisibleFromKeyboard}get isVisible(){return this._contentHoverWidget.isVisible}get isFocused(){return this._contentHoverWidget.isFocused}get isResizing(){return this._contentHoverWidget.isResizing}get widget(){return this._contentHoverWidget}};zee=K5t([MCe(1,Tt),MCe(2,xi)],zee);var G5t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},FCe=function(n,e){return function(t,i){e(t,i,n)}},Uee;const Y5t=!1;let wl=class extends me{static{Uee=this}static{this.ID="editor.contrib.contentHover"}constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._onHoverContentsChanged=this._register(new fe),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new ke,this._hoverState={mouseDown:!1,activatedByDecoratorClick:!1},this._reactToEditorMouseMoveRunner=this._register(new Ui(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}static get(e){return e.getContribution(Uee.ID)}_hookListeners(){const e=this._editor.getOption(60);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._shouldNotHideCurrentHoverWidget(e)&&this._hideWidgets()}_shouldNotHideCurrentHoverWidget(e){return this._isMouseOnContentHoverWidget(e)||this._isContentWidgetResizing()}_isMouseOnContentHoverWidget(e){const t=this._contentWidget?.getDomNode();return t?dH(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._shouldNotHideCurrentHoverWidget(e))||this._hideWidgets()}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=(o,a)=>{const l=this._isMouseOnContentHoverWidget(o);return a&&l},r=o=>{const a=this._isMouseOnContentHoverWidget(o),l=this._contentWidget?.isColorPickerVisible??!1;return a&&l},s=(o,a)=>(a&&this._contentWidget?.containsNode(o.event.browserEvent.view?.document.activeElement)&&!o.event.browserEvent.view?.getSelection()?.isCollapsed)??!1;return i(e,t)||r(e)||s(e,t)}_onEditorMouseMove(e){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._mouseMoveEvent=e,this._contentWidget?.isFocused||this._contentWidget?.isResizing))return;const t=this._hoverSettings.sticky;if(t&&this._contentWidget?.isVisibleFromKeyboard)return;if(this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}const r=this._hoverSettings.hidingDelay;if(this._contentWidget?.isVisible&&t&&r>0){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(r);return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){if(!e)return;const i=e.target.element?.classList.contains("colorpicker-color-decoration"),r=this._editor.getOption(149),s=this._hoverSettings.enabled,o=this._hoverState.activatedByDecoratorClick;if(i&&(r==="click"&&!o||r==="hover"&&!s&&!Y5t||r==="clickAndHover"&&!s&&!o)||!i&&!s&&!o){this._hideWidgets();return}this._tryShowHoverWidget(e)||this._hideWidgets()}_tryShowHoverWidget(e){return this._getOrCreateContentWidget().showsOrWillShow(e)}_onKeyDown(e){if(!this._editor.hasModel())return;const t=this._keybindingService.softDispatch(e,this._editor.getDomNode()),i=t.kind===1||t.kind===2&&(t.commandId===h7e||t.commandId===cH||t.commandId===uH)&&this._contentWidget?.isVisible;e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4||i||this._hideWidgets()}_hideWidgets(){this._hoverState.mouseDown&&this._contentWidget?.isColorPickerVisible||AE.dropDownVisible||(this._hoverState.activatedByDecoratorClick=!1,this._contentWidget?.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(zee,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()))),this._contentWidget}showContentHover(e,t,i,r,s=!1){this._hoverState.activatedByDecoratorClick=s,this._getOrCreateContentWidget().startShowingAtRange(e,t,i,r)}_isContentWidgetResizing(){return this._contentWidget?.widget.isResizing||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}updateHoverVerbosityLevel(e,t,i){this._getOrCreateContentWidget().updateHoverVerbosityLevel(e,t,i)}focus(){this._contentWidget?.focus()}scrollUp(){this._contentWidget?.scrollUp()}scrollDown(){this._contentWidget?.scrollDown()}scrollLeft(){this._contentWidget?.scrollLeft()}scrollRight(){this._contentWidget?.scrollRight()}pageUp(){this._contentWidget?.pageUp()}pageDown(){this._contentWidget?.pageDown()}goToTop(){this._contentWidget?.goToTop()}goToBottom(){this._contentWidget?.goToBottom()}get isColorPickerVisible(){return this._contentWidget?.isColorPickerVisible}get isHoverVisible(){return this._contentWidget?.isVisible}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._contentWidget?.dispose()}};wl=Uee=G5t([FCe(1,Tt),FCe(2,xi)],wl);class BCe extends me{static{this.ID="editor.contrib.colorContribution"}constructor(e){super(),this._editor=e,this._register(e.onMouseDown(t=>this.onMouseDown(t)))}dispose(){super.dispose()}onMouseDown(e){const t=this._editor.getOption(149);if(t!=="click"&&t!=="clickAndHover")return;const i=e.target;if(i.type!==6||!i.detail.injectedText||i.detail.injectedText.options.attachedData!==s7e||!i.range)return;const r=this._editor.getContribution(wl.ID);if(r&&!r.isColorPickerVisible){const s=new $(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);r.showContentHover(s,1,0,!1,!0)}}}Zn(BCe.ID,BCe,2);DC.register(aR);var H7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},BS=function(n,e){return function(t,i){e(t,i,n)}},jee,qee;let Yw=class extends me{static{jee=this}static{this.ID="editor.contrib.standaloneColorPickerController"}constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=Q.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=Q.standaloneColorPickerFocused.bindTo(t)}showOrFocus(){this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||this._standaloneColorPickerWidget?.focus():this._standaloneColorPickerWidget=this._instantiationService.createInstance(Kee,this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused))}hide(){this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerWidget?.hide(),this._editor.focus()}insertColor(){this._standaloneColorPickerWidget?.updateEditor(),this.hide()}static get(e){return e.getContribution(jee.ID)}};Yw=jee=H7e([BS(1,jt),BS(2,Tt)],Yw);Zn(Yw.ID,Yw,1);const $Ce=8,Z5t=22;let Kee=class extends me{static{qee=this}static{this.ID="editor.contrib.standaloneColorPickerWidget"}constructor(e,t,i,r,s,o,a){super(),this._editor=e,this._standaloneColorPickerVisible=t,this._standaloneColorPickerFocused=i,this._keybindingService=s,this._languageFeaturesService=o,this._editorWorkerService=a,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new fe),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=r.createInstance(lR,this._editor),this._position=this._editor._getViewModel()?.getPrimaryCursorState().modelState.position;const l=this._editor.getSelection(),c=l?{startLineNumber:l.startLineNumber,startColumn:l.startColumn,endLineNumber:l.endLineNumber,endColumn:l.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},u=this._register(Eg(this._body));this._register(u.onDidBlur(d=>{this.hide()})),this._register(u.onDidFocus(d=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(d=>{const h=d.target.element?.classList;h&&h.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(d=>{this._render(d.value,d.foundInEditor)})),this._start(c),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return qee.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const e=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){const t=await this._computeAsync(e);t&&this._onResult.fire(new X5t(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;const t={range:e,color:{red:0,green:0,blue:0,alpha:1}},i=await this._standaloneColorPickerParticipant.createColorHover(t,new oR(this._editorWorkerService),this._languageFeaturesService.colorProvider);return i?{result:i.colorHover,foundInEditor:i.foundInEditor}:null}_render(e,t){const i=document.createDocumentFragment(),r=this._register(new P9(this._keybindingService)),s={fragment:i,statusBar:r,onContentsChanged:()=>{},hide:()=>this.hide()};this._colorHover=e;const o=this._standaloneColorPickerParticipant.renderHoverParts(s,[e]);if(!o)return;this._register(o.disposables);const a=o.colorPicker;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(i),a.layout();const l=a.body,c=l.saturationBox.domNode.clientWidth,u=l.domNode.clientWidth-c-Z5t-$Ce,d=a.body.enterButton;d?.onClicked(()=>{this.updateEditor(),this.hide()});const h=a.header,f=h.pickedColorNode;f.style.width=c+$Ce+"px";const g=h.originalColorNode;g.style.width=u+"px",a.header.closeButton?.onClicked(()=>{this.hide()}),t&&(d&&(d.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}};Kee=qee=H7e([BS(3,Tt),BS(4,xi),BS(5,dt),BS(6,Oc)],Kee);class X5t{constructor(e,t){this.value=e,this.foundInEditor=t}}class Q5t extends Fg{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...Gt("showOrFocusStandaloneColorPicker","Show or Focus Standalone Color Picker"),mnemonicTitle:w({key:"mishowOrFocusStandaloneColorPicker",comment:["&& denotes a mnemonic"]},"&&Show or Focus Standalone Color Picker")},precondition:void 0,menu:[{id:ce.CommandPalette}],metadata:{description:Gt("showOrFocusStandaloneColorPickerDescription","Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(e,t){Yw.get(t)?.showOrFocus()}}class J5t extends ot{constructor(){super({id:"editor.action.hideColorPicker",label:w({key:"hideColorPicker",comment:["Action that hides the color picker"]},"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:Q.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:Gt("hideColorPickerDescription","Hide the standalone color picker.")}})}run(e,t){Yw.get(t)?.hide()}}class eFt extends ot{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:w({key:"insertColorWithStandaloneColorPicker",comment:["Action that inserts color with standalone color picker"]},"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:Q.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:Gt("insertColorWithStandaloneColorPickerDescription","Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){Yw.get(t)?.insertColor()}}Pe(J5t);Pe(eFt);lr(Q5t);class $v{constructor(e,t,i){this.languageConfigurationService=i,this._selection=e,this._insertSpace=t,this._usedEndToken=null}static _haystackHasNeedleAtOffset(e,t,i){if(i<0)return!1;const r=t.length,s=e.length;if(i+r>s)return!1;for(let o=0;o=65&&a<=90&&a+32===l)&&!(l>=65&&l<=90&&l+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,r,s,o){const a=e.startLineNumber,l=e.startColumn,c=e.endLineNumber,u=e.endColumn,d=s.getLineContent(a),h=s.getLineContent(c);let f=d.lastIndexOf(t,l-1+t.length),g=h.indexOf(i,u-1-i.length);if(f!==-1&&g!==-1)if(a===c)d.substring(f+t.length,g).indexOf(i)>=0&&(f=-1,g=-1);else{const m=d.substring(f+t.length),_=h.substring(0,g);(m.indexOf(i)>=0||_.indexOf(i)>=0)&&(f=-1,g=-1)}let p;f!==-1&&g!==-1?(r&&f+t.length0&&h.charCodeAt(g-1)===32&&(i=" "+i,g-=1),p=$v._createRemoveBlockCommentOperations(new $(a,f+t.length+1,c,g+1),t,i)):(p=$v._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=p.length===1?i:null);for(const m of p)o.addTrackedEditOperation(m.range,m.text)}static _createRemoveBlockCommentOperations(e,t,i){const r=[];return $.isEmpty(e)?r.push(jr.delete(new $(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(r.push(jr.delete(new $(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),r.push(jr.delete(new $(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),r}static _createAddBlockCommentOperations(e,t,i,r){const s=[];return $.isEmpty(e)?s.push(jr.replace(new $(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(jr.insert(new he(e.startLineNumber,e.startColumn),t+(r?" ":""))),s.push(jr.insert(new he(e.endLineNumber,e.endColumn),(r?" ":"")+i))),s}getEditOperations(e,t){const i=this._selection.startLineNumber,r=this._selection.startColumn;e.tokenization.tokenizeIfCheap(i);const s=e.getLanguageIdAtPosition(i,r),o=this.languageConfigurationService.getLanguageConfiguration(s).comments;!o||!o.blockCommentStartToken||!o.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,o.blockCommentStartToken,o.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length===2){const r=i[0],s=i[1];return new yt(r.range.endLineNumber,r.range.endColumn,s.range.startLineNumber,s.range.startColumn)}else{const r=i[0].range,s=this._usedEndToken?-this._usedEndToken.length-1:0;return new yt(r.endLineNumber,r.endColumn+s,r.endLineNumber,r.endColumn+s)}}}class jm{constructor(e,t,i,r,s,o,a){this.languageConfigurationService=e,this._selection=t,this._indentSize=i,this._type=r,this._insertSpace=s,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=o,this._ignoreFirstLine=a||!1}static _gatherPreflightCommentStrings(e,t,i,r){e.tokenization.tokenizeIfCheap(t);const s=e.getLanguageIdAtPosition(t,1),o=r.getLanguageConfiguration(s).comments,a=o?o.lineCommentToken:null;if(!a)return null;const l=[];for(let c=0,u=i-t+1;cs?t[l].commentStrOffset=o-1:t[l].commentStrOffset=o}}}class zue extends ot{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(Zr);if(!t.hasModel())return;const r=t.getModel(),s=[],o=r.getOptions(),a=t.getOption(23),l=t.getSelections().map((u,d)=>({selection:u,index:d,ignoreFirstLine:!1}));l.sort((u,d)=>$.compareRangesUsingStarts(u.selection,d.selection));let c=l[0];for(let u=1;u=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},M1=function(n,e){return function(t,i){e(t,i,n)}},Gee;let RE=class{static{Gee=this}static{this.ID="editor.contrib.contextmenu"}static get(e){return e.getContribution(Gee.ID)}constructor(e,t,i,r,s,o,a,l){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=r,this._keybindingService=s,this._menuService=o,this._configurationService=a,this._workspaceContextService=l,this._toDispose=new ke,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(c=>this._onContextMenu(c))),this._toDispose.add(this._editor.onMouseWheel(c=>{if(this._contextMenuIsBeingShownCount>0){const u=this._contextViewService.getContextViewElement(),d=c.srcElement;d.shadowRoot&&Iw(u)===d.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(c=>{this._editor.getOption(24)&&c.keyCode===58&&(c.preventDefault(),c.stopPropagation(),this.showContextMenu())}))}_onContextMenu(e){if(!this._editor.hasModel())return;if(!this._editor.getOption(24)){this._editor.focus(),e.target.position&&!this._editor.getSelection().containsPosition(e.target.position)&&this._editor.setPosition(e.target.position);return}if(e.target.type===12||e.target.type===6&&e.target.detail.injectedText)return;if(e.event.preventDefault(),e.event.stopPropagation(),e.target.type===11)return this._showScrollbarContextMenu(e.event);if(e.target.type!==6&&e.target.type!==7&&e.target.type!==1)return;if(this._editor.focus(),e.target.position){let i=!1;for(const r of this._editor.getSelections())if(r.containsPosition(e.target.position)){i=!0;break}i||this._editor.setPosition(e.target.position)}let t=null;e.target.type!==1&&(t=e.event),this.showContextMenu(t)}showContextMenu(e){if(!this._editor.getOption(24)||!this._editor.hasModel())return;const t=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);t.length>0&&this._doShowContextMenu(t,e)}_getMenuActions(e,t){const i=[],r=this._menuService.getMenuActions(t,this._contextKeyService,{arg:e.uri});for(const s of r){const[,o]=s;let a=0;for(const l of o)if(l instanceof ck){const c=this._getMenuActions(e,l.item.submenu);c.length>0&&(i.push(new rE(l.id,l.label,c)),a++)}else i.push(l),a++;a&&i.push(new na)}return i.length&&i.pop(),i}_doShowContextMenu(e,t=null){if(!this._editor.hasModel())return;const i=this._editor.getOption(60);this._editor.updateOptions({hover:{enabled:!1}});let r=t;if(!r){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const o=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),a=ms(this._editor.getDomNode()),l=a.left+o.left,c=a.top+o.top+o.height;r={x:l,y:c}}const s=this._editor.getOption(128)&&!Sg;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:s?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,getAnchor:()=>r,getActions:()=>e,getActionViewItem:o=>{const a=this._keybindingFor(o);if(a)return new vE(o,o,{label:!0,keybinding:a.getLabel(),isMenu:!0});const l=o;return typeof l.getActionViewItem=="function"?l.getActionViewItem():new vE(o,o,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:o=>this._keybindingFor(o),onHide:o=>{this._contextMenuIsBeingShownCount--,this._editor.updateOptions({hover:i})}})}_showScrollbarContextMenu(e){if(!this._editor.hasModel()||uSt(this._workspaceContextService.getWorkspace()))return;const t=this._editor.getOption(73);let i=0;const r=c=>({id:`menu-action-${++i}`,label:c.label,tooltip:"",class:void 0,enabled:typeof c.enabled>"u"?!0:c.enabled,checked:c.checked,run:c.run}),s=(c,u)=>new rE(`menu-action-${++i}`,c,u,void 0),o=(c,u,d,h,f)=>{if(!u)return r({label:c,enabled:u,run:()=>{}});const g=m=>()=>{this._configurationService.updateValue(d,m)},p=[];for(const m of f)p.push(r({label:m.label,checked:h===m.value,run:g(m.value)}));return s(c,p)},a=[];a.push(r({label:w("context.minimap.minimap","Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new na),a.push(r({label:w("context.minimap.renderCharacters","Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(o(w("context.minimap.size","Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:w("context.minimap.size.proportional","Proportional"),value:"proportional"},{label:w("context.minimap.size.fill","Fill"),value:"fill"},{label:w("context.minimap.size.fit","Fit"),value:"fit"}])),a.push(o(w("context.minimap.slider","Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:w("context.minimap.slider.mouseover","Mouse Over"),value:"mouseover"},{label:w("context.minimap.slider.always","Always"),value:"always"}]));const l=this._editor.getOption(128)&&!Sg;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:l?this._editor.getDomNode():void 0,getAnchor:()=>e,getActions:()=>a,onHide:c=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};RE=Gee=sFt([M1(1,mu),M1(2,m0),M1(3,jt),M1(4,xi),M1(5,ld),M1(6,En),M1(7,Mw)],RE);class oFt extends ot{constructor(){super({id:"editor.action.showContextMenu",label:w("action.showContextMenu.label","Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:1092,weight:100}})}run(e,t){RE.get(t)?.showContextMenu()}}Zn(RE.ID,RE,2);Pe(oFt);class Uq{constructor(e){this.selections=e}equals(e){const t=this.selections.length,i=e.selections.length;if(t!==i)return!1;for(let r=0;r{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeModelContent(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeCursorSelection(t=>{if(this._isCursorUndoRedo||!t.oldSelections||t.oldModelVersionId!==t.modelVersionId)return;const i=new Uq(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new jq(i,e.getScrollTop(),e.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new jq(new Uq(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new jq(new Uq(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(e){this._isCursorUndoRedo=!0,this._editor.setSelections(e.cursorState.selections),this._editor.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),this._isCursorUndoRedo=!1}}class aFt extends ot{constructor(){super({id:"cursorUndo",label:w("cursor.undo","Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:2099,weight:100}})}run(e,t,i){PE.get(t)?.cursorUndo()}}class lFt extends ot{constructor(){super({id:"cursorRedo",label:w("cursor.redo","Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(e,t,i){PE.get(t)?.cursorRedo()}}Zn(PE.ID,PE,0);Pe(aFt);Pe(lFt);class cFt{constructor(e,t,i){this.selection=e,this.targetPosition=t,this.copy=i,this.targetSelection=null}getEditOperations(e,t){const i=e.getValueInRange(this.selection);if(this.copy||t.addEditOperation(this.selection,null),t.addEditOperation(new $(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),i),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new yt(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new yt(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumberthis._onEditorMouseDown(t))),this._register(this._editor.onMouseUp(t=>this._onEditorMouseUp(t))),this._register(this._editor.onMouseDrag(t=>this._onEditorMouseDrag(t))),this._register(this._editor.onMouseDrop(t=>this._onEditorMouseDrop(t))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(t=>this.onEditorKeyDown(t))),this._register(this._editor.onKeyUp(t=>this.onEditorKeyUp(t))),this._register(this._editor.onDidBlurEditorWidget(()=>this.onEditorBlur())),this._register(this._editor.onDidBlurEditorText(()=>this.onEditorBlur())),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(e){!this._editor.getOption(35)||this._editor.getOption(22)||(xx(e)&&(this._modifierPressed=!0),this._mouseDown&&xx(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(35)||this._editor.getOption(22)||(xx(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===Tk.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(e){this._mouseDown=!0}_onEditorMouseUp(e){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(e){const t=e.target;if(this._dragSelection===null){const r=(this._editor.getSelections()||[]).filter(s=>t.position&&s.containsPosition(t.position));if(r.length===1)this._dragSelection=r[0];else return}xx(e.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),t.position&&(this._dragSelection.containsPosition(t.position)?this._removeDecoration():this.showAt(t.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(e){if(e.target&&(this._hitContent(e.target)||this._hitMargin(e.target))&&e.target.position){const t=new he(e.target.position.lineNumber,e.target.position.column);if(this._dragSelection===null){let i=null;if(e.event.shiftKey){const r=this._editor.getSelection();if(r){const{selectionStartLineNumber:s,selectionStartColumn:o}=r;i=[new yt(s,o,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(r=>r.containsPosition(t)?new yt(t.lineNumber,t.column,t.lineNumber,t.column):r);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(xx(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(Tk.ID,new cFt(this._dragSelection,t,xx(e.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}static{this._DECORATION_OPTIONS=un.register({description:"dnd-target",className:"dnd-target"})}showAt(e){this._dndDecorationIds.set([{range:new $(e.lineNumber,e.column,e.lineNumber,e.column),options:Tk._DECORATION_OPTIONS}]),this._editor.revealPosition(e,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(e){return e.type===6||e.type===7}_hitMargin(e){return e.type===2||e.type===3||e.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}}Zn(Tk.ID,Tk,2);Zn(t0.ID,t0,0);u2(hee);Je(new class extends fo{constructor(){super({id:B9e,precondition:Lue,kbOpts:{weight:100,primary:2137}})}runEditorCommand(n,e){return t0.get(e)?.changePasteType()}});Je(new class extends fo{constructor(){super({id:"editor.hidePasteWidget",precondition:Lue,kbOpts:{weight:100,primary:9}})}runEditorCommand(n,e){t0.get(e)?.clearWidgets()}});Pe(class V7e extends ot{static{this.argsSchema={type:"object",properties:{kind:{type:"string",description:w("pasteAs.kind","The kind of the paste edit to try applying. If not provided or there are multiple edits for this kind, the editor will show a picker.")}}}}constructor(){super({id:"editor.action.pasteAs",label:w("pasteAs","Paste As..."),alias:"Paste As...",precondition:Q.writable,metadata:{description:"Paste as",args:[{name:"args",schema:V7e.argsSchema}]}})}run(e,t,i){let r=typeof i?.kind=="string"?i.kind:void 0;return!r&&i&&(r=typeof i.id=="string"?i.id:void 0),t0.get(t)?.pasteAs(r?new sr(r):void 0)}});Pe(class extends ot{constructor(){super({id:"editor.action.pasteAsText",label:w("pasteAsText","Paste as Text"),alias:"Paste as Text",precondition:Q.writable})}run(n,e){return t0.get(e)?.pasteAs({providerId:Vw.id})}});class uFt{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(e){if(e&&this._dragOperations.has(e)){const t=this._dragOperations.get(e);return this._dragOperations.delete(e),t}}}class WCe{constructor(e){this.identifier=e}}const z7e=On("treeViewsDndService");Vn(z7e,uFt,1);var dFt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},u3=function(n,e){return function(t,i){e(t,i,n)}},Yee;const U7e="editor.experimental.dropIntoEditor.defaultProvider",j7e="editor.changeDropType",Uue=new et("dropWidgetVisible",!1,w("dropWidgetVisible","Whether the drop widget is showing"));let OE=class extends me{static{Yee=this}static{this.ID="editor.contrib.dropIntoEditorController"}static get(e){return e.getContribution(Yee.ID)}constructor(e,t,i,r,s){super(),this._configService=i,this._languageFeaturesService=r,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=L9.getInstance(),this._dropProgressManager=this._register(t.createInstance(D9,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(A9,"dropIntoEditor",e,Uue,{id:j7e,label:w("postDropWidgetTitle","Show drop options...")})),this._register(e.onDropIntoEditor(o=>this.onDropIntoEditor(e,o.position,o.event)))}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,i){if(!i.dataTransfer||!e.hasModel())return;this._currentOperation?.cancel(),e.focus(),e.setPosition(t);const r=ko(async s=>{const o=new ke,a=o.add(new Pb(e,1,void 0,s));try{const l=await this.extractDataTransferData(i);if(l.size===0||a.token.isCancellationRequested)return;const c=e.getModel();if(!c)return;const u=this._languageFeaturesService.documentDropEditProvider.ordered(c).filter(h=>h.dropMimeTypes?h.dropMimeTypes.some(f=>l.matches(f)):!0),d=o.add(await this.getDropEdits(u,c,t,l,a));if(a.token.isCancellationRequested)return;if(d.edits.length){const h=this.getInitialActiveEditIndex(c,d.edits),f=e.getOption(36).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([$.fromPositions(t)],{activeEditIndex:h,allEdits:d.edits},f,async g=>g,s)}}finally{o.dispose(),this._currentOperation===r&&(this._currentOperation=void 0)}});this._dropProgressManager.showWhile(t,w("dropIntoEditorProgress","Running drop handlers. Click to cancel"),r,{cancel:()=>r.cancel()}),this._currentOperation=r}async getDropEdits(e,t,i,r,s){const o=new ke,a=await YP(Promise.all(e.map(async c=>{try{const u=await c.provideDocumentDropEdits(t,i,r,s.token);return u&&o.add(u),u?.edits.map(d=>({...d,providerId:c.id}))}catch(u){console.error(u)}})),s.token),l=rf(a??[]).flat();return{edits:M9e(l),dispose:()=>o.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(U7e,{resource:e.uri});for(const[r,s]of Object.entries(i)){const o=new sr(s),a=t.findIndex(l=>o.value===l.providerId&&l.handledMimeType&&L9e(r,[l.handledMimeType]));if(a>=0)return a}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new E9e;const t=I9e(e.dataTransfer);if(this.treeItemsTransfer.hasData(WCe.prototype)){const i=this.treeItemsTransfer.getData(WCe.prototype);if(Array.isArray(i))for(const r of i){const s=await this._treeViewsDragAndDropService.removeDragOperationTransfer(r.identifier);if(s)for(const[o,a]of s)t.replace(o,a)}}return t}};OE=Yee=dFt([u3(1,Tt),u3(2,En),u3(3,dt),u3(4,z7e)],OE);Zn(OE.ID,OE,2);u2(dee);Je(new class extends fo{constructor(){super({id:j7e,precondition:Uue,kbOpts:{weight:100,primary:2137}})}runEditorCommand(n,e,t){OE.get(e)?.changeDropType()}});Je(new class extends fo{constructor(){super({id:"editor.hideDropWidget",precondition:Uue,kbOpts:{weight:100,primary:9}})}runEditorCommand(n,e,t){OE.get(e)?.clearWidgets()}});Yr.as(ff.Configuration).registerConfiguration({...sO,properties:{[U7e]:{type:"object",scope:5,description:w("defaultProviderDescription","Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});class Th{constructor(e){this._editor=e,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){const e=this._findScopeDecorationIds.map(t=>this._editor.getModel().getDecorationRange(t)).filter(t=>!!t);if(e.length)return e}return null}getStartPosition(){return this._startPosition}setStartPosition(e){this._startPosition=e,this.setCurrentFindMatch(null)}_getDecorationIndex(e){const t=this._decorations.indexOf(e);return t>=0?t+1:1}getDecorationRangeAt(e){const t=e{if(this._highlightedDecorationId!==null&&(r.changeDecorationOptions(this._highlightedDecorationId,Th._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,r.changeDecorationOptions(this._highlightedDecorationId,Th._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(r.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),t!==null){let s=this._editor.getModel().getDecorationRange(t);if(s.startLineNumber!==s.endLineNumber&&s.endColumn===1){const o=s.endLineNumber-1,a=this._editor.getModel().getLineMaxColumn(o);s=new $(s.startLineNumber,s.startColumn,o,a)}this._rangeHighlightDecorationId=r.addDecoration(s,Th._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let r=Th._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){r=Th._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),c=this._editor.getLayoutInfo().height/a,u=Math.max(2,Math.ceil(3/c));let d=e[0].range.startLineNumber,h=e[0].range.endLineNumber;for(let f=1,g=e.length;f=p.startLineNumber?p.endLineNumber>h&&(h=p.endLineNumber):(s.push({range:new $(d,1,h,1),options:Th._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),d=p.startLineNumber,h=p.endLineNumber)}s.push({range:new $(d,1,h,1),options:Th._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const o=new Array(e.length);for(let a=0,l=e.length;ai.removeDecoration(a)),this._findScopeDecorationIds=[]),t?.length&&(this._findScopeDecorationIds=t.map(a=>i.addDecoration(a,Th._FIND_SCOPE_DECORATION)))})}matchBeforePosition(e){if(this._decorations.length===0)return null;for(let t=this._decorations.length-1;t>=0;t--){const i=this._decorations[t],r=this._editor.getModel().getDecorationRange(i);if(!(!r||r.endLineNumber>e.lineNumber)){if(r.endLineNumbere.column))return r}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(e){if(this._decorations.length===0)return null;for(let t=0,i=this._decorations.length;te.lineNumber)return s;if(!(s.startColumn0){const i=[];for(let o=0;o$.compareRangesUsingStarts(o.range,a.range));const r=[];let s=i[0];for(let o=1;o0?e[0].toUpperCase()+e.substr(1):n[0][0].toUpperCase()!==n[0][0]&&e.length>0?e[0].toLowerCase()+e.substr(1):e}else return e}function HCe(n,e,t){return n[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&n[0].split(t).length===e.split(t).length}function VCe(n,e,t){const i=e.split(t),r=n[0].split(t);let s="";return i.forEach((o,a)=>{s+=q7e([r[a]],o)+t}),s.slice(0,-1)}class zCe{constructor(e){this.staticValue=e,this.kind=0}}class fFt{constructor(e){this.pieces=e,this.kind=1}}class ME{static fromStaticValue(e){return new ME([sw.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new zCe(""):e.length===1&&e[0].staticValue!==null?this._state=new zCe(e[0].staticValue):this._state=new fFt(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?q7e(e,this._state.staticValue):this._state.staticValue;let i="";for(let r=0,s=this._state.pieces.length;r0){const l=[],c=o.caseOps.length;let u=0;for(let d=0,h=a.length;d=c){l.push(a.slice(d));break}switch(o.caseOps[u]){case"U":l.push(a[d].toUpperCase());break;case"u":l.push(a[d].toUpperCase()),u++;break;case"L":l.push(a[d].toLowerCase());break;case"l":l.push(a[d].toLowerCase()),u++;break;default:l.push(a[d])}}a=l.join("")}i+=a}return i}static _substitute(e,t){if(t===null)return"";if(e===0)return t[0];let i="";for(;e>0;){if(e=r)break;const o=n.charCodeAt(i);switch(o){case 92:t.emitUnchanged(i-1),t.emitStatic("\\",i+1);break;case 110:t.emitUnchanged(i-1),t.emitStatic(` +`,i+1);break;case 116:t.emitUnchanged(i-1),t.emitStatic(" ",i+1);break;case 117:case 85:case 108:case 76:t.emitUnchanged(i-1),t.emitStatic("",i+1),e.push(String.fromCharCode(o));break}continue}if(s===36){if(i++,i>=r)break;const o=n.charCodeAt(i);if(o===36){t.emitUnchanged(i-1),t.emitStatic("$",i+1);continue}if(o===48||o===38){t.emitUnchanged(i-1),t.emitMatchIndex(0,i+1,e),e.length=0;continue}if(49<=o&&o<=57){let a=o-48;if(i+1{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(i=>{(i.reason===3||i.reason===5||i.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(i=>{this._ignoreModelContentChanged||(i.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(i=>this._onStateChanged(i))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,er(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(e){this._isDisposed||this._editor.hasModel()&&(e.searchString||e.isReplaceRevealed||e.isRegex||e.wholeWord||e.matchCase||e.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor)},mFt)):e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor))}static _getSearchRange(e,t){return t||e.getFullModelRange()}research(e,t){let i=null;typeof t<"u"?t!==null&&(Array.isArray(t)?i=t:i=[t]):i=this._decorations.getFindScopes(),i!==null&&(i=i.map(a=>{if(a.startLineNumber!==a.endLineNumber){let l=a.endLineNumber;return a.endColumn===1&&(l=l-1),new $(a.startLineNumber,1,l,this._editor.getModel().getLineMaxColumn(l))}return a}));const r=this._findMatches(i,!1,Wv);this._decorations.set(r,i);const s=this._editor.getSelection();let o=this._decorations.getCurrentMatchesPosition(s);if(o===0&&r.length>0){const a=gN(r.map(l=>l.range),l=>$.compareRangesUsingStarts(l,s)>=0);o=a>0?a-1+1:o}this._state.changeMatchInfo(o,this._decorations.getCount(),void 0),e&&this._editor.getOption(41).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const e=this._decorations.getFindScope();return e&&this._editor.revealRangeInCenterIfOutsideViewport(e,0),!0}return!1}_setCurrentFindMatch(e){const t=this._decorations.setCurrentFindMatch(e);this._state.changeMatchInfo(t,this._decorations.getCount(),e),this._editor.setSelection(e),this._editor.revealRangeInCenterIfOutsideViewport(e,0)}_prevSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:r}=e;const s=this._editor.getModel();return t||r===1?(i===1?i=s.getLineCount():i--,r=s.getLineMaxColumn(i)):r--,new he(i,r)}_moveToPrevMatch(e,t=!1){if(!this._state.canNavigateBack()){const u=this._decorations.matchAfterPosition(e);u&&this._setCurrentFindMatch(u);return}if(this._decorations.getCount()=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:r}=e;const s=this._editor.getModel();return t||r===s.getLineMaxColumn(i)?(i===s.getLineCount()?i=1:i++,r=1):r++,new he(i,r)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()zI._getSearchRange(this._editor.getModel(),s));return this._editor.getModel().findMatches(this._state.searchString,r,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null,t,i)}replaceAll(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();e===null&&this._state.matchesCount>=Wv?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const t=new j1(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(132):null).parseSearchRequest();if(!t)return;let i=t.regex;if(!i.multiline){let d="mu";i.ignoreCase&&(d+="i"),i.global&&(d+="g"),i=new RegExp(i.source,d)}const r=this._editor.getModel(),s=r.getValue(1),o=r.getFullModelRange(),a=this._getReplacePattern();let l;const c=this._state.preserveCase;a.hasReplacementPatterns||c?l=s.replace(i,function(){return a.buildReplaceString(arguments,c)}):l=s.replace(i,a.buildReplaceString(null,c));const u=new Pce(o,l,this._editor.getSelection());this._executeEditorCommand("replaceAll",u)}_regularReplaceAll(e){const t=this._getReplacePattern(),i=this._findMatches(e,t.hasReplacementPatterns||this._state.preserveCase,1073741824),r=[];for(let o=0,a=i.length;oo.range),r);this._executeEditorCommand("replaceAll",s)}selectAllMatches(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();let i=this._findMatches(e,!1,1073741824).map(s=>new yt(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn));const r=this._editor.getSelection();for(let s=0,o=i.length;sthis._hide(),2e3)),this._isVisible=!1,this._editor=e,this._state=t,this._keybindingService=i,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");const r={inputActiveOptionBorder:it(cW),inputActiveOptionForeground:it(uW),inputActiveOptionBackground:it(eO)},s=this._register(_E());this.caseSensitive=this._register(new l6e({appendTitle:this._keybindingLabelFor(wr.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverDelegate:s,...r})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange(()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)})),this.wholeWords=this._register(new c6e({appendTitle:this._keybindingLabelFor(wr.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverDelegate:s,...r})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange(()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)})),this.regex=this._register(new u6e({appendTitle:this._keybindingLabelFor(wr.ToggleRegexCommand),isChecked:this._state.isRegex,hoverDelegate:s,...r})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange(()=>{this._state.change({isRegex:this.regex.checked},!1)})),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange(o=>{let a=!1;o.isRegex&&(this.regex.checked=this._state.isRegex,a=!0),o.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,a=!0),o.matchCase&&(this.caseSensitive.checked=this._state.matchCase,a=!0),!this._state.isRevealed&&a&&this._revealTemporarily()})),this._register(Ce(this._domNode,je.MOUSE_LEAVE,o=>this._onMouseLeave())),this._register(Ce(this._domNode,"mouseover",o=>this._onMouseOver()))}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return que.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseLeave(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}}function m3(n,e){return n===1?!0:n===2?!1:e}class _Ft extends me{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return m3(this._isRegexOverride,this._isRegex)}get wholeWord(){return m3(this._wholeWordOverride,this._wholeWord)}get matchCase(){return m3(this._matchCaseOverride,this._matchCase)}get preserveCase(){return m3(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}constructor(){super(),this._onFindReplaceStateChange=this._register(new fe),this.onFindReplaceStateChange=this._onFindReplaceStateChange.event,this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}changeMatchInfo(e,t,i){const r={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;t===0&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,r.matchesPosition=!0,s=!0),this._matchesCount!==t&&(this._matchesCount=t,r.matchesCount=!0,s=!0),typeof i<"u"&&($.equalsRange(this._currentMatch,i)||(this._currentMatch=i,r.currentMatch=!0,s=!0)),s&&this._onFindReplaceStateChange.fire(r)}change(e,t,i=!0){const r={moveCursor:t,updateHistory:i,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;const o=this.isRegex,a=this.wholeWord,l=this.matchCase,c=this.preserveCase;typeof e.searchString<"u"&&this._searchString!==e.searchString&&(this._searchString=e.searchString,r.searchString=!0,s=!0),typeof e.replaceString<"u"&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,r.replaceString=!0,s=!0),typeof e.isRevealed<"u"&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,r.isRevealed=!0,s=!0),typeof e.isReplaceRevealed<"u"&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,r.isReplaceRevealed=!0,s=!0),typeof e.isRegex<"u"&&(this._isRegex=e.isRegex),typeof e.wholeWord<"u"&&(this._wholeWord=e.wholeWord),typeof e.matchCase<"u"&&(this._matchCase=e.matchCase),typeof e.preserveCase<"u"&&(this._preserveCase=e.preserveCase),typeof e.searchScope<"u"&&(e.searchScope?.every(u=>this._searchScope?.some(d=>!$.equalsRange(d,u)))||(this._searchScope=e.searchScope,r.searchScope=!0,s=!0)),typeof e.loop<"u"&&this._loop!==e.loop&&(this._loop=e.loop,r.loop=!0,s=!0),typeof e.isSearching<"u"&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,r.isSearching=!0,s=!0),typeof e.filters<"u"&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,r.filters=!0,s=!0),this._isRegexOverride=typeof e.isRegexOverride<"u"?e.isRegexOverride:0,this._wholeWordOverride=typeof e.wholeWordOverride<"u"?e.wholeWordOverride:0,this._matchCaseOverride=typeof e.matchCaseOverride<"u"?e.matchCaseOverride:0,this._preserveCaseOverride=typeof e.preserveCaseOverride<"u"?e.preserveCaseOverride:0,o!==this.isRegex&&(s=!0,r.isRegex=!0),a!==this.wholeWord&&(s=!0,r.wholeWord=!0),l!==this.matchCase&&(s=!0,r.matchCase=!0),c!==this.preserveCase&&(s=!0,r.preserveCase=!0),s&&this._onFindReplaceStateChange.fire(r)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition=Wv}}const vFt=w("defaultLabel","input"),bFt=w("label.preserveCaseToggle","Preserve Case");class yFt extends o2{constructor(e){super({icon:ze.preserveCase,title:bFt+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Yl("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class wFt extends ud{constructor(e,t,i,r){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new fe),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new fe),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new fe),this._onInput=this._register(new fe),this._onKeyUp=this._register(new fe),this._onPreserveCaseKeyDown=this._register(new fe),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=t,this.placeholder=r.placeholder||"",this.validation=r.validation,this.label=r.label||vFt;const s=r.appendPreserveCaseLabel||"",o=r.history||[],a=!!r.flexibleHeight,l=!!r.flexibleWidth,c=r.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new d6e(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:o,showHistoryHint:r.showHistoryHint,flexibleHeight:a,flexibleWidth:l,flexibleMaxHeight:c,inputBoxStyles:r.inputBoxStyles})),this.preserveCase=this._register(new yFt({appendTitle:s,isChecked:!1,...r.toggleStyles})),this._register(this.preserveCase.onChange(h=>{this._onDidOptionChange.fire(h),!h&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(h=>{this._onPreserveCaseKeyDown.fire(h)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;const u=[this.preserveCase.domNode];this.onkeydown(this.domNode,h=>{if(h.equals(15)||h.equals(17)||h.equals(9)){const f=u.indexOf(this.domNode.ownerDocument.activeElement);if(f>=0){let g=-1;h.equals(17)?g=(f+1)%u.length:h.equals(15)&&(f===0?g=u.length-1:g=f-1),h.equals(9)?(u[f].blur(),this.inputBox.focus()):g>=0&&u[g].focus(),Hn.stop(h,!0)}}});const d=document.createElement("div");d.className="controls",d.style.display=this._showOptionButtons?"block":"none",d.appendChild(this.preserveCase.domNode),this.domNode.appendChild(d),e?.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,h=>this._onKeyDown.fire(h)),this.onkeyup(this.inputBox.inputElement,h=>this._onKeyUp.fire(h)),this.oninput(this.inputBox.inputElement,h=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,h=>this._onMouseDown.fire(h))}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setEnabled(e){e?this.enable():this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}validate(){this.inputBox?.validate()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=e+"px"}dispose(){super.dispose()}}var K7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},G7e=function(n,e){return function(t,i){e(t,i,n)}};const Kue=new et("suggestWidgetVisible",!1,w("suggestWidgetVisible","Whether suggestion are visible")),Gue="historyNavigationWidgetFocus",Y7e="historyNavigationForwardsEnabled",Z7e="historyNavigationBackwardsEnabled";let UI;const _3=[];function X7e(n,e){if(_3.includes(e))throw new Error("Cannot register the same widget multiple times");_3.push(e);const t=new ke,i=new et(Gue,!1).bindTo(n),r=new et(Y7e,!0).bindTo(n),s=new et(Z7e,!0).bindTo(n),o=()=>{i.set(!0),UI=e},a=()=>{i.set(!1),UI===e&&(UI=void 0)};return H$(e.element)&&o(),t.add(e.onDidFocus(()=>o())),t.add(e.onDidBlur(()=>a())),t.add(Lt(()=>{_3.splice(_3.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:r,historyNavigationBackwardsEnablement:s,dispose(){t.dispose()}}}let Zee=class extends h6e{constructor(e,t,i,r){super(e,t,i);const s=this._register(r.createScoped(this.inputBox.element));this._register(X7e(s,this.inputBox))}};Zee=K7e([G7e(3,jt)],Zee);let Xee=class extends wFt{constructor(e,t,i,r,s=!1){super(e,t,s,i);const o=this._register(r.createScoped(this.inputBox.element));this._register(X7e(o,this.inputBox))}};Xee=K7e([G7e(3,jt)],Xee);jl.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Le.and(Le.has(Gue),Le.equals(Z7e,!0),Le.not("isComposing"),Kue.isEqualTo(!1)),primary:16,secondary:[528],handler:n=>{UI?.showPreviousValue()}});jl.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Le.and(Le.has(Gue),Le.equals(Y7e,!0),Le.not("isComposing"),Kue.isEqualTo(!1)),primary:18,secondary:[530],handler:n=>{UI?.showNextValue()}});function UCe(n){return n.lookupKeybinding("history.showPrevious")?.getElectronAccelerator()==="Up"&&n.lookupKeybinding("history.showNext")?.getElectronAccelerator()==="Down"}const jCe=kr("find-collapsed",ze.chevronRight,w("findCollapsedIcon","Icon to indicate that the editor find widget is collapsed.")),qCe=kr("find-expanded",ze.chevronDown,w("findExpandedIcon","Icon to indicate that the editor find widget is expanded.")),CFt=kr("find-selection",ze.selection,w("findSelectionIcon","Icon for 'Find in Selection' in the editor find widget.")),xFt=kr("find-replace",ze.replace,w("findReplaceIcon","Icon for 'Replace' in the editor find widget.")),SFt=kr("find-replace-all",ze.replaceAll,w("findReplaceAllIcon","Icon for 'Replace All' in the editor find widget.")),kFt=kr("find-previous-match",ze.arrowUp,w("findPreviousMatchIcon","Icon for 'Find Previous' in the editor find widget.")),EFt=kr("find-next-match",ze.arrowDown,w("findNextMatchIcon","Icon for 'Find Next' in the editor find widget.")),LFt=w("label.findDialog","Find / Replace"),TFt=w("label.find","Find"),DFt=w("placeholder.find","Find"),IFt=w("label.previousMatchButton","Previous Match"),AFt=w("label.nextMatchButton","Next Match"),NFt=w("label.toggleSelectionFind","Find in Selection"),RFt=w("label.closeButton","Close"),PFt=w("label.replace","Replace"),OFt=w("placeholder.replace","Replace"),MFt=w("label.replaceButton","Replace"),FFt=w("label.replaceAllButton","Replace All"),BFt=w("label.toggleReplaceButton","Toggle Replace"),$Ft=w("title.matchesCountLimit","Only the first {0} results are highlighted, but all find operations work on the entire text.",Wv),WFt=w("label.matchesLocation","{0} of {1}"),KCe=w("label.noResults","No results"),ep=419,HFt=275,VFt=HFt-54;let UT=69;const zFt=33,GCe="ctrlEnterReplaceAll.windows.donotask",YCe=Rn?256:2048;class qq{constructor(e){this.afterLineNumber=e,this.heightInPx=zFt,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function ZCe(n,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){n.stopPropagation();return}}function XCe(n,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEndthis._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(d=>this._onStateChanged(d))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(d=>{if(d.hasChanged(92)&&(this._codeEditor.getOption(92)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),d.hasChanged(146)&&this._tryUpdateWidgetWidth(),d.hasChanged(2)&&this.updateAccessibilitySupport(),d.hasChanged(41)){const h=this._codeEditor.getOption(41).loop;this._state.change({loop:h},!1);const f=this._codeEditor.getOption(41).addExtraSpaceOnTop;f&&!this._viewZone&&(this._viewZone=new qq(0),this._showViewZone()),!f&&this._viewZone&&this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{this._isVisible&&this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){const d=await this._controller.getGlobalBufferTerm();d&&d!==this._state.searchString&&(this._state.change({searchString:d},!1),this._findInput.select())}})),this._findInputFocused=_H.bindTo(o),this._findFocusTracker=this._register(Eg(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus(()=>{this._findInputFocused.set(!0),this._updateSearchScope()})),this._register(this._findFocusTracker.onDidBlur(()=>{this._findInputFocused.set(!1)})),this._replaceInputFocused=jue.bindTo(o),this._replaceFocusTracker=this._register(Eg(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus(()=>{this._replaceInputFocused.set(!0),this._updateSearchScope()})),this._register(this._replaceFocusTracker.onDidBlur(()=>{this._replaceInputFocused.set(!1)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(41).addExtraSpaceOnTop&&(this._viewZone=new qq(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(d=>{if(d.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}getId(){return Yue.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(e){if(e.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(e.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),e.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),e.isReplaceRevealed&&(this._state.isReplaceRevealed?!this._codeEditor.getOption(92)&&!this._isReplaceVisible&&(this._isReplaceVisible=!0,this._replaceInput.width=qc(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(e.isRevealed||e.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),e.isRegex&&this._findInput.setRegex(this._state.isRegex),e.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),e.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),e.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),e.searchScope&&(this._state.searchScope?this._toggleSelectionFind.checked=!0:this._toggleSelectionFind.checked=!1,this._updateToggleSelectionFindButton()),e.searchString||e.matchesCount||e.matchesPosition){const t=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle("no-results",t),this._updateMatchesCount(),this._updateButtons()}(e.searchString||e.currentMatch)&&this._layoutViewZone(),e.updateHistory&&this._delayedUpdateHistory(),e.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,rn)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){this._matchesCount.style.minWidth=UT+"px",this._state.matchesCount>=Wv?this._matchesCount.title=$Ft:this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=Wv&&(t+="+");let i=String(this._state.matchesPosition);i==="0"&&(i="?"),e=Lw(WFt,i,t)}else e=KCe;this._matchesCount.appendChild(document.createTextNode(e)),ql(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),UT=Math.max(UT,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===KCe)return i===""?w("ariaSearchNoResultEmpty","{0} found",e):w("ariaSearchNoResult","{0} found for '{1}'",e,i);if(t){const r=w("ariaSearchNoResultWithLineNum","{0} found for '{1}', at {2}",e,i,t.startLineNumber+":"+t.startColumn),s=this._codeEditor.getModel();return s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1?`${s.getLineContent(t.startLineNumber)}, ${r}`:r}return w("ariaSearchNoResultWithLineNumNoCurrentMatch","{0} found for '{1}'",e,i)}_updateToggleSelectionFindButton(){const e=this._codeEditor.getSelection(),t=e?e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn:!1,i=this._toggleSelectionFind.checked;this._isVisible&&(i||t)?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);const e=this._state.searchString.length>0,t=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);const i=!this._codeEditor.getOption(92);this._toggleReplaceBtn.setEnabled(this._isVisible&&i)}_reveal(){if(this._revealTimeouts.forEach(e=>{clearTimeout(e)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const e=this._codeEditor.getSelection();switch(this._codeEditor.getOption(41).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":{const i=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=i;break}}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout(()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false")},0)),this._revealTimeouts.push(setTimeout(()=>{this._findInput.validate()},200)),this._codeEditor.layoutOverlayWidget(this);let t=!0;if(this._codeEditor.getOption(41).seedSearchStringFromSelection&&e){const i=this._codeEditor.getDomNode();if(i){const r=ms(i),s=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),o=r.left+(s?s.left:0),a=s?s.top:0;if(this._viewZone&&ae.startLineNumber&&(t=!1);const l=u3e(this._domNode).left;o>l&&(t=!1);const c=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());r.left+(c?c.left:0)>l&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach(t=>{clearTimeout(t)}),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),e&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(e){if(!this._codeEditor.getOption(41).addExtraSpaceOnTop){this._removeViewZone();return}if(!this._isVisible)return;const i=this._viewZone;this._viewZoneId!==void 0||!i||this._codeEditor.changeViewZones(r=>{i.heightInPx=this._getHeight(),this._viewZoneId=r.addZone(i),this._codeEditor.setScrollTop(e||this._codeEditor.getScrollTop()+i.heightInPx)})}_showViewZone(e=!0){if(!this._isVisible||!this._codeEditor.getOption(41).addExtraSpaceOnTop)return;this._viewZone===void 0&&(this._viewZone=new qq(0));const i=this._viewZone;this._codeEditor.changeViewZones(r=>{if(this._viewZoneId!==void 0){const s=this._getHeight();if(s===i.heightInPx)return;const o=s-i.heightInPx;i.heightInPx=s,r.layoutZone(this._viewZoneId),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+o);return}else{let s=this._getHeight();if(s-=this._codeEditor.getOption(84).top,s<=0)return;i.heightInPx=s,this._viewZoneId=r.addZone(i),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s)}})}_removeViewZone(){this._codeEditor.changeViewZones(e=>{this._viewZoneId!==void 0&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))})}_tryUpdateWidgetWidth(){if(!this._isVisible||!this._domNode.isConnected)return;const e=this._codeEditor.getLayoutInfo();if(e.contentWidth<=0){this._domNode.classList.add("hiddenEditor");return}else this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");const i=e.width,r=e.minimap.minimapWidth;let s=!1,o=!1,a=!1;if(this._resized&&qc(this._domNode)>ep){this._domNode.style.maxWidth=`${i-28-r-15}px`,this._replaceInput.width=qc(this._findInput.domNode);return}if(ep+28+r>=i&&(o=!0),ep+28+r-UT>=i&&(a=!0),ep+28+r-UT>=i+50&&(s=!0),this._domNode.classList.toggle("collapsed-find-widget",s),this._domNode.classList.toggle("narrow-find-widget",a),this._domNode.classList.toggle("reduced-find-widget",o),!a&&!s&&(this._domNode.style.maxWidth=`${i-28-r-15}px`),this._findInput.layout({collapsedFindWidget:s,narrowFindWidget:a,reducedFindWidget:o}),this._resized){const l=this._findInput.inputBox.element.clientWidth;l>0&&(this._replaceInput.width=l)}else this._isReplaceVisible&&(this._replaceInput.width=qc(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){const e=this._getHeight();return this._cachedHeight!==null&&this._cachedHeight===e?!1:(this._cachedHeight=e,this._domNode.style.height=`${e}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){const e=this._codeEditor.getSelections();e.map(t=>{t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1)));const i=this._state.currentMatch;return t.startLineNumber!==t.endLineNumber&&!$.equalsRange(t,i)?t:null}).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(YCe|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(` `),e.preventDefault();return}if(e.equals(2)){this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return ZCe(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return XCe(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(YCe|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{Ta&&hg&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(w("ctrlEnter.keybindingChanged","Ctrl+Enter now inserts line break instead of replacing all. You can modify the keybinding for editor.action.replaceAll to override this behavior.")),this._ctrlEnterReplaceAllWarningPrompted=!0,this._storageService.store(GCe,!0,0,0)),this._replaceInput.inputBox.insertAtCursor(` -`),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return ZCe(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return XCe(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}_buildDomNode(){this._findInput=this._register(new Zee(null,this._contextViewProvider,{width:V5t,label:T5t,placeholder:D5t,appendCaseSensitiveLabel:this._keybindingLabelFor(wr.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(wr.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(wr.ToggleRegexCommand),validation:u=>{if(u.length===0||!this._findInput.getRegex())return null;try{return new RegExp(u,"gu"),null}catch(d){return{content:d.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>UCe(this._keybindingService),inputBoxStyles:A8,toggleStyles:I8},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown(u=>this._onFindInputKeyDown(u))),this._register(this._findInput.inputBox.onDidChange(()=>{this._ignoreChangeEvent||this._state.change({searchString:this._findInput.getValue()},!0)})),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._findInput.onCaseSensitiveKeyDown(u=>{u.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),u.preventDefault())})),this._register(this._findInput.onRegexKeyDown(u=>{u.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),u.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(u=>{this._tryUpdateHeight()&&this._showViewZone()})),zl&&this._register(this._findInput.onMouseDown(u=>this._onFindInputMouseDown(u))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const i=this._register(_E());this._prevBtn=this._register(new Sx({label:I5t+this._keybindingLabelFor(wr.PreviousMatchFindAction),icon:k5t,hoverDelegate:i,onTrigger:()=>{Lv(this._codeEditor.getAction(wr.PreviousMatchFindAction)).run().then(void 0,rn)}},this._hoverService)),this._nextBtn=this._register(new Sx({label:A5t+this._keybindingLabelFor(wr.NextMatchFindAction),icon:E5t,hoverDelegate:i,onTrigger:()=>{Lv(this._codeEditor.getAction(wr.NextMatchFindAction)).run().then(void 0,rn)}},this._hoverService));const r=document.createElement("div");r.className="find-part",r.appendChild(this._findInput.domNode);const s=document.createElement("div");s.className="find-actions",r.appendChild(s),s.appendChild(this._matchesCount),s.appendChild(this._prevBtn.domNode),s.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new o2({icon:C5t,title:N5t+this._keybindingLabelFor(wr.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:i,inputActiveOptionBackground:it(eO),inputActiveOptionBorder:it(cW),inputActiveOptionForeground:it(uW)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let u=this._codeEditor.getSelections();u=u.map(d=>(d.endColumn===1&&d.endLineNumber>d.startLineNumber&&(d=d.setEndPosition(d.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(d.endLineNumber-1))),d.isEmpty()?null:d)).filter(d=>!!d),u.length&&this._state.change({searchScope:u},!0)}}else this._state.change({searchScope:null},!0)})),s.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new Sx({label:R5t+this._keybindingLabelFor(wr.CloseFindWidgetCommand),icon:z6e,hoverDelegate:i,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:u=>{u.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),u.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new Xee(null,void 0,{label:P5t,placeholder:O5t,appendPreserveCaseLabel:this._keybindingLabelFor(wr.TogglePreserveCaseCommand),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>UCe(this._keybindingService),inputBoxStyles:A8,toggleStyles:I8},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(u=>this._onReplaceInputKeyDown(u))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(u=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(u=>{u.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),u.preventDefault())}));const o=this._register(_E());this._replaceBtn=this._register(new Sx({label:M5t+this._keybindingLabelFor(wr.ReplaceOneAction),icon:x5t,hoverDelegate:o,onTrigger:()=>{this._controller.replace()},onKeyDown:u=>{u.equals(1026)&&(this._closeBtn.focus(),u.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new Sx({label:F5t+this._keybindingLabelFor(wr.ReplaceAllAction),icon:S5t,hoverDelegate:o,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));const a=document.createElement("div");a.className="replace-part",a.appendChild(this._replaceInput.domNode);const l=document.createElement("div");l.className="replace-actions",a.appendChild(l),l.appendChild(this._replaceBtn.domNode),l.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new Sx({label:B5t,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=qc(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}},this._hoverService)),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=L5t,this._domNode.role="dialog",this._domNode.style.width=`${ep}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(r),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(a),this._resizeSash=this._register(new $a(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let c=ep;this._register(this._resizeSash.onDidStart(()=>{c=qc(this._domNode)})),this._register(this._resizeSash.onDidChange(u=>{this._resized=!0;const d=c+u.startX-u.currentX;if(dh||(this._domNode.style.width=`${d}px`,this._isReplaceVisible&&(this._replaceInput.width=qc(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const u=qc(this._domNode);if(u{this._opts.onTrigger(),r.preventDefault()}),this.onkeydown(this._domNode,r=>{if(r.equals(10)||r.equals(3)){this._opts.onTrigger(),r.preventDefault();return}this._opts.onKeyDown?.(r)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(e){this._domNode.classList.toggle("disabled",!e),this._domNode.setAttribute("aria-disabled",String(!e)),this._domNode.tabIndex=e?0:-1}setExpanded(e){this._domNode.setAttribute("aria-expanded",String(!!e)),e?(this._domNode.classList.remove(...zt.asClassNameArray(jCe)),this._domNode.classList.add(...zt.asClassNameArray(qCe))):(this._domNode.classList.remove(...zt.asClassNameArray(qCe)),this._domNode.classList.add(...zt.asClassNameArray(jCe)))}}dh((n,e)=>{const t=n.getColor(Av);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${mg(n.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=n.getColor(Cyt);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${mg(n.type)?"dashed":"solid"} ${i}; }`);const r=n.getColor(Yn);r&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${r}; }`);const s=n.getColor(yyt);s&&e.addRule(`.monaco-editor .findMatchInline { color: ${s}; }`);const o=n.getColor(wyt);o&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${o}; }`)});var Q7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ld=function(n,e){return function(t,i){e(t,i,n)}},Qee;const U5t=524288;function Jee(n,e="single",t=!1){if(!n.hasModel())return null;const i=n.getSelection();if(e==="single"&&i.startLineNumber===i.endLineNumber||e==="multiple"){if(i.isEmpty()){const r=n.getConfiguredWordAtPosition(i.getStartPosition());if(r&&t===!1)return r.word}else if(n.getModel().getValueLengthInRange(i)this._onStateChanged(a))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{const a=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),a&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(41).loop})}))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(e){this.saveQueryState(e),e.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),e.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(e){e.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),e.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),e.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),e.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!_H.getValue(this._contextKeyService)}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){let e=this._editor.getSelections();e=e.map(t=>(t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._editor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.isEmpty()?null:t)).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}setSearchString(e){this._state.isRegex&&(e=nd(e)),this._state.change({searchString:e},!1)}highlightFindOptions(e=!1){}async _start(e,t){if(this.disposeModel(),!this._editor.hasModel())return;const i={...t,isRevealed:!0};if(e.seedSearchStringFromSelection==="single"){const r=Jee(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);r&&(this._state.isRegex?i.searchString=nd(r):i.searchString=r)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const r=Jee(this._editor,e.seedSearchStringFromSelection);r&&(i.searchString=r)}if(!i.searchString&&e.seedSearchStringFromGlobalClipboard){const r=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;r&&(i.searchString=r)}if(e.forceRevealReplace||i.isReplaceRevealed?i.isReplaceRevealed=!0:this._findWidgetVisible.get()||(i.isReplaceRevealed=!1),e.updateSearchScope){const r=this._editor.getSelections();r.some(s=>!s.isEmpty())&&(i.searchScope=r)}i.loop=e.loop,this._state.change(i,!1),this._model||(this._model=new zI(this._editor,this._state))}start(e,t){return this._start(e,t)}moveToNextMatch(){return this._model?(this._model.moveToNextMatch(),!0):!1}moveToPrevMatch(){return this._model?(this._model.moveToPrevMatch(),!0):!1}goToMatch(e){return this._model?(this._model.moveToMatch(e),!0):!1}replace(){return this._model?(this._model.replace(),!0):!1}replaceAll(){return this._model?this._editor.getModel()?.isTooLargeForHeapOperation()?(this._notificationService.warn(w("too.large.for.replaceall","The file is too large to perform a replace all operation.")),!1):(this._model.replaceAll(),!0):!1}selectAllMatches(){return this._model?(this._model.selectAllMatches(),this._editor.focus(),!0):!1}async getGlobalBufferTerm(){return this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(e){this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(e)}};Ic=Qee=Q7e([Ld(1,jt),Ld(2,pf),Ld(3,b0),Ld(4,Ts),Ld(5,um)],Ic);let ete=class extends Ic{constructor(e,t,i,r,s,o,a,l,c){super(e,i,a,l,o,c),this._contextViewService=t,this._keybindingService=r,this._themeService=s,this._widget=null,this._findOptionsWidget=null}async _start(e,t){this._widget||this._createFindWidget();const i=this._editor.getSelection();let r=!1;switch(this._editor.getOption(41).autoFindInSelection){case"always":r=!0;break;case"never":r=!1;break;case"multiline":{r=!!i&&i.startLineNumber!==i.endLineNumber;break}}e.updateSearchScope=e.updateSearchScope||r,await super._start(e,t),this._widget&&(e.shouldFocus===2?this._widget.focusReplaceInput():e.shouldFocus===1&&this._widget.focusFindInput())}highlightFindOptions(e=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!e?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new Yue(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService,this._hoverService)),this._findOptionsWidget=this._register(new que(this._editor,this._state,this._keybindingService))}};ete=Q7e([Ld(1,m0),Ld(2,jt),Ld(3,xi),Ld(4,go),Ld(5,Ts),Ld(6,pf),Ld(7,b0),Ld(8,um)],ete);const j5t=L3e(new E3e({id:wr.StartFindAction,label:w("startFindAction","Find"),alias:"Find",precondition:Le.or(Q.focus,Le.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:ce.MenubarEditMenu,group:"3_find",title:w({key:"miFind",comment:["&& denotes a mnemonic"]},"&&Find"),order:1}}));j5t.addImplementation(0,(n,e,t)=>{const i=Ic.get(e);return i?i.start({forceRevealReplace:!1,seedSearchStringFromSelection:e.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(41).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(41).loop}):!1});const q5t={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},isRegex:{type:"boolean"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},preserveCase:{type:"boolean"},findInSelection:{type:"boolean"}}}}]};class K5t extends ot{constructor(){super({id:wr.StartFindWithArgs,label:w("startFindWithArgsAction","Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:q5t})}async run(e,t,i){const r=Ic.get(t);if(r){const s=i?{searchString:i.searchString,replaceString:i.replaceString,isReplaceRevealed:i.replaceString!==void 0,isRegex:i.isRegex,wholeWord:i.matchWholeWord,matchCase:i.isCaseSensitive,preserveCase:i.preserveCase}:{};await r.start({forceRevealReplace:!1,seedSearchStringFromSelection:r.getState().searchString.length===0&&t.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:t.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:i?.findInSelection||!1,loop:t.getOption(41).loop},s),r.setGlobalBufferTerm(r.getState().searchString)}}}class G5t extends ot{constructor(){super({id:wr.StartFindWithSelection,label:w("startFindWithSelectionAction","Find With Selection"),alias:"Find With Selection",precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(e,t){const i=Ic.get(t);i&&(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),i.setGlobalBufferTerm(i.getState().searchString))}}class J7e extends ot{async run(e,t){const i=Ic.get(t);i&&!this._run(i)&&(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:i.getState().searchString.length===0&&t.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:t.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),this._run(i))}}class Y5t extends J7e{constructor(){super({id:wr.NextMatchFindAction,label:w("findNextMatchAction","Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:Q.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Le.and(Q.focus,_H),primary:3,weight:100}]})}_run(e){return e.moveToNextMatch()?(e.editor.pushUndoStop(),!0):!1}}class Z5t extends J7e{constructor(){super({id:wr.PreviousMatchFindAction,label:w("findPreviousMatchAction","Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:Q.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Le.and(Q.focus,_H),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}class X5t extends ot{constructor(){super({id:wr.GoToMatchFindAction,label:w("findMatchAction.goToMatch","Go to Match..."),alias:"Go to Match...",precondition:y0}),this._highlightDecorations=[]}run(e,t,i){const r=Ic.get(t);if(!r)return;const s=r.getState().matchesCount;if(s<1){e.get(Ts).notify({severity:iW.Warning,message:w("findMatchAction.noResults","No matches. Try searching for something else.")});return}const o=e.get(hh),a=new ke,l=a.add(o.createInputBox());l.placeholder=w("findMatchAction.inputPlaceHolder","Type a number to go to a specific match (between 1 and {0})",s);const c=d=>{const h=parseInt(d);if(isNaN(h))return;const f=r.getState().matchesCount;if(h>0&&h<=f)return h-1;if(h<0&&h>=-f)return f+h},u=d=>{const h=c(d);if(typeof h=="number"){l.validationMessage=void 0,r.goToMatch(h);const f=r.getState().currentMatch;f&&this.addDecorations(t,f)}else l.validationMessage=w("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",r.getState().matchesCount),this.clearDecorations(t)};a.add(l.onDidChangeValue(d=>{u(d)})),a.add(l.onDidAccept(()=>{const d=c(l.value);typeof d=="number"?(r.goToMatch(d),l.hide()):l.validationMessage=w("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",r.getState().matchesCount)})),a.add(l.onDidHide(()=>{this.clearDecorations(t),a.dispose()})),l.show()}clearDecorations(e){e.changeDecorations(t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])})}addDecorations(e,t){e.changeDecorations(i=>{this._highlightDecorations=i.deltaDecorations(this._highlightDecorations,[{range:t,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:ss(D5e),position:Qu.Full}}}])})}}class eBe extends ot{async run(e,t){const i=Ic.get(t);if(!i)return;const r=Jee(t,"single",!1);r&&i.setSearchString(r),this._run(i)||(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),this._run(i))}}class Q5t extends eBe{constructor(){super({id:wr.NextSelectionMatchFindAction,label:w("nextSelectionMatchFindAction","Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}class J5t extends eBe{constructor(){super({id:wr.PreviousSelectionMatchFindAction,label:w("previousSelectionMatchFindAction","Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}}const e6t=L3e(new E3e({id:wr.StartFindReplaceAction,label:w("startReplace","Replace"),alias:"Replace",precondition:Le.or(Q.focus,Le.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:ce.MenubarEditMenu,group:"3_find",title:w({key:"miReplace",comment:["&& denotes a mnemonic"]},"&&Replace"),order:2}}));e6t.addImplementation(0,(n,e,t)=>{if(!e.hasModel()||e.getOption(92))return!1;const i=Ic.get(e);if(!i)return!1;const r=e.getSelection(),s=i.isFindInputFocused(),o=!r.isEmpty()&&r.startLineNumber===r.endLineNumber&&e.getOption(41).seedSearchStringFromSelection!=="never"&&!s,a=s||o?2:1;return i.start({forceRevealReplace:!0,seedSearchStringFromSelection:o?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(41).seedSearchStringFromSelection!=="never",shouldFocus:a,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(41).loop})});Zn(Ic.ID,ete,0);Pe(K5t);Pe(G5t);Pe(Y5t);Pe(Z5t);Pe(X5t);Pe(Q5t);Pe(J5t);const Wg=fo.bindToContribution(Ic.get);Je(new Wg({id:wr.CloseFindWidgetCommand,precondition:y0,handler:n=>n.closeFindWidget(),kbOpts:{weight:105,kbExpr:Le.and(Q.focus,Le.not("isComposing")),primary:9,secondary:[1033]}}));Je(new Wg({id:wr.ToggleCaseSensitiveCommand,precondition:void 0,handler:n=>n.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:Q.focus,primary:d3.primary,mac:d3.mac,win:d3.win,linux:d3.linux}}));Je(new Wg({id:wr.ToggleWholeWordCommand,precondition:void 0,handler:n=>n.toggleWholeWords(),kbOpts:{weight:105,kbExpr:Q.focus,primary:h3.primary,mac:h3.mac,win:h3.win,linux:h3.linux}}));Je(new Wg({id:wr.ToggleRegexCommand,precondition:void 0,handler:n=>n.toggleRegex(),kbOpts:{weight:105,kbExpr:Q.focus,primary:f3.primary,mac:f3.mac,win:f3.win,linux:f3.linux}}));Je(new Wg({id:wr.ToggleSearchScopeCommand,precondition:void 0,handler:n=>n.toggleSearchScope(),kbOpts:{weight:105,kbExpr:Q.focus,primary:g3.primary,mac:g3.mac,win:g3.win,linux:g3.linux}}));Je(new Wg({id:wr.TogglePreserveCaseCommand,precondition:void 0,handler:n=>n.togglePreserveCase(),kbOpts:{weight:105,kbExpr:Q.focus,primary:p3.primary,mac:p3.mac,win:p3.win,linux:p3.linux}}));Je(new Wg({id:wr.ReplaceOneAction,precondition:y0,handler:n=>n.replace(),kbOpts:{weight:105,kbExpr:Q.focus,primary:3094}}));Je(new Wg({id:wr.ReplaceOneAction,precondition:y0,handler:n=>n.replace(),kbOpts:{weight:105,kbExpr:Le.and(Q.focus,jue),primary:3}}));Je(new Wg({id:wr.ReplaceAllAction,precondition:y0,handler:n=>n.replaceAll(),kbOpts:{weight:105,kbExpr:Q.focus,primary:2563}}));Je(new Wg({id:wr.ReplaceAllAction,precondition:y0,handler:n=>n.replaceAll(),kbOpts:{weight:105,kbExpr:Le.and(Q.focus,jue),primary:void 0,mac:{primary:2051}}}));Je(new Wg({id:wr.SelectAllMatchesAction,precondition:y0,handler:n=>n.selectAllMatches(),kbOpts:{weight:105,kbExpr:Q.focus,primary:515}}));const t6t={0:" ",1:"u",2:"r"},QCe=65535,jf=16777215,JCe=4278190080;class Kq{constructor(e){const t=Math.ceil(e/32);this._states=new Uint32Array(t)}get(e){const t=e/32|0,i=e%32;return(this._states[t]&1<QCe)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new Kq(e.length),this._userDefinedStates=new Kq(e.length),this._recoveredStates=new Kq(e.length),this._types=i,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;const e=[],t=(i,r)=>{const s=e[e.length-1];return this.getStartLineNumber(s)<=i&&this.getEndLineNumber(s)>=r};for(let i=0,r=this._startIndexes.length;ijf||o>jf)throw new Error("startLineNumber or endLineNumber must not exceed "+jf);for(;e.length>0&&!t(s,o);)e.pop();const a=e.length>0?e[e.length-1]:-1;e.push(i),this._startIndexes[i]=s+((a&255)<<24),this._endIndexes[i]=o+((a&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(e){return this._startIndexes[e]&jf}getEndLineNumber(e){return this._endIndexes[e]&jf}getType(e){return this._types?this._types[e]:void 0}hasTypes(){return!!this._types}isCollapsed(e){return this._collapseStates.get(e)}setCollapsed(e,t){this._collapseStates.set(e,t)}isUserDefined(e){return this._userDefinedStates.get(e)}setUserDefined(e,t){return this._userDefinedStates.set(e,t)}isRecovered(e){return this._recoveredStates.get(e)}setRecovered(e,t){return this._recoveredStates.set(e,t)}getSource(e){return this.isUserDefined(e)?1:this.isRecovered(e)?2:0}setSource(e,t){t===1?(this.setUserDefined(e,!0),this.setRecovered(e,!1)):t===2?(this.setUserDefined(e,!1),this.setRecovered(e,!0)):(this.setUserDefined(e,!1),this.setRecovered(e,!1))}setCollapsedAllOfType(e,t){let i=!1;if(this._types)for(let r=0;r>>24)+((this._endIndexes[e]&JCe)>>>16);return t===QCe?-1:t}contains(e,t){return this.getStartLineNumber(e)<=t&&this.getEndLineNumber(e)>=t}findIndex(e){let t=0,i=this._startIndexes.length;if(i===0)return-1;for(;t=0){if(this.getEndLineNumber(t)>=e)return t;for(t=this.getParentIndex(t);t!==-1;){if(this.contains(t,e))return t;t=this.getParentIndex(t)}}return-1}toString(){const e=[];for(let t=0;tArray.isArray(m)?v=>v<_?m[v]:void 0:v=>v<_?m.toFoldRange(v):void 0,o=s(e,e.length),a=s(t,t.length);let l=0,c=0,u=o(0),d=a(0);const h=[];let f,g=0;const p=[];for(;u||d;){let m;if(d&&(!u||u.startLineNumber>=d.startLineNumber))u&&u.startLineNumber===d.startLineNumber?(d.source===1?m=d:(m=u,m.isCollapsed=d.isCollapsed&&(u.endLineNumber===d.endLineNumber||!r?.startsInside(u.startLineNumber+1,u.endLineNumber+1)),m.source=0),u=o(++l)):(m=d,d.isCollapsed&&d.source===0&&(m.source=2)),d=a(++c);else{let _=c,v=d;for(;;){if(!v||v.startLineNumber>u.endLineNumber){m=u;break}if(v.source===1&&v.endLineNumber>u.endLineNumber)break;v=a(++_)}u=o(++l)}if(m){for(;f&&f.endLineNumberm.startLineNumber&&m.startLineNumber>g&&m.endLineNumber<=i&&(!f||f.endLineNumber>=m.endLineNumber)&&(p.push(m),g=m.startLineNumber,f&&h.push(f),f=m)}}return p}}class n6t{constructor(e,t){this.ranges=e,this.index=t}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(e){return e.startLineNumber<=this.startLineNumber&&e.endLineNumber>=this.endLineNumber}containsLine(e){return this.startLineNumber<=e&&e<=this.endLineNumber}}class i6t{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new fe,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new Fu(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}toggleCollapseState(e){if(!e.length)return;e=e.sort((i,r)=>i.regionIndex-r.regionIndex);const t={};this._decorationProvider.changeDecorations(i=>{let r=0,s=-1,o=-1;const a=l=>{for(;ro&&(o=c),r++}};for(const l of e){const c=l.regionIndex,u=this._editorDecorationIds[c];if(u&&!t[u]){t[u]=!0,a(c);const d=!this._regions.isCollapsed(c);this._regions.setCollapsed(c,d),s=Math.max(s,this._regions.getEndLineNumber(c))}}a(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:e})}removeManualRanges(e){const t=new Array,i=r=>{for(const s of e)if(!(s.startLineNumber>r.endLineNumber||r.startLineNumber>s.endLineNumber))return!0;return!1};for(let r=0;ri&&(i=a)}this._decorationProvider.changeDecorations(r=>this._editorDecorationIds=r.deltaDecorations(this._editorDecorationIds,t)),this._regions=e,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(e){const t=[];for(let i=0,r=this._regions.length;i=o.endLineNumber||o.startLineNumber<1||o.endLineNumber>i)continue;const a=this._getLinesChecksum(o.startLineNumber+1,o.endLineNumber);t.push({startLineNumber:o.startLineNumber,endLineNumber:o.endLineNumber,isCollapsed:o.isCollapsed,source:o.source,checksum:a})}return t.length>0?t:void 0}applyMemento(e){if(!Array.isArray(e))return;const t=[],i=this._textModel.getLineCount();for(const s of e){if(s.startLineNumber>=s.endLineNumber||s.startLineNumber<1||s.endLineNumber>i)continue;const o=this._getLinesChecksum(s.startLineNumber+1,s.endLineNumber);(!s.checksum||o===s.checksum)&&t.push({startLineNumber:s.startLineNumber,endLineNumber:s.endLineNumber,type:void 0,isCollapsed:s.isCollapsed??!0,source:s.source??0})}const r=Fu.sanitizeAndMerge(this._regions,t,i);this.updatePost(Fu.fromFoldRanges(r))}_getLinesChecksum(e,t){return F$(this._textModel.getLineContent(e)+this._textModel.getLineContent(t))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds)}getAllRegionsAtLine(e,t){const i=[];if(this._regions){let r=this._regions.findRange(e),s=1;for(;r>=0;){const o=this._regions.toRegion(r);(!t||t(o,s))&&i.push(o),s++,r=o.parentIndex}}return i}getRegionAtLine(e){if(this._regions){const t=this._regions.findRange(e);if(t>=0)return this._regions.toRegion(t)}return null}getRegionsInside(e,t){const i=[],r=e?e.regionIndex+1:0,s=e?e.endLineNumber:Number.MAX_VALUE;if(t&&t.length===2){const o=[];for(let a=r,l=this._regions.length;a0&&!c.containedBy(o[o.length-1]);)o.pop();o.push(c),t(c,o.length)&&i.push(c)}else break}}else for(let o=r,a=this._regions.length;o1){const a=n.getRegionsInside(s,(l,c)=>l.isCollapsed!==o&&c0)for(const s of i){const o=n.getRegionAtLine(s);if(o&&(o.isCollapsed!==e&&r.push(o),t>1)){const a=n.getRegionsInside(o,(l,c)=>l.isCollapsed!==e&&co.isCollapsed!==e&&aa.isCollapsed!==e&&l<=t);r.push(...o)}n.toggleCollapseState(r)}function r6t(n,e,t){const i=[];for(const r of t){const s=n.getAllRegionsAtLine(r,o=>o.isCollapsed!==e);s.length>0&&i.push(s[0])}n.toggleCollapseState(i)}function s6t(n,e,t,i){const r=(o,a)=>a===e&&o.isCollapsed!==t&&!i.some(l=>o.containsLine(l)),s=n.getRegionsInside(null,r);n.toggleCollapseState(s)}function nBe(n,e,t){const i=[];for(const o of t){const a=n.getAllRegionsAtLine(o,void 0);a.length>0&&i.push(a[0])}const r=o=>i.every(a=>!a.containedBy(o)&&!o.containedBy(a))&&o.isCollapsed!==e,s=n.getRegionsInside(null,r);n.toggleCollapseState(s)}function Xue(n,e,t){const i=n.textModel,r=n.regions,s=[];for(let o=r.length-1;o>=0;o--)if(t!==r.isCollapsed(o)){const a=r.getStartLineNumber(o);e.test(i.getLineContent(a))&&s.push(r.toRegion(o))}n.toggleCollapseState(s)}function Que(n,e,t){const i=n.regions,r=[];for(let s=i.length-1;s>=0;s--)t!==i.isCollapsed(s)&&e===i.getType(s)&&r.push(i.toRegion(s));n.toggleCollapseState(r)}function o6t(n,e){let t=null;const i=e.getRegionAtLine(n);if(i!==null&&(t=i.startLineNumber,n===t)){const r=i.parentIndex;r!==-1?t=e.regions.getStartLineNumber(r):t=null}return t}function a6t(n,e){let t=e.getRegionAtLine(n);if(t!==null&&t.startLineNumber===n){if(n!==t.startLineNumber)return t.startLineNumber;{const i=t.parentIndex;let r=0;for(i!==-1&&(r=e.regions.getStartLineNumber(t.parentIndex));t!==null;)if(t.regionIndex>0){if(t=e.regions.toRegion(t.regionIndex-1),t.startLineNumber<=r)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}}else if(e.regions.length>0)for(t=e.regions.toRegion(e.regions.length-1);t!==null;){if(t.startLineNumber0?t=e.regions.toRegion(t.regionIndex-1):t=null}return null}function l6t(n,e){let t=e.getRegionAtLine(n);if(t!==null&&t.startLineNumber===n){const i=t.parentIndex;let r=0;if(i!==-1)r=e.regions.getEndLineNumber(t.parentIndex);else{if(e.regions.length===0)return null;r=e.regions.getEndLineNumber(e.regions.length-1)}for(;t!==null;)if(t.regionIndex=r)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}else if(e.regions.length>0)for(t=e.regions.toRegion(0);t!==null;){if(t.startLineNumber>n)return t.startLineNumber;t.regionIndexthis.updateHiddenRanges()),this._hiddenRanges=[],e.regions.length&&this.updateHiddenRanges()}notifyChangeModelContent(e){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=e.changes.some(t=>t.range.endLineNumber!==t.range.startLineNumber||Lb(t.text)[0]!==0))}updateHiddenRanges(){let e=!1;const t=[];let i=0,r=0,s=Number.MAX_VALUE,o=-1;const a=this._foldingModel.regions;for(;i0}isHidden(e){return exe(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1;const i=this._foldingModel.textModel;let r=null;const s=o=>((!r||!u6t(o,r))&&(r=exe(this._hiddenRanges,o)),r?r.startLineNumber-1:null);for(let o=0,a=e.length;o0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null)}}function u6t(n,e){return n>=e.startLineNumber&&n<=e.endLineNumber}function exe(n,e){const t=gN(n,i=>e=0&&n[t].endLineNumber>=e?n[t]:null}const d6t=5e3,h6t="indent";class Jue{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=i,this.id=h6t}dispose(){}compute(e){const t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,i=t&&!!t.offSide,r=t&&t.markers;return Promise.resolve(p6t(this.editorModel,i,r,this.foldingRangesLimit))}}let f6t=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>jf||t>jf)return;const r=this._length;this._startIndexes[r]=e,this._endIndexes[r]=t,this._length++,i<1e3&&(this._indentOccurrences[i]=(this._indentOccurrences[i]||0)+1)}toIndentRanges(e){const t=this._foldingRangesLimit.limit;if(this._length<=t){this._foldingRangesLimit.update(this._length,!1);const i=new Uint32Array(this._length),r=new Uint32Array(this._length);for(let s=this._length-1,o=0;s>=0;s--,o++)i[o]=this._startIndexes[s],r[o]=this._endIndexes[s];return new Fu(i,r)}else{this._foldingRangesLimit.update(this._length,t);let i=0,r=this._indentOccurrences.length;for(let l=0;lt){r=l;break}i+=c}}const s=e.getOptions().tabSize,o=new Uint32Array(t),a=new Uint32Array(t);for(let l=this._length-1,c=0;l>=0;l--){const u=this._startIndexes[l],d=e.getLineContent(u),h=TW(d,s);(h{}};function p6t(n,e,t,i=g6t){const r=n.getOptions().tabSize,s=new f6t(i);let o;t&&(o=new RegExp(`(${t.start.source})|(?:${t.end.source})`));const a=[],l=n.getLineCount()+1;a.push({indent:-1,endAbove:l,line:l});for(let c=n.getLineCount();c>0;c--){const u=n.getLineContent(c),d=TW(u,r);let h=a[a.length-1];if(d===-1){e&&(h.endAbove=c);continue}let f;if(o&&(f=u.match(o)))if(f[1]){let g=a.length-1;for(;g>0&&a[g].indent!==-2;)g--;if(g>0){a.length=g+1,h=a[g],s.insertFirst(c,h.line,d),h.line=c,h.indent=d,h.endAbove=c;continue}}else{a.push({indent:-2,endAbove:c,line:c});continue}if(h.indent>d){do a.pop(),h=a[a.length-1];while(h.indent>d);const g=h.endAbove-1;g-c>=1&&s.insertFirst(c,g,d)}h.indent===d?h.endAbove=c:a.push({indent:d,endAbove:c,line:c})}return s.toIndentRanges(n)}const m6t=J("editor.foldBackground",{light:xn(Iv,.3),dark:xn(Iv,.3),hcDark:null,hcLight:null},w("foldBackgroundBackground","Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},w("collapsedTextColor","Color of the collapsed text after the first line of a folded range."));J("editorGutter.foldingControlForeground",h8,w("editorGutter.foldingControlForeground","Color of the folding control in the editor gutter."));const W9=kr("folding-expanded",ze.chevronDown,w("foldingExpandedIcon","Icon for expanded ranges in the editor glyph margin.")),H9=kr("folding-collapsed",ze.chevronRight,w("foldingCollapsedIcon","Icon for collapsed ranges in the editor glyph margin.")),txe=kr("folding-manual-collapsed",H9,w("foldingManualCollapedIcon","Icon for manually collapsed ranges in the editor glyph margin.")),nxe=kr("folding-manual-expanded",W9,w("foldingManualExpandedIcon","Icon for manually expanded ranges in the editor glyph margin.")),Gq={color:ss(m6t),position:1},kx=w("linesCollapsed","Click to expand the range."),v3=w("linesExpanded","Click to collapse the range.");class Du{static{this.COLLAPSED_VISUAL_DECORATION=un.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:kx,firstLineDecorationClassName:zt.asClassName(H9)})}static{this.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=un.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Gq,isWholeLine:!0,linesDecorationsTooltip:kx,firstLineDecorationClassName:zt.asClassName(H9)})}static{this.MANUALLY_COLLAPSED_VISUAL_DECORATION=un.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:kx,firstLineDecorationClassName:zt.asClassName(txe)})}static{this.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=un.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Gq,isWholeLine:!0,linesDecorationsTooltip:kx,firstLineDecorationClassName:zt.asClassName(txe)})}static{this.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=un.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:kx})}static{this.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=un.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Gq,isWholeLine:!0,linesDecorationsTooltip:kx})}static{this.EXPANDED_VISUAL_DECORATION=un.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+zt.asClassName(W9),linesDecorationsTooltip:v3})}static{this.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=un.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:zt.asClassName(W9),linesDecorationsTooltip:v3})}static{this.MANUALLY_EXPANDED_VISUAL_DECORATION=un.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+zt.asClassName(nxe),linesDecorationsTooltip:v3})}static{this.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=un.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:zt.asClassName(nxe),linesDecorationsTooltip:v3})}static{this.NO_CONTROLS_EXPANDED_RANGE_DECORATION=un.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0})}static{this.HIDDEN_RANGE_DECORATION=un.register({description:"folding-hidden-range-decoration",stickiness:1})}constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?Du.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?Du.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:Du.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:Du.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?Du.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Du.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?Du.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Du.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?Du.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:Du.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?Du.MANUALLY_EXPANDED_VISUAL_DECORATION:Du.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}}const _6t={},v6t="syntax";class ede{constructor(e,t,i,r,s){this.editorModel=e,this.providers=t,this.handleFoldingRangesChange=i,this.foldingRangesLimit=r,this.fallbackRangeProvider=s,this.id=v6t,this.disposables=new ke,s&&this.disposables.add(s);for(const o of t)typeof o.onDidChange=="function"&&this.disposables.add(o.onDidChange(i))}compute(e){return b6t(this.providers,this.editorModel,e).then(t=>t?w6t(t,this.foldingRangesLimit):this.fallbackRangeProvider?.compute(e)??null)}dispose(){this.disposables.dispose()}}function b6t(n,e,t){let i=null;const r=n.map((s,o)=>Promise.resolve(s.provideFoldingRanges(e,_6t,t)).then(a=>{if(!t.isCancellationRequested&&Array.isArray(a)){Array.isArray(i)||(i=[]);const l=e.getLineCount();for(const c of a)c.start>0&&c.end>c.start&&c.end<=l&&i.push({start:c.start,end:c.end,rank:o,kind:c.kind})}},vs));return Promise.all(r).then(s=>i)}class y6t{constructor(e){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=e}add(e,t,i,r){if(e>jf||t>jf)return;const s=this._length;this._startIndexes[s]=e,this._endIndexes[s]=t,this._nestingLevels[s]=r,this._types[s]=i,this._length++,r<30&&(this._nestingLevelCounts[r]=(this._nestingLevelCounts[r]||0)+1)}toIndentRanges(){const e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let r=0;re){i=a;break}t+=l}}const r=new Uint32Array(e),s=new Uint32Array(e),o=[];for(let a=0,l=0;a{let l=o.start-a.start;return l===0&&(l=o.rank-a.rank),l}),i=new y6t(e);let r;const s=[];for(const o of t)if(!r)r=o,i.add(o.start,o.end,o.kind&&o.kind.value,s.length);else if(o.start>r.start)if(o.end<=r.end)s.push(r),r=o,i.add(o.start,o.end,o.kind&&o.kind.value,s.length);else{if(o.start>r.end){do r=s.pop();while(r&&o.start>r.end);r&&s.push(r),r=o}i.add(o.start,o.end,o.kind&&o.kind.value,s.length)}return i.toIndentRanges()}var C6t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},jT=function(n,e){return function(t,i){e(t,i,n)}},BD;const Ia=new et("foldingEnabled",!1);let Fb=class extends me{static{BD=this}static{this.ID="editor.contrib.folding"}static get(e){return e.getContribution(BD.ID)}static getFoldingRangeProviders(e,t){const i=e.foldingRangeProvider.ordered(t);return BD._foldingRangeSelector?.(i,t)??i}constructor(e,t,i,r,s,o){super(),this.contextKeyService=t,this.languageConfigurationService=i,this.languageFeaturesService=o,this.localToDispose=this._register(new ke),this.editor=e,this._foldingLimitReporter=new iBe(e);const a=this.editor.getOptions();this._isEnabled=a.get(43),this._useFoldingProviders=a.get(44)!=="indentation",this._unfoldOnClickAfterEndOfLine=a.get(48),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=a.get(46),this.updateDebounceInfo=s.for(o.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new Du(e),this.foldingDecorationProvider.showFoldingControls=a.get(111),this.foldingDecorationProvider.showFoldingHighlights=a.get(45),this.foldingEnabled=Ia.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(l=>{if(l.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),l.hasChanged(47)&&this.onModelChanged(),l.hasChanged(111)||l.hasChanged(45)){const c=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=c.get(111),this.foldingDecorationProvider.showFoldingHighlights=c.get(45),this.triggerFoldingModelChanged()}l.hasChanged(44)&&(this._useFoldingProviders=this.editor.getOptions().get(44)!=="indentation",this.onFoldingStrategyChanged()),l.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),l.hasChanged(46)&&(this._foldingImportsByDefault=this.editor.getOptions().get(46))})),this.onModelChanged()}saveViewState(){const e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){const t=this.foldingModel.getMemento(),i=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:i,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){const t=this.editor.getModel();if(!(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)&&e&&(this._currentModelHasFoldedImports=!!e.foldedImports,e.collapsedRegions&&e.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(e.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new i6t(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new c6t(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new Qd(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new Ui(()=>this.revealCursor(),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelContent(t=>this.onDidChangeModelContent(t))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.localToDispose.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.localToDispose.add({dispose:()=>{this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.updateScheduler?.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,this.rangeProvider?.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){this.rangeProvider?.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;const t=new Jue(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=BD.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new ede(e,i,()=>this.triggerFoldingModelChanged(),this._foldingLimitReporter,t))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(e){this.hiddenRangeModel?.notifyChangeModelContent(e),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger(()=>{const e=this.foldingModel;if(!e)return null;const t=new Bo,i=this.getRangeProvider(e.textModel),r=this.foldingRegionPromise=ko(s=>i.compute(s));return r.then(s=>{if(s&&r===this.foldingRegionPromise){let o;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const c=s.setCollapsedAllOfType(jL.Imports.value,!0);c&&(o=Ag.capture(this.editor),this._currentModelHasFoldedImports=c)}const a=this.editor.getSelections();e.update(s,x6t(a)),o?.restore(this.editor);const l=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=l)}return e})}).then(void 0,e=>(rn(e),null)))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){const t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(e,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){const e=this.getFoldingModel();e&&e.then(t=>{if(t){const i=this.editor.getSelections();if(i&&i.length>0){const r=[];for(const s of i){const o=s.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(o)&&r.push(...t.getAllRegionsAtLine(o,a=>a.isCollapsed&&o>a.startLineNumber))}r.length&&(t.toggleCollapseState(r),this.reveal(i[0].getPosition()))}}}).then(void 0,rn)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range||!e.event.leftButton&&!e.event.middleButton)return;const t=e.target.range;let i=!1;switch(e.target.type){case 4:{const r=e.target.detail,s=e.target.element.offsetLeft;if(r.offsetX-s<4)return;i=!0;break}case 7:{if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!e.target.detail.isAfterLines)break;return}case 6:{if(this.hiddenRangeModel.hasRanges()){const r=this.editor.getModel();if(r&&t.startColumn===r.getLineMaxColumn(t.startLineNumber))break}return}default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:i}}onEditorMouseUp(e){const t=this.foldingModel;if(!t||!this.mouseDownInfo||!e.target)return;const i=this.mouseDownInfo.lineNumber,r=this.mouseDownInfo.iconClicked,s=e.target.range;if(!s||s.startLineNumber!==i)return;if(r){if(e.target.type!==4)return}else{const a=this.editor.getModel();if(!a||s.startColumn!==a.getLineMaxColumn(i))return}const o=t.getRegionAtLine(i);if(o&&o.startLineNumber===i){const a=o.isCollapsed;if(r||a){const l=e.event.altKey;let c=[];if(l){const u=h=>!h.containedBy(o)&&!o.containedBy(h),d=t.getRegionsInside(null,u);for(const h of d)h.isCollapsed&&c.push(h);c.length===0&&(c=d)}else{const u=e.event.middleButton||e.event.shiftKey;if(u)for(const d of t.getRegionsInside(o))d.isCollapsed===a&&c.push(d);(a||!u||c.length===0)&&c.push(o)}t.toggleCollapseState(c),this.reveal({lineNumber:i,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}};Fb=BD=C6t([jT(1,jt),jT(2,Zr),jT(3,Ts),jT(4,cd),jT(5,dt)],Fb);class iBe{constructor(e){this.editor=e,this._onDidChange=new fe,this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(47)}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}class tl extends ot{runEditorCommand(e,t,i){const r=e.get(Zr),s=Fb.get(t);if(!s)return;const o=s.getFoldingModel();if(o)return this.reportTelemetry(e,t),o.then(a=>{if(a){this.invoke(s,a,t,i,r);const l=t.getSelection();l&&s.reveal(l.getStartPosition())}})}getSelectedLines(e){const t=e.getSelections();return t?t.map(i=>i.startLineNumber):[]}getLineNumbers(e,t){return e&&e.selectionLines?e.selectionLines.map(i=>i+1):this.getSelectedLines(t)}run(e,t){}}function x6t(n){return!n||n.length===0?{startsInside:()=>!1}:{startsInside(e,t){for(const i of n){const r=i.startLineNumber;if(r>=e&&r<=t)return!0}return!1}}}function rBe(n){if(!ml(n)){if(!Mo(n))return!1;const e=n;if(!ml(e.levels)&&!yb(e.levels)||!ml(e.direction)&&!yc(e.direction)||!ml(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(yb)))return!1}return!0}class S6t extends tl{constructor(){super({id:"editor.unfold",label:w("unfoldAction.label","Unfold"),alias:"Unfold",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:`Property-value pairs that can be passed through this argument: +`),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return ZCe(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return XCe(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}_buildDomNode(){this._findInput=this._register(new Zee(null,this._contextViewProvider,{width:VFt,label:TFt,placeholder:DFt,appendCaseSensitiveLabel:this._keybindingLabelFor(wr.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(wr.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(wr.ToggleRegexCommand),validation:u=>{if(u.length===0||!this._findInput.getRegex())return null;try{return new RegExp(u,"gu"),null}catch(d){return{content:d.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>UCe(this._keybindingService),inputBoxStyles:A8,toggleStyles:I8},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown(u=>this._onFindInputKeyDown(u))),this._register(this._findInput.inputBox.onDidChange(()=>{this._ignoreChangeEvent||this._state.change({searchString:this._findInput.getValue()},!0)})),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._findInput.onCaseSensitiveKeyDown(u=>{u.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),u.preventDefault())})),this._register(this._findInput.onRegexKeyDown(u=>{u.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),u.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(u=>{this._tryUpdateHeight()&&this._showViewZone()})),zl&&this._register(this._findInput.onMouseDown(u=>this._onFindInputMouseDown(u))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const i=this._register(_E());this._prevBtn=this._register(new Sx({label:IFt+this._keybindingLabelFor(wr.PreviousMatchFindAction),icon:kFt,hoverDelegate:i,onTrigger:()=>{Lv(this._codeEditor.getAction(wr.PreviousMatchFindAction)).run().then(void 0,rn)}},this._hoverService)),this._nextBtn=this._register(new Sx({label:AFt+this._keybindingLabelFor(wr.NextMatchFindAction),icon:EFt,hoverDelegate:i,onTrigger:()=>{Lv(this._codeEditor.getAction(wr.NextMatchFindAction)).run().then(void 0,rn)}},this._hoverService));const r=document.createElement("div");r.className="find-part",r.appendChild(this._findInput.domNode);const s=document.createElement("div");s.className="find-actions",r.appendChild(s),s.appendChild(this._matchesCount),s.appendChild(this._prevBtn.domNode),s.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new o2({icon:CFt,title:NFt+this._keybindingLabelFor(wr.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:i,inputActiveOptionBackground:it(eO),inputActiveOptionBorder:it(cW),inputActiveOptionForeground:it(uW)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let u=this._codeEditor.getSelections();u=u.map(d=>(d.endColumn===1&&d.endLineNumber>d.startLineNumber&&(d=d.setEndPosition(d.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(d.endLineNumber-1))),d.isEmpty()?null:d)).filter(d=>!!d),u.length&&this._state.change({searchScope:u},!0)}}else this._state.change({searchScope:null},!0)})),s.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new Sx({label:RFt+this._keybindingLabelFor(wr.CloseFindWidgetCommand),icon:z6e,hoverDelegate:i,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:u=>{u.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),u.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new Xee(null,void 0,{label:PFt,placeholder:OFt,appendPreserveCaseLabel:this._keybindingLabelFor(wr.TogglePreserveCaseCommand),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>UCe(this._keybindingService),inputBoxStyles:A8,toggleStyles:I8},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(u=>this._onReplaceInputKeyDown(u))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(u=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(u=>{u.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),u.preventDefault())}));const o=this._register(_E());this._replaceBtn=this._register(new Sx({label:MFt+this._keybindingLabelFor(wr.ReplaceOneAction),icon:xFt,hoverDelegate:o,onTrigger:()=>{this._controller.replace()},onKeyDown:u=>{u.equals(1026)&&(this._closeBtn.focus(),u.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new Sx({label:FFt+this._keybindingLabelFor(wr.ReplaceAllAction),icon:SFt,hoverDelegate:o,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));const a=document.createElement("div");a.className="replace-part",a.appendChild(this._replaceInput.domNode);const l=document.createElement("div");l.className="replace-actions",a.appendChild(l),l.appendChild(this._replaceBtn.domNode),l.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new Sx({label:BFt,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=qc(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}},this._hoverService)),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=LFt,this._domNode.role="dialog",this._domNode.style.width=`${ep}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(r),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(a),this._resizeSash=this._register(new $a(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let c=ep;this._register(this._resizeSash.onDidStart(()=>{c=qc(this._domNode)})),this._register(this._resizeSash.onDidChange(u=>{this._resized=!0;const d=c+u.startX-u.currentX;if(dh||(this._domNode.style.width=`${d}px`,this._isReplaceVisible&&(this._replaceInput.width=qc(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const u=qc(this._domNode);if(u{this._opts.onTrigger(),r.preventDefault()}),this.onkeydown(this._domNode,r=>{if(r.equals(10)||r.equals(3)){this._opts.onTrigger(),r.preventDefault();return}this._opts.onKeyDown?.(r)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(e){this._domNode.classList.toggle("disabled",!e),this._domNode.setAttribute("aria-disabled",String(!e)),this._domNode.tabIndex=e?0:-1}setExpanded(e){this._domNode.setAttribute("aria-expanded",String(!!e)),e?(this._domNode.classList.remove(...zt.asClassNameArray(jCe)),this._domNode.classList.add(...zt.asClassNameArray(qCe))):(this._domNode.classList.remove(...zt.asClassNameArray(qCe)),this._domNode.classList.add(...zt.asClassNameArray(jCe)))}}dh((n,e)=>{const t=n.getColor(Av);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${mg(n.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=n.getColor(Cyt);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${mg(n.type)?"dashed":"solid"} ${i}; }`);const r=n.getColor(Yn);r&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${r}; }`);const s=n.getColor(yyt);s&&e.addRule(`.monaco-editor .findMatchInline { color: ${s}; }`);const o=n.getColor(wyt);o&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${o}; }`)});var Q7e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ld=function(n,e){return function(t,i){e(t,i,n)}},Qee;const UFt=524288;function Jee(n,e="single",t=!1){if(!n.hasModel())return null;const i=n.getSelection();if(e==="single"&&i.startLineNumber===i.endLineNumber||e==="multiple"){if(i.isEmpty()){const r=n.getConfiguredWordAtPosition(i.getStartPosition());if(r&&t===!1)return r.word}else if(n.getModel().getValueLengthInRange(i)this._onStateChanged(a))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{const a=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),a&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(41).loop})}))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(e){this.saveQueryState(e),e.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),e.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(e){e.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),e.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),e.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),e.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!_H.getValue(this._contextKeyService)}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){let e=this._editor.getSelections();e=e.map(t=>(t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._editor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.isEmpty()?null:t)).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}setSearchString(e){this._state.isRegex&&(e=nd(e)),this._state.change({searchString:e},!1)}highlightFindOptions(e=!1){}async _start(e,t){if(this.disposeModel(),!this._editor.hasModel())return;const i={...t,isRevealed:!0};if(e.seedSearchStringFromSelection==="single"){const r=Jee(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);r&&(this._state.isRegex?i.searchString=nd(r):i.searchString=r)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const r=Jee(this._editor,e.seedSearchStringFromSelection);r&&(i.searchString=r)}if(!i.searchString&&e.seedSearchStringFromGlobalClipboard){const r=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;r&&(i.searchString=r)}if(e.forceRevealReplace||i.isReplaceRevealed?i.isReplaceRevealed=!0:this._findWidgetVisible.get()||(i.isReplaceRevealed=!1),e.updateSearchScope){const r=this._editor.getSelections();r.some(s=>!s.isEmpty())&&(i.searchScope=r)}i.loop=e.loop,this._state.change(i,!1),this._model||(this._model=new zI(this._editor,this._state))}start(e,t){return this._start(e,t)}moveToNextMatch(){return this._model?(this._model.moveToNextMatch(),!0):!1}moveToPrevMatch(){return this._model?(this._model.moveToPrevMatch(),!0):!1}goToMatch(e){return this._model?(this._model.moveToMatch(e),!0):!1}replace(){return this._model?(this._model.replace(),!0):!1}replaceAll(){return this._model?this._editor.getModel()?.isTooLargeForHeapOperation()?(this._notificationService.warn(w("too.large.for.replaceall","The file is too large to perform a replace all operation.")),!1):(this._model.replaceAll(),!0):!1}selectAllMatches(){return this._model?(this._model.selectAllMatches(),this._editor.focus(),!0):!1}async getGlobalBufferTerm(){return this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(e){this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(e)}};Ic=Qee=Q7e([Ld(1,jt),Ld(2,pf),Ld(3,b0),Ld(4,Ts),Ld(5,um)],Ic);let ete=class extends Ic{constructor(e,t,i,r,s,o,a,l,c){super(e,i,a,l,o,c),this._contextViewService=t,this._keybindingService=r,this._themeService=s,this._widget=null,this._findOptionsWidget=null}async _start(e,t){this._widget||this._createFindWidget();const i=this._editor.getSelection();let r=!1;switch(this._editor.getOption(41).autoFindInSelection){case"always":r=!0;break;case"never":r=!1;break;case"multiline":{r=!!i&&i.startLineNumber!==i.endLineNumber;break}}e.updateSearchScope=e.updateSearchScope||r,await super._start(e,t),this._widget&&(e.shouldFocus===2?this._widget.focusReplaceInput():e.shouldFocus===1&&this._widget.focusFindInput())}highlightFindOptions(e=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!e?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new Yue(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService,this._hoverService)),this._findOptionsWidget=this._register(new que(this._editor,this._state,this._keybindingService))}};ete=Q7e([Ld(1,m0),Ld(2,jt),Ld(3,xi),Ld(4,go),Ld(5,Ts),Ld(6,pf),Ld(7,b0),Ld(8,um)],ete);const jFt=L3e(new E3e({id:wr.StartFindAction,label:w("startFindAction","Find"),alias:"Find",precondition:Le.or(Q.focus,Le.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:ce.MenubarEditMenu,group:"3_find",title:w({key:"miFind",comment:["&& denotes a mnemonic"]},"&&Find"),order:1}}));jFt.addImplementation(0,(n,e,t)=>{const i=Ic.get(e);return i?i.start({forceRevealReplace:!1,seedSearchStringFromSelection:e.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(41).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(41).loop}):!1});const qFt={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},isRegex:{type:"boolean"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},preserveCase:{type:"boolean"},findInSelection:{type:"boolean"}}}}]};class KFt extends ot{constructor(){super({id:wr.StartFindWithArgs,label:w("startFindWithArgsAction","Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:qFt})}async run(e,t,i){const r=Ic.get(t);if(r){const s=i?{searchString:i.searchString,replaceString:i.replaceString,isReplaceRevealed:i.replaceString!==void 0,isRegex:i.isRegex,wholeWord:i.matchWholeWord,matchCase:i.isCaseSensitive,preserveCase:i.preserveCase}:{};await r.start({forceRevealReplace:!1,seedSearchStringFromSelection:r.getState().searchString.length===0&&t.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:t.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:i?.findInSelection||!1,loop:t.getOption(41).loop},s),r.setGlobalBufferTerm(r.getState().searchString)}}}class GFt extends ot{constructor(){super({id:wr.StartFindWithSelection,label:w("startFindWithSelectionAction","Find With Selection"),alias:"Find With Selection",precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(e,t){const i=Ic.get(t);i&&(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),i.setGlobalBufferTerm(i.getState().searchString))}}class J7e extends ot{async run(e,t){const i=Ic.get(t);i&&!this._run(i)&&(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:i.getState().searchString.length===0&&t.getOption(41).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:t.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),this._run(i))}}class YFt extends J7e{constructor(){super({id:wr.NextMatchFindAction,label:w("findNextMatchAction","Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:Q.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Le.and(Q.focus,_H),primary:3,weight:100}]})}_run(e){return e.moveToNextMatch()?(e.editor.pushUndoStop(),!0):!1}}class ZFt extends J7e{constructor(){super({id:wr.PreviousMatchFindAction,label:w("findPreviousMatchAction","Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:Q.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Le.and(Q.focus,_H),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}class XFt extends ot{constructor(){super({id:wr.GoToMatchFindAction,label:w("findMatchAction.goToMatch","Go to Match..."),alias:"Go to Match...",precondition:y0}),this._highlightDecorations=[]}run(e,t,i){const r=Ic.get(t);if(!r)return;const s=r.getState().matchesCount;if(s<1){e.get(Ts).notify({severity:iW.Warning,message:w("findMatchAction.noResults","No matches. Try searching for something else.")});return}const o=e.get(hh),a=new ke,l=a.add(o.createInputBox());l.placeholder=w("findMatchAction.inputPlaceHolder","Type a number to go to a specific match (between 1 and {0})",s);const c=d=>{const h=parseInt(d);if(isNaN(h))return;const f=r.getState().matchesCount;if(h>0&&h<=f)return h-1;if(h<0&&h>=-f)return f+h},u=d=>{const h=c(d);if(typeof h=="number"){l.validationMessage=void 0,r.goToMatch(h);const f=r.getState().currentMatch;f&&this.addDecorations(t,f)}else l.validationMessage=w("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",r.getState().matchesCount),this.clearDecorations(t)};a.add(l.onDidChangeValue(d=>{u(d)})),a.add(l.onDidAccept(()=>{const d=c(l.value);typeof d=="number"?(r.goToMatch(d),l.hide()):l.validationMessage=w("findMatchAction.inputValidationMessage","Please type a number between 1 and {0}",r.getState().matchesCount)})),a.add(l.onDidHide(()=>{this.clearDecorations(t),a.dispose()})),l.show()}clearDecorations(e){e.changeDecorations(t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])})}addDecorations(e,t){e.changeDecorations(i=>{this._highlightDecorations=i.deltaDecorations(this._highlightDecorations,[{range:t,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:ss(DFe),position:Qu.Full}}}])})}}class eBe extends ot{async run(e,t){const i=Ic.get(t);if(!i)return;const r=Jee(t,"single",!1);r&&i.setSearchString(r),this._run(i)||(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(41).loop}),this._run(i))}}class QFt extends eBe{constructor(){super({id:wr.NextSelectionMatchFindAction,label:w("nextSelectionMatchFindAction","Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}class JFt extends eBe{constructor(){super({id:wr.PreviousSelectionMatchFindAction,label:w("previousSelectionMatchFindAction","Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}}const e6t=L3e(new E3e({id:wr.StartFindReplaceAction,label:w("startReplace","Replace"),alias:"Replace",precondition:Le.or(Q.focus,Le.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:ce.MenubarEditMenu,group:"3_find",title:w({key:"miReplace",comment:["&& denotes a mnemonic"]},"&&Replace"),order:2}}));e6t.addImplementation(0,(n,e,t)=>{if(!e.hasModel()||e.getOption(92))return!1;const i=Ic.get(e);if(!i)return!1;const r=e.getSelection(),s=i.isFindInputFocused(),o=!r.isEmpty()&&r.startLineNumber===r.endLineNumber&&e.getOption(41).seedSearchStringFromSelection!=="never"&&!s,a=s||o?2:1;return i.start({forceRevealReplace:!0,seedSearchStringFromSelection:o?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(41).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(41).seedSearchStringFromSelection!=="never",shouldFocus:a,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(41).loop})});Zn(Ic.ID,ete,0);Pe(KFt);Pe(GFt);Pe(YFt);Pe(ZFt);Pe(XFt);Pe(QFt);Pe(JFt);const Wg=fo.bindToContribution(Ic.get);Je(new Wg({id:wr.CloseFindWidgetCommand,precondition:y0,handler:n=>n.closeFindWidget(),kbOpts:{weight:105,kbExpr:Le.and(Q.focus,Le.not("isComposing")),primary:9,secondary:[1033]}}));Je(new Wg({id:wr.ToggleCaseSensitiveCommand,precondition:void 0,handler:n=>n.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:Q.focus,primary:d3.primary,mac:d3.mac,win:d3.win,linux:d3.linux}}));Je(new Wg({id:wr.ToggleWholeWordCommand,precondition:void 0,handler:n=>n.toggleWholeWords(),kbOpts:{weight:105,kbExpr:Q.focus,primary:h3.primary,mac:h3.mac,win:h3.win,linux:h3.linux}}));Je(new Wg({id:wr.ToggleRegexCommand,precondition:void 0,handler:n=>n.toggleRegex(),kbOpts:{weight:105,kbExpr:Q.focus,primary:f3.primary,mac:f3.mac,win:f3.win,linux:f3.linux}}));Je(new Wg({id:wr.ToggleSearchScopeCommand,precondition:void 0,handler:n=>n.toggleSearchScope(),kbOpts:{weight:105,kbExpr:Q.focus,primary:g3.primary,mac:g3.mac,win:g3.win,linux:g3.linux}}));Je(new Wg({id:wr.TogglePreserveCaseCommand,precondition:void 0,handler:n=>n.togglePreserveCase(),kbOpts:{weight:105,kbExpr:Q.focus,primary:p3.primary,mac:p3.mac,win:p3.win,linux:p3.linux}}));Je(new Wg({id:wr.ReplaceOneAction,precondition:y0,handler:n=>n.replace(),kbOpts:{weight:105,kbExpr:Q.focus,primary:3094}}));Je(new Wg({id:wr.ReplaceOneAction,precondition:y0,handler:n=>n.replace(),kbOpts:{weight:105,kbExpr:Le.and(Q.focus,jue),primary:3}}));Je(new Wg({id:wr.ReplaceAllAction,precondition:y0,handler:n=>n.replaceAll(),kbOpts:{weight:105,kbExpr:Q.focus,primary:2563}}));Je(new Wg({id:wr.ReplaceAllAction,precondition:y0,handler:n=>n.replaceAll(),kbOpts:{weight:105,kbExpr:Le.and(Q.focus,jue),primary:void 0,mac:{primary:2051}}}));Je(new Wg({id:wr.SelectAllMatchesAction,precondition:y0,handler:n=>n.selectAllMatches(),kbOpts:{weight:105,kbExpr:Q.focus,primary:515}}));const t6t={0:" ",1:"u",2:"r"},QCe=65535,jf=16777215,JCe=4278190080;class Kq{constructor(e){const t=Math.ceil(e/32);this._states=new Uint32Array(t)}get(e){const t=e/32|0,i=e%32;return(this._states[t]&1<QCe)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new Kq(e.length),this._userDefinedStates=new Kq(e.length),this._recoveredStates=new Kq(e.length),this._types=i,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;const e=[],t=(i,r)=>{const s=e[e.length-1];return this.getStartLineNumber(s)<=i&&this.getEndLineNumber(s)>=r};for(let i=0,r=this._startIndexes.length;ijf||o>jf)throw new Error("startLineNumber or endLineNumber must not exceed "+jf);for(;e.length>0&&!t(s,o);)e.pop();const a=e.length>0?e[e.length-1]:-1;e.push(i),this._startIndexes[i]=s+((a&255)<<24),this._endIndexes[i]=o+((a&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(e){return this._startIndexes[e]&jf}getEndLineNumber(e){return this._endIndexes[e]&jf}getType(e){return this._types?this._types[e]:void 0}hasTypes(){return!!this._types}isCollapsed(e){return this._collapseStates.get(e)}setCollapsed(e,t){this._collapseStates.set(e,t)}isUserDefined(e){return this._userDefinedStates.get(e)}setUserDefined(e,t){return this._userDefinedStates.set(e,t)}isRecovered(e){return this._recoveredStates.get(e)}setRecovered(e,t){return this._recoveredStates.set(e,t)}getSource(e){return this.isUserDefined(e)?1:this.isRecovered(e)?2:0}setSource(e,t){t===1?(this.setUserDefined(e,!0),this.setRecovered(e,!1)):t===2?(this.setUserDefined(e,!1),this.setRecovered(e,!0)):(this.setUserDefined(e,!1),this.setRecovered(e,!1))}setCollapsedAllOfType(e,t){let i=!1;if(this._types)for(let r=0;r>>24)+((this._endIndexes[e]&JCe)>>>16);return t===QCe?-1:t}contains(e,t){return this.getStartLineNumber(e)<=t&&this.getEndLineNumber(e)>=t}findIndex(e){let t=0,i=this._startIndexes.length;if(i===0)return-1;for(;t=0){if(this.getEndLineNumber(t)>=e)return t;for(t=this.getParentIndex(t);t!==-1;){if(this.contains(t,e))return t;t=this.getParentIndex(t)}}return-1}toString(){const e=[];for(let t=0;tArray.isArray(m)?v=>v<_?m[v]:void 0:v=>v<_?m.toFoldRange(v):void 0,o=s(e,e.length),a=s(t,t.length);let l=0,c=0,u=o(0),d=a(0);const h=[];let f,g=0;const p=[];for(;u||d;){let m;if(d&&(!u||u.startLineNumber>=d.startLineNumber))u&&u.startLineNumber===d.startLineNumber?(d.source===1?m=d:(m=u,m.isCollapsed=d.isCollapsed&&(u.endLineNumber===d.endLineNumber||!r?.startsInside(u.startLineNumber+1,u.endLineNumber+1)),m.source=0),u=o(++l)):(m=d,d.isCollapsed&&d.source===0&&(m.source=2)),d=a(++c);else{let _=c,v=d;for(;;){if(!v||v.startLineNumber>u.endLineNumber){m=u;break}if(v.source===1&&v.endLineNumber>u.endLineNumber)break;v=a(++_)}u=o(++l)}if(m){for(;f&&f.endLineNumberm.startLineNumber&&m.startLineNumber>g&&m.endLineNumber<=i&&(!f||f.endLineNumber>=m.endLineNumber)&&(p.push(m),g=m.startLineNumber,f&&h.push(f),f=m)}}return p}}class n6t{constructor(e,t){this.ranges=e,this.index=t}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(e){return e.startLineNumber<=this.startLineNumber&&e.endLineNumber>=this.endLineNumber}containsLine(e){return this.startLineNumber<=e&&e<=this.endLineNumber}}class i6t{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new fe,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new Fu(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}toggleCollapseState(e){if(!e.length)return;e=e.sort((i,r)=>i.regionIndex-r.regionIndex);const t={};this._decorationProvider.changeDecorations(i=>{let r=0,s=-1,o=-1;const a=l=>{for(;ro&&(o=c),r++}};for(const l of e){const c=l.regionIndex,u=this._editorDecorationIds[c];if(u&&!t[u]){t[u]=!0,a(c);const d=!this._regions.isCollapsed(c);this._regions.setCollapsed(c,d),s=Math.max(s,this._regions.getEndLineNumber(c))}}a(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:e})}removeManualRanges(e){const t=new Array,i=r=>{for(const s of e)if(!(s.startLineNumber>r.endLineNumber||r.startLineNumber>s.endLineNumber))return!0;return!1};for(let r=0;ri&&(i=a)}this._decorationProvider.changeDecorations(r=>this._editorDecorationIds=r.deltaDecorations(this._editorDecorationIds,t)),this._regions=e,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(e){const t=[];for(let i=0,r=this._regions.length;i=o.endLineNumber||o.startLineNumber<1||o.endLineNumber>i)continue;const a=this._getLinesChecksum(o.startLineNumber+1,o.endLineNumber);t.push({startLineNumber:o.startLineNumber,endLineNumber:o.endLineNumber,isCollapsed:o.isCollapsed,source:o.source,checksum:a})}return t.length>0?t:void 0}applyMemento(e){if(!Array.isArray(e))return;const t=[],i=this._textModel.getLineCount();for(const s of e){if(s.startLineNumber>=s.endLineNumber||s.startLineNumber<1||s.endLineNumber>i)continue;const o=this._getLinesChecksum(s.startLineNumber+1,s.endLineNumber);(!s.checksum||o===s.checksum)&&t.push({startLineNumber:s.startLineNumber,endLineNumber:s.endLineNumber,type:void 0,isCollapsed:s.isCollapsed??!0,source:s.source??0})}const r=Fu.sanitizeAndMerge(this._regions,t,i);this.updatePost(Fu.fromFoldRanges(r))}_getLinesChecksum(e,t){return F$(this._textModel.getLineContent(e)+this._textModel.getLineContent(t))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds)}getAllRegionsAtLine(e,t){const i=[];if(this._regions){let r=this._regions.findRange(e),s=1;for(;r>=0;){const o=this._regions.toRegion(r);(!t||t(o,s))&&i.push(o),s++,r=o.parentIndex}}return i}getRegionAtLine(e){if(this._regions){const t=this._regions.findRange(e);if(t>=0)return this._regions.toRegion(t)}return null}getRegionsInside(e,t){const i=[],r=e?e.regionIndex+1:0,s=e?e.endLineNumber:Number.MAX_VALUE;if(t&&t.length===2){const o=[];for(let a=r,l=this._regions.length;a0&&!c.containedBy(o[o.length-1]);)o.pop();o.push(c),t(c,o.length)&&i.push(c)}else break}}else for(let o=r,a=this._regions.length;o1){const a=n.getRegionsInside(s,(l,c)=>l.isCollapsed!==o&&c0)for(const s of i){const o=n.getRegionAtLine(s);if(o&&(o.isCollapsed!==e&&r.push(o),t>1)){const a=n.getRegionsInside(o,(l,c)=>l.isCollapsed!==e&&co.isCollapsed!==e&&aa.isCollapsed!==e&&l<=t);r.push(...o)}n.toggleCollapseState(r)}function r6t(n,e,t){const i=[];for(const r of t){const s=n.getAllRegionsAtLine(r,o=>o.isCollapsed!==e);s.length>0&&i.push(s[0])}n.toggleCollapseState(i)}function s6t(n,e,t,i){const r=(o,a)=>a===e&&o.isCollapsed!==t&&!i.some(l=>o.containsLine(l)),s=n.getRegionsInside(null,r);n.toggleCollapseState(s)}function nBe(n,e,t){const i=[];for(const o of t){const a=n.getAllRegionsAtLine(o,void 0);a.length>0&&i.push(a[0])}const r=o=>i.every(a=>!a.containedBy(o)&&!o.containedBy(a))&&o.isCollapsed!==e,s=n.getRegionsInside(null,r);n.toggleCollapseState(s)}function Xue(n,e,t){const i=n.textModel,r=n.regions,s=[];for(let o=r.length-1;o>=0;o--)if(t!==r.isCollapsed(o)){const a=r.getStartLineNumber(o);e.test(i.getLineContent(a))&&s.push(r.toRegion(o))}n.toggleCollapseState(s)}function Que(n,e,t){const i=n.regions,r=[];for(let s=i.length-1;s>=0;s--)t!==i.isCollapsed(s)&&e===i.getType(s)&&r.push(i.toRegion(s));n.toggleCollapseState(r)}function o6t(n,e){let t=null;const i=e.getRegionAtLine(n);if(i!==null&&(t=i.startLineNumber,n===t)){const r=i.parentIndex;r!==-1?t=e.regions.getStartLineNumber(r):t=null}return t}function a6t(n,e){let t=e.getRegionAtLine(n);if(t!==null&&t.startLineNumber===n){if(n!==t.startLineNumber)return t.startLineNumber;{const i=t.parentIndex;let r=0;for(i!==-1&&(r=e.regions.getStartLineNumber(t.parentIndex));t!==null;)if(t.regionIndex>0){if(t=e.regions.toRegion(t.regionIndex-1),t.startLineNumber<=r)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}}else if(e.regions.length>0)for(t=e.regions.toRegion(e.regions.length-1);t!==null;){if(t.startLineNumber0?t=e.regions.toRegion(t.regionIndex-1):t=null}return null}function l6t(n,e){let t=e.getRegionAtLine(n);if(t!==null&&t.startLineNumber===n){const i=t.parentIndex;let r=0;if(i!==-1)r=e.regions.getEndLineNumber(t.parentIndex);else{if(e.regions.length===0)return null;r=e.regions.getEndLineNumber(e.regions.length-1)}for(;t!==null;)if(t.regionIndex=r)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}else if(e.regions.length>0)for(t=e.regions.toRegion(0);t!==null;){if(t.startLineNumber>n)return t.startLineNumber;t.regionIndexthis.updateHiddenRanges()),this._hiddenRanges=[],e.regions.length&&this.updateHiddenRanges()}notifyChangeModelContent(e){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=e.changes.some(t=>t.range.endLineNumber!==t.range.startLineNumber||Lb(t.text)[0]!==0))}updateHiddenRanges(){let e=!1;const t=[];let i=0,r=0,s=Number.MAX_VALUE,o=-1;const a=this._foldingModel.regions;for(;i0}isHidden(e){return exe(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1;const i=this._foldingModel.textModel;let r=null;const s=o=>((!r||!u6t(o,r))&&(r=exe(this._hiddenRanges,o)),r?r.startLineNumber-1:null);for(let o=0,a=e.length;o0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null)}}function u6t(n,e){return n>=e.startLineNumber&&n<=e.endLineNumber}function exe(n,e){const t=gN(n,i=>e=0&&n[t].endLineNumber>=e?n[t]:null}const d6t=5e3,h6t="indent";class Jue{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=i,this.id=h6t}dispose(){}compute(e){const t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,i=t&&!!t.offSide,r=t&&t.markers;return Promise.resolve(p6t(this.editorModel,i,r,this.foldingRangesLimit))}}let f6t=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>jf||t>jf)return;const r=this._length;this._startIndexes[r]=e,this._endIndexes[r]=t,this._length++,i<1e3&&(this._indentOccurrences[i]=(this._indentOccurrences[i]||0)+1)}toIndentRanges(e){const t=this._foldingRangesLimit.limit;if(this._length<=t){this._foldingRangesLimit.update(this._length,!1);const i=new Uint32Array(this._length),r=new Uint32Array(this._length);for(let s=this._length-1,o=0;s>=0;s--,o++)i[o]=this._startIndexes[s],r[o]=this._endIndexes[s];return new Fu(i,r)}else{this._foldingRangesLimit.update(this._length,t);let i=0,r=this._indentOccurrences.length;for(let l=0;lt){r=l;break}i+=c}}const s=e.getOptions().tabSize,o=new Uint32Array(t),a=new Uint32Array(t);for(let l=this._length-1,c=0;l>=0;l--){const u=this._startIndexes[l],d=e.getLineContent(u),h=TW(d,s);(h{}};function p6t(n,e,t,i=g6t){const r=n.getOptions().tabSize,s=new f6t(i);let o;t&&(o=new RegExp(`(${t.start.source})|(?:${t.end.source})`));const a=[],l=n.getLineCount()+1;a.push({indent:-1,endAbove:l,line:l});for(let c=n.getLineCount();c>0;c--){const u=n.getLineContent(c),d=TW(u,r);let h=a[a.length-1];if(d===-1){e&&(h.endAbove=c);continue}let f;if(o&&(f=u.match(o)))if(f[1]){let g=a.length-1;for(;g>0&&a[g].indent!==-2;)g--;if(g>0){a.length=g+1,h=a[g],s.insertFirst(c,h.line,d),h.line=c,h.indent=d,h.endAbove=c;continue}}else{a.push({indent:-2,endAbove:c,line:c});continue}if(h.indent>d){do a.pop(),h=a[a.length-1];while(h.indent>d);const g=h.endAbove-1;g-c>=1&&s.insertFirst(c,g,d)}h.indent===d?h.endAbove=c:a.push({indent:d,endAbove:c,line:c})}return s.toIndentRanges(n)}const m6t=J("editor.foldBackground",{light:Sn(Iv,.3),dark:Sn(Iv,.3),hcDark:null,hcLight:null},w("foldBackgroundBackground","Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},w("collapsedTextColor","Color of the collapsed text after the first line of a folded range."));J("editorGutter.foldingControlForeground",h8,w("editorGutter.foldingControlForeground","Color of the folding control in the editor gutter."));const W9=kr("folding-expanded",ze.chevronDown,w("foldingExpandedIcon","Icon for expanded ranges in the editor glyph margin.")),H9=kr("folding-collapsed",ze.chevronRight,w("foldingCollapsedIcon","Icon for collapsed ranges in the editor glyph margin.")),txe=kr("folding-manual-collapsed",H9,w("foldingManualCollapedIcon","Icon for manually collapsed ranges in the editor glyph margin.")),nxe=kr("folding-manual-expanded",W9,w("foldingManualExpandedIcon","Icon for manually expanded ranges in the editor glyph margin.")),Gq={color:ss(m6t),position:1},kx=w("linesCollapsed","Click to expand the range."),v3=w("linesExpanded","Click to collapse the range.");class Du{static{this.COLLAPSED_VISUAL_DECORATION=un.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:kx,firstLineDecorationClassName:zt.asClassName(H9)})}static{this.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=un.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Gq,isWholeLine:!0,linesDecorationsTooltip:kx,firstLineDecorationClassName:zt.asClassName(H9)})}static{this.MANUALLY_COLLAPSED_VISUAL_DECORATION=un.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:kx,firstLineDecorationClassName:zt.asClassName(txe)})}static{this.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=un.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Gq,isWholeLine:!0,linesDecorationsTooltip:kx,firstLineDecorationClassName:zt.asClassName(txe)})}static{this.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=un.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:kx})}static{this.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=un.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Gq,isWholeLine:!0,linesDecorationsTooltip:kx})}static{this.EXPANDED_VISUAL_DECORATION=un.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+zt.asClassName(W9),linesDecorationsTooltip:v3})}static{this.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=un.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:zt.asClassName(W9),linesDecorationsTooltip:v3})}static{this.MANUALLY_EXPANDED_VISUAL_DECORATION=un.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+zt.asClassName(nxe),linesDecorationsTooltip:v3})}static{this.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=un.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:zt.asClassName(nxe),linesDecorationsTooltip:v3})}static{this.NO_CONTROLS_EXPANDED_RANGE_DECORATION=un.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0})}static{this.HIDDEN_RANGE_DECORATION=un.register({description:"folding-hidden-range-decoration",stickiness:1})}constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?Du.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?Du.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:Du.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:Du.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?Du.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Du.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?Du.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Du.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?Du.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:Du.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?Du.MANUALLY_EXPANDED_VISUAL_DECORATION:Du.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}}const _6t={},v6t="syntax";class ede{constructor(e,t,i,r,s){this.editorModel=e,this.providers=t,this.handleFoldingRangesChange=i,this.foldingRangesLimit=r,this.fallbackRangeProvider=s,this.id=v6t,this.disposables=new ke,s&&this.disposables.add(s);for(const o of t)typeof o.onDidChange=="function"&&this.disposables.add(o.onDidChange(i))}compute(e){return b6t(this.providers,this.editorModel,e).then(t=>t?w6t(t,this.foldingRangesLimit):this.fallbackRangeProvider?.compute(e)??null)}dispose(){this.disposables.dispose()}}function b6t(n,e,t){let i=null;const r=n.map((s,o)=>Promise.resolve(s.provideFoldingRanges(e,_6t,t)).then(a=>{if(!t.isCancellationRequested&&Array.isArray(a)){Array.isArray(i)||(i=[]);const l=e.getLineCount();for(const c of a)c.start>0&&c.end>c.start&&c.end<=l&&i.push({start:c.start,end:c.end,rank:o,kind:c.kind})}},vs));return Promise.all(r).then(s=>i)}class y6t{constructor(e){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=e}add(e,t,i,r){if(e>jf||t>jf)return;const s=this._length;this._startIndexes[s]=e,this._endIndexes[s]=t,this._nestingLevels[s]=r,this._types[s]=i,this._length++,r<30&&(this._nestingLevelCounts[r]=(this._nestingLevelCounts[r]||0)+1)}toIndentRanges(){const e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let r=0;re){i=a;break}t+=l}}const r=new Uint32Array(e),s=new Uint32Array(e),o=[];for(let a=0,l=0;a{let l=o.start-a.start;return l===0&&(l=o.rank-a.rank),l}),i=new y6t(e);let r;const s=[];for(const o of t)if(!r)r=o,i.add(o.start,o.end,o.kind&&o.kind.value,s.length);else if(o.start>r.start)if(o.end<=r.end)s.push(r),r=o,i.add(o.start,o.end,o.kind&&o.kind.value,s.length);else{if(o.start>r.end){do r=s.pop();while(r&&o.start>r.end);r&&s.push(r),r=o}i.add(o.start,o.end,o.kind&&o.kind.value,s.length)}return i.toIndentRanges()}var C6t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},jT=function(n,e){return function(t,i){e(t,i,n)}},BD;const Ia=new et("foldingEnabled",!1);let Fb=class extends me{static{BD=this}static{this.ID="editor.contrib.folding"}static get(e){return e.getContribution(BD.ID)}static getFoldingRangeProviders(e,t){const i=e.foldingRangeProvider.ordered(t);return BD._foldingRangeSelector?.(i,t)??i}constructor(e,t,i,r,s,o){super(),this.contextKeyService=t,this.languageConfigurationService=i,this.languageFeaturesService=o,this.localToDispose=this._register(new ke),this.editor=e,this._foldingLimitReporter=new iBe(e);const a=this.editor.getOptions();this._isEnabled=a.get(43),this._useFoldingProviders=a.get(44)!=="indentation",this._unfoldOnClickAfterEndOfLine=a.get(48),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=a.get(46),this.updateDebounceInfo=s.for(o.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new Du(e),this.foldingDecorationProvider.showFoldingControls=a.get(111),this.foldingDecorationProvider.showFoldingHighlights=a.get(45),this.foldingEnabled=Ia.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(l=>{if(l.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),l.hasChanged(47)&&this.onModelChanged(),l.hasChanged(111)||l.hasChanged(45)){const c=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=c.get(111),this.foldingDecorationProvider.showFoldingHighlights=c.get(45),this.triggerFoldingModelChanged()}l.hasChanged(44)&&(this._useFoldingProviders=this.editor.getOptions().get(44)!=="indentation",this.onFoldingStrategyChanged()),l.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),l.hasChanged(46)&&(this._foldingImportsByDefault=this.editor.getOptions().get(46))})),this.onModelChanged()}saveViewState(){const e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){const t=this.foldingModel.getMemento(),i=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:i,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){const t=this.editor.getModel();if(!(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)&&e&&(this._currentModelHasFoldedImports=!!e.foldedImports,e.collapsedRegions&&e.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(e.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new i6t(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new c6t(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new Qd(this.updateDebounceInfo.get(e)),this.cursorChangedScheduler=new Ui(()=>this.revealCursor(),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelContent(t=>this.onDidChangeModelContent(t))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.localToDispose.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.localToDispose.add({dispose:()=>{this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.updateScheduler?.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,this.rangeProvider?.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){this.rangeProvider?.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;const t=new Jue(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=BD.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new ede(e,i,()=>this.triggerFoldingModelChanged(),this._foldingLimitReporter,t))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(e){this.hiddenRangeModel?.notifyChangeModelContent(e),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger(()=>{const e=this.foldingModel;if(!e)return null;const t=new Bo,i=this.getRangeProvider(e.textModel),r=this.foldingRegionPromise=ko(s=>i.compute(s));return r.then(s=>{if(s&&r===this.foldingRegionPromise){let o;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const c=s.setCollapsedAllOfType(jL.Imports.value,!0);c&&(o=Ag.capture(this.editor),this._currentModelHasFoldedImports=c)}const a=this.editor.getSelections();e.update(s,x6t(a)),o?.restore(this.editor);const l=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=l)}return e})}).then(void 0,e=>(rn(e),null)))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){const t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(e,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){const e=this.getFoldingModel();e&&e.then(t=>{if(t){const i=this.editor.getSelections();if(i&&i.length>0){const r=[];for(const s of i){const o=s.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(o)&&r.push(...t.getAllRegionsAtLine(o,a=>a.isCollapsed&&o>a.startLineNumber))}r.length&&(t.toggleCollapseState(r),this.reveal(i[0].getPosition()))}}}).then(void 0,rn)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range||!e.event.leftButton&&!e.event.middleButton)return;const t=e.target.range;let i=!1;switch(e.target.type){case 4:{const r=e.target.detail,s=e.target.element.offsetLeft;if(r.offsetX-s<4)return;i=!0;break}case 7:{if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!e.target.detail.isAfterLines)break;return}case 6:{if(this.hiddenRangeModel.hasRanges()){const r=this.editor.getModel();if(r&&t.startColumn===r.getLineMaxColumn(t.startLineNumber))break}return}default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:i}}onEditorMouseUp(e){const t=this.foldingModel;if(!t||!this.mouseDownInfo||!e.target)return;const i=this.mouseDownInfo.lineNumber,r=this.mouseDownInfo.iconClicked,s=e.target.range;if(!s||s.startLineNumber!==i)return;if(r){if(e.target.type!==4)return}else{const a=this.editor.getModel();if(!a||s.startColumn!==a.getLineMaxColumn(i))return}const o=t.getRegionAtLine(i);if(o&&o.startLineNumber===i){const a=o.isCollapsed;if(r||a){const l=e.event.altKey;let c=[];if(l){const u=h=>!h.containedBy(o)&&!o.containedBy(h),d=t.getRegionsInside(null,u);for(const h of d)h.isCollapsed&&c.push(h);c.length===0&&(c=d)}else{const u=e.event.middleButton||e.event.shiftKey;if(u)for(const d of t.getRegionsInside(o))d.isCollapsed===a&&c.push(d);(a||!u||c.length===0)&&c.push(o)}t.toggleCollapseState(c),this.reveal({lineNumber:i,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}};Fb=BD=C6t([jT(1,jt),jT(2,Zr),jT(3,Ts),jT(4,cd),jT(5,dt)],Fb);class iBe{constructor(e){this.editor=e,this._onDidChange=new fe,this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(47)}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}class tl extends ot{runEditorCommand(e,t,i){const r=e.get(Zr),s=Fb.get(t);if(!s)return;const o=s.getFoldingModel();if(o)return this.reportTelemetry(e,t),o.then(a=>{if(a){this.invoke(s,a,t,i,r);const l=t.getSelection();l&&s.reveal(l.getStartPosition())}})}getSelectedLines(e){const t=e.getSelections();return t?t.map(i=>i.startLineNumber):[]}getLineNumbers(e,t){return e&&e.selectionLines?e.selectionLines.map(i=>i+1):this.getSelectedLines(t)}run(e,t){}}function x6t(n){return!n||n.length===0?{startsInside:()=>!1}:{startsInside(e,t){for(const i of n){const r=i.startLineNumber;if(r>=e&&r<=t)return!0}return!1}}}function rBe(n){if(!ml(n)){if(!Mo(n))return!1;const e=n;if(!ml(e.levels)&&!yb(e.levels)||!ml(e.direction)&&!yc(e.direction)||!ml(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(yb)))return!1}return!0}class S6t extends tl{constructor(){super({id:"editor.unfold",label:w("unfoldAction.label","Unfold"),alias:"Unfold",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:`Property-value pairs that can be passed through this argument: * 'levels': Number of levels to unfold. If not set, defaults to 1. * 'direction': If 'up', unfold given number of levels up otherwise unfolds down. * 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used. @@ -822,23 +822,23 @@ ${e.toString()}`}}class i9{constructor(e=new c2,t=!1,i,r=_Dt){this._services=e,t * 'direction': If 'up', folds given number of levels up otherwise folds down. * 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used. If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead. - `,constraint:rBe,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,r){const s=this.getLineNumbers(r,i),o=r&&r.levels,a=r&&r.direction;typeof o!="number"&&typeof a!="string"?r6t(t,!0,s):a==="up"?tBe(t,!0,o||1,s):m2(t,!0,o||1,s)}}class L6t extends tl{constructor(){super({id:"editor.toggleFold",label:w("toggleFoldAction.label","Toggle Fold"),alias:"Toggle Fold",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2090),weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);Zue(t,1,r)}}class T6t extends tl{constructor(){super({id:"editor.foldRecursively",label:w("foldRecursivelyAction.label","Fold Recursively"),alias:"Fold Recursively",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2140),weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);m2(t,!0,Number.MAX_VALUE,r)}}class D6t extends tl{constructor(){super({id:"editor.toggleFoldRecursively",label:w("toggleFoldRecursivelyAction.label","Toggle Fold Recursively"),alias:"Toggle Fold Recursively",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,3114),weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);Zue(t,Number.MAX_VALUE,r)}}class I6t extends tl{constructor(){super({id:"editor.foldAllBlockComments",label:w("foldAllBlockComments.label","Fold All Block Comments"),alias:"Fold All Block Comments",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2138),weight:100}})}invoke(e,t,i,r,s){if(t.regions.hasTypes())Que(t,jL.Comment.value,!0);else{const o=i.getModel();if(!o)return;const a=s.getLanguageConfiguration(o.getLanguageId()).comments;if(a&&a.blockCommentStartToken){const l=new RegExp("^\\s*"+nd(a.blockCommentStartToken));Xue(t,l,!0)}}}}class A6t extends tl{constructor(){super({id:"editor.foldAllMarkerRegions",label:w("foldAllMarkerRegions.label","Fold All Regions"),alias:"Fold All Regions",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2077),weight:100}})}invoke(e,t,i,r,s){if(t.regions.hasTypes())Que(t,jL.Region.value,!0);else{const o=i.getModel();if(!o)return;const a=s.getLanguageConfiguration(o.getLanguageId()).foldingRules;if(a&&a.markers&&a.markers.start){const l=new RegExp(a.markers.start);Xue(t,l,!0)}}}}class N6t extends tl{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:w("unfoldAllMarkerRegions.label","Unfold All Regions"),alias:"Unfold All Regions",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2078),weight:100}})}invoke(e,t,i,r,s){if(t.regions.hasTypes())Que(t,jL.Region.value,!1);else{const o=i.getModel();if(!o)return;const a=s.getLanguageConfiguration(o.getLanguageId()).foldingRules;if(a&&a.markers&&a.markers.start){const l=new RegExp(a.markers.start);Xue(t,l,!1)}}}}class R6t extends tl{constructor(){super({id:"editor.foldAllExcept",label:w("foldAllExcept.label","Fold All Except Selected"),alias:"Fold All Except Selected",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2136),weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);nBe(t,!0,r)}}class P6t extends tl{constructor(){super({id:"editor.unfoldAllExcept",label:w("unfoldAllExcept.label","Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2134),weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);nBe(t,!1,r)}}class O6t extends tl{constructor(){super({id:"editor.foldAll",label:w("foldAllAction.label","Fold All"),alias:"Fold All",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2069),weight:100}})}invoke(e,t,i){m2(t,!0)}}class M6t extends tl{constructor(){super({id:"editor.unfoldAll",label:w("unfoldAllAction.label","Unfold All"),alias:"Unfold All",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2088),weight:100}})}invoke(e,t,i){m2(t,!1)}}class hR extends tl{static{this.ID_PREFIX="editor.foldLevel"}static{this.ID=e=>hR.ID_PREFIX+e}getFoldingLevel(){return parseInt(this.id.substr(hR.ID_PREFIX.length))}invoke(e,t,i){s6t(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}}class F6t extends tl{constructor(){super({id:"editor.gotoParentFold",label:w("gotoParentFold.label","Go to Parent Fold"),alias:"Go to Parent Fold",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);if(r.length>0){const s=o6t(r[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class B6t extends tl{constructor(){super({id:"editor.gotoPreviousFold",label:w("gotoPreviousFold.label","Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);if(r.length>0){const s=a6t(r[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class $6t extends tl{constructor(){super({id:"editor.gotoNextFold",label:w("gotoNextFold.label","Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);if(r.length>0){const s=l6t(r[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class W6t extends tl{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:w("createManualFoldRange.label","Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2135),weight:100}})}invoke(e,t,i){const r=[],s=i.getSelections();if(s){for(const o of s){let a=o.endLineNumber;o.endColumn===1&&--a,a>o.startLineNumber&&(r.push({startLineNumber:o.startLineNumber,endLineNumber:a,type:void 0,isCollapsed:!0,source:1}),i.setSelection({startLineNumber:o.startLineNumber,startColumn:1,endLineNumber:o.startLineNumber,endColumn:1}))}if(r.length>0){r.sort((a,l)=>a.startLineNumber-l.startLineNumber);const o=Fu.sanitizeAndMerge(t.regions,r,i.getModel()?.getLineCount());t.updatePost(Fu.fromFoldRanges(o))}}}}class H6t extends tl{constructor(){super({id:"editor.removeManualFoldingRanges",label:w("removeManualFoldingRanges.label","Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2137),weight:100}})}invoke(e,t,i){const r=i.getSelections();if(r){const s=[];for(const o of r){const{startLineNumber:a,endLineNumber:l}=o;s.push(l>=a?{startLineNumber:a,endLineNumber:l}:{endLineNumber:l,startLineNumber:a})}t.removeManualRanges(s),e.triggerFoldingModelChanged()}}}Zn(Fb.ID,Fb,0);Pe(S6t);Pe(k6t);Pe(E6t);Pe(T6t);Pe(D6t);Pe(O6t);Pe(M6t);Pe(I6t);Pe(A6t);Pe(N6t);Pe(R6t);Pe(P6t);Pe(L6t);Pe(F6t);Pe(B6t);Pe($6t);Pe(W6t);Pe(H6t);for(let n=1;n<=7;n++)fvt(new hR({id:hR.ID(n),label:w("foldLevelAction.label","Fold Level {0}",n),alias:`Fold Level ${n}`,precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2048|21+n),weight:100}}));Un.registerCommand("_executeFoldingRangeProvider",async function(n,...e){const[t]=e;if(!(t instanceof Pt))throw qd();const i=n.get(dt),r=n.get(Sr).getModel(t);if(!r)throw qd();const s=n.get(kn);if(!s.getValue("editor.folding",{resource:t}))return[];const o=n.get(Zr),a=s.getValue("editor.foldingStrategy",{resource:t}),l={get limit(){return s.getValue("editor.foldingMaximumRegions",{resource:t})},update:(f,g)=>{}},c=new Jue(r,o,l);let u=c;if(a!=="indentation"){const f=Fb.getFoldingRangeProviders(i,r);f.length&&(u=new ede(r,f,()=>{},l,c))}const d=await u.compute(yn.None),h=[];try{if(d)for(let f=0;f=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},jI=function(n,e){return function(t,i){e(t,i,n)}};let V9=class{static{this.ID="editor.contrib.autoFormat"}constructor(e,t,i,r){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=r,this._disposables=new ke,this._sessionDisposables=new ke,this._disposables.add(t.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(s=>{s.hasChanged(56)&&this._update()})),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(56)||!this._editor.hasModel())return;const e=this._editor.getModel(),[t]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(e);if(!t||!t.autoFormatTriggerCharacters)return;const i=new n8;for(const r of t.autoFormatTriggerCharacters)i.add(r.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(r=>{const s=r.charCodeAt(r.length-1);i.has(s)&&this._trigger(String.fromCharCode(s))}))}_trigger(e){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;const t=this._editor.getModel(),i=this._editor.getPosition(),r=new Kr,s=this._editor.onDidChangeModelContent(o=>{if(o.isFlush){r.cancel(),s.dispose();return}for(let a=0,l=o.changes.length;a{r.token.isCancellationRequested||bl(o)&&(this._accessibilitySignalService.playSignal(Ai.format,{userGesture:!1}),EE.execute(this._editor,o,!0))}).finally(()=>{s.dispose()})}};V9=sBe([jI(1,dt),jI(2,Oc),jI(3,t1)],V9);let z9=class{static{this.ID="editor.contrib.formatOnPaste"}constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new ke,this._callOnModel=new ke,this._callOnDispose.add(e.onDidChangeConfiguration(()=>this._update())),this._callOnDispose.add(e.onDidChangeModel(()=>this._update())),this._callOnDispose.add(e.onDidChangeModelLanguage(()=>this._update())),this._callOnDispose.add(t.documentRangeFormattingEditProvider.onDidChange(this._update,this))}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(55)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste(({range:e})=>this._trigger(e)))}_trigger(e){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(V8e,this.editor,e,2,p_.None,yn.None,!1).catch(rn))}};z9=sBe([jI(1,dt),jI(2,Tt)],z9);class j6t extends ot{constructor(){super({id:"editor.action.formatDocument",label:w("formatDocument.label","Format Document"),alias:"Format Document",precondition:Le.and(Q.notInCompositeEditor,Q.writable,Q.hasDocumentFormattingProvider),kbOpts:{kbExpr:Q.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(e,t){if(t.hasModel()){const i=e.get(Tt);await e.get(Qb).showWhile(i.invokeFunction(cMt,t,1,p_.None,yn.None,!0),250)}}}class q6t extends ot{constructor(){super({id:"editor.action.formatSelection",label:w("formatSelection.label","Format Selection"),alias:"Format Selection",precondition:Le.and(Q.writable,Q.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2084),weight:100},contextMenuOpts:{when:Q.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(e,t){if(!t.hasModel())return;const i=e.get(Tt),r=t.getModel(),s=t.getSelections().map(a=>a.isEmpty()?new $(a.startLineNumber,1,a.startLineNumber,r.getLineMaxColumn(a.startLineNumber)):a);await e.get(Qb).showWhile(i.invokeFunction(V8e,t,s,1,p_.None,yn.None,!0),250)}}Zn(V9.ID,V9,2);Zn(z9.ID,z9,2);Pe(j6t);Pe(q6t);Un.registerCommand("editor.action.format",async n=>{const e=n.get(ai).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=n.get(_r);e.getSelection().isEmpty()?await t.executeCommand("editor.action.formatDocument"):await t.executeCommand("editor.action.formatSelection")});var K6t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Yq=function(n,e){return function(t,i){e(t,i,n)}};class $S{remove(){this.parent?.children.delete(this.id)}static findId(e,t){let i;typeof e=="string"?i=`${t.id}/${e}`:(i=`${t.id}/${e.name}`,t.children.get(i)!==void 0&&(i=`${t.id}/${e.name}_${e.range.startLineNumber}_${e.range.startColumn}`));let r=i;for(let s=0;t.children.get(r)!==void 0;s++)r=`${i}_${s}`;return r}static empty(e){return e.children.size===0}}class tte extends $S{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class oBe extends $S{constructor(e,t,i,r){super(),this.id=e,this.parent=t,this.label=i,this.order=r,this.children=new Map}}class n_ extends $S{static create(e,t,i){const r=new Kr(i),s=new n_(t.uri),o=e.ordered(t),a=o.map((c,u)=>{const d=$S.findId(`provider_${u}`,s),h=new oBe(d,s,c.displayName??"Unknown Outline Provider",u);return Promise.resolve(c.provideDocumentSymbols(t,r.token)).then(f=>{for(const g of f||[])n_._makeOutlineElement(g,h);return h},f=>(vs(f),h)).then(f=>{$S.empty(f)?f.remove():s._groups.set(d,f)})}),l=e.onDidChange(()=>{const c=e.ordered(t);$r(c,o)||r.cancel()});return Promise.all(a).then(()=>r.token.isCancellationRequested&&!i.isCancellationRequested?n_.create(e,t,i):s._compact()).finally(()=>{r.dispose(),l.dispose(),r.dispose()})}static _makeOutlineElement(e,t){const i=$S.findId(e,t),r=new tte(i,t,e);if(e.children)for(const s of e.children)n_._makeOutlineElement(s,r);t.children.set(r.id,r)}constructor(e){super(),this.uri=e,this.id="root",this.parent=void 0,this._groups=new Map,this.children=new Map,this.id="root",this.parent=void 0}_compact(){let e=0;for(const[t,i]of this._groups)i.children.size===0?this._groups.delete(t):e+=1;if(e!==1)this.children=this._groups;else{const t=zn.first(this._groups.values());for(const[,i]of t.children)i.parent=this,this.children.set(i.id,i)}return this}getTopLevelSymbols(){const e=[];for(const t of this.children.values())t instanceof tte?e.push(t.symbol):e.push(...zn.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>$.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return n_._flattenDocumentSymbols(t,e,""),t.sort((i,r)=>he.compare($.getStartPosition(i.range),$.getStartPosition(r.range))||he.compare($.getEndPosition(r.range),$.getEndPosition(i.range)))}static _flattenDocumentSymbols(e,t,i){for(const r of t)e.push({kind:r.kind,tags:r.tags,name:r.name,detail:r.detail,containerName:r.containerName||i,range:r.range,selectionRange:r.selectionRange,children:void 0}),r.children&&n_._flattenDocumentSymbols(e,r.children,r.name)}}const DO=On("IOutlineModelService");let nte=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new ke,this._cache=new lm(10,.7),this._debounceInformation=t.for(e.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(i.onModelRemoved(r=>{this._cache.delete(r.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(e,t){const i=this._languageFeaturesService.documentSymbolProvider,r=i.ordered(e);let s=this._cache.get(e.id);if(!s||s.versionId!==e.getVersionId()||!$r(s.provider,r)){const a=new Kr;s={versionId:e.getVersionId(),provider:r,promiseCnt:0,source:a,promise:n_.create(i,e,a.token),model:void 0},this._cache.set(e.id,s);const l=Date.now();s.promise.then(c=>{s.model=c,this._debounceInformation.update(e,Date.now()-l)}).catch(c=>{this._cache.delete(e.id)})}if(s.model)return s.model;s.promiseCnt+=1;const o=t.onCancellationRequested(()=>{--s.promiseCnt===0&&(s.source.cancel(),this._cache.delete(e.id))});try{return await s.promise}finally{o.dispose()}}};nte=K6t([Yq(0,dt),Yq(1,cd),Yq(2,Sr)],nte);Vn(DO,nte,1);Un.registerCommand("_executeDocumentSymbolProvider",async function(n,...e){const[t]=e;oi(Pt.isUri(t));const i=n.get(DO),s=await n.get(Nc).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,yn.None)).getTopLevelSymbols()}finally{s.dispose()}});class _l extends me{static{this.inlineSuggestionVisible=new et("inlineSuggestionVisible",!1,w("inlineSuggestionVisible","Whether an inline suggestion is visible"))}static{this.inlineSuggestionHasIndentation=new et("inlineSuggestionHasIndentation",!1,w("inlineSuggestionHasIndentation","Whether the inline suggestion starts with whitespace"))}static{this.inlineSuggestionHasIndentationLessThanTabSize=new et("inlineSuggestionHasIndentationLessThanTabSize",!0,w("inlineSuggestionHasIndentationLessThanTabSize","Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab"))}static{this.suppressSuggestions=new et("inlineSuggestionSuppressSuggestions",void 0,w("suppressSuggestions","Whether suggestions should be suppressed for the current suggestion"))}constructor(e,t){super(),this.contextKeyService=e,this.model=t,this.inlineCompletionVisible=_l.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=_l.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=_l.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=_l.suppressSuggestions.bindTo(this.contextKeyService),this._register(tn(i=>{const s=this.model.read(i)?.state.read(i),o=!!s?.inlineCompletion&&s?.primaryGhostText!==void 0&&!s?.primaryGhostText.isEmpty();this.inlineCompletionVisible.set(o),s?.primaryGhostText&&s?.inlineCompletion&&this.suppressSuggestions.set(s.inlineCompletion.inlineCompletion.source.inlineCompletions.suppressSuggestions)})),this._register(tn(i=>{const r=this.model.read(i);let s=!1,o=!0;const a=r?.primaryGhostText.read(i);if(r?.selectedSuggestItem&&a&&a.parts.length>0){const{column:l,lines:c}=a.parts[0],u=c[0],d=r.textModel.getLineIndentColumn(a.lineNumber);if(l<=d){let f=yl(u);f===-1&&(f=u.length-1),s=f>0;const g=r.textModel.getOptions().tabSize;o=co.visibleColumnFromColumn(u,f+1,g){t.setStyle(n.read(i))})),e}class fR{constructor(e,t){this.lineNumber=e,this.parts=t}equals(e){return this.lineNumber===e.lineNumber&&this.parts.length===e.parts.length&&this.parts.every((t,i)=>t.equals(e.parts[i]))}renderForScreenReader(e){if(this.parts.length===0)return"";const t=this.parts[this.parts.length-1],i=e.substr(0,t.column-1);return new nle([...this.parts.map(s=>new Yp($.fromPositions(new he(1,s.column)),s.lines.join(` + `,constraint:rBe,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,r){const s=this.getLineNumbers(r,i),o=r&&r.levels,a=r&&r.direction;typeof o!="number"&&typeof a!="string"?r6t(t,!0,s):a==="up"?tBe(t,!0,o||1,s):m2(t,!0,o||1,s)}}class L6t extends tl{constructor(){super({id:"editor.toggleFold",label:w("toggleFoldAction.label","Toggle Fold"),alias:"Toggle Fold",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2090),weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);Zue(t,1,r)}}class T6t extends tl{constructor(){super({id:"editor.foldRecursively",label:w("foldRecursivelyAction.label","Fold Recursively"),alias:"Fold Recursively",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2140),weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);m2(t,!0,Number.MAX_VALUE,r)}}class D6t extends tl{constructor(){super({id:"editor.toggleFoldRecursively",label:w("toggleFoldRecursivelyAction.label","Toggle Fold Recursively"),alias:"Toggle Fold Recursively",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,3114),weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);Zue(t,Number.MAX_VALUE,r)}}class I6t extends tl{constructor(){super({id:"editor.foldAllBlockComments",label:w("foldAllBlockComments.label","Fold All Block Comments"),alias:"Fold All Block Comments",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2138),weight:100}})}invoke(e,t,i,r,s){if(t.regions.hasTypes())Que(t,jL.Comment.value,!0);else{const o=i.getModel();if(!o)return;const a=s.getLanguageConfiguration(o.getLanguageId()).comments;if(a&&a.blockCommentStartToken){const l=new RegExp("^\\s*"+nd(a.blockCommentStartToken));Xue(t,l,!0)}}}}class A6t extends tl{constructor(){super({id:"editor.foldAllMarkerRegions",label:w("foldAllMarkerRegions.label","Fold All Regions"),alias:"Fold All Regions",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2077),weight:100}})}invoke(e,t,i,r,s){if(t.regions.hasTypes())Que(t,jL.Region.value,!0);else{const o=i.getModel();if(!o)return;const a=s.getLanguageConfiguration(o.getLanguageId()).foldingRules;if(a&&a.markers&&a.markers.start){const l=new RegExp(a.markers.start);Xue(t,l,!0)}}}}class N6t extends tl{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:w("unfoldAllMarkerRegions.label","Unfold All Regions"),alias:"Unfold All Regions",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2078),weight:100}})}invoke(e,t,i,r,s){if(t.regions.hasTypes())Que(t,jL.Region.value,!1);else{const o=i.getModel();if(!o)return;const a=s.getLanguageConfiguration(o.getLanguageId()).foldingRules;if(a&&a.markers&&a.markers.start){const l=new RegExp(a.markers.start);Xue(t,l,!1)}}}}class R6t extends tl{constructor(){super({id:"editor.foldAllExcept",label:w("foldAllExcept.label","Fold All Except Selected"),alias:"Fold All Except Selected",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2136),weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);nBe(t,!0,r)}}class P6t extends tl{constructor(){super({id:"editor.unfoldAllExcept",label:w("unfoldAllExcept.label","Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2134),weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);nBe(t,!1,r)}}class O6t extends tl{constructor(){super({id:"editor.foldAll",label:w("foldAllAction.label","Fold All"),alias:"Fold All",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2069),weight:100}})}invoke(e,t,i){m2(t,!0)}}class M6t extends tl{constructor(){super({id:"editor.unfoldAll",label:w("unfoldAllAction.label","Unfold All"),alias:"Unfold All",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2088),weight:100}})}invoke(e,t,i){m2(t,!1)}}class hR extends tl{static{this.ID_PREFIX="editor.foldLevel"}static{this.ID=e=>hR.ID_PREFIX+e}getFoldingLevel(){return parseInt(this.id.substr(hR.ID_PREFIX.length))}invoke(e,t,i){s6t(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}}class F6t extends tl{constructor(){super({id:"editor.gotoParentFold",label:w("gotoParentFold.label","Go to Parent Fold"),alias:"Go to Parent Fold",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);if(r.length>0){const s=o6t(r[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class B6t extends tl{constructor(){super({id:"editor.gotoPreviousFold",label:w("gotoPreviousFold.label","Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);if(r.length>0){const s=a6t(r[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class $6t extends tl{constructor(){super({id:"editor.gotoNextFold",label:w("gotoNextFold.label","Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,weight:100}})}invoke(e,t,i){const r=this.getSelectedLines(i);if(r.length>0){const s=l6t(r[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class W6t extends tl{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:w("createManualFoldRange.label","Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2135),weight:100}})}invoke(e,t,i){const r=[],s=i.getSelections();if(s){for(const o of s){let a=o.endLineNumber;o.endColumn===1&&--a,a>o.startLineNumber&&(r.push({startLineNumber:o.startLineNumber,endLineNumber:a,type:void 0,isCollapsed:!0,source:1}),i.setSelection({startLineNumber:o.startLineNumber,startColumn:1,endLineNumber:o.startLineNumber,endColumn:1}))}if(r.length>0){r.sort((a,l)=>a.startLineNumber-l.startLineNumber);const o=Fu.sanitizeAndMerge(t.regions,r,i.getModel()?.getLineCount());t.updatePost(Fu.fromFoldRanges(o))}}}}class H6t extends tl{constructor(){super({id:"editor.removeManualFoldingRanges",label:w("removeManualFoldingRanges.label","Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2137),weight:100}})}invoke(e,t,i){const r=i.getSelections();if(r){const s=[];for(const o of r){const{startLineNumber:a,endLineNumber:l}=o;s.push(l>=a?{startLineNumber:a,endLineNumber:l}:{endLineNumber:l,startLineNumber:a})}t.removeManualRanges(s),e.triggerFoldingModelChanged()}}}Zn(Fb.ID,Fb,0);Pe(S6t);Pe(k6t);Pe(E6t);Pe(T6t);Pe(D6t);Pe(O6t);Pe(M6t);Pe(I6t);Pe(A6t);Pe(N6t);Pe(R6t);Pe(P6t);Pe(L6t);Pe(F6t);Pe(B6t);Pe($6t);Pe(W6t);Pe(H6t);for(let n=1;n<=7;n++)fvt(new hR({id:hR.ID(n),label:w("foldLevelAction.label","Fold Level {0}",n),alias:`Fold Level ${n}`,precondition:Ia,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2048|21+n),weight:100}}));Un.registerCommand("_executeFoldingRangeProvider",async function(n,...e){const[t]=e;if(!(t instanceof Pt))throw qd();const i=n.get(dt),r=n.get(Sr).getModel(t);if(!r)throw qd();const s=n.get(En);if(!s.getValue("editor.folding",{resource:t}))return[];const o=n.get(Zr),a=s.getValue("editor.foldingStrategy",{resource:t}),l={get limit(){return s.getValue("editor.foldingMaximumRegions",{resource:t})},update:(f,g)=>{}},c=new Jue(r,o,l);let u=c;if(a!=="indentation"){const f=Fb.getFoldingRangeProviders(i,r);f.length&&(u=new ede(r,f,()=>{},l,c))}const d=await u.compute(yn.None),h=[];try{if(d)for(let f=0;f=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},jI=function(n,e){return function(t,i){e(t,i,n)}};let V9=class{static{this.ID="editor.contrib.autoFormat"}constructor(e,t,i,r){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=r,this._disposables=new ke,this._sessionDisposables=new ke,this._disposables.add(t.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(s=>{s.hasChanged(56)&&this._update()})),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(56)||!this._editor.hasModel())return;const e=this._editor.getModel(),[t]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(e);if(!t||!t.autoFormatTriggerCharacters)return;const i=new n8;for(const r of t.autoFormatTriggerCharacters)i.add(r.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(r=>{const s=r.charCodeAt(r.length-1);i.has(s)&&this._trigger(String.fromCharCode(s))}))}_trigger(e){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;const t=this._editor.getModel(),i=this._editor.getPosition(),r=new Kr,s=this._editor.onDidChangeModelContent(o=>{if(o.isFlush){r.cancel(),s.dispose();return}for(let a=0,l=o.changes.length;a{r.token.isCancellationRequested||bl(o)&&(this._accessibilitySignalService.playSignal(Ai.format,{userGesture:!1}),EE.execute(this._editor,o,!0))}).finally(()=>{s.dispose()})}};V9=sBe([jI(1,dt),jI(2,Oc),jI(3,t1)],V9);let z9=class{static{this.ID="editor.contrib.formatOnPaste"}constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new ke,this._callOnModel=new ke,this._callOnDispose.add(e.onDidChangeConfiguration(()=>this._update())),this._callOnDispose.add(e.onDidChangeModel(()=>this._update())),this._callOnDispose.add(e.onDidChangeModelLanguage(()=>this._update())),this._callOnDispose.add(t.documentRangeFormattingEditProvider.onDidChange(this._update,this))}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(55)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste(({range:e})=>this._trigger(e)))}_trigger(e){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(V8e,this.editor,e,2,p_.None,yn.None,!1).catch(rn))}};z9=sBe([jI(1,dt),jI(2,Tt)],z9);class j6t extends ot{constructor(){super({id:"editor.action.formatDocument",label:w("formatDocument.label","Format Document"),alias:"Format Document",precondition:Le.and(Q.notInCompositeEditor,Q.writable,Q.hasDocumentFormattingProvider),kbOpts:{kbExpr:Q.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(e,t){if(t.hasModel()){const i=e.get(Tt);await e.get(Qb).showWhile(i.invokeFunction(cMt,t,1,p_.None,yn.None,!0),250)}}}class q6t extends ot{constructor(){super({id:"editor.action.formatSelection",label:w("formatSelection.label","Format Selection"),alias:"Format Selection",precondition:Le.and(Q.writable,Q.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2084),weight:100},contextMenuOpts:{when:Q.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(e,t){if(!t.hasModel())return;const i=e.get(Tt),r=t.getModel(),s=t.getSelections().map(a=>a.isEmpty()?new $(a.startLineNumber,1,a.startLineNumber,r.getLineMaxColumn(a.startLineNumber)):a);await e.get(Qb).showWhile(i.invokeFunction(V8e,t,s,1,p_.None,yn.None,!0),250)}}Zn(V9.ID,V9,2);Zn(z9.ID,z9,2);Pe(j6t);Pe(q6t);Un.registerCommand("editor.action.format",async n=>{const e=n.get(ai).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=n.get(_r);e.getSelection().isEmpty()?await t.executeCommand("editor.action.formatDocument"):await t.executeCommand("editor.action.formatSelection")});var K6t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Yq=function(n,e){return function(t,i){e(t,i,n)}};class $S{remove(){this.parent?.children.delete(this.id)}static findId(e,t){let i;typeof e=="string"?i=`${t.id}/${e}`:(i=`${t.id}/${e.name}`,t.children.get(i)!==void 0&&(i=`${t.id}/${e.name}_${e.range.startLineNumber}_${e.range.startColumn}`));let r=i;for(let s=0;t.children.get(r)!==void 0;s++)r=`${i}_${s}`;return r}static empty(e){return e.children.size===0}}class tte extends $S{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class oBe extends $S{constructor(e,t,i,r){super(),this.id=e,this.parent=t,this.label=i,this.order=r,this.children=new Map}}class n_ extends $S{static create(e,t,i){const r=new Kr(i),s=new n_(t.uri),o=e.ordered(t),a=o.map((c,u)=>{const d=$S.findId(`provider_${u}`,s),h=new oBe(d,s,c.displayName??"Unknown Outline Provider",u);return Promise.resolve(c.provideDocumentSymbols(t,r.token)).then(f=>{for(const g of f||[])n_._makeOutlineElement(g,h);return h},f=>(vs(f),h)).then(f=>{$S.empty(f)?f.remove():s._groups.set(d,f)})}),l=e.onDidChange(()=>{const c=e.ordered(t);$r(c,o)||r.cancel()});return Promise.all(a).then(()=>r.token.isCancellationRequested&&!i.isCancellationRequested?n_.create(e,t,i):s._compact()).finally(()=>{r.dispose(),l.dispose(),r.dispose()})}static _makeOutlineElement(e,t){const i=$S.findId(e,t),r=new tte(i,t,e);if(e.children)for(const s of e.children)n_._makeOutlineElement(s,r);t.children.set(r.id,r)}constructor(e){super(),this.uri=e,this.id="root",this.parent=void 0,this._groups=new Map,this.children=new Map,this.id="root",this.parent=void 0}_compact(){let e=0;for(const[t,i]of this._groups)i.children.size===0?this._groups.delete(t):e+=1;if(e!==1)this.children=this._groups;else{const t=zn.first(this._groups.values());for(const[,i]of t.children)i.parent=this,this.children.set(i.id,i)}return this}getTopLevelSymbols(){const e=[];for(const t of this.children.values())t instanceof tte?e.push(t.symbol):e.push(...zn.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>$.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return n_._flattenDocumentSymbols(t,e,""),t.sort((i,r)=>he.compare($.getStartPosition(i.range),$.getStartPosition(r.range))||he.compare($.getEndPosition(r.range),$.getEndPosition(i.range)))}static _flattenDocumentSymbols(e,t,i){for(const r of t)e.push({kind:r.kind,tags:r.tags,name:r.name,detail:r.detail,containerName:r.containerName||i,range:r.range,selectionRange:r.selectionRange,children:void 0}),r.children&&n_._flattenDocumentSymbols(e,r.children,r.name)}}const DO=On("IOutlineModelService");let nte=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new ke,this._cache=new lm(10,.7),this._debounceInformation=t.for(e.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(i.onModelRemoved(r=>{this._cache.delete(r.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(e,t){const i=this._languageFeaturesService.documentSymbolProvider,r=i.ordered(e);let s=this._cache.get(e.id);if(!s||s.versionId!==e.getVersionId()||!$r(s.provider,r)){const a=new Kr;s={versionId:e.getVersionId(),provider:r,promiseCnt:0,source:a,promise:n_.create(i,e,a.token),model:void 0},this._cache.set(e.id,s);const l=Date.now();s.promise.then(c=>{s.model=c,this._debounceInformation.update(e,Date.now()-l)}).catch(c=>{this._cache.delete(e.id)})}if(s.model)return s.model;s.promiseCnt+=1;const o=t.onCancellationRequested(()=>{--s.promiseCnt===0&&(s.source.cancel(),this._cache.delete(e.id))});try{return await s.promise}finally{o.dispose()}}};nte=K6t([Yq(0,dt),Yq(1,cd),Yq(2,Sr)],nte);Vn(DO,nte,1);Un.registerCommand("_executeDocumentSymbolProvider",async function(n,...e){const[t]=e;oi(Pt.isUri(t));const i=n.get(DO),s=await n.get(Nc).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,yn.None)).getTopLevelSymbols()}finally{s.dispose()}});class _l extends me{static{this.inlineSuggestionVisible=new et("inlineSuggestionVisible",!1,w("inlineSuggestionVisible","Whether an inline suggestion is visible"))}static{this.inlineSuggestionHasIndentation=new et("inlineSuggestionHasIndentation",!1,w("inlineSuggestionHasIndentation","Whether the inline suggestion starts with whitespace"))}static{this.inlineSuggestionHasIndentationLessThanTabSize=new et("inlineSuggestionHasIndentationLessThanTabSize",!0,w("inlineSuggestionHasIndentationLessThanTabSize","Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab"))}static{this.suppressSuggestions=new et("inlineSuggestionSuppressSuggestions",void 0,w("suppressSuggestions","Whether suggestions should be suppressed for the current suggestion"))}constructor(e,t){super(),this.contextKeyService=e,this.model=t,this.inlineCompletionVisible=_l.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=_l.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=_l.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=_l.suppressSuggestions.bindTo(this.contextKeyService),this._register(tn(i=>{const s=this.model.read(i)?.state.read(i),o=!!s?.inlineCompletion&&s?.primaryGhostText!==void 0&&!s?.primaryGhostText.isEmpty();this.inlineCompletionVisible.set(o),s?.primaryGhostText&&s?.inlineCompletion&&this.suppressSuggestions.set(s.inlineCompletion.inlineCompletion.source.inlineCompletions.suppressSuggestions)})),this._register(tn(i=>{const r=this.model.read(i);let s=!1,o=!0;const a=r?.primaryGhostText.read(i);if(r?.selectedSuggestItem&&a&&a.parts.length>0){const{column:l,lines:c}=a.parts[0],u=c[0],d=r.textModel.getLineIndentColumn(a.lineNumber);if(l<=d){let f=yl(u);f===-1&&(f=u.length-1),s=f>0;const g=r.textModel.getOptions().tabSize;o=co.visibleColumnFromColumn(u,f+1,g){t.setStyle(n.read(i))})),e}class fR{constructor(e,t){this.lineNumber=e,this.parts=t}equals(e){return this.lineNumber===e.lineNumber&&this.parts.length===e.parts.length&&this.parts.every((t,i)=>t.equals(e.parts[i]))}renderForScreenReader(e){if(this.parts.length===0)return"";const t=this.parts[this.parts.length-1],i=e.substr(0,t.column-1);return new nle([...this.parts.map(s=>new Yp($.fromPositions(new he(1,s.column)),s.lines.join(` `)))]).applyToString(i).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(e=>e.lines.length===0)}get lineCount(){return 1+this.parts.reduce((e,t)=>e+t.lines.length-1,0)}}class U9{constructor(e,t,i){this.column=e,this.text=t,this.preview=i,this.lines=om(this.text)}equals(e){return this.column===e.column&&this.lines.length===e.lines.length&&this.lines.every((t,i)=>t===e.lines[i])}}class ite{constructor(e,t,i,r=0){this.lineNumber=e,this.columnRange=t,this.text=i,this.additionalReservedLineCount=r,this.parts=[new U9(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=om(this.text)}renderForScreenReader(e){return this.newLines.join(` -`)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(e=>e.lines.length===0)}equals(e){return this.lineNumber===e.lineNumber&&this.columnRange.equals(e.columnRange)&&this.newLines.length===e.newLines.length&&this.newLines.every((t,i)=>t===e.newLines[i])&&this.additionalReservedLineCount===e.additionalReservedLineCount}}function ixe(n,e){return $r(n,e,aBe)}function aBe(n,e){return n===e?!0:!n||!e?!1:n instanceof fR&&e instanceof fR||n instanceof ite&&e instanceof ite?n.equals(e):!1}const Y6t=[];function Z6t(){return Y6t}class lBe{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new fi(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new $(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}}function cBe(n,e){const t=new ke,i=n.createDecorationsCollection();return t.add(aO({debugName:()=>`Apply decorations from ${e.debugName}`},r=>{const s=e.read(r);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function X6t(n,e){return new he(n.lineNumber+e.lineNumber-1,e.lineNumber===1?n.column+e.column-1:e.column)}function rxe(n,e){return new he(n.lineNumber-e.lineNumber+1,n.lineNumber-e.lineNumber===0?n.column-e.column+1:n.column)}var Q6t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},J6t=function(n,e){return function(t,i){e(t,i,n)}};const sxe="ghost-text";let rte=class extends me{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=Sn(this,!1),this.currentTextModel=Bi(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=St(this,r=>{if(this.isDisposed.read(r))return;const s=this.currentTextModel.read(r);if(s!==this.model.targetTextModel.read(r))return;const o=this.model.ghostText.read(r);if(!o)return;const a=o instanceof ite?o.columnRange:void 0,l=[],c=[];function u(p,m){if(c.length>0){const _=c[c.length-1];m&&_.decorations.push(new Ol(_.content.length+1,_.content.length+1+p[0].length,m,0)),_.content+=p[0],p=p.slice(1)}for(const _ of p)c.push({content:_,decorations:m?[new Ol(1,_.length+1,m,0)]:[]})}const d=s.getLineContent(o.lineNumber);let h,f=0;for(const p of o.parts){let m=p.lines;h===void 0?(l.push({column:p.column,text:m[0],preview:p.preview}),m=m.slice(1)):u([d.substring(f,p.column-1)],void 0),m.length>0&&(u(m,sxe),h===void 0&&p.column<=d.length&&(h=p.column)),f=p.column-1}h!==void 0&&u([d.substring(f)],void 0);const g=h!==void 0?new lBe(h,d.length+1):void 0;return{replacedRange:a,inlineTexts:l,additionalLines:c,hiddenRange:g,lineNumber:o.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(r),targetTextModel:s}}),this.decorations=St(this,r=>{const s=this.uiState.read(r);if(!s)return[];const o=[];s.replacedRange&&o.push({range:s.replacedRange.toRange(s.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace",description:"GhostTextReplacement"}}),s.hiddenRange&&o.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const a of s.inlineTexts)o.push({range:$.fromPositions(new he(s.lineNumber,a.column)),options:{description:sxe,after:{content:a.text,inlineClassName:a.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:Kh.Left},showIfCollapsed:!0}});return o}),this.additionalLinesWidget=this._register(new e8t(this.editor,this.languageService.languageIdCodec,St(r=>{const s=this.uiState.read(r);return s?{lineNumber:s.lineNumber,additionalLines:s.additionalLines,minReservedLineCount:s.additionalReservedLineCount,targetTextModel:s.targetTextModel}:void 0}))),this._register(Lt(()=>{this.isDisposed.set(!0,void 0)})),this._register(cBe(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}};rte=Q6t([J6t(2,Hr)],rte);class e8t extends me{get viewZoneId(){return this._viewZoneId}constructor(e,t,i){super(),this.editor=e,this.languageIdCodec=t,this.lines=i,this._viewZoneId=void 0,this.editorOptionsChanged=xa("editorOptionChanged",Ge.filter(this.editor.onDidChangeConfiguration,r=>r.hasChanged(33)||r.hasChanged(118)||r.hasChanged(100)||r.hasChanged(95)||r.hasChanged(51)||r.hasChanged(50)||r.hasChanged(67))),this._register(tn(r=>{const s=this.lines.read(r);this.editorOptionsChanged.read(r),s?this.updateLines(s.lineNumber,s.additionalLines,s.minReservedLineCount):this.clear()}))}dispose(){super.dispose(),this.clear()}clear(){this.editor.changeViewZones(e=>{this._viewZoneId&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0)})}updateLines(e,t,i){const r=this.editor.getModel();if(!r)return;const{tabSize:s}=r.getOptions();this.editor.changeViewZones(o=>{this._viewZoneId&&(o.removeZone(this._viewZoneId),this._viewZoneId=void 0);const a=Math.max(t.length,i);if(a>0){const l=document.createElement("div");t8t(l,s,t,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=o.addZone({afterLineNumber:e,heightInLines:a,domNode:l,afterColumnAffinity:1})}})}}function t8t(n,e,t,i,r){const s=i.get(33),o=i.get(118),a="none",l=i.get(95),c=i.get(51),u=i.get(50),d=i.get(67),h=new XL(1e4);h.appendString('
');for(let p=0,m=t.length;p');const y=KP(v),C=iE(v),x=Fs.createEmpty(v,r);mO(new n1(u.isMonospace&&!s,u.canUseHalfwidthRightwardsArrow,v,!1,y,C,0,x,_.decorations,e,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,o,a,l,c!==zh.OFF,null),h),h.appendString("
")}h.appendString(""),ta(n,u);const f=h.build(),g=oxe?oxe.createHTML(f):f;n.innerHTML=g}const oxe=p0("editorGhostText",{createHTML:n=>n});function n8t(n,e){const t=new F5e,i=new $5e(t,c=>e.getLanguageConfiguration(c)),r=new B5e(new i8t([n]),i),s=MQ(r,[],void 0,!0);let o="";const a=n.getLineContent();function l(c,u){if(c.kind===2)if(l(c.openingBracket,u),u=as(u,c.openingBracket.length),c.child&&(l(c.child,u),u=as(u,c.child.length)),c.closingBracket)l(c.closingBracket,u),u=as(u,c.closingBracket.length);else{const h=i.getSingleLanguageBracketTokens(c.openingBracket.languageId).findClosingTokenText(c.openingBracket.bracketIds);o+=h}else if(c.kind!==3){if(c.kind===0||c.kind===1)o+=a.substring(u,as(u,c.length));else if(c.kind===4)for(const d of c.children)l(d,u),u=as(u,d.length)}}return l(s,Pl),o}class i8t{constructor(e){this.lines=e,this.tokenization={getLineTokens:t=>this.lines[t-1]}}getLineCount(){return this.lines.length}getLineLength(e){return this.lines[e-1].getLineContent().length}}async function uBe(n,e,t,i,r=yn.None,s){const o=e instanceof he?a8t(e,t):e,a=n.all(t),l=new Xae;for(const _ of a)_.groupId&&l.add(_.groupId,_);function c(_){if(!_.yieldsToGroupIds)return[];const v=[];for(const y of _.yieldsToGroupIds||[]){const C=l.get(y);for(const x of C)v.push(x)}return v}const u=new Map,d=new Set;function h(_,v){if(v=[...v,_],d.has(_))return v;d.add(_);try{const y=c(_);for(const C of y){const x=h(C,v);if(x)return x}}finally{d.delete(_)}}function f(_){const v=u.get(_);if(v)return v;const y=h(_,[]);y&&vs(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${y.map(x=>x.toString?x.toString():""+x).join(" -> ")}`));const C=new KL;return u.set(_,C.p),(async()=>{if(!y){const x=c(_);for(const k of x){const L=await f(k);if(L&&L.items.length>0)return}}try{return e instanceof he?await _.provideInlineCompletions(t,e,i,r):await _.provideInlineEdits?.(t,e,i,r)}catch(x){vs(x);return}})().then(x=>C.complete(x),x=>C.error(x)),C.p}const g=await Promise.all(a.map(async _=>({provider:_,completions:await f(_)}))),p=new Map,m=[];for(const _ of g){const v=_.completions;if(!v)continue;const y=new s8t(v,_.provider);m.push(y);for(const C of v.items){const x=o8t.from(C,y,o,t,s);p.set(x.hash(),x)}}return new r8t(Array.from(p.values()),new Set(p.keys()),m)}class r8t{constructor(e,t,i){this.completions=e,this.hashs=t,this.providerResults=i}has(e){return this.hashs.has(e.hash())}dispose(){for(const e of this.providerResults)e.removeRef()}}let s8t=class{constructor(e,t){this.inlineCompletions=e,this.provider=t,this.refCount=1}addRef(){this.refCount++}removeRef(){this.refCount--,this.refCount===0&&this.provider.freeInlineCompletions(this.inlineCompletions)}},o8t=class ste{static from(e,t,i,r,s){let o,a,l=e.range?$.lift(e.range):i;if(typeof e.insertText=="string"){if(o=e.insertText,s&&e.completeBracketPairs){o=axe(o,l.getStartPosition(),r,s);const c=o.length-e.insertText.length;c!==0&&(l=new $(l.startLineNumber,l.startColumn,l.endLineNumber,l.endColumn+c))}a=void 0}else if("snippet"in e.insertText){const c=e.insertText.snippet.length;if(s&&e.completeBracketPairs){e.insertText.snippet=axe(e.insertText.snippet,l.getStartPosition(),r,s);const d=e.insertText.snippet.length-c;d!==0&&(l=new $(l.startLineNumber,l.startColumn,l.endLineNumber,l.endColumn+d))}const u=new zw().parse(e.insertText.snippet);u.children.length===1&&u.children[0]instanceof Xc?(o=u.children[0].value,a=void 0):(o=u.toString(),a={snippet:e.insertText.snippet,range:l})}else Z$(e.insertText);return new ste(o,e.command,l,o,a,e.additionalTextEdits||Z6t(),e,t)}constructor(e,t,i,r,s,o,a,l){this.filterText=e,this.command=t,this.range=i,this.insertText=r,this.snippetInfo=s,this.additionalTextEdits=o,this.sourceInlineCompletion=a,this.source=l,e=e.replace(/\r\n|\r/g,` +`)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(e=>e.lines.length===0)}equals(e){return this.lineNumber===e.lineNumber&&this.columnRange.equals(e.columnRange)&&this.newLines.length===e.newLines.length&&this.newLines.every((t,i)=>t===e.newLines[i])&&this.additionalReservedLineCount===e.additionalReservedLineCount}}function ixe(n,e){return $r(n,e,aBe)}function aBe(n,e){return n===e?!0:!n||!e?!1:n instanceof fR&&e instanceof fR||n instanceof ite&&e instanceof ite?n.equals(e):!1}const Y6t=[];function Z6t(){return Y6t}class lBe{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new fi(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new $(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}}function cBe(n,e){const t=new ke,i=n.createDecorationsCollection();return t.add(aO({debugName:()=>`Apply decorations from ${e.debugName}`},r=>{const s=e.read(r);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function X6t(n,e){return new he(n.lineNumber+e.lineNumber-1,e.lineNumber===1?n.column+e.column-1:e.column)}function rxe(n,e){return new he(n.lineNumber-e.lineNumber+1,n.lineNumber-e.lineNumber===0?n.column-e.column+1:n.column)}var Q6t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},J6t=function(n,e){return function(t,i){e(t,i,n)}};const sxe="ghost-text";let rte=class extends me{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=kn(this,!1),this.currentTextModel=Bi(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=St(this,r=>{if(this.isDisposed.read(r))return;const s=this.currentTextModel.read(r);if(s!==this.model.targetTextModel.read(r))return;const o=this.model.ghostText.read(r);if(!o)return;const a=o instanceof ite?o.columnRange:void 0,l=[],c=[];function u(p,m){if(c.length>0){const _=c[c.length-1];m&&_.decorations.push(new Ol(_.content.length+1,_.content.length+1+p[0].length,m,0)),_.content+=p[0],p=p.slice(1)}for(const _ of p)c.push({content:_,decorations:m?[new Ol(1,_.length+1,m,0)]:[]})}const d=s.getLineContent(o.lineNumber);let h,f=0;for(const p of o.parts){let m=p.lines;h===void 0?(l.push({column:p.column,text:m[0],preview:p.preview}),m=m.slice(1)):u([d.substring(f,p.column-1)],void 0),m.length>0&&(u(m,sxe),h===void 0&&p.column<=d.length&&(h=p.column)),f=p.column-1}h!==void 0&&u([d.substring(f)],void 0);const g=h!==void 0?new lBe(h,d.length+1):void 0;return{replacedRange:a,inlineTexts:l,additionalLines:c,hiddenRange:g,lineNumber:o.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(r),targetTextModel:s}}),this.decorations=St(this,r=>{const s=this.uiState.read(r);if(!s)return[];const o=[];s.replacedRange&&o.push({range:s.replacedRange.toRange(s.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace",description:"GhostTextReplacement"}}),s.hiddenRange&&o.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const a of s.inlineTexts)o.push({range:$.fromPositions(new he(s.lineNumber,a.column)),options:{description:sxe,after:{content:a.text,inlineClassName:a.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:Kh.Left},showIfCollapsed:!0}});return o}),this.additionalLinesWidget=this._register(new e8t(this.editor,this.languageService.languageIdCodec,St(r=>{const s=this.uiState.read(r);return s?{lineNumber:s.lineNumber,additionalLines:s.additionalLines,minReservedLineCount:s.additionalReservedLineCount,targetTextModel:s.targetTextModel}:void 0}))),this._register(Lt(()=>{this.isDisposed.set(!0,void 0)})),this._register(cBe(this.editor,this.decorations))}ownsViewZone(e){return this.additionalLinesWidget.viewZoneId===e}};rte=Q6t([J6t(2,Hr)],rte);class e8t extends me{get viewZoneId(){return this._viewZoneId}constructor(e,t,i){super(),this.editor=e,this.languageIdCodec=t,this.lines=i,this._viewZoneId=void 0,this.editorOptionsChanged=xa("editorOptionChanged",Ge.filter(this.editor.onDidChangeConfiguration,r=>r.hasChanged(33)||r.hasChanged(118)||r.hasChanged(100)||r.hasChanged(95)||r.hasChanged(51)||r.hasChanged(50)||r.hasChanged(67))),this._register(tn(r=>{const s=this.lines.read(r);this.editorOptionsChanged.read(r),s?this.updateLines(s.lineNumber,s.additionalLines,s.minReservedLineCount):this.clear()}))}dispose(){super.dispose(),this.clear()}clear(){this.editor.changeViewZones(e=>{this._viewZoneId&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0)})}updateLines(e,t,i){const r=this.editor.getModel();if(!r)return;const{tabSize:s}=r.getOptions();this.editor.changeViewZones(o=>{this._viewZoneId&&(o.removeZone(this._viewZoneId),this._viewZoneId=void 0);const a=Math.max(t.length,i);if(a>0){const l=document.createElement("div");t8t(l,s,t,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=o.addZone({afterLineNumber:e,heightInLines:a,domNode:l,afterColumnAffinity:1})}})}}function t8t(n,e,t,i,r){const s=i.get(33),o=i.get(118),a="none",l=i.get(95),c=i.get(51),u=i.get(50),d=i.get(67),h=new XL(1e4);h.appendString('
');for(let p=0,m=t.length;p');const y=KP(v),C=iE(v),x=Fs.createEmpty(v,r);mO(new n1(u.isMonospace&&!s,u.canUseHalfwidthRightwardsArrow,v,!1,y,C,0,x,_.decorations,e,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,o,a,l,c!==zh.OFF,null),h),h.appendString("
")}h.appendString(""),ta(n,u);const f=h.build(),g=oxe?oxe.createHTML(f):f;n.innerHTML=g}const oxe=p0("editorGhostText",{createHTML:n=>n});function n8t(n,e){const t=new FFe,i=new $Fe(t,c=>e.getLanguageConfiguration(c)),r=new BFe(new i8t([n]),i),s=MQ(r,[],void 0,!0);let o="";const a=n.getLineContent();function l(c,u){if(c.kind===2)if(l(c.openingBracket,u),u=as(u,c.openingBracket.length),c.child&&(l(c.child,u),u=as(u,c.child.length)),c.closingBracket)l(c.closingBracket,u),u=as(u,c.closingBracket.length);else{const h=i.getSingleLanguageBracketTokens(c.openingBracket.languageId).findClosingTokenText(c.openingBracket.bracketIds);o+=h}else if(c.kind!==3){if(c.kind===0||c.kind===1)o+=a.substring(u,as(u,c.length));else if(c.kind===4)for(const d of c.children)l(d,u),u=as(u,d.length)}}return l(s,Pl),o}class i8t{constructor(e){this.lines=e,this.tokenization={getLineTokens:t=>this.lines[t-1]}}getLineCount(){return this.lines.length}getLineLength(e){return this.lines[e-1].getLineContent().length}}async function uBe(n,e,t,i,r=yn.None,s){const o=e instanceof he?a8t(e,t):e,a=n.all(t),l=new Xae;for(const _ of a)_.groupId&&l.add(_.groupId,_);function c(_){if(!_.yieldsToGroupIds)return[];const v=[];for(const y of _.yieldsToGroupIds||[]){const C=l.get(y);for(const x of C)v.push(x)}return v}const u=new Map,d=new Set;function h(_,v){if(v=[...v,_],d.has(_))return v;d.add(_);try{const y=c(_);for(const C of y){const x=h(C,v);if(x)return x}}finally{d.delete(_)}}function f(_){const v=u.get(_);if(v)return v;const y=h(_,[]);y&&vs(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${y.map(x=>x.toString?x.toString():""+x).join(" -> ")}`));const C=new KL;return u.set(_,C.p),(async()=>{if(!y){const x=c(_);for(const k of x){const L=await f(k);if(L&&L.items.length>0)return}}try{return e instanceof he?await _.provideInlineCompletions(t,e,i,r):await _.provideInlineEdits?.(t,e,i,r)}catch(x){vs(x);return}})().then(x=>C.complete(x),x=>C.error(x)),C.p}const g=await Promise.all(a.map(async _=>({provider:_,completions:await f(_)}))),p=new Map,m=[];for(const _ of g){const v=_.completions;if(!v)continue;const y=new s8t(v,_.provider);m.push(y);for(const C of v.items){const x=o8t.from(C,y,o,t,s);p.set(x.hash(),x)}}return new r8t(Array.from(p.values()),new Set(p.keys()),m)}class r8t{constructor(e,t,i){this.completions=e,this.hashs=t,this.providerResults=i}has(e){return this.hashs.has(e.hash())}dispose(){for(const e of this.providerResults)e.removeRef()}}let s8t=class{constructor(e,t){this.inlineCompletions=e,this.provider=t,this.refCount=1}addRef(){this.refCount++}removeRef(){this.refCount--,this.refCount===0&&this.provider.freeInlineCompletions(this.inlineCompletions)}},o8t=class ste{static from(e,t,i,r,s){let o,a,l=e.range?$.lift(e.range):i;if(typeof e.insertText=="string"){if(o=e.insertText,s&&e.completeBracketPairs){o=axe(o,l.getStartPosition(),r,s);const c=o.length-e.insertText.length;c!==0&&(l=new $(l.startLineNumber,l.startColumn,l.endLineNumber,l.endColumn+c))}a=void 0}else if("snippet"in e.insertText){const c=e.insertText.snippet.length;if(s&&e.completeBracketPairs){e.insertText.snippet=axe(e.insertText.snippet,l.getStartPosition(),r,s);const d=e.insertText.snippet.length-c;d!==0&&(l=new $(l.startLineNumber,l.startColumn,l.endLineNumber,l.endColumn+d))}const u=new zw().parse(e.insertText.snippet);u.children.length===1&&u.children[0]instanceof Xc?(o=u.children[0].value,a=void 0):(o=u.toString(),a={snippet:e.insertText.snippet,range:l})}else Z$(e.insertText);return new ste(o,e.command,l,o,a,e.additionalTextEdits||Z6t(),e,t)}constructor(e,t,i,r,s,o,a,l){this.filterText=e,this.command=t,this.range=i,this.insertText=r,this.snippetInfo=s,this.additionalTextEdits=o,this.sourceInlineCompletion=a,this.source=l,e=e.replace(/\r\n|\r/g,` `),r=e.replace(/\r\n|\r/g,` -`)}withRange(e){return new ste(this.filterText,this.command,e,this.insertText,this.snippetInfo,this.additionalTextEdits,this.sourceInlineCompletion,this.source)}hash(){return JSON.stringify({insertText:this.insertText,range:this.range.toString()})}toSingleTextEdit(){return new Yp(this.range,this.insertText)}};function a8t(n,e){const t=e.getWordAtPosition(n),i=e.getLineMaxColumn(n.lineNumber);return t?new $(n.lineNumber,t.startColumn,n.lineNumber,i):$.fromPositions(n,n.with(void 0,i))}function axe(n,e,t,i){const s=t.getLineContent(e.lineNumber).substring(0,e.column-1)+n,a=t.tokenization.tokenizeLineWithEdit(e,s.length-(e.column-1),n)?.sliceAndInflate(e.column-1,s.length,0);return a?n8t(a,i):n}function ow(n,e,t){const i=t?n.range.intersectRanges(t):n.range;if(!i)return n;const r=e.getValueInRange(i,1),s=Cb(r,n.text),o=_c.ofText(r.substring(0,s)).addToPosition(n.range.getStartPosition()),a=n.text.substring(s),l=$.fromPositions(o,n.range.getEndPosition());return new Yp(l,a)}function dBe(n,e){return n.text.startsWith(e.text)&&l8t(n.range,e.range)}function lxe(n,e,t,i,r=0){let s=ow(n,e);if(s.range.endLineNumber!==s.range.startLineNumber)return;const o=e.getLineContent(s.range.startLineNumber),a=Ji(o).length;if(s.range.startColumn-1<=a){const g=Ji(s.text).length,p=o.substring(s.range.startColumn-1,a),[m,_]=[s.range.getStartPosition(),s.range.getEndPosition()],v=m.column+p.length<=_.column?m.delta(0,p.length):_,y=$.fromPositions(v,_),C=s.text.startsWith(p)?s.text.substring(p.length):s.text.substring(g);s=new Yp(y,C)}const c=e.getValueInRange(s.range),u=c8t(c,s.text);if(!u)return;const d=s.range.startLineNumber,h=new Array;if(t==="prefix"){const g=u.filter(p=>p.originalLength===0);if(g.length>1||g.length===1&&g[0].originalStart!==c.length)return}const f=s.text.length-r;for(const g of u){const p=s.range.startColumn+g.originalStart+g.originalLength;if(t==="subwordSmart"&&i&&i.lineNumber===s.range.startLineNumber&&p0)return;if(g.modifiedLength===0)continue;const m=g.modifiedStart+g.modifiedLength,_=Math.max(g.modifiedStart,Math.min(m,f)),v=s.text.substring(g.modifiedStart,_),y=s.text.substring(_,Math.max(g.modifiedStart,m));v.length>0&&h.push(new U9(p,v,!1)),y.length>0&&h.push(new U9(p,y,!0))}return new fR(d,h)}function l8t(n,e){return e.getStartPosition().equals(n.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(n.getEndPosition())}let b3;function c8t(n,e){if(b3?.originalValue===n&&b3?.newValue===e)return b3?.changes;{let t=uxe(n,e,!0);if(t){const i=cxe(t);if(i>0){const r=uxe(n,e,!1);r&&cxe(r)5e3||e.length>5e3)return;function i(c){let u=0;for(let d=0,h=c.length;du&&(u=f)}return u}const r=Math.max(i(n),i(e));function s(c){if(c<0)throw new Error("unexpected");return r+c+1}function o(c){let u=0,d=0;const h=new Int32Array(c.length);for(let f=0,g=c.length;fa},{getElements:()=>l}).ComputeDiff(!1).changes}var u8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},dxe=function(n,e){return function(t,i){e(t,i,n)}};let ote=class extends me{constructor(e,t,i,r,s){super(),this.textModel=e,this.versionId=t,this._debounceValue=i,this.languageFeaturesService=r,this.languageConfigurationService=s,this._updateOperation=this._register(new To),this.inlineCompletions=TN("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=TN("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperation.clear()}))}fetch(e,t,i){const r=new h8t(e,t,this.textModel.getVersionId()),s=t.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if(this._updateOperation.value?.request.satisfies(r))return this._updateOperation.value.promise;if(s.get()?.request.satisfies(r))return Promise.resolve(!0);const o=!!this._updateOperation.value;this._updateOperation.clear();const a=new Kr,l=(async()=>{if((o||t.triggerKind===gg.Automatic)&&await d8t(this._debounceValue.get(this.textModel),a.token),a.token.isCancellationRequested||this._store.isDisposed||this.textModel.getVersionId()!==r.versionId)return!1;const d=new Date,h=await uBe(this.languageFeaturesService.inlineCompletionsProvider,e,this.textModel,t,a.token,this.languageConfigurationService);if(a.token.isCancellationRequested||this._store.isDisposed||this.textModel.getVersionId()!==r.versionId)return!1;const f=new Date;this._debounceValue.update(this.textModel,f.getTime()-d.getTime());const g=new g8t(h,r,this.textModel,this.versionId);if(i){const p=i.toInlineCompletion(void 0);i.canBeReused(this.textModel,e)&&!h.has(p)&&g.prepend(i.inlineCompletion,p.range,!0)}return this._updateOperation.clear(),qr(p=>{s.set(g,p)}),!0})(),c=new f8t(r,a,l);return this._updateOperation.value=c,l}clear(e){this._updateOperation.clear(),this.inlineCompletions.set(void 0,e),this.suggestWidgetInlineCompletions.set(void 0,e)}clearSuggestWidgetInlineCompletions(e){this._updateOperation.value?.request.context.selectedSuggestionInfo&&this._updateOperation.clear(),this.suggestWidgetInlineCompletions.set(void 0,e)}cancelUpdate(){this._updateOperation.clear()}};ote=u8t([dxe(3,dt),dxe(4,Zr)],ote);function d8t(n,e){return new Promise(t=>{let i;const r=setTimeout(()=>{i&&i.dispose(),t()},n);e&&(i=e.onCancellationRequested(()=>{clearTimeout(r),i&&i.dispose(),t()}))})}class h8t{constructor(e,t,i){this.position=e,this.context=t,this.versionId=i}satisfies(e){return this.position.equals(e.position)&&bQ(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,vSt())&&(e.context.triggerKind===gg.Automatic||this.context.triggerKind===gg.Explicit)&&this.versionId===e.versionId}}class f8t{constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class g8t{get inlineCompletions(){return this._inlineCompletions}constructor(e,t,i,r){this.inlineCompletionProviderResult=e,this.request=t,this._textModel=i,this._versionId=r,this._refCount=1,this._prependedInlineCompletionItems=[];const s=i.deltaDecorations([],e.completions.map(o=>({range:o.range,options:{description:"inline-completion-tracking-range"}})));this._inlineCompletions=e.completions.map((o,a)=>new hxe(o,s[a],this._textModel,this._versionId))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,this._refCount===0){setTimeout(()=>{this._textModel.isDisposed()||this._textModel.deltaDecorations(this._inlineCompletions.map(e=>e.decorationId),[])},0),this.inlineCompletionProviderResult.dispose();for(const e of this._prependedInlineCompletionItems)e.source.removeRef()}}prepend(e,t,i){i&&e.source.addRef();const r=this._textModel.deltaDecorations([],[{range:t,options:{description:"inline-completion-tracking-range"}}])[0];this._inlineCompletions.unshift(new hxe(e,r,this._textModel,this._versionId)),this._prependedInlineCompletionItems.push(e)}}class hxe{get forwardStable(){return this.inlineCompletion.source.inlineCompletions.enableForwardStability??!1}constructor(e,t,i,r){this.inlineCompletion=e,this.decorationId=t,this._textModel=i,this._modelVersion=r,this.semanticId=JSON.stringify([this.inlineCompletion.filterText,this.inlineCompletion.insertText,this.inlineCompletion.range.getStartPosition().toString()]),this._updatedRange=$u({owner:this,equalsFn:$.equalsRange},s=>(this._modelVersion.read(s),this._textModel.getDecorationRange(this.decorationId)))}toInlineCompletion(e){return this.inlineCompletion.withRange(this._updatedRange.read(e)??Zq)}toSingleTextEdit(e){return new Yp(this._updatedRange.read(e)??Zq,this.inlineCompletion.insertText)}isVisible(e,t,i){const r=ow(this._toFilterTextReplacement(i),e),s=this._updatedRange.read(i);if(!s||!this.inlineCompletion.range.getStartPosition().equals(s.getStartPosition())||t.lineNumber!==r.range.startLineNumber)return!1;const o=e.getValueInRange(r.range,1),a=r.text,l=Math.max(0,t.column-r.range.startColumn);let c=a.substring(0,l),u=a.substring(l),d=o.substring(0,l),h=o.substring(l);const f=e.getLineIndentColumn(r.range.startLineNumber);return r.range.startColumn<=f&&(d=d.trimStart(),d.length===0&&(h=h.trimStart()),c=c.trimStart(),c.length===0&&(u=u.trimStart())),c.startsWith(d)&&!!VFe(h,u)}canBeReused(e,t){const i=this._updatedRange.read(void 0);return!!i&&i.containsPosition(t)&&this.isVisible(e,t,void 0)&&_c.ofRange(i).isGreaterThanOrEqualTo(_c.ofRange(this.inlineCompletion.range))}_toFilterTextReplacement(e){return new Yp(this._updatedRange.read(e)??Zq,this.inlineCompletion.filterText)}}const Zq=new $(1,1,1,1),Cn={Visible:Kue,HasFocusedSuggestion:new et("suggestWidgetHasFocusedSuggestion",!1,w("suggestWidgetHasSelection","Whether any suggestion is focused")),DetailsVisible:new et("suggestWidgetDetailsVisible",!1,w("suggestWidgetDetailsVisible","Whether suggestion details are visible")),MultipleSuggestions:new et("suggestWidgetMultipleSuggestions",!1,w("suggestWidgetMultipleSuggestions","Whether there are multiple suggestions to pick from")),MakesTextEdit:new et("suggestionMakesTextEdit",!0,w("suggestionMakesTextEdit","Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new et("acceptSuggestionOnEnter",!0,w("acceptSuggestionOnEnter","Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new et("suggestionHasInsertAndReplaceRange",!1,w("suggestionHasInsertAndReplaceRange","Whether the current suggestion has insert and replace behaviour")),InsertMode:new et("suggestionInsertMode",void 0,{type:"string",description:w("suggestionInsertMode","Whether the default behaviour is to insert or replace")}),CanResolve:new et("suggestionCanResolve",!1,w("suggestionCanResolve","Whether the current suggestion supports to resolve further details"))},ub=new ce("suggestWidgetStatusBar");let p8t=class{constructor(e,t,i,r){this.position=e,this.completion=t,this.container=i,this.provider=r,this.isInvalid=!1,this.score=vg.Default,this.distance=0,this.textLabel=typeof t.label=="string"?t.label:t.label?.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=t.sortText&&t.sortText.toLowerCase(),this.filterTextLow=t.filterText&&t.filterText.toLowerCase(),this.extensionId=t.extensionId,$.isIRange(t.range)?(this.editStart=new he(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new he(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new he(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||$.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new he(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new he(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new he(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||$.spansMultipleLines(t.range.insert)||$.spansMultipleLines(t.range.replace)||t.range.insert.startLineNumber!==e.lineNumber||t.range.replace.startLineNumber!==e.lineNumber||t.range.insert.startColumn!==t.range.replace.startColumn),typeof r.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(e){if(!this._resolveCache){const t=e.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),i=new Bo(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(r=>{Object.assign(this.completion,r),this._resolveDuration=i.elapsed()},r=>{uh(r)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}};class IO{static{this.default=new IO}constructor(e=2,t=new Set,i=new Set,r=new Map,s=!0){this.snippetSortOrder=e,this.kindFilter=t,this.providerFilter=i,this.providerItemsToReuse=r,this.showDeprecated=s}}class m8t{constructor(e,t,i,r){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=r}}async function tde(n,e,t,i=IO.default,r={triggerKind:0},s=yn.None){const o=new Bo;t=t.clone();const a=e.getWordAtPosition(t),l=a?new $(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):$.fromPositions(t),c={replace:l,insert:l.setEndPosition(t.lineNumber,t.column)},u=[],d=new ke,h=[];let f=!1;const g=(m,_,v)=>{let y=!1;if(!_)return y;for(const C of _.suggestions)if(!i.kindFilter.has(C.kind)){if(!i.showDeprecated&&C?.tags?.includes(1))continue;C.range||(C.range=c),C.sortText||(C.sortText=typeof C.label=="string"?C.label:C.label.label),!f&&C.insertTextRules&&C.insertTextRules&4&&(f=zw.guessNeedsClipboard(C.insertText)),u.push(new p8t(t,C,_,m)),y=!0}return R$(_)&&d.add(_),h.push({providerName:m._debugDisplayName??"unknown_provider",elapsedProvider:_.duration??-1,elapsedOverall:v.elapsed()}),y},p=(async()=>{})();for(const m of n.orderedGroups(e)){let _=!1;if(await Promise.all(m.map(async v=>{if(i.providerItemsToReuse.has(v)){const y=i.providerItemsToReuse.get(v);y.forEach(C=>u.push(C)),_=_||y.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(v)))try{const y=new Bo,C=await v.provideCompletionItems(e,t,r,s);_=g(v,C,y)||_}catch(y){vs(y)}})),_||s.isCancellationRequested)break}return await p,s.isCancellationRequested?(d.dispose(),Promise.reject(new sf)):new m8t(u.sort(b8t(i.snippetSortOrder)),f,{entries:h,elapsed:o.elapsed()},d)}function nde(n,e){if(n.sortTextLow&&e.sortTextLow){if(n.sortTextLowe.sortTextLow)return 1}return n.textLabele.textLabel?1:n.completion.kind-e.completion.kind}function _8t(n,e){if(n.completion.kind!==e.completion.kind){if(n.completion.kind===27)return-1;if(e.completion.kind===27)return 1}return nde(n,e)}function v8t(n,e){if(n.completion.kind!==e.completion.kind){if(n.completion.kind===27)return 1;if(e.completion.kind===27)return-1}return nde(n,e)}const vH=new Map;vH.set(0,_8t);vH.set(2,v8t);vH.set(1,nde);function b8t(n){return vH.get(n)}Un.registerCommand("_executeCompletionItemProvider",async(n,...e)=>{const[t,i,r,s]=e;oi(Pt.isUri(t)),oi(he.isIPosition(i)),oi(typeof r=="string"||!r),oi(typeof s=="number"||!s);const{completionProvider:o}=n.get(dt),a=await n.get(Nc).createModelReference(t);try{const l={incomplete:!1,suggestions:[]},c=[],u=a.object.textEditorModel.validatePosition(i),d=await tde(o,a.object.textEditorModel,u,void 0,{triggerCharacter:r??void 0,triggerKind:r?1:0});for(const h of d.items)c.length<(s??0)&&c.push(h.resolve(yn.None)),l.incomplete=l.incomplete||h.container.incomplete,l.suggestions.push(h.completion);try{return await Promise.all(c),l}finally{setTimeout(()=>d.disposable.dispose(),100)}}finally{a.dispose()}});function y8t(n,e){n.getContribution("editor.contrib.suggestController")?.triggerSuggest(new Set().add(e),void 0,!0)}class WS{static isAllOff(e){return e.other==="off"&&e.comments==="off"&&e.strings==="off"}static isAllOn(e){return e.other==="on"&&e.comments==="on"&&e.strings==="on"}static valueFor(e,t){switch(t){case 1:return e.comments;case 2:return e.strings;default:return e.other}}}function fxe(n,e=Ta){return z1t(n,e)?n.charAt(0).toUpperCase()+n.slice(1):n}var w8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},C8t=function(n,e){return function(t,i){e(t,i,n)}};class gxe{constructor(e){this._delegates=e}resolve(e){for(const t of this._delegates){const i=t.resolve(e);if(i!==void 0)return i}}}class pxe{constructor(e,t,i,r){this._model=e,this._selection=t,this._selectionIdx=i,this._overtypingCapturer=r}resolve(e){const{name:t}=e;if(t==="SELECTION"||t==="TM_SELECTED_TEXT"){let i=this._model.getValueInRange(this._selection)||void 0,r=this._selection.startLineNumber!==this._selection.endLineNumber;if(!i&&this._overtypingCapturer){const s=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);s&&(i=s.value,r=s.multiline)}if(i&&r&&e.snippet){const s=this._model.getLineContent(this._selection.startLineNumber),o=Ji(s,0,this._selection.startColumn-1);let a=o;e.snippet.walk(c=>c===e?!1:(c instanceof Xc&&(a=Ji(om(c.value).pop())),!0));const l=Cb(a,o);i=i.replace(/(\r\n|\r|\n)(.*)/g,(c,u,d)=>`${u}${a.substr(l)}${d}`)}return i}else{if(t==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);if(t==="TM_CURRENT_WORD"){const i=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return i&&i.word||void 0}else{if(t==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);if(t==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);if(t==="CURSOR_INDEX")return String(this._selectionIdx);if(t==="CURSOR_NUMBER")return String(this._selectionIdx+1)}}}}class mxe{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return rb(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=rb(this._model.uri.fsPath),r=i.lastIndexOf(".");return r<=0?i:i.slice(0,r)}else{if(t==="TM_DIRECTORY")return I4e(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(mW(this._model.uri));if(t==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);if(t==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}}}class _xe{constructor(e,t,i,r){this._readClipboardText=e,this._selectionIdx=t,this._selectionCount=i,this._spread=r}resolve(e){if(e.name!=="CLIPBOARD")return;const t=this._readClipboardText();if(t){if(this._spread){const i=t.split(/\r\n|\n|\r/).filter(r=>!$4e(r));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let j9=class{constructor(e,t,i){this._model=e,this._selection=t,this._languageConfigurationService=i}resolve(e){const{name:t}=e,i=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),r=this._languageConfigurationService.getLanguageConfiguration(i).comments;if(r){if(t==="LINE_COMMENT")return r.lineCommentToken||void 0;if(t==="BLOCK_COMMENT_START")return r.blockCommentStartToken||void 0;if(t==="BLOCK_COMMENT_END")return r.blockCommentEndToken||void 0}}};j9=w8t([C8t(2,Zr)],j9);class My{constructor(){this._date=new Date}static{this.dayNames=[w("Sunday","Sunday"),w("Monday","Monday"),w("Tuesday","Tuesday"),w("Wednesday","Wednesday"),w("Thursday","Thursday"),w("Friday","Friday"),w("Saturday","Saturday")]}static{this.dayNamesShort=[w("SundayShort","Sun"),w("MondayShort","Mon"),w("TuesdayShort","Tue"),w("WednesdayShort","Wed"),w("ThursdayShort","Thu"),w("FridayShort","Fri"),w("SaturdayShort","Sat")]}static{this.monthNames=[w("January","January"),w("February","February"),w("March","March"),w("April","April"),w("May","May"),w("June","June"),w("July","July"),w("August","August"),w("September","September"),w("October","October"),w("November","November"),w("December","December")]}static{this.monthNamesShort=[w("JanuaryShort","Jan"),w("FebruaryShort","Feb"),w("MarchShort","Mar"),w("AprilShort","Apr"),w("MayShort","May"),w("JuneShort","Jun"),w("JulyShort","Jul"),w("AugustShort","Aug"),w("SeptemberShort","Sep"),w("OctoberShort","Oct"),w("NovemberShort","Nov"),w("DecemberShort","Dec")]}resolve(e){const{name:t}=e;if(t==="CURRENT_YEAR")return String(this._date.getFullYear());if(t==="CURRENT_YEAR_SHORT")return String(this._date.getFullYear()).slice(-2);if(t==="CURRENT_MONTH")return String(this._date.getMonth().valueOf()+1).padStart(2,"0");if(t==="CURRENT_DATE")return String(this._date.getDate().valueOf()).padStart(2,"0");if(t==="CURRENT_HOUR")return String(this._date.getHours().valueOf()).padStart(2,"0");if(t==="CURRENT_MINUTE")return String(this._date.getMinutes().valueOf()).padStart(2,"0");if(t==="CURRENT_SECOND")return String(this._date.getSeconds().valueOf()).padStart(2,"0");if(t==="CURRENT_DAY_NAME")return My.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return My.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return My.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return My.monthNamesShort[this._date.getMonth()];if(t==="CURRENT_SECONDS_UNIX")return String(Math.floor(this._date.getTime()/1e3));if(t==="CURRENT_TIMEZONE_OFFSET"){const i=this._date.getTimezoneOffset(),r=i>0?"-":"+",s=Math.trunc(Math.abs(i/60)),o=s<10?"0"+s:s,a=Math.abs(i)-s*60,l=a<10?"0"+a:a;return r+o+":"+l}}}class vxe{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=aSt(this._workspaceService.getWorkspace());if(!sSt(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(hQ(e))return rb(e.uri.path);let t=rb(e.configPath.path);return t.endsWith(fQ)&&(t=t.substr(0,t.length-fQ.length-1)),t}_resoveWorkspacePath(e){if(hQ(e))return fxe(e.uri.fsPath);const t=rb(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?fxe(i):"/"}}class bxe{resolve(e){const{name:t}=e;if(t==="RANDOM")return Math.random().toString().slice(-6);if(t==="RANDOM_HEX")return Math.random().toString(16).slice(-6);if(t==="UUID")return aH()}}var x8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},S8t=function(n,e){return function(t,i){e(t,i,n)}},If;class Ih{static{this._decor={active:un.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:un.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:un.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:un.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})}}constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=Eve(t.placeholders,Nd.compareByIndex),this._placeholderGroupsIdx=-1}initialize(e){this._offset=e.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const e=this._editor.getModel();this._editor.changeDecorations(t=>{for(const i of this._snippet.placeholders){const r=this._snippet.offset(i),s=this._snippet.fullLen(i),o=$.fromPositions(e.getPositionAt(this._offset+r),e.getPositionAt(this._offset+r+s)),a=i.isFinalTabstop?Ih._decor.inactiveFinal:Ih._decor.inactive,l=t.addDecoration(o,a);this._placeholderDecorations.set(i,l)}})}move(e){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){const r=[];for(const s of this._placeholderGroups[this._placeholderGroupsIdx])if(s.transform){const o=this._placeholderDecorations.get(s),a=this._editor.getModel().getDecorationRange(o),l=this._editor.getModel().getValueInRange(a),c=s.transform.resolve(l).split(/\r\n|\r|\n/);for(let u=1;u0&&this._editor.executeEdits("snippet.placeholderTransform",r)}let t=!1;e===!0&&this._placeholderGroupsIdx0&&(this._placeholderGroupsIdx-=1,t=!0);const i=this._editor.getModel().changeDecorations(r=>{const s=new Set,o=[];for(const a of this._placeholderGroups[this._placeholderGroupsIdx]){const l=this._placeholderDecorations.get(a),c=this._editor.getModel().getDecorationRange(l);o.push(new yt(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),r.changeDecorationOptions(l,a.isFinalTabstop?Ih._decor.activeFinal:Ih._decor.active),s.add(a);for(const u of this._snippet.enclosingPlaceholders(a)){const d=this._placeholderDecorations.get(u);r.changeDecorationOptions(d,u.isFinalTabstop?Ih._decor.activeFinal:Ih._decor.active),s.add(u)}}for(const[a,l]of this._placeholderDecorations)s.has(a)||r.changeDecorationOptions(l,a.isFinalTabstop?Ih._decor.inactiveFinal:Ih._decor.inactive);return o});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof Nd){const i=this._placeholderDecorations.get(t);if(this._editor.getModel().getDecorationRange(i).isEmpty()&&t.toString().length>0)return!0}t=t.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||this._placeholderGroups.length===0}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(this._snippet.placeholders.length===0)return!0;if(this._snippet.placeholders.length===1){const[e]=this._snippet.placeholders;if(e.isFinalTabstop&&this._snippet.rightMostDescendant===e)return!0}return!1}computePossibleSelections(){const e=new Map;for(const t of this._placeholderGroups){let i;for(const r of t){if(r.isFinalTabstop)break;i||(i=[],e.set(r.index,i));const s=this._placeholderDecorations.get(r),o=this._editor.getModel().getDecorationRange(s);if(!o){e.delete(r.index);break}i.push(o)}}return e}get activeChoice(){if(!this._placeholderDecorations)return;const e=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!e?.choice)return;const t=this._placeholderDecorations.get(e);if(!t)return;const i=this._editor.getModel().getDecorationRange(t);if(i)return{range:i,choice:e.choice}}get hasChoice(){let e=!1;return this._snippet.walk(t=>(e=t instanceof p2,!e)),e}merge(e){const t=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(i=>{for(const r of this._placeholderGroups[this._placeholderGroupsIdx]){const s=e.shift();console.assert(s._offset!==-1),console.assert(!s._placeholderDecorations);const o=s._snippet.placeholderInfo.last.index;for(const l of s._snippet.placeholderInfo.all)l.isFinalTabstop?l.index=r.index+(o+1)/this._nestingLevel:l.index=r.index+l.index/this._nestingLevel;this._snippet.replace(r,s._snippet.children);const a=this._placeholderDecorations.get(r);i.removeDecoration(a),this._placeholderDecorations.delete(r);for(const l of s._snippet.placeholders){const c=s._snippet.offset(l),u=s._snippet.fullLen(l),d=$.fromPositions(t.getPositionAt(s._offset+c),t.getPositionAt(s._offset+c+u)),h=i.addDecoration(d,Ih._decor.inactive);this._placeholderDecorations.set(l,h)}}this._placeholderGroups=Eve(this._snippet.placeholders,Nd.compareByIndex)})}}const yxe={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let q9=If=class{static adjustWhitespace(e,t,i,r,s){const o=e.getLineContent(t.lineNumber),a=Ji(o,0,t.column-1);let l;return r.walk(c=>{if(!(c instanceof Xc)||c.parent instanceof p2||s&&!s.has(c))return!0;const u=c.value.split(/\r\n|\r|\n/);if(i){const h=r.offset(c);if(h===0)u[0]=e.normalizeIndentation(u[0]);else{l=l??r.toString();const f=l.charCodeAt(h-1);(f===10||f===13)&&(u[0]=e.normalizeIndentation(a+u[0]))}for(let f=1;fC.get(Mw)),g=e.invokeWithinContext(C=>new mxe(C.get(pE),h)),p=()=>a,m=h.getValueInRange(If.adjustSelection(h,e.getSelection(),i,0)),_=h.getValueInRange(If.adjustSelection(h,e.getSelection(),0,r)),v=h.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),y=e.getSelections().map((C,x)=>({selection:C,idx:x})).sort((C,x)=>$.compareRangesUsingStarts(C.selection,x.selection));for(const{selection:C,idx:x}of y){let k=If.adjustSelection(h,C,i,0),L=If.adjustSelection(h,C,0,r);m!==h.getValueInRange(k)&&(k=C),_!==h.getValueInRange(L)&&(L=C);const D=C.setStartPosition(k.startLineNumber,k.startColumn).setEndPosition(L.endLineNumber,L.endColumn),I=new zw().parse(t,!0,s),O=D.getStartPosition(),M=If.adjustWhitespace(h,O,o||x>0&&v!==h.getLineFirstNonWhitespaceColumn(C.positionLineNumber),I);I.resolveVariables(new gxe([g,new _xe(p,x,y.length,e.getOption(79)==="spread"),new pxe(h,C,x,l),new j9(h,C,c),new My,new vxe(f),new bxe])),u[x]=jr.replace(D,I.toString()),u[x].identifier={major:x,minor:0},u[x]._isTracked=!0,d[x]=new Ih(e,I,M)}return{edits:u,snippets:d}}static createEditsAndSnippetsFromEdits(e,t,i,r,s,o,a){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};const l=[],c=e.getModel(),u=new zw,d=new CO,h=new gxe([e.invokeWithinContext(g=>new mxe(g.get(pE),c)),new _xe(()=>s,0,e.getSelections().length,e.getOption(79)==="spread"),new pxe(c,e.getSelection(),0,o),new j9(c,e.getSelection(),a),new My,new vxe(e.invokeWithinContext(g=>g.get(Mw))),new bxe]);t=t.sort((g,p)=>$.compareRangesUsingStarts(g.range,p.range));let f=0;for(let g=0;g0){const x=t[g-1].range,k=$.fromPositions(x.getEndPosition(),p.getStartPosition()),L=new Xc(c.getValueInRange(k));d.appendChild(L),f+=L.value.length}const _=u.parseFragment(m,d);If.adjustWhitespace(c,p.getStartPosition(),!0,d,new Set(_)),d.resolveVariables(h);const v=d.toString(),y=v.slice(f);f=v.length;const C=jr.replace(p,y);C.identifier={major:g,minor:0},C._isTracked=!0,l.push(C)}return u.ensureFinalTabstop(d,i,!0),{edits:l,snippets:[new Ih(e,d,"")]}}constructor(e,t,i=yxe,r){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=r,this._templateMerges=[],this._snippets=[]}dispose(){er(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(){if(!this._editor.hasModel())return;const{edits:e,snippets:t}=typeof this._template=="string"?If.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):If.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=t,this._editor.executeEdits("snippet",e,i=>{const r=i.filter(s=>!!s.identifier);for(let s=0;syt.fromPositions(s.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=yxe){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:r}=If.createEditsAndSnippetsFromSelections(this._editor,e,t.overwriteBefore,t.overwriteAfter,!0,t.adjustWhitespace,t.clipboardText,t.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",i,s=>{const o=s.filter(l=>!!l.identifier);for(let l=0;lyt.fromPositions(l.range.getEndPosition()))})}next(){const e=this._move(!0);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}prev(){const e=this._move(!1);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}_move(e){const t=[];for(const i of this._snippets){const r=i.move(e);t.push(...r)}return t}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;const e=this._editor.getSelections();if(e.length{s.push(...r.get(o))})}e.sort($.compareRangesUsingStarts);for(const[i,r]of t){if(r.length!==e.length){t.delete(i);continue}r.sort($.compareRangesUsingStarts);for(let s=0;s0}};q9=If=x8t([S8t(3,Zr)],q9);var k8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},y3=function(n,e){return function(t,i){e(t,i,n)}},Jx;const wxe={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let Kl=class{static{Jx=this}static{this.ID="snippetController2"}static get(e){return e.getContribution(Jx.ID)}static{this.InSnippetMode=new et("inSnippetMode",!1,w("inSnippetMode","Whether the editor in current in snippet mode"))}static{this.HasNextTabstop=new et("hasNextTabstop",!1,w("hasNextTabstop","Whether there is a next tab stop when in snippet mode"))}static{this.HasPrevTabstop=new et("hasPrevTabstop",!1,w("hasPrevTabstop","Whether there is a previous tab stop when in snippet mode"))}constructor(e,t,i,r,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._snippetListener=new ke,this._modelVersionId=-1,this._inSnippet=Jx.InSnippetMode.bindTo(r),this._hasNextTabstop=Jx.HasNextTabstop.bindTo(r),this._hasPrevTabstop=Jx.HasPrevTabstop.bindTo(r)}dispose(){this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._session?.dispose(),this._snippetListener.dispose()}insert(e,t){try{this._doInsert(e,typeof t>"u"?wxe:{...wxe,...t})}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",e),this._logService.error("existing_template=",this._session?this._session._logInfo():"")}}_doInsert(e,t){if(this._editor.hasModel()){if(this._snippetListener.clear(),t.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&typeof e!="string"&&this.cancel(),this._session?(oi(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new q9(this._editor,e,t,this._languageConfigurationService),this._session.insert()),t.undoStopAfter&&this._editor.getModel().pushStackElement(),this._session?.hasChoice){const i={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(c,u)=>{if(!this._session||c!==this._editor.getModel()||!he.equals(this._editor.getPosition(),u))return;const{activeChoice:d}=this._session;if(!d||d.choice.options.length===0)return;const h=c.getValueInRange(d.range),f=!!d.choice.options.find(p=>p.value===h),g=[];for(let p=0;p{s?.dispose(),o=!1},l=()=>{o||(s=this._languageFeaturesService.completionProvider.register({language:r.getLanguageId(),pattern:r.uri.fsPath,scheme:r.uri.scheme,exclusive:!0},i),this._snippetListener.add(s),o=!0)};this._choiceCompletions={provider:i,enable:l,disable:a}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(i=>i.isFlush&&this.cancel())),this._snippetListener.add(this._editor.onDidChangeModel(()=>this.cancel())),this._snippetListener.add(this._editor.onDidChangeCursorSelection(()=>this._updateState()))}}_updateState(){if(!(!this._session||!this._editor.hasModel())){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0;return}const{activeChoice:e}=this._session;if(!e||!this._choiceCompletions){this._choiceCompletions?.disable(),this._currentChoice=void 0;return}this._currentChoice!==e.choice&&(this._currentChoice=e.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{y8t(this._editor,this._choiceCompletions.provider)}))}finish(){for(;this._inSnippet.get();)this.next()}cancel(e=!1){this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,this._session?.dispose(),this._session=void 0,this._modelVersionId=-1,e&&this._editor.setSelections([this._editor.getSelection()])}prev(){this._session?.prev(),this._updateState()}next(){this._session?.next(),this._updateState()}isInSnippet(){return!!this._inSnippet.get()}};Kl=Jx=k8t([y3(1,Da),y3(2,dt),y3(3,jt),y3(4,Zr)],Kl);Zn(Kl.ID,Kl,4);const bH=fo.bindToContribution(Kl.get);Je(new bH({id:"jumpToNextSnippetPlaceholder",precondition:Le.and(Kl.InSnippetMode,Kl.HasNextTabstop),handler:n=>n.next(),kbOpts:{weight:130,kbExpr:Q.textInputFocus,primary:2}}));Je(new bH({id:"jumpToPrevSnippetPlaceholder",precondition:Le.and(Kl.InSnippetMode,Kl.HasPrevTabstop),handler:n=>n.prev(),kbOpts:{weight:130,kbExpr:Q.textInputFocus,primary:1026}}));Je(new bH({id:"leaveSnippet",precondition:Kl.InSnippetMode,handler:n=>n.cancel(!0),kbOpts:{weight:130,kbExpr:Q.textInputFocus,primary:9,secondary:[1033]}}));Je(new bH({id:"acceptSnippet",precondition:Kl.InSnippetMode,handler:n=>n.finish()}));var E8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Xq=function(n,e){return function(t,i){e(t,i,n)}};let ate=class extends me{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(e,t,i,r,s,o,a,l,c,u,d,h){super(),this.textModel=e,this.selectedSuggestItem=t,this._textModelVersionId=i,this._positions=r,this._debounceValue=s,this._suggestPreviewEnabled=o,this._suggestPreviewMode=a,this._inlineSuggestMode=l,this._enabled=c,this._instantiationService=u,this._commandService=d,this._languageConfigurationService=h,this._source=this._register(this._instantiationService.createInstance(ote,this.textModel,this._textModelVersionId,this._debounceValue)),this._isActive=Sn(this,!1),this._forceUpdateExplicitlySignal=r2(this),this._selectedInlineCompletionId=Sn(this,void 0),this._primaryPosition=St(this,g=>this._positions.read(g)[0]??new he(1,1)),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([qm.Redo,qm.Undo,qm.AcceptWord]),this._fetchInlineCompletionsPromise=u5e({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:gg.Automatic}),handleChange:(g,p)=>(g.didChange(this._textModelVersionId)&&this._preserveCurrentCompletionReasons.has(this._getReason(g.change))?p.preserveCurrentCompletion=!0:g.didChange(this._forceUpdateExplicitlySignal)&&(p.inlineCompletionTriggerKind=gg.Explicit),!0)},(g,p)=>{if(this._forceUpdateExplicitlySignal.read(g),!(this._enabled.read(g)&&this.selectedSuggestItem.read(g)||this._isActive.read(g))){this._source.cancelUpdate();return}this._textModelVersionId.read(g);const _=this._source.suggestWidgetInlineCompletions.get(),v=this.selectedSuggestItem.read(g);if(_&&!v){const L=this._source.inlineCompletions.get();qr(D=>{(!L||_.request.versionId>L.request.versionId)&&this._source.inlineCompletions.set(_.clone(),D),this._source.clearSuggestWidgetInlineCompletions(D)})}const y=this._primaryPosition.read(g),C={triggerKind:p.inlineCompletionTriggerKind,selectedSuggestionInfo:v?.toSelectedSuggestionInfo()},x=this.selectedInlineCompletion.get(),k=p.preserveCurrentCompletion||x?.forwardStable?x:void 0;return this._source.fetch(y,C,k)}),this._filteredInlineCompletionItems=$u({owner:this,equalsFn:k8()},g=>{const p=this._source.inlineCompletions.read(g);if(!p)return[];const m=this._primaryPosition.read(g);return p.inlineCompletions.filter(v=>v.isVisible(this.textModel,m,g))}),this.selectedInlineCompletionIndex=St(this,g=>{const p=this._selectedInlineCompletionId.read(g),m=this._filteredInlineCompletionItems.read(g),_=this._selectedInlineCompletionId===void 0?-1:m.findIndex(v=>v.semanticId===p);return _===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):_}),this.selectedInlineCompletion=St(this,g=>{const p=this._filteredInlineCompletionItems.read(g),m=this.selectedInlineCompletionIndex.read(g);return p[m]}),this.activeCommands=$u({owner:this,equalsFn:k8()},g=>this.selectedInlineCompletion.read(g)?.inlineCompletion.source.inlineCompletions.commands??[]),this.lastTriggerKind=this._source.inlineCompletions.map(this,g=>g?.request.context.triggerKind),this.inlineCompletionsCount=St(this,g=>{if(this.lastTriggerKind.read(g)===gg.Explicit)return this._filteredInlineCompletionItems.read(g).length}),this.state=$u({owner:this,equalsFn:(g,p)=>!g||!p?g===p:ixe(g.ghostTexts,p.ghostTexts)&&g.inlineCompletion===p.inlineCompletion&&g.suggestItem===p.suggestItem},g=>{const p=this.textModel,m=this.selectedSuggestItem.read(g);if(m){const _=ow(m.toSingleTextEdit(),p),v=this._computeAugmentation(_,g);if(!this._suggestPreviewEnabled.read(g)&&!v)return;const C=v?.edit??_,x=v?v.edit.text.length-_.text.length:0,k=this._suggestPreviewMode.read(g),L=this._positions.read(g),D=[C,...Qq(this.textModel,L,C)],I=D.map((M,B)=>lxe(M,p,k,L[B],x)).filter(Bp),O=I[0]??new fR(C.range.endLineNumber,[]);return{edits:D,primaryGhostText:O,ghostTexts:I,inlineCompletion:v?.completion,suggestItem:m}}else{if(!this._isActive.read(g))return;const _=this.selectedInlineCompletion.read(g);if(!_)return;const v=_.toSingleTextEdit(g),y=this._inlineSuggestMode.read(g),C=this._positions.read(g),x=[v,...Qq(this.textModel,C,v)],k=x.map((L,D)=>lxe(L,p,y,C[D],0)).filter(Bp);return k[0]?{edits:x,primaryGhostText:k[0],ghostTexts:k,inlineCompletion:_,suggestItem:void 0}:void 0}}),this.ghostTexts=$u({owner:this,equalsFn:ixe},g=>{const p=this.state.read(g);if(p)return p.ghostTexts}),this.primaryGhostText=$u({owner:this,equalsFn:aBe},g=>{const p=this.state.read(g);if(p)return p?.primaryGhostText}),this._register(s2(this._fetchInlineCompletionsPromise));let f;this._register(tn(g=>{const m=this.state.read(g)?.inlineCompletion;if(m?.semanticId!==f?.semanticId&&(f=m,m)){const _=m.inlineCompletion,v=_.source;v.provider.handleItemDidShow?.(v.inlineCompletions,_.sourceInlineCompletion,_.insertText)}}))}_getReason(e){return e?.isUndoing?qm.Undo:e?.isRedoing?qm.Redo:this.isAcceptingPartially?qm.AcceptWord:qm.Other}async trigger(e){this._isActive.set(!0,e),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e){Fw(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineCompletionsPromise.get()}stop(e){Fw(e,t=>{this._isActive.set(!1,t),this._source.clear(t)})}_computeAugmentation(e,t){const i=this.textModel,r=this._source.suggestWidgetInlineCompletions.read(t),s=r?r.inlineCompletions:[this.selectedInlineCompletion.read(t)].filter(Bp);return Fbt(s,a=>{let l=a.toSingleTextEdit(t);return l=ow(l,i,$.fromPositions(l.range.getStartPosition(),e.range.getEndPosition())),dBe(l,e)?{completion:a,edit:l}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._filteredInlineCompletionItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(e){if(e.getModel()!==this.textModel)throw new fi;const t=this.state.get();if(!t||t.primaryGhostText.isEmpty()||!t.inlineCompletion)return;const i=t.inlineCompletion.toInlineCompletion(void 0);if(i.command&&i.source.addRef(),e.pushUndoStop(),i.snippetInfo)e.executeEdits("inlineSuggestion.accept",[jr.replace(i.range,""),...i.additionalTextEdits]),e.setPosition(i.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),Kl.get(e)?.insert(i.snippetInfo.snippet,{undoStopBefore:!1});else{const r=t.edits,s=Cxe(r).map(o=>yt.fromPositions(o));e.executeEdits("inlineSuggestion.accept",[...r.map(o=>jr.replace(o.range,o.text)),...i.additionalTextEdits]),e.setSelections(s,"inlineCompletionAccept")}this.stop(),i.command&&(await this._commandService.executeCommand(i.command.id,...i.command.arguments||[]).then(void 0,vs),i.source.removeRef())}async acceptNextWord(e){await this._acceptNext(e,(t,i)=>{const r=this.textModel.getLanguageIdAtPosition(t.lineNumber,t.column),s=this._languageConfigurationService.getLanguageConfiguration(r),o=new RegExp(s.wordDefinition.source,s.wordDefinition.flags.replace("g","")),a=i.match(o);let l=0;a&&a.index!==void 0?a.index===0?l=a[0].length:l=a.index:l=i.length;const u=/\s+/g.exec(i);return u&&u.index!==void 0&&u.index+u[0].length{const r=i.match(/\n/);return r&&r.index!==void 0?r.index+1:i.length},1)}async _acceptNext(e,t,i){if(e.getModel()!==this.textModel)throw new fi;const r=this.state.get();if(!r||r.primaryGhostText.isEmpty()||!r.inlineCompletion)return;const s=r.primaryGhostText,o=r.inlineCompletion.toInlineCompletion(void 0);if(o.snippetInfo||o.filterText!==o.insertText){await this.accept(e);return}const a=s.parts[0],l=new he(s.lineNumber,a.column),c=a.text,u=t(l,c);if(u===c.length&&s.parts.length===1){this.accept(e);return}const d=c.substring(0,u),h=this._positions.get(),f=h[0];o.source.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const g=$.fromPositions(f,l),p=e.getModel().getValueInRange(g)+d,m=new Yp(g,p),_=[m,...Qq(this.textModel,h,m)],v=Cxe(_).map(y=>yt.fromPositions(y));e.executeEdits("inlineSuggestion.accept",_.map(y=>jr.replace(y.range,y.text))),e.setSelections(v,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1)}finally{this._isAcceptingPartially=!1}if(o.source.provider.handlePartialAccept){const g=$.fromPositions(o.range.getStartPosition(),_c.ofText(d).addToPosition(l)),p=e.getModel().getValueInRange(g,1);o.source.provider.handlePartialAccept(o.source.inlineCompletions,o.sourceInlineCompletion,p.length,{kind:i})}}finally{o.source.removeRef()}}handleSuggestAccepted(e){const t=ow(e.toSingleTextEdit(),this.textModel),i=this._computeAugmentation(t,void 0);if(!i)return;const r=i.completion.inlineCompletion;r.source.provider.handlePartialAccept?.(r.source.inlineCompletions,r.sourceInlineCompletion,t.text.length,{kind:2})}};ate=E8t([Xq(9,Tt),Xq(10,_r),Xq(11,Zr)],ate);var qm;(function(n){n[n.Undo=0]="Undo",n[n.Redo=1]="Redo",n[n.AcceptWord=2]="AcceptWord",n[n.Other=3]="Other"})(qm||(qm={}));function Qq(n,e,t){if(e.length===1)return[];const i=e[0],r=e.slice(1),s=t.range.getStartPosition(),o=t.range.getEndPosition(),a=n.getValueInRange($.fromPositions(i,o)),l=rxe(i,s);if(l.lineNumber<1)return rn(new fi(`positionWithinTextEdit line number should be bigger than 0. - Invalid subtraction between ${i.toString()} and ${s.toString()}`)),[];const c=L8t(t.text,l);return r.map(u=>{const d=X6t(rxe(u,s),o),h=n.getValueInRange($.fromPositions(u,d)),f=Cb(a,h),g=$.fromPositions(u,u.delta(0,f));return new Yp(g,c)})}function L8t(n,e){let t="";const i=d_t(n);for(let r=e.lineNumber-1;rs.range,$.compareRangesUsingStarts)),i=new nle(e.apply(n)).getNewRanges();return e.inverse().apply(i).map(s=>s.getEndPosition())}var T8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},xxe=function(n,e){return function(t,i){e(t,i,n)}},$D;class ide{constructor(e){this.name=e}select(e,t,i){if(i.length===0)return 0;const r=i[0].score[0];for(let s=0;sl&&d.type===i[c].completion.kind&&d.insertText===i[c].completion.insertText&&(l=d.touch,a=c),i[c].completion.preselect&&o===-1)return o=c}return a!==-1?a:o!==-1?o:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();const t=0;for(const[i,r]of e)r.touch=t,r.type=typeof r.type=="number"?r.type:rN.fromString(r.type),this._cache.set(i,r);this._seq=this._cache.size}}class I8t extends ide{constructor(){super("recentlyUsedByPrefix"),this._trie=fk.forStrings(),this._seq=0}memorize(e,t,i){const{word:r}=e.getWordUntilPosition(t),s=`${e.getLanguageId()}/${r}`;this._trie.set(s,{type:i.completion.kind,insertText:i.completion.insertText,touch:this._seq++})}select(e,t,i){const{word:r}=e.getWordUntilPosition(t);if(!r)return super.select(e,t,i);const s=`${e.getLanguageId()}/${r}`;let o=this._trie.get(s);if(o||(o=this._trie.findSubstr(s)),o)for(let a=0;ae.push([i,t])),e.sort((t,i)=>-(t[1].touch-i[1].touch)).forEach((t,i)=>t[1].touch=i),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(const[t,i]of e)i.type=typeof i.type=="number"?i.type:rN.fromString(i.type),this._trie.set(t,i)}}}let lte=class{static{$D=this}static{this._strategyCtors=new Map([["recentlyUsedByPrefix",I8t],["recentlyUsed",D8t],["first",Sxe]])}static{this._storagePrefix="suggest/memories"}constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new ke,this._persistSoon=new Ui(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===AN.SHUTDOWN&&this._saveState()}))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(e,t,i){this._withStrategy(e,t).memorize(e,t,i),this._persistSoon.schedule()}select(e,t,i){return this._withStrategy(e,t).select(e,t,i)}_withStrategy(e,t){const i=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:e.getLanguageIdAtPosition(t.lineNumber,t.column),resource:e.uri});if(this._strategy?.name!==i){this._saveState();const r=$D._strategyCtors.get(i)||Sxe;this._strategy=new r;try{const o=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,a=this._storageService.get(`${$D._storagePrefix}/${i}`,o);a&&this._strategy.fromJSON(JSON.parse(a))}catch{}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${$D._storagePrefix}/${this._strategy.name}`,i,t,1)}}};lte=$D=T8t([xxe(0,pf),xxe(1,kn)],lte);const yH=On("ISuggestMemories");Vn(yH,lte,1);var A8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},N8t=function(n,e){return function(t,i){e(t,i,n)}},cte;let K9=class{static{cte=this}static{this.AtEnd=new et("atEndOfWord",!1)}constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=cte.AtEnd.bindTo(t),this._configListener=this._editor.onDidChangeConfiguration(i=>i.hasChanged(124)&&this._update()),this._update()}dispose(){this._configListener.dispose(),this._selectionListener?.dispose(),this._ckAtEnd.reset()}_update(){const e=this._editor.getOption(124)==="on";if(this._enabled!==e)if(this._enabled=e,this._enabled){const t=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}const i=this._editor.getModel(),r=this._editor.getSelection(),s=i.getWordAtPosition(r.getStartPosition());if(!s){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(s.endColumn===r.getStartPosition().column)};this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};K9=cte=A8t([N8t(1,jt)],K9);var R8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},P8t=function(n,e){return function(t,i){e(t,i,n)}},WD;let FE=class{static{WD=this}static{this.OtherSuggestions=new et("hasOtherSuggestions",!1)}constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=WD.OtherSuggestions.bindTo(t)}dispose(){this.reset()}reset(){this._ckOtherSuggestions.reset(),this._listener?.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:e,index:t},i){if(e.items.length===0){this.reset();return}if(WD._moveIndex(!0,e,t)===t){this.reset();return}this._acceptNext=i,this._model=e,this._index=t,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(e,t,i){let r=i;for(let s=t.items.length;s>0&&(r=(r+t.items.length+(e?1:-1))%t.items.length,!(r===i||!t.items[r].completion.additionalTextEdits));s--);return r}next(){this._move(!0)}prev(){this._move(!1)}_move(e){if(this._model)try{this._ignore=!0,this._index=WD._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};FE=WD=R8t([P8t(1,jt)],FE);class O8t{constructor(e,t,i,r){this._disposables=new ke,this._disposables.add(i.onDidSuggest(s=>{s.completionModel.items.length===0&&this.reset()})),this._disposables.add(i.onDidCancel(s=>{this.reset()})),this._disposables.add(t.onDidShow(()=>this._onItem(t.getFocusedItem()))),this._disposables.add(t.onDidFocus(this._onItem,this)),this._disposables.add(t.onDidHide(this.reset,this)),this._disposables.add(e.onWillType(s=>{if(this._active&&!t.isFrozen()&&i.state!==0){const o=s.charCodeAt(s.length-1);this._active.acceptCharacters.has(o)&&e.getOption(0)&&r(this._active.item)}}))}_onItem(e){if(!e||!bl(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new n8;for(const i of e.item.completion.commitCharacters)i.length>0&&t.add(i.charCodeAt(0));this._active={acceptCharacters:t,item:e}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}}class Ah{async provideSelectionRanges(e,t){const i=[];for(const r of t){const s=[];i.push(s);const o=new Map;await new Promise(a=>Ah._bracketsRightYield(a,0,e,r,o)),await new Promise(a=>Ah._bracketsLeftYield(a,0,e,r,o,s))}return i}static{this._maxDuration=30}static{this._maxRounds=2}static _bracketsRightYield(e,t,i,r,s){const o=new Map,a=Date.now();for(;;){if(t>=Ah._maxRounds){e();break}if(!r){e();break}const l=i.bracketPairs.findNextBracket(r);if(!l){e();break}if(Date.now()-a>Ah._maxDuration){setTimeout(()=>Ah._bracketsRightYield(e,t+1,i,r,s));break}if(l.bracketInfo.isOpeningBracket){const u=l.bracketInfo.bracketText,d=o.has(u)?o.get(u):0;o.set(u,d+1)}else{const u=l.bracketInfo.getOpeningBrackets()[0].bracketText;let d=o.has(u)?o.get(u):0;if(d-=1,o.set(u,Math.max(0,d)),d<0){let h=s.get(u);h||(h=new Rl,s.set(u,h)),h.push(l.range)}}r=l.range.getEndPosition()}}static _bracketsLeftYield(e,t,i,r,s,o){const a=new Map,l=Date.now();for(;;){if(t>=Ah._maxRounds&&s.size===0){e();break}if(!r){e();break}const c=i.bracketPairs.findPrevBracket(r);if(!c){e();break}if(Date.now()-l>Ah._maxDuration){setTimeout(()=>Ah._bracketsLeftYield(e,t+1,i,r,s,o));break}if(c.bracketInfo.isOpeningBracket){const d=c.bracketInfo.bracketText;let h=a.has(d)?a.get(d):0;if(h-=1,a.set(d,Math.max(0,h)),h<0){const f=s.get(d);if(f){const g=f.shift();f.size===0&&s.delete(d);const p=$.fromPositions(c.range.getEndPosition(),g.getStartPosition()),m=$.fromPositions(c.range.getStartPosition(),g.getEndPosition());o.push({range:p}),o.push({range:m}),Ah._addBracketLeading(i,m,o)}}}else{const d=c.bracketInfo.getOpeningBrackets()[0].bracketText,h=a.has(d)?a.get(d):0;a.set(d,h+1)}r=c.range.getStartPosition()}}static _addBracketLeading(e,t,i){if(t.startLineNumber===t.endLineNumber)return;const r=t.startLineNumber,s=e.getLineFirstNonWhitespaceColumn(r);s!==0&&s!==t.startColumn&&(i.push({range:$.fromPositions(new he(r,s),t.getEndPosition())}),i.push({range:$.fromPositions(new he(r,1),t.getEndPosition())}));const o=r-1;if(o>0){const a=e.getLineFirstNonWhitespaceColumn(o);a===t.startColumn&&a!==e.getLineLastNonWhitespaceColumn(o)&&(i.push({range:$.fromPositions(new he(o,a),t.getEndPosition())}),i.push({range:$.fromPositions(new he(o,1),t.getEndPosition())}))}}}class dp{static{this.None=new class extends dp{distance(){return 0}}}static async create(e,t){if(!t.getOption(119).localityBonus||!t.hasModel())return dp.None;const i=t.getModel(),r=t.getPosition();if(!e.canComputeWordRanges(i.uri))return dp.None;const[s]=await new Ah().provideSelectionRanges(i,[r]);if(s.length===0)return dp.None;const o=await e.computeWordRanges(i.uri,s[0].range);if(!o)return dp.None;const a=i.getWordUntilPosition(r);return delete o[a.word],new class extends dp{distance(l,c){if(!r.equals(t.getPosition()))return 0;if(c.kind===17)return 2<<20;const u=typeof c.label=="string"?c.label:c.label.label,d=o[u];if(s4e(d))return 2<<20;const h=JA(d,$.fromPositions(l),$.compareRangesUsingStarts),f=h>=0?d[h]:d[Math.max(0,~h-1)];let g=s.length;for(const p of s){if(!$.containsRange(p.range,f))break;g-=1}return g}}}}let kxe=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class yv{constructor(e,t,i,r,s,o,a=Lle.default,l=void 0){this.clipboardText=l,this._snippetCompareFn=yv._compareCompletionItems,this._items=e,this._column=t,this._wordDistance=r,this._options=s,this._refilterKind=1,this._lineContext=i,this._fuzzyScoreOptions=a,o==="top"?this._snippetCompareFn=yv._compareCompletionItemsSnippetsUp:o==="bottom"&&(this._snippetCompareFn=yv._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(e){(this._lineContext.leadingLineContent!==e.leadingLineContent||this._lineContext.characterCountDelta!==e.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta0&&i[0].container.incomplete&&e.add(t);return e}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const e=[],{leadingLineContent:t,characterCountDelta:i}=this._lineContext;let r="",s="";const o=this._refilterKind===1?this._items:this._filteredItems,a=[],l=!this._options.filterGraceful||o.length>2e3?Ow:DCt;for(let c=0;c=f)u.score=vg.Default;else if(typeof u.completion.filterText=="string"){const p=l(r,s,g,u.completion.filterText,u.filterTextLow,0,this._fuzzyScoreOptions);if(!p)continue;uX(u.completion.filterText,u.textLabel)===0?u.score=p:(u.score=kCt(r,s,g,u.textLabel,u.labelLow,0),u.score[0]=p[0])}else{const p=l(r,s,g,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!p)continue;u.score=p}}u.idx=c,u.distance=this._wordDistance.distance(u.position,u.completion),a.push(u),e.push(u.textLabel.length)}this._filteredItems=a.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?rZ(e.length-.85,e,(c,u)=>c-u):0}}static _compareCompletionItems(e,t){return e.score[0]>t.score[0]?-1:e.score[0]t.distance?1:e.idxt.idx?1:0}static _compareCompletionItemsSnippetsDown(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===27)return 1;if(t.completion.kind===27)return-1}return yv._compareCompletionItems(e,t)}static _compareCompletionItemsSnippetsUp(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===27)return-1;if(t.completion.kind===27)return 1}return yv._compareCompletionItems(e,t)}}var M8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},j0=function(n,e){return function(t,i){e(t,i,n)}},ute;class F1{static shouldAutoTrigger(e){if(!e.hasModel())return!1;const t=e.getModel(),i=e.getPosition();t.tokenization.tokenizeIfCheap(i.lineNumber);const r=t.getWordAtPosition(i);return!(!r||r.endColumn!==i.column&&r.startColumn+1!==i.column||!isNaN(Number(r.word)))}constructor(e,t,i){this.leadingLineContent=e.getLineContent(t.lineNumber).substr(0,t.column-1),this.leadingWord=e.getWordUntilPosition(t),this.lineNumber=t.lineNumber,this.column=t.column,this.triggerOptions=i}}function F8t(n,e,t){if(!e.getContextKeyValue(_l.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(_l.suppressSuggestions.key);return i!==void 0?!i:!n.getOption(62).suppressSuggestions}function B8t(n,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(_l.suppressSuggestions.key);return i!==void 0?!i:!n.getOption(62).suppressSuggestions}let G9=ute=class{constructor(e,t,i,r,s,o,a,l,c){this._editor=e,this._editorWorkerService=t,this._clipboardService=i,this._telemetryService=r,this._logService=s,this._contextKeyService=o,this._configurationService=a,this._languageFeaturesService=l,this._envService=c,this._toDispose=new ke,this._triggerCharacterListener=new ke,this._triggerQuickSuggest=new hf,this._triggerState=void 0,this._completionDisposables=new ke,this._onDidCancel=new fe,this._onDidTrigger=new fe,this._onDidSuggest=new fe,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new yt(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let u=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{u=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{u=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(d=>{u||this._onCursorChange(d)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!u&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){er(this._triggerCharacterListener),er([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(92)||!this._editor.hasModel()||!this._editor.getOption(122))return;const e=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const r of i.triggerCharacters||[]){let s=e.get(r);s||(s=new Set,e.set(r,s)),s.add(i)}const t=i=>{if(!B8t(this._editor,this._contextKeyService,this._configurationService)||F1.shouldAutoTrigger(this._editor))return;if(!i){const o=this._editor.getPosition();i=this._editor.getModel().getLineContent(o.lineNumber).substr(0,o.column-1)}let r="";Tw(i.charCodeAt(i.length-1))?Co(i.charCodeAt(i.length-2))&&(r=i.substr(i.length-2)):r=i.charAt(i.length-1);const s=e.get(r);if(s){const o=new Map;if(this._completionModel)for(const[a,l]of this._completionModel.getItemsByProvider())s.has(a)||o.set(a,l);this.trigger({auto:!0,triggerKind:1,triggerCharacter:r,retrigger:!!this._completionModel,clipboardText:this._completionModel?.clipboardText,completionOptions:{providerFilter:s,providerItemsToReuse:o}})}};this._triggerCharacterListener.add(this._editor.onDidType(t)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>t()))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(e=!1){this._triggerState!==void 0&&(this._triggerQuickSuggest.cancel(),this._requestToken?.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:e}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){this._triggerState!==void 0&&(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.cancel():this.trigger({auto:this._triggerState.auto,retrigger:!0}))}_onCursorChange(e){if(!this._editor.hasModel())return;const t=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!e.selection.isEmpty()||e.reason!==0&&e.reason!==3||e.source!=="keyboard"&&e.source!=="deleteLeft"){this.cancel();return}this._triggerState===void 0&&e.reason===0?(t.containsRange(this._currentSelection)||t.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():this._triggerState!==void 0&&e.reason===3&&this._refilterCompletionItems()}_onCompositionEnd(){this._triggerState===void 0?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){WS.isAllOff(this._editor.getOption(90))||this._editor.getOption(119).snippetsPreventQuickSuggestions&&Kl.get(this._editor)?.isInSnippet()||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!F1.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const e=this._editor.getModel(),t=this._editor.getPosition(),i=this._editor.getOption(90);if(!WS.isAllOff(i)){if(!WS.isAllOn(i)){e.tokenization.tokenizeIfCheap(t.lineNumber);const r=e.tokenization.getLineTokens(t.lineNumber),s=r.getStandardTokenType(r.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(WS.valueFor(i,s)!=="on")return}F8t(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(e)&&this.trigger({auto:!0})}},this._editor.getOption(91)))}_refilterCompletionItems(){oi(this._editor.hasModel()),oi(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new F1(e,t,{...this._triggerState,refilter:!0});this._onNewContext(i)}trigger(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=new F1(t,this._editor.getPosition(),e);this.cancel(e.retrigger),this._triggerState=e,this._onDidTrigger.fire({auto:e.auto,shy:e.shy??!1,position:this._editor.getPosition()}),this._context=i;let r={triggerKind:e.triggerKind??0};e.triggerCharacter&&(r={triggerKind:1,triggerCharacter:e.triggerCharacter}),this._requestToken=new Kr;const s=this._editor.getOption(113);let o=1;switch(s){case"top":o=0;break;case"bottom":o=2;break}const{itemKind:a,showDeprecated:l}=ute.createSuggestFilter(this._editor),c=new IO(o,e.completionOptions?.kindFilter??a,e.completionOptions?.providerFilter,e.completionOptions?.providerItemsToReuse,l),u=dp.create(this._editorWorkerService,this._editor),d=tde(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),c,r,this._requestToken.token);Promise.all([d,u]).then(async([h,f])=>{if(this._requestToken?.dispose(),!this._editor.hasModel())return;let g=e?.clipboardText;if(!g&&h.needsClipboard&&(g=await this._clipboardService.readText()),this._triggerState===void 0)return;const p=this._editor.getModel(),m=new F1(p,this._editor.getPosition(),e),_={...Lle.default,firstMatchCanBeWeak:!this._editor.getOption(119).matchOnWordStartOnly};if(this._completionModel=new yv(h.items,this._context.column,{leadingLineContent:m.leadingLineContent,characterCountDelta:m.column-this._context.column},f,this._editor.getOption(119),this._editor.getOption(113),_,g),this._completionDisposables.add(h.disposable),this._onNewContext(m),this._reportDurationsTelemetry(h.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const v of h.items)v.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${v.provider._debugDisplayName}`,v.completion)}).catch(rn)}_reportDurationsTelemetry(e){this._telemetryGate++%230===0&&setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(e)}),this._logService.debug("suggest.durations.json",e)})}static createSuggestFilter(e){const t=new Set;e.getOption(113)==="none"&&t.add(27);const r=e.getOption(119);return r.showMethods||t.add(0),r.showFunctions||t.add(1),r.showConstructors||t.add(2),r.showFields||t.add(3),r.showVariables||t.add(4),r.showClasses||t.add(5),r.showStructs||t.add(6),r.showInterfaces||t.add(7),r.showModules||t.add(8),r.showProperties||t.add(9),r.showEvents||t.add(10),r.showOperators||t.add(11),r.showUnits||t.add(12),r.showValues||t.add(13),r.showConstants||t.add(14),r.showEnums||t.add(15),r.showEnumMembers||t.add(16),r.showKeywords||t.add(17),r.showWords||t.add(18),r.showColors||t.add(19),r.showFiles||t.add(20),r.showReferences||t.add(21),r.showColors||t.add(22),r.showFolders||t.add(23),r.showTypeParameters||t.add(24),r.showSnippets||t.add(27),r.showUsers||t.add(25),r.showIssues||t.add(26),{itemKind:t,showDeprecated:r.showDeprecated}}_onNewContext(e){if(this._context){if(e.lineNumber!==this._context.lineNumber){this.cancel();return}if(Ji(e.leadingLineContent)!==Ji(this._context.leadingLineContent)){this.cancel();return}if(e.columnthis._context.leadingWord.startColumn){if(F1.shouldAutoTrigger(this._editor)&&this._context){const i=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:i}})}return}if(e.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&e.leadingWord.word.length!==0){const t=new Map,i=new Set;for(const[r,s]of this._completionModel.getItemsByProvider())s.length>0&&s[0].container.incomplete?i.add(r):t.set(r,s);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:i,providerItemsToReuse:t}})}else{const t=this._completionModel.lineContext;let i=!1;if(this._completionModel.lineContext={leadingLineContent:e.leadingLineContent,characterCountDelta:e.column-this._context.column},this._completionModel.items.length===0){const r=F1.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(r&&this._context.leadingWord.endColumn0,i&&e.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:e.triggerOptions,isFrozen:i})}}}}};G9=ute=M8t([j0(1,Oc),j0(2,b0),j0(3,Qa),j0(4,Da),j0(5,jt),j0(6,kn),j0(7,dt),j0(8,ole)],G9);class rde{static{this._maxSelectionLength=51200}constructor(e,t){this._disposables=new ke,this._lastOvertyped=[],this._locked=!1,this._disposables.add(e.onWillType(()=>{if(this._locked||!e.hasModel())return;const i=e.getSelections(),r=i.length;let s=!1;for(let a=0;arde._maxSelectionLength)return;this._lastOvertyped[a]={value:o.getValueInRange(l),multiline:l.startLineNumber!==l.endLineNumber}}})),this._disposables.add(t.onDidTrigger(i=>{this._locked=!0})),this._disposables.add(t.onDidCancel(i=>{this._locked=!1}))}getLastOvertypedInfo(e){if(e>=0&&e=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Jq=function(n,e){return function(t,i){e(t,i,n)}};let dte=class{constructor(e,t,i,r,s){this._menuId=t,this._menuService=r,this._contextKeyService=s,this._menuDisposables=new ke,this.element=Ne(e,qe(".suggest-status-bar"));const o=a=>a instanceof ou?i.createInstance(Wle,a,{useComma:!0}):void 0;this._leftActions=new ed(this.element,{actionViewItemProvider:o}),this._rightActions=new ed(this.element,{actionViewItemProvider:o}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const e=this._menuService.createMenu(this._menuId,this._contextKeyService),t=()=>{const i=[],r=[];for(const[s,o]of e.getActions())s==="left"?i.push(...o):r.push(...o);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(r)};this._menuDisposables.add(e.onDidChange(()=>t())),this._menuDisposables.add(e)}hide(){this._menuDisposables.clear()}};dte=$8t([Jq(2,Tt),Jq(3,ld),Jq(4,jt)],dte);var W8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},H8t=function(n,e){return function(t,i){e(t,i,n)}};function sde(n){return!!n&&!!(n.completion.documentation||n.completion.detail&&n.completion.detail!==n.completion.label)}let hte=class{constructor(e,t){this._editor=e,this._onDidClose=new fe,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new fe,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new ke,this._renderDisposeable=new ke,this._borderWidth=1,this._size=new vi(330,0),this.domNode=qe(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(Q_,{editor:e}),this._body=qe(".body"),this._scrollbar=new tO(this._body,{alwaysConsumeMouseWheel:!0}),Ne(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Ne(this._body,qe(".header")),this._close=Ne(this._header,qe("span"+zt.asCSSSelector(ze.close))),this._close.title=w("details.close","Close"),this._type=Ne(this._header,qe("p.type")),this._docs=Ne(this._body,qe("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(50)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const e=this._editor.getOptions(),t=e.get(50),i=t.getMassagedFontFamily(),r=e.get(120)||t.fontSize,s=e.get(121)||t.lineHeight,o=t.fontWeight,a=`${r}px`,l=`${s}px`;this.domNode.style.fontSize=a,this.domNode.style.lineHeight=`${s/r}`,this.domNode.style.fontWeight=o,this.domNode.style.fontFeatureSettings=t.fontFeatureSettings,this._type.style.fontFamily=i,this._close.style.height=l,this._close.style.width=l}getLayoutInfo(){const e=this._editor.getOption(121)||this._editor.getOption(50).lineHeight,t=this._borderWidth,i=t*2;return{lineHeight:e,borderWidth:t,borderHeight:i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=w("loading","Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(e,t){this._renderDisposeable.clear();let{detail:i,documentation:r}=e.completion;if(t){let s="";s+=`score: ${e.score[0]} +`)}withRange(e){return new ste(this.filterText,this.command,e,this.insertText,this.snippetInfo,this.additionalTextEdits,this.sourceInlineCompletion,this.source)}hash(){return JSON.stringify({insertText:this.insertText,range:this.range.toString()})}toSingleTextEdit(){return new Yp(this.range,this.insertText)}};function a8t(n,e){const t=e.getWordAtPosition(n),i=e.getLineMaxColumn(n.lineNumber);return t?new $(n.lineNumber,t.startColumn,n.lineNumber,i):$.fromPositions(n,n.with(void 0,i))}function axe(n,e,t,i){const s=t.getLineContent(e.lineNumber).substring(0,e.column-1)+n,a=t.tokenization.tokenizeLineWithEdit(e,s.length-(e.column-1),n)?.sliceAndInflate(e.column-1,s.length,0);return a?n8t(a,i):n}function ow(n,e,t){const i=t?n.range.intersectRanges(t):n.range;if(!i)return n;const r=e.getValueInRange(i,1),s=Cb(r,n.text),o=_c.ofText(r.substring(0,s)).addToPosition(n.range.getStartPosition()),a=n.text.substring(s),l=$.fromPositions(o,n.range.getEndPosition());return new Yp(l,a)}function dBe(n,e){return n.text.startsWith(e.text)&&l8t(n.range,e.range)}function lxe(n,e,t,i,r=0){let s=ow(n,e);if(s.range.endLineNumber!==s.range.startLineNumber)return;const o=e.getLineContent(s.range.startLineNumber),a=Ji(o).length;if(s.range.startColumn-1<=a){const g=Ji(s.text).length,p=o.substring(s.range.startColumn-1,a),[m,_]=[s.range.getStartPosition(),s.range.getEndPosition()],v=m.column+p.length<=_.column?m.delta(0,p.length):_,y=$.fromPositions(v,_),C=s.text.startsWith(p)?s.text.substring(p.length):s.text.substring(g);s=new Yp(y,C)}const c=e.getValueInRange(s.range),u=c8t(c,s.text);if(!u)return;const d=s.range.startLineNumber,h=new Array;if(t==="prefix"){const g=u.filter(p=>p.originalLength===0);if(g.length>1||g.length===1&&g[0].originalStart!==c.length)return}const f=s.text.length-r;for(const g of u){const p=s.range.startColumn+g.originalStart+g.originalLength;if(t==="subwordSmart"&&i&&i.lineNumber===s.range.startLineNumber&&p0)return;if(g.modifiedLength===0)continue;const m=g.modifiedStart+g.modifiedLength,_=Math.max(g.modifiedStart,Math.min(m,f)),v=s.text.substring(g.modifiedStart,_),y=s.text.substring(_,Math.max(g.modifiedStart,m));v.length>0&&h.push(new U9(p,v,!1)),y.length>0&&h.push(new U9(p,y,!0))}return new fR(d,h)}function l8t(n,e){return e.getStartPosition().equals(n.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(n.getEndPosition())}let b3;function c8t(n,e){if(b3?.originalValue===n&&b3?.newValue===e)return b3?.changes;{let t=uxe(n,e,!0);if(t){const i=cxe(t);if(i>0){const r=uxe(n,e,!1);r&&cxe(r)5e3||e.length>5e3)return;function i(c){let u=0;for(let d=0,h=c.length;du&&(u=f)}return u}const r=Math.max(i(n),i(e));function s(c){if(c<0)throw new Error("unexpected");return r+c+1}function o(c){let u=0,d=0;const h=new Int32Array(c.length);for(let f=0,g=c.length;fa},{getElements:()=>l}).ComputeDiff(!1).changes}var u8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},dxe=function(n,e){return function(t,i){e(t,i,n)}};let ote=class extends me{constructor(e,t,i,r,s){super(),this.textModel=e,this.versionId=t,this._debounceValue=i,this.languageFeaturesService=r,this.languageConfigurationService=s,this._updateOperation=this._register(new To),this.inlineCompletions=TN("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=TN("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent(()=>{this._updateOperation.clear()}))}fetch(e,t,i){const r=new h8t(e,t,this.textModel.getVersionId()),s=t.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if(this._updateOperation.value?.request.satisfies(r))return this._updateOperation.value.promise;if(s.get()?.request.satisfies(r))return Promise.resolve(!0);const o=!!this._updateOperation.value;this._updateOperation.clear();const a=new Kr,l=(async()=>{if((o||t.triggerKind===gg.Automatic)&&await d8t(this._debounceValue.get(this.textModel),a.token),a.token.isCancellationRequested||this._store.isDisposed||this.textModel.getVersionId()!==r.versionId)return!1;const d=new Date,h=await uBe(this.languageFeaturesService.inlineCompletionsProvider,e,this.textModel,t,a.token,this.languageConfigurationService);if(a.token.isCancellationRequested||this._store.isDisposed||this.textModel.getVersionId()!==r.versionId)return!1;const f=new Date;this._debounceValue.update(this.textModel,f.getTime()-d.getTime());const g=new g8t(h,r,this.textModel,this.versionId);if(i){const p=i.toInlineCompletion(void 0);i.canBeReused(this.textModel,e)&&!h.has(p)&&g.prepend(i.inlineCompletion,p.range,!0)}return this._updateOperation.clear(),qr(p=>{s.set(g,p)}),!0})(),c=new f8t(r,a,l);return this._updateOperation.value=c,l}clear(e){this._updateOperation.clear(),this.inlineCompletions.set(void 0,e),this.suggestWidgetInlineCompletions.set(void 0,e)}clearSuggestWidgetInlineCompletions(e){this._updateOperation.value?.request.context.selectedSuggestionInfo&&this._updateOperation.clear(),this.suggestWidgetInlineCompletions.set(void 0,e)}cancelUpdate(){this._updateOperation.clear()}};ote=u8t([dxe(3,dt),dxe(4,Zr)],ote);function d8t(n,e){return new Promise(t=>{let i;const r=setTimeout(()=>{i&&i.dispose(),t()},n);e&&(i=e.onCancellationRequested(()=>{clearTimeout(r),i&&i.dispose(),t()}))})}class h8t{constructor(e,t,i){this.position=e,this.context=t,this.versionId=i}satisfies(e){return this.position.equals(e.position)&&bQ(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,vSt())&&(e.context.triggerKind===gg.Automatic||this.context.triggerKind===gg.Explicit)&&this.versionId===e.versionId}}class f8t{constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class g8t{get inlineCompletions(){return this._inlineCompletions}constructor(e,t,i,r){this.inlineCompletionProviderResult=e,this.request=t,this._textModel=i,this._versionId=r,this._refCount=1,this._prependedInlineCompletionItems=[];const s=i.deltaDecorations([],e.completions.map(o=>({range:o.range,options:{description:"inline-completion-tracking-range"}})));this._inlineCompletions=e.completions.map((o,a)=>new hxe(o,s[a],this._textModel,this._versionId))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,this._refCount===0){setTimeout(()=>{this._textModel.isDisposed()||this._textModel.deltaDecorations(this._inlineCompletions.map(e=>e.decorationId),[])},0),this.inlineCompletionProviderResult.dispose();for(const e of this._prependedInlineCompletionItems)e.source.removeRef()}}prepend(e,t,i){i&&e.source.addRef();const r=this._textModel.deltaDecorations([],[{range:t,options:{description:"inline-completion-tracking-range"}}])[0];this._inlineCompletions.unshift(new hxe(e,r,this._textModel,this._versionId)),this._prependedInlineCompletionItems.push(e)}}class hxe{get forwardStable(){return this.inlineCompletion.source.inlineCompletions.enableForwardStability??!1}constructor(e,t,i,r){this.inlineCompletion=e,this.decorationId=t,this._textModel=i,this._modelVersion=r,this.semanticId=JSON.stringify([this.inlineCompletion.filterText,this.inlineCompletion.insertText,this.inlineCompletion.range.getStartPosition().toString()]),this._updatedRange=$u({owner:this,equalsFn:$.equalsRange},s=>(this._modelVersion.read(s),this._textModel.getDecorationRange(this.decorationId)))}toInlineCompletion(e){return this.inlineCompletion.withRange(this._updatedRange.read(e)??Zq)}toSingleTextEdit(e){return new Yp(this._updatedRange.read(e)??Zq,this.inlineCompletion.insertText)}isVisible(e,t,i){const r=ow(this._toFilterTextReplacement(i),e),s=this._updatedRange.read(i);if(!s||!this.inlineCompletion.range.getStartPosition().equals(s.getStartPosition())||t.lineNumber!==r.range.startLineNumber)return!1;const o=e.getValueInRange(r.range,1),a=r.text,l=Math.max(0,t.column-r.range.startColumn);let c=a.substring(0,l),u=a.substring(l),d=o.substring(0,l),h=o.substring(l);const f=e.getLineIndentColumn(r.range.startLineNumber);return r.range.startColumn<=f&&(d=d.trimStart(),d.length===0&&(h=h.trimStart()),c=c.trimStart(),c.length===0&&(u=u.trimStart())),c.startsWith(d)&&!!V5e(h,u)}canBeReused(e,t){const i=this._updatedRange.read(void 0);return!!i&&i.containsPosition(t)&&this.isVisible(e,t,void 0)&&_c.ofRange(i).isGreaterThanOrEqualTo(_c.ofRange(this.inlineCompletion.range))}_toFilterTextReplacement(e){return new Yp(this._updatedRange.read(e)??Zq,this.inlineCompletion.filterText)}}const Zq=new $(1,1,1,1),xn={Visible:Kue,HasFocusedSuggestion:new et("suggestWidgetHasFocusedSuggestion",!1,w("suggestWidgetHasSelection","Whether any suggestion is focused")),DetailsVisible:new et("suggestWidgetDetailsVisible",!1,w("suggestWidgetDetailsVisible","Whether suggestion details are visible")),MultipleSuggestions:new et("suggestWidgetMultipleSuggestions",!1,w("suggestWidgetMultipleSuggestions","Whether there are multiple suggestions to pick from")),MakesTextEdit:new et("suggestionMakesTextEdit",!0,w("suggestionMakesTextEdit","Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new et("acceptSuggestionOnEnter",!0,w("acceptSuggestionOnEnter","Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new et("suggestionHasInsertAndReplaceRange",!1,w("suggestionHasInsertAndReplaceRange","Whether the current suggestion has insert and replace behaviour")),InsertMode:new et("suggestionInsertMode",void 0,{type:"string",description:w("suggestionInsertMode","Whether the default behaviour is to insert or replace")}),CanResolve:new et("suggestionCanResolve",!1,w("suggestionCanResolve","Whether the current suggestion supports to resolve further details"))},ub=new ce("suggestWidgetStatusBar");let p8t=class{constructor(e,t,i,r){this.position=e,this.completion=t,this.container=i,this.provider=r,this.isInvalid=!1,this.score=vg.Default,this.distance=0,this.textLabel=typeof t.label=="string"?t.label:t.label?.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=t.sortText&&t.sortText.toLowerCase(),this.filterTextLow=t.filterText&&t.filterText.toLowerCase(),this.extensionId=t.extensionId,$.isIRange(t.range)?(this.editStart=new he(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new he(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new he(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||$.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new he(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new he(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new he(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||$.spansMultipleLines(t.range.insert)||$.spansMultipleLines(t.range.replace)||t.range.insert.startLineNumber!==e.lineNumber||t.range.replace.startLineNumber!==e.lineNumber||t.range.insert.startColumn!==t.range.replace.startColumn),typeof r.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(e){if(!this._resolveCache){const t=e.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),i=new Bo(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(r=>{Object.assign(this.completion,r),this._resolveDuration=i.elapsed()},r=>{uh(r)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}};class IO{static{this.default=new IO}constructor(e=2,t=new Set,i=new Set,r=new Map,s=!0){this.snippetSortOrder=e,this.kindFilter=t,this.providerFilter=i,this.providerItemsToReuse=r,this.showDeprecated=s}}class m8t{constructor(e,t,i,r){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=r}}async function tde(n,e,t,i=IO.default,r={triggerKind:0},s=yn.None){const o=new Bo;t=t.clone();const a=e.getWordAtPosition(t),l=a?new $(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):$.fromPositions(t),c={replace:l,insert:l.setEndPosition(t.lineNumber,t.column)},u=[],d=new ke,h=[];let f=!1;const g=(m,_,v)=>{let y=!1;if(!_)return y;for(const C of _.suggestions)if(!i.kindFilter.has(C.kind)){if(!i.showDeprecated&&C?.tags?.includes(1))continue;C.range||(C.range=c),C.sortText||(C.sortText=typeof C.label=="string"?C.label:C.label.label),!f&&C.insertTextRules&&C.insertTextRules&4&&(f=zw.guessNeedsClipboard(C.insertText)),u.push(new p8t(t,C,_,m)),y=!0}return R$(_)&&d.add(_),h.push({providerName:m._debugDisplayName??"unknown_provider",elapsedProvider:_.duration??-1,elapsedOverall:v.elapsed()}),y},p=(async()=>{})();for(const m of n.orderedGroups(e)){let _=!1;if(await Promise.all(m.map(async v=>{if(i.providerItemsToReuse.has(v)){const y=i.providerItemsToReuse.get(v);y.forEach(C=>u.push(C)),_=_||y.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(v)))try{const y=new Bo,C=await v.provideCompletionItems(e,t,r,s);_=g(v,C,y)||_}catch(y){vs(y)}})),_||s.isCancellationRequested)break}return await p,s.isCancellationRequested?(d.dispose(),Promise.reject(new sf)):new m8t(u.sort(b8t(i.snippetSortOrder)),f,{entries:h,elapsed:o.elapsed()},d)}function nde(n,e){if(n.sortTextLow&&e.sortTextLow){if(n.sortTextLowe.sortTextLow)return 1}return n.textLabele.textLabel?1:n.completion.kind-e.completion.kind}function _8t(n,e){if(n.completion.kind!==e.completion.kind){if(n.completion.kind===27)return-1;if(e.completion.kind===27)return 1}return nde(n,e)}function v8t(n,e){if(n.completion.kind!==e.completion.kind){if(n.completion.kind===27)return 1;if(e.completion.kind===27)return-1}return nde(n,e)}const vH=new Map;vH.set(0,_8t);vH.set(2,v8t);vH.set(1,nde);function b8t(n){return vH.get(n)}Un.registerCommand("_executeCompletionItemProvider",async(n,...e)=>{const[t,i,r,s]=e;oi(Pt.isUri(t)),oi(he.isIPosition(i)),oi(typeof r=="string"||!r),oi(typeof s=="number"||!s);const{completionProvider:o}=n.get(dt),a=await n.get(Nc).createModelReference(t);try{const l={incomplete:!1,suggestions:[]},c=[],u=a.object.textEditorModel.validatePosition(i),d=await tde(o,a.object.textEditorModel,u,void 0,{triggerCharacter:r??void 0,triggerKind:r?1:0});for(const h of d.items)c.length<(s??0)&&c.push(h.resolve(yn.None)),l.incomplete=l.incomplete||h.container.incomplete,l.suggestions.push(h.completion);try{return await Promise.all(c),l}finally{setTimeout(()=>d.disposable.dispose(),100)}}finally{a.dispose()}});function y8t(n,e){n.getContribution("editor.contrib.suggestController")?.triggerSuggest(new Set().add(e),void 0,!0)}class WS{static isAllOff(e){return e.other==="off"&&e.comments==="off"&&e.strings==="off"}static isAllOn(e){return e.other==="on"&&e.comments==="on"&&e.strings==="on"}static valueFor(e,t){switch(t){case 1:return e.comments;case 2:return e.strings;default:return e.other}}}function fxe(n,e=Ta){return z1t(n,e)?n.charAt(0).toUpperCase()+n.slice(1):n}var w8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},C8t=function(n,e){return function(t,i){e(t,i,n)}};class gxe{constructor(e){this._delegates=e}resolve(e){for(const t of this._delegates){const i=t.resolve(e);if(i!==void 0)return i}}}class pxe{constructor(e,t,i,r){this._model=e,this._selection=t,this._selectionIdx=i,this._overtypingCapturer=r}resolve(e){const{name:t}=e;if(t==="SELECTION"||t==="TM_SELECTED_TEXT"){let i=this._model.getValueInRange(this._selection)||void 0,r=this._selection.startLineNumber!==this._selection.endLineNumber;if(!i&&this._overtypingCapturer){const s=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);s&&(i=s.value,r=s.multiline)}if(i&&r&&e.snippet){const s=this._model.getLineContent(this._selection.startLineNumber),o=Ji(s,0,this._selection.startColumn-1);let a=o;e.snippet.walk(c=>c===e?!1:(c instanceof Xc&&(a=Ji(om(c.value).pop())),!0));const l=Cb(a,o);i=i.replace(/(\r\n|\r|\n)(.*)/g,(c,u,d)=>`${u}${a.substr(l)}${d}`)}return i}else{if(t==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);if(t==="TM_CURRENT_WORD"){const i=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return i&&i.word||void 0}else{if(t==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);if(t==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);if(t==="CURSOR_INDEX")return String(this._selectionIdx);if(t==="CURSOR_NUMBER")return String(this._selectionIdx+1)}}}}class mxe{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return rb(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=rb(this._model.uri.fsPath),r=i.lastIndexOf(".");return r<=0?i:i.slice(0,r)}else{if(t==="TM_DIRECTORY")return I4e(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(mW(this._model.uri));if(t==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);if(t==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}}}class _xe{constructor(e,t,i,r){this._readClipboardText=e,this._selectionIdx=t,this._selectionCount=i,this._spread=r}resolve(e){if(e.name!=="CLIPBOARD")return;const t=this._readClipboardText();if(t){if(this._spread){const i=t.split(/\r\n|\n|\r/).filter(r=>!$4e(r));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let j9=class{constructor(e,t,i){this._model=e,this._selection=t,this._languageConfigurationService=i}resolve(e){const{name:t}=e,i=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),r=this._languageConfigurationService.getLanguageConfiguration(i).comments;if(r){if(t==="LINE_COMMENT")return r.lineCommentToken||void 0;if(t==="BLOCK_COMMENT_START")return r.blockCommentStartToken||void 0;if(t==="BLOCK_COMMENT_END")return r.blockCommentEndToken||void 0}}};j9=w8t([C8t(2,Zr)],j9);class My{constructor(){this._date=new Date}static{this.dayNames=[w("Sunday","Sunday"),w("Monday","Monday"),w("Tuesday","Tuesday"),w("Wednesday","Wednesday"),w("Thursday","Thursday"),w("Friday","Friday"),w("Saturday","Saturday")]}static{this.dayNamesShort=[w("SundayShort","Sun"),w("MondayShort","Mon"),w("TuesdayShort","Tue"),w("WednesdayShort","Wed"),w("ThursdayShort","Thu"),w("FridayShort","Fri"),w("SaturdayShort","Sat")]}static{this.monthNames=[w("January","January"),w("February","February"),w("March","March"),w("April","April"),w("May","May"),w("June","June"),w("July","July"),w("August","August"),w("September","September"),w("October","October"),w("November","November"),w("December","December")]}static{this.monthNamesShort=[w("JanuaryShort","Jan"),w("FebruaryShort","Feb"),w("MarchShort","Mar"),w("AprilShort","Apr"),w("MayShort","May"),w("JuneShort","Jun"),w("JulyShort","Jul"),w("AugustShort","Aug"),w("SeptemberShort","Sep"),w("OctoberShort","Oct"),w("NovemberShort","Nov"),w("DecemberShort","Dec")]}resolve(e){const{name:t}=e;if(t==="CURRENT_YEAR")return String(this._date.getFullYear());if(t==="CURRENT_YEAR_SHORT")return String(this._date.getFullYear()).slice(-2);if(t==="CURRENT_MONTH")return String(this._date.getMonth().valueOf()+1).padStart(2,"0");if(t==="CURRENT_DATE")return String(this._date.getDate().valueOf()).padStart(2,"0");if(t==="CURRENT_HOUR")return String(this._date.getHours().valueOf()).padStart(2,"0");if(t==="CURRENT_MINUTE")return String(this._date.getMinutes().valueOf()).padStart(2,"0");if(t==="CURRENT_SECOND")return String(this._date.getSeconds().valueOf()).padStart(2,"0");if(t==="CURRENT_DAY_NAME")return My.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return My.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return My.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return My.monthNamesShort[this._date.getMonth()];if(t==="CURRENT_SECONDS_UNIX")return String(Math.floor(this._date.getTime()/1e3));if(t==="CURRENT_TIMEZONE_OFFSET"){const i=this._date.getTimezoneOffset(),r=i>0?"-":"+",s=Math.trunc(Math.abs(i/60)),o=s<10?"0"+s:s,a=Math.abs(i)-s*60,l=a<10?"0"+a:a;return r+o+":"+l}}}class vxe{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=aSt(this._workspaceService.getWorkspace());if(!sSt(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(hQ(e))return rb(e.uri.path);let t=rb(e.configPath.path);return t.endsWith(fQ)&&(t=t.substr(0,t.length-fQ.length-1)),t}_resoveWorkspacePath(e){if(hQ(e))return fxe(e.uri.fsPath);const t=rb(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?fxe(i):"/"}}class bxe{resolve(e){const{name:t}=e;if(t==="RANDOM")return Math.random().toString().slice(-6);if(t==="RANDOM_HEX")return Math.random().toString(16).slice(-6);if(t==="UUID")return aH()}}var x8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},S8t=function(n,e){return function(t,i){e(t,i,n)}},If;class Ih{static{this._decor={active:un.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:un.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:un.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:un.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})}}constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=Eve(t.placeholders,Nd.compareByIndex),this._placeholderGroupsIdx=-1}initialize(e){this._offset=e.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const e=this._editor.getModel();this._editor.changeDecorations(t=>{for(const i of this._snippet.placeholders){const r=this._snippet.offset(i),s=this._snippet.fullLen(i),o=$.fromPositions(e.getPositionAt(this._offset+r),e.getPositionAt(this._offset+r+s)),a=i.isFinalTabstop?Ih._decor.inactiveFinal:Ih._decor.inactive,l=t.addDecoration(o,a);this._placeholderDecorations.set(i,l)}})}move(e){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){const r=[];for(const s of this._placeholderGroups[this._placeholderGroupsIdx])if(s.transform){const o=this._placeholderDecorations.get(s),a=this._editor.getModel().getDecorationRange(o),l=this._editor.getModel().getValueInRange(a),c=s.transform.resolve(l).split(/\r\n|\r|\n/);for(let u=1;u0&&this._editor.executeEdits("snippet.placeholderTransform",r)}let t=!1;e===!0&&this._placeholderGroupsIdx0&&(this._placeholderGroupsIdx-=1,t=!0);const i=this._editor.getModel().changeDecorations(r=>{const s=new Set,o=[];for(const a of this._placeholderGroups[this._placeholderGroupsIdx]){const l=this._placeholderDecorations.get(a),c=this._editor.getModel().getDecorationRange(l);o.push(new yt(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),r.changeDecorationOptions(l,a.isFinalTabstop?Ih._decor.activeFinal:Ih._decor.active),s.add(a);for(const u of this._snippet.enclosingPlaceholders(a)){const d=this._placeholderDecorations.get(u);r.changeDecorationOptions(d,u.isFinalTabstop?Ih._decor.activeFinal:Ih._decor.active),s.add(u)}}for(const[a,l]of this._placeholderDecorations)s.has(a)||r.changeDecorationOptions(l,a.isFinalTabstop?Ih._decor.inactiveFinal:Ih._decor.inactive);return o});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof Nd){const i=this._placeholderDecorations.get(t);if(this._editor.getModel().getDecorationRange(i).isEmpty()&&t.toString().length>0)return!0}t=t.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||this._placeholderGroups.length===0}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(this._snippet.placeholders.length===0)return!0;if(this._snippet.placeholders.length===1){const[e]=this._snippet.placeholders;if(e.isFinalTabstop&&this._snippet.rightMostDescendant===e)return!0}return!1}computePossibleSelections(){const e=new Map;for(const t of this._placeholderGroups){let i;for(const r of t){if(r.isFinalTabstop)break;i||(i=[],e.set(r.index,i));const s=this._placeholderDecorations.get(r),o=this._editor.getModel().getDecorationRange(s);if(!o){e.delete(r.index);break}i.push(o)}}return e}get activeChoice(){if(!this._placeholderDecorations)return;const e=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!e?.choice)return;const t=this._placeholderDecorations.get(e);if(!t)return;const i=this._editor.getModel().getDecorationRange(t);if(i)return{range:i,choice:e.choice}}get hasChoice(){let e=!1;return this._snippet.walk(t=>(e=t instanceof p2,!e)),e}merge(e){const t=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(i=>{for(const r of this._placeholderGroups[this._placeholderGroupsIdx]){const s=e.shift();console.assert(s._offset!==-1),console.assert(!s._placeholderDecorations);const o=s._snippet.placeholderInfo.last.index;for(const l of s._snippet.placeholderInfo.all)l.isFinalTabstop?l.index=r.index+(o+1)/this._nestingLevel:l.index=r.index+l.index/this._nestingLevel;this._snippet.replace(r,s._snippet.children);const a=this._placeholderDecorations.get(r);i.removeDecoration(a),this._placeholderDecorations.delete(r);for(const l of s._snippet.placeholders){const c=s._snippet.offset(l),u=s._snippet.fullLen(l),d=$.fromPositions(t.getPositionAt(s._offset+c),t.getPositionAt(s._offset+c+u)),h=i.addDecoration(d,Ih._decor.inactive);this._placeholderDecorations.set(l,h)}}this._placeholderGroups=Eve(this._snippet.placeholders,Nd.compareByIndex)})}}const yxe={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let q9=If=class{static adjustWhitespace(e,t,i,r,s){const o=e.getLineContent(t.lineNumber),a=Ji(o,0,t.column-1);let l;return r.walk(c=>{if(!(c instanceof Xc)||c.parent instanceof p2||s&&!s.has(c))return!0;const u=c.value.split(/\r\n|\r|\n/);if(i){const h=r.offset(c);if(h===0)u[0]=e.normalizeIndentation(u[0]);else{l=l??r.toString();const f=l.charCodeAt(h-1);(f===10||f===13)&&(u[0]=e.normalizeIndentation(a+u[0]))}for(let f=1;fC.get(Mw)),g=e.invokeWithinContext(C=>new mxe(C.get(pE),h)),p=()=>a,m=h.getValueInRange(If.adjustSelection(h,e.getSelection(),i,0)),_=h.getValueInRange(If.adjustSelection(h,e.getSelection(),0,r)),v=h.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),y=e.getSelections().map((C,x)=>({selection:C,idx:x})).sort((C,x)=>$.compareRangesUsingStarts(C.selection,x.selection));for(const{selection:C,idx:x}of y){let k=If.adjustSelection(h,C,i,0),L=If.adjustSelection(h,C,0,r);m!==h.getValueInRange(k)&&(k=C),_!==h.getValueInRange(L)&&(L=C);const D=C.setStartPosition(k.startLineNumber,k.startColumn).setEndPosition(L.endLineNumber,L.endColumn),I=new zw().parse(t,!0,s),O=D.getStartPosition(),M=If.adjustWhitespace(h,O,o||x>0&&v!==h.getLineFirstNonWhitespaceColumn(C.positionLineNumber),I);I.resolveVariables(new gxe([g,new _xe(p,x,y.length,e.getOption(79)==="spread"),new pxe(h,C,x,l),new j9(h,C,c),new My,new vxe(f),new bxe])),u[x]=jr.replace(D,I.toString()),u[x].identifier={major:x,minor:0},u[x]._isTracked=!0,d[x]=new Ih(e,I,M)}return{edits:u,snippets:d}}static createEditsAndSnippetsFromEdits(e,t,i,r,s,o,a){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};const l=[],c=e.getModel(),u=new zw,d=new CO,h=new gxe([e.invokeWithinContext(g=>new mxe(g.get(pE),c)),new _xe(()=>s,0,e.getSelections().length,e.getOption(79)==="spread"),new pxe(c,e.getSelection(),0,o),new j9(c,e.getSelection(),a),new My,new vxe(e.invokeWithinContext(g=>g.get(Mw))),new bxe]);t=t.sort((g,p)=>$.compareRangesUsingStarts(g.range,p.range));let f=0;for(let g=0;g0){const x=t[g-1].range,k=$.fromPositions(x.getEndPosition(),p.getStartPosition()),L=new Xc(c.getValueInRange(k));d.appendChild(L),f+=L.value.length}const _=u.parseFragment(m,d);If.adjustWhitespace(c,p.getStartPosition(),!0,d,new Set(_)),d.resolveVariables(h);const v=d.toString(),y=v.slice(f);f=v.length;const C=jr.replace(p,y);C.identifier={major:g,minor:0},C._isTracked=!0,l.push(C)}return u.ensureFinalTabstop(d,i,!0),{edits:l,snippets:[new Ih(e,d,"")]}}constructor(e,t,i=yxe,r){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=r,this._templateMerges=[],this._snippets=[]}dispose(){er(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(){if(!this._editor.hasModel())return;const{edits:e,snippets:t}=typeof this._template=="string"?If.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):If.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=t,this._editor.executeEdits("snippet",e,i=>{const r=i.filter(s=>!!s.identifier);for(let s=0;syt.fromPositions(s.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=yxe){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:r}=If.createEditsAndSnippetsFromSelections(this._editor,e,t.overwriteBefore,t.overwriteAfter,!0,t.adjustWhitespace,t.clipboardText,t.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",i,s=>{const o=s.filter(l=>!!l.identifier);for(let l=0;lyt.fromPositions(l.range.getEndPosition()))})}next(){const e=this._move(!0);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}prev(){const e=this._move(!1);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}_move(e){const t=[];for(const i of this._snippets){const r=i.move(e);t.push(...r)}return t}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;const e=this._editor.getSelections();if(e.length{s.push(...r.get(o))})}e.sort($.compareRangesUsingStarts);for(const[i,r]of t){if(r.length!==e.length){t.delete(i);continue}r.sort($.compareRangesUsingStarts);for(let s=0;s0}};q9=If=x8t([S8t(3,Zr)],q9);var k8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},y3=function(n,e){return function(t,i){e(t,i,n)}},Jx;const wxe={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let Kl=class{static{Jx=this}static{this.ID="snippetController2"}static get(e){return e.getContribution(Jx.ID)}static{this.InSnippetMode=new et("inSnippetMode",!1,w("inSnippetMode","Whether the editor in current in snippet mode"))}static{this.HasNextTabstop=new et("hasNextTabstop",!1,w("hasNextTabstop","Whether there is a next tab stop when in snippet mode"))}static{this.HasPrevTabstop=new et("hasPrevTabstop",!1,w("hasPrevTabstop","Whether there is a previous tab stop when in snippet mode"))}constructor(e,t,i,r,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._snippetListener=new ke,this._modelVersionId=-1,this._inSnippet=Jx.InSnippetMode.bindTo(r),this._hasNextTabstop=Jx.HasNextTabstop.bindTo(r),this._hasPrevTabstop=Jx.HasPrevTabstop.bindTo(r)}dispose(){this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._session?.dispose(),this._snippetListener.dispose()}insert(e,t){try{this._doInsert(e,typeof t>"u"?wxe:{...wxe,...t})}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",e),this._logService.error("existing_template=",this._session?this._session._logInfo():"")}}_doInsert(e,t){if(this._editor.hasModel()){if(this._snippetListener.clear(),t.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&typeof e!="string"&&this.cancel(),this._session?(oi(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new q9(this._editor,e,t,this._languageConfigurationService),this._session.insert()),t.undoStopAfter&&this._editor.getModel().pushStackElement(),this._session?.hasChoice){const i={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(c,u)=>{if(!this._session||c!==this._editor.getModel()||!he.equals(this._editor.getPosition(),u))return;const{activeChoice:d}=this._session;if(!d||d.choice.options.length===0)return;const h=c.getValueInRange(d.range),f=!!d.choice.options.find(p=>p.value===h),g=[];for(let p=0;p{s?.dispose(),o=!1},l=()=>{o||(s=this._languageFeaturesService.completionProvider.register({language:r.getLanguageId(),pattern:r.uri.fsPath,scheme:r.uri.scheme,exclusive:!0},i),this._snippetListener.add(s),o=!0)};this._choiceCompletions={provider:i,enable:l,disable:a}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(i=>i.isFlush&&this.cancel())),this._snippetListener.add(this._editor.onDidChangeModel(()=>this.cancel())),this._snippetListener.add(this._editor.onDidChangeCursorSelection(()=>this._updateState()))}}_updateState(){if(!(!this._session||!this._editor.hasModel())){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0;return}const{activeChoice:e}=this._session;if(!e||!this._choiceCompletions){this._choiceCompletions?.disable(),this._currentChoice=void 0;return}this._currentChoice!==e.choice&&(this._currentChoice=e.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{y8t(this._editor,this._choiceCompletions.provider)}))}finish(){for(;this._inSnippet.get();)this.next()}cancel(e=!1){this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,this._session?.dispose(),this._session=void 0,this._modelVersionId=-1,e&&this._editor.setSelections([this._editor.getSelection()])}prev(){this._session?.prev(),this._updateState()}next(){this._session?.next(),this._updateState()}isInSnippet(){return!!this._inSnippet.get()}};Kl=Jx=k8t([y3(1,Da),y3(2,dt),y3(3,jt),y3(4,Zr)],Kl);Zn(Kl.ID,Kl,4);const bH=fo.bindToContribution(Kl.get);Je(new bH({id:"jumpToNextSnippetPlaceholder",precondition:Le.and(Kl.InSnippetMode,Kl.HasNextTabstop),handler:n=>n.next(),kbOpts:{weight:130,kbExpr:Q.textInputFocus,primary:2}}));Je(new bH({id:"jumpToPrevSnippetPlaceholder",precondition:Le.and(Kl.InSnippetMode,Kl.HasPrevTabstop),handler:n=>n.prev(),kbOpts:{weight:130,kbExpr:Q.textInputFocus,primary:1026}}));Je(new bH({id:"leaveSnippet",precondition:Kl.InSnippetMode,handler:n=>n.cancel(!0),kbOpts:{weight:130,kbExpr:Q.textInputFocus,primary:9,secondary:[1033]}}));Je(new bH({id:"acceptSnippet",precondition:Kl.InSnippetMode,handler:n=>n.finish()}));var E8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Xq=function(n,e){return function(t,i){e(t,i,n)}};let ate=class extends me{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(e,t,i,r,s,o,a,l,c,u,d,h){super(),this.textModel=e,this.selectedSuggestItem=t,this._textModelVersionId=i,this._positions=r,this._debounceValue=s,this._suggestPreviewEnabled=o,this._suggestPreviewMode=a,this._inlineSuggestMode=l,this._enabled=c,this._instantiationService=u,this._commandService=d,this._languageConfigurationService=h,this._source=this._register(this._instantiationService.createInstance(ote,this.textModel,this._textModelVersionId,this._debounceValue)),this._isActive=kn(this,!1),this._forceUpdateExplicitlySignal=r2(this),this._selectedInlineCompletionId=kn(this,void 0),this._primaryPosition=St(this,g=>this._positions.read(g)[0]??new he(1,1)),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([qm.Redo,qm.Undo,qm.AcceptWord]),this._fetchInlineCompletionsPromise=uFe({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:gg.Automatic}),handleChange:(g,p)=>(g.didChange(this._textModelVersionId)&&this._preserveCurrentCompletionReasons.has(this._getReason(g.change))?p.preserveCurrentCompletion=!0:g.didChange(this._forceUpdateExplicitlySignal)&&(p.inlineCompletionTriggerKind=gg.Explicit),!0)},(g,p)=>{if(this._forceUpdateExplicitlySignal.read(g),!(this._enabled.read(g)&&this.selectedSuggestItem.read(g)||this._isActive.read(g))){this._source.cancelUpdate();return}this._textModelVersionId.read(g);const _=this._source.suggestWidgetInlineCompletions.get(),v=this.selectedSuggestItem.read(g);if(_&&!v){const L=this._source.inlineCompletions.get();qr(D=>{(!L||_.request.versionId>L.request.versionId)&&this._source.inlineCompletions.set(_.clone(),D),this._source.clearSuggestWidgetInlineCompletions(D)})}const y=this._primaryPosition.read(g),C={triggerKind:p.inlineCompletionTriggerKind,selectedSuggestionInfo:v?.toSelectedSuggestionInfo()},x=this.selectedInlineCompletion.get(),k=p.preserveCurrentCompletion||x?.forwardStable?x:void 0;return this._source.fetch(y,C,k)}),this._filteredInlineCompletionItems=$u({owner:this,equalsFn:k8()},g=>{const p=this._source.inlineCompletions.read(g);if(!p)return[];const m=this._primaryPosition.read(g);return p.inlineCompletions.filter(v=>v.isVisible(this.textModel,m,g))}),this.selectedInlineCompletionIndex=St(this,g=>{const p=this._selectedInlineCompletionId.read(g),m=this._filteredInlineCompletionItems.read(g),_=this._selectedInlineCompletionId===void 0?-1:m.findIndex(v=>v.semanticId===p);return _===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):_}),this.selectedInlineCompletion=St(this,g=>{const p=this._filteredInlineCompletionItems.read(g),m=this.selectedInlineCompletionIndex.read(g);return p[m]}),this.activeCommands=$u({owner:this,equalsFn:k8()},g=>this.selectedInlineCompletion.read(g)?.inlineCompletion.source.inlineCompletions.commands??[]),this.lastTriggerKind=this._source.inlineCompletions.map(this,g=>g?.request.context.triggerKind),this.inlineCompletionsCount=St(this,g=>{if(this.lastTriggerKind.read(g)===gg.Explicit)return this._filteredInlineCompletionItems.read(g).length}),this.state=$u({owner:this,equalsFn:(g,p)=>!g||!p?g===p:ixe(g.ghostTexts,p.ghostTexts)&&g.inlineCompletion===p.inlineCompletion&&g.suggestItem===p.suggestItem},g=>{const p=this.textModel,m=this.selectedSuggestItem.read(g);if(m){const _=ow(m.toSingleTextEdit(),p),v=this._computeAugmentation(_,g);if(!this._suggestPreviewEnabled.read(g)&&!v)return;const C=v?.edit??_,x=v?v.edit.text.length-_.text.length:0,k=this._suggestPreviewMode.read(g),L=this._positions.read(g),D=[C,...Qq(this.textModel,L,C)],I=D.map((M,B)=>lxe(M,p,k,L[B],x)).filter(Bp),O=I[0]??new fR(C.range.endLineNumber,[]);return{edits:D,primaryGhostText:O,ghostTexts:I,inlineCompletion:v?.completion,suggestItem:m}}else{if(!this._isActive.read(g))return;const _=this.selectedInlineCompletion.read(g);if(!_)return;const v=_.toSingleTextEdit(g),y=this._inlineSuggestMode.read(g),C=this._positions.read(g),x=[v,...Qq(this.textModel,C,v)],k=x.map((L,D)=>lxe(L,p,y,C[D],0)).filter(Bp);return k[0]?{edits:x,primaryGhostText:k[0],ghostTexts:k,inlineCompletion:_,suggestItem:void 0}:void 0}}),this.ghostTexts=$u({owner:this,equalsFn:ixe},g=>{const p=this.state.read(g);if(p)return p.ghostTexts}),this.primaryGhostText=$u({owner:this,equalsFn:aBe},g=>{const p=this.state.read(g);if(p)return p?.primaryGhostText}),this._register(s2(this._fetchInlineCompletionsPromise));let f;this._register(tn(g=>{const m=this.state.read(g)?.inlineCompletion;if(m?.semanticId!==f?.semanticId&&(f=m,m)){const _=m.inlineCompletion,v=_.source;v.provider.handleItemDidShow?.(v.inlineCompletions,_.sourceInlineCompletion,_.insertText)}}))}_getReason(e){return e?.isUndoing?qm.Undo:e?.isRedoing?qm.Redo:this.isAcceptingPartially?qm.AcceptWord:qm.Other}async trigger(e){this._isActive.set(!0,e),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e){Fw(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineCompletionsPromise.get()}stop(e){Fw(e,t=>{this._isActive.set(!1,t),this._source.clear(t)})}_computeAugmentation(e,t){const i=this.textModel,r=this._source.suggestWidgetInlineCompletions.read(t),s=r?r.inlineCompletions:[this.selectedInlineCompletion.read(t)].filter(Bp);return Fbt(s,a=>{let l=a.toSingleTextEdit(t);return l=ow(l,i,$.fromPositions(l.range.getStartPosition(),e.range.getEndPosition())),dBe(l,e)?{completion:a,edit:l}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._filteredInlineCompletionItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(e){if(e.getModel()!==this.textModel)throw new fi;const t=this.state.get();if(!t||t.primaryGhostText.isEmpty()||!t.inlineCompletion)return;const i=t.inlineCompletion.toInlineCompletion(void 0);if(i.command&&i.source.addRef(),e.pushUndoStop(),i.snippetInfo)e.executeEdits("inlineSuggestion.accept",[jr.replace(i.range,""),...i.additionalTextEdits]),e.setPosition(i.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),Kl.get(e)?.insert(i.snippetInfo.snippet,{undoStopBefore:!1});else{const r=t.edits,s=Cxe(r).map(o=>yt.fromPositions(o));e.executeEdits("inlineSuggestion.accept",[...r.map(o=>jr.replace(o.range,o.text)),...i.additionalTextEdits]),e.setSelections(s,"inlineCompletionAccept")}this.stop(),i.command&&(await this._commandService.executeCommand(i.command.id,...i.command.arguments||[]).then(void 0,vs),i.source.removeRef())}async acceptNextWord(e){await this._acceptNext(e,(t,i)=>{const r=this.textModel.getLanguageIdAtPosition(t.lineNumber,t.column),s=this._languageConfigurationService.getLanguageConfiguration(r),o=new RegExp(s.wordDefinition.source,s.wordDefinition.flags.replace("g","")),a=i.match(o);let l=0;a&&a.index!==void 0?a.index===0?l=a[0].length:l=a.index:l=i.length;const u=/\s+/g.exec(i);return u&&u.index!==void 0&&u.index+u[0].length{const r=i.match(/\n/);return r&&r.index!==void 0?r.index+1:i.length},1)}async _acceptNext(e,t,i){if(e.getModel()!==this.textModel)throw new fi;const r=this.state.get();if(!r||r.primaryGhostText.isEmpty()||!r.inlineCompletion)return;const s=r.primaryGhostText,o=r.inlineCompletion.toInlineCompletion(void 0);if(o.snippetInfo||o.filterText!==o.insertText){await this.accept(e);return}const a=s.parts[0],l=new he(s.lineNumber,a.column),c=a.text,u=t(l,c);if(u===c.length&&s.parts.length===1){this.accept(e);return}const d=c.substring(0,u),h=this._positions.get(),f=h[0];o.source.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const g=$.fromPositions(f,l),p=e.getModel().getValueInRange(g)+d,m=new Yp(g,p),_=[m,...Qq(this.textModel,h,m)],v=Cxe(_).map(y=>yt.fromPositions(y));e.executeEdits("inlineSuggestion.accept",_.map(y=>jr.replace(y.range,y.text))),e.setSelections(v,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1)}finally{this._isAcceptingPartially=!1}if(o.source.provider.handlePartialAccept){const g=$.fromPositions(o.range.getStartPosition(),_c.ofText(d).addToPosition(l)),p=e.getModel().getValueInRange(g,1);o.source.provider.handlePartialAccept(o.source.inlineCompletions,o.sourceInlineCompletion,p.length,{kind:i})}}finally{o.source.removeRef()}}handleSuggestAccepted(e){const t=ow(e.toSingleTextEdit(),this.textModel),i=this._computeAugmentation(t,void 0);if(!i)return;const r=i.completion.inlineCompletion;r.source.provider.handlePartialAccept?.(r.source.inlineCompletions,r.sourceInlineCompletion,t.text.length,{kind:2})}};ate=E8t([Xq(9,Tt),Xq(10,_r),Xq(11,Zr)],ate);var qm;(function(n){n[n.Undo=0]="Undo",n[n.Redo=1]="Redo",n[n.AcceptWord=2]="AcceptWord",n[n.Other=3]="Other"})(qm||(qm={}));function Qq(n,e,t){if(e.length===1)return[];const i=e[0],r=e.slice(1),s=t.range.getStartPosition(),o=t.range.getEndPosition(),a=n.getValueInRange($.fromPositions(i,o)),l=rxe(i,s);if(l.lineNumber<1)return rn(new fi(`positionWithinTextEdit line number should be bigger than 0. + Invalid subtraction between ${i.toString()} and ${s.toString()}`)),[];const c=L8t(t.text,l);return r.map(u=>{const d=X6t(rxe(u,s),o),h=n.getValueInRange($.fromPositions(u,d)),f=Cb(a,h),g=$.fromPositions(u,u.delta(0,f));return new Yp(g,c)})}function L8t(n,e){let t="";const i=d_t(n);for(let r=e.lineNumber-1;rs.range,$.compareRangesUsingStarts)),i=new nle(e.apply(n)).getNewRanges();return e.inverse().apply(i).map(s=>s.getEndPosition())}var T8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},xxe=function(n,e){return function(t,i){e(t,i,n)}},$D;class ide{constructor(e){this.name=e}select(e,t,i){if(i.length===0)return 0;const r=i[0].score[0];for(let s=0;sl&&d.type===i[c].completion.kind&&d.insertText===i[c].completion.insertText&&(l=d.touch,a=c),i[c].completion.preselect&&o===-1)return o=c}return a!==-1?a:o!==-1?o:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();const t=0;for(const[i,r]of e)r.touch=t,r.type=typeof r.type=="number"?r.type:rN.fromString(r.type),this._cache.set(i,r);this._seq=this._cache.size}}class I8t extends ide{constructor(){super("recentlyUsedByPrefix"),this._trie=fk.forStrings(),this._seq=0}memorize(e,t,i){const{word:r}=e.getWordUntilPosition(t),s=`${e.getLanguageId()}/${r}`;this._trie.set(s,{type:i.completion.kind,insertText:i.completion.insertText,touch:this._seq++})}select(e,t,i){const{word:r}=e.getWordUntilPosition(t);if(!r)return super.select(e,t,i);const s=`${e.getLanguageId()}/${r}`;let o=this._trie.get(s);if(o||(o=this._trie.findSubstr(s)),o)for(let a=0;ae.push([i,t])),e.sort((t,i)=>-(t[1].touch-i[1].touch)).forEach((t,i)=>t[1].touch=i),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(const[t,i]of e)i.type=typeof i.type=="number"?i.type:rN.fromString(i.type),this._trie.set(t,i)}}}let lte=class{static{$D=this}static{this._strategyCtors=new Map([["recentlyUsedByPrefix",I8t],["recentlyUsed",D8t],["first",Sxe]])}static{this._storagePrefix="suggest/memories"}constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new ke,this._persistSoon=new Ui(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===AN.SHUTDOWN&&this._saveState()}))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(e,t,i){this._withStrategy(e,t).memorize(e,t,i),this._persistSoon.schedule()}select(e,t,i){return this._withStrategy(e,t).select(e,t,i)}_withStrategy(e,t){const i=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:e.getLanguageIdAtPosition(t.lineNumber,t.column),resource:e.uri});if(this._strategy?.name!==i){this._saveState();const r=$D._strategyCtors.get(i)||Sxe;this._strategy=new r;try{const o=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,a=this._storageService.get(`${$D._storagePrefix}/${i}`,o);a&&this._strategy.fromJSON(JSON.parse(a))}catch{}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${$D._storagePrefix}/${this._strategy.name}`,i,t,1)}}};lte=$D=T8t([xxe(0,pf),xxe(1,En)],lte);const yH=On("ISuggestMemories");Vn(yH,lte,1);var A8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},N8t=function(n,e){return function(t,i){e(t,i,n)}},cte;let K9=class{static{cte=this}static{this.AtEnd=new et("atEndOfWord",!1)}constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=cte.AtEnd.bindTo(t),this._configListener=this._editor.onDidChangeConfiguration(i=>i.hasChanged(124)&&this._update()),this._update()}dispose(){this._configListener.dispose(),this._selectionListener?.dispose(),this._ckAtEnd.reset()}_update(){const e=this._editor.getOption(124)==="on";if(this._enabled!==e)if(this._enabled=e,this._enabled){const t=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}const i=this._editor.getModel(),r=this._editor.getSelection(),s=i.getWordAtPosition(r.getStartPosition());if(!s){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(s.endColumn===r.getStartPosition().column)};this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};K9=cte=A8t([N8t(1,jt)],K9);var R8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},P8t=function(n,e){return function(t,i){e(t,i,n)}},WD;let FE=class{static{WD=this}static{this.OtherSuggestions=new et("hasOtherSuggestions",!1)}constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=WD.OtherSuggestions.bindTo(t)}dispose(){this.reset()}reset(){this._ckOtherSuggestions.reset(),this._listener?.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:e,index:t},i){if(e.items.length===0){this.reset();return}if(WD._moveIndex(!0,e,t)===t){this.reset();return}this._acceptNext=i,this._model=e,this._index=t,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(e,t,i){let r=i;for(let s=t.items.length;s>0&&(r=(r+t.items.length+(e?1:-1))%t.items.length,!(r===i||!t.items[r].completion.additionalTextEdits));s--);return r}next(){this._move(!0)}prev(){this._move(!1)}_move(e){if(this._model)try{this._ignore=!0,this._index=WD._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};FE=WD=R8t([P8t(1,jt)],FE);class O8t{constructor(e,t,i,r){this._disposables=new ke,this._disposables.add(i.onDidSuggest(s=>{s.completionModel.items.length===0&&this.reset()})),this._disposables.add(i.onDidCancel(s=>{this.reset()})),this._disposables.add(t.onDidShow(()=>this._onItem(t.getFocusedItem()))),this._disposables.add(t.onDidFocus(this._onItem,this)),this._disposables.add(t.onDidHide(this.reset,this)),this._disposables.add(e.onWillType(s=>{if(this._active&&!t.isFrozen()&&i.state!==0){const o=s.charCodeAt(s.length-1);this._active.acceptCharacters.has(o)&&e.getOption(0)&&r(this._active.item)}}))}_onItem(e){if(!e||!bl(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new n8;for(const i of e.item.completion.commitCharacters)i.length>0&&t.add(i.charCodeAt(0));this._active={acceptCharacters:t,item:e}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}}class Ah{async provideSelectionRanges(e,t){const i=[];for(const r of t){const s=[];i.push(s);const o=new Map;await new Promise(a=>Ah._bracketsRightYield(a,0,e,r,o)),await new Promise(a=>Ah._bracketsLeftYield(a,0,e,r,o,s))}return i}static{this._maxDuration=30}static{this._maxRounds=2}static _bracketsRightYield(e,t,i,r,s){const o=new Map,a=Date.now();for(;;){if(t>=Ah._maxRounds){e();break}if(!r){e();break}const l=i.bracketPairs.findNextBracket(r);if(!l){e();break}if(Date.now()-a>Ah._maxDuration){setTimeout(()=>Ah._bracketsRightYield(e,t+1,i,r,s));break}if(l.bracketInfo.isOpeningBracket){const u=l.bracketInfo.bracketText,d=o.has(u)?o.get(u):0;o.set(u,d+1)}else{const u=l.bracketInfo.getOpeningBrackets()[0].bracketText;let d=o.has(u)?o.get(u):0;if(d-=1,o.set(u,Math.max(0,d)),d<0){let h=s.get(u);h||(h=new Rl,s.set(u,h)),h.push(l.range)}}r=l.range.getEndPosition()}}static _bracketsLeftYield(e,t,i,r,s,o){const a=new Map,l=Date.now();for(;;){if(t>=Ah._maxRounds&&s.size===0){e();break}if(!r){e();break}const c=i.bracketPairs.findPrevBracket(r);if(!c){e();break}if(Date.now()-l>Ah._maxDuration){setTimeout(()=>Ah._bracketsLeftYield(e,t+1,i,r,s,o));break}if(c.bracketInfo.isOpeningBracket){const d=c.bracketInfo.bracketText;let h=a.has(d)?a.get(d):0;if(h-=1,a.set(d,Math.max(0,h)),h<0){const f=s.get(d);if(f){const g=f.shift();f.size===0&&s.delete(d);const p=$.fromPositions(c.range.getEndPosition(),g.getStartPosition()),m=$.fromPositions(c.range.getStartPosition(),g.getEndPosition());o.push({range:p}),o.push({range:m}),Ah._addBracketLeading(i,m,o)}}}else{const d=c.bracketInfo.getOpeningBrackets()[0].bracketText,h=a.has(d)?a.get(d):0;a.set(d,h+1)}r=c.range.getStartPosition()}}static _addBracketLeading(e,t,i){if(t.startLineNumber===t.endLineNumber)return;const r=t.startLineNumber,s=e.getLineFirstNonWhitespaceColumn(r);s!==0&&s!==t.startColumn&&(i.push({range:$.fromPositions(new he(r,s),t.getEndPosition())}),i.push({range:$.fromPositions(new he(r,1),t.getEndPosition())}));const o=r-1;if(o>0){const a=e.getLineFirstNonWhitespaceColumn(o);a===t.startColumn&&a!==e.getLineLastNonWhitespaceColumn(o)&&(i.push({range:$.fromPositions(new he(o,a),t.getEndPosition())}),i.push({range:$.fromPositions(new he(o,1),t.getEndPosition())}))}}}class dp{static{this.None=new class extends dp{distance(){return 0}}}static async create(e,t){if(!t.getOption(119).localityBonus||!t.hasModel())return dp.None;const i=t.getModel(),r=t.getPosition();if(!e.canComputeWordRanges(i.uri))return dp.None;const[s]=await new Ah().provideSelectionRanges(i,[r]);if(s.length===0)return dp.None;const o=await e.computeWordRanges(i.uri,s[0].range);if(!o)return dp.None;const a=i.getWordUntilPosition(r);return delete o[a.word],new class extends dp{distance(l,c){if(!r.equals(t.getPosition()))return 0;if(c.kind===17)return 2<<20;const u=typeof c.label=="string"?c.label:c.label.label,d=o[u];if(s4e(d))return 2<<20;const h=JA(d,$.fromPositions(l),$.compareRangesUsingStarts),f=h>=0?d[h]:d[Math.max(0,~h-1)];let g=s.length;for(const p of s){if(!$.containsRange(p.range,f))break;g-=1}return g}}}}let kxe=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class yv{constructor(e,t,i,r,s,o,a=Lle.default,l=void 0){this.clipboardText=l,this._snippetCompareFn=yv._compareCompletionItems,this._items=e,this._column=t,this._wordDistance=r,this._options=s,this._refilterKind=1,this._lineContext=i,this._fuzzyScoreOptions=a,o==="top"?this._snippetCompareFn=yv._compareCompletionItemsSnippetsUp:o==="bottom"&&(this._snippetCompareFn=yv._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(e){(this._lineContext.leadingLineContent!==e.leadingLineContent||this._lineContext.characterCountDelta!==e.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta0&&i[0].container.incomplete&&e.add(t);return e}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const e=[],{leadingLineContent:t,characterCountDelta:i}=this._lineContext;let r="",s="";const o=this._refilterKind===1?this._items:this._filteredItems,a=[],l=!this._options.filterGraceful||o.length>2e3?Ow:DCt;for(let c=0;c=f)u.score=vg.Default;else if(typeof u.completion.filterText=="string"){const p=l(r,s,g,u.completion.filterText,u.filterTextLow,0,this._fuzzyScoreOptions);if(!p)continue;uX(u.completion.filterText,u.textLabel)===0?u.score=p:(u.score=kCt(r,s,g,u.textLabel,u.labelLow,0),u.score[0]=p[0])}else{const p=l(r,s,g,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!p)continue;u.score=p}}u.idx=c,u.distance=this._wordDistance.distance(u.position,u.completion),a.push(u),e.push(u.textLabel.length)}this._filteredItems=a.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?rZ(e.length-.85,e,(c,u)=>c-u):0}}static _compareCompletionItems(e,t){return e.score[0]>t.score[0]?-1:e.score[0]t.distance?1:e.idxt.idx?1:0}static _compareCompletionItemsSnippetsDown(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===27)return 1;if(t.completion.kind===27)return-1}return yv._compareCompletionItems(e,t)}static _compareCompletionItemsSnippetsUp(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===27)return-1;if(t.completion.kind===27)return 1}return yv._compareCompletionItems(e,t)}}var M8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},j0=function(n,e){return function(t,i){e(t,i,n)}},ute;class F1{static shouldAutoTrigger(e){if(!e.hasModel())return!1;const t=e.getModel(),i=e.getPosition();t.tokenization.tokenizeIfCheap(i.lineNumber);const r=t.getWordAtPosition(i);return!(!r||r.endColumn!==i.column&&r.startColumn+1!==i.column||!isNaN(Number(r.word)))}constructor(e,t,i){this.leadingLineContent=e.getLineContent(t.lineNumber).substr(0,t.column-1),this.leadingWord=e.getWordUntilPosition(t),this.lineNumber=t.lineNumber,this.column=t.column,this.triggerOptions=i}}function F8t(n,e,t){if(!e.getContextKeyValue(_l.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(_l.suppressSuggestions.key);return i!==void 0?!i:!n.getOption(62).suppressSuggestions}function B8t(n,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(_l.suppressSuggestions.key);return i!==void 0?!i:!n.getOption(62).suppressSuggestions}let G9=ute=class{constructor(e,t,i,r,s,o,a,l,c){this._editor=e,this._editorWorkerService=t,this._clipboardService=i,this._telemetryService=r,this._logService=s,this._contextKeyService=o,this._configurationService=a,this._languageFeaturesService=l,this._envService=c,this._toDispose=new ke,this._triggerCharacterListener=new ke,this._triggerQuickSuggest=new hf,this._triggerState=void 0,this._completionDisposables=new ke,this._onDidCancel=new fe,this._onDidTrigger=new fe,this._onDidSuggest=new fe,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new yt(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let u=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{u=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{u=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(d=>{u||this._onCursorChange(d)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!u&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){er(this._triggerCharacterListener),er([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(92)||!this._editor.hasModel()||!this._editor.getOption(122))return;const e=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const r of i.triggerCharacters||[]){let s=e.get(r);s||(s=new Set,e.set(r,s)),s.add(i)}const t=i=>{if(!B8t(this._editor,this._contextKeyService,this._configurationService)||F1.shouldAutoTrigger(this._editor))return;if(!i){const o=this._editor.getPosition();i=this._editor.getModel().getLineContent(o.lineNumber).substr(0,o.column-1)}let r="";Tw(i.charCodeAt(i.length-1))?Co(i.charCodeAt(i.length-2))&&(r=i.substr(i.length-2)):r=i.charAt(i.length-1);const s=e.get(r);if(s){const o=new Map;if(this._completionModel)for(const[a,l]of this._completionModel.getItemsByProvider())s.has(a)||o.set(a,l);this.trigger({auto:!0,triggerKind:1,triggerCharacter:r,retrigger:!!this._completionModel,clipboardText:this._completionModel?.clipboardText,completionOptions:{providerFilter:s,providerItemsToReuse:o}})}};this._triggerCharacterListener.add(this._editor.onDidType(t)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>t()))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(e=!1){this._triggerState!==void 0&&(this._triggerQuickSuggest.cancel(),this._requestToken?.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:e}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){this._triggerState!==void 0&&(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.cancel():this.trigger({auto:this._triggerState.auto,retrigger:!0}))}_onCursorChange(e){if(!this._editor.hasModel())return;const t=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!e.selection.isEmpty()||e.reason!==0&&e.reason!==3||e.source!=="keyboard"&&e.source!=="deleteLeft"){this.cancel();return}this._triggerState===void 0&&e.reason===0?(t.containsRange(this._currentSelection)||t.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():this._triggerState!==void 0&&e.reason===3&&this._refilterCompletionItems()}_onCompositionEnd(){this._triggerState===void 0?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){WS.isAllOff(this._editor.getOption(90))||this._editor.getOption(119).snippetsPreventQuickSuggestions&&Kl.get(this._editor)?.isInSnippet()||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!F1.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const e=this._editor.getModel(),t=this._editor.getPosition(),i=this._editor.getOption(90);if(!WS.isAllOff(i)){if(!WS.isAllOn(i)){e.tokenization.tokenizeIfCheap(t.lineNumber);const r=e.tokenization.getLineTokens(t.lineNumber),s=r.getStandardTokenType(r.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(WS.valueFor(i,s)!=="on")return}F8t(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(e)&&this.trigger({auto:!0})}},this._editor.getOption(91)))}_refilterCompletionItems(){oi(this._editor.hasModel()),oi(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new F1(e,t,{...this._triggerState,refilter:!0});this._onNewContext(i)}trigger(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=new F1(t,this._editor.getPosition(),e);this.cancel(e.retrigger),this._triggerState=e,this._onDidTrigger.fire({auto:e.auto,shy:e.shy??!1,position:this._editor.getPosition()}),this._context=i;let r={triggerKind:e.triggerKind??0};e.triggerCharacter&&(r={triggerKind:1,triggerCharacter:e.triggerCharacter}),this._requestToken=new Kr;const s=this._editor.getOption(113);let o=1;switch(s){case"top":o=0;break;case"bottom":o=2;break}const{itemKind:a,showDeprecated:l}=ute.createSuggestFilter(this._editor),c=new IO(o,e.completionOptions?.kindFilter??a,e.completionOptions?.providerFilter,e.completionOptions?.providerItemsToReuse,l),u=dp.create(this._editorWorkerService,this._editor),d=tde(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),c,r,this._requestToken.token);Promise.all([d,u]).then(async([h,f])=>{if(this._requestToken?.dispose(),!this._editor.hasModel())return;let g=e?.clipboardText;if(!g&&h.needsClipboard&&(g=await this._clipboardService.readText()),this._triggerState===void 0)return;const p=this._editor.getModel(),m=new F1(p,this._editor.getPosition(),e),_={...Lle.default,firstMatchCanBeWeak:!this._editor.getOption(119).matchOnWordStartOnly};if(this._completionModel=new yv(h.items,this._context.column,{leadingLineContent:m.leadingLineContent,characterCountDelta:m.column-this._context.column},f,this._editor.getOption(119),this._editor.getOption(113),_,g),this._completionDisposables.add(h.disposable),this._onNewContext(m),this._reportDurationsTelemetry(h.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const v of h.items)v.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${v.provider._debugDisplayName}`,v.completion)}).catch(rn)}_reportDurationsTelemetry(e){this._telemetryGate++%230===0&&setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(e)}),this._logService.debug("suggest.durations.json",e)})}static createSuggestFilter(e){const t=new Set;e.getOption(113)==="none"&&t.add(27);const r=e.getOption(119);return r.showMethods||t.add(0),r.showFunctions||t.add(1),r.showConstructors||t.add(2),r.showFields||t.add(3),r.showVariables||t.add(4),r.showClasses||t.add(5),r.showStructs||t.add(6),r.showInterfaces||t.add(7),r.showModules||t.add(8),r.showProperties||t.add(9),r.showEvents||t.add(10),r.showOperators||t.add(11),r.showUnits||t.add(12),r.showValues||t.add(13),r.showConstants||t.add(14),r.showEnums||t.add(15),r.showEnumMembers||t.add(16),r.showKeywords||t.add(17),r.showWords||t.add(18),r.showColors||t.add(19),r.showFiles||t.add(20),r.showReferences||t.add(21),r.showColors||t.add(22),r.showFolders||t.add(23),r.showTypeParameters||t.add(24),r.showSnippets||t.add(27),r.showUsers||t.add(25),r.showIssues||t.add(26),{itemKind:t,showDeprecated:r.showDeprecated}}_onNewContext(e){if(this._context){if(e.lineNumber!==this._context.lineNumber){this.cancel();return}if(Ji(e.leadingLineContent)!==Ji(this._context.leadingLineContent)){this.cancel();return}if(e.columnthis._context.leadingWord.startColumn){if(F1.shouldAutoTrigger(this._editor)&&this._context){const i=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:i}})}return}if(e.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&e.leadingWord.word.length!==0){const t=new Map,i=new Set;for(const[r,s]of this._completionModel.getItemsByProvider())s.length>0&&s[0].container.incomplete?i.add(r):t.set(r,s);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:i,providerItemsToReuse:t}})}else{const t=this._completionModel.lineContext;let i=!1;if(this._completionModel.lineContext={leadingLineContent:e.leadingLineContent,characterCountDelta:e.column-this._context.column},this._completionModel.items.length===0){const r=F1.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(r&&this._context.leadingWord.endColumn0,i&&e.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:e.triggerOptions,isFrozen:i})}}}}};G9=ute=M8t([j0(1,Oc),j0(2,b0),j0(3,Qa),j0(4,Da),j0(5,jt),j0(6,En),j0(7,dt),j0(8,ole)],G9);class rde{static{this._maxSelectionLength=51200}constructor(e,t){this._disposables=new ke,this._lastOvertyped=[],this._locked=!1,this._disposables.add(e.onWillType(()=>{if(this._locked||!e.hasModel())return;const i=e.getSelections(),r=i.length;let s=!1;for(let a=0;arde._maxSelectionLength)return;this._lastOvertyped[a]={value:o.getValueInRange(l),multiline:l.startLineNumber!==l.endLineNumber}}})),this._disposables.add(t.onDidTrigger(i=>{this._locked=!0})),this._disposables.add(t.onDidCancel(i=>{this._locked=!1}))}getLastOvertypedInfo(e){if(e>=0&&e=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Jq=function(n,e){return function(t,i){e(t,i,n)}};let dte=class{constructor(e,t,i,r,s){this._menuId=t,this._menuService=r,this._contextKeyService=s,this._menuDisposables=new ke,this.element=Ne(e,qe(".suggest-status-bar"));const o=a=>a instanceof ou?i.createInstance(Wle,a,{useComma:!0}):void 0;this._leftActions=new ed(this.element,{actionViewItemProvider:o}),this._rightActions=new ed(this.element,{actionViewItemProvider:o}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const e=this._menuService.createMenu(this._menuId,this._contextKeyService),t=()=>{const i=[],r=[];for(const[s,o]of e.getActions())s==="left"?i.push(...o):r.push(...o);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(r)};this._menuDisposables.add(e.onDidChange(()=>t())),this._menuDisposables.add(e)}hide(){this._menuDisposables.clear()}};dte=$8t([Jq(2,Tt),Jq(3,ld),Jq(4,jt)],dte);var W8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},H8t=function(n,e){return function(t,i){e(t,i,n)}};function sde(n){return!!n&&!!(n.completion.documentation||n.completion.detail&&n.completion.detail!==n.completion.label)}let hte=class{constructor(e,t){this._editor=e,this._onDidClose=new fe,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new fe,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new ke,this._renderDisposeable=new ke,this._borderWidth=1,this._size=new vi(330,0),this.domNode=qe(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(Q_,{editor:e}),this._body=qe(".body"),this._scrollbar=new tO(this._body,{alwaysConsumeMouseWheel:!0}),Ne(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Ne(this._body,qe(".header")),this._close=Ne(this._header,qe("span"+zt.asCSSSelector(ze.close))),this._close.title=w("details.close","Close"),this._type=Ne(this._header,qe("p.type")),this._docs=Ne(this._body,qe("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(50)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const e=this._editor.getOptions(),t=e.get(50),i=t.getMassagedFontFamily(),r=e.get(120)||t.fontSize,s=e.get(121)||t.lineHeight,o=t.fontWeight,a=`${r}px`,l=`${s}px`;this.domNode.style.fontSize=a,this.domNode.style.lineHeight=`${s/r}`,this.domNode.style.fontWeight=o,this.domNode.style.fontFeatureSettings=t.fontFeatureSettings,this._type.style.fontFamily=i,this._close.style.height=l,this._close.style.width=l}getLayoutInfo(){const e=this._editor.getOption(121)||this._editor.getOption(50).lineHeight,t=this._borderWidth,i=t*2;return{lineHeight:e,borderWidth:t,borderHeight:i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=w("loading","Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(e,t){this._renderDisposeable.clear();let{detail:i,documentation:r}=e.completion;if(t){let s="";s+=`score: ${e.score[0]} `,s+=`prefix: ${e.word??"(no prefix)"} `,s+=`word: ${e.completion.filterText?e.completion.filterText+" (filterText)":e.textLabel} `,s+=`distance: ${e.distance} (localityBonus-setting) `,s+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"} `,s+=`commit_chars: ${e.completion.commitCharacters?.join("")} -`,r=new za().appendCodeblock("empty",s),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!sde(e)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),i){const s=i.length>1e5?`${i.substr(0,1e5)}…`:i;this._type.textContent=s,this._type.title=s,Qc(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(s))}else Jo(this._type),this._type.title="",Al(this._type),this.domNode.classList.add("no-type");if(Jo(this._docs),typeof r=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),Jo(this._docs);const s=this._markdownRenderer.render(r);this._docs.appendChild(s.element),this._renderDisposeable.add(s),this._renderDisposeable.add(this._markdownRenderer.onDidRenderAsync(()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}))}this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},this._close.onclick=s=>{s.preventDefault(),s.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(e,t){const i=new vi(e,t);vi.equals(i,this._size)||(this._size=i,v0t(this.domNode,e,t)),this._scrollbar.scanDomNode()}scrollDown(e=8){this._body.scrollTop+=e}scrollUp(e=8){this._body.scrollTop-=e}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(e){this._borderWidth=e}get borderWidth(){return this._borderWidth}};hte=W8t([H8t(1,Tt)],hte);class V8t{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new ke,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new Rue,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(e.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let i,r,s=0,o=0;this._disposables.add(this._resizable.onDidWillResize(()=>{i=this._topLeft,r=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(a=>{if(i&&r){this.widget.layout(a.dimension.width,a.dimension.height);let l=!1;a.west&&(o=r.width-a.dimension.width,l=!0),a.north&&(s=r.height-a.dimension.height,l=!0),l&&this._applyTopLeft({top:i.top+s,left:i.left+o})}a.done&&(i=void 0,r=void 0,s=0,o=0,this._userSize=a.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,this._preferAlignAtTop)}))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(e=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),e&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(e,t){const i=e.getBoundingClientRect();this._anchorBox=i,this._preferAlignAtTop=t,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,t)}_placeAtAnchor(e,t,i){const r=kb(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),o=new vi(220,2*s.lineHeight),a=e.top,l=function(){const x=r.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),k=-s.borderWidth+e.left+e.width,L=new vi(x,r.height-e.top-s.borderHeight-s.verticalPadding),D=L.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:k,fit:x-t.width,maxSizeTop:L,maxSizeBottom:D,minSize:o.with(Math.min(x,o.width))}}(),c=function(){const x=e.left-s.borderWidth-s.horizontalPadding,k=Math.max(s.horizontalPadding,e.left-t.width-s.borderWidth),L=new vi(x,r.height-e.top-s.borderHeight-s.verticalPadding),D=L.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:k,fit:x-t.width,maxSizeTop:L,maxSizeBottom:D,minSize:o.with(Math.min(x,o.width))}}(),u=function(){const x=e.left,k=-s.borderWidth+e.top+e.height,L=new vi(e.width-s.borderHeight,r.height-e.top-e.height-s.verticalPadding);return{top:k,left:x,fit:L.height-t.height,maxSizeBottom:L,maxSizeTop:L,minSize:o.with(L.width)}}(),d=[l,c,u],h=d.find(x=>x.fit>=0)??d.sort((x,k)=>k.fit-x.fit)[0],f=e.top+e.height-s.borderHeight;let g,p=t.height;const m=Math.max(h.maxSizeTop.height,h.maxSizeBottom.height);p>m&&(p=m);let _;i?p<=h.maxSizeTop.height?(g=!0,_=h.maxSizeTop):(g=!1,_=h.maxSizeBottom):p<=h.maxSizeBottom.height?(g=!1,_=h.maxSizeBottom):(g=!0,_=h.maxSizeTop);let{top:v,left:y}=h;!g&&p>e.height&&(v=f-p);const C=this._editor.getDomNode();if(C){const x=C.getBoundingClientRect();v-=x.top,y-=x.left}this._applyTopLeft({left:y,top:v}),this._resizable.enableSashes(!g,h===l,g,h!==l),this._resizable.minSize=h.minSize,this._resizable.maxSize=_,this._resizable.layout(p,Math.min(_.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this._editor.layoutOverlayWidget(this)}}var Tp;(function(n){n[n.FILE=0]="FILE",n[n.FOLDER=1]="FOLDER",n[n.ROOT_FOLDER=2]="ROOT_FOLDER"})(Tp||(Tp={}));const z8t=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function w3(n,e,t,i,r){if(zt.isThemeIcon(r))return[`codicon-${r.id}`,"predefined-file-icon"];if(Pt.isUri(r))return[];const s=i===Tp.ROOT_FOLDER?["rootfolder-icon"]:i===Tp.FOLDER?["folder-icon"]:["file-icon"];if(t){let o;if(t.scheme===sn.data)o=Tb.parseMetaData(t).get(Tb.META_DATA_LABEL);else{const a=t.path.match(z8t);a?(o=C3(a[2].toLowerCase()),a[1]&&s.push(`${C3(a[1].toLowerCase())}-name-dir-icon`)):o=C3(t.authority.toLowerCase())}if(i===Tp.ROOT_FOLDER)s.push(`${o}-root-name-folder-icon`);else if(i===Tp.FOLDER)s.push(`${o}-name-folder-icon`);else{if(o){if(s.push(`${o}-name-file-icon`),s.push("name-file-icon"),o.length<=255){const l=o.split(".");for(let c=1;c=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},eK=function(n,e){return function(t,i){e(t,i,n)}};function hBe(n){return`suggest-aria-id:${n}`}const q8t=kr("suggest-more-info",ze.chevronRight,w("suggestMoreInfoIcon","Icon for more information in the suggest widget.")),K8t=new class HD{static{this._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/}static{this._regexStrict=new RegExp(`^${HD._regexRelaxed.source}$`,"i")}extract(e,t){if(e.textLabel.match(HD._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(HD._regexStrict))return t[0]=e.completion.detail,!0;if(e.completion.documentation){const i=typeof e.completion.documentation=="string"?e.completion.documentation:e.completion.documentation.value,r=HD._regexRelaxed.exec(i);if(r&&(r.index===0||r.index+r[0].length===i.length))return t[0]=r[0],!0}return!1}};let fte=class{constructor(e,t,i,r){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=r,this._onDidToggleDetails=new fe,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new ke,i=e;i.classList.add("show-file-icons");const r=Ne(e,qe(".icon")),s=Ne(r,qe("span.colorspan")),o=Ne(e,qe(".contents")),a=Ne(o,qe(".main")),l=Ne(a,qe(".icon-label.codicon")),c=Ne(a,qe("span.left")),u=Ne(a,qe("span.right")),d=new Q8(c,{supportHighlights:!0,supportIcons:!0});t.add(d);const h=Ne(c,qe("span.signature-label")),f=Ne(c,qe("span.qualifier-label")),g=Ne(u,qe("span.details-label")),p=Ne(u,qe("span.readMore"+zt.asCSSSelector(q8t)));return p.title=w("readMore","Read More"),{root:i,left:c,right:u,icon:r,colorspan:s,iconLabel:d,iconContainer:l,parametersLabel:h,qualifierLabel:f,detailsLabel:g,readMore:p,disposables:t,configureFont:()=>{const _=this._editor.getOptions(),v=_.get(50),y=v.getMassagedFontFamily(),C=v.fontFeatureSettings,x=_.get(120)||v.fontSize,k=_.get(121)||v.lineHeight,L=v.fontWeight,D=v.letterSpacing,I=`${x}px`,O=`${k}px`,M=`${D}px`;i.style.fontSize=I,i.style.fontWeight=L,i.style.letterSpacing=M,a.style.fontFamily=y,a.style.fontFeatureSettings=C,a.style.lineHeight=O,r.style.height=O,r.style.width=O,p.style.height=O,p.style.width=O}}}renderElement(e,t,i){i.configureFont();const{completion:r}=e;i.root.id=hBe(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:nO(e.score)},o=[];if(r.kind===19&&K8t.extract(e,o))i.icon.className="icon customcolor",i.iconContainer.className="icon hide",i.colorspan.style.backgroundColor=o[0];else if(r.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){i.icon.className="icon hide",i.iconContainer.className="icon hide";const a=w3(this._modelService,this._languageService,Pt.from({scheme:"fake",path:e.textLabel}),Tp.FILE),l=w3(this._modelService,this._languageService,Pt.from({scheme:"fake",path:r.detail}),Tp.FILE);s.extraClasses=a.length>l.length?a:l}else r.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",s.extraClasses=[w3(this._modelService,this._languageService,Pt.from({scheme:"fake",path:e.textLabel}),Tp.FOLDER),w3(this._modelService,this._languageService,Pt.from({scheme:"fake",path:r.detail}),Tp.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...zt.asClassNameArray(rN.toIcon(r.kind))));r.tags&&r.tags.indexOf(1)>=0&&(s.extraClasses=(s.extraClasses||[]).concat(["deprecated"]),s.matches=[]),i.iconLabel.setLabel(e.textLabel,void 0,s),typeof r.label=="string"?(i.parametersLabel.textContent="",i.detailsLabel.textContent=tK(r.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=tK(r.label.detail||""),i.detailsLabel.textContent=tK(r.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(119).showInlineDetails?Qc(i.detailsLabel):Al(i.detailsLabel),sde(e)?(i.right.classList.add("can-expand-details"),Qc(i.readMore),i.readMore.onmousedown=a=>{a.stopPropagation(),a.preventDefault()},i.readMore.onclick=a=>{a.stopPropagation(),a.preventDefault(),this._onDidToggleDetails.fire()}):(i.right.classList.remove("can-expand-details"),Al(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};fte=j8t([eK(1,Sr),eK(2,Hr),eK(3,go)],fte);function tK(n){return n.replace(/\r\n|\r|\n/g,"")}var G8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},x3=function(n,e){return function(t,i){e(t,i,n)}},eS;J("editorSuggestWidget.background",ju,w("editorSuggestWidgetBackground","Background color of the suggest widget."));J("editorSuggestWidget.border",dle,w("editorSuggestWidgetBorder","Border color of the suggest widget."));const Y8t=J("editorSuggestWidget.foreground",cm,w("editorSuggestWidgetForeground","Foreground color of the suggest widget."));J("editorSuggestWidget.selectedForeground",wN,w("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));J("editorSuggestWidget.selectedIconForeground",vle,w("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const Z8t=J("editorSuggestWidget.selectedBackground",CN,w("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));J("editorSuggestWidget.highlightForeground",xS,w("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));J("editorSuggestWidget.focusHighlightForeground",Dwt,w("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));J("editorSuggestWidgetStatus.foreground",xn(Y8t,.5),w("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class X8t{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof cf}`}restore(){const e=this._service.get(this._key,0)??"";try{const t=JSON.parse(e);if(vi.is(t))return vi.lift(t)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}let gte=class{static{eS=this}static{this.LOADING_MESSAGE=w("suggestWidget.loading","Loading...")}static{this.NO_SUGGESTIONS_MESSAGE=w("suggestWidget.noSuggestions","No suggestions.")}constructor(e,t,i,r,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new To,this._pendingShowDetails=new To,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new hf,this._disposables=new ke,this._onDidSelect=new Ew,this._onDidFocus=new Ew,this._onDidHide=new fe,this._onDidShow=new fe,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new fe,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new Rue,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Q8t(this,e),this._persistedSize=new X8t(t,e);class o{constructor(f,g,p=!1,m=!1){this.persistedSize=f,this.currentSize=g,this.persistHeight=p,this.persistWidth=m}}let a;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),a=new o(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(h=>{if(this._resize(h.dimension.width,h.dimension.height),a&&(a.persistHeight=a.persistHeight||!!h.north||!!h.south,a.persistWidth=a.persistWidth||!!h.east||!!h.west),!!h.done){if(a){const{itemHeight:f,defaultSize:g}=this.getLayoutInfo(),p=Math.round(f/2);let{width:m,height:_}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-_)<=p)&&(_=a.persistedSize?.height??g.height),(!a.persistWidth||Math.abs(a.currentSize.width-m)<=p)&&(m=a.persistedSize?.width??g.width),this._persistedSize.store(new vi(m,_))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=Ne(this.element.domNode,qe(".message")),this._listElement=Ne(this.element.domNode,qe(".tree"));const l=this._disposables.add(s.createInstance(hte,this.editor));l.onDidClose(this.toggleDetails,this,this._disposables),this._details=new V8t(l,this.editor);const c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(119).showIcons);c();const u=s.createInstance(fte,this.editor);this._disposables.add(u),this._disposables.add(u.onDidToggleDetails(()=>this.toggleDetails())),this._list=new dd("SuggestWidget",this._listElement,{getHeight:h=>this.getLayoutInfo().itemHeight,getTemplateId:h=>"suggestion"},[u],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>w("suggest","Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:h=>{let f=h.textLabel;if(typeof h.completion.label!="string"){const{detail:_,description:v}=h.completion.label;_&&v?f=w("label.full","{0} {1}, {2}",f,_,v):_?f=w("label.detail","{0} {1}",f,_):v&&(f=w("label.desc","{0}, {1}",f,v))}if(!h.isResolved||!this._isDetailsVisible())return f;const{documentation:g,detail:p}=h.completion,m=Lw("{0}{1}",p||"",g?typeof g=="string"?g:g.value:"");return w("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",f,m)}}}),this._list.style(wC({listInactiveFocusBackground:Z8t,listInactiveFocusOutline:Ar})),this._status=s.createInstance(dte,this.element.domNode,ub);const d=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(119).showStatusBar);d(),this._disposables.add(r.onDidColorThemeChange(h=>this._onThemeChange(h))),this._onThemeChange(r.getColorTheme()),this._disposables.add(this._list.onMouseDown(h=>this._onListMouseDownOrTap(h))),this._disposables.add(this._list.onTap(h=>this._onListMouseDownOrTap(h))),this._disposables.add(this._list.onDidChangeSelection(h=>this._onListSelection(h))),this._disposables.add(this._list.onDidChangeFocus(h=>this._onListFocus(h))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(h=>{h.hasChanged(119)&&(d(),c()),this._completionModel&&(h.hasChanged(50)||h.hasChanged(120)||h.hasChanged(121))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=Cn.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=Cn.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=Cn.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=Cn.HasFocusedSuggestion.bindTo(i),this._disposables.add(Jr(this._details.widget.domNode,"keydown",h=>{this._onDetailsKeydown.fire(h)})),this._disposables.add(this.editor.onMouseDown(h=>this._onEditorMouseDown(h)))}dispose(){this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),this._loadingTimeout?.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(e){this._details.widget.domNode.contains(e.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(e.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){const i=this._completionModel;i&&(this._onDidSelect.fire({item:e,index:t,model:i}),this.editor.focus())}_onThemeChange(e){this._details.widget.borderWidth=mg(e.type)?2:1}_onListFocus(e){if(this._ignoreFocusEvents)return;if(!e.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);const t=e.elements[0],i=e.indexes[0];t!==this._focusedItem&&(this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=t,this._list.reveal(i),this._currentSuggestionDetails=ko(async r=>{const s=Sb(()=>{this._isDetailsVisible()&&this.showDetails(!0)},250),o=r.onCancellationRequested(()=>s.dispose());try{return await t.resolve(r)}finally{s.dispose(),o.dispose()}}),this._currentSuggestionDetails.then(()=>{i>=this._list.length||t!==this._list.element(i)||(this._ignoreFocusEvents=!0,this._list.splice(i,1,[t]),this._list.setFocus([i]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:hBe(i)}))}).catch(rn)),this._onDidFocus.fire({item:t,index:i,model:this._completionModel})}_setState(e){if(this._state!==e)switch(this._state=e,this.element.domNode.classList.toggle("frozen",e===4),this.element.domNode.classList.remove("message"),e){case 0:Al(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=eS.LOADING_MESSAGE,Al(this._listElement,this._status.element),Qc(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Qp(eS.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=eS.NO_SUGGESTIONS_MESSAGE,Al(this._listElement,this._status.element),Qc(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Qp(eS.NO_SUGGESTIONS_MESSAGE);break;case 3:Al(this._messageElement),Qc(this._listElement,this._status.element),this._show();break;case 4:Al(this._messageElement),Qc(this._listElement,this._status.element),this._show();break;case 5:Al(this._messageElement),Qc(this._listElement,this._status.element),this._details.show(),this._show();break}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)},100)}showTriggered(e,t){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!e,this._isAuto||(this._loadingTimeout=Sb(()=>this._setState(1),t)))}showSuggestions(e,t,i,r,s){if(this._contentWidget.setPosition(this.editor.getPosition()),this._loadingTimeout?.dispose(),this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==e&&(this._completionModel=e),i&&this._state!==2&&this._state!==0){this._setState(4);return}const o=this._completionModel.items.length,a=o===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(o>1),a){this._setState(r?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(i?4:3),this._list.reveal(t,0),this._list.setFocus(s?[]:[t])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=K6(Ot(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._setState(3),this._details.widget.domNode.classList.remove("focused")):this._state===3&&this._isDetailsVisible()&&(this._setState(5),this._details.widget.domNode.classList.add("focused"))}toggleDetails(){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(sde(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this.showDetails(!1))}showDetails(e){this._pendingShowDetails.value=K6(Ot(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show(),e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details")),this.editor.focus()})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this.showDetails(!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){this._pendingLayout.clear(),this._pendingShowDetails.clear(),this._loadingTimeout?.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const e=this._persistedSize.restore(),t=Math.ceil(this.getLayoutInfo().itemHeight*4.3);e&&e.heighto&&(s=o);const a=this._completionModel?this._completionModel.stats.pLabelLen*i.typicalHalfwidthCharacterWidth:s,l=i.statusBarHeight+this._list.contentHeight+i.borderHeight,c=i.itemHeight+i.statusBarHeight,u=ms(this.editor.getDomNode()),d=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),h=u.top+d.top+d.height,f=Math.min(t.height-h-i.verticalPadding,l),g=u.top+d.top-i.verticalPadding,p=Math.min(g,l);let m=Math.min(Math.max(p,f)+i.borderHeight,l);r===this._cappedHeight?.capped&&(r=this._cappedHeight.wanted),rm&&(r=m),r>f||this._forceRenderingAbove&&g>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),m=p):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),m=f),this.element.preferredSize=new vi(a,i.defaultSize.height),this.element.maxSize=new vi(o,m),this.element.minSize=new vi(220,c),this._cappedHeight=r===l?{wanted:this._cappedHeight?.wanted??e.height,capped:r}:void 0}this._resize(s,r)}_resize(e,t){const{width:i,height:r}=this.element.maxSize;e=Math.min(i,e),t=Math.min(r,t);const{statusBarHeight:s}=this.getLayoutInfo();this._list.layout(t-s,e),this._listElement.style.height=`${t-s}px`,this.element.layout(t,e),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,this._contentWidget.getPosition()?.preference[0]===2)}getLayoutInfo(){const e=this.editor.getOption(50),t=Il(this.editor.getOption(121)||e.lineHeight,8,1e3),i=!this.editor.getOption(119).showStatusBar||this._state===2||this._state===1?0:t,r=this._details.widget.borderWidth,s=2*r;return{itemHeight:t,statusBarHeight:i,borderWidth:r,borderHeight:s,typicalHalfwidthCharacterWidth:e.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new vi(430,i+12*t+s)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};gte=eS=G8t([x3(1,pf),x3(2,jt),x3(3,go),x3(4,Tt)],gte);class Q8t{constructor(e,t){this._widget=e,this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return this._hidden||!this._position||!this._preference?null:{position:this._position,preference:[this._preference]}}beforeRender(){const{height:e,width:t}=this._widget.element.size,{borderWidth:i,horizontalPadding:r}=this._widget.getLayoutInfo();return new vi(t+2*i+r,e+2*i)}afterRender(e){this._widget._afterRender(e)}setPreference(e){this._preferenceLocked||(this._preference=e)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(e){this._position=e}}var J8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ex=function(n,e){return function(t,i){e(t,i,n)}},pte;class e9t{constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=un.register({description:"suggest-line-suffix",stickiness:1}),e.getLineMaxColumn(t.lineNumber)!==t.column){const r=e.getOffsetAt(t),s=e.getPositionAt(r+1);e.changeDecorations(o=>{this._marker&&o.removeDecoration(this._marker),this._marker=o.addDecoration($.fromPositions(t,s),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(e=>{e.removeDecoration(this._marker),this._marker=void 0})}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){const t=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}else return this._model.getLineMaxColumn(e.lineNumber)-e.column}}let Gh=class{static{pte=this}static{this.ID="editor.contrib.suggestController"}static get(e){return e.getContribution(pte.ID)}constructor(e,t,i,r,s,o,a){this._memoryService=t,this._commandService=i,this._contextKeyService=r,this._instantiationService=s,this._logService=o,this._telemetryService=a,this._lineSuffix=new To,this._toDispose=new ke,this._selectors=new t9t(d=>d.priority),this._onWillInsertSuggestItem=new fe,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(G9,this.editor),this._selectors.register({priority:0,select:(d,h,f)=>this._memoryService.select(d,h,f)});const l=Cn.InsertMode.bindTo(r);l.set(e.getOption(119).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>l.set(e.getOption(119).insertMode))),this.widget=this._toDispose.add(new wj(Ot(e.getDomNode()),()=>{const d=this._instantiationService.createInstance(gte,this.editor);this._toDispose.add(d),this._toDispose.add(d.onDidSelect(m=>this._insertSuggestion(m,0),this));const h=new O8t(this.editor,d,this.model,m=>this._insertSuggestion(m,2));this._toDispose.add(h);const f=Cn.MakesTextEdit.bindTo(this._contextKeyService),g=Cn.HasInsertAndReplaceRange.bindTo(this._contextKeyService),p=Cn.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(Lt(()=>{f.reset(),g.reset(),p.reset()})),this._toDispose.add(d.onDidFocus(({item:m})=>{const _=this.editor.getPosition(),v=m.editStart.column,y=_.column;let C=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!m.completion.additionalTextEdits&&!(m.completion.insertTextRules&4)&&y-v===m.completion.insertText.length&&(C=this.editor.getModel().getValueInRange({startLineNumber:_.lineNumber,startColumn:v,endLineNumber:_.lineNumber,endColumn:y})!==m.completion.insertText),f.set(C),g.set(!he.equals(m.editInsertEnd,m.editReplaceEnd)),p.set(!!m.provider.resolveCompletionItem||!!m.completion.documentation||m.completion.detail!==m.completion.label)})),this._toDispose.add(d.onDetailsKeyDown(m=>{if(m.toKeyCodeChord().equals(new G_(!0,!1,!1,!1,33))||Rn&&m.toKeyCodeChord().equals(new G_(!1,!1,!1,!0,33))){m.stopPropagation();return}m.toKeyCodeChord().isModifierKey()||this.editor.focus()})),d})),this._overtypingCapturer=this._toDispose.add(new wj(Ot(e.getDomNode()),()=>this._toDispose.add(new rde(this.editor,this.model)))),this._alternatives=this._toDispose.add(new wj(Ot(e.getDomNode()),()=>this._toDispose.add(new FE(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(K9,e)),this._toDispose.add(this.model.onDidTrigger(d=>{this.widget.value.showTriggered(d.auto,d.shy?250:50),this._lineSuffix.value=new e9t(this.editor.getModel(),d.position)})),this._toDispose.add(this.model.onDidSuggest(d=>{if(d.triggerOptions.shy)return;let h=-1;for(const g of this._selectors.itemsOrderedByPriorityDesc)if(h=g.select(this.editor.getModel(),this.editor.getPosition(),d.completionModel.items),h!==-1)break;if(h===-1&&(h=0),this.model.state===0)return;let f=!1;if(d.triggerOptions.auto){const g=this.editor.getOption(119);g.selectionMode==="never"||g.selectionMode==="always"?f=g.selectionMode==="never":g.selectionMode==="whenTriggerCharacter"?f=d.triggerOptions.triggerKind!==1:g.selectionMode==="whenQuickSuggestion"&&(f=d.triggerOptions.triggerKind===1&&!d.triggerOptions.refilter)}this.widget.value.showSuggestions(d.completionModel,h,d.isFrozen,d.triggerOptions.auto,f)})),this._toDispose.add(this.model.onDidCancel(d=>{d.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));const c=Cn.AcceptSuggestionsOnEnter.bindTo(r),u=()=>{const d=this.editor.getOption(1);c.set(d==="on"||d==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>u())),u()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(e,t){if(!e||!e.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;const i=Kl.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const r=this.editor.getModel(),s=r.getAlternativeVersionId(),{item:o}=e,a=[],l=new Kr;t&1||this.editor.pushUndoStop();const c=this.getOverwriteInfo(o,!!(t&8));this._memoryService.memorize(r,this.editor.getPosition(),o);const u=o.isResolved;let d=-1,h=-1;if(Array.isArray(o.completion.additionalTextEdits)){this.model.cancel();const g=Ag.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",o.completion.additionalTextEdits.map(p=>{let m=$.lift(p.range);if(m.startLineNumber===o.position.lineNumber&&m.startColumn>o.position.column){const _=this.editor.getPosition().column-o.position.column,v=_,y=$.spansMultipleLines(m)?0:_;m=new $(m.startLineNumber,m.startColumn+v,m.endLineNumber,m.endColumn+y)}return jr.replaceMove(m,p.text)})),g.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!u){const g=new Bo;let p;const m=r.onDidChangeContent(C=>{if(C.isFlush){l.cancel(),m.dispose();return}for(const x of C.changes){const k=$.getEndPosition(x.range);(!p||he.isBefore(k,p))&&(p=k)}}),_=t;t|=2;let v=!1;const y=this.editor.onWillType(()=>{y.dispose(),v=!0,_&2||this.editor.pushUndoStop()});a.push(o.resolve(l.token).then(()=>{if(!o.completion.additionalTextEdits||l.token.isCancellationRequested)return;if(p&&o.completion.additionalTextEdits.some(x=>he.isBefore(p,$.getStartPosition(x.range))))return!1;v&&this.editor.pushUndoStop();const C=Ag.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",o.completion.additionalTextEdits.map(x=>jr.replaceMove($.lift(x.range),x.text))),C.restoreRelativeVerticalPositionOfCursor(this.editor),(v||!(_&2))&&this.editor.pushUndoStop(),!0}).then(C=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",g.elapsed(),C),h=C===!0?1:C===!1?0:-2}).finally(()=>{m.dispose(),y.dispose()}))}let{insertText:f}=o.completion;if(o.completion.insertTextRules&4||(f=zw.escape(f)),this.model.cancel(),i.insert(f,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(o.completion.insertTextRules&1),clipboardText:e.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),t&2||this.editor.pushUndoStop(),o.completion.command)if(o.completion.command.id===wH.id)this.model.trigger({auto:!0,retrigger:!0});else{const g=new Bo;a.push(this._commandService.executeCommand(o.completion.command.id,...o.completion.command.arguments?[...o.completion.command.arguments]:[]).catch(p=>{o.completion.extensionId?vs(p):rn(p)}).finally(()=>{d=g.elapsed()}))}t&4&&this._alternatives.value.set(e,g=>{for(l.cancel();r.canUndo();){s!==r.getAlternativeVersionId()&&r.undo(),this._insertSuggestion(g,3|(t&8?8:0));break}}),this._alertCompletionItem(o),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(o,r,u,d,h,e.index,e.model.items),this.model.clear(),l.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,r,s,o,a){if(Math.floor(Math.random()*100)===0)return;const l=new Map;for(let h=0;h1?c[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:e.extensionId?.value??"unknown",providerId:e.provider._debugDisplayName??"unknown",kind:e.completion.kind,basenameHash:F$(th(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:HCt(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:r,additionalEditsAsync:s,index:o,firstIndex:d})}getOverwriteInfo(e,t){oi(this.editor.hasModel());let i=this.editor.getOption(119).insertMode==="replace";t&&(i=!i);const r=e.position.column-e.editStart.column,s=(i?e.editReplaceEnd.column:e.editInsertEnd.column)-e.position.column,o=this.editor.getPosition().column-e.position.column,a=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:r+o,overwriteAfter:s+a}}_alertCompletionItem(e){if(bl(e.completion.additionalTextEdits)){const t=w("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);ql(t)}}triggerSuggest(e,t,i){this.editor.hasModel()&&(this.model.trigger({auto:t??!1,completionOptions:{providerFilter:e,kindFilter:i?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(e){if(!this.editor.hasModel())return;const t=this.editor.getPosition(),i=()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},r=s=>{if(s.completion.insertTextRules&4||s.completion.additionalTextEdits)return!0;const o=this.editor.getPosition(),a=s.editStart.column,l=o.column;return l-a!==s.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:o.lineNumber,startColumn:a,endLineNumber:o.lineNumber,endColumn:l})!==s.completion.insertText};Ge.once(this.model.onDidTrigger)(s=>{const o=[];Ge.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{er(o),i()},void 0,o),this.model.onDidSuggest(({completionModel:a})=>{if(er(o),a.items.length===0){i();return}const l=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),c=a.items[l];if(!r(c)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:l,item:c,model:a},7)},void 0,o)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(t,0),this.editor.focus()}acceptSelectedSuggestion(e,t){const i=this.widget.value.getFocusedItem();let r=0;e&&(r|=4),t&&(r|=8),this._insertSuggestion(i,r)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.value.forceRenderingAbove()}stopForceRenderingAbove(){this.widget.isInitialized&&this.widget.value.stopForceRenderingAbove()}registerSelector(e){return this._selectors.register(e)}};Gh=pte=J8t([Ex(1,yH),Ex(2,_r),Ex(3,jt),Ex(4,Tt),Ex(5,Da),Ex(6,Qa)],Gh);class t9t{constructor(e){this.prioritySelector=e,this._items=new Array}register(e){if(this._items.indexOf(e)!==-1)throw new Error("Value is already registered");return this._items.push(e),this._items.sort((t,i)=>this.prioritySelector(i)-this.prioritySelector(t)),{dispose:()=>{const t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}class wH extends ot{static{this.id="editor.action.triggerSuggest"}constructor(){super({id:wH.id,label:w("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:Le.and(Q.writable,Q.hasCompletionItemProvider,Cn.Visible.toNegated()),kbOpts:{kbExpr:Q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const r=Gh.get(t);if(!r)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),r.triggerSuggest(void 0,s,void 0)}}Zn(Gh.ID,Gh,2);Pe(wH);const od=190,Xl=fo.bindToContribution(Gh.get);Je(new Xl({id:"acceptSelectedSuggestion",precondition:Le.and(Cn.Visible,Cn.HasFocusedSuggestion),handler(n){n.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Le.and(Cn.Visible,Q.textInputFocus),weight:od},{primary:3,kbExpr:Le.and(Cn.Visible,Q.textInputFocus,Cn.AcceptSuggestionsOnEnter,Cn.MakesTextEdit),weight:od}],menuOpts:[{menuId:ub,title:w("accept.insert","Insert"),group:"left",order:1,when:Cn.HasInsertAndReplaceRange.toNegated()},{menuId:ub,title:w("accept.insert","Insert"),group:"left",order:1,when:Le.and(Cn.HasInsertAndReplaceRange,Cn.InsertMode.isEqualTo("insert"))},{menuId:ub,title:w("accept.replace","Replace"),group:"left",order:1,when:Le.and(Cn.HasInsertAndReplaceRange,Cn.InsertMode.isEqualTo("replace"))}]}));Je(new Xl({id:"acceptAlternativeSelectedSuggestion",precondition:Le.and(Cn.Visible,Q.textInputFocus,Cn.HasFocusedSuggestion),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:1027,secondary:[1026]},handler(n){n.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:ub,group:"left",order:2,when:Le.and(Cn.HasInsertAndReplaceRange,Cn.InsertMode.isEqualTo("insert")),title:w("accept.replace","Replace")},{menuId:ub,group:"left",order:2,when:Le.and(Cn.HasInsertAndReplaceRange,Cn.InsertMode.isEqualTo("replace")),title:w("accept.insert","Insert")}]}));Un.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");Je(new Xl({id:"hideSuggestWidget",precondition:Cn.Visible,handler:n=>n.cancelSuggestWidget(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:9,secondary:[1033]}}));Je(new Xl({id:"selectNextSuggestion",precondition:Le.and(Cn.Visible,Le.or(Cn.MultipleSuggestions,Cn.HasFocusedSuggestion.negate())),handler:n=>n.selectNextSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));Je(new Xl({id:"selectNextPageSuggestion",precondition:Le.and(Cn.Visible,Le.or(Cn.MultipleSuggestions,Cn.HasFocusedSuggestion.negate())),handler:n=>n.selectNextPageSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:12,secondary:[2060]}}));Je(new Xl({id:"selectLastSuggestion",precondition:Le.and(Cn.Visible,Le.or(Cn.MultipleSuggestions,Cn.HasFocusedSuggestion.negate())),handler:n=>n.selectLastSuggestion()}));Je(new Xl({id:"selectPrevSuggestion",precondition:Le.and(Cn.Visible,Le.or(Cn.MultipleSuggestions,Cn.HasFocusedSuggestion.negate())),handler:n=>n.selectPrevSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));Je(new Xl({id:"selectPrevPageSuggestion",precondition:Le.and(Cn.Visible,Le.or(Cn.MultipleSuggestions,Cn.HasFocusedSuggestion.negate())),handler:n=>n.selectPrevPageSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:11,secondary:[2059]}}));Je(new Xl({id:"selectFirstSuggestion",precondition:Le.and(Cn.Visible,Le.or(Cn.MultipleSuggestions,Cn.HasFocusedSuggestion.negate())),handler:n=>n.selectFirstSuggestion()}));Je(new Xl({id:"focusSuggestion",precondition:Le.and(Cn.Visible,Cn.HasFocusedSuggestion.negate()),handler:n=>n.focusSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));Je(new Xl({id:"focusAndAcceptSuggestion",precondition:Le.and(Cn.Visible,Cn.HasFocusedSuggestion.negate()),handler:n=>{n.focusSuggestion(),n.acceptSelectedSuggestion(!0,!1)}}));Je(new Xl({id:"toggleSuggestionDetails",precondition:Le.and(Cn.Visible,Cn.HasFocusedSuggestion),handler:n=>n.toggleSuggestionDetails(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:ub,group:"right",order:1,when:Le.and(Cn.DetailsVisible,Cn.CanResolve),title:w("detail.more","Show Less")},{menuId:ub,group:"right",order:1,when:Le.and(Cn.DetailsVisible.toNegated(),Cn.CanResolve),title:w("detail.less","Show More")}]}));Je(new Xl({id:"toggleExplainMode",precondition:Cn.Visible,handler:n=>n.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));Je(new Xl({id:"toggleSuggestionFocus",precondition:Cn.Visible,handler:n=>n.toggleSuggestionFocus(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:2570,mac:{primary:778}}}));Je(new Xl({id:"insertBestCompletion",precondition:Le.and(Q.textInputFocus,Le.equals("config.editor.tabCompletion","on"),K9.AtEnd,Cn.Visible.toNegated(),FE.OtherSuggestions.toNegated(),Kl.InSnippetMode.toNegated()),handler:(n,e)=>{n.triggerSuggestAndAcceptBest(Mo(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:od,primary:2}}));Je(new Xl({id:"insertNextSuggestion",precondition:Le.and(Q.textInputFocus,Le.equals("config.editor.tabCompletion","on"),FE.OtherSuggestions,Cn.Visible.toNegated(),Kl.InSnippetMode.toNegated()),handler:n=>n.acceptNextSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:2}}));Je(new Xl({id:"insertPrevSuggestion",precondition:Le.and(Q.textInputFocus,Le.equals("config.editor.tabCompletion","on"),FE.OtherSuggestions,Cn.Visible.toNegated(),Kl.InSnippetMode.toNegated()),handler:n=>n.acceptPrevSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:1026}}));Pe(class extends ot{constructor(){super({id:"editor.action.resetSuggestSize",label:w("suggest.reset.label","Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(n,e){Gh.get(e)?.resetWidgetSize()}});class n9t extends me{get selectedItem(){return this._currentSuggestItemInfo}constructor(e,t,i){super(),this.editor=e,this.suggestControllerPreselector=t,this.onWillAccept=i,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._onDidSelectedItemChange=this._register(new fe),this.onDidSelectedItemChange=this._onDidSelectedItemChange.event,this._register(e.onKeyDown(s=>{s.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(s=>{s.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));const r=Gh.get(this.editor);if(r){this._register(r.registerSelector({priority:100,select:(a,l,c)=>{const u=this.editor.getModel();if(!u)return-1;const d=this.suggestControllerPreselector(),h=d?ow(d,u):void 0;if(!h)return-1;const f=he.lift(l),g=c.map((m,_)=>{const v=qI.fromSuggestion(r,u,f,m,this.isShiftKeyPressed),y=ow(v.toSingleTextEdit(),u),C=dBe(h,y);return{index:_,valid:C,prefixLength:y.text.length,suggestItem:m}}).filter(m=>m&&m.valid&&m.prefixLength>0),p=tle(g,$l(m=>m.prefixLength,Xh));return p?p.index:-1}}));let s=!1;const o=()=>{s||(s=!0,this._register(r.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(r.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(r.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(Ge.once(r.model.onDidTrigger)(a=>{o()})),this._register(r.onWillInsertSuggestItem(a=>{const l=this.editor.getPosition(),c=this.editor.getModel();if(!l||!c)return;const u=qI.fromSuggestion(r,c,l,a.item,this.isShiftKeyPressed);this.onWillAccept(u)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!i9t(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const e=Gh.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;const t=e.widget.value.getFocusedItem(),i=this.editor.getPosition(),r=this.editor.getModel();if(!(!t||!i||!r))return qI.fromSuggestion(e,r,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){Gh.get(this.editor)?.stopForceRenderingAbove()}forceRenderingAbove(){Gh.get(this.editor)?.forceRenderingAbove()}}class qI{static fromSuggestion(e,t,i,r,s){let{insertText:o}=r.completion,a=!1;if(r.completion.insertTextRules&4){const c=new zw().parse(o);c.children.length<100&&q9.adjustWhitespace(t,i,!0,c),o=c.toString(),a=!0}const l=e.getOverwriteInfo(r,s);return new qI($.fromPositions(i.delta(0,-l.overwriteBefore),i.delta(0,Math.max(l.overwriteAfter,0))),o,r.completion.kind,a)}constructor(e,t,i,r){this.range=e,this.insertText=t,this.completionItemKind=i,this.isSnippetText=r}equals(e){return this.range.equalsRange(e.range)&&this.insertText===e.insertText&&this.completionItemKind===e.completionItemKind&&this.isSnippetText===e.isSnippetText}toSelectedSuggestionInfo(){return new M4e(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new Yp(this.range,this.insertText)}}function i9t(n,e){return n===e?!0:!n||!e?!1:n.equals(e)}var r9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Pm=function(n,e){return function(t,i){e(t,i,n)}},mte;let ih=class extends me{static{mte=this}static{this.ID="editor.contrib.inlineCompletionsController"}static get(e){return e.getContribution(mte.ID)}constructor(e,t,i,r,s,o,a,l,c,u){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=r,this._commandService=s,this._debounceService=o,this._languageFeaturesService=a,this._accessibilitySignalService=l,this._keybindingService=c,this._accessibilityService=u,this._editorObs=Jc(this.editor),this._positions=St(this,h=>this._editorObs.selections.read(h)?.map(f=>f.getEndPosition())??[new he(1,1)]),this._suggestWidgetAdaptor=this._register(new n9t(this.editor,()=>(this._editorObs.forceUpdate(),this.model.get()?.selectedInlineCompletion.get()?.toSingleTextEdit(void 0)),h=>this._editorObs.forceUpdate(f=>{this.model.get()?.handleSuggestAccepted(h)}))),this._suggestWidgetSelectedItem=Bi(this,h=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(f=>h(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem),this._enabledInConfig=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._isScreenReaderEnabled=Bi(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=Bi(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=St(this,h=>this._enabledInConfig.read(h)&&(!this._isScreenReaderEnabled.read(h)||!this._editorDictationInProgress.read(h))),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model=hl(this,h=>{if(this._editorObs.isReadonly.read(h))return;const f=this._editorObs.model.read(h);return f?this._instantiationService.createInstance(ate,f,this._suggestWidgetSelectedItem,this._editorObs.versionId,this._positions,this._debounceValue,Bi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).preview),Bi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).previewMode),Bi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).mode),this._enabled):void 0}).recomputeInitiallyAndOnChange(this._store),this._ghostTexts=St(this,h=>this.model.read(h)?.ghostTexts.read(h)??[]),this._stablizedGhostTexts=s9t(this._ghostTexts,this._store),this._ghostTextWidgets=OSt(this,this._stablizedGhostTexts,(h,f)=>f.add(this._instantiationService.createInstance(rte,this.editor,{ghostText:h,minReservedLineCount:Hd(0),targetTextModel:this.model.map(g=>g?.textModel)}))).recomputeInitiallyAndOnChange(this._store),this._playAccessibilitySignal=r2(this),this._fontFamily=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).fontFamily),this._register(new _l(this._contextKeyService,this.model)),this._register(JJ(this._editorObs.onDidType,(h,f)=>{this._enabled.get()&&this.model.get()?.trigger()})),this._register(this._commandService.onDidExecuteCommand(h=>{new Set([Sk.Tab.id,Sk.DeleteLeft.id,Sk.DeleteRight.id,f7e,"acceptSelectedSuggestion"]).has(h.commandId)&&e.hasTextFocus()&&this._enabled.get()&&this._editorObs.forceUpdate(g=>{this.model.get()?.trigger(g)})})),this._register(JJ(this._editorObs.selections,(h,f)=>{f.some(g=>g.reason===3||g.source==="api")&&this.model.get()?.stop()})),this._register(this.editor.onDidBlurEditorWidget(()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(62).keepOnBlur||AE.dropDownVisible||qr(h=>{this.model.get()?.stop(h)})})),this._register(tn(h=>{const f=this.model.read(h)?.state.read(h);f?.suggestItem?f.primaryGhostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(Lt(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const d=cO(this,(h,f)=>{const p=this.model.read(h)?.state.read(h);return this._suggestWidgetSelectedItem.get()?f:p?.inlineCompletion?.semanticId});this._register(uPt(St(h=>(this._playAccessibilitySignal.read(h),d.read(h),{})),async(h,f,g)=>{const p=this.model.get(),m=p?.state.get();if(!m||!p)return;const _=p.textModel.getLineContent(m.primaryGhostText.lineNumber);await Y_(50,lZ(g)),await h5e(this._suggestWidgetSelectedItem,ml,()=>!1,lZ(g)),await this._accessibilitySignalService.playSignal(Ai.inlineSuggestion),this.editor.getOption(8)&&this._provideScreenReaderUpdate(m.primaryGhostText.renderForScreenReader(_))})),this._register(new Lee(this.editor,this.model,this._instantiationService)),this._register(G6t(St(h=>{const f=this._fontFamily.read(h);return f===""||f==="default"?"":` +`,r=new za().appendCodeblock("empty",s),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!sde(e)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),i){const s=i.length>1e5?`${i.substr(0,1e5)}…`:i;this._type.textContent=s,this._type.title=s,Qc(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(s))}else Jo(this._type),this._type.title="",Al(this._type),this.domNode.classList.add("no-type");if(Jo(this._docs),typeof r=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),Jo(this._docs);const s=this._markdownRenderer.render(r);this._docs.appendChild(s.element),this._renderDisposeable.add(s),this._renderDisposeable.add(this._markdownRenderer.onDidRenderAsync(()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}))}this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},this._close.onclick=s=>{s.preventDefault(),s.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(e,t){const i=new vi(e,t);vi.equals(i,this._size)||(this._size=i,v0t(this.domNode,e,t)),this._scrollbar.scanDomNode()}scrollDown(e=8){this._body.scrollTop+=e}scrollUp(e=8){this._body.scrollTop-=e}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(e){this._borderWidth=e}get borderWidth(){return this._borderWidth}};hte=W8t([H8t(1,Tt)],hte);class V8t{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new ke,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new Rue,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(e.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let i,r,s=0,o=0;this._disposables.add(this._resizable.onDidWillResize(()=>{i=this._topLeft,r=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(a=>{if(i&&r){this.widget.layout(a.dimension.width,a.dimension.height);let l=!1;a.west&&(o=r.width-a.dimension.width,l=!0),a.north&&(s=r.height-a.dimension.height,l=!0),l&&this._applyTopLeft({top:i.top+s,left:i.left+o})}a.done&&(i=void 0,r=void 0,s=0,o=0,this._userSize=a.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,this._preferAlignAtTop)}))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(e=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),e&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(e,t){const i=e.getBoundingClientRect();this._anchorBox=i,this._preferAlignAtTop=t,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,t)}_placeAtAnchor(e,t,i){const r=kb(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),o=new vi(220,2*s.lineHeight),a=e.top,l=function(){const x=r.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),k=-s.borderWidth+e.left+e.width,L=new vi(x,r.height-e.top-s.borderHeight-s.verticalPadding),D=L.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:k,fit:x-t.width,maxSizeTop:L,maxSizeBottom:D,minSize:o.with(Math.min(x,o.width))}}(),c=function(){const x=e.left-s.borderWidth-s.horizontalPadding,k=Math.max(s.horizontalPadding,e.left-t.width-s.borderWidth),L=new vi(x,r.height-e.top-s.borderHeight-s.verticalPadding),D=L.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:k,fit:x-t.width,maxSizeTop:L,maxSizeBottom:D,minSize:o.with(Math.min(x,o.width))}}(),u=function(){const x=e.left,k=-s.borderWidth+e.top+e.height,L=new vi(e.width-s.borderHeight,r.height-e.top-e.height-s.verticalPadding);return{top:k,left:x,fit:L.height-t.height,maxSizeBottom:L,maxSizeTop:L,minSize:o.with(L.width)}}(),d=[l,c,u],h=d.find(x=>x.fit>=0)??d.sort((x,k)=>k.fit-x.fit)[0],f=e.top+e.height-s.borderHeight;let g,p=t.height;const m=Math.max(h.maxSizeTop.height,h.maxSizeBottom.height);p>m&&(p=m);let _;i?p<=h.maxSizeTop.height?(g=!0,_=h.maxSizeTop):(g=!1,_=h.maxSizeBottom):p<=h.maxSizeBottom.height?(g=!1,_=h.maxSizeBottom):(g=!0,_=h.maxSizeTop);let{top:v,left:y}=h;!g&&p>e.height&&(v=f-p);const C=this._editor.getDomNode();if(C){const x=C.getBoundingClientRect();v-=x.top,y-=x.left}this._applyTopLeft({left:y,top:v}),this._resizable.enableSashes(!g,h===l,g,h!==l),this._resizable.minSize=h.minSize,this._resizable.maxSize=_,this._resizable.layout(p,Math.min(_.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this._editor.layoutOverlayWidget(this)}}var Tp;(function(n){n[n.FILE=0]="FILE",n[n.FOLDER=1]="FOLDER",n[n.ROOT_FOLDER=2]="ROOT_FOLDER"})(Tp||(Tp={}));const z8t=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function w3(n,e,t,i,r){if(zt.isThemeIcon(r))return[`codicon-${r.id}`,"predefined-file-icon"];if(Pt.isUri(r))return[];const s=i===Tp.ROOT_FOLDER?["rootfolder-icon"]:i===Tp.FOLDER?["folder-icon"]:["file-icon"];if(t){let o;if(t.scheme===sn.data)o=Tb.parseMetaData(t).get(Tb.META_DATA_LABEL);else{const a=t.path.match(z8t);a?(o=C3(a[2].toLowerCase()),a[1]&&s.push(`${C3(a[1].toLowerCase())}-name-dir-icon`)):o=C3(t.authority.toLowerCase())}if(i===Tp.ROOT_FOLDER)s.push(`${o}-root-name-folder-icon`);else if(i===Tp.FOLDER)s.push(`${o}-name-folder-icon`);else{if(o){if(s.push(`${o}-name-file-icon`),s.push("name-file-icon"),o.length<=255){const l=o.split(".");for(let c=1;c=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},eK=function(n,e){return function(t,i){e(t,i,n)}};function hBe(n){return`suggest-aria-id:${n}`}const q8t=kr("suggest-more-info",ze.chevronRight,w("suggestMoreInfoIcon","Icon for more information in the suggest widget.")),K8t=new class HD{static{this._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/}static{this._regexStrict=new RegExp(`^${HD._regexRelaxed.source}$`,"i")}extract(e,t){if(e.textLabel.match(HD._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(HD._regexStrict))return t[0]=e.completion.detail,!0;if(e.completion.documentation){const i=typeof e.completion.documentation=="string"?e.completion.documentation:e.completion.documentation.value,r=HD._regexRelaxed.exec(i);if(r&&(r.index===0||r.index+r[0].length===i.length))return t[0]=r[0],!0}return!1}};let fte=class{constructor(e,t,i,r){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=r,this._onDidToggleDetails=new fe,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new ke,i=e;i.classList.add("show-file-icons");const r=Ne(e,qe(".icon")),s=Ne(r,qe("span.colorspan")),o=Ne(e,qe(".contents")),a=Ne(o,qe(".main")),l=Ne(a,qe(".icon-label.codicon")),c=Ne(a,qe("span.left")),u=Ne(a,qe("span.right")),d=new Q8(c,{supportHighlights:!0,supportIcons:!0});t.add(d);const h=Ne(c,qe("span.signature-label")),f=Ne(c,qe("span.qualifier-label")),g=Ne(u,qe("span.details-label")),p=Ne(u,qe("span.readMore"+zt.asCSSSelector(q8t)));return p.title=w("readMore","Read More"),{root:i,left:c,right:u,icon:r,colorspan:s,iconLabel:d,iconContainer:l,parametersLabel:h,qualifierLabel:f,detailsLabel:g,readMore:p,disposables:t,configureFont:()=>{const _=this._editor.getOptions(),v=_.get(50),y=v.getMassagedFontFamily(),C=v.fontFeatureSettings,x=_.get(120)||v.fontSize,k=_.get(121)||v.lineHeight,L=v.fontWeight,D=v.letterSpacing,I=`${x}px`,O=`${k}px`,M=`${D}px`;i.style.fontSize=I,i.style.fontWeight=L,i.style.letterSpacing=M,a.style.fontFamily=y,a.style.fontFeatureSettings=C,a.style.lineHeight=O,r.style.height=O,r.style.width=O,p.style.height=O,p.style.width=O}}}renderElement(e,t,i){i.configureFont();const{completion:r}=e;i.root.id=hBe(t),i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:nO(e.score)},o=[];if(r.kind===19&&K8t.extract(e,o))i.icon.className="icon customcolor",i.iconContainer.className="icon hide",i.colorspan.style.backgroundColor=o[0];else if(r.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){i.icon.className="icon hide",i.iconContainer.className="icon hide";const a=w3(this._modelService,this._languageService,Pt.from({scheme:"fake",path:e.textLabel}),Tp.FILE),l=w3(this._modelService,this._languageService,Pt.from({scheme:"fake",path:r.detail}),Tp.FILE);s.extraClasses=a.length>l.length?a:l}else r.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",s.extraClasses=[w3(this._modelService,this._languageService,Pt.from({scheme:"fake",path:e.textLabel}),Tp.FOLDER),w3(this._modelService,this._languageService,Pt.from({scheme:"fake",path:r.detail}),Tp.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...zt.asClassNameArray(rN.toIcon(r.kind))));r.tags&&r.tags.indexOf(1)>=0&&(s.extraClasses=(s.extraClasses||[]).concat(["deprecated"]),s.matches=[]),i.iconLabel.setLabel(e.textLabel,void 0,s),typeof r.label=="string"?(i.parametersLabel.textContent="",i.detailsLabel.textContent=tK(r.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=tK(r.label.detail||""),i.detailsLabel.textContent=tK(r.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(119).showInlineDetails?Qc(i.detailsLabel):Al(i.detailsLabel),sde(e)?(i.right.classList.add("can-expand-details"),Qc(i.readMore),i.readMore.onmousedown=a=>{a.stopPropagation(),a.preventDefault()},i.readMore.onclick=a=>{a.stopPropagation(),a.preventDefault(),this._onDidToggleDetails.fire()}):(i.right.classList.remove("can-expand-details"),Al(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};fte=j8t([eK(1,Sr),eK(2,Hr),eK(3,go)],fte);function tK(n){return n.replace(/\r\n|\r|\n/g,"")}var G8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},x3=function(n,e){return function(t,i){e(t,i,n)}},eS;J("editorSuggestWidget.background",ju,w("editorSuggestWidgetBackground","Background color of the suggest widget."));J("editorSuggestWidget.border",dle,w("editorSuggestWidgetBorder","Border color of the suggest widget."));const Y8t=J("editorSuggestWidget.foreground",cm,w("editorSuggestWidgetForeground","Foreground color of the suggest widget."));J("editorSuggestWidget.selectedForeground",wN,w("editorSuggestWidgetSelectedForeground","Foreground color of the selected entry in the suggest widget."));J("editorSuggestWidget.selectedIconForeground",vle,w("editorSuggestWidgetSelectedIconForeground","Icon foreground color of the selected entry in the suggest widget."));const Z8t=J("editorSuggestWidget.selectedBackground",CN,w("editorSuggestWidgetSelectedBackground","Background color of the selected entry in the suggest widget."));J("editorSuggestWidget.highlightForeground",xS,w("editorSuggestWidgetHighlightForeground","Color of the match highlights in the suggest widget."));J("editorSuggestWidget.focusHighlightForeground",Dwt,w("editorSuggestWidgetFocusHighlightForeground","Color of the match highlights in the suggest widget when an item is focused."));J("editorSuggestWidgetStatus.foreground",Sn(Y8t,.5),w("editorSuggestWidgetStatusForeground","Foreground color of the suggest widget status."));class X8t{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof cf}`}restore(){const e=this._service.get(this._key,0)??"";try{const t=JSON.parse(e);if(vi.is(t))return vi.lift(t)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}let gte=class{static{eS=this}static{this.LOADING_MESSAGE=w("suggestWidget.loading","Loading...")}static{this.NO_SUGGESTIONS_MESSAGE=w("suggestWidget.noSuggestions","No suggestions.")}constructor(e,t,i,r,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new To,this._pendingShowDetails=new To,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new hf,this._disposables=new ke,this._onDidSelect=new Ew,this._onDidFocus=new Ew,this._onDidHide=new fe,this._onDidShow=new fe,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new fe,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new Rue,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Q8t(this,e),this._persistedSize=new X8t(t,e);class o{constructor(f,g,p=!1,m=!1){this.persistedSize=f,this.currentSize=g,this.persistHeight=p,this.persistWidth=m}}let a;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),a=new o(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(h=>{if(this._resize(h.dimension.width,h.dimension.height),a&&(a.persistHeight=a.persistHeight||!!h.north||!!h.south,a.persistWidth=a.persistWidth||!!h.east||!!h.west),!!h.done){if(a){const{itemHeight:f,defaultSize:g}=this.getLayoutInfo(),p=Math.round(f/2);let{width:m,height:_}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-_)<=p)&&(_=a.persistedSize?.height??g.height),(!a.persistWidth||Math.abs(a.currentSize.width-m)<=p)&&(m=a.persistedSize?.width??g.width),this._persistedSize.store(new vi(m,_))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=Ne(this.element.domNode,qe(".message")),this._listElement=Ne(this.element.domNode,qe(".tree"));const l=this._disposables.add(s.createInstance(hte,this.editor));l.onDidClose(this.toggleDetails,this,this._disposables),this._details=new V8t(l,this.editor);const c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(119).showIcons);c();const u=s.createInstance(fte,this.editor);this._disposables.add(u),this._disposables.add(u.onDidToggleDetails(()=>this.toggleDetails())),this._list=new dd("SuggestWidget",this._listElement,{getHeight:h=>this.getLayoutInfo().itemHeight,getTemplateId:h=>"suggestion"},[u],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>w("suggest","Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:h=>{let f=h.textLabel;if(typeof h.completion.label!="string"){const{detail:_,description:v}=h.completion.label;_&&v?f=w("label.full","{0} {1}, {2}",f,_,v):_?f=w("label.detail","{0} {1}",f,_):v&&(f=w("label.desc","{0}, {1}",f,v))}if(!h.isResolved||!this._isDetailsVisible())return f;const{documentation:g,detail:p}=h.completion,m=Lw("{0}{1}",p||"",g?typeof g=="string"?g:g.value:"");return w("ariaCurrenttSuggestionReadDetails","{0}, docs: {1}",f,m)}}}),this._list.style(wC({listInactiveFocusBackground:Z8t,listInactiveFocusOutline:Ar})),this._status=s.createInstance(dte,this.element.domNode,ub);const d=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(119).showStatusBar);d(),this._disposables.add(r.onDidColorThemeChange(h=>this._onThemeChange(h))),this._onThemeChange(r.getColorTheme()),this._disposables.add(this._list.onMouseDown(h=>this._onListMouseDownOrTap(h))),this._disposables.add(this._list.onTap(h=>this._onListMouseDownOrTap(h))),this._disposables.add(this._list.onDidChangeSelection(h=>this._onListSelection(h))),this._disposables.add(this._list.onDidChangeFocus(h=>this._onListFocus(h))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(h=>{h.hasChanged(119)&&(d(),c()),this._completionModel&&(h.hasChanged(50)||h.hasChanged(120)||h.hasChanged(121))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=xn.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=xn.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=xn.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=xn.HasFocusedSuggestion.bindTo(i),this._disposables.add(Jr(this._details.widget.domNode,"keydown",h=>{this._onDetailsKeydown.fire(h)})),this._disposables.add(this.editor.onMouseDown(h=>this._onEditorMouseDown(h)))}dispose(){this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),this._loadingTimeout?.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(e){this._details.widget.domNode.contains(e.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(e.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){const i=this._completionModel;i&&(this._onDidSelect.fire({item:e,index:t,model:i}),this.editor.focus())}_onThemeChange(e){this._details.widget.borderWidth=mg(e.type)?2:1}_onListFocus(e){if(this._ignoreFocusEvents)return;if(!e.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);const t=e.elements[0],i=e.indexes[0];t!==this._focusedItem&&(this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=t,this._list.reveal(i),this._currentSuggestionDetails=ko(async r=>{const s=Sb(()=>{this._isDetailsVisible()&&this.showDetails(!0)},250),o=r.onCancellationRequested(()=>s.dispose());try{return await t.resolve(r)}finally{s.dispose(),o.dispose()}}),this._currentSuggestionDetails.then(()=>{i>=this._list.length||t!==this._list.element(i)||(this._ignoreFocusEvents=!0,this._list.splice(i,1,[t]),this._list.setFocus([i]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:hBe(i)}))}).catch(rn)),this._onDidFocus.fire({item:t,index:i,model:this._completionModel})}_setState(e){if(this._state!==e)switch(this._state=e,this.element.domNode.classList.toggle("frozen",e===4),this.element.domNode.classList.remove("message"),e){case 0:Al(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=eS.LOADING_MESSAGE,Al(this._listElement,this._status.element),Qc(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Qp(eS.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=eS.NO_SUGGESTIONS_MESSAGE,Al(this._listElement,this._status.element),Qc(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Qp(eS.NO_SUGGESTIONS_MESSAGE);break;case 3:Al(this._messageElement),Qc(this._listElement,this._status.element),this._show();break;case 4:Al(this._messageElement),Qc(this._listElement,this._status.element),this._show();break;case 5:Al(this._messageElement),Qc(this._listElement,this._status.element),this._details.show(),this._show();break}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)},100)}showTriggered(e,t){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!e,this._isAuto||(this._loadingTimeout=Sb(()=>this._setState(1),t)))}showSuggestions(e,t,i,r,s){if(this._contentWidget.setPosition(this.editor.getPosition()),this._loadingTimeout?.dispose(),this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==e&&(this._completionModel=e),i&&this._state!==2&&this._state!==0){this._setState(4);return}const o=this._completionModel.items.length,a=o===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(o>1),a){this._setState(r?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(i?4:3),this._list.reveal(t,0),this._list.setFocus(s?[]:[t])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=K6(Ot(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._setState(3),this._details.widget.domNode.classList.remove("focused")):this._state===3&&this._isDetailsVisible()&&(this._setState(5),this._details.widget.domNode.classList.add("focused"))}toggleDetails(){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(sde(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this.showDetails(!1))}showDetails(e){this._pendingShowDetails.value=K6(Ot(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show(),e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details")),this.editor.focus()})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this.showDetails(!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){this._pendingLayout.clear(),this._pendingShowDetails.clear(),this._loadingTimeout?.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const e=this._persistedSize.restore(),t=Math.ceil(this.getLayoutInfo().itemHeight*4.3);e&&e.heighto&&(s=o);const a=this._completionModel?this._completionModel.stats.pLabelLen*i.typicalHalfwidthCharacterWidth:s,l=i.statusBarHeight+this._list.contentHeight+i.borderHeight,c=i.itemHeight+i.statusBarHeight,u=ms(this.editor.getDomNode()),d=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),h=u.top+d.top+d.height,f=Math.min(t.height-h-i.verticalPadding,l),g=u.top+d.top-i.verticalPadding,p=Math.min(g,l);let m=Math.min(Math.max(p,f)+i.borderHeight,l);r===this._cappedHeight?.capped&&(r=this._cappedHeight.wanted),rm&&(r=m),r>f||this._forceRenderingAbove&&g>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),m=p):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),m=f),this.element.preferredSize=new vi(a,i.defaultSize.height),this.element.maxSize=new vi(o,m),this.element.minSize=new vi(220,c),this._cappedHeight=r===l?{wanted:this._cappedHeight?.wanted??e.height,capped:r}:void 0}this._resize(s,r)}_resize(e,t){const{width:i,height:r}=this.element.maxSize;e=Math.min(i,e),t=Math.min(r,t);const{statusBarHeight:s}=this.getLayoutInfo();this._list.layout(t-s,e),this._listElement.style.height=`${t-s}px`,this.element.layout(t,e),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,this._contentWidget.getPosition()?.preference[0]===2)}getLayoutInfo(){const e=this.editor.getOption(50),t=Il(this.editor.getOption(121)||e.lineHeight,8,1e3),i=!this.editor.getOption(119).showStatusBar||this._state===2||this._state===1?0:t,r=this._details.widget.borderWidth,s=2*r;return{itemHeight:t,statusBarHeight:i,borderWidth:r,borderHeight:s,typicalHalfwidthCharacterWidth:e.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new vi(430,i+12*t+s)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};gte=eS=G8t([x3(1,pf),x3(2,jt),x3(3,go),x3(4,Tt)],gte);class Q8t{constructor(e,t){this._widget=e,this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return this._hidden||!this._position||!this._preference?null:{position:this._position,preference:[this._preference]}}beforeRender(){const{height:e,width:t}=this._widget.element.size,{borderWidth:i,horizontalPadding:r}=this._widget.getLayoutInfo();return new vi(t+2*i+r,e+2*i)}afterRender(e){this._widget._afterRender(e)}setPreference(e){this._preferenceLocked||(this._preference=e)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(e){this._position=e}}var J8t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ex=function(n,e){return function(t,i){e(t,i,n)}},pte;class e9t{constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=un.register({description:"suggest-line-suffix",stickiness:1}),e.getLineMaxColumn(t.lineNumber)!==t.column){const r=e.getOffsetAt(t),s=e.getPositionAt(r+1);e.changeDecorations(o=>{this._marker&&o.removeDecoration(this._marker),this._marker=o.addDecoration($.fromPositions(t,s),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(e=>{e.removeDecoration(this._marker),this._marker=void 0})}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){const t=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}else return this._model.getLineMaxColumn(e.lineNumber)-e.column}}let Gh=class{static{pte=this}static{this.ID="editor.contrib.suggestController"}static get(e){return e.getContribution(pte.ID)}constructor(e,t,i,r,s,o,a){this._memoryService=t,this._commandService=i,this._contextKeyService=r,this._instantiationService=s,this._logService=o,this._telemetryService=a,this._lineSuffix=new To,this._toDispose=new ke,this._selectors=new t9t(d=>d.priority),this._onWillInsertSuggestItem=new fe,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=e,this.model=s.createInstance(G9,this.editor),this._selectors.register({priority:0,select:(d,h,f)=>this._memoryService.select(d,h,f)});const l=xn.InsertMode.bindTo(r);l.set(e.getOption(119).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>l.set(e.getOption(119).insertMode))),this.widget=this._toDispose.add(new wj(Ot(e.getDomNode()),()=>{const d=this._instantiationService.createInstance(gte,this.editor);this._toDispose.add(d),this._toDispose.add(d.onDidSelect(m=>this._insertSuggestion(m,0),this));const h=new O8t(this.editor,d,this.model,m=>this._insertSuggestion(m,2));this._toDispose.add(h);const f=xn.MakesTextEdit.bindTo(this._contextKeyService),g=xn.HasInsertAndReplaceRange.bindTo(this._contextKeyService),p=xn.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(Lt(()=>{f.reset(),g.reset(),p.reset()})),this._toDispose.add(d.onDidFocus(({item:m})=>{const _=this.editor.getPosition(),v=m.editStart.column,y=_.column;let C=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!m.completion.additionalTextEdits&&!(m.completion.insertTextRules&4)&&y-v===m.completion.insertText.length&&(C=this.editor.getModel().getValueInRange({startLineNumber:_.lineNumber,startColumn:v,endLineNumber:_.lineNumber,endColumn:y})!==m.completion.insertText),f.set(C),g.set(!he.equals(m.editInsertEnd,m.editReplaceEnd)),p.set(!!m.provider.resolveCompletionItem||!!m.completion.documentation||m.completion.detail!==m.completion.label)})),this._toDispose.add(d.onDetailsKeyDown(m=>{if(m.toKeyCodeChord().equals(new G_(!0,!1,!1,!1,33))||Rn&&m.toKeyCodeChord().equals(new G_(!1,!1,!1,!0,33))){m.stopPropagation();return}m.toKeyCodeChord().isModifierKey()||this.editor.focus()})),d})),this._overtypingCapturer=this._toDispose.add(new wj(Ot(e.getDomNode()),()=>this._toDispose.add(new rde(this.editor,this.model)))),this._alternatives=this._toDispose.add(new wj(Ot(e.getDomNode()),()=>this._toDispose.add(new FE(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(K9,e)),this._toDispose.add(this.model.onDidTrigger(d=>{this.widget.value.showTriggered(d.auto,d.shy?250:50),this._lineSuffix.value=new e9t(this.editor.getModel(),d.position)})),this._toDispose.add(this.model.onDidSuggest(d=>{if(d.triggerOptions.shy)return;let h=-1;for(const g of this._selectors.itemsOrderedByPriorityDesc)if(h=g.select(this.editor.getModel(),this.editor.getPosition(),d.completionModel.items),h!==-1)break;if(h===-1&&(h=0),this.model.state===0)return;let f=!1;if(d.triggerOptions.auto){const g=this.editor.getOption(119);g.selectionMode==="never"||g.selectionMode==="always"?f=g.selectionMode==="never":g.selectionMode==="whenTriggerCharacter"?f=d.triggerOptions.triggerKind!==1:g.selectionMode==="whenQuickSuggestion"&&(f=d.triggerOptions.triggerKind===1&&!d.triggerOptions.refilter)}this.widget.value.showSuggestions(d.completionModel,h,d.isFrozen,d.triggerOptions.auto,f)})),this._toDispose.add(this.model.onDidCancel(d=>{d.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));const c=xn.AcceptSuggestionsOnEnter.bindTo(r),u=()=>{const d=this.editor.getOption(1);c.set(d==="on"||d==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>u())),u()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(e,t){if(!e||!e.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;const i=Kl.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const r=this.editor.getModel(),s=r.getAlternativeVersionId(),{item:o}=e,a=[],l=new Kr;t&1||this.editor.pushUndoStop();const c=this.getOverwriteInfo(o,!!(t&8));this._memoryService.memorize(r,this.editor.getPosition(),o);const u=o.isResolved;let d=-1,h=-1;if(Array.isArray(o.completion.additionalTextEdits)){this.model.cancel();const g=Ag.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",o.completion.additionalTextEdits.map(p=>{let m=$.lift(p.range);if(m.startLineNumber===o.position.lineNumber&&m.startColumn>o.position.column){const _=this.editor.getPosition().column-o.position.column,v=_,y=$.spansMultipleLines(m)?0:_;m=new $(m.startLineNumber,m.startColumn+v,m.endLineNumber,m.endColumn+y)}return jr.replaceMove(m,p.text)})),g.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!u){const g=new Bo;let p;const m=r.onDidChangeContent(C=>{if(C.isFlush){l.cancel(),m.dispose();return}for(const x of C.changes){const k=$.getEndPosition(x.range);(!p||he.isBefore(k,p))&&(p=k)}}),_=t;t|=2;let v=!1;const y=this.editor.onWillType(()=>{y.dispose(),v=!0,_&2||this.editor.pushUndoStop()});a.push(o.resolve(l.token).then(()=>{if(!o.completion.additionalTextEdits||l.token.isCancellationRequested)return;if(p&&o.completion.additionalTextEdits.some(x=>he.isBefore(p,$.getStartPosition(x.range))))return!1;v&&this.editor.pushUndoStop();const C=Ag.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",o.completion.additionalTextEdits.map(x=>jr.replaceMove($.lift(x.range),x.text))),C.restoreRelativeVerticalPositionOfCursor(this.editor),(v||!(_&2))&&this.editor.pushUndoStop(),!0}).then(C=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",g.elapsed(),C),h=C===!0?1:C===!1?0:-2}).finally(()=>{m.dispose(),y.dispose()}))}let{insertText:f}=o.completion;if(o.completion.insertTextRules&4||(f=zw.escape(f)),this.model.cancel(),i.insert(f,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(o.completion.insertTextRules&1),clipboardText:e.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),t&2||this.editor.pushUndoStop(),o.completion.command)if(o.completion.command.id===wH.id)this.model.trigger({auto:!0,retrigger:!0});else{const g=new Bo;a.push(this._commandService.executeCommand(o.completion.command.id,...o.completion.command.arguments?[...o.completion.command.arguments]:[]).catch(p=>{o.completion.extensionId?vs(p):rn(p)}).finally(()=>{d=g.elapsed()}))}t&4&&this._alternatives.value.set(e,g=>{for(l.cancel();r.canUndo();){s!==r.getAlternativeVersionId()&&r.undo(),this._insertSuggestion(g,3|(t&8?8:0));break}}),this._alertCompletionItem(o),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(o,r,u,d,h,e.index,e.model.items),this.model.clear(),l.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,r,s,o,a){if(Math.floor(Math.random()*100)===0)return;const l=new Map;for(let h=0;h1?c[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:e.extensionId?.value??"unknown",providerId:e.provider._debugDisplayName??"unknown",kind:e.completion.kind,basenameHash:F$(th(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:HCt(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:r,additionalEditsAsync:s,index:o,firstIndex:d})}getOverwriteInfo(e,t){oi(this.editor.hasModel());let i=this.editor.getOption(119).insertMode==="replace";t&&(i=!i);const r=e.position.column-e.editStart.column,s=(i?e.editReplaceEnd.column:e.editInsertEnd.column)-e.position.column,o=this.editor.getPosition().column-e.position.column,a=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:r+o,overwriteAfter:s+a}}_alertCompletionItem(e){if(bl(e.completion.additionalTextEdits)){const t=w("aria.alert.snippet","Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);ql(t)}}triggerSuggest(e,t,i){this.editor.hasModel()&&(this.model.trigger({auto:t??!1,completionOptions:{providerFilter:e,kindFilter:i?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(e){if(!this.editor.hasModel())return;const t=this.editor.getPosition(),i=()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},r=s=>{if(s.completion.insertTextRules&4||s.completion.additionalTextEdits)return!0;const o=this.editor.getPosition(),a=s.editStart.column,l=o.column;return l-a!==s.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:o.lineNumber,startColumn:a,endLineNumber:o.lineNumber,endColumn:l})!==s.completion.insertText};Ge.once(this.model.onDidTrigger)(s=>{const o=[];Ge.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{er(o),i()},void 0,o),this.model.onDidSuggest(({completionModel:a})=>{if(er(o),a.items.length===0){i();return}const l=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),c=a.items[l];if(!r(c)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:l,item:c,model:a},7)},void 0,o)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(t,0),this.editor.focus()}acceptSelectedSuggestion(e,t){const i=this.widget.value.getFocusedItem();let r=0;e&&(r|=4),t&&(r|=8),this._insertSuggestion(i,r)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.value.forceRenderingAbove()}stopForceRenderingAbove(){this.widget.isInitialized&&this.widget.value.stopForceRenderingAbove()}registerSelector(e){return this._selectors.register(e)}};Gh=pte=J8t([Ex(1,yH),Ex(2,_r),Ex(3,jt),Ex(4,Tt),Ex(5,Da),Ex(6,Qa)],Gh);class t9t{constructor(e){this.prioritySelector=e,this._items=new Array}register(e){if(this._items.indexOf(e)!==-1)throw new Error("Value is already registered");return this._items.push(e),this._items.sort((t,i)=>this.prioritySelector(i)-this.prioritySelector(t)),{dispose:()=>{const t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}class wH extends ot{static{this.id="editor.action.triggerSuggest"}constructor(){super({id:wH.id,label:w("suggest.trigger.label","Trigger Suggest"),alias:"Trigger Suggest",precondition:Le.and(Q.writable,Q.hasCompletionItemProvider,xn.Visible.toNegated()),kbOpts:{kbExpr:Q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const r=Gh.get(t);if(!r)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),r.triggerSuggest(void 0,s,void 0)}}Zn(Gh.ID,Gh,2);Pe(wH);const od=190,Xl=fo.bindToContribution(Gh.get);Je(new Xl({id:"acceptSelectedSuggestion",precondition:Le.and(xn.Visible,xn.HasFocusedSuggestion),handler(n){n.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Le.and(xn.Visible,Q.textInputFocus),weight:od},{primary:3,kbExpr:Le.and(xn.Visible,Q.textInputFocus,xn.AcceptSuggestionsOnEnter,xn.MakesTextEdit),weight:od}],menuOpts:[{menuId:ub,title:w("accept.insert","Insert"),group:"left",order:1,when:xn.HasInsertAndReplaceRange.toNegated()},{menuId:ub,title:w("accept.insert","Insert"),group:"left",order:1,when:Le.and(xn.HasInsertAndReplaceRange,xn.InsertMode.isEqualTo("insert"))},{menuId:ub,title:w("accept.replace","Replace"),group:"left",order:1,when:Le.and(xn.HasInsertAndReplaceRange,xn.InsertMode.isEqualTo("replace"))}]}));Je(new Xl({id:"acceptAlternativeSelectedSuggestion",precondition:Le.and(xn.Visible,Q.textInputFocus,xn.HasFocusedSuggestion),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:1027,secondary:[1026]},handler(n){n.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:ub,group:"left",order:2,when:Le.and(xn.HasInsertAndReplaceRange,xn.InsertMode.isEqualTo("insert")),title:w("accept.replace","Replace")},{menuId:ub,group:"left",order:2,when:Le.and(xn.HasInsertAndReplaceRange,xn.InsertMode.isEqualTo("replace")),title:w("accept.insert","Insert")}]}));Un.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");Je(new Xl({id:"hideSuggestWidget",precondition:xn.Visible,handler:n=>n.cancelSuggestWidget(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:9,secondary:[1033]}}));Je(new Xl({id:"selectNextSuggestion",precondition:Le.and(xn.Visible,Le.or(xn.MultipleSuggestions,xn.HasFocusedSuggestion.negate())),handler:n=>n.selectNextSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}}));Je(new Xl({id:"selectNextPageSuggestion",precondition:Le.and(xn.Visible,Le.or(xn.MultipleSuggestions,xn.HasFocusedSuggestion.negate())),handler:n=>n.selectNextPageSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:12,secondary:[2060]}}));Je(new Xl({id:"selectLastSuggestion",precondition:Le.and(xn.Visible,Le.or(xn.MultipleSuggestions,xn.HasFocusedSuggestion.negate())),handler:n=>n.selectLastSuggestion()}));Je(new Xl({id:"selectPrevSuggestion",precondition:Le.and(xn.Visible,Le.or(xn.MultipleSuggestions,xn.HasFocusedSuggestion.negate())),handler:n=>n.selectPrevSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));Je(new Xl({id:"selectPrevPageSuggestion",precondition:Le.and(xn.Visible,Le.or(xn.MultipleSuggestions,xn.HasFocusedSuggestion.negate())),handler:n=>n.selectPrevPageSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:11,secondary:[2059]}}));Je(new Xl({id:"selectFirstSuggestion",precondition:Le.and(xn.Visible,Le.or(xn.MultipleSuggestions,xn.HasFocusedSuggestion.negate())),handler:n=>n.selectFirstSuggestion()}));Je(new Xl({id:"focusSuggestion",precondition:Le.and(xn.Visible,xn.HasFocusedSuggestion.negate()),handler:n=>n.focusSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));Je(new Xl({id:"focusAndAcceptSuggestion",precondition:Le.and(xn.Visible,xn.HasFocusedSuggestion.negate()),handler:n=>{n.focusSuggestion(),n.acceptSelectedSuggestion(!0,!1)}}));Je(new Xl({id:"toggleSuggestionDetails",precondition:Le.and(xn.Visible,xn.HasFocusedSuggestion),handler:n=>n.toggleSuggestionDetails(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:ub,group:"right",order:1,when:Le.and(xn.DetailsVisible,xn.CanResolve),title:w("detail.more","Show Less")},{menuId:ub,group:"right",order:1,when:Le.and(xn.DetailsVisible.toNegated(),xn.CanResolve),title:w("detail.less","Show More")}]}));Je(new Xl({id:"toggleExplainMode",precondition:xn.Visible,handler:n=>n.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));Je(new Xl({id:"toggleSuggestionFocus",precondition:xn.Visible,handler:n=>n.toggleSuggestionFocus(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:2570,mac:{primary:778}}}));Je(new Xl({id:"insertBestCompletion",precondition:Le.and(Q.textInputFocus,Le.equals("config.editor.tabCompletion","on"),K9.AtEnd,xn.Visible.toNegated(),FE.OtherSuggestions.toNegated(),Kl.InSnippetMode.toNegated()),handler:(n,e)=>{n.triggerSuggestAndAcceptBest(Mo(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:od,primary:2}}));Je(new Xl({id:"insertNextSuggestion",precondition:Le.and(Q.textInputFocus,Le.equals("config.editor.tabCompletion","on"),FE.OtherSuggestions,xn.Visible.toNegated(),Kl.InSnippetMode.toNegated()),handler:n=>n.acceptNextSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:2}}));Je(new Xl({id:"insertPrevSuggestion",precondition:Le.and(Q.textInputFocus,Le.equals("config.editor.tabCompletion","on"),FE.OtherSuggestions,xn.Visible.toNegated(),Kl.InSnippetMode.toNegated()),handler:n=>n.acceptPrevSuggestion(),kbOpts:{weight:od,kbExpr:Q.textInputFocus,primary:1026}}));Pe(class extends ot{constructor(){super({id:"editor.action.resetSuggestSize",label:w("suggest.reset.label","Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(n,e){Gh.get(e)?.resetWidgetSize()}});class n9t extends me{get selectedItem(){return this._currentSuggestItemInfo}constructor(e,t,i){super(),this.editor=e,this.suggestControllerPreselector=t,this.onWillAccept=i,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._onDidSelectedItemChange=this._register(new fe),this.onDidSelectedItemChange=this._onDidSelectedItemChange.event,this._register(e.onKeyDown(s=>{s.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(s=>{s.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));const r=Gh.get(this.editor);if(r){this._register(r.registerSelector({priority:100,select:(a,l,c)=>{const u=this.editor.getModel();if(!u)return-1;const d=this.suggestControllerPreselector(),h=d?ow(d,u):void 0;if(!h)return-1;const f=he.lift(l),g=c.map((m,_)=>{const v=qI.fromSuggestion(r,u,f,m,this.isShiftKeyPressed),y=ow(v.toSingleTextEdit(),u),C=dBe(h,y);return{index:_,valid:C,prefixLength:y.text.length,suggestItem:m}}).filter(m=>m&&m.valid&&m.prefixLength>0),p=tle(g,$l(m=>m.prefixLength,Xh));return p?p.index:-1}}));let s=!1;const o=()=>{s||(s=!0,this._register(r.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(r.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(r.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(Ge.once(r.model.onDidTrigger)(a=>{o()})),this._register(r.onWillInsertSuggestItem(a=>{const l=this.editor.getPosition(),c=this.editor.getModel();if(!l||!c)return;const u=qI.fromSuggestion(r,c,l,a.item,this.isShiftKeyPressed);this.onWillAccept(u)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!i9t(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const e=Gh.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;const t=e.widget.value.getFocusedItem(),i=this.editor.getPosition(),r=this.editor.getModel();if(!(!t||!i||!r))return qI.fromSuggestion(e,r,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){Gh.get(this.editor)?.stopForceRenderingAbove()}forceRenderingAbove(){Gh.get(this.editor)?.forceRenderingAbove()}}class qI{static fromSuggestion(e,t,i,r,s){let{insertText:o}=r.completion,a=!1;if(r.completion.insertTextRules&4){const c=new zw().parse(o);c.children.length<100&&q9.adjustWhitespace(t,i,!0,c),o=c.toString(),a=!0}const l=e.getOverwriteInfo(r,s);return new qI($.fromPositions(i.delta(0,-l.overwriteBefore),i.delta(0,Math.max(l.overwriteAfter,0))),o,r.completion.kind,a)}constructor(e,t,i,r){this.range=e,this.insertText=t,this.completionItemKind=i,this.isSnippetText=r}equals(e){return this.range.equalsRange(e.range)&&this.insertText===e.insertText&&this.completionItemKind===e.completionItemKind&&this.isSnippetText===e.isSnippetText}toSelectedSuggestionInfo(){return new M4e(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new Yp(this.range,this.insertText)}}function i9t(n,e){return n===e?!0:!n||!e?!1:n.equals(e)}var r9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Pm=function(n,e){return function(t,i){e(t,i,n)}},mte;let ih=class extends me{static{mte=this}static{this.ID="editor.contrib.inlineCompletionsController"}static get(e){return e.getContribution(mte.ID)}constructor(e,t,i,r,s,o,a,l,c,u){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=r,this._commandService=s,this._debounceService=o,this._languageFeaturesService=a,this._accessibilitySignalService=l,this._keybindingService=c,this._accessibilityService=u,this._editorObs=Jc(this.editor),this._positions=St(this,h=>this._editorObs.selections.read(h)?.map(f=>f.getEndPosition())??[new he(1,1)]),this._suggestWidgetAdaptor=this._register(new n9t(this.editor,()=>(this._editorObs.forceUpdate(),this.model.get()?.selectedInlineCompletion.get()?.toSingleTextEdit(void 0)),h=>this._editorObs.forceUpdate(f=>{this.model.get()?.handleSuggestAccepted(h)}))),this._suggestWidgetSelectedItem=Bi(this,h=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(f=>h(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem),this._enabledInConfig=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).enabled),this._isScreenReaderEnabled=Bi(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=Bi(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=St(this,h=>this._enabledInConfig.read(h)&&(!this._isScreenReaderEnabled.read(h)||!this._editorDictationInProgress.read(h))),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model=hl(this,h=>{if(this._editorObs.isReadonly.read(h))return;const f=this._editorObs.model.read(h);return f?this._instantiationService.createInstance(ate,f,this._suggestWidgetSelectedItem,this._editorObs.versionId,this._positions,this._debounceValue,Bi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).preview),Bi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(119).previewMode),Bi(this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).mode),this._enabled):void 0}).recomputeInitiallyAndOnChange(this._store),this._ghostTexts=St(this,h=>this.model.read(h)?.ghostTexts.read(h)??[]),this._stablizedGhostTexts=s9t(this._ghostTexts,this._store),this._ghostTextWidgets=OSt(this,this._stablizedGhostTexts,(h,f)=>f.add(this._instantiationService.createInstance(rte,this.editor,{ghostText:h,minReservedLineCount:Hd(0),targetTextModel:this.model.map(g=>g?.textModel)}))).recomputeInitiallyAndOnChange(this._store),this._playAccessibilitySignal=r2(this),this._fontFamily=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(62).fontFamily),this._register(new _l(this._contextKeyService,this.model)),this._register(JJ(this._editorObs.onDidType,(h,f)=>{this._enabled.get()&&this.model.get()?.trigger()})),this._register(this._commandService.onDidExecuteCommand(h=>{new Set([Sk.Tab.id,Sk.DeleteLeft.id,Sk.DeleteRight.id,f7e,"acceptSelectedSuggestion"]).has(h.commandId)&&e.hasTextFocus()&&this._enabled.get()&&this._editorObs.forceUpdate(g=>{this.model.get()?.trigger(g)})})),this._register(JJ(this._editorObs.selections,(h,f)=>{f.some(g=>g.reason===3||g.source==="api")&&this.model.get()?.stop()})),this._register(this.editor.onDidBlurEditorWidget(()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(62).keepOnBlur||AE.dropDownVisible||qr(h=>{this.model.get()?.stop(h)})})),this._register(tn(h=>{const f=this.model.read(h)?.state.read(h);f?.suggestItem?f.primaryGhostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()})),this._register(Lt(()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}));const d=cO(this,(h,f)=>{const p=this.model.read(h)?.state.read(h);return this._suggestWidgetSelectedItem.get()?f:p?.inlineCompletion?.semanticId});this._register(uPt(St(h=>(this._playAccessibilitySignal.read(h),d.read(h),{})),async(h,f,g)=>{const p=this.model.get(),m=p?.state.get();if(!m||!p)return;const _=p.textModel.getLineContent(m.primaryGhostText.lineNumber);await Y_(50,lZ(g)),await hFe(this._suggestWidgetSelectedItem,ml,()=>!1,lZ(g)),await this._accessibilitySignalService.playSignal(Ai.inlineSuggestion),this.editor.getOption(8)&&this._provideScreenReaderUpdate(m.primaryGhostText.renderForScreenReader(_))})),this._register(new Lee(this.editor,this.model,this._instantiationService)),this._register(G6t(St(h=>{const f=this._fontFamily.read(h);return f===""||f==="default"?"":` .monaco-editor .ghost-text-decoration, .monaco-editor .ghost-text-decoration-preview, .monaco-editor .ghost-text { font-family: ${f}; -}`}))),this._register(this._configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let r;!t&&i&&this.editor.getOption(150)&&(r=w("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),ql(r?e+", "+r:e)}shouldShowHoverAt(e){const t=this.model.get()?.primaryGhostText.get();return t?t.parts.some(i=>e.containsPosition(new he(t.lineNumber,i.column))):!1}shouldShowHoverAtViewZone(e){return this._ghostTextWidgets.get()[0]?.ownsViewZone(e)??!1}};ih=mte=r9t([Pm(1,Tt),Pm(2,jt),Pm(3,kn),Pm(4,_r),Pm(5,cd),Pm(6,dt),Pm(7,t1),Pm(8,xi),Pm(9,_u)],ih);function s9t(n,e){const t=Sn("result",[]),i=[];return e.add(tn(r=>{const s=n.read(r);qr(o=>{if(s.length!==i.length){i.length=s.length;for(let a=0;aa.set(s[l],o))})})),t}class ode extends ot{static{this.ID=p7e}constructor(){super({id:ode.ID,label:w("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Le.and(Q.writable,_l.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){ih.get(t)?.model.get()?.next()}}class ade extends ot{static{this.ID=g7e}constructor(){super({id:ade.ID,label:w("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Le.and(Q.writable,_l.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){ih.get(t)?.model.get()?.previous()}}class o9t extends ot{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:w("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:Q.writable})}async run(e,t){const i=ih.get(t);await c5e(async r=>{await i?.model.get()?.triggerExplicitly(r),i?.playAccessibilitySignal(r)})}}class a9t extends ot{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:w("action.inlineSuggest.acceptNextWord","Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:Le.and(Q.writable,_l.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:Le.and(Q.writable,_l.inlineSuggestionVisible)},menuOpts:[{menuId:ce.InlineSuggestionToolbar,title:w("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){const i=ih.get(t);await i?.model.get()?.acceptNextWord(i.editor)}}class l9t extends ot{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:w("action.inlineSuggest.acceptNextLine","Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:Le.and(Q.writable,_l.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:ce.InlineSuggestionToolbar,title:w("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){const i=ih.get(t);await i?.model.get()?.acceptNextLine(i.editor)}}class c9t extends ot{constructor(){super({id:f7e,label:w("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:_l.inlineSuggestionVisible,menuOpts:[{menuId:ce.InlineSuggestionToolbar,title:w("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Le.and(_l.inlineSuggestionVisible,Q.tabMovesFocus.toNegated(),_l.inlineSuggestionHasIndentationLessThanTabSize,Cn.Visible.toNegated(),Q.hoverFocused.toNegated())}})}async run(e,t){const i=ih.get(t);i&&(i.model.get()?.accept(i.editor),i.editor.focus())}}class lde extends ot{static{this.ID="editor.action.inlineSuggest.hide"}constructor(){super({id:lde.ID,label:w("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:_l.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=ih.get(t);qr(r=>{i?.model.get()?.stop(r)})}}class cde extends Gl{static{this.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar"}constructor(){super({id:cde.ID,title:w("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:ce.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Le.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(kn),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}}var u9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},qT=function(n,e){return function(t,i){e(t,i,n)}};class d9t{constructor(e,t,i){this.owner=e,this.range=t,this.controller=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let _te=class{constructor(e,t,i,r,s,o){this._editor=e,this._languageService=t,this._openerService=i,this.accessibilityService=r,this._instantiationService=s,this._telemetryService=o,this.hoverOrdinal=4}suggestHoverAnchor(e){const t=ih.get(this._editor);if(!t)return null;const i=e.target;if(i.type===8){const r=i.detail;if(t.shouldShowHoverAtViewZone(r.viewZoneId))return new g5(1e3,this,$.fromPositions(this._editor.getModel().validatePosition(r.positionBefore||r.position)),e.event.posx,e.event.posy,!1)}return i.type===7&&t.shouldShowHoverAt(i.range)?new g5(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new g5(1e3,this,i.range,e.event.posx,e.event.posy,!1):null}computeSync(e,t){if(this._editor.getOption(62).showToolbar!=="onHover")return[];const i=ih.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new d9t(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new ke,r=t[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(8)&&i.add(this.renderScreenReaderText(e,r));const s=r.controller.model.get(),o=this._instantiationService.createInstance(AE,this._editor,!1,Hd(null),s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands),a=o.getDomNode();e.fragment.appendChild(a),s.triggerExplicitly(),i.add(o);const l={hoverPart:r,hoverElement:a,dispose(){i.dispose()}};return new Kw([l])}renderScreenReaderText(e,t){const i=new ke,r=qe,s=r("div.hover-row.markdown-hover"),o=Ne(s,r("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new Q_({editor:this._editor},this._languageService,this._openerService)),l=c=>{i.add(a.onDidRenderAsync(()=>{o.className="hover-contents code-hover-contents",e.onContentsChanged()}));const u=w("inlineSuggestionFollows","Suggestion:"),d=i.add(a.render(new za().appendText(u).appendCodeblock("text",c)));o.replaceChildren(d.element)};return i.add(tn(c=>{const u=t.controller.model.read(c)?.primaryGhostText.read(c);if(u){const d=this._editor.getModel().getLineContent(u.lineNumber);l(u.renderForScreenReader(d))}else ea(o)})),e.fragment.appendChild(s),i}};_te=u9t([qT(1,Hr),qT(2,Pc),qT(3,_u),qT(4,Tt),qT(5,Qa)],_te);class h9t{}const CH=new class{constructor(){this._implementations=[]}register(e){return this._implementations.push(e),{dispose:()=>{const t=this._implementations.indexOf(e);t!==-1&&this._implementations.splice(t,1)}}}getImplementations(){return this._implementations}};Zn(ih.ID,ih,3);Pe(o9t);Pe(ode);Pe(ade);Pe(a9t);Pe(l9t);Pe(c9t);Pe(lde);lr(cde);DC.register(_te);CH.register(new h9t);var f9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},nK=function(n,e){return function(t,i){e(t,i,n)}},VD;let gR=class{static{VD=this}static{this.ID="editor.contrib.gotodefinitionatposition"}static{this.MAX_SOURCE_PREVIEW_LINES=8}constructor(e,t,i,r){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=r,this.toUnhook=new ke,this.toUnhookForKeyboard=new ke,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new hH(e);this.toUnhook.add(s),this.toUnhook.add(s.onMouseMoveOrRelevantKeyDown(([o,a])=>{this.startFindDefinitionFromMouse(o,a??void 0)})),this.toUnhook.add(s.onExecute(o=>{this.isEnabled(o)&&this.gotoDefinition(o.target.position,o.hasSideBySideModifier).catch(a=>{rn(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(VD.ID)}async startFindDefinitionFromCursor(e){await this.startFindDefinition(e),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown(t=>{t&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())}))}startFindDefinitionFromMouse(e,t){if(e.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(e,t)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}const i=e.target.position;this.startFindDefinition(i)}async startFindDefinition(e){this.toUnhookForKeyboard.clear();const t=e?this.editor.getModel()?.getWordAtPosition(e):null;if(!t){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===t.startColumn&&this.currentWordAtPosition.endColumn===t.endColumn&&this.currentWordAtPosition.word===t.word)return;this.currentWordAtPosition=t;const i=new $8e(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=ko(o=>this.findDefinition(e,o));let r;try{r=await this.previousPromise}catch(o){rn(o);return}if(!r||!r.length||!i.validate(this.editor)){this.removeLinkDecorations();return}const s=r[0].originSelectionRange?$.lift(r[0].originSelectionRange):new $(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(r.length>1){let o=s;for(const{originSelectionRange:a}of r)a&&(o=$.plusRange(o,a));this.addDecoration(o,new za().appendText(w("multipleResults","Click to show {0} definitions.",r.length)))}else{const o=r[0];if(!o.uri)return;this.textModelResolverService.createModelReference(o.uri).then(a=>{if(!a.object||!a.object.textEditorModel){a.dispose();return}const{object:{textEditorModel:l}}=a,{startLineNumber:c}=o.range;if(c<1||c>l.getLineCount()){a.dispose();return}const u=this.getPreviewValue(l,c,o),d=this.languageService.guessLanguageIdByFilepathOrFirstLine(l.uri);this.addDecoration(s,u?new za().appendCodeblock(d||"",u):void 0),a.dispose()})}}getPreviewValue(e,t,i){let r=i.range;return r.endLineNumber-r.startLineNumber>=VD.MAX_SOURCE_PREVIEW_LINES&&(r=this.getPreviewRangeBasedOnIndentation(e,t)),this.stripIndentationFromPreviewRange(e,t,r)}stripIndentationFromPreviewRange(e,t,i){let s=e.getLineFirstNonWhitespaceColumn(t);for(let a=t+1;a{const r=!t&&this.editor.getOption(89)&&!this.isInPeekEditor(i);return new TO({openToSide:t,openInPeek:r,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(jt);return Dc.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};gR=VD=f9t([nK(1,Nc),nK(2,Hr),nK(3,dt)],gR);Zn(gR.ID,gR,2);var fBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Y9=function(n,e){return function(t,i){e(t,i,n)}};class Exe{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let vte=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._dispoables=new ke,this._markers=[],this._nextIdx=-1,Pt.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const r=this._configService.getValue("problems.sortOrder"),s=(a,l)=>{let c=aN(a.resource.toString(),l.resource.toString());return c===0&&(r==="position"?c=$.compareRangesUsingStarts(a,l)||os.compare(a.severity,l.severity):c=os.compare(a.severity,l.severity)||$.compareRangesUsingStarts(a,l)),c},o=()=>{this._markers=this._markerService.read({resource:Pt.isUri(e)?e:void 0,severities:os.Error|os.Warning|os.Info}),typeof e=="function"&&(this._markers=this._markers.filter(a=>this._resourceFilter(a.resource))),this._markers.sort(s)};o(),this._dispoables.add(t.onMarkerChanged(a=>{(!this._resourceFilter||a.some(l=>this._resourceFilter(l)))&&(o(),this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(e){return!this._resourceFilter&&!e?!0:!this._resourceFilter||!e?!1:this._resourceFilter(e)}get selected(){const e=this._markers[this._nextIdx];return e&&new Exe(e,this._nextIdx+1,this._markers.length)}_initIdx(e,t,i){let r=!1,s=this._markers.findIndex(o=>o.resource.toString()===e.uri.toString());s<0&&(s=JA(this._markers,{resource:e.uri},(o,a)=>aN(o.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let o=s;or.resource.toString()===e.toString());if(!(i<0)){for(;i=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Lx=function(n,e){return function(t,i){e(t,i,n)}},wte;class p9t{constructor(e,t,i,r,s){this._openerService=r,this._labelService=s,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new ke,this._editor=t;const o=document.createElement("div");o.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),o.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),o.appendChild(this._relatedBlock),this._disposables.add(Jr(this._relatedBlock,"click",a=>{a.preventDefault();const l=this._relatedDiagnostics.get(a.target);l&&i(l)})),this._scrollable=new OFe(o,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),e.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(a=>{o.style.left=`-${a.scrollLeft}px`,o.style.top=`-${a.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){er(this._disposables)}update(e){const{source:t,message:i,relatedInformation:r,code:s}=e;let o=(t?.length||0)+2;s&&(typeof s=="string"?o+=s.length:o+=s.value.length);const a=om(i);this._lines=a.length,this._longestLineLength=0;for(const h of a)this._longestLineLength=Math.max(h.length+o,this._longestLineLength);Jo(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let l=this._messageBlock;for(const h of a)l=document.createElement("div"),l.innerText=h,h===""&&(l.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(l);if(t||s){const h=document.createElement("span");if(h.classList.add("details"),l.appendChild(h),t){const f=document.createElement("span");f.innerText=t,f.classList.add("source"),h.appendChild(f)}if(s)if(typeof s=="string"){const f=document.createElement("span");f.innerText=`(${s})`,f.classList.add("code"),h.appendChild(f)}else{this._codeLink=qe("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=g=>{this._openerService.open(s.target,{allowCommands:!0}),g.preventDefault(),g.stopPropagation()};const f=Ne(this._codeLink,qe("span"));f.innerText=s.value,h.appendChild(this._codeLink)}}if(Jo(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),bl(r)){const h=this._relatedBlock.appendChild(document.createElement("div"));h.style.paddingTop=`${Math.floor(this._editor.getOption(67)*.66)}px`,this._lines+=1;for(const f of r){const g=document.createElement("div"),p=document.createElement("a");p.classList.add("filename"),p.innerText=`${this._labelService.getUriBasenameLabel(f.resource)}(${f.startLineNumber}, ${f.startColumn}): `,p.title=this._labelService.getUriLabel(f.resource),this._relatedDiagnostics.set(p,f);const m=document.createElement("span");m.innerText=f.message,g.appendChild(p),g.appendChild(m),this._lines+=1,h.appendChild(g)}}const c=this._editor.getOption(50),u=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75),d=c.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:u,scrollHeight:d})}layout(e,t){this._scrollable.getDomNode().style.height=`${e}px`,this._scrollable.getDomNode().style.width=`${t}px`,this._scrollable.setScrollDimensions({width:t,height:e})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(e){let t="";switch(e.severity){case os.Error:t=w("Error","Error");break;case os.Warning:t=w("Warning","Warning");break;case os.Info:t=w("Info","Info");break;case os.Hint:t=w("Hint","Hint");break}let i=w("marker aria","{0} at {1}. ",t,e.startLineNumber+":"+e.startColumn);const r=this._editor.getModel();return r&&e.startLineNumber<=r.getLineCount()&&e.startLineNumber>=1&&(i=`${r.getLineContent(e.startLineNumber)}, ${i}`),i}}let pR=class extends M9{static{wte=this}static{this.TitleMenu=new ce("gotoErrorTitleMenu")}constructor(e,t,i,r,s,o,a){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},s),this._themeService=t,this._openerService=i,this._menuService=r,this._contextKeyService=o,this._labelService=a,this._callOnDispose=new ke,this._onDidSelectRelatedInformation=new fe,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=os.Warning,this._backgroundColor=Te.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(b9t);let t=Cte,i=m9t;this._severity===os.Warning?(t=v5,i=_9t):this._severity===os.Info&&(t=xte,i=v9t);const r=e.getColor(t),s=e.getColor(i);this.style({arrowColor:r,frameColor:r,headerBackgroundColor:s,primaryHeadingColor:e.getColor(E7e),secondaryHeadingColor:e.getColor(L7e)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(r=>this.editor.focus()));const t=[],i=this._menuService.getMenuActions(wte.TitleMenu,this._contextKeyService);EW(i,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=Ne(e,qe(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new p9t(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,i){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());const r=$.lift(e),s=this.editor.getPosition(),o=s&&r.containsPosition(s)?s:r.getStartPosition();super.show(o,this.computeRequiredHeight());const a=this.editor.getModel();if(a){const l=i>1?w("problems","{0} of {1} problems",t,i):w("change","{0} of {1} problem",t,i);this.setTitle(th(a.uri),l)}this._icon.className=`codicon ${yte.className(os.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(o,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};pR=wte=g9t([Lx(1,go),Lx(2,Pc),Lx(3,ld),Lx(4,Tt),Lx(5,jt),Lx(6,pE)],pR);const Lxe=_N(aW,pyt),Txe=_N(X_,vN),Dxe=_N(Xp,bN),Cte=J("editorMarkerNavigationError.background",{dark:Lxe,light:Lxe,hcDark:Yn,hcLight:Yn},w("editorMarkerNavigationError","Editor marker navigation widget error color.")),m9t=J("editorMarkerNavigationError.headerBackground",{dark:xn(Cte,.1),light:xn(Cte,.1),hcDark:null,hcLight:null},w("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),v5=J("editorMarkerNavigationWarning.background",{dark:Txe,light:Txe,hcDark:Yn,hcLight:Yn},w("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),_9t=J("editorMarkerNavigationWarning.headerBackground",{dark:xn(v5,.1),light:xn(v5,.1),hcDark:"#0C141F",hcLight:xn(v5,.2)},w("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),xte=J("editorMarkerNavigationInfo.background",{dark:Dxe,light:Dxe,hcDark:Yn,hcLight:Yn},w("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),v9t=J("editorMarkerNavigationInfo.headerBackground",{dark:xn(xte,.1),light:xn(xte,.1),hcDark:null,hcLight:null},w("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),b9t=J("editorMarkerNavigation.background",lf,w("editorMarkerNavigationBackground","Editor marker navigation widget background."));var y9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},S3=function(n,e){return function(t,i){e(t,i,n)}},zD;let Zw=class{static{zD=this}static{this.ID="editor.contrib.markerController"}static get(e){return e.getContribution(zD.ID)}constructor(e,t,i,r,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=r,this._instantiationService=s,this._sessionDispoables=new ke,this._editor=e,this._widgetVisible=pBe.bindTo(this._contextKeyService)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(e){if(this._model&&this._model.matches(e))return this._model;let t=!1;return this._model&&(t=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(e),t&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(pR,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(i=>{(!this._model?.selected||!$.containsPosition(this._model?.selected.marker,i.position))&&this._model?.resetIndex()})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;const i=this._model.find(this._editor.getModel().uri,this._widget.position);i?this._widget.updateMarker(i.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(i=>{this._editorService.openCodeEditor({resource:i.resource,options:{pinned:!0,revealIfOpened:!0,selection:$.lift(i).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(e=!0){this._cleanUp(),e&&this._editor.focus()}showAtMarker(e){if(this._editor.hasModel()){const t=this._getOrCreateModel(this._editor.getModel().uri);t.resetIndex(),t.move(!0,this._editor.getModel(),new he(e.startLineNumber,e.startColumn)),t.selected&&this._widget.showAtMarker(t.selected.marker,t.selected.index,t.selected.total)}}async nagivate(e,t){if(this._editor.hasModel()){const i=this._getOrCreateModel(t?void 0:this._editor.getModel().uri);if(i.move(e,this._editor.getModel(),this._editor.getPosition()),!i.selected)return;if(i.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=await this._editorService.openCodeEditor({resource:i.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:i.selected.marker}},this._editor);r&&(zD.get(r)?.close(),zD.get(r)?.nagivate(e,t))}else this._widget.showAtMarker(i.selected.marker,i.selected.index,i.selected.total)}}};Zw=zD=y9t([S3(1,gBe),S3(2,jt),S3(3,ai),S3(4,Tt)],Zw);class xH extends ot{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){t.hasModel()&&Zw.get(t)?.nagivate(this._next,this._multiFile)}}class Dk extends xH{static{this.ID="editor.action.marker.next"}static{this.LABEL=w("markerAction.next.label","Go to Next Problem (Error, Warning, Info)")}constructor(){super(!0,!1,{id:Dk.ID,label:Dk.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:578,weight:100},menuOpts:{menuId:pR.TitleMenu,title:Dk.LABEL,icon:kr("marker-navigation-next",ze.arrowDown,w("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}}class KI extends xH{static{this.ID="editor.action.marker.prev"}static{this.LABEL=w("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)")}constructor(){super(!1,!1,{id:KI.ID,label:KI.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:1602,weight:100},menuOpts:{menuId:pR.TitleMenu,title:KI.LABEL,icon:kr("marker-navigation-previous",ze.arrowUp,w("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}}class w9t extends xH{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:w("markerAction.nextInFiles.label","Go to Next Problem in Files (Error, Warning, Info)"),alias:"Go to Next Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:66,weight:100},menuOpts:{menuId:ce.MenubarGoMenu,title:w({key:"miGotoNextProblem",comment:["&& denotes a mnemonic"]},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class C9t extends xH{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:w("markerAction.previousInFiles.label","Go to Previous Problem in Files (Error, Warning, Info)"),alias:"Go to Previous Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:1090,weight:100},menuOpts:{menuId:ce.MenubarGoMenu,title:w({key:"miGotoPreviousProblem",comment:["&& denotes a mnemonic"]},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}Zn(Zw.ID,Zw,4);Pe(Dk);Pe(KI);Pe(w9t);Pe(C9t);const pBe=new et("markersNavigationVisible",!1),x9t=fo.bindToContribution(Zw.get);Je(new x9t({id:"closeMarkersNavigation",precondition:pBe,handler:n=>n.close(),kbOpts:{weight:150,kbExpr:Q.focus,primary:9,secondary:[1033]}}));var Mf;(function(n){n.NoAutoFocus="noAutoFocus",n.FocusIfVisible="focusIfVisible",n.AutoFocusImmediately="autoFocusImmediately"})(Mf||(Mf={}));class S9t extends ot{constructor(){super({id:h7e,label:w({key:"showOrFocusHover",comment:["Label for action that will trigger the showing/focusing of a hover in the editor.","If the hover is not visible, it will show the hover.","This allows for users to show the hover without using the mouse."]},"Show or Focus Hover"),metadata:{description:Gt("showOrFocusHoverDescription","Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[Mf.NoAutoFocus,Mf.FocusIfVisible,Mf.AutoFocusImmediately],enumDescriptions:[w("showOrFocusHover.focus.noAutoFocus","The hover will not automatically take focus."),w("showOrFocusHover.focus.focusIfVisible","The hover will take focus only if it is already visible."),w("showOrFocusHover.focus.autoFocusImmediately","The hover will automatically take focus when it appears.")],default:Mf.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const r=wl.get(t);if(!r)return;const s=i?.focus;let o=Mf.FocusIfVisible;Object.values(Mf).includes(s)?o=s:typeof s=="boolean"&&s&&(o=Mf.AutoFocusImmediately);const a=c=>{const u=t.getPosition(),d=new $(u.lineNumber,u.column,u.lineNumber,u.column);r.showContentHover(d,1,1,c)},l=t.getOption(2)===2;r.isHoverVisible?o!==Mf.NoAutoFocus?r.focus():a(l):a(l||o===Mf.AutoFocusImmediately)}}class k9t extends ot{constructor(){super({id:$3t,label:w({key:"showDefinitionPreviewHover",comment:["Label for action that will trigger the showing of definition preview hover in the editor.","This allows for users to show the definition preview hover without using the mouse."]},"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0,metadata:{description:Gt("showDefinitionPreviewHoverDescription","Show the definition preview hover in the editor.")}})}run(e,t){const i=wl.get(t);if(!i)return;const r=t.getPosition();if(!r)return;const s=new $(r.lineNumber,r.column,r.lineNumber,r.column),o=gR.get(t);if(!o)return;o.startFindDefinitionFromCursor(r).then(()=>{i.showContentHover(s,1,1,!0)})}}class E9t extends ot{constructor(){super({id:W3t,label:w({key:"scrollUpHover",comment:["Action that allows to scroll up in the hover widget with the up arrow when the hover widget is focused."]},"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:16,weight:100},metadata:{description:Gt("scrollUpHoverDescription","Scroll up the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.scrollUp()}}class L9t extends ot{constructor(){super({id:H3t,label:w({key:"scrollDownHover",comment:["Action that allows to scroll down in the hover widget with the up arrow when the hover widget is focused."]},"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:18,weight:100},metadata:{description:Gt("scrollDownHoverDescription","Scroll down the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.scrollDown()}}class T9t extends ot{constructor(){super({id:V3t,label:w({key:"scrollLeftHover",comment:["Action that allows to scroll left in the hover widget with the left arrow when the hover widget is focused."]},"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:15,weight:100},metadata:{description:Gt("scrollLeftHoverDescription","Scroll left the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.scrollLeft()}}class D9t extends ot{constructor(){super({id:z3t,label:w({key:"scrollRightHover",comment:["Action that allows to scroll right in the hover widget with the right arrow when the hover widget is focused."]},"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:17,weight:100},metadata:{description:Gt("scrollRightHoverDescription","Scroll right the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.scrollRight()}}class I9t extends ot{constructor(){super({id:U3t,label:w({key:"pageUpHover",comment:["Action that allows to page up in the hover widget with the page up command when the hover widget is focused."]},"Page Up Hover"),alias:"Page Up Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:Gt("pageUpHoverDescription","Page up the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.pageUp()}}class A9t extends ot{constructor(){super({id:j3t,label:w({key:"pageDownHover",comment:["Action that allows to page down in the hover widget with the page down command when the hover widget is focused."]},"Page Down Hover"),alias:"Page Down Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:Gt("pageDownHoverDescription","Page down the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.pageDown()}}class N9t extends ot{constructor(){super({id:q3t,label:w({key:"goToTopHover",comment:["Action that allows to go to the top of the hover widget with the home command when the hover widget is focused."]},"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:Gt("goToTopHoverDescription","Go to the top of the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.goToTop()}}class R9t extends ot{constructor(){super({id:K3t,label:w({key:"goToBottomHover",comment:["Action that allows to go to the bottom in the hover widget with the end command when the hover widget is focused."]},"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:Gt("goToBottomHoverDescription","Go to the bottom of the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.goToBottom()}}class P9t extends ot{constructor(){super({id:cH,label:G3t,alias:"Increase Hover Verbosity Level",precondition:Q.hoverVisible})}run(e,t,i){const r=wl.get(t);if(!r)return;const s=i?.index!==void 0?i.index:r.focusedHoverPartIndex();r.updateHoverVerbosityLevel(Zc.Increase,s,i?.focus)}}class O9t extends ot{constructor(){super({id:uH,label:Y3t,alias:"Decrease Hover Verbosity Level",precondition:Q.hoverVisible})}run(e,t,i){const r=wl.get(t);if(!r)return;const s=i?.index!==void 0?i.index:r.focusedHoverPartIndex();wl.get(t)?.updateHoverVerbosityLevel(Zc.Decrease,s,i?.focus)}}var M9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},iK=function(n,e){return function(t,i){e(t,i,n)}};const Ch=qe;class F9t{constructor(e,t,i){this.owner=e,this.range=t,this.marker=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}const Ixe={type:1,filter:{include:Dr.QuickFix},triggerAction:hu.QuickFixHover};let Ste=class{constructor(e,t,i,r){this._editor=e,this._markerDecorationsService=t,this._openerService=i,this._languageFeaturesService=r,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1&&!e.supportsMarkerHover)return[];const i=this._editor.getModel(),r=e.range.startLineNumber,s=i.getLineMaxColumn(r),o=[];for(const a of t){const l=a.range.startLineNumber===r?a.range.startColumn:1,c=a.range.endLineNumber===r?a.range.endColumn:s,u=this._markerDecorationsService.getMarker(i.uri,a);if(!u)continue;const d=new $(e.range.startLineNumber,l,e.range.startLineNumber,c);o.push(new F9t(this,d,u))}return o}renderHoverParts(e,t){if(!t.length)return new Kw([]);const i=new ke,r=[];t.forEach(o=>{const a=this._renderMarkerHover(o);e.fragment.appendChild(a.hoverElement),r.push(a)});const s=t.length===1?t[0]:t.sort((o,a)=>os.compare(o.marker.severity,a.marker.severity))[0];return this.renderMarkerStatusbar(e,s,i),new Kw(r)}_renderMarkerHover(e){const t=new ke,i=Ch("div.hover-row"),r=Ne(i,Ch("div.marker.hover-contents")),{source:s,message:o,code:a,relatedInformation:l}=e.marker;this._editor.applyFontInfo(r);const c=Ne(r,Ch("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=o,s||a)if(a&&typeof a!="string"){const d=Ch("span");if(s){const p=Ne(d,Ch("span"));p.innerText=s}const h=Ne(d,Ch("a.code-link"));h.setAttribute("href",a.target.toString()),t.add(Ce(h,"click",p=>{this._openerService.open(a.target,{allowCommands:!0}),p.preventDefault(),p.stopPropagation()}));const f=Ne(h,Ch("span"));f.innerText=a.value;const g=Ne(r,d);g.style.opacity="0.6",g.style.paddingLeft="6px"}else{const d=Ne(r,Ch("span"));d.style.opacity="0.6",d.style.paddingLeft="6px",d.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(bl(l))for(const{message:d,resource:h,startLineNumber:f,startColumn:g}of l){const p=Ne(r,Ch("div"));p.style.marginTop="8px";const m=Ne(p,Ch("a"));m.innerText=`${th(h)}(${f}, ${g}): `,m.style.cursor="pointer",t.add(Ce(m,"click",v=>{if(v.stopPropagation(),v.preventDefault(),this._openerService){const y={selection:{startLineNumber:f,startColumn:g}};this._openerService.open(h,{fromUserGesture:!0,editorOptions:y}).catch(rn)}}));const _=Ne(p,Ch("span"));_.innerText=d,this._editor.applyFontInfo(_)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}renderMarkerStatusbar(e,t,i){if(t.marker.severity===os.Error||t.marker.severity===os.Warning||t.marker.severity===os.Info){const r=Zw.get(this._editor);r&&e.statusBar.addAction({label:w("view problem","View Problem"),commandId:Dk.ID,run:()=>{e.hide(),r.showAtMarker(t.marker),this._editor.focus()}})}if(!this._editor.getOption(92)){const r=e.statusBar.append(Ch("div"));this.recentMarkerCodeActionsInfo&&(O8.makeKey(this.recentMarkerCodeActionsInfo.marker)===O8.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(r.textContent=w("noQuickFixes","No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?me.None:Sb(()=>r.textContent=w("checkingForQuickFixes","Checking for quick fixes..."),200,i);r.textContent||(r.textContent=" ");const o=this.getCodeActions(t.marker);i.add(Lt(()=>o.cancel())),o.then(a=>{if(s.dispose(),this.recentMarkerCodeActionsInfo={marker:t.marker,hasCodeActions:a.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){a.dispose(),r.textContent=w("noQuickFixes","No quick fixes available");return}r.style.display="none";let l=!1;i.add(Lt(()=>{l||a.dispose()})),e.statusBar.addAction({label:w("quick fixes","Quick Fix..."),commandId:Due,run:c=>{l=!0;const u=DE.get(this._editor),d=ms(c);e.hide(),u?.showCodeActions(Ixe,a,{x:d.left,y:d.top,width:d.width,height:d.height})}})},rn)}}getCodeActions(e){return ko(t=>MS(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new $(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),Ixe,p_.None,t))}};Ste=M9t([iK(1,Ule),iK(2,Pc),iK(3,dt)],Ste);class B9t{get lineNumber(){return this._lineNumber}set lineNumber(e){this._lineNumber=e}get lane(){return this._laneOrLine}set lane(e){this._laneOrLine=e}constructor(e){this._editor=e,this._lineNumber=-1,this._laneOrLine=af.Center}computeSync(){const e=s=>({value:s}),t=this._editor.getLineDecorations(this._lineNumber),i=[],r=this._laneOrLine==="lineNo";if(!t)return i;for(const s of t){const o=s.options.glyphMargin?.position??af.Center;if(!r&&o!==this._laneOrLine)continue;const a=r?s.options.lineNumberHoverMessage:s.options.glyphMarginHoverMessage;!a||fE(a)||i.push(...fae(a).map(e))}return i}}var $9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Axe=function(n,e){return function(t,i){e(t,i,n)}},kte;const Nxe=qe;let Ete=class extends me{static{kte=this}static{this.ID="editor.contrib.modesGlyphHoverWidget"}constructor(e,t,i){super(),this._renderDisposeables=this._register(new ke),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new yle),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new Q_({editor:this._editor},t,i)),this._computer=new B9t(this._editor),this._hoverOperation=this._register(new m7e(this._editor,this._computer)),this._register(this._hoverOperation.onResult(r=>{this._withResult(r.value)})),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(50)&&this._updateFont()})),this._register(Jr(this._hover.containerDomNode,"mouseleave",r=>{this._onMouseLeave(r)})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return kte.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&(this._hoverOperation.cancel(),this._hoverOperation.start(0))}showsOrWillShow(e){const t=e.target;return t.type===2&&t.detail.glyphMarginLane?(this._startShowingAt(t.position.lineNumber,t.detail.glyphMarginLane),!0):t.type===3?(this._startShowingAt(t.position.lineNumber,"lineNo"),!0):!1}_startShowingAt(e,t){this._computer.lineNumber===e&&this._computer.lane===t||(this._hoverOperation.cancel(),this.hide(),this._computer.lineNumber=e,this._computer.lane=t,this._hoverOperation.start(0))}hide(){this._computer.lineNumber=-1,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e,this._messages.length>0?this._renderMessages(this._computer.lineNumber,this._messages):this.hide()}_renderMessages(e,t){this._renderDisposeables.clear();const i=document.createDocumentFragment();for(const r of t){const s=Nxe("div.hover-row.markdown-hover"),o=Ne(s,Nxe("div.hover-contents")),a=this._renderDisposeables.add(this._markdownRenderer.render(r.value));o.appendChild(a.element),i.appendChild(s)}this._updateContents(i),this._showAt(e)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const t=this._editor.getLayoutInfo(),i=this._editor.getTopForLineNumber(e),r=this._editor.getScrollTop(),s=this._editor.getOption(67),o=this._hover.containerDomNode.clientHeight,a=i-r-(o-s)/2,l=t.glyphMarginLeft+t.glyphMarginWidth+(this._computer.lane==="lineNo"?t.lineNumbersWidth:0);this._hover.containerDomNode.style.left=`${l}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(a),0)}px`}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!dH(t,e.x,e.y))&&this.hide()}};Ete=kte=$9t([Axe(1,Hr),Axe(2,Pc)],Ete);var W9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},H9t=function(n,e){return function(t,i){e(t,i,n)}};let Z9=class extends me{static{this.ID="editor.contrib.marginHover"}constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new ke,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new Ui(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}_hookListeners(){const e=this._editor.getOption(60);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._isMouseOnMarginHoverWidget(e)&&this._hideWidgets()}_isMouseOnMarginHoverWidget(e){const t=this._glyphWidget?.getDomNode();return t?dH(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._isMouseOnMarginHoverWidget(e))||this._hideWidgets()}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=this._isMouseOnMarginHoverWidget(e);return t&&i}_onEditorMouseMove(e){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._mouseMoveEvent=e,this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){!e||this._tryShowHoverWidget(e)||this._hideWidgets()}_tryShowHoverWidget(e){return this._getOrCreateGlyphWidget().showsOrWillShow(e)}_onKeyDown(e){this._editor.hasModel()&&(e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4||this._hideWidgets())}_hideWidgets(){this._glyphWidget?.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(Ete,this._editor)),this._glyphWidget}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._glyphWidget?.dispose()}};Z9=W9t([H9t(1,Tt)],Z9);class V9t{}class z9t{}class U9t{}Zn(wl.ID,wl,2);Zn(Z9.ID,Z9,2);Pe(S9t);Pe(k9t);Pe(E9t);Pe(L9t);Pe(T9t);Pe(D9t);Pe(I9t);Pe(A9t);Pe(N9t);Pe(R9t);Pe(P9t);Pe(O9t);DC.register(cR);DC.register(Ste);dh((n,e)=>{const t=n.getColor(CFe);t&&(e.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${t.transparent(.5)}; }`))});CH.register(new V9t);CH.register(new z9t);CH.register(new U9t);function Uc(n,e){let t=0;for(let i=0;ii-1)return[];const{tabSize:o,indentSize:a,insertSpaces:l}=n.getOptions(),c=(p,m)=>(m=m||1,nh.shiftIndent(p,p.length+m,o,a,l)),u=(p,m)=>(m=m||1,nh.unshiftIndent(p,p.length+m,o,a,l)),d=[],h=n.getLineContent(t);let f=Ji(h),g=f;s.shouldIncrease(t)?(g=c(g),f=c(f)):s.shouldIndentNextLine(t)&&(g=c(g)),t++;for(let p=t;p<=i;p++){if(j9t(n,p))continue;const m=n.getLineContent(p),_=Ji(m),v=g;s.shouldDecrease(p,v)&&(g=u(g),f=u(f)),_!==g&&d.push(jr.replaceMove(new yt(p,1,p,_.length+1),jle(g,a,l))),!s.shouldIgnore(p)&&(s.shouldIncrease(p,v)?(f=c(f),g=f):s.shouldIndentNextLine(p,v)?g=c(g):g=f)}return d}function j9t(n,e){return n.tokenization.isCheapToTokenize(e)?n.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var q9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},K9t=function(n,e){return function(t,i){e(t,i,n)}};class ude extends ot{static{this.ID="editor.action.indentationToSpaces"}constructor(){super({id:ude.ID,label:w("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:Q.writable,metadata:{description:Gt("indentationToSpacesDescription","Convert the tab indentation to spaces.")}})}run(e,t){const i=t.getModel();if(!i)return;const r=i.getOptions(),s=t.getSelection();if(!s)return;const o=new Q9t(s,r.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[o]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}}class dde extends ot{static{this.ID="editor.action.indentationToTabs"}constructor(){super({id:dde.ID,label:w("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:Q.writable,metadata:{description:Gt("indentationToTabsDescription","Convert the spaces indentation to tabs.")}})}run(e,t){const i=t.getModel();if(!i)return;const r=i.getOptions(),s=t.getSelection();if(!s)return;const o=new J9t(s,r.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[o]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}}class hde extends ot{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(hh),r=e.get(Sr),s=t.getModel();if(!s)return;const o=r.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget),a=s.getOptions(),l=[1,2,3,4,5,6,7,8].map(u=>({id:u.toString(),label:u.toString(),description:u===o.tabSize&&u===a.tabSize?w("configuredTabSize","Configured Tab Size"):u===o.tabSize?w("defaultTabSize","Default Tab Size"):u===a.tabSize?w("currentTabSize","Current Tab Size"):void 0})),c=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(l,{placeHolder:w({key:"selectTabWidth",comment:["Tab corresponds to the tab key"]},"Select Tab Size for Current File"),activeItem:l[c]}).then(u=>{if(u&&s&&!s.isDisposed()){const d=parseInt(u.label,10);this.displaySizeOnly?s.updateOptions({tabSize:d}):s.updateOptions({tabSize:d,indentSize:d,insertSpaces:this.insertSpaces})}})},50)}}class fde extends hde{static{this.ID="editor.action.indentUsingTabs"}constructor(){super(!1,!1,{id:fde.ID,label:w("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0,metadata:{description:Gt("indentUsingTabsDescription","Use indentation with tabs.")}})}}class gde extends hde{static{this.ID="editor.action.indentUsingSpaces"}constructor(){super(!0,!1,{id:gde.ID,label:w("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0,metadata:{description:Gt("indentUsingSpacesDescription","Use indentation with spaces.")}})}}class pde extends hde{static{this.ID="editor.action.changeTabDisplaySize"}constructor(){super(!0,!0,{id:pde.ID,label:w("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0,metadata:{description:Gt("changeTabDisplaySizeDescription","Change the space size equivalent of the tab.")}})}}class mde extends ot{static{this.ID="editor.action.detectIndentation"}constructor(){super({id:mde.ID,label:w("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0,metadata:{description:Gt("detectIndentationDescription","Detect the indentation from content.")}})}run(e,t){const i=e.get(Sr),r=t.getModel();if(!r)return;const s=i.getCreationOptions(r.getLanguageId(),r.uri,r.isForSimpleWidget);r.detectIndentation(s.insertSpaces,s.tabSize)}}class G9t extends ot{constructor(){super({id:"editor.action.reindentlines",label:w("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:Q.writable,metadata:{description:Gt("editor.reindentlinesDescription","Reindent the lines of the editor.")}})}run(e,t){const i=e.get(Zr),r=t.getModel();if(!r)return;const s=mBe(r,i,1,r.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class Y9t extends ot{constructor(){super({id:"editor.action.reindentselectedlines",label:w("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:Q.writable,metadata:{description:Gt("editor.reindentselectedlinesDescription","Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(Zr),r=t.getModel();if(!r)return;const s=t.getSelections();if(s===null)return;const o=[];for(const a of s){let l=a.startLineNumber,c=a.endLineNumber;if(l!==c&&a.endColumn===1&&c--,l===1){if(l===c)continue}else l--;const u=mBe(r,i,l,c);o.push(...u)}o.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,o),t.pushUndoStop())}}class Z9t{constructor(e,t){this._initialSelection=t,this._edits=[],this._selectionId=null;for(const i of e)i.range&&typeof i.text=="string"&&this._edits.push(i)}getEditOperations(e,t){for(const r of this._edits)t.addEditOperation($.lift(r.range),r.text);let i=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!1))),i||(this._selectionId=t.trackSelection(this._initialSelection))}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}let X9=class{static{this.ID="editor.contrib.autoIndentOnPaste"}constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new ke,this.callOnModel=new ke,this.callOnDispose.add(e.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(e.onDidChangeModel(()=>this.update())),this.callOnDispose.add(e.onDidChangeModelLanguage(()=>this.update()))}update(){this.callOnModel.clear(),!(this.editor.getOption(12)<4||this.editor.getOption(55))&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:e})=>{this.trigger(e)}))}trigger(e){const t=this.editor.getSelections();if(t===null||t.length>1)return;const i=this.editor.getModel();if(!i||this.rangeContainsOnlyWhitespaceCharacters(i,e)||X9t(i,e)||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:o,indentSize:a,insertSpaces:l}=i.getOptions(),c=[],u={shiftIndent:g=>nh.shiftIndent(g,g.length+1,o,a,l),unshiftIndent:g=>nh.unshiftIndent(g,g.length+1,o,a,l)};let d=e.startLineNumber;for(;d<=e.endLineNumber;){if(this.shouldIgnoreLine(i,d)){d++;continue}break}if(d>e.endLineNumber)return;let h=i.getLineContent(d);if(!/\S/.test(h.substring(0,e.startColumn-1))){const g=RI(s,i,i.getLanguageId(),d,u,this._languageConfigurationService);if(g!==null){const p=Ji(h),m=Uc(g,o),_=Uc(p,o);if(m!==_){const v=GI(m,o,l);c.push({range:new $(d,1,d,p.length+1),text:v}),h=v+h.substring(p.length)}else{const v=c8e(i,d,this._languageConfigurationService);if(v===0||v===8)return}}}const f=d;for(;di.tokenization.getLineTokens(m),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(m,_)=>i.getLanguageIdAtPosition(m,_)},getLineContent:m=>m===f?h:i.getLineContent(m)},i.getLanguageId(),d+1,u,this._languageConfigurationService);if(p!==null){const m=Uc(p,o),_=Uc(Ji(i.getLineContent(d+1)),o);if(m!==_){const v=m-_;for(let y=d+1;y<=e.endLineNumber;y++){const C=i.getLineContent(y),x=Ji(C),L=Uc(x,o)+v,D=GI(L,o,l);D!==x&&c.push({range:new $(y,1,y,x.length+1),text:D})}}}}if(c.length>0){this.editor.pushUndoStop();const g=new Z9t(c,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",g),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(e,t){const i=s=>s.trim().length===0;let r=!0;if(t.startLineNumber===t.endLineNumber){const o=e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1);r=i(o)}else for(let s=t.startLineNumber;s<=t.endLineNumber;s++){const o=e.getLineContent(s);if(s===t.startLineNumber){const a=o.substring(t.startColumn-1);r=i(a)}else if(s===t.endLineNumber){const a=o.substring(0,t.endColumn-1);r=i(a)}else r=e.getLineFirstNonWhitespaceColumn(s)===0;if(!r)break}return r}shouldIgnoreLine(e,t){e.tokenization.forceTokenization(t);const i=e.getLineFirstNonWhitespaceColumn(t);if(i===0)return!0;const r=e.tokenization.getLineTokens(t);if(r.getCount()>0){const s=r.findTokenIndexAtOffset(i);if(s>=0&&r.getStandardTokenType(s)===1)return!0}return!1}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};X9=q9t([K9t(1,Zr)],X9);function X9t(n,e){const t=i=>Cxt(n,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function _Be(n,e,t,i){if(n.getLineCount()===1&&n.getLineMaxColumn(1)===1)return;let r="";for(let o=0;o=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},n7t=function(n,e){return function(t,i){e(t,i,n)}},b5;let BE=class{static{b5=this}static{this.ID="editor.contrib.inPlaceReplaceController"}static get(e){return e.getContribution(b5.ID)}static{this.DECORATION=un.register({description:"in-place-replace",className:"valueSetReplacement"})}constructor(e,t){this.editor=e,this.editorWorkerService=t,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(e,t){this.currentRequest?.cancel();const i=this.editor.getSelection(),r=this.editor.getModel();if(!r||!i)return;let s=i;if(s.startLineNumber!==s.endLineNumber)return;const o=new $8e(this.editor,5),a=r.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=ko(l=>this.editorWorkerService.navigateValueSet(a,s,t)),this.currentRequest.then(l=>{if(!l||!l.range||!l.value||!o.validate(this.editor))return;const c=$.lift(l.range);let u=l.range;const d=l.value.length-(s.endColumn-s.startColumn);u={startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.startColumn+l.value.length},d>1&&(s=new yt(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+d-1));const h=new e7t(c,s,l.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,h),this.editor.pushUndoStop(),this.decorations.set([{range:u,options:b5.DECORATION}]),this.decorationRemover?.cancel(),this.decorationRemover=Y_(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(rn)}).catch(rn)):Promise.resolve(void 0)}};BE=b5=t7t([n7t(1,Oc)],BE);class i7t extends ot{constructor(){super({id:"editor.action.inPlaceReplace.up",label:w("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=BE.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class r7t extends ot{constructor(){super({id:"editor.action.inPlaceReplace.down",label:w("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=BE.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}Zn(BE.ID,BE,4);Pe(i7t);Pe(r7t);class s7t extends ot{constructor(){super({id:"expandLineSelection",label:w("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:Q.textInputFocus,primary:2090}})}run(e,t,i){if(i=i||{},!t.hasModel())return;const r=t._getViewModel();r.model.pushStackElement(),r.setCursorStates(i.source,3,qo.expandLineSelection(r,r.getCursorStates())),r.revealAllCursors(i.source,!0)}}Pe(s7t);class o7t{constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=a7t(e,this._cursors,this._trimInRegexesAndStrings);for(let r=0,s=i.length;ra.lineNumber===l.lineNumber?a.column-l.column:a.lineNumber-l.lineNumber);for(let a=e.length-2;a>=0;a--)e[a].lineNumber===e[a+1].lineNumber&&e.splice(a,1);const i=[];let r=0,s=0;const o=e.length;for(let a=1,l=n.getLineCount();a<=l;a++){const c=n.getLineContent(a),u=c.length+1;let d=0;if(s{h.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let r;!t&&i&&this.editor.getOption(150)&&(r=w("showAccessibleViewHint","Inspect this in the accessible view ({0})",i.getAriaLabel())),ql(r?e+", "+r:e)}shouldShowHoverAt(e){const t=this.model.get()?.primaryGhostText.get();return t?t.parts.some(i=>e.containsPosition(new he(t.lineNumber,i.column))):!1}shouldShowHoverAtViewZone(e){return this._ghostTextWidgets.get()[0]?.ownsViewZone(e)??!1}};ih=mte=r9t([Pm(1,Tt),Pm(2,jt),Pm(3,En),Pm(4,_r),Pm(5,cd),Pm(6,dt),Pm(7,t1),Pm(8,xi),Pm(9,_u)],ih);function s9t(n,e){const t=kn("result",[]),i=[];return e.add(tn(r=>{const s=n.read(r);qr(o=>{if(s.length!==i.length){i.length=s.length;for(let a=0;aa.set(s[l],o))})})),t}class ode extends ot{static{this.ID=p7e}constructor(){super({id:ode.ID,label:w("action.inlineSuggest.showNext","Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Le.and(Q.writable,_l.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){ih.get(t)?.model.get()?.next()}}class ade extends ot{static{this.ID=g7e}constructor(){super({id:ade.ID,label:w("action.inlineSuggest.showPrevious","Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Le.and(Q.writable,_l.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){ih.get(t)?.model.get()?.previous()}}class o9t extends ot{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:w("action.inlineSuggest.trigger","Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:Q.writable})}async run(e,t){const i=ih.get(t);await cFe(async r=>{await i?.model.get()?.triggerExplicitly(r),i?.playAccessibilitySignal(r)})}}class a9t extends ot{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:w("action.inlineSuggest.acceptNextWord","Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:Le.and(Q.writable,_l.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:Le.and(Q.writable,_l.inlineSuggestionVisible)},menuOpts:[{menuId:ce.InlineSuggestionToolbar,title:w("acceptWord","Accept Word"),group:"primary",order:2}]})}async run(e,t){const i=ih.get(t);await i?.model.get()?.acceptNextWord(i.editor)}}class l9t extends ot{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:w("action.inlineSuggest.acceptNextLine","Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:Le.and(Q.writable,_l.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:ce.InlineSuggestionToolbar,title:w("acceptLine","Accept Line"),group:"secondary",order:2}]})}async run(e,t){const i=ih.get(t);await i?.model.get()?.acceptNextLine(i.editor)}}class c9t extends ot{constructor(){super({id:f7e,label:w("action.inlineSuggest.accept","Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:_l.inlineSuggestionVisible,menuOpts:[{menuId:ce.InlineSuggestionToolbar,title:w("accept","Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Le.and(_l.inlineSuggestionVisible,Q.tabMovesFocus.toNegated(),_l.inlineSuggestionHasIndentationLessThanTabSize,xn.Visible.toNegated(),Q.hoverFocused.toNegated())}})}async run(e,t){const i=ih.get(t);i&&(i.model.get()?.accept(i.editor),i.editor.focus())}}class lde extends ot{static{this.ID="editor.action.inlineSuggest.hide"}constructor(){super({id:lde.ID,label:w("action.inlineSuggest.hide","Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:_l.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=ih.get(t);qr(r=>{i?.model.get()?.stop(r)})}}class cde extends Gl{static{this.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar"}constructor(){super({id:cde.ID,title:w("action.inlineSuggest.alwaysShowToolbar","Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:ce.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Le.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e,t){const i=e.get(En),s=i.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";i.updateValue("editor.inlineSuggest.showToolbar",s)}}var u9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},qT=function(n,e){return function(t,i){e(t,i,n)}};class d9t{constructor(e,t,i){this.owner=e,this.range=t,this.controller=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let _te=class{constructor(e,t,i,r,s,o){this._editor=e,this._languageService=t,this._openerService=i,this.accessibilityService=r,this._instantiationService=s,this._telemetryService=o,this.hoverOrdinal=4}suggestHoverAnchor(e){const t=ih.get(this._editor);if(!t)return null;const i=e.target;if(i.type===8){const r=i.detail;if(t.shouldShowHoverAtViewZone(r.viewZoneId))return new gF(1e3,this,$.fromPositions(this._editor.getModel().validatePosition(r.positionBefore||r.position)),e.event.posx,e.event.posy,!1)}return i.type===7&&t.shouldShowHoverAt(i.range)?new gF(1e3,this,i.range,e.event.posx,e.event.posy,!1):i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range)?new gF(1e3,this,i.range,e.event.posx,e.event.posy,!1):null}computeSync(e,t){if(this._editor.getOption(62).showToolbar!=="onHover")return[];const i=ih.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new d9t(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new ke,r=t[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(8)&&i.add(this.renderScreenReaderText(e,r));const s=r.controller.model.get(),o=this._instantiationService.createInstance(AE,this._editor,!1,Hd(null),s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands),a=o.getDomNode();e.fragment.appendChild(a),s.triggerExplicitly(),i.add(o);const l={hoverPart:r,hoverElement:a,dispose(){i.dispose()}};return new Kw([l])}renderScreenReaderText(e,t){const i=new ke,r=qe,s=r("div.hover-row.markdown-hover"),o=Ne(s,r("div.hover-contents",{"aria-live":"assertive"})),a=i.add(new Q_({editor:this._editor},this._languageService,this._openerService)),l=c=>{i.add(a.onDidRenderAsync(()=>{o.className="hover-contents code-hover-contents",e.onContentsChanged()}));const u=w("inlineSuggestionFollows","Suggestion:"),d=i.add(a.render(new za().appendText(u).appendCodeblock("text",c)));o.replaceChildren(d.element)};return i.add(tn(c=>{const u=t.controller.model.read(c)?.primaryGhostText.read(c);if(u){const d=this._editor.getModel().getLineContent(u.lineNumber);l(u.renderForScreenReader(d))}else ea(o)})),e.fragment.appendChild(s),i}};_te=u9t([qT(1,Hr),qT(2,Pc),qT(3,_u),qT(4,Tt),qT(5,Qa)],_te);class h9t{}const CH=new class{constructor(){this._implementations=[]}register(e){return this._implementations.push(e),{dispose:()=>{const t=this._implementations.indexOf(e);t!==-1&&this._implementations.splice(t,1)}}}getImplementations(){return this._implementations}};Zn(ih.ID,ih,3);Pe(o9t);Pe(ode);Pe(ade);Pe(a9t);Pe(l9t);Pe(c9t);Pe(lde);lr(cde);DC.register(_te);CH.register(new h9t);var f9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},nK=function(n,e){return function(t,i){e(t,i,n)}},VD;let gR=class{static{VD=this}static{this.ID="editor.contrib.gotodefinitionatposition"}static{this.MAX_SOURCE_PREVIEW_LINES=8}constructor(e,t,i,r){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=r,this.toUnhook=new ke,this.toUnhookForKeyboard=new ke,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new hH(e);this.toUnhook.add(s),this.toUnhook.add(s.onMouseMoveOrRelevantKeyDown(([o,a])=>{this.startFindDefinitionFromMouse(o,a??void 0)})),this.toUnhook.add(s.onExecute(o=>{this.isEnabled(o)&&this.gotoDefinition(o.target.position,o.hasSideBySideModifier).catch(a=>{rn(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(VD.ID)}async startFindDefinitionFromCursor(e){await this.startFindDefinition(e),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown(t=>{t&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())}))}startFindDefinitionFromMouse(e,t){if(e.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(e,t)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}const i=e.target.position;this.startFindDefinition(i)}async startFindDefinition(e){this.toUnhookForKeyboard.clear();const t=e?this.editor.getModel()?.getWordAtPosition(e):null;if(!t){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===t.startColumn&&this.currentWordAtPosition.endColumn===t.endColumn&&this.currentWordAtPosition.word===t.word)return;this.currentWordAtPosition=t;const i=new $8e(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=ko(o=>this.findDefinition(e,o));let r;try{r=await this.previousPromise}catch(o){rn(o);return}if(!r||!r.length||!i.validate(this.editor)){this.removeLinkDecorations();return}const s=r[0].originSelectionRange?$.lift(r[0].originSelectionRange):new $(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(r.length>1){let o=s;for(const{originSelectionRange:a}of r)a&&(o=$.plusRange(o,a));this.addDecoration(o,new za().appendText(w("multipleResults","Click to show {0} definitions.",r.length)))}else{const o=r[0];if(!o.uri)return;this.textModelResolverService.createModelReference(o.uri).then(a=>{if(!a.object||!a.object.textEditorModel){a.dispose();return}const{object:{textEditorModel:l}}=a,{startLineNumber:c}=o.range;if(c<1||c>l.getLineCount()){a.dispose();return}const u=this.getPreviewValue(l,c,o),d=this.languageService.guessLanguageIdByFilepathOrFirstLine(l.uri);this.addDecoration(s,u?new za().appendCodeblock(d||"",u):void 0),a.dispose()})}}getPreviewValue(e,t,i){let r=i.range;return r.endLineNumber-r.startLineNumber>=VD.MAX_SOURCE_PREVIEW_LINES&&(r=this.getPreviewRangeBasedOnIndentation(e,t)),this.stripIndentationFromPreviewRange(e,t,r)}stripIndentationFromPreviewRange(e,t,i){let s=e.getLineFirstNonWhitespaceColumn(t);for(let a=t+1;a{const r=!t&&this.editor.getOption(89)&&!this.isInPeekEditor(i);return new TO({openToSide:t,openInPeek:r,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(jt);return Dc.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};gR=VD=f9t([nK(1,Nc),nK(2,Hr),nK(3,dt)],gR);Zn(gR.ID,gR,2);var fBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Y9=function(n,e){return function(t,i){e(t,i,n)}};class Exe{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let vte=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new fe,this.onDidChange=this._onDidChange.event,this._dispoables=new ke,this._markers=[],this._nextIdx=-1,Pt.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const r=this._configService.getValue("problems.sortOrder"),s=(a,l)=>{let c=aN(a.resource.toString(),l.resource.toString());return c===0&&(r==="position"?c=$.compareRangesUsingStarts(a,l)||os.compare(a.severity,l.severity):c=os.compare(a.severity,l.severity)||$.compareRangesUsingStarts(a,l)),c},o=()=>{this._markers=this._markerService.read({resource:Pt.isUri(e)?e:void 0,severities:os.Error|os.Warning|os.Info}),typeof e=="function"&&(this._markers=this._markers.filter(a=>this._resourceFilter(a.resource))),this._markers.sort(s)};o(),this._dispoables.add(t.onMarkerChanged(a=>{(!this._resourceFilter||a.some(l=>this._resourceFilter(l)))&&(o(),this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(e){return!this._resourceFilter&&!e?!0:!this._resourceFilter||!e?!1:this._resourceFilter(e)}get selected(){const e=this._markers[this._nextIdx];return e&&new Exe(e,this._nextIdx+1,this._markers.length)}_initIdx(e,t,i){let r=!1,s=this._markers.findIndex(o=>o.resource.toString()===e.uri.toString());s<0&&(s=JA(this._markers,{resource:e.uri},(o,a)=>aN(o.resource.toString(),a.resource.toString())),s<0&&(s=~s));for(let o=s;or.resource.toString()===e.toString());if(!(i<0)){for(;i=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Lx=function(n,e){return function(t,i){e(t,i,n)}},wte;class p9t{constructor(e,t,i,r,s){this._openerService=r,this._labelService=s,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new ke,this._editor=t;const o=document.createElement("div");o.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),o.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),o.appendChild(this._relatedBlock),this._disposables.add(Jr(this._relatedBlock,"click",a=>{a.preventDefault();const l=this._relatedDiagnostics.get(a.target);l&&i(l)})),this._scrollable=new O5e(o,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),e.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(a=>{o.style.left=`-${a.scrollLeft}px`,o.style.top=`-${a.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){er(this._disposables)}update(e){const{source:t,message:i,relatedInformation:r,code:s}=e;let o=(t?.length||0)+2;s&&(typeof s=="string"?o+=s.length:o+=s.value.length);const a=om(i);this._lines=a.length,this._longestLineLength=0;for(const h of a)this._longestLineLength=Math.max(h.length+o,this._longestLineLength);Jo(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let l=this._messageBlock;for(const h of a)l=document.createElement("div"),l.innerText=h,h===""&&(l.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(l);if(t||s){const h=document.createElement("span");if(h.classList.add("details"),l.appendChild(h),t){const f=document.createElement("span");f.innerText=t,f.classList.add("source"),h.appendChild(f)}if(s)if(typeof s=="string"){const f=document.createElement("span");f.innerText=`(${s})`,f.classList.add("code"),h.appendChild(f)}else{this._codeLink=qe("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=g=>{this._openerService.open(s.target,{allowCommands:!0}),g.preventDefault(),g.stopPropagation()};const f=Ne(this._codeLink,qe("span"));f.innerText=s.value,h.appendChild(this._codeLink)}}if(Jo(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),bl(r)){const h=this._relatedBlock.appendChild(document.createElement("div"));h.style.paddingTop=`${Math.floor(this._editor.getOption(67)*.66)}px`,this._lines+=1;for(const f of r){const g=document.createElement("div"),p=document.createElement("a");p.classList.add("filename"),p.innerText=`${this._labelService.getUriBasenameLabel(f.resource)}(${f.startLineNumber}, ${f.startColumn}): `,p.title=this._labelService.getUriLabel(f.resource),this._relatedDiagnostics.set(p,f);const m=document.createElement("span");m.innerText=f.message,g.appendChild(p),g.appendChild(m),this._lines+=1,h.appendChild(g)}}const c=this._editor.getOption(50),u=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75),d=c.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:u,scrollHeight:d})}layout(e,t){this._scrollable.getDomNode().style.height=`${e}px`,this._scrollable.getDomNode().style.width=`${t}px`,this._scrollable.setScrollDimensions({width:t,height:e})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(e){let t="";switch(e.severity){case os.Error:t=w("Error","Error");break;case os.Warning:t=w("Warning","Warning");break;case os.Info:t=w("Info","Info");break;case os.Hint:t=w("Hint","Hint");break}let i=w("marker aria","{0} at {1}. ",t,e.startLineNumber+":"+e.startColumn);const r=this._editor.getModel();return r&&e.startLineNumber<=r.getLineCount()&&e.startLineNumber>=1&&(i=`${r.getLineContent(e.startLineNumber)}, ${i}`),i}}let pR=class extends M9{static{wte=this}static{this.TitleMenu=new ce("gotoErrorTitleMenu")}constructor(e,t,i,r,s,o,a){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},s),this._themeService=t,this._openerService=i,this._menuService=r,this._contextKeyService=o,this._labelService=a,this._callOnDispose=new ke,this._onDidSelectRelatedInformation=new fe,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=os.Warning,this._backgroundColor=Te.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(b9t);let t=Cte,i=m9t;this._severity===os.Warning?(t=vF,i=_9t):this._severity===os.Info&&(t=xte,i=v9t);const r=e.getColor(t),s=e.getColor(i);this.style({arrowColor:r,frameColor:r,headerBackgroundColor:s,primaryHeadingColor:e.getColor(E7e),secondaryHeadingColor:e.getColor(L7e)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(r=>this.editor.focus()));const t=[],i=this._menuService.getMenuActions(wte.TitleMenu,this._contextKeyService);EW(i,t),this._actionbarWidget.push(t,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=Ne(e,qe(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new p9t(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,i){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());const r=$.lift(e),s=this.editor.getPosition(),o=s&&r.containsPosition(s)?s:r.getStartPosition();super.show(o,this.computeRequiredHeight());const a=this.editor.getModel();if(a){const l=i>1?w("problems","{0} of {1} problems",t,i):w("change","{0} of {1} problem",t,i);this.setTitle(th(a.uri),l)}this._icon.className=`codicon ${yte.className(os.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(o,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};pR=wte=g9t([Lx(1,go),Lx(2,Pc),Lx(3,ld),Lx(4,Tt),Lx(5,jt),Lx(6,pE)],pR);const Lxe=_N(aW,pyt),Txe=_N(X_,vN),Dxe=_N(Xp,bN),Cte=J("editorMarkerNavigationError.background",{dark:Lxe,light:Lxe,hcDark:Yn,hcLight:Yn},w("editorMarkerNavigationError","Editor marker navigation widget error color.")),m9t=J("editorMarkerNavigationError.headerBackground",{dark:Sn(Cte,.1),light:Sn(Cte,.1),hcDark:null,hcLight:null},w("editorMarkerNavigationErrorHeaderBackground","Editor marker navigation widget error heading background.")),vF=J("editorMarkerNavigationWarning.background",{dark:Txe,light:Txe,hcDark:Yn,hcLight:Yn},w("editorMarkerNavigationWarning","Editor marker navigation widget warning color.")),_9t=J("editorMarkerNavigationWarning.headerBackground",{dark:Sn(vF,.1),light:Sn(vF,.1),hcDark:"#0C141F",hcLight:Sn(vF,.2)},w("editorMarkerNavigationWarningBackground","Editor marker navigation widget warning heading background.")),xte=J("editorMarkerNavigationInfo.background",{dark:Dxe,light:Dxe,hcDark:Yn,hcLight:Yn},w("editorMarkerNavigationInfo","Editor marker navigation widget info color.")),v9t=J("editorMarkerNavigationInfo.headerBackground",{dark:Sn(xte,.1),light:Sn(xte,.1),hcDark:null,hcLight:null},w("editorMarkerNavigationInfoHeaderBackground","Editor marker navigation widget info heading background.")),b9t=J("editorMarkerNavigation.background",lf,w("editorMarkerNavigationBackground","Editor marker navigation widget background."));var y9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},S3=function(n,e){return function(t,i){e(t,i,n)}},zD;let Zw=class{static{zD=this}static{this.ID="editor.contrib.markerController"}static get(e){return e.getContribution(zD.ID)}constructor(e,t,i,r,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=r,this._instantiationService=s,this._sessionDispoables=new ke,this._editor=e,this._widgetVisible=pBe.bindTo(this._contextKeyService)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(e){if(this._model&&this._model.matches(e))return this._model;let t=!1;return this._model&&(t=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(e),t&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(pR,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(i=>{(!this._model?.selected||!$.containsPosition(this._model?.selected.marker,i.position))&&this._model?.resetIndex()})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;const i=this._model.find(this._editor.getModel().uri,this._widget.position);i?this._widget.updateMarker(i.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(i=>{this._editorService.openCodeEditor({resource:i.resource,options:{pinned:!0,revealIfOpened:!0,selection:$.lift(i).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(e=!0){this._cleanUp(),e&&this._editor.focus()}showAtMarker(e){if(this._editor.hasModel()){const t=this._getOrCreateModel(this._editor.getModel().uri);t.resetIndex(),t.move(!0,this._editor.getModel(),new he(e.startLineNumber,e.startColumn)),t.selected&&this._widget.showAtMarker(t.selected.marker,t.selected.index,t.selected.total)}}async nagivate(e,t){if(this._editor.hasModel()){const i=this._getOrCreateModel(t?void 0:this._editor.getModel().uri);if(i.move(e,this._editor.getModel(),this._editor.getPosition()),!i.selected)return;if(i.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=await this._editorService.openCodeEditor({resource:i.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:i.selected.marker}},this._editor);r&&(zD.get(r)?.close(),zD.get(r)?.nagivate(e,t))}else this._widget.showAtMarker(i.selected.marker,i.selected.index,i.selected.total)}}};Zw=zD=y9t([S3(1,gBe),S3(2,jt),S3(3,ai),S3(4,Tt)],Zw);class xH extends ot{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){t.hasModel()&&Zw.get(t)?.nagivate(this._next,this._multiFile)}}class Dk extends xH{static{this.ID="editor.action.marker.next"}static{this.LABEL=w("markerAction.next.label","Go to Next Problem (Error, Warning, Info)")}constructor(){super(!0,!1,{id:Dk.ID,label:Dk.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:578,weight:100},menuOpts:{menuId:pR.TitleMenu,title:Dk.LABEL,icon:kr("marker-navigation-next",ze.arrowDown,w("nextMarkerIcon","Icon for goto next marker.")),group:"navigation",order:1}})}}class KI extends xH{static{this.ID="editor.action.marker.prev"}static{this.LABEL=w("markerAction.previous.label","Go to Previous Problem (Error, Warning, Info)")}constructor(){super(!1,!1,{id:KI.ID,label:KI.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:1602,weight:100},menuOpts:{menuId:pR.TitleMenu,title:KI.LABEL,icon:kr("marker-navigation-previous",ze.arrowUp,w("previousMarkerIcon","Icon for goto previous marker.")),group:"navigation",order:2}})}}class w9t extends xH{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:w("markerAction.nextInFiles.label","Go to Next Problem in Files (Error, Warning, Info)"),alias:"Go to Next Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:66,weight:100},menuOpts:{menuId:ce.MenubarGoMenu,title:w({key:"miGotoNextProblem",comment:["&& denotes a mnemonic"]},"Next &&Problem"),group:"6_problem_nav",order:1}})}}class C9t extends xH{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:w("markerAction.previousInFiles.label","Go to Previous Problem in Files (Error, Warning, Info)"),alias:"Go to Previous Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:1090,weight:100},menuOpts:{menuId:ce.MenubarGoMenu,title:w({key:"miGotoPreviousProblem",comment:["&& denotes a mnemonic"]},"Previous &&Problem"),group:"6_problem_nav",order:2}})}}Zn(Zw.ID,Zw,4);Pe(Dk);Pe(KI);Pe(w9t);Pe(C9t);const pBe=new et("markersNavigationVisible",!1),x9t=fo.bindToContribution(Zw.get);Je(new x9t({id:"closeMarkersNavigation",precondition:pBe,handler:n=>n.close(),kbOpts:{weight:150,kbExpr:Q.focus,primary:9,secondary:[1033]}}));var Mf;(function(n){n.NoAutoFocus="noAutoFocus",n.FocusIfVisible="focusIfVisible",n.AutoFocusImmediately="autoFocusImmediately"})(Mf||(Mf={}));class S9t extends ot{constructor(){super({id:h7e,label:w({key:"showOrFocusHover",comment:["Label for action that will trigger the showing/focusing of a hover in the editor.","If the hover is not visible, it will show the hover.","This allows for users to show the hover without using the mouse."]},"Show or Focus Hover"),metadata:{description:Gt("showOrFocusHoverDescription","Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[Mf.NoAutoFocus,Mf.FocusIfVisible,Mf.AutoFocusImmediately],enumDescriptions:[w("showOrFocusHover.focus.noAutoFocus","The hover will not automatically take focus."),w("showOrFocusHover.focus.focusIfVisible","The hover will take focus only if it is already visible."),w("showOrFocusHover.focus.autoFocusImmediately","The hover will automatically take focus when it appears.")],default:Mf.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const r=wl.get(t);if(!r)return;const s=i?.focus;let o=Mf.FocusIfVisible;Object.values(Mf).includes(s)?o=s:typeof s=="boolean"&&s&&(o=Mf.AutoFocusImmediately);const a=c=>{const u=t.getPosition(),d=new $(u.lineNumber,u.column,u.lineNumber,u.column);r.showContentHover(d,1,1,c)},l=t.getOption(2)===2;r.isHoverVisible?o!==Mf.NoAutoFocus?r.focus():a(l):a(l||o===Mf.AutoFocusImmediately)}}class k9t extends ot{constructor(){super({id:$3t,label:w({key:"showDefinitionPreviewHover",comment:["Label for action that will trigger the showing of definition preview hover in the editor.","This allows for users to show the definition preview hover without using the mouse."]},"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0,metadata:{description:Gt("showDefinitionPreviewHoverDescription","Show the definition preview hover in the editor.")}})}run(e,t){const i=wl.get(t);if(!i)return;const r=t.getPosition();if(!r)return;const s=new $(r.lineNumber,r.column,r.lineNumber,r.column),o=gR.get(t);if(!o)return;o.startFindDefinitionFromCursor(r).then(()=>{i.showContentHover(s,1,1,!0)})}}class E9t extends ot{constructor(){super({id:W3t,label:w({key:"scrollUpHover",comment:["Action that allows to scroll up in the hover widget with the up arrow when the hover widget is focused."]},"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:16,weight:100},metadata:{description:Gt("scrollUpHoverDescription","Scroll up the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.scrollUp()}}class L9t extends ot{constructor(){super({id:H3t,label:w({key:"scrollDownHover",comment:["Action that allows to scroll down in the hover widget with the up arrow when the hover widget is focused."]},"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:18,weight:100},metadata:{description:Gt("scrollDownHoverDescription","Scroll down the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.scrollDown()}}class T9t extends ot{constructor(){super({id:V3t,label:w({key:"scrollLeftHover",comment:["Action that allows to scroll left in the hover widget with the left arrow when the hover widget is focused."]},"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:15,weight:100},metadata:{description:Gt("scrollLeftHoverDescription","Scroll left the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.scrollLeft()}}class D9t extends ot{constructor(){super({id:z3t,label:w({key:"scrollRightHover",comment:["Action that allows to scroll right in the hover widget with the right arrow when the hover widget is focused."]},"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:17,weight:100},metadata:{description:Gt("scrollRightHoverDescription","Scroll right the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.scrollRight()}}class I9t extends ot{constructor(){super({id:U3t,label:w({key:"pageUpHover",comment:["Action that allows to page up in the hover widget with the page up command when the hover widget is focused."]},"Page Up Hover"),alias:"Page Up Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:Gt("pageUpHoverDescription","Page up the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.pageUp()}}class A9t extends ot{constructor(){super({id:j3t,label:w({key:"pageDownHover",comment:["Action that allows to page down in the hover widget with the page down command when the hover widget is focused."]},"Page Down Hover"),alias:"Page Down Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:Gt("pageDownHoverDescription","Page down the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.pageDown()}}class N9t extends ot{constructor(){super({id:q3t,label:w({key:"goToTopHover",comment:["Action that allows to go to the top of the hover widget with the home command when the hover widget is focused."]},"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:Gt("goToTopHoverDescription","Go to the top of the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.goToTop()}}class R9t extends ot{constructor(){super({id:K3t,label:w({key:"goToBottomHover",comment:["Action that allows to go to the bottom in the hover widget with the end command when the hover widget is focused."]},"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:Q.hoverFocused,kbOpts:{kbExpr:Q.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:Gt("goToBottomHoverDescription","Go to the bottom of the editor hover.")}})}run(e,t){const i=wl.get(t);i&&i.goToBottom()}}class P9t extends ot{constructor(){super({id:cH,label:G3t,alias:"Increase Hover Verbosity Level",precondition:Q.hoverVisible})}run(e,t,i){const r=wl.get(t);if(!r)return;const s=i?.index!==void 0?i.index:r.focusedHoverPartIndex();r.updateHoverVerbosityLevel(Zc.Increase,s,i?.focus)}}class O9t extends ot{constructor(){super({id:uH,label:Y3t,alias:"Decrease Hover Verbosity Level",precondition:Q.hoverVisible})}run(e,t,i){const r=wl.get(t);if(!r)return;const s=i?.index!==void 0?i.index:r.focusedHoverPartIndex();wl.get(t)?.updateHoverVerbosityLevel(Zc.Decrease,s,i?.focus)}}var M9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},iK=function(n,e){return function(t,i){e(t,i,n)}};const Ch=qe;class F9t{constructor(e,t,i){this.owner=e,this.range=t,this.marker=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}const Ixe={type:1,filter:{include:Dr.QuickFix},triggerAction:hu.QuickFixHover};let Ste=class{constructor(e,t,i,r){this._editor=e,this._markerDecorationsService=t,this._openerService=i,this._languageFeaturesService=r,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1&&!e.supportsMarkerHover)return[];const i=this._editor.getModel(),r=e.range.startLineNumber,s=i.getLineMaxColumn(r),o=[];for(const a of t){const l=a.range.startLineNumber===r?a.range.startColumn:1,c=a.range.endLineNumber===r?a.range.endColumn:s,u=this._markerDecorationsService.getMarker(i.uri,a);if(!u)continue;const d=new $(e.range.startLineNumber,l,e.range.startLineNumber,c);o.push(new F9t(this,d,u))}return o}renderHoverParts(e,t){if(!t.length)return new Kw([]);const i=new ke,r=[];t.forEach(o=>{const a=this._renderMarkerHover(o);e.fragment.appendChild(a.hoverElement),r.push(a)});const s=t.length===1?t[0]:t.sort((o,a)=>os.compare(o.marker.severity,a.marker.severity))[0];return this.renderMarkerStatusbar(e,s,i),new Kw(r)}_renderMarkerHover(e){const t=new ke,i=Ch("div.hover-row"),r=Ne(i,Ch("div.marker.hover-contents")),{source:s,message:o,code:a,relatedInformation:l}=e.marker;this._editor.applyFontInfo(r);const c=Ne(r,Ch("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=o,s||a)if(a&&typeof a!="string"){const d=Ch("span");if(s){const p=Ne(d,Ch("span"));p.innerText=s}const h=Ne(d,Ch("a.code-link"));h.setAttribute("href",a.target.toString()),t.add(Ce(h,"click",p=>{this._openerService.open(a.target,{allowCommands:!0}),p.preventDefault(),p.stopPropagation()}));const f=Ne(h,Ch("span"));f.innerText=a.value;const g=Ne(r,d);g.style.opacity="0.6",g.style.paddingLeft="6px"}else{const d=Ne(r,Ch("span"));d.style.opacity="0.6",d.style.paddingLeft="6px",d.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(bl(l))for(const{message:d,resource:h,startLineNumber:f,startColumn:g}of l){const p=Ne(r,Ch("div"));p.style.marginTop="8px";const m=Ne(p,Ch("a"));m.innerText=`${th(h)}(${f}, ${g}): `,m.style.cursor="pointer",t.add(Ce(m,"click",v=>{if(v.stopPropagation(),v.preventDefault(),this._openerService){const y={selection:{startLineNumber:f,startColumn:g}};this._openerService.open(h,{fromUserGesture:!0,editorOptions:y}).catch(rn)}}));const _=Ne(p,Ch("span"));_.innerText=d,this._editor.applyFontInfo(_)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}renderMarkerStatusbar(e,t,i){if(t.marker.severity===os.Error||t.marker.severity===os.Warning||t.marker.severity===os.Info){const r=Zw.get(this._editor);r&&e.statusBar.addAction({label:w("view problem","View Problem"),commandId:Dk.ID,run:()=>{e.hide(),r.showAtMarker(t.marker),this._editor.focus()}})}if(!this._editor.getOption(92)){const r=e.statusBar.append(Ch("div"));this.recentMarkerCodeActionsInfo&&(O8.makeKey(this.recentMarkerCodeActionsInfo.marker)===O8.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(r.textContent=w("noQuickFixes","No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?me.None:Sb(()=>r.textContent=w("checkingForQuickFixes","Checking for quick fixes..."),200,i);r.textContent||(r.textContent=" ");const o=this.getCodeActions(t.marker);i.add(Lt(()=>o.cancel())),o.then(a=>{if(s.dispose(),this.recentMarkerCodeActionsInfo={marker:t.marker,hasCodeActions:a.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){a.dispose(),r.textContent=w("noQuickFixes","No quick fixes available");return}r.style.display="none";let l=!1;i.add(Lt(()=>{l||a.dispose()})),e.statusBar.addAction({label:w("quick fixes","Quick Fix..."),commandId:Due,run:c=>{l=!0;const u=DE.get(this._editor),d=ms(c);e.hide(),u?.showCodeActions(Ixe,a,{x:d.left,y:d.top,width:d.width,height:d.height})}})},rn)}}getCodeActions(e){return ko(t=>MS(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new $(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),Ixe,p_.None,t))}};Ste=M9t([iK(1,Ule),iK(2,Pc),iK(3,dt)],Ste);class B9t{get lineNumber(){return this._lineNumber}set lineNumber(e){this._lineNumber=e}get lane(){return this._laneOrLine}set lane(e){this._laneOrLine=e}constructor(e){this._editor=e,this._lineNumber=-1,this._laneOrLine=af.Center}computeSync(){const e=s=>({value:s}),t=this._editor.getLineDecorations(this._lineNumber),i=[],r=this._laneOrLine==="lineNo";if(!t)return i;for(const s of t){const o=s.options.glyphMargin?.position??af.Center;if(!r&&o!==this._laneOrLine)continue;const a=r?s.options.lineNumberHoverMessage:s.options.glyphMarginHoverMessage;!a||fE(a)||i.push(...fae(a).map(e))}return i}}var $9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Axe=function(n,e){return function(t,i){e(t,i,n)}},kte;const Nxe=qe;let Ete=class extends me{static{kte=this}static{this.ID="editor.contrib.modesGlyphHoverWidget"}constructor(e,t,i){super(),this._renderDisposeables=this._register(new ke),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new yle),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new Q_({editor:this._editor},t,i)),this._computer=new B9t(this._editor),this._hoverOperation=this._register(new m7e(this._editor,this._computer)),this._register(this._hoverOperation.onResult(r=>{this._withResult(r.value)})),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(50)&&this._updateFont()})),this._register(Jr(this._hover.containerDomNode,"mouseleave",r=>{this._onMouseLeave(r)})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return kte.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&(this._hoverOperation.cancel(),this._hoverOperation.start(0))}showsOrWillShow(e){const t=e.target;return t.type===2&&t.detail.glyphMarginLane?(this._startShowingAt(t.position.lineNumber,t.detail.glyphMarginLane),!0):t.type===3?(this._startShowingAt(t.position.lineNumber,"lineNo"),!0):!1}_startShowingAt(e,t){this._computer.lineNumber===e&&this._computer.lane===t||(this._hoverOperation.cancel(),this.hide(),this._computer.lineNumber=e,this._computer.lane=t,this._hoverOperation.start(0))}hide(){this._computer.lineNumber=-1,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e,this._messages.length>0?this._renderMessages(this._computer.lineNumber,this._messages):this.hide()}_renderMessages(e,t){this._renderDisposeables.clear();const i=document.createDocumentFragment();for(const r of t){const s=Nxe("div.hover-row.markdown-hover"),o=Ne(s,Nxe("div.hover-contents")),a=this._renderDisposeables.add(this._markdownRenderer.render(r.value));o.appendChild(a.element),i.appendChild(s)}this._updateContents(i),this._showAt(e)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const t=this._editor.getLayoutInfo(),i=this._editor.getTopForLineNumber(e),r=this._editor.getScrollTop(),s=this._editor.getOption(67),o=this._hover.containerDomNode.clientHeight,a=i-r-(o-s)/2,l=t.glyphMarginLeft+t.glyphMarginWidth+(this._computer.lane==="lineNo"?t.lineNumbersWidth:0);this._hover.containerDomNode.style.left=`${l}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(a),0)}px`}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!dH(t,e.x,e.y))&&this.hide()}};Ete=kte=$9t([Axe(1,Hr),Axe(2,Pc)],Ete);var W9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},H9t=function(n,e){return function(t,i){e(t,i,n)}};let Z9=class extends me{static{this.ID="editor.contrib.marginHover"}constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new ke,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new Ui(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(60)&&(this._unhookListeners(),this._hookListeners())}))}_hookListeners(){const e=this._editor.getOption(60);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this._hideWidgets()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._isMouseOnMarginHoverWidget(e)&&this._hideWidgets()}_isMouseOnMarginHoverWidget(e){const t=this._glyphWidget?.getDomNode();return t?dH(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._isMouseOnMarginHoverWidget(e))||this._hideWidgets()}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=this._isMouseOnMarginHoverWidget(e);return t&&i}_onEditorMouseMove(e){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._mouseMoveEvent=e,this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){!e||this._tryShowHoverWidget(e)||this._hideWidgets()}_tryShowHoverWidget(e){return this._getOrCreateGlyphWidget().showsOrWillShow(e)}_onKeyDown(e){this._editor.hasModel()&&(e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4||this._hideWidgets())}_hideWidgets(){this._glyphWidget?.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(Ete,this._editor)),this._glyphWidget}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._glyphWidget?.dispose()}};Z9=W9t([H9t(1,Tt)],Z9);class V9t{}class z9t{}class U9t{}Zn(wl.ID,wl,2);Zn(Z9.ID,Z9,2);Pe(S9t);Pe(k9t);Pe(E9t);Pe(L9t);Pe(T9t);Pe(D9t);Pe(I9t);Pe(A9t);Pe(N9t);Pe(R9t);Pe(P9t);Pe(O9t);DC.register(cR);DC.register(Ste);dh((n,e)=>{const t=n.getColor(C5e);t&&(e.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${t.transparent(.5)}; }`))});CH.register(new V9t);CH.register(new z9t);CH.register(new U9t);function Uc(n,e){let t=0;for(let i=0;ii-1)return[];const{tabSize:o,indentSize:a,insertSpaces:l}=n.getOptions(),c=(p,m)=>(m=m||1,nh.shiftIndent(p,p.length+m,o,a,l)),u=(p,m)=>(m=m||1,nh.unshiftIndent(p,p.length+m,o,a,l)),d=[],h=n.getLineContent(t);let f=Ji(h),g=f;s.shouldIncrease(t)?(g=c(g),f=c(f)):s.shouldIndentNextLine(t)&&(g=c(g)),t++;for(let p=t;p<=i;p++){if(j9t(n,p))continue;const m=n.getLineContent(p),_=Ji(m),v=g;s.shouldDecrease(p,v)&&(g=u(g),f=u(f)),_!==g&&d.push(jr.replaceMove(new yt(p,1,p,_.length+1),jle(g,a,l))),!s.shouldIgnore(p)&&(s.shouldIncrease(p,v)?(f=c(f),g=f):s.shouldIndentNextLine(p,v)?g=c(g):g=f)}return d}function j9t(n,e){return n.tokenization.isCheapToTokenize(e)?n.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var q9t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},K9t=function(n,e){return function(t,i){e(t,i,n)}};class ude extends ot{static{this.ID="editor.action.indentationToSpaces"}constructor(){super({id:ude.ID,label:w("indentationToSpaces","Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:Q.writable,metadata:{description:Gt("indentationToSpacesDescription","Convert the tab indentation to spaces.")}})}run(e,t){const i=t.getModel();if(!i)return;const r=i.getOptions(),s=t.getSelection();if(!s)return;const o=new Q9t(s,r.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[o]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}}class dde extends ot{static{this.ID="editor.action.indentationToTabs"}constructor(){super({id:dde.ID,label:w("indentationToTabs","Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:Q.writable,metadata:{description:Gt("indentationToTabsDescription","Convert the spaces indentation to tabs.")}})}run(e,t){const i=t.getModel();if(!i)return;const r=i.getOptions(),s=t.getSelection();if(!s)return;const o=new J9t(s,r.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[o]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}}class hde extends ot{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(hh),r=e.get(Sr),s=t.getModel();if(!s)return;const o=r.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget),a=s.getOptions(),l=[1,2,3,4,5,6,7,8].map(u=>({id:u.toString(),label:u.toString(),description:u===o.tabSize&&u===a.tabSize?w("configuredTabSize","Configured Tab Size"):u===o.tabSize?w("defaultTabSize","Default Tab Size"):u===a.tabSize?w("currentTabSize","Current Tab Size"):void 0})),c=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(l,{placeHolder:w({key:"selectTabWidth",comment:["Tab corresponds to the tab key"]},"Select Tab Size for Current File"),activeItem:l[c]}).then(u=>{if(u&&s&&!s.isDisposed()){const d=parseInt(u.label,10);this.displaySizeOnly?s.updateOptions({tabSize:d}):s.updateOptions({tabSize:d,indentSize:d,insertSpaces:this.insertSpaces})}})},50)}}class fde extends hde{static{this.ID="editor.action.indentUsingTabs"}constructor(){super(!1,!1,{id:fde.ID,label:w("indentUsingTabs","Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0,metadata:{description:Gt("indentUsingTabsDescription","Use indentation with tabs.")}})}}class gde extends hde{static{this.ID="editor.action.indentUsingSpaces"}constructor(){super(!0,!1,{id:gde.ID,label:w("indentUsingSpaces","Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0,metadata:{description:Gt("indentUsingSpacesDescription","Use indentation with spaces.")}})}}class pde extends hde{static{this.ID="editor.action.changeTabDisplaySize"}constructor(){super(!0,!0,{id:pde.ID,label:w("changeTabDisplaySize","Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0,metadata:{description:Gt("changeTabDisplaySizeDescription","Change the space size equivalent of the tab.")}})}}class mde extends ot{static{this.ID="editor.action.detectIndentation"}constructor(){super({id:mde.ID,label:w("detectIndentation","Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0,metadata:{description:Gt("detectIndentationDescription","Detect the indentation from content.")}})}run(e,t){const i=e.get(Sr),r=t.getModel();if(!r)return;const s=i.getCreationOptions(r.getLanguageId(),r.uri,r.isForSimpleWidget);r.detectIndentation(s.insertSpaces,s.tabSize)}}class G9t extends ot{constructor(){super({id:"editor.action.reindentlines",label:w("editor.reindentlines","Reindent Lines"),alias:"Reindent Lines",precondition:Q.writable,metadata:{description:Gt("editor.reindentlinesDescription","Reindent the lines of the editor.")}})}run(e,t){const i=e.get(Zr),r=t.getModel();if(!r)return;const s=mBe(r,i,1,r.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class Y9t extends ot{constructor(){super({id:"editor.action.reindentselectedlines",label:w("editor.reindentselectedlines","Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:Q.writable,metadata:{description:Gt("editor.reindentselectedlinesDescription","Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(Zr),r=t.getModel();if(!r)return;const s=t.getSelections();if(s===null)return;const o=[];for(const a of s){let l=a.startLineNumber,c=a.endLineNumber;if(l!==c&&a.endColumn===1&&c--,l===1){if(l===c)continue}else l--;const u=mBe(r,i,l,c);o.push(...u)}o.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,o),t.pushUndoStop())}}class Z9t{constructor(e,t){this._initialSelection=t,this._edits=[],this._selectionId=null;for(const i of e)i.range&&typeof i.text=="string"&&this._edits.push(i)}getEditOperations(e,t){for(const r of this._edits)t.addEditOperation($.lift(r.range),r.text);let i=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!1))),i||(this._selectionId=t.trackSelection(this._initialSelection))}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}let X9=class{static{this.ID="editor.contrib.autoIndentOnPaste"}constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new ke,this.callOnModel=new ke,this.callOnDispose.add(e.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(e.onDidChangeModel(()=>this.update())),this.callOnDispose.add(e.onDidChangeModelLanguage(()=>this.update()))}update(){this.callOnModel.clear(),!(this.editor.getOption(12)<4||this.editor.getOption(55))&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:e})=>{this.trigger(e)}))}trigger(e){const t=this.editor.getSelections();if(t===null||t.length>1)return;const i=this.editor.getModel();if(!i||this.rangeContainsOnlyWhitespaceCharacters(i,e)||X9t(i,e)||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:o,indentSize:a,insertSpaces:l}=i.getOptions(),c=[],u={shiftIndent:g=>nh.shiftIndent(g,g.length+1,o,a,l),unshiftIndent:g=>nh.unshiftIndent(g,g.length+1,o,a,l)};let d=e.startLineNumber;for(;d<=e.endLineNumber;){if(this.shouldIgnoreLine(i,d)){d++;continue}break}if(d>e.endLineNumber)return;let h=i.getLineContent(d);if(!/\S/.test(h.substring(0,e.startColumn-1))){const g=RI(s,i,i.getLanguageId(),d,u,this._languageConfigurationService);if(g!==null){const p=Ji(h),m=Uc(g,o),_=Uc(p,o);if(m!==_){const v=GI(m,o,l);c.push({range:new $(d,1,d,p.length+1),text:v}),h=v+h.substring(p.length)}else{const v=c8e(i,d,this._languageConfigurationService);if(v===0||v===8)return}}}const f=d;for(;di.tokenization.getLineTokens(m),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(m,_)=>i.getLanguageIdAtPosition(m,_)},getLineContent:m=>m===f?h:i.getLineContent(m)},i.getLanguageId(),d+1,u,this._languageConfigurationService);if(p!==null){const m=Uc(p,o),_=Uc(Ji(i.getLineContent(d+1)),o);if(m!==_){const v=m-_;for(let y=d+1;y<=e.endLineNumber;y++){const C=i.getLineContent(y),x=Ji(C),L=Uc(x,o)+v,D=GI(L,o,l);D!==x&&c.push({range:new $(y,1,y,x.length+1),text:D})}}}}if(c.length>0){this.editor.pushUndoStop();const g=new Z9t(c,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",g),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(e,t){const i=s=>s.trim().length===0;let r=!0;if(t.startLineNumber===t.endLineNumber){const o=e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1);r=i(o)}else for(let s=t.startLineNumber;s<=t.endLineNumber;s++){const o=e.getLineContent(s);if(s===t.startLineNumber){const a=o.substring(t.startColumn-1);r=i(a)}else if(s===t.endLineNumber){const a=o.substring(0,t.endColumn-1);r=i(a)}else r=e.getLineFirstNonWhitespaceColumn(s)===0;if(!r)break}return r}shouldIgnoreLine(e,t){e.tokenization.forceTokenization(t);const i=e.getLineFirstNonWhitespaceColumn(t);if(i===0)return!0;const r=e.tokenization.getLineTokens(t);if(r.getCount()>0){const s=r.findTokenIndexAtOffset(i);if(s>=0&&r.getStandardTokenType(s)===1)return!0}return!1}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};X9=q9t([K9t(1,Zr)],X9);function X9t(n,e){const t=i=>Cxt(n,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function _Be(n,e,t,i){if(n.getLineCount()===1&&n.getLineMaxColumn(1)===1)return;let r="";for(let o=0;o=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},n7t=function(n,e){return function(t,i){e(t,i,n)}},bF;let BE=class{static{bF=this}static{this.ID="editor.contrib.inPlaceReplaceController"}static get(e){return e.getContribution(bF.ID)}static{this.DECORATION=un.register({description:"in-place-replace",className:"valueSetReplacement"})}constructor(e,t){this.editor=e,this.editorWorkerService=t,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(e,t){this.currentRequest?.cancel();const i=this.editor.getSelection(),r=this.editor.getModel();if(!r||!i)return;let s=i;if(s.startLineNumber!==s.endLineNumber)return;const o=new $8e(this.editor,5),a=r.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=ko(l=>this.editorWorkerService.navigateValueSet(a,s,t)),this.currentRequest.then(l=>{if(!l||!l.range||!l.value||!o.validate(this.editor))return;const c=$.lift(l.range);let u=l.range;const d=l.value.length-(s.endColumn-s.startColumn);u={startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.startColumn+l.value.length},d>1&&(s=new yt(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+d-1));const h=new e7t(c,s,l.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,h),this.editor.pushUndoStop(),this.decorations.set([{range:u,options:bF.DECORATION}]),this.decorationRemover?.cancel(),this.decorationRemover=Y_(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(rn)}).catch(rn)):Promise.resolve(void 0)}};BE=bF=t7t([n7t(1,Oc)],BE);class i7t extends ot{constructor(){super({id:"editor.action.inPlaceReplace.up",label:w("InPlaceReplaceAction.previous.label","Replace with Previous Value"),alias:"Replace with Previous Value",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=BE.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class r7t extends ot{constructor(){super({id:"editor.action.inPlaceReplace.down",label:w("InPlaceReplaceAction.next.label","Replace with Next Value"),alias:"Replace with Next Value",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=BE.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}Zn(BE.ID,BE,4);Pe(i7t);Pe(r7t);class s7t extends ot{constructor(){super({id:"expandLineSelection",label:w("expandLineSelection","Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:Q.textInputFocus,primary:2090}})}run(e,t,i){if(i=i||{},!t.hasModel())return;const r=t._getViewModel();r.model.pushStackElement(),r.setCursorStates(i.source,3,qo.expandLineSelection(r,r.getCursorStates())),r.revealAllCursors(i.source,!0)}}Pe(s7t);class o7t{constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=a7t(e,this._cursors,this._trimInRegexesAndStrings);for(let r=0,s=i.length;ra.lineNumber===l.lineNumber?a.column-l.column:a.lineNumber-l.lineNumber);for(let a=e.length-2;a>=0;a--)e[a].lineNumber===e[a+1].lineNumber&&e.splice(a,1);const i=[];let r=0,s=0;const o=e.length;for(let a=1,l=n.getLineCount();a<=l;a++){const c=n.getLineContent(a),u=c.length+1;let d=0;if(sp===d?e.tokenization.getLineTokens(o.startLineNumber):e.tokenization.getLineTokens(p),getLanguageId:i,getLanguageIdAtPosition:r},getLineContent:p=>p===d?e.getLineContent(o.startLineNumber):e.getLineContent(p)},g=this.matchEnterRule(e,u,a,o.startLineNumber,o.startLineNumber-2);if(g!==null)g!==0&&this.getIndentEditsOfMovingBlock(e,t,o,a,c,g);else{const p=RI(this._autoIndent,f,e.getLanguageIdAtPosition(o.startLineNumber,1),d,u,this._languageConfigurationService);if(p!==null){const m=Ji(e.getLineContent(o.startLineNumber)),_=Uc(p,a),v=Uc(m,a);if(_!==v){const y=_-v;this.getIndentEditsOfMovingBlock(e,t,o,a,c,y)}}}}}this._selectionId=t.trackSelection(o)}buildIndentConverter(e,t,i){return{shiftIndent:r=>nh.shiftIndent(r,r.length+1,e,t,i),unshiftIndent:r=>nh.unshiftIndent(r,r.length+1,e,t,i)}}parseEnterResult(e,t,i,r,s){if(s){let o=s.indentation;s.indentAction===zs.None||s.indentAction===zs.Indent?o=s.indentation+s.appendText:s.indentAction===zs.IndentOutdent?o=s.indentation:s.indentAction===zs.Outdent&&(o=t.unshiftIndent(s.indentation)+s.appendText);const a=e.getLineContent(r);if(this.trimStart(a).indexOf(this.trimStart(o))>=0){const l=Ji(e.getLineContent(r));let c=Ji(o);const u=c8e(e,r,this._languageConfigurationService);u!==null&&u&2&&(c=t.unshiftIndent(c));const d=Uc(c,i),h=Uc(l,i);return d-h}}return null}matchEnterRuleMovingDown(e,t,i,r,s,o){if(pg(o)>=0){const a=e.getLineMaxColumn(s),l=xk(this._autoIndent,e,new $(s,a,s,a),this._languageConfigurationService);return this.parseEnterResult(e,t,i,r,l)}else{let a=r-1;for(;a>=1;){const u=e.getLineContent(a);if(pg(u)>=0)break;a--}if(a<1||r>e.getLineCount())return null;const l=e.getLineMaxColumn(a),c=xk(this._autoIndent,e,new $(a,l,a,l),this._languageConfigurationService);return this.parseEnterResult(e,t,i,r,c)}}matchEnterRule(e,t,i,r,s,o){let a=s;for(;a>=1;){let u;if(a===s&&o!==void 0?u=o:u=e.getLineContent(a),pg(u)>=0)break;a--}if(a<1||r>e.getLineCount())return null;const l=e.getLineMaxColumn(a),c=xk(this._autoIndent,e,new $(a,l,a,l),this._languageConfigurationService);return this.parseEnterResult(e,t,i,r,c)}trimStart(e){return e.replace(/^\s+/,"")}shouldAutoIndent(e,t){if(this._autoIndent<4||!e.tokenization.isCheapToTokenize(t.startLineNumber))return!1;const i=e.getLanguageIdAtPosition(t.startLineNumber,1),r=e.getLanguageIdAtPosition(t.endLineNumber,1);return!(i!==r||this._languageConfigurationService.getLanguageConfiguration(i).indentRulesSupport===null)}getIndentEditsOfMovingBlock(e,t,i,r,s,o){for(let a=i.startLineNumber;a<=i.endLineNumber;a++){const l=e.getLineContent(a),c=Ji(l),d=Uc(c,r)+o,h=GI(d,r,s);h!==c&&(t.addEditOperation(new $(a,1,a,c.length+1),h),a===i.endLineNumber&&i.endColumn<=c.length+1&&h===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&i.startLineNumber=r)return null;const s=[];for(let a=i;a<=r;a++)s.push(n.getLineContent(a));let o=s.slice(0);return o.sort(aw.getCollator().compare),t===!0&&(o=o.reverse()),{startLineNumber:i,endLineNumber:r,before:s,after:o}}function u7t(n,e,t){const i=bBe(n,e,t);return i?jr.replace(new $(i.startLineNumber,1,i.endLineNumber,n.getLineMaxColumn(i.endLineNumber)),i.after.join(` `)):null}class yBe extends ot{constructor(e,t){super(t),this.down=e}run(e,t){if(!t.hasModel())return;const i=t.getSelections().map((o,a)=>({selection:o,index:a,ignore:!1}));i.sort((o,a)=>$.compareRangesUsingStarts(o.selection,a.selection));let r=i[0];for(let o=1;onew he(u.positionLineNumber,u.positionColumn)));const s=t.getSelection();if(s===null)return;const o=e.get(kn),a=t.getModel(),l=o.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a?.getLanguageId(),resource:a?.uri}),c=new o7t(s,r,l);t.pushUndoStop(),t.executeCommands(this.id,[c]),t.pushUndoStop()}}class b7t extends ot{constructor(){super({id:"editor.action.deleteLines",label:w("lines.delete","Delete Line"),alias:"Delete Line",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:3113,weight:100}})}run(e,t){if(!t.hasModel())return;const i=this._getLinesToRemove(t),r=t.getModel();if(r.getLineCount()===1&&r.getLineMaxColumn(1)===1)return;let s=0;const o=[],a=[];for(let l=0,c=i.length;l1&&(d-=1,f=r.getLineMaxColumn(d)),o.push(jr.replace(new yt(d,f,h,g),"")),a.push(new yt(d-s,u.positionColumn,d-s,u.positionColumn)),s+=u.endLineNumber-u.startLineNumber+1}t.pushUndoStop(),t.executeEdits(this.id,o,a),t.pushUndoStop()}_getLinesToRemove(e){const t=e.getSelections().map(s=>{let o=s.endLineNumber;return s.startLineNumbers.startLineNumber===o.startLineNumber?s.endLineNumber-o.endLineNumber:s.startLineNumber-o.startLineNumber);const i=[];let r=t[0];for(let s=1;s=t[s].startLineNumber?r.endLineNumber=t[s].endLineNumber:(i.push(r),r=t[s]);return i.push(r),i}}class y7t extends ot{constructor(){super({id:"editor.action.indentLines",label:w("lines.indent","Indent Line"),alias:"Indent Line",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,bv.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class w7t extends ot{constructor(){super({id:"editor.action.outdentLines",label:w("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:2140,weight:100}})}run(e,t){Sk.Outdent.runEditorCommand(e,t,null)}}class C7t extends ot{constructor(){super({id:"editor.action.insertLineBefore",label:w("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,qW.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class x7t extends ot{constructor(){super({id:"editor.action.insertLineAfter",label:w("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,qW.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class xBe extends ot{run(e,t){if(!t.hasModel())return;const i=t.getSelection(),r=this._getRangesToDelete(t),s=[];for(let l=0,c=r.length-1;ljr.replace(l,""));t.pushUndoStop(),t.executeEdits(this.id,a,o),t.pushUndoStop()}}class S7t extends xBe{constructor(){super({id:"deleteAllLeft",label:w("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:2049},weight:100}})}_getEndCursorState(e,t){let i=null;const r=[];let s=0;return t.forEach(o=>{let a;if(o.endColumn===1&&s>0){const l=o.startLineNumber-s;a=new yt(l,o.startColumn,l,o.startColumn)}else a=new yt(o.startLineNumber,o.startColumn,o.startLineNumber,o.startColumn);s+=o.endLineNumber-o.startLineNumber,o.intersectRanges(e)?i=a:r.push(a)}),i&&r.unshift(i),r}_getRangesToDelete(e){const t=e.getSelections();if(t===null)return[];let i=t;const r=e.getModel();return r===null?[]:(i.sort($.compareRangesUsingStarts),i=i.map(s=>{if(s.isEmpty())if(s.startColumn===1){const o=Math.max(1,s.startLineNumber-1),a=s.startLineNumber===1?1:r.getLineLength(o)+1;return new $(o,a,s.startLineNumber,1)}else return new $(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new $(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class k7t extends xBe{constructor(){super({id:"deleteAllRight",label:w("lines.deleteAllRight","Delete All Right"),alias:"Delete All Right",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100}})}_getEndCursorState(e,t){let i=null;const r=[];for(let s=0,o=t.length,a=0;s{if(s.isEmpty()){const o=t.getLineMaxColumn(s.startLineNumber);return s.startColumn===o?new $(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new $(s.startLineNumber,s.startColumn,s.startLineNumber,o)}return s});return r.sort($.compareRangesUsingStarts),r}}class E7t extends ot{constructor(){super({id:"editor.action.joinLines",label:w("lines.joinLines","Join Lines"),alias:"Join Lines",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:0,mac:{primary:296},weight:100}})}run(e,t){const i=t.getSelections();if(i===null)return;let r=t.getSelection();if(r===null)return;i.sort($.compareRangesUsingStarts);const s=[],o=i.reduce((h,f)=>h.isEmpty()?h.endLineNumber===f.startLineNumber?(r.equalsSelection(h)&&(r=f),f):f.startLineNumber>h.endLineNumber+1?(s.push(h),f):new yt(h.startLineNumber,h.startColumn,f.endLineNumber,f.endColumn):f.startLineNumber>h.endLineNumber?(s.push(h),f):new yt(h.startLineNumber,h.startColumn,f.endLineNumber,f.endColumn));s.push(o);const a=t.getModel();if(a===null)return;const l=[],c=[];let u=r,d=0;for(let h=0,f=s.length;h=1){let O=!0;x===""&&(O=!1),O&&(x.charAt(x.length-1)===" "||x.charAt(x.length-1)===" ")&&(O=!1,x=x.replace(/[\s\uFEFF\xA0]+$/g," "));const M=D.substr(I-1);x+=(O?" ":"")+M,O?_=M.length+1:_=M.length}else _=0}const k=new $(p,m,v,y);if(!k.isEmpty()){let L;g.isEmpty()?(l.push(jr.replace(k,x)),L=new yt(k.startLineNumber-d,x.length-_+1,p-d,x.length-_+1)):g.startLineNumber===g.endLineNumber?(l.push(jr.replace(k,x)),L=new yt(g.startLineNumber-d,g.startColumn,g.endLineNumber-d,g.endColumn)):(l.push(jr.replace(k,x)),L=new yt(g.startLineNumber-d,g.startColumn,g.startLineNumber-d,x.length-C)),$.intersectRanges(k,r)!==null?u=L:c.push(L)}d+=k.endLineNumber-k.startLineNumber}c.unshift(u),t.pushUndoStop(),t.executeEdits(this.id,l,c),t.pushUndoStop()}}class L7t extends ot{constructor(){super({id:"editor.action.transpose",label:w("editor.transpose","Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:Q.writable})}run(e,t){const i=t.getSelections();if(i===null)return;const r=t.getModel();if(r===null)return;const s=[];for(let o=0,a=i.length;o=u){if(c.lineNumber===r.getLineCount())continue;const d=new $(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),h=r.getValueInRange(d).split("").reverse().join("");s.push(new Sa(new yt(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),h))}else{const d=new $(c.lineNumber,Math.max(1,c.column-1),c.lineNumber,c.column+1),h=r.getValueInRange(d).split("").reverse().join("");s.push(new Pce(d,h,new yt(c.lineNumber,c.column+1,c.lineNumber,c.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class NC extends ot{run(e,t){const i=t.getSelections();if(i===null)return;const r=t.getModel();if(r===null)return;const s=t.getOption(132),o=[];for(const a of i)if(a.isEmpty()){const l=a.getStartPosition(),c=t.getConfiguredWordAtPosition(l);if(!c)continue;const u=new $(l.lineNumber,c.startColumn,l.lineNumber,c.endColumn),d=r.getValueInRange(u);o.push(jr.replace(u,this._modifyText(d,s)))}else{const l=r.getValueInRange(a);o.push(jr.replace(a,this._modifyText(l,s)))}t.pushUndoStop(),t.executeEdits(this.id,o),t.pushUndoStop()}}class T7t extends NC{constructor(){super({id:"editor.action.transformToUppercase",label:w("editor.transformToUppercase","Transform to Uppercase"),alias:"Transform to Uppercase",precondition:Q.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class D7t extends NC{constructor(){super({id:"editor.action.transformToLowercase",label:w("editor.transformToLowercase","Transform to Lowercase"),alias:"Transform to Lowercase",precondition:Q.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class O_{constructor(e,t){this._pattern=e,this._flags=t,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch{}}return this._actual}isSupported(){return this.get()!==null}}class Q9 extends NC{static{this.titleBoundary=new O_("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu")}constructor(){super({id:"editor.action.transformToTitlecase",label:w("editor.transformToTitlecase","Transform to Title Case"),alias:"Transform to Title Case",precondition:Q.writable})}_modifyText(e,t){const i=Q9.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,r=>r.toLocaleUpperCase()):e}}class Ik extends NC{static{this.caseBoundary=new O_("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new O_("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu")}constructor(){super({id:"editor.action.transformToSnakecase",label:w("editor.transformToSnakecase","Transform to Snake Case"),alias:"Transform to Snake Case",precondition:Q.writable})}_modifyText(e,t){const i=Ik.caseBoundary.get(),r=Ik.singleLetters.get();return!i||!r?e:e.replace(i,"$1_$2").replace(r,"$1_$2$3").toLocaleLowerCase()}}class J9 extends NC{static{this.wordBoundary=new O_("[_\\s-]","gm")}constructor(){super({id:"editor.action.transformToCamelcase",label:w("editor.transformToCamelcase","Transform to Camel Case"),alias:"Transform to Camel Case",precondition:Q.writable})}_modifyText(e,t){const i=J9.wordBoundary.get();if(!i)return e;const r=e.split(i);return r.shift()+r.map(o=>o.substring(0,1).toLocaleUpperCase()+o.substring(1)).join("")}}class mR extends NC{static{this.wordBoundary=new O_("[_\\s-]","gm")}static{this.wordBoundaryToMaintain=new O_("(?<=\\.)","gm")}constructor(){super({id:"editor.action.transformToPascalcase",label:w("editor.transformToPascalcase","Transform to Pascal Case"),alias:"Transform to Pascal Case",precondition:Q.writable})}_modifyText(e,t){const i=mR.wordBoundary.get(),r=mR.wordBoundaryToMaintain.get();return!i||!r?e:e.split(r).map(a=>a.split(i)).flat().map(a=>a.substring(0,1).toLocaleUpperCase()+a.substring(1)).join("")}}class Ak extends NC{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(t=>t.isSupported())}static{this.caseBoundary=new O_("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new O_("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu")}static{this.underscoreBoundary=new O_("(\\S)(_)(\\S)","gm")}constructor(){super({id:"editor.action.transformToKebabcase",label:w("editor.transformToKebabcase","Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:Q.writable})}_modifyText(e,t){const i=Ak.caseBoundary.get(),r=Ak.singleLetters.get(),s=Ak.underscoreBoundary.get();return!i||!r||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(r,"$1-$2").toLocaleLowerCase()}}Pe(d7t);Pe(h7t);Pe(f7t);Pe(g7t);Pe(p7t);Pe(m7t);Pe(_7t);Pe(v7t);Pe(_de);Pe(b7t);Pe(y7t);Pe(w7t);Pe(C7t);Pe(x7t);Pe(S7t);Pe(k7t);Pe(E7t);Pe(L7t);Pe(T7t);Pe(D7t);Ik.caseBoundary.isSupported()&&Ik.singleLetters.isSupported()&&Pe(Ik);J9.wordBoundary.isSupported()&&Pe(J9);mR.wordBoundary.isSupported()&&Pe(mR);Q9.titleBoundary.isSupported()&&Pe(Q9);Ak.isSupported()&&Pe(Ak);var I7t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},k3=function(n,e){return function(t,i){e(t,i,n)}},y5;const SBe=new et("LinkedEditingInputVisible",!1),A7t="linked-editing-decoration";let $E=class extends me{static{y5=this}static{this.ID="editor.contrib.linkedEditing"}static{this.DECORATION=un.register({description:"linked-editing",stickiness:0,className:A7t})}static get(e){return e.getContribution(y5.ID)}constructor(e,t,i,r,s){super(),this.languageConfigurationService=r,this._syncRangesToken=0,this._localToDispose=this._register(new ke),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=SBe.bindTo(t),this._debounceInformation=s.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new ke),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequestCts=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel(()=>this.reinitialize(!0))),this._register(this._editor.onDidChangeConfiguration(o=>{(o.hasChanged(70)||o.hasChanged(94))&&this.reinitialize(!1)})),this._register(this._providers.onDidChange(()=>this.reinitialize(!1))),this._register(this._editor.onDidChangeModelLanguage(()=>this.reinitialize(!0))),this.reinitialize(!0)}reinitialize(e){const t=this._editor.getModel(),i=t!==null&&(this._editor.getOption(70)||this._editor.getOption(94))&&this._providers.has(t);if(i===this._enabled&&!e||(this._enabled=i,this.clearRanges(),this._localToDispose.clear(),!i||t===null))return;this._localToDispose.add(Ge.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const r=new Qd(this._debounceInformation.get(t)),s=()=>{this._rangeUpdateTriggerPromise=r.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},o=new Qd(0),a=l=>{this._rangeSyncTriggerPromise=o.trigger(()=>this._syncRanges(l))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{s()})),this._localToDispose.add(this._editor.onDidChangeModelContent(l=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const c=this._currentDecorations.getRange(0);if(c&&l.changes.every(u=>c.intersectRanges(u.range))){a(this._syncRangesToken);return}}s()})),this._localToDispose.add({dispose:()=>{r.dispose(),o.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;const t=this._editor.getModel(),i=this._currentDecorations.getRange(0);if(!i||i.startLineNumber!==i.endLineNumber)return this.clearRanges();const r=t.getValueInRange(i);if(this._currentWordPattern){const o=r.match(this._currentWordPattern);if((o?o[0].length:0)!==r.length)return this.clearRanges()}const s=[];for(let o=1,a=this._currentDecorations.length;o1){this.clearRanges();return}const i=this._editor.getModel(),r=i.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===r){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const o=this._currentDecorations.getRange(0);if(o&&o.containsPosition(t))return}}this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=r;const s=this._currentRequestCts=new Kr;try{const o=new Bo(!1),a=await kBe(this._providers,i,t,s.token);if(this._debounceInformation.update(i,o.elapsed()),s!==this._currentRequestCts||(this._currentRequestCts=null,r!==i.getVersionId()))return;let l=[];a?.ranges&&(l=a.ranges),this._currentWordPattern=a?.wordPattern||this._languageWordPattern;let c=!1;for(let d=0,h=l.length;d({range:d,options:y5.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(u),this._syncRangesToken++}catch(o){uh(o)||rn(o),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}};$E=y5=I7t([k3(1,jt),k3(2,dt),k3(3,Zr),k3(4,cd)],$E);class N7t extends ot{constructor(){super({id:"editor.action.linkedEditing",label:w("linkedEditing.label","Start Linked Editing"),alias:"Start Linked Editing",precondition:Le.and(Q.writable,Q.hasRenameProvider),kbOpts:{kbExpr:Q.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(ai),[r,s]=Array.isArray(t)&&t||[void 0,void 0];return Pt.isUri(r)&&he.isIPosition(s)?i.openCodeEditor({resource:r},i.getActiveCodeEditor()).then(o=>{o&&(o.setPosition(s),o.invokeWithinContext(a=>(this.reportTelemetry(a,o),this.run(a,o))))},rn):super.runCommand(e,t)}run(e,t){const i=$E.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const R7t=fo.bindToContribution($E.get);Je(new R7t({id:"cancelLinkedEditingInput",precondition:SBe,handler:n=>n.clearRanges(),kbOpts:{kbExpr:Q.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function kBe(n,e,t,i){const r=n.ordered(e);return Oae(r.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(o){vs(o);return}}),s=>!!s&&bl(s?.ranges))}J("editor.linkedEditingBackground",{dark:Te.fromHex("#f00").transparent(.3),light:Te.fromHex("#f00").transparent(.3),hcDark:Te.fromHex("#f00").transparent(.3),hcLight:Te.white},w("editorLinkedEditingBackground","Background color when the editor auto renames on type."));Rc("_executeLinkedEditingProvider",(n,e,t)=>{const{linkedEditingRangeProvider:i}=n.get(dt);return kBe(i,e,t,yn.None)});Zn($E.ID,$E,1);Pe(N7t);let P7t=class{constructor(e,t){this._link=e,this._provider=t}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(e){return this._link.url?this._link.url:typeof this._provider.resolveLink=="function"?Promise.resolve(this._provider.resolveLink(this._link,e)).then(t=>(this._link=t||this._link,this._link.url?this.resolve(e):Promise.reject(new Error("missing")))):Promise.reject(new Error("missing"))}};class e7{constructor(e){this._disposables=new ke;let t=[];for(const[i,r]of e){const s=i.links.map(o=>new P7t(o,r));t=e7._union(t,s),R$(i)&&this._disposables.add(i)}this.links=t}dispose(){this._disposables.dispose(),this.links.length=0}static _union(e,t){const i=[];let r,s,o,a;for(r=0,o=0,s=e.length,a=t.length;rPromise.resolve(s.provideLinks(e,t)).then(a=>{a&&(i[o]=[a,s])},vs));return Promise.all(r).then(()=>{const s=new e7(rf(i));return t.isCancellationRequested?(s.dispose(),new e7([])):s})}Un.registerCommand("_executeLinkProvider",async(n,...e)=>{let[t,i]=e;oi(t instanceof Pt),typeof i!="number"&&(i=0);const{linkProvider:r}=n.get(dt),s=n.get(Sr).getModel(t);if(!s)return[];const o=await EBe(r,s,yn.None);if(!o)return[];for(let l=0;l=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},E3=function(n,e){return function(t,i){e(t,i,n)}},Tte;let _R=class extends me{static{Tte=this}static{this.ID="editor.linkDetector"}static get(e){return e.getContribution(Tte.ID)}constructor(e,t,i,r,s){super(),this.editor=e,this.openerService=t,this.notificationService=i,this.languageFeaturesService=r,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=s.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new Ui(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const o=this._register(new hH(e));this._register(o.onMouseMoveOrRelevantKeyDown(([a,l])=>{this._onEditorMouseMove(a,l)})),this._register(o.onExecute(a=>{this.onEditorMouseUp(a)})),this._register(o.onCancel(a=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(a=>{a.hasChanged(71)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(a=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(a=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(a=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(a=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(71))return;const e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=ko(t=>EBe(this.providers,e,t));try{const t=new Bo(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){rn(t)}finally{this.computePromise=null}}}updateDecorations(e){const t=this.editor.getOption(78)==="altKey",i=[],r=Object.keys(this.currentOccurrences);for(const o of r){const a=this.currentOccurrences[o];i.push(a.decorationId)}const s=[];if(e)for(const o of e)s.push(Nk.decoration(o,t));this.editor.changeDecorations(o=>{const a=o.deltaDecorations(i,s);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let l=0,c=a.length;l{r.activate(s,i),this.activeLinkDecorationId=r.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const e=this.editor.getOption(78)==="altKey";if(this.activeLinkDecorationId){const t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(i=>{t.deactivate(i,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;const t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,i=!1){if(!this.openerService)return;const{link:r}=e;r.resolve(yn.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const o=this.editor.getModel().uri;if(o.scheme===sn.file&&s.startsWith(`${sn.file}:`)){const a=Pt.parse(s);if(a.scheme===sn.file){const l=ip(a);let c=null;l.startsWith("/./")||l.startsWith("\\.\\")?c=`.${l.substr(1)}`:(l.startsWith("//./")||l.startsWith("\\\\.\\"))&&(c=`.${l.substr(2)}`),c&&(s=VCt(o,c))}}}return this.openerService.open(s,{openToSide:t,fromUserGesture:i,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},s=>{const o=s instanceof Error?s.message:s;o==="invalid"?this.notificationService.warn(w("invalid.url","Failed to open this link because it is not well-formed: {0}",r.url.toString())):o==="missing"?this.notificationService.warn(w("missing.url","Failed to open this link because its target is missing.")):rn(s)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;const t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(const i of t){const r=this.currentOccurrences[i.id];if(r)return r}return null}isEnabled(e,t){return!!(e.target.type===6&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey))}stop(){this.computeLinks.cancel(),this.activeLinksList&&(this.activeLinksList?.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}};_R=Tte=O7t([E3(1,Pc),E3(2,Ts),E3(3,dt),E3(4,cd)],_R);const Rxe={general:un.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:un.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class Nk{static decoration(e,t){return{range:e.range,options:Nk._getOptions(e,t,!1)}}static _getOptions(e,t,i){const r={...i?Rxe.active:Rxe.general};return r.hoverMessage=M7t(e,t),r}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,Nk._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,Nk._getOptions(this.link,t,!1))}}function M7t(n,e){const t=n.url&&/^command:/i.test(n.url.toString()),i=n.tooltip?n.tooltip:t?w("links.navigate.executeCmd","Execute command"):w("links.navigate.follow","Follow link"),r=e?Rn?w("links.navigate.kb.meta.mac","cmd + click"):w("links.navigate.kb.meta","ctrl + click"):Rn?w("links.navigate.kb.alt.mac","option + click"):w("links.navigate.kb.alt","alt + click");if(n.url){let s="";if(/^command:/i.test(n.url.toString())){const a=n.url.toString().match(/^command:([^?#]+)/);if(a){const l=a[1];s=w("tooltip.explanation","Execute command {0}",l)}}return new za("",!0).appendLink(n.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${r})`)}else return new za().appendText(`${i} (${r})`)}class F7t extends ot{constructor(){super({id:"editor.action.openLink",label:w("label","Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=_R.get(t);if(!i||!t.hasModel())return;const r=t.getSelections();for(const s of r){const o=i.getLinkOccurrence(s.getEndPosition());o&&i.openLinkOccurrence(o,!1)}}}Zn(_R.ID,_R,1);Pe(F7t);class Pxe extends me{static{this.ID="editor.contrib.longLinesHelper"}constructor(e){super(),this._editor=e,this._register(this._editor.onMouseDown(t=>{const i=this._editor.getOption(118);i>=0&&t.target.type===6&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}}Zn(Pxe.ID,Pxe,2);const B7t=J("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},w("wordHighlight","Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},w("wordHighlightStrong","Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.wordHighlightTextBackground",B7t,w("wordHighlightText","Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0);const $7t=J("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Ar,hcLight:Ar},w("wordHighlightBorder","Border color of a symbol during read-access, like reading a variable."));J("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Ar,hcLight:Ar},w("wordHighlightStrongBorder","Border color of a symbol during write-access, like writing to a variable."));J("editor.wordHighlightTextBorder",$7t,w("wordHighlightTextBorder","Border color of a textual occurrence for a symbol."));const W7t=J("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",w("overviewRulerWordHighlightForeground","Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),H7t=J("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",w("overviewRulerWordHighlightStrongForeground","Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),V7t=J("editorOverviewRuler.wordHighlightTextForeground",kFe,w("overviewRulerWordHighlightTextForeground","Overview ruler marker color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0),z7t=un.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:ss(H7t),position:Qu.Center},minimap:{color:ss(lW),position:1}}),U7t=un.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:ss(V7t),position:Qu.Center},minimap:{color:ss(lW),position:1}}),j7t=un.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:ss(kFe),position:Qu.Center},minimap:{color:ss(lW),position:1}}),q7t=un.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),K7t=un.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:ss(W7t),position:Qu.Center},minimap:{color:ss(lW),position:1}});function G7t(n){return n===nE.Write?z7t:n===nE.Text?U7t:K7t}function Y7t(n){return n?q7t:j7t}dh((n,e)=>{const t=n.getColor(hle);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var Z7t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},X7t=function(n,e){return function(t,i){e(t,i,n)}},Dte;function i1(n,e){const t=e.filter(i=>!n.find(r=>r.equals(i)));if(t.length>=1){const i=t.map(s=>`line ${s.viewState.position.lineNumber} column ${s.viewState.position.column}`).join(", "),r=t.length===1?w("cursorAdded","Cursor added: {0}",i):w("cursorsAdded","Cursors added: {0}",i);Qp(r)}}class Q7t extends ot{constructor(){super({id:"editor.action.insertCursorAbove",label:w("mutlicursor.insertAbove","Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miInsertCursorAbove",comment:["&& denotes a mnemonic"]},"&&Add Cursor Above"),order:2}})}run(e,t,i){if(!t.hasModel())return;let r=!0;i&&i.logicalLine===!1&&(r=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const o=s.getCursorStates();s.setCursorStates(i.source,3,qo.addCursorUp(s,o,r)),s.revealTopMostCursor(i.source),i1(o,s.getCursorStates())}}class J7t extends ot{constructor(){super({id:"editor.action.insertCursorBelow",label:w("mutlicursor.insertBelow","Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miInsertCursorBelow",comment:["&& denotes a mnemonic"]},"A&&dd Cursor Below"),order:3}})}run(e,t,i){if(!t.hasModel())return;let r=!0;i&&i.logicalLine===!1&&(r=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const o=s.getCursorStates();s.setCursorStates(i.source,3,qo.addCursorDown(s,o,r)),s.revealBottomMostCursor(i.source),i1(o,s.getCursorStates())}}class eBt extends ot{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:w("mutlicursor.insertAtEndOfEachLineSelected","Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miInsertCursorAtEndOfEachLineSelected",comment:["&& denotes a mnemonic"]},"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(e,t,i){if(!e.isEmpty()){for(let r=e.startLineNumber;r1&&i.push(new yt(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn))}}run(e,t){if(!t.hasModel())return;const i=t.getModel(),r=t.getSelections(),s=t._getViewModel(),o=s.getCursorStates(),a=[];r.forEach(l=>this.getCursorsForSelection(l,i,a)),a.length>0&&t.setSelections(a),i1(o,s.getCursorStates())}}class tBt extends ot{constructor(){super({id:"editor.action.addCursorsToBottom",label:w("mutlicursor.addCursorsToBottom","Add Cursors To Bottom"),alias:"Add Cursors To Bottom",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),r=t.getModel().getLineCount(),s=[];for(let l=i[0].startLineNumber;l<=r;l++)s.push(new yt(l,i[0].startColumn,l,i[0].endColumn));const o=t._getViewModel(),a=o.getCursorStates();s.length>0&&t.setSelections(s),i1(a,o.getCursorStates())}}class nBt extends ot{constructor(){super({id:"editor.action.addCursorsToTop",label:w("mutlicursor.addCursorsToTop","Add Cursors To Top"),alias:"Add Cursors To Top",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),r=[];for(let a=i[0].startLineNumber;a>=1;a--)r.push(new yt(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),o=s.getCursorStates();r.length>0&&t.setSelections(r),i1(o,s.getCursorStates())}}class L3{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class vR{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new vR(e,t,!1,i.searchString,i.wholeWord,i.matchCase,null);let r=!1,s,o;const a=e.getSelections();a.length===1&&a[0].isEmpty()?(r=!0,s=!0,o=!0):(s=i.wholeWord,o=i.matchCase);const l=e.getSelection();let c,u=null;if(l.isEmpty()){const d=e.getConfiguredWordAtPosition(l.getStartPosition());if(!d)return null;c=d.word,u=new yt(l.startLineNumber,d.startColumn,l.startLineNumber,d.endColumn)}else c=e.getModel().getValueInRange(l).replace(/\r\n/g,` -`);return new vR(e,t,r,c,s,o,u)}constructor(e,t,i,r,s,o,a){this._editor=e,this.findController=t,this.isDisconnectedFromFindController=i,this.searchText=r,this.wholeWord=s,this.matchCase=o,this.currentMatch=a}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new L3(t.concat(e),e,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new L3(t.slice(0,t.length-1).concat(e),e,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const r=this.currentMatch;return this.currentMatch=null,r}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findNextMatch(this.searchText,t.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1);return i?new yt(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new L3(t.concat(e),e,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new L3(t.slice(0,t.length-1).concat(e),e,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const r=this.currentMatch;return this.currentMatch=null,r}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findPreviousMatch(this.searchText,t.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1);return i?new yt(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}selectAll(e){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();const t=this._editor.getModel();return e?t.findMatches(this.searchText,e,!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1,1073741824):t.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1,1073741824)}}class WE extends me{static{this.ID="editor.contrib.multiCursorController"}static get(e){return e.getContribution(WE.ID)}constructor(e){super(),this._sessionDispose=this._register(new ke),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=vR.create(this._editor,e);if(!t)return;this._session=t;const i={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(i.wholeWordOverride=1,i.matchCaseOverride=1,i.isRegexOverride=2),e.getState().change(i,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(r=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(r=>{(r.matchCase||r.wholeWord)&&this._endSession()}))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){const e={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(e,!1)}this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;const i=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return i?new yt(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){const t=this._editor.getSelections();if(t.length>1){const r=e.getState().matchCase;if(!LBe(this._editor.getModel(),t,r)){const o=this._editor.getModel(),a=[];for(let l=0,c=t.length;l0&&i.isRegex){const r=this._editor.getModel();i.searchScope?t=r.findMatches(i.searchString,i.searchScope,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(132):null,!1,1073741824):t=r.findMatches(i.searchString,!0,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(132):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(i.searchScope)}if(t.length>0){const r=this._editor.getSelection();for(let s=0,o=t.length;snew yt(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}}class _2 extends ot{run(e,t){const i=WE.get(t);if(!i)return;const r=t._getViewModel();if(r){const s=r.getCursorStates(),o=Ic.get(t);if(o)this._run(i,o);else{const a=e.get(Tt).createInstance(Ic,t);this._run(i,a),a.dispose()}i1(s,r.getCursorStates())}}}class iBt extends _2{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:w("addSelectionToNextFindMatch","Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:2082,weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miAddSelectionToNextFindMatch",comment:["&& denotes a mnemonic"]},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class rBt extends _2{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:w("addSelectionToPreviousFindMatch","Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miAddSelectionToPreviousFindMatch",comment:["&& denotes a mnemonic"]},"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class sBt extends _2{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:w("moveSelectionToNextFindMatch","Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:js(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class oBt extends _2{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:w("moveSelectionToPreviousFindMatch","Move Last Selection To Previous Find Match"),alias:"Move Last Selection To Previous Find Match",precondition:void 0})}_run(e,t){e.moveSelectionToPreviousFindMatch(t)}}class aBt extends _2{constructor(){super({id:"editor.action.selectHighlights",label:w("selectAllOccurrencesOfFindMatch","Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:3114,weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miSelectHighlights",comment:["&& denotes a mnemonic"]},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class lBt extends _2{constructor(){super({id:"editor.action.changeAll",label:w("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:Le.and(Q.writable,Q.editorTextFocus),kbOpts:{kbExpr:Q.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class cBt{constructor(e,t,i,r,s){this._model=e,this._searchText=t,this._matchCase=i,this._wordSeparators=r,this._modelVersionId=this._model.getVersionId(),this._cachedFindMatches=null,s&&this._model===s._model&&this._searchText===s._searchText&&this._matchCase===s._matchCase&&this._wordSeparators===s._wordSeparators&&this._modelVersionId===s._modelVersionId&&(this._cachedFindMatches=s._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(e=>e.range),this._cachedFindMatches.sort($.compareRangesUsingStarts)),this._cachedFindMatches}}let t7=class extends me{static{Dte=this}static{this.ID="editor.contrib.selectionHighlighter"}constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(109),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Ui(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(r=>{this._isEnabled=e.getOption(109)})),this._register(e.onDidChangeCursorSelection(r=>{this._isEnabled&&(r.selection.isEmpty()?r.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(r=>{this._setState(null)})),this._register(e.onDidChangeModelContent(r=>{this._isEnabled&&this.updateSoon.schedule()}));const i=Ic.get(e);i&&this._register(i.getState().onFindReplaceStateChange(r=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(Dte._createState(this.state,this._isEnabled,this.editor))}static _createState(e,t,i){if(!t||!i.hasModel())return null;const r=i.getSelection();if(r.startLineNumber!==r.endLineNumber)return null;const s=WE.get(i);if(!s)return null;const o=Ic.get(i);if(!o)return null;let a=s.getSession(o);if(!a){const u=i.getSelections();if(u.length>1){const h=o.getState().matchCase;if(!LBe(i.getModel(),u,h))return null}a=vR.create(i,o)}if(!a||a.currentMatch||/^[ \t]+$/.test(a.searchText)||a.searchText.length>200)return null;const l=o.getState(),c=l.matchCase;if(l.isRevealed){let u=l.searchString;c||(u=u.toLowerCase());let d=a.searchText;if(c||(d=d.toLowerCase()),u===d&&a.matchCase===l.matchCase&&a.wholeWord===l.wholeWord&&!l.isRegex)return null}return new cBt(i.getModel(),a.searchText,a.matchCase,a.wholeWord?i.getOption(132):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;const t=this.editor.getModel();if(t.isTooLargeForTokenization())return;const i=this.state.findMatches(),r=this.editor.getSelections();r.sort($.compareRangesUsingStarts);const s=[];for(let c=0,u=0,d=i.length,h=r.length;c=h)s.push(f),c++;else{const g=$.compareRangesUsingStarts(f,r[u]);g<0?((r[u].isEmpty()||!$.areIntersecting(f,r[u]))&&s.push(f),c++):(g>0||c++,u++)}}const o=this.editor.getOption(81)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&o,l=s.map(c=>({range:c,options:Y7t(a)}));this._decorations.set(l)}dispose(){this._setState(null),super.dispose()}};t7=Dte=Z7t([X7t(1,dt)],t7);function LBe(n,e,t){const i=Oxe(n,e[0],!t);for(let r=1,s=e.length;r=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},_Bt=function(n,e){return function(t,i){e(t,i,n)}};const rK="inline-edit";let Ite=class extends me{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=Sn(this,!1),this.currentTextModel=Bi(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=St(this,r=>{if(this.isDisposed.read(r))return;const s=this.currentTextModel.read(r);if(s!==this.model.targetTextModel.read(r))return;const o=this.model.ghostText.read(r);if(!o)return;let a=this.model.range?.read(r);a&&a.startLineNumber===a.endLineNumber&&a.startColumn===a.endColumn&&(a=void 0);const l=(a?a.startLineNumber===a.endLineNumber:!0)&&o.parts.length===1&&o.parts[0].lines.length===1,c=o.parts.length===1&&o.parts[0].lines.every(v=>v.length===0),u=[],d=[];function h(v,y){if(d.length>0){const C=d[d.length-1];y&&C.decorations.push(new Ol(C.content.length+1,C.content.length+1+v[0].length,y,0)),C.content+=v[0],v=v.slice(1)}for(const C of v)d.push({content:C,decorations:y?[new Ol(1,C.length+1,y,0)]:[]})}const f=s.getLineContent(o.lineNumber);let g,p=0;if(!c&&(l||!a)){for(const v of o.parts){let y=v.lines;a&&!l&&(h(y,rK),y=[]),g===void 0?(u.push({column:v.column,text:y[0],preview:v.preview}),y=y.slice(1)):h([f.substring(p,v.column-1)],void 0),y.length>0&&(h(y,rK),g===void 0&&v.column<=f.length&&(g=v.column)),p=v.column-1}g!==void 0&&h([f.substring(p)],void 0)}const m=g!==void 0?new lBe(g,f.length+1):void 0,_=l||!a?o.lineNumber:a.endLineNumber-1;return{inlineTexts:u,additionalLines:d,hiddenRange:m,lineNumber:_,additionalReservedLineCount:this.model.minReservedLineCount.read(r),targetTextModel:s,range:a,isSingleLine:l,isPureRemove:c}}),this.decorations=St(this,r=>{const s=this.uiState.read(r);if(!s)return[];const o=[];if(s.hiddenRange&&o.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"inline-edit-hidden",description:"inline-edit-hidden"}}),s.range){const a=[];if(s.isSingleLine)a.push(s.range);else if(!s.isPureRemove){const l=s.range.endLineNumber-s.range.startLineNumber;for(let c=0;c{this.isDisposed.set(!0,void 0)})),this._register(cBe(this.editor,this.decorations))}};Ite=mBt([_Bt(2,Hr)],Ite);var vde=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},mp=function(n,e){return function(t,i){e(t,i,n)}},w5;let Ate=class extends me{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).showToolbar==="always"),this.sessionPosition=void 0,this.position=St(this,r=>{const s=this.model.read(r)?.model.ghostText.read(r);if(!this.alwaysShowToolbar.read(r)||!s||s.parts.length===0)return this.sessionPosition=void 0,null;const o=s.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==s.lineNumber&&(this.sessionPosition=void 0);const a=new he(s.lineNumber,Math.min(o,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(wc((r,s)=>{if(!this.model.read(r)||!this.alwaysShowToolbar.read(r))return;const a=s.add(this.instantiationService.createInstance(Nte,this.editor,!0,this.position));e.addContentWidget(a),s.add(Lt(()=>e.removeContentWidget(a)))}))}};Ate=vde([mp(2,Tt)],Ate);let Nte=class extends me{static{w5=this}static{this._dropDownVisible=!1}static{this.id=0}constructor(e,t,i,r,s,o){super(),this.editor=e,this.withBorder=t,this._position=i,this._contextKeyService=s,this._menuService=o,this.id=`InlineEditHintsContentWidget${w5.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=An("div.inlineEditHints",{className:this.withBorder?".withBorder":""},[An("div@toolBar")]),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(ce.InlineEditActions,this._contextKeyService)),this.toolBar=this._register(r.createInstance(Rte,this.nodes.toolBar,this.editor,ce.InlineEditToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:a=>a.startsWith("primary")},actionViewItemProvider:(a,l)=>{if(a instanceof ou)return r.createInstance(vBt,a,void 0)},telemetrySource:"InlineEditToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility(a=>{w5._dropDownVisible=a})),this._register(tn(a=>{this._position.read(a),this.editor.layoutContentWidget(this)})),this._register(tn(a=>{const l=[];for(const[c,u]of this.inlineCompletionsActionsMenus.getActions())for(const d of u)d instanceof ou&&l.push(d);l.length>0&&l.unshift(new na),this.toolBar.setAdditionalSecondaryActions(l)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};Nte=w5=vde([mp(3,Tt),mp(4,jt),mp(5,ld)],Nte);class vBt extends Db{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=An("div.keybinding").root;this._register(new l2(t,eu,{disableTitle:!0,...P6e})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineEditStatusBarItemLabel")}}updateTooltip(){}}let Rte=class extends JN{constructor(e,t,i,r,s,o,a,l,c,u){super(e,{resetMenu:i,...r},s,o,a,l,c,u),this.editor=t,this.menuId=i,this.options2=r,this.menuService=s,this.contextKeyService=o,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this._store.add(this.editor.onDidChangeCursorPosition(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){const e=[],t=[];EW(this.menu,this.options2?.menuOptions,{primary:e,secondary:t},this.options2?.toolbarOptions?.primaryGroup,this.options2?.toolbarOptions?.shouldInlineSubmenu,this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setAdditionalSecondaryActions(e){$r(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};Rte=vde([mp(4,ld),mp(5,jt),mp(6,mu),mp(7,xi),mp(8,_r),mp(9,Qa)],Rte);var TBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},C5=function(n,e){return function(t,i){e(t,i,n)}},UD,Pte;function*bBt(n,e,t=1){e===void 0&&([e,n]=[n,0]);for(let i=n;ii.replace(new RegExp("^"+e),"")),shift:t}}let Ote=class extends me{static{UD=this}static{this._modelId=0}static _createUniqueUri(){return Pt.from({scheme:"inline-edit-widget",path:new Date().toString()+String(UD._modelId++)})}constructor(e,t,i,r,s){super(),this._editor=e,this._model=t,this._instantiationService=i,this._diffProviderFactoryService=r,this._modelService=s,this._position=St(this,o=>{const a=this._model.read(o);if(!a||a.text.length===0||a.range.startLineNumber===a.range.endLineNumber&&!(a.range.startColumn===a.range.endColumn&&a.range.startColumn===1))return null;const l=this._editor.getModel();if(!l)return null;const c=Array.from(bBt(a.range.startLineNumber,a.range.endLineNumber+1)),u=c.map(p=>l.getLineLastNonWhitespaceColumn(p)),d=Math.max(...u),h=c[u.indexOf(d)],f=new he(h,d);return{top:a.range.startLineNumber,left:f}}),this._text=St(this,o=>{const a=this._model.read(o);if(!a)return{text:"",shift:0};const l=sK(a.text.split(` +`))),s.push(g),o+=c.endLineNumber-c.startLineNumber+1-d.length}t.pushUndoStop(),t.executeEdits(this.id,r,a?s:void 0),t.pushUndoStop()}}class _de extends ot{static{this.ID="editor.action.trimTrailingWhitespace"}constructor(){super({id:_de.ID,label:w("lines.trimTrailingWhitespace","Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:js(2089,2102),weight:100}})}run(e,t,i){let r=[];i.reason==="auto-save"&&(r=(t.getSelections()||[]).map(u=>new he(u.positionLineNumber,u.positionColumn)));const s=t.getSelection();if(s===null)return;const o=e.get(En),a=t.getModel(),l=o.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a?.getLanguageId(),resource:a?.uri}),c=new o7t(s,r,l);t.pushUndoStop(),t.executeCommands(this.id,[c]),t.pushUndoStop()}}class b7t extends ot{constructor(){super({id:"editor.action.deleteLines",label:w("lines.delete","Delete Line"),alias:"Delete Line",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:3113,weight:100}})}run(e,t){if(!t.hasModel())return;const i=this._getLinesToRemove(t),r=t.getModel();if(r.getLineCount()===1&&r.getLineMaxColumn(1)===1)return;let s=0;const o=[],a=[];for(let l=0,c=i.length;l1&&(d-=1,f=r.getLineMaxColumn(d)),o.push(jr.replace(new yt(d,f,h,g),"")),a.push(new yt(d-s,u.positionColumn,d-s,u.positionColumn)),s+=u.endLineNumber-u.startLineNumber+1}t.pushUndoStop(),t.executeEdits(this.id,o,a),t.pushUndoStop()}_getLinesToRemove(e){const t=e.getSelections().map(s=>{let o=s.endLineNumber;return s.startLineNumbers.startLineNumber===o.startLineNumber?s.endLineNumber-o.endLineNumber:s.startLineNumber-o.startLineNumber);const i=[];let r=t[0];for(let s=1;s=t[s].startLineNumber?r.endLineNumber=t[s].endLineNumber:(i.push(r),r=t[s]);return i.push(r),i}}class y7t extends ot{constructor(){super({id:"editor.action.indentLines",label:w("lines.indent","Indent Line"),alias:"Indent Line",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,bv.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class w7t extends ot{constructor(){super({id:"editor.action.outdentLines",label:w("lines.outdent","Outdent Line"),alias:"Outdent Line",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:2140,weight:100}})}run(e,t){Sk.Outdent.runEditorCommand(e,t,null)}}class C7t extends ot{constructor(){super({id:"editor.action.insertLineBefore",label:w("lines.insertBefore","Insert Line Above"),alias:"Insert Line Above",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,qW.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class x7t extends ot{constructor(){super({id:"editor.action.insertLineAfter",label:w("lines.insertAfter","Insert Line Below"),alias:"Insert Line Below",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,qW.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class xBe extends ot{run(e,t){if(!t.hasModel())return;const i=t.getSelection(),r=this._getRangesToDelete(t),s=[];for(let l=0,c=r.length-1;ljr.replace(l,""));t.pushUndoStop(),t.executeEdits(this.id,a,o),t.pushUndoStop()}}class S7t extends xBe{constructor(){super({id:"deleteAllLeft",label:w("lines.deleteAllLeft","Delete All Left"),alias:"Delete All Left",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:2049},weight:100}})}_getEndCursorState(e,t){let i=null;const r=[];let s=0;return t.forEach(o=>{let a;if(o.endColumn===1&&s>0){const l=o.startLineNumber-s;a=new yt(l,o.startColumn,l,o.startColumn)}else a=new yt(o.startLineNumber,o.startColumn,o.startLineNumber,o.startColumn);s+=o.endLineNumber-o.startLineNumber,o.intersectRanges(e)?i=a:r.push(a)}),i&&r.unshift(i),r}_getRangesToDelete(e){const t=e.getSelections();if(t===null)return[];let i=t;const r=e.getModel();return r===null?[]:(i.sort($.compareRangesUsingStarts),i=i.map(s=>{if(s.isEmpty())if(s.startColumn===1){const o=Math.max(1,s.startLineNumber-1),a=s.startLineNumber===1?1:r.getLineLength(o)+1;return new $(o,a,s.startLineNumber,1)}else return new $(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new $(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class k7t extends xBe{constructor(){super({id:"deleteAllRight",label:w("lines.deleteAllRight","Delete All Right"),alias:"Delete All Right",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100}})}_getEndCursorState(e,t){let i=null;const r=[];for(let s=0,o=t.length,a=0;s{if(s.isEmpty()){const o=t.getLineMaxColumn(s.startLineNumber);return s.startColumn===o?new $(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new $(s.startLineNumber,s.startColumn,s.startLineNumber,o)}return s});return r.sort($.compareRangesUsingStarts),r}}class E7t extends ot{constructor(){super({id:"editor.action.joinLines",label:w("lines.joinLines","Join Lines"),alias:"Join Lines",precondition:Q.writable,kbOpts:{kbExpr:Q.editorTextFocus,primary:0,mac:{primary:296},weight:100}})}run(e,t){const i=t.getSelections();if(i===null)return;let r=t.getSelection();if(r===null)return;i.sort($.compareRangesUsingStarts);const s=[],o=i.reduce((h,f)=>h.isEmpty()?h.endLineNumber===f.startLineNumber?(r.equalsSelection(h)&&(r=f),f):f.startLineNumber>h.endLineNumber+1?(s.push(h),f):new yt(h.startLineNumber,h.startColumn,f.endLineNumber,f.endColumn):f.startLineNumber>h.endLineNumber?(s.push(h),f):new yt(h.startLineNumber,h.startColumn,f.endLineNumber,f.endColumn));s.push(o);const a=t.getModel();if(a===null)return;const l=[],c=[];let u=r,d=0;for(let h=0,f=s.length;h=1){let O=!0;x===""&&(O=!1),O&&(x.charAt(x.length-1)===" "||x.charAt(x.length-1)===" ")&&(O=!1,x=x.replace(/[\s\uFEFF\xA0]+$/g," "));const M=D.substr(I-1);x+=(O?" ":"")+M,O?_=M.length+1:_=M.length}else _=0}const k=new $(p,m,v,y);if(!k.isEmpty()){let L;g.isEmpty()?(l.push(jr.replace(k,x)),L=new yt(k.startLineNumber-d,x.length-_+1,p-d,x.length-_+1)):g.startLineNumber===g.endLineNumber?(l.push(jr.replace(k,x)),L=new yt(g.startLineNumber-d,g.startColumn,g.endLineNumber-d,g.endColumn)):(l.push(jr.replace(k,x)),L=new yt(g.startLineNumber-d,g.startColumn,g.startLineNumber-d,x.length-C)),$.intersectRanges(k,r)!==null?u=L:c.push(L)}d+=k.endLineNumber-k.startLineNumber}c.unshift(u),t.pushUndoStop(),t.executeEdits(this.id,l,c),t.pushUndoStop()}}class L7t extends ot{constructor(){super({id:"editor.action.transpose",label:w("editor.transpose","Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:Q.writable})}run(e,t){const i=t.getSelections();if(i===null)return;const r=t.getModel();if(r===null)return;const s=[];for(let o=0,a=i.length;o=u){if(c.lineNumber===r.getLineCount())continue;const d=new $(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),h=r.getValueInRange(d).split("").reverse().join("");s.push(new Sa(new yt(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),h))}else{const d=new $(c.lineNumber,Math.max(1,c.column-1),c.lineNumber,c.column+1),h=r.getValueInRange(d).split("").reverse().join("");s.push(new Pce(d,h,new yt(c.lineNumber,c.column+1,c.lineNumber,c.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class NC extends ot{run(e,t){const i=t.getSelections();if(i===null)return;const r=t.getModel();if(r===null)return;const s=t.getOption(132),o=[];for(const a of i)if(a.isEmpty()){const l=a.getStartPosition(),c=t.getConfiguredWordAtPosition(l);if(!c)continue;const u=new $(l.lineNumber,c.startColumn,l.lineNumber,c.endColumn),d=r.getValueInRange(u);o.push(jr.replace(u,this._modifyText(d,s)))}else{const l=r.getValueInRange(a);o.push(jr.replace(a,this._modifyText(l,s)))}t.pushUndoStop(),t.executeEdits(this.id,o),t.pushUndoStop()}}class T7t extends NC{constructor(){super({id:"editor.action.transformToUppercase",label:w("editor.transformToUppercase","Transform to Uppercase"),alias:"Transform to Uppercase",precondition:Q.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class D7t extends NC{constructor(){super({id:"editor.action.transformToLowercase",label:w("editor.transformToLowercase","Transform to Lowercase"),alias:"Transform to Lowercase",precondition:Q.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class O_{constructor(e,t){this._pattern=e,this._flags=t,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch{}}return this._actual}isSupported(){return this.get()!==null}}class Q9 extends NC{static{this.titleBoundary=new O_("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu")}constructor(){super({id:"editor.action.transformToTitlecase",label:w("editor.transformToTitlecase","Transform to Title Case"),alias:"Transform to Title Case",precondition:Q.writable})}_modifyText(e,t){const i=Q9.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,r=>r.toLocaleUpperCase()):e}}class Ik extends NC{static{this.caseBoundary=new O_("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new O_("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu")}constructor(){super({id:"editor.action.transformToSnakecase",label:w("editor.transformToSnakecase","Transform to Snake Case"),alias:"Transform to Snake Case",precondition:Q.writable})}_modifyText(e,t){const i=Ik.caseBoundary.get(),r=Ik.singleLetters.get();return!i||!r?e:e.replace(i,"$1_$2").replace(r,"$1_$2$3").toLocaleLowerCase()}}class J9 extends NC{static{this.wordBoundary=new O_("[_\\s-]","gm")}constructor(){super({id:"editor.action.transformToCamelcase",label:w("editor.transformToCamelcase","Transform to Camel Case"),alias:"Transform to Camel Case",precondition:Q.writable})}_modifyText(e,t){const i=J9.wordBoundary.get();if(!i)return e;const r=e.split(i);return r.shift()+r.map(o=>o.substring(0,1).toLocaleUpperCase()+o.substring(1)).join("")}}class mR extends NC{static{this.wordBoundary=new O_("[_\\s-]","gm")}static{this.wordBoundaryToMaintain=new O_("(?<=\\.)","gm")}constructor(){super({id:"editor.action.transformToPascalcase",label:w("editor.transformToPascalcase","Transform to Pascal Case"),alias:"Transform to Pascal Case",precondition:Q.writable})}_modifyText(e,t){const i=mR.wordBoundary.get(),r=mR.wordBoundaryToMaintain.get();return!i||!r?e:e.split(r).map(a=>a.split(i)).flat().map(a=>a.substring(0,1).toLocaleUpperCase()+a.substring(1)).join("")}}class Ak extends NC{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(t=>t.isSupported())}static{this.caseBoundary=new O_("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new O_("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu")}static{this.underscoreBoundary=new O_("(\\S)(_)(\\S)","gm")}constructor(){super({id:"editor.action.transformToKebabcase",label:w("editor.transformToKebabcase","Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:Q.writable})}_modifyText(e,t){const i=Ak.caseBoundary.get(),r=Ak.singleLetters.get(),s=Ak.underscoreBoundary.get();return!i||!r||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(r,"$1-$2").toLocaleLowerCase()}}Pe(d7t);Pe(h7t);Pe(f7t);Pe(g7t);Pe(p7t);Pe(m7t);Pe(_7t);Pe(v7t);Pe(_de);Pe(b7t);Pe(y7t);Pe(w7t);Pe(C7t);Pe(x7t);Pe(S7t);Pe(k7t);Pe(E7t);Pe(L7t);Pe(T7t);Pe(D7t);Ik.caseBoundary.isSupported()&&Ik.singleLetters.isSupported()&&Pe(Ik);J9.wordBoundary.isSupported()&&Pe(J9);mR.wordBoundary.isSupported()&&Pe(mR);Q9.titleBoundary.isSupported()&&Pe(Q9);Ak.isSupported()&&Pe(Ak);var I7t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},k3=function(n,e){return function(t,i){e(t,i,n)}},yF;const SBe=new et("LinkedEditingInputVisible",!1),A7t="linked-editing-decoration";let $E=class extends me{static{yF=this}static{this.ID="editor.contrib.linkedEditing"}static{this.DECORATION=un.register({description:"linked-editing",stickiness:0,className:A7t})}static get(e){return e.getContribution(yF.ID)}constructor(e,t,i,r,s){super(),this.languageConfigurationService=r,this._syncRangesToken=0,this._localToDispose=this._register(new ke),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=SBe.bindTo(t),this._debounceInformation=s.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new ke),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequestCts=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel(()=>this.reinitialize(!0))),this._register(this._editor.onDidChangeConfiguration(o=>{(o.hasChanged(70)||o.hasChanged(94))&&this.reinitialize(!1)})),this._register(this._providers.onDidChange(()=>this.reinitialize(!1))),this._register(this._editor.onDidChangeModelLanguage(()=>this.reinitialize(!0))),this.reinitialize(!0)}reinitialize(e){const t=this._editor.getModel(),i=t!==null&&(this._editor.getOption(70)||this._editor.getOption(94))&&this._providers.has(t);if(i===this._enabled&&!e||(this._enabled=i,this.clearRanges(),this._localToDispose.clear(),!i||t===null))return;this._localToDispose.add(Ge.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const r=new Qd(this._debounceInformation.get(t)),s=()=>{this._rangeUpdateTriggerPromise=r.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},o=new Qd(0),a=l=>{this._rangeSyncTriggerPromise=o.trigger(()=>this._syncRanges(l))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{s()})),this._localToDispose.add(this._editor.onDidChangeModelContent(l=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const c=this._currentDecorations.getRange(0);if(c&&l.changes.every(u=>c.intersectRanges(u.range))){a(this._syncRangesToken);return}}s()})),this._localToDispose.add({dispose:()=>{r.dispose(),o.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;const t=this._editor.getModel(),i=this._currentDecorations.getRange(0);if(!i||i.startLineNumber!==i.endLineNumber)return this.clearRanges();const r=t.getValueInRange(i);if(this._currentWordPattern){const o=r.match(this._currentWordPattern);if((o?o[0].length:0)!==r.length)return this.clearRanges()}const s=[];for(let o=1,a=this._currentDecorations.length;o1){this.clearRanges();return}const i=this._editor.getModel(),r=i.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===r){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const o=this._currentDecorations.getRange(0);if(o&&o.containsPosition(t))return}}this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=r;const s=this._currentRequestCts=new Kr;try{const o=new Bo(!1),a=await kBe(this._providers,i,t,s.token);if(this._debounceInformation.update(i,o.elapsed()),s!==this._currentRequestCts||(this._currentRequestCts=null,r!==i.getVersionId()))return;let l=[];a?.ranges&&(l=a.ranges),this._currentWordPattern=a?.wordPattern||this._languageWordPattern;let c=!1;for(let d=0,h=l.length;d({range:d,options:yF.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(u),this._syncRangesToken++}catch(o){uh(o)||rn(o),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}};$E=yF=I7t([k3(1,jt),k3(2,dt),k3(3,Zr),k3(4,cd)],$E);class N7t extends ot{constructor(){super({id:"editor.action.linkedEditing",label:w("linkedEditing.label","Start Linked Editing"),alias:"Start Linked Editing",precondition:Le.and(Q.writable,Q.hasRenameProvider),kbOpts:{kbExpr:Q.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(ai),[r,s]=Array.isArray(t)&&t||[void 0,void 0];return Pt.isUri(r)&&he.isIPosition(s)?i.openCodeEditor({resource:r},i.getActiveCodeEditor()).then(o=>{o&&(o.setPosition(s),o.invokeWithinContext(a=>(this.reportTelemetry(a,o),this.run(a,o))))},rn):super.runCommand(e,t)}run(e,t){const i=$E.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const R7t=fo.bindToContribution($E.get);Je(new R7t({id:"cancelLinkedEditingInput",precondition:SBe,handler:n=>n.clearRanges(),kbOpts:{kbExpr:Q.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function kBe(n,e,t,i){const r=n.ordered(e);return Oae(r.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(o){vs(o);return}}),s=>!!s&&bl(s?.ranges))}J("editor.linkedEditingBackground",{dark:Te.fromHex("#f00").transparent(.3),light:Te.fromHex("#f00").transparent(.3),hcDark:Te.fromHex("#f00").transparent(.3),hcLight:Te.white},w("editorLinkedEditingBackground","Background color when the editor auto renames on type."));Rc("_executeLinkedEditingProvider",(n,e,t)=>{const{linkedEditingRangeProvider:i}=n.get(dt);return kBe(i,e,t,yn.None)});Zn($E.ID,$E,1);Pe(N7t);let P7t=class{constructor(e,t){this._link=e,this._provider=t}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(e){return this._link.url?this._link.url:typeof this._provider.resolveLink=="function"?Promise.resolve(this._provider.resolveLink(this._link,e)).then(t=>(this._link=t||this._link,this._link.url?this.resolve(e):Promise.reject(new Error("missing")))):Promise.reject(new Error("missing"))}};class e7{constructor(e){this._disposables=new ke;let t=[];for(const[i,r]of e){const s=i.links.map(o=>new P7t(o,r));t=e7._union(t,s),R$(i)&&this._disposables.add(i)}this.links=t}dispose(){this._disposables.dispose(),this.links.length=0}static _union(e,t){const i=[];let r,s,o,a;for(r=0,o=0,s=e.length,a=t.length;rPromise.resolve(s.provideLinks(e,t)).then(a=>{a&&(i[o]=[a,s])},vs));return Promise.all(r).then(()=>{const s=new e7(rf(i));return t.isCancellationRequested?(s.dispose(),new e7([])):s})}Un.registerCommand("_executeLinkProvider",async(n,...e)=>{let[t,i]=e;oi(t instanceof Pt),typeof i!="number"&&(i=0);const{linkProvider:r}=n.get(dt),s=n.get(Sr).getModel(t);if(!s)return[];const o=await EBe(r,s,yn.None);if(!o)return[];for(let l=0;l=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},E3=function(n,e){return function(t,i){e(t,i,n)}},Tte;let _R=class extends me{static{Tte=this}static{this.ID="editor.linkDetector"}static get(e){return e.getContribution(Tte.ID)}constructor(e,t,i,r,s){super(),this.editor=e,this.openerService=t,this.notificationService=i,this.languageFeaturesService=r,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=s.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new Ui(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const o=this._register(new hH(e));this._register(o.onMouseMoveOrRelevantKeyDown(([a,l])=>{this._onEditorMouseMove(a,l)})),this._register(o.onExecute(a=>{this.onEditorMouseUp(a)})),this._register(o.onCancel(a=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(a=>{a.hasChanged(71)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(a=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(a=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(a=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(a=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(71))return;const e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=ko(t=>EBe(this.providers,e,t));try{const t=new Bo(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){rn(t)}finally{this.computePromise=null}}}updateDecorations(e){const t=this.editor.getOption(78)==="altKey",i=[],r=Object.keys(this.currentOccurrences);for(const o of r){const a=this.currentOccurrences[o];i.push(a.decorationId)}const s=[];if(e)for(const o of e)s.push(Nk.decoration(o,t));this.editor.changeDecorations(o=>{const a=o.deltaDecorations(i,s);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let l=0,c=a.length;l{r.activate(s,i),this.activeLinkDecorationId=r.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const e=this.editor.getOption(78)==="altKey";if(this.activeLinkDecorationId){const t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(i=>{t.deactivate(i,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;const t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,i=!1){if(!this.openerService)return;const{link:r}=e;r.resolve(yn.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const o=this.editor.getModel().uri;if(o.scheme===sn.file&&s.startsWith(`${sn.file}:`)){const a=Pt.parse(s);if(a.scheme===sn.file){const l=ip(a);let c=null;l.startsWith("/./")||l.startsWith("\\.\\")?c=`.${l.substr(1)}`:(l.startsWith("//./")||l.startsWith("\\\\.\\"))&&(c=`.${l.substr(2)}`),c&&(s=VCt(o,c))}}}return this.openerService.open(s,{openToSide:t,fromUserGesture:i,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},s=>{const o=s instanceof Error?s.message:s;o==="invalid"?this.notificationService.warn(w("invalid.url","Failed to open this link because it is not well-formed: {0}",r.url.toString())):o==="missing"?this.notificationService.warn(w("missing.url","Failed to open this link because its target is missing.")):rn(s)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;const t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(const i of t){const r=this.currentOccurrences[i.id];if(r)return r}return null}isEnabled(e,t){return!!(e.target.type===6&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey))}stop(){this.computeLinks.cancel(),this.activeLinksList&&(this.activeLinksList?.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}};_R=Tte=O7t([E3(1,Pc),E3(2,Ts),E3(3,dt),E3(4,cd)],_R);const Rxe={general:un.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:un.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class Nk{static decoration(e,t){return{range:e.range,options:Nk._getOptions(e,t,!1)}}static _getOptions(e,t,i){const r={...i?Rxe.active:Rxe.general};return r.hoverMessage=M7t(e,t),r}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,Nk._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,Nk._getOptions(this.link,t,!1))}}function M7t(n,e){const t=n.url&&/^command:/i.test(n.url.toString()),i=n.tooltip?n.tooltip:t?w("links.navigate.executeCmd","Execute command"):w("links.navigate.follow","Follow link"),r=e?Rn?w("links.navigate.kb.meta.mac","cmd + click"):w("links.navigate.kb.meta","ctrl + click"):Rn?w("links.navigate.kb.alt.mac","option + click"):w("links.navigate.kb.alt","alt + click");if(n.url){let s="";if(/^command:/i.test(n.url.toString())){const a=n.url.toString().match(/^command:([^?#]+)/);if(a){const l=a[1];s=w("tooltip.explanation","Execute command {0}",l)}}return new za("",!0).appendLink(n.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${r})`)}else return new za().appendText(`${i} (${r})`)}class F7t extends ot{constructor(){super({id:"editor.action.openLink",label:w("label","Open Link"),alias:"Open Link",precondition:void 0})}run(e,t){const i=_R.get(t);if(!i||!t.hasModel())return;const r=t.getSelections();for(const s of r){const o=i.getLinkOccurrence(s.getEndPosition());o&&i.openLinkOccurrence(o,!1)}}}Zn(_R.ID,_R,1);Pe(F7t);class Pxe extends me{static{this.ID="editor.contrib.longLinesHelper"}constructor(e){super(),this._editor=e,this._register(this._editor.onMouseDown(t=>{const i=this._editor.getOption(118);i>=0&&t.target.type===6&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}}Zn(Pxe.ID,Pxe,2);const B7t=J("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},w("wordHighlight","Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},w("wordHighlightStrong","Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."),!0);J("editor.wordHighlightTextBackground",B7t,w("wordHighlightText","Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0);const $7t=J("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Ar,hcLight:Ar},w("wordHighlightBorder","Border color of a symbol during read-access, like reading a variable."));J("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Ar,hcLight:Ar},w("wordHighlightStrongBorder","Border color of a symbol during write-access, like writing to a variable."));J("editor.wordHighlightTextBorder",$7t,w("wordHighlightTextBorder","Border color of a textual occurrence for a symbol."));const W7t=J("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",w("overviewRulerWordHighlightForeground","Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),H7t=J("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",w("overviewRulerWordHighlightStrongForeground","Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),V7t=J("editorOverviewRuler.wordHighlightTextForeground",k5e,w("overviewRulerWordHighlightTextForeground","Overview ruler marker color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0),z7t=un.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:ss(H7t),position:Qu.Center},minimap:{color:ss(lW),position:1}}),U7t=un.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:ss(V7t),position:Qu.Center},minimap:{color:ss(lW),position:1}}),j7t=un.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:ss(k5e),position:Qu.Center},minimap:{color:ss(lW),position:1}}),q7t=un.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),K7t=un.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:ss(W7t),position:Qu.Center},minimap:{color:ss(lW),position:1}});function G7t(n){return n===nE.Write?z7t:n===nE.Text?U7t:K7t}function Y7t(n){return n?q7t:j7t}dh((n,e)=>{const t=n.getColor(hle);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var Z7t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},X7t=function(n,e){return function(t,i){e(t,i,n)}},Dte;function i1(n,e){const t=e.filter(i=>!n.find(r=>r.equals(i)));if(t.length>=1){const i=t.map(s=>`line ${s.viewState.position.lineNumber} column ${s.viewState.position.column}`).join(", "),r=t.length===1?w("cursorAdded","Cursor added: {0}",i):w("cursorsAdded","Cursors added: {0}",i);Qp(r)}}class Q7t extends ot{constructor(){super({id:"editor.action.insertCursorAbove",label:w("mutlicursor.insertAbove","Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miInsertCursorAbove",comment:["&& denotes a mnemonic"]},"&&Add Cursor Above"),order:2}})}run(e,t,i){if(!t.hasModel())return;let r=!0;i&&i.logicalLine===!1&&(r=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const o=s.getCursorStates();s.setCursorStates(i.source,3,qo.addCursorUp(s,o,r)),s.revealTopMostCursor(i.source),i1(o,s.getCursorStates())}}class J7t extends ot{constructor(){super({id:"editor.action.insertCursorBelow",label:w("mutlicursor.insertBelow","Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miInsertCursorBelow",comment:["&& denotes a mnemonic"]},"A&&dd Cursor Below"),order:3}})}run(e,t,i){if(!t.hasModel())return;let r=!0;i&&i.logicalLine===!1&&(r=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const o=s.getCursorStates();s.setCursorStates(i.source,3,qo.addCursorDown(s,o,r)),s.revealBottomMostCursor(i.source),i1(o,s.getCursorStates())}}class eBt extends ot{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:w("mutlicursor.insertAtEndOfEachLineSelected","Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miInsertCursorAtEndOfEachLineSelected",comment:["&& denotes a mnemonic"]},"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(e,t,i){if(!e.isEmpty()){for(let r=e.startLineNumber;r1&&i.push(new yt(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn))}}run(e,t){if(!t.hasModel())return;const i=t.getModel(),r=t.getSelections(),s=t._getViewModel(),o=s.getCursorStates(),a=[];r.forEach(l=>this.getCursorsForSelection(l,i,a)),a.length>0&&t.setSelections(a),i1(o,s.getCursorStates())}}class tBt extends ot{constructor(){super({id:"editor.action.addCursorsToBottom",label:w("mutlicursor.addCursorsToBottom","Add Cursors To Bottom"),alias:"Add Cursors To Bottom",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),r=t.getModel().getLineCount(),s=[];for(let l=i[0].startLineNumber;l<=r;l++)s.push(new yt(l,i[0].startColumn,l,i[0].endColumn));const o=t._getViewModel(),a=o.getCursorStates();s.length>0&&t.setSelections(s),i1(a,o.getCursorStates())}}class nBt extends ot{constructor(){super({id:"editor.action.addCursorsToTop",label:w("mutlicursor.addCursorsToTop","Add Cursors To Top"),alias:"Add Cursors To Top",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),r=[];for(let a=i[0].startLineNumber;a>=1;a--)r.push(new yt(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),o=s.getCursorStates();r.length>0&&t.setSelections(r),i1(o,s.getCursorStates())}}class L3{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class vR{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new vR(e,t,!1,i.searchString,i.wholeWord,i.matchCase,null);let r=!1,s,o;const a=e.getSelections();a.length===1&&a[0].isEmpty()?(r=!0,s=!0,o=!0):(s=i.wholeWord,o=i.matchCase);const l=e.getSelection();let c,u=null;if(l.isEmpty()){const d=e.getConfiguredWordAtPosition(l.getStartPosition());if(!d)return null;c=d.word,u=new yt(l.startLineNumber,d.startColumn,l.startLineNumber,d.endColumn)}else c=e.getModel().getValueInRange(l).replace(/\r\n/g,` +`);return new vR(e,t,r,c,s,o,u)}constructor(e,t,i,r,s,o,a){this._editor=e,this.findController=t,this.isDisconnectedFromFindController=i,this.searchText=r,this.wholeWord=s,this.matchCase=o,this.currentMatch=a}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new L3(t.concat(e),e,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new L3(t.slice(0,t.length-1).concat(e),e,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const r=this.currentMatch;return this.currentMatch=null,r}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findNextMatch(this.searchText,t.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1);return i?new yt(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new L3(t.concat(e),e,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new L3(t.slice(0,t.length-1).concat(e),e,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const r=this.currentMatch;return this.currentMatch=null,r}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findPreviousMatch(this.searchText,t.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1);return i?new yt(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}selectAll(e){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();const t=this._editor.getModel();return e?t.findMatches(this.searchText,e,!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1,1073741824):t.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(132):null,!1,1073741824)}}class WE extends me{static{this.ID="editor.contrib.multiCursorController"}static get(e){return e.getContribution(WE.ID)}constructor(e){super(),this._sessionDispose=this._register(new ke),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=vR.create(this._editor,e);if(!t)return;this._session=t;const i={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(i.wholeWordOverride=1,i.matchCaseOverride=1,i.isRegexOverride=2),e.getState().change(i,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(r=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(r=>{(r.matchCase||r.wholeWord)&&this._endSession()}))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){const e={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(e,!1)}this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;const i=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return i?new yt(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){const t=this._editor.getSelections();if(t.length>1){const r=e.getState().matchCase;if(!LBe(this._editor.getModel(),t,r)){const o=this._editor.getModel(),a=[];for(let l=0,c=t.length;l0&&i.isRegex){const r=this._editor.getModel();i.searchScope?t=r.findMatches(i.searchString,i.searchScope,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(132):null,!1,1073741824):t=r.findMatches(i.searchString,!0,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(132):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(i.searchScope)}if(t.length>0){const r=this._editor.getSelection();for(let s=0,o=t.length;snew yt(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}}class _2 extends ot{run(e,t){const i=WE.get(t);if(!i)return;const r=t._getViewModel();if(r){const s=r.getCursorStates(),o=Ic.get(t);if(o)this._run(i,o);else{const a=e.get(Tt).createInstance(Ic,t);this._run(i,a),a.dispose()}i1(s,r.getCursorStates())}}}class iBt extends _2{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:w("addSelectionToNextFindMatch","Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:2082,weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miAddSelectionToNextFindMatch",comment:["&& denotes a mnemonic"]},"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class rBt extends _2{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:w("addSelectionToPreviousFindMatch","Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miAddSelectionToPreviousFindMatch",comment:["&& denotes a mnemonic"]},"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class sBt extends _2{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:w("moveSelectionToNextFindMatch","Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:js(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class oBt extends _2{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:w("moveSelectionToPreviousFindMatch","Move Last Selection To Previous Find Match"),alias:"Move Last Selection To Previous Find Match",precondition:void 0})}_run(e,t){e.moveSelectionToPreviousFindMatch(t)}}class aBt extends _2{constructor(){super({id:"editor.action.selectHighlights",label:w("selectAllOccurrencesOfFindMatch","Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:3114,weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"3_multi",title:w({key:"miSelectHighlights",comment:["&& denotes a mnemonic"]},"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class lBt extends _2{constructor(){super({id:"editor.action.changeAll",label:w("changeAll.label","Change All Occurrences"),alias:"Change All Occurrences",precondition:Le.and(Q.writable,Q.editorTextFocus),kbOpts:{kbExpr:Q.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class cBt{constructor(e,t,i,r,s){this._model=e,this._searchText=t,this._matchCase=i,this._wordSeparators=r,this._modelVersionId=this._model.getVersionId(),this._cachedFindMatches=null,s&&this._model===s._model&&this._searchText===s._searchText&&this._matchCase===s._matchCase&&this._wordSeparators===s._wordSeparators&&this._modelVersionId===s._modelVersionId&&(this._cachedFindMatches=s._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(e=>e.range),this._cachedFindMatches.sort($.compareRangesUsingStarts)),this._cachedFindMatches}}let t7=class extends me{static{Dte=this}static{this.ID="editor.contrib.selectionHighlighter"}constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(109),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Ui(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(r=>{this._isEnabled=e.getOption(109)})),this._register(e.onDidChangeCursorSelection(r=>{this._isEnabled&&(r.selection.isEmpty()?r.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(r=>{this._setState(null)})),this._register(e.onDidChangeModelContent(r=>{this._isEnabled&&this.updateSoon.schedule()}));const i=Ic.get(e);i&&this._register(i.getState().onFindReplaceStateChange(r=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(Dte._createState(this.state,this._isEnabled,this.editor))}static _createState(e,t,i){if(!t||!i.hasModel())return null;const r=i.getSelection();if(r.startLineNumber!==r.endLineNumber)return null;const s=WE.get(i);if(!s)return null;const o=Ic.get(i);if(!o)return null;let a=s.getSession(o);if(!a){const u=i.getSelections();if(u.length>1){const h=o.getState().matchCase;if(!LBe(i.getModel(),u,h))return null}a=vR.create(i,o)}if(!a||a.currentMatch||/^[ \t]+$/.test(a.searchText)||a.searchText.length>200)return null;const l=o.getState(),c=l.matchCase;if(l.isRevealed){let u=l.searchString;c||(u=u.toLowerCase());let d=a.searchText;if(c||(d=d.toLowerCase()),u===d&&a.matchCase===l.matchCase&&a.wholeWord===l.wholeWord&&!l.isRegex)return null}return new cBt(i.getModel(),a.searchText,a.matchCase,a.wholeWord?i.getOption(132):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;const t=this.editor.getModel();if(t.isTooLargeForTokenization())return;const i=this.state.findMatches(),r=this.editor.getSelections();r.sort($.compareRangesUsingStarts);const s=[];for(let c=0,u=0,d=i.length,h=r.length;c=h)s.push(f),c++;else{const g=$.compareRangesUsingStarts(f,r[u]);g<0?((r[u].isEmpty()||!$.areIntersecting(f,r[u]))&&s.push(f),c++):(g>0||c++,u++)}}const o=this.editor.getOption(81)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&o,l=s.map(c=>({range:c,options:Y7t(a)}));this._decorations.set(l)}dispose(){this._setState(null),super.dispose()}};t7=Dte=Z7t([X7t(1,dt)],t7);function LBe(n,e,t){const i=Oxe(n,e[0],!t);for(let r=1,s=e.length;r=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},_Bt=function(n,e){return function(t,i){e(t,i,n)}};const rK="inline-edit";let Ite=class extends me{constructor(e,t,i){super(),this.editor=e,this.model=t,this.languageService=i,this.isDisposed=kn(this,!1),this.currentTextModel=Bi(this,this.editor.onDidChangeModel,()=>this.editor.getModel()),this.uiState=St(this,r=>{if(this.isDisposed.read(r))return;const s=this.currentTextModel.read(r);if(s!==this.model.targetTextModel.read(r))return;const o=this.model.ghostText.read(r);if(!o)return;let a=this.model.range?.read(r);a&&a.startLineNumber===a.endLineNumber&&a.startColumn===a.endColumn&&(a=void 0);const l=(a?a.startLineNumber===a.endLineNumber:!0)&&o.parts.length===1&&o.parts[0].lines.length===1,c=o.parts.length===1&&o.parts[0].lines.every(v=>v.length===0),u=[],d=[];function h(v,y){if(d.length>0){const C=d[d.length-1];y&&C.decorations.push(new Ol(C.content.length+1,C.content.length+1+v[0].length,y,0)),C.content+=v[0],v=v.slice(1)}for(const C of v)d.push({content:C,decorations:y?[new Ol(1,C.length+1,y,0)]:[]})}const f=s.getLineContent(o.lineNumber);let g,p=0;if(!c&&(l||!a)){for(const v of o.parts){let y=v.lines;a&&!l&&(h(y,rK),y=[]),g===void 0?(u.push({column:v.column,text:y[0],preview:v.preview}),y=y.slice(1)):h([f.substring(p,v.column-1)],void 0),y.length>0&&(h(y,rK),g===void 0&&v.column<=f.length&&(g=v.column)),p=v.column-1}g!==void 0&&h([f.substring(p)],void 0)}const m=g!==void 0?new lBe(g,f.length+1):void 0,_=l||!a?o.lineNumber:a.endLineNumber-1;return{inlineTexts:u,additionalLines:d,hiddenRange:m,lineNumber:_,additionalReservedLineCount:this.model.minReservedLineCount.read(r),targetTextModel:s,range:a,isSingleLine:l,isPureRemove:c}}),this.decorations=St(this,r=>{const s=this.uiState.read(r);if(!s)return[];const o=[];if(s.hiddenRange&&o.push({range:s.hiddenRange.toRange(s.lineNumber),options:{inlineClassName:"inline-edit-hidden",description:"inline-edit-hidden"}}),s.range){const a=[];if(s.isSingleLine)a.push(s.range);else if(!s.isPureRemove){const l=s.range.endLineNumber-s.range.startLineNumber;for(let c=0;c{this.isDisposed.set(!0,void 0)})),this._register(cBe(this.editor,this.decorations))}};Ite=mBt([_Bt(2,Hr)],Ite);var vde=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},mp=function(n,e){return function(t,i){e(t,i,n)}},wF;let Ate=class extends me{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).showToolbar==="always"),this.sessionPosition=void 0,this.position=St(this,r=>{const s=this.model.read(r)?.model.ghostText.read(r);if(!this.alwaysShowToolbar.read(r)||!s||s.parts.length===0)return this.sessionPosition=void 0,null;const o=s.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==s.lineNumber&&(this.sessionPosition=void 0);const a=new he(s.lineNumber,Math.min(o,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(wc((r,s)=>{if(!this.model.read(r)||!this.alwaysShowToolbar.read(r))return;const a=s.add(this.instantiationService.createInstance(Nte,this.editor,!0,this.position));e.addContentWidget(a),s.add(Lt(()=>e.removeContentWidget(a)))}))}};Ate=vde([mp(2,Tt)],Ate);let Nte=class extends me{static{wF=this}static{this._dropDownVisible=!1}static{this.id=0}constructor(e,t,i,r,s,o){super(),this.editor=e,this.withBorder=t,this._position=i,this._contextKeyService=s,this._menuService=o,this.id=`InlineEditHintsContentWidget${wF.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=An("div.inlineEditHints",{className:this.withBorder?".withBorder":""},[An("div@toolBar")]),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(ce.InlineEditActions,this._contextKeyService)),this.toolBar=this._register(r.createInstance(Rte,this.nodes.toolBar,this.editor,ce.InlineEditToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:a=>a.startsWith("primary")},actionViewItemProvider:(a,l)=>{if(a instanceof ou)return r.createInstance(vBt,a,void 0)},telemetrySource:"InlineEditToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility(a=>{wF._dropDownVisible=a})),this._register(tn(a=>{this._position.read(a),this.editor.layoutContentWidget(this)})),this._register(tn(a=>{const l=[];for(const[c,u]of this.inlineCompletionsActionsMenus.getActions())for(const d of u)d instanceof ou&&l.push(d);l.length>0&&l.unshift(new na),this.toolBar.setAdditionalSecondaryActions(l)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};Nte=wF=vde([mp(3,Tt),mp(4,jt),mp(5,ld)],Nte);class vBt extends Db{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=An("div.keybinding").root;this._register(new l2(t,eu,{disableTitle:!0,...P6e})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineEditStatusBarItemLabel")}}updateTooltip(){}}let Rte=class extends JN{constructor(e,t,i,r,s,o,a,l,c,u){super(e,{resetMenu:i,...r},s,o,a,l,c,u),this.editor=t,this.menuId=i,this.options2=r,this.menuService=s,this.contextKeyService=o,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this._store.add(this.editor.onDidChangeCursorPosition(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){const e=[],t=[];EW(this.menu,this.options2?.menuOptions,{primary:e,secondary:t},this.options2?.toolbarOptions?.primaryGroup,this.options2?.toolbarOptions?.shouldInlineSubmenu,this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions),t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),this.setActions(e,t)}setAdditionalSecondaryActions(e){$r(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};Rte=vde([mp(4,ld),mp(5,jt),mp(6,mu),mp(7,xi),mp(8,_r),mp(9,Qa)],Rte);var TBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},CF=function(n,e){return function(t,i){e(t,i,n)}},UD,Pte;function*bBt(n,e,t=1){e===void 0&&([e,n]=[n,0]);for(let i=n;ii.replace(new RegExp("^"+e),"")),shift:t}}let Ote=class extends me{static{UD=this}static{this._modelId=0}static _createUniqueUri(){return Pt.from({scheme:"inline-edit-widget",path:new Date().toString()+String(UD._modelId++)})}constructor(e,t,i,r,s){super(),this._editor=e,this._model=t,this._instantiationService=i,this._diffProviderFactoryService=r,this._modelService=s,this._position=St(this,o=>{const a=this._model.read(o);if(!a||a.text.length===0||a.range.startLineNumber===a.range.endLineNumber&&!(a.range.startColumn===a.range.endColumn&&a.range.startColumn===1))return null;const l=this._editor.getModel();if(!l)return null;const c=Array.from(bBt(a.range.startLineNumber,a.range.endLineNumber+1)),u=c.map(p=>l.getLineLastNonWhitespaceColumn(p)),d=Math.max(...u),h=c[u.indexOf(d)],f=new he(h,d);return{top:a.range.startLineNumber,left:f}}),this._text=St(this,o=>{const a=this._model.read(o);if(!a)return{text:"",shift:0};const l=sK(a.text.split(` `));return{text:l.text.join(` `),shift:l.shift}}),this._originalModel=hl(()=>this._modelService.createModel("",null,UD._createUniqueUri())).keepObserved(this._store),this._modifiedModel=hl(()=>this._modelService.createModel("",null,UD._createUniqueUri())).keepObserved(this._store),this._diff=St(this,o=>this._diffPromise.read(o)?.promiseResult.read(o)?.data),this._diffPromise=St(this,o=>{const a=this._model.read(o);if(!a)return;const l=this._editor.getModel();if(!l)return;const c=sK(l.getValueInRange(a.range).split(` `)).text.join(` `),u=sK(a.text.split(` `)).text.join(` -`);this._originalModel.get().setValue(c),this._modifiedModel.get().setValue(u);const d=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return xW.fromFn(async()=>{const h=await d.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},yn.None);if(!h.identical)return h.changes})}),this._register(wc((o,a)=>{if(!this._model.read(o)||this._position.get()===null)return;const c=a.add(this._instantiationService.createInstance(Mte,this._editor,this._position,this._text.map(u=>u.text),this._text.map(u=>u.shift),this._diff));e.addOverlayWidget(c),a.add(Lt(()=>e.removeOverlayWidget(c)))}))}};Ote=UD=TBe([C5(2,Tt),C5(3,vO),C5(4,Sr)],Ote);let Mte=class extends me{static{Pte=this}static{this.id=0}constructor(e,t,i,r,s,o){super(),this._editor=e,this._position=t,this._text=i,this._shift=r,this._diff=s,this._instantiationService=o,this.id=`InlineEditSideBySideContentWidget${Pte.id++}`,this.allowEditorOverflow=!1,this._nodes=qe("div.inlineEditSideBySide",void 0),this._scrollChanged=xa("editor.onDidScrollChange",this._editor.onDidScrollChange),this._previewEditor=this._register(this._instantiationService.createInstance(cf,this._nodes,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,scrollbar:{vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!1,handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off",wrappingIndent:"none",wrappingStrategy:void 0},{contributions:[],isSimpleWidget:!0},this._editor)),this._previewEditorObs=Jc(this._previewEditor),this._editorObs=Jc(this._editor),this._previewTextModel=this._register(this._instantiationService.createInstance(og,"",this._editor.getModel()?.getLanguageId()??Hl,og.DEFAULT_CREATION_OPTIONS,null)),this._setText=St(a=>{const l=this._text.read(a);l&&this._previewTextModel.setValue(l)}).recomputeInitiallyAndOnChange(this._store),this._decorations=St(this,a=>{this._setText.read(a);const l=this._position.read(a);if(!l)return{org:[],mod:[]};const c=this._diff.read(a);if(!c)return{org:[],mod:[]};const u=[],d=[];if(c.length===1&&c[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return{org:[],mod:[]};const h=this._shift.get(),f=g=>new $(g.startLineNumber+l.top-1,g.startColumn+h,g.endLineNumber+l.top-1,g.endColumn+h);for(const g of c)if(g.original.isEmpty||u.push({range:f(g.original.toInclusiveRange()),options:XN}),g.modified.isEmpty||d.push({range:g.modified.toInclusiveRange(),options:b9}),g.modified.isEmpty||g.original.isEmpty)g.original.isEmpty||u.push({range:f(g.original.toInclusiveRange()),options:sue}),g.modified.isEmpty||d.push({range:g.modified.toInclusiveRange(),options:iue});else for(const p of g.innerChanges||[])g.original.contains(p.originalRange.startLineNumber)&&u.push({range:f(p.originalRange),options:p.originalRange.isEmpty()?oue:kE}),g.modified.contains(p.modifiedRange.startLineNumber)&&d.push({range:p.modifiedRange,options:p.modifiedRange.isEmpty()?rue:y9});return{org:u,mod:d}}),this._originalDecorations=St(this,a=>this._decorations.read(a).org),this._modifiedDecorations=St(this,a=>this._decorations.read(a).mod),this._previewEditor.setModel(this._previewTextModel),this._register(this._editorObs.setDecorations(this._originalDecorations)),this._register(this._previewEditorObs.setDecorations(this._modifiedDecorations)),this._register(tn(a=>{const l=this._previewEditorObs.contentWidth.read(a),c=this._text.read(a).split(` -`).length-1,u=this._editor.getOption(67)*c;l<=0||this._previewEditor.layout({height:u,width:l})})),this._register(tn(a=>{this._position.read(a),this._editor.layoutOverlayWidget(this)})),this._register(tn(a=>{this._scrollChanged.read(a),this._position.read(a)&&this._editor.layoutOverlayWidget(this)}))}getId(){return this.id}getDomNode(){return this._nodes}getPosition(){const e=this._position.get();if(!e)return null;const t=this._editor.getLayoutInfo(),i=this._editor.getScrolledVisiblePosition(new he(e.top,1));if(!i)return null;const r=i.top-1,s=this._editor.getOffsetForColumn(e.left.lineNumber,e.left.column);return{preference:{left:t.contentLeft+s+10,top:r}}}};Mte=Pte=TBe([C5(5,Tt)],Mte);var yBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},B1=function(n,e){return function(t,i){e(t,i,n)}},jD;let Ml=class extends me{static{jD=this}static{this.ID="editor.contrib.inlineEditController"}static{this.inlineEditVisibleKey="inlineEditVisible"}static{this.inlineEditVisibleContext=new et(this.inlineEditVisibleKey,!1)}static{this.cursorAtInlineEditKey="cursorAtInlineEdit"}static{this.cursorAtInlineEditContext=new et(this.cursorAtInlineEditKey,!1)}static get(e){return e.getContribution(jD.ID)}constructor(e,t,i,r,s,o,a,l){super(),this.editor=e,this.instantiationService=t,this.contextKeyService=i,this.languageFeaturesService=r,this._commandService=s,this._configurationService=o,this._diffProviderFactoryService=a,this._modelService=l,this._isVisibleContext=jD.inlineEditVisibleContext.bindTo(this.contextKeyService),this._isCursorAtInlineEditContext=jD.cursorAtInlineEditContext.bindTo(this.contextKeyService),this._currentEdit=Sn(this,void 0),this._currentWidget=hl(this._currentEdit,g=>{const p=this._currentEdit.read(g);if(!p)return;const m=p.range.endLineNumber,_=p.range.endColumn,v=p.text.endsWith(` -`)&&!(p.range.startLineNumber===p.range.endLineNumber&&p.range.startColumn===p.range.endColumn)?p.text.slice(0,-1):p.text,y=new fR(m,[new U9(_,v,!1)]),C=p.range.startLineNumber===p.range.endLineNumber&&y.parts.length===1&&y.parts[0].lines.length===1,x=p.text==="";return!C&&!x?void 0:this.instantiationService.createInstance(Ite,this.editor,{ghostText:Hd(y),minReservedLineCount:Hd(0),targetTextModel:Hd(this.editor.getModel()??void 0),range:Hd(p.range)})}),this._isAccepting=Sn(this,!1),this._enabled=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).enabled),this._fontFamily=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).fontFamily);const c=xa("InlineEditController.modelContentChangedSignal",e.onDidChangeModelContent);this._register(tn(g=>{this._enabled.read(g)&&(c.read(g),!this._isAccepting.read(g)&&this.getInlineEdit(e,!0))}));const u=Bi(this,e.onDidChangeCursorPosition,()=>e.getPosition());this._register(tn(g=>{if(!this._enabled.read(g))return;const p=u.read(g);p&&this.checkCursorPosition(p)})),this._register(tn(g=>{const p=this._currentEdit.read(g);if(this._isCursorAtInlineEditContext.set(!1),!p){this._isVisibleContext.set(!1);return}this._isVisibleContext.set(!0);const m=e.getPosition();m&&this.checkCursorPosition(m)}));const d=xa("InlineEditController.editorBlurSignal",e.onDidBlurEditorWidget);this._register(tn(async g=>{this._enabled.read(g)&&(d.read(g),!(this._configurationService.getValue("editor.experimentalInlineEdit.keepOnBlur")||e.getOption(63).keepOnBlur)&&(this._currentRequestCts?.dispose(!0),this._currentRequestCts=void 0,await this.clear(!1)))}));const h=xa("InlineEditController.editorFocusSignal",e.onDidFocusEditorText);this._register(tn(g=>{this._enabled.read(g)&&(h.read(g),this.getInlineEdit(e,!0))}));const f=this._register(g3e());this._register(tn(g=>{const p=this._fontFamily.read(g);f.setStyle(p===""||p==="default"?"":` +`);this._originalModel.get().setValue(c),this._modifiedModel.get().setValue(u);const d=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return xW.fromFn(async()=>{const h=await d.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},yn.None);if(!h.identical)return h.changes})}),this._register(wc((o,a)=>{if(!this._model.read(o)||this._position.get()===null)return;const c=a.add(this._instantiationService.createInstance(Mte,this._editor,this._position,this._text.map(u=>u.text),this._text.map(u=>u.shift),this._diff));e.addOverlayWidget(c),a.add(Lt(()=>e.removeOverlayWidget(c)))}))}};Ote=UD=TBe([CF(2,Tt),CF(3,vO),CF(4,Sr)],Ote);let Mte=class extends me{static{Pte=this}static{this.id=0}constructor(e,t,i,r,s,o){super(),this._editor=e,this._position=t,this._text=i,this._shift=r,this._diff=s,this._instantiationService=o,this.id=`InlineEditSideBySideContentWidget${Pte.id++}`,this.allowEditorOverflow=!1,this._nodes=qe("div.inlineEditSideBySide",void 0),this._scrollChanged=xa("editor.onDidScrollChange",this._editor.onDidScrollChange),this._previewEditor=this._register(this._instantiationService.createInstance(cf,this._nodes,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,scrollbar:{vertical:"hidden",horizontal:"hidden",alwaysConsumeMouseWheel:!1,handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off",wrappingIndent:"none",wrappingStrategy:void 0},{contributions:[],isSimpleWidget:!0},this._editor)),this._previewEditorObs=Jc(this._previewEditor),this._editorObs=Jc(this._editor),this._previewTextModel=this._register(this._instantiationService.createInstance(og,"",this._editor.getModel()?.getLanguageId()??Hl,og.DEFAULT_CREATION_OPTIONS,null)),this._setText=St(a=>{const l=this._text.read(a);l&&this._previewTextModel.setValue(l)}).recomputeInitiallyAndOnChange(this._store),this._decorations=St(this,a=>{this._setText.read(a);const l=this._position.read(a);if(!l)return{org:[],mod:[]};const c=this._diff.read(a);if(!c)return{org:[],mod:[]};const u=[],d=[];if(c.length===1&&c[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return{org:[],mod:[]};const h=this._shift.get(),f=g=>new $(g.startLineNumber+l.top-1,g.startColumn+h,g.endLineNumber+l.top-1,g.endColumn+h);for(const g of c)if(g.original.isEmpty||u.push({range:f(g.original.toInclusiveRange()),options:XN}),g.modified.isEmpty||d.push({range:g.modified.toInclusiveRange(),options:b9}),g.modified.isEmpty||g.original.isEmpty)g.original.isEmpty||u.push({range:f(g.original.toInclusiveRange()),options:sue}),g.modified.isEmpty||d.push({range:g.modified.toInclusiveRange(),options:iue});else for(const p of g.innerChanges||[])g.original.contains(p.originalRange.startLineNumber)&&u.push({range:f(p.originalRange),options:p.originalRange.isEmpty()?oue:kE}),g.modified.contains(p.modifiedRange.startLineNumber)&&d.push({range:p.modifiedRange,options:p.modifiedRange.isEmpty()?rue:y9});return{org:u,mod:d}}),this._originalDecorations=St(this,a=>this._decorations.read(a).org),this._modifiedDecorations=St(this,a=>this._decorations.read(a).mod),this._previewEditor.setModel(this._previewTextModel),this._register(this._editorObs.setDecorations(this._originalDecorations)),this._register(this._previewEditorObs.setDecorations(this._modifiedDecorations)),this._register(tn(a=>{const l=this._previewEditorObs.contentWidth.read(a),c=this._text.read(a).split(` +`).length-1,u=this._editor.getOption(67)*c;l<=0||this._previewEditor.layout({height:u,width:l})})),this._register(tn(a=>{this._position.read(a),this._editor.layoutOverlayWidget(this)})),this._register(tn(a=>{this._scrollChanged.read(a),this._position.read(a)&&this._editor.layoutOverlayWidget(this)}))}getId(){return this.id}getDomNode(){return this._nodes}getPosition(){const e=this._position.get();if(!e)return null;const t=this._editor.getLayoutInfo(),i=this._editor.getScrolledVisiblePosition(new he(e.top,1));if(!i)return null;const r=i.top-1,s=this._editor.getOffsetForColumn(e.left.lineNumber,e.left.column);return{preference:{left:t.contentLeft+s+10,top:r}}}};Mte=Pte=TBe([CF(5,Tt)],Mte);var yBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},B1=function(n,e){return function(t,i){e(t,i,n)}},jD;let Ml=class extends me{static{jD=this}static{this.ID="editor.contrib.inlineEditController"}static{this.inlineEditVisibleKey="inlineEditVisible"}static{this.inlineEditVisibleContext=new et(this.inlineEditVisibleKey,!1)}static{this.cursorAtInlineEditKey="cursorAtInlineEdit"}static{this.cursorAtInlineEditContext=new et(this.cursorAtInlineEditKey,!1)}static get(e){return e.getContribution(jD.ID)}constructor(e,t,i,r,s,o,a,l){super(),this.editor=e,this.instantiationService=t,this.contextKeyService=i,this.languageFeaturesService=r,this._commandService=s,this._configurationService=o,this._diffProviderFactoryService=a,this._modelService=l,this._isVisibleContext=jD.inlineEditVisibleContext.bindTo(this.contextKeyService),this._isCursorAtInlineEditContext=jD.cursorAtInlineEditContext.bindTo(this.contextKeyService),this._currentEdit=kn(this,void 0),this._currentWidget=hl(this._currentEdit,g=>{const p=this._currentEdit.read(g);if(!p)return;const m=p.range.endLineNumber,_=p.range.endColumn,v=p.text.endsWith(` +`)&&!(p.range.startLineNumber===p.range.endLineNumber&&p.range.startColumn===p.range.endColumn)?p.text.slice(0,-1):p.text,y=new fR(m,[new U9(_,v,!1)]),C=p.range.startLineNumber===p.range.endLineNumber&&y.parts.length===1&&y.parts[0].lines.length===1,x=p.text==="";return!C&&!x?void 0:this.instantiationService.createInstance(Ite,this.editor,{ghostText:Hd(y),minReservedLineCount:Hd(0),targetTextModel:Hd(this.editor.getModel()??void 0),range:Hd(p.range)})}),this._isAccepting=kn(this,!1),this._enabled=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).enabled),this._fontFamily=Bi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(63).fontFamily);const c=xa("InlineEditController.modelContentChangedSignal",e.onDidChangeModelContent);this._register(tn(g=>{this._enabled.read(g)&&(c.read(g),!this._isAccepting.read(g)&&this.getInlineEdit(e,!0))}));const u=Bi(this,e.onDidChangeCursorPosition,()=>e.getPosition());this._register(tn(g=>{if(!this._enabled.read(g))return;const p=u.read(g);p&&this.checkCursorPosition(p)})),this._register(tn(g=>{const p=this._currentEdit.read(g);if(this._isCursorAtInlineEditContext.set(!1),!p){this._isVisibleContext.set(!1);return}this._isVisibleContext.set(!0);const m=e.getPosition();m&&this.checkCursorPosition(m)}));const d=xa("InlineEditController.editorBlurSignal",e.onDidBlurEditorWidget);this._register(tn(async g=>{this._enabled.read(g)&&(d.read(g),!(this._configurationService.getValue("editor.experimentalInlineEdit.keepOnBlur")||e.getOption(63).keepOnBlur)&&(this._currentRequestCts?.dispose(!0),this._currentRequestCts=void 0,await this.clear(!1)))}));const h=xa("InlineEditController.editorFocusSignal",e.onDidFocusEditorText);this._register(tn(g=>{this._enabled.read(g)&&(h.read(g),this.getInlineEdit(e,!0))}));const f=this._register(g3e());this._register(tn(g=>{const p=this._fontFamily.read(g);f.setStyle(p===""||p==="default"?"":` .monaco-editor .inline-edit-decoration, .monaco-editor .inline-edit-decoration-preview, .monaco-editor .inline-edit { font-family: ${p}; }`)})),this._register(new Ate(this.editor,this._currentWidget,this.instantiationService)),this._register(new Ote(this.editor,this._currentEdit,this.instantiationService,this._diffProviderFactoryService,this._modelService))}checkCursorPosition(e){if(!this._currentEdit){this._isCursorAtInlineEditContext.set(!1);return}const t=this._currentEdit.get();if(!t){this._isCursorAtInlineEditContext.set(!1);return}this._isCursorAtInlineEditContext.set($.containsPosition(t.range,e))}validateInlineEdit(e,t){if(t.text.includes(` `)&&t.range.startLineNumber!==t.range.endLineNumber&&t.range.startColumn!==t.range.endColumn){if(t.range.startColumn!==1)return!1;const r=t.range.endLineNumber,s=t.range.endColumn,o=e.getModel()?.getLineLength(r)??0;if(s!==o+1)return!1}return!0}async fetchInlineEdit(e,t){this._currentRequestCts&&this._currentRequestCts.dispose(!0);const i=e.getModel();if(!i)return;const r=i.getVersionId(),s=this.languageFeaturesService.inlineEditProvider.all(i);if(s.length===0)return;const o=s[0];this._currentRequestCts=new Kr;const a=this._currentRequestCts.token,l=t?H6.Automatic:H6.Invoke;if(t&&await wBt(50,a),a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==r)return;const u=await o.provideInlineEdit(i,{triggerKind:l},a);if(u&&!(a.isCancellationRequested||i.isDisposed()||i.getVersionId()!==r)&&this.validateInlineEdit(e,u))return u}async getInlineEdit(e,t){this._isCursorAtInlineEditContext.set(!1),await this.clear();const i=await this.fetchInlineEdit(e,t);i&&this._currentEdit.set(i,void 0)}async trigger(){await this.getInlineEdit(this.editor,!1)}async jumpBack(){this._jumpBackPosition&&(this.editor.setPosition(this._jumpBackPosition),this.editor.revealPositionInCenterIfOutsideViewport(this._jumpBackPosition))}async accept(){this._isAccepting.set(!0,void 0);const e=this._currentEdit.get();if(!e)return;let t=e.text;e.text.startsWith(` -`)&&(t=e.text.substring(1)),this.editor.pushUndoStop(),this.editor.executeEdits("acceptCurrent",[jr.replace($.lift(e.range),t)]),e.accepted&&await this._commandService.executeCommand(e.accepted.id,...e.accepted.arguments||[]).then(void 0,vs),this.freeEdit(e),qr(i=>{this._currentEdit.set(void 0,i),this._isAccepting.set(!1,i)})}jumpToCurrent(){this._jumpBackPosition=this.editor.getSelection()?.getStartPosition();const e=this._currentEdit.get();if(!e)return;const t=he.lift({lineNumber:e.range.startLineNumber,column:e.range.startColumn});this.editor.setPosition(t),this.editor.revealPositionInCenterIfOutsideViewport(t)}async clear(e=!0){const t=this._currentEdit.get();t&&t?.rejected&&e&&await this._commandService.executeCommand(t.rejected.id,...t.rejected.arguments||[]).then(void 0,vs),t&&this.freeEdit(t),this._currentEdit.set(void 0,void 0)}freeEdit(e){const t=this.editor.getModel();if(!t)return;const i=this.languageFeaturesService.inlineEditProvider.all(t);i.length!==0&&i[0].freeInlineEdit(e)}};Ml=jD=yBt([B1(1,Tt),B1(2,jt),B1(3,dt),B1(4,_r),B1(5,kn),B1(6,vO),B1(7,Sr)],Ml);function wBt(n,e){return new Promise(t=>{let i;const r=setTimeout(()=>{i&&i.dispose(),t()},n);e&&(i=e.onCancellationRequested(()=>{clearTimeout(r),i&&i.dispose(),t()}))})}let CBt=class extends ot{constructor(){super({id:hBt,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:Le.and(Q.writable,Ml.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:Le.and(Q.writable,Ml.inlineEditVisibleContext,Ml.cursorAtInlineEditContext)}],menuOpts:[{menuId:ce.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){await Ml.get(t)?.accept()}};class xBt extends ot{constructor(){const e=Le.and(Q.writable,Le.not(Ml.inlineEditVisibleKey));super({id:"editor.action.inlineEdit.trigger",label:"Trigger Inline Edit",alias:"Trigger Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e}})}async run(e,t){Ml.get(t)?.trigger()}}class SBt extends ot{constructor(){const e=Le.and(Q.writable,Ml.inlineEditVisibleContext,Le.not(Ml.cursorAtInlineEditKey));super({id:gBt,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:ce.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){Ml.get(t)?.jumpToCurrent()}}class kBt extends ot{constructor(){const e=Le.and(Q.writable,Ml.cursorAtInlineEditContext);super({id:pBt,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:ce.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){Ml.get(t)?.jumpBack()}}class EBt extends ot{constructor(){const e=Le.and(Q.writable,Ml.inlineEditVisibleContext);super({id:fBt,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:ce.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){await Ml.get(t)?.clear()}}Pe(CBt);Pe(EBt);Pe(SBt);Pe(kBt);Pe(xBt);Zn(Ml.ID,Ml,3);const LBt="editor.action.inlineEdits.accept",TBt="editor.action.inlineEdits.showPrevious",DBt="editor.action.inlineEdits.showNext",HE=new et("inlineEditsVisible",!1,w("inlineEditsVisible","Whether an inline edit is visible")),IBt=new et("inlineEditsIsPinned",!1,w("isPinned","Whether an inline edit is visible"));class Fte extends me{static{this.ID="editor.contrib.placeholderText"}constructor(e){super(),this._editor=e,this._editorObs=Jc(this._editor),this._placeholderText=this._editorObs.getOption(88),this._state=$u({owner:this,equalsFn:E8},t=>{const i=this._placeholderText.read(t);if(i&&this._editorObs.valueIsEmpty.read(t))return{placeholder:i}}),this._shouldViewBeAlive=ABt(this,t=>this._state.read(t)?.placeholder!==void 0),this._view=Jb((t,i)=>{if(!this._shouldViewBeAlive.read(t))return;const r=An("div.editorPlaceholder");i.add(tn(s=>{const o=this._state.read(s),a=o?.placeholder!==void 0;r.root.style.display=a?"block":"none",r.root.innerText=o?.placeholder??""})),i.add(tn(s=>{const o=this._editorObs.layoutInfo.read(s);r.root.style.left=`${o.contentLeft}px`,r.root.style.width=o.contentWidth-o.verticalScrollbarWidth+"px",r.root.style.top=`${this._editor.getTopForLineNumber(0)}px`})),i.add(tn(s=>{r.root.style.fontFamily=this._editorObs.getOption(49).read(s),r.root.style.fontSize=this._editorObs.getOption(52).read(s)+"px",r.root.style.lineHeight=this._editorObs.getOption(67).read(s)+"px"})),i.add(this._editorObs.createOverlayWidget({allowEditorOverflow:!1,minContentWidthInPx:Hd(0),position:Hd(null),domNode:r.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}}function ABt(n,e){return cO(n,(t,i)=>i===!0?!0:e(t))}var NBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},RBt=function(n,e){return function(t,i){e(t,i,n)}};class PBt{constructor(e,t,i){this.range=e,this.newLines=t,this.changes=i}}let Bte=class extends me{constructor(e,t,i,r){super(),this._editor=e,this._edit=t,this._userPrompt=i,this._instantiationService=r,this._editorObs=Jc(this._editor),this._elements=An("div.inline-edits-widget",{style:{position:"absolute",overflow:"visible",top:"0px",left:"0px"}},[An("div@editorContainer",{style:{position:"absolute",top:"0px",left:"0px",width:"500px",height:"500px"}},[An("div.toolbar@toolbar",{style:{position:"absolute",top:"-25px",left:"0px"}}),An("div.promptEditor@promptEditor",{style:{position:"absolute",top:"-25px",left:"80px",width:"300px",height:"22px"}}),An("div.preview@editor",{style:{position:"absolute",top:"0px",left:"0px"}})]),cx("svg",{style:{overflow:"visible",pointerEvents:"none"}},[cx("defs",[cx("linearGradient",{id:"Gradient2",x1:"0",y1:"0",x2:"1",y2:"0"},[cx("stop",{offset:"0%",class:"gradient-stop"}),cx("stop",{offset:"100%",class:"gradient-stop"})])]),cx("path@path",{d:"",fill:"url(#Gradient2)"})])]),this._previewTextModel=this._register(this._instantiationService.createInstance(og,"",Hl,og.DEFAULT_CREATION_OPTIONS,null)),this._setText=St(o=>{const a=this._edit.read(o);a&&this._previewTextModel.setValue(a.newLines.join(` -`))}).recomputeInitiallyAndOnChange(this._store),this._promptTextModel=this._register(this._instantiationService.createInstance(og,"",Hl,og.DEFAULT_CREATION_OPTIONS,null)),this._promptEditor=this._register(this._instantiationService.createInstance(cf,this._elements.promptEditor,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,placeholder:"Describe the change you want...",fontFamily:_8e},{contributions:Zy.getSomeEditorContributions([Gh.ID,Fte.ID,RE.ID]),isSimpleWidget:!0},this._editor)),this._previewEditor=this._register(this._instantiationService.createInstance(cf,this._elements.editor,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0},{contributions:[]},this._editor)),this._previewEditorObs=Jc(this._previewEditor),this._decorations=St(this,o=>{this._setText.read(o);const a=this._edit.read(o)?.changes;if(!a)return[];const l=[],c=[];if(a.length===1&&a[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return[];for(const u of a)if(u.original.isEmpty||l.push({range:u.original.toInclusiveRange(),options:XN}),u.modified.isEmpty||c.push({range:u.modified.toInclusiveRange(),options:b9}),u.modified.isEmpty||u.original.isEmpty)u.original.isEmpty||l.push({range:u.original.toInclusiveRange(),options:sue}),u.modified.isEmpty||c.push({range:u.modified.toInclusiveRange(),options:iue});else for(const d of u.innerChanges||[])u.original.contains(d.originalRange.startLineNumber)&&l.push({range:d.originalRange,options:d.originalRange.isEmpty()?oue:kE}),u.modified.contains(d.modifiedRange.startLineNumber)&&c.push({range:d.modifiedRange,options:d.modifiedRange.isEmpty()?rue:y9});return c}),this._layout1=St(this,o=>{const a=this._editor.getModel(),l=this._edit.read(o);if(!l)return null;const c=l.range;let u=0;for(let f=c.startLineNumber;f{const a=this._edit.read(o);if(!a)return null;const l=a.range,c=this._editorObs.scrollLeft.read(o),u=this._layout1.read(o).left+20-c,d=this._editor.getTopForLineNumber(l.startLineNumber)-this._editorObs.scrollTop.read(o),h=this._editor.getTopForLineNumber(l.endLineNumberExclusive)-this._editorObs.scrollTop.read(o),f=new HS(u,d),g=new HS(u,h),p=h-d,m=50,_=this._editor.getOption(67)*a.newLines.length,v=p-_,y=new HS(u+m,d+v/2),C=new HS(u+m,h-v/2);return{topCode:f,bottomCode:g,codeHeight:p,topEdit:y,bottomEdit:C,editHeight:_}});const s=St(this,o=>this._edit.read(o)!==void 0||this._userPrompt.read(o)!==void 0);this._register(J_(this._elements.root,{display:St(this,o=>s.read(o)?"block":"none")})),this._register(PS(this._editor.getDomNode(),this._elements.root)),this._register(Jc(e).createOverlayWidget({domNode:this._elements.root,position:Hd(null),allowEditorOverflow:!1,minContentWidthInPx:St(o=>{const a=this._layout1.read(o)?.left;if(a===void 0)return 0;const l=this._previewEditorObs.contentWidth.read(o);return a+l})})),this._previewEditor.setModel(this._previewTextModel),this._register(this._previewEditorObs.setDecorations(this._decorations)),this._register(tn(o=>{const a=this._layout.read(o);if(!a)return;const{topCode:l,bottomCode:c,topEdit:u,bottomEdit:d,editHeight:h}=a,f=10,g=0,p=40,m=new MBt().moveTo(l).lineTo(l.deltaX(f)).curveTo(l.deltaX(f+p),u.deltaX(-p-g),u.deltaX(-g)).lineTo(u).lineTo(d).lineTo(d.deltaX(-g)).curveTo(d.deltaX(-p-g),c.deltaX(f+p),c.deltaX(f)).lineTo(c).build();this._elements.path.setAttribute("d",m),this._elements.editorContainer.style.top=`${u.y}px`,this._elements.editorContainer.style.left=`${u.x}px`,this._elements.editorContainer.style.height=`${h}px`;const _=this._previewEditorObs.contentWidth.read(o);this._previewEditor.layout({height:h,width:_})})),this._promptEditor.setModel(this._promptTextModel),this._promptEditor.layout(),this._register(FBt(OBt(this._userPrompt,o=>o??"",o=>o),Jc(this._promptEditor).value)),this._register(tn(o=>{const a=Jc(this._promptEditor).isFocused.read(o);this._elements.root.classList.toggle("focused",a)}))}};Bte=NBt([RBt(3,Tt)],Bte);function OBt(n,e,t){return oO(void 0,i=>e(n.read(i)),(i,r)=>n.set(t(i),r))}class HS{constructor(e,t){this.x=e,this.y=t}deltaX(e){return new HS(this.x+e,this.y)}}class MBt{constructor(){this._data=""}moveTo(e){return this._data+=`M ${e.x} ${e.y} `,this}lineTo(e){return this._data+=`L ${e.x} ${e.y} `,this}curveTo(e,t,i){return this._data+=`C ${e.x} ${e.y} ${t.x} ${t.y} ${i.x} ${i.y} `,this}build(){return this._data}}function FBt(n,e){const t=new ke;return t.add(tn(i=>{const r=n.read(i);e.set(r,void 0)})),t.add(tn(i=>{const r=e.read(i);n.set(r,void 0)})),t}var BBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},oK=function(n,e){return function(t,i){e(t,i,n)}},qD;let $te=class extends me{static{qD=this}static{this._modelId=0}static _createUniqueUri(){return Pt.from({scheme:"inline-edits",path:new Date().toString()+String(qD._modelId++)})}constructor(e,t,i,r,s,o,a){super(),this.textModel=e,this._textModelVersionId=t,this._selection=i,this._debounceValue=r,this.languageFeaturesService=s,this._diffProviderFactoryService=o,this._modelService=a,this._forceUpdateExplicitlySignal=r2(this),this._selectedInlineCompletionId=Sn(this,void 0),this._isActive=Sn(this,!1),this._originalModel=hl(()=>this._modelService.createModel("",null,qD._createUniqueUri())).keepObserved(this._store),this._modifiedModel=hl(()=>this._modelService.createModel("",null,qD._createUniqueUri())).keepObserved(this._store),this._pinnedRange=new WBt(this.textModel,this._textModelVersionId),this.isPinned=this._pinnedRange.range.map(l=>!!l),this.userPrompt=Sn(this,void 0),this.inlineEdit=St(this,l=>this._inlineEdit.read(l)?.promiseResult.read(l)?.data),this._inlineEdit=St(this,l=>{const c=this.selectedInlineEdit.read(l);if(!c)return;const u=c.inlineCompletion.range;if(c.inlineCompletion.insertText.trim()==="")return;let d=c.inlineCompletion.insertText.split(/\r\n|\r|\n/);function h(m){const _=m[0].match(/^\s*/)?.[0]??"";return m.map(v=>v.replace(new RegExp("^"+_),""))}d=h(d);let g=this.textModel.getValueInRange(u).split(/\r\n|\r|\n/);g=h(g),this._originalModel.get().setValue(g.join(` +`)&&(t=e.text.substring(1)),this.editor.pushUndoStop(),this.editor.executeEdits("acceptCurrent",[jr.replace($.lift(e.range),t)]),e.accepted&&await this._commandService.executeCommand(e.accepted.id,...e.accepted.arguments||[]).then(void 0,vs),this.freeEdit(e),qr(i=>{this._currentEdit.set(void 0,i),this._isAccepting.set(!1,i)})}jumpToCurrent(){this._jumpBackPosition=this.editor.getSelection()?.getStartPosition();const e=this._currentEdit.get();if(!e)return;const t=he.lift({lineNumber:e.range.startLineNumber,column:e.range.startColumn});this.editor.setPosition(t),this.editor.revealPositionInCenterIfOutsideViewport(t)}async clear(e=!0){const t=this._currentEdit.get();t&&t?.rejected&&e&&await this._commandService.executeCommand(t.rejected.id,...t.rejected.arguments||[]).then(void 0,vs),t&&this.freeEdit(t),this._currentEdit.set(void 0,void 0)}freeEdit(e){const t=this.editor.getModel();if(!t)return;const i=this.languageFeaturesService.inlineEditProvider.all(t);i.length!==0&&i[0].freeInlineEdit(e)}};Ml=jD=yBt([B1(1,Tt),B1(2,jt),B1(3,dt),B1(4,_r),B1(5,En),B1(6,vO),B1(7,Sr)],Ml);function wBt(n,e){return new Promise(t=>{let i;const r=setTimeout(()=>{i&&i.dispose(),t()},n);e&&(i=e.onCancellationRequested(()=>{clearTimeout(r),i&&i.dispose(),t()}))})}let CBt=class extends ot{constructor(){super({id:hBt,label:"Accept Inline Edit",alias:"Accept Inline Edit",precondition:Le.and(Q.writable,Ml.inlineEditVisibleContext),kbOpts:[{weight:101,primary:2,kbExpr:Le.and(Q.writable,Ml.inlineEditVisibleContext,Ml.cursorAtInlineEditContext)}],menuOpts:[{menuId:ce.InlineEditToolbar,title:"Accept",group:"primary",order:1}]})}async run(e,t){await Ml.get(t)?.accept()}};class xBt extends ot{constructor(){const e=Le.and(Q.writable,Le.not(Ml.inlineEditVisibleKey));super({id:"editor.action.inlineEdit.trigger",label:"Trigger Inline Edit",alias:"Trigger Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e}})}async run(e,t){Ml.get(t)?.trigger()}}class SBt extends ot{constructor(){const e=Le.and(Q.writable,Ml.inlineEditVisibleContext,Le.not(Ml.cursorAtInlineEditKey));super({id:gBt,label:"Jump to Inline Edit",alias:"Jump to Inline Edit",precondition:e,kbOpts:{weight:101,primary:2646,kbExpr:e},menuOpts:[{menuId:ce.InlineEditToolbar,title:"Jump To Edit",group:"primary",order:3,when:e}]})}async run(e,t){Ml.get(t)?.jumpToCurrent()}}class kBt extends ot{constructor(){const e=Le.and(Q.writable,Ml.cursorAtInlineEditContext);super({id:pBt,label:"Jump Back from Inline Edit",alias:"Jump Back from Inline Edit",precondition:e,kbOpts:{weight:110,primary:2646,kbExpr:e},menuOpts:[{menuId:ce.InlineEditToolbar,title:"Jump Back",group:"primary",order:3,when:e}]})}async run(e,t){Ml.get(t)?.jumpBack()}}class EBt extends ot{constructor(){const e=Le.and(Q.writable,Ml.inlineEditVisibleContext);super({id:fBt,label:"Reject Inline Edit",alias:"Reject Inline Edit",precondition:e,kbOpts:{weight:100,primary:9,kbExpr:e},menuOpts:[{menuId:ce.InlineEditToolbar,title:"Reject",group:"secondary",order:2}]})}async run(e,t){await Ml.get(t)?.clear()}}Pe(CBt);Pe(EBt);Pe(SBt);Pe(kBt);Pe(xBt);Zn(Ml.ID,Ml,3);const LBt="editor.action.inlineEdits.accept",TBt="editor.action.inlineEdits.showPrevious",DBt="editor.action.inlineEdits.showNext",HE=new et("inlineEditsVisible",!1,w("inlineEditsVisible","Whether an inline edit is visible")),IBt=new et("inlineEditsIsPinned",!1,w("isPinned","Whether an inline edit is visible"));class Fte extends me{static{this.ID="editor.contrib.placeholderText"}constructor(e){super(),this._editor=e,this._editorObs=Jc(this._editor),this._placeholderText=this._editorObs.getOption(88),this._state=$u({owner:this,equalsFn:E8},t=>{const i=this._placeholderText.read(t);if(i&&this._editorObs.valueIsEmpty.read(t))return{placeholder:i}}),this._shouldViewBeAlive=ABt(this,t=>this._state.read(t)?.placeholder!==void 0),this._view=Jb((t,i)=>{if(!this._shouldViewBeAlive.read(t))return;const r=An("div.editorPlaceholder");i.add(tn(s=>{const o=this._state.read(s),a=o?.placeholder!==void 0;r.root.style.display=a?"block":"none",r.root.innerText=o?.placeholder??""})),i.add(tn(s=>{const o=this._editorObs.layoutInfo.read(s);r.root.style.left=`${o.contentLeft}px`,r.root.style.width=o.contentWidth-o.verticalScrollbarWidth+"px",r.root.style.top=`${this._editor.getTopForLineNumber(0)}px`})),i.add(tn(s=>{r.root.style.fontFamily=this._editorObs.getOption(49).read(s),r.root.style.fontSize=this._editorObs.getOption(52).read(s)+"px",r.root.style.lineHeight=this._editorObs.getOption(67).read(s)+"px"})),i.add(this._editorObs.createOverlayWidget({allowEditorOverflow:!1,minContentWidthInPx:Hd(0),position:Hd(null),domNode:r.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}}function ABt(n,e){return cO(n,(t,i)=>i===!0?!0:e(t))}var NBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},RBt=function(n,e){return function(t,i){e(t,i,n)}};class PBt{constructor(e,t,i){this.range=e,this.newLines=t,this.changes=i}}let Bte=class extends me{constructor(e,t,i,r){super(),this._editor=e,this._edit=t,this._userPrompt=i,this._instantiationService=r,this._editorObs=Jc(this._editor),this._elements=An("div.inline-edits-widget",{style:{position:"absolute",overflow:"visible",top:"0px",left:"0px"}},[An("div@editorContainer",{style:{position:"absolute",top:"0px",left:"0px",width:"500px",height:"500px"}},[An("div.toolbar@toolbar",{style:{position:"absolute",top:"-25px",left:"0px"}}),An("div.promptEditor@promptEditor",{style:{position:"absolute",top:"-25px",left:"80px",width:"300px",height:"22px"}}),An("div.preview@editor",{style:{position:"absolute",top:"0px",left:"0px"}})]),cx("svg",{style:{overflow:"visible",pointerEvents:"none"}},[cx("defs",[cx("linearGradient",{id:"Gradient2",x1:"0",y1:"0",x2:"1",y2:"0"},[cx("stop",{offset:"0%",class:"gradient-stop"}),cx("stop",{offset:"100%",class:"gradient-stop"})])]),cx("path@path",{d:"",fill:"url(#Gradient2)"})])]),this._previewTextModel=this._register(this._instantiationService.createInstance(og,"",Hl,og.DEFAULT_CREATION_OPTIONS,null)),this._setText=St(o=>{const a=this._edit.read(o);a&&this._previewTextModel.setValue(a.newLines.join(` +`))}).recomputeInitiallyAndOnChange(this._store),this._promptTextModel=this._register(this._instantiationService.createInstance(og,"",Hl,og.DEFAULT_CREATION_OPTIONS,null)),this._promptEditor=this._register(this._instantiationService.createInstance(cf,this._elements.promptEditor,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,placeholder:"Describe the change you want...",fontFamily:_8e},{contributions:Zy.getSomeEditorContributions([Gh.ID,Fte.ID,RE.ID]),isSimpleWidget:!0},this._editor)),this._previewEditor=this._register(this._instantiationService.createInstance(cf,this._elements.editor,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0},{contributions:[]},this._editor)),this._previewEditorObs=Jc(this._previewEditor),this._decorations=St(this,o=>{this._setText.read(o);const a=this._edit.read(o)?.changes;if(!a)return[];const l=[],c=[];if(a.length===1&&a[0].innerChanges[0].modifiedRange.equalsRange(this._previewTextModel.getFullModelRange()))return[];for(const u of a)if(u.original.isEmpty||l.push({range:u.original.toInclusiveRange(),options:XN}),u.modified.isEmpty||c.push({range:u.modified.toInclusiveRange(),options:b9}),u.modified.isEmpty||u.original.isEmpty)u.original.isEmpty||l.push({range:u.original.toInclusiveRange(),options:sue}),u.modified.isEmpty||c.push({range:u.modified.toInclusiveRange(),options:iue});else for(const d of u.innerChanges||[])u.original.contains(d.originalRange.startLineNumber)&&l.push({range:d.originalRange,options:d.originalRange.isEmpty()?oue:kE}),u.modified.contains(d.modifiedRange.startLineNumber)&&c.push({range:d.modifiedRange,options:d.modifiedRange.isEmpty()?rue:y9});return c}),this._layout1=St(this,o=>{const a=this._editor.getModel(),l=this._edit.read(o);if(!l)return null;const c=l.range;let u=0;for(let f=c.startLineNumber;f{const a=this._edit.read(o);if(!a)return null;const l=a.range,c=this._editorObs.scrollLeft.read(o),u=this._layout1.read(o).left+20-c,d=this._editor.getTopForLineNumber(l.startLineNumber)-this._editorObs.scrollTop.read(o),h=this._editor.getTopForLineNumber(l.endLineNumberExclusive)-this._editorObs.scrollTop.read(o),f=new HS(u,d),g=new HS(u,h),p=h-d,m=50,_=this._editor.getOption(67)*a.newLines.length,v=p-_,y=new HS(u+m,d+v/2),C=new HS(u+m,h-v/2);return{topCode:f,bottomCode:g,codeHeight:p,topEdit:y,bottomEdit:C,editHeight:_}});const s=St(this,o=>this._edit.read(o)!==void 0||this._userPrompt.read(o)!==void 0);this._register(J_(this._elements.root,{display:St(this,o=>s.read(o)?"block":"none")})),this._register(PS(this._editor.getDomNode(),this._elements.root)),this._register(Jc(e).createOverlayWidget({domNode:this._elements.root,position:Hd(null),allowEditorOverflow:!1,minContentWidthInPx:St(o=>{const a=this._layout1.read(o)?.left;if(a===void 0)return 0;const l=this._previewEditorObs.contentWidth.read(o);return a+l})})),this._previewEditor.setModel(this._previewTextModel),this._register(this._previewEditorObs.setDecorations(this._decorations)),this._register(tn(o=>{const a=this._layout.read(o);if(!a)return;const{topCode:l,bottomCode:c,topEdit:u,bottomEdit:d,editHeight:h}=a,f=10,g=0,p=40,m=new MBt().moveTo(l).lineTo(l.deltaX(f)).curveTo(l.deltaX(f+p),u.deltaX(-p-g),u.deltaX(-g)).lineTo(u).lineTo(d).lineTo(d.deltaX(-g)).curveTo(d.deltaX(-p-g),c.deltaX(f+p),c.deltaX(f)).lineTo(c).build();this._elements.path.setAttribute("d",m),this._elements.editorContainer.style.top=`${u.y}px`,this._elements.editorContainer.style.left=`${u.x}px`,this._elements.editorContainer.style.height=`${h}px`;const _=this._previewEditorObs.contentWidth.read(o);this._previewEditor.layout({height:h,width:_})})),this._promptEditor.setModel(this._promptTextModel),this._promptEditor.layout(),this._register(FBt(OBt(this._userPrompt,o=>o??"",o=>o),Jc(this._promptEditor).value)),this._register(tn(o=>{const a=Jc(this._promptEditor).isFocused.read(o);this._elements.root.classList.toggle("focused",a)}))}};Bte=NBt([RBt(3,Tt)],Bte);function OBt(n,e,t){return oO(void 0,i=>e(n.read(i)),(i,r)=>n.set(t(i),r))}class HS{constructor(e,t){this.x=e,this.y=t}deltaX(e){return new HS(this.x+e,this.y)}}class MBt{constructor(){this._data=""}moveTo(e){return this._data+=`M ${e.x} ${e.y} `,this}lineTo(e){return this._data+=`L ${e.x} ${e.y} `,this}curveTo(e,t,i){return this._data+=`C ${e.x} ${e.y} ${t.x} ${t.y} ${i.x} ${i.y} `,this}build(){return this._data}}function FBt(n,e){const t=new ke;return t.add(tn(i=>{const r=n.read(i);e.set(r,void 0)})),t.add(tn(i=>{const r=e.read(i);n.set(r,void 0)})),t}var BBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},oK=function(n,e){return function(t,i){e(t,i,n)}},qD;let $te=class extends me{static{qD=this}static{this._modelId=0}static _createUniqueUri(){return Pt.from({scheme:"inline-edits",path:new Date().toString()+String(qD._modelId++)})}constructor(e,t,i,r,s,o,a){super(),this.textModel=e,this._textModelVersionId=t,this._selection=i,this._debounceValue=r,this.languageFeaturesService=s,this._diffProviderFactoryService=o,this._modelService=a,this._forceUpdateExplicitlySignal=r2(this),this._selectedInlineCompletionId=kn(this,void 0),this._isActive=kn(this,!1),this._originalModel=hl(()=>this._modelService.createModel("",null,qD._createUniqueUri())).keepObserved(this._store),this._modifiedModel=hl(()=>this._modelService.createModel("",null,qD._createUniqueUri())).keepObserved(this._store),this._pinnedRange=new WBt(this.textModel,this._textModelVersionId),this.isPinned=this._pinnedRange.range.map(l=>!!l),this.userPrompt=kn(this,void 0),this.inlineEdit=St(this,l=>this._inlineEdit.read(l)?.promiseResult.read(l)?.data),this._inlineEdit=St(this,l=>{const c=this.selectedInlineEdit.read(l);if(!c)return;const u=c.inlineCompletion.range;if(c.inlineCompletion.insertText.trim()==="")return;let d=c.inlineCompletion.insertText.split(/\r\n|\r|\n/);function h(m){const _=m[0].match(/^\s*/)?.[0]??"";return m.map(v=>v.replace(new RegExp("^"+_),""))}d=h(d);let g=this.textModel.getValueInRange(u).split(/\r\n|\r|\n/);g=h(g),this._originalModel.get().setValue(g.join(` `)),this._modifiedModel.get().setValue(d.join(` -`));const p=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return xW.fromFn(async()=>{const m=await p.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},yn.None);if(!m.identical)return new PBt(gn.fromRangeInclusive(u),h(d),m.changes)})}),this._fetchStore=this._register(new ke),this._inlineEditsFetchResult=TN(this,void 0),this._inlineEdits=$u({owner:this,equalsFn:E8},l=>this._inlineEditsFetchResult.read(l)?.completions.map(c=>new $Bt(c))??[]),this._fetchInlineEditsPromise=u5e({owner:this,createEmptyChangeSummary:()=>({inlineCompletionTriggerKind:gg.Automatic}),handleChange:(l,c)=>(l.didChange(this._forceUpdateExplicitlySignal)&&(c.inlineCompletionTriggerKind=gg.Explicit),!0)},async(l,c)=>{this._fetchStore.clear(),this._forceUpdateExplicitlySignal.read(l),this._textModelVersionId.read(l);function u(p,m){return m(p)}const d=this._pinnedRange.range.read(l)??u(this._selection.read(l),p=>p.isEmpty()?void 0:p);if(!d){this._inlineEditsFetchResult.set(void 0,void 0),this.userPrompt.set(void 0,void 0);return}const h={triggerKind:c.inlineCompletionTriggerKind,selectedSuggestionInfo:void 0,userPrompt:this.userPrompt.read(l)},f=lZ(this._fetchStore);await Y_(200,f);const g=await uBe(this.languageFeaturesService.inlineCompletionsProvider,d,this.textModel,h,f);f.isCancellationRequested||this._inlineEditsFetchResult.set(g,void 0)}),this._filteredInlineEditItems=$u({owner:this,equalsFn:k8()},l=>this._inlineEdits.read(l)),this.selectedInlineCompletionIndex=St(this,l=>{const c=this._selectedInlineCompletionId.read(l),u=this._filteredInlineEditItems.read(l),d=this._selectedInlineCompletionId===void 0?-1:u.findIndex(h=>h.semanticId===c);return d===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):d}),this.selectedInlineEdit=St(this,l=>{const c=this._filteredInlineEditItems.read(l),u=this.selectedInlineCompletionIndex.read(l);return c[u]}),this._register(s2(this._fetchInlineEditsPromise))}async triggerExplicitly(e){Fw(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineEditsPromise.get()}stop(e){Fw(e,t=>{this.userPrompt.set(void 0,t),this._isActive.set(!1,t),this._inlineEditsFetchResult.set(void 0,t),this._pinnedRange.setRange(void 0,t)})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._filteredInlineEditItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(e){if(e.getModel()!==this.textModel)throw new fi;const t=this.selectedInlineEdit.get();t&&(e.pushUndoStop(),e.executeEdits("inlineSuggestion.accept",[t.inlineCompletion.toSingleTextEdit().toSingleEditOperation()]),this.stop())}};$te=qD=BBt([oK(4,dt),oK(5,vO),oK(6,Sr)],$te);class $Bt{constructor(e){this.inlineCompletion=e,this.semanticId=this.inlineCompletion.hash()}}class WBt extends me{constructor(e,t){super(),this._textModel=e,this._versionId=t,this._decorations=Sn(this,[]),this.range=St(this,i=>{this._versionId.read(i);const r=this._decorations.read(i)[0];return r?this._textModel.getDecorationRange(r)??null:null}),this._register(Lt(()=>{this._textModel.deltaDecorations(this._decorations.get(),[])}))}setRange(e,t){this._decorations.set(this._textModel.deltaDecorations(this._decorations.get(),e?[{range:e,options:{description:"trackedRange"}}]:[]),t)}}var HBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},KT=function(n,e){return function(t,i){e(t,i,n)}},Wte;let n0=class extends me{static{Wte=this}static{this.ID="editor.contrib.inlineEditsController"}static get(e){return e.getContribution(Wte.ID)}constructor(e,t,i,r,s,o){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._debounceService=r,this._languageFeaturesService=s,this._configurationService=o,this._enabled=mPt("editor.inlineEdits.enabled",!1,this._configurationService),this._editorObs=Jc(this.editor),this._selection=St(this,a=>this._editorObs.cursorSelection.read(a)??new yt(1,1,1,1)),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineEditsDebounce",{min:50,max:50}),this.model=hl(this,a=>{if(!this._enabled.read(a)||this._editorObs.isReadonly.read(a))return;const l=this._editorObs.model.read(a);return l?this._instantiationService.createInstance(Yc($te,a),l,this._editorObs.versionId,this._selection,this._debounceValue):void 0}),this._hadInlineEdit=cO(this,(a,l)=>l||this.model.read(a)?.inlineEdit.read(a)!==void 0),this._widget=hl(this,a=>{if(this._hadInlineEdit.read(a))return this._instantiationService.createInstance(Yc(Bte,a),this.editor,this.model.map((l,c)=>l?.inlineEdit.read(c)),VBt(l=>this.model.read(l)?.userPrompt??Sn("empty","")))}),this._register(Rf(HE,this._contextKeyService,a=>!!this.model.read(a)?.inlineEdit.read(a))),this._register(Rf(IBt,this._contextKeyService,a=>!!this.model.read(a)?.isPinned.read(a))),this.model.recomputeInitiallyAndOnChange(this._store),this._widget.recomputeInitiallyAndOnChange(this._store)}};n0=Wte=HBt([KT(1,Tt),KT(2,jt),KT(3,cd),KT(4,dt),KT(5,kn)],n0);function VBt(n){return oO(void 0,e=>n(e).read(e),(e,t)=>{n(void 0).set(e,t)})}function AO(n){return{label:n.value,alias:n.original}}class bde extends ot{static{this.ID=DBt}constructor(){super({id:bde.ID,...AO(Gt("action.inlineEdits.showNext","Show Next Inline Edit")),precondition:Le.and(Q.writable,HE),kbOpts:{weight:100,primary:606}})}async run(e,t){n0.get(t)?.model.get()?.next()}}class yde extends ot{static{this.ID=TBt}constructor(){super({id:yde.ID,...AO(Gt("action.inlineEdits.showPrevious","Show Previous Inline Edit")),precondition:Le.and(Q.writable,HE),kbOpts:{weight:100,primary:604}})}async run(e,t){n0.get(t)?.model.get()?.previous()}}class zBt extends ot{constructor(){super({id:"editor.action.inlineEdits.trigger",...AO(Gt("action.inlineEdits.trigger","Trigger Inline Edit")),precondition:Q.writable})}async run(e,t){const i=n0.get(t);await c5e(async r=>{await i?.model.get()?.triggerExplicitly(r)})}}class UBt extends ot{constructor(){super({id:LBt,...AO(Gt("action.inlineEdits.accept","Accept Inline Edit")),precondition:HE,menuOpts:{menuId:ce.InlineEditsActions,title:w("inlineEditsActions","Accept Inline Edit"),group:"primary",order:1,icon:ze.check},kbOpts:{primary:2058,weight:2e4,kbExpr:HE}})}async run(e,t){t instanceof cf&&(t=t.getParentEditor());const i=n0.get(t);i&&(i.model.get()?.accept(i.editor),i.editor.focus())}}class wde extends ot{static{this.ID="editor.action.inlineEdits.hide"}constructor(){super({id:wde.ID,...AO(Gt("action.inlineEdits.hide","Hide Inline Edit")),precondition:HE,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=n0.get(t);qr(r=>{i?.model.get()?.stop(r)})}}Zn(n0.ID,n0,3);Pe(zBt);Pe(bde);Pe(yde);Pe(UBt);Pe(wde);const Xw={Visible:new et("parameterHintsVisible",!1),MultipleSignatures:new et("parameterHintsMultipleSignatures",!1)};async function DBe(n,e,t,i,r){const s=n.ordered(e);for(const o of s)try{const a=await o.provideSignatureHelp(e,t,r,i);if(a)return a}catch(a){vs(a)}}Un.registerCommand("_executeSignatureHelpProvider",async(n,...e)=>{const[t,i,r]=e;oi(Pt.isUri(t)),oi(he.isIPosition(i)),oi(typeof r=="string"||!r);const s=n.get(dt),o=await n.get(Nc).createModelReference(t);try{const a=await DBe(s.signatureHelpProvider,o.object.textEditorModel,he.lift(i),{triggerKind:$p.Invoke,isRetrigger:!1,triggerCharacter:r},yn.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{o.dispose()}});var ov;(function(n){n.Default={type:0};class e{constructor(r,s){this.request=r,this.previouslyActiveHints=s,this.type=2}}n.Pending=e;class t{constructor(r){this.hints=r,this.type=1}}n.Active=t})(ov||(ov={}));class Cde extends me{static{this.DEFAULT_DELAY=120}constructor(e,t,i=Cde.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new fe),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=ov.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new To),this.triggerChars=new n8,this.retriggerChars=new n8,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new Qd(i),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(r=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(r=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(r=>this.onCursorChange(r))),this._register(this.editor.onDidChangeModelContent(r=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(r=>this.onDidType(r))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(e){this._state.type===2&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=ov.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){const i=this.editor.getModel();if(!i||!this.providers.has(i))return;const r=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(r),t).catch(rn)}next(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t%e===e-1,r=this.editor.getOption(86).cycle;if((e<2||i)&&!r){this.cancel();return}this.updateActiveSignature(i&&r?0:t+1)}previous(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t===0,r=this.editor.getOption(86).cycle;if((e<2||i)&&!r){this.cancel();return}this.updateActiveSignature(i&&r?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new ov.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){const t=this.state.type===1||this.state.type===2,i=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;const r=this._pendingTriggers.reduce(jBt);this._pendingTriggers=[];const s={triggerKind:r.triggerKind,triggerCharacter:r.triggerCharacter,isRetrigger:t,activeSignatureHelp:i};if(!this.editor.hasModel())return!1;const o=this.editor.getModel(),a=this.editor.getPosition();this.state=new ov.Pending(ko(l=>DBe(this.providers,o,a,s,l)),i);try{const l=await this.state.request;return e!==this.triggerId?(l?.dispose(),!1):!l||!l.value.signatures||l.value.signatures.length===0?(l?.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new ov.Active(l.value),this._lastSignatureHelpResult.value=l,this._onChangedHints.fire(this.state.hints),!0)}catch(l){return e===this.triggerId&&(this.state=ov.Default),rn(l),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return this.state.type===1||this.state.type===2||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const e=this.editor.getModel();if(e)for(const t of this.providers.ordered(e)){for(const i of t.signatureHelpTriggerCharacters||[])if(i.length){const r=i.charCodeAt(0);this.triggerChars.add(r),this.retriggerChars.add(r)}for(const i of t.signatureHelpRetriggerCharacters||[])i.length&&this.retriggerChars.add(i.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;const t=e.length-1,i=e.charCodeAt(t);(this.triggerChars.has(i)||this.isTriggered&&this.retriggerChars.has(i))&&this.trigger({triggerKind:$p.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:$p.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:$p.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(86).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}function jBt(n,e){switch(e.triggerKind){case $p.Invoke:return e;case $p.ContentChange:return n;case $p.TriggerCharacter:default:return e}}var qBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},T3=function(n,e){return function(t,i){e(t,i,n)}},Hte;const Lu=qe,KBt=kr("parameter-hints-next",ze.chevronDown,w("parameterHintsNextIcon","Icon for show next parameter hint.")),GBt=kr("parameter-hints-previous",ze.chevronUp,w("parameterHintsPreviousIcon","Icon for show previous parameter hint."));let Vte=class extends me{static{Hte=this}static{this.ID="editor.widget.parameterHintsWidget"}constructor(e,t,i,r,s,o){super(),this.editor=e,this.model=t,this.telemetryService=o,this.renderDisposeables=this._register(new ke),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new Q_({editor:e},s,r)),this.keyVisible=Xw.Visible.bindTo(i),this.keyMultipleSignatures=Xw.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=Lu(".editor-widget.parameter-hints-widget"),t=Ne(e,Lu(".phwrapper"));t.tabIndex=-1;const i=Ne(t,Lu(".controls")),r=Ne(i,Lu(".button"+zt.asCSSSelector(GBt))),s=Ne(i,Lu(".overloads")),o=Ne(i,Lu(".button"+zt.asCSSSelector(KBt)));this._register(Ce(r,"click",h=>{Hn.stop(h),this.previous()})),this._register(Ce(o,"click",h=>{Hn.stop(h),this.next()}));const a=Lu(".body"),l=new tO(a,{alwaysConsumeMouseWheel:!0});this._register(l),t.appendChild(l.getDomNode());const c=Ne(a,Lu(".signature")),u=Ne(a,Lu(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:c,overloads:s,docs:u,scrollbar:l},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(h=>{this.visible&&this.editor.layoutContentWidget(this)}));const d=()=>{if(!this.domNodes)return;const h=this.editor.getOption(50),f=this.domNodes.element;f.style.fontSize=`${h.fontSize}px`,f.style.lineHeight=`${h.lineHeight/h.fontSize}`,f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",h.fontFamily),f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",Wl.fontFamily)};d(),this._register(Ge.chain(this.editor.onDidChangeConfiguration.bind(this.editor),h=>h.filter(f=>f.hasChanged(50)))(d)),this._register(this.editor.onDidLayoutChange(h=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{this.domNodes?.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,this.domNodes?.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){if(this.renderDisposeables.clear(),!this.domNodes)return;const t=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const i=e.signatures[e.activeSignature];if(!i)return;const r=Ne(this.domNodes.signature,Lu(".code")),s=i.parameters.length>0,o=i.activeParameter??e.activeParameter;if(s)this.renderParameters(r,i,o);else{const c=Ne(r,Lu("span"));c.textContent=i.label}const a=i.parameters[o];if(a?.documentation){const c=Lu("span.documentation");if(typeof a.documentation=="string")c.textContent=a.documentation;else{const u=this.renderMarkdownDocs(a.documentation);c.appendChild(u.element)}Ne(this.domNodes.docs,Lu("p",{},c))}if(i.documentation!==void 0)if(typeof i.documentation=="string")Ne(this.domNodes.docs,Lu("p",{},i.documentation));else{const c=this.renderMarkdownDocs(i.documentation);Ne(this.domNodes.docs,c.element)}const l=this.hasDocs(i,a);if(this.domNodes.signature.classList.toggle("has-docs",l),this.domNodes.docs.classList.toggle("empty",!l),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,a){let c="";const u=i.parameters[o];Array.isArray(u.label)?c=i.label.substring(u.label[0],u.label[1]):c=u.label,u.documentation&&(c+=typeof u.documentation=="string"?`, ${u.documentation}`:`, ${u.documentation.value}`),i.documentation&&(c+=typeof i.documentation=="string"?`, ${i.documentation}`:`, ${i.documentation.value}`),this.announcedLabel!==c&&(ql(w("hint","{0}, hint",c)),this.announcedLabel=c)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=new Bo,i=this.renderDisposeables.add(this.markdownRenderer.render(e,{asyncRenderCallback:()=>{this.domNodes?.scrollbar.scanDomNode()}}));i.element.classList.add("markdown-docs");const r=t.elapsed();return r>300&&this.telemetryService.publicLog2("parameterHints.parseMarkdown",{renderDuration:r}),i}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&Lv(t.documentation).length>0||t&&typeof t.documentation=="object"&&Lv(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Lv(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Lv(e.documentation.value).length>0)}renderParameters(e,t,i){const[r,s]=this.getParameterLabelOffsets(t,i),o=document.createElement("span");o.textContent=t.label.substring(0,r);const a=document.createElement("span");a.textContent=t.label.substring(r,s),a.className="parameter active";const l=document.createElement("span");l.textContent=t.label.substring(s),Ne(e,o,a,l)}getParameterLabelOffsets(e,t){const i=e.parameters[t];if(i){if(Array.isArray(i.label))return i.label;if(i.label.length){const r=new RegExp(`(\\W|^)${nd(i.label)}(?=\\W|$)`,"g");r.test(e.label);const s=r.lastIndex-i.label.length;return s>=0?[s,r.lastIndex]:[0,0]}else return[0,0]}else return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return Hte.ID}updateMaxHeight(){if(!this.domNodes)return;const t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;const i=this.domNodes.element.getElementsByClassName("phwrapper");i.length&&(i[0].style.maxHeight=t)}};Vte=Hte=qBt([T3(2,jt),T3(3,Pc),T3(4,Hr),T3(5,Qa)],Vte);J("editorHoverWidget.highlightForeground",xS,w("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var YBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Mxe=function(n,e){return function(t,i){e(t,i,n)}},zte;let VE=class extends me{static{zte=this}static{this.ID="editor.controller.parameterHints"}static get(e){return e.getContribution(zte.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new Cde(e,i.signatureHelpProvider)),this._register(this.model.onChangedHints(r=>{r?(this.widget.value.show(),this.widget.value.render(r)):this.widget.rawValue?.hide()})),this.widget=new kg(()=>this._register(t.createInstance(Vte,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){this.widget.rawValue?.previous()}next(){this.widget.rawValue?.next()}trigger(e){this.model.trigger(e,0)}};VE=zte=YBt([Mxe(1,Tt),Mxe(2,dt)],VE);class ZBt extends ot{constructor(){super({id:"editor.action.triggerParameterHints",label:w("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:Q.hasSignatureHelpProvider,kbOpts:{kbExpr:Q.editorTextFocus,primary:3082,weight:100}})}run(e,t){VE.get(t)?.trigger({triggerKind:$p.Invoke})}}Zn(VE.ID,VE,2);Pe(ZBt);const xde=175,Sde=fo.bindToContribution(VE.get);Je(new Sde({id:"closeParameterHints",precondition:Xw.Visible,handler:n=>n.cancel(),kbOpts:{weight:xde,kbExpr:Q.focus,primary:9,secondary:[1033]}}));Je(new Sde({id:"showPrevParameterHint",precondition:Le.and(Xw.Visible,Xw.MultipleSignatures),handler:n=>n.previous(),kbOpts:{weight:xde,kbExpr:Q.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));Je(new Sde({id:"showNextParameterHint",precondition:Le.and(Xw.Visible,Xw.MultipleSignatures),handler:n=>n.next(),kbOpts:{weight:xde,kbExpr:Q.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var XBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},QBt=function(n,e){return function(t,i){e(t,i,n)}};class JBt{constructor(e){this.instantiationService=e}init(...e){}}function e$t(n,e){return class extends e{constructor(){super(...arguments),this._autorun=void 0}init(...i){this._autorun=wc((r,s)=>{const o=Yc(n(),r);s.add(this.instantiationService.createInstance(o,...i))})}dispose(){this._autorun?.dispose()}}}function t$t(n){return JW()?e$t(n,Ute):n()}let Ute=class extends JBt{constructor(e,t){super(t),this.init(e)}};Ute=XBt([QBt(1,Tt)],Ute);Zn(Fte.ID,t$t(()=>Fte),0);J("editor.placeholder.foreground",tEt,w("placeholderForeground","Foreground color of the placeholder text in the editor."));var n$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},D3=function(n,e){return function(t,i){e(t,i,n)}};const v2=new et("renameInputVisible",!1,w("renameInputVisible","Whether the rename input widget is visible"));new et("renameInputFocused",!1,w("renameInputFocused","Whether the rename input widget is focused"));let jte=class{constructor(e,t,i,r,s,o){this._editor=e,this._acceptKeybindings=t,this._themeService=i,this._keybindingService=r,this._logService=o,this.allowEditorOverflow=!0,this._disposables=new ke,this._visibleContextKey=v2.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new Bo,this._inputWithButton=new i$t,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{a.hasChanged(50)&&this._updateFont()})),this._disposables.add(i.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._domNode.appendChild(this._inputWithButton.domNode),this._renameCandidateListView=this._disposables.add(new kde(this._domNode,{fontInfo:this._editor.getOption(50),onFocusChange:e=>{this._inputWithButton.input.value=e,this._isEditingRenameCandidate=!1},onSelectionChange:()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)}})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{this._renameCandidateListView?.focusedCandidate!==void 0&&(this._isEditingRenameCandidate=!0),this._timeBeforeFirstInputFieldEdit??=this._beforeFirstInputFieldEditSW.elapsed(),this._renameCandidateProvidersCts?.token.isCancellationRequested===!1&&this._renameCandidateProvidersCts.cancel(),this._renameCandidateListView?.clearFocus()})),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(e){if(!this._domNode)return;const t=e.getColor(JL),i=e.getColor(xFe);this._domNode.style.backgroundColor=String(e.getColor(ju)??""),this._domNode.style.boxShadow=t?` 0 0 8px 2px ${t}`:"",this._domNode.style.border=i?`1px solid ${i}`:"",this._domNode.style.color=String(e.getColor(EFe)??"");const r=e.getColor(LFe);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(YX)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(YX)??""),this._inputWithButton.domNode.style.borderWidth=r?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=r?"solid":"none",this._inputWithButton.domNode.style.borderColor=r?.toString()??"none"}_updateFont(){if(this._domNode===void 0)return;oi(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);const e=this._editor.getOption(50);this._label.style.fontSize=`${this._computeLabelFontSize(e.fontSize)}px`}_computeLabelFontSize(e){return e*.8}getPosition(){if(!this._visible||!this._editor.hasModel()||!this._editor.getDomNode())return null;const e=kb(this.getDomNode().ownerDocument.body),t=ms(this._editor.getDomNode()),i=this._getTopForPosition();this._nPxAvailableAbove=i+t.top,this._nPxAvailableBelow=e.height-this._nPxAvailableAbove;const r=this._editor.getOption(67),{totalHeight:s}=zE.getLayoutInfo({lineHeight:r}),o=this._nPxAvailableBelow>s*6?[2,1]:[1,2];return{position:this._position,preference:o}}beforeRender(){const[e,t]=this._acceptKeybindings;return this._label.innerText=w({key:"label",comment:['placeholders are keybindings, e.g "F2 to Rename, Shift+F2 to Preview"']},"{0} to Rename, {1} to Preview",this._keybindingService.lookupKeybinding(e)?.getLabel(),this._keybindingService.lookupKeybinding(t)?.getLabel()),this._domNode.style.minWidth="200px",null}afterRender(e){if(e===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;oi(this._renameCandidateListView),oi(this._nPxAvailableAbove!==void 0),oi(this._nPxAvailableBelow!==void 0);const t=h_(this._inputWithButton.domNode),i=h_(this._label);let r;e===2?r=this._nPxAvailableBelow:r=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:r-i-t,width:qc(this._inputWithButton.domNode)})}acceptInput(e){this._trace("invoking acceptInput"),this._currentAcceptInput?.(e)}cancelInput(e,t){this._currentCancelInput?.(e)}focusNextRenameSuggestion(){this._renameCandidateListView?.focusNext()||(this._inputWithButton.input.value=this._currentName)}focusPreviousRenameSuggestion(){this._renameCandidateListView?.focusPrevious()||(this._inputWithButton.input.value=this._currentName)}getInput(e,t,i,r,s){const{start:o,end:a}=this._getSelection(e,t);this._renameCts=s;const l=new ke;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,r===void 0?this._inputWithButton.button.style.display="none":(this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=r,this._requestRenameCandidates(t,!1),l.add(Ce(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),l.add(Ce(this._inputWithButton.button,je.KEY_DOWN,u=>{const d=new or(u);(d.equals(3)||d.equals(10))&&(d.stopPropagation(),d.preventDefault(),this._requestRenameCandidates(t,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",i),this._position=new he(e.startLineNumber,e.startColumn),this._currentName=t,this._inputWithButton.input.value=t,this._inputWithButton.input.setAttribute("selectionStart",o.toString()),this._inputWithButton.input.setAttribute("selectionEnd",a.toString()),this._inputWithButton.input.size=Math.max((e.endColumn-e.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),l.add(Lt(()=>{this._renameCts=void 0,s.dispose(!0)})),l.add(Lt(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),l.add(Lt(()=>this._candidates.clear()));const c=new KL;return c.p.finally(()=>{l.dispose(),this._hide()}),this._currentCancelInput=u=>(this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView?.clearCandidates(),c.complete(u),!0),this._currentAcceptInput=u=>{this._trace("invoking _currentAcceptInput"),oi(this._renameCandidateListView!==void 0);const d=this._renameCandidateListView.nCandidates;let h,f;const g=this._renameCandidateListView.focusedCandidate;if(g!==void 0?(this._trace("using new name from renameSuggestion"),h=g,f={k:"renameSuggestion"}):(this._trace("using new name from inputField"),h=this._inputWithButton.input.value,f=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),h===t||h.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),c.complete({newName:h,wantsPreview:i&&u,stats:{source:f,nRenameSuggestions:d,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},l.add(s.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),l.add(this._editor.onDidBlurEditorWidget(()=>this.cancelInput(!this._domNode?.ownerDocument.hasFocus(),"editor.onDidBlurEditorWidget"))),this._show(),c.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),oi(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new Kr;const i=t?oN.Invoke:oN.Automatic,r=this._requestRenameCandidatesOnce(i,this._renameCandidateProvidersCts.token);if(r.length===0){this._inputWithButton.setSparkleButton();return}t||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(r,e,this._renameCts.token)}}_getSelection(e,t){oi(this._editor.hasModel());const i=this._editor.getSelection();let r=0,s=t.length;return!$.isEmpty(i)&&!$.spansMultipleLines(i)&&$.containsRange(e,i)&&(r=Math.max(0,i.startColumn-e.startColumn),s=Math.min(e.endColumn,i.endColumn)-e.startColumn),{start:r,end:s}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(e,t,i){const r=(...c)=>this._trace("_updateRenameCandidates",...c);r("start");const s=await YP(Promise.allSettled(e),i);if(this._inputWithButton.setSparkleButton(),s===void 0){r("returning early - received updateRenameCandidates results - undefined");return}const o=s.flatMap(c=>c.status==="fulfilled"&&Bp(c.value)?c.value:[]);r(`received updateRenameCandidates results - total (unfiltered) ${o.length} candidates.`);const a=j_(o,c=>c.newSymbolName);r(`distinct candidates - ${a.length} candidates.`);const l=a.filter(({newSymbolName:c})=>c.trim().length>0&&c!==this._inputWithButton.input.value&&c!==t&&!this._candidates.has(c));if(r(`valid distinct candidates - ${o.length} candidates.`),l.forEach(c=>this._candidates.add(c.newSymbolName)),l.length<1){r("returning early - no valid distinct candidates");return}r("setting candidates"),this._renameCandidateListView.setCandidates(l),r("asking editor to re-layout"),this._editor.layoutContentWidget(this)}_hide(){this._trace("invoked _hide"),this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}_getTopForPosition(){const e=this._editor.getVisibleRanges();let t;return e.length>0?t=e[0].startLineNumber:(this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),t=Math.max(1,this._position.lineNumber-5)),this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(t)}_trace(...e){this._logService.trace("RenameWidget",...e)}};jte=n$t([D3(2,go),D3(3,xi),D3(4,jt),D3(5,Da)],jte);class kde{constructor(e,t){this._disposables=new ke,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=t.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=t.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement("div"),this._listContainer.className="rename-box rename-candidate-list-container",e.appendChild(this._listContainer),this._listWidget=kde._createListWidget(this._listContainer,this._candidateViewHeight,t.fontInfo),this._listWidget.onDidChangeFocus(i=>{i.elements.length===1&&t.onFocusChange(i.elements[0].newSymbolName)},this._disposables),this._listWidget.onDidChangeSelection(i=>{i.elements.length===1&&t.onSelectionChange()},this._disposables),this._disposables.add(this._listWidget.onDidBlur(i=>{this._listWidget.setFocus([])})),this._listWidget.style(wC({listInactiveFocusForeground:wN,listInactiveFocusBackground:CN}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:e,width:t}){this._availableHeight=e,this._minimumWidth=t}setCandidates(e){this._listWidget.splice(0,0,e);const t=this._pickListHeight(this._listWidget.length),i=this._pickListWidth(e);this._listWidget.layout(t,i),this._listContainer.style.height=`${t}px`,this._listContainer.style.width=`${i}px`,Qp(w("renameSuggestionsReceivedAria","Received {0} rename suggestions",e.length))}clearCandidates(){this._listContainer.style.height="0px",this._listContainer.style.width="0px",this._listWidget.splice(0,this._listWidget.length,[])}get nCandidates(){return this._listWidget.length}get focusedCandidate(){if(this._listWidget.length===0)return;const e=this._listWidget.getSelectedElements()[0];if(e!==void 0)return e.newSymbolName;const t=this._listWidget.getFocusedElements()[0];if(t!==void 0)return t.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;if(e[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;{this._listWidget.focusNext();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0){this._listWidget.focusLast();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}else{if(e[0]===0)return this._listWidget.setFocus([]),!1;{this._listWidget.focusPrevious();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){const{totalHeight:e}=zE.getLayoutInfo({lineHeight:this._lineHeight});return e}_pickListHeight(e){const t=this._candidateViewHeight*e;return Math.min(t,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(e){const t=Math.ceil(Math.max(...e.map(r=>r.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+t+10)}static _createListWidget(e,t,i){const r=new class{getTemplateId(o){return"candidate"}getHeight(o){return t}},s=new class{constructor(){this.templateId="candidate"}renderTemplate(o){return new zE(o,i)}renderElement(o,a,l){l.populate(o)}disposeTemplate(o){o.dispose()}};return new dd("NewSymbolNameCandidates",e,r,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class i$t{constructor(){this._onDidInputChange=new fe,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new ke}get domNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="rename-input-with-button",this._domNode.style.display="flex",this._domNode.style.flexDirection="row",this._domNode.style.alignItems="center",this._inputNode=document.createElement("input"),this._inputNode.className="rename-input",this._inputNode.type="text",this._inputNode.style.border="none",this._inputNode.setAttribute("aria-label",w("renameAriaLabel","Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=w("generateRenameSuggestionsButton","Generate new name suggestions"),this._buttonCancelHoverText=w("cancelRenameSuggestionsButton","Cancel"),this._buttonHover=Bg().setupManagedHover(Yl("element"),this._buttonNode,this._buttonGenHoverText),this._disposables.add(this._buttonHover),this._domNode.appendChild(this._buttonNode),this._disposables.add(Ce(this.input,je.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(Ce(this.input,je.KEY_DOWN,e=>{const t=new or(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(Ce(this.input,je.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(Ce(this.input,je.FOCUS,()=>{this.domNode.style.outlineWidth="1px",this.domNode.style.outlineStyle="solid",this.domNode.style.outlineOffset="-1px",this.domNode.style.outlineColor="var(--vscode-focusBorder)"})),this._disposables.add(Ce(this.input,je.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return oi(this._inputNode),this._inputNode}get button(){return oi(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){this._buttonState="sparkle",this._sparkleIcon??=Pw(ze.sparkle),Jo(this.button),this.button.appendChild(this._sparkleIcon),this.button.setAttribute("aria-label","Generating new name suggestions"),this._buttonHover?.update(this._buttonGenHoverText),this.input.focus()}setStopButton(){this._buttonState="stop",this._stopIcon??=Pw(ze.primitiveSquare),Jo(this.button),this.button.appendChild(this._stopIcon),this.button.setAttribute("aria-label","Cancel generating new name suggestions"),this._buttonHover?.update(this._buttonCancelHoverText),this.input.focus()}dispose(){this._disposables.dispose()}}class zE{static{this._PADDING=2}constructor(e,t){this._domNode=document.createElement("div"),this._domNode.className="rename-box rename-candidate",this._domNode.style.display="flex",this._domNode.style.columnGap="5px",this._domNode.style.alignItems="center",this._domNode.style.height=`${t.lineHeight}px`,this._domNode.style.padding=`${zE._PADDING}px`;const i=document.createElement("div");i.style.display="flex",i.style.alignItems="center",i.style.width=i.style.height=`${t.lineHeight*.8}px`,this._domNode.appendChild(i),this._icon=Pw(ze.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),ta(this._label,t),this._domNode.appendChild(this._label),e.appendChild(this._domNode)}populate(e){this._updateIcon(e),this._updateLabel(e)}_updateIcon(e){const t=!!e.tags?.includes(pZ.AIGenerated);this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+zE._PADDING*2}}dispose(){}}var r$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},q0=function(n,e){return function(t,i){e(t,i,n)}},qte;class Ede{constructor(e,t,i){this.model=e,this.position=t,this._providerRenameIdx=0,this._providers=i.ordered(e)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(e){const t=[];for(this._providerRenameIdx=0;this._providerRenameIdx0?t.join(` +`));const p=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:"advanced"});return xW.fromFn(async()=>{const m=await p.computeDiff(this._originalModel.get(),this._modifiedModel.get(),{computeMoves:!1,ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3},yn.None);if(!m.identical)return new PBt(gn.fromRangeInclusive(u),h(d),m.changes)})}),this._fetchStore=this._register(new ke),this._inlineEditsFetchResult=TN(this,void 0),this._inlineEdits=$u({owner:this,equalsFn:E8},l=>this._inlineEditsFetchResult.read(l)?.completions.map(c=>new $Bt(c))??[]),this._fetchInlineEditsPromise=uFe({owner:this,createEmptyChangeSummary:()=>({inlineCompletionTriggerKind:gg.Automatic}),handleChange:(l,c)=>(l.didChange(this._forceUpdateExplicitlySignal)&&(c.inlineCompletionTriggerKind=gg.Explicit),!0)},async(l,c)=>{this._fetchStore.clear(),this._forceUpdateExplicitlySignal.read(l),this._textModelVersionId.read(l);function u(p,m){return m(p)}const d=this._pinnedRange.range.read(l)??u(this._selection.read(l),p=>p.isEmpty()?void 0:p);if(!d){this._inlineEditsFetchResult.set(void 0,void 0),this.userPrompt.set(void 0,void 0);return}const h={triggerKind:c.inlineCompletionTriggerKind,selectedSuggestionInfo:void 0,userPrompt:this.userPrompt.read(l)},f=lZ(this._fetchStore);await Y_(200,f);const g=await uBe(this.languageFeaturesService.inlineCompletionsProvider,d,this.textModel,h,f);f.isCancellationRequested||this._inlineEditsFetchResult.set(g,void 0)}),this._filteredInlineEditItems=$u({owner:this,equalsFn:k8()},l=>this._inlineEdits.read(l)),this.selectedInlineCompletionIndex=St(this,l=>{const c=this._selectedInlineCompletionId.read(l),u=this._filteredInlineEditItems.read(l),d=this._selectedInlineCompletionId===void 0?-1:u.findIndex(h=>h.semanticId===c);return d===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):d}),this.selectedInlineEdit=St(this,l=>{const c=this._filteredInlineEditItems.read(l),u=this.selectedInlineCompletionIndex.read(l);return c[u]}),this._register(s2(this._fetchInlineEditsPromise))}async triggerExplicitly(e){Fw(e,t=>{this._isActive.set(!0,t),this._forceUpdateExplicitlySignal.trigger(t)}),await this._fetchInlineEditsPromise.get()}stop(e){Fw(e,t=>{this.userPrompt.set(void 0,t),this._isActive.set(!1,t),this._inlineEditsFetchResult.set(void 0,t),this._pinnedRange.setRange(void 0,t)})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._filteredInlineEditItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(e){if(e.getModel()!==this.textModel)throw new fi;const t=this.selectedInlineEdit.get();t&&(e.pushUndoStop(),e.executeEdits("inlineSuggestion.accept",[t.inlineCompletion.toSingleTextEdit().toSingleEditOperation()]),this.stop())}};$te=qD=BBt([oK(4,dt),oK(5,vO),oK(6,Sr)],$te);class $Bt{constructor(e){this.inlineCompletion=e,this.semanticId=this.inlineCompletion.hash()}}class WBt extends me{constructor(e,t){super(),this._textModel=e,this._versionId=t,this._decorations=kn(this,[]),this.range=St(this,i=>{this._versionId.read(i);const r=this._decorations.read(i)[0];return r?this._textModel.getDecorationRange(r)??null:null}),this._register(Lt(()=>{this._textModel.deltaDecorations(this._decorations.get(),[])}))}setRange(e,t){this._decorations.set(this._textModel.deltaDecorations(this._decorations.get(),e?[{range:e,options:{description:"trackedRange"}}]:[]),t)}}var HBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},KT=function(n,e){return function(t,i){e(t,i,n)}},Wte;let n0=class extends me{static{Wte=this}static{this.ID="editor.contrib.inlineEditsController"}static get(e){return e.getContribution(Wte.ID)}constructor(e,t,i,r,s,o){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._debounceService=r,this._languageFeaturesService=s,this._configurationService=o,this._enabled=mPt("editor.inlineEdits.enabled",!1,this._configurationService),this._editorObs=Jc(this.editor),this._selection=St(this,a=>this._editorObs.cursorSelection.read(a)??new yt(1,1,1,1)),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineEditsDebounce",{min:50,max:50}),this.model=hl(this,a=>{if(!this._enabled.read(a)||this._editorObs.isReadonly.read(a))return;const l=this._editorObs.model.read(a);return l?this._instantiationService.createInstance(Yc($te,a),l,this._editorObs.versionId,this._selection,this._debounceValue):void 0}),this._hadInlineEdit=cO(this,(a,l)=>l||this.model.read(a)?.inlineEdit.read(a)!==void 0),this._widget=hl(this,a=>{if(this._hadInlineEdit.read(a))return this._instantiationService.createInstance(Yc(Bte,a),this.editor,this.model.map((l,c)=>l?.inlineEdit.read(c)),VBt(l=>this.model.read(l)?.userPrompt??kn("empty","")))}),this._register(Rf(HE,this._contextKeyService,a=>!!this.model.read(a)?.inlineEdit.read(a))),this._register(Rf(IBt,this._contextKeyService,a=>!!this.model.read(a)?.isPinned.read(a))),this.model.recomputeInitiallyAndOnChange(this._store),this._widget.recomputeInitiallyAndOnChange(this._store)}};n0=Wte=HBt([KT(1,Tt),KT(2,jt),KT(3,cd),KT(4,dt),KT(5,En)],n0);function VBt(n){return oO(void 0,e=>n(e).read(e),(e,t)=>{n(void 0).set(e,t)})}function AO(n){return{label:n.value,alias:n.original}}class bde extends ot{static{this.ID=DBt}constructor(){super({id:bde.ID,...AO(Gt("action.inlineEdits.showNext","Show Next Inline Edit")),precondition:Le.and(Q.writable,HE),kbOpts:{weight:100,primary:606}})}async run(e,t){n0.get(t)?.model.get()?.next()}}class yde extends ot{static{this.ID=TBt}constructor(){super({id:yde.ID,...AO(Gt("action.inlineEdits.showPrevious","Show Previous Inline Edit")),precondition:Le.and(Q.writable,HE),kbOpts:{weight:100,primary:604}})}async run(e,t){n0.get(t)?.model.get()?.previous()}}class zBt extends ot{constructor(){super({id:"editor.action.inlineEdits.trigger",...AO(Gt("action.inlineEdits.trigger","Trigger Inline Edit")),precondition:Q.writable})}async run(e,t){const i=n0.get(t);await cFe(async r=>{await i?.model.get()?.triggerExplicitly(r)})}}class UBt extends ot{constructor(){super({id:LBt,...AO(Gt("action.inlineEdits.accept","Accept Inline Edit")),precondition:HE,menuOpts:{menuId:ce.InlineEditsActions,title:w("inlineEditsActions","Accept Inline Edit"),group:"primary",order:1,icon:ze.check},kbOpts:{primary:2058,weight:2e4,kbExpr:HE}})}async run(e,t){t instanceof cf&&(t=t.getParentEditor());const i=n0.get(t);i&&(i.model.get()?.accept(i.editor),i.editor.focus())}}class wde extends ot{static{this.ID="editor.action.inlineEdits.hide"}constructor(){super({id:wde.ID,...AO(Gt("action.inlineEdits.hide","Hide Inline Edit")),precondition:HE,kbOpts:{weight:100,primary:9}})}async run(e,t){const i=n0.get(t);qr(r=>{i?.model.get()?.stop(r)})}}Zn(n0.ID,n0,3);Pe(zBt);Pe(bde);Pe(yde);Pe(UBt);Pe(wde);const Xw={Visible:new et("parameterHintsVisible",!1),MultipleSignatures:new et("parameterHintsMultipleSignatures",!1)};async function DBe(n,e,t,i,r){const s=n.ordered(e);for(const o of s)try{const a=await o.provideSignatureHelp(e,t,r,i);if(a)return a}catch(a){vs(a)}}Un.registerCommand("_executeSignatureHelpProvider",async(n,...e)=>{const[t,i,r]=e;oi(Pt.isUri(t)),oi(he.isIPosition(i)),oi(typeof r=="string"||!r);const s=n.get(dt),o=await n.get(Nc).createModelReference(t);try{const a=await DBe(s.signatureHelpProvider,o.object.textEditorModel,he.lift(i),{triggerKind:$p.Invoke,isRetrigger:!1,triggerCharacter:r},yn.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{o.dispose()}});var ov;(function(n){n.Default={type:0};class e{constructor(r,s){this.request=r,this.previouslyActiveHints=s,this.type=2}}n.Pending=e;class t{constructor(r){this.hints=r,this.type=1}}n.Active=t})(ov||(ov={}));class Cde extends me{static{this.DEFAULT_DELAY=120}constructor(e,t,i=Cde.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new fe),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=ov.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new To),this.triggerChars=new n8,this.retriggerChars=new n8,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new Qd(i),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(r=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(r=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(r=>this.onCursorChange(r))),this._register(this.editor.onDidChangeModelContent(r=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(r=>this.onDidType(r))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(e){this._state.type===2&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=ov.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){const i=this.editor.getModel();if(!i||!this.providers.has(i))return;const r=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(r),t).catch(rn)}next(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t%e===e-1,r=this.editor.getOption(86).cycle;if((e<2||i)&&!r){this.cancel();return}this.updateActiveSignature(i&&r?0:t+1)}previous(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t===0,r=this.editor.getOption(86).cycle;if((e<2||i)&&!r){this.cancel();return}this.updateActiveSignature(i&&r?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new ov.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){const t=this.state.type===1||this.state.type===2,i=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;const r=this._pendingTriggers.reduce(jBt);this._pendingTriggers=[];const s={triggerKind:r.triggerKind,triggerCharacter:r.triggerCharacter,isRetrigger:t,activeSignatureHelp:i};if(!this.editor.hasModel())return!1;const o=this.editor.getModel(),a=this.editor.getPosition();this.state=new ov.Pending(ko(l=>DBe(this.providers,o,a,s,l)),i);try{const l=await this.state.request;return e!==this.triggerId?(l?.dispose(),!1):!l||!l.value.signatures||l.value.signatures.length===0?(l?.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new ov.Active(l.value),this._lastSignatureHelpResult.value=l,this._onChangedHints.fire(this.state.hints),!0)}catch(l){return e===this.triggerId&&(this.state=ov.Default),rn(l),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return this.state.type===1||this.state.type===2||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const e=this.editor.getModel();if(e)for(const t of this.providers.ordered(e)){for(const i of t.signatureHelpTriggerCharacters||[])if(i.length){const r=i.charCodeAt(0);this.triggerChars.add(r),this.retriggerChars.add(r)}for(const i of t.signatureHelpRetriggerCharacters||[])i.length&&this.retriggerChars.add(i.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;const t=e.length-1,i=e.charCodeAt(t);(this.triggerChars.has(i)||this.isTriggered&&this.retriggerChars.has(i))&&this.trigger({triggerKind:$p.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:$p.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:$p.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(86).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}function jBt(n,e){switch(e.triggerKind){case $p.Invoke:return e;case $p.ContentChange:return n;case $p.TriggerCharacter:default:return e}}var qBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},T3=function(n,e){return function(t,i){e(t,i,n)}},Hte;const Lu=qe,KBt=kr("parameter-hints-next",ze.chevronDown,w("parameterHintsNextIcon","Icon for show next parameter hint.")),GBt=kr("parameter-hints-previous",ze.chevronUp,w("parameterHintsPreviousIcon","Icon for show previous parameter hint."));let Vte=class extends me{static{Hte=this}static{this.ID="editor.widget.parameterHintsWidget"}constructor(e,t,i,r,s,o){super(),this.editor=e,this.model=t,this.telemetryService=o,this.renderDisposeables=this._register(new ke),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new Q_({editor:e},s,r)),this.keyVisible=Xw.Visible.bindTo(i),this.keyMultipleSignatures=Xw.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=Lu(".editor-widget.parameter-hints-widget"),t=Ne(e,Lu(".phwrapper"));t.tabIndex=-1;const i=Ne(t,Lu(".controls")),r=Ne(i,Lu(".button"+zt.asCSSSelector(GBt))),s=Ne(i,Lu(".overloads")),o=Ne(i,Lu(".button"+zt.asCSSSelector(KBt)));this._register(Ce(r,"click",h=>{Hn.stop(h),this.previous()})),this._register(Ce(o,"click",h=>{Hn.stop(h),this.next()}));const a=Lu(".body"),l=new tO(a,{alwaysConsumeMouseWheel:!0});this._register(l),t.appendChild(l.getDomNode());const c=Ne(a,Lu(".signature")),u=Ne(a,Lu(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:c,overloads:s,docs:u,scrollbar:l},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(h=>{this.visible&&this.editor.layoutContentWidget(this)}));const d=()=>{if(!this.domNodes)return;const h=this.editor.getOption(50),f=this.domNodes.element;f.style.fontSize=`${h.fontSize}px`,f.style.lineHeight=`${h.lineHeight/h.fontSize}`,f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",h.fontFamily),f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",Wl.fontFamily)};d(),this._register(Ge.chain(this.editor.onDidChangeConfiguration.bind(this.editor),h=>h.filter(f=>f.hasChanged(50)))(d)),this._register(this.editor.onDidLayoutChange(h=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{this.domNodes?.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,this.domNodes?.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){if(this.renderDisposeables.clear(),!this.domNodes)return;const t=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const i=e.signatures[e.activeSignature];if(!i)return;const r=Ne(this.domNodes.signature,Lu(".code")),s=i.parameters.length>0,o=i.activeParameter??e.activeParameter;if(s)this.renderParameters(r,i,o);else{const c=Ne(r,Lu("span"));c.textContent=i.label}const a=i.parameters[o];if(a?.documentation){const c=Lu("span.documentation");if(typeof a.documentation=="string")c.textContent=a.documentation;else{const u=this.renderMarkdownDocs(a.documentation);c.appendChild(u.element)}Ne(this.domNodes.docs,Lu("p",{},c))}if(i.documentation!==void 0)if(typeof i.documentation=="string")Ne(this.domNodes.docs,Lu("p",{},i.documentation));else{const c=this.renderMarkdownDocs(i.documentation);Ne(this.domNodes.docs,c.element)}const l=this.hasDocs(i,a);if(this.domNodes.signature.classList.toggle("has-docs",l),this.domNodes.docs.classList.toggle("empty",!l),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,a){let c="";const u=i.parameters[o];Array.isArray(u.label)?c=i.label.substring(u.label[0],u.label[1]):c=u.label,u.documentation&&(c+=typeof u.documentation=="string"?`, ${u.documentation}`:`, ${u.documentation.value}`),i.documentation&&(c+=typeof i.documentation=="string"?`, ${i.documentation}`:`, ${i.documentation.value}`),this.announcedLabel!==c&&(ql(w("hint","{0}, hint",c)),this.announcedLabel=c)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=new Bo,i=this.renderDisposeables.add(this.markdownRenderer.render(e,{asyncRenderCallback:()=>{this.domNodes?.scrollbar.scanDomNode()}}));i.element.classList.add("markdown-docs");const r=t.elapsed();return r>300&&this.telemetryService.publicLog2("parameterHints.parseMarkdown",{renderDuration:r}),i}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&Lv(t.documentation).length>0||t&&typeof t.documentation=="object"&&Lv(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Lv(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Lv(e.documentation.value).length>0)}renderParameters(e,t,i){const[r,s]=this.getParameterLabelOffsets(t,i),o=document.createElement("span");o.textContent=t.label.substring(0,r);const a=document.createElement("span");a.textContent=t.label.substring(r,s),a.className="parameter active";const l=document.createElement("span");l.textContent=t.label.substring(s),Ne(e,o,a,l)}getParameterLabelOffsets(e,t){const i=e.parameters[t];if(i){if(Array.isArray(i.label))return i.label;if(i.label.length){const r=new RegExp(`(\\W|^)${nd(i.label)}(?=\\W|$)`,"g");r.test(e.label);const s=r.lastIndex-i.label.length;return s>=0?[s,r.lastIndex]:[0,0]}else return[0,0]}else return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return Hte.ID}updateMaxHeight(){if(!this.domNodes)return;const t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;const i=this.domNodes.element.getElementsByClassName("phwrapper");i.length&&(i[0].style.maxHeight=t)}};Vte=Hte=qBt([T3(2,jt),T3(3,Pc),T3(4,Hr),T3(5,Qa)],Vte);J("editorHoverWidget.highlightForeground",xS,w("editorHoverWidgetHighlightForeground","Foreground color of the active item in the parameter hint."));var YBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Mxe=function(n,e){return function(t,i){e(t,i,n)}},zte;let VE=class extends me{static{zte=this}static{this.ID="editor.controller.parameterHints"}static get(e){return e.getContribution(zte.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new Cde(e,i.signatureHelpProvider)),this._register(this.model.onChangedHints(r=>{r?(this.widget.value.show(),this.widget.value.render(r)):this.widget.rawValue?.hide()})),this.widget=new kg(()=>this._register(t.createInstance(Vte,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){this.widget.rawValue?.previous()}next(){this.widget.rawValue?.next()}trigger(e){this.model.trigger(e,0)}};VE=zte=YBt([Mxe(1,Tt),Mxe(2,dt)],VE);class ZBt extends ot{constructor(){super({id:"editor.action.triggerParameterHints",label:w("parameterHints.trigger.label","Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:Q.hasSignatureHelpProvider,kbOpts:{kbExpr:Q.editorTextFocus,primary:3082,weight:100}})}run(e,t){VE.get(t)?.trigger({triggerKind:$p.Invoke})}}Zn(VE.ID,VE,2);Pe(ZBt);const xde=175,Sde=fo.bindToContribution(VE.get);Je(new Sde({id:"closeParameterHints",precondition:Xw.Visible,handler:n=>n.cancel(),kbOpts:{weight:xde,kbExpr:Q.focus,primary:9,secondary:[1033]}}));Je(new Sde({id:"showPrevParameterHint",precondition:Le.and(Xw.Visible,Xw.MultipleSignatures),handler:n=>n.previous(),kbOpts:{weight:xde,kbExpr:Q.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));Je(new Sde({id:"showNextParameterHint",precondition:Le.and(Xw.Visible,Xw.MultipleSignatures),handler:n=>n.next(),kbOpts:{weight:xde,kbExpr:Q.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var XBt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},QBt=function(n,e){return function(t,i){e(t,i,n)}};class JBt{constructor(e){this.instantiationService=e}init(...e){}}function e$t(n,e){return class extends e{constructor(){super(...arguments),this._autorun=void 0}init(...i){this._autorun=wc((r,s)=>{const o=Yc(n(),r);s.add(this.instantiationService.createInstance(o,...i))})}dispose(){this._autorun?.dispose()}}}function t$t(n){return JW()?e$t(n,Ute):n()}let Ute=class extends JBt{constructor(e,t){super(t),this.init(e)}};Ute=XBt([QBt(1,Tt)],Ute);Zn(Fte.ID,t$t(()=>Fte),0);J("editor.placeholder.foreground",tEt,w("placeholderForeground","Foreground color of the placeholder text in the editor."));var n$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},D3=function(n,e){return function(t,i){e(t,i,n)}};const v2=new et("renameInputVisible",!1,w("renameInputVisible","Whether the rename input widget is visible"));new et("renameInputFocused",!1,w("renameInputFocused","Whether the rename input widget is focused"));let jte=class{constructor(e,t,i,r,s,o){this._editor=e,this._acceptKeybindings=t,this._themeService=i,this._keybindingService=r,this._logService=o,this.allowEditorOverflow=!0,this._disposables=new ke,this._visibleContextKey=v2.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new Bo,this._inputWithButton=new i$t,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{a.hasChanged(50)&&this._updateFont()})),this._disposables.add(i.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._domNode.appendChild(this._inputWithButton.domNode),this._renameCandidateListView=this._disposables.add(new kde(this._domNode,{fontInfo:this._editor.getOption(50),onFocusChange:e=>{this._inputWithButton.input.value=e,this._isEditingRenameCandidate=!1},onSelectionChange:()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)}})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{this._renameCandidateListView?.focusedCandidate!==void 0&&(this._isEditingRenameCandidate=!0),this._timeBeforeFirstInputFieldEdit??=this._beforeFirstInputFieldEditSW.elapsed(),this._renameCandidateProvidersCts?.token.isCancellationRequested===!1&&this._renameCandidateProvidersCts.cancel(),this._renameCandidateListView?.clearFocus()})),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(e){if(!this._domNode)return;const t=e.getColor(JL),i=e.getColor(x5e);this._domNode.style.backgroundColor=String(e.getColor(ju)??""),this._domNode.style.boxShadow=t?` 0 0 8px 2px ${t}`:"",this._domNode.style.border=i?`1px solid ${i}`:"",this._domNode.style.color=String(e.getColor(E5e)??"");const r=e.getColor(L5e);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(YX)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(YX)??""),this._inputWithButton.domNode.style.borderWidth=r?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=r?"solid":"none",this._inputWithButton.domNode.style.borderColor=r?.toString()??"none"}_updateFont(){if(this._domNode===void 0)return;oi(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);const e=this._editor.getOption(50);this._label.style.fontSize=`${this._computeLabelFontSize(e.fontSize)}px`}_computeLabelFontSize(e){return e*.8}getPosition(){if(!this._visible||!this._editor.hasModel()||!this._editor.getDomNode())return null;const e=kb(this.getDomNode().ownerDocument.body),t=ms(this._editor.getDomNode()),i=this._getTopForPosition();this._nPxAvailableAbove=i+t.top,this._nPxAvailableBelow=e.height-this._nPxAvailableAbove;const r=this._editor.getOption(67),{totalHeight:s}=zE.getLayoutInfo({lineHeight:r}),o=this._nPxAvailableBelow>s*6?[2,1]:[1,2];return{position:this._position,preference:o}}beforeRender(){const[e,t]=this._acceptKeybindings;return this._label.innerText=w({key:"label",comment:['placeholders are keybindings, e.g "F2 to Rename, Shift+F2 to Preview"']},"{0} to Rename, {1} to Preview",this._keybindingService.lookupKeybinding(e)?.getLabel(),this._keybindingService.lookupKeybinding(t)?.getLabel()),this._domNode.style.minWidth="200px",null}afterRender(e){if(e===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;oi(this._renameCandidateListView),oi(this._nPxAvailableAbove!==void 0),oi(this._nPxAvailableBelow!==void 0);const t=h_(this._inputWithButton.domNode),i=h_(this._label);let r;e===2?r=this._nPxAvailableBelow:r=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:r-i-t,width:qc(this._inputWithButton.domNode)})}acceptInput(e){this._trace("invoking acceptInput"),this._currentAcceptInput?.(e)}cancelInput(e,t){this._currentCancelInput?.(e)}focusNextRenameSuggestion(){this._renameCandidateListView?.focusNext()||(this._inputWithButton.input.value=this._currentName)}focusPreviousRenameSuggestion(){this._renameCandidateListView?.focusPrevious()||(this._inputWithButton.input.value=this._currentName)}getInput(e,t,i,r,s){const{start:o,end:a}=this._getSelection(e,t);this._renameCts=s;const l=new ke;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,r===void 0?this._inputWithButton.button.style.display="none":(this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=r,this._requestRenameCandidates(t,!1),l.add(Ce(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),l.add(Ce(this._inputWithButton.button,je.KEY_DOWN,u=>{const d=new or(u);(d.equals(3)||d.equals(10))&&(d.stopPropagation(),d.preventDefault(),this._requestRenameCandidates(t,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",i),this._position=new he(e.startLineNumber,e.startColumn),this._currentName=t,this._inputWithButton.input.value=t,this._inputWithButton.input.setAttribute("selectionStart",o.toString()),this._inputWithButton.input.setAttribute("selectionEnd",a.toString()),this._inputWithButton.input.size=Math.max((e.endColumn-e.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),l.add(Lt(()=>{this._renameCts=void 0,s.dispose(!0)})),l.add(Lt(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),l.add(Lt(()=>this._candidates.clear()));const c=new KL;return c.p.finally(()=>{l.dispose(),this._hide()}),this._currentCancelInput=u=>(this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView?.clearCandidates(),c.complete(u),!0),this._currentAcceptInput=u=>{this._trace("invoking _currentAcceptInput"),oi(this._renameCandidateListView!==void 0);const d=this._renameCandidateListView.nCandidates;let h,f;const g=this._renameCandidateListView.focusedCandidate;if(g!==void 0?(this._trace("using new name from renameSuggestion"),h=g,f={k:"renameSuggestion"}):(this._trace("using new name from inputField"),h=this._inputWithButton.input.value,f=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),h===t||h.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),c.complete({newName:h,wantsPreview:i&&u,stats:{source:f,nRenameSuggestions:d,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},l.add(s.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),l.add(this._editor.onDidBlurEditorWidget(()=>this.cancelInput(!this._domNode?.ownerDocument.hasFocus(),"editor.onDidBlurEditorWidget"))),this._show(),c.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),oi(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new Kr;const i=t?oN.Invoke:oN.Automatic,r=this._requestRenameCandidatesOnce(i,this._renameCandidateProvidersCts.token);if(r.length===0){this._inputWithButton.setSparkleButton();return}t||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(r,e,this._renameCts.token)}}_getSelection(e,t){oi(this._editor.hasModel());const i=this._editor.getSelection();let r=0,s=t.length;return!$.isEmpty(i)&&!$.spansMultipleLines(i)&&$.containsRange(e,i)&&(r=Math.max(0,i.startColumn-e.startColumn),s=Math.min(e.endColumn,i.endColumn)-e.startColumn),{start:r,end:s}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(e,t,i){const r=(...c)=>this._trace("_updateRenameCandidates",...c);r("start");const s=await YP(Promise.allSettled(e),i);if(this._inputWithButton.setSparkleButton(),s===void 0){r("returning early - received updateRenameCandidates results - undefined");return}const o=s.flatMap(c=>c.status==="fulfilled"&&Bp(c.value)?c.value:[]);r(`received updateRenameCandidates results - total (unfiltered) ${o.length} candidates.`);const a=j_(o,c=>c.newSymbolName);r(`distinct candidates - ${a.length} candidates.`);const l=a.filter(({newSymbolName:c})=>c.trim().length>0&&c!==this._inputWithButton.input.value&&c!==t&&!this._candidates.has(c));if(r(`valid distinct candidates - ${o.length} candidates.`),l.forEach(c=>this._candidates.add(c.newSymbolName)),l.length<1){r("returning early - no valid distinct candidates");return}r("setting candidates"),this._renameCandidateListView.setCandidates(l),r("asking editor to re-layout"),this._editor.layoutContentWidget(this)}_hide(){this._trace("invoked _hide"),this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}_getTopForPosition(){const e=this._editor.getVisibleRanges();let t;return e.length>0?t=e[0].startLineNumber:(this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),t=Math.max(1,this._position.lineNumber-5)),this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(t)}_trace(...e){this._logService.trace("RenameWidget",...e)}};jte=n$t([D3(2,go),D3(3,xi),D3(4,jt),D3(5,Da)],jte);class kde{constructor(e,t){this._disposables=new ke,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=t.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=t.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement("div"),this._listContainer.className="rename-box rename-candidate-list-container",e.appendChild(this._listContainer),this._listWidget=kde._createListWidget(this._listContainer,this._candidateViewHeight,t.fontInfo),this._listWidget.onDidChangeFocus(i=>{i.elements.length===1&&t.onFocusChange(i.elements[0].newSymbolName)},this._disposables),this._listWidget.onDidChangeSelection(i=>{i.elements.length===1&&t.onSelectionChange()},this._disposables),this._disposables.add(this._listWidget.onDidBlur(i=>{this._listWidget.setFocus([])})),this._listWidget.style(wC({listInactiveFocusForeground:wN,listInactiveFocusBackground:CN}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:e,width:t}){this._availableHeight=e,this._minimumWidth=t}setCandidates(e){this._listWidget.splice(0,0,e);const t=this._pickListHeight(this._listWidget.length),i=this._pickListWidth(e);this._listWidget.layout(t,i),this._listContainer.style.height=`${t}px`,this._listContainer.style.width=`${i}px`,Qp(w("renameSuggestionsReceivedAria","Received {0} rename suggestions",e.length))}clearCandidates(){this._listContainer.style.height="0px",this._listContainer.style.width="0px",this._listWidget.splice(0,this._listWidget.length,[])}get nCandidates(){return this._listWidget.length}get focusedCandidate(){if(this._listWidget.length===0)return;const e=this._listWidget.getSelectedElements()[0];if(e!==void 0)return e.newSymbolName;const t=this._listWidget.getFocusedElements()[0];if(t!==void 0)return t.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;if(e[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;{this._listWidget.focusNext();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0){this._listWidget.focusLast();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}else{if(e[0]===0)return this._listWidget.setFocus([]),!1;{this._listWidget.focusPrevious();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){const{totalHeight:e}=zE.getLayoutInfo({lineHeight:this._lineHeight});return e}_pickListHeight(e){const t=this._candidateViewHeight*e;return Math.min(t,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(e){const t=Math.ceil(Math.max(...e.map(r=>r.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+t+10)}static _createListWidget(e,t,i){const r=new class{getTemplateId(o){return"candidate"}getHeight(o){return t}},s=new class{constructor(){this.templateId="candidate"}renderTemplate(o){return new zE(o,i)}renderElement(o,a,l){l.populate(o)}disposeTemplate(o){o.dispose()}};return new dd("NewSymbolNameCandidates",e,r,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class i$t{constructor(){this._onDidInputChange=new fe,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new ke}get domNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="rename-input-with-button",this._domNode.style.display="flex",this._domNode.style.flexDirection="row",this._domNode.style.alignItems="center",this._inputNode=document.createElement("input"),this._inputNode.className="rename-input",this._inputNode.type="text",this._inputNode.style.border="none",this._inputNode.setAttribute("aria-label",w("renameAriaLabel","Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=w("generateRenameSuggestionsButton","Generate new name suggestions"),this._buttonCancelHoverText=w("cancelRenameSuggestionsButton","Cancel"),this._buttonHover=Bg().setupManagedHover(Yl("element"),this._buttonNode,this._buttonGenHoverText),this._disposables.add(this._buttonHover),this._domNode.appendChild(this._buttonNode),this._disposables.add(Ce(this.input,je.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(Ce(this.input,je.KEY_DOWN,e=>{const t=new or(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(Ce(this.input,je.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(Ce(this.input,je.FOCUS,()=>{this.domNode.style.outlineWidth="1px",this.domNode.style.outlineStyle="solid",this.domNode.style.outlineOffset="-1px",this.domNode.style.outlineColor="var(--vscode-focusBorder)"})),this._disposables.add(Ce(this.input,je.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return oi(this._inputNode),this._inputNode}get button(){return oi(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){this._buttonState="sparkle",this._sparkleIcon??=Pw(ze.sparkle),Jo(this.button),this.button.appendChild(this._sparkleIcon),this.button.setAttribute("aria-label","Generating new name suggestions"),this._buttonHover?.update(this._buttonGenHoverText),this.input.focus()}setStopButton(){this._buttonState="stop",this._stopIcon??=Pw(ze.primitiveSquare),Jo(this.button),this.button.appendChild(this._stopIcon),this.button.setAttribute("aria-label","Cancel generating new name suggestions"),this._buttonHover?.update(this._buttonCancelHoverText),this.input.focus()}dispose(){this._disposables.dispose()}}class zE{static{this._PADDING=2}constructor(e,t){this._domNode=document.createElement("div"),this._domNode.className="rename-box rename-candidate",this._domNode.style.display="flex",this._domNode.style.columnGap="5px",this._domNode.style.alignItems="center",this._domNode.style.height=`${t.lineHeight}px`,this._domNode.style.padding=`${zE._PADDING}px`;const i=document.createElement("div");i.style.display="flex",i.style.alignItems="center",i.style.width=i.style.height=`${t.lineHeight*.8}px`,this._domNode.appendChild(i),this._icon=Pw(ze.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),ta(this._label,t),this._domNode.appendChild(this._label),e.appendChild(this._domNode)}populate(e){this._updateIcon(e),this._updateLabel(e)}_updateIcon(e){const t=!!e.tags?.includes(pZ.AIGenerated);this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+zE._PADDING*2}}dispose(){}}var r$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},q0=function(n,e){return function(t,i){e(t,i,n)}},qte;class Ede{constructor(e,t,i){this.model=e,this.position=t,this._providerRenameIdx=0,this._providers=i.ordered(e)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(e){const t=[];for(this._providerRenameIdx=0;this._providerRenameIdx0?t.join(` `):void 0}:{range:$.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(` `):void 0}}async provideRenameEdits(e,t){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}async _provideRenameEdits(e,t,i,r){const s=this._providers[t];if(!s)return{edits:[],rejectReason:i.join(` -`)};const o=await s.provideRenameEdits(this.model,this.position,e,r);if(o){if(o.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(o.rejectReason),r)}else return this._provideRenameEdits(e,t+1,i.concat(w("no result","No result.")),r);return o}}async function s$t(n,e,t,i){const r=new Ede(e,t,n),s=await r.resolveRenameLocation(yn.None);return s?.rejectReason?{edits:[],rejectReason:s.rejectReason}:r.provideRenameEdits(i,yn.None)}let Bb=class{static{qte=this}static{this.ID="editor.contrib.renameController"}static get(e){return e.getContribution(qte.ID)}constructor(e,t,i,r,s,o,a,l,c){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=r,this._progressService=s,this._logService=o,this._configService=a,this._languageFeaturesService=l,this._telemetryService=c,this._disposableStore=new ke,this._cts=new Kr,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(jte,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new Kr,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new Ede(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const r=new Pb(this.editor,5,void 0,this._cts.token);let s;try{e("resolving rename location");const g=i.resolveRenameLocation(r.token);this._progressService.showWhile(g,250),s=await g,e("resolved rename location")}catch(g){g instanceof sf?e("resolve rename location cancelled",JSON.stringify(g,null," ")):(e("resolve rename location failed",g instanceof Error?g:JSON.stringify(g,null," ")),(typeof g=="string"||bg(g))&&au.get(this.editor)?.showMessage(g||w("resolveRenameLocationFailed","An unknown error occurred while resolving rename location"),t));return}finally{r.dispose()}if(!s){e("returning early - no loc");return}if(s.rejectReason){e(`returning early - rejected with reason: ${s.rejectReason}`,s.rejectReason),au.get(this.editor)?.showMessage(s.rejectReason,t);return}if(r.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const o=new Pb(this.editor,5,s.range,this._cts.token),a=this.editor.getModel(),l=this._languageFeaturesService.newSymbolNamesProvider.all(a),c=await Promise.all(l.map(async g=>[g,await g.supportsAutomaticNewSymbolNamesTriggerKind??!1])),u=(g,p)=>{let m=c.slice();return g===oN.Automatic&&(m=m.filter(([_,v])=>v)),m.map(([_])=>_.provideNewSymbolNames(a,s.range,g,p))};e("creating rename input field and awaiting its result");const d=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),h=await this._renameWidget.getInput(s.range,s.text,d,l.length>0?u:void 0,o);if(e("received response from rename input field"),l.length>0&&this._reportTelemetry(l.length,a.getLanguageId(),h),typeof h=="boolean"){e(`returning early - rename input field response - ${h}`),h&&this.editor.focus(),o.dispose();return}this.editor.focus(),e("requesting rename edits");const f=YP(i.provideRenameEdits(h.newName,o.token),o.token).then(async g=>{if(!g){e("returning early - no rename edits result");return}if(!this.editor.hasModel()){e("returning early - no model after rename edits are provided");return}if(g.rejectReason){e(`returning early - rejected with reason: ${g.rejectReason}`),this._notificationService.info(g.rejectReason);return}this.editor.setSelection($.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(g,{editor:this.editor,showPreview:h.wantsPreview,label:w("label","Renaming '{0}' to '{1}'",s?.text,h.newName),code:"undoredo.rename",quotableLabel:w("quotableLabel","Renaming {0} to {1}",s?.text,h.newName),respectAutoSaveConfig:!0}).then(p=>{e("edits applied"),p.ariaSummary&&ql(w("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",s.text,h.newName,p.ariaSummary))}).catch(p=>{e(`error when applying edits ${JSON.stringify(p,null," ")}`),this._notificationService.error(w("rename.failedApply","Rename failed to apply edits")),this._logService.error(p)})},g=>{e("error when providing rename edits",JSON.stringify(g,null," ")),this._notificationService.error(w("rename.failed","Rename failed to compute edits")),this._logService.error(g)}).finally(()=>{o.dispose()});return e("returning rename operation"),this._progressService.showWhile(f,250),f}acceptRenameInput(e){this._renameWidget.acceptInput(e)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}_reportTelemetry(e,t,i){const r=typeof i=="boolean"?{kind:"cancelled",languageId:t,nRenameSuggestionProviders:e}:{kind:"accepted",languageId:t,nRenameSuggestionProviders:e,source:i.stats.source.k,nRenameSuggestions:i.stats.nRenameSuggestions,timeBeforeFirstInputFieldEdit:i.stats.timeBeforeFirstInputFieldEdit,wantsPreview:i.wantsPreview,nRenameSuggestionsInvocations:i.stats.nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:i.stats.hadAutomaticRenameSuggestionsInvocation};this._telemetryService.publicLog2("renameInvokedEvent",r)}};Bb=qte=r$t([q0(1,Tt),q0(2,Ts),q0(3,rO),q0(4,Qb),q0(5,Da),q0(6,nW),q0(7,dt),q0(8,Qa)],Bb);class o$t extends ot{constructor(){super({id:"editor.action.rename",label:w("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:Le.and(Q.writable,Q.hasRenameProvider),kbOpts:{kbExpr:Q.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(ai),[r,s]=Array.isArray(t)&&t||[void 0,void 0];return Pt.isUri(r)&&he.isIPosition(s)?i.openCodeEditor({resource:r},i.getActiveCodeEditor()).then(o=>{o&&(o.setPosition(s),o.invokeWithinContext(a=>(this.reportTelemetry(a,o),this.run(a,o))))},rn):super.runCommand(e,t)}run(e,t){const i=e.get(Da),r=Bb.get(t);return r?(i.trace("[RenameAction] got controller, running..."),r.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}Zn(Bb.ID,Bb,4);Pe(o$t);const Lde=fo.bindToContribution(Bb.get);Je(new Lde({id:"acceptRenameInput",precondition:v2,handler:n=>n.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Le.and(Q.focus,Le.not("isComposing")),primary:3}}));Je(new Lde({id:"acceptRenameInputWithPreview",precondition:Le.and(v2,Le.has("config.editor.rename.enablePreview")),handler:n=>n.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Le.and(Q.focus,Le.not("isComposing")),primary:2051}}));Je(new Lde({id:"cancelRenameInput",precondition:v2,handler:n=>n.cancelRenameInput(),kbOpts:{weight:199,kbExpr:Q.focus,primary:9,secondary:[1033]}}));lr(class extends Gl{constructor(){super({id:"focusNextRenameSuggestion",title:{...Gt("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:v2,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(ai).getFocusedCodeEditor();if(!t)return;const i=Bb.get(t);i&&i.focusNextRenameSuggestion()}});lr(class extends Gl{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...Gt("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:v2,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(ai).getFocusedCodeEditor();if(!t)return;const i=Bb.get(t);i&&i.focusPreviousRenameSuggestion()}});Rc("_executeDocumentRenameProvider",function(n,e,t,...i){const[r]=i;oi(typeof r=="string");const{renameProvider:s}=n.get(dt);return s$t(s,e,t,r)});Rc("_executePrepareRename",async function(n,e,t){const{renameProvider:i}=n.get(dt),s=await new Ede(e,t,i).resolveRenameLocation(yn.None);if(s?.rejectReason)throw new Error(s.rejectReason);return s});Yr.as(ff.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:w("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var a$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Fxe=function(n,e){return function(t,i){e(t,i,n)}};let n7=class extends me{static{this.ID="editor.sectionHeaderDetector"}constructor(e,t,i){super(),this.editor=e,this.languageConfigurationService=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(73)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(r=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(r=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(r=>{const s=this.editor.getModel()?.getLanguageId();s&&r.affects(s)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(r=>{this.options&&!r.hasChanged(73)||(this.options=this.createOptions(e.getOption(73)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(r=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(r=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new Ui(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}createOptions(e){if(!e||!this.editor.hasModel())return;const t=this.editor.getModel().getLanguageId();if(!t)return;const i=this.languageConfigurationService.getLanguageConfiguration(t).comments,r=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!i&&!r?.markers))return{foldingRules:r,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){if(!this.editor.hasModel()||!this.options?.findMarkSectionHeaders&&!this.options?.findRegionSectionHeaders)return;const e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;const t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(i=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(i)})}updateDecorations(e){const t=this.editor.getModel();t&&(e=e.filter(s=>{if(!s.shouldBeInComments)return!0;const o=t.validateRange(s.range),a=t.tokenization.getLineTokens(o.startLineNumber),l=a.findTokenIndexAtOffset(o.startColumn-1),c=a.getStandardTokenType(l);return a.getLanguageId(l)===t.getLanguageId()&&c===1}));const i=Object.values(this.currentOccurrences).map(s=>s.decorationId),r=e.map(s=>l$t(s));this.editor.changeDecorations(s=>{const o=s.deltaDecorations(i,r);this.currentOccurrences={};for(let a=0,l=o.length;a0?t[0]:[]}async function RBe(n,e,t,i,r){const s=f$t(n,e),o=await Promise.all(s.map(async a=>{let l,c=null;try{l=await a.provideDocumentSemanticTokens(e,a===t?i:null,r)}catch(u){c=u,l=null}return(!l||!SH(l)&&!ABe(l))&&(l=null),new h$t(a,l,c)}));for(const a of o){if(a.error)throw a.error;if(a.tokens)return a}return o.length>0?o[0]:null}function g$t(n,e){const t=n.orderedGroups(e);return t.length>0?t[0]:null}class p$t{constructor(e,t){this.provider=e,this.tokens=t}}function m$t(n,e){return n.has(e)}function PBe(n,e){const t=n.orderedGroups(e);return t.length>0?t[0]:[]}async function Tde(n,e,t,i){const r=PBe(n,e),s=await Promise.all(r.map(async o=>{let a;try{a=await o.provideDocumentRangeSemanticTokens(e,t,i)}catch(l){vs(l),a=null}return(!a||!SH(a))&&(a=null),new p$t(o,a)}));for(const o of s)if(o.tokens)return o;return s.length>0?s[0]:null}Un.registerCommand("_provideDocumentSemanticTokensLegend",async(n,...e)=>{const[t]=e;oi(t instanceof Pt);const i=n.get(Sr).getModel(t);if(!i)return;const{documentSemanticTokensProvider:r}=n.get(dt),s=g$t(r,i);return s?s[0].getLegend():n.get(_r).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});Un.registerCommand("_provideDocumentSemanticTokens",async(n,...e)=>{const[t]=e;oi(t instanceof Pt);const i=n.get(Sr).getModel(t);if(!i)return;const{documentSemanticTokensProvider:r}=n.get(dt);if(!NBe(r,i))return n.get(_r).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await RBe(r,i,null,null,yn.None);if(!s)return;const{provider:o,tokens:a}=s;if(!a||!SH(a))return;const l=IBe({id:0,type:"full",data:a.data});return a.resultId&&o.releaseDocumentSemanticTokens(a.resultId),l});Un.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(n,...e)=>{const[t,i]=e;oi(t instanceof Pt);const r=n.get(Sr).getModel(t);if(!r)return;const{documentRangeSemanticTokensProvider:s}=n.get(dt),o=PBe(s,r);if(o.length===0)return;if(o.length===1)return o[0].getLegend();if(!i||!$.isIRange(i))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),o[0].getLegend();const a=await Tde(s,r,$.lift(i),yn.None);if(a)return a.provider.getLegend()});Un.registerCommand("_provideDocumentRangeSemanticTokens",async(n,...e)=>{const[t,i]=e;oi(t instanceof Pt),oi($.isIRange(i));const r=n.get(Sr).getModel(t);if(!r)return;const{documentRangeSemanticTokensProvider:s}=n.get(dt),o=await Tde(s,r,$.lift(i),yn.None);if(!(!o||!o.tokens))return IBe({id:0,type:"full",data:o.tokens.data})});const Dde="editor.semanticHighlighting";function x5(n,e,t){const i=t.getValue(Dde,{overrideIdentifier:n.getLanguageId(),resource:n.uri})?.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var OBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},_p=function(n,e){return function(t,i){e(t,i,n)}},J0;let Kte=class extends me{constructor(e,t,i,r,s,o){super(),this._watchers=Object.create(null);const a=u=>{this._watchers[u.uri.toString()]=new Gte(u,e,i,s,o)},l=(u,d)=>{d.dispose(),delete this._watchers[u.uri.toString()]},c=()=>{for(const u of t.getModels()){const d=this._watchers[u.uri.toString()];x5(u,i,r)?d||a(u):d&&l(u,d)}};t.getModels().forEach(u=>{x5(u,i,r)&&a(u)}),this._register(t.onModelAdded(u=>{x5(u,i,r)&&a(u)})),this._register(t.onModelRemoved(u=>{const d=this._watchers[u.uri.toString()];d&&l(u,d)})),this._register(r.onDidChangeConfiguration(u=>{u.affectsConfiguration(Dde)&&c()})),this._register(i.onDidColorThemeChange(c))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};Kte=OBe([_p(0,rW),_p(1,Sr),_p(2,go),_p(3,kn),_p(4,cd),_p(5,dt)],Kte);let Gte=class extends me{static{J0=this}static{this.REQUEST_MIN_DELAY=300}static{this.REQUEST_MAX_DELAY=2e3}constructor(e,t,i,r,s){super(),this._semanticTokensStylingService=t,this._isDisposed=!1,this._model=e,this._provider=s.documentSemanticTokensProvider,this._debounceInformation=r.for(this._provider,"DocumentSemanticTokens",{min:J0.REQUEST_MIN_DELAY,max:J0.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Ui(()=>this._fetchDocumentSemanticTokensNow(),J0.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeAttached(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)}));const o=()=>{er(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const a of this._provider.all(e))typeof a.onDidChange=="function"&&this._documentProvidersChangeListeners.push(a.onDidChange(()=>{if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}))};o(),this._register(this._provider.onDidChange(()=>{o(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(i.onDidColorThemeChange(a=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),er(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!NBe(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new Kr,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,r=RBe(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const s=[],o=this._model.onDidChangeContent(l=>{s.push(l)}),a=new Bo(!1);r.then(l=>{if(this._debounceInformation.update(this._model,a.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,o.dispose(),!l)this._setDocumentSemanticTokens(null,null,null,s);else{const{provider:c,tokens:u}=l,d=this._semanticTokensStylingService.getStyling(c);this._setDocumentSemanticTokens(c,u||null,d,s)}},l=>{l&&(uh(l)||typeof l.message=="string"&&l.message.indexOf("busy")!==-1)||rn(l),this._currentDocumentRequestCancellationTokenSource=null,o.dispose(),(s.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,i,r,s){s=Math.min(s,i.length-r,e.length-t);for(let o=0;o{(r.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!i){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),o();return}if(ABe(t)){if(!s){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:s.data};else{let a=0;for(const h of t.edits)a+=(h.data?h.data.length:0)-h.deleteCount;const l=s.data,c=new Uint32Array(l.length+a);let u=l.length,d=c.length;for(let h=t.edits.length-1;h>=0;h--){const f=t.edits[h];if(f.start>l.length){i.warnInvalidEditStart(s.resultId,t.resultId,h,f.start,l.length),this._model.tokenization.setSemanticTokens(null,!0);return}const g=u-(f.start+f.deleteCount);g>0&&(J0._copy(l,u-g,c,d-g,g),d-=g),f.data&&(J0._copy(f.data,0,c,d-f.data.length,f.data.length),d-=f.data.length),u=f.start}u>0&&J0._copy(l,0,c,0,u),t={resultId:t.resultId,data:c}}}if(SH(t)){this._currentDocumentResponse=new _$t(e,t.resultId,t.data);const a=lFe(t,i,this._model.getLanguageId());if(r.length>0)for(const l of r)for(const c of a)for(const u of l.changes)c.applyEdit(u.range,u.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);o()}};Gte=J0=OBe([_p(1,rW),_p(2,go),_p(3,cd),_p(4,dt)],Gte);class _$t{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}u2(Kte);var v$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},GT=function(n,e){return function(t,i){e(t,i,n)}};let i7=class extends me{static{this.ID="editor.contrib.viewportSemanticTokens"}constructor(e,t,i,r,s,o){super(),this._semanticTokensStylingService=t,this._themeService=i,this._configurationService=r,this._editor=e,this._provider=o.documentRangeSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new Ui(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[];const a=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange(()=>{a()})),this._register(this._editor.onDidChangeModel(()=>{this._cancelAll(),a()})),this._register(this._editor.onDidChangeModelContent(l=>{this._cancelAll(),a()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration(Dde)&&(this._cancelAll(),a())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),a()})),a()}_cancelAll(){for(const e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,i=this._outstandingRequests.length;tthis._requestRange(e,i)))}_requestRange(e,t){const i=e.getVersionId(),r=ko(o=>Promise.resolve(Tde(this._provider,e,t,o))),s=new Bo(!1);return r.then(o=>{if(this._debounceInformation.update(e,s.elapsed()),!o||!o.tokens||e.isDisposed()||e.getVersionId()!==i)return;const{provider:a,tokens:l}=o,c=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,lFe(l,c,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(r),()=>this._removeOutstandingRequest(r)),r}};i7=v$t([GT(1,rW),GT(2,go),GT(3,kn),GT(4,cd),GT(5,dt)],i7);Zn(i7.ID,i7,1);class b$t{constructor(e=!0){this.selectSubwords=e}provideSelectionRanges(e,t){const i=[];for(const r of t){const s=[];i.push(s),this.selectSubwords&&this._addInWordRanges(s,e,r),this._addWordRanges(s,e,r),this._addWhitespaceLine(s,e,r),s.push({range:e.getFullModelRange()})}return i}_addInWordRanges(e,t,i){const r=t.getWordAtPosition(i);if(!r)return;const{word:s,startColumn:o}=r,a=i.column-o;let l=a,c=a,u=0;for(;l>=0;l--){const d=s.charCodeAt(l);if(l!==a&&(d===95||d===45))break;if(Tv(d)&&fp(u))break;u=d}for(l+=1;c0&&t.getLineFirstNonWhitespaceColumn(i.lineNumber)===0&&t.getLineLastNonWhitespaceColumn(i.lineNumber)===0&&e.push({range:new $(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var y$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},w$t=function(n,e){return function(t,i){e(t,i,n)}},Yte;class Ide{constructor(e,t){this.index=e,this.ranges=t}mov(e){const t=this.index+(e?1:-1);if(t<0||t>=this.ranges.length)return this;const i=new Ide(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}let bR=class{static{Yte=this}static{this.ID="editor.contrib.smartSelectController"}static get(e){return e.getContribution(Yte.ID)}constructor(e,t){this._editor=e,this._languageFeaturesService=t,this._ignoreSelection=!1}dispose(){this._selectionListener?.dispose()}async run(e){if(!this._editor.hasModel())return;const t=this._editor.getSelections(),i=this._editor.getModel();if(this._state||await FBe(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(114),yn.None).then(s=>{if(!(!bl(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!$r(this._editor.getSelections(),t,(o,a)=>o.equalsSelection(a)))){for(let o=0;oa.containsPosition(t[o].getStartPosition())&&a.containsPosition(t[o].getEndPosition())),s[o].unshift(t[o]);this._state=s.map(o=>new Ide(0,o)),this._selectionListener?.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{this._ignoreSelection||(this._selectionListener?.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(s=>s.mov(e));const r=this._state.map(s=>yt.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(r)}finally{this._ignoreSelection=!1}}};bR=Yte=y$t([w$t(1,dt)],bR);class MBe extends ot{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=bR.get(t);i&&await i.run(this._forward)}}class C$t extends MBe{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:w("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"1_basic",title:w({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}Un.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class x$t extends MBe{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:w("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"1_basic",title:w({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}Zn(bR.ID,bR,4);Pe(C$t);Pe(x$t);async function FBe(n,e,t,i,r){const s=n.all(e).concat(new b$t(i.selectSubwords));s.length===1&&s.unshift(new Ah);const o=[],a=[];for(const l of s)o.push(Promise.resolve(l.provideSelectionRanges(e,t,r)).then(c=>{if(bl(c)&&c.length===t.length)for(let u=0;u{if(l.length===0)return[];l.sort((h,f)=>he.isBefore(h.getStartPosition(),f.getStartPosition())?1:he.isBefore(f.getStartPosition(),h.getStartPosition())||he.isBefore(h.getEndPosition(),f.getEndPosition())?-1:he.isBefore(f.getEndPosition(),h.getEndPosition())?1:0);const c=[];let u;for(const h of l)(!u||$.containsRange(h,u)&&!$.equalsRange(h,u))&&(c.push(h),u=h);if(!i.selectLeadingAndTrailingWhitespace)return c;const d=[c[0]];for(let h=1;hn}),aK="data-sticky-line-index",$xe="data-sticky-is-line",k$t="data-sticky-is-line-number",Wxe="data-sticky-is-folding-icon";class E$t extends me{constructor(e){super(),this._editor=e,this._foldingIconStore=new ke,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._lineHeight=this._editor.getOption(67),this._renderedStickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",e instanceof cf),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const t=()=>{this._linesDomNode.style.left=this._editor.getOption(116).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(116)&&t(),i.hasChanged(67)&&(this._lineHeight=this._editor.getOption(67))})),this._register(this._editor.onDidScrollChange(i=>{i.scrollLeftChanged&&t(),i.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),this._register(this._foldingIconStore),t(),this._register(this._editor.onDidLayoutChange(i=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(e){return this._renderedStickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,i){if(i===void 0&&(!this._previousState&&!e||this._previousState&&this._previousState.equals(e)))return;const r=this._isWidgetHeightZero(e),s=r?void 0:e,o=r?0:this._findLineToRebuildWidgetFrom(e,i);this._renderRootNode(s,t,o),this._previousState=e}_isWidgetHeightZero(e){if(!e)return!0;const t=e.startLineNumbers.length*this._lineHeight+e.lastLineRelativePosition;if(t>0){this._lastLineRelativePosition=e.lastLineRelativePosition;const i=[...e.startLineNumbers];e.showEndForLine!==null&&(i[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]),this._lineNumbers=i}else this._lastLineRelativePosition=0,this._lineNumbers=[];return t===0}_findLineToRebuildWidgetFrom(e,t){if(!e||!this._previousState)return 0;if(t!==void 0)return t;const i=this._previousState,r=e.startLineNumbers.findIndex(s=>!i.startLineNumbers.includes(s));return r===-1?0:r}_updateWidgetWidth(){const e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_clearStickyLinesFromLine(e){this._foldingIconStore.clear();for(let t=e;ta.scrollWidth))+r.verticalScrollbarWidth,this._editor.layoutOverlayWidget(this)}_setFoldingHoverListeners(){this._editor.getOption(111)==="mouseover"&&(this._foldingIconStore.add(Ce(this._lineNumbersDomNode,je.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(Ce(this._lineNumbersDomNode,je.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,i,r){const s=this._editor._getViewModel();if(!s)return;const o=s.coordinatesConverter.convertModelPositionToViewPosition(new he(t,1)).lineNumber,a=s.getViewLineRenderingData(o),l=this._editor.getOption(68);let c;try{c=Ol.filter(a.inlineDecorations,o,a.minColumn,a.maxColumn)}catch{c=[]}const u=new n1(!0,!0,a.content,a.continuesWithWrappedLine,a.isBasicASCII,a.containsRTL,0,a.tokens,c,a.tabSize,a.startVisibleColumn,1,1,1,500,"none",!0,!0,null),d=new XL(2e3),h=mO(u,d);let f;Bxe?f=Bxe.createHTML(d.build()):f=d.build();const g=document.createElement("span");g.setAttribute(aK,String(e)),g.setAttribute($xe,""),g.setAttribute("role","listitem"),g.tabIndex=0,g.className="sticky-line-content",g.classList.add(`stickyLine${t}`),g.style.lineHeight=`${this._lineHeight}px`,g.innerHTML=f;const p=document.createElement("span");p.setAttribute(aK,String(e)),p.setAttribute(k$t,""),p.className="sticky-line-number",p.style.lineHeight=`${this._lineHeight}px`;const m=r.contentLeft;p.style.width=`${m}px`;const _=document.createElement("span");l.renderType===1||l.renderType===3&&t%10===0?_.innerText=t.toString():l.renderType===2&&(_.innerText=Math.abs(t-this._editor.getPosition().lineNumber).toString()),_.className="sticky-line-number-inner",_.style.lineHeight=`${this._lineHeight}px`,_.style.width=`${r.lineNumbersWidth}px`,_.style.paddingLeft=`${r.lineNumbersLeft}px`,p.appendChild(_);const v=this._renderFoldingIconForLine(i,t);v&&p.appendChild(v.domNode),this._editor.applyFontInfo(g),this._editor.applyFontInfo(_),p.style.lineHeight=`${this._lineHeight}px`,g.style.lineHeight=`${this._lineHeight}px`,p.style.height=`${this._lineHeight}px`,g.style.height=`${this._lineHeight}px`;const y=new L$t(e,t,g,p,v,h.characterMapping,g.scrollWidth);return this._updateTopAndZIndexOfStickyLine(y)}_updateTopAndZIndexOfStickyLine(e){const t=e.index,i=e.lineDomNode,r=e.lineNumberDomNode,s=t===this._lineNumbers.length-1,o="0",a="1";i.style.zIndex=s?o:a,r.style.zIndex=s?o:a;const l=`${t*this._lineHeight+this._lastLineRelativePosition+(e.foldingIcon?.isCollapsed?1:0)}px`,c=`${t*this._lineHeight}px`;return i.style.top=s?l:c,r.style.top=s?l:c,e}_renderFoldingIconForLine(e,t){const i=this._editor.getOption(111);if(!e||i==="never")return;const r=e.regions,s=r.findRange(t),o=r.getStartLineNumber(s);if(!(t===o))return;const l=r.isCollapsed(s),c=new T$t(l,o,r.getEndLineNumber(s),this._lineHeight);return c.setVisible(this._isOnGlyphMargin?!0:l||i==="always"),c.domNode.setAttribute(Wxe,""),c}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOridinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e0)return null;const t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;const i=Ace(t.characterMapping,e,0);return new he(t.lineNumber,i)}getLineNumberFromChildDomNode(e){return this._getRenderedStickyLineFromChildDomNode(e)?.lineNumber??null}_getRenderedStickyLineFromChildDomNode(e){const t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._renderedStickyLines.length?null:this._renderedStickyLines[t]}getLineIndexFromChildDomNode(e){const t=this._getAttributeValue(e,aK);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,$xe)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,Wxe)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class L$t{constructor(e,t,i,r,s,o,a){this.index=e,this.lineNumber=t,this.lineDomNode=i,this.lineNumberDomNode=r,this.foldingIcon=s,this.characterMapping=o,this.scrollWidth=a}}class T$t{constructor(e,t,i,r){this.isCollapsed=e,this.foldingStartLine=t,this.foldingEndLine=i,this.dimension=r,this.domNode=document.createElement("div"),this.domNode.style.width=`${r}px`,this.domNode.style.height=`${r}px`,this.domNode.className=zt.asClassName(e?H9:W9)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class ZI{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class r7{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class BBe{constructor(e,t,i,r){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=r}}var kH=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},yR=function(n,e){return function(t,i){e(t,i,n)}},XI;(function(n){n.OUTLINE_MODEL="outlineModel",n.FOLDING_PROVIDER_MODEL="foldingProviderModel",n.INDENTATION_MODEL="indentationModel"})(XI||(XI={}));var Hv;(function(n){n[n.VALID=0]="VALID",n[n.INVALID=1]="INVALID",n[n.CANCELED=2]="CANCELED"})(Hv||(Hv={}));let Zte=class extends me{constructor(e,t,i,r){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new Qd(300)),this._updateOperation=this._register(new ke),this._editor.getOption(116).defaultModel){case XI.OUTLINE_MODEL:this._modelProviders.push(new Xte(this._editor,r));case XI.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new Jte(this._editor,t,r));case XI.INDENTATION_MODEL:this._modelProviders.push(new Qte(this._editor,i));break}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(const t of this._modelProviders){const{statusPromise:i,modelPromise:r}=t.computeStickyModel(e);this._modelPromise=r;const s=await i;if(this._modelPromise!==r)return null;switch(s){case Hv.CANCELED:return this._updateOperation.clear(),null;case Hv.VALID:return t.stickyModel}}return null}).catch(t=>(rn(t),null))}};Zte=kH([yR(2,Tt),yR(3,dt)],Zte);class $Be extends me{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,Hv.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=ko(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?Hv.CANCELED:(this._stickyModel=this.createStickyModel(e,i),Hv.VALID):this._invalid()).then(void 0,i=>(rn(i),Hv.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let Xte=class extends $Be{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return n_.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){const{stickyOutlineElement:i,providerID:r}=this._stickyModelFromOutlineModel(t,this._stickyModel?.outlineProviderId),s=this._editor.getModel();return new BBe(s.uri,s.getVersionId(),i,r)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(zn.first(e.children.values())instanceof oBe){const a=zn.find(e.children.values(),l=>l.id===t);if(a)i=a.children;else{let l="",c=-1,u;for(const[d,h]of e.children.entries()){const f=this._findSumOfRangesOfGroup(h);f>c&&(u=h,c=f,l=h.id)}t=l,i=u.children}}else i=e.children;const r=[],s=Array.from(i.values()).sort((a,l)=>{const c=new ZI(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),u=new ZI(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber);return this._comparator(c,u)});for(const a of s)r.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new r7(void 0,r,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){const i=[];for(const s of e.children.values())if(s.symbol.selectionRange.startLineNumber!==s.symbol.range.endLineNumber)if(s.symbol.selectionRange.startLineNumber!==t)i.push(this._stickyModelFromOutlineElement(s,s.symbol.selectionRange.startLineNumber));else for(const o of s.children.values())i.push(this._stickyModelFromOutlineElement(o,s.symbol.selectionRange.startLineNumber));i.sort((s,o)=>this._comparator(s.range,o.range));const r=new ZI(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new r7(r,i,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(const i of e.children.values())t+=this._findSumOfRangesOfGroup(i);return e instanceof tte?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};Xte=kH([yR(1,dt)],Xte);class WBe extends $Be{constructor(e){super(e),this._foldingLimitReporter=new iBe(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),r=this._editor.getModel();return new BBe(r.uri,r.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],r=new r7(void 0,[],void 0);for(let s=0;s0&&(this.provider=this._register(new ede(e.getModel(),r,t,this._foldingLimitReporter,void 0)))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){return this.provider?.compute(e)??null}};Jte=kH([yR(2,dt)],Jte);var D$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Hxe=function(n,e){return function(t,i){e(t,i,n)}};class I$t{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let ene=class extends me{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new fe),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new ke),this._updateSoon=this._register(new Ui(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(116)&&this.readConfiguration()})),this.readConfiguration()}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(116).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this._sessionStore.add(Lt(()=>{this._stickyModelProvider?.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update())}getVersionId(){return this._model?.version}updateStickyModelProvider(){this._stickyModelProvider?.dispose(),this._stickyModelProvider=null;const e=this._editor;e.hasModel()&&(this._stickyModelProvider=new Zte(e,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){this._cts?.dispose(!0),this._cts=new Kr,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}const t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}updateIndex(e){return e===-1?e=0:e<0&&(e=-e-2),e}getCandidateStickyLinesIntersectingFromStickyModel(e,t,i,r,s){if(t.children.length===0)return;let o=s;const a=[];for(let u=0;uu-d)),c=this.updateIndex(JA(a,e.startLineNumber+r,(u,d)=>u-d));for(let u=l;u<=c;u++){const d=t.children[u];if(!d)return;if(d.range){const h=d.range.startLineNumber,f=d.range.endLineNumber;e.startLineNumber<=f+1&&h-1<=e.endLineNumber&&h!==o&&(o=h,i.push(new I$t(h,f-1,r+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,d,i,r+1,h))}else this.getCandidateStickyLinesIntersectingFromStickyModel(e,d,i,r,s)}}getCandidateStickyLinesIntersecting(e){if(!this._model?.element)return[];let t=[];this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,t,0,-1);const i=this._editor._getViewModel()?.getHiddenAreas();if(i)for(const r of i)t=t.filter(s=>!(s.startLineNumber>=r.startLineNumber&&s.endLineNumber<=r.endLineNumber+1));return t}};ene=D$t([Hxe(1,dt),Hxe(2,Zr)],ene);var A$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Tx=function(n,e){return function(t,i){e(t,i,n)}},tne;let i0=class extends me{static{tne=this}static{this.ID="store.contrib.stickyScrollController"}constructor(e,t,i,r,s,o,a){super(),this._editor=e,this._contextMenuService=t,this._languageFeaturesService=i,this._instaService=r,this._contextKeyService=a,this._sessionStore=new ke,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._stickyScrollWidget=new E$t(this._editor),this._stickyLineCandidateProvider=new ene(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=YI.Empty,this._onDidResize(),this._readConfiguration();const l=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(u=>{this._readConfigurationChange(u)})),this._register(Ce(l,je.CONTEXT_MENU,async u=>{this._onContextMenu(Ot(l),u)})),this._stickyScrollFocusedContextKey=Q.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=Q.stickyScrollVisible.bindTo(this._contextKeyService);const c=this._register(Eg(l));this._register(c.onDidBlur(u=>{this._positionRevealed===!1&&l.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(c.onDidFocus(u=>{this.focus()})),this._registerMouseListeners(),this._register(Ce(l,je.MOUSE_DOWN,u=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(tne.ID)}_disposeFocusStickyScrollStore(){this._stickyScrollFocusedContextKey.set(!1),this._focusDisposableStore?.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new ke,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection($.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new ke),t=this._register(new hH(this._editor,{extractLineNumberFromMouseEvent:s=>{const o=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);return o?o.lineNumber:0}})),i=s=>{if(!this._editor.hasModel()||s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return null;const o=s.target.element;if(!o||o.innerText!==o.innerHTML)return null;const a=this._stickyScrollWidget.getEditorPositionFromNode(o);return a?{range:new $(a.lineNumber,a.column,a.lineNumber,a.column+o.innerText.length),textElement:o}:null},r=this._stickyScrollWidget.getDomNode();this._register(Jr(r,je.CLICK,s=>{if(s.ctrlKey||s.altKey||s.metaKey||!s.leftButton)return;if(s.shiftKey){const c=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(c===null)return;const u=new he(this._endLineNumbers[c],1);this._revealLineInCenterIfOutsideViewport(u);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(s.target)){const c=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);this._toggleFoldingRegionForLine(c);return}if(!this._stickyScrollWidget.isInStickyLine(s.target))return;let l=this._stickyScrollWidget.getEditorPositionFromNode(s.target);if(!l){const c=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);if(c===null)return;l=new he(c,1)}this._revealPosition(l)})),this._register(Jr(r,je.MOUSE_MOVE,s=>{if(s.shiftKey){const o=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(o===null||this._showEndForLine!==null&&this._showEndForLine===o)return;this._showEndForLine=o,this._renderStickyScroll();return}this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(Ce(r,je.MOUSE_LEAVE,s=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([s,o])=>{const a=i(s);if(!a||!s.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}const{range:l,textElement:c}=a;if(!l.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=l,e.clear();else if(c.style.textDecoration==="underline")return;const u=new Kr;e.add(Lt(()=>u.dispose(!0)));let d;EO(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new he(l.startLineNumber,l.startColumn+1),!1,u.token).then(h=>{if(!u.token.isCancellationRequested)if(h.length!==0){this._candidateDefinitionsLength=h.length;const f=c;d!==f?(e.clear(),d=f,d.style.textDecoration="underline",e.add(Lt(()=>{d.style.textDecoration="none"}))):d||(d=f,d.style.textDecoration="underline",e.add(Lt(()=>{d.style.textDecoration="none"})))}else e.clear()})})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async s=>{if(s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return;const o=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);o&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:o.lineNumber,column:1})),this._instaService.invokeFunction($7e,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new qh(e,t);this._contextMenuService.showContextMenu({menuId:ce.StickyScrollContext,getAnchor:()=>i})}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;const t=this._stickyScrollWidget.getRenderedStickyLine(e),i=t?.foldingIcon;if(!i)return;Zue(this._foldingModel,Number.MAX_VALUE,[e]),i.isCollapsed=!i.isCollapsed;const r=(i.isCollapsed?this._editor.getTopForLineNumber(i.foldingEndLine):this._editor.getTopForLineNumber(i.foldingStartLine))-this._editor.getOption(67)*t.index+1;this._editor.setScrollTop(r),this._renderStickyScroll(e)}_readConfiguration(){const e=this._editor.getOption(116);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(i=>{i.scrollTopChanged&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(i=>this._onTokensChange(i))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=void 0,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(68).renderType===2&&this._sessionStore.add(this._editor.onDidChangeCursorPosition(()=>{this._showEndForLine=void 0,this._renderStickyScroll(0)}))}_readConfigurationChange(e){(e.hasChanged(116)||e.hasChanged(73)||e.hasChanged(67)||e.hasChanged(111)||e.hasChanged(68))&&this._readConfiguration(),e.hasChanged(68)&&this._renderStickyScroll(0)}_needsUpdate(e){const t=this._stickyScrollWidget.getCurrentLines();for(const i of t)for(const r of e.ranges)if(i>=r.fromLineNumber&&i<=r.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(0)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(67);this._maxStickyLines=Math.round(t*.25)}async _renderStickyScroll(e){const t=this._editor.getModel();if(!t||t.isTooLargeForTokenization()){this._resetState();return}const i=this._updateAndGetMinRebuildFromLine(e),r=this._stickyLineCandidateProvider.getVersionId();if(r===void 0||r===t.getVersionId())if(!this._focused)await this._updateState(i);else if(this._focusedStickyElementIndex===-1)await this._updateState(i),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const o=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(i),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(o)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}_updateAndGetMinRebuildFromLine(e){if(e!==void 0){const t=this._minRebuildFromLine!==void 0?this._minRebuildFromLine:1/0;this._minRebuildFromLine=Math.min(e,t)}return this._minRebuildFromLine}async _updateState(e){this._minRebuildFromLine=void 0,this._foldingModel=await Fb.get(this._editor)?.getFoldingModel()??void 0,this._widgetState=this.findScrollWidgetState();const t=this._widgetState.startLineNumbers.length>0;this._stickyScrollVisibleContextKey.set(t),this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e)}async _resetState(){this._minRebuildFromLine=void 0,this._foldingModel=void 0,this._widgetState=YI.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){const e=this._editor.getOption(67),t=Math.min(this._maxStickyLines,this._editor.getOption(116).maxLineCount),i=this._editor.getScrollTop();let r=0;const s=[],o=[],a=this._editor.getVisibleRanges();if(a.length!==0){const l=new ZI(a[0].startLineNumber,a[a.length-1].endLineNumber),c=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(l);for(const u of c){const d=u.startLineNumber,h=u.endLineNumber,f=u.nestingDepth;if(h-d>0){const g=(f-1)*e,p=f*e,m=this._editor.getBottomForLineNumber(d)-i,_=this._editor.getTopForLineNumber(h)-i,v=this._editor.getBottomForLineNumber(h)-i;if(g>_&&g<=v){s.push(d),o.push(h+1),r=v-p;break}else p>m&&p<=v&&(s.push(d),o.push(h+1));if(s.length===t)break}}}return this._endLineNumbers=o,new YI(s,o,r,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};i0=tne=A$t([Tx(1,mu),Tx(2,dt),Tx(3,Tt),Tx(4,Zr),Tx(5,cd),Tx(6,jt)],i0);class N$t extends Gl{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...Gt("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:w({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:Gt("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:S$t.View,toggled:{condition:Le.equals("config.editor.stickyScroll.enabled",!0),title:w("stickyScroll","Sticky Scroll"),mnemonicTitle:w({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:ce.CommandPalette},{id:ce.MenubarAppearanceMenu,group:"4_editor",order:3},{id:ce.StickyScrollContext}]})}async run(e){const t=e.get(kn),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const EH=100;class R$t extends Fg{constructor(){super({id:"editor.action.focusStickyScroll",title:{...Gt("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:w({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:Le.and(Le.has("config.editor.stickyScroll.enabled"),Q.stickyScrollVisible),menu:[{id:ce.CommandPalette}]})}runEditorCommand(e,t){i0.get(t)?.focus()}}class P$t extends Fg{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:Gt("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:Q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:EH,primary:18}})}runEditorCommand(e,t){i0.get(t)?.focusNext()}}class O$t extends Fg{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:Gt("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:Q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:EH,primary:16}})}runEditorCommand(e,t){i0.get(t)?.focusPrevious()}}class M$t extends Fg{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:Gt("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:Q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:EH,primary:3}})}runEditorCommand(e,t){i0.get(t)?.goToFocused()}}class F$t extends Fg{constructor(){super({id:"editor.action.selectEditor",title:Gt("selectEditor.title","Select Editor"),precondition:Q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:EH,primary:9}})}runEditorCommand(e,t){i0.get(t)?.selectEditor()}}Zn(i0.ID,i0,1);lr(N$t);lr(R$t);lr(O$t);lr(P$t);lr(M$t);lr(F$t);var HBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},KD=function(n,e){return function(t,i){e(t,i,n)}};class B$t{constructor(e,t,i,r,s,o){this.range=e,this.insertText=t,this.filterText=i,this.additionalTextEdits=r,this.command=s,this.completion=o}}let nne=class extends mmt{constructor(e,t,i,r,s,o){super(s.disposable),this.model=e,this.line=t,this.word=i,this.completionModel=r,this._suggestMemoryService=o}canBeReused(e,t,i){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===i.startColumn&&this.word.endColumn=0&&a.resolve(yn.None)}return e}};nne=HBe([KD(5,yH)],nne);let ine=class extends me{constructor(e,t,i,r){super(),this._languageFeatureService=e,this._clipboardService=t,this._suggestMemoryService=i,this._editorService=r,this._store.add(e.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(e,t,i,r){if(i.selectedSuggestionInfo)return;let s;for(const f of this._editorService.listCodeEditors())if(f.getModel()===e){s=f;break}if(!s)return;const o=s.getOption(90);if(WS.isAllOff(o))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const a=e.tokenization.getLineTokens(t.lineNumber),l=a.getStandardTokenType(a.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(WS.valueFor(o,l)!=="inline")return;let c=e.getWordAtPosition(t),u;if(c?.word||(u=this._getTriggerCharacterInfo(e,t)),!c?.word&&!u||(c||(c=e.getWordUntilPosition(t)),c.endColumn!==t.column))return;let d;const h=e.getValueInRange(new $(t.lineNumber,1,t.lineNumber,t.column));if(!u&&this._lastResult?.canBeReused(e,t.lineNumber,c)){const f=new kxe(h,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=f,this._lastResult.acquire(),d=this._lastResult}else{const f=await tde(this._languageFeatureService.completionProvider,e,t,new IO(void 0,G9.createSuggestFilter(s).itemKind,u?.providers),u&&{triggerKind:1,triggerCharacter:u.ch},r);let g;f.needsClipboard&&(g=await this._clipboardService.readText());const p=new yv(f.items,t.column,new kxe(h,0),dp.None,s.getOption(119),s.getOption(113),{boostFullMatch:!1,firstMatchCanBeWeak:!1},g);d=new nne(e,t.lineNumber,c,p,f,this._suggestMemoryService)}return this._lastResult=d,d}handleItemDidShow(e,t){t.completion.resolve(yn.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){const i=e.getValueInRange($.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),r=new Set;for(const s of this._languageFeatureService.completionProvider.all(e))s.triggerCharacters?.includes(i)&&r.add(s);if(r.size!==0)return{providers:r,ch:i}}};ine=HBe([KD(0,dt),KD(1,b0),KD(2,yH),KD(3,ai)],ine);u2(ine);class $$t extends ot{constructor(){super({id:"editor.action.forceRetokenize",label:w("forceRetokenize","Developer: Force Retokenize"),alias:"Developer: Force Retokenize",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getModel();i.tokenization.resetTokenization();const r=new Bo;i.tokenization.forceTokenization(i.getLineCount()),r.stop(),console.log(`tokenization took ${r.elapsed()}`)}}Pe($$t);class Ade extends Gl{static{this.ID="editor.action.toggleTabFocusMode"}constructor(){super({id:Ade.ID,title:Gt({key:"toggle.tabMovesFocus",comment:["Turn on/off use of tab key for moving focus around VS Code"]},"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:Gt("tabMovesFocusDescriptions","Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){const t=!xE.getTabFocusMode();xE.setTabFocusMode(t),ql(t?w("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element"):w("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}}lr(Ade);var W$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Vxe=function(n,e){return function(t,i){e(t,i,n)}};let rne=class extends me{get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}constructor(e,t,i={},r,s){super(),this._link=t,this._hoverService=r,this._enabled=!0,this.el=Ne(e,qe("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??Yl("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const o=this._register(new $n(this.el,"click")),a=this._register(new $n(this.el,"keypress")),l=Ge.chain(a.event,d=>d.map(h=>new or(h)).filter(h=>h.keyCode===3)),c=this._register(new $n(this.el,gr.Tap)).event;this._register(Fr.addTarget(this.el));const u=Ge.any(o.event,l,c);this._register(u(d=>{this.enabled&&(Hn.stop(d,!0),i?.opener?i.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}setTooltip(e){this.hoverDelegate.showNativeHover?this.el.title=e??"":!this.hover&&e?this.hover=this._register(this._hoverService.setupManagedHover(this.hoverDelegate,this.el,e)):this.hover&&this.hover.update(e)}};rne=W$t([Vxe(3,um),Vxe(4,Pc)],rne);var VBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},zBe=function(n,e){return function(t,i){e(t,i,n)}};const H$t=26;let sne=class extends me{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(one))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{this.hide(),e.onClose?.()}}),this._editor.setBanner(this.banner.element,H$t)}};sne=VBe([zBe(1,Tt)],sne);let one=class extends me{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(Q_,{}),this.element=qe("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){const t=qe("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){Jo(this.element)}show(e){Jo(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=Ne(this.element,qe("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(qe(`div${zt.asCSSSelector(e.icon)}`));const r=Ne(this.element,qe("div.message-container"));if(r.setAttribute("aria-hidden","true"),r.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=Ne(this.element,qe("div.message-actions-container")),e.actions)for(const o of e.actions)this._register(this.instantiationService.createInstance(rne,this.messageActionsContainer,{...o,tabIndex:-1},{}));const s=Ne(this.element,qe("div.action-container"));this.actionBar=this._register(new ed(s)),this.actionBar.push(this._register(new su("banner.close","Close Banner",zt.asClassName(z6e),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};one=VBe([zBe(0,Tt)],one);var Nde=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Rk=function(n,e){return function(t,i){e(t,i,n)}};const V$t=kr("extensions-warning-message",ze.warning,w("warningIcon","Icon shown with a warning message in the extensions editor."));let wR=class extends me{static{this.ID="editor.contrib.unicodeHighlighter"}constructor(e,t,i,r){super(),this._editor=e,this._editorWorkerService=t,this._workspaceTrustService=i,this._highlighter=null,this._bannerClosed=!1,this._updateState=s=>{if(s&&s.hasMore){if(this._bannerClosed)return;const o=Math.max(s.ambiguousCharacterCount,s.nonBasicAsciiCharacterCount,s.invisibleCharacterCount);let a;if(s.nonBasicAsciiCharacterCount>=o)a={message:w("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new RO};else if(s.ambiguousCharacterCount>=o)a={message:w("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new RC};else if(s.invisibleCharacterCount>=o)a={message:w("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new NO};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:V$t,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(r.createInstance(sne,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(126),this._register(i.onDidChangeTrust(s=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(s=>{s.hasChanged(126)&&(this._options=e.getOption(126),this._updateHighlighter())})),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const e=z$t(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(i=>i===!1))return;const t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(i=>i.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(i=>i==="_os"?new Intl.NumberFormat().resolvedOptions().locale:i==="_vscode"?gpt:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new ane(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new U$t(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};wR=Nde([Rk(1,Oc),Rk(2,i5e),Rk(3,Tt)],wR);function z$t(n,e){return{nonBasicASCII:e.nonBasicASCII===Iu?!n:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===Iu?!n:e.includeComments,includeStrings:e.includeStrings===Iu?!n:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let ane=class extends me{constructor(e,t,i,r){super(),this._editor=e,this._options=t,this._updateState=i,this._editorWorkerService=r,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Ui(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);const i=[];if(!t.hasMore)for(const r of t.ranges)i.push({range:r,options:LH.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!Yce(t,e))return null;const i=t.getValueInRange(e.range);return{reason:jBe(i,this._options),inComment:Zce(t,e),inString:Xce(t,e)}}};ane=Nde([Rk(3,Oc)],ane);class U$t extends me{constructor(e,t,i){super(),this._editor=e,this._options=t,this._updateState=i,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Ui(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._editor.getVisibleRanges(),t=[],i={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const r of e){const s=Jae.computeUnicodeHighlights(this._model,this._options,r);for(const o of s.ranges)i.ranges.push(o);i.ambiguousCharacterCount+=i.ambiguousCharacterCount,i.invisibleCharacterCount+=i.invisibleCharacterCount,i.nonBasicAsciiCharacterCount+=i.nonBasicAsciiCharacterCount,i.hasMore=i.hasMore||s.hasMore}if(!i.hasMore)for(const r of i.ranges)t.push({range:r,options:LH.instance.getDecorationFromOptions(this._options)});this._updateState(i),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel(),i=t.getValueInRange(e.range);return Yce(t,e)?{reason:jBe(i,this._options),inComment:Zce(t,e),inString:Xce(t,e)}:null}}const UBe=w("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let lne=class{constructor(e,t,i){this._editor=e,this._languageService=t,this._openerService=i,this.hoverOrdinal=5}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),r=this._editor.getContribution(wR.ID);if(!r)return[];const s=[],o=new Set;let a=300;for(const l of t){const c=r.getDecorationInfo(l);if(!c)continue;const d=i.getValueInRange(l.range).codePointAt(0),h=lK(d);let f;switch(c.reason.kind){case 0:{KP(c.reason.confusableWith)?f=w("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",h,lK(c.reason.confusableWith.codePointAt(0))):f=w("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",h,lK(c.reason.confusableWith.codePointAt(0)));break}case 1:f=w("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",h);break;case 2:f=w("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",h);break}if(o.has(f))continue;o.add(f);const g={codePoint:d,reason:c.reason,inComment:c.inComment,inString:c.inString},p=w("unicodeHighlight.adjustSettings","Adjust settings"),m=`command:${TH.ID}?${encodeURIComponent(JSON.stringify(g))}`,_=new za("",!0).appendMarkdown(f).appendText(" ").appendLink(m,p,UBe);s.push(new Uh(this,l.range,[_],!1,a++))}return s}renderHoverParts(e,t){return mFt(e,t,this._editor,this._languageService,this._openerService)}};lne=Nde([Rk(1,Hr),Rk(2,Pc)],lne);function cne(n){return`U+${n.toString(16).padStart(4,"0")}`}function lK(n){let e=`\`${cne(n)}\``;return I_.isInvisibleCharacter(n)||(e+=` "${`${j$t(n)}`}"`),e}function j$t(n){return n===96?"`` ` ``":"`"+String.fromCodePoint(n)+"`"}function jBe(n,e){return Jae.computeUnicodeHighlightReason(n,e)}class LH{constructor(){this.map=new Map}static{this.instance=new LH}getDecorationFromOptions(e){return this.getDecoration(!e.includeComments,!e.includeStrings)}getDecoration(e,t){const i=`${e}${t}`;let r=this.map.get(i);return r||(r=un.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:e,hideInStringTokens:t}),this.map.set(i,r)),r}}class q$t extends ot{constructor(){super({id:RC.ID,label:w("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const r=e?.get(kn);r&&this.runAction(r)}async runAction(e){await e.updateValue(cc.includeComments,!1,2)}}class K$t extends ot{constructor(){super({id:RC.ID,label:w("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const r=e?.get(kn);r&&this.runAction(r)}async runAction(e){await e.updateValue(cc.includeStrings,!1,2)}}class RC extends ot{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters"}constructor(){super({id:RC.ID,label:w("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const r=e?.get(kn);r&&this.runAction(r)}async runAction(e){await e.updateValue(cc.ambiguousCharacters,!1,2)}}class NO extends ot{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters"}constructor(){super({id:NO.ID,label:w("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const r=e?.get(kn);r&&this.runAction(r)}async runAction(e){await e.updateValue(cc.invisibleCharacters,!1,2)}}class RO extends ot{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters"}constructor(){super({id:RO.ID,label:w("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const r=e?.get(kn);r&&this.runAction(r)}async runAction(e){await e.updateValue(cc.nonBasicASCII,!1,2)}}class TH extends ot{static{this.ID="editor.action.unicodeHighlight.showExcludeOptions"}constructor(){super({id:TH.ID,label:w("action.unicodeHighlight.showExcludeOptions","Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}async run(e,t,i){const{codePoint:r,reason:s,inString:o,inComment:a}=i,l=String.fromCodePoint(r),c=e.get(hh),u=e.get(kn);function d(g){return I_.isInvisibleCharacter(g)?w("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",cne(g)):w("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${cne(g)} "${l}"`)}const h=[];if(s.kind===0)for(const g of s.notAmbiguousInLocales)h.push({label:w("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',g),run:async()=>{Y$t(u,[g])}});if(h.push({label:d(r),run:()=>G$t(u,[r])}),a){const g=new q$t;h.push({label:g.label,run:async()=>g.runAction(u)})}else if(o){const g=new K$t;h.push({label:g.label,run:async()=>g.runAction(u)})}if(s.kind===0){const g=new RC;h.push({label:g.label,run:async()=>g.runAction(u)})}else if(s.kind===1){const g=new NO;h.push({label:g.label,run:async()=>g.runAction(u)})}else if(s.kind===2){const g=new RO;h.push({label:g.label,run:async()=>g.runAction(u)})}else Z$t(s);const f=await c.pick(h,{title:UBe});f&&await f.run()}}async function G$t(n,e){const t=n.getValue(cc.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const r of e)i[String.fromCodePoint(r)]=!0;await n.updateValue(cc.allowedCharacters,i,2)}async function Y$t(n,e){const t=n.inspect(cc.allowedLocales).user?.value;let i;typeof t=="object"&&t?i=Object.assign({},t):i={};for(const r of e)i[r]=!0;await n.updateValue(cc.allowedLocales,i,2)}function Z$t(n){throw new Error(`Unexpected value: ${n}`)}Pe(RC);Pe(NO);Pe(RO);Pe(TH);Zn(wR.ID,wR,1);DC.register(lne);var X$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},zxe=function(n,e){return function(t,i){e(t,i,n)}};const qBe="ignoreUnusualLineTerminators";function Q$t(n,e,t){n.setModelProperty(e.uri,qBe,t)}function J$t(n,e){return n.getModelProperty(e.uri,qBe)}let s7=class extends me{static{this.ID="editor.contrib.unusualLineTerminatorsDetector"}constructor(e,t,i){super(),this._editor=e,this._dialogService=t,this._codeEditorService=i,this._isPresentingDialog=!1,this._config=this._editor.getOption(127),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(127)&&(this._config=this._editor.getOption(127),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(r=>{r.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;const e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||J$t(this._codeEditorService,e)===!0||this._editor.getOption(92))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let i;try{this._isPresentingDialog=!0,i=await this._dialogService.confirm({title:w("unusualLineTerminators.title","Unusual Line Terminators"),message:w("unusualLineTerminators.message","Detected unusual line terminators"),detail:w("unusualLineTerminators.detail","The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.",th(e.uri)),primaryButton:w({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:w("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){Q$t(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};s7=X$t([zxe(1,JP),zxe(2,ai)],s7);Zn(s7.ID,s7,1);var eWt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},tWt=function(n,e){return function(t,i){e(t,i,n)}};class Uxe{constructor(){this.selector={language:"*"}}provideDocumentHighlights(e,t,i){const r=[],s=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});return s?e.isDisposed()?void 0:e.findMatches(s.word,!0,!1,!0,N6,!1).map(a=>({range:a.range,kind:nE.Text})):Promise.resolve(r)}provideMultiDocumentHighlights(e,t,i,r){const s=new so,o=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});if(!o)return Promise.resolve(s);for(const a of[e,...i]){if(a.isDisposed())continue;const c=a.findMatches(o.word,!0,!1,!0,N6,!1).map(u=>({range:u.range,kind:nE.Text}));c&&s.set(a.uri,c)}return s}}let une=class extends me{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new Uxe)),this._register(e.multiDocumentHighlightProvider.register("*",new Uxe))}};une=eWt([tWt(0,dt)],une);var KBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},S5=function(n,e){return function(t,i){e(t,i,n)}},ys,dne;const Rde=new et("hasWordHighlights",!1);function GBe(n,e,t,i){const r=n.ordered(e);return Oae(r.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,vs)),s=>s!=null).then(s=>{if(s){const o=new so;return o.set(e.uri,s),o}return new so})}function nWt(n,e,t,i,r,s){const o=n.ordered(e);return Oae(o.map(a=>()=>{const l=s.filter(c=>z3e(c)).filter(c=>lle(a.selector,c.uri,c.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,l,r)).then(void 0,vs)}),a=>a!=null)}class YBe{constructor(e,t,i){this._model=e,this._selection=t,this._wordSeparators=i,this._wordRange=this._getCurrentWordRange(e,t),this._result=null}get result(){return this._result||(this._result=ko(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new $(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):null}isValid(e,t,i){const r=t.startLineNumber,s=t.startColumn,o=t.endColumn,a=this._getCurrentWordRange(e,t);let l=!!(this._wordRange&&this._wordRange.equalsRange(a));for(let c=0,u=i.length;!l&&c=o&&(l=!0)}return l}cancel(){this.result.cancel()}}class iWt extends YBe{constructor(e,t,i,r){super(e,t,i),this._providers=r}_compute(e,t,i,r){return GBe(this._providers,e,t.getPosition(),r).then(s=>s||new so)}}class rWt extends YBe{constructor(e,t,i,r,s){super(e,t,i),this._providers=r,this._otherModels=s}_compute(e,t,i,r){return nWt(this._providers,e,t.getPosition(),i,r,this._otherModels).then(s=>s||new so)}}function sWt(n,e,t,i,r){return new iWt(e,t,r,n)}function oWt(n,e,t,i,r,s){return new rWt(e,t,r,n,s)}Rc("_executeDocumentHighlights",async(n,e,t)=>{const i=n.get(dt);return(await GBe(i.documentHighlightProvider,e,t,yn.None))?.get(e.uri)});let hne=class{static{ys=this}static{this.storedDecorationIDs=new so}static{this.query=null}constructor(e,t,i,r,s){this.toUnhook=new ke,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new so,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.runDelayer=this.toUnhook.add(new Qd(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=Rde.bindTo(r),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(81),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition(o=>{this._ignorePositionChangeEvent||this.occurrencesHighlight!=="off"&&this.runDelayer.trigger(()=>{this._onPositionChanged(o)})})),this.toUnhook.add(e.onDidFocusEditorText(o=>{this.occurrencesHighlight!=="off"&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}))})),this.toUnhook.add(e.onDidChangeModelContent(o=>{O$(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(o=>{!o.newModelUrl&&o.oldModelUrl?this._stopSingular():ys.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(o=>{const a=this.editor.getOption(81);if(this.occurrencesHighlight!==a)switch(this.occurrencesHighlight=a,a){case"off":this._stopAll();break;case"singleFile":this._stopAll(ys.query?.modelInfo?.model);break;case"multiFile":ys.query&&this._run(!0);break;default:console.warn("Unknown occurrencesHighlight setting value:",a);break}})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,ys.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&(this.runDelayer.cancel(),this._run())}_getSortedHighlights(){return this.decorations.getRanges().sort($.compareRangesUsingStarts)}moveNext(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))+1)%e.length,r=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(r.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(r);const s=this._getWord();if(s){const o=this.editor.getModel().getLineContent(r.startLineNumber);ql(`${o}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))-1+e.length)%e.length,r=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(r.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(r);const s=this._getWord();if(s){const o=this.editor.getModel().getLineContent(r.startLineNumber);ql(`${o}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=ys.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),ys.storedDecorationIDs.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(e){const t=this.codeEditorService.listCodeEditors(),i=[];for(const r of t){if(!r.hasModel()||kN(r.getModel().uri,e?.uri))continue;const s=ys.storedDecorationIDs.get(r.getModel().uri);if(!s)continue;r.removeDecorations(s),i.push(r.getModel().uri);const o=$b.get(r);o?.wordHighlighter&&o.wordHighlighter.decorations.length>0&&(o.wordHighlighter.decorations.clear(),o.wordHighlighter.workerRequest=null,o.wordHighlighter._hasWordHighlights.set(!1))}for(const r of i)ys.storedDecorationIDs.delete(r)}_stopSingular(){this._removeSingleDecorations(),this.editor.hasTextFocus()&&(this.editor.getModel()?.uri.scheme!==sn.vscodeNotebookCell&&ys.query?.modelInfo?.model.uri.scheme!==sn.vscodeNotebookCell?(ys.query=null,this._run()):ys.query?.modelInfo&&(ys.query.modelInfo=null)),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(e){this._removeAllDecorations(e),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(e){if(this.occurrencesHighlight==="off"){this._stopAll();return}if(e.reason!==3&&this.editor.getModel()?.uri.scheme!==sn.vscodeNotebookCell){this._stopAll();return}this._run()}_getWord(){const e=this.editor.getSelection(),t=e.startLineNumber,i=e.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:t,column:i})}getOtherModelsToHighlight(e){if(!e)return[];if(e.uri.scheme===sn.vscodeNotebookCell){const s=[],o=this.codeEditorService.listCodeEditors();for(const a of o){const l=a.getModel();l&&l!==e&&l.uri.scheme===sn.vscodeNotebookCell&&s.push(l)}return s}const i=[],r=this.codeEditorService.listCodeEditors();for(const s of r){if(!mue(s))continue;const o=s.getModel();o&&e===o.modified&&i.push(o.modified)}if(i.length)return i;if(this.occurrencesHighlight==="singleFile")return[];for(const s of r){const o=s.getModel();o&&o!==e&&i.push(o)}return i}_run(e){let t;if(this.editor.hasTextFocus()){const r=this.editor.getSelection();if(!r||r.startLineNumber!==r.endLineNumber){ys.query=null,this._stopAll();return}const s=r.startColumn,o=r.endColumn,a=this._getWord();if(!a||a.startColumn>s||a.endColumn{r===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=o||[],this._beginRenderDecorations())},rn)}}computeWithModel(e,t,i,r){return r.length?oWt(this.multiDocumentProviders,e,t,i,this.editor.getOption(132),r):sWt(this.providers,e,t,i,this.editor.getOption(132))}_beginRenderDecorations(){const e=new Date().getTime(),t=this.lastCursorPositionChangeTime+250;e>=t?(this.renderDecorationsTimer=-1,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},t-e)}renderDecorations(){this.renderDecorationsTimer=-1;const e=this.codeEditorService.listCodeEditors();for(const t of e){const i=$b.get(t);if(!i)continue;const r=[],s=t.getModel()?.uri;if(s&&this.workerRequestValue.has(s)){const o=ys.storedDecorationIDs.get(s),a=this.workerRequestValue.get(s);if(a)for(const c of a)c.range&&r.push({range:c.range,options:G7t(c.kind)});let l=[];t.changeDecorations(c=>{l=c.deltaDecorations(o??[],r)}),ys.storedDecorationIDs=ys.storedDecorationIDs.set(s,l),r.length>0&&(i.wordHighlighter?.decorations.set(r),i.wordHighlighter?._hasWordHighlights.set(!0))}}}dispose(){this._stopSingular(),this.toUnhook.dispose()}};hne=ys=KBe([S5(4,ai)],hne);let $b=class extends me{static{dne=this}static{this.ID="editor.contrib.wordHighlighter"}static get(e){return e.getContribution(dne.ID)}constructor(e,t,i,r){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new hne(e,i.documentHighlightProvider,i.multiDocumentHighlightProvider,t,r))};this._register(e.onDidChangeModel(o=>{this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),s()})),s()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){this._wordHighlighter?.moveNext()}moveBack(){this._wordHighlighter?.moveBack()}restoreViewState(e){this._wordHighlighter&&e&&this._wordHighlighter.restore()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}};$b=dne=KBe([S5(1,jt),S5(2,dt),S5(3,ai)],$b);class ZBe extends ot{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=$b.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class aWt extends ZBe{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:w("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:Rde,kbOpts:{kbExpr:Q.editorTextFocus,primary:65,weight:100}})}}class lWt extends ZBe{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:w("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:Rde,kbOpts:{kbExpr:Q.editorTextFocus,primary:1089,weight:100}})}}class cWt extends ot{constructor(){super({id:"editor.action.wordHighlight.trigger",label:w("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const r=$b.get(t);r&&r.restoreViewState(!0)}}Zn($b.ID,$b,0);Pe(aWt);Pe(lWt);Pe(cWt);u2(une);class DH extends fo{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const r=eh(t.getOption(132),t.getOption(131)),s=t.getModel(),o=t.getSelections(),a=o.length>1,l=o.map(c=>{const u=new he(c.positionLineNumber,c.positionColumn),d=this._move(r,s,u,this._wordNavigationType,a);return this._moveTo(c,d,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,l.map(c=>ri.fromModelSelection(c))),l.length===1){const c=new he(l[0].positionLineNumber,l[0].positionColumn);t.revealPosition(c,0)}}_moveTo(e,t,i){return i?new yt(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new yt(t.lineNumber,t.column,t.lineNumber,t.column)}}class r1 extends DH{_move(e,t,i,r,s){return yi.moveWordLeft(e,t,i,r,s)}}class s1 extends DH{_move(e,t,i,r,s){return yi.moveWordRight(e,t,i,r)}}class uWt extends r1{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class dWt extends r1{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class hWt extends r1{constructor(){super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Le.and(Q.textInputFocus,Le.and(iO,AW)?.negate()),primary:2063,mac:{primary:527},weight:100}})}}class fWt extends r1{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class gWt extends r1{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class pWt extends r1{constructor(){super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Le.and(Q.textInputFocus,Le.and(iO,AW)?.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class mWt extends r1{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,r,s){return super._move(eh(Mg.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,r,s)}}class _Wt extends r1{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,r,s){return super._move(eh(Mg.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,r,s)}}class vWt extends s1{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class bWt extends s1{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Le.and(Q.textInputFocus,Le.and(iO,AW)?.negate()),primary:2065,mac:{primary:529},weight:100}})}}class yWt extends s1{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class wWt extends s1{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class CWt extends s1{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Le.and(Q.textInputFocus,Le.and(iO,AW)?.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class xWt extends s1{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class SWt extends s1{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,r,s){return super._move(eh(Mg.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,r,s)}}class kWt extends s1{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,r,s){return super._move(eh(Mg.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,r,s)}}class IH extends fo{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const r=e.get(Zr);if(!t.hasModel())return;const s=eh(t.getOption(132),t.getOption(131)),o=t.getModel(),a=t.getSelections(),l=t.getOption(6),c=t.getOption(11),u=r.getLanguageConfiguration(o.getLanguageId()).getAutoClosingPairs(),d=t._getViewModel(),h=a.map(f=>{const g=this._delete({wordSeparators:s,model:o,selection:f,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:l,autoClosingQuotes:c,autoClosingPairs:u,autoClosedCharacters:d.getCursorAutoClosedCharacters()},this._wordNavigationType);return new Sa(g,"")});t.pushUndoStop(),t.executeCommands(this.id,h),t.pushUndoStop()}}class Pde extends IH{_delete(e,t){const i=yi.deleteWordLeft(e,t);return i||new $(1,1,1,1)}}class Ode extends IH{_delete(e,t){const i=yi.deleteWordRight(e,t);if(i)return i;const r=e.model.getLineCount(),s=e.model.getLineMaxColumn(r);return new $(r,s,r,s)}}class EWt extends Pde{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:Q.writable})}}class LWt extends Pde{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:Q.writable})}}class TWt extends Pde{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class DWt extends Ode{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:Q.writable})}}class IWt extends Ode{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:Q.writable})}}class AWt extends Ode{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class NWt extends ot{constructor(){super({id:"deleteInsideWord",precondition:Q.writable,label:w("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const r=eh(t.getOption(132),t.getOption(131)),s=t.getModel(),a=t.getSelections().map(l=>{const c=yi.deleteInsideWord(r,s,l);return new Sa(c,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}Je(new uWt);Je(new dWt);Je(new hWt);Je(new fWt);Je(new gWt);Je(new pWt);Je(new vWt);Je(new bWt);Je(new yWt);Je(new wWt);Je(new CWt);Je(new xWt);Je(new mWt);Je(new _Wt);Je(new SWt);Je(new kWt);Je(new EWt);Je(new LWt);Je(new TWt);Je(new DWt);Je(new IWt);Je(new AWt);Pe(NWt);class RWt extends IH{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=jW.deleteWordPartLeft(e);return i||new $(1,1,1,1)}}class PWt extends IH{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=jW.deleteWordPartRight(e);if(i)return i;const r=e.model.getLineCount(),s=e.model.getLineMaxColumn(r);return new $(r,s,r,s)}}class XBe extends DH{_move(e,t,i,r,s){return jW.moveWordPartLeft(e,t,i,s)}}class OWt extends XBe{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}Un.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class MWt extends XBe{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}Un.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class QBe extends DH{_move(e,t,i,r,s){return jW.moveWordPartRight(e,t,i)}}class FWt extends QBe{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class BWt extends QBe{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}Je(new RWt);Je(new PWt);Je(new OWt);Je(new MWt);Je(new FWt);Je(new BWt);class jxe extends me{static{this.ID="editor.contrib.readOnlyMessageController"}constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=au.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(93);t||(this.editor.isSimpleWidget?t=new za(w("editor.simple.readonly","Cannot edit in read-only input")):t=new za(w("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}}Zn(jxe.ID,jxe,2);var $Wt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},qxe=function(n,e){return function(t,i){e(t,i,n)}};let fne=class extends me{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=Sn(this,void 0);const r=xa("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=xa("_textModel.onDidChangeContent",Ge.debounce(o=>this._textModel.onDidChangeContent(o),()=>{},100));this._register(wc(async(o,a)=>{r.read(o),s.read(o);const l=a.add(new PRt),c=await this._outlineModelService.getOrCreate(this._textModel,l.token);a.isDisposed||this._currentModel.set(c,void 0)}))}getBreadcrumbItems(e,t){const i=this._currentModel.read(t);if(!i)return[];const r=i.asListOfDocumentSymbols().filter(s=>e.contains(s.range.startLineNumber)&&!e.contains(s.range.endLineNumber));return r.sort(a4e($l(s=>s.range.endLineNumber-s.range.startLineNumber,Xh))),r.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};fne=$Wt([qxe(1,dt),qxe(2,DO)],fne);C9.setBreadcrumbsSourceFactory((n,e)=>e.createInstance(fne,n));class Kxe extends me{static{this.ID="editor.contrib.iPadShowKeyboard"}constructor(e){super(),this.editor=e,this.widget=null,Sg&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(92);!this.widget&&e?this.widget=new Mde(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}class Mde extends me{static{this.ID="editor.contrib.ShowKeyboardWidget"}constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Ce(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(Ce(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return Mde.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}Zn(Kxe.ID,Kxe,3);var WWt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Gxe=function(n,e){return function(t,i){e(t,i,n)}},gne;let CR=class extends me{static{gne=this}static{this.ID="editor.contrib.inspectTokens"}static get(e){return e.getContribution(gne.ID)}constructor(e,t,i){super(),this._editor=e,this._languageService=i,this._widget=null,this._register(this._editor.onDidChangeModel(r=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(r=>this.stop())),this._register(rs.onDidChange(r=>this.stop())),this._register(this._editor.onKeyUp(r=>r.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new Fde(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};CR=gne=WWt([Gxe(1,hd),Gxe(2,Hr)],CR);class HWt extends ot{constructor(){super({id:"editor.action.inspectTokens",label:gQ.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){CR.get(t)?.launch()}}function VWt(n){let e="";for(let t=0,i=n.length;tgE,tokenize:(r,s,o)=>Nle(e,o),tokenizeEncoded:(r,s,o)=>bW(i,o)}}class Fde extends me{static{this._ID="editor.contrib.inspectTokensWidget"}constructor(e,t){super(),this.allowEditorOverflow=!0,this._editor=e,this._languageService=t,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="tokens-inspect-widget",this._tokenizationSupport=zWt(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(i=>this._compute(this._editor.getPosition()))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return Fde._ID}_compute(e){const t=this._getTokensAtLine(e.lineNumber);let i=0;for(let l=t.tokens1.length-1;l>=0;l--){const c=t.tokens1[l];if(e.column-1>=c.offset){i=l;break}}let r=0;for(let l=t.tokens2.length>>>1;l>=0;l--)if(e.column-1>=t.tokens2[l<<1]){r=l;break}const s=this._model.getLineContent(e.lineNumber);let o="";if(i=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Yxe=function(n,e){return function(t,i){e(t,i,n)}},GD;let pne=class{static{GD=this}static{this.PREFIX="?"}constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=Yr.as(CC.Quickaccess)}provide(e){const t=new ke;return t.add(e.onDidAccept(()=>{const[i]=e.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})})),t.add(e.onDidChangeValue(i=>{const r=this.registry.getQuickAccessProvider(i.substr(GD.PREFIX.length));r&&r.prefix&&r.prefix!==GD.PREFIX&&this.quickInputService.quickAccess.show(r.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==GD.PREFIX),t}getQuickAccessProviders(){return this.registry.getQuickAccessProviders().sort((t,i)=>t.prefix.localeCompare(i.prefix)).flatMap(t=>this.createPicks(t))}createPicks(e){return e.helpEntries.map(t=>{const i=t.prefix||e.prefix,r=i||"…";return{prefix:i,label:r,keybinding:t.commandId?this.keybindingService.lookupKeybinding(t.commandId):void 0,ariaLabel:w("helpPickAriaLabel","{0}, {1}",r,t.description),description:t.description}})}};pne=GD=UWt([Yxe(0,hh),Yxe(1,xi)],pne);Yr.as(CC.Quickaccess).registerQuickAccessProvider({ctor:pne,prefix:"",helpEntries:[{description:pQ.helpQuickAccessActionLabel}]});class JBe{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){const r=new ke;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=r.add(new To);return s.value=this.doProvide(e,t,i),r.add(this.onDidActiveTextEditorControlChange(()=>{s.value=void 0,s.value=this.doProvide(e,t)})),r}doProvide(e,t,i){const r=new ke,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const o={editor:s},a=W8e(s);if(a){let l=s.saveViewState()??void 0;r.add(a.onDidChangeCursorPosition(()=>{l=s.saveViewState()??void 0})),o.restoreViewState=()=>{l&&s===this.activeTextEditorControl&&s.restoreViewState(l)},r.add(wb(t.onCancellationRequested)(()=>o.restoreViewState?.()))}r.add(Lt(()=>this.clearDecorations(s))),r.add(this.provideWithTextEditor(o,e,t,i))}else r.add(this.provideWithoutTextEditor(e,t));return r}canProvideWithTextEditor(e){return!0}gotoLocation({editor:e},t){e.setSelection(t.range,"code.jump"),e.revealRangeInCenter(t.range,0),t.preserveFocus||e.focus();const i=e.getModel();i&&"getLineContent"in i&&Qp(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){return mue(e)?e.getModel()?.modified:e.getModel()}addDecorations(e,t){e.changeDecorations(i=>{const r=[];this.rangeHighlightDecorationId&&(r.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),r.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);const s=[{range:t,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:ss(D5e),position:Qu.Full}}}],[o,a]=i.deltaDecorations(r,s);this.rangeHighlightDecorationId={rangeHighlightId:o,overviewRulerDecorationId:a}})}clearDecorations(e){const t=this.rangeHighlightDecorationId;t&&(e.changeDecorations(i=>{i.deltaDecorations([t.overviewRulerDecorationId,t.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}}class Bde extends JBe{static{this.PREFIX=":"}constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=w("cannotRunGotoLine","Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,me.None}provideWithTextEditor(e,t,i){const r=e.editor,s=new ke;s.add(t.onDidAccept(l=>{const[c]=t.selectedItems;if(c){if(!this.isValidLineNumber(r,c.lineNumber))return;this.gotoLocation(e,{range:this.toRange(c.lineNumber,c.column),keyMods:t.keyMods,preserveFocus:l.inBackground}),l.inBackground||t.hide()}}));const o=()=>{const l=this.parsePosition(r,t.value.trim().substr(Bde.PREFIX.length)),c=this.getPickLabel(r,l.lineNumber,l.column);if(t.items=[{lineNumber:l.lineNumber,column:l.column,label:c}],t.ariaLabel=c,!this.isValidLineNumber(r,l.lineNumber)){this.clearDecorations(r);return}const u=this.toRange(l.lineNumber,l.column);r.revealRangeInCenter(u,0),this.addDecorations(r,u)};o(),s.add(t.onDidChangeValue(()=>o()));const a=W8e(r);return a&&a.getOptions().get(68).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(Lt(()=>a.updateOptions({lineNumbers:"relative"})))),s}toRange(e=1,t=1){return{startLineNumber:e,startColumn:t,endLineNumber:e,endColumn:t}}parsePosition(e,t){const i=t.split(/,|:|#/).map(s=>parseInt(s,10)).filter(s=>!isNaN(s)),r=this.lineCount(e)+1;return{lineNumber:i[0]>0?i[0]:r+i[0],column:i[1]}}getPickLabel(e,t,i){if(this.isValidLineNumber(e,t))return this.isValidColumn(e,t,i)?w("gotoLineColumnLabel","Go to line {0} and character {1}.",t,i):w("gotoLineLabel","Go to line {0}.",t);const r=e.getPosition()||{lineNumber:1,column:1},s=this.lineCount(e);return s>1?w("gotoLineLabelEmptyWithLimit","Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",r.lineNumber,r.column,s):w("gotoLineLabelEmpty","Current Line: {0}, Character: {1}. Type a line number to navigate to.",r.lineNumber,r.column)}isValidLineNumber(e,t){return!t||typeof t!="number"?!1:t>0&&t<=this.lineCount(e)}isValidColumn(e,t,i){if(!i||typeof i!="number")return!1;const r=this.getModel(e);if(!r)return!1;const s={lineNumber:t,column:i};return r.validatePosition(s).equals(s)}lineCount(e){return this.getModel(e)?.getLineCount()??0}}var jWt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},qWt=function(n,e){return function(t,i){e(t,i,n)}};let xR=class extends Bde{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=Ge.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};xR=jWt([qWt(0,ai)],xR);let e$e=class t$e extends ot{static{this.ID="editor.action.gotoLine"}constructor(){super({id:t$e.ID,label:C8.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(hh).quickAccess.show(xR.PREFIX)}};Pe(e$e);Yr.as(CC.Quickaccess).registerQuickAccessProvider({ctor:xR,prefix:xR.PREFIX,helpEntries:[{description:C8.gotoLineActionLabel,commandId:e$e.ID}]});const n$e=[void 0,[]];function cK(n,e,t=0,i=0){const r=e;return r.values&&r.values.length>1?KWt(n,r.values,t,i):i$e(n,e,t,i)}function KWt(n,e,t,i){let r=0;const s=[];for(const o of e){const[a,l]=i$e(n,o,t,i);if(typeof a!="number")return n$e;r+=a,s.push(...l)}return[r,GWt(s)]}function i$e(n,e,t,i){const r=Ow(e.original,e.originalLowercase,t,n,n.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return r?[r[0],nO(r)]:n$e}function GWt(n){const e=n.sort((r,s)=>r.start-s.start),t=[];let i;for(const r of e)!i||!YWt(i,r)?(i=r,t.push(r)):(i.start=Math.min(i.start,r.start),i.end=Math.max(i.end,r.end));return t}function YWt(n,e){return!(n.end=0,o=Zxe(n);let a;const l=n.split(r$e);if(l.length>1)for(const c of l){const u=Zxe(c),{pathNormalized:d,normalized:h,normalizedLowercase:f}=Xxe(c);h&&(a||(a=[]),a.push({original:c,originalLowercase:c.toLowerCase(),pathNormalized:d,normalized:h,normalizedLowercase:f,expectContiguousMatch:u}))}return{original:n,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:r,values:a,containsPathSeparator:s,expectContiguousMatch:o}}function Xxe(n){let e;Ta?e=n.replace(/\//g,fg):e=n.replace(/\\/g,fg);const t=c_t(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function Qxe(n){return Array.isArray(n)?mne(n.map(e=>e.original).join(r$e)):mne(n.original)}var ZWt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Jxe=function(n,e){return function(t,i){e(t,i,n)}},k5;let lw=class extends JBe{static{k5=this}static{this.PREFIX="@"}static{this.SCOPE_PREFIX=":"}static{this.PREFIX_BY_CATEGORY=`${this.PREFIX}${this.SCOPE_PREFIX}`}constructor(e,t,i=Object.create(null)){super(i),this._languageFeaturesService=e,this._outlineModelService=t,this.options=i,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(e){return this.provideLabelPick(e,w("cannotRunGotoSymbolWithoutEditor","To go to a symbol, first open a text editor with symbol information.")),me.None}provideWithTextEditor(e,t,i,r){const s=e.editor,o=this.getModel(s);return o?this._languageFeaturesService.documentSymbolProvider.has(o)?this.doProvideWithEditorSymbols(e,o,t,i,r):this.doProvideWithoutEditorSymbols(e,o,t,i):me.None}doProvideWithoutEditorSymbols(e,t,i,r){const s=new ke;return this.provideLabelPick(i,w("cannotRunGotoSymbolWithoutSymbolProvider","The active text editor does not provide symbol information.")),(async()=>!await this.waitForLanguageSymbolRegistry(t,s)||r.isCancellationRequested||s.add(this.doProvideWithEditorSymbols(e,t,i,r)))(),s}provideLabelPick(e,t){e.items=[{label:t,index:0,kind:14}],e.ariaLabel=t}async waitForLanguageSymbolRegistry(e,t){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;const i=new KL,r=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(r.dispose(),i.complete(!0))}));return t.add(Lt(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,r,s){const o=e.editor,a=new ke;a.add(i.onDidAccept(d=>{const[h]=i.selectedItems;h&&h.range&&(this.gotoLocation(e,{range:h.range.selection,keyMods:i.keyMods,preserveFocus:d.inBackground}),s?.handleAccept?.(h),d.inBackground||i.hide())})),a.add(i.onDidTriggerItemButton(({item:d})=>{d&&d.range&&(this.gotoLocation(e,{range:d.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const l=this.getDocumentSymbols(t,r);let c;const u=async d=>{c?.dispose(!0),i.busy=!1,c=new Kr(r),i.busy=!0;try{const h=mne(i.value.substr(k5.PREFIX.length).trim()),f=await this.doGetSymbolPicks(l,h,void 0,c.token,t);if(r.isCancellationRequested)return;if(f.length>0){if(i.items=f,d&&h.original.length===0){const g=hN(f,p=>!!(p.type!=="separator"&&p.range&&$.containsPosition(p.range.decoration,d)));g&&(i.activeItems=[g])}}else h.original.length>0?this.provideLabelPick(i,w("noMatchingSymbolResults","No matching editor symbols")):this.provideLabelPick(i,w("noSymbolResults","No editor symbols"))}finally{r.isCancellationRequested||(i.busy=!1)}};return a.add(i.onDidChangeValue(()=>u(void 0))),u(o.getSelection()?.getPosition()),a.add(i.onDidChangeActive(()=>{const[d]=i.activeItems;d&&d.range&&(o.revealRangeInCenter(d.range.selection,0),this.addDecorations(o,d.range.decoration))})),a}async doGetSymbolPicks(e,t,i,r,s){const o=await e;if(r.isCancellationRequested)return[];const a=t.original.indexOf(k5.SCOPE_PREFIX)===0,l=a?1:0;let c,u;t.values&&t.values.length>1?(c=Qxe(t.values[0]),u=Qxe(t.values.slice(1))):c=t;let d;const h=this.options?.openSideBySideDirection?.();h&&(d=[{iconClass:h==="right"?zt.asClassName(ze.splitHorizontal):zt.asClassName(ze.splitVertical),tooltip:h==="right"?w("openToSide","Open to the Side"):w("openToBottom","Open to the Bottom")}]);const f=[];for(let m=0;ml){let M=!1;if(c!==t&&([k,L]=cK(y,{...t,values:void 0},l,C),typeof k=="number"&&(M=!0)),typeof k!="number"&&([k,L]=cK(y,c,l,C),typeof k!="number"))continue;if(!M&&u){if(x&&u.original.length>0&&([D,I]=cK(x,u)),typeof D!="number")continue;typeof k=="number"&&(k+=D)}}const O=_.tags&&_.tags.indexOf(1)>=0;f.push({index:m,kind:_.kind,score:k,label:y,ariaLabel:e_t(_.name,_.kind),description:x,highlights:O?void 0:{label:L,description:I},range:{selection:$.collapseToStart(_.selectionRange),decoration:_.range},uri:s.uri,symbolName:v,strikethrough:O,buttons:d})}const g=f.sort((m,_)=>a?this.compareByKindAndScore(m,_):this.compareByScore(m,_));let p=[];if(a){let y=function(){_&&typeof m=="number"&&v>0&&(_.label=Lw(dK[m]||uK,v))},m,_,v=0;for(const C of g)m!==C.kind?(y(),m=C.kind,v=1,_={type:"separator"},p.push(_)):v++,p.push(C);y()}else g.length>0&&(p=[{label:w("symbols","symbols ({0})",f.length),type:"separator"},...g]);return p}compareByScore(e,t){if(typeof e.score!="number"&&typeof t.score=="number")return 1;if(typeof e.score=="number"&&typeof t.score!="number")return-1;if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.scoret.index?1:0}compareByKindAndScore(e,t){const i=dK[e.kind]||uK,r=dK[t.kind]||uK,s=i.localeCompare(r);return s===0?this.compareByScore(e,t):s}async getDocumentSymbols(e,t){const i=await this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:i.asListOfDocumentSymbols()}};lw=k5=ZWt([Jxe(0,dt),Jxe(1,DO)],lw);const uK=w("property","properties ({0})"),dK={5:w("method","methods ({0})"),11:w("function","functions ({0})"),8:w("_constructor","constructors ({0})"),12:w("variable","variables ({0})"),4:w("class","classes ({0})"),22:w("struct","structs ({0})"),23:w("event","events ({0})"),24:w("operator","operators ({0})"),10:w("interface","interfaces ({0})"),2:w("namespace","namespaces ({0})"),3:w("package","packages ({0})"),25:w("typeParameter","type parameters ({0})"),1:w("modules","modules ({0})"),6:w("property","properties ({0})"),9:w("enum","enumerations ({0})"),21:w("enumMember","enumeration members ({0})"),14:w("string","strings ({0})"),0:w("file","files ({0})"),17:w("array","arrays ({0})"),15:w("number","numbers ({0})"),16:w("boolean","booleans ({0})"),18:w("object","objects ({0})"),19:w("key","keys ({0})"),7:w("field","fields ({0})"),13:w("constant","constants ({0})")};var XWt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},hK=function(n,e){return function(t,i){e(t,i,n)}};let _ne=class extends lw{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=Ge.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};_ne=XWt([hK(0,ai),hK(1,dt),hK(2,DO)],_ne);class AH extends ot{static{this.ID="editor.action.quickOutline"}constructor(){super({id:AH.ID,label:LN.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:Q.hasDocumentSymbolProvider,kbOpts:{kbExpr:Q.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(hh).quickAccess.show(lw.PREFIX,{itemActivation:zf.NONE})}}Pe(AH);Yr.as(CC.Quickaccess).registerQuickAccessProvider({ctor:_ne,prefix:lw.PREFIX,helpEntries:[{description:LN.quickOutlineActionLabel,prefix:lw.PREFIX,commandId:AH.ID},{description:LN.quickOutlineByCategoryActionLabel,prefix:lw.PREFIX_BY_CATEGORY}]});function QWt(n){const e=new Map;for(const t of n)e.set(t,(e.get(t)??0)+1);return e}class QI{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(e,t){const i=this.computeEmbedding(e),r=new Map,s=[];for(const[o,a]of this.documents){if(t.isCancellationRequested)return[];for(const l of a.chunks){const c=this.computeSimilarityScore(l,i,r);c>0&&s.push({key:o,score:c})}}return s}static termFrequencies(e){return QWt(QI.splitTerms(e))}static*splitTerms(e){const t=i=>i.toLowerCase();for(const[i]of e.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield t(i);const r=i.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(r.length>1)for(const s of r)s.length>2&&/\p{Letter}{3,}/gu.test(s)&&(yield t(s))}}updateDocuments(e){for(const{key:t}of e)this.deleteDocument(t);for(const t of e){const i=[];for(const r of t.textChunks){const s=QI.termFrequencies(r);for(const o of s.keys())this.chunkOccurrences.set(o,(this.chunkOccurrences.get(o)??0)+1);i.push({text:r,tf:s})}this.chunkCount+=i.length,this.documents.set(t.key,{chunks:i})}return this}deleteDocument(e){const t=this.documents.get(e);if(t){this.documents.delete(e),this.chunkCount-=t.chunks.length;for(const i of t.chunks)for(const r of i.tf.keys()){const s=this.chunkOccurrences.get(r);if(typeof s=="number"){const o=s-1;o<=0?this.chunkOccurrences.delete(r):this.chunkOccurrences.set(r,o)}}}}computeSimilarityScore(e,t,i){let r=0;for(const[s,o]of Object.entries(t)){const a=e.tf.get(s);if(!a)continue;let l=i.get(s);typeof l!="number"&&(l=this.computeIdf(s),i.set(s,l));const c=a*l;r+=c*o}return r}computeEmbedding(e){const t=QI.termFrequencies(e);return this.computeTfidf(t)}computeIdf(e){const t=this.chunkOccurrences.get(e)??0;return t>0?Math.log((this.chunkCount+1)/t):0}computeTfidf(e){const t=Object.create(null);for(const[i,r]of e){const s=this.computeIdf(i);s>0&&(t[i]=r*s)}return t}}function JWt(n){const e=n.slice(0);e.sort((i,r)=>r.score-i.score);const t=e[0]?.score??0;if(t>0)for(const i of e)i.score/=t;return e}var VS;(function(n){n[n.NO_ACTION=0]="NO_ACTION",n[n.CLOSE_PICKER=1]="CLOSE_PICKER",n[n.REFRESH_PICKER=2]="REFRESH_PICKER",n[n.REMOVE_ITEM=3]="REMOVE_ITEM"})(VS||(VS={}));function fK(n){const e=n;return Array.isArray(e.items)}function eSe(n){const e=n;return!!e.picks&&e.additionalPicks instanceof Promise}class eHt extends me{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){const r=new ke;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let s;const o=r.add(new To),a=async()=>{const c=o.value=new ke;s?.dispose(!0),e.busy=!1,s=new Kr(t);const u=s.token;let d=e.value.substring(this.prefix.length);this.options?.shouldSkipTrimPickFilter||(d=d.trim());const h=this._getPicks(d,c,u,i),f=(p,m)=>{let _,v;if(fK(p)?(_=p.items,v=p.active):_=p,_.length===0){if(m)return!1;(d.length>0||e.hideInput)&&this.options?.noResultsPick&&(tN(this.options.noResultsPick)?_=[this.options.noResultsPick(d)]:_=[this.options.noResultsPick])}return e.items=_,v&&(e.activeItems=[v]),!0},g=async p=>{let m=!1,_=!1;await Promise.all([(async()=>{typeof p.mergeDelay=="number"&&(await Y_(p.mergeDelay),u.isCancellationRequested)||_||(m=f(p.picks,!0))})(),(async()=>{e.busy=!0;try{const v=await p.additionalPicks;if(u.isCancellationRequested)return;let y,C;fK(p.picks)?(y=p.picks.items,C=p.picks.active):y=p.picks;let x,k;if(fK(v)?(x=v.items,k=v.active):x=v,x.length>0||!m){let L;if(!C&&!k){const D=e.activeItems[0];D&&y.indexOf(D)!==-1&&(L=D)}f({items:[...y,...x],active:C||k||L})}}finally{u.isCancellationRequested||(e.busy=!1),_=!0}})()])};if(h!==null)if(eSe(h))await g(h);else if(!(h instanceof Promise))f(h);else{e.busy=!0;try{const p=await h;if(u.isCancellationRequested)return;eSe(p)?await g(p):f(p)}finally{u.isCancellationRequested||(e.busy=!1)}}};r.add(e.onDidChangeValue(()=>a())),a(),r.add(e.onDidAccept(c=>{if(i?.handleAccept){c.inBackground||e.hide(),i.handleAccept?.(e.activeItems[0]);return}const[u]=e.selectedItems;typeof u?.accept=="function"&&(c.inBackground||e.hide(),u.accept(e.keyMods,c))}));const l=async(c,u)=>{if(typeof u.trigger!="function")return;const d=u.buttons?.indexOf(c)??-1;if(d>=0){const h=u.trigger(d,e.keyMods),f=typeof h=="number"?h:await h;if(t.isCancellationRequested)return;switch(f){case VS.NO_ACTION:break;case VS.CLOSE_PICKER:e.hide();break;case VS.REFRESH_PICKER:a();break;case VS.REMOVE_ITEM:{const g=e.items.indexOf(u);if(g!==-1){const p=e.items.slice(),m=p.splice(g,1),_=e.activeItems.filter(y=>y!==m[0]),v=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=p,_&&(e.activeItems=_),e.keepScrollPosition=v}break}}}};return r.add(e.onDidTriggerItemButton(({button:c,item:u})=>l(c,u))),r.add(e.onDidTriggerSeparatorButton(({button:c,separator:u})=>l(c,u))),r}}var s$e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},wv=function(n,e){return function(t,i){e(t,i,n)}},Q1,Js;let vne=class extends eHt{static{Q1=this}static{this.PREFIX=">"}static{this.TFIDF_THRESHOLD=.5}static{this.TFIDF_MAX_RESULTS=5}static{this.WORD_FILTER=Cle(SN,wCt,HFe)}constructor(e,t,i,r,s,o){super(Q1.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=r,this.telemetryService=s,this.dialogService=o,this.commandsHistory=this._register(this.instantiationService.createInstance(bne)),this.options=e}async _getPicks(e,t,i,r){const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const o=wb(()=>{const f=new QI;f.updateDocuments(s.map(p=>({key:p.commandId,textChunks:[this.getTfIdfChunk(p)]})));const g=f.calculateScores(e,i);return JWt(g).filter(p=>p.score>Q1.TFIDF_THRESHOLD).slice(0,Q1.TFIDF_MAX_RESULTS)}),a=[];for(const f of s){const g=Q1.WORD_FILTER(e,f.label)??void 0,p=f.commandAlias?Q1.WORD_FILTER(e,f.commandAlias)??void 0:void 0;if(g||p)f.highlights={label:g,detail:this.options.showAlias?p:void 0},a.push(f);else if(e===f.commandId)a.push(f);else if(e.length>=3){const m=o();if(i.isCancellationRequested)return[];const _=m.find(v=>v.key===f.commandId);_&&(f.tfIdfScore=_.score,a.push(f))}}const l=new Map;for(const f of a){const g=l.get(f.label);g?(f.description=f.commandId,g.description=g.commandId):l.set(f.label,f)}a.sort((f,g)=>{if(f.tfIdfScore&&g.tfIdfScore)return f.tfIdfScore===g.tfIdfScore?f.label.localeCompare(g.label):g.tfIdfScore-f.tfIdfScore;if(f.tfIdfScore)return 1;if(g.tfIdfScore)return-1;const p=this.commandsHistory.peek(f.commandId),m=this.commandsHistory.peek(g.commandId);if(p&&m)return p>m?-1:1;if(p)return-1;if(m)return 1;if(this.options.suggestedCommandIds){const _=this.options.suggestedCommandIds.has(f.commandId),v=this.options.suggestedCommandIds.has(g.commandId);if(_&&v)return 0;if(_)return-1;if(v)return 1}return f.label.localeCompare(g.label)});const c=[];let u=!1,d=!0,h=!!this.options.suggestedCommandIds;for(let f=0;f{const f=await this.getAdditionalCommandPicks(s,a,e,i);if(i.isCancellationRequested)return[];const g=f.map(p=>this.toCommandPick(p,r));return d&&g[0]?.type!=="separator"&&g.unshift({type:"separator",label:w("suggested","similar commands")}),g})()}:c}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),r=i?w("commandPickAriaLabelWithKeybinding","{0}, {1}",e.label,i.getAriaLabel()):e.label;return{...e,ariaLabel:r,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:i,accept:async()=>{this.commandsHistory.push(e.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.commandId,from:t?.from??"quick open"});try{e.args?.length?await this.commandService.executeCommand(e.commandId,...e.args):await this.commandService.executeCommand(e.commandId)}catch(s){uh(s)||this.dialogService.error(w("canNotRun","Command '{0}' resulted in an error",e.label),I9(s))}}}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:i}){let r=e;return t&&t!==e&&(r+=` - ${t}`),i&&i.value!==e&&(r+=` - ${i.value===i.original?i.value:`${i.value} (${i.original})`}`),r}};vne=Q1=s$e([wv(1,Tt),wv(2,xi),wv(3,_r),wv(4,Qa),wv(5,JP)],vne);let bne=class extends me{static{Js=this}static{this.DEFAULT_COMMANDS_HISTORY_LENGTH=50}static{this.PREF_KEY_CACHE="commandPalette.mru.cache"}static{this.PREF_KEY_COUNTER="commandPalette.mru.counter"}static{this.counter=1}static{this.hasChanges=!1}constructor(e,t,i){super(),this.storageService=e,this.configurationService=t,this.logService=i,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e))),this._register(this.storageService.onWillSaveState(e=>{e.reason===AN.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=Js.getConfiguredCommandHistoryLength(this.configurationService),Js.cache&&Js.cache.limit!==this.configuredCommandsHistoryLength&&(Js.cache.limit=this.configuredCommandsHistoryLength,Js.hasChanges=!0))}load(){const e=this.storageService.get(Js.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(r){this.logService.error(`[CommandsHistory] invalid data: ${r}`)}const i=Js.cache=new lm(this.configuredCommandsHistoryLength,1);if(t){let r;t.usesLRU?r=t.entries:r=t.entries.sort((s,o)=>s.value-o.value),r.forEach(s=>i.set(s.key,s.value))}Js.counter=this.storageService.getNumber(Js.PREF_KEY_COUNTER,0,Js.counter)}push(e){Js.cache&&(Js.cache.set(e,Js.counter++),Js.hasChanges=!0)}peek(e){return Js.cache?.peek(e)}saveState(){if(!Js.cache||!Js.hasChanges)return;const e={usesLRU:!0,entries:[]};Js.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(Js.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(Js.PREF_KEY_COUNTER,Js.counter,0,0),Js.hasChanges=!1}static getConfiguredCommandHistoryLength(e){const i=e.getValue().workbench?.commandPalette?.history;return typeof i=="number"?i:Js.DEFAULT_COMMANDS_HISTORY_LENGTH}};bne=Js=s$e([wv(0,pf),wv(1,kn),wv(2,Da)],bne);class tHt extends vne{constructor(e,t,i,r,s,o){super(e,t,i,r,s,o)}getCodeEditorCommandPicks(){const e=this.activeTextEditorControl;if(!e)return[];const t=[];for(const i of e.getSupportedActions()){let r;i.metadata?.description&&(bkt(i.metadata.description)?r=i.metadata.description:r={original:i.metadata.description,value:i.metadata.description}),t.push({commandId:i.id,commandAlias:i.alias,commandDescription:r,label:Dle(i.label)||i.id})}return t}}var nHt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Dx=function(n,e){return function(t,i){e(t,i,n)}};let SR=class extends tHt{get activeTextEditorControl(){return this.codeEditorService.getFocusedCodeEditor()??void 0}constructor(e,t,i,r,s,o){super({showAlias:!1},e,i,r,s,o),this.codeEditorService=t}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};SR=nHt([Dx(0,Tt),Dx(1,ai),Dx(2,xi),Dx(3,_r),Dx(4,Qa),Dx(5,JP)],SR);class NH extends ot{static{this.ID="editor.action.quickCommand"}constructor(){super({id:NH.ID,label:x8.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(hh).quickAccess.show(SR.PREFIX)}}Pe(NH);Yr.as(CC.Quickaccess).registerQuickAccessProvider({ctor:SR,prefix:SR.PREFIX,helpEntries:[{description:x8.quickCommandHelp,commandId:NH.ID}]});var iHt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ix=function(n,e){return function(t,i){e(t,i,n)}};let yne=class extends Gw{constructor(e,t,i,r,s,o,a){super(!0,e,t,i,r,s,o,a)}};yne=iHt([Ix(1,jt),Ix(2,ai),Ix(3,Ts),Ix(4,Tt),Ix(5,pf),Ix(6,kn)],yne);Zn(Gw.ID,yne,4);class rHt extends ot{constructor(){super({id:"editor.action.toggleHighContrast",label:_Q.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(hd),r=i.getColorTheme();mg(r.type)?(i.setTheme(this._originalThemeName||(aE(r.type)?bk:a_)),this._originalThemeName=null):(i.setTheme(aE(r.type)?ew:tw),this._originalThemeName=r.themeName)}}Pe(rHt);const a$n=Object.freeze(Object.defineProperty({__proto__:null,CancellationTokenSource:U8e,Emitter:j8e,KeyCode:q8e,KeyMod:K8e,MarkerSeverity:Q8e,MarkerTag:J8e,Position:G8e,Range:Y8e,Selection:Z8e,SelectionDirection:X8e,Token:t9e,Uri:e9e,editor:n9e,languages:i9e},Symbol.toStringTag,{value:"Module"}));function Ll(n){return`Minified Redux error #${n}; visit https://redux.js.org/Errors?code=${n} for the full message or use the non-minified dev environment for full errors. `}var sHt=typeof Symbol=="function"&&Symbol.observable||"@@observable",tSe=sHt,gK=()=>Math.random().toString(36).substring(7).split("").join("."),oHt={INIT:`@@redux/INIT${gK()}`,REPLACE:`@@redux/REPLACE${gK()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${gK()}`},o7=oHt;function $de(n){if(typeof n!="object"||n===null)return!1;let e=n;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(n)===e||Object.getPrototypeOf(n)===null}function o$e(n,e,t){if(typeof n!="function")throw new Error(Ll(2));if(typeof e=="function"&&typeof t=="function"||typeof t=="function"&&typeof arguments[3]=="function")throw new Error(Ll(0));if(typeof e=="function"&&typeof t>"u"&&(t=e,e=void 0),typeof t<"u"){if(typeof t!="function")throw new Error(Ll(1));return t(o$e)(n,e)}let i=n,r=e,s=new Map,o=s,a=0,l=!1;function c(){o===s&&(o=new Map,s.forEach((m,_)=>{o.set(_,m)}))}function u(){if(l)throw new Error(Ll(3));return r}function d(m){if(typeof m!="function")throw new Error(Ll(4));if(l)throw new Error(Ll(5));let _=!0;c();const v=a++;return o.set(v,m),function(){if(_){if(l)throw new Error(Ll(6));_=!1,c(),o.delete(v),s=null}}}function h(m){if(!$de(m))throw new Error(Ll(7));if(typeof m.type>"u")throw new Error(Ll(8));if(typeof m.type!="string")throw new Error(Ll(17));if(l)throw new Error(Ll(9));try{l=!0,r=i(r,m)}finally{l=!1}return(s=o).forEach(v=>{v()}),m}function f(m){if(typeof m!="function")throw new Error(Ll(10));i=m,h({type:o7.REPLACE})}function g(){const m=d;return{subscribe(_){if(typeof _!="object"||_===null)throw new Error(Ll(11));function v(){const C=_;C.next&&C.next(u())}return v(),{unsubscribe:m(v)}},[tSe](){return this}}}return h({type:o7.INIT}),{dispatch:h,subscribe:d,getState:u,replaceReducer:f,[tSe]:g}}function aHt(n){Object.keys(n).forEach(e=>{const t=n[e];if(typeof t(void 0,{type:o7.INIT})>"u")throw new Error(Ll(12));if(typeof t(void 0,{type:o7.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ll(13))})}function lHt(n){const e=Object.keys(n),t={};for(let s=0;s"u")throw a&&a.type,new Error(Ll(14));c[d]=g,l=l||g!==f}return l=l||i.length!==Object.keys(o).length,l?c:o}}function a7(...n){return n.length===0?e=>e:n.length===1?n[0]:n.reduce((e,t)=>(...i)=>e(t(...i)))}function cHt(...n){return e=>(t,i)=>{const r=e(t,i);let s=()=>{throw new Error(Ll(15))};const o={getState:r.getState,dispatch:(l,...c)=>s(l,...c)},a=n.map(l=>l(o));return s=a7(...a)(r.dispatch),{...r,dispatch:s}}}function uHt(n){return $de(n)&&"type"in n&&typeof n.type=="string"}var a$e=Symbol.for("immer-nothing"),nSe=Symbol.for("immer-draftable"),rh=Symbol.for("immer-state");function tg(n,...e){throw new Error(`[Immer] minified error nr: ${n}. Full error at: https://bit.ly/3cXEKWf`)}var UE=Object.getPrototypeOf;function Qw(n){return!!n&&!!n[rh]}function r0(n){return n?l$e(n)||Array.isArray(n)||!!n[nSe]||!!n.constructor?.[nSe]||PH(n)||OH(n):!1}var dHt=Object.prototype.constructor.toString();function l$e(n){if(!n||typeof n!="object")return!1;const e=UE(n);if(e===null)return!0;const t=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return t===Object?!0:typeof t=="function"&&Function.toString.call(t)===dHt}function l7(n,e){RH(n)===0?Reflect.ownKeys(n).forEach(t=>{e(t,n[t],n)}):n.forEach((t,i)=>e(i,t,n))}function RH(n){const e=n[rh];return e?e.type_:Array.isArray(n)?1:PH(n)?2:OH(n)?3:0}function wne(n,e){return RH(n)===2?n.has(e):Object.prototype.hasOwnProperty.call(n,e)}function c$e(n,e,t){const i=RH(n);i===2?n.set(e,t):i===3?n.add(t):n[e]=t}function hHt(n,e){return n===e?n!==0||1/n===1/e:n!==n&&e!==e}function PH(n){return n instanceof Map}function OH(n){return n instanceof Set}function J1(n){return n.copy_||n.base_}function Cne(n,e){if(PH(n))return new Map(n);if(OH(n))return new Set(n);if(Array.isArray(n))return Array.prototype.slice.call(n);if(!e&&l$e(n))return UE(n)?{...n}:Object.assign(Object.create(null),n);const t=Object.getOwnPropertyDescriptors(n);delete t[rh];let i=Reflect.ownKeys(t);for(let r=0;r1&&(n.set=n.add=n.clear=n.delete=fHt),Object.freeze(n),e&&Object.entries(n).forEach(([t,i])=>Wde(i,!0))),n}function fHt(){tg(2)}function MH(n){return Object.isFrozen(n)}var gHt={};function Jw(n){const e=gHt[n];return e||tg(0,n),e}var kR;function u$e(){return kR}function pHt(n,e){return{drafts_:[],parent_:n,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function iSe(n,e){e&&(Jw("Patches"),n.patches_=[],n.inversePatches_=[],n.patchListener_=e)}function xne(n){Sne(n),n.drafts_.forEach(mHt),n.drafts_=null}function Sne(n){n===kR&&(kR=n.parent_)}function rSe(n){return kR=pHt(kR,n)}function mHt(n){const e=n[rh];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function sSe(n,e){e.unfinalizedDrafts_=e.drafts_.length;const t=e.drafts_[0];return n!==void 0&&n!==t?(t[rh].modified_&&(xne(e),tg(4)),r0(n)&&(n=c7(e,n),e.parent_||u7(e,n)),e.patches_&&Jw("Patches").generateReplacementPatches_(t[rh].base_,n,e.patches_,e.inversePatches_)):n=c7(e,t,[]),xne(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),n!==a$e?n:void 0}function c7(n,e,t){if(MH(e))return e;const i=e[rh];if(!i)return l7(e,(r,s)=>oSe(n,i,e,r,s,t)),e;if(i.scope_!==n)return e;if(!i.modified_)return u7(n,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const r=i.copy_;let s=r,o=!1;i.type_===3&&(s=new Set(r),r.clear(),o=!0),l7(s,(a,l)=>oSe(n,i,r,a,l,t,o)),u7(n,r,!1),t&&n.patches_&&Jw("Patches").generatePatches_(i,t,n.patches_,n.inversePatches_)}return i.copy_}function oSe(n,e,t,i,r,s,o){if(Qw(r)){const a=s&&e&&e.type_!==3&&!wne(e.assigned_,i)?s.concat(i):void 0,l=c7(n,r,a);if(c$e(t,i,l),Qw(l))n.canAutoFreeze_=!1;else return}else o&&t.add(r);if(r0(r)&&!MH(r)){if(!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1)return;c7(n,r),(!e||!e.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(t,i)&&u7(n,r)}}function u7(n,e,t=!1){!n.parent_&&n.immer_.autoFreeze_&&n.canAutoFreeze_&&Wde(e,t)}function _Ht(n,e){const t=Array.isArray(n),i={type_:t?1:0,scope_:e?e.scope_:u$e(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:n,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,s=Hde;t&&(r=[i],s=ER);const{revoke:o,proxy:a}=Proxy.revocable(r,s);return i.draft_=a,i.revoke_=o,a}var Hde={get(n,e){if(e===rh)return n;const t=J1(n);if(!wne(t,e))return vHt(n,t,e);const i=t[e];return n.finalized_||!r0(i)?i:i===pK(n.base_,e)?(mK(n),n.copy_[e]=Ene(i,n)):i},has(n,e){return e in J1(n)},ownKeys(n){return Reflect.ownKeys(J1(n))},set(n,e,t){const i=d$e(J1(n),e);if(i?.set)return i.set.call(n.draft_,t),!0;if(!n.modified_){const r=pK(J1(n),e),s=r?.[rh];if(s&&s.base_===t)return n.copy_[e]=t,n.assigned_[e]=!1,!0;if(hHt(t,r)&&(t!==void 0||wne(n.base_,e)))return!0;mK(n),kne(n)}return n.copy_[e]===t&&(t!==void 0||e in n.copy_)||Number.isNaN(t)&&Number.isNaN(n.copy_[e])||(n.copy_[e]=t,n.assigned_[e]=!0),!0},deleteProperty(n,e){return pK(n.base_,e)!==void 0||e in n.base_?(n.assigned_[e]=!1,mK(n),kne(n)):delete n.assigned_[e],n.copy_&&delete n.copy_[e],!0},getOwnPropertyDescriptor(n,e){const t=J1(n),i=Reflect.getOwnPropertyDescriptor(t,e);return i&&{writable:!0,configurable:n.type_!==1||e!=="length",enumerable:i.enumerable,value:t[e]}},defineProperty(){tg(11)},getPrototypeOf(n){return UE(n.base_)},setPrototypeOf(){tg(12)}},ER={};l7(Hde,(n,e)=>{ER[n]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});ER.deleteProperty=function(n,e){return ER.set.call(this,n,e,void 0)};ER.set=function(n,e,t){return Hde.set.call(this,n[0],e,t,n[0])};function pK(n,e){const t=n[rh];return(t?J1(t):n)[e]}function vHt(n,e,t){const i=d$e(e,t);return i?"value"in i?i.value:i.get?.call(n.draft_):void 0}function d$e(n,e){if(!(e in n))return;let t=UE(n);for(;t;){const i=Object.getOwnPropertyDescriptor(t,e);if(i)return i;t=UE(t)}}function kne(n){n.modified_||(n.modified_=!0,n.parent_&&kne(n.parent_))}function mK(n){n.copy_||(n.copy_=Cne(n.base_,n.scope_.immer_.useStrictShallowCopy_))}var bHt=class{constructor(n){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,i)=>{if(typeof e=="function"&&typeof t!="function"){const s=t;t=e;const o=this;return function(l=s,...c){return o.produce(l,u=>t.call(this,u,...c))}}typeof t!="function"&&tg(6),i!==void 0&&typeof i!="function"&&tg(7);let r;if(r0(e)){const s=rSe(this),o=Ene(e,void 0);let a=!0;try{r=t(o),a=!1}finally{a?xne(s):Sne(s)}return iSe(s,i),sSe(r,s)}else if(!e||typeof e!="object"){if(r=t(e),r===void 0&&(r=e),r===a$e&&(r=void 0),this.autoFreeze_&&Wde(r,!0),i){const s=[],o=[];Jw("Patches").generateReplacementPatches_(e,r,s,o),i(s,o)}return r}else tg(1,e)},this.produceWithPatches=(e,t)=>{if(typeof e=="function")return(o,...a)=>this.produceWithPatches(o,l=>e(l,...a));let i,r;return[this.produce(e,t,(o,a)=>{i=o,r=a}),i,r]},typeof n?.autoFreeze=="boolean"&&this.setAutoFreeze(n.autoFreeze),typeof n?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(n.useStrictShallowCopy)}createDraft(n){r0(n)||tg(8),Qw(n)&&(n=yHt(n));const e=rSe(this),t=Ene(n,void 0);return t[rh].isManual_=!0,Sne(e),t}finishDraft(n,e){const t=n&&n[rh];(!t||!t.isManual_)&&tg(9);const{scope_:i}=t;return iSe(i,e),sSe(void 0,i)}setAutoFreeze(n){this.autoFreeze_=n}setUseStrictShallowCopy(n){this.useStrictShallowCopy_=n}applyPatches(n,e){let t;for(t=e.length-1;t>=0;t--){const r=e[t];if(r.path.length===0&&r.op==="replace"){n=r.value;break}}t>-1&&(e=e.slice(t+1));const i=Jw("Patches").applyPatches_;return Qw(n)?i(n,e):this.produce(n,r=>i(r,e))}};function Ene(n,e){const t=PH(n)?Jw("MapSet").proxyMap_(n,e):OH(n)?Jw("MapSet").proxySet_(n,e):_Ht(n,e);return(e?e.scope_:u$e()).drafts_.push(t),t}function yHt(n){return Qw(n)||tg(10,n),h$e(n)}function h$e(n){if(!r0(n)||MH(n))return n;const e=n[rh];let t;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,t=Cne(n,e.scope_.immer_.useStrictShallowCopy_)}else t=Cne(n,!0);return l7(t,(i,r)=>{c$e(t,i,h$e(r))}),e&&(e.finalized_=!1),t}var sh=new bHt,f$e=sh.produce;sh.produceWithPatches.bind(sh);sh.setAutoFreeze.bind(sh);sh.setUseStrictShallowCopy.bind(sh);sh.applyPatches.bind(sh);sh.createDraft.bind(sh);sh.finishDraft.bind(sh);function wHt(n,e=`expected a function, instead received ${typeof n}`){if(typeof n!="function")throw new TypeError(e)}function CHt(n,e=`expected an object, instead received ${typeof n}`){if(typeof n!="object")throw new TypeError(e)}function xHt(n,e="expected all items to be functions, instead received the following types: "){if(!n.every(t=>typeof t=="function")){const t=n.map(i=>typeof i=="function"?`function ${i.name||"unnamed"}()`:typeof i).join(", ");throw new TypeError(`${e}[${t}]`)}}var aSe=n=>Array.isArray(n)?n:[n];function SHt(n){const e=Array.isArray(n[0])?n[0]:n;return xHt(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function kHt(n,e){const t=[],{length:i}=n;for(let r=0;r{t=I3(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function DHt(n,...e){const t=typeof n=="function"?{memoize:n,memoizeOptions:e}:n,i=(...r)=>{let s=0,o=0,a,l={},c=r.pop();typeof c=="object"&&(l=c,c=r.pop()),wHt(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...t,...l},{memoize:d,memoizeOptions:h=[],argsMemoize:f=g$e,argsMemoizeOptions:g=[],devModeChecks:p={}}=u,m=aSe(h),_=aSe(g),v=SHt(r),y=d(function(){return s++,c.apply(null,arguments)},...m),C=f(function(){o++;const k=kHt(v,arguments);return a=y.apply(null,k),a},..._);return Object.assign(C,{resultFunc:c,memoizedResultFunc:y,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:f})};return Object.assign(i,{withTypes:()=>i}),i}var IHt=DHt(g$e),AHt=Object.assign((n,e=IHt)=>{CHt(n,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof n}`);const t=Object.keys(n),i=t.map(s=>n[s]);return e(i,(...s)=>s.reduce((o,a,l)=>(o[t[l]]=a,o),{}))},{withTypes:()=>AHt});function p$e(n){return({dispatch:t,getState:i})=>r=>s=>typeof s=="function"?s(t,i,n):r(s)}var NHt=p$e(),RHt=p$e,PHt=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?a7:a7.apply(null,arguments)},OHt=n=>n&&typeof n.match=="function";function JI(n,e){function t(...i){if(e){let r=e(...i);if(!r)throw new Error(M_(0));return{type:n,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:n,payload:i[0]}}return t.toString=()=>`${n}`,t.type=n,t.match=i=>uHt(i)&&i.type===n,t}var m$e=class YD extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,YD.prototype)}static get[Symbol.species](){return YD}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new YD(...e[0].concat(this)):new YD(...e.concat(this))}};function cSe(n){return r0(n)?f$e(n,()=>{}):n}function uSe(n,e,t){return n.has(e)?n.get(e):n.set(e,t(e)).get(e)}function MHt(n){return typeof n=="boolean"}var FHt=()=>function(e){const{thunk:t=!0,immutableCheck:i=!0,serializableCheck:r=!0,actionCreatorCheck:s=!0}=e??{};let o=new m$e;return t&&(MHt(t)?o.push(NHt):o.push(RHt(t.extraArgument))),o},BHt="RTK_autoBatch",dSe=n=>e=>{setTimeout(e,n)},$Ht=(n={type:"raf"})=>e=>(...t)=>{const i=e(...t);let r=!0,s=!1,o=!1;const a=new Set,l=n.type==="tick"?queueMicrotask:n.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:dSe(10):n.type==="callback"?n.queueNotification:dSe(n.timeout),c=()=>{o=!1,s&&(s=!1,a.forEach(u=>u()))};return Object.assign({},i,{subscribe(u){const d=()=>r&&u(),h=i.subscribe(d);return a.add(u),()=>{h(),a.delete(u)}},dispatch(u){try{return r=!u?.meta?.[BHt],s=!r,s&&(o||(o=!0,l(c))),i.dispatch(u)}finally{r=!0}}})},WHt=n=>function(t){const{autoBatch:i=!0}=t??{};let r=new m$e(n);return i&&r.push($Ht(typeof i=="object"?i:void 0)),r};function l$n(n){const e=FHt(),{reducer:t=void 0,middleware:i,devTools:r=!0,preloadedState:s=void 0,enhancers:o=void 0}=n;let a;if(typeof t=="function")a=t;else if($de(t))a=lHt(t);else throw new Error(M_(1));let l;typeof i=="function"?l=i(e):l=e();let c=a7;r&&(c=PHt({trace:!1,...typeof r=="object"&&r}));const u=cHt(...l),d=WHt(u);let h=typeof o=="function"?o(d):d();const f=c(...h);return o$e(a,s,f)}function _$e(n){const e={},t=[];let i;const r={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(M_(28));if(a in e)throw new Error(M_(29));return e[a]=o,r},addMatcher(s,o){return t.push({matcher:s,reducer:o}),r},addDefaultCase(s){return i=s,r}};return n(r),[e,t,i]}function HHt(n){return typeof n=="function"}function VHt(n,e){let[t,i,r]=_$e(e),s;if(HHt(n))s=()=>cSe(n());else{const a=cSe(n);s=()=>a}function o(a=s(),l){let c=[t[l.type],...i.filter(({matcher:u})=>u(l)).map(({reducer:u})=>u)];return c.filter(u=>!!u).length===0&&(c=[r]),c.reduce((u,d)=>{if(d)if(Qw(u)){const f=d(u,l);return f===void 0?u:f}else{if(r0(u))return f$e(u,h=>d(h,l));{const h=d(u,l);if(h===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return h}}return u},a)}return o.getInitialState=s,o}var zHt=(n,e)=>OHt(n)?n.match(e):n(e);function UHt(...n){return e=>n.some(t=>zHt(t,e))}var jHt="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",qHt=(n=21)=>{let e="",t=n;for(;t--;)e+=jHt[Math.random()*64|0];return e},KHt=["name","message","stack","code"],_K=class{constructor(n,e){this.payload=n,this.meta=e}_type},hSe=class{constructor(n,e){this.payload=n,this.meta=e}_type},GHt=n=>{if(typeof n=="object"&&n!==null){const e={};for(const t of KHt)typeof n[t]=="string"&&(e[t]=n[t]);return e}return{message:String(n)}},c$n=(()=>{function n(e,t,i){const r=JI(e+"/fulfilled",(l,c,u,d)=>({payload:l,meta:{...d||{},arg:u,requestId:c,requestStatus:"fulfilled"}})),s=JI(e+"/pending",(l,c,u)=>({payload:void 0,meta:{...u||{},arg:c,requestId:l,requestStatus:"pending"}})),o=JI(e+"/rejected",(l,c,u,d,h)=>({payload:d,error:(i&&i.serializeError||GHt)(l||"Rejected"),meta:{...h||{},arg:u,requestId:c,rejectedWithValue:!!d,requestStatus:"rejected",aborted:l?.name==="AbortError",condition:l?.name==="ConditionError"}}));function a(l){return(c,u,d)=>{const h=i?.idGenerator?i.idGenerator(l):qHt(),f=new AbortController;let g,p;function m(v){p=v,f.abort()}const _=async function(){let v;try{let C=i?.condition?.(l,{getState:u,extra:d});if(ZHt(C)&&(C=await C),C===!1||f.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const x=new Promise((k,L)=>{g=()=>{L({name:"AbortError",message:p||"Aborted"})},f.signal.addEventListener("abort",g)});c(s(h,l,i?.getPendingMeta?.({requestId:h,arg:l},{getState:u,extra:d}))),v=await Promise.race([x,Promise.resolve(t(l,{dispatch:c,getState:u,extra:d,requestId:h,signal:f.signal,abort:m,rejectWithValue:(k,L)=>new _K(k,L),fulfillWithValue:(k,L)=>new hSe(k,L)})).then(k=>{if(k instanceof _K)throw k;return k instanceof hSe?r(k.payload,h,l,k.meta):r(k,h,l)})])}catch(C){v=C instanceof _K?o(null,h,l,C.payload,C.meta):o(C,h,l)}finally{g&&f.signal.removeEventListener("abort",g)}return i&&!i.dispatchConditionRejection&&o.match(v)&&v.meta.condition||c(v),v}();return Object.assign(_,{abort:m,requestId:h,arg:l,unwrap(){return _.then(YHt)}})}}return Object.assign(a,{pending:s,rejected:o,fulfilled:r,settled:UHt(o,r),typePrefix:e})}return n.withTypes=()=>n,n})();function YHt(n){if(n.meta&&n.meta.rejectedWithValue)throw n.payload;if(n.error)throw n.error;return n.payload}function ZHt(n){return n!==null&&typeof n=="object"&&typeof n.then=="function"}var XHt=Symbol.for("rtk-slice-createasyncthunk");function QHt(n,e){return`${n}/${e}`}function JHt({creators:n}={}){const e=n?.asyncThunk?.[XHt];return function(i){const{name:r,reducerPath:s=r}=i;if(!r)throw new Error(M_(11));const o=(typeof i.reducers=="function"?i.reducers(tVt()):i.reducers)||{},a=Object.keys(o),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(v,y){const C=typeof v=="string"?v:v.type;if(!C)throw new Error(M_(12));if(C in l.sliceCaseReducersByType)throw new Error(M_(13));return l.sliceCaseReducersByType[C]=y,c},addMatcher(v,y){return l.sliceMatchers.push({matcher:v,reducer:y}),c},exposeAction(v,y){return l.actionCreators[v]=y,c},exposeCaseReducer(v,y){return l.sliceCaseReducersByName[v]=y,c}};a.forEach(v=>{const y=o[v],C={reducerName:v,type:QHt(r,v),createNotation:typeof i.reducers=="function"};iVt(y)?sVt(C,y,c,e):nVt(C,y,c)});function u(){const[v={},y=[],C=void 0]=typeof i.extraReducers=="function"?_$e(i.extraReducers):[i.extraReducers],x={...v,...l.sliceCaseReducersByType};return VHt(i.initialState,k=>{for(let L in x)k.addCase(L,x[L]);for(let L of l.sliceMatchers)k.addMatcher(L.matcher,L.reducer);for(let L of y)k.addMatcher(L.matcher,L.reducer);C&&k.addDefaultCase(C)})}const d=v=>v,h=new Map;let f;function g(v,y){return f||(f=u()),f(v,y)}function p(){return f||(f=u()),f.getInitialState()}function m(v,y=!1){function C(k){let L=k[v];return typeof L>"u"&&y&&(L=p()),L}function x(k=d){const L=uSe(h,y,()=>new WeakMap);return uSe(L,k,()=>{const D={};for(const[I,O]of Object.entries(i.selectors??{}))D[I]=eVt(O,k,p,y);return D})}return{reducerPath:v,getSelectors:x,get selectors(){return x(C)},selectSlice:C}}const _={name:r,reducer:g,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:p,...m(s),injectInto(v,{reducerPath:y,...C}={}){const x=y??s;return v.inject({reducerPath:x,reducer:g},C),{..._,...m(x,!0)}}};return _}}function eVt(n,e,t,i){function r(s,...o){let a=e(s);return typeof a>"u"&&i&&(a=t()),n(a,...o)}return r.unwrapped=n,r}var u$n=JHt();function tVt(){function n(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return n.withTypes=()=>n,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,t){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}},asyncThunk:n}}function nVt({type:n,reducerName:e,createNotation:t},i,r){let s,o;if("reducer"in i){if(t&&!rVt(i))throw new Error(M_(17));s=i.reducer,o=i.prepare}else s=i;r.addCase(n,s).exposeCaseReducer(e,s).exposeAction(e,o?JI(n,o):JI(n))}function iVt(n){return n._reducerDefinitionType==="asyncThunk"}function rVt(n){return n._reducerDefinitionType==="reducerWithPrepare"}function sVt({type:n,reducerName:e},t,i,r){if(!r)throw new Error(M_(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:l,settled:c,options:u}=t,d=r(n,s,u);i.exposeAction(e,d),o&&i.addCase(d.fulfilled,o),a&&i.addCase(d.pending,a),l&&i.addCase(d.rejected,l),c&&i.addMatcher(d.settled,c),i.exposeCaseReducer(e,{fulfilled:o||A3,pending:a||A3,rejected:l||A3,settled:c||A3})}function A3(){}function M_(n){return`Minified Redux Toolkit error #${n}; visit https://redux-toolkit.js.org/Errors?code=${n} for the full message or use the non-minified dev environment for full errors. `}const wi=n=>typeof n=="string",YT=()=>{let n,e;const t=new Promise((i,r)=>{n=i,e=r});return t.resolve=n,t.reject=e,t},fSe=n=>n==null?"":""+n,oVt=(n,e,t)=>{n.forEach(i=>{e[i]&&(t[i]=e[i])})},aVt=/###/g,gSe=n=>n&&n.indexOf("###")>-1?n.replace(aVt,"."):n,pSe=n=>!n||wi(n),eA=(n,e,t)=>{const i=wi(e)?e.split("."):e;let r=0;for(;r{const{obj:i,k:r}=eA(n,e,Object);if(i!==void 0||e.length===1){i[r]=t;return}let s=e[e.length-1],o=e.slice(0,e.length-1),a=eA(n,o,Object);for(;a.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=eA(n,o,Object),a?.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=t},lVt=(n,e,t,i)=>{const{obj:r,k:s}=eA(n,e,Object);r[s]=r[s]||[],r[s].push(t)},d7=(n,e)=>{const{obj:t,k:i}=eA(n,e);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},cVt=(n,e,t)=>{const i=d7(n,t);return i!==void 0?i:d7(e,t)},v$e=(n,e,t)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in n?wi(n[i])||n[i]instanceof String||wi(e[i])||e[i]instanceof String?t&&(n[i]=e[i]):v$e(n[i],e[i],t):n[i]=e[i]);return n},Ax=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var uVt={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const dVt=n=>wi(n)?n.replace(/[&<>"'\/]/g,e=>uVt[e]):n;class hVt{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}const fVt=[" ",",","?","!",";"],gVt=new hVt(20),pVt=(n,e,t)=>{e=e||"",t=t||"";const i=fVt.filter(o=>e.indexOf(o)<0&&t.indexOf(o)<0);if(i.length===0)return!0;const r=gVt.getRegExp(`(${i.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!r.test(n);if(!s){const o=n.indexOf(t);o>0&&!r.test(n.substring(0,o))&&(s=!0)}return s},Lne=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[e])return Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;const i=e.split(t);let r=n;for(let s=0;s-1&&ln?.replace("_","-"),mVt={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,e){console?.[n]?.apply?.(console,e)}};let _Vt=class Tne{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||mVt,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),i=0;i{this.observers[i]||(this.observers[i]=new Map);const r=this.observers[i].get(t)||0;this.observers[i].set(t,r+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r{let[a,l]=o;for(let c=0;c{let[a,l]=o;for(let c=0;c1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,o=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],i&&(Array.isArray(i)?a.push(...i):wi(i)&&s?a.push(...i.split(s)):a.push(i)));const l=d7(this.data,a);return!l&&!t&&!i&&e.indexOf(".")>-1&&(e=a[0],t=a[1],i=a.slice(2).join(".")),l||!o||!wi(i)?l:Lne(this.data?.[e]?.[t],i,s)}addResource(e,t,i,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[e,t];i&&(a=a.concat(o?i.split(o):i)),e.indexOf(".")>-1&&(a=e.split("."),r=t,t=a[1]),this.addNamespaces(t),mSe(this.data,a,r),s.silent||this.emit("added",e,t,i,r)}addResources(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in i)(wi(i[s])||Array.isArray(i[s]))&&this.addResource(e,t,s,i[s],{silent:!0});r.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,r,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),r=i,i=t,t=a[1]),this.addNamespaces(t);let l=d7(this.data,a)||{};o.skipCopy||(i=JSON.parse(JSON.stringify(i))),r?v$e(l,i,s):l={...l,...i},mSe(this.data,a,l),o.silent||this.emit("added",e,t,i)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(r=>t[r]&&Object.keys(t[r]).length>0)}toJSON(){return this.data}}var b$e={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,i,r){return n.forEach(s=>{e=this.processors[s]?.process(e,t,i,r)??e}),e}};const vSe={};class f7 extends FH{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),oVt(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Dp.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};return e==null?!1:this.resolve(e,t)?.res!==void 0}extractFromKey(e,t){let i=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const r=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let s=t.ns||this.options.defaultNS||[];const o=i&&e.indexOf(i)>-1,a=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!pVt(e,i,r);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:wi(s)?[s]:s};const c=e.split(i);(i!==r||i===r&&this.options.ns.indexOf(c[0])>-1)&&(s=c.shift()),e=c.join(r)}return{key:e,namespaces:wi(s)?[s]:s}}translate(e,t,i){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(e[e.length-1],t),l=a[a.length-1],c=t.lng||this.language,u=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c?.toLowerCase()==="cimode"){if(u){const C=t.nsSeparator||this.options.nsSeparator;return r?{res:`${l}${C}${o}`,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${C}${o}`}return r?{res:o,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:o}const d=this.resolve(e,t);let h=d?.res;const f=d?.usedKey||o,g=d?.exactUsedKey||o,p=Object.prototype.toString.apply(h),m=["[object Number]","[object Function]","[object RegExp]"],_=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,y=!wi(h)&&typeof h!="boolean"&&typeof h!="number";if(v&&h&&y&&m.indexOf(p)<0&&!(wi(_)&&Array.isArray(h))){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const C=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,h,{...t,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return r?(d.res=C,d.usedParams=this.getUsedParamsDetails(t),d):C}if(s){const C=Array.isArray(h),x=C?[]:{},k=C?g:f;for(const L in h)if(Object.prototype.hasOwnProperty.call(h,L)){const D=`${k}${s}${L}`;x[L]=this.translate(D,{...t,joinArrays:!1,ns:a}),x[L]===D&&(x[L]=h[L])}h=x}}else if(v&&wi(_)&&Array.isArray(h))h=h.join(_),h&&(h=this.extendTranslation(h,e,t,i));else{let C=!1,x=!1;const k=t.count!==void 0&&!wi(t.count),L=f7.hasDefaultValue(t),D=k?this.pluralResolver.getSuffix(c,t.count,t):"",I=t.ordinal&&k?this.pluralResolver.getSuffix(c,t.count,{ordinal:!1}):"",O=k&&!t.ordinal&&t.count===0,M=O&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${D}`]||t[`defaultValue${I}`]||t.defaultValue;!this.isValidLookup(h)&&L&&(C=!0,h=M),this.isValidLookup(h)||(x=!0,h=o);const G=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&x?void 0:h,W=L&&M!==h&&this.options.updateMissing;if(x||C||W){if(this.logger.log(W?"updateKey":"missingKey",c,l,o,W?M:h),s){const Z=this.resolve(o,{...t,keySeparator:!1});Z&&Z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let z=[];const q=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&q&&q[0])for(let Z=0;Z{const le=L&&te!==h?te:G;this.options.missingKeyHandler?this.options.missingKeyHandler(Z,l,j,le,W,t):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(Z,l,j,le,W,t),this.emit("missingKey",Z,l,j,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&k?z.forEach(Z=>{const j=this.pluralResolver.getSuffixes(Z,t);O&&t[`defaultValue${this.options.pluralSeparator}zero`]&&j.indexOf(`${this.options.pluralSeparator}zero`)<0&&j.push(`${this.options.pluralSeparator}zero`),j.forEach(te=>{ee([Z],o+te,t[`defaultValue${te}`]||M)})}):ee(z,o,M))}h=this.extendTranslation(h,e,t,d,i),x&&h===o&&this.options.appendNamespaceToMissingKey&&(h=`${l}:${o}`),(x||C)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,C?h:void 0))}return r?(d.res=h,d.usedParams=this.getUsedParamsDetails(t),d):h}extendTranslation(e,t,i,r,s){var o=this;if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const c=wi(e)&&(i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(c){const h=e.match(this.interpolator.nestingRegexp);u=h&&h.length}let d=i.replace&&!wi(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,i.lng||this.language||r.usedLng,i),c){const h=e.match(this.interpolator.nestingRegexp),f=h&&h.length;u1&&arguments[1]!==void 0?arguments[1]:{},i,r,s,o,a;return wi(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(i))return;const c=this.extractFromKey(l,t),u=c.key;r=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const h=t.count!==void 0&&!wi(t.count),f=h&&!t.ordinal&&t.count===0,g=t.context!==void 0&&(wi(t.context)||typeof t.context=="number")&&t.context!=="",p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);d.forEach(m=>{this.isValidLookup(i)||(a=m,!vSe[`${p[0]}-${m}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(vSe[`${p[0]}-${m}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(_=>{if(this.isValidLookup(i))return;o=_;const v=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(v,u,_,m,t);else{let C;h&&(C=this.pluralResolver.getSuffix(_,t.count,t));const x=`${this.options.pluralSeparator}zero`,k=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(v.push(u+C),t.ordinal&&C.indexOf(k)===0&&v.push(u+C.replace(k,this.options.pluralSeparator)),f&&v.push(u+x)),g){const L=`${u}${this.options.contextSeparator}${t.context}`;v.push(L),h&&(v.push(L+C),t.ordinal&&C.indexOf(k)===0&&v.push(L+C.replace(k,this.options.pluralSeparator)),f&&v.push(L+x))}}let y;for(;y=v.pop();)this.isValidLookup(i)||(s=y,i=this.getResource(_,m,y,t))}))})}),{res:i,usedKey:r,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,i,r):this.resourceStore.getResource(e,t,i,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!wi(e.replace);let r=i?e.replace:e;if(i&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!i){r={...r};for(const s of t)delete r[s]}return r}static hasDefaultValue(e){const t="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,t.length)&&e[i]!==void 0)return!0;return!1}}class bSe{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Dp.create("languageUtils")}getScriptPartFromCode(e){if(e=h7(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=h7(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(wi(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(i=>{if(t)return;const r=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(r))&&(t=r)}),!t&&this.options.supportedLngs&&e.forEach(i=>{if(t)return;const r=this.getLanguagePartFromCode(i);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(s=>{if(s===r)return s;if(!(s.indexOf("-")<0&&r.indexOf("-")<0)&&(s.indexOf("-")>0&&r.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===r||s.indexOf(r)===0&&r.length>1))return s})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),wi(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}toResolveHierarchy(e,t){const i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],s=o=>{o&&(this.isSupportedCode(o)?r.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return wi(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):wi(e)&&s(this.formatLanguageCode(e)),i.forEach(o=>{r.indexOf(o)<0&&s(this.formatLanguageCode(o))}),r}}const ySe={zero:0,one:1,two:2,few:3,many:4,other:5},wSe={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class vVt{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=Dp.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=h7(e==="dev"?"en":e),r=t.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:i,type:r});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(i,{type:r})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),wSe;if(!e.match(/-|_/))return wSe;const l=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(l,t)}return this.pluralRulesCache[s]=o,o}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,i).map(r=>`${t}${r}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?i.resolvedOptions().pluralCategories.sort((r,s)=>ySe[r]-ySe[s]).map(r=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,i);return r?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,i))}}const CSe=function(n,e,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=cVt(n,e,t);return!s&&r&&wi(t)&&(s=Lne(n,t,i),s===void 0&&(s=Lne(e,t,i))),s},vK=n=>n.replace(/\$/g,"$$$$");class bVt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Dp.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(t=>t),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:i,useRawValueToEscape:r,prefix:s,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:c,unescapeSuffix:u,unescapePrefix:d,nestingPrefix:h,nestingPrefixEscaped:f,nestingSuffix:g,nestingSuffixEscaped:p,nestingOptionsSeparator:m,maxReplaces:_,alwaysFormat:v}=e.interpolation;this.escape=t!==void 0?t:dVt,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=s?Ax(s):o||"{{",this.suffix=a?Ax(a):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=u?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=h?Ax(h):f||Ax("$t("),this.nestingSuffix=g?Ax(g):p||Ax(")"),this.nestingOptionsSeparator=m||",",this.maxReplaces=_||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,i)=>t?.source===i?(t.lastIndex=0,t):new RegExp(i,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,i,r){let s,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=f=>{if(f.indexOf(this.formatSeparator)<0){const _=CSe(t,l,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(_,void 0,i,{...r,...t,interpolationkey:f}):_}const g=f.split(this.formatSeparator),p=g.shift().trim(),m=g.join(this.formatSeparator).trim();return this.format(CSe(t,l,p,this.options.keySeparator,this.options.ignoreJSONStructure),m,i,{...r,...t,interpolationkey:p})};this.resetRegExp();const u=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>vK(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?vK(this.escape(f)):vK(f)}].forEach(f=>{for(a=0;s=f.regex.exec(e);){const g=s[1].trim();if(o=c(g),o===void 0)if(typeof u=="function"){const m=u(e,s,r);o=wi(m)?m:""}else if(r&&Object.prototype.hasOwnProperty.call(r,g))o="";else if(d){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),o="";else!wi(o)&&!this.useRawValueToEscape&&(o=fSe(o));const p=f.safeValue(o);if(e=e.replace(s[0],p),d?(f.regex.lastIndex+=o.length,f.regex.lastIndex-=s[0].length):f.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,s,o;const a=(l,c)=>{const u=this.nestingOptionsSeparator;if(l.indexOf(u)<0)return l;const d=l.split(new RegExp(`${u}[ ]*{`));let h=`{${d[1]}`;l=d[0],h=this.interpolate(h,o);const f=h.match(/'/g),g=h.match(/"/g);((f?.length??0)%2===0&&!g||g.length%2!==0)&&(h=h.replace(/'/g,'"'));try{o=JSON.parse(h),c&&(o={...c,...o})}catch(p){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,p),`${l}${u}${h}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];o={...i},o=o.replace&&!wi(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let c=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const u=r[1].split(this.formatSeparator).map(d=>d.trim());r[1]=u.shift(),l=u,c=!0}if(s=t(a.call(this,r[1].trim(),o),o),s&&r[0]===e&&!wi(s))return s;wi(s)||(s=fSe(s)),s||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),s=""),c&&(s=l.reduce((u,d)=>this.format(u,d,i.lng,{...i,interpolationkey:r[1].trim()}),s.trim())),e=e.replace(r[0],s),this.regexp.lastIndex=0}return e}}const yVt=n=>{let e=n.toLowerCase().trim();const t={};if(n.indexOf("(")>-1){const i=n.split("(");e=i[0].toLowerCase().trim();const r=i[1].substring(0,i[1].length-1);e==="currency"&&r.indexOf(":")<0?t.currency||(t.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?t.range||(t.range=r.trim()):r.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),u=a.trim();t[u]||(t[u]=c),c==="false"&&(t[u]=!1),c==="true"&&(t[u]=!0),isNaN(c)||(t[u]=parseInt(c,10))}})}return{formatName:e,formatOptions:t}},Nx=n=>{const e={};return(t,i,r)=>{let s=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(s={...s,[r.interpolationkey]:void 0});const o=i+JSON.stringify(s);let a=e[o];return a||(a=n(h7(i),r),e[o]=a),a(t)}};class wVt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Dp.create("formatter"),this.options=e,this.formats={number:Nx((t,i)=>{const r=new Intl.NumberFormat(t,{...i});return s=>r.format(s)}),currency:Nx((t,i)=>{const r=new Intl.NumberFormat(t,{...i,style:"currency"});return s=>r.format(s)}),datetime:Nx((t,i)=>{const r=new Intl.DateTimeFormat(t,{...i});return s=>r.format(s)}),relativetime:Nx((t,i)=>{const r=new Intl.RelativeTimeFormat(t,{...i});return s=>r.format(s,i.range||"day")}),list:Nx((t,i)=>{const r=new Intl.ListFormat(t,{...i});return s=>r.format(s)})},this.init(e)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Nx(t)}format(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=t.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(a=>a.indexOf(")")>-1)){const a=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,l)=>{const{formatName:c,formatOptions:u}=yVt(l);if(this.formats[c]){let d=a;try{const h=r?.formatParams?.[r.interpolationkey]||{},f=h.locale||h.lng||r.locale||r.lng||i;d=this.formats[c](a,f,{...u,...r,...h})}catch(h){this.logger.warn(h)}return d}else this.logger.warn(`there was no format function for ${c}`);return a},e)}}const CVt=(n,e)=>{n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)};class xVt extends FH{constructor(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=r,this.logger=Dp.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(i,r.backend,r)}queueLoad(e,t,i,r){const s={},o={},a={},l={};return e.forEach(c=>{let u=!0;t.forEach(d=>{const h=`${c}|${d}`;!i.reload&&this.store.hasResourceBundle(c,d)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?o[h]===void 0&&(o[h]=!0):(this.state[h]=1,u=!1,o[h]===void 0&&(o[h]=!0),s[h]===void 0&&(s[h]=!0),l[d]===void 0&&(l[d]=!0)))}),u||(a[c]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,t,i){const r=e.split("|"),s=r[0],o=r[1];t&&this.emit("failedLoading",s,o,t),!t&&i&&this.store.addResourceBundle(s,o,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);const a={};this.queue.forEach(l=>{lVt(l.loaded,[s],o),CVt(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});const u=l.loaded[c];u.length&&u.forEach(d=>{a[c][d]===void 0&&(a[c][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:i,tried:r,wait:s,callback:o});return}this.readingCalls++;const a=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&r{this.read.call(this,e,t,i,r+1,s*2,o)},s);return}o(c,u)},l=this.backend[i].bind(this.backend);if(l.length===2){try{const c=l(e,t);c&&typeof c.then=="function"?c.then(u=>a(null,u)).catch(a):a(null,c)}catch(c){a(c)}return}return l(e,t,a)}prepareLoading(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();wi(e)&&(e=this.languageUtils.toResolveHierarchy(e)),wi(t)&&(t=[t]);const s=this.queueLoad(e,t,i,r);if(!s.toLoad.length)return s.pending.length||r(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const i=e.split("|"),r=i[0],s=i[1];this.read(r,s,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${t}loading namespace ${s} for language ${r} failed`,o),!o&&a&&this.logger.log(`${t}loaded namespace ${s} for language ${r}`,a),this.loaded(e,o,a)})}saveMissing(e,t,i,r,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${i}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(i==null||i==="")){if(this.backend?.create){const l={...o,isUpdate:s},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,t,i,r,l):u=c(e,t,i,r),u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}else c(e,t,i,r,a,l)}!e||!e[0]||this.store.addResource(e[0],t,i,r)}}}const xSe=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:n=>{let e={};if(typeof n[1]=="object"&&(e=n[1]),wi(n[1])&&(e.defaultValue=n[1]),wi(n[2])&&(e.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const t=n[3]||n[2];Object.keys(t).forEach(i=>{e[i]=t[i]})}return e},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),SSe=n=>(wi(n.ns)&&(n.ns=[n.ns]),wi(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),wi(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs?.indexOf?.("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),typeof n.initImmediate=="boolean"&&(n.initAsync=n.initImmediate),n),N3=()=>{},SVt=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})};let y$e=class Dne extends FH{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=SSe(e),this.services={},this.logger=Dp,this.modules={external:[]},SVt(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(i=t,t={}),t.defaultNS==null&&t.ns&&(wi(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=xSe();this.options={...r,...this.options,...SSe(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const s=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Dp.init(s(this.modules.logger),this.options):Dp.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=wVt;const d=new bSe(this.options);this.store=new _Se(this.options.resources,this.options);const h=this.services;h.logger=Dp,h.resourceStore=this.store,h.languageUtils=d,h.pluralResolver=new vVt(d,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(h.formatter=s(u),h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new bVt(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new xVt(s(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",function(f){for(var g=arguments.length,p=new Array(g>1?g-1:0),m=1;m1?g-1:0),m=1;m{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,i||(i=N3),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const l=YT(),c=()=>{const u=(d,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(h),i(d,h)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),l}loadResources(e){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:N3;const r=wi(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const s=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&s.indexOf(c)<0&&s.push(c)})};r?o(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload?.forEach?.(a=>o(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(a)})}else i(null)}reloadResources(e,t,i){const r=YT();return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),i||(i=N3),this.services.backendConnector.reload(e,t,s=>{r.resolve(),i(s)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&b$e.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}}changeLanguage(e,t){var i=this;this.isLanguageChangingTo=e;const r=YT();this.emit("languageChanging",e);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,c)=>{c?(s(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve(function(){return i.t(...arguments)}),t&&t(l,function(){return i.t(...arguments)})},a=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const c=wi(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);c&&(this.language||s(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,u=>{o(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),r}getFixedT(e,t,i){var r=this;const s=function(o,a){let l;if(typeof a!="object"){for(var c=arguments.length,u=new Array(c>2?c-2:0),d=2;d`${l.keyPrefix}${h}${g}`):f=l.keyPrefix?`${l.keyPrefix}${h}${o}`:o,r.t(f,l)};return wi(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=i,s}t(){for(var e=arguments.length,t=new Array(e),i=0;i1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===0||c===2};if(t.precheck){const a=t.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(i,e)&&(!r||o(s,e)))}loadNamespaces(e,t){const i=YT();return this.options.ns?(wi(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{i.resolve(),t&&t(r)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){const i=YT();wi(e)&&(e=[e]);const r=this.options.preload||[],s=e.filter(o=>r.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=r.concat(s),this.loadResources(o=>{i.resolve(),t&&t(o)}),i):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],i=this.services?.languageUtils||new bSe(xSe());return t.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new Dne(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:N3;const i=e.forkResourceStore;i&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},s=new Dne(r);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},i){const a=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},Object.keys(l[c]).reduce((u,d)=>(u[d]={...l[c][d]},u),{})),{});s.store=new _Se(a,r),s.services.resourceStore=s.store}return s.translator=new f7(s.services,r),s.translator.on("*",function(a){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;u{if(e)for(const t in e)n[t]===void 0&&(n[t]=e[t])}),n}const kSe=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,TVt=function(n,e){const i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},r=encodeURIComponent(e);let s=`${n}=${r}`;if(i.maxAge>0){const o=i.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(o)}`}if(i.domain){if(!kSe.test(i.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${i.domain}`}if(i.path){if(!kSe.test(i.path))throw new TypeError("option path is invalid");s+=`; Path=${i.path}`}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${i.expires.toUTCString()}`}if(i.httpOnly&&(s+="; HttpOnly"),i.secure&&(s+="; Secure"),i.sameSite)switch(typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return s},ESe={create(n,e,t,i){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};t&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+t*60*1e3)),i&&(r.domain=i),document.cookie=TVt(n,encodeURIComponent(e),r)},read(n){const e=`${n}=`,t=document.cookie.split(";");for(let i=0;i-1&&(i=window.location.hash.substring(window.location.hash.indexOf("?")));const s=i.substring(1).split("&");for(let o=0;o0&&s[o].substring(0,a)===e&&(t=s[o].substring(a+1))}}return t}};let ZT=null;const LSe=()=>{if(ZT!==null)return ZT;try{ZT=window!=="undefined"&&window.localStorage!==null;const n="i18next.translate.boo";window.localStorage.setItem(n,"foo"),window.localStorage.removeItem(n)}catch{ZT=!1}return ZT};var AVt={name:"localStorage",lookup(n){let{lookupLocalStorage:e}=n;if(e&&LSe())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(n,e){let{lookupLocalStorage:t}=e;t&&LSe()&&window.localStorage.setItem(t,n)}};let XT=null;const TSe=()=>{if(XT!==null)return XT;try{XT=window!=="undefined"&&window.sessionStorage!==null;const n="i18next.translate.boo";window.sessionStorage.setItem(n,"foo"),window.sessionStorage.removeItem(n)}catch{XT=!1}return XT};var NVt={name:"sessionStorage",lookup(n){let{lookupSessionStorage:e}=n;if(e&&TSe())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(n,e){let{lookupSessionStorage:t}=e;t&&TSe()&&window.sessionStorage.setItem(t,n)}},RVt={name:"navigator",lookup(n){const e=[];if(typeof navigator<"u"){const{languages:t,userLanguage:i,language:r}=navigator;if(t)for(let s=0;s0?e:void 0}},PVt={name:"htmlTag",lookup(n){let{htmlTag:e}=n,t;const i=e||(typeof document<"u"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(t=i.getAttribute("lang")),t}},OVt={name:"path",lookup(n){let{lookupFromPathIndex:e}=n;if(typeof window>"u")return;const t=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?t[typeof e=="number"?e:0]?.replace("/",""):void 0}},MVt={name:"subdomain",lookup(n){let{lookupFromSubdomainIndex:e}=n;const t=typeof e=="number"?e+1:1,i=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(i)return i[t]}};let w$e=!1;try{document.cookie,w$e=!0}catch{}const C$e=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];w$e||C$e.splice(1,1);const FVt=()=>({order:C$e,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:n=>n});class BVt{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=LVt(t,this.options||{},FVt()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=r=>r.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(DVt),this.addDetector(IVt),this.addDetector(AVt),this.addDetector(NVt),this.addDetector(RVt),this.addDetector(PVt),this.addDetector(OVt),this.addDetector(MVt)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,t=[];return e.forEach(i=>{if(this.detectors[i]){let r=this.detectors[i].lookup(this.options);r&&typeof r=="string"&&(r=[r]),r&&(t=t.concat(r))}}),t=t.map(i=>this.options.convertDetectedLanguage(i)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(i=>{this.detectors[i]&&this.detectors[i].cacheUserLanguage(e,this.options)}))}}BVt.type="languageDetector";/*!----------------------------------------------------------------------------- +`)};const o=await s.provideRenameEdits(this.model,this.position,e,r);if(o){if(o.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(o.rejectReason),r)}else return this._provideRenameEdits(e,t+1,i.concat(w("no result","No result.")),r);return o}}async function s$t(n,e,t,i){const r=new Ede(e,t,n),s=await r.resolveRenameLocation(yn.None);return s?.rejectReason?{edits:[],rejectReason:s.rejectReason}:r.provideRenameEdits(i,yn.None)}let Bb=class{static{qte=this}static{this.ID="editor.contrib.renameController"}static get(e){return e.getContribution(qte.ID)}constructor(e,t,i,r,s,o,a,l,c){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=r,this._progressService=s,this._logService=o,this._configService=a,this._languageFeaturesService=l,this._telemetryService=c,this._disposableStore=new ke,this._cts=new Kr,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(jte,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new Kr,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new Ede(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const r=new Pb(this.editor,5,void 0,this._cts.token);let s;try{e("resolving rename location");const g=i.resolveRenameLocation(r.token);this._progressService.showWhile(g,250),s=await g,e("resolved rename location")}catch(g){g instanceof sf?e("resolve rename location cancelled",JSON.stringify(g,null," ")):(e("resolve rename location failed",g instanceof Error?g:JSON.stringify(g,null," ")),(typeof g=="string"||bg(g))&&au.get(this.editor)?.showMessage(g||w("resolveRenameLocationFailed","An unknown error occurred while resolving rename location"),t));return}finally{r.dispose()}if(!s){e("returning early - no loc");return}if(s.rejectReason){e(`returning early - rejected with reason: ${s.rejectReason}`,s.rejectReason),au.get(this.editor)?.showMessage(s.rejectReason,t);return}if(r.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const o=new Pb(this.editor,5,s.range,this._cts.token),a=this.editor.getModel(),l=this._languageFeaturesService.newSymbolNamesProvider.all(a),c=await Promise.all(l.map(async g=>[g,await g.supportsAutomaticNewSymbolNamesTriggerKind??!1])),u=(g,p)=>{let m=c.slice();return g===oN.Automatic&&(m=m.filter(([_,v])=>v)),m.map(([_])=>_.provideNewSymbolNames(a,s.range,g,p))};e("creating rename input field and awaiting its result");const d=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),h=await this._renameWidget.getInput(s.range,s.text,d,l.length>0?u:void 0,o);if(e("received response from rename input field"),l.length>0&&this._reportTelemetry(l.length,a.getLanguageId(),h),typeof h=="boolean"){e(`returning early - rename input field response - ${h}`),h&&this.editor.focus(),o.dispose();return}this.editor.focus(),e("requesting rename edits");const f=YP(i.provideRenameEdits(h.newName,o.token),o.token).then(async g=>{if(!g){e("returning early - no rename edits result");return}if(!this.editor.hasModel()){e("returning early - no model after rename edits are provided");return}if(g.rejectReason){e(`returning early - rejected with reason: ${g.rejectReason}`),this._notificationService.info(g.rejectReason);return}this.editor.setSelection($.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(g,{editor:this.editor,showPreview:h.wantsPreview,label:w("label","Renaming '{0}' to '{1}'",s?.text,h.newName),code:"undoredo.rename",quotableLabel:w("quotableLabel","Renaming {0} to {1}",s?.text,h.newName),respectAutoSaveConfig:!0}).then(p=>{e("edits applied"),p.ariaSummary&&ql(w("aria","Successfully renamed '{0}' to '{1}'. Summary: {2}",s.text,h.newName,p.ariaSummary))}).catch(p=>{e(`error when applying edits ${JSON.stringify(p,null," ")}`),this._notificationService.error(w("rename.failedApply","Rename failed to apply edits")),this._logService.error(p)})},g=>{e("error when providing rename edits",JSON.stringify(g,null," ")),this._notificationService.error(w("rename.failed","Rename failed to compute edits")),this._logService.error(g)}).finally(()=>{o.dispose()});return e("returning rename operation"),this._progressService.showWhile(f,250),f}acceptRenameInput(e){this._renameWidget.acceptInput(e)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}_reportTelemetry(e,t,i){const r=typeof i=="boolean"?{kind:"cancelled",languageId:t,nRenameSuggestionProviders:e}:{kind:"accepted",languageId:t,nRenameSuggestionProviders:e,source:i.stats.source.k,nRenameSuggestions:i.stats.nRenameSuggestions,timeBeforeFirstInputFieldEdit:i.stats.timeBeforeFirstInputFieldEdit,wantsPreview:i.wantsPreview,nRenameSuggestionsInvocations:i.stats.nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:i.stats.hadAutomaticRenameSuggestionsInvocation};this._telemetryService.publicLog2("renameInvokedEvent",r)}};Bb=qte=r$t([q0(1,Tt),q0(2,Ts),q0(3,rO),q0(4,Qb),q0(5,Da),q0(6,nW),q0(7,dt),q0(8,Qa)],Bb);class o$t extends ot{constructor(){super({id:"editor.action.rename",label:w("rename.label","Rename Symbol"),alias:"Rename Symbol",precondition:Le.and(Q.writable,Q.hasRenameProvider),kbOpts:{kbExpr:Q.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(ai),[r,s]=Array.isArray(t)&&t||[void 0,void 0];return Pt.isUri(r)&&he.isIPosition(s)?i.openCodeEditor({resource:r},i.getActiveCodeEditor()).then(o=>{o&&(o.setPosition(s),o.invokeWithinContext(a=>(this.reportTelemetry(a,o),this.run(a,o))))},rn):super.runCommand(e,t)}run(e,t){const i=e.get(Da),r=Bb.get(t);return r?(i.trace("[RenameAction] got controller, running..."),r.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}Zn(Bb.ID,Bb,4);Pe(o$t);const Lde=fo.bindToContribution(Bb.get);Je(new Lde({id:"acceptRenameInput",precondition:v2,handler:n=>n.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Le.and(Q.focus,Le.not("isComposing")),primary:3}}));Je(new Lde({id:"acceptRenameInputWithPreview",precondition:Le.and(v2,Le.has("config.editor.rename.enablePreview")),handler:n=>n.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Le.and(Q.focus,Le.not("isComposing")),primary:2051}}));Je(new Lde({id:"cancelRenameInput",precondition:v2,handler:n=>n.cancelRenameInput(),kbOpts:{weight:199,kbExpr:Q.focus,primary:9,secondary:[1033]}}));lr(class extends Gl{constructor(){super({id:"focusNextRenameSuggestion",title:{...Gt("focusNextRenameSuggestion","Focus Next Rename Suggestion")},precondition:v2,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(ai).getFocusedCodeEditor();if(!t)return;const i=Bb.get(t);i&&i.focusNextRenameSuggestion()}});lr(class extends Gl{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...Gt("focusPreviousRenameSuggestion","Focus Previous Rename Suggestion")},precondition:v2,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(ai).getFocusedCodeEditor();if(!t)return;const i=Bb.get(t);i&&i.focusPreviousRenameSuggestion()}});Rc("_executeDocumentRenameProvider",function(n,e,t,...i){const[r]=i;oi(typeof r=="string");const{renameProvider:s}=n.get(dt);return s$t(s,e,t,r)});Rc("_executePrepareRename",async function(n,e,t){const{renameProvider:i}=n.get(dt),s=await new Ede(e,t,i).resolveRenameLocation(yn.None);if(s?.rejectReason)throw new Error(s.rejectReason);return s});Yr.as(ff.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:w("enablePreview","Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var a$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Fxe=function(n,e){return function(t,i){e(t,i,n)}};let n7=class extends me{static{this.ID="editor.sectionHeaderDetector"}constructor(e,t,i){super(),this.editor=e,this.languageConfigurationService=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(73)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(r=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(r=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(r=>{const s=this.editor.getModel()?.getLanguageId();s&&r.affects(s)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(73)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(r=>{this.options&&!r.hasChanged(73)||(this.options=this.createOptions(e.getOption(73)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(r=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(r=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new Ui(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}createOptions(e){if(!e||!this.editor.hasModel())return;const t=this.editor.getModel().getLanguageId();if(!t)return;const i=this.languageConfigurationService.getLanguageConfiguration(t).comments,r=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!i&&!r?.markers))return{foldingRules:r,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){if(!this.editor.hasModel()||!this.options?.findMarkSectionHeaders&&!this.options?.findRegionSectionHeaders)return;const e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;const t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(i=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(i)})}updateDecorations(e){const t=this.editor.getModel();t&&(e=e.filter(s=>{if(!s.shouldBeInComments)return!0;const o=t.validateRange(s.range),a=t.tokenization.getLineTokens(o.startLineNumber),l=a.findTokenIndexAtOffset(o.startColumn-1),c=a.getStandardTokenType(l);return a.getLanguageId(l)===t.getLanguageId()&&c===1}));const i=Object.values(this.currentOccurrences).map(s=>s.decorationId),r=e.map(s=>l$t(s));this.editor.changeDecorations(s=>{const o=s.deltaDecorations(i,r);this.currentOccurrences={};for(let a=0,l=o.length;a0?t[0]:[]}async function RBe(n,e,t,i,r){const s=f$t(n,e),o=await Promise.all(s.map(async a=>{let l,c=null;try{l=await a.provideDocumentSemanticTokens(e,a===t?i:null,r)}catch(u){c=u,l=null}return(!l||!SH(l)&&!ABe(l))&&(l=null),new h$t(a,l,c)}));for(const a of o){if(a.error)throw a.error;if(a.tokens)return a}return o.length>0?o[0]:null}function g$t(n,e){const t=n.orderedGroups(e);return t.length>0?t[0]:null}class p$t{constructor(e,t){this.provider=e,this.tokens=t}}function m$t(n,e){return n.has(e)}function PBe(n,e){const t=n.orderedGroups(e);return t.length>0?t[0]:[]}async function Tde(n,e,t,i){const r=PBe(n,e),s=await Promise.all(r.map(async o=>{let a;try{a=await o.provideDocumentRangeSemanticTokens(e,t,i)}catch(l){vs(l),a=null}return(!a||!SH(a))&&(a=null),new p$t(o,a)}));for(const o of s)if(o.tokens)return o;return s.length>0?s[0]:null}Un.registerCommand("_provideDocumentSemanticTokensLegend",async(n,...e)=>{const[t]=e;oi(t instanceof Pt);const i=n.get(Sr).getModel(t);if(!i)return;const{documentSemanticTokensProvider:r}=n.get(dt),s=g$t(r,i);return s?s[0].getLegend():n.get(_r).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});Un.registerCommand("_provideDocumentSemanticTokens",async(n,...e)=>{const[t]=e;oi(t instanceof Pt);const i=n.get(Sr).getModel(t);if(!i)return;const{documentSemanticTokensProvider:r}=n.get(dt);if(!NBe(r,i))return n.get(_r).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await RBe(r,i,null,null,yn.None);if(!s)return;const{provider:o,tokens:a}=s;if(!a||!SH(a))return;const l=IBe({id:0,type:"full",data:a.data});return a.resultId&&o.releaseDocumentSemanticTokens(a.resultId),l});Un.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(n,...e)=>{const[t,i]=e;oi(t instanceof Pt);const r=n.get(Sr).getModel(t);if(!r)return;const{documentRangeSemanticTokensProvider:s}=n.get(dt),o=PBe(s,r);if(o.length===0)return;if(o.length===1)return o[0].getLegend();if(!i||!$.isIRange(i))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),o[0].getLegend();const a=await Tde(s,r,$.lift(i),yn.None);if(a)return a.provider.getLegend()});Un.registerCommand("_provideDocumentRangeSemanticTokens",async(n,...e)=>{const[t,i]=e;oi(t instanceof Pt),oi($.isIRange(i));const r=n.get(Sr).getModel(t);if(!r)return;const{documentRangeSemanticTokensProvider:s}=n.get(dt),o=await Tde(s,r,$.lift(i),yn.None);if(!(!o||!o.tokens))return IBe({id:0,type:"full",data:o.tokens.data})});const Dde="editor.semanticHighlighting";function xF(n,e,t){const i=t.getValue(Dde,{overrideIdentifier:n.getLanguageId(),resource:n.uri})?.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var OBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},_p=function(n,e){return function(t,i){e(t,i,n)}},J0;let Kte=class extends me{constructor(e,t,i,r,s,o){super(),this._watchers=Object.create(null);const a=u=>{this._watchers[u.uri.toString()]=new Gte(u,e,i,s,o)},l=(u,d)=>{d.dispose(),delete this._watchers[u.uri.toString()]},c=()=>{for(const u of t.getModels()){const d=this._watchers[u.uri.toString()];xF(u,i,r)?d||a(u):d&&l(u,d)}};t.getModels().forEach(u=>{xF(u,i,r)&&a(u)}),this._register(t.onModelAdded(u=>{xF(u,i,r)&&a(u)})),this._register(t.onModelRemoved(u=>{const d=this._watchers[u.uri.toString()];d&&l(u,d)})),this._register(r.onDidChangeConfiguration(u=>{u.affectsConfiguration(Dde)&&c()})),this._register(i.onDidColorThemeChange(c))}dispose(){for(const e of Object.values(this._watchers))e.dispose();super.dispose()}};Kte=OBe([_p(0,rW),_p(1,Sr),_p(2,go),_p(3,En),_p(4,cd),_p(5,dt)],Kte);let Gte=class extends me{static{J0=this}static{this.REQUEST_MIN_DELAY=300}static{this.REQUEST_MAX_DELAY=2e3}constructor(e,t,i,r,s){super(),this._semanticTokensStylingService=t,this._isDisposed=!1,this._model=e,this._provider=s.documentSemanticTokensProvider,this._debounceInformation=r.for(this._provider,"DocumentSemanticTokens",{min:J0.REQUEST_MIN_DELAY,max:J0.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Ui(()=>this._fetchDocumentSemanticTokensNow(),J0.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeAttached(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)}));const o=()=>{er(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const a of this._provider.all(e))typeof a.onDidChange=="function"&&this._documentProvidersChangeListeners.push(a.onDidChange(()=>{if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}))};o(),this._register(this._provider.onDidChange(()=>{o(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(i.onDidColorThemeChange(a=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),er(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!NBe(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new Kr,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,r=RBe(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const s=[],o=this._model.onDidChangeContent(l=>{s.push(l)}),a=new Bo(!1);r.then(l=>{if(this._debounceInformation.update(this._model,a.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,o.dispose(),!l)this._setDocumentSemanticTokens(null,null,null,s);else{const{provider:c,tokens:u}=l,d=this._semanticTokensStylingService.getStyling(c);this._setDocumentSemanticTokens(c,u||null,d,s)}},l=>{l&&(uh(l)||typeof l.message=="string"&&l.message.indexOf("busy")!==-1)||rn(l),this._currentDocumentRequestCancellationTokenSource=null,o.dispose(),(s.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,i,r,s){s=Math.min(s,i.length-r,e.length-t);for(let o=0;o{(r.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!i){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),o();return}if(ABe(t)){if(!s){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:s.data};else{let a=0;for(const h of t.edits)a+=(h.data?h.data.length:0)-h.deleteCount;const l=s.data,c=new Uint32Array(l.length+a);let u=l.length,d=c.length;for(let h=t.edits.length-1;h>=0;h--){const f=t.edits[h];if(f.start>l.length){i.warnInvalidEditStart(s.resultId,t.resultId,h,f.start,l.length),this._model.tokenization.setSemanticTokens(null,!0);return}const g=u-(f.start+f.deleteCount);g>0&&(J0._copy(l,u-g,c,d-g,g),d-=g),f.data&&(J0._copy(f.data,0,c,d-f.data.length,f.data.length),d-=f.data.length),u=f.start}u>0&&J0._copy(l,0,c,0,u),t={resultId:t.resultId,data:c}}}if(SH(t)){this._currentDocumentResponse=new _$t(e,t.resultId,t.data);const a=l5e(t,i,this._model.getLanguageId());if(r.length>0)for(const l of r)for(const c of a)for(const u of l.changes)c.applyEdit(u.range,u.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);o()}};Gte=J0=OBe([_p(1,rW),_p(2,go),_p(3,cd),_p(4,dt)],Gte);class _$t{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}u2(Kte);var v$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},GT=function(n,e){return function(t,i){e(t,i,n)}};let i7=class extends me{static{this.ID="editor.contrib.viewportSemanticTokens"}constructor(e,t,i,r,s,o){super(),this._semanticTokensStylingService=t,this._themeService=i,this._configurationService=r,this._editor=e,this._provider=o.documentRangeSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new Ui(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[];const a=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange(()=>{a()})),this._register(this._editor.onDidChangeModel(()=>{this._cancelAll(),a()})),this._register(this._editor.onDidChangeModelContent(l=>{this._cancelAll(),a()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration(Dde)&&(this._cancelAll(),a())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),a()})),a()}_cancelAll(){for(const e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,i=this._outstandingRequests.length;tthis._requestRange(e,i)))}_requestRange(e,t){const i=e.getVersionId(),r=ko(o=>Promise.resolve(Tde(this._provider,e,t,o))),s=new Bo(!1);return r.then(o=>{if(this._debounceInformation.update(e,s.elapsed()),!o||!o.tokens||e.isDisposed()||e.getVersionId()!==i)return;const{provider:a,tokens:l}=o,c=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,l5e(l,c,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(r),()=>this._removeOutstandingRequest(r)),r}};i7=v$t([GT(1,rW),GT(2,go),GT(3,En),GT(4,cd),GT(5,dt)],i7);Zn(i7.ID,i7,1);class b$t{constructor(e=!0){this.selectSubwords=e}provideSelectionRanges(e,t){const i=[];for(const r of t){const s=[];i.push(s),this.selectSubwords&&this._addInWordRanges(s,e,r),this._addWordRanges(s,e,r),this._addWhitespaceLine(s,e,r),s.push({range:e.getFullModelRange()})}return i}_addInWordRanges(e,t,i){const r=t.getWordAtPosition(i);if(!r)return;const{word:s,startColumn:o}=r,a=i.column-o;let l=a,c=a,u=0;for(;l>=0;l--){const d=s.charCodeAt(l);if(l!==a&&(d===95||d===45))break;if(Tv(d)&&fp(u))break;u=d}for(l+=1;c0&&t.getLineFirstNonWhitespaceColumn(i.lineNumber)===0&&t.getLineLastNonWhitespaceColumn(i.lineNumber)===0&&e.push({range:new $(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var y$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},w$t=function(n,e){return function(t,i){e(t,i,n)}},Yte;class Ide{constructor(e,t){this.index=e,this.ranges=t}mov(e){const t=this.index+(e?1:-1);if(t<0||t>=this.ranges.length)return this;const i=new Ide(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}let bR=class{static{Yte=this}static{this.ID="editor.contrib.smartSelectController"}static get(e){return e.getContribution(Yte.ID)}constructor(e,t){this._editor=e,this._languageFeaturesService=t,this._ignoreSelection=!1}dispose(){this._selectionListener?.dispose()}async run(e){if(!this._editor.hasModel())return;const t=this._editor.getSelections(),i=this._editor.getModel();if(this._state||await FBe(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(114),yn.None).then(s=>{if(!(!bl(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!$r(this._editor.getSelections(),t,(o,a)=>o.equalsSelection(a)))){for(let o=0;oa.containsPosition(t[o].getStartPosition())&&a.containsPosition(t[o].getEndPosition())),s[o].unshift(t[o]);this._state=s.map(o=>new Ide(0,o)),this._selectionListener?.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{this._ignoreSelection||(this._selectionListener?.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(s=>s.mov(e));const r=this._state.map(s=>yt.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(r)}finally{this._ignoreSelection=!1}}};bR=Yte=y$t([w$t(1,dt)],bR);class MBe extends ot{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=bR.get(t);i&&await i.run(this._forward)}}class C$t extends MBe{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:w("smartSelect.expand","Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"1_basic",title:w({key:"miSmartSelectGrow",comment:["&& denotes a mnemonic"]},"&&Expand Selection"),order:2}})}}Un.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class x$t extends MBe{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:w("smartSelect.shrink","Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:ce.MenubarSelectionMenu,group:"1_basic",title:w({key:"miSmartSelectShrink",comment:["&& denotes a mnemonic"]},"&&Shrink Selection"),order:3}})}}Zn(bR.ID,bR,4);Pe(C$t);Pe(x$t);async function FBe(n,e,t,i,r){const s=n.all(e).concat(new b$t(i.selectSubwords));s.length===1&&s.unshift(new Ah);const o=[],a=[];for(const l of s)o.push(Promise.resolve(l.provideSelectionRanges(e,t,r)).then(c=>{if(bl(c)&&c.length===t.length)for(let u=0;u{if(l.length===0)return[];l.sort((h,f)=>he.isBefore(h.getStartPosition(),f.getStartPosition())?1:he.isBefore(f.getStartPosition(),h.getStartPosition())||he.isBefore(h.getEndPosition(),f.getEndPosition())?-1:he.isBefore(f.getEndPosition(),h.getEndPosition())?1:0);const c=[];let u;for(const h of l)(!u||$.containsRange(h,u)&&!$.equalsRange(h,u))&&(c.push(h),u=h);if(!i.selectLeadingAndTrailingWhitespace)return c;const d=[c[0]];for(let h=1;hn}),aK="data-sticky-line-index",$xe="data-sticky-is-line",k$t="data-sticky-is-line-number",Wxe="data-sticky-is-folding-icon";class E$t extends me{constructor(e){super(),this._editor=e,this._foldingIconStore=new ke,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._lineHeight=this._editor.getOption(67),this._renderedStickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",e instanceof cf),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const t=()=>{this._linesDomNode.style.left=this._editor.getOption(116).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(116)&&t(),i.hasChanged(67)&&(this._lineHeight=this._editor.getOption(67))})),this._register(this._editor.onDidScrollChange(i=>{i.scrollLeftChanged&&t(),i.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),this._register(this._foldingIconStore),t(),this._register(this._editor.onDidLayoutChange(i=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(e){return this._renderedStickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,i){if(i===void 0&&(!this._previousState&&!e||this._previousState&&this._previousState.equals(e)))return;const r=this._isWidgetHeightZero(e),s=r?void 0:e,o=r?0:this._findLineToRebuildWidgetFrom(e,i);this._renderRootNode(s,t,o),this._previousState=e}_isWidgetHeightZero(e){if(!e)return!0;const t=e.startLineNumbers.length*this._lineHeight+e.lastLineRelativePosition;if(t>0){this._lastLineRelativePosition=e.lastLineRelativePosition;const i=[...e.startLineNumbers];e.showEndForLine!==null&&(i[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]),this._lineNumbers=i}else this._lastLineRelativePosition=0,this._lineNumbers=[];return t===0}_findLineToRebuildWidgetFrom(e,t){if(!e||!this._previousState)return 0;if(t!==void 0)return t;const i=this._previousState,r=e.startLineNumbers.findIndex(s=>!i.startLineNumbers.includes(s));return r===-1?0:r}_updateWidgetWidth(){const e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_clearStickyLinesFromLine(e){this._foldingIconStore.clear();for(let t=e;ta.scrollWidth))+r.verticalScrollbarWidth,this._editor.layoutOverlayWidget(this)}_setFoldingHoverListeners(){this._editor.getOption(111)==="mouseover"&&(this._foldingIconStore.add(Ce(this._lineNumbersDomNode,je.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(Ce(this._lineNumbersDomNode,je.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,i,r){const s=this._editor._getViewModel();if(!s)return;const o=s.coordinatesConverter.convertModelPositionToViewPosition(new he(t,1)).lineNumber,a=s.getViewLineRenderingData(o),l=this._editor.getOption(68);let c;try{c=Ol.filter(a.inlineDecorations,o,a.minColumn,a.maxColumn)}catch{c=[]}const u=new n1(!0,!0,a.content,a.continuesWithWrappedLine,a.isBasicASCII,a.containsRTL,0,a.tokens,c,a.tabSize,a.startVisibleColumn,1,1,1,500,"none",!0,!0,null),d=new XL(2e3),h=mO(u,d);let f;Bxe?f=Bxe.createHTML(d.build()):f=d.build();const g=document.createElement("span");g.setAttribute(aK,String(e)),g.setAttribute($xe,""),g.setAttribute("role","listitem"),g.tabIndex=0,g.className="sticky-line-content",g.classList.add(`stickyLine${t}`),g.style.lineHeight=`${this._lineHeight}px`,g.innerHTML=f;const p=document.createElement("span");p.setAttribute(aK,String(e)),p.setAttribute(k$t,""),p.className="sticky-line-number",p.style.lineHeight=`${this._lineHeight}px`;const m=r.contentLeft;p.style.width=`${m}px`;const _=document.createElement("span");l.renderType===1||l.renderType===3&&t%10===0?_.innerText=t.toString():l.renderType===2&&(_.innerText=Math.abs(t-this._editor.getPosition().lineNumber).toString()),_.className="sticky-line-number-inner",_.style.lineHeight=`${this._lineHeight}px`,_.style.width=`${r.lineNumbersWidth}px`,_.style.paddingLeft=`${r.lineNumbersLeft}px`,p.appendChild(_);const v=this._renderFoldingIconForLine(i,t);v&&p.appendChild(v.domNode),this._editor.applyFontInfo(g),this._editor.applyFontInfo(_),p.style.lineHeight=`${this._lineHeight}px`,g.style.lineHeight=`${this._lineHeight}px`,p.style.height=`${this._lineHeight}px`,g.style.height=`${this._lineHeight}px`;const y=new L$t(e,t,g,p,v,h.characterMapping,g.scrollWidth);return this._updateTopAndZIndexOfStickyLine(y)}_updateTopAndZIndexOfStickyLine(e){const t=e.index,i=e.lineDomNode,r=e.lineNumberDomNode,s=t===this._lineNumbers.length-1,o="0",a="1";i.style.zIndex=s?o:a,r.style.zIndex=s?o:a;const l=`${t*this._lineHeight+this._lastLineRelativePosition+(e.foldingIcon?.isCollapsed?1:0)}px`,c=`${t*this._lineHeight}px`;return i.style.top=s?l:c,r.style.top=s?l:c,e}_renderFoldingIconForLine(e,t){const i=this._editor.getOption(111);if(!e||i==="never")return;const r=e.regions,s=r.findRange(t),o=r.getStartLineNumber(s);if(!(t===o))return;const l=r.isCollapsed(s),c=new T$t(l,o,r.getEndLineNumber(s),this._lineHeight);return c.setVisible(this._isOnGlyphMargin?!0:l||i==="always"),c.domNode.setAttribute(Wxe,""),c}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOridinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e0)return null;const t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;const i=Ace(t.characterMapping,e,0);return new he(t.lineNumber,i)}getLineNumberFromChildDomNode(e){return this._getRenderedStickyLineFromChildDomNode(e)?.lineNumber??null}_getRenderedStickyLineFromChildDomNode(e){const t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._renderedStickyLines.length?null:this._renderedStickyLines[t]}getLineIndexFromChildDomNode(e){const t=this._getAttributeValue(e,aK);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,$xe)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,Wxe)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class L$t{constructor(e,t,i,r,s,o,a){this.index=e,this.lineNumber=t,this.lineDomNode=i,this.lineNumberDomNode=r,this.foldingIcon=s,this.characterMapping=o,this.scrollWidth=a}}class T$t{constructor(e,t,i,r){this.isCollapsed=e,this.foldingStartLine=t,this.foldingEndLine=i,this.dimension=r,this.domNode=document.createElement("div"),this.domNode.style.width=`${r}px`,this.domNode.style.height=`${r}px`,this.domNode.className=zt.asClassName(e?H9:W9)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class ZI{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class r7{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class BBe{constructor(e,t,i,r){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=r}}var kH=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},yR=function(n,e){return function(t,i){e(t,i,n)}},XI;(function(n){n.OUTLINE_MODEL="outlineModel",n.FOLDING_PROVIDER_MODEL="foldingProviderModel",n.INDENTATION_MODEL="indentationModel"})(XI||(XI={}));var Hv;(function(n){n[n.VALID=0]="VALID",n[n.INVALID=1]="INVALID",n[n.CANCELED=2]="CANCELED"})(Hv||(Hv={}));let Zte=class extends me{constructor(e,t,i,r){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new Qd(300)),this._updateOperation=this._register(new ke),this._editor.getOption(116).defaultModel){case XI.OUTLINE_MODEL:this._modelProviders.push(new Xte(this._editor,r));case XI.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new Jte(this._editor,t,r));case XI.INDENTATION_MODEL:this._modelProviders.push(new Qte(this._editor,i));break}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(const t of this._modelProviders){const{statusPromise:i,modelPromise:r}=t.computeStickyModel(e);this._modelPromise=r;const s=await i;if(this._modelPromise!==r)return null;switch(s){case Hv.CANCELED:return this._updateOperation.clear(),null;case Hv.VALID:return t.stickyModel}}return null}).catch(t=>(rn(t),null))}};Zte=kH([yR(2,Tt),yR(3,dt)],Zte);class $Be extends me{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,Hv.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=ko(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?Hv.CANCELED:(this._stickyModel=this.createStickyModel(e,i),Hv.VALID):this._invalid()).then(void 0,i=>(rn(i),Hv.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let Xte=class extends $Be{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return n_.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){const{stickyOutlineElement:i,providerID:r}=this._stickyModelFromOutlineModel(t,this._stickyModel?.outlineProviderId),s=this._editor.getModel();return new BBe(s.uri,s.getVersionId(),i,r)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(zn.first(e.children.values())instanceof oBe){const a=zn.find(e.children.values(),l=>l.id===t);if(a)i=a.children;else{let l="",c=-1,u;for(const[d,h]of e.children.entries()){const f=this._findSumOfRangesOfGroup(h);f>c&&(u=h,c=f,l=h.id)}t=l,i=u.children}}else i=e.children;const r=[],s=Array.from(i.values()).sort((a,l)=>{const c=new ZI(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),u=new ZI(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber);return this._comparator(c,u)});for(const a of s)r.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new r7(void 0,r,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){const i=[];for(const s of e.children.values())if(s.symbol.selectionRange.startLineNumber!==s.symbol.range.endLineNumber)if(s.symbol.selectionRange.startLineNumber!==t)i.push(this._stickyModelFromOutlineElement(s,s.symbol.selectionRange.startLineNumber));else for(const o of s.children.values())i.push(this._stickyModelFromOutlineElement(o,s.symbol.selectionRange.startLineNumber));i.sort((s,o)=>this._comparator(s.range,o.range));const r=new ZI(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new r7(r,i,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(const i of e.children.values())t+=this._findSumOfRangesOfGroup(i);return e instanceof tte?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};Xte=kH([yR(1,dt)],Xte);class WBe extends $Be{constructor(e){super(e),this._foldingLimitReporter=new iBe(e)}createStickyModel(e,t){const i=this._fromFoldingRegions(t),r=this._editor.getModel();return new BBe(r.uri,r.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],r=new r7(void 0,[],void 0);for(let s=0;s0&&(this.provider=this._register(new ede(e.getModel(),r,t,this._foldingLimitReporter,void 0)))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){return this.provider?.compute(e)??null}};Jte=kH([yR(2,dt)],Jte);var D$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Hxe=function(n,e){return function(t,i){e(t,i,n)}};class I$t{constructor(e,t,i){this.startLineNumber=e,this.endLineNumber=t,this.nestingDepth=i}}let ene=class extends me{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new fe),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new ke),this._updateSoon=this._register(new Ui(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(116)&&this.readConfiguration()})),this.readConfiguration()}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(116).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this._sessionStore.add(Lt(()=>{this._stickyModelProvider?.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update())}getVersionId(){return this._model?.version}updateStickyModelProvider(){this._stickyModelProvider?.dispose(),this._stickyModelProvider=null;const e=this._editor;e.hasModel()&&(this._stickyModelProvider=new Zte(e,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){this._cts?.dispose(!0),this._cts=new Kr,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}const t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}updateIndex(e){return e===-1?e=0:e<0&&(e=-e-2),e}getCandidateStickyLinesIntersectingFromStickyModel(e,t,i,r,s){if(t.children.length===0)return;let o=s;const a=[];for(let u=0;uu-d)),c=this.updateIndex(JA(a,e.startLineNumber+r,(u,d)=>u-d));for(let u=l;u<=c;u++){const d=t.children[u];if(!d)return;if(d.range){const h=d.range.startLineNumber,f=d.range.endLineNumber;e.startLineNumber<=f+1&&h-1<=e.endLineNumber&&h!==o&&(o=h,i.push(new I$t(h,f-1,r+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,d,i,r+1,h))}else this.getCandidateStickyLinesIntersectingFromStickyModel(e,d,i,r,s)}}getCandidateStickyLinesIntersecting(e){if(!this._model?.element)return[];let t=[];this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,t,0,-1);const i=this._editor._getViewModel()?.getHiddenAreas();if(i)for(const r of i)t=t.filter(s=>!(s.startLineNumber>=r.startLineNumber&&s.endLineNumber<=r.endLineNumber+1));return t}};ene=D$t([Hxe(1,dt),Hxe(2,Zr)],ene);var A$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Tx=function(n,e){return function(t,i){e(t,i,n)}},tne;let i0=class extends me{static{tne=this}static{this.ID="store.contrib.stickyScrollController"}constructor(e,t,i,r,s,o,a){super(),this._editor=e,this._contextMenuService=t,this._languageFeaturesService=i,this._instaService=r,this._contextKeyService=a,this._sessionStore=new ke,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._stickyScrollWidget=new E$t(this._editor),this._stickyLineCandidateProvider=new ene(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=YI.Empty,this._onDidResize(),this._readConfiguration();const l=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration(u=>{this._readConfigurationChange(u)})),this._register(Ce(l,je.CONTEXT_MENU,async u=>{this._onContextMenu(Ot(l),u)})),this._stickyScrollFocusedContextKey=Q.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=Q.stickyScrollVisible.bindTo(this._contextKeyService);const c=this._register(Eg(l));this._register(c.onDidBlur(u=>{this._positionRevealed===!1&&l.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(c.onDidFocus(u=>{this.focus()})),this._registerMouseListeners(),this._register(Ce(l,je.MOUSE_DOWN,u=>{this._onMouseDown=!0}))}static get(e){return e.getContribution(tne.ID)}_disposeFocusStickyScrollStore(){this._stickyScrollFocusedContextKey.set(!1),this._focusDisposableStore?.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new ke,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection($.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new ke),t=this._register(new hH(this._editor,{extractLineNumberFromMouseEvent:s=>{const o=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);return o?o.lineNumber:0}})),i=s=>{if(!this._editor.hasModel()||s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return null;const o=s.target.element;if(!o||o.innerText!==o.innerHTML)return null;const a=this._stickyScrollWidget.getEditorPositionFromNode(o);return a?{range:new $(a.lineNumber,a.column,a.lineNumber,a.column+o.innerText.length),textElement:o}:null},r=this._stickyScrollWidget.getDomNode();this._register(Jr(r,je.CLICK,s=>{if(s.ctrlKey||s.altKey||s.metaKey||!s.leftButton)return;if(s.shiftKey){const c=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(c===null)return;const u=new he(this._endLineNumbers[c],1);this._revealLineInCenterIfOutsideViewport(u);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(s.target)){const c=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);this._toggleFoldingRegionForLine(c);return}if(!this._stickyScrollWidget.isInStickyLine(s.target))return;let l=this._stickyScrollWidget.getEditorPositionFromNode(s.target);if(!l){const c=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);if(c===null)return;l=new he(c,1)}this._revealPosition(l)})),this._register(Jr(r,je.MOUSE_MOVE,s=>{if(s.shiftKey){const o=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(o===null||this._showEndForLine!==null&&this._showEndForLine===o)return;this._showEndForLine=o,this._renderStickyScroll();return}this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(Ce(r,je.MOUSE_LEAVE,s=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([s,o])=>{const a=i(s);if(!a||!s.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}const{range:l,textElement:c}=a;if(!l.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=l,e.clear();else if(c.style.textDecoration==="underline")return;const u=new Kr;e.add(Lt(()=>u.dispose(!0)));let d;EO(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new he(l.startLineNumber,l.startColumn+1),!1,u.token).then(h=>{if(!u.token.isCancellationRequested)if(h.length!==0){this._candidateDefinitionsLength=h.length;const f=c;d!==f?(e.clear(),d=f,d.style.textDecoration="underline",e.add(Lt(()=>{d.style.textDecoration="none"}))):d||(d=f,d.style.textDecoration="underline",e.add(Lt(()=>{d.style.textDecoration="none"})))}else e.clear()})})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async s=>{if(s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return;const o=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);o&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:o.lineNumber,column:1})),this._instaService.invokeFunction($7e,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new qh(e,t);this._contextMenuService.showContextMenu({menuId:ce.StickyScrollContext,getAnchor:()=>i})}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;const t=this._stickyScrollWidget.getRenderedStickyLine(e),i=t?.foldingIcon;if(!i)return;Zue(this._foldingModel,Number.MAX_VALUE,[e]),i.isCollapsed=!i.isCollapsed;const r=(i.isCollapsed?this._editor.getTopForLineNumber(i.foldingEndLine):this._editor.getTopForLineNumber(i.foldingStartLine))-this._editor.getOption(67)*t.index+1;this._editor.setScrollTop(r),this._renderStickyScroll(e)}_readConfiguration(){const e=this._editor.getOption(116);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(i=>{i.scrollTopChanged&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(i=>this._onTokensChange(i))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=void 0,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(68).renderType===2&&this._sessionStore.add(this._editor.onDidChangeCursorPosition(()=>{this._showEndForLine=void 0,this._renderStickyScroll(0)}))}_readConfigurationChange(e){(e.hasChanged(116)||e.hasChanged(73)||e.hasChanged(67)||e.hasChanged(111)||e.hasChanged(68))&&this._readConfiguration(),e.hasChanged(68)&&this._renderStickyScroll(0)}_needsUpdate(e){const t=this._stickyScrollWidget.getCurrentLines();for(const i of t)for(const r of e.ranges)if(i>=r.fromLineNumber&&i<=r.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(0)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(67);this._maxStickyLines=Math.round(t*.25)}async _renderStickyScroll(e){const t=this._editor.getModel();if(!t||t.isTooLargeForTokenization()){this._resetState();return}const i=this._updateAndGetMinRebuildFromLine(e),r=this._stickyLineCandidateProvider.getVersionId();if(r===void 0||r===t.getVersionId())if(!this._focused)await this._updateState(i);else if(this._focusedStickyElementIndex===-1)await this._updateState(i),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const o=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(i),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(o)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}_updateAndGetMinRebuildFromLine(e){if(e!==void 0){const t=this._minRebuildFromLine!==void 0?this._minRebuildFromLine:1/0;this._minRebuildFromLine=Math.min(e,t)}return this._minRebuildFromLine}async _updateState(e){this._minRebuildFromLine=void 0,this._foldingModel=await Fb.get(this._editor)?.getFoldingModel()??void 0,this._widgetState=this.findScrollWidgetState();const t=this._widgetState.startLineNumbers.length>0;this._stickyScrollVisibleContextKey.set(t),this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e)}async _resetState(){this._minRebuildFromLine=void 0,this._foldingModel=void 0,this._widgetState=YI.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){const e=this._editor.getOption(67),t=Math.min(this._maxStickyLines,this._editor.getOption(116).maxLineCount),i=this._editor.getScrollTop();let r=0;const s=[],o=[],a=this._editor.getVisibleRanges();if(a.length!==0){const l=new ZI(a[0].startLineNumber,a[a.length-1].endLineNumber),c=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(l);for(const u of c){const d=u.startLineNumber,h=u.endLineNumber,f=u.nestingDepth;if(h-d>0){const g=(f-1)*e,p=f*e,m=this._editor.getBottomForLineNumber(d)-i,_=this._editor.getTopForLineNumber(h)-i,v=this._editor.getBottomForLineNumber(h)-i;if(g>_&&g<=v){s.push(d),o.push(h+1),r=v-p;break}else p>m&&p<=v&&(s.push(d),o.push(h+1));if(s.length===t)break}}}return this._endLineNumbers=o,new YI(s,o,r,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};i0=tne=A$t([Tx(1,mu),Tx(2,dt),Tx(3,Tt),Tx(4,Zr),Tx(5,cd),Tx(6,jt)],i0);class N$t extends Gl{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...Gt("toggleEditorStickyScroll","Toggle Editor Sticky Scroll"),mnemonicTitle:w({key:"mitoggleStickyScroll",comment:["&& denotes a mnemonic"]},"&&Toggle Editor Sticky Scroll")},metadata:{description:Gt("toggleEditorStickyScroll.description","Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:S$t.View,toggled:{condition:Le.equals("config.editor.stickyScroll.enabled",!0),title:w("stickyScroll","Sticky Scroll"),mnemonicTitle:w({key:"miStickyScroll",comment:["&& denotes a mnemonic"]},"&&Sticky Scroll")},menu:[{id:ce.CommandPalette},{id:ce.MenubarAppearanceMenu,group:"4_editor",order:3},{id:ce.StickyScrollContext}]})}async run(e){const t=e.get(En),i=!t.getValue("editor.stickyScroll.enabled");return t.updateValue("editor.stickyScroll.enabled",i)}}const EH=100;class R$t extends Fg{constructor(){super({id:"editor.action.focusStickyScroll",title:{...Gt("focusStickyScroll","Focus on the editor sticky scroll"),mnemonicTitle:w({key:"mifocusStickyScroll",comment:["&& denotes a mnemonic"]},"&&Focus Sticky Scroll")},precondition:Le.and(Le.has("config.editor.stickyScroll.enabled"),Q.stickyScrollVisible),menu:[{id:ce.CommandPalette}]})}runEditorCommand(e,t){i0.get(t)?.focus()}}class P$t extends Fg{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:Gt("selectNextStickyScrollLine.title","Select the next editor sticky scroll line"),precondition:Q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:EH,primary:18}})}runEditorCommand(e,t){i0.get(t)?.focusNext()}}class O$t extends Fg{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:Gt("selectPreviousStickyScrollLine.title","Select the previous sticky scroll line"),precondition:Q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:EH,primary:16}})}runEditorCommand(e,t){i0.get(t)?.focusPrevious()}}class M$t extends Fg{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:Gt("goToFocusedStickyScrollLine.title","Go to the focused sticky scroll line"),precondition:Q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:EH,primary:3}})}runEditorCommand(e,t){i0.get(t)?.goToFocused()}}class F$t extends Fg{constructor(){super({id:"editor.action.selectEditor",title:Gt("selectEditor.title","Select Editor"),precondition:Q.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:EH,primary:9}})}runEditorCommand(e,t){i0.get(t)?.selectEditor()}}Zn(i0.ID,i0,1);lr(N$t);lr(R$t);lr(O$t);lr(P$t);lr(M$t);lr(F$t);var HBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},KD=function(n,e){return function(t,i){e(t,i,n)}};class B$t{constructor(e,t,i,r,s,o){this.range=e,this.insertText=t,this.filterText=i,this.additionalTextEdits=r,this.command=s,this.completion=o}}let nne=class extends mmt{constructor(e,t,i,r,s,o){super(s.disposable),this.model=e,this.line=t,this.word=i,this.completionModel=r,this._suggestMemoryService=o}canBeReused(e,t,i){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===i.startColumn&&this.word.endColumn=0&&a.resolve(yn.None)}return e}};nne=HBe([KD(5,yH)],nne);let ine=class extends me{constructor(e,t,i,r){super(),this._languageFeatureService=e,this._clipboardService=t,this._suggestMemoryService=i,this._editorService=r,this._store.add(e.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(e,t,i,r){if(i.selectedSuggestionInfo)return;let s;for(const f of this._editorService.listCodeEditors())if(f.getModel()===e){s=f;break}if(!s)return;const o=s.getOption(90);if(WS.isAllOff(o))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const a=e.tokenization.getLineTokens(t.lineNumber),l=a.getStandardTokenType(a.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(WS.valueFor(o,l)!=="inline")return;let c=e.getWordAtPosition(t),u;if(c?.word||(u=this._getTriggerCharacterInfo(e,t)),!c?.word&&!u||(c||(c=e.getWordUntilPosition(t)),c.endColumn!==t.column))return;let d;const h=e.getValueInRange(new $(t.lineNumber,1,t.lineNumber,t.column));if(!u&&this._lastResult?.canBeReused(e,t.lineNumber,c)){const f=new kxe(h,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=f,this._lastResult.acquire(),d=this._lastResult}else{const f=await tde(this._languageFeatureService.completionProvider,e,t,new IO(void 0,G9.createSuggestFilter(s).itemKind,u?.providers),u&&{triggerKind:1,triggerCharacter:u.ch},r);let g;f.needsClipboard&&(g=await this._clipboardService.readText());const p=new yv(f.items,t.column,new kxe(h,0),dp.None,s.getOption(119),s.getOption(113),{boostFullMatch:!1,firstMatchCanBeWeak:!1},g);d=new nne(e,t.lineNumber,c,p,f,this._suggestMemoryService)}return this._lastResult=d,d}handleItemDidShow(e,t){t.completion.resolve(yn.None)}freeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){const i=e.getValueInRange($.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),r=new Set;for(const s of this._languageFeatureService.completionProvider.all(e))s.triggerCharacters?.includes(i)&&r.add(s);if(r.size!==0)return{providers:r,ch:i}}};ine=HBe([KD(0,dt),KD(1,b0),KD(2,yH),KD(3,ai)],ine);u2(ine);class $$t extends ot{constructor(){super({id:"editor.action.forceRetokenize",label:w("forceRetokenize","Developer: Force Retokenize"),alias:"Developer: Force Retokenize",precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getModel();i.tokenization.resetTokenization();const r=new Bo;i.tokenization.forceTokenization(i.getLineCount()),r.stop(),console.log(`tokenization took ${r.elapsed()}`)}}Pe($$t);class Ade extends Gl{static{this.ID="editor.action.toggleTabFocusMode"}constructor(){super({id:Ade.ID,title:Gt({key:"toggle.tabMovesFocus",comment:["Turn on/off use of tab key for moving focus around VS Code"]},"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:Gt("tabMovesFocusDescriptions","Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){const t=!xE.getTabFocusMode();xE.setTabFocusMode(t),ql(t?w("toggle.tabMovesFocus.on","Pressing Tab will now move focus to the next focusable element"):w("toggle.tabMovesFocus.off","Pressing Tab will now insert the tab character"))}}lr(Ade);var W$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Vxe=function(n,e){return function(t,i){e(t,i,n)}};let rne=class extends me{get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}constructor(e,t,i={},r,s){super(),this._link=t,this._hoverService=r,this._enabled=!0,this.el=Ne(e,qe("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??Yl("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const o=this._register(new $n(this.el,"click")),a=this._register(new $n(this.el,"keypress")),l=Ge.chain(a.event,d=>d.map(h=>new or(h)).filter(h=>h.keyCode===3)),c=this._register(new $n(this.el,gr.Tap)).event;this._register(Fr.addTarget(this.el));const u=Ge.any(o.event,l,c);this._register(u(d=>{this.enabled&&(Hn.stop(d,!0),i?.opener?i.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}setTooltip(e){this.hoverDelegate.showNativeHover?this.el.title=e??"":!this.hover&&e?this.hover=this._register(this._hoverService.setupManagedHover(this.hoverDelegate,this.el,e)):this.hover&&this.hover.update(e)}};rne=W$t([Vxe(3,um),Vxe(4,Pc)],rne);var VBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},zBe=function(n,e){return function(t,i){e(t,i,n)}};const H$t=26;let sne=class extends me{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(one))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{this.hide(),e.onClose?.()}}),this._editor.setBanner(this.banner.element,H$t)}};sne=VBe([zBe(1,Tt)],sne);let one=class extends me{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(Q_,{}),this.element=qe("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){const t=qe("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){Jo(this.element)}show(e){Jo(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=Ne(this.element,qe("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(qe(`div${zt.asCSSSelector(e.icon)}`));const r=Ne(this.element,qe("div.message-container"));if(r.setAttribute("aria-hidden","true"),r.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=Ne(this.element,qe("div.message-actions-container")),e.actions)for(const o of e.actions)this._register(this.instantiationService.createInstance(rne,this.messageActionsContainer,{...o,tabIndex:-1},{}));const s=Ne(this.element,qe("div.action-container"));this.actionBar=this._register(new ed(s)),this.actionBar.push(this._register(new su("banner.close","Close Banner",zt.asClassName(z6e),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};one=VBe([zBe(0,Tt)],one);var Nde=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Rk=function(n,e){return function(t,i){e(t,i,n)}};const V$t=kr("extensions-warning-message",ze.warning,w("warningIcon","Icon shown with a warning message in the extensions editor."));let wR=class extends me{static{this.ID="editor.contrib.unicodeHighlighter"}constructor(e,t,i,r){super(),this._editor=e,this._editorWorkerService=t,this._workspaceTrustService=i,this._highlighter=null,this._bannerClosed=!1,this._updateState=s=>{if(s&&s.hasMore){if(this._bannerClosed)return;const o=Math.max(s.ambiguousCharacterCount,s.nonBasicAsciiCharacterCount,s.invisibleCharacterCount);let a;if(s.nonBasicAsciiCharacterCount>=o)a={message:w("unicodeHighlighting.thisDocumentHasManyNonBasicAsciiUnicodeCharacters","This document contains many non-basic ASCII unicode characters"),command:new RO};else if(s.ambiguousCharacterCount>=o)a={message:w("unicodeHighlighting.thisDocumentHasManyAmbiguousUnicodeCharacters","This document contains many ambiguous unicode characters"),command:new RC};else if(s.invisibleCharacterCount>=o)a={message:w("unicodeHighlighting.thisDocumentHasManyInvisibleUnicodeCharacters","This document contains many invisible unicode characters"),command:new NO};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:V$t,actions:[{label:a.command.shortLabel,href:`command:${a.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(r.createInstance(sne,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(126),this._register(i.onDidChangeTrust(s=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(s=>{s.hasChanged(126)&&(this._options=e.getOption(126),this._updateHighlighter())})),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const e=z$t(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(i=>i===!1))return;const t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(i=>i.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(i=>i==="_os"?new Intl.NumberFormat().resolvedOptions().locale:i==="_vscode"?gpt:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new ane(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new U$t(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};wR=Nde([Rk(1,Oc),Rk(2,iFe),Rk(3,Tt)],wR);function z$t(n,e){return{nonBasicASCII:e.nonBasicASCII===Iu?!n:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===Iu?!n:e.includeComments,includeStrings:e.includeStrings===Iu?!n:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let ane=class extends me{constructor(e,t,i,r){super(),this._editor=e,this._options=t,this._updateState=i,this._editorWorkerService=r,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Ui(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);const i=[];if(!t.hasMore)for(const r of t.ranges)i.push({range:r,options:LH.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!Yce(t,e))return null;const i=t.getValueInRange(e.range);return{reason:jBe(i,this._options),inComment:Zce(t,e),inString:Xce(t,e)}}};ane=Nde([Rk(3,Oc)],ane);class U$t extends me{constructor(e,t,i){super(),this._editor=e,this._options=t,this._updateState=i,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Ui(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._editor.getVisibleRanges(),t=[],i={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const r of e){const s=Jae.computeUnicodeHighlights(this._model,this._options,r);for(const o of s.ranges)i.ranges.push(o);i.ambiguousCharacterCount+=i.ambiguousCharacterCount,i.invisibleCharacterCount+=i.invisibleCharacterCount,i.nonBasicAsciiCharacterCount+=i.nonBasicAsciiCharacterCount,i.hasMore=i.hasMore||s.hasMore}if(!i.hasMore)for(const r of i.ranges)t.push({range:r,options:LH.instance.getDecorationFromOptions(this._options)});this._updateState(i),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel(),i=t.getValueInRange(e.range);return Yce(t,e)?{reason:jBe(i,this._options),inComment:Zce(t,e),inString:Xce(t,e)}:null}}const UBe=w("unicodeHighlight.configureUnicodeHighlightOptions","Configure Unicode Highlight Options");let lne=class{constructor(e,t,i){this._editor=e,this._languageService=t,this._openerService=i,this.hoverOrdinal=5}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),r=this._editor.getContribution(wR.ID);if(!r)return[];const s=[],o=new Set;let a=300;for(const l of t){const c=r.getDecorationInfo(l);if(!c)continue;const d=i.getValueInRange(l.range).codePointAt(0),h=lK(d);let f;switch(c.reason.kind){case 0:{KP(c.reason.confusableWith)?f=w("unicodeHighlight.characterIsAmbiguousASCII","The character {0} could be confused with the ASCII character {1}, which is more common in source code.",h,lK(c.reason.confusableWith.codePointAt(0))):f=w("unicodeHighlight.characterIsAmbiguous","The character {0} could be confused with the character {1}, which is more common in source code.",h,lK(c.reason.confusableWith.codePointAt(0)));break}case 1:f=w("unicodeHighlight.characterIsInvisible","The character {0} is invisible.",h);break;case 2:f=w("unicodeHighlight.characterIsNonBasicAscii","The character {0} is not a basic ASCII character.",h);break}if(o.has(f))continue;o.add(f);const g={codePoint:d,reason:c.reason,inComment:c.inComment,inString:c.inString},p=w("unicodeHighlight.adjustSettings","Adjust settings"),m=`command:${TH.ID}?${encodeURIComponent(JSON.stringify(g))}`,_=new za("",!0).appendMarkdown(f).appendText(" ").appendLink(m,p,UBe);s.push(new Uh(this,l.range,[_],!1,a++))}return s}renderHoverParts(e,t){return m5t(e,t,this._editor,this._languageService,this._openerService)}};lne=Nde([Rk(1,Hr),Rk(2,Pc)],lne);function cne(n){return`U+${n.toString(16).padStart(4,"0")}`}function lK(n){let e=`\`${cne(n)}\``;return I_.isInvisibleCharacter(n)||(e+=` "${`${j$t(n)}`}"`),e}function j$t(n){return n===96?"`` ` ``":"`"+String.fromCodePoint(n)+"`"}function jBe(n,e){return Jae.computeUnicodeHighlightReason(n,e)}class LH{constructor(){this.map=new Map}static{this.instance=new LH}getDecorationFromOptions(e){return this.getDecoration(!e.includeComments,!e.includeStrings)}getDecoration(e,t){const i=`${e}${t}`;let r=this.map.get(i);return r||(r=un.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:e,hideInStringTokens:t}),this.map.set(i,r)),r}}class q$t extends ot{constructor(){super({id:RC.ID,label:w("action.unicodeHighlight.disableHighlightingInComments","Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingInComments.shortLabel","Disable Highlight In Comments")}async run(e,t,i){const r=e?.get(En);r&&this.runAction(r)}async runAction(e){await e.updateValue(cc.includeComments,!1,2)}}class K$t extends ot{constructor(){super({id:RC.ID,label:w("action.unicodeHighlight.disableHighlightingInStrings","Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingInStrings.shortLabel","Disable Highlight In Strings")}async run(e,t,i){const r=e?.get(En);r&&this.runAction(r)}async runAction(e){await e.updateValue(cc.includeStrings,!1,2)}}class RC extends ot{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters"}constructor(){super({id:RC.ID,label:w("action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters","Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfAmbiguousCharacters.shortLabel","Disable Ambiguous Highlight")}async run(e,t,i){const r=e?.get(En);r&&this.runAction(r)}async runAction(e){await e.updateValue(cc.ambiguousCharacters,!1,2)}}class NO extends ot{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters"}constructor(){super({id:NO.ID,label:w("action.unicodeHighlight.disableHighlightingOfInvisibleCharacters","Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfInvisibleCharacters.shortLabel","Disable Invisible Highlight")}async run(e,t,i){const r=e?.get(En);r&&this.runAction(r)}async runAction(e){await e.updateValue(cc.invisibleCharacters,!1,2)}}class RO extends ot{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters"}constructor(){super({id:RO.ID,label:w("action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters","Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=w("unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters.shortLabel","Disable Non ASCII Highlight")}async run(e,t,i){const r=e?.get(En);r&&this.runAction(r)}async runAction(e){await e.updateValue(cc.nonBasicASCII,!1,2)}}class TH extends ot{static{this.ID="editor.action.unicodeHighlight.showExcludeOptions"}constructor(){super({id:TH.ID,label:w("action.unicodeHighlight.showExcludeOptions","Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}async run(e,t,i){const{codePoint:r,reason:s,inString:o,inComment:a}=i,l=String.fromCodePoint(r),c=e.get(hh),u=e.get(En);function d(g){return I_.isInvisibleCharacter(g)?w("unicodeHighlight.excludeInvisibleCharFromBeingHighlighted","Exclude {0} (invisible character) from being highlighted",cne(g)):w("unicodeHighlight.excludeCharFromBeingHighlighted","Exclude {0} from being highlighted",`${cne(g)} "${l}"`)}const h=[];if(s.kind===0)for(const g of s.notAmbiguousInLocales)h.push({label:w("unicodeHighlight.allowCommonCharactersInLanguage",'Allow unicode characters that are more common in the language "{0}".',g),run:async()=>{Y$t(u,[g])}});if(h.push({label:d(r),run:()=>G$t(u,[r])}),a){const g=new q$t;h.push({label:g.label,run:async()=>g.runAction(u)})}else if(o){const g=new K$t;h.push({label:g.label,run:async()=>g.runAction(u)})}if(s.kind===0){const g=new RC;h.push({label:g.label,run:async()=>g.runAction(u)})}else if(s.kind===1){const g=new NO;h.push({label:g.label,run:async()=>g.runAction(u)})}else if(s.kind===2){const g=new RO;h.push({label:g.label,run:async()=>g.runAction(u)})}else Z$t(s);const f=await c.pick(h,{title:UBe});f&&await f.run()}}async function G$t(n,e){const t=n.getValue(cc.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const r of e)i[String.fromCodePoint(r)]=!0;await n.updateValue(cc.allowedCharacters,i,2)}async function Y$t(n,e){const t=n.inspect(cc.allowedLocales).user?.value;let i;typeof t=="object"&&t?i=Object.assign({},t):i={};for(const r of e)i[r]=!0;await n.updateValue(cc.allowedLocales,i,2)}function Z$t(n){throw new Error(`Unexpected value: ${n}`)}Pe(RC);Pe(NO);Pe(RO);Pe(TH);Zn(wR.ID,wR,1);DC.register(lne);var X$t=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},zxe=function(n,e){return function(t,i){e(t,i,n)}};const qBe="ignoreUnusualLineTerminators";function Q$t(n,e,t){n.setModelProperty(e.uri,qBe,t)}function J$t(n,e){return n.getModelProperty(e.uri,qBe)}let s7=class extends me{static{this.ID="editor.contrib.unusualLineTerminatorsDetector"}constructor(e,t,i){super(),this._editor=e,this._dialogService=t,this._codeEditorService=i,this._isPresentingDialog=!1,this._config=this._editor.getOption(127),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(127)&&(this._config=this._editor.getOption(127),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(r=>{r.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;const e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||J$t(this._codeEditorService,e)===!0||this._editor.getOption(92))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let i;try{this._isPresentingDialog=!0,i=await this._dialogService.confirm({title:w("unusualLineTerminators.title","Unusual Line Terminators"),message:w("unusualLineTerminators.message","Detected unusual line terminators"),detail:w("unusualLineTerminators.detail","The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.",th(e.uri)),primaryButton:w({key:"unusualLineTerminators.fix",comment:["&& denotes a mnemonic"]},"&&Remove Unusual Line Terminators"),cancelButton:w("unusualLineTerminators.ignore","Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){Q$t(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};s7=X$t([zxe(1,JP),zxe(2,ai)],s7);Zn(s7.ID,s7,1);var eWt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},tWt=function(n,e){return function(t,i){e(t,i,n)}};class Uxe{constructor(){this.selector={language:"*"}}provideDocumentHighlights(e,t,i){const r=[],s=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});return s?e.isDisposed()?void 0:e.findMatches(s.word,!0,!1,!0,N6,!1).map(a=>({range:a.range,kind:nE.Text})):Promise.resolve(r)}provideMultiDocumentHighlights(e,t,i,r){const s=new so,o=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});if(!o)return Promise.resolve(s);for(const a of[e,...i]){if(a.isDisposed())continue;const c=a.findMatches(o.word,!0,!1,!0,N6,!1).map(u=>({range:u.range,kind:nE.Text}));c&&s.set(a.uri,c)}return s}}let une=class extends me{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new Uxe)),this._register(e.multiDocumentHighlightProvider.register("*",new Uxe))}};une=eWt([tWt(0,dt)],une);var KBe=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},SF=function(n,e){return function(t,i){e(t,i,n)}},ys,dne;const Rde=new et("hasWordHighlights",!1);function GBe(n,e,t,i){const r=n.ordered(e);return Oae(r.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,vs)),s=>s!=null).then(s=>{if(s){const o=new so;return o.set(e.uri,s),o}return new so})}function nWt(n,e,t,i,r,s){const o=n.ordered(e);return Oae(o.map(a=>()=>{const l=s.filter(c=>z3e(c)).filter(c=>lle(a.selector,c.uri,c.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(a.provideMultiDocumentHighlights(e,t,l,r)).then(void 0,vs)}),a=>a!=null)}class YBe{constructor(e,t,i){this._model=e,this._selection=t,this._wordSeparators=i,this._wordRange=this._getCurrentWordRange(e,t),this._result=null}get result(){return this._result||(this._result=ko(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new $(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):null}isValid(e,t,i){const r=t.startLineNumber,s=t.startColumn,o=t.endColumn,a=this._getCurrentWordRange(e,t);let l=!!(this._wordRange&&this._wordRange.equalsRange(a));for(let c=0,u=i.length;!l&&c=o&&(l=!0)}return l}cancel(){this.result.cancel()}}class iWt extends YBe{constructor(e,t,i,r){super(e,t,i),this._providers=r}_compute(e,t,i,r){return GBe(this._providers,e,t.getPosition(),r).then(s=>s||new so)}}class rWt extends YBe{constructor(e,t,i,r,s){super(e,t,i),this._providers=r,this._otherModels=s}_compute(e,t,i,r){return nWt(this._providers,e,t.getPosition(),i,r,this._otherModels).then(s=>s||new so)}}function sWt(n,e,t,i,r){return new iWt(e,t,r,n)}function oWt(n,e,t,i,r,s){return new rWt(e,t,r,n,s)}Rc("_executeDocumentHighlights",async(n,e,t)=>{const i=n.get(dt);return(await GBe(i.documentHighlightProvider,e,t,yn.None))?.get(e.uri)});let hne=class{static{ys=this}static{this.storedDecorationIDs=new so}static{this.query=null}constructor(e,t,i,r,s){this.toUnhook=new ke,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new so,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.runDelayer=this.toUnhook.add(new Qd(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=s,this._hasWordHighlights=Rde.bindTo(r),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(81),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition(o=>{this._ignorePositionChangeEvent||this.occurrencesHighlight!=="off"&&this.runDelayer.trigger(()=>{this._onPositionChanged(o)})})),this.toUnhook.add(e.onDidFocusEditorText(o=>{this.occurrencesHighlight!=="off"&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}))})),this.toUnhook.add(e.onDidChangeModelContent(o=>{O$(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(o=>{!o.newModelUrl&&o.oldModelUrl?this._stopSingular():ys.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(o=>{const a=this.editor.getOption(81);if(this.occurrencesHighlight!==a)switch(this.occurrencesHighlight=a,a){case"off":this._stopAll();break;case"singleFile":this._stopAll(ys.query?.modelInfo?.model);break;case"multiFile":ys.query&&this._run(!0);break;default:console.warn("Unknown occurrencesHighlight setting value:",a);break}})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,ys.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight!=="off"&&(this.runDelayer.cancel(),this._run())}_getSortedHighlights(){return this.decorations.getRanges().sort($.compareRangesUsingStarts)}moveNext(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))+1)%e.length,r=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(r.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(r);const s=this._getWord();if(s){const o=this.editor.getModel().getLineContent(r.startLineNumber);ql(`${o}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))-1+e.length)%e.length,r=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(r.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(r);const s=this._getWord();if(s){const o=this.editor.getModel().getLineContent(r.startLineNumber);ql(`${o}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=ys.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),ys.storedDecorationIDs.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(e){const t=this.codeEditorService.listCodeEditors(),i=[];for(const r of t){if(!r.hasModel()||kN(r.getModel().uri,e?.uri))continue;const s=ys.storedDecorationIDs.get(r.getModel().uri);if(!s)continue;r.removeDecorations(s),i.push(r.getModel().uri);const o=$b.get(r);o?.wordHighlighter&&o.wordHighlighter.decorations.length>0&&(o.wordHighlighter.decorations.clear(),o.wordHighlighter.workerRequest=null,o.wordHighlighter._hasWordHighlights.set(!1))}for(const r of i)ys.storedDecorationIDs.delete(r)}_stopSingular(){this._removeSingleDecorations(),this.editor.hasTextFocus()&&(this.editor.getModel()?.uri.scheme!==sn.vscodeNotebookCell&&ys.query?.modelInfo?.model.uri.scheme!==sn.vscodeNotebookCell?(ys.query=null,this._run()):ys.query?.modelInfo&&(ys.query.modelInfo=null)),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(e){this._removeAllDecorations(e),this.renderDecorationsTimer!==-1&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(e){if(this.occurrencesHighlight==="off"){this._stopAll();return}if(e.reason!==3&&this.editor.getModel()?.uri.scheme!==sn.vscodeNotebookCell){this._stopAll();return}this._run()}_getWord(){const e=this.editor.getSelection(),t=e.startLineNumber,i=e.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:t,column:i})}getOtherModelsToHighlight(e){if(!e)return[];if(e.uri.scheme===sn.vscodeNotebookCell){const s=[],o=this.codeEditorService.listCodeEditors();for(const a of o){const l=a.getModel();l&&l!==e&&l.uri.scheme===sn.vscodeNotebookCell&&s.push(l)}return s}const i=[],r=this.codeEditorService.listCodeEditors();for(const s of r){if(!mue(s))continue;const o=s.getModel();o&&e===o.modified&&i.push(o.modified)}if(i.length)return i;if(this.occurrencesHighlight==="singleFile")return[];for(const s of r){const o=s.getModel();o&&o!==e&&i.push(o)}return i}_run(e){let t;if(this.editor.hasTextFocus()){const r=this.editor.getSelection();if(!r||r.startLineNumber!==r.endLineNumber){ys.query=null,this._stopAll();return}const s=r.startColumn,o=r.endColumn,a=this._getWord();if(!a||a.startColumn>s||a.endColumn{r===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=o||[],this._beginRenderDecorations())},rn)}}computeWithModel(e,t,i,r){return r.length?oWt(this.multiDocumentProviders,e,t,i,this.editor.getOption(132),r):sWt(this.providers,e,t,i,this.editor.getOption(132))}_beginRenderDecorations(){const e=new Date().getTime(),t=this.lastCursorPositionChangeTime+250;e>=t?(this.renderDecorationsTimer=-1,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},t-e)}renderDecorations(){this.renderDecorationsTimer=-1;const e=this.codeEditorService.listCodeEditors();for(const t of e){const i=$b.get(t);if(!i)continue;const r=[],s=t.getModel()?.uri;if(s&&this.workerRequestValue.has(s)){const o=ys.storedDecorationIDs.get(s),a=this.workerRequestValue.get(s);if(a)for(const c of a)c.range&&r.push({range:c.range,options:G7t(c.kind)});let l=[];t.changeDecorations(c=>{l=c.deltaDecorations(o??[],r)}),ys.storedDecorationIDs=ys.storedDecorationIDs.set(s,l),r.length>0&&(i.wordHighlighter?.decorations.set(r),i.wordHighlighter?._hasWordHighlights.set(!0))}}}dispose(){this._stopSingular(),this.toUnhook.dispose()}};hne=ys=KBe([SF(4,ai)],hne);let $b=class extends me{static{dne=this}static{this.ID="editor.contrib.wordHighlighter"}static get(e){return e.getContribution(dne.ID)}constructor(e,t,i,r){super(),this._wordHighlighter=null;const s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new hne(e,i.documentHighlightProvider,i.multiDocumentHighlightProvider,t,r))};this._register(e.onDidChangeModel(o=>{this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),s()})),s()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){this._wordHighlighter?.moveNext()}moveBack(){this._wordHighlighter?.moveBack()}restoreViewState(e){this._wordHighlighter&&e&&this._wordHighlighter.restore()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}};$b=dne=KBe([SF(1,jt),SF(2,dt),SF(3,ai)],$b);class ZBe extends ot{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=$b.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class aWt extends ZBe{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:w("wordHighlight.next.label","Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:Rde,kbOpts:{kbExpr:Q.editorTextFocus,primary:65,weight:100}})}}class lWt extends ZBe{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:w("wordHighlight.previous.label","Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:Rde,kbOpts:{kbExpr:Q.editorTextFocus,primary:1089,weight:100}})}}class cWt extends ot{constructor(){super({id:"editor.action.wordHighlight.trigger",label:w("wordHighlight.trigger.label","Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:void 0,kbOpts:{kbExpr:Q.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const r=$b.get(t);r&&r.restoreViewState(!0)}}Zn($b.ID,$b,0);Pe(aWt);Pe(lWt);Pe(cWt);u2(une);class DH extends fo{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const r=eh(t.getOption(132),t.getOption(131)),s=t.getModel(),o=t.getSelections(),a=o.length>1,l=o.map(c=>{const u=new he(c.positionLineNumber,c.positionColumn),d=this._move(r,s,u,this._wordNavigationType,a);return this._moveTo(c,d,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,l.map(c=>ri.fromModelSelection(c))),l.length===1){const c=new he(l[0].positionLineNumber,l[0].positionColumn);t.revealPosition(c,0)}}_moveTo(e,t,i){return i?new yt(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new yt(t.lineNumber,t.column,t.lineNumber,t.column)}}class r1 extends DH{_move(e,t,i,r,s){return yi.moveWordLeft(e,t,i,r,s)}}class s1 extends DH{_move(e,t,i,r,s){return yi.moveWordRight(e,t,i,r)}}class uWt extends r1{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class dWt extends r1{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class hWt extends r1{constructor(){super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Le.and(Q.textInputFocus,Le.and(iO,AW)?.negate()),primary:2063,mac:{primary:527},weight:100}})}}class fWt extends r1{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class gWt extends r1{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class pWt extends r1{constructor(){super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Le.and(Q.textInputFocus,Le.and(iO,AW)?.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class mWt extends r1{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,r,s){return super._move(eh(Mg.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,r,s)}}class _Wt extends r1{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,r,s){return super._move(eh(Mg.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,r,s)}}class vWt extends s1{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class bWt extends s1{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Le.and(Q.textInputFocus,Le.and(iO,AW)?.negate()),primary:2065,mac:{primary:529},weight:100}})}}class yWt extends s1{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class wWt extends s1{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class CWt extends s1{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Le.and(Q.textInputFocus,Le.and(iO,AW)?.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class xWt extends s1{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class SWt extends s1{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,r,s){return super._move(eh(Mg.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,r,s)}}class kWt extends s1{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,r,s){return super._move(eh(Mg.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,r,s)}}class IH extends fo{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const r=e.get(Zr);if(!t.hasModel())return;const s=eh(t.getOption(132),t.getOption(131)),o=t.getModel(),a=t.getSelections(),l=t.getOption(6),c=t.getOption(11),u=r.getLanguageConfiguration(o.getLanguageId()).getAutoClosingPairs(),d=t._getViewModel(),h=a.map(f=>{const g=this._delete({wordSeparators:s,model:o,selection:f,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(9),autoClosingBrackets:l,autoClosingQuotes:c,autoClosingPairs:u,autoClosedCharacters:d.getCursorAutoClosedCharacters()},this._wordNavigationType);return new Sa(g,"")});t.pushUndoStop(),t.executeCommands(this.id,h),t.pushUndoStop()}}class Pde extends IH{_delete(e,t){const i=yi.deleteWordLeft(e,t);return i||new $(1,1,1,1)}}class Ode extends IH{_delete(e,t){const i=yi.deleteWordRight(e,t);if(i)return i;const r=e.model.getLineCount(),s=e.model.getLineMaxColumn(r);return new $(r,s,r,s)}}class EWt extends Pde{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:Q.writable})}}class LWt extends Pde{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:Q.writable})}}class TWt extends Pde{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class DWt extends Ode{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:Q.writable})}}class IWt extends Ode{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:Q.writable})}}class AWt extends Ode{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class NWt extends ot{constructor(){super({id:"deleteInsideWord",precondition:Q.writable,label:w("deleteInsideWord","Delete Word"),alias:"Delete Word"})}run(e,t,i){if(!t.hasModel())return;const r=eh(t.getOption(132),t.getOption(131)),s=t.getModel(),a=t.getSelections().map(l=>{const c=yi.deleteInsideWord(r,s,l);return new Sa(c,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}Je(new uWt);Je(new dWt);Je(new hWt);Je(new fWt);Je(new gWt);Je(new pWt);Je(new vWt);Je(new bWt);Je(new yWt);Je(new wWt);Je(new CWt);Je(new xWt);Je(new mWt);Je(new _Wt);Je(new SWt);Je(new kWt);Je(new EWt);Je(new LWt);Je(new TWt);Je(new DWt);Je(new IWt);Je(new AWt);Pe(NWt);class RWt extends IH{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=jW.deleteWordPartLeft(e);return i||new $(1,1,1,1)}}class PWt extends IH{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:Q.writable,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=jW.deleteWordPartRight(e);if(i)return i;const r=e.model.getLineCount(),s=e.model.getLineMaxColumn(r);return new $(r,s,r,s)}}class XBe extends DH{_move(e,t,i,r,s){return jW.moveWordPartLeft(e,t,i,s)}}class OWt extends XBe{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}Un.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class MWt extends XBe{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}Un.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class QBe extends DH{_move(e,t,i,r,s){return jW.moveWordPartRight(e,t,i)}}class FWt extends QBe{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class BWt extends QBe{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:Q.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}Je(new RWt);Je(new PWt);Je(new OWt);Je(new MWt);Je(new FWt);Je(new BWt);class jxe extends me{static{this.ID="editor.contrib.readOnlyMessageController"}constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=au.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(93);t||(this.editor.isSimpleWidget?t=new za(w("editor.simple.readonly","Cannot edit in read-only input")):t=new za(w("editor.readonly","Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}}Zn(jxe.ID,jxe,2);var $Wt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},qxe=function(n,e){return function(t,i){e(t,i,n)}};let fne=class extends me{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=kn(this,void 0);const r=xa("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=xa("_textModel.onDidChangeContent",Ge.debounce(o=>this._textModel.onDidChangeContent(o),()=>{},100));this._register(wc(async(o,a)=>{r.read(o),s.read(o);const l=a.add(new PRt),c=await this._outlineModelService.getOrCreate(this._textModel,l.token);a.isDisposed||this._currentModel.set(c,void 0)}))}getBreadcrumbItems(e,t){const i=this._currentModel.read(t);if(!i)return[];const r=i.asListOfDocumentSymbols().filter(s=>e.contains(s.range.startLineNumber)&&!e.contains(s.range.endLineNumber));return r.sort(a4e($l(s=>s.range.endLineNumber-s.range.startLineNumber,Xh))),r.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};fne=$Wt([qxe(1,dt),qxe(2,DO)],fne);C9.setBreadcrumbsSourceFactory((n,e)=>e.createInstance(fne,n));class Kxe extends me{static{this.ID="editor.contrib.iPadShowKeyboard"}constructor(e){super(),this.editor=e,this.widget=null,Sg&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(92);!this.widget&&e?this.widget=new Mde(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}class Mde extends me{static{this.ID="editor.contrib.ShowKeyboardWidget"}constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Ce(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(Ce(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return Mde.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}Zn(Kxe.ID,Kxe,3);var WWt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Gxe=function(n,e){return function(t,i){e(t,i,n)}},gne;let CR=class extends me{static{gne=this}static{this.ID="editor.contrib.inspectTokens"}static get(e){return e.getContribution(gne.ID)}constructor(e,t,i){super(),this._editor=e,this._languageService=i,this._widget=null,this._register(this._editor.onDidChangeModel(r=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(r=>this.stop())),this._register(rs.onDidChange(r=>this.stop())),this._register(this._editor.onKeyUp(r=>r.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new Fde(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};CR=gne=WWt([Gxe(1,hd),Gxe(2,Hr)],CR);class HWt extends ot{constructor(){super({id:"editor.action.inspectTokens",label:gQ.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){CR.get(t)?.launch()}}function VWt(n){let e="";for(let t=0,i=n.length;tgE,tokenize:(r,s,o)=>Nle(e,o),tokenizeEncoded:(r,s,o)=>bW(i,o)}}class Fde extends me{static{this._ID="editor.contrib.inspectTokensWidget"}constructor(e,t){super(),this.allowEditorOverflow=!0,this._editor=e,this._languageService=t,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="tokens-inspect-widget",this._tokenizationSupport=zWt(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(i=>this._compute(this._editor.getPosition()))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return Fde._ID}_compute(e){const t=this._getTokensAtLine(e.lineNumber);let i=0;for(let l=t.tokens1.length-1;l>=0;l--){const c=t.tokens1[l];if(e.column-1>=c.offset){i=l;break}}let r=0;for(let l=t.tokens2.length>>>1;l>=0;l--)if(e.column-1>=t.tokens2[l<<1]){r=l;break}const s=this._model.getLineContent(e.lineNumber);let o="";if(i=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Yxe=function(n,e){return function(t,i){e(t,i,n)}},GD;let pne=class{static{GD=this}static{this.PREFIX="?"}constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=Yr.as(CC.Quickaccess)}provide(e){const t=new ke;return t.add(e.onDidAccept(()=>{const[i]=e.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})})),t.add(e.onDidChangeValue(i=>{const r=this.registry.getQuickAccessProvider(i.substr(GD.PREFIX.length));r&&r.prefix&&r.prefix!==GD.PREFIX&&this.quickInputService.quickAccess.show(r.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==GD.PREFIX),t}getQuickAccessProviders(){return this.registry.getQuickAccessProviders().sort((t,i)=>t.prefix.localeCompare(i.prefix)).flatMap(t=>this.createPicks(t))}createPicks(e){return e.helpEntries.map(t=>{const i=t.prefix||e.prefix,r=i||"…";return{prefix:i,label:r,keybinding:t.commandId?this.keybindingService.lookupKeybinding(t.commandId):void 0,ariaLabel:w("helpPickAriaLabel","{0}, {1}",r,t.description),description:t.description}})}};pne=GD=UWt([Yxe(0,hh),Yxe(1,xi)],pne);Yr.as(CC.Quickaccess).registerQuickAccessProvider({ctor:pne,prefix:"",helpEntries:[{description:pQ.helpQuickAccessActionLabel}]});class JBe{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){const r=new ke;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=r.add(new To);return s.value=this.doProvide(e,t,i),r.add(this.onDidActiveTextEditorControlChange(()=>{s.value=void 0,s.value=this.doProvide(e,t)})),r}doProvide(e,t,i){const r=new ke,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const o={editor:s},a=W8e(s);if(a){let l=s.saveViewState()??void 0;r.add(a.onDidChangeCursorPosition(()=>{l=s.saveViewState()??void 0})),o.restoreViewState=()=>{l&&s===this.activeTextEditorControl&&s.restoreViewState(l)},r.add(wb(t.onCancellationRequested)(()=>o.restoreViewState?.()))}r.add(Lt(()=>this.clearDecorations(s))),r.add(this.provideWithTextEditor(o,e,t,i))}else r.add(this.provideWithoutTextEditor(e,t));return r}canProvideWithTextEditor(e){return!0}gotoLocation({editor:e},t){e.setSelection(t.range,"code.jump"),e.revealRangeInCenter(t.range,0),t.preserveFocus||e.focus();const i=e.getModel();i&&"getLineContent"in i&&Qp(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){return mue(e)?e.getModel()?.modified:e.getModel()}addDecorations(e,t){e.changeDecorations(i=>{const r=[];this.rangeHighlightDecorationId&&(r.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),r.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);const s=[{range:t,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:ss(DFe),position:Qu.Full}}}],[o,a]=i.deltaDecorations(r,s);this.rangeHighlightDecorationId={rangeHighlightId:o,overviewRulerDecorationId:a}})}clearDecorations(e){const t=this.rangeHighlightDecorationId;t&&(e.changeDecorations(i=>{i.deltaDecorations([t.overviewRulerDecorationId,t.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}}class Bde extends JBe{static{this.PREFIX=":"}constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=w("cannotRunGotoLine","Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,me.None}provideWithTextEditor(e,t,i){const r=e.editor,s=new ke;s.add(t.onDidAccept(l=>{const[c]=t.selectedItems;if(c){if(!this.isValidLineNumber(r,c.lineNumber))return;this.gotoLocation(e,{range:this.toRange(c.lineNumber,c.column),keyMods:t.keyMods,preserveFocus:l.inBackground}),l.inBackground||t.hide()}}));const o=()=>{const l=this.parsePosition(r,t.value.trim().substr(Bde.PREFIX.length)),c=this.getPickLabel(r,l.lineNumber,l.column);if(t.items=[{lineNumber:l.lineNumber,column:l.column,label:c}],t.ariaLabel=c,!this.isValidLineNumber(r,l.lineNumber)){this.clearDecorations(r);return}const u=this.toRange(l.lineNumber,l.column);r.revealRangeInCenter(u,0),this.addDecorations(r,u)};o(),s.add(t.onDidChangeValue(()=>o()));const a=W8e(r);return a&&a.getOptions().get(68).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(Lt(()=>a.updateOptions({lineNumbers:"relative"})))),s}toRange(e=1,t=1){return{startLineNumber:e,startColumn:t,endLineNumber:e,endColumn:t}}parsePosition(e,t){const i=t.split(/,|:|#/).map(s=>parseInt(s,10)).filter(s=>!isNaN(s)),r=this.lineCount(e)+1;return{lineNumber:i[0]>0?i[0]:r+i[0],column:i[1]}}getPickLabel(e,t,i){if(this.isValidLineNumber(e,t))return this.isValidColumn(e,t,i)?w("gotoLineColumnLabel","Go to line {0} and character {1}.",t,i):w("gotoLineLabel","Go to line {0}.",t);const r=e.getPosition()||{lineNumber:1,column:1},s=this.lineCount(e);return s>1?w("gotoLineLabelEmptyWithLimit","Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",r.lineNumber,r.column,s):w("gotoLineLabelEmpty","Current Line: {0}, Character: {1}. Type a line number to navigate to.",r.lineNumber,r.column)}isValidLineNumber(e,t){return!t||typeof t!="number"?!1:t>0&&t<=this.lineCount(e)}isValidColumn(e,t,i){if(!i||typeof i!="number")return!1;const r=this.getModel(e);if(!r)return!1;const s={lineNumber:t,column:i};return r.validatePosition(s).equals(s)}lineCount(e){return this.getModel(e)?.getLineCount()??0}}var jWt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},qWt=function(n,e){return function(t,i){e(t,i,n)}};let xR=class extends Bde{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=Ge.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};xR=jWt([qWt(0,ai)],xR);let e$e=class t$e extends ot{static{this.ID="editor.action.gotoLine"}constructor(){super({id:t$e.ID,label:C8.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(hh).quickAccess.show(xR.PREFIX)}};Pe(e$e);Yr.as(CC.Quickaccess).registerQuickAccessProvider({ctor:xR,prefix:xR.PREFIX,helpEntries:[{description:C8.gotoLineActionLabel,commandId:e$e.ID}]});const n$e=[void 0,[]];function cK(n,e,t=0,i=0){const r=e;return r.values&&r.values.length>1?KWt(n,r.values,t,i):i$e(n,e,t,i)}function KWt(n,e,t,i){let r=0;const s=[];for(const o of e){const[a,l]=i$e(n,o,t,i);if(typeof a!="number")return n$e;r+=a,s.push(...l)}return[r,GWt(s)]}function i$e(n,e,t,i){const r=Ow(e.original,e.originalLowercase,t,n,n.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return r?[r[0],nO(r)]:n$e}function GWt(n){const e=n.sort((r,s)=>r.start-s.start),t=[];let i;for(const r of e)!i||!YWt(i,r)?(i=r,t.push(r)):(i.start=Math.min(i.start,r.start),i.end=Math.max(i.end,r.end));return t}function YWt(n,e){return!(n.end=0,o=Zxe(n);let a;const l=n.split(r$e);if(l.length>1)for(const c of l){const u=Zxe(c),{pathNormalized:d,normalized:h,normalizedLowercase:f}=Xxe(c);h&&(a||(a=[]),a.push({original:c,originalLowercase:c.toLowerCase(),pathNormalized:d,normalized:h,normalizedLowercase:f,expectContiguousMatch:u}))}return{original:n,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:r,values:a,containsPathSeparator:s,expectContiguousMatch:o}}function Xxe(n){let e;Ta?e=n.replace(/\//g,fg):e=n.replace(/\\/g,fg);const t=c_t(e).replace(/\s|"/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function Qxe(n){return Array.isArray(n)?mne(n.map(e=>e.original).join(r$e)):mne(n.original)}var ZWt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Jxe=function(n,e){return function(t,i){e(t,i,n)}},kF;let lw=class extends JBe{static{kF=this}static{this.PREFIX="@"}static{this.SCOPE_PREFIX=":"}static{this.PREFIX_BY_CATEGORY=`${this.PREFIX}${this.SCOPE_PREFIX}`}constructor(e,t,i=Object.create(null)){super(i),this._languageFeaturesService=e,this._outlineModelService=t,this.options=i,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(e){return this.provideLabelPick(e,w("cannotRunGotoSymbolWithoutEditor","To go to a symbol, first open a text editor with symbol information.")),me.None}provideWithTextEditor(e,t,i,r){const s=e.editor,o=this.getModel(s);return o?this._languageFeaturesService.documentSymbolProvider.has(o)?this.doProvideWithEditorSymbols(e,o,t,i,r):this.doProvideWithoutEditorSymbols(e,o,t,i):me.None}doProvideWithoutEditorSymbols(e,t,i,r){const s=new ke;return this.provideLabelPick(i,w("cannotRunGotoSymbolWithoutSymbolProvider","The active text editor does not provide symbol information.")),(async()=>!await this.waitForLanguageSymbolRegistry(t,s)||r.isCancellationRequested||s.add(this.doProvideWithEditorSymbols(e,t,i,r)))(),s}provideLabelPick(e,t){e.items=[{label:t,index:0,kind:14}],e.ariaLabel=t}async waitForLanguageSymbolRegistry(e,t){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;const i=new KL,r=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(r.dispose(),i.complete(!0))}));return t.add(Lt(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,r,s){const o=e.editor,a=new ke;a.add(i.onDidAccept(d=>{const[h]=i.selectedItems;h&&h.range&&(this.gotoLocation(e,{range:h.range.selection,keyMods:i.keyMods,preserveFocus:d.inBackground}),s?.handleAccept?.(h),d.inBackground||i.hide())})),a.add(i.onDidTriggerItemButton(({item:d})=>{d&&d.range&&(this.gotoLocation(e,{range:d.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const l=this.getDocumentSymbols(t,r);let c;const u=async d=>{c?.dispose(!0),i.busy=!1,c=new Kr(r),i.busy=!0;try{const h=mne(i.value.substr(kF.PREFIX.length).trim()),f=await this.doGetSymbolPicks(l,h,void 0,c.token,t);if(r.isCancellationRequested)return;if(f.length>0){if(i.items=f,d&&h.original.length===0){const g=hN(f,p=>!!(p.type!=="separator"&&p.range&&$.containsPosition(p.range.decoration,d)));g&&(i.activeItems=[g])}}else h.original.length>0?this.provideLabelPick(i,w("noMatchingSymbolResults","No matching editor symbols")):this.provideLabelPick(i,w("noSymbolResults","No editor symbols"))}finally{r.isCancellationRequested||(i.busy=!1)}};return a.add(i.onDidChangeValue(()=>u(void 0))),u(o.getSelection()?.getPosition()),a.add(i.onDidChangeActive(()=>{const[d]=i.activeItems;d&&d.range&&(o.revealRangeInCenter(d.range.selection,0),this.addDecorations(o,d.range.decoration))})),a}async doGetSymbolPicks(e,t,i,r,s){const o=await e;if(r.isCancellationRequested)return[];const a=t.original.indexOf(kF.SCOPE_PREFIX)===0,l=a?1:0;let c,u;t.values&&t.values.length>1?(c=Qxe(t.values[0]),u=Qxe(t.values.slice(1))):c=t;let d;const h=this.options?.openSideBySideDirection?.();h&&(d=[{iconClass:h==="right"?zt.asClassName(ze.splitHorizontal):zt.asClassName(ze.splitVertical),tooltip:h==="right"?w("openToSide","Open to the Side"):w("openToBottom","Open to the Bottom")}]);const f=[];for(let m=0;ml){let M=!1;if(c!==t&&([k,L]=cK(y,{...t,values:void 0},l,C),typeof k=="number"&&(M=!0)),typeof k!="number"&&([k,L]=cK(y,c,l,C),typeof k!="number"))continue;if(!M&&u){if(x&&u.original.length>0&&([D,I]=cK(x,u)),typeof D!="number")continue;typeof k=="number"&&(k+=D)}}const O=_.tags&&_.tags.indexOf(1)>=0;f.push({index:m,kind:_.kind,score:k,label:y,ariaLabel:e_t(_.name,_.kind),description:x,highlights:O?void 0:{label:L,description:I},range:{selection:$.collapseToStart(_.selectionRange),decoration:_.range},uri:s.uri,symbolName:v,strikethrough:O,buttons:d})}const g=f.sort((m,_)=>a?this.compareByKindAndScore(m,_):this.compareByScore(m,_));let p=[];if(a){let y=function(){_&&typeof m=="number"&&v>0&&(_.label=Lw(dK[m]||uK,v))},m,_,v=0;for(const C of g)m!==C.kind?(y(),m=C.kind,v=1,_={type:"separator"},p.push(_)):v++,p.push(C);y()}else g.length>0&&(p=[{label:w("symbols","symbols ({0})",f.length),type:"separator"},...g]);return p}compareByScore(e,t){if(typeof e.score!="number"&&typeof t.score=="number")return 1;if(typeof e.score=="number"&&typeof t.score!="number")return-1;if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.scoret.index?1:0}compareByKindAndScore(e,t){const i=dK[e.kind]||uK,r=dK[t.kind]||uK,s=i.localeCompare(r);return s===0?this.compareByScore(e,t):s}async getDocumentSymbols(e,t){const i=await this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:i.asListOfDocumentSymbols()}};lw=kF=ZWt([Jxe(0,dt),Jxe(1,DO)],lw);const uK=w("property","properties ({0})"),dK={5:w("method","methods ({0})"),11:w("function","functions ({0})"),8:w("_constructor","constructors ({0})"),12:w("variable","variables ({0})"),4:w("class","classes ({0})"),22:w("struct","structs ({0})"),23:w("event","events ({0})"),24:w("operator","operators ({0})"),10:w("interface","interfaces ({0})"),2:w("namespace","namespaces ({0})"),3:w("package","packages ({0})"),25:w("typeParameter","type parameters ({0})"),1:w("modules","modules ({0})"),6:w("property","properties ({0})"),9:w("enum","enumerations ({0})"),21:w("enumMember","enumeration members ({0})"),14:w("string","strings ({0})"),0:w("file","files ({0})"),17:w("array","arrays ({0})"),15:w("number","numbers ({0})"),16:w("boolean","booleans ({0})"),18:w("object","objects ({0})"),19:w("key","keys ({0})"),7:w("field","fields ({0})"),13:w("constant","constants ({0})")};var XWt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},hK=function(n,e){return function(t,i){e(t,i,n)}};let _ne=class extends lw{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=Ge.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};_ne=XWt([hK(0,ai),hK(1,dt),hK(2,DO)],_ne);class AH extends ot{static{this.ID="editor.action.quickOutline"}constructor(){super({id:AH.ID,label:LN.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:Q.hasDocumentSymbolProvider,kbOpts:{kbExpr:Q.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(hh).quickAccess.show(lw.PREFIX,{itemActivation:zf.NONE})}}Pe(AH);Yr.as(CC.Quickaccess).registerQuickAccessProvider({ctor:_ne,prefix:lw.PREFIX,helpEntries:[{description:LN.quickOutlineActionLabel,prefix:lw.PREFIX,commandId:AH.ID},{description:LN.quickOutlineByCategoryActionLabel,prefix:lw.PREFIX_BY_CATEGORY}]});function QWt(n){const e=new Map;for(const t of n)e.set(t,(e.get(t)??0)+1);return e}class QI{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(e,t){const i=this.computeEmbedding(e),r=new Map,s=[];for(const[o,a]of this.documents){if(t.isCancellationRequested)return[];for(const l of a.chunks){const c=this.computeSimilarityScore(l,i,r);c>0&&s.push({key:o,score:c})}}return s}static termFrequencies(e){return QWt(QI.splitTerms(e))}static*splitTerms(e){const t=i=>i.toLowerCase();for(const[i]of e.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield t(i);const r=i.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(r.length>1)for(const s of r)s.length>2&&/\p{Letter}{3,}/gu.test(s)&&(yield t(s))}}updateDocuments(e){for(const{key:t}of e)this.deleteDocument(t);for(const t of e){const i=[];for(const r of t.textChunks){const s=QI.termFrequencies(r);for(const o of s.keys())this.chunkOccurrences.set(o,(this.chunkOccurrences.get(o)??0)+1);i.push({text:r,tf:s})}this.chunkCount+=i.length,this.documents.set(t.key,{chunks:i})}return this}deleteDocument(e){const t=this.documents.get(e);if(t){this.documents.delete(e),this.chunkCount-=t.chunks.length;for(const i of t.chunks)for(const r of i.tf.keys()){const s=this.chunkOccurrences.get(r);if(typeof s=="number"){const o=s-1;o<=0?this.chunkOccurrences.delete(r):this.chunkOccurrences.set(r,o)}}}}computeSimilarityScore(e,t,i){let r=0;for(const[s,o]of Object.entries(t)){const a=e.tf.get(s);if(!a)continue;let l=i.get(s);typeof l!="number"&&(l=this.computeIdf(s),i.set(s,l));const c=a*l;r+=c*o}return r}computeEmbedding(e){const t=QI.termFrequencies(e);return this.computeTfidf(t)}computeIdf(e){const t=this.chunkOccurrences.get(e)??0;return t>0?Math.log((this.chunkCount+1)/t):0}computeTfidf(e){const t=Object.create(null);for(const[i,r]of e){const s=this.computeIdf(i);s>0&&(t[i]=r*s)}return t}}function JWt(n){const e=n.slice(0);e.sort((i,r)=>r.score-i.score);const t=e[0]?.score??0;if(t>0)for(const i of e)i.score/=t;return e}var VS;(function(n){n[n.NO_ACTION=0]="NO_ACTION",n[n.CLOSE_PICKER=1]="CLOSE_PICKER",n[n.REFRESH_PICKER=2]="REFRESH_PICKER",n[n.REMOVE_ITEM=3]="REMOVE_ITEM"})(VS||(VS={}));function fK(n){const e=n;return Array.isArray(e.items)}function eSe(n){const e=n;return!!e.picks&&e.additionalPicks instanceof Promise}class eHt extends me{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){const r=new ke;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let s;const o=r.add(new To),a=async()=>{const c=o.value=new ke;s?.dispose(!0),e.busy=!1,s=new Kr(t);const u=s.token;let d=e.value.substring(this.prefix.length);this.options?.shouldSkipTrimPickFilter||(d=d.trim());const h=this._getPicks(d,c,u,i),f=(p,m)=>{let _,v;if(fK(p)?(_=p.items,v=p.active):_=p,_.length===0){if(m)return!1;(d.length>0||e.hideInput)&&this.options?.noResultsPick&&(tN(this.options.noResultsPick)?_=[this.options.noResultsPick(d)]:_=[this.options.noResultsPick])}return e.items=_,v&&(e.activeItems=[v]),!0},g=async p=>{let m=!1,_=!1;await Promise.all([(async()=>{typeof p.mergeDelay=="number"&&(await Y_(p.mergeDelay),u.isCancellationRequested)||_||(m=f(p.picks,!0))})(),(async()=>{e.busy=!0;try{const v=await p.additionalPicks;if(u.isCancellationRequested)return;let y,C;fK(p.picks)?(y=p.picks.items,C=p.picks.active):y=p.picks;let x,k;if(fK(v)?(x=v.items,k=v.active):x=v,x.length>0||!m){let L;if(!C&&!k){const D=e.activeItems[0];D&&y.indexOf(D)!==-1&&(L=D)}f({items:[...y,...x],active:C||k||L})}}finally{u.isCancellationRequested||(e.busy=!1),_=!0}})()])};if(h!==null)if(eSe(h))await g(h);else if(!(h instanceof Promise))f(h);else{e.busy=!0;try{const p=await h;if(u.isCancellationRequested)return;eSe(p)?await g(p):f(p)}finally{u.isCancellationRequested||(e.busy=!1)}}};r.add(e.onDidChangeValue(()=>a())),a(),r.add(e.onDidAccept(c=>{if(i?.handleAccept){c.inBackground||e.hide(),i.handleAccept?.(e.activeItems[0]);return}const[u]=e.selectedItems;typeof u?.accept=="function"&&(c.inBackground||e.hide(),u.accept(e.keyMods,c))}));const l=async(c,u)=>{if(typeof u.trigger!="function")return;const d=u.buttons?.indexOf(c)??-1;if(d>=0){const h=u.trigger(d,e.keyMods),f=typeof h=="number"?h:await h;if(t.isCancellationRequested)return;switch(f){case VS.NO_ACTION:break;case VS.CLOSE_PICKER:e.hide();break;case VS.REFRESH_PICKER:a();break;case VS.REMOVE_ITEM:{const g=e.items.indexOf(u);if(g!==-1){const p=e.items.slice(),m=p.splice(g,1),_=e.activeItems.filter(y=>y!==m[0]),v=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=p,_&&(e.activeItems=_),e.keepScrollPosition=v}break}}}};return r.add(e.onDidTriggerItemButton(({button:c,item:u})=>l(c,u))),r.add(e.onDidTriggerSeparatorButton(({button:c,separator:u})=>l(c,u))),r}}var s$e=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},wv=function(n,e){return function(t,i){e(t,i,n)}},Q1,Js;let vne=class extends eHt{static{Q1=this}static{this.PREFIX=">"}static{this.TFIDF_THRESHOLD=.5}static{this.TFIDF_MAX_RESULTS=5}static{this.WORD_FILTER=Cle(SN,wCt,H5e)}constructor(e,t,i,r,s,o){super(Q1.PREFIX,e),this.instantiationService=t,this.keybindingService=i,this.commandService=r,this.telemetryService=s,this.dialogService=o,this.commandsHistory=this._register(this.instantiationService.createInstance(bne)),this.options=e}async _getPicks(e,t,i,r){const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const o=wb(()=>{const f=new QI;f.updateDocuments(s.map(p=>({key:p.commandId,textChunks:[this.getTfIdfChunk(p)]})));const g=f.calculateScores(e,i);return JWt(g).filter(p=>p.score>Q1.TFIDF_THRESHOLD).slice(0,Q1.TFIDF_MAX_RESULTS)}),a=[];for(const f of s){const g=Q1.WORD_FILTER(e,f.label)??void 0,p=f.commandAlias?Q1.WORD_FILTER(e,f.commandAlias)??void 0:void 0;if(g||p)f.highlights={label:g,detail:this.options.showAlias?p:void 0},a.push(f);else if(e===f.commandId)a.push(f);else if(e.length>=3){const m=o();if(i.isCancellationRequested)return[];const _=m.find(v=>v.key===f.commandId);_&&(f.tfIdfScore=_.score,a.push(f))}}const l=new Map;for(const f of a){const g=l.get(f.label);g?(f.description=f.commandId,g.description=g.commandId):l.set(f.label,f)}a.sort((f,g)=>{if(f.tfIdfScore&&g.tfIdfScore)return f.tfIdfScore===g.tfIdfScore?f.label.localeCompare(g.label):g.tfIdfScore-f.tfIdfScore;if(f.tfIdfScore)return 1;if(g.tfIdfScore)return-1;const p=this.commandsHistory.peek(f.commandId),m=this.commandsHistory.peek(g.commandId);if(p&&m)return p>m?-1:1;if(p)return-1;if(m)return 1;if(this.options.suggestedCommandIds){const _=this.options.suggestedCommandIds.has(f.commandId),v=this.options.suggestedCommandIds.has(g.commandId);if(_&&v)return 0;if(_)return-1;if(v)return 1}return f.label.localeCompare(g.label)});const c=[];let u=!1,d=!0,h=!!this.options.suggestedCommandIds;for(let f=0;f{const f=await this.getAdditionalCommandPicks(s,a,e,i);if(i.isCancellationRequested)return[];const g=f.map(p=>this.toCommandPick(p,r));return d&&g[0]?.type!=="separator"&&g.unshift({type:"separator",label:w("suggested","similar commands")}),g})()}:c}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),r=i?w("commandPickAriaLabelWithKeybinding","{0}, {1}",e.label,i.getAriaLabel()):e.label;return{...e,ariaLabel:r,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:i,accept:async()=>{this.commandsHistory.push(e.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.commandId,from:t?.from??"quick open"});try{e.args?.length?await this.commandService.executeCommand(e.commandId,...e.args):await this.commandService.executeCommand(e.commandId)}catch(s){uh(s)||this.dialogService.error(w("canNotRun","Command '{0}' resulted in an error",e.label),I9(s))}}}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:i}){let r=e;return t&&t!==e&&(r+=` - ${t}`),i&&i.value!==e&&(r+=` - ${i.value===i.original?i.value:`${i.value} (${i.original})`}`),r}};vne=Q1=s$e([wv(1,Tt),wv(2,xi),wv(3,_r),wv(4,Qa),wv(5,JP)],vne);let bne=class extends me{static{Js=this}static{this.DEFAULT_COMMANDS_HISTORY_LENGTH=50}static{this.PREF_KEY_CACHE="commandPalette.mru.cache"}static{this.PREF_KEY_COUNTER="commandPalette.mru.counter"}static{this.counter=1}static{this.hasChanges=!1}constructor(e,t,i){super(),this.storageService=e,this.configurationService=t,this.logService=i,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e))),this._register(this.storageService.onWillSaveState(e=>{e.reason===AN.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=Js.getConfiguredCommandHistoryLength(this.configurationService),Js.cache&&Js.cache.limit!==this.configuredCommandsHistoryLength&&(Js.cache.limit=this.configuredCommandsHistoryLength,Js.hasChanges=!0))}load(){const e=this.storageService.get(Js.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(r){this.logService.error(`[CommandsHistory] invalid data: ${r}`)}const i=Js.cache=new lm(this.configuredCommandsHistoryLength,1);if(t){let r;t.usesLRU?r=t.entries:r=t.entries.sort((s,o)=>s.value-o.value),r.forEach(s=>i.set(s.key,s.value))}Js.counter=this.storageService.getNumber(Js.PREF_KEY_COUNTER,0,Js.counter)}push(e){Js.cache&&(Js.cache.set(e,Js.counter++),Js.hasChanges=!0)}peek(e){return Js.cache?.peek(e)}saveState(){if(!Js.cache||!Js.hasChanges)return;const e={usesLRU:!0,entries:[]};Js.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(Js.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(Js.PREF_KEY_COUNTER,Js.counter,0,0),Js.hasChanges=!1}static getConfiguredCommandHistoryLength(e){const i=e.getValue().workbench?.commandPalette?.history;return typeof i=="number"?i:Js.DEFAULT_COMMANDS_HISTORY_LENGTH}};bne=Js=s$e([wv(0,pf),wv(1,En),wv(2,Da)],bne);class tHt extends vne{constructor(e,t,i,r,s,o){super(e,t,i,r,s,o)}getCodeEditorCommandPicks(){const e=this.activeTextEditorControl;if(!e)return[];const t=[];for(const i of e.getSupportedActions()){let r;i.metadata?.description&&(bkt(i.metadata.description)?r=i.metadata.description:r={original:i.metadata.description,value:i.metadata.description}),t.push({commandId:i.id,commandAlias:i.alias,commandDescription:r,label:Dle(i.label)||i.id})}return t}}var nHt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Dx=function(n,e){return function(t,i){e(t,i,n)}};let SR=class extends tHt{get activeTextEditorControl(){return this.codeEditorService.getFocusedCodeEditor()??void 0}constructor(e,t,i,r,s,o){super({showAlias:!1},e,i,r,s,o),this.codeEditorService=t}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};SR=nHt([Dx(0,Tt),Dx(1,ai),Dx(2,xi),Dx(3,_r),Dx(4,Qa),Dx(5,JP)],SR);class NH extends ot{static{this.ID="editor.action.quickCommand"}constructor(){super({id:NH.ID,label:x8.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:Q.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(hh).quickAccess.show(SR.PREFIX)}}Pe(NH);Yr.as(CC.Quickaccess).registerQuickAccessProvider({ctor:SR,prefix:SR.PREFIX,helpEntries:[{description:x8.quickCommandHelp,commandId:NH.ID}]});var iHt=function(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ix=function(n,e){return function(t,i){e(t,i,n)}};let yne=class extends Gw{constructor(e,t,i,r,s,o,a){super(!0,e,t,i,r,s,o,a)}};yne=iHt([Ix(1,jt),Ix(2,ai),Ix(3,Ts),Ix(4,Tt),Ix(5,pf),Ix(6,En)],yne);Zn(Gw.ID,yne,4);class rHt extends ot{constructor(){super({id:"editor.action.toggleHighContrast",label:_Q.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(hd),r=i.getColorTheme();mg(r.type)?(i.setTheme(this._originalThemeName||(aE(r.type)?bk:a_)),this._originalThemeName=null):(i.setTheme(aE(r.type)?ew:tw),this._originalThemeName=r.themeName)}}Pe(rHt);const a$n=Object.freeze(Object.defineProperty({__proto__:null,CancellationTokenSource:U8e,Emitter:j8e,KeyCode:q8e,KeyMod:K8e,MarkerSeverity:Q8e,MarkerTag:J8e,Position:G8e,Range:Y8e,Selection:Z8e,SelectionDirection:X8e,Token:t9e,Uri:e9e,editor:n9e,languages:i9e},Symbol.toStringTag,{value:"Module"}));function Ll(n){return`Minified Redux error #${n}; visit https://redux.js.org/Errors?code=${n} for the full message or use the non-minified dev environment for full errors. `}var sHt=typeof Symbol=="function"&&Symbol.observable||"@@observable",tSe=sHt,gK=()=>Math.random().toString(36).substring(7).split("").join("."),oHt={INIT:`@@redux/INIT${gK()}`,REPLACE:`@@redux/REPLACE${gK()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${gK()}`},o7=oHt;function $de(n){if(typeof n!="object"||n===null)return!1;let e=n;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(n)===e||Object.getPrototypeOf(n)===null}function o$e(n,e,t){if(typeof n!="function")throw new Error(Ll(2));if(typeof e=="function"&&typeof t=="function"||typeof t=="function"&&typeof arguments[3]=="function")throw new Error(Ll(0));if(typeof e=="function"&&typeof t>"u"&&(t=e,e=void 0),typeof t<"u"){if(typeof t!="function")throw new Error(Ll(1));return t(o$e)(n,e)}let i=n,r=e,s=new Map,o=s,a=0,l=!1;function c(){o===s&&(o=new Map,s.forEach((m,_)=>{o.set(_,m)}))}function u(){if(l)throw new Error(Ll(3));return r}function d(m){if(typeof m!="function")throw new Error(Ll(4));if(l)throw new Error(Ll(5));let _=!0;c();const v=a++;return o.set(v,m),function(){if(_){if(l)throw new Error(Ll(6));_=!1,c(),o.delete(v),s=null}}}function h(m){if(!$de(m))throw new Error(Ll(7));if(typeof m.type>"u")throw new Error(Ll(8));if(typeof m.type!="string")throw new Error(Ll(17));if(l)throw new Error(Ll(9));try{l=!0,r=i(r,m)}finally{l=!1}return(s=o).forEach(v=>{v()}),m}function f(m){if(typeof m!="function")throw new Error(Ll(10));i=m,h({type:o7.REPLACE})}function g(){const m=d;return{subscribe(_){if(typeof _!="object"||_===null)throw new Error(Ll(11));function v(){const C=_;C.next&&C.next(u())}return v(),{unsubscribe:m(v)}},[tSe](){return this}}}return h({type:o7.INIT}),{dispatch:h,subscribe:d,getState:u,replaceReducer:f,[tSe]:g}}function aHt(n){Object.keys(n).forEach(e=>{const t=n[e];if(typeof t(void 0,{type:o7.INIT})>"u")throw new Error(Ll(12));if(typeof t(void 0,{type:o7.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ll(13))})}function lHt(n){const e=Object.keys(n),t={};for(let s=0;s"u")throw a&&a.type,new Error(Ll(14));c[d]=g,l=l||g!==f}return l=l||i.length!==Object.keys(o).length,l?c:o}}function a7(...n){return n.length===0?e=>e:n.length===1?n[0]:n.reduce((e,t)=>(...i)=>e(t(...i)))}function cHt(...n){return e=>(t,i)=>{const r=e(t,i);let s=()=>{throw new Error(Ll(15))};const o={getState:r.getState,dispatch:(l,...c)=>s(l,...c)},a=n.map(l=>l(o));return s=a7(...a)(r.dispatch),{...r,dispatch:s}}}function uHt(n){return $de(n)&&"type"in n&&typeof n.type=="string"}var a$e=Symbol.for("immer-nothing"),nSe=Symbol.for("immer-draftable"),rh=Symbol.for("immer-state");function tg(n,...e){throw new Error(`[Immer] minified error nr: ${n}. Full error at: https://bit.ly/3cXEKWf`)}var UE=Object.getPrototypeOf;function Qw(n){return!!n&&!!n[rh]}function r0(n){return n?l$e(n)||Array.isArray(n)||!!n[nSe]||!!n.constructor?.[nSe]||PH(n)||OH(n):!1}var dHt=Object.prototype.constructor.toString();function l$e(n){if(!n||typeof n!="object")return!1;const e=UE(n);if(e===null)return!0;const t=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return t===Object?!0:typeof t=="function"&&Function.toString.call(t)===dHt}function l7(n,e){RH(n)===0?Reflect.ownKeys(n).forEach(t=>{e(t,n[t],n)}):n.forEach((t,i)=>e(i,t,n))}function RH(n){const e=n[rh];return e?e.type_:Array.isArray(n)?1:PH(n)?2:OH(n)?3:0}function wne(n,e){return RH(n)===2?n.has(e):Object.prototype.hasOwnProperty.call(n,e)}function c$e(n,e,t){const i=RH(n);i===2?n.set(e,t):i===3?n.add(t):n[e]=t}function hHt(n,e){return n===e?n!==0||1/n===1/e:n!==n&&e!==e}function PH(n){return n instanceof Map}function OH(n){return n instanceof Set}function J1(n){return n.copy_||n.base_}function Cne(n,e){if(PH(n))return new Map(n);if(OH(n))return new Set(n);if(Array.isArray(n))return Array.prototype.slice.call(n);if(!e&&l$e(n))return UE(n)?{...n}:Object.assign(Object.create(null),n);const t=Object.getOwnPropertyDescriptors(n);delete t[rh];let i=Reflect.ownKeys(t);for(let r=0;r1&&(n.set=n.add=n.clear=n.delete=fHt),Object.freeze(n),e&&Object.entries(n).forEach(([t,i])=>Wde(i,!0))),n}function fHt(){tg(2)}function MH(n){return Object.isFrozen(n)}var gHt={};function Jw(n){const e=gHt[n];return e||tg(0,n),e}var kR;function u$e(){return kR}function pHt(n,e){return{drafts_:[],parent_:n,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function iSe(n,e){e&&(Jw("Patches"),n.patches_=[],n.inversePatches_=[],n.patchListener_=e)}function xne(n){Sne(n),n.drafts_.forEach(mHt),n.drafts_=null}function Sne(n){n===kR&&(kR=n.parent_)}function rSe(n){return kR=pHt(kR,n)}function mHt(n){const e=n[rh];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function sSe(n,e){e.unfinalizedDrafts_=e.drafts_.length;const t=e.drafts_[0];return n!==void 0&&n!==t?(t[rh].modified_&&(xne(e),tg(4)),r0(n)&&(n=c7(e,n),e.parent_||u7(e,n)),e.patches_&&Jw("Patches").generateReplacementPatches_(t[rh].base_,n,e.patches_,e.inversePatches_)):n=c7(e,t,[]),xne(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),n!==a$e?n:void 0}function c7(n,e,t){if(MH(e))return e;const i=e[rh];if(!i)return l7(e,(r,s)=>oSe(n,i,e,r,s,t)),e;if(i.scope_!==n)return e;if(!i.modified_)return u7(n,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const r=i.copy_;let s=r,o=!1;i.type_===3&&(s=new Set(r),r.clear(),o=!0),l7(s,(a,l)=>oSe(n,i,r,a,l,t,o)),u7(n,r,!1),t&&n.patches_&&Jw("Patches").generatePatches_(i,t,n.patches_,n.inversePatches_)}return i.copy_}function oSe(n,e,t,i,r,s,o){if(Qw(r)){const a=s&&e&&e.type_!==3&&!wne(e.assigned_,i)?s.concat(i):void 0,l=c7(n,r,a);if(c$e(t,i,l),Qw(l))n.canAutoFreeze_=!1;else return}else o&&t.add(r);if(r0(r)&&!MH(r)){if(!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1)return;c7(n,r),(!e||!e.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(t,i)&&u7(n,r)}}function u7(n,e,t=!1){!n.parent_&&n.immer_.autoFreeze_&&n.canAutoFreeze_&&Wde(e,t)}function _Ht(n,e){const t=Array.isArray(n),i={type_:t?1:0,scope_:e?e.scope_:u$e(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:n,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,s=Hde;t&&(r=[i],s=ER);const{revoke:o,proxy:a}=Proxy.revocable(r,s);return i.draft_=a,i.revoke_=o,a}var Hde={get(n,e){if(e===rh)return n;const t=J1(n);if(!wne(t,e))return vHt(n,t,e);const i=t[e];return n.finalized_||!r0(i)?i:i===pK(n.base_,e)?(mK(n),n.copy_[e]=Ene(i,n)):i},has(n,e){return e in J1(n)},ownKeys(n){return Reflect.ownKeys(J1(n))},set(n,e,t){const i=d$e(J1(n),e);if(i?.set)return i.set.call(n.draft_,t),!0;if(!n.modified_){const r=pK(J1(n),e),s=r?.[rh];if(s&&s.base_===t)return n.copy_[e]=t,n.assigned_[e]=!1,!0;if(hHt(t,r)&&(t!==void 0||wne(n.base_,e)))return!0;mK(n),kne(n)}return n.copy_[e]===t&&(t!==void 0||e in n.copy_)||Number.isNaN(t)&&Number.isNaN(n.copy_[e])||(n.copy_[e]=t,n.assigned_[e]=!0),!0},deleteProperty(n,e){return pK(n.base_,e)!==void 0||e in n.base_?(n.assigned_[e]=!1,mK(n),kne(n)):delete n.assigned_[e],n.copy_&&delete n.copy_[e],!0},getOwnPropertyDescriptor(n,e){const t=J1(n),i=Reflect.getOwnPropertyDescriptor(t,e);return i&&{writable:!0,configurable:n.type_!==1||e!=="length",enumerable:i.enumerable,value:t[e]}},defineProperty(){tg(11)},getPrototypeOf(n){return UE(n.base_)},setPrototypeOf(){tg(12)}},ER={};l7(Hde,(n,e)=>{ER[n]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});ER.deleteProperty=function(n,e){return ER.set.call(this,n,e,void 0)};ER.set=function(n,e,t){return Hde.set.call(this,n[0],e,t,n[0])};function pK(n,e){const t=n[rh];return(t?J1(t):n)[e]}function vHt(n,e,t){const i=d$e(e,t);return i?"value"in i?i.value:i.get?.call(n.draft_):void 0}function d$e(n,e){if(!(e in n))return;let t=UE(n);for(;t;){const i=Object.getOwnPropertyDescriptor(t,e);if(i)return i;t=UE(t)}}function kne(n){n.modified_||(n.modified_=!0,n.parent_&&kne(n.parent_))}function mK(n){n.copy_||(n.copy_=Cne(n.base_,n.scope_.immer_.useStrictShallowCopy_))}var bHt=class{constructor(n){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,i)=>{if(typeof e=="function"&&typeof t!="function"){const s=t;t=e;const o=this;return function(l=s,...c){return o.produce(l,u=>t.call(this,u,...c))}}typeof t!="function"&&tg(6),i!==void 0&&typeof i!="function"&&tg(7);let r;if(r0(e)){const s=rSe(this),o=Ene(e,void 0);let a=!0;try{r=t(o),a=!1}finally{a?xne(s):Sne(s)}return iSe(s,i),sSe(r,s)}else if(!e||typeof e!="object"){if(r=t(e),r===void 0&&(r=e),r===a$e&&(r=void 0),this.autoFreeze_&&Wde(r,!0),i){const s=[],o=[];Jw("Patches").generateReplacementPatches_(e,r,s,o),i(s,o)}return r}else tg(1,e)},this.produceWithPatches=(e,t)=>{if(typeof e=="function")return(o,...a)=>this.produceWithPatches(o,l=>e(l,...a));let i,r;return[this.produce(e,t,(o,a)=>{i=o,r=a}),i,r]},typeof n?.autoFreeze=="boolean"&&this.setAutoFreeze(n.autoFreeze),typeof n?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(n.useStrictShallowCopy)}createDraft(n){r0(n)||tg(8),Qw(n)&&(n=yHt(n));const e=rSe(this),t=Ene(n,void 0);return t[rh].isManual_=!0,Sne(e),t}finishDraft(n,e){const t=n&&n[rh];(!t||!t.isManual_)&&tg(9);const{scope_:i}=t;return iSe(i,e),sSe(void 0,i)}setAutoFreeze(n){this.autoFreeze_=n}setUseStrictShallowCopy(n){this.useStrictShallowCopy_=n}applyPatches(n,e){let t;for(t=e.length-1;t>=0;t--){const r=e[t];if(r.path.length===0&&r.op==="replace"){n=r.value;break}}t>-1&&(e=e.slice(t+1));const i=Jw("Patches").applyPatches_;return Qw(n)?i(n,e):this.produce(n,r=>i(r,e))}};function Ene(n,e){const t=PH(n)?Jw("MapSet").proxyMap_(n,e):OH(n)?Jw("MapSet").proxySet_(n,e):_Ht(n,e);return(e?e.scope_:u$e()).drafts_.push(t),t}function yHt(n){return Qw(n)||tg(10,n),h$e(n)}function h$e(n){if(!r0(n)||MH(n))return n;const e=n[rh];let t;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,t=Cne(n,e.scope_.immer_.useStrictShallowCopy_)}else t=Cne(n,!0);return l7(t,(i,r)=>{c$e(t,i,h$e(r))}),e&&(e.finalized_=!1),t}var sh=new bHt,f$e=sh.produce;sh.produceWithPatches.bind(sh);sh.setAutoFreeze.bind(sh);sh.setUseStrictShallowCopy.bind(sh);sh.applyPatches.bind(sh);sh.createDraft.bind(sh);sh.finishDraft.bind(sh);function wHt(n,e=`expected a function, instead received ${typeof n}`){if(typeof n!="function")throw new TypeError(e)}function CHt(n,e=`expected an object, instead received ${typeof n}`){if(typeof n!="object")throw new TypeError(e)}function xHt(n,e="expected all items to be functions, instead received the following types: "){if(!n.every(t=>typeof t=="function")){const t=n.map(i=>typeof i=="function"?`function ${i.name||"unnamed"}()`:typeof i).join(", ");throw new TypeError(`${e}[${t}]`)}}var aSe=n=>Array.isArray(n)?n:[n];function SHt(n){const e=Array.isArray(n[0])?n[0]:n;return xHt(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function kHt(n,e){const t=[],{length:i}=n;for(let r=0;r{t=I3(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function DHt(n,...e){const t=typeof n=="function"?{memoize:n,memoizeOptions:e}:n,i=(...r)=>{let s=0,o=0,a,l={},c=r.pop();typeof c=="object"&&(l=c,c=r.pop()),wHt(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const u={...t,...l},{memoize:d,memoizeOptions:h=[],argsMemoize:f=g$e,argsMemoizeOptions:g=[],devModeChecks:p={}}=u,m=aSe(h),_=aSe(g),v=SHt(r),y=d(function(){return s++,c.apply(null,arguments)},...m),C=f(function(){o++;const k=kHt(v,arguments);return a=y.apply(null,k),a},..._);return Object.assign(C,{resultFunc:c,memoizedResultFunc:y,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:d,argsMemoize:f})};return Object.assign(i,{withTypes:()=>i}),i}var IHt=DHt(g$e),AHt=Object.assign((n,e=IHt)=>{CHt(n,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof n}`);const t=Object.keys(n),i=t.map(s=>n[s]);return e(i,(...s)=>s.reduce((o,a,l)=>(o[t[l]]=a,o),{}))},{withTypes:()=>AHt});function p$e(n){return({dispatch:t,getState:i})=>r=>s=>typeof s=="function"?s(t,i,n):r(s)}var NHt=p$e(),RHt=p$e,PHt=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?a7:a7.apply(null,arguments)},OHt=n=>n&&typeof n.match=="function";function JI(n,e){function t(...i){if(e){let r=e(...i);if(!r)throw new Error(M_(0));return{type:n,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:n,payload:i[0]}}return t.toString=()=>`${n}`,t.type=n,t.match=i=>uHt(i)&&i.type===n,t}var m$e=class YD extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,YD.prototype)}static get[Symbol.species](){return YD}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new YD(...e[0].concat(this)):new YD(...e.concat(this))}};function cSe(n){return r0(n)?f$e(n,()=>{}):n}function uSe(n,e,t){return n.has(e)?n.get(e):n.set(e,t(e)).get(e)}function MHt(n){return typeof n=="boolean"}var FHt=()=>function(e){const{thunk:t=!0,immutableCheck:i=!0,serializableCheck:r=!0,actionCreatorCheck:s=!0}=e??{};let o=new m$e;return t&&(MHt(t)?o.push(NHt):o.push(RHt(t.extraArgument))),o},BHt="RTK_autoBatch",dSe=n=>e=>{setTimeout(e,n)},$Ht=(n={type:"raf"})=>e=>(...t)=>{const i=e(...t);let r=!0,s=!1,o=!1;const a=new Set,l=n.type==="tick"?queueMicrotask:n.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:dSe(10):n.type==="callback"?n.queueNotification:dSe(n.timeout),c=()=>{o=!1,s&&(s=!1,a.forEach(u=>u()))};return Object.assign({},i,{subscribe(u){const d=()=>r&&u(),h=i.subscribe(d);return a.add(u),()=>{h(),a.delete(u)}},dispatch(u){try{return r=!u?.meta?.[BHt],s=!r,s&&(o||(o=!0,l(c))),i.dispatch(u)}finally{r=!0}}})},WHt=n=>function(t){const{autoBatch:i=!0}=t??{};let r=new m$e(n);return i&&r.push($Ht(typeof i=="object"?i:void 0)),r};function l$n(n){const e=FHt(),{reducer:t=void 0,middleware:i,devTools:r=!0,preloadedState:s=void 0,enhancers:o=void 0}=n;let a;if(typeof t=="function")a=t;else if($de(t))a=lHt(t);else throw new Error(M_(1));let l;typeof i=="function"?l=i(e):l=e();let c=a7;r&&(c=PHt({trace:!1,...typeof r=="object"&&r}));const u=cHt(...l),d=WHt(u);let h=typeof o=="function"?o(d):d();const f=c(...h);return o$e(a,s,f)}function _$e(n){const e={},t=[];let i;const r={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(M_(28));if(a in e)throw new Error(M_(29));return e[a]=o,r},addMatcher(s,o){return t.push({matcher:s,reducer:o}),r},addDefaultCase(s){return i=s,r}};return n(r),[e,t,i]}function HHt(n){return typeof n=="function"}function VHt(n,e){let[t,i,r]=_$e(e),s;if(HHt(n))s=()=>cSe(n());else{const a=cSe(n);s=()=>a}function o(a=s(),l){let c=[t[l.type],...i.filter(({matcher:u})=>u(l)).map(({reducer:u})=>u)];return c.filter(u=>!!u).length===0&&(c=[r]),c.reduce((u,d)=>{if(d)if(Qw(u)){const f=d(u,l);return f===void 0?u:f}else{if(r0(u))return f$e(u,h=>d(h,l));{const h=d(u,l);if(h===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return h}}return u},a)}return o.getInitialState=s,o}var zHt=(n,e)=>OHt(n)?n.match(e):n(e);function UHt(...n){return e=>n.some(t=>zHt(t,e))}var jHt="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",qHt=(n=21)=>{let e="",t=n;for(;t--;)e+=jHt[Math.random()*64|0];return e},KHt=["name","message","stack","code"],_K=class{constructor(n,e){this.payload=n,this.meta=e}_type},hSe=class{constructor(n,e){this.payload=n,this.meta=e}_type},GHt=n=>{if(typeof n=="object"&&n!==null){const e={};for(const t of KHt)typeof n[t]=="string"&&(e[t]=n[t]);return e}return{message:String(n)}},c$n=(()=>{function n(e,t,i){const r=JI(e+"/fulfilled",(l,c,u,d)=>({payload:l,meta:{...d||{},arg:u,requestId:c,requestStatus:"fulfilled"}})),s=JI(e+"/pending",(l,c,u)=>({payload:void 0,meta:{...u||{},arg:c,requestId:l,requestStatus:"pending"}})),o=JI(e+"/rejected",(l,c,u,d,h)=>({payload:d,error:(i&&i.serializeError||GHt)(l||"Rejected"),meta:{...h||{},arg:u,requestId:c,rejectedWithValue:!!d,requestStatus:"rejected",aborted:l?.name==="AbortError",condition:l?.name==="ConditionError"}}));function a(l){return(c,u,d)=>{const h=i?.idGenerator?i.idGenerator(l):qHt(),f=new AbortController;let g,p;function m(v){p=v,f.abort()}const _=async function(){let v;try{let C=i?.condition?.(l,{getState:u,extra:d});if(ZHt(C)&&(C=await C),C===!1||f.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const x=new Promise((k,L)=>{g=()=>{L({name:"AbortError",message:p||"Aborted"})},f.signal.addEventListener("abort",g)});c(s(h,l,i?.getPendingMeta?.({requestId:h,arg:l},{getState:u,extra:d}))),v=await Promise.race([x,Promise.resolve(t(l,{dispatch:c,getState:u,extra:d,requestId:h,signal:f.signal,abort:m,rejectWithValue:(k,L)=>new _K(k,L),fulfillWithValue:(k,L)=>new hSe(k,L)})).then(k=>{if(k instanceof _K)throw k;return k instanceof hSe?r(k.payload,h,l,k.meta):r(k,h,l)})])}catch(C){v=C instanceof _K?o(null,h,l,C.payload,C.meta):o(C,h,l)}finally{g&&f.signal.removeEventListener("abort",g)}return i&&!i.dispatchConditionRejection&&o.match(v)&&v.meta.condition||c(v),v}();return Object.assign(_,{abort:m,requestId:h,arg:l,unwrap(){return _.then(YHt)}})}}return Object.assign(a,{pending:s,rejected:o,fulfilled:r,settled:UHt(o,r),typePrefix:e})}return n.withTypes=()=>n,n})();function YHt(n){if(n.meta&&n.meta.rejectedWithValue)throw n.payload;if(n.error)throw n.error;return n.payload}function ZHt(n){return n!==null&&typeof n=="object"&&typeof n.then=="function"}var XHt=Symbol.for("rtk-slice-createasyncthunk");function QHt(n,e){return`${n}/${e}`}function JHt({creators:n}={}){const e=n?.asyncThunk?.[XHt];return function(i){const{name:r,reducerPath:s=r}=i;if(!r)throw new Error(M_(11));const o=(typeof i.reducers=="function"?i.reducers(tVt()):i.reducers)||{},a=Object.keys(o),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(v,y){const C=typeof v=="string"?v:v.type;if(!C)throw new Error(M_(12));if(C in l.sliceCaseReducersByType)throw new Error(M_(13));return l.sliceCaseReducersByType[C]=y,c},addMatcher(v,y){return l.sliceMatchers.push({matcher:v,reducer:y}),c},exposeAction(v,y){return l.actionCreators[v]=y,c},exposeCaseReducer(v,y){return l.sliceCaseReducersByName[v]=y,c}};a.forEach(v=>{const y=o[v],C={reducerName:v,type:QHt(r,v),createNotation:typeof i.reducers=="function"};iVt(y)?sVt(C,y,c,e):nVt(C,y,c)});function u(){const[v={},y=[],C=void 0]=typeof i.extraReducers=="function"?_$e(i.extraReducers):[i.extraReducers],x={...v,...l.sliceCaseReducersByType};return VHt(i.initialState,k=>{for(let L in x)k.addCase(L,x[L]);for(let L of l.sliceMatchers)k.addMatcher(L.matcher,L.reducer);for(let L of y)k.addMatcher(L.matcher,L.reducer);C&&k.addDefaultCase(C)})}const d=v=>v,h=new Map;let f;function g(v,y){return f||(f=u()),f(v,y)}function p(){return f||(f=u()),f.getInitialState()}function m(v,y=!1){function C(k){let L=k[v];return typeof L>"u"&&y&&(L=p()),L}function x(k=d){const L=uSe(h,y,()=>new WeakMap);return uSe(L,k,()=>{const D={};for(const[I,O]of Object.entries(i.selectors??{}))D[I]=eVt(O,k,p,y);return D})}return{reducerPath:v,getSelectors:x,get selectors(){return x(C)},selectSlice:C}}const _={name:r,reducer:g,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:p,...m(s),injectInto(v,{reducerPath:y,...C}={}){const x=y??s;return v.inject({reducerPath:x,reducer:g},C),{..._,...m(x,!0)}}};return _}}function eVt(n,e,t,i){function r(s,...o){let a=e(s);return typeof a>"u"&&i&&(a=t()),n(a,...o)}return r.unwrapped=n,r}var u$n=JHt();function tVt(){function n(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return n.withTypes=()=>n,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,t){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}},asyncThunk:n}}function nVt({type:n,reducerName:e,createNotation:t},i,r){let s,o;if("reducer"in i){if(t&&!rVt(i))throw new Error(M_(17));s=i.reducer,o=i.prepare}else s=i;r.addCase(n,s).exposeCaseReducer(e,s).exposeAction(e,o?JI(n,o):JI(n))}function iVt(n){return n._reducerDefinitionType==="asyncThunk"}function rVt(n){return n._reducerDefinitionType==="reducerWithPrepare"}function sVt({type:n,reducerName:e},t,i,r){if(!r)throw new Error(M_(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:l,settled:c,options:u}=t,d=r(n,s,u);i.exposeAction(e,d),o&&i.addCase(d.fulfilled,o),a&&i.addCase(d.pending,a),l&&i.addCase(d.rejected,l),c&&i.addMatcher(d.settled,c),i.exposeCaseReducer(e,{fulfilled:o||A3,pending:a||A3,rejected:l||A3,settled:c||A3})}function A3(){}function M_(n){return`Minified Redux Toolkit error #${n}; visit https://redux-toolkit.js.org/Errors?code=${n} for the full message or use the non-minified dev environment for full errors. `}const wi=n=>typeof n=="string",YT=()=>{let n,e;const t=new Promise((i,r)=>{n=i,e=r});return t.resolve=n,t.reject=e,t},fSe=n=>n==null?"":""+n,oVt=(n,e,t)=>{n.forEach(i=>{e[i]&&(t[i]=e[i])})},aVt=/###/g,gSe=n=>n&&n.indexOf("###")>-1?n.replace(aVt,"."):n,pSe=n=>!n||wi(n),eA=(n,e,t)=>{const i=wi(e)?e.split("."):e;let r=0;for(;r{const{obj:i,k:r}=eA(n,e,Object);if(i!==void 0||e.length===1){i[r]=t;return}let s=e[e.length-1],o=e.slice(0,e.length-1),a=eA(n,o,Object);for(;a.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),a=eA(n,o,Object),a?.obj&&typeof a.obj[`${a.k}.${s}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${s}`]=t},lVt=(n,e,t,i)=>{const{obj:r,k:s}=eA(n,e,Object);r[s]=r[s]||[],r[s].push(t)},d7=(n,e)=>{const{obj:t,k:i}=eA(n,e);if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i]},cVt=(n,e,t)=>{const i=d7(n,t);return i!==void 0?i:d7(e,t)},v$e=(n,e,t)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in n?wi(n[i])||n[i]instanceof String||wi(e[i])||e[i]instanceof String?t&&(n[i]=e[i]):v$e(n[i],e[i],t):n[i]=e[i]);return n},Ax=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var uVt={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const dVt=n=>wi(n)?n.replace(/[&<>"'\/]/g,e=>uVt[e]):n;class hVt{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}const fVt=[" ",",","?","!",";"],gVt=new hVt(20),pVt=(n,e,t)=>{e=e||"",t=t||"";const i=fVt.filter(o=>e.indexOf(o)<0&&t.indexOf(o)<0);if(i.length===0)return!0;const r=gVt.getRegExp(`(${i.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!r.test(n);if(!s){const o=n.indexOf(t);o>0&&!r.test(n.substring(0,o))&&(s=!0)}return s},Lne=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!n)return;if(n[e])return Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0;const i=e.split(t);let r=n;for(let s=0;s-1&&ln?.replace("_","-"),mVt={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,e){console?.[n]?.apply?.(console,e)}};let _Vt=class Tne{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||mVt,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),i=0;i{this.observers[i]||(this.observers[i]=new Map);const r=this.observers[i].get(t)||0;this.observers[i].set(t,r+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r{let[a,l]=o;for(let c=0;c{let[a,l]=o;for(let c=0;c1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,o=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],i&&(Array.isArray(i)?a.push(...i):wi(i)&&s?a.push(...i.split(s)):a.push(i)));const l=d7(this.data,a);return!l&&!t&&!i&&e.indexOf(".")>-1&&(e=a[0],t=a[1],i=a.slice(2).join(".")),l||!o||!wi(i)?l:Lne(this.data?.[e]?.[t],i,s)}addResource(e,t,i,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[e,t];i&&(a=a.concat(o?i.split(o):i)),e.indexOf(".")>-1&&(a=e.split("."),r=t,t=a[1]),this.addNamespaces(t),mSe(this.data,a,r),s.silent||this.emit("added",e,t,i,r)}addResources(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in i)(wi(i[s])||Array.isArray(i[s]))&&this.addResource(e,t,s,i[s],{silent:!0});r.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,r,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),r=i,i=t,t=a[1]),this.addNamespaces(t);let l=d7(this.data,a)||{};o.skipCopy||(i=JSON.parse(JSON.stringify(i))),r?v$e(l,i,s):l={...l,...i},mSe(this.data,a,l),o.silent||this.emit("added",e,t,i)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(r=>t[r]&&Object.keys(t[r]).length>0)}toJSON(){return this.data}}var b$e={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,e,t,i,r){return n.forEach(s=>{e=this.processors[s]?.process(e,t,i,r)??e}),e}};const vSe={};class f7 extends FH{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),oVt(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Dp.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};return e==null?!1:this.resolve(e,t)?.res!==void 0}extractFromKey(e,t){let i=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const r=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let s=t.ns||this.options.defaultNS||[];const o=i&&e.indexOf(i)>-1,a=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!pVt(e,i,r);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:wi(s)?[s]:s};const c=e.split(i);(i!==r||i===r&&this.options.ns.indexOf(c[0])>-1)&&(s=c.shift()),e=c.join(r)}return{key:e,namespaces:wi(s)?[s]:s}}translate(e,t,i){if(typeof t!="object"&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),typeof t=="object"&&(t={...t}),t||(t={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=t.returnDetails!==void 0?t.returnDetails:this.options.returnDetails,s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(e[e.length-1],t),l=a[a.length-1],c=t.lng||this.language,u=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c?.toLowerCase()==="cimode"){if(u){const C=t.nsSeparator||this.options.nsSeparator;return r?{res:`${l}${C}${o}`,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:`${l}${C}${o}`}return r?{res:o,usedKey:o,exactUsedKey:o,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(t)}:o}const d=this.resolve(e,t);let h=d?.res;const f=d?.usedKey||o,g=d?.exactUsedKey||o,p=Object.prototype.toString.apply(h),m=["[object Number]","[object Function]","[object RegExp]"],_=t.joinArrays!==void 0?t.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,y=!wi(h)&&typeof h!="boolean"&&typeof h!="number";if(v&&h&&y&&m.indexOf(p)<0&&!(wi(_)&&Array.isArray(h))){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const C=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,h,{...t,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return r?(d.res=C,d.usedParams=this.getUsedParamsDetails(t),d):C}if(s){const C=Array.isArray(h),x=C?[]:{},k=C?g:f;for(const L in h)if(Object.prototype.hasOwnProperty.call(h,L)){const D=`${k}${s}${L}`;x[L]=this.translate(D,{...t,joinArrays:!1,ns:a}),x[L]===D&&(x[L]=h[L])}h=x}}else if(v&&wi(_)&&Array.isArray(h))h=h.join(_),h&&(h=this.extendTranslation(h,e,t,i));else{let C=!1,x=!1;const k=t.count!==void 0&&!wi(t.count),L=f7.hasDefaultValue(t),D=k?this.pluralResolver.getSuffix(c,t.count,t):"",I=t.ordinal&&k?this.pluralResolver.getSuffix(c,t.count,{ordinal:!1}):"",O=k&&!t.ordinal&&t.count===0,M=O&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${D}`]||t[`defaultValue${I}`]||t.defaultValue;!this.isValidLookup(h)&&L&&(C=!0,h=M),this.isValidLookup(h)||(x=!0,h=o);const G=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&x?void 0:h,W=L&&M!==h&&this.options.updateMissing;if(x||C||W){if(this.logger.log(W?"updateKey":"missingKey",c,l,o,W?M:h),s){const Z=this.resolve(o,{...t,keySeparator:!1});Z&&Z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let z=[];const q=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if(this.options.saveMissingTo==="fallback"&&q&&q[0])for(let Z=0;Z{const le=L&&te!==h?te:G;this.options.missingKeyHandler?this.options.missingKeyHandler(Z,l,j,le,W,t):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(Z,l,j,le,W,t),this.emit("missingKey",Z,l,j,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&k?z.forEach(Z=>{const j=this.pluralResolver.getSuffixes(Z,t);O&&t[`defaultValue${this.options.pluralSeparator}zero`]&&j.indexOf(`${this.options.pluralSeparator}zero`)<0&&j.push(`${this.options.pluralSeparator}zero`),j.forEach(te=>{ee([Z],o+te,t[`defaultValue${te}`]||M)})}):ee(z,o,M))}h=this.extendTranslation(h,e,t,d,i),x&&h===o&&this.options.appendNamespaceToMissingKey&&(h=`${l}:${o}`),(x||C)&&this.options.parseMissingKeyHandler&&(h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,C?h:void 0))}return r?(d.res=h,d.usedParams=this.getUsedParamsDetails(t),d):h}extendTranslation(e,t,i,r,s){var o=this;if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const c=wi(e)&&(i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(c){const h=e.match(this.interpolator.nestingRegexp);u=h&&h.length}let d=i.replace&&!wi(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,i.lng||this.language||r.usedLng,i),c){const h=e.match(this.interpolator.nestingRegexp),f=h&&h.length;u1&&arguments[1]!==void 0?arguments[1]:{},i,r,s,o,a;return wi(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(i))return;const c=this.extractFromKey(l,t),u=c.key;r=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const h=t.count!==void 0&&!wi(t.count),f=h&&!t.ordinal&&t.count===0,g=t.context!==void 0&&(wi(t.context)||typeof t.context=="number")&&t.context!=="",p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);d.forEach(m=>{this.isValidLookup(i)||(a=m,!vSe[`${p[0]}-${m}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)&&(vSe[`${p[0]}-${m}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(_=>{if(this.isValidLookup(i))return;o=_;const v=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(v,u,_,m,t);else{let C;h&&(C=this.pluralResolver.getSuffix(_,t.count,t));const x=`${this.options.pluralSeparator}zero`,k=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(v.push(u+C),t.ordinal&&C.indexOf(k)===0&&v.push(u+C.replace(k,this.options.pluralSeparator)),f&&v.push(u+x)),g){const L=`${u}${this.options.contextSeparator}${t.context}`;v.push(L),h&&(v.push(L+C),t.ordinal&&C.indexOf(k)===0&&v.push(L+C.replace(k,this.options.pluralSeparator)),f&&v.push(L+x))}}let y;for(;y=v.pop();)this.isValidLookup(i)||(s=y,i=this.getResource(_,m,y,t))}))})}),{res:i,usedKey:r,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,i,r):this.resourceStore.getResource(e,t,i,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!wi(e.replace);let r=i?e.replace:e;if(i&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!i){r={...r};for(const s of t)delete r[s]}return r}static hasDefaultValue(e){const t="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,t.length)&&e[i]!==void 0)return!0;return!1}}class bSe{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Dp.create("languageUtils")}getScriptPartFromCode(e){if(e=h7(e),!e||e.indexOf("-")<0)return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=h7(e),!e||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(wi(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(i=>{if(t)return;const r=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(r))&&(t=r)}),!t&&this.options.supportedLngs&&e.forEach(i=>{if(t)return;const r=this.getLanguagePartFromCode(i);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(s=>{if(s===r)return s;if(!(s.indexOf("-")<0&&r.indexOf("-")<0)&&(s.indexOf("-")>0&&r.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===r||s.indexOf(r)===0&&r.length>1))return s})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),wi(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}toResolveHierarchy(e,t){const i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),r=[],s=o=>{o&&(this.isSupportedCode(o)?r.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return wi(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):wi(e)&&s(this.formatLanguageCode(e)),i.forEach(o=>{r.indexOf(o)<0&&s(this.formatLanguageCode(o))}),r}}const ySe={zero:0,one:1,two:2,few:3,many:4,other:5},wSe={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class vVt{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=Dp.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=h7(e==="dev"?"en":e),r=t.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:i,type:r});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(i,{type:r})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),wSe;if(!e.match(/-|_/))return wSe;const l=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(l,t)}return this.pluralRulesCache[s]=o,o}needsPlural(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,i).map(r=>`${t}${r}`)}getSuffixes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(e,t);return i||(i=this.getRule("dev",t)),i?i.resolvedOptions().pluralCategories.sort((r,s)=>ySe[r]-ySe[s]).map(r=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,i);return r?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,i))}}const CSe=function(n,e,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=cVt(n,e,t);return!s&&r&&wi(t)&&(s=Lne(n,t,i),s===void 0&&(s=Lne(e,t,i))),s},vK=n=>n.replace(/\$/g,"$$$$");class bVt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Dp.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(t=>t),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:i,useRawValueToEscape:r,prefix:s,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:c,unescapeSuffix:u,unescapePrefix:d,nestingPrefix:h,nestingPrefixEscaped:f,nestingSuffix:g,nestingSuffixEscaped:p,nestingOptionsSeparator:m,maxReplaces:_,alwaysFormat:v}=e.interpolation;this.escape=t!==void 0?t:dVt,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=s?Ax(s):o||"{{",this.suffix=a?Ax(a):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=u?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=h?Ax(h):f||Ax("$t("),this.nestingSuffix=g?Ax(g):p||Ax(")"),this.nestingOptionsSeparator=m||",",this.maxReplaces=_||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,i)=>t?.source===i?(t.lastIndex=0,t):new RegExp(i,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,i,r){let s,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=f=>{if(f.indexOf(this.formatSeparator)<0){const _=CSe(t,l,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(_,void 0,i,{...r,...t,interpolationkey:f}):_}const g=f.split(this.formatSeparator),p=g.shift().trim(),m=g.join(this.formatSeparator).trim();return this.format(CSe(t,l,p,this.options.keySeparator,this.options.ignoreJSONStructure),m,i,{...r,...t,interpolationkey:p})};this.resetRegExp();const u=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>vK(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?vK(this.escape(f)):vK(f)}].forEach(f=>{for(a=0;s=f.regex.exec(e);){const g=s[1].trim();if(o=c(g),o===void 0)if(typeof u=="function"){const m=u(e,s,r);o=wi(m)?m:""}else if(r&&Object.prototype.hasOwnProperty.call(r,g))o="";else if(d){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),o="";else!wi(o)&&!this.useRawValueToEscape&&(o=fSe(o));const p=f.safeValue(o);if(e=e.replace(s[0],p),d?(f.regex.lastIndex+=o.length,f.regex.lastIndex-=s[0].length):f.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,s,o;const a=(l,c)=>{const u=this.nestingOptionsSeparator;if(l.indexOf(u)<0)return l;const d=l.split(new RegExp(`${u}[ ]*{`));let h=`{${d[1]}`;l=d[0],h=this.interpolate(h,o);const f=h.match(/'/g),g=h.match(/"/g);((f?.length??0)%2===0&&!g||g.length%2!==0)&&(h=h.replace(/'/g,'"'));try{o=JSON.parse(h),c&&(o={...c,...o})}catch(p){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,p),`${l}${u}${h}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];o={...i},o=o.replace&&!wi(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let c=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const u=r[1].split(this.formatSeparator).map(d=>d.trim());r[1]=u.shift(),l=u,c=!0}if(s=t(a.call(this,r[1].trim(),o),o),s&&r[0]===e&&!wi(s))return s;wi(s)||(s=fSe(s)),s||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),s=""),c&&(s=l.reduce((u,d)=>this.format(u,d,i.lng,{...i,interpolationkey:r[1].trim()}),s.trim())),e=e.replace(r[0],s),this.regexp.lastIndex=0}return e}}const yVt=n=>{let e=n.toLowerCase().trim();const t={};if(n.indexOf("(")>-1){const i=n.split("(");e=i[0].toLowerCase().trim();const r=i[1].substring(0,i[1].length-1);e==="currency"&&r.indexOf(":")<0?t.currency||(t.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?t.range||(t.range=r.trim()):r.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),u=a.trim();t[u]||(t[u]=c),c==="false"&&(t[u]=!1),c==="true"&&(t[u]=!0),isNaN(c)||(t[u]=parseInt(c,10))}})}return{formatName:e,formatOptions:t}},Nx=n=>{const e={};return(t,i,r)=>{let s=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(s={...s,[r.interpolationkey]:void 0});const o=i+JSON.stringify(s);let a=e[o];return a||(a=n(h7(i),r),e[o]=a),a(t)}};class wVt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Dp.create("formatter"),this.options=e,this.formats={number:Nx((t,i)=>{const r=new Intl.NumberFormat(t,{...i});return s=>r.format(s)}),currency:Nx((t,i)=>{const r=new Intl.NumberFormat(t,{...i,style:"currency"});return s=>r.format(s)}),datetime:Nx((t,i)=>{const r=new Intl.DateTimeFormat(t,{...i});return s=>r.format(s)}),relativetime:Nx((t,i)=>{const r=new Intl.RelativeTimeFormat(t,{...i});return s=>r.format(s,i.range||"day")}),list:Nx((t,i)=>{const r=new Intl.ListFormat(t,{...i});return s=>r.format(s)})},this.init(e)}init(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Nx(t)}format(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=t.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(a=>a.indexOf(")")>-1)){const a=s.findIndex(l=>l.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,a)].join(this.formatSeparator)}return s.reduce((a,l)=>{const{formatName:c,formatOptions:u}=yVt(l);if(this.formats[c]){let d=a;try{const h=r?.formatParams?.[r.interpolationkey]||{},f=h.locale||h.lng||r.locale||r.lng||i;d=this.formats[c](a,f,{...u,...r,...h})}catch(h){this.logger.warn(h)}return d}else this.logger.warn(`there was no format function for ${c}`);return a},e)}}const CVt=(n,e)=>{n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)};class xVt extends FH{constructor(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=r,this.logger=Dp.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(i,r.backend,r)}queueLoad(e,t,i,r){const s={},o={},a={},l={};return e.forEach(c=>{let u=!0;t.forEach(d=>{const h=`${c}|${d}`;!i.reload&&this.store.hasResourceBundle(c,d)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?o[h]===void 0&&(o[h]=!0):(this.state[h]=1,u=!1,o[h]===void 0&&(o[h]=!0),s[h]===void 0&&(s[h]=!0),l[d]===void 0&&(l[d]=!0)))}),u||(a[c]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,t,i){const r=e.split("|"),s=r[0],o=r[1];t&&this.emit("failedLoading",s,o,t),!t&&i&&this.store.addResourceBundle(s,o,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);const a={};this.queue.forEach(l=>{lVt(l.loaded,[s],o),CVt(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});const u=l.loaded[c];u.length&&u.forEach(d=>{a[c][d]===void 0&&(a[c][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,t,i){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:i,tried:r,wait:s,callback:o});return}this.readingCalls++;const a=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&r{this.read.call(this,e,t,i,r+1,s*2,o)},s);return}o(c,u)},l=this.backend[i].bind(this.backend);if(l.length===2){try{const c=l(e,t);c&&typeof c.then=="function"?c.then(u=>a(null,u)).catch(a):a(null,c)}catch(c){a(c)}return}return l(e,t,a)}prepareLoading(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();wi(e)&&(e=this.languageUtils.toResolveHierarchy(e)),wi(t)&&(t=[t]);const s=this.queueLoad(e,t,i,r);if(!s.toLoad.length)return s.pending.length||r(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const i=e.split("|"),r=i[0],s=i[1];this.read(r,s,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${t}loading namespace ${s} for language ${r} failed`,o),!o&&a&&this.logger.log(`${t}loaded namespace ${s} for language ${r}`,a),this.loaded(e,o,a)})}saveMissing(e,t,i,r,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${i}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(i==null||i==="")){if(this.backend?.create){const l={...o,isUpdate:s},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,t,i,r,l):u=c(e,t,i,r),u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}else c(e,t,i,r,a,l)}!e||!e[0]||this.store.addResource(e[0],t,i,r)}}}const xSe=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:n=>{let e={};if(typeof n[1]=="object"&&(e=n[1]),wi(n[1])&&(e.defaultValue=n[1]),wi(n[2])&&(e.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const t=n[3]||n[2];Object.keys(t).forEach(i=>{e[i]=t[i]})}return e},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),SSe=n=>(wi(n.ns)&&(n.ns=[n.ns]),wi(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),wi(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs?.indexOf?.("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),typeof n.initImmediate=="boolean"&&(n.initAsync=n.initImmediate),n),N3=()=>{},SVt=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(t=>{typeof n[t]=="function"&&(n[t]=n[t].bind(n))})};let y$e=class Dne extends FH{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;if(super(),this.options=SSe(e),this.services={},this.logger=Dp,this.modules={external:[]},SVt(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof t=="function"&&(i=t,t={}),t.defaultNS==null&&t.ns&&(wi(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=xSe();this.options={...r,...this.options,...SSe(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const s=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Dp.init(s(this.modules.logger),this.options):Dp.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=wVt;const d=new bSe(this.options);this.store=new _Se(this.options.resources,this.options);const h=this.services;h.logger=Dp,h.resourceStore=this.store,h.languageUtils=d,h.pluralResolver=new vVt(d,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(h.formatter=s(u),h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new bVt(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new xVt(s(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",function(f){for(var g=arguments.length,p=new Array(g>1?g-1:0),m=1;m1?g-1:0),m=1;m{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,i||(i=N3),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const l=YT(),c=()=>{const u=(d,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(h),i(d,h)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),l}loadResources(e){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:N3;const r=wi(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const s=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&s.indexOf(c)<0&&s.push(c)})};r?o(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload?.forEach?.(a=>o(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(a)})}else i(null)}reloadResources(e,t,i){const r=YT();return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),i||(i=N3),this.services.backendConnector.reload(e,t,s=>{r.resolve(),i(s)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&b$e.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}}changeLanguage(e,t){var i=this;this.isLanguageChangingTo=e;const r=YT();this.emit("languageChanging",e);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,c)=>{c?(s(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve(function(){return i.t(...arguments)}),t&&t(l,function(){return i.t(...arguments)})},a=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const c=wi(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);c&&(this.language||s(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,u=>{o(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),r}getFixedT(e,t,i){var r=this;const s=function(o,a){let l;if(typeof a!="object"){for(var c=arguments.length,u=new Array(c>2?c-2:0),d=2;d`${l.keyPrefix}${h}${g}`):f=l.keyPrefix?`${l.keyPrefix}${h}${o}`:o,r.t(f,l)};return wi(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=i,s}t(){for(var e=arguments.length,t=new Array(e),i=0;i1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===0||c===2};if(t.precheck){const a=t.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(i,e)&&(!r||o(s,e)))}loadNamespaces(e,t){const i=YT();return this.options.ns?(wi(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{i.resolve(),t&&t(r)}),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){const i=YT();wi(e)&&(e=[e]);const r=this.options.preload||[],s=e.filter(o=>r.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=r.concat(s),this.loadResources(o=>{i.resolve(),t&&t(o)}),i):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],i=this.services?.languageUtils||new bSe(xSe());return t.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new Dne(e,t)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:N3;const i=e.forkResourceStore;i&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},s=new Dne(r);if((e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},i){const a=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},Object.keys(l[c]).reduce((u,d)=>(u[d]={...l[c][d]},u),{})),{});s.store=new _Se(a,r),s.services.resourceStore=s.store}return s.translator=new f7(s.services,r),s.translator.on("*",function(a){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;u{if(e)for(const t in e)n[t]===void 0&&(n[t]=e[t])}),n}const kSe=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,TVt=function(n,e){const i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},r=encodeURIComponent(e);let s=`${n}=${r}`;if(i.maxAge>0){const o=i.maxAge-0;if(Number.isNaN(o))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(o)}`}if(i.domain){if(!kSe.test(i.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${i.domain}`}if(i.path){if(!kSe.test(i.path))throw new TypeError("option path is invalid");s+=`; Path=${i.path}`}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+=`; Expires=${i.expires.toUTCString()}`}if(i.httpOnly&&(s+="; HttpOnly"),i.secure&&(s+="; Secure"),i.sameSite)switch(typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return s},ESe={create(n,e,t,i){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};t&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+t*60*1e3)),i&&(r.domain=i),document.cookie=TVt(n,encodeURIComponent(e),r)},read(n){const e=`${n}=`,t=document.cookie.split(";");for(let i=0;i-1&&(i=window.location.hash.substring(window.location.hash.indexOf("?")));const s=i.substring(1).split("&");for(let o=0;o0&&s[o].substring(0,a)===e&&(t=s[o].substring(a+1))}}return t}};let ZT=null;const LSe=()=>{if(ZT!==null)return ZT;try{ZT=window!=="undefined"&&window.localStorage!==null;const n="i18next.translate.boo";window.localStorage.setItem(n,"foo"),window.localStorage.removeItem(n)}catch{ZT=!1}return ZT};var AVt={name:"localStorage",lookup(n){let{lookupLocalStorage:e}=n;if(e&&LSe())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(n,e){let{lookupLocalStorage:t}=e;t&&LSe()&&window.localStorage.setItem(t,n)}};let XT=null;const TSe=()=>{if(XT!==null)return XT;try{XT=window!=="undefined"&&window.sessionStorage!==null;const n="i18next.translate.boo";window.sessionStorage.setItem(n,"foo"),window.sessionStorage.removeItem(n)}catch{XT=!1}return XT};var NVt={name:"sessionStorage",lookup(n){let{lookupSessionStorage:e}=n;if(e&&TSe())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(n,e){let{lookupSessionStorage:t}=e;t&&TSe()&&window.sessionStorage.setItem(t,n)}},RVt={name:"navigator",lookup(n){const e=[];if(typeof navigator<"u"){const{languages:t,userLanguage:i,language:r}=navigator;if(t)for(let s=0;s0?e:void 0}},PVt={name:"htmlTag",lookup(n){let{htmlTag:e}=n,t;const i=e||(typeof document<"u"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(t=i.getAttribute("lang")),t}},OVt={name:"path",lookup(n){let{lookupFromPathIndex:e}=n;if(typeof window>"u")return;const t=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?t[typeof e=="number"?e:0]?.replace("/",""):void 0}},MVt={name:"subdomain",lookup(n){let{lookupFromSubdomainIndex:e}=n;const t=typeof e=="number"?e+1:1,i=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(i)return i[t]}};let w$e=!1;try{document.cookie,w$e=!0}catch{}const C$e=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];w$e||C$e.splice(1,1);const FVt=()=>({order:C$e,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:n=>n});class BVt{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=LVt(t,this.options||{},FVt()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=r=>r.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(DVt),this.addDetector(IVt),this.addDetector(AVt),this.addDetector(NVt),this.addDetector(RVt),this.addDetector(PVt),this.addDetector(OVt),this.addDetector(MVt)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,t=[];return e.forEach(i=>{if(this.detectors[i]){let r=this.detectors[i].lookup(this.options);r&&typeof r=="string"&&(r=[r]),r&&(t=t.concat(r))}}),t=t.map(i=>this.options.convertDetectedLanguage(i)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(i=>{this.detectors[i]&&this.detectors[i].cacheUserLanguage(e,this.options)}))}}BVt.type="languageDetector";/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) * Released under the MIT license @@ -879,7 +879,7 @@ ${e.toString()}`}}class i9{constructor(e=new c2,t=!1,i,r=_Dt){this._services=e,t * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) * Released under the MIT license * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt - *-----------------------------------------------------------------------------*/var VVt={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"}],folding:{markers:{start:new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:))")}}},zVt=["abstract","activate","and","any","array","as","asc","assert","autonomous","begin","bigdecimal","blob","boolean","break","bulk","by","case","cast","catch","char","class","collect","commit","const","continue","convertcurrency","decimal","default","delete","desc","do","double","else","end","enum","exception","exit","export","extends","false","final","finally","float","for","from","future","get","global","goto","group","having","hint","if","implements","import","in","inner","insert","instanceof","int","interface","into","join","last_90_days","last_month","last_n_days","last_week","like","limit","list","long","loop","map","merge","native","new","next_90_days","next_month","next_n_days","next_week","not","null","nulls","number","object","of","on","or","outer","override","package","parallel","pragma","private","protected","public","retrieve","return","returning","rollback","savepoint","search","select","set","short","sort","stat","static","strictfp","super","switch","synchronized","system","testmethod","then","this","this_month","this_week","throw","throws","today","tolabel","tomorrow","transaction","transient","trigger","true","try","type","undelete","update","upsert","using","virtual","void","volatile","webservice","when","where","while","yesterday"],UVt=n=>n.charAt(0).toUpperCase()+n.substr(1),E5=[];zVt.forEach(n=>{E5.push(n),E5.push(n.toUpperCase()),E5.push(UVt(n))});var jVt={defaultToken:"",tokenPostfix:".apex",keywords:E5,operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],symbols:/[=>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/@\s*[a-zA-Z_\$][\w\$]*/,"annotation"],[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/,"number.float"],[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/,"number.float"],[/(@digits)[fFdD]/,"number.float"],[/(@digits)[lL]?/,"number"],[/[;,.]/,"delimiter"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"],[/'[^\\']'/,"string"],[/(')(@escapes)(')/,["string","string.escape","string"]],[/'/,"string.invalid"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@apexdoc"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[\/*]/,"comment"]],apexdoc:[[/[^\/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[\/*]/,"comment.doc"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]]}};const qVt=Object.freeze(Object.defineProperty({__proto__:null,conf:VVt,language:jVt},Symbol.toStringTag,{value:"Module"}));/*!----------------------------------------------------------------------------- + *-----------------------------------------------------------------------------*/var VVt={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"<",close:">"}],folding:{markers:{start:new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:))")}}},zVt=["abstract","activate","and","any","array","as","asc","assert","autonomous","begin","bigdecimal","blob","boolean","break","bulk","by","case","cast","catch","char","class","collect","commit","const","continue","convertcurrency","decimal","default","delete","desc","do","double","else","end","enum","exception","exit","export","extends","false","final","finally","float","for","from","future","get","global","goto","group","having","hint","if","implements","import","in","inner","insert","instanceof","int","interface","into","join","last_90_days","last_month","last_n_days","last_week","like","limit","list","long","loop","map","merge","native","new","next_90_days","next_month","next_n_days","next_week","not","null","nulls","number","object","of","on","or","outer","override","package","parallel","pragma","private","protected","public","retrieve","return","returning","rollback","savepoint","search","select","set","short","sort","stat","static","strictfp","super","switch","synchronized","system","testmethod","then","this","this_month","this_week","throw","throws","today","tolabel","tomorrow","transaction","transient","trigger","true","try","type","undelete","update","upsert","using","virtual","void","volatile","webservice","when","where","while","yesterday"],UVt=n=>n.charAt(0).toUpperCase()+n.substr(1),EF=[];zVt.forEach(n=>{EF.push(n),EF.push(n.toUpperCase()),EF.push(UVt(n))});var jVt={defaultToken:"",tokenPostfix:".apex",keywords:EF,operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],symbols:/[=>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/@\s*[a-zA-Z_\$][\w\$]*/,"annotation"],[/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/,"number.float"],[/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/,"number.float"],[/(@digits)[fFdD]/,"number.float"],[/(@digits)[lL]?/,"number"],[/[;,.]/,"delimiter"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"],[/'[^\\']'/,"string"],[/(')(@escapes)(')/,["string","string.escape","string"]],[/'/,"string.invalid"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@apexdoc"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[\/*]/,"comment"]],apexdoc:[[/[^\/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[\/*]/,"comment.doc"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]]}};const qVt=Object.freeze(Object.defineProperty({__proto__:null,conf:VVt,language:jVt},Symbol.toStringTag,{value:"Module"}));/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) * Released under the MIT license @@ -1619,7 +1619,7 @@ ${e.toString()}`}}class i9{constructor(e=new c2,t=!1,i,r=_Dt){this._services=e,t * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt *-----------------------------------------------------------------------------*/var TZt=Object.defineProperty,DZt=Object.getOwnPropertyDescriptor,IZt=Object.getOwnPropertyNames,AZt=Object.prototype.hasOwnProperty,NZt=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of IZt(e))!AZt.call(n,r)&&r!==t&&TZt(n,r,{get:()=>e[r],enumerable:!(i=DZt(e,r))||i.enumerable});return n},RZt=(n,e,t)=>(NZt(n,e,"default"),t),en={};RZt(en,el);var yWe=class{constructor(n,e){this._modeId=n,this._defaults=e,this._worker=null,this._client=null,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker()),this._updateExtraLibsToken=0,this._extraLibsChangeListener=this._defaults.onDidExtraLibsChange(()=>this._updateExtraLibs())}dispose(){this._configChangeListener.dispose(),this._extraLibsChangeListener.dispose(),this._stopWorker()}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}async _updateExtraLibs(){if(!this._worker)return;const n=++this._updateExtraLibsToken,e=await this._worker.getProxy();this._updateExtraLibsToken===n&&e.updateExtraLibs(this._defaults.getExtraLibs())}_getClient(){return this._client||(this._client=(async()=>(this._worker=en.editor.createWebWorker({moduleId:"vs/language/typescript/tsWorker",label:this._modeId,keepIdleModels:!0,createData:{compilerOptions:this._defaults.getCompilerOptions(),extraLibs:this._defaults.getExtraLibs(),customWorkerPath:this._defaults.workerOptions.customWorkerPath,inlayHintsOptions:this._defaults.inlayHintsOptions}}),this._defaults.getEagerModelSync()?await this._worker.withSyncedResources(en.editor.getModels().filter(n=>n.getLanguageId()===this._modeId).map(n=>n.uri)):await this._worker.getProxy()))()),this._client}async getLanguageServiceWorker(...n){const e=await this._getClient();return this._worker&&await this._worker.withSyncedResources(n),e}},Bt={};Bt["lib.d.ts"]=!0;Bt["lib.decorators.d.ts"]=!0;Bt["lib.decorators.legacy.d.ts"]=!0;Bt["lib.dom.asynciterable.d.ts"]=!0;Bt["lib.dom.d.ts"]=!0;Bt["lib.dom.iterable.d.ts"]=!0;Bt["lib.es2015.collection.d.ts"]=!0;Bt["lib.es2015.core.d.ts"]=!0;Bt["lib.es2015.d.ts"]=!0;Bt["lib.es2015.generator.d.ts"]=!0;Bt["lib.es2015.iterable.d.ts"]=!0;Bt["lib.es2015.promise.d.ts"]=!0;Bt["lib.es2015.proxy.d.ts"]=!0;Bt["lib.es2015.reflect.d.ts"]=!0;Bt["lib.es2015.symbol.d.ts"]=!0;Bt["lib.es2015.symbol.wellknown.d.ts"]=!0;Bt["lib.es2016.array.include.d.ts"]=!0;Bt["lib.es2016.d.ts"]=!0;Bt["lib.es2016.full.d.ts"]=!0;Bt["lib.es2016.intl.d.ts"]=!0;Bt["lib.es2017.d.ts"]=!0;Bt["lib.es2017.date.d.ts"]=!0;Bt["lib.es2017.full.d.ts"]=!0;Bt["lib.es2017.intl.d.ts"]=!0;Bt["lib.es2017.object.d.ts"]=!0;Bt["lib.es2017.sharedmemory.d.ts"]=!0;Bt["lib.es2017.string.d.ts"]=!0;Bt["lib.es2017.typedarrays.d.ts"]=!0;Bt["lib.es2018.asyncgenerator.d.ts"]=!0;Bt["lib.es2018.asynciterable.d.ts"]=!0;Bt["lib.es2018.d.ts"]=!0;Bt["lib.es2018.full.d.ts"]=!0;Bt["lib.es2018.intl.d.ts"]=!0;Bt["lib.es2018.promise.d.ts"]=!0;Bt["lib.es2018.regexp.d.ts"]=!0;Bt["lib.es2019.array.d.ts"]=!0;Bt["lib.es2019.d.ts"]=!0;Bt["lib.es2019.full.d.ts"]=!0;Bt["lib.es2019.intl.d.ts"]=!0;Bt["lib.es2019.object.d.ts"]=!0;Bt["lib.es2019.string.d.ts"]=!0;Bt["lib.es2019.symbol.d.ts"]=!0;Bt["lib.es2020.bigint.d.ts"]=!0;Bt["lib.es2020.d.ts"]=!0;Bt["lib.es2020.date.d.ts"]=!0;Bt["lib.es2020.full.d.ts"]=!0;Bt["lib.es2020.intl.d.ts"]=!0;Bt["lib.es2020.number.d.ts"]=!0;Bt["lib.es2020.promise.d.ts"]=!0;Bt["lib.es2020.sharedmemory.d.ts"]=!0;Bt["lib.es2020.string.d.ts"]=!0;Bt["lib.es2020.symbol.wellknown.d.ts"]=!0;Bt["lib.es2021.d.ts"]=!0;Bt["lib.es2021.full.d.ts"]=!0;Bt["lib.es2021.intl.d.ts"]=!0;Bt["lib.es2021.promise.d.ts"]=!0;Bt["lib.es2021.string.d.ts"]=!0;Bt["lib.es2021.weakref.d.ts"]=!0;Bt["lib.es2022.array.d.ts"]=!0;Bt["lib.es2022.d.ts"]=!0;Bt["lib.es2022.error.d.ts"]=!0;Bt["lib.es2022.full.d.ts"]=!0;Bt["lib.es2022.intl.d.ts"]=!0;Bt["lib.es2022.object.d.ts"]=!0;Bt["lib.es2022.regexp.d.ts"]=!0;Bt["lib.es2022.sharedmemory.d.ts"]=!0;Bt["lib.es2022.string.d.ts"]=!0;Bt["lib.es2023.array.d.ts"]=!0;Bt["lib.es2023.collection.d.ts"]=!0;Bt["lib.es2023.d.ts"]=!0;Bt["lib.es2023.full.d.ts"]=!0;Bt["lib.es5.d.ts"]=!0;Bt["lib.es6.d.ts"]=!0;Bt["lib.esnext.collection.d.ts"]=!0;Bt["lib.esnext.d.ts"]=!0;Bt["lib.esnext.decorators.d.ts"]=!0;Bt["lib.esnext.disposable.d.ts"]=!0;Bt["lib.esnext.full.d.ts"]=!0;Bt["lib.esnext.intl.d.ts"]=!0;Bt["lib.esnext.object.d.ts"]=!0;Bt["lib.esnext.promise.d.ts"]=!0;Bt["lib.scripthost.d.ts"]=!0;Bt["lib.webworker.asynciterable.d.ts"]=!0;Bt["lib.webworker.d.ts"]=!0;Bt["lib.webworker.importscripts.d.ts"]=!0;Bt["lib.webworker.iterable.d.ts"]=!0;function A7(n,e,t=0){if(typeof n=="string")return n;if(n===void 0)return"";let i="";if(t){i+=e;for(let r=0;re.text).join(""):""}var mf=class{constructor(n){this._worker=n}_textSpanToRange(n,e){let t=n.getPositionAt(e.start),i=n.getPositionAt(e.start+e.length),{lineNumber:r,column:s}=t,{lineNumber:o,column:a}=i;return{startLineNumber:r,startColumn:s,endLineNumber:o,endColumn:a}}},wWe=class{constructor(n){this._worker=n,this._libFiles={},this._hasFetchedLibFiles=!1,this._fetchLibFilesPromise=null}isLibFile(n){return n&&n.path.indexOf("/lib.")===0?!!Bt[n.path.slice(1)]:!1}getOrCreateModel(n){const e=en.Uri.parse(n),t=en.editor.getModel(e);if(t)return t;if(this.isLibFile(e)&&this._hasFetchedLibFiles)return en.editor.createModel(this._libFiles[e.path.slice(1)],"typescript",e);const i=wue.getExtraLibs()[n];return i?en.editor.createModel(i.content,"typescript",e):null}_containsLibFile(n){for(let e of n)if(this.isLibFile(e))return!0;return!1}async fetchLibFilesIfNecessary(n){this._containsLibFile(n)&&await this._fetchLibFiles()}_fetchLibFiles(){return this._fetchLibFilesPromise||(this._fetchLibFilesPromise=this._worker().then(n=>n.getLibFiles()).then(n=>{this._hasFetchedLibFiles=!0,this._libFiles=n})),this._fetchLibFilesPromise}},CWe=class extends mf{constructor(n,e,t,i){super(i),this._libFiles=n,this._defaults=e,this._selector=t,this._disposables=[],this._listener=Object.create(null);const r=a=>{if(a.getLanguageId()!==t)return;const l=()=>{const{onlyVisible:h}=this._defaults.getDiagnosticsOptions();h?a.isAttachedToEditor()&&this._doValidate(a):this._doValidate(a)};let c;const u=a.onDidChangeContent(()=>{clearTimeout(c),c=window.setTimeout(l,500)}),d=a.onDidChangeAttached(()=>{const{onlyVisible:h}=this._defaults.getDiagnosticsOptions();h&&(a.isAttachedToEditor()?l():en.editor.setModelMarkers(a,this._selector,[]))});this._listener[a.uri.toString()]={dispose(){u.dispose(),d.dispose(),clearTimeout(c)}},l()},s=a=>{en.editor.setModelMarkers(a,this._selector,[]);const l=a.uri.toString();this._listener[l]&&(this._listener[l].dispose(),delete this._listener[l])};this._disposables.push(en.editor.onDidCreateModel(a=>r(a))),this._disposables.push(en.editor.onWillDisposeModel(s)),this._disposables.push(en.editor.onDidChangeModelLanguage(a=>{s(a.model),r(a.model)})),this._disposables.push({dispose(){for(const a of en.editor.getModels())s(a)}});const o=()=>{for(const a of en.editor.getModels())s(a),r(a)};this._disposables.push(this._defaults.onDidChange(o)),this._disposables.push(this._defaults.onDidExtraLibsChange(o)),en.editor.getModels().forEach(a=>r(a))}dispose(){this._disposables.forEach(n=>n&&n.dispose()),this._disposables=[]}async _doValidate(n){const e=await this._worker(n.uri);if(n.isDisposed())return;const t=[],{noSyntaxValidation:i,noSemanticValidation:r,noSuggestionDiagnostics:s}=this._defaults.getDiagnosticsOptions();i||t.push(e.getSyntacticDiagnostics(n.uri.toString())),r||t.push(e.getSemanticDiagnostics(n.uri.toString())),s||t.push(e.getSuggestionDiagnostics(n.uri.toString()));const o=await Promise.all(t);if(!o||n.isDisposed())return;const a=o.reduce((c,u)=>u.concat(c),[]).filter(c=>(this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore||[]).indexOf(c.code)===-1),l=a.map(c=>c.relatedInformation||[]).reduce((c,u)=>u.concat(c),[]).map(c=>c.file?en.Uri.parse(c.file.fileName):null);await this._libFiles.fetchLibFilesIfNecessary(l),!n.isDisposed()&&en.editor.setModelMarkers(n,this._selector,a.map(c=>this._convertDiagnostics(n,c)))}_convertDiagnostics(n,e){const t=e.start||0,i=e.length||1,{lineNumber:r,column:s}=n.getPositionAt(t),{lineNumber:o,column:a}=n.getPositionAt(t+i),l=[];return e.reportsUnnecessary&&l.push(en.MarkerTag.Unnecessary),e.reportsDeprecated&&l.push(en.MarkerTag.Deprecated),{severity:this._tsDiagnosticCategoryToMarkerSeverity(e.category),startLineNumber:r,startColumn:s,endLineNumber:o,endColumn:a,message:A7(e.messageText,` `),code:e.code.toString(),tags:l,relatedInformation:this._convertRelatedInformation(n,e.relatedInformation)}}_convertRelatedInformation(n,e){if(!e)return[];const t=[];return e.forEach(i=>{let r=n;if(i.file&&(r=this._libFiles.getOrCreateModel(i.file.fileName)),!r)return;const s=i.start||0,o=i.length||1,{lineNumber:a,column:l}=r.getPositionAt(s),{lineNumber:c,column:u}=r.getPositionAt(s+o);t.push({resource:r.uri,startLineNumber:a,startColumn:l,endLineNumber:c,endColumn:u,message:A7(i.messageText,` -`)})}),t}_tsDiagnosticCategoryToMarkerSeverity(n){switch(n){case 1:return en.MarkerSeverity.Error;case 3:return en.MarkerSeverity.Info;case 0:return en.MarkerSeverity.Warning;case 2:return en.MarkerSeverity.Hint}return en.MarkerSeverity.Info}},xWe=class L5 extends mf{get triggerCharacters(){return["."]}async provideCompletionItems(e,t,i,r){const s=e.getWordUntilPosition(t),o=new en.Range(t.lineNumber,s.startColumn,t.lineNumber,s.endColumn),a=e.uri,l=e.getOffsetAt(t),c=await this._worker(a);if(e.isDisposed())return;const u=await c.getCompletionsAtPosition(a.toString(),l);return!u||e.isDisposed()?void 0:{suggestions:u.entries.map(h=>{let f=o;if(h.replacementSpan){const p=e.getPositionAt(h.replacementSpan.start),m=e.getPositionAt(h.replacementSpan.start+h.replacementSpan.length);f=new en.Range(p.lineNumber,p.column,m.lineNumber,m.column)}const g=[];return h.kindModifiers!==void 0&&h.kindModifiers.indexOf("deprecated")!==-1&&g.push(en.languages.CompletionItemTag.Deprecated),{uri:a,position:t,offset:l,range:f,label:h.name,insertText:h.name,sortText:h.sortText,kind:L5.convertKind(h.kind),tags:g}})}}async resolveCompletionItem(e,t){const i=e,r=i.uri,s=i.position,o=i.offset,l=await(await this._worker(r)).getCompletionEntryDetails(r.toString(),o,i.label);return l?{uri:r,position:s,label:l.name,kind:L5.convertKind(l.kind),detail:vp(l.displayParts),documentation:{value:L5.createDocumentationString(l)}}:i}static convertKind(e){switch(e){case Ur.primitiveType:case Ur.keyword:return en.languages.CompletionItemKind.Keyword;case Ur.variable:case Ur.localVariable:return en.languages.CompletionItemKind.Variable;case Ur.memberVariable:case Ur.memberGetAccessor:case Ur.memberSetAccessor:return en.languages.CompletionItemKind.Field;case Ur.function:case Ur.memberFunction:case Ur.constructSignature:case Ur.callSignature:case Ur.indexSignature:return en.languages.CompletionItemKind.Function;case Ur.enum:return en.languages.CompletionItemKind.Enum;case Ur.module:return en.languages.CompletionItemKind.Module;case Ur.class:return en.languages.CompletionItemKind.Class;case Ur.interface:return en.languages.CompletionItemKind.Interface;case Ur.warning:return en.languages.CompletionItemKind.File}return en.languages.CompletionItemKind.Property}static createDocumentationString(e){let t=vp(e.documentation);if(e.tags)for(const i of e.tags)t+=` +`)})}),t}_tsDiagnosticCategoryToMarkerSeverity(n){switch(n){case 1:return en.MarkerSeverity.Error;case 3:return en.MarkerSeverity.Info;case 0:return en.MarkerSeverity.Warning;case 2:return en.MarkerSeverity.Hint}return en.MarkerSeverity.Info}},xWe=class LF extends mf{get triggerCharacters(){return["."]}async provideCompletionItems(e,t,i,r){const s=e.getWordUntilPosition(t),o=new en.Range(t.lineNumber,s.startColumn,t.lineNumber,s.endColumn),a=e.uri,l=e.getOffsetAt(t),c=await this._worker(a);if(e.isDisposed())return;const u=await c.getCompletionsAtPosition(a.toString(),l);return!u||e.isDisposed()?void 0:{suggestions:u.entries.map(h=>{let f=o;if(h.replacementSpan){const p=e.getPositionAt(h.replacementSpan.start),m=e.getPositionAt(h.replacementSpan.start+h.replacementSpan.length);f=new en.Range(p.lineNumber,p.column,m.lineNumber,m.column)}const g=[];return h.kindModifiers!==void 0&&h.kindModifiers.indexOf("deprecated")!==-1&&g.push(en.languages.CompletionItemTag.Deprecated),{uri:a,position:t,offset:l,range:f,label:h.name,insertText:h.name,sortText:h.sortText,kind:LF.convertKind(h.kind),tags:g}})}}async resolveCompletionItem(e,t){const i=e,r=i.uri,s=i.position,o=i.offset,l=await(await this._worker(r)).getCompletionEntryDetails(r.toString(),o,i.label);return l?{uri:r,position:s,label:l.name,kind:LF.convertKind(l.kind),detail:vp(l.displayParts),documentation:{value:LF.createDocumentationString(l)}}:i}static convertKind(e){switch(e){case Ur.primitiveType:case Ur.keyword:return en.languages.CompletionItemKind.Keyword;case Ur.variable:case Ur.localVariable:return en.languages.CompletionItemKind.Variable;case Ur.memberVariable:case Ur.memberGetAccessor:case Ur.memberSetAccessor:return en.languages.CompletionItemKind.Field;case Ur.function:case Ur.memberFunction:case Ur.constructSignature:case Ur.callSignature:case Ur.indexSignature:return en.languages.CompletionItemKind.Function;case Ur.enum:return en.languages.CompletionItemKind.Enum;case Ur.module:return en.languages.CompletionItemKind.Module;case Ur.class:return en.languages.CompletionItemKind.Class;case Ur.interface:return en.languages.CompletionItemKind.Interface;case Ur.warning:return en.languages.CompletionItemKind.File}return en.languages.CompletionItemKind.Property}static createDocumentationString(e){let t=vp(e.documentation);if(e.tags)for(const i of e.tags)t+=` ${SWe(i)}`;return t}};function SWe(n){let e=`*@${n.name}*`;if(n.name==="param"&&n.text){const[t,...i]=n.text;e+=`\`${t.text}\``,i.length>0&&(e+=` — ${i.map(r=>r.text).join(" ")}`)}else Array.isArray(n.text)?e+=` — ${n.text.map(t=>t.text).join(" ")}`:n.text&&(e+=` — ${n.text}`);return e}var kWe=class EWe extends mf{constructor(){super(...arguments),this.signatureHelpTriggerCharacters=["(",","]}static _toSignatureHelpTriggerReason(e){switch(e.triggerKind){case en.languages.SignatureHelpTriggerKind.TriggerCharacter:return e.triggerCharacter?e.isRetrigger?{kind:"retrigger",triggerCharacter:e.triggerCharacter}:{kind:"characterTyped",triggerCharacter:e.triggerCharacter}:{kind:"invoked"};case en.languages.SignatureHelpTriggerKind.ContentChange:return e.isRetrigger?{kind:"retrigger"}:{kind:"invoked"};case en.languages.SignatureHelpTriggerKind.Invoke:default:return{kind:"invoked"}}}async provideSignatureHelp(e,t,i,r){const s=e.uri,o=e.getOffsetAt(t),a=await this._worker(s);if(e.isDisposed())return;const l=await a.getSignatureHelpItems(s.toString(),o,{triggerReason:EWe._toSignatureHelpTriggerReason(r)});if(!l||e.isDisposed())return;const c={activeSignature:l.selectedItemIndex,activeParameter:l.argumentIndex,signatures:[]};return l.items.forEach(u=>{const d={label:"",parameters:[]};d.documentation={value:vp(u.documentation)},d.label+=vp(u.prefixDisplayParts),u.parameters.forEach((h,f,g)=>{const p=vp(h.displayParts),m={label:p,documentation:{value:vp(h.documentation)}};d.label+=p,d.parameters.push(m),fSWe(u)).join(` @@ -1627,7 +1627,7 @@ ${SWe(i)}`;return t}};function SWe(n){let e=`*@${n.name}*`;if(n.name==="param"&& `+l:"")}]}}},TWe=class extends mf{async provideDocumentHighlights(n,e,t){const i=n.uri,r=n.getOffsetAt(e),s=await this._worker(i);if(n.isDisposed())return;const o=await s.getDocumentHighlights(i.toString(),r,[i.toString()]);if(!(!o||n.isDisposed()))return o.flatMap(a=>a.highlightSpans.map(l=>({range:this._textSpanToRange(n,l.textSpan),kind:l.kind==="writtenReference"?en.languages.DocumentHighlightKind.Write:en.languages.DocumentHighlightKind.Text})))}},DWe=class extends mf{constructor(n,e){super(e),this._libFiles=n}async provideDefinition(n,e,t){const i=n.uri,r=n.getOffsetAt(e),s=await this._worker(i);if(n.isDisposed())return;const o=await s.getDefinitionAtPosition(i.toString(),r);if(!o||n.isDisposed()||(await this._libFiles.fetchLibFilesIfNecessary(o.map(l=>en.Uri.parse(l.fileName))),n.isDisposed()))return;const a=[];for(let l of o){const c=this._libFiles.getOrCreateModel(l.fileName);c&&a.push({uri:c.uri,range:this._textSpanToRange(c,l.textSpan)})}return a}},IWe=class extends mf{constructor(n,e){super(e),this._libFiles=n}async provideReferences(n,e,t,i){const r=n.uri,s=n.getOffsetAt(e),o=await this._worker(r);if(n.isDisposed())return;const a=await o.getReferencesAtPosition(r.toString(),s);if(!a||n.isDisposed()||(await this._libFiles.fetchLibFilesIfNecessary(a.map(c=>en.Uri.parse(c.fileName))),n.isDisposed()))return;const l=[];for(let c of a){const u=this._libFiles.getOrCreateModel(c.fileName);u&&l.push({uri:u.uri,range:this._textSpanToRange(u,c.textSpan)})}return l}},AWe=class extends mf{async provideDocumentSymbols(n,e){const t=n.uri,i=await this._worker(t);if(n.isDisposed())return;const r=await i.getNavigationTree(t.toString());if(!r||n.isDisposed())return;const s=(a,l)=>({name:a.text,detail:"",kind:wu[a.kind]||en.languages.SymbolKind.Variable,range:this._textSpanToRange(n,a.spans[0]),selectionRange:this._textSpanToRange(n,a.spans[0]),tags:[],children:a.childItems?.map(u=>s(u,a.text)),containerName:l});return r.childItems?r.childItems.map(a=>s(a)):[]}},Ur=class{static{this.unknown=""}static{this.keyword="keyword"}static{this.script="script"}static{this.module="module"}static{this.class="class"}static{this.interface="interface"}static{this.type="type"}static{this.enum="enum"}static{this.variable="var"}static{this.localVariable="local var"}static{this.function="function"}static{this.localFunction="local function"}static{this.memberFunction="method"}static{this.memberGetAccessor="getter"}static{this.memberSetAccessor="setter"}static{this.memberVariable="property"}static{this.constructorImplementation="constructor"}static{this.callSignature="call"}static{this.indexSignature="index"}static{this.constructSignature="construct"}static{this.parameter="parameter"}static{this.typeParameter="type parameter"}static{this.primitiveType="primitive type"}static{this.label="label"}static{this.alias="alias"}static{this.const="const"}static{this.let="let"}static{this.warning="warning"}},wu=Object.create(null);wu[Ur.module]=en.languages.SymbolKind.Module;wu[Ur.class]=en.languages.SymbolKind.Class;wu[Ur.enum]=en.languages.SymbolKind.Enum;wu[Ur.interface]=en.languages.SymbolKind.Interface;wu[Ur.memberFunction]=en.languages.SymbolKind.Method;wu[Ur.memberVariable]=en.languages.SymbolKind.Property;wu[Ur.memberGetAccessor]=en.languages.SymbolKind.Property;wu[Ur.memberSetAccessor]=en.languages.SymbolKind.Property;wu[Ur.variable]=en.languages.SymbolKind.Variable;wu[Ur.const]=en.languages.SymbolKind.Variable;wu[Ur.localVariable]=en.languages.SymbolKind.Variable;wu[Ur.variable]=en.languages.SymbolKind.Variable;wu[Ur.function]=en.languages.SymbolKind.Function;wu[Ur.localFunction]=en.languages.SymbolKind.Function;var eC=class extends mf{static _convertOptions(n){return{ConvertTabsToSpaces:n.insertSpaces,TabSize:n.tabSize,IndentSize:n.tabSize,IndentStyle:2,NewLineCharacter:` `,InsertSpaceAfterCommaDelimiter:!0,InsertSpaceAfterSemicolonInForStatements:!0,InsertSpaceBeforeAndAfterBinaryOperators:!0,InsertSpaceAfterKeywordsInControlFlowStatements:!0,InsertSpaceAfterFunctionKeywordForAnonymousFunctions:!0,InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis:!1,InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets:!1,InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces:!1,PlaceOpenBraceOnNewLineForControlBlocks:!1,PlaceOpenBraceOnNewLineForFunctions:!1}}_convertTextChanges(n,e){return{text:e.newText,range:this._textSpanToRange(n,e.span)}}},NWe=class extends eC{constructor(){super(...arguments),this.canFormatMultipleRanges=!1}async provideDocumentRangeFormattingEdits(n,e,t,i){const r=n.uri,s=n.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),o=n.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),a=await this._worker(r);if(n.isDisposed())return;const l=await a.getFormattingEditsForRange(r.toString(),s,o,eC._convertOptions(t));if(!(!l||n.isDisposed()))return l.map(c=>this._convertTextChanges(n,c))}},RWe=class extends eC{get autoFormatTriggerCharacters(){return[";","}",` -`]}async provideOnTypeFormattingEdits(n,e,t,i,r){const s=n.uri,o=n.getOffsetAt(e),a=await this._worker(s);if(n.isDisposed())return;const l=await a.getFormattingEditsAfterKeystroke(s.toString(),o,t,eC._convertOptions(i));if(!(!l||n.isDisposed()))return l.map(c=>this._convertTextChanges(n,c))}},PWe=class extends eC{async provideCodeActions(n,e,t,i){const r=n.uri,s=n.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),o=n.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),a=eC._convertOptions(n.getOptions()),l=t.markers.filter(h=>h.code).map(h=>h.code).map(Number),c=await this._worker(r);if(n.isDisposed())return;const u=await c.getCodeFixesAtPosition(r.toString(),s,o,l,a);return!u||n.isDisposed()?{actions:[],dispose:()=>{}}:{actions:u.filter(h=>h.changes.filter(f=>f.isNewFile).length===0).map(h=>this._tsCodeFixActionToMonacoCodeAction(n,t,h)),dispose:()=>{}}}_tsCodeFixActionToMonacoCodeAction(n,e,t){const i=[];for(const s of t.changes)for(const o of s.textChanges)i.push({resource:n.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(n,o.span),text:o.newText}});return{title:t.description,edit:{edits:i},diagnostics:e.markers,kind:"quickfix"}}},OWe=class extends mf{constructor(n,e){super(e),this._libFiles=n}async provideRenameEdits(n,e,t,i){const r=n.uri,s=r.toString(),o=n.getOffsetAt(e),a=await this._worker(r);if(n.isDisposed())return;const l=await a.getRenameInfo(s,o,{allowRenameOfImportPath:!1});if(l.canRename===!1)return{edits:[],rejectReason:l.localizedErrorMessage};if(l.fileToRename!==void 0)throw new Error("Renaming files is not supported.");const c=await a.findRenameLocations(s,o,!1,!1,!1);if(!c||n.isDisposed())return;const u=[];for(const d of c){const h=this._libFiles.getOrCreateModel(d.fileName);if(h)u.push({resource:h.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(h,d.textSpan),text:t}});else throw new Error(`Unknown file ${d.fileName}.`)}return{edits:u}}},MWe=class extends mf{async provideInlayHints(n,e,t){const i=n.uri,r=i.toString(),s=n.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),o=n.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),a=await this._worker(i);return n.isDisposed()?null:{hints:(await a.provideInlayHints(r,s,o)).map(u=>({...u,label:u.text,position:n.getPositionAt(u.position),kind:this._convertHintKind(u.kind)})),dispose:()=>{}}}_convertHintKind(n){switch(n){case"Parameter":return en.languages.InlayHintKind.Parameter;case"Type":return en.languages.InlayHintKind.Type;default:return en.languages.InlayHintKind.Type}}},Sie,kie;function PZt(n){kie=FWe(n,"typescript")}function OZt(n){Sie=FWe(n,"javascript")}function MZt(){return new Promise((n,e)=>{if(!Sie)return e("JavaScript not registered!");n(Sie)})}function FZt(){return new Promise((n,e)=>{if(!kie)return e("TypeScript not registered!");n(kie)})}function FWe(n,e){const t=[],i=new yWe(e,n),r=(...a)=>i.getLanguageServiceWorker(...a),s=new wWe(r);function o(){const{modeConfiguration:a}=n;BZt(t),a.completionItems&&t.push(en.languages.registerCompletionItemProvider(e,new xWe(r))),a.signatureHelp&&t.push(en.languages.registerSignatureHelpProvider(e,new kWe(r))),a.hovers&&t.push(en.languages.registerHoverProvider(e,new LWe(r))),a.documentHighlights&&t.push(en.languages.registerDocumentHighlightProvider(e,new TWe(r))),a.definitions&&t.push(en.languages.registerDefinitionProvider(e,new DWe(s,r))),a.references&&t.push(en.languages.registerReferenceProvider(e,new IWe(s,r))),a.documentSymbols&&t.push(en.languages.registerDocumentSymbolProvider(e,new AWe(r))),a.rename&&t.push(en.languages.registerRenameProvider(e,new OWe(s,r))),a.documentRangeFormattingEdits&&t.push(en.languages.registerDocumentRangeFormattingEditProvider(e,new NWe(r))),a.onTypeFormattingEdits&&t.push(en.languages.registerOnTypeFormattingEditProvider(e,new RWe(r))),a.codeActions&&t.push(en.languages.registerCodeActionProvider(e,new PWe(r))),a.inlayHints&&t.push(en.languages.registerInlayHintsProvider(e,new MWe(r))),a.diagnostics&&t.push(new CWe(s,n,e,r))}return o(),r}function BZt(n){for(;n.length;)n.pop().dispose()}const $Zt=Object.freeze(Object.defineProperty({__proto__:null,Adapter:mf,CodeActionAdaptor:PWe,DefinitionAdapter:DWe,DiagnosticsAdapter:CWe,DocumentHighlightAdapter:TWe,FormatAdapter:NWe,FormatHelper:eC,FormatOnTypeAdapter:RWe,InlayHintsAdapter:MWe,Kind:Ur,LibFiles:wWe,OutlineAdapter:AWe,QuickInfoAdapter:LWe,ReferenceAdapter:IWe,RenameAdapter:OWe,SignatureHelpAdapter:kWe,SuggestAdapter:xWe,WorkerManager:yWe,flattenDiagnosticMessageText:A7,getJavaScriptWorker:MZt,getTypeScriptWorker:FZt,setupJavaScript:OZt,setupTypeScript:PZt},Symbol.toStringTag,{value:"Module"}));function WZt(n){const e=E.useRef(n);return E.useEffect(()=>{e.current=n}),E.useMemo(()=>(...t)=>e.current?.(...t),[])}function HZt(n,e=globalThis?.document){const t=WZt(n);E.useEffect(()=>{const i=r=>{r.key==="Escape"&&t(r)};return e.addEventListener("keydown",i,{capture:!0}),()=>e.removeEventListener("keydown",i,{capture:!0})},[t,e])}var VZt="DismissableLayer",Eie="dismissableLayer.update",zZt="dismissableLayer.pointerDownOutside",UZt="dismissableLayer.focusOutside",PLe,BWe=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),b2=E.forwardRef((n,e)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=n,c=E.useContext(BWe),[u,d]=E.useState(null),h=u?.ownerDocument??globalThis?.document,[,f]=E.useState({}),g=gi(e,L=>d(L)),p=Array.from(c.layers),[m]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),_=p.indexOf(m),v=u?p.indexOf(u):-1,y=c.layersWithOutsidePointerEventsDisabled.size>0,C=v>=_,x=KZt(L=>{const D=L.target,I=[...c.branches].some(O=>O.contains(D));!C||I||(r?.(L),o?.(L),L.defaultPrevented||a?.())},h),k=GZt(L=>{const D=L.target;[...c.branches].some(O=>O.contains(D))||(s?.(L),o?.(L),L.defaultPrevented||a?.())},h);return HZt(L=>{v===c.layers.size-1&&(i?.(L),!L.defaultPrevented&&a&&(L.preventDefault(),a()))},h),E.useEffect(()=>{if(u)return t&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(PLe=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),OLe(),()=>{t&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=PLe)}},[u,h,t,c]),E.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),OLe())},[u,c]),E.useEffect(()=>{const L=()=>f({});return document.addEventListener(Eie,L),()=>document.removeEventListener(Eie,L)},[]),ae.jsx(Pn.div,{...l,ref:g,style:{pointerEvents:y?C?"auto":"none":void 0,...n.style},onFocusCapture:Kt(n.onFocusCapture,k.onFocusCapture),onBlurCapture:Kt(n.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Kt(n.onPointerDownCapture,x.onPointerDownCapture)})});b2.displayName=VZt;var jZt="DismissableLayerBranch",qZt=E.forwardRef((n,e)=>{const t=E.useContext(BWe),i=E.useRef(null),r=gi(e,i);return E.useEffect(()=>{const s=i.current;if(s)return t.branches.add(s),()=>{t.branches.delete(s)}},[t.branches]),ae.jsx(Pn.div,{...n,ref:r})});qZt.displayName=jZt;function KZt(n,e=globalThis?.document){const t=Ua(n),i=E.useRef(!1),r=E.useRef(()=>{});return E.useEffect(()=>{const s=a=>{if(a.target&&!i.current){let l=function(){$We(zZt,t,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=l,e.addEventListener("click",r.current,{once:!0})):l()}else e.removeEventListener("click",r.current);i.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",r.current)}},[e,t]),{onPointerDownCapture:()=>i.current=!0}}function GZt(n,e=globalThis?.document){const t=Ua(n),i=E.useRef(!1);return E.useEffect(()=>{const r=s=>{s.target&&!i.current&&$We(UZt,t,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,t]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function OLe(){const n=new CustomEvent(Eie);document.dispatchEvent(n)}function $We(n,e,t,{discrete:i}){const r=t.originalEvent.target,s=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&r.addEventListener(n,e,{once:!0}),i?fOe(r,s):r.dispatchEvent(s)}var yK="focusScope.autoFocusOnMount",wK="focusScope.autoFocusOnUnmount",MLe={bubbles:!1,cancelable:!0},YZt="FocusScope",PO=E.forwardRef((n,e)=>{const{loop:t=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...o}=n,[a,l]=E.useState(null),c=Ua(r),u=Ua(s),d=E.useRef(null),h=gi(e,p=>l(p)),f=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(i){let p=function(y){if(f.paused||!a)return;const C=y.target;a.contains(C)?d.current=C:ev(d.current,{select:!0})},m=function(y){if(f.paused||!a)return;const C=y.relatedTarget;C!==null&&(a.contains(C)||ev(d.current,{select:!0}))},_=function(y){if(document.activeElement===document.body)for(const x of y)x.removedNodes.length>0&&ev(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",m);const v=new MutationObserver(_);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",m),v.disconnect()}}},[i,a,f.paused]),E.useEffect(()=>{if(a){BLe.add(f);const p=document.activeElement;if(!a.contains(p)){const _=new CustomEvent(yK,MLe);a.addEventListener(yK,c),a.dispatchEvent(_),_.defaultPrevented||(ZZt(tXt(WWe(a)),{select:!0}),document.activeElement===p&&ev(a))}return()=>{a.removeEventListener(yK,c),setTimeout(()=>{const _=new CustomEvent(wK,MLe);a.addEventListener(wK,u),a.dispatchEvent(_),_.defaultPrevented||ev(p??document.body,{select:!0}),a.removeEventListener(wK,u),BLe.remove(f)},0)}}},[a,c,u,f]);const g=E.useCallback(p=>{if(!t&&!i||f.paused)return;const m=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,_=document.activeElement;if(m&&_){const v=p.currentTarget,[y,C]=XZt(v);y&&C?!p.shiftKey&&_===C?(p.preventDefault(),t&&ev(y,{select:!0})):p.shiftKey&&_===y&&(p.preventDefault(),t&&ev(C,{select:!0})):_===v&&p.preventDefault()}},[t,i,f.paused]);return ae.jsx(Pn.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});PO.displayName=YZt;function ZZt(n,{select:e=!1}={}){const t=document.activeElement;for(const i of n)if(ev(i,{select:e}),document.activeElement!==t)return}function XZt(n){const e=WWe(n),t=FLe(e,n),i=FLe(e.reverse(),n);return[t,i]}function WWe(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function FLe(n,e){for(const t of n)if(!QZt(t,{upTo:e}))return t}function QZt(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function JZt(n){return n instanceof HTMLInputElement&&"select"in n}function ev(n,{select:e=!1}={}){if(n&&n.focus){const t=document.activeElement;n.focus({preventScroll:!0}),n!==t&&JZt(n)&&e&&n.select()}}var BLe=eXt();function eXt(){let n=[];return{add(e){const t=n[0];e!==t&&t?.pause(),n=$Le(n,e),n.unshift(e)},remove(e){n=$Le(n,e),n[0]?.resume()}}}function $Le(n,e){const t=[...n],i=t.indexOf(e);return i!==-1&&t.splice(i,1),t}function tXt(n){return n.filter(e=>e.tagName!=="A")}var nXt="Portal",y2=E.forwardRef((n,e)=>{const{container:t,...i}=n,[r,s]=E.useState(!1);es(()=>s(!0),[]);const o=t||r&&globalThis?.document?.body;return o?p$.createPortal(ae.jsx(Pn.div,{...i,ref:e}),o):null});y2.displayName=nXt;function iXt(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var $H=n=>{const{present:e,children:t}=n,i=rXt(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,sXt(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};$H.displayName="Presence";function rXt(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=iXt(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=R3(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=R3(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=R3(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=R3(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function R3(n){return n?.animationName||"none"}function sXt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var CK=0;function WH(){E.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??WLe()),document.body.insertAdjacentElement("beforeend",n[1]??WLe()),CK++,()=>{CK===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),CK--}},[])}function WLe(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var vc=function(){return vc=Object.assign||function(e){for(var t,i=1,r=arguments.length;i"u")return bXt;var e=yXt(n),t=document.documentElement.clientWidth,i=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,i-t+e[2]-e[0])}},CXt=vXt(),Pk="data-scroll-locked",xXt=function(n,e,t,i){var r=n.left,s=n.top,o=n.right,a=n.gap;return t===void 0&&(t="margin"),` +`]}async provideOnTypeFormattingEdits(n,e,t,i,r){const s=n.uri,o=n.getOffsetAt(e),a=await this._worker(s);if(n.isDisposed())return;const l=await a.getFormattingEditsAfterKeystroke(s.toString(),o,t,eC._convertOptions(i));if(!(!l||n.isDisposed()))return l.map(c=>this._convertTextChanges(n,c))}},PWe=class extends eC{async provideCodeActions(n,e,t,i){const r=n.uri,s=n.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),o=n.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),a=eC._convertOptions(n.getOptions()),l=t.markers.filter(h=>h.code).map(h=>h.code).map(Number),c=await this._worker(r);if(n.isDisposed())return;const u=await c.getCodeFixesAtPosition(r.toString(),s,o,l,a);return!u||n.isDisposed()?{actions:[],dispose:()=>{}}:{actions:u.filter(h=>h.changes.filter(f=>f.isNewFile).length===0).map(h=>this._tsCodeFixActionToMonacoCodeAction(n,t,h)),dispose:()=>{}}}_tsCodeFixActionToMonacoCodeAction(n,e,t){const i=[];for(const s of t.changes)for(const o of s.textChanges)i.push({resource:n.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(n,o.span),text:o.newText}});return{title:t.description,edit:{edits:i},diagnostics:e.markers,kind:"quickfix"}}},OWe=class extends mf{constructor(n,e){super(e),this._libFiles=n}async provideRenameEdits(n,e,t,i){const r=n.uri,s=r.toString(),o=n.getOffsetAt(e),a=await this._worker(r);if(n.isDisposed())return;const l=await a.getRenameInfo(s,o,{allowRenameOfImportPath:!1});if(l.canRename===!1)return{edits:[],rejectReason:l.localizedErrorMessage};if(l.fileToRename!==void 0)throw new Error("Renaming files is not supported.");const c=await a.findRenameLocations(s,o,!1,!1,!1);if(!c||n.isDisposed())return;const u=[];for(const d of c){const h=this._libFiles.getOrCreateModel(d.fileName);if(h)u.push({resource:h.uri,versionId:void 0,textEdit:{range:this._textSpanToRange(h,d.textSpan),text:t}});else throw new Error(`Unknown file ${d.fileName}.`)}return{edits:u}}},MWe=class extends mf{async provideInlayHints(n,e,t){const i=n.uri,r=i.toString(),s=n.getOffsetAt({lineNumber:e.startLineNumber,column:e.startColumn}),o=n.getOffsetAt({lineNumber:e.endLineNumber,column:e.endColumn}),a=await this._worker(i);return n.isDisposed()?null:{hints:(await a.provideInlayHints(r,s,o)).map(u=>({...u,label:u.text,position:n.getPositionAt(u.position),kind:this._convertHintKind(u.kind)})),dispose:()=>{}}}_convertHintKind(n){switch(n){case"Parameter":return en.languages.InlayHintKind.Parameter;case"Type":return en.languages.InlayHintKind.Type;default:return en.languages.InlayHintKind.Type}}},Sie,kie;function PZt(n){kie=FWe(n,"typescript")}function OZt(n){Sie=FWe(n,"javascript")}function MZt(){return new Promise((n,e)=>{if(!Sie)return e("JavaScript not registered!");n(Sie)})}function FZt(){return new Promise((n,e)=>{if(!kie)return e("TypeScript not registered!");n(kie)})}function FWe(n,e){const t=[],i=new yWe(e,n),r=(...a)=>i.getLanguageServiceWorker(...a),s=new wWe(r);function o(){const{modeConfiguration:a}=n;BZt(t),a.completionItems&&t.push(en.languages.registerCompletionItemProvider(e,new xWe(r))),a.signatureHelp&&t.push(en.languages.registerSignatureHelpProvider(e,new kWe(r))),a.hovers&&t.push(en.languages.registerHoverProvider(e,new LWe(r))),a.documentHighlights&&t.push(en.languages.registerDocumentHighlightProvider(e,new TWe(r))),a.definitions&&t.push(en.languages.registerDefinitionProvider(e,new DWe(s,r))),a.references&&t.push(en.languages.registerReferenceProvider(e,new IWe(s,r))),a.documentSymbols&&t.push(en.languages.registerDocumentSymbolProvider(e,new AWe(r))),a.rename&&t.push(en.languages.registerRenameProvider(e,new OWe(s,r))),a.documentRangeFormattingEdits&&t.push(en.languages.registerDocumentRangeFormattingEditProvider(e,new NWe(r))),a.onTypeFormattingEdits&&t.push(en.languages.registerOnTypeFormattingEditProvider(e,new RWe(r))),a.codeActions&&t.push(en.languages.registerCodeActionProvider(e,new PWe(r))),a.inlayHints&&t.push(en.languages.registerInlayHintsProvider(e,new MWe(r))),a.diagnostics&&t.push(new CWe(s,n,e,r))}return o(),r}function BZt(n){for(;n.length;)n.pop().dispose()}const $Zt=Object.freeze(Object.defineProperty({__proto__:null,Adapter:mf,CodeActionAdaptor:PWe,DefinitionAdapter:DWe,DiagnosticsAdapter:CWe,DocumentHighlightAdapter:TWe,FormatAdapter:NWe,FormatHelper:eC,FormatOnTypeAdapter:RWe,InlayHintsAdapter:MWe,Kind:Ur,LibFiles:wWe,OutlineAdapter:AWe,QuickInfoAdapter:LWe,ReferenceAdapter:IWe,RenameAdapter:OWe,SignatureHelpAdapter:kWe,SuggestAdapter:xWe,WorkerManager:yWe,flattenDiagnosticMessageText:A7,getJavaScriptWorker:MZt,getTypeScriptWorker:FZt,setupJavaScript:OZt,setupTypeScript:PZt},Symbol.toStringTag,{value:"Module"}));function WZt(n){const e=E.useRef(n);return E.useEffect(()=>{e.current=n}),E.useMemo(()=>(...t)=>e.current?.(...t),[])}function HZt(n,e=globalThis?.document){const t=WZt(n);E.useEffect(()=>{const i=r=>{r.key==="Escape"&&t(r)};return e.addEventListener("keydown",i,{capture:!0}),()=>e.removeEventListener("keydown",i,{capture:!0})},[t,e])}var VZt="DismissableLayer",Eie="dismissableLayer.update",zZt="dismissableLayer.pointerDownOutside",UZt="dismissableLayer.focusOutside",PLe,BWe=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),b2=E.forwardRef((n,e)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=n,c=E.useContext(BWe),[u,d]=E.useState(null),h=u?.ownerDocument??globalThis?.document,[,f]=E.useState({}),g=gi(e,L=>d(L)),p=Array.from(c.layers),[m]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),_=p.indexOf(m),v=u?p.indexOf(u):-1,y=c.layersWithOutsidePointerEventsDisabled.size>0,C=v>=_,x=KZt(L=>{const D=L.target,I=[...c.branches].some(O=>O.contains(D));!C||I||(r?.(L),o?.(L),L.defaultPrevented||a?.())},h),k=GZt(L=>{const D=L.target;[...c.branches].some(O=>O.contains(D))||(s?.(L),o?.(L),L.defaultPrevented||a?.())},h);return HZt(L=>{v===c.layers.size-1&&(i?.(L),!L.defaultPrevented&&a&&(L.preventDefault(),a()))},h),E.useEffect(()=>{if(u)return t&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(PLe=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),OLe(),()=>{t&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=PLe)}},[u,h,t,c]),E.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),OLe())},[u,c]),E.useEffect(()=>{const L=()=>f({});return document.addEventListener(Eie,L),()=>document.removeEventListener(Eie,L)},[]),ae.jsx(Pn.div,{...l,ref:g,style:{pointerEvents:y?C?"auto":"none":void 0,...n.style},onFocusCapture:Kt(n.onFocusCapture,k.onFocusCapture),onBlurCapture:Kt(n.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Kt(n.onPointerDownCapture,x.onPointerDownCapture)})});b2.displayName=VZt;var jZt="DismissableLayerBranch",qZt=E.forwardRef((n,e)=>{const t=E.useContext(BWe),i=E.useRef(null),r=gi(e,i);return E.useEffect(()=>{const s=i.current;if(s)return t.branches.add(s),()=>{t.branches.delete(s)}},[t.branches]),ae.jsx(Pn.div,{...n,ref:r})});qZt.displayName=jZt;function KZt(n,e=globalThis?.document){const t=Ua(n),i=E.useRef(!1),r=E.useRef(()=>{});return E.useEffect(()=>{const s=a=>{if(a.target&&!i.current){let l=function(){$We(zZt,t,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=l,e.addEventListener("click",r.current,{once:!0})):l()}else e.removeEventListener("click",r.current);i.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",r.current)}},[e,t]),{onPointerDownCapture:()=>i.current=!0}}function GZt(n,e=globalThis?.document){const t=Ua(n),i=E.useRef(!1);return E.useEffect(()=>{const r=s=>{s.target&&!i.current&&$We(UZt,t,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,t]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function OLe(){const n=new CustomEvent(Eie);document.dispatchEvent(n)}function $We(n,e,t,{discrete:i}){const r=t.originalEvent.target,s=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&r.addEventListener(n,e,{once:!0}),i?fOe(r,s):r.dispatchEvent(s)}var yK="focusScope.autoFocusOnMount",wK="focusScope.autoFocusOnUnmount",MLe={bubbles:!1,cancelable:!0},YZt="FocusScope",PO=E.forwardRef((n,e)=>{const{loop:t=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...o}=n,[a,l]=E.useState(null),c=Ua(r),u=Ua(s),d=E.useRef(null),h=gi(e,p=>l(p)),f=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(i){let p=function(y){if(f.paused||!a)return;const C=y.target;a.contains(C)?d.current=C:ev(d.current,{select:!0})},m=function(y){if(f.paused||!a)return;const C=y.relatedTarget;C!==null&&(a.contains(C)||ev(d.current,{select:!0}))},_=function(y){if(document.activeElement===document.body)for(const x of y)x.removedNodes.length>0&&ev(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",m);const v=new MutationObserver(_);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",m),v.disconnect()}}},[i,a,f.paused]),E.useEffect(()=>{if(a){BLe.add(f);const p=document.activeElement;if(!a.contains(p)){const _=new CustomEvent(yK,MLe);a.addEventListener(yK,c),a.dispatchEvent(_),_.defaultPrevented||(ZZt(tXt(WWe(a)),{select:!0}),document.activeElement===p&&ev(a))}return()=>{a.removeEventListener(yK,c),setTimeout(()=>{const _=new CustomEvent(wK,MLe);a.addEventListener(wK,u),a.dispatchEvent(_),_.defaultPrevented||ev(p??document.body,{select:!0}),a.removeEventListener(wK,u),BLe.remove(f)},0)}}},[a,c,u,f]);const g=E.useCallback(p=>{if(!t&&!i||f.paused)return;const m=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,_=document.activeElement;if(m&&_){const v=p.currentTarget,[y,C]=XZt(v);y&&C?!p.shiftKey&&_===C?(p.preventDefault(),t&&ev(y,{select:!0})):p.shiftKey&&_===y&&(p.preventDefault(),t&&ev(C,{select:!0})):_===v&&p.preventDefault()}},[t,i,f.paused]);return ae.jsx(Pn.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});PO.displayName=YZt;function ZZt(n,{select:e=!1}={}){const t=document.activeElement;for(const i of n)if(ev(i,{select:e}),document.activeElement!==t)return}function XZt(n){const e=WWe(n),t=FLe(e,n),i=FLe(e.reverse(),n);return[t,i]}function WWe(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function FLe(n,e){for(const t of n)if(!QZt(t,{upTo:e}))return t}function QZt(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function JZt(n){return n instanceof HTMLInputElement&&"select"in n}function ev(n,{select:e=!1}={}){if(n&&n.focus){const t=document.activeElement;n.focus({preventScroll:!0}),n!==t&&JZt(n)&&e&&n.select()}}var BLe=eXt();function eXt(){let n=[];return{add(e){const t=n[0];e!==t&&t?.pause(),n=$Le(n,e),n.unshift(e)},remove(e){n=$Le(n,e),n[0]?.resume()}}}function $Le(n,e){const t=[...n],i=t.indexOf(e);return i!==-1&&t.splice(i,1),t}function tXt(n){return n.filter(e=>e.tagName!=="A")}var nXt="Portal",y2=E.forwardRef((n,e)=>{const{container:t,...i}=n,[r,s]=E.useState(!1);es(()=>s(!0),[]);const o=t||r&&globalThis?.document?.body;return o?p$.createPortal(ae.jsx(Pn.div,{...i,ref:e}),o):null});y2.displayName=nXt;function iXt(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var $H=n=>{const{present:e,children:t}=n,i=rXt(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,sXt(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};$H.displayName="Presence";function rXt(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=iXt(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=R3(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=R3(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=R3(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=R3(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function R3(n){return n?.animationName||"none"}function sXt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var CK=0;function WH(){E.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??WLe()),document.body.insertAdjacentElement("beforeend",n[1]??WLe()),CK++,()=>{CK===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),CK--}},[])}function WLe(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var vc=function(){return vc=Object.assign||function(e){for(var t,i=1,r=arguments.length;i"u")return bXt;var e=yXt(n),t=document.documentElement.clientWidth,i=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,i-t+e[2]-e[0])}},CXt=vXt(),Pk="data-scroll-locked",xXt=function(n,e,t,i){var r=n.left,s=n.top,o=n.right,a=n.gap;return t===void 0&&(t="margin"),` .`.concat(oXt,` { overflow: hidden `).concat(i,`; padding-right: `).concat(a,"px ").concat(i,`; @@ -1645,19 +1645,19 @@ ${SWe(i)}`;return t}};function SWe(n){let e=`*@${n.name}*`;if(n.name==="param"&& `),t==="padding"&&"padding-right: ".concat(a,"px ").concat(i,";")].filter(Boolean).join(""),` } - .`).concat(T5,` { + .`).concat(TF,` { right: `).concat(a,"px ").concat(i,`; } - .`).concat(D5,` { + .`).concat(DF,` { margin-right: `).concat(a,"px ").concat(i,`; } - .`).concat(T5," .").concat(T5,` { + .`).concat(TF," .").concat(TF,` { right: 0 `).concat(i,`; } - .`).concat(D5," .").concat(D5,` { + .`).concat(DF," .").concat(DF,` { margin-right: 0 `).concat(i,`; } @@ -1671,7 +1671,7 @@ ${SWe(i)}`;return t}};function SWe(n){let e=`*@${n.name}*`;if(n.name==="param"&& If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return E.useEffect(()=>{n&&(document.getElementById(n)||console.error(t))},[t,n]),null},rQt="DialogDescriptionWarning",sQt=({contentRef:n,descriptionId:e})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gHe(rQt).contentName}}.`;return E.useEffect(()=>{const r=n.current?.getAttribute("aria-describedby");e&&r&&(document.getElementById(e)||console.warn(i))},[i,n,e]),null},oQt=eHe,aQt=nHe,lQt=rHe,cQt=sHe,uQt=oHe,dQt=lHe,hQt=uHe,pHe=hHe;function nl(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}var fQt=["color"],Z$n=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,fQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),gQt=["color"],X$n=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,gQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M7.49991 0.877045C3.84222 0.877045 0.877075 3.84219 0.877075 7.49988C0.877075 11.1575 3.84222 14.1227 7.49991 14.1227C11.1576 14.1227 14.1227 11.1575 14.1227 7.49988C14.1227 3.84219 11.1576 0.877045 7.49991 0.877045ZM1.82708 7.49988C1.82708 4.36686 4.36689 1.82704 7.49991 1.82704C10.6329 1.82704 13.1727 4.36686 13.1727 7.49988C13.1727 10.6329 10.6329 13.1727 7.49991 13.1727C4.36689 13.1727 1.82708 10.6329 1.82708 7.49988ZM10.1589 5.53774C10.3178 5.31191 10.2636 5.00001 10.0378 4.84109C9.81194 4.68217 9.50004 4.73642 9.34112 4.96225L6.51977 8.97154L5.35681 7.78706C5.16334 7.59002 4.84677 7.58711 4.64973 7.78058C4.45268 7.97404 4.44978 8.29061 4.64325 8.48765L6.22658 10.1003C6.33054 10.2062 6.47617 10.2604 6.62407 10.2483C6.77197 10.2363 6.90686 10.1591 6.99226 10.0377L10.1589 5.53774Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),pQt=["color"],Q$n=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,pQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),mQt=["color"],J$n=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,mQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),_Qt=["color"],eWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,_Qt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),vQt=["color"],tWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,vQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),bQt=["color"],nWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,bQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M0.877075 7.49991C0.877075 3.84222 3.84222 0.877075 7.49991 0.877075C11.1576 0.877075 14.1227 3.84222 14.1227 7.49991C14.1227 11.1576 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1576 0.877075 7.49991ZM7.49991 1.82708C4.36689 1.82708 1.82708 4.36689 1.82708 7.49991C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49991C13.1727 4.36689 10.6329 1.82708 7.49991 1.82708Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),yQt=["color"],iWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,yQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),wQt=["color"],rWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,wQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704ZM9.85358 5.14644C10.0488 5.3417 10.0488 5.65829 9.85358 5.85355L8.20713 7.49999L9.85358 9.14644C10.0488 9.3417 10.0488 9.65829 9.85358 9.85355C9.65832 10.0488 9.34173 10.0488 9.14647 9.85355L7.50002 8.2071L5.85358 9.85355C5.65832 10.0488 5.34173 10.0488 5.14647 9.85355C4.95121 9.65829 4.95121 9.3417 5.14647 9.14644L6.79292 7.49999L5.14647 5.85355C4.95121 5.65829 4.95121 5.3417 5.14647 5.14644C5.34173 4.95118 5.65832 4.95118 5.85358 5.14644L7.50002 6.79289L9.14647 5.14644C9.34173 4.95118 9.65832 4.95118 9.85358 5.14644Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),CQt=["color"],sWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,CQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",fill:i}))}),xQt=["color"],oWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,xQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M6.85355 3.85355C7.04882 3.65829 7.04882 3.34171 6.85355 3.14645C6.65829 2.95118 6.34171 2.95118 6.14645 3.14645L2.14645 7.14645C1.95118 7.34171 1.95118 7.65829 2.14645 7.85355L6.14645 11.8536C6.34171 12.0488 6.65829 12.0488 6.85355 11.8536C7.04882 11.6583 7.04882 11.3417 6.85355 11.1464L3.20711 7.5L6.85355 3.85355ZM12.8536 3.85355C13.0488 3.65829 13.0488 3.34171 12.8536 3.14645C12.6583 2.95118 12.3417 2.95118 12.1464 3.14645L8.14645 7.14645C7.95118 7.34171 7.95118 7.65829 8.14645 7.85355L12.1464 11.8536C12.3417 12.0488 12.6583 12.0488 12.8536 11.8536C13.0488 11.6583 13.0488 11.3417 12.8536 11.1464L9.20711 7.5L12.8536 3.85355Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),SQt=["color"],aWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,SQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M2.14645 11.1464C1.95118 11.3417 1.95118 11.6583 2.14645 11.8536C2.34171 12.0488 2.65829 12.0488 2.85355 11.8536L6.85355 7.85355C7.04882 7.65829 7.04882 7.34171 6.85355 7.14645L2.85355 3.14645C2.65829 2.95118 2.34171 2.95118 2.14645 3.14645C1.95118 3.34171 1.95118 3.65829 2.14645 3.85355L5.79289 7.5L2.14645 11.1464ZM8.14645 11.1464C7.95118 11.3417 7.95118 11.6583 8.14645 11.8536C8.34171 12.0488 8.65829 12.0488 8.85355 11.8536L12.8536 7.85355C13.0488 7.65829 13.0488 7.34171 12.8536 7.14645L8.85355 3.14645C8.65829 2.95118 8.34171 2.95118 8.14645 3.14645C7.95118 3.34171 7.95118 3.65829 8.14645 3.85355L11.7929 7.5L8.14645 11.1464Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),kQt=["color"],lWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,kQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M5.5 4.625C6.12132 4.625 6.625 4.12132 6.625 3.5C6.625 2.87868 6.12132 2.375 5.5 2.375C4.87868 2.375 4.375 2.87868 4.375 3.5C4.375 4.12132 4.87868 4.625 5.5 4.625ZM9.5 4.625C10.1213 4.625 10.625 4.12132 10.625 3.5C10.625 2.87868 10.1213 2.375 9.5 2.375C8.87868 2.375 8.375 2.87868 8.375 3.5C8.375 4.12132 8.87868 4.625 9.5 4.625ZM10.625 7.5C10.625 8.12132 10.1213 8.625 9.5 8.625C8.87868 8.625 8.375 8.12132 8.375 7.5C8.375 6.87868 8.87868 6.375 9.5 6.375C10.1213 6.375 10.625 6.87868 10.625 7.5ZM5.5 8.625C6.12132 8.625 6.625 8.12132 6.625 7.5C6.625 6.87868 6.12132 6.375 5.5 6.375C4.87868 6.375 4.375 6.87868 4.375 7.5C4.375 8.12132 4.87868 8.625 5.5 8.625ZM10.625 11.5C10.625 12.1213 10.1213 12.625 9.5 12.625C8.87868 12.625 8.375 12.1213 8.375 11.5C8.375 10.8787 8.87868 10.375 9.5 10.375C10.1213 10.375 10.625 10.8787 10.625 11.5ZM5.5 12.625C6.12132 12.625 6.625 12.1213 6.625 11.5C6.625 10.8787 6.12132 10.375 5.5 10.375C4.87868 10.375 4.375 10.8787 4.375 11.5C4.375 12.1213 4.87868 12.625 5.5 12.625Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),EQt=["color"],cWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,EQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),LQt=["color"],uWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,LQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M5.5 3C4.67157 3 4 3.67157 4 4.5C4 5.32843 4.67157 6 5.5 6C6.32843 6 7 5.32843 7 4.5C7 3.67157 6.32843 3 5.5 3ZM3 5C3.01671 5 3.03323 4.99918 3.04952 4.99758C3.28022 6.1399 4.28967 7 5.5 7C6.71033 7 7.71978 6.1399 7.95048 4.99758C7.96677 4.99918 7.98329 5 8 5H13.5C13.7761 5 14 4.77614 14 4.5C14 4.22386 13.7761 4 13.5 4H8C7.98329 4 7.96677 4.00082 7.95048 4.00242C7.71978 2.86009 6.71033 2 5.5 2C4.28967 2 3.28022 2.86009 3.04952 4.00242C3.03323 4.00082 3.01671 4 3 4H1.5C1.22386 4 1 4.22386 1 4.5C1 4.77614 1.22386 5 1.5 5H3ZM11.9505 10.9976C11.7198 12.1399 10.7103 13 9.5 13C8.28967 13 7.28022 12.1399 7.04952 10.9976C7.03323 10.9992 7.01671 11 7 11H1.5C1.22386 11 1 10.7761 1 10.5C1 10.2239 1.22386 10 1.5 10H7C7.01671 10 7.03323 10.0008 7.04952 10.0024C7.28022 8.8601 8.28967 8 9.5 8C10.7103 8 11.7198 8.8601 11.9505 10.0024C11.9668 10.0008 11.9833 10 12 10H13.5C13.7761 10 14 10.2239 14 10.5C14 10.7761 13.7761 11 13.5 11H12C11.9833 11 11.9668 10.9992 11.9505 10.9976ZM8 10.5C8 9.67157 8.67157 9 9.5 9C10.3284 9 11 9.67157 11 10.5C11 11.3284 10.3284 12 9.5 12C8.67157 12 8 11.3284 8 10.5Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),TQt=["color"],dWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,TQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M12.1464 1.14645C12.3417 0.951184 12.6583 0.951184 12.8535 1.14645L14.8535 3.14645C15.0488 3.34171 15.0488 3.65829 14.8535 3.85355L10.9109 7.79618C10.8349 7.87218 10.7471 7.93543 10.651 7.9835L6.72359 9.94721C6.53109 10.0435 6.29861 10.0057 6.14643 9.85355C5.99425 9.70137 5.95652 9.46889 6.05277 9.27639L8.01648 5.34897C8.06455 5.25283 8.1278 5.16507 8.2038 5.08907L12.1464 1.14645ZM12.5 2.20711L8.91091 5.79618L7.87266 7.87267L8.12731 8.12732L10.2038 7.08907L13.7929 3.5L12.5 2.20711ZM9.99998 2L8.99998 3H4.9C4.47171 3 4.18056 3.00039 3.95552 3.01877C3.73631 3.03668 3.62421 3.06915 3.54601 3.10899C3.35785 3.20487 3.20487 3.35785 3.10899 3.54601C3.06915 3.62421 3.03669 3.73631 3.01878 3.95552C3.00039 4.18056 3 4.47171 3 4.9V11.1C3 11.5283 3.00039 11.8194 3.01878 12.0445C3.03669 12.2637 3.06915 12.3758 3.10899 12.454C3.20487 12.6422 3.35785 12.7951 3.54601 12.891C3.62421 12.9309 3.73631 12.9633 3.95552 12.9812C4.18056 12.9996 4.47171 13 4.9 13H11.1C11.5283 13 11.8194 12.9996 12.0445 12.9812C12.2637 12.9633 12.3758 12.9309 12.454 12.891C12.6422 12.7951 12.7951 12.6422 12.891 12.454C12.9309 12.3758 12.9633 12.2637 12.9812 12.0445C12.9996 11.8194 13 11.5283 13 11.1V6.99998L14 5.99998V11.1V11.1207C14 11.5231 14 11.8553 13.9779 12.1259C13.9549 12.407 13.9057 12.6653 13.782 12.908C13.5903 13.2843 13.2843 13.5903 12.908 13.782C12.6653 13.9057 12.407 13.9549 12.1259 13.9779C11.8553 14 11.5231 14 11.1207 14H11.1H4.9H4.87934C4.47686 14 4.14468 14 3.87409 13.9779C3.59304 13.9549 3.33469 13.9057 3.09202 13.782C2.7157 13.5903 2.40973 13.2843 2.21799 12.908C2.09434 12.6653 2.04506 12.407 2.0221 12.1259C1.99999 11.8553 1.99999 11.5231 2 11.1207V11.1206V11.1V4.9V4.87935V4.87932V4.87931C1.99999 4.47685 1.99999 4.14468 2.0221 3.87409C2.04506 3.59304 2.09434 3.33469 2.21799 3.09202C2.40973 2.71569 2.7157 2.40973 3.09202 2.21799C3.33469 2.09434 3.59304 2.04506 3.87409 2.0221C4.14468 1.99999 4.47685 1.99999 4.87932 2H4.87935H4.9H9.99998Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),DQt=["color"],hWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,DQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM7.50003 4C7.77617 4 8.00003 4.22386 8.00003 4.5V7H10.5C10.7762 7 11 7.22386 11 7.5C11 7.77614 10.7762 8 10.5 8H8.00003V10.5C8.00003 10.7761 7.77617 11 7.50003 11C7.22389 11 7.00003 10.7761 7.00003 10.5V8H4.50003C4.22389 8 4.00003 7.77614 4.00003 7.5C4.00003 7.22386 4.22389 7 4.50003 7H7.00003V4.5C7.00003 4.22386 7.22389 4 7.50003 4Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),IQt=["color"],fWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,IQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M0.877075 7.49972C0.877075 3.84204 3.84222 0.876892 7.49991 0.876892C11.1576 0.876892 14.1227 3.84204 14.1227 7.49972C14.1227 11.1574 11.1576 14.1226 7.49991 14.1226C3.84222 14.1226 0.877075 11.1574 0.877075 7.49972ZM7.49991 1.82689C4.36689 1.82689 1.82708 4.36671 1.82708 7.49972C1.82708 10.6327 4.36689 13.1726 7.49991 13.1726C10.6329 13.1726 13.1727 10.6327 13.1727 7.49972C13.1727 4.36671 10.6329 1.82689 7.49991 1.82689ZM8.24993 10.5C8.24993 10.9142 7.91414 11.25 7.49993 11.25C7.08571 11.25 6.74993 10.9142 6.74993 10.5C6.74993 10.0858 7.08571 9.75 7.49993 9.75C7.91414 9.75 8.24993 10.0858 8.24993 10.5ZM6.05003 6.25C6.05003 5.57211 6.63511 4.925 7.50003 4.925C8.36496 4.925 8.95003 5.57211 8.95003 6.25C8.95003 6.74118 8.68002 6.99212 8.21447 7.27494C8.16251 7.30651 8.10258 7.34131 8.03847 7.37854L8.03841 7.37858C7.85521 7.48497 7.63788 7.61119 7.47449 7.73849C7.23214 7.92732 6.95003 8.23198 6.95003 8.7C6.95004 9.00376 7.19628 9.25 7.50004 9.25C7.8024 9.25 8.04778 9.00601 8.05002 8.70417L8.05056 8.7033C8.05924 8.6896 8.08493 8.65735 8.15058 8.6062C8.25207 8.52712 8.36508 8.46163 8.51567 8.37436L8.51571 8.37433C8.59422 8.32883 8.68296 8.27741 8.78559 8.21506C9.32004 7.89038 10.05 7.35382 10.05 6.25C10.05 4.92789 8.93511 3.825 7.50003 3.825C6.06496 3.825 4.95003 4.92789 4.95003 6.25C4.95003 6.55376 5.19628 6.8 5.50003 6.8C5.80379 6.8 6.05003 6.55376 6.05003 6.25Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),AQt=["color"],gWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,AQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M5.49998 0.5C5.49998 0.223858 5.72383 0 5.99998 0H7.49998H8.99998C9.27612 0 9.49998 0.223858 9.49998 0.5C9.49998 0.776142 9.27612 1 8.99998 1H7.99998V2.11922C9.09832 2.20409 10.119 2.56622 10.992 3.13572C11.0116 3.10851 11.0336 3.08252 11.058 3.05806L11.858 2.25806C12.1021 2.01398 12.4978 2.01398 12.7419 2.25806C12.986 2.50214 12.986 2.89786 12.7419 3.14194L11.967 3.91682C13.1595 5.07925 13.9 6.70314 13.9 8.49998C13.9 12.0346 11.0346 14.9 7.49998 14.9C3.96535 14.9 1.09998 12.0346 1.09998 8.49998C1.09998 5.13362 3.69904 2.3743 6.99998 2.11922V1H5.99998C5.72383 1 5.49998 0.776142 5.49998 0.5ZM2.09998 8.49998C2.09998 5.51764 4.51764 3.09998 7.49998 3.09998C10.4823 3.09998 12.9 5.51764 12.9 8.49998C12.9 11.4823 10.4823 13.9 7.49998 13.9C4.51764 13.9 2.09998 11.4823 2.09998 8.49998ZM7.99998 4.5C7.99998 4.22386 7.77612 4 7.49998 4C7.22383 4 6.99998 4.22386 6.99998 4.5V9.5C6.99998 9.77614 7.22383 10 7.49998 10C7.77612 10 7.99998 9.77614 7.99998 9.5V4.5Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),NQt=["title"],RQt=["title"];function R7(){return R7=Object.assign||function(n){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function PQt(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}var pWn=function(e){var t=e.title,i=mHe(e,NQt);return U.createElement("svg",R7({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},i),t&&U.createElement("title",null,t),U.createElement("path",{fill:"#D80027",d:"M0 0h513v342H0z"}),U.createElement("path",{d:"m226.8 239.2-9.7-15.6-17.9 4.4 11.9-14.1-9.7-15.6 17.1 6.9 11.8-14.1-1.3 18.4 17.1 6.9-17.9 4.4zM290.6 82l-10.1 15.4 11.6 14.3-17.7-4.8-10.1 15.5-1-18.4-17.7-4.8 17.2-6.6-1-18.4 11.6 14.3zm-54.4-56.6-2 18.3 16.8 7.6-18 3.8-2 18.3-9.2-16-17.9 3.8 12.3-13.7-9.2-15.9 16.8 7.5zm56.6 136.4-14.9 10.9 5.8 17.5-14.9-10.8-14.9 11 5.6-17.6-14.9-10.7 18.4-.1 5.6-17.6 5.8 17.5zM115 46.3l17.3 53.5h56.2l-45.4 32.9 17.3 53.5-45.4-33-45.5 33 17.4-53.5-45.5-32.9h56.3z",fill:"#FFDA44"}))},mWn=function(e){var t=e.title,i=mHe(e,RQt);return U.createElement("svg",R7({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},i),t&&U.createElement("title",null,t),U.createElement("g",{fill:"#FFF"},U.createElement("path",{d:"M0 0h513v341.3H0V0z"}),U.createElement("path",{d:"M311.7 230 513 341.3v-31.5L369.3 230h-57.6zM200.3 111.3 0 0v31.5l143.7 79.8h56.6z"})),U.createElement("path",{d:"M393.8 230 513 295.7V230H393.8zm-82.1 0L513 341.3v-31.5L369.3 230h-57.6zm146.9 111.3-147-81.7v81.7h147zM90.3 230 0 280.2V230h90.3zm110 14.2v97.2H25.5l174.8-97.2zm-82.1-132.9L0 45.6v65.7h118.2zm82.1 0L0 0v31.5l143.7 79.8h56.6zM53.4 0l147 81.7V0h-147zm368.3 111.3L513 61.1v50.2h-91.3zm-110-14.2V0h174.9L311.7 97.1z",fill:"#0052B4"}),U.createElement("g",{fill:"#D80027"},U.createElement("path",{d:"M288 0h-64v138.7H0v64h224v138.7h64V202.7h224v-64H288V0z"}),U.createElement("path",{d:"M311.7 230 513 341.3v-31.5L369.3 230h-57.6zm-168 0L0 309.9v31.5L200.3 230h-56.6zm56.6-118.7L0 0v31.5l143.7 79.8h56.6zm168 0L513 31.5V0L311.7 111.3h56.6z"})))};const OQt=["top","right","bottom","left"],Wb=Math.min,Rd=Math.max,P7=Math.round,B3=Math.floor,Hb=n=>({x:n,y:n}),MQt={left:"right",right:"left",bottom:"top",top:"bottom"},FQt={start:"end",end:"start"};function Die(n,e,t){return Rd(n,Wb(e,t))}function s0(n,e){return typeof n=="function"?n(e):n}function o0(n){return n.split("-")[0]}function w2(n){return n.split("-")[1]}function che(n){return n==="x"?"y":"x"}function uhe(n){return n==="y"?"height":"width"}function C2(n){return["top","bottom"].includes(o0(n))?"y":"x"}function dhe(n){return che(C2(n))}function BQt(n,e,t){t===void 0&&(t=!1);const i=w2(n),r=dhe(n),s=uhe(r);let o=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=O7(o)),[o,O7(o)]}function $Qt(n){const e=O7(n);return[Iie(n),e,Iie(e)]}function Iie(n){return n.replace(/start|end/g,e=>FQt[e])}function WQt(n,e,t){const i=["left","right"],r=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?r:i:e?i:r;case"left":case"right":return e?s:o;default:return[]}}function HQt(n,e,t,i){const r=w2(n);let s=WQt(o0(n),t==="start",i);return r&&(s=s.map(o=>o+"-"+r),e&&(s=s.concat(s.map(Iie)))),s}function O7(n){return n.replace(/left|right|bottom|top/g,e=>MQt[e])}function VQt(n){return{top:0,right:0,bottom:0,left:0,...n}}function _He(n){return typeof n!="number"?VQt(n):{top:n,right:n,bottom:n,left:n}}function M7(n){return{...n,top:n.y,left:n.x,right:n.x+n.width,bottom:n.y+n.height}}function qLe(n,e,t){let{reference:i,floating:r}=n;const s=C2(e),o=dhe(e),a=uhe(o),l=o0(e),c=s==="y",u=i.x+i.width/2-r.width/2,d=i.y+i.height/2-r.height/2,h=i[a]/2-r[a]/2;let f;switch(l){case"top":f={x:u,y:i.y-r.height};break;case"bottom":f={x:u,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:d};break;case"left":f={x:i.x-r.width,y:d};break;default:f={x:i.x,y:i.y}}switch(w2(e)){case"start":f[o]-=h*(t&&c?-1:1);break;case"end":f[o]+=h*(t&&c?-1:1);break}return f}const zQt=async(n,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:r}),{x:u,y:d}=qLe(c,i,l),h=i,f={},g=0;for(let p=0;p({name:"arrow",options:n,async fn(e){const{x:t,y:i,placement:r,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=s0(n,e)||{};if(c==null)return{};const d=_He(u),h={x:t,y:i},f=dhe(r),g=uhe(f),p=await o.getDimensions(c),m=f==="y",_=m?"top":"left",v=m?"bottom":"right",y=m?"clientHeight":"clientWidth",C=s.reference[g]+s.reference[f]-h[f]-s.floating[g],x=h[f]-s.reference[f],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let L=k?k[y]:0;(!L||!await(o.isElement==null?void 0:o.isElement(k)))&&(L=a.floating[y]||s.floating[g]);const D=C/2-x/2,I=L/2-p[g]/2-1,O=Wb(d[_],I),M=Wb(d[v],I),B=O,G=L-p[g]-M,W=L/2-p[g]/2+D,z=Die(B,W,G),q=!l.arrow&&w2(r)!=null&&W!==z&&s.reference[g]/2-(WB<=0)){var I,O;const B=(((I=s.flip)==null?void 0:I.index)||0)+1,G=x[B];if(G)return{data:{index:B,overflows:D},reset:{placement:G}};let W=(O=D.filter(z=>z.overflows[0]<=0).sort((z,q)=>z.overflows[1]-q.overflows[1])[0])==null?void 0:O.placement;if(!W)switch(f){case"bestFit":{var M;const z=(M=D.map(q=>[q.placement,q.overflows.filter(ee=>ee>0).reduce((ee,Z)=>ee+Z,0)]).sort((q,ee)=>q[1]-ee[1])[0])==null?void 0:M[0];z&&(W=z);break}case"initialPlacement":W=a;break}if(r!==W)return{reset:{placement:W}}}return{}}}};function KLe(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function GLe(n){return OQt.some(e=>n[e]>=0)}const qQt=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:i="referenceHidden",...r}=s0(n,e);switch(i){case"referenceHidden":{const s=await RR(e,{...r,elementContext:"reference"}),o=KLe(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:GLe(o)}}}case"escaped":{const s=await RR(e,{...r,altBoundary:!0}),o=KLe(s,t.floating);return{data:{escapedOffsets:o,escaped:GLe(o)}}}default:return{}}}}};async function KQt(n,e){const{placement:t,platform:i,elements:r}=n,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=o0(t),a=w2(t),l=C2(t)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,d=s0(e,n);let{mainAxis:h,crossAxis:f,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&typeof g=="number"&&(f=a==="end"?g*-1:g),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const GQt=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,i;const{x:r,y:s,placement:o,middlewareData:a}=e,l=await KQt(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:o}}}}},YQt=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:i,placement:r}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:m=>{let{x:_,y:v}=m;return{x:_,y:v}}},...l}=s0(n,e),c={x:t,y:i},u=await RR(e,l),d=C2(o0(r)),h=che(d);let f=c[h],g=c[d];if(s){const m=h==="y"?"top":"left",_=h==="y"?"bottom":"right",v=f+u[m],y=f-u[_];f=Die(v,f,y)}if(o){const m=d==="y"?"top":"left",_=d==="y"?"bottom":"right",v=g+u[m],y=g-u[_];g=Die(v,g,y)}const p=a.fn({...e,[h]:f,[d]:g});return{...p,data:{x:p.x-t,y:p.y-i}}}}},ZQt=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:i,placement:r,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=s0(n,e),u={x:t,y:i},d=C2(r),h=che(d);let f=u[h],g=u[d];const p=s0(a,e),m=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const y=h==="y"?"height":"width",C=s.reference[h]-s.floating[y]+m.mainAxis,x=s.reference[h]+s.reference[y]-m.mainAxis;fx&&(f=x)}if(c){var _,v;const y=h==="y"?"width":"height",C=["top","left"].includes(o0(r)),x=s.reference[d]-s.floating[y]+(C&&((_=o.offset)==null?void 0:_[d])||0)+(C?0:m.crossAxis),k=s.reference[d]+s.reference[y]+(C?0:((v=o.offset)==null?void 0:v[d])||0)-(C?m.crossAxis:0);gk&&(g=k)}return{[h]:f,[d]:g}}}},XQt=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:i,platform:r,elements:s}=e,{apply:o=()=>{},...a}=s0(n,e),l=await RR(e,a),c=o0(t),u=w2(t),d=C2(t)==="y",{width:h,height:f}=i.floating;let g,p;c==="top"||c==="bottom"?(g=c,p=u===(await(r.isRTL==null?void 0:r.isRTL(s.floating))?"start":"end")?"left":"right"):(p=c,g=u==="end"?"top":"bottom");const m=f-l[g],_=h-l[p],v=!e.middlewareData.shift;let y=m,C=_;if(d){const k=h-l.left-l.right;C=u||v?Wb(_,k):k}else{const k=f-l.top-l.bottom;y=u||v?Wb(m,k):k}if(v&&!u){const k=Rd(l.left,0),L=Rd(l.right,0),D=Rd(l.top,0),I=Rd(l.bottom,0);d?C=h-2*(k!==0||L!==0?k+L:Rd(l.left,l.right)):y=f-2*(D!==0||I!==0?D+I:Rd(l.top,l.bottom))}await o({...e,availableWidth:C,availableHeight:y});const x=await r.getDimensions(s.floating);return h!==x.width||f!==x.height?{reset:{rects:!0}}:{}}}};function Vb(n){return vHe(n)?(n.nodeName||"").toLowerCase():"#document"}function Yd(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function C0(n){var e;return(e=(vHe(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function vHe(n){return n instanceof Node||n instanceof Yd(n).Node}function a0(n){return n instanceof Element||n instanceof Yd(n).Element}function rm(n){return n instanceof HTMLElement||n instanceof Yd(n).HTMLElement}function YLe(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Yd(n).ShadowRoot}function FO(n){const{overflow:e,overflowX:t,overflowY:i,display:r}=uf(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(r)}function QQt(n){return["table","td","th"].includes(Vb(n))}function hhe(n){const e=fhe(),t=uf(n);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function JQt(n){let e=iL(n);for(;rm(e)&&!VH(e);){if(hhe(e))return e;e=iL(e)}return null}function fhe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function VH(n){return["html","body","#document"].includes(Vb(n))}function uf(n){return Yd(n).getComputedStyle(n)}function zH(n){return a0(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function iL(n){if(Vb(n)==="html")return n;const e=n.assignedSlot||n.parentNode||YLe(n)&&n.host||C0(n);return YLe(e)?e.host:e}function bHe(n){const e=iL(n);return VH(e)?n.ownerDocument?n.ownerDocument.body:n.body:rm(e)&&FO(e)?e:bHe(e)}function PR(n,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=bHe(n),s=r===((i=n.ownerDocument)==null?void 0:i.body),o=Yd(r);return s?e.concat(o,o.visualViewport||[],FO(r)?r:[],o.frameElement&&t?PR(o.frameElement):[]):e.concat(r,PR(r,[],t))}function yHe(n){const e=uf(n);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=rm(n),s=r?n.offsetWidth:t,o=r?n.offsetHeight:i,a=P7(t)!==s||P7(i)!==o;return a&&(t=s,i=o),{width:t,height:i,$:a}}function ghe(n){return a0(n)?n:n.contextElement}function Ok(n){const e=ghe(n);if(!rm(e))return Hb(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:s}=yHe(e);let o=(s?P7(t.width):t.width)/i,a=(s?P7(t.height):t.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const eJt=Hb(0);function wHe(n){const e=Yd(n);return!fhe()||!e.visualViewport?eJt:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function tJt(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Yd(n)?!1:e}function nC(n,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),s=ghe(n);let o=Hb(1);e&&(i?a0(i)&&(o=Ok(i)):o=Ok(n));const a=tJt(s,t,i)?wHe(s):Hb(0);let l=(r.left+a.x)/o.x,c=(r.top+a.y)/o.y,u=r.width/o.x,d=r.height/o.y;if(s){const h=Yd(s),f=i&&a0(i)?Yd(i):i;let g=h,p=g.frameElement;for(;p&&i&&f!==g;){const m=Ok(p),_=p.getBoundingClientRect(),v=uf(p),y=_.left+(p.clientLeft+parseFloat(v.paddingLeft))*m.x,C=_.top+(p.clientTop+parseFloat(v.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=y,c+=C,g=Yd(p),p=g.frameElement}}return M7({width:u,height:d,x:l,y:c})}const nJt=[":popover-open",":modal"];function CHe(n){return nJt.some(e=>{try{return n.matches(e)}catch{return!1}})}function iJt(n){let{elements:e,rect:t,offsetParent:i,strategy:r}=n;const s=r==="fixed",o=C0(i),a=e?CHe(e.floating):!1;if(i===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Hb(1);const u=Hb(0),d=rm(i);if((d||!d&&!s)&&((Vb(i)!=="body"||FO(o))&&(l=zH(i)),rm(i))){const h=nC(i);c=Ok(i),u.x=h.x+i.clientLeft,u.y=h.y+i.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x,y:t.y*c.y-l.scrollTop*c.y+u.y}}function rJt(n){return Array.from(n.getClientRects())}function xHe(n){return nC(C0(n)).left+zH(n).scrollLeft}function sJt(n){const e=C0(n),t=zH(n),i=n.ownerDocument.body,r=Rd(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=Rd(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+xHe(n);const a=-t.scrollTop;return uf(i).direction==="rtl"&&(o+=Rd(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}function oJt(n,e){const t=Yd(n),i=C0(n),r=t.visualViewport;let s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;const c=fhe();(!c||c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a,y:l}}function aJt(n,e){const t=nC(n,!0,e==="fixed"),i=t.top+n.clientTop,r=t.left+n.clientLeft,s=rm(n)?Ok(n):Hb(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,l=r*s.x,c=i*s.y;return{width:o,height:a,x:l,y:c}}function ZLe(n,e,t){let i;if(e==="viewport")i=oJt(n,t);else if(e==="document")i=sJt(C0(n));else if(a0(e))i=aJt(e,t);else{const r=wHe(n);i={...e,x:e.x-r.x,y:e.y-r.y}}return M7(i)}function SHe(n,e){const t=iL(n);return t===e||!a0(t)||VH(t)?!1:uf(t).position==="fixed"||SHe(t,e)}function lJt(n,e){const t=e.get(n);if(t)return t;let i=PR(n,[],!1).filter(a=>a0(a)&&Vb(a)!=="body"),r=null;const s=uf(n).position==="fixed";let o=s?iL(n):n;for(;a0(o)&&!VH(o);){const a=uf(o),l=hhe(o);!l&&a.position==="fixed"&&(r=null),(s?!l&&!r:!l&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||FO(o)&&!l&&SHe(n,o))?i=i.filter(u=>u!==o):r=a,o=iL(o)}return e.set(n,i),i}function cJt(n){let{element:e,boundary:t,rootBoundary:i,strategy:r}=n;const o=[...t==="clippingAncestors"?lJt(e,this._c):[].concat(t),i],a=o[0],l=o.reduce((c,u)=>{const d=ZLe(e,u,r);return c.top=Rd(d.top,c.top),c.right=Wb(d.right,c.right),c.bottom=Wb(d.bottom,c.bottom),c.left=Rd(d.left,c.left),c},ZLe(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function uJt(n){const{width:e,height:t}=yHe(n);return{width:e,height:t}}function dJt(n,e,t){const i=rm(e),r=C0(e),s=t==="fixed",o=nC(n,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Hb(0);if(i||!i&&!s)if((Vb(e)!=="body"||FO(r))&&(a=zH(e)),i){const d=nC(e,!0,s,e);l.x=d.x+e.clientLeft,l.y=d.y+e.clientTop}else r&&(l.x=xHe(r));const c=o.left+a.scrollLeft-l.x,u=o.top+a.scrollTop-l.y;return{x:c,y:u,width:o.width,height:o.height}}function XLe(n,e){return!rm(n)||uf(n).position==="fixed"?null:e?e(n):n.offsetParent}function kHe(n,e){const t=Yd(n);if(!rm(n)||CHe(n))return t;let i=XLe(n,e);for(;i&&QQt(i)&&uf(i).position==="static";)i=XLe(i,e);return i&&(Vb(i)==="html"||Vb(i)==="body"&&uf(i).position==="static"&&!hhe(i))?t:i||JQt(n)||t}const hJt=async function(n){const e=this.getOffsetParent||kHe,t=this.getDimensions;return{reference:dJt(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,...await t(n.floating)}}};function fJt(n){return uf(n).direction==="rtl"}const gJt={convertOffsetParentRelativeRectToViewportRelativeRect:iJt,getDocumentElement:C0,getClippingRect:cJt,getOffsetParent:kHe,getElementRects:hJt,getClientRects:rJt,getDimensions:uJt,getScale:Ok,isElement:a0,isRTL:fJt};function pJt(n,e){let t=null,i;const r=C0(n);function s(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:c,top:u,width:d,height:h}=n.getBoundingClientRect();if(a||e(),!d||!h)return;const f=B3(u),g=B3(r.clientWidth-(c+d)),p=B3(r.clientHeight-(u+h)),m=B3(c),v={rootMargin:-f+"px "+-g+"px "+-p+"px "+-m+"px",threshold:Rd(0,Wb(1,l))||1};let y=!0;function C(x){const k=x[0].intersectionRatio;if(k!==l){if(!y)return o();k?o(!1,k):i=setTimeout(()=>{o(!1,1e-7)},100)}y=!1}try{t=new IntersectionObserver(C,{...v,root:r.ownerDocument})}catch{t=new IntersectionObserver(C,v)}t.observe(n)}return o(!0),s}function mJt(n,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=ghe(n),u=r||s?[...c?PR(c):[],...PR(e)]:[];u.forEach(_=>{r&&_.addEventListener("scroll",t,{passive:!0}),s&&_.addEventListener("resize",t)});const d=c&&a?pJt(c,t):null;let h=-1,f=null;o&&(f=new ResizeObserver(_=>{let[v]=_;v&&v.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=f)==null||y.observe(e)})),t()}),c&&!l&&f.observe(c),f.observe(e));let g,p=l?nC(n):null;l&&m();function m(){const _=nC(n);p&&(_.x!==p.x||_.y!==p.y||_.width!==p.width||_.height!==p.height)&&t(),p=_,g=requestAnimationFrame(m)}return t(),()=>{var _;u.forEach(v=>{r&&v.removeEventListener("scroll",t),s&&v.removeEventListener("resize",t)}),d?.(),(_=f)==null||_.disconnect(),f=null,l&&cancelAnimationFrame(g)}}const _Jt=YQt,vJt=jQt,bJt=XQt,yJt=qQt,QLe=UQt,wJt=ZQt,CJt=(n,e,t)=>{const i=new Map,r={platform:gJt,...t},s={...r.platform,_c:i};return zQt(n,e,{...r,platform:s})},xJt=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:i,padding:r}=typeof n=="function"?n(t):n;return i&&e(i)?i.current!=null?QLe({element:i.current,padding:r}).fn(t):{}:i?QLe({element:i,padding:r}).fn(t):{}}}};var I5=typeof document<"u"?E.useLayoutEffect:E.useEffect;function F7(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,i,r;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(i=t;i--!==0;)if(!F7(n[i],e[i]))return!1;return!0}if(r=Object.keys(n),t=r.length,t!==Object.keys(e).length)return!1;for(i=t;i--!==0;)if(!{}.hasOwnProperty.call(e,r[i]))return!1;for(i=t;i--!==0;){const s=r[i];if(!(s==="_owner"&&n.$$typeof)&&!F7(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function EHe(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function JLe(n,e){const t=EHe(n);return Math.round(e*t)/t}function e2e(n){const e=E.useRef(n);return I5(()=>{e.current=n}),e}function SJt(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[u,d]=E.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[h,f]=E.useState(i);F7(h,i)||f(i);const[g,p]=E.useState(null),[m,_]=E.useState(null),v=E.useCallback(ee=>{ee!==k.current&&(k.current=ee,p(ee))},[]),y=E.useCallback(ee=>{ee!==L.current&&(L.current=ee,_(ee))},[]),C=s||g,x=o||m,k=E.useRef(null),L=E.useRef(null),D=E.useRef(u),I=l!=null,O=e2e(l),M=e2e(r),B=E.useCallback(()=>{if(!k.current||!L.current)return;const ee={placement:e,strategy:t,middleware:h};M.current&&(ee.platform=M.current),CJt(k.current,L.current,ee).then(Z=>{const j={...Z,isPositioned:!0};G.current&&!F7(D.current,j)&&(D.current=j,h0.flushSync(()=>{d(j)}))})},[h,e,t,M]);I5(()=>{c===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,d(ee=>({...ee,isPositioned:!1})))},[c]);const G=E.useRef(!1);I5(()=>(G.current=!0,()=>{G.current=!1}),[]),I5(()=>{if(C&&(k.current=C),x&&(L.current=x),C&&x){if(O.current)return O.current(C,x,B);B()}},[C,x,B,O,I]);const W=E.useMemo(()=>({reference:k,floating:L,setReference:v,setFloating:y}),[v,y]),z=E.useMemo(()=>({reference:C,floating:x}),[C,x]),q=E.useMemo(()=>{const ee={position:t,left:0,top:0};if(!z.floating)return ee;const Z=JLe(z.floating,u.x),j=JLe(z.floating,u.y);return a?{...ee,transform:"translate("+Z+"px, "+j+"px)",...EHe(z.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:Z,top:j}},[t,a,z.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:B,refs:W,elements:z,floatingStyles:q}),[u,B,W,z,q])}var kJt="Arrow",LHe=E.forwardRef((n,e)=>{const{children:t,width:i=10,height:r=5,...s}=n;return ae.jsx(Pn.svg,{...s,ref:e,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?t:ae.jsx("polygon",{points:"0,0 30,0 15,10"})})});LHe.displayName=kJt;var EJt=LHe;function LJt(n){const[e,t]=E.useState(void 0);return es(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else t(void 0)},[n]),e}var phe="Popper",[THe,c1]=Ac(phe),[TJt,DHe]=THe(phe),IHe=n=>{const{__scopePopper:e,children:t}=n,[i,r]=E.useState(null);return ae.jsx(TJt,{scope:e,anchor:i,onAnchorChange:r,children:t})};IHe.displayName=phe;var AHe="PopperAnchor",NHe=E.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:i,...r}=n,s=DHe(AHe,t),o=E.useRef(null),a=gi(e,o);return E.useEffect(()=>{s.onAnchorChange(i?.current||o.current)}),i?null:ae.jsx(Pn.div,{...r,ref:a})});NHe.displayName=AHe;var mhe="PopperContent",[DJt,IJt]=THe(mhe),RHe=E.forwardRef((n,e)=>{const{__scopePopper:t,side:i="bottom",sideOffset:r=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:f="optimized",onPlaced:g,...p}=n,m=DHe(mhe,t),[_,v]=E.useState(null),y=gi(e,Re=>v(Re)),[C,x]=E.useState(null),k=LJt(C),L=k?.width??0,D=k?.height??0,I=i+(s!=="center"?"-"+s:""),O=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},M=Array.isArray(c)?c:[c],B=M.length>0,G={padding:O,boundary:M.filter(NJt),altBoundary:B},{refs:W,floatingStyles:z,placement:q,isPositioned:ee,middlewareData:Z}=SJt({strategy:"fixed",placement:I,whileElementsMounted:(...Re)=>mJt(...Re,{animationFrame:f==="always"}),elements:{reference:m.anchor},middleware:[GQt({mainAxis:r+D,alignmentAxis:o}),l&&_Jt({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?wJt():void 0,...G}),l&&vJt({...G}),bJt({...G,apply:({elements:Re,rects:_t,availableWidth:Qe,availableHeight:pt})=>{const{width:gt,height:Ue}=_t.reference,wn=Re.floating.style;wn.setProperty("--radix-popper-available-width",`${Qe}px`),wn.setProperty("--radix-popper-available-height",`${pt}px`),wn.setProperty("--radix-popper-anchor-width",`${gt}px`),wn.setProperty("--radix-popper-anchor-height",`${Ue}px`)}}),C&&xJt({element:C,padding:a}),RJt({arrowWidth:L,arrowHeight:D}),h&&yJt({strategy:"referenceHidden",...G})]}),[j,te]=MHe(q),le=Ua(g);es(()=>{ee&&le?.()},[ee,le]);const ue=Z.arrow?.x,de=Z.arrow?.y,we=Z.arrow?.centerOffset!==0,[xe,Me]=E.useState();return es(()=>{_&&Me(window.getComputedStyle(_).zIndex)},[_]),ae.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:ee?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[Z.transformOrigin?.x,Z.transformOrigin?.y].join(" "),...Z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:ae.jsx(DJt,{scope:t,placedSide:j,onArrowChange:x,arrowX:ue,arrowY:de,shouldHideArrow:we,children:ae.jsx(Pn.div,{"data-side":j,"data-align":te,...p,ref:y,style:{...p.style,animation:ee?void 0:"none"}})})})});RHe.displayName=mhe;var PHe="PopperArrow",AJt={top:"bottom",right:"left",bottom:"top",left:"right"},OHe=E.forwardRef(function(e,t){const{__scopePopper:i,...r}=e,s=IJt(PHe,i),o=AJt[s.placedSide];return ae.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:ae.jsx(EJt,{...r,ref:t,style:{...r.style,display:"block"}})})});OHe.displayName=PHe;function NJt(n){return n!==null}var RJt=n=>({name:"transformOrigin",options:n,fn(e){const{placement:t,rects:i,middlewareData:r}=e,o=r.arrow?.centerOffset!==0,a=o?0:n.arrowWidth,l=o?0:n.arrowHeight,[c,u]=MHe(t),d={start:"0%",center:"50%",end:"100%"}[u],h=(r.arrow?.x??0)+a/2,f=(r.arrow?.y??0)+l/2;let g="",p="";return c==="bottom"?(g=o?d:`${h}px`,p=`${-l}px`):c==="top"?(g=o?d:`${h}px`,p=`${i.floating.height+l}px`):c==="right"?(g=`${-l}px`,p=o?d:`${f}px`):c==="left"&&(g=`${i.floating.width+l}px`,p=o?d:`${f}px`),{data:{x:g,y:p}}}});function MHe(n){const[e,t="center"]=n.split("-");return[e,t]}var UH=IHe,BO=NHe,jH=RHe,qH=OHe;function PJt(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var $O=n=>{const{present:e,children:t}=n,i=OJt(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,MJt(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};$O.displayName="Presence";function OJt(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=PJt(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=$3(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=$3(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=$3(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=$3(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function $3(n){return n?.animationName||"none"}function MJt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var FHe=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(BJt);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(Aie,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(Aie,{...i,ref:e,children:t})});FHe.displayName="Slot";var Aie=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=WJt(t);return E.cloneElement(t,{...$Jt(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});Aie.displayName="SlotClone";var FJt=({children:n})=>ae.jsx(ae.Fragment,{children:n});function BJt(n){return E.isValidElement(n)&&n.type===FJt}function $Jt(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function WJt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Nie=["Enter"," "],HJt=["ArrowDown","PageUp","Home"],BHe=["ArrowUp","PageDown","End"],VJt=[...HJt,...BHe],zJt={ltr:[...Nie,"ArrowRight"],rtl:[...Nie,"ArrowLeft"]},UJt={ltr:["ArrowLeft"],rtl:["ArrowRight"]},WO="Menu",[OR,jJt,qJt]=eae(WO),[OC,$He]=Ac(WO,[qJt,c1,C$]),KH=c1(),WHe=C$(),[KJt,MC]=OC(WO),[GJt,HO]=OC(WO),HHe=n=>{const{__scopeMenu:e,open:t=!1,children:i,dir:r,onOpenChange:s,modal:o=!0}=n,a=KH(e),[l,c]=E.useState(null),u=E.useRef(!1),d=Ua(s),h=$P(r);return E.useEffect(()=>{const f=()=>{u.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>u.current=!1;return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),ae.jsx(UH,{...a,children:ae.jsx(KJt,{scope:e,open:t,onOpenChange:d,content:l,onContentChange:c,children:ae.jsx(GJt,{scope:e,onClose:E.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:i})})})};HHe.displayName=WO;var YJt="MenuAnchor",_he=E.forwardRef((n,e)=>{const{__scopeMenu:t,...i}=n,r=KH(t);return ae.jsx(BO,{...r,...i,ref:e})});_he.displayName=YJt;var vhe="MenuPortal",[ZJt,VHe]=OC(vhe,{forceMount:void 0}),zHe=n=>{const{__scopeMenu:e,forceMount:t,children:i,container:r}=n,s=MC(vhe,e);return ae.jsx(ZJt,{scope:e,forceMount:t,children:ae.jsx($O,{present:t||s.open,children:ae.jsx(y2,{asChild:!0,container:r,children:i})})})};zHe.displayName=vhe;var Jh="MenuContent",[XJt,bhe]=OC(Jh),UHe=E.forwardRef((n,e)=>{const t=VHe(Jh,n.__scopeMenu),{forceMount:i=t.forceMount,...r}=n,s=MC(Jh,n.__scopeMenu),o=HO(Jh,n.__scopeMenu);return ae.jsx(OR.Provider,{scope:n.__scopeMenu,children:ae.jsx($O,{present:i||s.open,children:ae.jsx(OR.Slot,{scope:n.__scopeMenu,children:o.modal?ae.jsx(QJt,{...r,ref:e}):ae.jsx(JJt,{...r,ref:e})})})})}),QJt=E.forwardRef((n,e)=>{const t=MC(Jh,n.__scopeMenu),i=E.useRef(null),r=gi(e,i);return E.useEffect(()=>{const s=i.current;if(s)return MO(s)},[]),ae.jsx(yhe,{...n,ref:r,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:Kt(n.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})}),JJt=E.forwardRef((n,e)=>{const t=MC(Jh,n.__scopeMenu);return ae.jsx(yhe,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})}),yhe=E.forwardRef((n,e)=>{const{__scopeMenu:t,loop:i=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:g,...p}=n,m=MC(Jh,t),_=HO(Jh,t),v=KH(t),y=WHe(t),C=jJt(t),[x,k]=E.useState(null),L=E.useRef(null),D=gi(e,L,m.onContentChange),I=E.useRef(0),O=E.useRef(""),M=E.useRef(0),B=E.useRef(null),G=E.useRef("right"),W=E.useRef(0),z=g?OO:E.Fragment,q=g?{as:FHe,allowPinchZoom:!0}:void 0,ee=j=>{const te=O.current+j,le=C().filter(Re=>!Re.disabled),ue=document.activeElement,de=le.find(Re=>Re.ref.current===ue)?.textValue,we=le.map(Re=>Re.textValue),xe=den(we,te,de),Me=le.find(Re=>Re.textValue===xe)?.ref.current;(function Re(_t){O.current=_t,window.clearTimeout(I.current),_t!==""&&(I.current=window.setTimeout(()=>Re(""),1e3))})(te),Me&&setTimeout(()=>Me.focus())};E.useEffect(()=>()=>window.clearTimeout(I.current),[]),WH();const Z=E.useCallback(j=>G.current===B.current?.side&&fen(j,B.current?.area),[]);return ae.jsx(XJt,{scope:t,searchRef:O,onItemEnter:E.useCallback(j=>{Z(j)&&j.preventDefault()},[Z]),onItemLeave:E.useCallback(j=>{Z(j)||(L.current?.focus(),k(null))},[Z]),onTriggerLeave:E.useCallback(j=>{Z(j)&&j.preventDefault()},[Z]),pointerGraceTimerRef:M,onPointerGraceIntentChange:E.useCallback(j=>{B.current=j},[]),children:ae.jsx(z,{...q,children:ae.jsx(PO,{asChild:!0,trapped:r,onMountAutoFocus:Kt(s,j=>{j.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:ae.jsx(b2,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,children:ae.jsx(QOe,{asChild:!0,...y,dir:_.dir,orientation:"vertical",loop:i,currentTabStopId:x,onCurrentTabStopIdChange:k,onEntryFocus:Kt(l,j=>{_.isUsingKeyboardRef.current||j.preventDefault()}),preventScrollOnEntryFocus:!0,children:ae.jsx(jH,{role:"menu","aria-orientation":"vertical","data-state":oVe(m.open),"data-radix-menu-content":"",dir:_.dir,...v,...p,ref:D,style:{outline:"none",...p.style},onKeyDown:Kt(p.onKeyDown,j=>{const le=j.target.closest("[data-radix-menu-content]")===j.currentTarget,ue=j.ctrlKey||j.altKey||j.metaKey,de=j.key.length===1;le&&(j.key==="Tab"&&j.preventDefault(),!ue&&de&&ee(j.key));const we=L.current;if(j.target!==we||!VJt.includes(j.key))return;j.preventDefault();const Me=C().filter(Re=>!Re.disabled).map(Re=>Re.ref.current);BHe.includes(j.key)&&Me.reverse(),cen(Me)}),onBlur:Kt(n.onBlur,j=>{j.currentTarget.contains(j.target)||(window.clearTimeout(I.current),O.current="")}),onPointerMove:Kt(n.onPointerMove,MR(j=>{const te=j.target,le=W.current!==j.clientX;if(j.currentTarget.contains(te)&&le){const ue=j.clientX>W.current?"right":"left";G.current=ue,W.current=j.clientX}}))})})})})})})});UHe.displayName=Jh;var een="MenuGroup",whe=E.forwardRef((n,e)=>{const{__scopeMenu:t,...i}=n;return ae.jsx(Pn.div,{role:"group",...i,ref:e})});whe.displayName=een;var ten="MenuLabel",jHe=E.forwardRef((n,e)=>{const{__scopeMenu:t,...i}=n;return ae.jsx(Pn.div,{...i,ref:e})});jHe.displayName=ten;var B7="MenuItem",t2e="menu.itemSelect",GH=E.forwardRef((n,e)=>{const{disabled:t=!1,onSelect:i,...r}=n,s=E.useRef(null),o=HO(B7,n.__scopeMenu),a=bhe(B7,n.__scopeMenu),l=gi(e,s),c=E.useRef(!1),u=()=>{const d=s.current;if(!t&&d){const h=new CustomEvent(t2e,{bubbles:!0,cancelable:!0});d.addEventListener(t2e,f=>i?.(f),{once:!0}),fOe(d,h),h.defaultPrevented?c.current=!1:o.onClose()}};return ae.jsx(qHe,{...r,ref:l,disabled:t,onClick:Kt(n.onClick,u),onPointerDown:d=>{n.onPointerDown?.(d),c.current=!0},onPointerUp:Kt(n.onPointerUp,d=>{c.current||d.currentTarget?.click()}),onKeyDown:Kt(n.onKeyDown,d=>{const h=a.searchRef.current!=="";t||h&&d.key===" "||Nie.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});GH.displayName=B7;var qHe=E.forwardRef((n,e)=>{const{__scopeMenu:t,disabled:i=!1,textValue:r,...s}=n,o=bhe(B7,t),a=WHe(t),l=E.useRef(null),c=gi(e,l),[u,d]=E.useState(!1),[h,f]=E.useState("");return E.useEffect(()=>{const g=l.current;g&&f((g.textContent??"").trim())},[s.children]),ae.jsx(OR.ItemSlot,{scope:t,disabled:i,textValue:r??h,children:ae.jsx(JOe,{asChild:!0,...a,focusable:!i,children:ae.jsx(Pn.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...s,ref:c,onPointerMove:Kt(n.onPointerMove,MR(g=>{i?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Kt(n.onPointerLeave,MR(g=>o.onItemLeave(g))),onFocus:Kt(n.onFocus,()=>d(!0)),onBlur:Kt(n.onBlur,()=>d(!1))})})})}),nen="MenuCheckboxItem",KHe=E.forwardRef((n,e)=>{const{checked:t=!1,onCheckedChange:i,...r}=n;return ae.jsx(QHe,{scope:n.__scopeMenu,checked:t,children:ae.jsx(GH,{role:"menuitemcheckbox","aria-checked":$7(t)?"mixed":t,...r,ref:e,"data-state":xhe(t),onSelect:Kt(r.onSelect,()=>i?.($7(t)?!0:!t),{checkForDefaultPrevented:!1})})})});KHe.displayName=nen;var GHe="MenuRadioGroup",[ien,ren]=OC(GHe,{value:void 0,onValueChange:()=>{}}),YHe=E.forwardRef((n,e)=>{const{value:t,onValueChange:i,...r}=n,s=Ua(i);return ae.jsx(ien,{scope:n.__scopeMenu,value:t,onValueChange:s,children:ae.jsx(whe,{...r,ref:e})})});YHe.displayName=GHe;var ZHe="MenuRadioItem",XHe=E.forwardRef((n,e)=>{const{value:t,...i}=n,r=ren(ZHe,n.__scopeMenu),s=t===r.value;return ae.jsx(QHe,{scope:n.__scopeMenu,checked:s,children:ae.jsx(GH,{role:"menuitemradio","aria-checked":s,...i,ref:e,"data-state":xhe(s),onSelect:Kt(i.onSelect,()=>r.onValueChange?.(t),{checkForDefaultPrevented:!1})})})});XHe.displayName=ZHe;var Che="MenuItemIndicator",[QHe,sen]=OC(Che,{checked:!1}),JHe=E.forwardRef((n,e)=>{const{__scopeMenu:t,forceMount:i,...r}=n,s=sen(Che,t);return ae.jsx($O,{present:i||$7(s.checked)||s.checked===!0,children:ae.jsx(Pn.span,{...r,ref:e,"data-state":xhe(s.checked)})})});JHe.displayName=Che;var oen="MenuSeparator",eVe=E.forwardRef((n,e)=>{const{__scopeMenu:t,...i}=n;return ae.jsx(Pn.div,{role:"separator","aria-orientation":"horizontal",...i,ref:e})});eVe.displayName=oen;var aen="MenuArrow",tVe=E.forwardRef((n,e)=>{const{__scopeMenu:t,...i}=n,r=KH(t);return ae.jsx(qH,{...r,...i,ref:e})});tVe.displayName=aen;var len="MenuSub",[_Wn,nVe]=OC(len),QD="MenuSubTrigger",iVe=E.forwardRef((n,e)=>{const t=MC(QD,n.__scopeMenu),i=HO(QD,n.__scopeMenu),r=nVe(QD,n.__scopeMenu),s=bhe(QD,n.__scopeMenu),o=E.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:n.__scopeMenu},u=E.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return E.useEffect(()=>u,[u]),E.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),ae.jsx(_he,{asChild:!0,...c,children:ae.jsx(qHe,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":r.contentId,"data-state":oVe(t.open),...n,ref:Pg(e,r.onTriggerChange),onClick:d=>{n.onClick?.(d),!(n.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:Kt(n.onPointerMove,MR(d=>{s.onItemEnter(d),!d.defaultPrevented&&!n.disabled&&!t.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{t.onOpenChange(!0),u()},100))})),onPointerLeave:Kt(n.onPointerLeave,MR(d=>{u();const h=t.content?.getBoundingClientRect();if(h){const f=t.content?.dataset.side,g=f==="right",p=g?-5:5,m=h[g?"left":"right"],_=h[g?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+p,y:d.clientY},{x:m,y:h.top},{x:_,y:h.top},{x:_,y:h.bottom},{x:m,y:h.bottom}],side:f}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Kt(n.onKeyDown,d=>{const h=s.searchRef.current!=="";n.disabled||h&&d.key===" "||zJt[i.dir].includes(d.key)&&(t.onOpenChange(!0),t.content?.focus(),d.preventDefault())})})})});iVe.displayName=QD;var rVe="MenuSubContent",sVe=E.forwardRef((n,e)=>{const t=VHe(Jh,n.__scopeMenu),{forceMount:i=t.forceMount,...r}=n,s=MC(Jh,n.__scopeMenu),o=HO(Jh,n.__scopeMenu),a=nVe(rVe,n.__scopeMenu),l=E.useRef(null),c=gi(e,l);return ae.jsx(OR.Provider,{scope:n.__scopeMenu,children:ae.jsx($O,{present:i||s.open,children:ae.jsx(OR.Slot,{scope:n.__scopeMenu,children:ae.jsx(yhe,{id:a.contentId,"aria-labelledby":a.triggerId,...r,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{o.isUsingKeyboardRef.current&&l.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Kt(n.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Kt(n.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Kt(n.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),h=UJt[o.dir].includes(u.key);d&&h&&(s.onOpenChange(!1),a.trigger?.focus(),u.preventDefault())})})})})})});sVe.displayName=rVe;function oVe(n){return n?"open":"closed"}function $7(n){return n==="indeterminate"}function xhe(n){return $7(n)?"indeterminate":n?"checked":"unchecked"}function cen(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}function uen(n,e){return n.map((t,i)=>n[(e+i)%n.length])}function den(n,e,t){const r=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=t?n.indexOf(t):-1;let o=uen(n,Math.max(s,0));r.length===1&&(o=o.filter(c=>c!==t));const l=o.find(c=>c.toLowerCase().startsWith(r.toLowerCase()));return l!==t?l:void 0}function hen(n,e){const{x:t,y:i}=n;let r=!1;for(let s=0,o=e.length-1;si!=u>i&&t<(c-a)*(i-l)/(u-l)+a&&(r=!r)}return r}function fen(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return hen(t,e)}function MR(n){return e=>e.pointerType==="mouse"?n(e):void 0}var gen=HHe,pen=_he,men=zHe,_en=UHe,ven=whe,ben=jHe,yen=GH,wen=KHe,Cen=YHe,xen=XHe,Sen=JHe,ken=eVe,Een=tVe,Len=iVe,Ten=sVe,She="DropdownMenu",[Den,vWn]=Ac(She,[$He]),Cu=$He(),[Ien,aVe]=Den(She),lVe=n=>{const{__scopeDropdownMenu:e,children:t,dir:i,open:r,defaultOpen:s,onOpenChange:o,modal:a=!0}=n,l=Cu(e),c=E.useRef(null),[u=!1,d]=Kp({prop:r,defaultProp:s,onChange:o});return ae.jsx(Ien,{scope:e,triggerId:Ud(),triggerRef:c,contentId:Ud(),open:u,onOpenChange:d,onOpenToggle:E.useCallback(()=>d(h=>!h),[d]),modal:a,children:ae.jsx(gen,{...l,open:u,onOpenChange:d,dir:i,modal:a,children:t})})};lVe.displayName=She;var cVe="DropdownMenuTrigger",uVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,disabled:i=!1,...r}=n,s=aVe(cVe,t),o=Cu(t);return ae.jsx(pen,{asChild:!0,...o,children:ae.jsx(Pn.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...r,ref:Pg(e,s.triggerRef),onPointerDown:Kt(n.onPointerDown,a=>{!i&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Kt(n.onKeyDown,a=>{i||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});uVe.displayName=cVe;var Aen="DropdownMenuPortal",dVe=n=>{const{__scopeDropdownMenu:e,...t}=n,i=Cu(e);return ae.jsx(men,{...i,...t})};dVe.displayName=Aen;var hVe="DropdownMenuContent",fVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=aVe(hVe,t),s=Cu(t),o=E.useRef(!1);return ae.jsx(_en,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...i,ref:e,onCloseAutoFocus:Kt(n.onCloseAutoFocus,a=>{o.current||r.triggerRef.current?.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Kt(n.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!r.modal||u)&&(o.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});fVe.displayName=hVe;var Nen="DropdownMenuGroup",gVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(ven,{...r,...i,ref:e})});gVe.displayName=Nen;var Ren="DropdownMenuLabel",pVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(ben,{...r,...i,ref:e})});pVe.displayName=Ren;var Pen="DropdownMenuItem",mVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(yen,{...r,...i,ref:e})});mVe.displayName=Pen;var Oen="DropdownMenuCheckboxItem",_Ve=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(wen,{...r,...i,ref:e})});_Ve.displayName=Oen;var Men="DropdownMenuRadioGroup",Fen=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(Cen,{...r,...i,ref:e})});Fen.displayName=Men;var Ben="DropdownMenuRadioItem",vVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(xen,{...r,...i,ref:e})});vVe.displayName=Ben;var $en="DropdownMenuItemIndicator",bVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(Sen,{...r,...i,ref:e})});bVe.displayName=$en;var Wen="DropdownMenuSeparator",yVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(ken,{...r,...i,ref:e})});yVe.displayName=Wen;var Hen="DropdownMenuArrow",Ven=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(Een,{...r,...i,ref:e})});Ven.displayName=Hen;var zen="DropdownMenuSubTrigger",wVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(Len,{...r,...i,ref:e})});wVe.displayName=zen;var Uen="DropdownMenuSubContent",CVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(Ten,{...r,...i,ref:e,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});CVe.displayName=Uen;var bWn=lVe,yWn=uVe,wWn=dVe,CWn=fVe,xWn=gVe,SWn=pVe,kWn=mVe,EWn=_Ve,LWn=vVe,TWn=bVe,DWn=yVe,IWn=wVe,AWn=CVe;function jen(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var xVe=n=>{const{present:e,children:t}=n,i=qen(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,Ken(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};xVe.displayName="Presence";function qen(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=jen(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=W3(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=W3(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=W3(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=W3(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function W3(n){return n?.animationName||"none"}function Ken(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var khe="Collapsible",[Gen,NWn]=Ac(khe),[Yen,Ehe]=Gen(khe),SVe=E.forwardRef((n,e)=>{const{__scopeCollapsible:t,open:i,defaultOpen:r,disabled:s,onOpenChange:o,...a}=n,[l=!1,c]=Kp({prop:i,defaultProp:r,onChange:o});return ae.jsx(Yen,{scope:t,disabled:s,contentId:Ud(),open:l,onOpenToggle:E.useCallback(()=>c(u=>!u),[c]),children:ae.jsx(Pn.div,{"data-state":The(l),"data-disabled":s?"":void 0,...a,ref:e})})});SVe.displayName=khe;var kVe="CollapsibleTrigger",Zen=E.forwardRef((n,e)=>{const{__scopeCollapsible:t,...i}=n,r=Ehe(kVe,t);return ae.jsx(Pn.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":The(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...i,ref:e,onClick:Kt(n.onClick,r.onOpenToggle)})});Zen.displayName=kVe;var Lhe="CollapsibleContent",Xen=E.forwardRef((n,e)=>{const{forceMount:t,...i}=n,r=Ehe(Lhe,n.__scopeCollapsible);return ae.jsx(xVe,{present:t||r.open,children:({present:s})=>ae.jsx(Qen,{...i,ref:e,present:s})})});Xen.displayName=Lhe;var Qen=E.forwardRef((n,e)=>{const{__scopeCollapsible:t,present:i,children:r,...s}=n,o=Ehe(Lhe,t),[a,l]=E.useState(i),c=E.useRef(null),u=gi(e,c),d=E.useRef(0),h=d.current,f=E.useRef(0),g=f.current,p=o.open||a,m=E.useRef(p),_=E.useRef(void 0);return E.useEffect(()=>{const v=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(v)},[]),es(()=>{const v=c.current;if(v){_.current=_.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const y=v.getBoundingClientRect();d.current=y.height,f.current=y.width,m.current||(v.style.transitionDuration=_.current.transitionDuration,v.style.animationName=_.current.animationName),l(i)}},[o.open,i]),ae.jsx(Pn.div,{"data-state":The(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...s,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...n.style},children:p&&r})});function The(n){return n?"open":"closed"}var RWn=SVe;function Jen(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var Dhe=n=>{const{present:e,children:t}=n,i=etn(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,ttn(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};Dhe.displayName="Presence";function etn(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=Jen(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=H3(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=H3(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=H3(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=H3(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function H3(n){return n?.animationName||"none"}function ttn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var ntn=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(itn);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(Rie,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(Rie,{...i,ref:e,children:t})});ntn.displayName="Slot";var Rie=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=stn(t);return E.cloneElement(t,{...rtn(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});Rie.displayName="SlotClone";var EVe=({children:n})=>ae.jsx(ae.Fragment,{children:n});function itn(n){return E.isValidElement(n)&&n.type===EVe}function rtn(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function stn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var otn="VisuallyHidden",Ihe=E.forwardRef((n,e)=>ae.jsx(Pn.span,{...n,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...n.style}}));Ihe.displayName=otn;var atn=Ihe,[YH,PWn]=Ac("Tooltip",[c1]),ZH=c1(),LVe="TooltipProvider",ltn=700,Pie="tooltip.open",[ctn,Ahe]=YH(LVe),TVe=n=>{const{__scopeTooltip:e,delayDuration:t=ltn,skipDelayDuration:i=300,disableHoverableContent:r=!1,children:s}=n,[o,a]=E.useState(!0),l=E.useRef(!1),c=E.useRef(0);return E.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),ae.jsx(ctn,{scope:e,isOpenDelayed:o,delayDuration:t,onOpen:E.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:E.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),i)},[i]),isPointerInTransitRef:l,onPointerInTransitChange:E.useCallback(u=>{l.current=u},[]),disableHoverableContent:r,children:s})};TVe.displayName=LVe;var XH="Tooltip",[utn,VO]=YH(XH),DVe=n=>{const{__scopeTooltip:e,children:t,open:i,defaultOpen:r=!1,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=n,l=Ahe(XH,n.__scopeTooltip),c=ZH(e),[u,d]=E.useState(null),h=Ud(),f=E.useRef(0),g=o??l.disableHoverableContent,p=a??l.delayDuration,m=E.useRef(!1),[_=!1,v]=Kp({prop:i,defaultProp:r,onChange:L=>{L?(l.onOpen(),document.dispatchEvent(new CustomEvent(Pie))):l.onClose(),s?.(L)}}),y=E.useMemo(()=>_?m.current?"delayed-open":"instant-open":"closed",[_]),C=E.useCallback(()=>{window.clearTimeout(f.current),f.current=0,m.current=!1,v(!0)},[v]),x=E.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v(!1)},[v]),k=E.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{m.current=!0,v(!0),f.current=0},p)},[p,v]);return E.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),ae.jsx(UH,{...c,children:ae.jsx(utn,{scope:e,contentId:h,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:E.useCallback(()=>{l.isOpenDelayed?k():C()},[l.isOpenDelayed,k,C]),onTriggerLeave:E.useCallback(()=>{g?x():(window.clearTimeout(f.current),f.current=0)},[x,g]),onOpen:C,onClose:x,disableHoverableContent:g,children:t})})};DVe.displayName=XH;var Oie="TooltipTrigger",IVe=E.forwardRef((n,e)=>{const{__scopeTooltip:t,...i}=n,r=VO(Oie,t),s=Ahe(Oie,t),o=ZH(t),a=E.useRef(null),l=gi(e,a,r.onTriggerChange),c=E.useRef(!1),u=E.useRef(!1),d=E.useCallback(()=>c.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),ae.jsx(BO,{asChild:!0,...o,children:ae.jsx(Pn.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...i,ref:l,onPointerMove:Kt(n.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),u.current=!0)}),onPointerLeave:Kt(n.onPointerLeave,()=>{r.onTriggerLeave(),u.current=!1}),onPointerDown:Kt(n.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Kt(n.onFocus,()=>{c.current||r.onOpen()}),onBlur:Kt(n.onBlur,r.onClose),onClick:Kt(n.onClick,r.onClose)})})});IVe.displayName=Oie;var Nhe="TooltipPortal",[dtn,htn]=YH(Nhe,{forceMount:void 0}),AVe=n=>{const{__scopeTooltip:e,forceMount:t,children:i,container:r}=n,s=VO(Nhe,e);return ae.jsx(dtn,{scope:e,forceMount:t,children:ae.jsx(Dhe,{present:t||s.open,children:ae.jsx(y2,{asChild:!0,container:r,children:i})})})};AVe.displayName=Nhe;var rL="TooltipContent",NVe=E.forwardRef((n,e)=>{const t=htn(rL,n.__scopeTooltip),{forceMount:i=t.forceMount,side:r="top",...s}=n,o=VO(rL,n.__scopeTooltip);return ae.jsx(Dhe,{present:i||o.open,children:o.disableHoverableContent?ae.jsx(RVe,{side:r,...s,ref:e}):ae.jsx(ftn,{side:r,...s,ref:e})})}),ftn=E.forwardRef((n,e)=>{const t=VO(rL,n.__scopeTooltip),i=Ahe(rL,n.__scopeTooltip),r=E.useRef(null),s=gi(e,r),[o,a]=E.useState(null),{trigger:l,onClose:c}=t,u=r.current,{onPointerInTransitChange:d}=i,h=E.useCallback(()=>{a(null),d(!1)},[d]),f=E.useCallback((g,p)=>{const m=g.currentTarget,_={x:g.clientX,y:g.clientY},v=_tn(_,m.getBoundingClientRect()),y=vtn(_,v),C=btn(p.getBoundingClientRect()),x=wtn([...y,...C]);a(x),d(!0)},[d]);return E.useEffect(()=>()=>h(),[h]),E.useEffect(()=>{if(l&&u){const g=m=>f(m,u),p=m=>f(m,l);return l.addEventListener("pointerleave",g),u.addEventListener("pointerleave",p),()=>{l.removeEventListener("pointerleave",g),u.removeEventListener("pointerleave",p)}}},[l,u,f,h]),E.useEffect(()=>{if(o){const g=p=>{const m=p.target,_={x:p.clientX,y:p.clientY},v=l?.contains(m)||u?.contains(m),y=!ytn(_,o);v?h():y&&(h(),c())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,u,o,c,h]),ae.jsx(RVe,{...n,ref:s})}),[gtn,ptn]=YH(XH,{isInside:!1}),RVe=E.forwardRef((n,e)=>{const{__scopeTooltip:t,children:i,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=n,l=VO(rL,t),c=ZH(t),{onClose:u}=l;return E.useEffect(()=>(document.addEventListener(Pie,u),()=>document.removeEventListener(Pie,u)),[u]),E.useEffect(()=>{if(l.trigger){const d=h=>{h.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),ae.jsx(b2,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:ae.jsxs(jH,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[ae.jsx(EVe,{children:i}),ae.jsx(gtn,{scope:t,isInside:!0,children:ae.jsx(atn,{id:l.contentId,role:"tooltip",children:r||i})})]})})});NVe.displayName=rL;var PVe="TooltipArrow",mtn=E.forwardRef((n,e)=>{const{__scopeTooltip:t,...i}=n,r=ZH(t);return ptn(PVe,t).isInside?null:ae.jsx(qH,{...r,...i,ref:e})});mtn.displayName=PVe;function _tn(n,e){const t=Math.abs(e.top-n.y),i=Math.abs(e.bottom-n.y),r=Math.abs(e.right-n.x),s=Math.abs(e.left-n.x);switch(Math.min(t,i,r,s)){case s:return"left";case r:return"right";case t:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function vtn(n,e,t=5){const i=[];switch(e){case"top":i.push({x:n.x-t,y:n.y+t},{x:n.x+t,y:n.y+t});break;case"bottom":i.push({x:n.x-t,y:n.y-t},{x:n.x+t,y:n.y-t});break;case"left":i.push({x:n.x+t,y:n.y-t},{x:n.x+t,y:n.y+t});break;case"right":i.push({x:n.x-t,y:n.y-t},{x:n.x-t,y:n.y+t});break}return i}function btn(n){const{top:e,right:t,bottom:i,left:r}=n;return[{x:r,y:e},{x:t,y:e},{x:t,y:i},{x:r,y:i}]}function ytn(n,e){const{x:t,y:i}=n;let r=!1;for(let s=0,o=e.length-1;si!=u>i&&t<(c-a)*(i-l)/(u-l)+a&&(r=!r)}return r}function wtn(n){const e=n.slice();return e.sort((t,i)=>t.xi.x?1:t.yi.y?1:0),Ctn(e)}function Ctn(n){if(n.length<=1)return n.slice();const e=[];for(let i=0;i=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))e.pop();else break}e.push(r)}e.pop();const t=[];for(let i=n.length-1;i>=0;i--){const r=n[i];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var OWn=TVe,MWn=DVe,FWn=IVe,BWn=AVe,$Wn=NVe;/** +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return E.useEffect(()=>{n&&(document.getElementById(n)||console.error(t))},[t,n]),null},rQt="DialogDescriptionWarning",sQt=({contentRef:n,descriptionId:e})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gHe(rQt).contentName}}.`;return E.useEffect(()=>{const r=n.current?.getAttribute("aria-describedby");e&&r&&(document.getElementById(e)||console.warn(i))},[i,n,e]),null},oQt=eHe,aQt=nHe,lQt=rHe,cQt=sHe,uQt=oHe,dQt=lHe,hQt=uHe,pHe=hHe;function nl(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}var fQt=["color"],Z$n=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,fQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),gQt=["color"],X$n=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,gQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M7.49991 0.877045C3.84222 0.877045 0.877075 3.84219 0.877075 7.49988C0.877075 11.1575 3.84222 14.1227 7.49991 14.1227C11.1576 14.1227 14.1227 11.1575 14.1227 7.49988C14.1227 3.84219 11.1576 0.877045 7.49991 0.877045ZM1.82708 7.49988C1.82708 4.36686 4.36689 1.82704 7.49991 1.82704C10.6329 1.82704 13.1727 4.36686 13.1727 7.49988C13.1727 10.6329 10.6329 13.1727 7.49991 13.1727C4.36689 13.1727 1.82708 10.6329 1.82708 7.49988ZM10.1589 5.53774C10.3178 5.31191 10.2636 5.00001 10.0378 4.84109C9.81194 4.68217 9.50004 4.73642 9.34112 4.96225L6.51977 8.97154L5.35681 7.78706C5.16334 7.59002 4.84677 7.58711 4.64973 7.78058C4.45268 7.97404 4.44978 8.29061 4.64325 8.48765L6.22658 10.1003C6.33054 10.2062 6.47617 10.2604 6.62407 10.2483C6.77197 10.2363 6.90686 10.1591 6.99226 10.0377L10.1589 5.53774Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),pQt=["color"],Q$n=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,pQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),mQt=["color"],J$n=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,mQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),_Qt=["color"],eWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,_Qt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),vQt=["color"],tWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,vQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),bQt=["color"],nWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,bQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M0.877075 7.49991C0.877075 3.84222 3.84222 0.877075 7.49991 0.877075C11.1576 0.877075 14.1227 3.84222 14.1227 7.49991C14.1227 11.1576 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1576 0.877075 7.49991ZM7.49991 1.82708C4.36689 1.82708 1.82708 4.36689 1.82708 7.49991C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49991C13.1727 4.36689 10.6329 1.82708 7.49991 1.82708Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),yQt=["color"],iWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,yQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),wQt=["color"],rWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,wQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704ZM9.85358 5.14644C10.0488 5.3417 10.0488 5.65829 9.85358 5.85355L8.20713 7.49999L9.85358 9.14644C10.0488 9.3417 10.0488 9.65829 9.85358 9.85355C9.65832 10.0488 9.34173 10.0488 9.14647 9.85355L7.50002 8.2071L5.85358 9.85355C5.65832 10.0488 5.34173 10.0488 5.14647 9.85355C4.95121 9.65829 4.95121 9.3417 5.14647 9.14644L6.79292 7.49999L5.14647 5.85355C4.95121 5.65829 4.95121 5.3417 5.14647 5.14644C5.34173 4.95118 5.65832 4.95118 5.85358 5.14644L7.50002 6.79289L9.14647 5.14644C9.34173 4.95118 9.65832 4.95118 9.85358 5.14644Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),CQt=["color"],sWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,CQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",fill:i}))}),xQt=["color"],oWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,xQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M6.85355 3.85355C7.04882 3.65829 7.04882 3.34171 6.85355 3.14645C6.65829 2.95118 6.34171 2.95118 6.14645 3.14645L2.14645 7.14645C1.95118 7.34171 1.95118 7.65829 2.14645 7.85355L6.14645 11.8536C6.34171 12.0488 6.65829 12.0488 6.85355 11.8536C7.04882 11.6583 7.04882 11.3417 6.85355 11.1464L3.20711 7.5L6.85355 3.85355ZM12.8536 3.85355C13.0488 3.65829 13.0488 3.34171 12.8536 3.14645C12.6583 2.95118 12.3417 2.95118 12.1464 3.14645L8.14645 7.14645C7.95118 7.34171 7.95118 7.65829 8.14645 7.85355L12.1464 11.8536C12.3417 12.0488 12.6583 12.0488 12.8536 11.8536C13.0488 11.6583 13.0488 11.3417 12.8536 11.1464L9.20711 7.5L12.8536 3.85355Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),SQt=["color"],aWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,SQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M2.14645 11.1464C1.95118 11.3417 1.95118 11.6583 2.14645 11.8536C2.34171 12.0488 2.65829 12.0488 2.85355 11.8536L6.85355 7.85355C7.04882 7.65829 7.04882 7.34171 6.85355 7.14645L2.85355 3.14645C2.65829 2.95118 2.34171 2.95118 2.14645 3.14645C1.95118 3.34171 1.95118 3.65829 2.14645 3.85355L5.79289 7.5L2.14645 11.1464ZM8.14645 11.1464C7.95118 11.3417 7.95118 11.6583 8.14645 11.8536C8.34171 12.0488 8.65829 12.0488 8.85355 11.8536L12.8536 7.85355C13.0488 7.65829 13.0488 7.34171 12.8536 7.14645L8.85355 3.14645C8.65829 2.95118 8.34171 2.95118 8.14645 3.14645C7.95118 3.34171 7.95118 3.65829 8.14645 3.85355L11.7929 7.5L8.14645 11.1464Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),kQt=["color"],lWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,kQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M5.5 4.625C6.12132 4.625 6.625 4.12132 6.625 3.5C6.625 2.87868 6.12132 2.375 5.5 2.375C4.87868 2.375 4.375 2.87868 4.375 3.5C4.375 4.12132 4.87868 4.625 5.5 4.625ZM9.5 4.625C10.1213 4.625 10.625 4.12132 10.625 3.5C10.625 2.87868 10.1213 2.375 9.5 2.375C8.87868 2.375 8.375 2.87868 8.375 3.5C8.375 4.12132 8.87868 4.625 9.5 4.625ZM10.625 7.5C10.625 8.12132 10.1213 8.625 9.5 8.625C8.87868 8.625 8.375 8.12132 8.375 7.5C8.375 6.87868 8.87868 6.375 9.5 6.375C10.1213 6.375 10.625 6.87868 10.625 7.5ZM5.5 8.625C6.12132 8.625 6.625 8.12132 6.625 7.5C6.625 6.87868 6.12132 6.375 5.5 6.375C4.87868 6.375 4.375 6.87868 4.375 7.5C4.375 8.12132 4.87868 8.625 5.5 8.625ZM10.625 11.5C10.625 12.1213 10.1213 12.625 9.5 12.625C8.87868 12.625 8.375 12.1213 8.375 11.5C8.375 10.8787 8.87868 10.375 9.5 10.375C10.1213 10.375 10.625 10.8787 10.625 11.5ZM5.5 12.625C6.12132 12.625 6.625 12.1213 6.625 11.5C6.625 10.8787 6.12132 10.375 5.5 10.375C4.87868 10.375 4.375 10.8787 4.375 11.5C4.375 12.1213 4.87868 12.625 5.5 12.625Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),EQt=["color"],cWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,EQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),LQt=["color"],uWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,LQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M5.5 3C4.67157 3 4 3.67157 4 4.5C4 5.32843 4.67157 6 5.5 6C6.32843 6 7 5.32843 7 4.5C7 3.67157 6.32843 3 5.5 3ZM3 5C3.01671 5 3.03323 4.99918 3.04952 4.99758C3.28022 6.1399 4.28967 7 5.5 7C6.71033 7 7.71978 6.1399 7.95048 4.99758C7.96677 4.99918 7.98329 5 8 5H13.5C13.7761 5 14 4.77614 14 4.5C14 4.22386 13.7761 4 13.5 4H8C7.98329 4 7.96677 4.00082 7.95048 4.00242C7.71978 2.86009 6.71033 2 5.5 2C4.28967 2 3.28022 2.86009 3.04952 4.00242C3.03323 4.00082 3.01671 4 3 4H1.5C1.22386 4 1 4.22386 1 4.5C1 4.77614 1.22386 5 1.5 5H3ZM11.9505 10.9976C11.7198 12.1399 10.7103 13 9.5 13C8.28967 13 7.28022 12.1399 7.04952 10.9976C7.03323 10.9992 7.01671 11 7 11H1.5C1.22386 11 1 10.7761 1 10.5C1 10.2239 1.22386 10 1.5 10H7C7.01671 10 7.03323 10.0008 7.04952 10.0024C7.28022 8.8601 8.28967 8 9.5 8C10.7103 8 11.7198 8.8601 11.9505 10.0024C11.9668 10.0008 11.9833 10 12 10H13.5C13.7761 10 14 10.2239 14 10.5C14 10.7761 13.7761 11 13.5 11H12C11.9833 11 11.9668 10.9992 11.9505 10.9976ZM8 10.5C8 9.67157 8.67157 9 9.5 9C10.3284 9 11 9.67157 11 10.5C11 11.3284 10.3284 12 9.5 12C8.67157 12 8 11.3284 8 10.5Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),TQt=["color"],dWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,TQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M12.1464 1.14645C12.3417 0.951184 12.6583 0.951184 12.8535 1.14645L14.8535 3.14645C15.0488 3.34171 15.0488 3.65829 14.8535 3.85355L10.9109 7.79618C10.8349 7.87218 10.7471 7.93543 10.651 7.9835L6.72359 9.94721C6.53109 10.0435 6.29861 10.0057 6.14643 9.85355C5.99425 9.70137 5.95652 9.46889 6.05277 9.27639L8.01648 5.34897C8.06455 5.25283 8.1278 5.16507 8.2038 5.08907L12.1464 1.14645ZM12.5 2.20711L8.91091 5.79618L7.87266 7.87267L8.12731 8.12732L10.2038 7.08907L13.7929 3.5L12.5 2.20711ZM9.99998 2L8.99998 3H4.9C4.47171 3 4.18056 3.00039 3.95552 3.01877C3.73631 3.03668 3.62421 3.06915 3.54601 3.10899C3.35785 3.20487 3.20487 3.35785 3.10899 3.54601C3.06915 3.62421 3.03669 3.73631 3.01878 3.95552C3.00039 4.18056 3 4.47171 3 4.9V11.1C3 11.5283 3.00039 11.8194 3.01878 12.0445C3.03669 12.2637 3.06915 12.3758 3.10899 12.454C3.20487 12.6422 3.35785 12.7951 3.54601 12.891C3.62421 12.9309 3.73631 12.9633 3.95552 12.9812C4.18056 12.9996 4.47171 13 4.9 13H11.1C11.5283 13 11.8194 12.9996 12.0445 12.9812C12.2637 12.9633 12.3758 12.9309 12.454 12.891C12.6422 12.7951 12.7951 12.6422 12.891 12.454C12.9309 12.3758 12.9633 12.2637 12.9812 12.0445C12.9996 11.8194 13 11.5283 13 11.1V6.99998L14 5.99998V11.1V11.1207C14 11.5231 14 11.8553 13.9779 12.1259C13.9549 12.407 13.9057 12.6653 13.782 12.908C13.5903 13.2843 13.2843 13.5903 12.908 13.782C12.6653 13.9057 12.407 13.9549 12.1259 13.9779C11.8553 14 11.5231 14 11.1207 14H11.1H4.9H4.87934C4.47686 14 4.14468 14 3.87409 13.9779C3.59304 13.9549 3.33469 13.9057 3.09202 13.782C2.7157 13.5903 2.40973 13.2843 2.21799 12.908C2.09434 12.6653 2.04506 12.407 2.0221 12.1259C1.99999 11.8553 1.99999 11.5231 2 11.1207V11.1206V11.1V4.9V4.87935V4.87932V4.87931C1.99999 4.47685 1.99999 4.14468 2.0221 3.87409C2.04506 3.59304 2.09434 3.33469 2.21799 3.09202C2.40973 2.71569 2.7157 2.40973 3.09202 2.21799C3.33469 2.09434 3.59304 2.04506 3.87409 2.0221C4.14468 1.99999 4.47685 1.99999 4.87932 2H4.87935H4.9H9.99998Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),DQt=["color"],hWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,DQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82707 7.49972C1.82707 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82707 10.6327 1.82707 7.49972ZM7.50003 4C7.77617 4 8.00003 4.22386 8.00003 4.5V7H10.5C10.7762 7 11 7.22386 11 7.5C11 7.77614 10.7762 8 10.5 8H8.00003V10.5C8.00003 10.7761 7.77617 11 7.50003 11C7.22389 11 7.00003 10.7761 7.00003 10.5V8H4.50003C4.22389 8 4.00003 7.77614 4.00003 7.5C4.00003 7.22386 4.22389 7 4.50003 7H7.00003V4.5C7.00003 4.22386 7.22389 4 7.50003 4Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),IQt=["color"],fWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,IQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M0.877075 7.49972C0.877075 3.84204 3.84222 0.876892 7.49991 0.876892C11.1576 0.876892 14.1227 3.84204 14.1227 7.49972C14.1227 11.1574 11.1576 14.1226 7.49991 14.1226C3.84222 14.1226 0.877075 11.1574 0.877075 7.49972ZM7.49991 1.82689C4.36689 1.82689 1.82708 4.36671 1.82708 7.49972C1.82708 10.6327 4.36689 13.1726 7.49991 13.1726C10.6329 13.1726 13.1727 10.6327 13.1727 7.49972C13.1727 4.36671 10.6329 1.82689 7.49991 1.82689ZM8.24993 10.5C8.24993 10.9142 7.91414 11.25 7.49993 11.25C7.08571 11.25 6.74993 10.9142 6.74993 10.5C6.74993 10.0858 7.08571 9.75 7.49993 9.75C7.91414 9.75 8.24993 10.0858 8.24993 10.5ZM6.05003 6.25C6.05003 5.57211 6.63511 4.925 7.50003 4.925C8.36496 4.925 8.95003 5.57211 8.95003 6.25C8.95003 6.74118 8.68002 6.99212 8.21447 7.27494C8.16251 7.30651 8.10258 7.34131 8.03847 7.37854L8.03841 7.37858C7.85521 7.48497 7.63788 7.61119 7.47449 7.73849C7.23214 7.92732 6.95003 8.23198 6.95003 8.7C6.95004 9.00376 7.19628 9.25 7.50004 9.25C7.8024 9.25 8.04778 9.00601 8.05002 8.70417L8.05056 8.7033C8.05924 8.6896 8.08493 8.65735 8.15058 8.6062C8.25207 8.52712 8.36508 8.46163 8.51567 8.37436L8.51571 8.37433C8.59422 8.32883 8.68296 8.27741 8.78559 8.21506C9.32004 7.89038 10.05 7.35382 10.05 6.25C10.05 4.92789 8.93511 3.825 7.50003 3.825C6.06496 3.825 4.95003 4.92789 4.95003 6.25C4.95003 6.55376 5.19628 6.8 5.50003 6.8C5.80379 6.8 6.05003 6.55376 6.05003 6.25Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),AQt=["color"],gWn=E.forwardRef(function(n,e){var t=n.color,i=t===void 0?"currentColor":t,r=nl(n,AQt);return E.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{ref:e}),E.createElement("path",{d:"M5.49998 0.5C5.49998 0.223858 5.72383 0 5.99998 0H7.49998H8.99998C9.27612 0 9.49998 0.223858 9.49998 0.5C9.49998 0.776142 9.27612 1 8.99998 1H7.99998V2.11922C9.09832 2.20409 10.119 2.56622 10.992 3.13572C11.0116 3.10851 11.0336 3.08252 11.058 3.05806L11.858 2.25806C12.1021 2.01398 12.4978 2.01398 12.7419 2.25806C12.986 2.50214 12.986 2.89786 12.7419 3.14194L11.967 3.91682C13.1595 5.07925 13.9 6.70314 13.9 8.49998C13.9 12.0346 11.0346 14.9 7.49998 14.9C3.96535 14.9 1.09998 12.0346 1.09998 8.49998C1.09998 5.13362 3.69904 2.3743 6.99998 2.11922V1H5.99998C5.72383 1 5.49998 0.776142 5.49998 0.5ZM2.09998 8.49998C2.09998 5.51764 4.51764 3.09998 7.49998 3.09998C10.4823 3.09998 12.9 5.51764 12.9 8.49998C12.9 11.4823 10.4823 13.9 7.49998 13.9C4.51764 13.9 2.09998 11.4823 2.09998 8.49998ZM7.99998 4.5C7.99998 4.22386 7.77612 4 7.49998 4C7.22383 4 6.99998 4.22386 6.99998 4.5V9.5C6.99998 9.77614 7.22383 10 7.49998 10C7.77612 10 7.99998 9.77614 7.99998 9.5V4.5Z",fill:i,fillRule:"evenodd",clipRule:"evenodd"}))}),NQt=["title"],RQt=["title"];function R7(){return R7=Object.assign||function(n){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function PQt(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}var pWn=function(e){var t=e.title,i=mHe(e,NQt);return U.createElement("svg",R7({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},i),t&&U.createElement("title",null,t),U.createElement("path",{fill:"#D80027",d:"M0 0h513v342H0z"}),U.createElement("path",{d:"m226.8 239.2-9.7-15.6-17.9 4.4 11.9-14.1-9.7-15.6 17.1 6.9 11.8-14.1-1.3 18.4 17.1 6.9-17.9 4.4zM290.6 82l-10.1 15.4 11.6 14.3-17.7-4.8-10.1 15.5-1-18.4-17.7-4.8 17.2-6.6-1-18.4 11.6 14.3zm-54.4-56.6-2 18.3 16.8 7.6-18 3.8-2 18.3-9.2-16-17.9 3.8 12.3-13.7-9.2-15.9 16.8 7.5zm56.6 136.4-14.9 10.9 5.8 17.5-14.9-10.8-14.9 11 5.6-17.6-14.9-10.7 18.4-.1 5.6-17.6 5.8 17.5zM115 46.3l17.3 53.5h56.2l-45.4 32.9 17.3 53.5-45.4-33-45.5 33 17.4-53.5-45.5-32.9h56.3z",fill:"#FFDA44"}))},mWn=function(e){var t=e.title,i=mHe(e,RQt);return U.createElement("svg",R7({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 513 342"},i),t&&U.createElement("title",null,t),U.createElement("g",{fill:"#FFF"},U.createElement("path",{d:"M0 0h513v341.3H0V0z"}),U.createElement("path",{d:"M311.7 230 513 341.3v-31.5L369.3 230h-57.6zM200.3 111.3 0 0v31.5l143.7 79.8h56.6z"})),U.createElement("path",{d:"M393.8 230 513 295.7V230H393.8zm-82.1 0L513 341.3v-31.5L369.3 230h-57.6zm146.9 111.3-147-81.7v81.7h147zM90.3 230 0 280.2V230h90.3zm110 14.2v97.2H25.5l174.8-97.2zm-82.1-132.9L0 45.6v65.7h118.2zm82.1 0L0 0v31.5l143.7 79.8h56.6zM53.4 0l147 81.7V0h-147zm368.3 111.3L513 61.1v50.2h-91.3zm-110-14.2V0h174.9L311.7 97.1z",fill:"#0052B4"}),U.createElement("g",{fill:"#D80027"},U.createElement("path",{d:"M288 0h-64v138.7H0v64h224v138.7h64V202.7h224v-64H288V0z"}),U.createElement("path",{d:"M311.7 230 513 341.3v-31.5L369.3 230h-57.6zm-168 0L0 309.9v31.5L200.3 230h-56.6zm56.6-118.7L0 0v31.5l143.7 79.8h56.6zm168 0L513 31.5V0L311.7 111.3h56.6z"})))};const OQt=["top","right","bottom","left"],Wb=Math.min,Rd=Math.max,P7=Math.round,B3=Math.floor,Hb=n=>({x:n,y:n}),MQt={left:"right",right:"left",bottom:"top",top:"bottom"},FQt={start:"end",end:"start"};function Die(n,e,t){return Rd(n,Wb(e,t))}function s0(n,e){return typeof n=="function"?n(e):n}function o0(n){return n.split("-")[0]}function w2(n){return n.split("-")[1]}function che(n){return n==="x"?"y":"x"}function uhe(n){return n==="y"?"height":"width"}function C2(n){return["top","bottom"].includes(o0(n))?"y":"x"}function dhe(n){return che(C2(n))}function BQt(n,e,t){t===void 0&&(t=!1);const i=w2(n),r=dhe(n),s=uhe(r);let o=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=O7(o)),[o,O7(o)]}function $Qt(n){const e=O7(n);return[Iie(n),e,Iie(e)]}function Iie(n){return n.replace(/start|end/g,e=>FQt[e])}function WQt(n,e,t){const i=["left","right"],r=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?r:i:e?i:r;case"left":case"right":return e?s:o;default:return[]}}function HQt(n,e,t,i){const r=w2(n);let s=WQt(o0(n),t==="start",i);return r&&(s=s.map(o=>o+"-"+r),e&&(s=s.concat(s.map(Iie)))),s}function O7(n){return n.replace(/left|right|bottom|top/g,e=>MQt[e])}function VQt(n){return{top:0,right:0,bottom:0,left:0,...n}}function _He(n){return typeof n!="number"?VQt(n):{top:n,right:n,bottom:n,left:n}}function M7(n){return{...n,top:n.y,left:n.x,right:n.x+n.width,bottom:n.y+n.height}}function qLe(n,e,t){let{reference:i,floating:r}=n;const s=C2(e),o=dhe(e),a=uhe(o),l=o0(e),c=s==="y",u=i.x+i.width/2-r.width/2,d=i.y+i.height/2-r.height/2,h=i[a]/2-r[a]/2;let f;switch(l){case"top":f={x:u,y:i.y-r.height};break;case"bottom":f={x:u,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:d};break;case"left":f={x:i.x-r.width,y:d};break;default:f={x:i.x,y:i.y}}switch(w2(e)){case"start":f[o]-=h*(t&&c?-1:1);break;case"end":f[o]+=h*(t&&c?-1:1);break}return f}const zQt=async(n,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:r}),{x:u,y:d}=qLe(c,i,l),h=i,f={},g=0;for(let p=0;p({name:"arrow",options:n,async fn(e){const{x:t,y:i,placement:r,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=s0(n,e)||{};if(c==null)return{};const d=_He(u),h={x:t,y:i},f=dhe(r),g=uhe(f),p=await o.getDimensions(c),m=f==="y",_=m?"top":"left",v=m?"bottom":"right",y=m?"clientHeight":"clientWidth",C=s.reference[g]+s.reference[f]-h[f]-s.floating[g],x=h[f]-s.reference[f],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let L=k?k[y]:0;(!L||!await(o.isElement==null?void 0:o.isElement(k)))&&(L=a.floating[y]||s.floating[g]);const D=C/2-x/2,I=L/2-p[g]/2-1,O=Wb(d[_],I),M=Wb(d[v],I),B=O,G=L-p[g]-M,W=L/2-p[g]/2+D,z=Die(B,W,G),q=!l.arrow&&w2(r)!=null&&W!==z&&s.reference[g]/2-(WB<=0)){var I,O;const B=(((I=s.flip)==null?void 0:I.index)||0)+1,G=x[B];if(G)return{data:{index:B,overflows:D},reset:{placement:G}};let W=(O=D.filter(z=>z.overflows[0]<=0).sort((z,q)=>z.overflows[1]-q.overflows[1])[0])==null?void 0:O.placement;if(!W)switch(f){case"bestFit":{var M;const z=(M=D.map(q=>[q.placement,q.overflows.filter(ee=>ee>0).reduce((ee,Z)=>ee+Z,0)]).sort((q,ee)=>q[1]-ee[1])[0])==null?void 0:M[0];z&&(W=z);break}case"initialPlacement":W=a;break}if(r!==W)return{reset:{placement:W}}}return{}}}};function KLe(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function GLe(n){return OQt.some(e=>n[e]>=0)}const qQt=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:i="referenceHidden",...r}=s0(n,e);switch(i){case"referenceHidden":{const s=await RR(e,{...r,elementContext:"reference"}),o=KLe(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:GLe(o)}}}case"escaped":{const s=await RR(e,{...r,altBoundary:!0}),o=KLe(s,t.floating);return{data:{escapedOffsets:o,escaped:GLe(o)}}}default:return{}}}}};async function KQt(n,e){const{placement:t,platform:i,elements:r}=n,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=o0(t),a=w2(t),l=C2(t)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,d=s0(e,n);let{mainAxis:h,crossAxis:f,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&typeof g=="number"&&(f=a==="end"?g*-1:g),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}const GQt=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,i;const{x:r,y:s,placement:o,middlewareData:a}=e,l=await KQt(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:o}}}}},YQt=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:i,placement:r}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:m=>{let{x:_,y:v}=m;return{x:_,y:v}}},...l}=s0(n,e),c={x:t,y:i},u=await RR(e,l),d=C2(o0(r)),h=che(d);let f=c[h],g=c[d];if(s){const m=h==="y"?"top":"left",_=h==="y"?"bottom":"right",v=f+u[m],y=f-u[_];f=Die(v,f,y)}if(o){const m=d==="y"?"top":"left",_=d==="y"?"bottom":"right",v=g+u[m],y=g-u[_];g=Die(v,g,y)}const p=a.fn({...e,[h]:f,[d]:g});return{...p,data:{x:p.x-t,y:p.y-i}}}}},ZQt=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:i,placement:r,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=s0(n,e),u={x:t,y:i},d=C2(r),h=che(d);let f=u[h],g=u[d];const p=s0(a,e),m=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const y=h==="y"?"height":"width",C=s.reference[h]-s.floating[y]+m.mainAxis,x=s.reference[h]+s.reference[y]-m.mainAxis;fx&&(f=x)}if(c){var _,v;const y=h==="y"?"width":"height",C=["top","left"].includes(o0(r)),x=s.reference[d]-s.floating[y]+(C&&((_=o.offset)==null?void 0:_[d])||0)+(C?0:m.crossAxis),k=s.reference[d]+s.reference[y]+(C?0:((v=o.offset)==null?void 0:v[d])||0)-(C?m.crossAxis:0);gk&&(g=k)}return{[h]:f,[d]:g}}}},XQt=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:i,platform:r,elements:s}=e,{apply:o=()=>{},...a}=s0(n,e),l=await RR(e,a),c=o0(t),u=w2(t),d=C2(t)==="y",{width:h,height:f}=i.floating;let g,p;c==="top"||c==="bottom"?(g=c,p=u===(await(r.isRTL==null?void 0:r.isRTL(s.floating))?"start":"end")?"left":"right"):(p=c,g=u==="end"?"top":"bottom");const m=f-l[g],_=h-l[p],v=!e.middlewareData.shift;let y=m,C=_;if(d){const k=h-l.left-l.right;C=u||v?Wb(_,k):k}else{const k=f-l.top-l.bottom;y=u||v?Wb(m,k):k}if(v&&!u){const k=Rd(l.left,0),L=Rd(l.right,0),D=Rd(l.top,0),I=Rd(l.bottom,0);d?C=h-2*(k!==0||L!==0?k+L:Rd(l.left,l.right)):y=f-2*(D!==0||I!==0?D+I:Rd(l.top,l.bottom))}await o({...e,availableWidth:C,availableHeight:y});const x=await r.getDimensions(s.floating);return h!==x.width||f!==x.height?{reset:{rects:!0}}:{}}}};function Vb(n){return vHe(n)?(n.nodeName||"").toLowerCase():"#document"}function Yd(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function C0(n){var e;return(e=(vHe(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function vHe(n){return n instanceof Node||n instanceof Yd(n).Node}function a0(n){return n instanceof Element||n instanceof Yd(n).Element}function rm(n){return n instanceof HTMLElement||n instanceof Yd(n).HTMLElement}function YLe(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Yd(n).ShadowRoot}function FO(n){const{overflow:e,overflowX:t,overflowY:i,display:r}=uf(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(r)}function QQt(n){return["table","td","th"].includes(Vb(n))}function hhe(n){const e=fhe(),t=uf(n);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function JQt(n){let e=iL(n);for(;rm(e)&&!VH(e);){if(hhe(e))return e;e=iL(e)}return null}function fhe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function VH(n){return["html","body","#document"].includes(Vb(n))}function uf(n){return Yd(n).getComputedStyle(n)}function zH(n){return a0(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function iL(n){if(Vb(n)==="html")return n;const e=n.assignedSlot||n.parentNode||YLe(n)&&n.host||C0(n);return YLe(e)?e.host:e}function bHe(n){const e=iL(n);return VH(e)?n.ownerDocument?n.ownerDocument.body:n.body:rm(e)&&FO(e)?e:bHe(e)}function PR(n,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=bHe(n),s=r===((i=n.ownerDocument)==null?void 0:i.body),o=Yd(r);return s?e.concat(o,o.visualViewport||[],FO(r)?r:[],o.frameElement&&t?PR(o.frameElement):[]):e.concat(r,PR(r,[],t))}function yHe(n){const e=uf(n);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=rm(n),s=r?n.offsetWidth:t,o=r?n.offsetHeight:i,a=P7(t)!==s||P7(i)!==o;return a&&(t=s,i=o),{width:t,height:i,$:a}}function ghe(n){return a0(n)?n:n.contextElement}function Ok(n){const e=ghe(n);if(!rm(e))return Hb(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:s}=yHe(e);let o=(s?P7(t.width):t.width)/i,a=(s?P7(t.height):t.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const eJt=Hb(0);function wHe(n){const e=Yd(n);return!fhe()||!e.visualViewport?eJt:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function tJt(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Yd(n)?!1:e}function nC(n,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),s=ghe(n);let o=Hb(1);e&&(i?a0(i)&&(o=Ok(i)):o=Ok(n));const a=tJt(s,t,i)?wHe(s):Hb(0);let l=(r.left+a.x)/o.x,c=(r.top+a.y)/o.y,u=r.width/o.x,d=r.height/o.y;if(s){const h=Yd(s),f=i&&a0(i)?Yd(i):i;let g=h,p=g.frameElement;for(;p&&i&&f!==g;){const m=Ok(p),_=p.getBoundingClientRect(),v=uf(p),y=_.left+(p.clientLeft+parseFloat(v.paddingLeft))*m.x,C=_.top+(p.clientTop+parseFloat(v.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=y,c+=C,g=Yd(p),p=g.frameElement}}return M7({width:u,height:d,x:l,y:c})}const nJt=[":popover-open",":modal"];function CHe(n){return nJt.some(e=>{try{return n.matches(e)}catch{return!1}})}function iJt(n){let{elements:e,rect:t,offsetParent:i,strategy:r}=n;const s=r==="fixed",o=C0(i),a=e?CHe(e.floating):!1;if(i===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},c=Hb(1);const u=Hb(0),d=rm(i);if((d||!d&&!s)&&((Vb(i)!=="body"||FO(o))&&(l=zH(i)),rm(i))){const h=nC(i);c=Ok(i),u.x=h.x+i.clientLeft,u.y=h.y+i.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x,y:t.y*c.y-l.scrollTop*c.y+u.y}}function rJt(n){return Array.from(n.getClientRects())}function xHe(n){return nC(C0(n)).left+zH(n).scrollLeft}function sJt(n){const e=C0(n),t=zH(n),i=n.ownerDocument.body,r=Rd(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=Rd(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+xHe(n);const a=-t.scrollTop;return uf(i).direction==="rtl"&&(o+=Rd(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}function oJt(n,e){const t=Yd(n),i=C0(n),r=t.visualViewport;let s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;const c=fhe();(!c||c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a,y:l}}function aJt(n,e){const t=nC(n,!0,e==="fixed"),i=t.top+n.clientTop,r=t.left+n.clientLeft,s=rm(n)?Ok(n):Hb(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,l=r*s.x,c=i*s.y;return{width:o,height:a,x:l,y:c}}function ZLe(n,e,t){let i;if(e==="viewport")i=oJt(n,t);else if(e==="document")i=sJt(C0(n));else if(a0(e))i=aJt(e,t);else{const r=wHe(n);i={...e,x:e.x-r.x,y:e.y-r.y}}return M7(i)}function SHe(n,e){const t=iL(n);return t===e||!a0(t)||VH(t)?!1:uf(t).position==="fixed"||SHe(t,e)}function lJt(n,e){const t=e.get(n);if(t)return t;let i=PR(n,[],!1).filter(a=>a0(a)&&Vb(a)!=="body"),r=null;const s=uf(n).position==="fixed";let o=s?iL(n):n;for(;a0(o)&&!VH(o);){const a=uf(o),l=hhe(o);!l&&a.position==="fixed"&&(r=null),(s?!l&&!r:!l&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||FO(o)&&!l&&SHe(n,o))?i=i.filter(u=>u!==o):r=a,o=iL(o)}return e.set(n,i),i}function cJt(n){let{element:e,boundary:t,rootBoundary:i,strategy:r}=n;const o=[...t==="clippingAncestors"?lJt(e,this._c):[].concat(t),i],a=o[0],l=o.reduce((c,u)=>{const d=ZLe(e,u,r);return c.top=Rd(d.top,c.top),c.right=Wb(d.right,c.right),c.bottom=Wb(d.bottom,c.bottom),c.left=Rd(d.left,c.left),c},ZLe(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function uJt(n){const{width:e,height:t}=yHe(n);return{width:e,height:t}}function dJt(n,e,t){const i=rm(e),r=C0(e),s=t==="fixed",o=nC(n,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Hb(0);if(i||!i&&!s)if((Vb(e)!=="body"||FO(r))&&(a=zH(e)),i){const d=nC(e,!0,s,e);l.x=d.x+e.clientLeft,l.y=d.y+e.clientTop}else r&&(l.x=xHe(r));const c=o.left+a.scrollLeft-l.x,u=o.top+a.scrollTop-l.y;return{x:c,y:u,width:o.width,height:o.height}}function XLe(n,e){return!rm(n)||uf(n).position==="fixed"?null:e?e(n):n.offsetParent}function kHe(n,e){const t=Yd(n);if(!rm(n)||CHe(n))return t;let i=XLe(n,e);for(;i&&QQt(i)&&uf(i).position==="static";)i=XLe(i,e);return i&&(Vb(i)==="html"||Vb(i)==="body"&&uf(i).position==="static"&&!hhe(i))?t:i||JQt(n)||t}const hJt=async function(n){const e=this.getOffsetParent||kHe,t=this.getDimensions;return{reference:dJt(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,...await t(n.floating)}}};function fJt(n){return uf(n).direction==="rtl"}const gJt={convertOffsetParentRelativeRectToViewportRelativeRect:iJt,getDocumentElement:C0,getClippingRect:cJt,getOffsetParent:kHe,getElementRects:hJt,getClientRects:rJt,getDimensions:uJt,getScale:Ok,isElement:a0,isRTL:fJt};function pJt(n,e){let t=null,i;const r=C0(n);function s(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:c,top:u,width:d,height:h}=n.getBoundingClientRect();if(a||e(),!d||!h)return;const f=B3(u),g=B3(r.clientWidth-(c+d)),p=B3(r.clientHeight-(u+h)),m=B3(c),v={rootMargin:-f+"px "+-g+"px "+-p+"px "+-m+"px",threshold:Rd(0,Wb(1,l))||1};let y=!0;function C(x){const k=x[0].intersectionRatio;if(k!==l){if(!y)return o();k?o(!1,k):i=setTimeout(()=>{o(!1,1e-7)},100)}y=!1}try{t=new IntersectionObserver(C,{...v,root:r.ownerDocument})}catch{t=new IntersectionObserver(C,v)}t.observe(n)}return o(!0),s}function mJt(n,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=ghe(n),u=r||s?[...c?PR(c):[],...PR(e)]:[];u.forEach(_=>{r&&_.addEventListener("scroll",t,{passive:!0}),s&&_.addEventListener("resize",t)});const d=c&&a?pJt(c,t):null;let h=-1,f=null;o&&(f=new ResizeObserver(_=>{let[v]=_;v&&v.target===c&&f&&(f.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=f)==null||y.observe(e)})),t()}),c&&!l&&f.observe(c),f.observe(e));let g,p=l?nC(n):null;l&&m();function m(){const _=nC(n);p&&(_.x!==p.x||_.y!==p.y||_.width!==p.width||_.height!==p.height)&&t(),p=_,g=requestAnimationFrame(m)}return t(),()=>{var _;u.forEach(v=>{r&&v.removeEventListener("scroll",t),s&&v.removeEventListener("resize",t)}),d?.(),(_=f)==null||_.disconnect(),f=null,l&&cancelAnimationFrame(g)}}const _Jt=YQt,vJt=jQt,bJt=XQt,yJt=qQt,QLe=UQt,wJt=ZQt,CJt=(n,e,t)=>{const i=new Map,r={platform:gJt,...t},s={...r.platform,_c:i};return zQt(n,e,{...r,platform:s})},xJt=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:i,padding:r}=typeof n=="function"?n(t):n;return i&&e(i)?i.current!=null?QLe({element:i.current,padding:r}).fn(t):{}:i?QLe({element:i,padding:r}).fn(t):{}}}};var IF=typeof document<"u"?E.useLayoutEffect:E.useEffect;function F7(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,i,r;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(i=t;i--!==0;)if(!F7(n[i],e[i]))return!1;return!0}if(r=Object.keys(n),t=r.length,t!==Object.keys(e).length)return!1;for(i=t;i--!==0;)if(!{}.hasOwnProperty.call(e,r[i]))return!1;for(i=t;i--!==0;){const s=r[i];if(!(s==="_owner"&&n.$$typeof)&&!F7(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function EHe(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function JLe(n,e){const t=EHe(n);return Math.round(e*t)/t}function e2e(n){const e=E.useRef(n);return IF(()=>{e.current=n}),e}function SJt(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[u,d]=E.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[h,f]=E.useState(i);F7(h,i)||f(i);const[g,p]=E.useState(null),[m,_]=E.useState(null),v=E.useCallback(ee=>{ee!==k.current&&(k.current=ee,p(ee))},[]),y=E.useCallback(ee=>{ee!==L.current&&(L.current=ee,_(ee))},[]),C=s||g,x=o||m,k=E.useRef(null),L=E.useRef(null),D=E.useRef(u),I=l!=null,O=e2e(l),M=e2e(r),B=E.useCallback(()=>{if(!k.current||!L.current)return;const ee={placement:e,strategy:t,middleware:h};M.current&&(ee.platform=M.current),CJt(k.current,L.current,ee).then(Z=>{const j={...Z,isPositioned:!0};G.current&&!F7(D.current,j)&&(D.current=j,h0.flushSync(()=>{d(j)}))})},[h,e,t,M]);IF(()=>{c===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,d(ee=>({...ee,isPositioned:!1})))},[c]);const G=E.useRef(!1);IF(()=>(G.current=!0,()=>{G.current=!1}),[]),IF(()=>{if(C&&(k.current=C),x&&(L.current=x),C&&x){if(O.current)return O.current(C,x,B);B()}},[C,x,B,O,I]);const W=E.useMemo(()=>({reference:k,floating:L,setReference:v,setFloating:y}),[v,y]),z=E.useMemo(()=>({reference:C,floating:x}),[C,x]),q=E.useMemo(()=>{const ee={position:t,left:0,top:0};if(!z.floating)return ee;const Z=JLe(z.floating,u.x),j=JLe(z.floating,u.y);return a?{...ee,transform:"translate("+Z+"px, "+j+"px)",...EHe(z.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:Z,top:j}},[t,a,z.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:B,refs:W,elements:z,floatingStyles:q}),[u,B,W,z,q])}var kJt="Arrow",LHe=E.forwardRef((n,e)=>{const{children:t,width:i=10,height:r=5,...s}=n;return ae.jsx(Pn.svg,{...s,ref:e,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?t:ae.jsx("polygon",{points:"0,0 30,0 15,10"})})});LHe.displayName=kJt;var EJt=LHe;function LJt(n){const[e,t]=E.useState(void 0);return es(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else t(void 0)},[n]),e}var phe="Popper",[THe,c1]=Ac(phe),[TJt,DHe]=THe(phe),IHe=n=>{const{__scopePopper:e,children:t}=n,[i,r]=E.useState(null);return ae.jsx(TJt,{scope:e,anchor:i,onAnchorChange:r,children:t})};IHe.displayName=phe;var AHe="PopperAnchor",NHe=E.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:i,...r}=n,s=DHe(AHe,t),o=E.useRef(null),a=gi(e,o);return E.useEffect(()=>{s.onAnchorChange(i?.current||o.current)}),i?null:ae.jsx(Pn.div,{...r,ref:a})});NHe.displayName=AHe;var mhe="PopperContent",[DJt,IJt]=THe(mhe),RHe=E.forwardRef((n,e)=>{const{__scopePopper:t,side:i="bottom",sideOffset:r=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:f="optimized",onPlaced:g,...p}=n,m=DHe(mhe,t),[_,v]=E.useState(null),y=gi(e,Re=>v(Re)),[C,x]=E.useState(null),k=LJt(C),L=k?.width??0,D=k?.height??0,I=i+(s!=="center"?"-"+s:""),O=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},M=Array.isArray(c)?c:[c],B=M.length>0,G={padding:O,boundary:M.filter(NJt),altBoundary:B},{refs:W,floatingStyles:z,placement:q,isPositioned:ee,middlewareData:Z}=SJt({strategy:"fixed",placement:I,whileElementsMounted:(...Re)=>mJt(...Re,{animationFrame:f==="always"}),elements:{reference:m.anchor},middleware:[GQt({mainAxis:r+D,alignmentAxis:o}),l&&_Jt({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?wJt():void 0,...G}),l&&vJt({...G}),bJt({...G,apply:({elements:Re,rects:_t,availableWidth:Qe,availableHeight:pt})=>{const{width:gt,height:Ue}=_t.reference,wn=Re.floating.style;wn.setProperty("--radix-popper-available-width",`${Qe}px`),wn.setProperty("--radix-popper-available-height",`${pt}px`),wn.setProperty("--radix-popper-anchor-width",`${gt}px`),wn.setProperty("--radix-popper-anchor-height",`${Ue}px`)}}),C&&xJt({element:C,padding:a}),RJt({arrowWidth:L,arrowHeight:D}),h&&yJt({strategy:"referenceHidden",...G})]}),[j,te]=MHe(q),le=Ua(g);es(()=>{ee&&le?.()},[ee,le]);const ue=Z.arrow?.x,de=Z.arrow?.y,we=Z.arrow?.centerOffset!==0,[xe,Me]=E.useState();return es(()=>{_&&Me(window.getComputedStyle(_).zIndex)},[_]),ae.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:ee?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[Z.transformOrigin?.x,Z.transformOrigin?.y].join(" "),...Z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:ae.jsx(DJt,{scope:t,placedSide:j,onArrowChange:x,arrowX:ue,arrowY:de,shouldHideArrow:we,children:ae.jsx(Pn.div,{"data-side":j,"data-align":te,...p,ref:y,style:{...p.style,animation:ee?void 0:"none"}})})})});RHe.displayName=mhe;var PHe="PopperArrow",AJt={top:"bottom",right:"left",bottom:"top",left:"right"},OHe=E.forwardRef(function(e,t){const{__scopePopper:i,...r}=e,s=IJt(PHe,i),o=AJt[s.placedSide];return ae.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:ae.jsx(EJt,{...r,ref:t,style:{...r.style,display:"block"}})})});OHe.displayName=PHe;function NJt(n){return n!==null}var RJt=n=>({name:"transformOrigin",options:n,fn(e){const{placement:t,rects:i,middlewareData:r}=e,o=r.arrow?.centerOffset!==0,a=o?0:n.arrowWidth,l=o?0:n.arrowHeight,[c,u]=MHe(t),d={start:"0%",center:"50%",end:"100%"}[u],h=(r.arrow?.x??0)+a/2,f=(r.arrow?.y??0)+l/2;let g="",p="";return c==="bottom"?(g=o?d:`${h}px`,p=`${-l}px`):c==="top"?(g=o?d:`${h}px`,p=`${i.floating.height+l}px`):c==="right"?(g=`${-l}px`,p=o?d:`${f}px`):c==="left"&&(g=`${i.floating.width+l}px`,p=o?d:`${f}px`),{data:{x:g,y:p}}}});function MHe(n){const[e,t="center"]=n.split("-");return[e,t]}var UH=IHe,BO=NHe,jH=RHe,qH=OHe;function PJt(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var $O=n=>{const{present:e,children:t}=n,i=OJt(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,MJt(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};$O.displayName="Presence";function OJt(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=PJt(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=$3(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=$3(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=$3(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=$3(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function $3(n){return n?.animationName||"none"}function MJt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var FHe=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(BJt);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(Aie,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(Aie,{...i,ref:e,children:t})});FHe.displayName="Slot";var Aie=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=WJt(t);return E.cloneElement(t,{...$Jt(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});Aie.displayName="SlotClone";var FJt=({children:n})=>ae.jsx(ae.Fragment,{children:n});function BJt(n){return E.isValidElement(n)&&n.type===FJt}function $Jt(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function WJt(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Nie=["Enter"," "],HJt=["ArrowDown","PageUp","Home"],BHe=["ArrowUp","PageDown","End"],VJt=[...HJt,...BHe],zJt={ltr:[...Nie,"ArrowRight"],rtl:[...Nie,"ArrowLeft"]},UJt={ltr:["ArrowLeft"],rtl:["ArrowRight"]},WO="Menu",[OR,jJt,qJt]=eae(WO),[OC,$He]=Ac(WO,[qJt,c1,C$]),KH=c1(),WHe=C$(),[KJt,MC]=OC(WO),[GJt,HO]=OC(WO),HHe=n=>{const{__scopeMenu:e,open:t=!1,children:i,dir:r,onOpenChange:s,modal:o=!0}=n,a=KH(e),[l,c]=E.useState(null),u=E.useRef(!1),d=Ua(s),h=$P(r);return E.useEffect(()=>{const f=()=>{u.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>u.current=!1;return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),ae.jsx(UH,{...a,children:ae.jsx(KJt,{scope:e,open:t,onOpenChange:d,content:l,onContentChange:c,children:ae.jsx(GJt,{scope:e,onClose:E.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:i})})})};HHe.displayName=WO;var YJt="MenuAnchor",_he=E.forwardRef((n,e)=>{const{__scopeMenu:t,...i}=n,r=KH(t);return ae.jsx(BO,{...r,...i,ref:e})});_he.displayName=YJt;var vhe="MenuPortal",[ZJt,VHe]=OC(vhe,{forceMount:void 0}),zHe=n=>{const{__scopeMenu:e,forceMount:t,children:i,container:r}=n,s=MC(vhe,e);return ae.jsx(ZJt,{scope:e,forceMount:t,children:ae.jsx($O,{present:t||s.open,children:ae.jsx(y2,{asChild:!0,container:r,children:i})})})};zHe.displayName=vhe;var Jh="MenuContent",[XJt,bhe]=OC(Jh),UHe=E.forwardRef((n,e)=>{const t=VHe(Jh,n.__scopeMenu),{forceMount:i=t.forceMount,...r}=n,s=MC(Jh,n.__scopeMenu),o=HO(Jh,n.__scopeMenu);return ae.jsx(OR.Provider,{scope:n.__scopeMenu,children:ae.jsx($O,{present:i||s.open,children:ae.jsx(OR.Slot,{scope:n.__scopeMenu,children:o.modal?ae.jsx(QJt,{...r,ref:e}):ae.jsx(JJt,{...r,ref:e})})})})}),QJt=E.forwardRef((n,e)=>{const t=MC(Jh,n.__scopeMenu),i=E.useRef(null),r=gi(e,i);return E.useEffect(()=>{const s=i.current;if(s)return MO(s)},[]),ae.jsx(yhe,{...n,ref:r,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:Kt(n.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})}),JJt=E.forwardRef((n,e)=>{const t=MC(Jh,n.__scopeMenu);return ae.jsx(yhe,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})}),yhe=E.forwardRef((n,e)=>{const{__scopeMenu:t,loop:i=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:g,...p}=n,m=MC(Jh,t),_=HO(Jh,t),v=KH(t),y=WHe(t),C=jJt(t),[x,k]=E.useState(null),L=E.useRef(null),D=gi(e,L,m.onContentChange),I=E.useRef(0),O=E.useRef(""),M=E.useRef(0),B=E.useRef(null),G=E.useRef("right"),W=E.useRef(0),z=g?OO:E.Fragment,q=g?{as:FHe,allowPinchZoom:!0}:void 0,ee=j=>{const te=O.current+j,le=C().filter(Re=>!Re.disabled),ue=document.activeElement,de=le.find(Re=>Re.ref.current===ue)?.textValue,we=le.map(Re=>Re.textValue),xe=den(we,te,de),Me=le.find(Re=>Re.textValue===xe)?.ref.current;(function Re(_t){O.current=_t,window.clearTimeout(I.current),_t!==""&&(I.current=window.setTimeout(()=>Re(""),1e3))})(te),Me&&setTimeout(()=>Me.focus())};E.useEffect(()=>()=>window.clearTimeout(I.current),[]),WH();const Z=E.useCallback(j=>G.current===B.current?.side&&fen(j,B.current?.area),[]);return ae.jsx(XJt,{scope:t,searchRef:O,onItemEnter:E.useCallback(j=>{Z(j)&&j.preventDefault()},[Z]),onItemLeave:E.useCallback(j=>{Z(j)||(L.current?.focus(),k(null))},[Z]),onTriggerLeave:E.useCallback(j=>{Z(j)&&j.preventDefault()},[Z]),pointerGraceTimerRef:M,onPointerGraceIntentChange:E.useCallback(j=>{B.current=j},[]),children:ae.jsx(z,{...q,children:ae.jsx(PO,{asChild:!0,trapped:r,onMountAutoFocus:Kt(s,j=>{j.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:ae.jsx(b2,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,children:ae.jsx(QOe,{asChild:!0,...y,dir:_.dir,orientation:"vertical",loop:i,currentTabStopId:x,onCurrentTabStopIdChange:k,onEntryFocus:Kt(l,j=>{_.isUsingKeyboardRef.current||j.preventDefault()}),preventScrollOnEntryFocus:!0,children:ae.jsx(jH,{role:"menu","aria-orientation":"vertical","data-state":oVe(m.open),"data-radix-menu-content":"",dir:_.dir,...v,...p,ref:D,style:{outline:"none",...p.style},onKeyDown:Kt(p.onKeyDown,j=>{const le=j.target.closest("[data-radix-menu-content]")===j.currentTarget,ue=j.ctrlKey||j.altKey||j.metaKey,de=j.key.length===1;le&&(j.key==="Tab"&&j.preventDefault(),!ue&&de&&ee(j.key));const we=L.current;if(j.target!==we||!VJt.includes(j.key))return;j.preventDefault();const Me=C().filter(Re=>!Re.disabled).map(Re=>Re.ref.current);BHe.includes(j.key)&&Me.reverse(),cen(Me)}),onBlur:Kt(n.onBlur,j=>{j.currentTarget.contains(j.target)||(window.clearTimeout(I.current),O.current="")}),onPointerMove:Kt(n.onPointerMove,MR(j=>{const te=j.target,le=W.current!==j.clientX;if(j.currentTarget.contains(te)&&le){const ue=j.clientX>W.current?"right":"left";G.current=ue,W.current=j.clientX}}))})})})})})})});UHe.displayName=Jh;var een="MenuGroup",whe=E.forwardRef((n,e)=>{const{__scopeMenu:t,...i}=n;return ae.jsx(Pn.div,{role:"group",...i,ref:e})});whe.displayName=een;var ten="MenuLabel",jHe=E.forwardRef((n,e)=>{const{__scopeMenu:t,...i}=n;return ae.jsx(Pn.div,{...i,ref:e})});jHe.displayName=ten;var B7="MenuItem",t2e="menu.itemSelect",GH=E.forwardRef((n,e)=>{const{disabled:t=!1,onSelect:i,...r}=n,s=E.useRef(null),o=HO(B7,n.__scopeMenu),a=bhe(B7,n.__scopeMenu),l=gi(e,s),c=E.useRef(!1),u=()=>{const d=s.current;if(!t&&d){const h=new CustomEvent(t2e,{bubbles:!0,cancelable:!0});d.addEventListener(t2e,f=>i?.(f),{once:!0}),fOe(d,h),h.defaultPrevented?c.current=!1:o.onClose()}};return ae.jsx(qHe,{...r,ref:l,disabled:t,onClick:Kt(n.onClick,u),onPointerDown:d=>{n.onPointerDown?.(d),c.current=!0},onPointerUp:Kt(n.onPointerUp,d=>{c.current||d.currentTarget?.click()}),onKeyDown:Kt(n.onKeyDown,d=>{const h=a.searchRef.current!=="";t||h&&d.key===" "||Nie.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});GH.displayName=B7;var qHe=E.forwardRef((n,e)=>{const{__scopeMenu:t,disabled:i=!1,textValue:r,...s}=n,o=bhe(B7,t),a=WHe(t),l=E.useRef(null),c=gi(e,l),[u,d]=E.useState(!1),[h,f]=E.useState("");return E.useEffect(()=>{const g=l.current;g&&f((g.textContent??"").trim())},[s.children]),ae.jsx(OR.ItemSlot,{scope:t,disabled:i,textValue:r??h,children:ae.jsx(JOe,{asChild:!0,...a,focusable:!i,children:ae.jsx(Pn.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...s,ref:c,onPointerMove:Kt(n.onPointerMove,MR(g=>{i?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Kt(n.onPointerLeave,MR(g=>o.onItemLeave(g))),onFocus:Kt(n.onFocus,()=>d(!0)),onBlur:Kt(n.onBlur,()=>d(!1))})})})}),nen="MenuCheckboxItem",KHe=E.forwardRef((n,e)=>{const{checked:t=!1,onCheckedChange:i,...r}=n;return ae.jsx(QHe,{scope:n.__scopeMenu,checked:t,children:ae.jsx(GH,{role:"menuitemcheckbox","aria-checked":$7(t)?"mixed":t,...r,ref:e,"data-state":xhe(t),onSelect:Kt(r.onSelect,()=>i?.($7(t)?!0:!t),{checkForDefaultPrevented:!1})})})});KHe.displayName=nen;var GHe="MenuRadioGroup",[ien,ren]=OC(GHe,{value:void 0,onValueChange:()=>{}}),YHe=E.forwardRef((n,e)=>{const{value:t,onValueChange:i,...r}=n,s=Ua(i);return ae.jsx(ien,{scope:n.__scopeMenu,value:t,onValueChange:s,children:ae.jsx(whe,{...r,ref:e})})});YHe.displayName=GHe;var ZHe="MenuRadioItem",XHe=E.forwardRef((n,e)=>{const{value:t,...i}=n,r=ren(ZHe,n.__scopeMenu),s=t===r.value;return ae.jsx(QHe,{scope:n.__scopeMenu,checked:s,children:ae.jsx(GH,{role:"menuitemradio","aria-checked":s,...i,ref:e,"data-state":xhe(s),onSelect:Kt(i.onSelect,()=>r.onValueChange?.(t),{checkForDefaultPrevented:!1})})})});XHe.displayName=ZHe;var Che="MenuItemIndicator",[QHe,sen]=OC(Che,{checked:!1}),JHe=E.forwardRef((n,e)=>{const{__scopeMenu:t,forceMount:i,...r}=n,s=sen(Che,t);return ae.jsx($O,{present:i||$7(s.checked)||s.checked===!0,children:ae.jsx(Pn.span,{...r,ref:e,"data-state":xhe(s.checked)})})});JHe.displayName=Che;var oen="MenuSeparator",eVe=E.forwardRef((n,e)=>{const{__scopeMenu:t,...i}=n;return ae.jsx(Pn.div,{role:"separator","aria-orientation":"horizontal",...i,ref:e})});eVe.displayName=oen;var aen="MenuArrow",tVe=E.forwardRef((n,e)=>{const{__scopeMenu:t,...i}=n,r=KH(t);return ae.jsx(qH,{...r,...i,ref:e})});tVe.displayName=aen;var len="MenuSub",[_Wn,nVe]=OC(len),QD="MenuSubTrigger",iVe=E.forwardRef((n,e)=>{const t=MC(QD,n.__scopeMenu),i=HO(QD,n.__scopeMenu),r=nVe(QD,n.__scopeMenu),s=bhe(QD,n.__scopeMenu),o=E.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:n.__scopeMenu},u=E.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return E.useEffect(()=>u,[u]),E.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),ae.jsx(_he,{asChild:!0,...c,children:ae.jsx(qHe,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":r.contentId,"data-state":oVe(t.open),...n,ref:Pg(e,r.onTriggerChange),onClick:d=>{n.onClick?.(d),!(n.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:Kt(n.onPointerMove,MR(d=>{s.onItemEnter(d),!d.defaultPrevented&&!n.disabled&&!t.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{t.onOpenChange(!0),u()},100))})),onPointerLeave:Kt(n.onPointerLeave,MR(d=>{u();const h=t.content?.getBoundingClientRect();if(h){const f=t.content?.dataset.side,g=f==="right",p=g?-5:5,m=h[g?"left":"right"],_=h[g?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+p,y:d.clientY},{x:m,y:h.top},{x:_,y:h.top},{x:_,y:h.bottom},{x:m,y:h.bottom}],side:f}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Kt(n.onKeyDown,d=>{const h=s.searchRef.current!=="";n.disabled||h&&d.key===" "||zJt[i.dir].includes(d.key)&&(t.onOpenChange(!0),t.content?.focus(),d.preventDefault())})})})});iVe.displayName=QD;var rVe="MenuSubContent",sVe=E.forwardRef((n,e)=>{const t=VHe(Jh,n.__scopeMenu),{forceMount:i=t.forceMount,...r}=n,s=MC(Jh,n.__scopeMenu),o=HO(Jh,n.__scopeMenu),a=nVe(rVe,n.__scopeMenu),l=E.useRef(null),c=gi(e,l);return ae.jsx(OR.Provider,{scope:n.__scopeMenu,children:ae.jsx($O,{present:i||s.open,children:ae.jsx(OR.Slot,{scope:n.__scopeMenu,children:ae.jsx(yhe,{id:a.contentId,"aria-labelledby":a.triggerId,...r,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{o.isUsingKeyboardRef.current&&l.current?.focus(),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Kt(n.onFocusOutside,u=>{u.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Kt(n.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Kt(n.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),h=UJt[o.dir].includes(u.key);d&&h&&(s.onOpenChange(!1),a.trigger?.focus(),u.preventDefault())})})})})})});sVe.displayName=rVe;function oVe(n){return n?"open":"closed"}function $7(n){return n==="indeterminate"}function xhe(n){return $7(n)?"indeterminate":n?"checked":"unchecked"}function cen(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}function uen(n,e){return n.map((t,i)=>n[(e+i)%n.length])}function den(n,e,t){const r=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=t?n.indexOf(t):-1;let o=uen(n,Math.max(s,0));r.length===1&&(o=o.filter(c=>c!==t));const l=o.find(c=>c.toLowerCase().startsWith(r.toLowerCase()));return l!==t?l:void 0}function hen(n,e){const{x:t,y:i}=n;let r=!1;for(let s=0,o=e.length-1;si!=u>i&&t<(c-a)*(i-l)/(u-l)+a&&(r=!r)}return r}function fen(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return hen(t,e)}function MR(n){return e=>e.pointerType==="mouse"?n(e):void 0}var gen=HHe,pen=_he,men=zHe,_en=UHe,ven=whe,ben=jHe,yen=GH,wen=KHe,Cen=YHe,xen=XHe,Sen=JHe,ken=eVe,Een=tVe,Len=iVe,Ten=sVe,She="DropdownMenu",[Den,vWn]=Ac(She,[$He]),Cu=$He(),[Ien,aVe]=Den(She),lVe=n=>{const{__scopeDropdownMenu:e,children:t,dir:i,open:r,defaultOpen:s,onOpenChange:o,modal:a=!0}=n,l=Cu(e),c=E.useRef(null),[u=!1,d]=Kp({prop:r,defaultProp:s,onChange:o});return ae.jsx(Ien,{scope:e,triggerId:Ud(),triggerRef:c,contentId:Ud(),open:u,onOpenChange:d,onOpenToggle:E.useCallback(()=>d(h=>!h),[d]),modal:a,children:ae.jsx(gen,{...l,open:u,onOpenChange:d,dir:i,modal:a,children:t})})};lVe.displayName=She;var cVe="DropdownMenuTrigger",uVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,disabled:i=!1,...r}=n,s=aVe(cVe,t),o=Cu(t);return ae.jsx(pen,{asChild:!0,...o,children:ae.jsx(Pn.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...r,ref:Pg(e,s.triggerRef),onPointerDown:Kt(n.onPointerDown,a=>{!i&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Kt(n.onKeyDown,a=>{i||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});uVe.displayName=cVe;var Aen="DropdownMenuPortal",dVe=n=>{const{__scopeDropdownMenu:e,...t}=n,i=Cu(e);return ae.jsx(men,{...i,...t})};dVe.displayName=Aen;var hVe="DropdownMenuContent",fVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=aVe(hVe,t),s=Cu(t),o=E.useRef(!1);return ae.jsx(_en,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...i,ref:e,onCloseAutoFocus:Kt(n.onCloseAutoFocus,a=>{o.current||r.triggerRef.current?.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Kt(n.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!r.modal||u)&&(o.current=!0)}),style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});fVe.displayName=hVe;var Nen="DropdownMenuGroup",gVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(ven,{...r,...i,ref:e})});gVe.displayName=Nen;var Ren="DropdownMenuLabel",pVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(ben,{...r,...i,ref:e})});pVe.displayName=Ren;var Pen="DropdownMenuItem",mVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(yen,{...r,...i,ref:e})});mVe.displayName=Pen;var Oen="DropdownMenuCheckboxItem",_Ve=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(wen,{...r,...i,ref:e})});_Ve.displayName=Oen;var Men="DropdownMenuRadioGroup",Fen=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(Cen,{...r,...i,ref:e})});Fen.displayName=Men;var Ben="DropdownMenuRadioItem",vVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(xen,{...r,...i,ref:e})});vVe.displayName=Ben;var $en="DropdownMenuItemIndicator",bVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(Sen,{...r,...i,ref:e})});bVe.displayName=$en;var Wen="DropdownMenuSeparator",yVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(ken,{...r,...i,ref:e})});yVe.displayName=Wen;var Hen="DropdownMenuArrow",Ven=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(Een,{...r,...i,ref:e})});Ven.displayName=Hen;var zen="DropdownMenuSubTrigger",wVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(Len,{...r,...i,ref:e})});wVe.displayName=zen;var Uen="DropdownMenuSubContent",CVe=E.forwardRef((n,e)=>{const{__scopeDropdownMenu:t,...i}=n,r=Cu(t);return ae.jsx(Ten,{...r,...i,ref:e,style:{...n.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});CVe.displayName=Uen;var bWn=lVe,yWn=uVe,wWn=dVe,CWn=fVe,xWn=gVe,SWn=pVe,kWn=mVe,EWn=_Ve,LWn=vVe,TWn=bVe,DWn=yVe,IWn=wVe,AWn=CVe;function jen(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var xVe=n=>{const{present:e,children:t}=n,i=qen(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,Ken(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};xVe.displayName="Presence";function qen(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=jen(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=W3(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=W3(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=W3(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=W3(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function W3(n){return n?.animationName||"none"}function Ken(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var khe="Collapsible",[Gen,NWn]=Ac(khe),[Yen,Ehe]=Gen(khe),SVe=E.forwardRef((n,e)=>{const{__scopeCollapsible:t,open:i,defaultOpen:r,disabled:s,onOpenChange:o,...a}=n,[l=!1,c]=Kp({prop:i,defaultProp:r,onChange:o});return ae.jsx(Yen,{scope:t,disabled:s,contentId:Ud(),open:l,onOpenToggle:E.useCallback(()=>c(u=>!u),[c]),children:ae.jsx(Pn.div,{"data-state":The(l),"data-disabled":s?"":void 0,...a,ref:e})})});SVe.displayName=khe;var kVe="CollapsibleTrigger",Zen=E.forwardRef((n,e)=>{const{__scopeCollapsible:t,...i}=n,r=Ehe(kVe,t);return ae.jsx(Pn.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":The(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...i,ref:e,onClick:Kt(n.onClick,r.onOpenToggle)})});Zen.displayName=kVe;var Lhe="CollapsibleContent",Xen=E.forwardRef((n,e)=>{const{forceMount:t,...i}=n,r=Ehe(Lhe,n.__scopeCollapsible);return ae.jsx(xVe,{present:t||r.open,children:({present:s})=>ae.jsx(Qen,{...i,ref:e,present:s})})});Xen.displayName=Lhe;var Qen=E.forwardRef((n,e)=>{const{__scopeCollapsible:t,present:i,children:r,...s}=n,o=Ehe(Lhe,t),[a,l]=E.useState(i),c=E.useRef(null),u=gi(e,c),d=E.useRef(0),h=d.current,f=E.useRef(0),g=f.current,p=o.open||a,m=E.useRef(p),_=E.useRef(void 0);return E.useEffect(()=>{const v=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(v)},[]),es(()=>{const v=c.current;if(v){_.current=_.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const y=v.getBoundingClientRect();d.current=y.height,f.current=y.width,m.current||(v.style.transitionDuration=_.current.transitionDuration,v.style.animationName=_.current.animationName),l(i)}},[o.open,i]),ae.jsx(Pn.div,{"data-state":The(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...s,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...n.style},children:p&&r})});function The(n){return n?"open":"closed"}var RWn=SVe;function Jen(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var Dhe=n=>{const{present:e,children:t}=n,i=etn(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,ttn(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};Dhe.displayName="Presence";function etn(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=Jen(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=H3(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=H3(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=H3(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=H3(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function H3(n){return n?.animationName||"none"}function ttn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var ntn=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(itn);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(Rie,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(Rie,{...i,ref:e,children:t})});ntn.displayName="Slot";var Rie=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=stn(t);return E.cloneElement(t,{...rtn(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});Rie.displayName="SlotClone";var EVe=({children:n})=>ae.jsx(ae.Fragment,{children:n});function itn(n){return E.isValidElement(n)&&n.type===EVe}function rtn(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function stn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var otn="VisuallyHidden",Ihe=E.forwardRef((n,e)=>ae.jsx(Pn.span,{...n,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...n.style}}));Ihe.displayName=otn;var atn=Ihe,[YH,PWn]=Ac("Tooltip",[c1]),ZH=c1(),LVe="TooltipProvider",ltn=700,Pie="tooltip.open",[ctn,Ahe]=YH(LVe),TVe=n=>{const{__scopeTooltip:e,delayDuration:t=ltn,skipDelayDuration:i=300,disableHoverableContent:r=!1,children:s}=n,[o,a]=E.useState(!0),l=E.useRef(!1),c=E.useRef(0);return E.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),ae.jsx(ctn,{scope:e,isOpenDelayed:o,delayDuration:t,onOpen:E.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:E.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),i)},[i]),isPointerInTransitRef:l,onPointerInTransitChange:E.useCallback(u=>{l.current=u},[]),disableHoverableContent:r,children:s})};TVe.displayName=LVe;var XH="Tooltip",[utn,VO]=YH(XH),DVe=n=>{const{__scopeTooltip:e,children:t,open:i,defaultOpen:r=!1,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=n,l=Ahe(XH,n.__scopeTooltip),c=ZH(e),[u,d]=E.useState(null),h=Ud(),f=E.useRef(0),g=o??l.disableHoverableContent,p=a??l.delayDuration,m=E.useRef(!1),[_=!1,v]=Kp({prop:i,defaultProp:r,onChange:L=>{L?(l.onOpen(),document.dispatchEvent(new CustomEvent(Pie))):l.onClose(),s?.(L)}}),y=E.useMemo(()=>_?m.current?"delayed-open":"instant-open":"closed",[_]),C=E.useCallback(()=>{window.clearTimeout(f.current),f.current=0,m.current=!1,v(!0)},[v]),x=E.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v(!1)},[v]),k=E.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{m.current=!0,v(!0),f.current=0},p)},[p,v]);return E.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),ae.jsx(UH,{...c,children:ae.jsx(utn,{scope:e,contentId:h,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:E.useCallback(()=>{l.isOpenDelayed?k():C()},[l.isOpenDelayed,k,C]),onTriggerLeave:E.useCallback(()=>{g?x():(window.clearTimeout(f.current),f.current=0)},[x,g]),onOpen:C,onClose:x,disableHoverableContent:g,children:t})})};DVe.displayName=XH;var Oie="TooltipTrigger",IVe=E.forwardRef((n,e)=>{const{__scopeTooltip:t,...i}=n,r=VO(Oie,t),s=Ahe(Oie,t),o=ZH(t),a=E.useRef(null),l=gi(e,a,r.onTriggerChange),c=E.useRef(!1),u=E.useRef(!1),d=E.useCallback(()=>c.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),ae.jsx(BO,{asChild:!0,...o,children:ae.jsx(Pn.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...i,ref:l,onPointerMove:Kt(n.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),u.current=!0)}),onPointerLeave:Kt(n.onPointerLeave,()=>{r.onTriggerLeave(),u.current=!1}),onPointerDown:Kt(n.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Kt(n.onFocus,()=>{c.current||r.onOpen()}),onBlur:Kt(n.onBlur,r.onClose),onClick:Kt(n.onClick,r.onClose)})})});IVe.displayName=Oie;var Nhe="TooltipPortal",[dtn,htn]=YH(Nhe,{forceMount:void 0}),AVe=n=>{const{__scopeTooltip:e,forceMount:t,children:i,container:r}=n,s=VO(Nhe,e);return ae.jsx(dtn,{scope:e,forceMount:t,children:ae.jsx(Dhe,{present:t||s.open,children:ae.jsx(y2,{asChild:!0,container:r,children:i})})})};AVe.displayName=Nhe;var rL="TooltipContent",NVe=E.forwardRef((n,e)=>{const t=htn(rL,n.__scopeTooltip),{forceMount:i=t.forceMount,side:r="top",...s}=n,o=VO(rL,n.__scopeTooltip);return ae.jsx(Dhe,{present:i||o.open,children:o.disableHoverableContent?ae.jsx(RVe,{side:r,...s,ref:e}):ae.jsx(ftn,{side:r,...s,ref:e})})}),ftn=E.forwardRef((n,e)=>{const t=VO(rL,n.__scopeTooltip),i=Ahe(rL,n.__scopeTooltip),r=E.useRef(null),s=gi(e,r),[o,a]=E.useState(null),{trigger:l,onClose:c}=t,u=r.current,{onPointerInTransitChange:d}=i,h=E.useCallback(()=>{a(null),d(!1)},[d]),f=E.useCallback((g,p)=>{const m=g.currentTarget,_={x:g.clientX,y:g.clientY},v=_tn(_,m.getBoundingClientRect()),y=vtn(_,v),C=btn(p.getBoundingClientRect()),x=wtn([...y,...C]);a(x),d(!0)},[d]);return E.useEffect(()=>()=>h(),[h]),E.useEffect(()=>{if(l&&u){const g=m=>f(m,u),p=m=>f(m,l);return l.addEventListener("pointerleave",g),u.addEventListener("pointerleave",p),()=>{l.removeEventListener("pointerleave",g),u.removeEventListener("pointerleave",p)}}},[l,u,f,h]),E.useEffect(()=>{if(o){const g=p=>{const m=p.target,_={x:p.clientX,y:p.clientY},v=l?.contains(m)||u?.contains(m),y=!ytn(_,o);v?h():y&&(h(),c())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,u,o,c,h]),ae.jsx(RVe,{...n,ref:s})}),[gtn,ptn]=YH(XH,{isInside:!1}),RVe=E.forwardRef((n,e)=>{const{__scopeTooltip:t,children:i,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=n,l=VO(rL,t),c=ZH(t),{onClose:u}=l;return E.useEffect(()=>(document.addEventListener(Pie,u),()=>document.removeEventListener(Pie,u)),[u]),E.useEffect(()=>{if(l.trigger){const d=h=>{h.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),ae.jsx(b2,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:ae.jsxs(jH,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[ae.jsx(EVe,{children:i}),ae.jsx(gtn,{scope:t,isInside:!0,children:ae.jsx(atn,{id:l.contentId,role:"tooltip",children:r||i})})]})})});NVe.displayName=rL;var PVe="TooltipArrow",mtn=E.forwardRef((n,e)=>{const{__scopeTooltip:t,...i}=n,r=ZH(t);return ptn(PVe,t).isInside?null:ae.jsx(qH,{...r,...i,ref:e})});mtn.displayName=PVe;function _tn(n,e){const t=Math.abs(e.top-n.y),i=Math.abs(e.bottom-n.y),r=Math.abs(e.right-n.x),s=Math.abs(e.left-n.x);switch(Math.min(t,i,r,s)){case s:return"left";case r:return"right";case t:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function vtn(n,e,t=5){const i=[];switch(e){case"top":i.push({x:n.x-t,y:n.y+t},{x:n.x+t,y:n.y+t});break;case"bottom":i.push({x:n.x-t,y:n.y-t},{x:n.x+t,y:n.y-t});break;case"left":i.push({x:n.x+t,y:n.y-t},{x:n.x+t,y:n.y+t});break;case"right":i.push({x:n.x-t,y:n.y-t},{x:n.x-t,y:n.y+t});break}return i}function btn(n){const{top:e,right:t,bottom:i,left:r}=n;return[{x:r,y:e},{x:t,y:e},{x:t,y:i},{x:r,y:i}]}function ytn(n,e){const{x:t,y:i}=n;let r=!1;for(let s=0,o=e.length-1;si!=u>i&&t<(c-a)*(i-l)/(u-l)+a&&(r=!r)}return r}function wtn(n){const e=n.slice();return e.sort((t,i)=>t.xi.x?1:t.yi.y?1:0),Ctn(e)}function Ctn(n){if(n.length<=1)return n.slice();const e=[];for(let i=0;i=2;){const s=e[e.length-1],o=e[e.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))e.pop();else break}e.push(r)}e.pop();const t=[];for(let i=n.length-1;i>=0;i--){const r=n[i];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(r.y-o.y)>=(s.y-o.y)*(r.x-o.x))t.pop();else break}t.push(r)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var OWn=TVe,MWn=DVe,FWn=IVe,BWn=AVe,$Wn=NVe;/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. @@ -1691,312 +1691,322 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const En=(n,e)=>{const t=E.forwardRef(({className:i,...r},s)=>E.createElement(ktn,{ref:s,iconNode:e,className:OVe(`lucide-${xtn(n)}`,i),...r}));return t.displayName=`${n}`,t};/** + */const Cn=(n,e)=>{const t=E.forwardRef(({className:i,...r},s)=>E.createElement(ktn,{ref:s,iconNode:e,className:OVe(`lucide-${xtn(n)}`,i),...r}));return t.displayName=`${n}`,t};/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const WWn=En("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + */const WWn=Cn("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const HWn=En("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);/** + */const HWn=Cn("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VWn=En("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** + */const VWn=Cn("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zWn=En("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + */const zWn=Cn("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const UWn=En("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const UWn=Cn("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jWn=En("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** + */const jWn=Cn("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qWn=En("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** + */const qWn=Cn("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const KWn=En("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** + */const KWn=Cn("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const GWn=En("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const GWn=Cn("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const YWn=En("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const YWn=Cn("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ZWn=En("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const ZWn=Cn("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const XWn=En("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const XWn=Cn("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const QWn=En("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + */const QWn=Cn("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const JWn=En("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const JWn=Cn("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const eHn=En("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const eHn=Cn("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tHn=En("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** + */const tHn=Cn("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nHn=En("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + */const nHn=Cn("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const iHn=En("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/** + */const iHn=Cn("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rHn=En("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + */const rHn=Cn("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sHn=En("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/** + */const sHn=Cn("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oHn=En("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const oHn=Cn("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aHn=En("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const aHn=Cn("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lHn=En("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const lHn=Cn("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cHn=En("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** + */const cHn=Cn("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uHn=En("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + */const uHn=Cn("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dHn=En("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const dHn=Cn("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hHn=En("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + */const hHn=Cn("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fHn=En("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + */const fHn=Cn("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gHn=En("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const gHn=Cn("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pHn=En("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + */const pHn=Cn("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mHn=En("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** + */const mHn=Cn("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _Hn=En("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + */const _Hn=Cn("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vHn=En("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + */const vHn=Cn("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bHn=En("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const bHn=Cn("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yHn=En("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4c0-1.1.9-2 2-2h8a2 2 0 0 1 2 2z",key:"jj09z8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** + */const yHn=Cn("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wHn=En("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + */const wHn=Cn("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CHn=En("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** + */const CHn=Cn("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4c0-1.1.9-2 2-2h8a2 2 0 0 1 2 2z",key:"jj09z8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xHn=En("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + */const xHn=Cn("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SHn=En("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/** + */const SHn=Cn("Package",[["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kHn=En("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const kHn=Cn("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const EHn=En("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** + */const EHn=Cn("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LHn=En("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + */const LHn=Cn("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const THn=En("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + */const THn=Cn("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DHn=En("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** + */const DHn=Cn("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IHn=En("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const IHn=Cn("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const AHn=En("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + */const AHn=Cn("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NHn=En("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const NHn=Cn("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const RHn=En("ShieldBan",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]]);/** + */const RHn=Cn("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PHn=En("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + */const PHn=Cn("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OHn=En("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** + */const OHn=Cn("ShieldBan",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const MHn=En("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** + */const MHn=Cn("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const FHn=En("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const FHn=Cn("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BHn=En("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/** + */const BHn=Cn("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $Hn=En("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** + */const $Hn=Cn("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const WHn=En("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const WHn=Cn("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const HHn=En("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + */const HHn=Cn("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VHn=En("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** + */const VHn=Cn("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zHn=En("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + */const zHn=Cn("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const UHn=En("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + */const UHn=Cn("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jHn=En("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + */const jHn=Cn("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.399.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qHn=En("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var n2e=1,Etn=.9,Ltn=.8,Ttn=.17,LK=.1,TK=.999,Dtn=.9999,Itn=.99,Atn=/[\\\/_+.#"@\[\(\{&]/,Ntn=/[\\\/_+.#"@\[\(\{&]/g,Rtn=/[\s-]/,MVe=/[\s-]/g;function Mie(n,e,t,i,r,s,o){if(s===e.length)return r===n.length?n2e:Itn;var a=`${r},${s}`;if(o[a]!==void 0)return o[a];for(var l=i.charAt(s),c=t.indexOf(l,r),u=0,d,h,f,g;c>=0;)d=Mie(n,e,t,i,c+1,s+1,o),d>u&&(c===r?d*=n2e:Atn.test(n.charAt(c-1))?(d*=Ltn,f=n.slice(r,c-1).match(Ntn),f&&r>0&&(d*=Math.pow(TK,f.length))):Rtn.test(n.charAt(c-1))?(d*=Etn,g=n.slice(r,c-1).match(MVe),g&&r>0&&(d*=Math.pow(TK,g.length))):(d*=Ttn,r>0&&(d*=Math.pow(TK,c-r))),n.charAt(c)!==e.charAt(s)&&(d*=Dtn)),(dd&&(d=h*LK)),d>u&&(u=d),c=t.indexOf(l,c+1);return o[a]=u,u}function i2e(n){return n.toLowerCase().replace(MVe," ")}function Ptn(n,e){return Mie(n,e,i2e(n),i2e(e),0,0,{})}function fu(){return fu=Object.assign?Object.assign.bind():function(n){for(var e=1;en.forEach(t=>Otn(t,e))}function zO(...n){return E.useCallback(FVe(...n),n)}function Mtn(n,e=[]){let t=[];function i(s,o){const a=E.createContext(o),l=t.length;t=[...t,o];function c(d){const{scope:h,children:f,...g}=d,p=h?.[n][l]||a,m=E.useMemo(()=>g,Object.values(g));return E.createElement(p.Provider,{value:m},f)}function u(d,h){const f=h?.[n][l]||a,g=E.useContext(f);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,u]}const r=()=>{const s=t.map(o=>E.createContext(o));return function(a){const l=a?.[n]||s;return E.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return r.scopeName=n,[i,Ftn(r,...e)]}function Ftn(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const i=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}const Btn=globalThis?.document?E.useLayoutEffect:()=>{},$tn=JB.useId||(()=>{});let Wtn=0;function DK(n){const[e,t]=E.useState($tn());return Btn(()=>{n||t(i=>i??String(Wtn++))},[n]),n||(e?`radix-${e}`:"")}function BVe(n){const e=E.useRef(n);return E.useEffect(()=>{e.current=n}),E.useMemo(()=>(...t)=>{var i;return(i=e.current)===null||i===void 0?void 0:i.call(e,...t)},[])}function Htn({prop:n,defaultProp:e,onChange:t=()=>{}}){const[i,r]=Vtn({defaultProp:e,onChange:t}),s=n!==void 0,o=s?n:i,a=BVe(t),l=E.useCallback(c=>{if(s){const d=typeof c=="function"?c(n):c;d!==n&&a(d)}else r(c)},[s,n,r,a]);return[o,l]}function Vtn({defaultProp:n,onChange:e}){const t=E.useState(n),[i]=t,r=E.useRef(i),s=BVe(e);return E.useEffect(()=>{r.current!==i&&(s(i),r.current=i)},[i,r,s]),t}const Rhe=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(Utn);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return E.createElement(Fie,fu({},i,{ref:e}),E.isValidElement(o)?E.cloneElement(o,void 0,a):null)}return E.createElement(Fie,fu({},i,{ref:e}),t)});Rhe.displayName="Slot";const Fie=E.forwardRef((n,e)=>{const{children:t,...i}=n;return E.isValidElement(t)?E.cloneElement(t,{...jtn(i,t.props),ref:FVe(e,t.ref)}):E.Children.count(t)>1?E.Children.only(null):null});Fie.displayName="SlotClone";const ztn=({children:n})=>E.createElement(E.Fragment,null,n);function Utn(n){return E.isValidElement(n)&&n.type===ztn}function jtn(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?t[i]=(...a)=>{s?.(...a),r?.(...a)}:i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}const qtn=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"],QH=qtn.reduce((n,e)=>{const t=E.forwardRef((i,r)=>{const{asChild:s,...o}=i,a=s?Rhe:e;return E.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),E.createElement(a,fu({},o,{ref:r}))});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function Ktn(n,e){n&&h0.flushSync(()=>n.dispatchEvent(e))}function Phe(n){const e=E.useRef(n);return E.useEffect(()=>{e.current=n}),E.useMemo(()=>(...t)=>{var i;return(i=e.current)===null||i===void 0?void 0:i.call(e,...t)},[])}function Gtn(n){const e=Phe(n);E.useEffect(()=>{const t=i=>{i.key==="Escape"&&e(i)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e])}const Bie="dismissableLayer.update",Ytn="dismissableLayer.pointerDownOutside",Ztn="dismissableLayer.focusOutside";let r2e;const Xtn=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qtn=E.forwardRef((n,e)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=n,c=E.useContext(Xtn),[u,d]=E.useState(null),[,h]=E.useState({}),f=zO(e,k=>d(k)),g=Array.from(c.layers),[p]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),m=g.indexOf(p),_=u?g.indexOf(u):-1,v=c.layersWithOutsidePointerEventsDisabled.size>0,y=_>=m,C=Jtn(k=>{const L=k.target,D=[...c.branches].some(I=>I.contains(L));!y||D||(r?.(k),o?.(k),k.defaultPrevented||a?.())}),x=enn(k=>{const L=k.target;[...c.branches].some(I=>I.contains(L))||(s?.(k),o?.(k),k.defaultPrevented||a?.())});return Gtn(k=>{_===c.layers.size-1&&(i?.(k),!k.defaultPrevented&&a&&(k.preventDefault(),a()))}),E.useEffect(()=>{if(u)return t&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(r2e=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),s2e(),()=>{t&&c.layersWithOutsidePointerEventsDisabled.size===1&&(document.body.style.pointerEvents=r2e)}},[u,t,c]),E.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),s2e())},[u,c]),E.useEffect(()=>{const k=()=>h({});return document.addEventListener(Bie,k),()=>document.removeEventListener(Bie,k)},[]),E.createElement(QH.div,fu({},l,{ref:f,style:{pointerEvents:v?y?"auto":"none":void 0,...n.style},onFocusCapture:Mk(n.onFocusCapture,x.onFocusCapture),onBlurCapture:Mk(n.onBlurCapture,x.onBlurCapture),onPointerDownCapture:Mk(n.onPointerDownCapture,C.onPointerDownCapture)}))});function Jtn(n){const e=Phe(n),t=E.useRef(!1),i=E.useRef(()=>{});return E.useEffect(()=>{const r=o=>{if(o.target&&!t.current){let l=function(){$Ve(Ytn,e,a,{discrete:!0})};const a={originalEvent:o};o.pointerType==="touch"?(document.removeEventListener("click",i.current),i.current=l,document.addEventListener("click",i.current,{once:!0})):l()}t.current=!1},s=window.setTimeout(()=>{document.addEventListener("pointerdown",r)},0);return()=>{window.clearTimeout(s),document.removeEventListener("pointerdown",r),document.removeEventListener("click",i.current)}},[e]),{onPointerDownCapture:()=>t.current=!0}}function enn(n){const e=Phe(n),t=E.useRef(!1);return E.useEffect(()=>{const i=r=>{r.target&&!t.current&&$Ve(Ztn,e,{originalEvent:r},{discrete:!1})};return document.addEventListener("focusin",i),()=>document.removeEventListener("focusin",i)},[e]),{onFocusCapture:()=>t.current=!0,onBlurCapture:()=>t.current=!1}}function s2e(){const n=new CustomEvent(Bie);document.dispatchEvent(n)}function $Ve(n,e,t,{discrete:i}){const r=t.originalEvent.target,s=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&r.addEventListener(n,e,{once:!0}),i?Ktn(r,s):r.dispatchEvent(s)}function o2e(n){const e=E.useRef(n);return E.useEffect(()=>{e.current=n}),E.useMemo(()=>(...t)=>{var i;return(i=e.current)===null||i===void 0?void 0:i.call(e,...t)},[])}const IK="focusScope.autoFocusOnMount",AK="focusScope.autoFocusOnUnmount",a2e={bubbles:!1,cancelable:!0},tnn=E.forwardRef((n,e)=>{const{loop:t=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...o}=n,[a,l]=E.useState(null),c=o2e(r),u=o2e(s),d=E.useRef(null),h=zO(e,p=>l(p)),f=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(i){let p=function(_){if(f.paused||!a)return;const v=_.target;a.contains(v)?d.current=v:ey(d.current,{select:!0})},m=function(_){f.paused||!a||a.contains(_.relatedTarget)||ey(d.current,{select:!0})};return document.addEventListener("focusin",p),document.addEventListener("focusout",m),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",m)}}},[i,a,f.paused]),E.useEffect(()=>{if(a){c2e.add(f);const p=document.activeElement;if(!a.contains(p)){const _=new CustomEvent(IK,a2e);a.addEventListener(IK,c),a.dispatchEvent(_),_.defaultPrevented||(nnn(ann(WVe(a)),{select:!0}),document.activeElement===p&&ey(a))}return()=>{a.removeEventListener(IK,c),setTimeout(()=>{const _=new CustomEvent(AK,a2e);a.addEventListener(AK,u),a.dispatchEvent(_),_.defaultPrevented||ey(p??document.body,{select:!0}),a.removeEventListener(AK,u),c2e.remove(f)},0)}}},[a,c,u,f]);const g=E.useCallback(p=>{if(!t&&!i||f.paused)return;const m=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,_=document.activeElement;if(m&&_){const v=p.currentTarget,[y,C]=inn(v);y&&C?!p.shiftKey&&_===C?(p.preventDefault(),t&&ey(y,{select:!0})):p.shiftKey&&_===y&&(p.preventDefault(),t&&ey(C,{select:!0})):_===v&&p.preventDefault()}},[t,i,f.paused]);return E.createElement(QH.div,fu({tabIndex:-1},o,{ref:h,onKeyDown:g}))});function nnn(n,{select:e=!1}={}){const t=document.activeElement;for(const i of n)if(ey(i,{select:e}),document.activeElement!==t)return}function inn(n){const e=WVe(n),t=l2e(e,n),i=l2e(e.reverse(),n);return[t,i]}function WVe(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function l2e(n,e){for(const t of n)if(!rnn(t,{upTo:e}))return t}function rnn(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function snn(n){return n instanceof HTMLInputElement&&"select"in n}function ey(n,{select:e=!1}={}){if(n&&n.focus){const t=document.activeElement;n.focus({preventScroll:!0}),n!==t&&snn(n)&&e&&n.select()}}const c2e=onn();function onn(){let n=[];return{add(e){const t=n[0];e!==t&&t?.pause(),n=u2e(n,e),n.unshift(e)},remove(e){var t;n=u2e(n,e),(t=n[0])===null||t===void 0||t.resume()}}}function u2e(n,e){const t=[...n],i=t.indexOf(e);return i!==-1&&t.splice(i,1),t}function ann(n){return n.filter(e=>e.tagName!=="A")}const lnn=E.forwardRef((n,e)=>{var t;const{container:i=globalThis==null||(t=globalThis.document)===null||t===void 0?void 0:t.body,...r}=n;return i?p$.createPortal(E.createElement(QH.div,fu({},r,{ref:e})),i):null}),d2e=globalThis?.document?E.useLayoutEffect:()=>{};function cnn(n,e){return E.useReducer((t,i)=>{const r=e[t][i];return r??t},n)}const JH=n=>{const{present:e,children:t}=n,i=unn(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=zO(i.ref,r.ref);return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};JH.displayName="Presence";function unn(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=cnn(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=V3(i.current);s.current=a==="mounted"?c:"none"},[a]),d2e(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=V3(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),d2e(()=>{if(e){const c=d=>{const f=V3(i.current).includes(d.animationName);d.target===e&&f&&h0.flushSync(()=>l("ANIMATION_END"))},u=d=>{d.target===e&&(s.current=V3(i.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function V3(n){return n?.animationName||"none"}let NK=0;function dnn(){E.useEffect(()=>{var n,e;const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(n=t[0])!==null&&n!==void 0?n:h2e()),document.body.insertAdjacentElement("beforeend",(e=t[1])!==null&&e!==void 0?e:h2e()),NK++,()=>{NK===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(i=>i.remove()),NK--}},[])}function h2e(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",n}var A5="right-scroll-bar-position",N5="width-before-scroll-bar",hnn="with-scroll-bars-hidden",fnn="--removed-body-scroll-bar-size";function RK(n,e){return typeof n=="function"?n(e):n&&(n.current=e),n}function gnn(n,e){var t=E.useState(function(){return{value:n,callback:e,facade:{get current(){return t.value},set current(i){var r=t.value;r!==i&&(t.value=i,t.callback(i,r))}}}})[0];return t.callback=e,t.facade}var pnn=typeof window<"u"?E.useLayoutEffect:E.useEffect,f2e=new WeakMap;function mnn(n,e){var t=gnn(null,function(i){return n.forEach(function(r){return RK(r,i)})});return pnn(function(){var i=f2e.get(t);if(i){var r=new Set(i),s=new Set(n),o=t.current;r.forEach(function(a){s.has(a)||RK(a,null)}),s.forEach(function(a){r.has(a)||RK(a,o)})}f2e.set(t,n)},[n]),t}var HVe=VWe(),PK=function(){},eV=E.forwardRef(function(n,e){var t=E.useRef(null),i=E.useState({onScrollCapture:PK,onWheelCapture:PK,onTouchMoveCapture:PK}),r=i[0],s=i[1],o=n.forwardProps,a=n.children,l=n.className,c=n.removeScrollBar,u=n.enabled,d=n.shards,h=n.sideCar,f=n.noIsolation,g=n.inert,p=n.allowPinchZoom,m=n.as,_=m===void 0?"div":m,v=ihe(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),y=h,C=mnn([t,e]),x=vc(vc({},v),r);return E.createElement(E.Fragment,null,u&&E.createElement(y,{sideCar:HVe,removeScrollBar:c,shards:d,noIsolation:f,inert:g,setCallbacks:s,allowPinchZoom:!!p,lockRef:t}),o?E.cloneElement(E.Children.only(a),vc(vc({},x),{ref:C})):E.createElement(_,vc({},x,{className:l,ref:C}),a))});eV.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};eV.classNames={fullWidth:N5,zeroRight:A5};var _nn={left:0,top:0,right:0,gap:0},OK=function(n){return parseInt(n||"",10)||0},vnn=function(n){var e=window.getComputedStyle(document.body),t=e[n==="padding"?"paddingLeft":"marginLeft"],i=e[n==="padding"?"paddingTop":"marginTop"],r=e[n==="padding"?"paddingRight":"marginRight"];return[OK(t),OK(i),OK(r)]},bnn=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return _nn;var e=vnn(n),t=document.documentElement.clientWidth,i=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,i-t+e[2]-e[0])}},ynn=rhe(),Fk="data-scroll-locked",wnn=function(n,e,t,i){var r=n.left,s=n.top,o=n.right,a=n.gap;return t===void 0&&(t="margin"),` + */const qHn=Cn("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + * @license lucide-react v0.399.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KHn=Cn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.399.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GHn=Cn("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var n2e=1,Etn=.9,Ltn=.8,Ttn=.17,LK=.1,TK=.999,Dtn=.9999,Itn=.99,Atn=/[\\\/_+.#"@\[\(\{&]/,Ntn=/[\\\/_+.#"@\[\(\{&]/g,Rtn=/[\s-]/,MVe=/[\s-]/g;function Mie(n,e,t,i,r,s,o){if(s===e.length)return r===n.length?n2e:Itn;var a=`${r},${s}`;if(o[a]!==void 0)return o[a];for(var l=i.charAt(s),c=t.indexOf(l,r),u=0,d,h,f,g;c>=0;)d=Mie(n,e,t,i,c+1,s+1,o),d>u&&(c===r?d*=n2e:Atn.test(n.charAt(c-1))?(d*=Ltn,f=n.slice(r,c-1).match(Ntn),f&&r>0&&(d*=Math.pow(TK,f.length))):Rtn.test(n.charAt(c-1))?(d*=Etn,g=n.slice(r,c-1).match(MVe),g&&r>0&&(d*=Math.pow(TK,g.length))):(d*=Ttn,r>0&&(d*=Math.pow(TK,c-r))),n.charAt(c)!==e.charAt(s)&&(d*=Dtn)),(dd&&(d=h*LK)),d>u&&(u=d),c=t.indexOf(l,c+1);return o[a]=u,u}function i2e(n){return n.toLowerCase().replace(MVe," ")}function Ptn(n,e){return Mie(n,e,i2e(n),i2e(e),0,0,{})}function fu(){return fu=Object.assign?Object.assign.bind():function(n){for(var e=1;en.forEach(t=>Otn(t,e))}function zO(...n){return E.useCallback(FVe(...n),n)}function Mtn(n,e=[]){let t=[];function i(s,o){const a=E.createContext(o),l=t.length;t=[...t,o];function c(d){const{scope:h,children:f,...g}=d,p=h?.[n][l]||a,m=E.useMemo(()=>g,Object.values(g));return E.createElement(p.Provider,{value:m},f)}function u(d,h){const f=h?.[n][l]||a,g=E.useContext(f);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,u]}const r=()=>{const s=t.map(o=>E.createContext(o));return function(a){const l=a?.[n]||s;return E.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return r.scopeName=n,[i,Ftn(r,...e)]}function Ftn(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const i=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}const Btn=globalThis?.document?E.useLayoutEffect:()=>{},$tn=JB.useId||(()=>{});let Wtn=0;function DK(n){const[e,t]=E.useState($tn());return Btn(()=>{n||t(i=>i??String(Wtn++))},[n]),n||(e?`radix-${e}`:"")}function BVe(n){const e=E.useRef(n);return E.useEffect(()=>{e.current=n}),E.useMemo(()=>(...t)=>{var i;return(i=e.current)===null||i===void 0?void 0:i.call(e,...t)},[])}function Htn({prop:n,defaultProp:e,onChange:t=()=>{}}){const[i,r]=Vtn({defaultProp:e,onChange:t}),s=n!==void 0,o=s?n:i,a=BVe(t),l=E.useCallback(c=>{if(s){const d=typeof c=="function"?c(n):c;d!==n&&a(d)}else r(c)},[s,n,r,a]);return[o,l]}function Vtn({defaultProp:n,onChange:e}){const t=E.useState(n),[i]=t,r=E.useRef(i),s=BVe(e);return E.useEffect(()=>{r.current!==i&&(s(i),r.current=i)},[i,r,s]),t}const Rhe=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(Utn);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return E.createElement(Fie,fu({},i,{ref:e}),E.isValidElement(o)?E.cloneElement(o,void 0,a):null)}return E.createElement(Fie,fu({},i,{ref:e}),t)});Rhe.displayName="Slot";const Fie=E.forwardRef((n,e)=>{const{children:t,...i}=n;return E.isValidElement(t)?E.cloneElement(t,{...jtn(i,t.props),ref:FVe(e,t.ref)}):E.Children.count(t)>1?E.Children.only(null):null});Fie.displayName="SlotClone";const ztn=({children:n})=>E.createElement(E.Fragment,null,n);function Utn(n){return E.isValidElement(n)&&n.type===ztn}function jtn(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?t[i]=(...a)=>{s?.(...a),r?.(...a)}:i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}const qtn=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"],QH=qtn.reduce((n,e)=>{const t=E.forwardRef((i,r)=>{const{asChild:s,...o}=i,a=s?Rhe:e;return E.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),E.createElement(a,fu({},o,{ref:r}))});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function Ktn(n,e){n&&h0.flushSync(()=>n.dispatchEvent(e))}function Phe(n){const e=E.useRef(n);return E.useEffect(()=>{e.current=n}),E.useMemo(()=>(...t)=>{var i;return(i=e.current)===null||i===void 0?void 0:i.call(e,...t)},[])}function Gtn(n){const e=Phe(n);E.useEffect(()=>{const t=i=>{i.key==="Escape"&&e(i)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e])}const Bie="dismissableLayer.update",Ytn="dismissableLayer.pointerDownOutside",Ztn="dismissableLayer.focusOutside";let r2e;const Xtn=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qtn=E.forwardRef((n,e)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=n,c=E.useContext(Xtn),[u,d]=E.useState(null),[,h]=E.useState({}),f=zO(e,k=>d(k)),g=Array.from(c.layers),[p]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),m=g.indexOf(p),_=u?g.indexOf(u):-1,v=c.layersWithOutsidePointerEventsDisabled.size>0,y=_>=m,C=Jtn(k=>{const L=k.target,D=[...c.branches].some(I=>I.contains(L));!y||D||(r?.(k),o?.(k),k.defaultPrevented||a?.())}),x=enn(k=>{const L=k.target;[...c.branches].some(I=>I.contains(L))||(s?.(k),o?.(k),k.defaultPrevented||a?.())});return Gtn(k=>{_===c.layers.size-1&&(i?.(k),!k.defaultPrevented&&a&&(k.preventDefault(),a()))}),E.useEffect(()=>{if(u)return t&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(r2e=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),s2e(),()=>{t&&c.layersWithOutsidePointerEventsDisabled.size===1&&(document.body.style.pointerEvents=r2e)}},[u,t,c]),E.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),s2e())},[u,c]),E.useEffect(()=>{const k=()=>h({});return document.addEventListener(Bie,k),()=>document.removeEventListener(Bie,k)},[]),E.createElement(QH.div,fu({},l,{ref:f,style:{pointerEvents:v?y?"auto":"none":void 0,...n.style},onFocusCapture:Mk(n.onFocusCapture,x.onFocusCapture),onBlurCapture:Mk(n.onBlurCapture,x.onBlurCapture),onPointerDownCapture:Mk(n.onPointerDownCapture,C.onPointerDownCapture)}))});function Jtn(n){const e=Phe(n),t=E.useRef(!1),i=E.useRef(()=>{});return E.useEffect(()=>{const r=o=>{if(o.target&&!t.current){let l=function(){$Ve(Ytn,e,a,{discrete:!0})};const a={originalEvent:o};o.pointerType==="touch"?(document.removeEventListener("click",i.current),i.current=l,document.addEventListener("click",i.current,{once:!0})):l()}t.current=!1},s=window.setTimeout(()=>{document.addEventListener("pointerdown",r)},0);return()=>{window.clearTimeout(s),document.removeEventListener("pointerdown",r),document.removeEventListener("click",i.current)}},[e]),{onPointerDownCapture:()=>t.current=!0}}function enn(n){const e=Phe(n),t=E.useRef(!1);return E.useEffect(()=>{const i=r=>{r.target&&!t.current&&$Ve(Ztn,e,{originalEvent:r},{discrete:!1})};return document.addEventListener("focusin",i),()=>document.removeEventListener("focusin",i)},[e]),{onFocusCapture:()=>t.current=!0,onBlurCapture:()=>t.current=!1}}function s2e(){const n=new CustomEvent(Bie);document.dispatchEvent(n)}function $Ve(n,e,t,{discrete:i}){const r=t.originalEvent.target,s=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&r.addEventListener(n,e,{once:!0}),i?Ktn(r,s):r.dispatchEvent(s)}function o2e(n){const e=E.useRef(n);return E.useEffect(()=>{e.current=n}),E.useMemo(()=>(...t)=>{var i;return(i=e.current)===null||i===void 0?void 0:i.call(e,...t)},[])}const IK="focusScope.autoFocusOnMount",AK="focusScope.autoFocusOnUnmount",a2e={bubbles:!1,cancelable:!0},tnn=E.forwardRef((n,e)=>{const{loop:t=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...o}=n,[a,l]=E.useState(null),c=o2e(r),u=o2e(s),d=E.useRef(null),h=zO(e,p=>l(p)),f=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(i){let p=function(_){if(f.paused||!a)return;const v=_.target;a.contains(v)?d.current=v:ey(d.current,{select:!0})},m=function(_){f.paused||!a||a.contains(_.relatedTarget)||ey(d.current,{select:!0})};return document.addEventListener("focusin",p),document.addEventListener("focusout",m),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",m)}}},[i,a,f.paused]),E.useEffect(()=>{if(a){c2e.add(f);const p=document.activeElement;if(!a.contains(p)){const _=new CustomEvent(IK,a2e);a.addEventListener(IK,c),a.dispatchEvent(_),_.defaultPrevented||(nnn(ann(WVe(a)),{select:!0}),document.activeElement===p&&ey(a))}return()=>{a.removeEventListener(IK,c),setTimeout(()=>{const _=new CustomEvent(AK,a2e);a.addEventListener(AK,u),a.dispatchEvent(_),_.defaultPrevented||ey(p??document.body,{select:!0}),a.removeEventListener(AK,u),c2e.remove(f)},0)}}},[a,c,u,f]);const g=E.useCallback(p=>{if(!t&&!i||f.paused)return;const m=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,_=document.activeElement;if(m&&_){const v=p.currentTarget,[y,C]=inn(v);y&&C?!p.shiftKey&&_===C?(p.preventDefault(),t&&ey(y,{select:!0})):p.shiftKey&&_===y&&(p.preventDefault(),t&&ey(C,{select:!0})):_===v&&p.preventDefault()}},[t,i,f.paused]);return E.createElement(QH.div,fu({tabIndex:-1},o,{ref:h,onKeyDown:g}))});function nnn(n,{select:e=!1}={}){const t=document.activeElement;for(const i of n)if(ey(i,{select:e}),document.activeElement!==t)return}function inn(n){const e=WVe(n),t=l2e(e,n),i=l2e(e.reverse(),n);return[t,i]}function WVe(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function l2e(n,e){for(const t of n)if(!rnn(t,{upTo:e}))return t}function rnn(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function snn(n){return n instanceof HTMLInputElement&&"select"in n}function ey(n,{select:e=!1}={}){if(n&&n.focus){const t=document.activeElement;n.focus({preventScroll:!0}),n!==t&&snn(n)&&e&&n.select()}}const c2e=onn();function onn(){let n=[];return{add(e){const t=n[0];e!==t&&t?.pause(),n=u2e(n,e),n.unshift(e)},remove(e){var t;n=u2e(n,e),(t=n[0])===null||t===void 0||t.resume()}}}function u2e(n,e){const t=[...n],i=t.indexOf(e);return i!==-1&&t.splice(i,1),t}function ann(n){return n.filter(e=>e.tagName!=="A")}const lnn=E.forwardRef((n,e)=>{var t;const{container:i=globalThis==null||(t=globalThis.document)===null||t===void 0?void 0:t.body,...r}=n;return i?p$.createPortal(E.createElement(QH.div,fu({},r,{ref:e})),i):null}),d2e=globalThis?.document?E.useLayoutEffect:()=>{};function cnn(n,e){return E.useReducer((t,i)=>{const r=e[t][i];return r??t},n)}const JH=n=>{const{present:e,children:t}=n,i=unn(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=zO(i.ref,r.ref);return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};JH.displayName="Presence";function unn(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=cnn(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=V3(i.current);s.current=a==="mounted"?c:"none"},[a]),d2e(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=V3(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),d2e(()=>{if(e){const c=d=>{const f=V3(i.current).includes(d.animationName);d.target===e&&f&&h0.flushSync(()=>l("ANIMATION_END"))},u=d=>{d.target===e&&(s.current=V3(i.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function V3(n){return n?.animationName||"none"}let NK=0;function dnn(){E.useEffect(()=>{var n,e;const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(n=t[0])!==null&&n!==void 0?n:h2e()),document.body.insertAdjacentElement("beforeend",(e=t[1])!==null&&e!==void 0?e:h2e()),NK++,()=>{NK===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(i=>i.remove()),NK--}},[])}function h2e(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",n}var AF="right-scroll-bar-position",NF="width-before-scroll-bar",hnn="with-scroll-bars-hidden",fnn="--removed-body-scroll-bar-size";function RK(n,e){return typeof n=="function"?n(e):n&&(n.current=e),n}function gnn(n,e){var t=E.useState(function(){return{value:n,callback:e,facade:{get current(){return t.value},set current(i){var r=t.value;r!==i&&(t.value=i,t.callback(i,r))}}}})[0];return t.callback=e,t.facade}var pnn=typeof window<"u"?E.useLayoutEffect:E.useEffect,f2e=new WeakMap;function mnn(n,e){var t=gnn(null,function(i){return n.forEach(function(r){return RK(r,i)})});return pnn(function(){var i=f2e.get(t);if(i){var r=new Set(i),s=new Set(n),o=t.current;r.forEach(function(a){s.has(a)||RK(a,null)}),s.forEach(function(a){r.has(a)||RK(a,o)})}f2e.set(t,n)},[n]),t}var HVe=VWe(),PK=function(){},eV=E.forwardRef(function(n,e){var t=E.useRef(null),i=E.useState({onScrollCapture:PK,onWheelCapture:PK,onTouchMoveCapture:PK}),r=i[0],s=i[1],o=n.forwardProps,a=n.children,l=n.className,c=n.removeScrollBar,u=n.enabled,d=n.shards,h=n.sideCar,f=n.noIsolation,g=n.inert,p=n.allowPinchZoom,m=n.as,_=m===void 0?"div":m,v=ihe(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),y=h,C=mnn([t,e]),x=vc(vc({},v),r);return E.createElement(E.Fragment,null,u&&E.createElement(y,{sideCar:HVe,removeScrollBar:c,shards:d,noIsolation:f,inert:g,setCallbacks:s,allowPinchZoom:!!p,lockRef:t}),o?E.cloneElement(E.Children.only(a),vc(vc({},x),{ref:C})):E.createElement(_,vc({},x,{className:l,ref:C}),a))});eV.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};eV.classNames={fullWidth:NF,zeroRight:AF};var _nn={left:0,top:0,right:0,gap:0},OK=function(n){return parseInt(n||"",10)||0},vnn=function(n){var e=window.getComputedStyle(document.body),t=e[n==="padding"?"paddingLeft":"marginLeft"],i=e[n==="padding"?"paddingTop":"marginTop"],r=e[n==="padding"?"paddingRight":"marginRight"];return[OK(t),OK(i),OK(r)]},bnn=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return _nn;var e=vnn(n),t=document.documentElement.clientWidth,i=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,i-t+e[2]-e[0])}},ynn=rhe(),Fk="data-scroll-locked",wnn=function(n,e,t,i){var r=n.left,s=n.top,o=n.right,a=n.gap;return t===void 0&&(t="margin"),` .`.concat(hnn,` { overflow: hidden `).concat(i,`; padding-right: `).concat(a,"px ").concat(i,`; @@ -2014,19 +2024,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do `),t==="padding"&&"padding-right: ".concat(a,"px ").concat(i,";")].filter(Boolean).join(""),` } - .`).concat(A5,` { + .`).concat(AF,` { right: `).concat(a,"px ").concat(i,`; } - .`).concat(N5,` { + .`).concat(NF,` { margin-right: `).concat(a,"px ").concat(i,`; } - .`).concat(A5," .").concat(A5,` { + .`).concat(AF," .").concat(AF,` { right: 0 `).concat(i,`; } - .`).concat(N5," .").concat(N5,` { + .`).concat(NF," .").concat(NF,` { margin-right: 0 `).concat(i,`; } @@ -2036,7 +2046,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do `)},g2e=function(){var n=parseInt(document.body.getAttribute(Fk)||"0",10);return isFinite(n)?n:0},Cnn=function(){E.useEffect(function(){return document.body.setAttribute(Fk,(g2e()+1).toString()),function(){var n=g2e()-1;n<=0?document.body.removeAttribute(Fk):document.body.setAttribute(Fk,n.toString())}},[])},xnn=function(n){var e=n.noRelative,t=n.noImportant,i=n.gapMode,r=i===void 0?"margin":i;Cnn();var s=E.useMemo(function(){return bnn(r)},[r]);return E.createElement(ynn,{styles:wnn(s,!e,r,t?"":"!important")})},$ie=!1;if(typeof window<"u")try{var z3=Object.defineProperty({},"passive",{get:function(){return $ie=!0,!0}});window.addEventListener("test",z3,z3),window.removeEventListener("test",z3,z3)}catch{$ie=!1}var $x=$ie?{passive:!1}:!1,Snn=function(n){var e=window.getComputedStyle(n);return e.overflowY!=="hidden"&&!(e.overflowY===e.overflowX&&e.overflowY==="visible")},knn=function(n){var e=window.getComputedStyle(n);return e.overflowX!=="hidden"&&!(e.overflowY===e.overflowX&&e.overflowX==="visible")},p2e=function(n,e){var t=e;do{typeof ShadowRoot<"u"&&t instanceof ShadowRoot&&(t=t.host);var i=VVe(n,t);if(i){var r=zVe(n,t),s=r[1],o=r[2];if(s>o)return!0}t=t.parentNode}while(t&&t!==document.body);return!1},Enn=function(n){var e=n.scrollTop,t=n.scrollHeight,i=n.clientHeight;return[e,t,i]},Lnn=function(n){var e=n.scrollLeft,t=n.scrollWidth,i=n.clientWidth;return[e,t,i]},VVe=function(n,e){return n==="v"?Snn(e):knn(e)},zVe=function(n,e){return n==="v"?Enn(e):Lnn(e)},Tnn=function(n,e){return n==="h"&&e==="rtl"?-1:1},Dnn=function(n,e,t,i,r){var s=Tnn(n,window.getComputedStyle(e).direction),o=s*i,a=t.target,l=e.contains(a),c=!1,u=o>0,d=0,h=0;do{var f=zVe(n,a),g=f[0],p=f[1],m=f[2],_=p-m-s*g;(g||_)&&VVe(n,a)&&(d+=_,h+=g),a=a.parentNode}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&(d===0||!r)||!u&&(h===0||!r))&&(c=!0),c},U3=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},m2e=function(n){return[n.deltaX,n.deltaY]},_2e=function(n){return n&&"current"in n?n.current:n},Inn=function(n,e){return n[0]===e[0]&&n[1]===e[1]},Ann=function(n){return` .block-interactivity-`.concat(n,` {pointer-events: none;} .allow-interactivity-`).concat(n,` {pointer-events: all;} -`)},Nnn=0,Wx=[];function Rnn(n){var e=E.useRef([]),t=E.useRef([0,0]),i=E.useRef(),r=E.useState(Nnn++)[0],s=E.useState(function(){return rhe()})[0],o=E.useRef(n);E.useEffect(function(){o.current=n},[n]),E.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(r));var p=HWe([n.lockRef.current],(n.shards||[]).map(_2e),!0).filter(Boolean);return p.forEach(function(m){return m.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),p.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(r))})}}},[n.inert,n.lockRef.current,n.shards]);var a=E.useCallback(function(p,m){if("touches"in p&&p.touches.length===2)return!o.current.allowPinchZoom;var _=U3(p),v=t.current,y="deltaX"in p?p.deltaX:v[0]-_[0],C="deltaY"in p?p.deltaY:v[1]-_[1],x,k=p.target,L=Math.abs(y)>Math.abs(C)?"h":"v";if("touches"in p&&L==="h"&&k.type==="range")return!1;var D=p2e(L,k);if(!D)return!0;if(D?x=L:(x=L==="v"?"h":"v",D=p2e(L,k)),!D)return!1;if(!i.current&&"changedTouches"in p&&(y||C)&&(i.current=x),!x)return!0;var I=i.current||x;return Dnn(I,m,p,I==="h"?y:C,!0)},[]),l=E.useCallback(function(p){var m=p;if(!(!Wx.length||Wx[Wx.length-1]!==s)){var _="deltaY"in m?m2e(m):U3(m),v=e.current.filter(function(x){return x.name===m.type&&x.target===m.target&&Inn(x.delta,_)})[0];if(v&&v.should){m.preventDefault();return}if(!v){var y=(o.current.shards||[]).map(_2e).filter(Boolean).filter(function(x){return x.contains(m.target)}),C=y.length>0?a(m,y[0]):!o.current.noIsolation;C&&m.preventDefault()}}},[]),c=E.useCallback(function(p,m,_,v){var y={name:p,delta:m,target:_,should:v};e.current.push(y),setTimeout(function(){e.current=e.current.filter(function(C){return C!==y})},1)},[]),u=E.useCallback(function(p){t.current=U3(p),i.current=void 0},[]),d=E.useCallback(function(p){c(p.type,m2e(p),p.target,a(p,n.lockRef.current))},[]),h=E.useCallback(function(p){c(p.type,U3(p),p.target,a(p,n.lockRef.current))},[]);E.useEffect(function(){return Wx.push(s),n.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,$x),document.addEventListener("touchmove",l,$x),document.addEventListener("touchstart",u,$x),function(){Wx=Wx.filter(function(p){return p!==s}),document.removeEventListener("wheel",l,$x),document.removeEventListener("touchmove",l,$x),document.removeEventListener("touchstart",u,$x)}},[]);var f=n.removeScrollBar,g=n.inert;return E.createElement(E.Fragment,null,g?E.createElement(s,{styles:Ann(r)}):null,f?E.createElement(xnn,{gapMode:"margin"}):null)}const Pnn=UWe(HVe,Rnn);var UVe=E.forwardRef(function(n,e){return E.createElement(eV,vc({},n,{ref:e,sideCar:Pnn}))});UVe.classNames=eV.classNames;const jVe="Dialog",[qVe,KHn]=Mtn(jVe),[Onn,FC]=qVe(jVe),Mnn=n=>{const{__scopeDialog:e,children:t,open:i,defaultOpen:r,onOpenChange:s,modal:o=!0}=n,a=E.useRef(null),l=E.useRef(null),[c=!1,u]=Htn({prop:i,defaultProp:r,onChange:s});return E.createElement(Onn,{scope:e,triggerRef:a,contentRef:l,contentId:DK(),titleId:DK(),descriptionId:DK(),open:c,onOpenChange:u,onOpenToggle:E.useCallback(()=>u(d=>!d),[u]),modal:o},t)},KVe="DialogPortal",[Fnn,GVe]=qVe(KVe,{forceMount:void 0}),Bnn=n=>{const{__scopeDialog:e,forceMount:t,children:i,container:r}=n,s=FC(KVe,e);return E.createElement(Fnn,{scope:e,forceMount:t},E.Children.map(i,o=>E.createElement(JH,{present:t||s.open},E.createElement(lnn,{asChild:!0,container:r},o))))},Wie="DialogOverlay",$nn=E.forwardRef((n,e)=>{const t=GVe(Wie,n.__scopeDialog),{forceMount:i=t.forceMount,...r}=n,s=FC(Wie,n.__scopeDialog);return s.modal?E.createElement(JH,{present:i||s.open},E.createElement(Wnn,fu({},r,{ref:e}))):null}),Wnn=E.forwardRef((n,e)=>{const{__scopeDialog:t,...i}=n,r=FC(Wie,t);return E.createElement(UVe,{as:Rhe,allowPinchZoom:!0,shards:[r.contentRef]},E.createElement(QH.div,fu({"data-state":ZVe(r.open)},i,{ref:e,style:{pointerEvents:"auto",...i.style}})))}),FR="DialogContent",Hnn=E.forwardRef((n,e)=>{const t=GVe(FR,n.__scopeDialog),{forceMount:i=t.forceMount,...r}=n,s=FC(FR,n.__scopeDialog);return E.createElement(JH,{present:i||s.open},s.modal?E.createElement(Vnn,fu({},r,{ref:e})):E.createElement(znn,fu({},r,{ref:e})))}),Vnn=E.forwardRef((n,e)=>{const t=FC(FR,n.__scopeDialog),i=E.useRef(null),r=zO(e,t.contentRef,i);return E.useEffect(()=>{const s=i.current;if(s)return MO(s)},[]),E.createElement(YVe,fu({},n,{ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Mk(n.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=t.triggerRef.current)===null||o===void 0||o.focus()}),onPointerDownOutside:Mk(n.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:Mk(n.onFocusOutside,s=>s.preventDefault())}))}),znn=E.forwardRef((n,e)=>{const t=FC(FR,n.__scopeDialog),i=E.useRef(!1);return E.createElement(YVe,fu({},n,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var s;if((s=n.onCloseAutoFocus)===null||s===void 0||s.call(n,r),!r.defaultPrevented){var o;i.current||(o=t.triggerRef.current)===null||o===void 0||o.focus(),r.preventDefault()}i.current=!1},onInteractOutside:r=>{var s,o;(s=n.onInteractOutside)===null||s===void 0||s.call(n,r),r.defaultPrevented||(i.current=!0);const a=r.target;((o=t.triggerRef.current)===null||o===void 0?void 0:o.contains(a))&&r.preventDefault()}}))}),YVe=E.forwardRef((n,e)=>{const{__scopeDialog:t,trapFocus:i,onOpenAutoFocus:r,onCloseAutoFocus:s,...o}=n,a=FC(FR,t),l=E.useRef(null),c=zO(e,l);return dnn(),E.createElement(E.Fragment,null,E.createElement(tnn,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:r,onUnmountAutoFocus:s},E.createElement(Qtn,fu({role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ZVe(a.open)},o,{ref:c,onDismiss:()=>a.onOpenChange(!1)}))),!1)});function ZVe(n){return n?"open":"closed"}const Unn=Mnn,jnn=Bnn,qnn=$nn,Knn=Hnn;var Gnn='[cmdk-list-sizer=""]',JT='[cmdk-group=""]',MK='[cmdk-group-items=""]',Ynn='[cmdk-group-heading=""]',Ohe='[cmdk-item=""]',v2e=`${Ohe}:not([aria-disabled="true"])`,Hie="cmdk-item-select",Km="data-value",Znn=(n,e)=>Ptn(n,e),XVe=E.createContext(void 0),UO=()=>E.useContext(XVe),QVe=E.createContext(void 0),Mhe=()=>E.useContext(QVe),JVe=E.createContext(void 0),eze=E.forwardRef((n,e)=>{let t=E.useRef(null),i=tS(()=>{var te,le,ue;return{search:"",value:(ue=(le=n.value)!=null?le:(te=n.defaultValue)==null?void 0:te.toLowerCase())!=null?ue:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=tS(()=>new Set),s=tS(()=>new Map),o=tS(()=>new Map),a=tS(()=>new Set),l=tze(n),{label:c,children:u,value:d,onValueChange:h,filter:f,shouldFilter:g,vimBindings:p=!0,...m}=n,_=E.useId(),v=E.useId(),y=E.useId(),C=ain();x2(()=>{if(d!==void 0){let te=d.trim().toLowerCase();i.current.value=te,C(6,M),x.emit()}},[d]);let x=E.useMemo(()=>({subscribe:te=>(a.current.add(te),()=>a.current.delete(te)),snapshot:()=>i.current,setState:(te,le,ue)=>{var de,we,xe;if(!Object.is(i.current[te],le)){if(i.current[te]=le,te==="search")O(),D(),C(1,I);else if(te==="value")if(((de=l.current)==null?void 0:de.value)!==void 0){let Me=le??"";(xe=(we=l.current).onValueChange)==null||xe.call(we,Me);return}else ue||C(5,M);x.emit()}},emit:()=>{a.current.forEach(te=>te())}}),[]),k=E.useMemo(()=>({value:(te,le)=>{le!==o.current.get(te)&&(o.current.set(te,le),i.current.filtered.items.set(te,L(le)),C(2,()=>{D(),x.emit()}))},item:(te,le)=>(r.current.add(te),le&&(s.current.has(le)?s.current.get(le).add(te):s.current.set(le,new Set([te]))),C(3,()=>{O(),D(),i.current.value||I(),x.emit()}),()=>{o.current.delete(te),r.current.delete(te),i.current.filtered.items.delete(te);let ue=B();C(4,()=>{O(),ue?.getAttribute("id")===te&&I(),x.emit()})}),group:te=>(s.current.has(te)||s.current.set(te,new Set),()=>{o.current.delete(te),s.current.delete(te)}),filter:()=>l.current.shouldFilter,label:c||n["aria-label"],commandRef:t,listId:_,inputId:y,labelId:v}),[]);function L(te){var le,ue;let de=(ue=(le=l.current)==null?void 0:le.filter)!=null?ue:Znn;return te?de(te,i.current.search):0}function D(){if(!t.current||!i.current.search||l.current.shouldFilter===!1)return;let te=i.current.filtered.items,le=[];i.current.filtered.groups.forEach(de=>{let we=s.current.get(de),xe=0;we.forEach(Me=>{let Re=te.get(Me);xe=Math.max(Re,xe)}),le.push([de,xe])});let ue=t.current.querySelector(Gnn);G().sort((de,we)=>{var xe,Me;let Re=de.getAttribute(Km),_t=we.getAttribute(Km);return((xe=te.get(_t))!=null?xe:0)-((Me=te.get(Re))!=null?Me:0)}).forEach(de=>{let we=de.closest(MK);we?we.appendChild(de.parentElement===we?de:de.closest(`${MK} > *`)):ue.appendChild(de.parentElement===ue?de:de.closest(`${MK} > *`))}),le.sort((de,we)=>we[1]-de[1]).forEach(de=>{let we=t.current.querySelector(`${JT}[${Km}="${de[0]}"]`);we?.parentElement.appendChild(we)})}function I(){let te=G().find(ue=>!ue.ariaDisabled),le=te?.getAttribute(Km);x.setState("value",le||void 0)}function O(){if(!i.current.search||l.current.shouldFilter===!1){i.current.filtered.count=r.current.size;return}i.current.filtered.groups=new Set;let te=0;for(let le of r.current){let ue=o.current.get(le),de=L(ue);i.current.filtered.items.set(le,de),de>0&&te++}for(let[le,ue]of s.current)for(let de of ue)if(i.current.filtered.items.get(de)>0){i.current.filtered.groups.add(le);break}i.current.filtered.count=te}function M(){var te,le,ue;let de=B();de&&(((te=de.parentElement)==null?void 0:te.firstChild)===de&&((ue=(le=de.closest(JT))==null?void 0:le.querySelector(Ynn))==null||ue.scrollIntoView({block:"nearest"})),de.scrollIntoView({block:"nearest"}))}function B(){var te;return(te=t.current)==null?void 0:te.querySelector(`${Ohe}[aria-selected="true"]`)}function G(){return Array.from(t.current.querySelectorAll(v2e))}function W(te){let le=G()[te];le&&x.setState("value",le.getAttribute(Km))}function z(te){var le;let ue=B(),de=G(),we=de.findIndex(Me=>Me===ue),xe=de[we+te];(le=l.current)!=null&&le.loop&&(xe=we+te<0?de[de.length-1]:we+te===de.length?de[0]:de[we+te]),xe&&x.setState("value",xe.getAttribute(Km))}function q(te){let le=B(),ue=le?.closest(JT),de;for(;ue&&!de;)ue=te>0?sin(ue,JT):oin(ue,JT),de=ue?.querySelector(v2e);de?x.setState("value",de.getAttribute(Km)):z(te)}let ee=()=>W(G().length-1),Z=te=>{te.preventDefault(),te.metaKey?ee():te.altKey?q(1):z(1)},j=te=>{te.preventDefault(),te.metaKey?W(0):te.altKey?q(-1):z(-1)};return E.createElement("div",{ref:jO([t,e]),...m,"cmdk-root":"",onKeyDown:te=>{var le;if((le=m.onKeyDown)==null||le.call(m,te),!te.defaultPrevented)switch(te.key){case"n":case"j":{p&&te.ctrlKey&&Z(te);break}case"ArrowDown":{Z(te);break}case"p":case"k":{p&&te.ctrlKey&&j(te);break}case"ArrowUp":{j(te);break}case"Home":{te.preventDefault(),W(0);break}case"End":{te.preventDefault(),ee();break}case"Enter":if(!te.nativeEvent.isComposing){te.preventDefault();let ue=B();if(ue){let de=new Event(Hie);ue.dispatchEvent(de)}}}}},E.createElement("label",{"cmdk-label":"",htmlFor:k.inputId,id:k.labelId,style:lin},c),E.createElement(QVe.Provider,{value:x},E.createElement(XVe.Provider,{value:k},u)))}),Xnn=E.forwardRef((n,e)=>{var t,i;let r=E.useId(),s=E.useRef(null),o=E.useContext(JVe),a=UO(),l=tze(n),c=(i=(t=l.current)==null?void 0:t.forceMount)!=null?i:o?.forceMount;x2(()=>a.item(r,o?.id),[]);let u=nze(r,s,[n.value,n.children,s]),d=Mhe(),h=iC(x=>x.value&&x.value===u.current),f=iC(x=>c||a.filter()===!1?!0:x.search?x.filtered.items.get(r)>0:!0);E.useEffect(()=>{let x=s.current;if(!(!x||n.disabled))return x.addEventListener(Hie,g),()=>x.removeEventListener(Hie,g)},[f,n.onSelect,n.disabled]);function g(){var x,k;p(),(k=(x=l.current).onSelect)==null||k.call(x,u.current)}function p(){d.setState("value",u.current,!0)}if(!f)return null;let{disabled:m,value:_,onSelect:v,forceMount:y,...C}=n;return E.createElement("div",{ref:jO([s,e]),...C,id:r,"cmdk-item":"",role:"option","aria-disabled":m||void 0,"aria-selected":h||void 0,"data-disabled":m||void 0,"data-selected":h||void 0,onPointerMove:m?void 0:p,onClick:m?void 0:g},n.children)}),Qnn=E.forwardRef((n,e)=>{let{heading:t,children:i,forceMount:r,...s}=n,o=E.useId(),a=E.useRef(null),l=E.useRef(null),c=E.useId(),u=UO(),d=iC(g=>r||u.filter()===!1?!0:g.search?g.filtered.groups.has(o):!0);x2(()=>u.group(o),[]),nze(o,a,[n.value,n.heading,l]);let h=E.useMemo(()=>({id:o,forceMount:r}),[r]),f=E.createElement(JVe.Provider,{value:h},i);return E.createElement("div",{ref:jO([a,e]),...s,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},t&&E.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},t),E.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":t?c:void 0},f))}),Jnn=E.forwardRef((n,e)=>{let{alwaysRender:t,...i}=n,r=E.useRef(null),s=iC(o=>!o.search);return!t&&!s?null:E.createElement("div",{ref:jO([r,e]),...i,"cmdk-separator":"",role:"separator"})}),ein=E.forwardRef((n,e)=>{let{onValueChange:t,...i}=n,r=n.value!=null,s=Mhe(),o=iC(u=>u.search),a=iC(u=>u.value),l=UO(),c=E.useMemo(()=>{var u;let d=(u=l.commandRef.current)==null?void 0:u.querySelector(`${Ohe}[${Km}="${a}"]`);return d?.getAttribute("id")},[a,l.commandRef]);return E.useEffect(()=>{n.value!=null&&s.setState("search",n.value)},[n.value]),E.createElement("input",{ref:e,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:r?n.value:o,onChange:u=>{r||s.setState("search",u.target.value),t?.(u.target.value)}})}),tin=E.forwardRef((n,e)=>{let{children:t,...i}=n,r=E.useRef(null),s=E.useRef(null),o=UO();return E.useEffect(()=>{if(s.current&&r.current){let a=s.current,l=r.current,c,u=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let d=a.offsetHeight;l.style.setProperty("--cmdk-list-height",d.toFixed(1)+"px")})});return u.observe(a),()=>{cancelAnimationFrame(c),u.unobserve(a)}}},[]),E.createElement("div",{ref:jO([r,e]),...i,"cmdk-list":"",role:"listbox","aria-label":"Suggestions",id:o.listId,"aria-labelledby":o.inputId},E.createElement("div",{ref:s,"cmdk-list-sizer":""},t))}),nin=E.forwardRef((n,e)=>{let{open:t,onOpenChange:i,overlayClassName:r,contentClassName:s,container:o,...a}=n;return E.createElement(Unn,{open:t,onOpenChange:i},E.createElement(jnn,{container:o},E.createElement(qnn,{"cmdk-overlay":"",className:r}),E.createElement(Knn,{"aria-label":n.label,"cmdk-dialog":"",className:s},E.createElement(eze,{ref:e,...a}))))}),iin=E.forwardRef((n,e)=>{let t=E.useRef(!0),i=iC(r=>r.filtered.count===0);return E.useEffect(()=>{t.current=!1},[]),t.current||!i?null:E.createElement("div",{ref:e,...n,"cmdk-empty":"",role:"presentation"})}),rin=E.forwardRef((n,e)=>{let{progress:t,children:i,...r}=n;return E.createElement("div",{ref:e,...r,"cmdk-loading":"",role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Loading..."},E.createElement("div",{"aria-hidden":!0},i))}),GHn=Object.assign(eze,{List:tin,Item:Xnn,Input:ein,Group:Qnn,Separator:Jnn,Dialog:nin,Empty:iin,Loading:rin});function sin(n,e){let t=n.nextElementSibling;for(;t;){if(t.matches(e))return t;t=t.nextElementSibling}}function oin(n,e){let t=n.previousElementSibling;for(;t;){if(t.matches(e))return t;t=t.previousElementSibling}}function tze(n){let e=E.useRef(n);return x2(()=>{e.current=n}),e}var x2=typeof window>"u"?E.useEffect:E.useLayoutEffect;function tS(n){let e=E.useRef();return e.current===void 0&&(e.current=n()),e}function jO(n){return e=>{n.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}function iC(n){let e=Mhe(),t=()=>n(e.snapshot());return E.useSyncExternalStore(e.subscribe,t,t)}function nze(n,e,t){let i=E.useRef(),r=UO();return x2(()=>{var s;let o=(()=>{var a;for(let l of t){if(typeof l=="string")return l.trim().toLowerCase();if(typeof l=="object"&&"current"in l)return l.current?(a=l.current.textContent)==null?void 0:a.trim().toLowerCase():i.current}})();r.value(n,o),(s=e.current)==null||s.setAttribute(Km,o),i.current=o}),i}var ain=()=>{let[n,e]=E.useState(),t=tS(()=>new Map);return x2(()=>{t.current.forEach(i=>i()),t.current=new Map},[n]),(i,r)=>{t.current.set(i,r),e({})}},lin={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},Fhe="Avatar",[cin,YHn]=Ac(Fhe),[uin,ize]=cin(Fhe),rze=E.forwardRef((n,e)=>{const{__scopeAvatar:t,...i}=n,[r,s]=E.useState("idle");return ae.jsx(uin,{scope:t,imageLoadingStatus:r,onImageLoadingStatusChange:s,children:ae.jsx(Pn.span,{...i,ref:e})})});rze.displayName=Fhe;var sze="AvatarImage",oze=E.forwardRef((n,e)=>{const{__scopeAvatar:t,src:i,onLoadingStatusChange:r=()=>{},...s}=n,o=ize(sze,t),a=din(i,s.referrerPolicy),l=Ua(c=>{r(c),o.onImageLoadingStatusChange(c)});return es(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?ae.jsx(Pn.img,{...s,ref:e,src:i}):null});oze.displayName=sze;var aze="AvatarFallback",lze=E.forwardRef((n,e)=>{const{__scopeAvatar:t,delayMs:i,...r}=n,s=ize(aze,t),[o,a]=E.useState(i===void 0);return E.useEffect(()=>{if(i!==void 0){const l=window.setTimeout(()=>a(!0),i);return()=>window.clearTimeout(l)}},[i]),o&&s.imageLoadingStatus!=="loaded"?ae.jsx(Pn.span,{...r,ref:e}):null});lze.displayName=aze;function din(n,e){const[t,i]=E.useState("idle");return es(()=>{if(!n){i("error");return}let r=!0;const s=new window.Image,o=a=>()=>{r&&i(a)};return i("loading"),s.onload=o("loaded"),s.onerror=o("error"),s.src=n,e&&(s.referrerPolicy=e),()=>{r=!1}},[n,e]),t}var ZHn=rze,XHn=oze,QHn=lze,hin=Array.isArray,fd=hin,fin=typeof Hh=="object"&&Hh&&Hh.Object===Object&&Hh,cze=fin,gin=cze,pin=typeof self=="object"&&self&&self.Object===Object&&self,min=gin||pin||Function("return this")(),gm=min,_in=gm,vin=_in.Symbol,qO=vin,b2e=qO,uze=Object.prototype,bin=uze.hasOwnProperty,yin=uze.toString,eD=b2e?b2e.toStringTag:void 0;function win(n){var e=bin.call(n,eD),t=n[eD];try{n[eD]=void 0;var i=!0}catch{}var r=yin.call(n);return i&&(e?n[eD]=t:delete n[eD]),r}var Cin=win,xin=Object.prototype,Sin=xin.toString;function kin(n){return Sin.call(n)}var Ein=kin,y2e=qO,Lin=Cin,Tin=Ein,Din="[object Null]",Iin="[object Undefined]",w2e=y2e?y2e.toStringTag:void 0;function Ain(n){return n==null?n===void 0?Iin:Din:w2e&&w2e in Object(n)?Lin(n):Tin(n)}var x0=Ain;function Nin(n){return n!=null&&typeof n=="object"}var S0=Nin,Rin=x0,Pin=S0,Oin="[object Symbol]";function Min(n){return typeof n=="symbol"||Pin(n)&&Rin(n)==Oin}var S2=Min,Fin=fd,Bin=S2,$in=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Win=/^\w*$/;function Hin(n,e){if(Fin(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||Bin(n)?!0:Win.test(n)||!$in.test(n)||e!=null&&n in Object(e)}var Bhe=Hin;function Vin(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var u1=Vin;const k2=cs(u1);var zin=x0,Uin=u1,jin="[object AsyncFunction]",qin="[object Function]",Kin="[object GeneratorFunction]",Gin="[object Proxy]";function Yin(n){if(!Uin(n))return!1;var e=zin(n);return e==qin||e==Kin||e==jin||e==Gin}var $he=Yin;const Ri=cs($he);var Zin=gm,Xin=Zin["__core-js_shared__"],Qin=Xin,FK=Qin,C2e=function(){var n=/[^.]+$/.exec(FK&&FK.keys&&FK.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function Jin(n){return!!C2e&&C2e in n}var ern=Jin,trn=Function.prototype,nrn=trn.toString;function irn(n){if(n!=null){try{return nrn.call(n)}catch{}try{return n+""}catch{}}return""}var dze=irn,rrn=$he,srn=ern,orn=u1,arn=dze,lrn=/[\\^$.*+?()[\]{}|]/g,crn=/^\[object .+?Constructor\]$/,urn=Function.prototype,drn=Object.prototype,hrn=urn.toString,frn=drn.hasOwnProperty,grn=RegExp("^"+hrn.call(frn).replace(lrn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function prn(n){if(!orn(n)||srn(n))return!1;var e=rrn(n)?grn:crn;return e.test(arn(n))}var mrn=prn;function _rn(n,e){return n?.[e]}var vrn=_rn,brn=mrn,yrn=vrn;function wrn(n,e){var t=yrn(n,e);return brn(t)?t:void 0}var BC=wrn,Crn=BC,xrn=Crn(Object,"create"),tV=xrn,x2e=tV;function Srn(){this.__data__=x2e?x2e(null):{},this.size=0}var krn=Srn;function Ern(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var Lrn=Ern,Trn=tV,Drn="__lodash_hash_undefined__",Irn=Object.prototype,Arn=Irn.hasOwnProperty;function Nrn(n){var e=this.__data__;if(Trn){var t=e[n];return t===Drn?void 0:t}return Arn.call(e,n)?e[n]:void 0}var Rrn=Nrn,Prn=tV,Orn=Object.prototype,Mrn=Orn.hasOwnProperty;function Frn(n){var e=this.__data__;return Prn?e[n]!==void 0:Mrn.call(e,n)}var Brn=Frn,$rn=tV,Wrn="__lodash_hash_undefined__";function Hrn(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=$rn&&e===void 0?Wrn:e,this}var Vrn=Hrn,zrn=krn,Urn=Lrn,jrn=Rrn,qrn=Brn,Krn=Vrn;function E2(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1}var usn=csn,dsn=nV;function hsn(n,e){var t=this.__data__,i=dsn(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}var fsn=hsn,gsn=Zrn,psn=rsn,msn=asn,_sn=usn,vsn=fsn;function L2(n){var e=-1,t=n==null?0:n.length;for(this.clear();++eMath.abs(C)?"h":"v";if("touches"in p&&L==="h"&&k.type==="range")return!1;var D=p2e(L,k);if(!D)return!0;if(D?x=L:(x=L==="v"?"h":"v",D=p2e(L,k)),!D)return!1;if(!i.current&&"changedTouches"in p&&(y||C)&&(i.current=x),!x)return!0;var I=i.current||x;return Dnn(I,m,p,I==="h"?y:C,!0)},[]),l=E.useCallback(function(p){var m=p;if(!(!Wx.length||Wx[Wx.length-1]!==s)){var _="deltaY"in m?m2e(m):U3(m),v=e.current.filter(function(x){return x.name===m.type&&x.target===m.target&&Inn(x.delta,_)})[0];if(v&&v.should){m.preventDefault();return}if(!v){var y=(o.current.shards||[]).map(_2e).filter(Boolean).filter(function(x){return x.contains(m.target)}),C=y.length>0?a(m,y[0]):!o.current.noIsolation;C&&m.preventDefault()}}},[]),c=E.useCallback(function(p,m,_,v){var y={name:p,delta:m,target:_,should:v};e.current.push(y),setTimeout(function(){e.current=e.current.filter(function(C){return C!==y})},1)},[]),u=E.useCallback(function(p){t.current=U3(p),i.current=void 0},[]),d=E.useCallback(function(p){c(p.type,m2e(p),p.target,a(p,n.lockRef.current))},[]),h=E.useCallback(function(p){c(p.type,U3(p),p.target,a(p,n.lockRef.current))},[]);E.useEffect(function(){return Wx.push(s),n.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",l,$x),document.addEventListener("touchmove",l,$x),document.addEventListener("touchstart",u,$x),function(){Wx=Wx.filter(function(p){return p!==s}),document.removeEventListener("wheel",l,$x),document.removeEventListener("touchmove",l,$x),document.removeEventListener("touchstart",u,$x)}},[]);var f=n.removeScrollBar,g=n.inert;return E.createElement(E.Fragment,null,g?E.createElement(s,{styles:Ann(r)}):null,f?E.createElement(xnn,{gapMode:"margin"}):null)}const Pnn=UWe(HVe,Rnn);var UVe=E.forwardRef(function(n,e){return E.createElement(eV,vc({},n,{ref:e,sideCar:Pnn}))});UVe.classNames=eV.classNames;const jVe="Dialog",[qVe,YHn]=Mtn(jVe),[Onn,FC]=qVe(jVe),Mnn=n=>{const{__scopeDialog:e,children:t,open:i,defaultOpen:r,onOpenChange:s,modal:o=!0}=n,a=E.useRef(null),l=E.useRef(null),[c=!1,u]=Htn({prop:i,defaultProp:r,onChange:s});return E.createElement(Onn,{scope:e,triggerRef:a,contentRef:l,contentId:DK(),titleId:DK(),descriptionId:DK(),open:c,onOpenChange:u,onOpenToggle:E.useCallback(()=>u(d=>!d),[u]),modal:o},t)},KVe="DialogPortal",[Fnn,GVe]=qVe(KVe,{forceMount:void 0}),Bnn=n=>{const{__scopeDialog:e,forceMount:t,children:i,container:r}=n,s=FC(KVe,e);return E.createElement(Fnn,{scope:e,forceMount:t},E.Children.map(i,o=>E.createElement(JH,{present:t||s.open},E.createElement(lnn,{asChild:!0,container:r},o))))},Wie="DialogOverlay",$nn=E.forwardRef((n,e)=>{const t=GVe(Wie,n.__scopeDialog),{forceMount:i=t.forceMount,...r}=n,s=FC(Wie,n.__scopeDialog);return s.modal?E.createElement(JH,{present:i||s.open},E.createElement(Wnn,fu({},r,{ref:e}))):null}),Wnn=E.forwardRef((n,e)=>{const{__scopeDialog:t,...i}=n,r=FC(Wie,t);return E.createElement(UVe,{as:Rhe,allowPinchZoom:!0,shards:[r.contentRef]},E.createElement(QH.div,fu({"data-state":ZVe(r.open)},i,{ref:e,style:{pointerEvents:"auto",...i.style}})))}),FR="DialogContent",Hnn=E.forwardRef((n,e)=>{const t=GVe(FR,n.__scopeDialog),{forceMount:i=t.forceMount,...r}=n,s=FC(FR,n.__scopeDialog);return E.createElement(JH,{present:i||s.open},s.modal?E.createElement(Vnn,fu({},r,{ref:e})):E.createElement(znn,fu({},r,{ref:e})))}),Vnn=E.forwardRef((n,e)=>{const t=FC(FR,n.__scopeDialog),i=E.useRef(null),r=zO(e,t.contentRef,i);return E.useEffect(()=>{const s=i.current;if(s)return MO(s)},[]),E.createElement(YVe,fu({},n,{ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Mk(n.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=t.triggerRef.current)===null||o===void 0||o.focus()}),onPointerDownOutside:Mk(n.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:Mk(n.onFocusOutside,s=>s.preventDefault())}))}),znn=E.forwardRef((n,e)=>{const t=FC(FR,n.__scopeDialog),i=E.useRef(!1);return E.createElement(YVe,fu({},n,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var s;if((s=n.onCloseAutoFocus)===null||s===void 0||s.call(n,r),!r.defaultPrevented){var o;i.current||(o=t.triggerRef.current)===null||o===void 0||o.focus(),r.preventDefault()}i.current=!1},onInteractOutside:r=>{var s,o;(s=n.onInteractOutside)===null||s===void 0||s.call(n,r),r.defaultPrevented||(i.current=!0);const a=r.target;((o=t.triggerRef.current)===null||o===void 0?void 0:o.contains(a))&&r.preventDefault()}}))}),YVe=E.forwardRef((n,e)=>{const{__scopeDialog:t,trapFocus:i,onOpenAutoFocus:r,onCloseAutoFocus:s,...o}=n,a=FC(FR,t),l=E.useRef(null),c=zO(e,l);return dnn(),E.createElement(E.Fragment,null,E.createElement(tnn,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:r,onUnmountAutoFocus:s},E.createElement(Qtn,fu({role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ZVe(a.open)},o,{ref:c,onDismiss:()=>a.onOpenChange(!1)}))),!1)});function ZVe(n){return n?"open":"closed"}const Unn=Mnn,jnn=Bnn,qnn=$nn,Knn=Hnn;var Gnn='[cmdk-list-sizer=""]',JT='[cmdk-group=""]',MK='[cmdk-group-items=""]',Ynn='[cmdk-group-heading=""]',Ohe='[cmdk-item=""]',v2e=`${Ohe}:not([aria-disabled="true"])`,Hie="cmdk-item-select",Km="data-value",Znn=(n,e)=>Ptn(n,e),XVe=E.createContext(void 0),UO=()=>E.useContext(XVe),QVe=E.createContext(void 0),Mhe=()=>E.useContext(QVe),JVe=E.createContext(void 0),eze=E.forwardRef((n,e)=>{let t=E.useRef(null),i=tS(()=>{var te,le,ue;return{search:"",value:(ue=(le=n.value)!=null?le:(te=n.defaultValue)==null?void 0:te.toLowerCase())!=null?ue:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=tS(()=>new Set),s=tS(()=>new Map),o=tS(()=>new Map),a=tS(()=>new Set),l=tze(n),{label:c,children:u,value:d,onValueChange:h,filter:f,shouldFilter:g,vimBindings:p=!0,...m}=n,_=E.useId(),v=E.useId(),y=E.useId(),C=ain();x2(()=>{if(d!==void 0){let te=d.trim().toLowerCase();i.current.value=te,C(6,M),x.emit()}},[d]);let x=E.useMemo(()=>({subscribe:te=>(a.current.add(te),()=>a.current.delete(te)),snapshot:()=>i.current,setState:(te,le,ue)=>{var de,we,xe;if(!Object.is(i.current[te],le)){if(i.current[te]=le,te==="search")O(),D(),C(1,I);else if(te==="value")if(((de=l.current)==null?void 0:de.value)!==void 0){let Me=le??"";(xe=(we=l.current).onValueChange)==null||xe.call(we,Me);return}else ue||C(5,M);x.emit()}},emit:()=>{a.current.forEach(te=>te())}}),[]),k=E.useMemo(()=>({value:(te,le)=>{le!==o.current.get(te)&&(o.current.set(te,le),i.current.filtered.items.set(te,L(le)),C(2,()=>{D(),x.emit()}))},item:(te,le)=>(r.current.add(te),le&&(s.current.has(le)?s.current.get(le).add(te):s.current.set(le,new Set([te]))),C(3,()=>{O(),D(),i.current.value||I(),x.emit()}),()=>{o.current.delete(te),r.current.delete(te),i.current.filtered.items.delete(te);let ue=B();C(4,()=>{O(),ue?.getAttribute("id")===te&&I(),x.emit()})}),group:te=>(s.current.has(te)||s.current.set(te,new Set),()=>{o.current.delete(te),s.current.delete(te)}),filter:()=>l.current.shouldFilter,label:c||n["aria-label"],commandRef:t,listId:_,inputId:y,labelId:v}),[]);function L(te){var le,ue;let de=(ue=(le=l.current)==null?void 0:le.filter)!=null?ue:Znn;return te?de(te,i.current.search):0}function D(){if(!t.current||!i.current.search||l.current.shouldFilter===!1)return;let te=i.current.filtered.items,le=[];i.current.filtered.groups.forEach(de=>{let we=s.current.get(de),xe=0;we.forEach(Me=>{let Re=te.get(Me);xe=Math.max(Re,xe)}),le.push([de,xe])});let ue=t.current.querySelector(Gnn);G().sort((de,we)=>{var xe,Me;let Re=de.getAttribute(Km),_t=we.getAttribute(Km);return((xe=te.get(_t))!=null?xe:0)-((Me=te.get(Re))!=null?Me:0)}).forEach(de=>{let we=de.closest(MK);we?we.appendChild(de.parentElement===we?de:de.closest(`${MK} > *`)):ue.appendChild(de.parentElement===ue?de:de.closest(`${MK} > *`))}),le.sort((de,we)=>we[1]-de[1]).forEach(de=>{let we=t.current.querySelector(`${JT}[${Km}="${de[0]}"]`);we?.parentElement.appendChild(we)})}function I(){let te=G().find(ue=>!ue.ariaDisabled),le=te?.getAttribute(Km);x.setState("value",le||void 0)}function O(){if(!i.current.search||l.current.shouldFilter===!1){i.current.filtered.count=r.current.size;return}i.current.filtered.groups=new Set;let te=0;for(let le of r.current){let ue=o.current.get(le),de=L(ue);i.current.filtered.items.set(le,de),de>0&&te++}for(let[le,ue]of s.current)for(let de of ue)if(i.current.filtered.items.get(de)>0){i.current.filtered.groups.add(le);break}i.current.filtered.count=te}function M(){var te,le,ue;let de=B();de&&(((te=de.parentElement)==null?void 0:te.firstChild)===de&&((ue=(le=de.closest(JT))==null?void 0:le.querySelector(Ynn))==null||ue.scrollIntoView({block:"nearest"})),de.scrollIntoView({block:"nearest"}))}function B(){var te;return(te=t.current)==null?void 0:te.querySelector(`${Ohe}[aria-selected="true"]`)}function G(){return Array.from(t.current.querySelectorAll(v2e))}function W(te){let le=G()[te];le&&x.setState("value",le.getAttribute(Km))}function z(te){var le;let ue=B(),de=G(),we=de.findIndex(Me=>Me===ue),xe=de[we+te];(le=l.current)!=null&&le.loop&&(xe=we+te<0?de[de.length-1]:we+te===de.length?de[0]:de[we+te]),xe&&x.setState("value",xe.getAttribute(Km))}function q(te){let le=B(),ue=le?.closest(JT),de;for(;ue&&!de;)ue=te>0?sin(ue,JT):oin(ue,JT),de=ue?.querySelector(v2e);de?x.setState("value",de.getAttribute(Km)):z(te)}let ee=()=>W(G().length-1),Z=te=>{te.preventDefault(),te.metaKey?ee():te.altKey?q(1):z(1)},j=te=>{te.preventDefault(),te.metaKey?W(0):te.altKey?q(-1):z(-1)};return E.createElement("div",{ref:jO([t,e]),...m,"cmdk-root":"",onKeyDown:te=>{var le;if((le=m.onKeyDown)==null||le.call(m,te),!te.defaultPrevented)switch(te.key){case"n":case"j":{p&&te.ctrlKey&&Z(te);break}case"ArrowDown":{Z(te);break}case"p":case"k":{p&&te.ctrlKey&&j(te);break}case"ArrowUp":{j(te);break}case"Home":{te.preventDefault(),W(0);break}case"End":{te.preventDefault(),ee();break}case"Enter":if(!te.nativeEvent.isComposing){te.preventDefault();let ue=B();if(ue){let de=new Event(Hie);ue.dispatchEvent(de)}}}}},E.createElement("label",{"cmdk-label":"",htmlFor:k.inputId,id:k.labelId,style:lin},c),E.createElement(QVe.Provider,{value:x},E.createElement(XVe.Provider,{value:k},u)))}),Xnn=E.forwardRef((n,e)=>{var t,i;let r=E.useId(),s=E.useRef(null),o=E.useContext(JVe),a=UO(),l=tze(n),c=(i=(t=l.current)==null?void 0:t.forceMount)!=null?i:o?.forceMount;x2(()=>a.item(r,o?.id),[]);let u=nze(r,s,[n.value,n.children,s]),d=Mhe(),h=iC(x=>x.value&&x.value===u.current),f=iC(x=>c||a.filter()===!1?!0:x.search?x.filtered.items.get(r)>0:!0);E.useEffect(()=>{let x=s.current;if(!(!x||n.disabled))return x.addEventListener(Hie,g),()=>x.removeEventListener(Hie,g)},[f,n.onSelect,n.disabled]);function g(){var x,k;p(),(k=(x=l.current).onSelect)==null||k.call(x,u.current)}function p(){d.setState("value",u.current,!0)}if(!f)return null;let{disabled:m,value:_,onSelect:v,forceMount:y,...C}=n;return E.createElement("div",{ref:jO([s,e]),...C,id:r,"cmdk-item":"",role:"option","aria-disabled":m||void 0,"aria-selected":h||void 0,"data-disabled":m||void 0,"data-selected":h||void 0,onPointerMove:m?void 0:p,onClick:m?void 0:g},n.children)}),Qnn=E.forwardRef((n,e)=>{let{heading:t,children:i,forceMount:r,...s}=n,o=E.useId(),a=E.useRef(null),l=E.useRef(null),c=E.useId(),u=UO(),d=iC(g=>r||u.filter()===!1?!0:g.search?g.filtered.groups.has(o):!0);x2(()=>u.group(o),[]),nze(o,a,[n.value,n.heading,l]);let h=E.useMemo(()=>({id:o,forceMount:r}),[r]),f=E.createElement(JVe.Provider,{value:h},i);return E.createElement("div",{ref:jO([a,e]),...s,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},t&&E.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},t),E.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":t?c:void 0},f))}),Jnn=E.forwardRef((n,e)=>{let{alwaysRender:t,...i}=n,r=E.useRef(null),s=iC(o=>!o.search);return!t&&!s?null:E.createElement("div",{ref:jO([r,e]),...i,"cmdk-separator":"",role:"separator"})}),ein=E.forwardRef((n,e)=>{let{onValueChange:t,...i}=n,r=n.value!=null,s=Mhe(),o=iC(u=>u.search),a=iC(u=>u.value),l=UO(),c=E.useMemo(()=>{var u;let d=(u=l.commandRef.current)==null?void 0:u.querySelector(`${Ohe}[${Km}="${a}"]`);return d?.getAttribute("id")},[a,l.commandRef]);return E.useEffect(()=>{n.value!=null&&s.setState("search",n.value)},[n.value]),E.createElement("input",{ref:e,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:r?n.value:o,onChange:u=>{r||s.setState("search",u.target.value),t?.(u.target.value)}})}),tin=E.forwardRef((n,e)=>{let{children:t,...i}=n,r=E.useRef(null),s=E.useRef(null),o=UO();return E.useEffect(()=>{if(s.current&&r.current){let a=s.current,l=r.current,c,u=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let d=a.offsetHeight;l.style.setProperty("--cmdk-list-height",d.toFixed(1)+"px")})});return u.observe(a),()=>{cancelAnimationFrame(c),u.unobserve(a)}}},[]),E.createElement("div",{ref:jO([r,e]),...i,"cmdk-list":"",role:"listbox","aria-label":"Suggestions",id:o.listId,"aria-labelledby":o.inputId},E.createElement("div",{ref:s,"cmdk-list-sizer":""},t))}),nin=E.forwardRef((n,e)=>{let{open:t,onOpenChange:i,overlayClassName:r,contentClassName:s,container:o,...a}=n;return E.createElement(Unn,{open:t,onOpenChange:i},E.createElement(jnn,{container:o},E.createElement(qnn,{"cmdk-overlay":"",className:r}),E.createElement(Knn,{"aria-label":n.label,"cmdk-dialog":"",className:s},E.createElement(eze,{ref:e,...a}))))}),iin=E.forwardRef((n,e)=>{let t=E.useRef(!0),i=iC(r=>r.filtered.count===0);return E.useEffect(()=>{t.current=!1},[]),t.current||!i?null:E.createElement("div",{ref:e,...n,"cmdk-empty":"",role:"presentation"})}),rin=E.forwardRef((n,e)=>{let{progress:t,children:i,...r}=n;return E.createElement("div",{ref:e,...r,"cmdk-loading":"",role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Loading..."},E.createElement("div",{"aria-hidden":!0},i))}),ZHn=Object.assign(eze,{List:tin,Item:Xnn,Input:ein,Group:Qnn,Separator:Jnn,Dialog:nin,Empty:iin,Loading:rin});function sin(n,e){let t=n.nextElementSibling;for(;t;){if(t.matches(e))return t;t=t.nextElementSibling}}function oin(n,e){let t=n.previousElementSibling;for(;t;){if(t.matches(e))return t;t=t.previousElementSibling}}function tze(n){let e=E.useRef(n);return x2(()=>{e.current=n}),e}var x2=typeof window>"u"?E.useEffect:E.useLayoutEffect;function tS(n){let e=E.useRef();return e.current===void 0&&(e.current=n()),e}function jO(n){return e=>{n.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}function iC(n){let e=Mhe(),t=()=>n(e.snapshot());return E.useSyncExternalStore(e.subscribe,t,t)}function nze(n,e,t){let i=E.useRef(),r=UO();return x2(()=>{var s;let o=(()=>{var a;for(let l of t){if(typeof l=="string")return l.trim().toLowerCase();if(typeof l=="object"&&"current"in l)return l.current?(a=l.current.textContent)==null?void 0:a.trim().toLowerCase():i.current}})();r.value(n,o),(s=e.current)==null||s.setAttribute(Km,o),i.current=o}),i}var ain=()=>{let[n,e]=E.useState(),t=tS(()=>new Map);return x2(()=>{t.current.forEach(i=>i()),t.current=new Map},[n]),(i,r)=>{t.current.set(i,r),e({})}},lin={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},Fhe="Avatar",[cin,XHn]=Ac(Fhe),[uin,ize]=cin(Fhe),rze=E.forwardRef((n,e)=>{const{__scopeAvatar:t,...i}=n,[r,s]=E.useState("idle");return ae.jsx(uin,{scope:t,imageLoadingStatus:r,onImageLoadingStatusChange:s,children:ae.jsx(Pn.span,{...i,ref:e})})});rze.displayName=Fhe;var sze="AvatarImage",oze=E.forwardRef((n,e)=>{const{__scopeAvatar:t,src:i,onLoadingStatusChange:r=()=>{},...s}=n,o=ize(sze,t),a=din(i,s.referrerPolicy),l=Ua(c=>{r(c),o.onImageLoadingStatusChange(c)});return es(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?ae.jsx(Pn.img,{...s,ref:e,src:i}):null});oze.displayName=sze;var aze="AvatarFallback",lze=E.forwardRef((n,e)=>{const{__scopeAvatar:t,delayMs:i,...r}=n,s=ize(aze,t),[o,a]=E.useState(i===void 0);return E.useEffect(()=>{if(i!==void 0){const l=window.setTimeout(()=>a(!0),i);return()=>window.clearTimeout(l)}},[i]),o&&s.imageLoadingStatus!=="loaded"?ae.jsx(Pn.span,{...r,ref:e}):null});lze.displayName=aze;function din(n,e){const[t,i]=E.useState("idle");return es(()=>{if(!n){i("error");return}let r=!0;const s=new window.Image,o=a=>()=>{r&&i(a)};return i("loading"),s.onload=o("loaded"),s.onerror=o("error"),s.src=n,e&&(s.referrerPolicy=e),()=>{r=!1}},[n,e]),t}var QHn=rze,JHn=oze,eVn=lze,hin=Array.isArray,fd=hin,fin=typeof Hh=="object"&&Hh&&Hh.Object===Object&&Hh,cze=fin,gin=cze,pin=typeof self=="object"&&self&&self.Object===Object&&self,min=gin||pin||Function("return this")(),gm=min,_in=gm,vin=_in.Symbol,qO=vin,b2e=qO,uze=Object.prototype,bin=uze.hasOwnProperty,yin=uze.toString,eD=b2e?b2e.toStringTag:void 0;function win(n){var e=bin.call(n,eD),t=n[eD];try{n[eD]=void 0;var i=!0}catch{}var r=yin.call(n);return i&&(e?n[eD]=t:delete n[eD]),r}var Cin=win,xin=Object.prototype,Sin=xin.toString;function kin(n){return Sin.call(n)}var Ein=kin,y2e=qO,Lin=Cin,Tin=Ein,Din="[object Null]",Iin="[object Undefined]",w2e=y2e?y2e.toStringTag:void 0;function Ain(n){return n==null?n===void 0?Iin:Din:w2e&&w2e in Object(n)?Lin(n):Tin(n)}var x0=Ain;function Nin(n){return n!=null&&typeof n=="object"}var S0=Nin,Rin=x0,Pin=S0,Oin="[object Symbol]";function Min(n){return typeof n=="symbol"||Pin(n)&&Rin(n)==Oin}var S2=Min,Fin=fd,Bin=S2,$in=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Win=/^\w*$/;function Hin(n,e){if(Fin(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||Bin(n)?!0:Win.test(n)||!$in.test(n)||e!=null&&n in Object(e)}var Bhe=Hin;function Vin(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var u1=Vin;const k2=cs(u1);var zin=x0,Uin=u1,jin="[object AsyncFunction]",qin="[object Function]",Kin="[object GeneratorFunction]",Gin="[object Proxy]";function Yin(n){if(!Uin(n))return!1;var e=zin(n);return e==qin||e==Kin||e==jin||e==Gin}var $he=Yin;const Ri=cs($he);var Zin=gm,Xin=Zin["__core-js_shared__"],Qin=Xin,FK=Qin,C2e=function(){var n=/[^.]+$/.exec(FK&&FK.keys&&FK.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function Jin(n){return!!C2e&&C2e in n}var ern=Jin,trn=Function.prototype,nrn=trn.toString;function irn(n){if(n!=null){try{return nrn.call(n)}catch{}try{return n+""}catch{}}return""}var dze=irn,rrn=$he,srn=ern,orn=u1,arn=dze,lrn=/[\\^$.*+?()[\]{}|]/g,crn=/^\[object .+?Constructor\]$/,urn=Function.prototype,drn=Object.prototype,hrn=urn.toString,frn=drn.hasOwnProperty,grn=RegExp("^"+hrn.call(frn).replace(lrn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function prn(n){if(!orn(n)||srn(n))return!1;var e=rrn(n)?grn:crn;return e.test(arn(n))}var mrn=prn;function _rn(n,e){return n?.[e]}var vrn=_rn,brn=mrn,yrn=vrn;function wrn(n,e){var t=yrn(n,e);return brn(t)?t:void 0}var BC=wrn,Crn=BC,xrn=Crn(Object,"create"),tV=xrn,x2e=tV;function Srn(){this.__data__=x2e?x2e(null):{},this.size=0}var krn=Srn;function Ern(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var Lrn=Ern,Trn=tV,Drn="__lodash_hash_undefined__",Irn=Object.prototype,Arn=Irn.hasOwnProperty;function Nrn(n){var e=this.__data__;if(Trn){var t=e[n];return t===Drn?void 0:t}return Arn.call(e,n)?e[n]:void 0}var Rrn=Nrn,Prn=tV,Orn=Object.prototype,Mrn=Orn.hasOwnProperty;function Frn(n){var e=this.__data__;return Prn?e[n]!==void 0:Mrn.call(e,n)}var Brn=Frn,$rn=tV,Wrn="__lodash_hash_undefined__";function Hrn(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=$rn&&e===void 0?Wrn:e,this}var Vrn=Hrn,zrn=krn,Urn=Lrn,jrn=Rrn,qrn=Brn,Krn=Vrn;function E2(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1}var usn=csn,dsn=nV;function hsn(n,e){var t=this.__data__,i=dsn(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}var fsn=hsn,gsn=Zrn,psn=rsn,msn=asn,_sn=usn,vsn=fsn;function L2(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e`);var v=f.inactive?c:f.color;return U.createElement("li",tre({className:m,style:d,key:"legend-item-".concat(g)},BR(i.props,f,g)),U.createElement(qie,{width:o,height:o,viewBox:u,style:h},i.renderIcon(f)),U.createElement("span",{className:"recharts-legend-item-text",style:{color:v}},p?p(_,f,g):_))})}},{key:"render",value:function(){var i=this.props,r=i.payload,s=i.layout,o=i.align;if(!r||!r.length)return null;var a={padding:0,margin:0,textAlign:s==="horizontal"?o:"left"};return U.createElement("ul",{className:"recharts-default-legend",style:a},this.renderItems())}}])}(E.PureComponent);WR(Jhe,"displayName","Legend");WR(Jhe,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Qln=iV;function Jln(){this.__data__=new Qln,this.size=0}var ecn=Jln;function tcn(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}var ncn=tcn;function icn(n){return this.__data__.get(n)}var rcn=icn;function scn(n){return this.__data__.has(n)}var ocn=scn,acn=iV,lcn=Hhe,ccn=Vhe,ucn=200;function dcn(n,e){var t=this.__data__;if(t instanceof acn){var i=t.__data__;if(!lcn||i.lengtha))return!1;var c=s.get(n),u=s.get(e);if(c&&u)return c==e&&u==n;var d=-1,h=!0,f=t&Rcn?new Dcn:void 0;for(s.set(n,e),s.set(e,n);++d-1&&n%1==0&&n-1&&n%1==0&&n<=Fun}var ife=Bun,$un=x0,Wun=ife,Hun=S0,Vun="[object Arguments]",zun="[object Array]",Uun="[object Boolean]",jun="[object Date]",qun="[object Error]",Kun="[object Function]",Gun="[object Map]",Yun="[object Number]",Zun="[object Object]",Xun="[object RegExp]",Qun="[object Set]",Jun="[object String]",edn="[object WeakMap]",tdn="[object ArrayBuffer]",ndn="[object DataView]",idn="[object Float32Array]",rdn="[object Float64Array]",sdn="[object Int8Array]",odn="[object Int16Array]",adn="[object Int32Array]",ldn="[object Uint8Array]",cdn="[object Uint8ClampedArray]",udn="[object Uint16Array]",ddn="[object Uint32Array]",eo={};eo[idn]=eo[rdn]=eo[sdn]=eo[odn]=eo[adn]=eo[ldn]=eo[cdn]=eo[udn]=eo[ddn]=!0;eo[Vun]=eo[zun]=eo[tdn]=eo[Uun]=eo[ndn]=eo[jun]=eo[qun]=eo[Kun]=eo[Gun]=eo[Yun]=eo[Zun]=eo[Xun]=eo[Qun]=eo[Jun]=eo[edn]=!1;function hdn(n){return Hun(n)&&Wun(n.length)&&!!eo[$un(n)]}var fdn=hdn;function gdn(n){return function(e){return n(e)}}var nUe=gdn,Z7={exports:{}};Z7.exports;(function(n,e){var t=cze,i=e&&!e.nodeType&&e,r=i&&!0&&n&&!n.nodeType&&n,s=r&&r.exports===i,o=s&&t.process,a=function(){try{var l=r&&r.require&&r.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}}();n.exports=a})(Z7,Z7.exports);var pdn=Z7.exports,mdn=fdn,_dn=nUe,K2e=pdn,G2e=K2e&&K2e.isTypedArray,vdn=G2e?_dn(G2e):mdn,iUe=vdn,bdn=Cun,ydn=tfe,wdn=fd,Cdn=tUe,xdn=nfe,Sdn=iUe,kdn=Object.prototype,Edn=kdn.hasOwnProperty;function Ldn(n,e){var t=wdn(n),i=!t&&ydn(n),r=!t&&!i&&Cdn(n),s=!t&&!i&&!r&&Sdn(n),o=t||i||r||s,a=o?bdn(n.length,String):[],l=a.length;for(var c in n)(e||Edn.call(n,c))&&!(o&&(c=="length"||r&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||xdn(c,l)))&&a.push(c);return a}var Tdn=Ldn,Ddn=Object.prototype;function Idn(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||Ddn;return n===t}var Adn=Idn;function Ndn(n,e){return function(t){return n(e(t))}}var rUe=Ndn,Rdn=rUe,Pdn=Rdn(Object.keys,Object),Odn=Pdn,Mdn=Adn,Fdn=Odn,Bdn=Object.prototype,$dn=Bdn.hasOwnProperty;function Wdn(n){if(!Mdn(n))return Fdn(n);var e=[];for(var t in Object(n))$dn.call(n,t)&&t!="constructor"&&e.push(t);return e}var Hdn=Wdn,Vdn=$he,zdn=ife;function Udn(n){return n!=null&&zdn(n.length)&&!Vdn(n)}var GO=Udn,jdn=Tdn,qdn=Hdn,Kdn=GO;function Gdn(n){return Kdn(n)?jdn(n):qdn(n)}var wV=Gdn,Ydn=uun,Zdn=yun,Xdn=wV;function Qdn(n){return Ydn(n,Xdn,Zdn)}var Jdn=Qdn,Y2e=Jdn,ehn=1,thn=Object.prototype,nhn=thn.hasOwnProperty;function ihn(n,e,t,i,r,s){var o=t&ehn,a=Y2e(n),l=a.length,c=Y2e(e),u=c.length;if(l!=u&&!o)return!1;for(var d=l;d--;){var h=a[d];if(!(o?h in e:nhn.call(e,h)))return!1}var f=s.get(n),g=s.get(e);if(f&&g)return f==e&&g==n;var p=!0;s.set(n,e),s.set(e,n);for(var m=o;++d-1}var tgn=egn;function ngn(n,e,t){for(var i=-1,r=n==null?0:n.length;++i=_gn){var c=e?null:pgn(n);if(c)return mgn(c);o=!1,r=ggn,l=new dgn}else l=e?[]:a;e:for(;++i=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function Rgn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}function Pgn(n){return n.value}function Ogn(n,e){if(U.isValidElement(n))return U.cloneElement(n,e);if(typeof n=="function")return U.createElement(n,e);e.ref;var t=Ngn(e,Sgn);return U.createElement(Jhe,t)}var dTe=1,$k=function(n){function e(){var t;kgn(this,e);for(var i=arguments.length,r=new Array(i),s=0;sdTe||Math.abs(r.height-this.lastBoundingBox.height)>dTe)&&(this.lastBoundingBox.width=r.width,this.lastBoundingBox.height=r.height,i&&i(r)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,i&&i(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Om({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(i){var r=this.props,s=r.layout,o=r.align,a=r.verticalAlign,l=r.margin,c=r.chartWidth,u=r.chartHeight,d,h;if(!i||(i.left===void 0||i.left===null)&&(i.right===void 0||i.right===null))if(o==="center"&&s==="vertical"){var f=this.getBBoxSnapshot();d={left:((c||0)-f.width)/2}}else d=o==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!i||(i.top===void 0||i.top===null)&&(i.bottom===void 0||i.bottom===null))if(a==="middle"){var g=this.getBBoxSnapshot();h={top:((u||0)-g.height)/2}}else h=a==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return Om(Om({},d),h)}},{key:"render",value:function(){var i=this,r=this.props,s=r.content,o=r.width,a=r.height,l=r.wrapperStyle,c=r.payloadUniqBy,u=r.payload,d=Om(Om({position:"absolute",width:o||"auto",height:a||"auto"},this.getDefaultPosition(l)),l);return U.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(f){i.wrapperNode=f}},Ogn(s,Om(Om({},this.props),{},{payload:dUe(u,c,Pgn)})))}}],[{key:"getWithHeight",value:function(i,r){var s=Om(Om({},this.defaultProps),i.props),o=s.layout;return o==="vertical"&&Ut(i.props.height)?{height:i.props.height}:o==="horizontal"?{width:i.props.width||r}:null}}])}(E.PureComponent);CV($k,"displayName","Legend");CV($k,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var hTe=qO,Mgn=tfe,Fgn=fd,fTe=hTe?hTe.isConcatSpreadable:void 0;function Bgn(n){return Fgn(n)||Mgn(n)||!!(fTe&&n&&n[fTe])}var $gn=Bgn,Wgn=Jze,Hgn=$gn;function gUe(n,e,t,i,r){var s=-1,o=n.length;for(t||(t=Hgn),r||(r=[]);++s0&&t(a)?e>1?gUe(a,e-1,t,i,r):Wgn(r,a):i||(r[r.length]=a)}return r}var pUe=gUe;function Vgn(n){return function(e,t,i){for(var r=-1,s=Object(e),o=i(e),a=o.length;a--;){var l=o[n?a:++r];if(t(s[l],l,s)===!1)break}return e}}var zgn=Vgn,Ugn=zgn,jgn=Ugn(),qgn=jgn,Kgn=qgn,Ggn=wV;function Ygn(n,e){return n&&Kgn(n,e,Ggn)}var mUe=Ygn,Zgn=GO;function Xgn(n,e){return function(t,i){if(t==null)return t;if(!Zgn(t))return n(t,i);for(var r=t.length,s=e?r:-1,o=Object(t);(e?s--:++se||s&&o&&l&&!a&&!c||i&&o&&l||!t&&l||!r)return 1;if(!i&&!s&&!c&&n=a)return l;var c=t[i];return l*(c=="desc"?-1:1)}}return n.index-e.index}var dpn=upn,jK=Uhe,hpn=jhe,fpn=d1,gpn=_Ue,ppn=opn,mpn=nUe,_pn=dpn,vpn=N2,bpn=fd;function ypn(n,e,t){e.length?e=jK(e,function(s){return bpn(s)?function(o){return hpn(o,s.length===1?s[0]:s)}:s}):e=[vpn];var i=-1;e=jK(e,mpn(fpn));var r=gpn(n,function(s,o,a){var l=jK(e,function(c){return c(s)});return{criteria:l,index:++i,value:s}});return ppn(r,function(s,o){return _pn(s,o,t)})}var wpn=ypn;function Cpn(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}var xpn=Cpn,Spn=xpn,pTe=Math.max;function kpn(n,e,t){return e=pTe(e===void 0?n.length-1:e,0),function(){for(var i=arguments,r=-1,s=pTe(i.length-e,0),o=Array(s);++r0){if(++e>=Opn)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var $pn=Bpn,Wpn=Ppn,Hpn=$pn,Vpn=Hpn(Wpn),zpn=Vpn,Upn=N2,jpn=Epn,qpn=zpn;function Kpn(n,e){return qpn(jpn(n,e,Upn),n+"")}var Gpn=Kpn,Ypn=Whe,Zpn=GO,Xpn=nfe,Qpn=u1;function Jpn(n,e,t){if(!Qpn(t))return!1;var i=typeof e;return(i=="number"?Zpn(t)&&Xpn(e,t.length):i=="string"&&e in t)?Ypn(t[e],n):!1}var xV=Jpn,emn=pUe,tmn=wpn,nmn=Gpn,_Te=xV,imn=nmn(function(n,e){if(n==null)return[];var t=e.length;return t>1&&_Te(n,e[0],e[1])?e=[]:t>2&&_Te(e[0],e[1],e[2])&&(e=[e[0]]),tmn(n,emn(e,1),[])}),rmn=imn;const ofe=cs(rmn);function HR(n){"@babel/helpers - typeof";return HR=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},HR(n)}function cre(){return cre=Object.assign?Object.assign.bind():function(n){for(var e=1;en.length)&&(e=n.length);for(var t=0,i=new Array(e);t=e.x),"".concat(tD,"-left"),Ut(t)&&e&&Ut(e.x)&&t=e.y),"".concat(tD,"-top"),Ut(i)&&e&&Ut(e.y)&&ip?Math.max(u,l[i]):Math.max(d,l[i])}function bmn(n){var e=n.translateX,t=n.translateY,i=n.useTranslate3d;return{transform:i?"translate3d(".concat(e,"px, ").concat(t,"px, 0)"):"translate(".concat(e,"px, ").concat(t,"px)")}}function ymn(n){var e=n.allowEscapeViewBox,t=n.coordinate,i=n.offsetTopLeft,r=n.position,s=n.reverseDirection,o=n.tooltipBox,a=n.useTranslate3d,l=n.viewBox,c,u,d;return o.height>0&&o.width>0&&t?(u=yTe({allowEscapeViewBox:e,coordinate:t,key:"x",offsetTopLeft:i,position:r,reverseDirection:s,tooltipDimension:o.width,viewBox:l,viewBoxDimension:l.width}),d=yTe({allowEscapeViewBox:e,coordinate:t,key:"y",offsetTopLeft:i,position:r,reverseDirection:s,tooltipDimension:o.height,viewBox:l,viewBoxDimension:l.height}),c=bmn({translateX:u,translateY:d,useTranslate3d:a})):c=_mn,{cssProperties:c,cssClasses:vmn({translateX:u,translateY:d,coordinate:t})}}function lL(n){"@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(n)}function wTe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function CTe(n){for(var e=1;exTe||Math.abs(i.height-this.state.lastBoundingBox.height)>xTe)&&this.setState({lastBoundingBox:{width:i.width,height:i.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var i,r;this.props.active&&this.updateBBox(),this.state.dismissed&&(((i=this.props.coordinate)===null||i===void 0?void 0:i.x)!==this.state.dismissedAtCoordinate.x||((r=this.props.coordinate)===null||r===void 0?void 0:r.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var i=this,r=this.props,s=r.active,o=r.allowEscapeViewBox,a=r.animationDuration,l=r.animationEasing,c=r.children,u=r.coordinate,d=r.hasPayload,h=r.isAnimationActive,f=r.offset,g=r.position,p=r.reverseDirection,m=r.useTranslate3d,_=r.viewBox,v=r.wrapperStyle,y=ymn({allowEscapeViewBox:o,coordinate:u,offsetTopLeft:f,position:g,reverseDirection:p,tooltipBox:this.state.lastBoundingBox,useTranslate3d:m,viewBox:_}),C=y.cssClasses,x=y.cssProperties,k=CTe(CTe({transition:h&&s?"transform ".concat(a,"ms ").concat(l):void 0},x),{},{pointerEvents:"none",visibility:!this.state.dismissed&&s&&d?"visible":"hidden",position:"absolute",top:0,left:0},v);return U.createElement("div",{tabIndex:-1,className:C,style:k,ref:function(D){i.wrapperNode=D}},c)}}])}(E.PureComponent),Imn=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},yg={isSsr:Imn(),get:function(e){return yg[e]},set:function(e,t){if(typeof e=="string")yg[e]=t;else{var i=Object.keys(e);i&&i.length&&i.forEach(function(r){yg[r]=e[r]})}}};function cL(n){"@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(n)}function STe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function kTe(n){for(var e=1;e0;return U.createElement(Dmn,{allowEscapeViewBox:o,animationDuration:a,animationEasing:l,isAnimationActive:h,active:s,coordinate:u,hasPayload:k,offset:f,position:m,reverseDirection:_,useTranslate3d:v,viewBox:y,wrapperStyle:C},Wmn(c,kTe(kTe({},this.props),{},{payload:x})))}}])}(E.PureComponent);afe(Gm,"displayName","Tooltip");afe(Gm,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!yg.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Hmn=gm,Vmn=function(){return Hmn.Date.now()},zmn=Vmn,Umn=/\s/;function jmn(n){for(var e=n.length;e--&&Umn.test(n.charAt(e)););return e}var qmn=jmn,Kmn=qmn,Gmn=/^\s+/;function Ymn(n){return n&&n.slice(0,Kmn(n)+1).replace(Gmn,"")}var Zmn=Ymn,Xmn=Zmn,ETe=u1,Qmn=S2,LTe=NaN,Jmn=/^[-+]0x[0-9a-f]+$/i,e_n=/^0b[01]+$/i,t_n=/^0o[0-7]+$/i,n_n=parseInt;function i_n(n){if(typeof n=="number")return n;if(Qmn(n))return LTe;if(ETe(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=ETe(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Xmn(n);var t=e_n.test(n);return t||t_n.test(n)?n_n(n.slice(2),t?2:8):Jmn.test(n)?LTe:+n}var xUe=i_n,r_n=u1,KK=zmn,TTe=xUe,s_n="Expected a function",o_n=Math.max,a_n=Math.min;function l_n(n,e,t){var i,r,s,o,a,l,c=0,u=!1,d=!1,h=!0;if(typeof n!="function")throw new TypeError(s_n);e=TTe(e)||0,r_n(t)&&(u=!!t.leading,d="maxWait"in t,s=d?o_n(TTe(t.maxWait)||0,e):s,h="trailing"in t?!!t.trailing:h);function f(k){var L=i,D=r;return i=r=void 0,c=k,o=n.apply(D,L),o}function g(k){return c=k,a=setTimeout(_,e),u?f(k):o}function p(k){var L=k-l,D=k-c,I=e-L;return d?a_n(I,s-D):I}function m(k){var L=k-l,D=k-c;return l===void 0||L>=e||L<0||d&&D>=s}function _(){var k=KK();if(m(k))return v(k);a=setTimeout(_,p(k))}function v(k){return a=void 0,h&&i?f(k):(i=r=void 0,o)}function y(){a!==void 0&&clearTimeout(a),c=0,i=l=r=a=void 0}function C(){return a===void 0?o:v(KK())}function x(){var k=KK(),L=m(k);if(i=arguments,r=this,l=k,L){if(a===void 0)return g(l);if(d)return clearTimeout(a),a=setTimeout(_,e),f(l)}return a===void 0&&(a=setTimeout(_,e)),o}return x.cancel=y,x.flush=C,x}var c_n=l_n,u_n=c_n,d_n=u1,h_n="Expected a function";function f_n(n,e,t){var i=!0,r=!0;if(typeof n!="function")throw new TypeError(h_n);return d_n(t)&&(i="leading"in t?!!t.leading:i,r="trailing"in t?!!t.trailing:r),u_n(n,e,{leading:i,maxWait:e,trailing:r})}var g_n=f_n;const SUe=cs(g_n);function zR(n){"@babel/helpers - typeof";return zR=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},zR(n)}function DTe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function G3(n){for(var e=1;en.length)&&(e=n.length);for(var t=0,i=new Array(e);t0&&(G=SUe(G,p,{trailing:!0,leading:!1}));var W=new ResizeObserver(G),z=x.current.getBoundingClientRect(),q=z.width,ee=z.height;return M(q,ee),W.observe(x.current),function(){W.disconnect()}},[M,p]);var B=E.useMemo(function(){var G=I.containerWidth,W=I.containerHeight;if(G<0||W<0)return null;B_(Fy(o)||Fy(l),`The width(%s) and height(%s) are both fixed numbers, +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y_n(n,e){if(n){if(typeof n=="string")return ITe(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ITe(n,e)}}function ITe(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t0&&(G=SUe(G,p,{trailing:!0,leading:!1}));var W=new ResizeObserver(G),z=x.current.getBoundingClientRect(),q=z.width,ee=z.height;return M(q,ee),W.observe(x.current),function(){W.disconnect()}},[M,p]);var B=E.useMemo(function(){var G=I.containerWidth,W=I.containerHeight;if(G<0||W<0)return null;B_(Fy(o)||Fy(l),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,o,l),B_(!t||t>0,"The aspect(%s) must be greater than zero.",t);var z=Fy(o)?G:o,q=Fy(l)?W:l;t&&t>0&&(z?q=z/t:q&&(z=q*t),h&&q>h&&(q=h)),B_(z>0||q>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the @@ -2064,24 +2074,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ryn(n,e){if(n){if(typeof n=="string")return Ire(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ire(n,e)}}function Pyn(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function Oyn(n){if(Array.isArray(n))return Ire(n)}function Ire(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function Fyn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}function VDe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function Ma(n){for(var e=1;e=0?1:-1,y,C;r==="insideStart"?(y=f+v*o,C=p):r==="insideEnd"?(y=g-v*o,C=!p):r==="end"&&(y=g+v*o,C=p),C=_<=0?C:!C;var x=Fl(c,u,m,y),k=Fl(c,u,m,y+(C?1:-1)*359),L="M".concat(x.x,",").concat(x.y,` A`).concat(m,",").concat(m,",0,1,").concat(C?0:1,`, `).concat(k.x,",").concat(k.y),D=Di(e.id)?$C("recharts-radial-line-"):e.id;return U.createElement("text",iP({},i,{dominantBaseline:"central",className:mr("recharts-radial-bar-label",a)}),U.createElement("defs",null,U.createElement("path",{id:D,d:L})),U.createElement("textPath",{xlinkHref:"#".concat(D)},t))},Uyn=function(e){var t=e.viewBox,i=e.offset,r=e.position,s=t,o=s.cx,a=s.cy,l=s.innerRadius,c=s.outerRadius,u=s.startAngle,d=s.endAngle,h=(u+d)/2;if(r==="outside"){var f=Fl(o,a,c+i,h),g=f.x,p=f.y;return{x:g,y:p,textAnchor:g>=o?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:o,y:a,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:o,y:a,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:o,y:a,textAnchor:"middle",verticalAnchor:"end"};var m=(l+c)/2,_=Fl(o,a,m,h),v=_.x,y=_.y;return{x:v,y,textAnchor:"middle",verticalAnchor:"middle"}},jyn=function(e){var t=e.viewBox,i=e.parentViewBox,r=e.offset,s=e.position,o=t,a=o.x,l=o.y,c=o.width,u=o.height,d=u>=0?1:-1,h=d*r,f=d>0?"end":"start",g=d>0?"start":"end",p=c>=0?1:-1,m=p*r,_=p>0?"end":"start",v=p>0?"start":"end";if(s==="top"){var y={x:a+c/2,y:l-d*r,textAnchor:"middle",verticalAnchor:f};return Ma(Ma({},y),i?{height:Math.max(l-i.y,0),width:c}:{})}if(s==="bottom"){var C={x:a+c/2,y:l+u+h,textAnchor:"middle",verticalAnchor:g};return Ma(Ma({},C),i?{height:Math.max(i.y+i.height-(l+u),0),width:c}:{})}if(s==="left"){var x={x:a-m,y:l+u/2,textAnchor:_,verticalAnchor:"middle"};return Ma(Ma({},x),i?{width:Math.max(x.x-i.x,0),height:u}:{})}if(s==="right"){var k={x:a+c+m,y:l+u/2,textAnchor:v,verticalAnchor:"middle"};return Ma(Ma({},k),i?{width:Math.max(i.x+i.width-k.x,0),height:u}:{})}var L=i?{width:c,height:u}:{};return s==="insideLeft"?Ma({x:a+m,y:l+u/2,textAnchor:v,verticalAnchor:"middle"},L):s==="insideRight"?Ma({x:a+c-m,y:l+u/2,textAnchor:_,verticalAnchor:"middle"},L):s==="insideTop"?Ma({x:a+c/2,y:l+h,textAnchor:"middle",verticalAnchor:g},L):s==="insideBottom"?Ma({x:a+c/2,y:l+u-h,textAnchor:"middle",verticalAnchor:f},L):s==="insideTopLeft"?Ma({x:a+m,y:l+h,textAnchor:v,verticalAnchor:g},L):s==="insideTopRight"?Ma({x:a+c-m,y:l+h,textAnchor:_,verticalAnchor:g},L):s==="insideBottomLeft"?Ma({x:a+m,y:l+u-h,textAnchor:v,verticalAnchor:f},L):s==="insideBottomRight"?Ma({x:a+c-m,y:l+u-h,textAnchor:_,verticalAnchor:f},L):k2(s)&&(Ut(s.x)||Fy(s.x))&&(Ut(s.y)||Fy(s.y))?Ma({x:a+rC(s.x,c),y:l+rC(s.y,u),textAnchor:"end",verticalAnchor:"end"},L):Ma({x:a+c/2,y:l+u/2,textAnchor:"middle",verticalAnchor:"middle"},L)},qyn=function(e){return"cx"in e&&Ut(e.cx)};function gc(n){var e=n.offset,t=e===void 0?5:e,i=Myn(n,Iyn),r=Ma({offset:t},i),s=r.viewBox,o=r.position,a=r.value,l=r.children,c=r.content,u=r.className,d=u===void 0?"":u,h=r.textBreakAll;if(!s||Di(a)&&Di(l)&&!E.isValidElement(c)&&!Ri(c))return null;if(E.isValidElement(c))return E.cloneElement(c,r);var f;if(Ri(c)){if(f=E.createElement(c,r),E.isValidElement(f))return f}else f=Hyn(r);var g=qyn(s),p=Ti(r,!0);if(g&&(o==="insideStart"||o==="insideEnd"||o==="end"))return zyn(r,f,p);var m=g?Uyn(r):jyn(r);return U.createElement(tB,iP({className:mr("recharts-label",d)},p,m,{breakAll:h}),f)}gc.displayName="Label";var Aje=function(e){var t=e.cx,i=e.cy,r=e.angle,s=e.startAngle,o=e.endAngle,a=e.r,l=e.radius,c=e.innerRadius,u=e.outerRadius,d=e.x,h=e.y,f=e.top,g=e.left,p=e.width,m=e.height,_=e.clockWise,v=e.labelViewBox;if(v)return v;if(Ut(p)&&Ut(m)){if(Ut(d)&&Ut(h))return{x:d,y:h,width:p,height:m};if(Ut(f)&&Ut(g))return{x:f,y:g,width:p,height:m}}return Ut(d)&&Ut(h)?{x:d,y:h,width:0,height:0}:Ut(t)&&Ut(i)?{cx:t,cy:i,startAngle:s||r||0,endAngle:o||r||0,innerRadius:c||0,outerRadius:u||l||a||0,clockWise:_}:e.viewBox?e.viewBox:{}},Kyn=function(e,t){return e?e===!0?U.createElement(gc,{key:"label-implicit",viewBox:t}):qa(e)?U.createElement(gc,{key:"label-implicit",viewBox:t,value:e}):E.isValidElement(e)?e.type===gc?E.cloneElement(e,{key:"label-implicit",viewBox:t}):U.createElement(gc,{key:"label-implicit",content:e,viewBox:t}):Ri(e)?U.createElement(gc,{key:"label-implicit",content:e,viewBox:t}):k2(e)?U.createElement(gc,iP({viewBox:t},e,{key:"label-implicit"})):null:null},Gyn=function(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&i&&!e.label)return null;var r=e.children,s=Aje(e),o=td(r,gc).map(function(l,c){return E.cloneElement(l,{viewBox:t||s,key:"label-".concat(c)})});if(!i)return o;var a=Kyn(e.label,t||s);return[a].concat(Ayn(o))};gc.parseViewBox=Aje;gc.renderCallByParent=Gyn;function Yyn(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var Zyn=Yyn;const Xyn=cs(Zyn);function rP(n){"@babel/helpers - typeof";return rP=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},rP(n)}var Qyn=["valueAccessor"],Jyn=["data","dataKey","clockWise","id","textBreakAll"];function ewn(n){return rwn(n)||iwn(n)||nwn(n)||twn()}function twn(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nwn(n,e){if(n){if(typeof n=="string")return Are(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Are(n,e)}}function iwn(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function rwn(n){if(Array.isArray(n))return Are(n)}function Are(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function lwn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}var cwn=function(e){return Array.isArray(e.value)?Xyn(e.value):e.value};function zp(n){var e=n.valueAccessor,t=e===void 0?cwn:e,i=jDe(n,Qyn),r=i.data,s=i.dataKey,o=i.clockWise,a=i.id,l=i.textBreakAll,c=jDe(i,Jyn);return!r||!r.length?null:U.createElement(Qr,{className:"recharts-label-list"},r.map(function(u,d){var h=Di(s)?t(u,d):Ka(u&&u.payload,s),f=Di(a)?{}:{id:"".concat(a,"-").concat(d)};return U.createElement(gc,_B({},Ti(u,!0),c,f,{parentViewBox:u.parentViewBox,value:h,textBreakAll:l,viewBox:gc.parseViewBox(Di(o)?u:UDe(UDe({},u),{},{clockWise:o})),key:"label-".concat(d),index:d}))}))}zp.displayName="LabelList";function uwn(n,e){return n?n===!0?U.createElement(zp,{key:"labelList-implicit",data:e}):U.isValidElement(n)||Ri(n)?U.createElement(zp,{key:"labelList-implicit",data:e,content:n}):k2(n)?U.createElement(zp,_B({data:e},n,{key:"labelList-implicit"})):null:null}function dwn(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!n||!n.children&&t&&!n.label)return null;var i=n.children,r=td(i,zp).map(function(o,a){return E.cloneElement(o,{data:e,key:"labelList-".concat(a)})});if(!t)return r;var s=uwn(n.label,e);return[s].concat(ewn(r))}zp.renderCallByParent=dwn;function sP(n){"@babel/helpers - typeof";return sP=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},sP(n)}function Nre(){return Nre=Object.assign?Object.assign.bind():function(n){for(var e=1;en.length)&&(e=n.length);for(var t=0,i=new Array(e);t=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function lwn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}var cwn=function(e){return Array.isArray(e.value)?Xyn(e.value):e.value};function zp(n){var e=n.valueAccessor,t=e===void 0?cwn:e,i=jDe(n,Qyn),r=i.data,s=i.dataKey,o=i.clockWise,a=i.id,l=i.textBreakAll,c=jDe(i,Jyn);return!r||!r.length?null:U.createElement(Qr,{className:"recharts-label-list"},r.map(function(u,d){var h=Di(s)?t(u,d):Ka(u&&u.payload,s),f=Di(a)?{}:{id:"".concat(a,"-").concat(d)};return U.createElement(gc,_B({},Ti(u,!0),c,f,{parentViewBox:u.parentViewBox,value:h,textBreakAll:l,viewBox:gc.parseViewBox(Di(o)?u:UDe(UDe({},u),{},{clockWise:o})),key:"label-".concat(d),index:d}))}))}zp.displayName="LabelList";function uwn(n,e){return n?n===!0?U.createElement(zp,{key:"labelList-implicit",data:e}):U.isValidElement(n)||Ri(n)?U.createElement(zp,{key:"labelList-implicit",data:e,content:n}):k2(n)?U.createElement(zp,_B({data:e},n,{key:"labelList-implicit"})):null:null}function dwn(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!n||!n.children&&t&&!n.label)return null;var i=n.children,r=td(i,zp).map(function(o,a){return E.cloneElement(o,{data:e,key:"labelList-".concat(a)})});if(!t)return r;var s=uwn(n.label,e);return[s].concat(ewn(r))}zp.renderCallByParent=dwn;function sP(n){"@babel/helpers - typeof";return sP=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},sP(n)}function Nre(){return Nre=Object.assign?Object.assign.bind():function(n){for(var e=1;e180),",").concat(+(o>c),`, `).concat(d.x,",").concat(d.y,` `);if(r>0){var f=Fl(t,i,r,o),g=Fl(t,i,r,c);h+="L ".concat(g.x,",").concat(g.y,` A `).concat(r,",").concat(r,`,0, `).concat(+(Math.abs(l)>180),",").concat(+(o<=c),`, - `).concat(f.x,",").concat(f.y," Z")}else h+="L ".concat(t,",").concat(i," Z");return h},mwn=function(e){var t=e.cx,i=e.cy,r=e.innerRadius,s=e.outerRadius,o=e.cornerRadius,a=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,u=e.endAngle,d=ag(u-c),h=eF({cx:t,cy:i,radius:s,angle:c,sign:d,cornerRadius:o,cornerIsExternal:l}),f=h.circleTangency,g=h.lineTangency,p=h.theta,m=eF({cx:t,cy:i,radius:s,angle:u,sign:-d,cornerRadius:o,cornerIsExternal:l}),_=m.circleTangency,v=m.lineTangency,y=m.theta,C=l?Math.abs(c-u):Math.abs(c-u)-p-y;if(C<0)return a?"M ".concat(g.x,",").concat(g.y,` + `).concat(f.x,",").concat(f.y," Z")}else h+="L ".concat(t,",").concat(i," Z");return h},mwn=function(e){var t=e.cx,i=e.cy,r=e.innerRadius,s=e.outerRadius,o=e.cornerRadius,a=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,u=e.endAngle,d=ag(u-c),h=e5({cx:t,cy:i,radius:s,angle:c,sign:d,cornerRadius:o,cornerIsExternal:l}),f=h.circleTangency,g=h.lineTangency,p=h.theta,m=e5({cx:t,cy:i,radius:s,angle:u,sign:-d,cornerRadius:o,cornerIsExternal:l}),_=m.circleTangency,v=m.lineTangency,y=m.theta,C=l?Math.abs(c-u):Math.abs(c-u)-p-y;if(C<0)return a?"M ".concat(g.x,",").concat(g.y,` a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 `):Nje({cx:t,cy:i,innerRadius:r,outerRadius:s,startAngle:c,endAngle:u});var x="M ".concat(g.x,",").concat(g.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(f.x,",").concat(f.y,` A`).concat(s,",").concat(s,",0,").concat(+(C>180),",").concat(+(d<0),",").concat(_.x,",").concat(_.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(v.x,",").concat(v.y,` - `);if(r>0){var k=eF({cx:t,cy:i,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),L=k.circleTangency,D=k.lineTangency,I=k.theta,O=eF({cx:t,cy:i,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),M=O.circleTangency,B=O.lineTangency,G=O.theta,W=l?Math.abs(c-u):Math.abs(c-u)-I-G;if(W<0&&o===0)return"".concat(x,"L").concat(t,",").concat(i,"Z");x+="L".concat(B.x,",").concat(B.y,` + `);if(r>0){var k=e5({cx:t,cy:i,radius:r,angle:c,sign:d,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),L=k.circleTangency,D=k.lineTangency,I=k.theta,O=e5({cx:t,cy:i,radius:r,angle:u,sign:-d,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),M=O.circleTangency,B=O.lineTangency,G=O.theta,W=l?Math.abs(c-u):Math.abs(c-u)-I-G;if(W<0&&o===0)return"".concat(x,"L").concat(t,",").concat(i,"Z");x+="L".concat(B.x,",").concat(B.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(M.x,",").concat(M.y,` A`).concat(r,",").concat(r,",0,").concat(+(W>180),",").concat(+(d>0),",").concat(L.x,",").concat(L.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(D.x,",").concat(D.y,"Z")}else x+="L".concat(t,",").concat(i,"Z");return x},_wn={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Rje=function(e){var t=KDe(KDe({},_wn),e),i=t.cx,r=t.cy,s=t.innerRadius,o=t.outerRadius,a=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,h=t.className;if(o0&&Math.abs(u-d)<360?m=mwn({cx:i,cy:r,innerRadius:s,outerRadius:o,cornerRadius:Math.min(p,g/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):m=Nje({cx:i,cy:r,innerRadius:s,outerRadius:o,startAngle:u,endAngle:d}),U.createElement("path",Nre({},Ti(t,!0),{className:f,d:m,role:"img"}))};function oP(n){"@babel/helpers - typeof";return oP=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},oP(n)}function Rre(){return Rre=Object.assign?Object.assign.bind():function(n){for(var e=1;e0;)if(!t.equals(n[i],e[i],i,i,n,e,t))return!1;return!0}function Lwn(n,e){return F2(n.getTime(),e.getTime())}function tIe(n,e,t){if(n.size!==e.size)return!1;for(var i={},r=n.entries(),s=0,o,a;(o=r.next())&&!o.done;){for(var l=e.entries(),c=!1,u=0;(a=l.next())&&!a.done;){var d=o.value,h=d[0],f=d[1],g=a.value,p=g[0],m=g[1];!c&&!i[u]&&(c=t.equals(h,p,s,u,n,e,t)&&t.equals(f,m,h,p,n,e,t))&&(i[u]=!0),u++}if(!c)return!1;s++}return!0}function Twn(n,e,t){var i=eIe(n),r=i.length;if(eIe(e).length!==r)return!1;for(var s;r-- >0;)if(s=i[r],s===Oje&&(n.$$typeof||e.$$typeof)&&n.$$typeof!==e.$$typeof||!Pje(e,s)||!t.equals(n[s],e[s],s,s,n,e,t))return!1;return!0}function lD(n,e,t){var i=QDe(n),r=i.length;if(QDe(e).length!==r)return!1;for(var s,o,a;r-- >0;)if(s=i[r],s===Oje&&(n.$$typeof||e.$$typeof)&&n.$$typeof!==e.$$typeof||!Pje(e,s)||!t.equals(n[s],e[s],s,s,n,e,t)||(o=JDe(n,s),a=JDe(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function Dwn(n,e){return F2(n.valueOf(),e.valueOf())}function Iwn(n,e){return n.source===e.source&&n.flags===e.flags}function nIe(n,e,t){if(n.size!==e.size)return!1;for(var i={},r=n.values(),s,o;(s=r.next())&&!s.done;){for(var a=e.values(),l=!1,c=0;(o=a.next())&&!o.done;)!l&&!i[c]&&(l=t.equals(s.value,o.value,s.value,o.value,n,e,t))&&(i[c]=!0),c++;if(!l)return!1}return!0}function Awn(n,e){var t=n.length;if(e.length!==t)return!1;for(;t-- >0;)if(n[t]!==e[t])return!1;return!0}var Nwn="[object Arguments]",Rwn="[object Boolean]",Pwn="[object Date]",Own="[object Map]",Mwn="[object Number]",Fwn="[object Object]",Bwn="[object RegExp]",$wn="[object Set]",Wwn="[object String]",Hwn=Array.isArray,iIe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,rIe=Object.assign,Vwn=Object.prototype.toString.call.bind(Object.prototype.toString);function zwn(n){var e=n.areArraysEqual,t=n.areDatesEqual,i=n.areMapsEqual,r=n.areObjectsEqual,s=n.arePrimitiveWrappersEqual,o=n.areRegExpsEqual,a=n.areSetsEqual,l=n.areTypedArraysEqual;return function(u,d,h){if(u===d)return!0;if(u==null||d==null||typeof u!="object"||typeof d!="object")return u!==u&&d!==d;var f=u.constructor;if(f!==d.constructor)return!1;if(f===Object)return r(u,d,h);if(Hwn(u))return e(u,d,h);if(iIe!=null&&iIe(u))return l(u,d,h);if(f===Date)return t(u,d,h);if(f===RegExp)return o(u,d,h);if(f===Map)return i(u,d,h);if(f===Set)return a(u,d,h);var g=Vwn(u);return g===Pwn?t(u,d,h):g===Bwn?o(u,d,h):g===Own?i(u,d,h):g===$wn?a(u,d,h):g===Fwn?typeof u.then!="function"&&typeof d.then!="function"&&r(u,d,h):g===Nwn?r(u,d,h):g===Rwn||g===Mwn||g===Wwn?s(u,d,h):!1}}function Uwn(n){var e=n.circular,t=n.createCustomConfig,i=n.strict,r={areArraysEqual:i?lD:Ewn,areDatesEqual:Lwn,areMapsEqual:i?XDe(tIe,lD):tIe,areObjectsEqual:i?lD:Twn,arePrimitiveWrappersEqual:Dwn,areRegExpsEqual:Iwn,areSetsEqual:i?XDe(nIe,lD):nIe,areTypedArraysEqual:i?lD:Awn};if(t&&(r=rIe({},r,t(r))),e){var s=nF(r.areArraysEqual),o=nF(r.areMapsEqual),a=nF(r.areObjectsEqual),l=nF(r.areSetsEqual);r=rIe({},r,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:l})}return r}function jwn(n){return function(e,t,i,r,s,o,a){return n(e,t,a)}}function qwn(n){var e=n.circular,t=n.comparator,i=n.createState,r=n.equals,s=n.strict;if(i)return function(l,c){var u=i(),d=u.cache,h=d===void 0?e?new WeakMap:void 0:d,f=u.meta;return t(l,c,{cache:h,equals:r,meta:f,strict:s})};if(e)return function(l,c){return t(l,c,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};var o={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,c){return t(l,c,o)}}var Kwn=g1();g1({strict:!0});g1({circular:!0});g1({circular:!0,strict:!0});g1({createInternalComparator:function(){return F2}});g1({strict:!0,createInternalComparator:function(){return F2}});g1({circular:!0,createInternalComparator:function(){return F2}});g1({circular:!0,createInternalComparator:function(){return F2},strict:!0});function g1(n){n===void 0&&(n={});var e=n.circular,t=e===void 0?!1:e,i=n.createInternalComparator,r=n.createState,s=n.strict,o=s===void 0?!1:s,a=Uwn(n),l=zwn(a),c=i?i(l):jwn(l);return qwn({circular:t,comparator:l,createState:r,equals:c,strict:o})}function Gwn(n){typeof requestAnimationFrame<"u"&&requestAnimationFrame(n)}function sIe(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=-1,i=function r(s){t<0&&(t=s),s-t>e?(n(s),t=-1):Gwn(r)};requestAnimationFrame(i)}function Pre(n){"@babel/helpers - typeof";return Pre=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},Pre(n)}function Ywn(n){return Jwn(n)||Qwn(n)||Xwn(n)||Zwn()}function Zwn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. + A`).concat(o,",").concat(o,",0,0,").concat(+(d<0),",").concat(D.x,",").concat(D.y,"Z")}else x+="L".concat(t,",").concat(i,"Z");return x},_wn={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Rje=function(e){var t=KDe(KDe({},_wn),e),i=t.cx,r=t.cy,s=t.innerRadius,o=t.outerRadius,a=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,h=t.className;if(o0&&Math.abs(u-d)<360?m=mwn({cx:i,cy:r,innerRadius:s,outerRadius:o,cornerRadius:Math.min(p,g/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):m=Nje({cx:i,cy:r,innerRadius:s,outerRadius:o,startAngle:u,endAngle:d}),U.createElement("path",Nre({},Ti(t,!0),{className:f,d:m,role:"img"}))};function oP(n){"@babel/helpers - typeof";return oP=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},oP(n)}function Rre(){return Rre=Object.assign?Object.assign.bind():function(n){for(var e=1;e0;)if(!t.equals(n[i],e[i],i,i,n,e,t))return!1;return!0}function Lwn(n,e){return F2(n.getTime(),e.getTime())}function tIe(n,e,t){if(n.size!==e.size)return!1;for(var i={},r=n.entries(),s=0,o,a;(o=r.next())&&!o.done;){for(var l=e.entries(),c=!1,u=0;(a=l.next())&&!a.done;){var d=o.value,h=d[0],f=d[1],g=a.value,p=g[0],m=g[1];!c&&!i[u]&&(c=t.equals(h,p,s,u,n,e,t)&&t.equals(f,m,h,p,n,e,t))&&(i[u]=!0),u++}if(!c)return!1;s++}return!0}function Twn(n,e,t){var i=eIe(n),r=i.length;if(eIe(e).length!==r)return!1;for(var s;r-- >0;)if(s=i[r],s===Oje&&(n.$$typeof||e.$$typeof)&&n.$$typeof!==e.$$typeof||!Pje(e,s)||!t.equals(n[s],e[s],s,s,n,e,t))return!1;return!0}function lD(n,e,t){var i=QDe(n),r=i.length;if(QDe(e).length!==r)return!1;for(var s,o,a;r-- >0;)if(s=i[r],s===Oje&&(n.$$typeof||e.$$typeof)&&n.$$typeof!==e.$$typeof||!Pje(e,s)||!t.equals(n[s],e[s],s,s,n,e,t)||(o=JDe(n,s),a=JDe(e,s),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function Dwn(n,e){return F2(n.valueOf(),e.valueOf())}function Iwn(n,e){return n.source===e.source&&n.flags===e.flags}function nIe(n,e,t){if(n.size!==e.size)return!1;for(var i={},r=n.values(),s,o;(s=r.next())&&!s.done;){for(var a=e.values(),l=!1,c=0;(o=a.next())&&!o.done;)!l&&!i[c]&&(l=t.equals(s.value,o.value,s.value,o.value,n,e,t))&&(i[c]=!0),c++;if(!l)return!1}return!0}function Awn(n,e){var t=n.length;if(e.length!==t)return!1;for(;t-- >0;)if(n[t]!==e[t])return!1;return!0}var Nwn="[object Arguments]",Rwn="[object Boolean]",Pwn="[object Date]",Own="[object Map]",Mwn="[object Number]",Fwn="[object Object]",Bwn="[object RegExp]",$wn="[object Set]",Wwn="[object String]",Hwn=Array.isArray,iIe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,rIe=Object.assign,Vwn=Object.prototype.toString.call.bind(Object.prototype.toString);function zwn(n){var e=n.areArraysEqual,t=n.areDatesEqual,i=n.areMapsEqual,r=n.areObjectsEqual,s=n.arePrimitiveWrappersEqual,o=n.areRegExpsEqual,a=n.areSetsEqual,l=n.areTypedArraysEqual;return function(u,d,h){if(u===d)return!0;if(u==null||d==null||typeof u!="object"||typeof d!="object")return u!==u&&d!==d;var f=u.constructor;if(f!==d.constructor)return!1;if(f===Object)return r(u,d,h);if(Hwn(u))return e(u,d,h);if(iIe!=null&&iIe(u))return l(u,d,h);if(f===Date)return t(u,d,h);if(f===RegExp)return o(u,d,h);if(f===Map)return i(u,d,h);if(f===Set)return a(u,d,h);var g=Vwn(u);return g===Pwn?t(u,d,h):g===Bwn?o(u,d,h):g===Own?i(u,d,h):g===$wn?a(u,d,h):g===Fwn?typeof u.then!="function"&&typeof d.then!="function"&&r(u,d,h):g===Nwn?r(u,d,h):g===Rwn||g===Mwn||g===Wwn?s(u,d,h):!1}}function Uwn(n){var e=n.circular,t=n.createCustomConfig,i=n.strict,r={areArraysEqual:i?lD:Ewn,areDatesEqual:Lwn,areMapsEqual:i?XDe(tIe,lD):tIe,areObjectsEqual:i?lD:Twn,arePrimitiveWrappersEqual:Dwn,areRegExpsEqual:Iwn,areSetsEqual:i?XDe(nIe,lD):nIe,areTypedArraysEqual:i?lD:Awn};if(t&&(r=rIe({},r,t(r))),e){var s=n5(r.areArraysEqual),o=n5(r.areMapsEqual),a=n5(r.areObjectsEqual),l=n5(r.areSetsEqual);r=rIe({},r,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:l})}return r}function jwn(n){return function(e,t,i,r,s,o,a){return n(e,t,a)}}function qwn(n){var e=n.circular,t=n.comparator,i=n.createState,r=n.equals,s=n.strict;if(i)return function(l,c){var u=i(),d=u.cache,h=d===void 0?e?new WeakMap:void 0:d,f=u.meta;return t(l,c,{cache:h,equals:r,meta:f,strict:s})};if(e)return function(l,c){return t(l,c,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};var o={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,c){return t(l,c,o)}}var Kwn=g1();g1({strict:!0});g1({circular:!0});g1({circular:!0,strict:!0});g1({createInternalComparator:function(){return F2}});g1({strict:!0,createInternalComparator:function(){return F2}});g1({circular:!0,createInternalComparator:function(){return F2}});g1({circular:!0,createInternalComparator:function(){return F2},strict:!0});function g1(n){n===void 0&&(n={});var e=n.circular,t=e===void 0?!1:e,i=n.createInternalComparator,r=n.createState,s=n.strict,o=s===void 0?!1:s,a=Uwn(n),l=zwn(a),c=i?i(l):jwn(l);return qwn({circular:t,comparator:l,createState:r,equals:c,strict:o})}function Gwn(n){typeof requestAnimationFrame<"u"&&requestAnimationFrame(n)}function sIe(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=-1,i=function r(s){t<0&&(t=s),s-t>e?(n(s),t=-1):Gwn(r)};requestAnimationFrame(i)}function Pre(n){"@babel/helpers - typeof";return Pre=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},Pre(n)}function Ywn(n){return Jwn(n)||Qwn(n)||Xwn(n)||Zwn()}function Zwn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xwn(n,e){if(n){if(typeof n=="string")return oIe(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return oIe(n,e)}}function oIe(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);tn.length)&&(e=n.length);for(var t=0,i=new Array(e);t1?1:_<0?0:_},p=function(_){for(var v=_>1?1:_,y=v,C=0;C<8;++C){var x=d(y)-v,k=f(y);if(Math.abs(x-v)0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,i=t===void 0?100:t,r=e.damping,s=r===void 0?8:r,o=e.dt,a=o===void 0?17:o,l=function(u,d,h){var f=-(u-d)*i,g=h*s,p=h+(f-g)*a/1e3,m=h*a/1e3+u;return Math.abs(m-d)n.length)&&(e=n.length);for(var t=0,i=new Array(e);t0,from:{upperWidth:0,lowerWidth:0,height:h,x:l,y:c},to:{upperWidth:u,lowerWidth:d,height:h,x:l,y:c},duration:p,animationEasing:g,isActive:_},function(y){var C=y.upperWidth,x=y.lowerWidth,k=y.height,L=y.x,D=y.y;return U.createElement(Ng,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:m,duration:p,easing:g},U.createElement("path",CB({},Ti(t,!0),{className:v,d:xIe(L,D,C,x,k),ref:i})))}):U.createElement("g",null,U.createElement("path",CB({},Ti(t,!0),{className:v,d:xIe(l,c,u,d,h)})))},Fxn=["option","shapeType","propTransformer","activeClassName","isActive"];function hP(n){"@babel/helpers - typeof";return hP=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},hP(n)}function Bxn(n,e){if(n==null)return{};var t=$xn(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function $xn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}function SIe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function xB(n){for(var e=1;e0&&i.handleDrag(r.changedTouches[0])}),Cd(i,"handleDragEnd",function(){i.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var r=i.props,s=r.endIndex,o=r.onDragEnd,a=r.startIndex;o?.({endIndex:s,startIndex:a})}),i.detachDragEndListener()}),Cd(i,"handleLeaveWrapper",function(){(i.state.isTravellerMoving||i.state.isSlideMoving)&&(i.leaveTimer=window.setTimeout(i.handleDragEnd,i.props.leaveTimeOut))}),Cd(i,"handleEnterSlideOrTraveller",function(){i.setState({isTextActive:!0})}),Cd(i,"handleLeaveSlideOrTraveller",function(){i.setState({isTextActive:!1})}),Cd(i,"handleSlideDragStart",function(r){var s=AIe(r)?r.changedTouches[0]:r;i.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:s.pageX}),i.attachDragEndListener()}),i.travellerDragStartHandlers={startX:i.handleTravellerDragStart.bind(i,"startX"),endX:i.handleTravellerDragStart.bind(i,"endX")},i.state={},i}return CSn(e,n),vSn(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(i){var r=i.startX,s=i.endX,o=this.state.scaleValues,a=this.props,l=a.gap,c=a.data,u=c.length-1,d=Math.min(r,s),h=Math.max(r,s),f=e.getIndexInRange(o,d),g=e.getIndexInRange(o,h);return{startIndex:f-f%l,endIndex:g===u?u:g-g%l}}},{key:"getTextOfTick",value:function(i){var r=this.props,s=r.data,o=r.tickFormatter,a=r.dataKey,l=Ka(s[i],a,i);return Ri(o)?o(l,i):l}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(i){var r=this.state,s=r.slideMoveStartX,o=r.startX,a=r.endX,l=this.props,c=l.x,u=l.width,d=l.travellerWidth,h=l.startIndex,f=l.endIndex,g=l.onChange,p=i.pageX-s;p>0?p=Math.min(p,c+u-d-a,c+u-d-o):p<0&&(p=Math.max(p,c-o,c-a));var m=this.getIndex({startX:o+p,endX:a+p});(m.startIndex!==h||m.endIndex!==f)&&g&&g(m),this.setState({startX:o+p,endX:a+p,slideMoveStartX:i.pageX})}},{key:"handleTravellerDragStart",value:function(i,r){var s=AIe(r)?r.changedTouches[0]:r;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:i,brushMoveStartX:s.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(i){var r=this.state,s=r.brushMoveStartX,o=r.movingTravellerId,a=r.endX,l=r.startX,c=this.state[o],u=this.props,d=u.x,h=u.width,f=u.travellerWidth,g=u.onChange,p=u.gap,m=u.data,_={startX:this.state.startX,endX:this.state.endX},v=i.pageX-s;v>0?v=Math.min(v,d+h-f-c):v<0&&(v=Math.max(v,d-c)),_[o]=c+v;var y=this.getIndex(_),C=y.startIndex,x=y.endIndex,k=function(){var D=m.length-1;return o==="startX"&&(a>l?C%p===0:x%p===0)||al?x%p===0:C%p===0)||a>l&&x===D};this.setState(Cd(Cd({},o,c+v),"brushMoveStartX",i.pageX),function(){g&&k()&&g(y)})}},{key:"handleTravellerMoveKeyboard",value:function(i,r){var s=this,o=this.state,a=o.scaleValues,l=o.startX,c=o.endX,u=this.state[r],d=a.indexOf(u);if(d!==-1){var h=d+i;if(!(h===-1||h>=a.length)){var f=a[h];r==="startX"&&f>=c||r==="endX"&&f<=l||this.setState(Cd({},r,f),function(){s.props.onChange(s.getIndex({startX:s.state.startX,endX:s.state.endX}))})}}}},{key:"renderBackground",value:function(){var i=this.props,r=i.x,s=i.y,o=i.width,a=i.height,l=i.fill,c=i.stroke;return U.createElement("rect",{stroke:c,fill:l,x:r,y:s,width:o,height:a})}},{key:"renderPanorama",value:function(){var i=this.props,r=i.x,s=i.y,o=i.width,a=i.height,l=i.data,c=i.children,u=i.padding,d=E.Children.only(c);return d?U.cloneElement(d,{x:r,y:s,width:o,height:a,margin:u,compact:!0,data:l}):null}},{key:"renderTravellerLayer",value:function(i,r){var s,o,a=this,l=this.props,c=l.y,u=l.travellerWidth,d=l.height,h=l.traveller,f=l.ariaLabel,g=l.data,p=l.startIndex,m=l.endIndex,_=Math.max(i,this.props.x),v=oG(oG({},Ti(this.props,!1)),{},{x:_,y:c,width:u,height:d}),y=f||"Min value: ".concat((s=g[p])===null||s===void 0?void 0:s.name,", Max value: ").concat((o=g[m])===null||o===void 0?void 0:o.name);return U.createElement(Qr,{tabIndex:0,role:"slider","aria-label":y,"aria-valuenow":i,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[r],onTouchStart:this.travellerDragStartHandlers[r],onKeyDown:function(x){["ArrowLeft","ArrowRight"].includes(x.key)&&(x.preventDefault(),x.stopPropagation(),a.handleTravellerMoveKeyboard(x.key==="ArrowRight"?1:-1,r))},onFocus:function(){a.setState({isTravellerFocused:!0})},onBlur:function(){a.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(h,v))}},{key:"renderSlide",value:function(i,r){var s=this.props,o=s.y,a=s.height,l=s.stroke,c=s.travellerWidth,u=Math.min(i,r)+c,d=Math.max(Math.abs(r-i)-c,0);return U.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:l,fillOpacity:.2,x:u,y:o,width:d,height:a})}},{key:"renderText",value:function(){var i=this.props,r=i.startIndex,s=i.endIndex,o=i.y,a=i.height,l=i.travellerWidth,c=i.stroke,u=this.state,d=u.startX,h=u.endX,f=5,g={pointerEvents:"none",fill:c};return U.createElement(Qr,{className:"recharts-brush-texts"},U.createElement(tB,kB({textAnchor:"end",verticalAnchor:"middle",x:Math.min(d,h)-f,y:o+a/2},g),this.getTextOfTick(r)),U.createElement(tB,kB({textAnchor:"start",verticalAnchor:"middle",x:Math.max(d,h)+l+f,y:o+a/2},g),this.getTextOfTick(s)))}},{key:"render",value:function(){var i=this.props,r=i.data,s=i.className,o=i.children,a=i.x,l=i.y,c=i.width,u=i.height,d=i.alwaysShowText,h=this.state,f=h.startX,g=h.endX,p=h.isTextActive,m=h.isSlideMoving,_=h.isTravellerMoving,v=h.isTravellerFocused;if(!r||!r.length||!Ut(a)||!Ut(l)||!Ut(c)||!Ut(u)||c<=0||u<=0)return null;var y=mr("recharts-brush",s),C=U.Children.count(o)===1,x=mSn("userSelect","none");return U.createElement(Qr,{className:y,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:x},this.renderBackground(),C&&this.renderPanorama(),this.renderSlide(f,g),this.renderTravellerLayer(f,"startX"),this.renderTravellerLayer(g,"endX"),(p||m||_||v||d)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(i){var r=i.x,s=i.y,o=i.width,a=i.height,l=i.stroke,c=Math.floor(s+a/2)-1;return U.createElement(U.Fragment,null,U.createElement("rect",{x:r,y:s,width:o,height:a,fill:l,stroke:"none"}),U.createElement("line",{x1:r+1,y1:c,x2:r+o-1,y2:c,fill:"none",stroke:"#fff"}),U.createElement("line",{x1:r+1,y1:c+2,x2:r+o-1,y2:c+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(i,r){var s;return U.isValidElement(i)?s=U.cloneElement(i,r):Ri(i)?s=i(r):s=e.renderDefaultTraveller(r),s}},{key:"getDerivedStateFromProps",value:function(i,r){var s=i.data,o=i.width,a=i.x,l=i.travellerWidth,c=i.updateId,u=i.startIndex,d=i.endIndex;if(s!==r.prevData||c!==r.prevUpdateId)return oG({prevData:s,prevTravellerWidth:l,prevUpdateId:c,prevX:a,prevWidth:o},s&&s.length?SSn({data:s,width:o,x:a,travellerWidth:l,startIndex:u,endIndex:d}):{scale:null,scaleValues:null});if(r.scale&&(o!==r.prevWidth||a!==r.prevX||l!==r.prevTravellerWidth)){r.scale.range([a,a+o-l]);var h=r.scale.domain().map(function(f){return r.scale(f)});return{prevData:s,prevTravellerWidth:l,prevUpdateId:c,prevX:a,prevWidth:o,startX:r.scale(i.startIndex),endX:r.scale(i.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(i,r){for(var s=i.length,o=0,a=s-1;a-o>1;){var l=Math.floor((o+a)/2);i[l]>r?a=l:o=l}return r>=i[a]?a:o}}])}(E.PureComponent);Cd(_L,"displayName","Brush");Cd(_L,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var kSn=sfe;function ESn(n,e){var t;return kSn(n,function(i,r,s){return t=e(i,r,s),!t}),!!t}var LSn=ESn,TSn=Zze,DSn=d1,ISn=LSn,ASn=fd,NSn=xV;function RSn(n,e,t){var i=ASn(n)?TSn:ISn;return t&&NSn(n,e,t)&&(e=void 0),i(n,DSn(e))}var PSn=RSn;const OSn=cs(PSn);var Up=function(e,t){var i=e.alwaysShow,r=e.ifOverflow;return i&&(r="extendDomain"),r===t},NIe=vUe;function MSn(n,e,t){e=="__proto__"&&NIe?NIe(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}var FSn=MSn,BSn=FSn,$Sn=mUe,WSn=d1;function HSn(n,e){var t={};return e=WSn(e),$Sn(n,function(i,r,s){BSn(t,r,e(i,r,s))}),t}var VSn=HSn;const zSn=cs(VSn);function USn(n,e){for(var t=-1,i=n==null?0:n.length;++t=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function akn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}function lkn(n,e){var t=n.x,i=n.y,r=okn(n,nkn),s="".concat(t),o=parseInt(s,10),a="".concat(i),l=parseInt(a,10),c="".concat(e.height||r.height),u=parseInt(c,10),d="".concat(e.width||r.width),h=parseInt(d,10);return cD(cD(cD(cD(cD({},e),r),o?{x:o}:{}),l?{y:l}:{}),{},{height:u,width:h,name:e.name,radius:e.radius})}function PIe(n){return U.createElement(jre,Kre({shapeType:"rectangle",propTransformer:lkn,activeClassName:"recharts-active-bar"},n))}var ckn=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(i,r){if(typeof e=="number")return e;var s=typeof i=="number";return s?e(i,r):(s||aC(),t)}},ukn=["value","background"],Gje;function vL(n){"@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(n)}function dkn(n,e){if(n==null)return{};var t=hkn(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function hkn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}function LB(){return LB=Object.assign?Object.assign.bind():function(n){for(var e=1;e0&&Math.abs(z)0&&Math.abs(W)0&&(G=Math.min((we||0)-(W[xe-1]||0),G))}),Number.isFinite(G)){var z=G/B,q=p.layout==="vertical"?i.height:i.width;if(p.padding==="gap"&&(L=z*q/2),p.padding==="no-gap"){var ee=rC(e.barCategoryGap,z*q),Z=z*q/2;L=Z-ee-(Z-ee)/q*ee}}}r==="xAxis"?D=[i.left+(y.left||0)+(L||0),i.left+i.width-(y.right||0)-(L||0)]:r==="yAxis"?D=l==="horizontal"?[i.top+i.height-(y.bottom||0),i.top+(y.top||0)]:[i.top+(y.top||0)+(L||0),i.top+i.height-(y.bottom||0)-(L||0)]:D=p.range,x&&(D=[D[1],D[0]]);var j=cyn(p,s,h),te=j.scale,le=j.realScaleType;te.domain(_).range(D),uyn(te);var ue=vyn(te,qf(qf({},p),{},{realScaleType:le}));r==="xAxis"?(M=m==="top"&&!C||m==="bottom"&&C,I=i.left,O=d[k]-M*p.height):r==="yAxis"&&(M=m==="left"&&!C||m==="right"&&C,I=d[k]-M*p.width,O=i.top);var de=qf(qf(qf({},p),ue),{},{realScaleType:le,x:I,y:O,scale:te,width:r==="xAxis"?i.width:p.width,height:r==="yAxis"?i.height:p.height});return de.bandSize=pB(de,ue),!p.hide&&r==="xAxis"?d[k]+=(M?-1:1)*de.height:p.hide||(d[k]+=(M?-1:1)*de.width),qf(qf({},f),{},MV({},g,de))},{})},Qje=function(e,t){var i=e.x,r=e.y,s=t.x,o=t.y;return{x:Math.min(i,s),y:Math.min(r,o),width:Math.abs(s-i),height:Math.abs(o-r)}},Skn=function(e){var t=e.x1,i=e.y1,r=e.x2,s=e.y2;return Qje({x:t,y:i},{x:r,y:s})},Jje=function(){function n(e){ykn(this,n),this.scale=e}return wkn(n,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=i.bandAware,s=i.position;if(t!==void 0){if(s)switch(s){case"start":return this.scale(t);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o}case"end":{var a=this.bandwidth?this.bandwidth():0;return this.scale(t)+a}default:return this.scale(t)}if(r){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+l}return this.scale(t)}}},{key:"isInRange",value:function(t){var i=this.range(),r=i[0],s=i[i.length-1];return r<=s?t>=r&&t<=s:t>=s&&t<=r}}],[{key:"create",value:function(t){return new n(t)}}])}();MV(Jje,"EPS",1e-4);var Ofe=function(e){var t=Object.keys(e).reduce(function(i,r){return qf(qf({},i),{},MV({},r,Jje.create(e[r])))},{});return qf(qf({},t),{},{apply:function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=s.bandAware,a=s.position;return zSn(r,function(l,c){return t[c].apply(l,{bandAware:o,position:a})})},isInRange:function(r){return Kje(r,function(s,o){return t[o].isInRange(s)})}})};function kkn(n){return(n%180+180)%180}var Ekn=function(e){var t=e.width,i=e.height,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=kkn(r),o=s*Math.PI/180,a=Math.atan(i/t),l=o>a&&o-1?r[s?e[o]:o]:void 0}}var Akn=Ikn,Nkn=zje;function Rkn(n){var e=Nkn(n),t=e%1;return e===e?t?e-t:e:0}var Pkn=Rkn,Okn=uUe,Mkn=d1,Fkn=Pkn,Bkn=Math.max;function $kn(n,e,t){var i=n==null?0:n.length;if(!i)return-1;var r=t==null?0:Fkn(t);return r<0&&(r=Bkn(i+r,0)),Okn(n,Mkn(e),r)}var Wkn=$kn,Hkn=Akn,Vkn=Wkn,zkn=Hkn(Vkn),Ukn=zkn;const jkn=cs(Ukn);var qkn=Gsn(function(n){return{x:n.left,y:n.top,width:n.width,height:n.height}},function(n){return["l",n.left,"t",n.top,"w",n.width,"h",n.height].join("")}),Mfe=E.createContext(void 0),Ffe=E.createContext(void 0),eqe=E.createContext(void 0),tqe=E.createContext({}),nqe=E.createContext(void 0),iqe=E.createContext(0),rqe=E.createContext(0),$Ie=function(e){var t=e.state,i=t.xAxisMap,r=t.yAxisMap,s=t.offset,o=e.clipPathId,a=e.children,l=e.width,c=e.height,u=qkn(s);return U.createElement(Mfe.Provider,{value:i},U.createElement(Ffe.Provider,{value:r},U.createElement(tqe.Provider,{value:s},U.createElement(eqe.Provider,{value:u},U.createElement(nqe.Provider,{value:o},U.createElement(iqe.Provider,{value:c},U.createElement(rqe.Provider,{value:l},a)))))))},Kkn=function(){return E.useContext(nqe)},sqe=function(e){var t=E.useContext(Mfe);t==null&&aC();var i=t[e];return i==null&&aC(),i},Gkn=function(){var e=E.useContext(Mfe);return Cv(e)},Ykn=function(){var e=E.useContext(Ffe),t=jkn(e,function(i){return Kje(i.domain,Number.isFinite)});return t||Cv(e)},oqe=function(e){var t=E.useContext(Ffe);t==null&&aC();var i=t[e];return i==null&&aC(),i},Zkn=function(){var e=E.useContext(eqe);return e},Xkn=function(){return E.useContext(tqe)},Bfe=function(){return E.useContext(rqe)},$fe=function(){return E.useContext(iqe)};function bL(n){"@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(n)}function Qkn(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Jkn(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,i=new Array(e);tn*r)return!1;var s=t();return n*(e-n*s/2-i)>=0&&n*(e+n*s/2-r)<=0}function PEn(n,e){return fqe(n,e+1)}function OEn(n,e,t,i,r){for(var s=(i||[]).slice(),o=e.start,a=e.end,l=0,c=1,u=o,d=function(){var g=i?.[l];if(g===void 0)return{v:fqe(i,c)};var p=l,m,_=function(){return m===void 0&&(m=t(g,p)),m},v=g.coordinate,y=l===0||NB(n,v,_,u,a);y||(l=0,u=o,c+=1),y&&(u=v+n*(_()/2+r),l+=c)},h;c<=s.length;)if(h=d(),h)return h.v;return[]}function _P(n){"@babel/helpers - typeof";return _P=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},_P(n)}function KIe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function oc(n){for(var e=1;e0?f.coordinate-m*n:f.coordinate})}else s[h]=f=oc(oc({},f),{},{tickCoord:f.coordinate});var _=NB(n,f.tickCoord,p,a,l);_&&(l=f.tickCoord-n*(p()/2+r),s[h]=oc(oc({},f),{},{isShow:!0}))},u=o-1;u>=0;u--)c(u);return s}function WEn(n,e,t,i,r,s){var o=(i||[]).slice(),a=o.length,l=e.start,c=e.end;if(s){var u=i[a-1],d=t(u,a-1),h=n*(u.coordinate+n*d/2-c);o[a-1]=u=oc(oc({},u),{},{tickCoord:h>0?u.coordinate-h*n:u.coordinate});var f=NB(n,u.tickCoord,function(){return d},l,c);f&&(c=u.tickCoord-n*(d/2+r),o[a-1]=oc(oc({},u),{},{isShow:!0}))}for(var g=s?a-1:a,p=function(v){var y=o[v],C,x=function(){return C===void 0&&(C=t(y,v)),C};if(v===0){var k=n*(y.coordinate-n*x()/2-l);o[v]=y=oc(oc({},y),{},{tickCoord:k<0?y.coordinate-k*n:y.coordinate})}else o[v]=y=oc(oc({},y),{},{tickCoord:y.coordinate});var L=NB(n,y.tickCoord,x,l,c);L&&(l=y.tickCoord+n*(x()/2+r),o[v]=oc(oc({},y),{},{isShow:!0}))},m=0;m=2?ag(r[1].coordinate-r[0].coordinate):1,_=REn(s,m,f);return l==="equidistantPreserveStart"?OEn(m,_,p,r,o):(l==="preserveStart"||l==="preserveStartEnd"?h=WEn(m,_,p,r,o,l==="preserveStartEnd"):h=$En(m,_,p,r,o),h.filter(function(v){return v.isShow}))}var HEn=["viewBox"],VEn=["viewBox"],zEn=["ticks"];function CL(n){"@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(n)}function KS(){return KS=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function UEn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}function jEn(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function YIe(n,e){for(var t=0;t0?l(this.props):l(f)),o<=0||a<=0||!g||!g.length?null:U.createElement(Qr,{className:mr("recharts-cartesian-axis",c),ref:function(m){i.layerReference=m}},s&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),gc.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(i,r,s){var o;return U.isValidElement(i)?o=U.cloneElement(i,r):Ri(i)?o=i(r):o=U.createElement(tB,KS({},r,{className:"recharts-cartesian-axis-tick-value"}),s),o}}])}(E.Component);zfe($2,"displayName","CartesianAxis");zfe($2,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var QEn=["x1","y1","x2","y2","key"],JEn=["offset"];function lC(n){"@babel/helpers - typeof";return lC=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},lC(n)}function ZIe(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function pc(n){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function iLn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}var rLn=function(e){var t=e.fill;if(!t||t==="none")return null;var i=e.fillOpacity,r=e.x,s=e.y,o=e.width,a=e.height,l=e.ry;return U.createElement("rect",{x:r,y:s,ry:l,width:o,height:a,stroke:"none",fill:t,fillOpacity:i,className:"recharts-cartesian-grid-bg"})};function mqe(n,e){var t;if(U.isValidElement(n))t=U.cloneElement(n,e);else if(Ri(n))t=n(e);else{var i=e.x1,r=e.y1,s=e.x2,o=e.y2,a=e.key,l=XIe(e,QEn),c=Ti(l,!1);c.offset;var u=XIe(c,JEn);t=U.createElement("line",Wy({},u,{x1:i,y1:r,x2:s,y2:o,fill:"none",key:a}))}return t}function sLn(n){var e=n.x,t=n.width,i=n.horizontal,r=i===void 0?!0:i,s=n.horizontalPoints;if(!r||!s||!s.length)return null;var o=s.map(function(a,l){var c=pc(pc({},n),{},{x1:e,y1:a,x2:e+t,y2:a,key:"line-".concat(l),index:l});return mqe(r,c)});return U.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function oLn(n){var e=n.y,t=n.height,i=n.vertical,r=i===void 0?!0:i,s=n.verticalPoints;if(!r||!s||!s.length)return null;var o=s.map(function(a,l){var c=pc(pc({},n),{},{x1:a,y1:e,x2:a,y2:e+t,key:"line-".concat(l),index:l});return mqe(r,c)});return U.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function aLn(n){var e=n.horizontalFill,t=n.fillOpacity,i=n.x,r=n.y,s=n.width,o=n.height,a=n.horizontalPoints,l=n.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length)return null;var u=a.map(function(h){return Math.round(h+r-r)}).sort(function(h,f){return h-f});r!==u[0]&&u.unshift(0);var d=u.map(function(h,f){var g=!u[f+1],p=g?r+o-h:u[f+1]-h;if(p<=0)return null;var m=f%e.length;return U.createElement("rect",{key:"react-".concat(f),y:h,x:i,height:p,width:s,stroke:"none",fill:e[m],fillOpacity:t,className:"recharts-cartesian-grid-bg"})});return U.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function lLn(n){var e=n.vertical,t=e===void 0?!0:e,i=n.verticalFill,r=n.fillOpacity,s=n.x,o=n.y,a=n.width,l=n.height,c=n.verticalPoints;if(!t||!i||!i.length)return null;var u=c.map(function(h){return Math.round(h+s-s)}).sort(function(h,f){return h-f});s!==u[0]&&u.unshift(0);var d=u.map(function(h,f){var g=!u[f+1],p=g?s+a-h:u[f+1]-h;if(p<=0)return null;var m=f%i.length;return U.createElement("rect",{key:"react-".concat(f),x:h,y:o,width:p,height:l,stroke:"none",fill:i[m],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return U.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var cLn=function(e,t){var i=e.xAxis,r=e.width,s=e.height,o=e.offset;return Tje(Vfe(pc(pc(pc({},$2.defaultProps),i),{},{ticks:w_(i,!0),viewBox:{x:0,y:0,width:r,height:s}})),o.left,o.left+o.width,t)},uLn=function(e,t){var i=e.yAxis,r=e.width,s=e.height,o=e.offset;return Tje(Vfe(pc(pc(pc({},$2.defaultProps),i),{},{ticks:w_(i,!0),viewBox:{x:0,y:0,width:r,height:s}})),o.top,o.top+o.height,t)},zx={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function dLn(n){var e,t,i,r,s,o,a=Bfe(),l=$fe(),c=Xkn(),u=pc(pc({},n),{},{stroke:(e=n.stroke)!==null&&e!==void 0?e:zx.stroke,fill:(t=n.fill)!==null&&t!==void 0?t:zx.fill,horizontal:(i=n.horizontal)!==null&&i!==void 0?i:zx.horizontal,horizontalFill:(r=n.horizontalFill)!==null&&r!==void 0?r:zx.horizontalFill,vertical:(s=n.vertical)!==null&&s!==void 0?s:zx.vertical,verticalFill:(o=n.verticalFill)!==null&&o!==void 0?o:zx.verticalFill,x:Ut(n.x)?n.x:c.left,y:Ut(n.y)?n.y:c.top,width:Ut(n.width)?n.width:c.width,height:Ut(n.height)?n.height:c.height}),d=u.x,h=u.y,f=u.width,g=u.height,p=u.syncWithTicks,m=u.horizontalValues,_=u.verticalValues,v=Gkn(),y=Ykn();if(!Ut(f)||f<=0||!Ut(g)||g<=0||!Ut(d)||d!==+d||!Ut(h)||h!==+h)return null;var C=u.verticalCoordinatesGenerator||cLn,x=u.horizontalCoordinatesGenerator||uLn,k=u.horizontalPoints,L=u.verticalPoints;if((!k||!k.length)&&Ri(x)){var D=m&&m.length,I=x({yAxis:y?pc(pc({},y),{},{ticks:D?m:y.ticks}):void 0,width:a,height:l,offset:c},D?!0:p);B_(Array.isArray(I),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(lC(I),"]")),Array.isArray(I)&&(k=I)}if((!L||!L.length)&&Ri(C)){var O=_&&_.length,M=C({xAxis:v?pc(pc({},v),{},{ticks:O?_:v.ticks}):void 0,width:a,height:l,offset:c},O?!0:p);B_(Array.isArray(M),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(lC(M),"]")),Array.isArray(M)&&(L=M)}return U.createElement("g",{className:"recharts-cartesian-grid"},U.createElement(rLn,{fill:u.fill,fillOpacity:u.fillOpacity,x:u.x,y:u.y,width:u.width,height:u.height,ry:u.ry}),U.createElement(sLn,Wy({},u,{offset:c,horizontalPoints:k,xAxis:v,yAxis:y})),U.createElement(oLn,Wy({},u,{offset:c,verticalPoints:L,xAxis:v,yAxis:y})),U.createElement(aLn,Wy({},u,{horizontalPoints:k})),U.createElement(lLn,Wy({},u,{verticalPoints:L})))}dLn.displayName="CartesianGrid";var hLn=["type","layout","connectNulls","ref"],fLn=["key"];function xL(n){"@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(n)}function QIe(n,e){if(n==null)return{};var t=gLn(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function gLn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}function dA(){return dA=Object.assign?Object.assign.bind():function(n){for(var e=1;en.length)&&(e=n.length);for(var t=0,i=new Array(e);td){f=[].concat(Ux(l.slice(0,g)),[d-p]);break}var m=f.length%2===0?[0,h]:[h];return[].concat(Ux(e.repeat(l,u)),Ux(f),m).map(function(_){return"".concat(_,"px")}).join(", ")}),Kf(t,"id",$C("recharts-line-")),Kf(t,"pathRef",function(o){t.mainCurve=o}),Kf(t,"handleAnimationEnd",function(){t.setState({isAnimationFinished:!0}),t.props.onAnimationEnd&&t.props.onAnimationEnd()}),Kf(t,"handleAnimationStart",function(){t.setState({isAnimationFinished:!1}),t.props.onAnimationStart&&t.props.onAnimationStart()}),t}return SLn(e,n),yLn(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var i=this.getTotalLength();this.setState({totalLength:i})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var i=this.getTotalLength();i!==this.state.totalLength&&this.setState({totalLength:i})}}},{key:"getTotalLength",value:function(){var i=this.mainCurve;try{return i&&i.getTotalLength&&i.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(i,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var s=this.props,o=s.points,a=s.xAxis,l=s.yAxis,c=s.layout,u=s.children,d=td(u,M2);if(!d)return null;var h=function(p,m){return{x:p.x,y:p.y,value:p.value,errorVal:Ka(p.payload,m)}},f={clipPath:i?"url(#clipPath-".concat(r,")"):null};return U.createElement(Qr,f,d.map(function(g){return U.cloneElement(g,{key:"bar-".concat(g.props.dataKey),data:o,xAxis:a,yAxis:l,layout:c,dataPointFormatter:h})}))}},{key:"renderDots",value:function(i,r,s){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var a=this.props,l=a.dot,c=a.points,u=a.dataKey,d=Ti(this.props,!1),h=Ti(l,!0),f=c.map(function(p,m){var _=wd(wd(wd({key:"dot-".concat(m),r:3},d),h),{},{value:p.value,dataKey:u,cx:p.x,cy:p.y,index:m,payload:p.payload});return e.renderDotItem(l,_)}),g={clipPath:i?"url(#clipPath-".concat(r?"":"dots-").concat(s,")"):null};return U.createElement(Qr,dA({className:"recharts-line-dots",key:"dots"},g),f)}},{key:"renderCurveStatically",value:function(i,r,s,o){var a=this.props,l=a.type,c=a.layout,u=a.connectNulls;a.ref;var d=QIe(a,hLn),h=wd(wd(wd({},Ti(d,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:r?"url(#clipPath-".concat(s,")"):null,points:i},o),{},{type:l,layout:c,connectNulls:u});return U.createElement(hw,dA({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(i,r){var s=this,o=this.props,a=o.points,l=o.strokeDasharray,c=o.isAnimationActive,u=o.animationBegin,d=o.animationDuration,h=o.animationEasing,f=o.animationId,g=o.animateNewValues,p=o.width,m=o.height,_=this.state,v=_.prevPoints,y=_.totalLength;return U.createElement(Ng,{begin:u,duration:d,isActive:c,easing:h,from:{t:0},to:{t:1},key:"line-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(C){var x=C.t;if(v){var k=v.length/a.length,L=a.map(function(B,G){var W=Math.floor(G*k);if(v[W]){var z=v[W],q=Xo(z.x,B.x),ee=Xo(z.y,B.y);return wd(wd({},B),{},{x:q(x),y:ee(x)})}if(g){var Z=Xo(p*2,B.x),j=Xo(m/2,B.y);return wd(wd({},B),{},{x:Z(x),y:j(x)})}return wd(wd({},B),{},{x:B.x,y:B.y})});return s.renderCurveStatically(L,i,r)}var D=Xo(0,y),I=D(x),O;if(l){var M="".concat(l).split(/[,\s]+/gim).map(function(B){return parseFloat(B)});O=s.getStrokeDasharray(I,y,M)}else O=s.generateSimpleStrokeDasharray(y,I);return s.renderCurveStatically(a,i,r,{strokeDasharray:O})})}},{key:"renderCurve",value:function(i,r){var s=this.props,o=s.points,a=s.isAnimationActive,l=this.state,c=l.prevPoints,u=l.totalLength;return a&&o&&o.length&&(!c&&u>0||!sC(c,o))?this.renderCurveWithAnimation(i,r):this.renderCurveStatically(o,i,r)}},{key:"render",value:function(){var i,r=this.props,s=r.hide,o=r.dot,a=r.points,l=r.className,c=r.xAxis,u=r.yAxis,d=r.top,h=r.left,f=r.width,g=r.height,p=r.isAnimationActive,m=r.id;if(s||!a||!a.length)return null;var _=this.state.isAnimationFinished,v=a.length===1,y=mr("recharts-line",l),C=c&&c.allowDataOverflow,x=u&&u.allowDataOverflow,k=C||x,L=Di(m)?this.id:m,D=(i=Ti(o,!1))!==null&&i!==void 0?i:{r:3,strokeWidth:2},I=D.r,O=I===void 0?3:I,M=D.strokeWidth,B=M===void 0?2:M,G=wze(o)?o:{},W=G.clipDot,z=W===void 0?!0:W,q=O*2+B;return U.createElement(Qr,{className:y},C||x?U.createElement("defs",null,U.createElement("clipPath",{id:"clipPath-".concat(L)},U.createElement("rect",{x:C?h:h-f/2,y:x?d:d-g/2,width:C?f:f*2,height:x?g:g*2})),!z&&U.createElement("clipPath",{id:"clipPath-dots-".concat(L)},U.createElement("rect",{x:h-q/2,y:d-q/2,width:f+q,height:g+q}))):null,!v&&this.renderCurve(k,L),this.renderErrorBar(k,L),(v||o)&&this.renderDots(k,z,L),(!p||_)&&zp.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(i,r){return i.animationId!==r.prevAnimationId?{prevAnimationId:i.animationId,curPoints:i.points,prevPoints:r.curPoints}:i.points!==r.curPoints?{curPoints:i.points}:null}},{key:"repeat",value:function(i,r){for(var s=i.length%2!==0?[].concat(Ux(i),[0]):i,o=[],a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function TLn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}function Hy(){return Hy=Object.assign?Object.assign.bind():function(n){for(var e=1;e0||!sC(u,o)||!sC(d,a))?this.renderAreaWithAnimation(i,r):this.renderAreaStatically(o,a,i,r)}},{key:"render",value:function(){var i,r=this.props,s=r.hide,o=r.dot,a=r.points,l=r.className,c=r.top,u=r.left,d=r.xAxis,h=r.yAxis,f=r.width,g=r.height,p=r.isAnimationActive,m=r.id;if(s||!a||!a.length)return null;var _=this.state.isAnimationFinished,v=a.length===1,y=mr("recharts-area",l),C=d&&d.allowDataOverflow,x=h&&h.allowDataOverflow,k=C||x,L=Di(m)?this.id:m,D=(i=Ti(o,!1))!==null&&i!==void 0?i:{r:3,strokeWidth:2},I=D.r,O=I===void 0?3:I,M=D.strokeWidth,B=M===void 0?2:M,G=wze(o)?o:{},W=G.clipDot,z=W===void 0?!0:W,q=O*2+B;return U.createElement(Qr,{className:y},C||x?U.createElement("defs",null,U.createElement("clipPath",{id:"clipPath-".concat(L)},U.createElement("rect",{x:C?u:u-f/2,y:x?c:c-g/2,width:C?f:f*2,height:x?g:g*2})),!z&&U.createElement("clipPath",{id:"clipPath-dots-".concat(L)},U.createElement("rect",{x:u-q/2,y:c-q/2,width:f+q,height:g+q}))):null,v?null:this.renderArea(k,L),(o||v)&&this.renderDots(k,z,L),(!p||_)&&zp.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(i,r){return i.animationId!==r.prevAnimationId?{prevAnimationId:i.animationId,curPoints:i.points,curBaseLine:i.baseLine,prevPoints:r.curPoints,prevBaseLine:r.curBaseLine}:i.points!==r.curPoints||i.baseLine!==r.curBaseLine?{curPoints:i.points,curBaseLine:i.baseLine}:null}}])}(E.PureComponent);bqe=VC;Ap(VC,"displayName","Area");Ap(VC,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!yg.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Ap(VC,"getBaseValue",function(n,e,t,i){var r=n.layout,s=n.baseValue,o=e.props.baseValue,a=o??s;if(Ut(a)&&typeof a=="number")return a;var l=r==="horizontal"?i:t,c=l.scale.domain();if(l.type==="number"){var u=Math.max(c[0],c[1]),d=Math.min(c[0],c[1]);return a==="dataMin"?d:a==="dataMax"||u<0?u:Math.max(Math.min(c[0],c[1]),0)}return a==="dataMin"?c[0]:a==="dataMax"?c[1]:c[0]});Ap(VC,"getComposedData",function(n){var e=n.props,t=n.item,i=n.xAxis,r=n.yAxis,s=n.xAxisTicks,o=n.yAxisTicks,a=n.bandSize,l=n.dataKey,c=n.stackedData,u=n.dataStartIndex,d=n.displayedData,h=n.offset,f=e.layout,g=c&&c.length,p=bqe.getBaseValue(e,t,i,r),m=f==="horizontal",_=!1,v=d.map(function(C,x){var k;g?k=c[u+x]:(k=Ka(C,l),Array.isArray(k)?_=!0:k=[p,k]);var L=k[1]==null||g&&Ka(C,l)==null;return m?{x:gL({axis:i,ticks:s,bandSize:a,entry:C,index:x}),y:L?null:r.scale(k[1]),value:k,payload:C}:{x:L?null:i.scale(k[1]),y:gL({axis:r,ticks:o,bandSize:a,entry:C,index:x}),value:k,payload:C}}),y;return g||_?y=v.map(function(C){var x=Array.isArray(C.value)?C.value[0]:null;return m?{x:C.x,y:x!=null&&C.y!=null?r.scale(x):null}:{x:x!=null?i.scale(x):null,y:C.y}}):y=m?r.scale(p):i.scale(p),tv({points:v,baseLine:y,layout:f,isRange:_},h)});Ap(VC,"renderDotItem",function(n,e){var t;if(U.isValidElement(n))t=U.cloneElement(n,e);else if(Ri(n))t=n(e);else{var i=mr("recharts-area-dot",typeof n!="boolean"?n.className:""),r=e.key,s=yqe(e,LLn);t=U.createElement(RV,Hy({},s,{key:r,className:i}))}return t});function kL(n){"@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(n)}function MLn(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function FLn(n,e){for(var t=0;t=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function qLn(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}function KLn(n){var e=n.option,t=n.isActive,i=jLn(n,ULn);return typeof e=="string"?U.createElement(jre,hA({option:U.createElement(yV,hA({type:e},i)),isActive:t,shapeType:"symbols"},i)):U.createElement(jre,hA({option:e,isActive:t,shapeType:"symbols"},i))}function EL(n){"@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(n)}function fA(){return fA=Object.assign?Object.assign.bind():function(n){for(var e=1;en.length)&&(e=n.length);for(var t=0,i=new Array(e);tn.length)&&(e=n.length);for(var t=0,i=new Array(e);t=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function H2n(n,e){if(n==null)return{};var t={};for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){if(e.indexOf(i)>=0)continue;t[i]=n[i]}return t}function V2n(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function z2n(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,i=new Array(e);t0?o:e&&e.length&&Ut(r)&&Ut(s)?e.slice(r,s+1):[]};function Vqe(n){return n==="number"?[0,"auto"]:void 0}var pse=function(e,t,i,r){var s=e.graphicalItems,o=e.tooltipAxis,a=UV(t,e);return i<0||!s||!s.length||i>=a.length?null:s.reduce(function(l,c){var u,d=(u=c.props.data)!==null&&u!==void 0?u:t;d&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=i&&(d=d.slice(e.dataStartIndex,e.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var f=d===void 0?a:d;h=W7(f,o.dataKey,r)}else h=d&&d[i]||a[i];return h?[].concat(IL(l),[Ije(c,h)]):l},[])},uAe=function(e,t,i,r){var s=r||{x:e.chartX,y:e.chartY},o=tTn(s,i),a=e.orderedTooltipTicks,l=e.tooltipAxis,c=e.tooltipTicks,u=iyn(o,a,c,l);if(u>=0&&c){var d=c[u]&&c[u].value,h=pse(e,t,u,d),f=nTn(i,a,u,s);return{activeTooltipIndex:u,activeLabel:d,activePayload:h,activeCoordinate:f}}return null},iTn=function(e,t){var i=t.axes,r=t.graphicalItems,s=t.axisType,o=t.axisIdKey,a=t.stackGroups,l=t.dataStartIndex,c=t.dataEndIndex,u=e.layout,d=e.children,h=e.stackOffset,f=Lje(u,s);return i.reduce(function(g,p){var m,_=p.type.defaultProps!==void 0?rt(rt({},p.type.defaultProps),p.props):p.props,v=_.type,y=_.dataKey,C=_.allowDataOverflow,x=_.allowDuplicatedCategory,k=_.scale,L=_.ticks,D=_.includeHidden,I=_[o];if(g[I])return g;var O=UV(e.data,{graphicalItems:r.filter(function(ue){var de,we=o in ue.props?ue.props[o]:(de=ue.type.defaultProps)===null||de===void 0?void 0:de[o];return we===I}),dataStartIndex:l,dataEndIndex:c}),M=O.length,B,G,W;D2n(_.domain,C,v)&&(B=Dre(_.domain,null,C),f&&(v==="number"||k!=="auto")&&(W=cA(O,y,"category")));var z=Vqe(v);if(!B||B.length===0){var q,ee=(q=_.domain)!==null&&q!==void 0?q:z;if(y){if(B=cA(O,y,v),v==="category"&&f){var Z=jon(B);x&&Z?(G=B,B=SB(0,M)):x||(B=BDe(ee,B,p).reduce(function(ue,de){return ue.indexOf(de)>=0?ue:[].concat(IL(ue),[de])},[]))}else if(v==="category")x?B=B.filter(function(ue){return ue!==""&&!Di(ue)}):B=BDe(ee,B,p).reduce(function(ue,de){return ue.indexOf(de)>=0||de===""||Di(de)?ue:[].concat(IL(ue),[de])},[]);else if(v==="number"){var j=lyn(O,r.filter(function(ue){var de,we,xe=o in ue.props?ue.props[o]:(de=ue.type.defaultProps)===null||de===void 0?void 0:de[o],Me="hide"in ue.props?ue.props.hide:(we=ue.type.defaultProps)===null||we===void 0?void 0:we.hide;return xe===I&&(D||!Me)}),y,s,u);j&&(B=j)}f&&(v==="number"||k!=="auto")&&(W=cA(O,y,"category"))}else f?B=SB(0,M):a&&a[I]&&a[I].hasStack&&v==="number"?B=h==="expand"?[0,1]:Dje(a[I].stackGroups,l,c):B=Eje(O,r.filter(function(ue){var de=o in ue.props?ue.props[o]:ue.type.defaultProps[o],we="hide"in ue.props?ue.props.hide:ue.type.defaultProps.hide;return de===I&&(D||!we)}),v,u,!0);if(v==="number")B=hse(d,B,I,s,L),ee&&(B=Dre(ee,B,C));else if(v==="category"&&ee){var te=ee,le=B.every(function(ue){return te.indexOf(ue)>=0});le&&(B=te)}}return rt(rt({},g),{},ii({},I,rt(rt({},_),{},{axisType:s,domain:B,categoricalDomain:W,duplicateDomain:G,originalDomain:(m=_.domain)!==null&&m!==void 0?m:z,isCategorical:f,layout:u})))},{})},rTn=function(e,t){var i=t.graphicalItems,r=t.Axis,s=t.axisType,o=t.axisIdKey,a=t.stackGroups,l=t.dataStartIndex,c=t.dataEndIndex,u=e.layout,d=e.children,h=UV(e.data,{graphicalItems:i,dataStartIndex:l,dataEndIndex:c}),f=h.length,g=Lje(u,s),p=-1;return i.reduce(function(m,_){var v=_.type.defaultProps!==void 0?rt(rt({},_.type.defaultProps),_.props):_.props,y=v[o],C=Vqe("number");if(!m[y]){p++;var x;return g?x=SB(0,f):a&&a[y]&&a[y].hasStack?(x=Dje(a[y].stackGroups,l,c),x=hse(d,x,y,s)):(x=Dre(C,Eje(h,i.filter(function(k){var L,D,I=o in k.props?k.props[o]:(L=k.type.defaultProps)===null||L===void 0?void 0:L[o],O="hide"in k.props?k.props.hide:(D=k.type.defaultProps)===null||D===void 0?void 0:D.hide;return I===y&&!O}),"number",u),r.defaultProps.allowDataOverflow),x=hse(d,x,y,s)),rt(rt({},m),{},ii({},y,rt(rt({axisType:s},r.defaultProps),{},{hide:!0,orientation:ef(J2n,"".concat(s,".").concat(p%2),null),domain:x,originalDomain:C,isCategorical:g,layout:u})))}return m},{})},sTn=function(e,t){var i=t.axisType,r=i===void 0?"xAxis":i,s=t.AxisComp,o=t.graphicalItems,a=t.stackGroups,l=t.dataStartIndex,c=t.dataEndIndex,u=e.children,d="".concat(r,"Id"),h=td(u,s),f={};return h.length?f=iTn(e,{axes:h,graphicalItems:o,axisType:r,axisIdKey:d,stackGroups:a,dataStartIndex:l,dataEndIndex:c}):o&&o.length&&(f=rTn(e,{Axis:s,graphicalItems:o,axisType:r,axisIdKey:d,stackGroups:a,dataStartIndex:l,dataEndIndex:c})),f},oTn=function(e){var t=Cv(e),i=w_(t,!1,!0);return{tooltipTicks:i,orderedTooltipTicks:ofe(i,function(r){return r.coordinate}),tooltipAxis:t,tooltipAxisBandSize:pB(t,i)}},dAe=function(e){var t=e.children,i=e.defaultShowTooltip,r=Td(t,_L),s=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(s=r.props.startIndex),r.props.endIndex>=0&&(o=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:s,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!i}},aTn=function(e){return!e||!e.length?!1:e.some(function(t){var i=F_(t&&t.type);return i&&i.indexOf("Bar")>=0})},hAe=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},lTn=function(e,t){var i=e.props,r=e.graphicalItems,s=e.xAxisMap,o=s===void 0?{}:s,a=e.yAxisMap,l=a===void 0?{}:a,c=i.width,u=i.height,d=i.children,h=i.margin||{},f=Td(d,_L),g=Td(d,$k),p=Object.keys(l).reduce(function(x,k){var L=l[k],D=L.orientation;return!L.mirror&&!L.hide?rt(rt({},x),{},ii({},D,x[D]+L.width)):x},{left:h.left||0,right:h.right||0}),m=Object.keys(o).reduce(function(x,k){var L=o[k],D=L.orientation;return!L.mirror&&!L.hide?rt(rt({},x),{},ii({},D,ef(x,"".concat(D))+L.height)):x},{top:h.top||0,bottom:h.bottom||0}),_=rt(rt({},m),p),v=_.bottom;f&&(_.bottom+=f.props.height||_L.defaultProps.height),g&&t&&(_=oyn(_,r,i,t));var y=c-_.left-_.right,C=u-_.top-_.bottom;return rt(rt({brushBottom:v},_),{},{width:Math.max(y,0),height:Math.max(C,0)})},cTn=function(e,t){if(t==="xAxis")return e[t].width;if(t==="yAxis")return e[t].height},uTn=function(e){var t=e.chartName,i=e.GraphicalChild,r=e.defaultTooltipEventType,s=r===void 0?"axis":r,o=e.validateTooltipEventTypes,a=o===void 0?["axis"]:o,l=e.axisComponents,c=e.legendContent,u=e.formatAxisMap,d=e.defaultProps,h=function(_,v){var y=v.graphicalItems,C=v.stackGroups,x=v.offset,k=v.updateId,L=v.dataStartIndex,D=v.dataEndIndex,I=_.barSize,O=_.layout,M=_.barGap,B=_.barCategoryGap,G=_.maxBarSize,W=hAe(O),z=W.numericAxisName,q=W.cateAxisName,ee=aTn(y),Z=[];return y.forEach(function(j,te){var le=UV(_.data,{graphicalItems:[j],dataStartIndex:L,dataEndIndex:D}),ue=j.type.defaultProps!==void 0?rt(rt({},j.type.defaultProps),j.props):j.props,de=ue.dataKey,we=ue.maxBarSize,xe=ue["".concat(z,"Id")],Me=ue["".concat(q,"Id")],Re={},_t=l.reduce(function(wt,vt){var nt=v["".concat(vt.axisType,"Map")],$t=ue["".concat(vt.axisType,"Id")];nt&&nt[$t]||vt.axisType==="zAxis"||aC();var an=nt[$t];return rt(rt({},wt),{},ii(ii({},vt.axisType,an),"".concat(vt.axisType,"Ticks"),w_(an)))},Re),Qe=_t[q],pt=_t["".concat(q,"Ticks")],gt=C&&C[xe]&&C[xe].hasStack&&yyn(j,C[xe].stackGroups),Ue=F_(j.type).indexOf("Bar")>=0,wn=pB(Qe,pt),Xt=[],jn=ee&&ryn({barSize:I,stackGroups:C,totalSize:cTn(_t,q)});if(Ue){var ji,ci,ye=Di(we)?G:we,Ie=(ji=(ci=pB(Qe,pt,!0))!==null&&ci!==void 0?ci:ye)!==null&&ji!==void 0?ji:0;Xt=syn({barGap:M,barCategoryGap:B,bandSize:Ie!==wn?Ie:wn,sizeList:jn[Me],maxBarSize:ye}),Ie!==wn&&(Xt=Xt.map(function(wt){return rt(rt({},wt),{},{position:rt(rt({},wt.position),{},{offset:wt.position.offset-Ie/2})})}))}var Ve=j&&j.type&&j.type.getComposedData;Ve&&Z.push({props:rt(rt({},Ve(rt(rt({},_t),{},{displayedData:le,props:_,dataKey:de,item:j,bandSize:wn,barPosition:Xt,offset:x,stackedData:gt,layout:O,dataStartIndex:L,dataEndIndex:D}))),{},ii(ii(ii({key:j.key||"item-".concat(te)},z,_t[z]),q,_t[q]),"animationId",k)),childIndex:ian(j,_.children),item:j})}),Z},f=function(_,v){var y=_.props,C=_.dataStartIndex,x=_.dataEndIndex,k=_.updateId;if(!N2e({props:y}))return null;var L=y.children,D=y.layout,I=y.stackOffset,O=y.data,M=y.reverseStackOrder,B=hAe(D),G=B.numericAxisName,W=B.cateAxisName,z=td(L,i),q=_yn(O,z,"".concat(G,"Id"),"".concat(W,"Id"),I,M),ee=l.reduce(function(ue,de){var we="".concat(de.axisType,"Map");return rt(rt({},ue),{},ii({},we,sTn(y,rt(rt({},de),{},{graphicalItems:z,stackGroups:de.axisType===G&&q,dataStartIndex:C,dataEndIndex:x}))))},{}),Z=lTn(rt(rt({},ee),{},{props:y,graphicalItems:z}),v?.legendBBox);Object.keys(ee).forEach(function(ue){ee[ue]=u(y,ee[ue],Z,ue.replace("Map",""),t)});var j=ee["".concat(W,"Map")],te=oTn(j),le=h(y,rt(rt({},ee),{},{dataStartIndex:C,dataEndIndex:x,updateId:k,graphicalItems:z,stackGroups:q,offset:Z}));return rt(rt({formattedGraphicalItems:le,graphicalItems:z,offset:Z,stackGroups:q},te),ee)},g=function(m){function _(v){var y,C,x;return V2n(this,_),x=j2n(this,_,[v]),ii(x,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ii(x,"accessibilityManager",new T2n),ii(x,"handleLegendBBoxUpdate",function(k){if(k){var L=x.state,D=L.dataStartIndex,I=L.dataEndIndex,O=L.updateId;x.setState(rt({legendBBox:k},f({props:x.props,dataStartIndex:D,dataEndIndex:I,updateId:O},rt(rt({},x.state),{},{legendBBox:k}))))}}),ii(x,"handleReceiveSyncEvent",function(k,L,D){if(x.props.syncId===k){if(D===x.eventEmitterSymbol&&typeof x.props.syncMethod!="function")return;x.applySyncEvent(L)}}),ii(x,"handleBrushChange",function(k){var L=k.startIndex,D=k.endIndex;if(L!==x.state.dataStartIndex||D!==x.state.dataEndIndex){var I=x.state.updateId;x.setState(function(){return rt({dataStartIndex:L,dataEndIndex:D},f({props:x.props,dataStartIndex:L,dataEndIndex:D,updateId:I},x.state))}),x.triggerSyncEvent({dataStartIndex:L,dataEndIndex:D})}}),ii(x,"handleMouseEnter",function(k){var L=x.getMouseInfo(k);if(L){var D=rt(rt({},L),{},{isTooltipActive:!0});x.setState(D),x.triggerSyncEvent(D);var I=x.props.onMouseEnter;Ri(I)&&I(D,k)}}),ii(x,"triggeredAfterMouseMove",function(k){var L=x.getMouseInfo(k),D=L?rt(rt({},L),{},{isTooltipActive:!0}):{isTooltipActive:!1};x.setState(D),x.triggerSyncEvent(D);var I=x.props.onMouseMove;Ri(I)&&I(D,k)}),ii(x,"handleItemMouseEnter",function(k){x.setState(function(){return{isTooltipActive:!0,activeItem:k,activePayload:k.tooltipPayload,activeCoordinate:k.tooltipPosition||{x:k.cx,y:k.cy}}})}),ii(x,"handleItemMouseLeave",function(){x.setState(function(){return{isTooltipActive:!1}})}),ii(x,"handleMouseMove",function(k){k.persist(),x.throttleTriggeredAfterMouseMove(k)}),ii(x,"handleMouseLeave",function(k){x.throttleTriggeredAfterMouseMove.cancel();var L={isTooltipActive:!1};x.setState(L),x.triggerSyncEvent(L);var D=x.props.onMouseLeave;Ri(D)&&D(L,k)}),ii(x,"handleOuterEvent",function(k){var L=nan(k),D=ef(x.props,"".concat(L));if(L&&Ri(D)){var I,O;/.*touch.*/i.test(L)?O=x.getMouseInfo(k.changedTouches[0]):O=x.getMouseInfo(k),D((I=O)!==null&&I!==void 0?I:{},k)}}),ii(x,"handleClick",function(k){var L=x.getMouseInfo(k);if(L){var D=rt(rt({},L),{},{isTooltipActive:!0});x.setState(D),x.triggerSyncEvent(D);var I=x.props.onClick;Ri(I)&&I(D,k)}}),ii(x,"handleMouseDown",function(k){var L=x.props.onMouseDown;if(Ri(L)){var D=x.getMouseInfo(k);L(D,k)}}),ii(x,"handleMouseUp",function(k){var L=x.props.onMouseUp;if(Ri(L)){var D=x.getMouseInfo(k);L(D,k)}}),ii(x,"handleTouchMove",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&x.throttleTriggeredAfterMouseMove(k.changedTouches[0])}),ii(x,"handleTouchStart",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&x.handleMouseDown(k.changedTouches[0])}),ii(x,"handleTouchEnd",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&x.handleMouseUp(k.changedTouches[0])}),ii(x,"handleDoubleClick",function(k){var L=x.props.onDoubleClick;if(Ri(L)){var D=x.getMouseInfo(k);L(D,k)}}),ii(x,"handleContextMenu",function(k){var L=x.props.onContextMenu;if(Ri(L)){var D=x.getMouseInfo(k);L(D,k)}}),ii(x,"triggerSyncEvent",function(k){x.props.syncId!==void 0&&lG.emit(cG,x.props.syncId,k,x.eventEmitterSymbol)}),ii(x,"applySyncEvent",function(k){var L=x.props,D=L.layout,I=L.syncMethod,O=x.state.updateId,M=k.dataStartIndex,B=k.dataEndIndex;if(k.dataStartIndex!==void 0||k.dataEndIndex!==void 0)x.setState(rt({dataStartIndex:M,dataEndIndex:B},f({props:x.props,dataStartIndex:M,dataEndIndex:B,updateId:O},x.state)));else if(k.activeTooltipIndex!==void 0){var G=k.chartX,W=k.chartY,z=k.activeTooltipIndex,q=x.state,ee=q.offset,Z=q.tooltipTicks;if(!ee)return;if(typeof I=="function")z=I(Z,k);else if(I==="value"){z=-1;for(var j=0;j=0){var gt,Ue;if(G.dataKey&&!G.allowDuplicatedCategory){var wn=typeof G.dataKey=="function"?pt:"payload.".concat(G.dataKey.toString());gt=W7(j,wn,z),Ue=te&&le&&W7(le,wn,z)}else gt=j?.[W],Ue=te&&le&&le[W];if(Me||xe){var Xt=k.props.activeIndex!==void 0?k.props.activeIndex:W;return[E.cloneElement(k,rt(rt(rt({},I.props),_t),{},{activeIndex:Xt})),null,null]}if(!Di(gt))return[Qe].concat(IL(x.renderActivePoints({item:I,activePoint:gt,basePoint:Ue,childIndex:W,isRange:te})))}else{var jn,ji=(jn=x.getItemByXY(x.state.activeCoordinate))!==null&&jn!==void 0?jn:{graphicalItem:Qe},ci=ji.graphicalItem,ye=ci.item,Ie=ye===void 0?k:ye,Ve=ci.childIndex,wt=rt(rt(rt({},I.props),_t),{},{activeIndex:Ve});return[E.cloneElement(Ie,wt),null,null]}return te?[Qe,null,null]:[Qe,null]}),ii(x,"renderCustomized",function(k,L,D){return E.cloneElement(k,rt(rt({key:"recharts-customized-".concat(D)},x.props),x.state))}),ii(x,"renderMap",{CartesianGrid:{handler:rF,once:!0},ReferenceArea:{handler:x.renderReferenceElement},ReferenceLine:{handler:rF},ReferenceDot:{handler:x.renderReferenceElement},XAxis:{handler:rF},YAxis:{handler:rF},Brush:{handler:x.renderBrush,once:!0},Bar:{handler:x.renderGraphicChild},Line:{handler:x.renderGraphicChild},Area:{handler:x.renderGraphicChild},Radar:{handler:x.renderGraphicChild},RadialBar:{handler:x.renderGraphicChild},Scatter:{handler:x.renderGraphicChild},Pie:{handler:x.renderGraphicChild},Funnel:{handler:x.renderGraphicChild},Tooltip:{handler:x.renderCursor,once:!0},PolarGrid:{handler:x.renderPolarGrid,once:!0},PolarAngleAxis:{handler:x.renderPolarAxis},PolarRadiusAxis:{handler:x.renderPolarAxis},Customized:{handler:x.renderCustomized}}),x.clipPathId="".concat((y=v.id)!==null&&y!==void 0?y:$C("recharts"),"-clip"),x.throttleTriggeredAfterMouseMove=SUe(x.triggeredAfterMouseMove,(C=v.throttleDelay)!==null&&C!==void 0?C:1e3/60),x.state={},x}return G2n(_,m),U2n(_,[{key:"componentDidMount",value:function(){var y,C;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(y=this.props.margin.left)!==null&&y!==void 0?y:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var y=this.props,C=y.children,x=y.data,k=y.height,L=y.layout,D=Td(C,Gm);if(D){var I=D.props.defaultIndex;if(!(typeof I!="number"||I<0||I>this.state.tooltipTicks.length-1)){var O=this.state.tooltipTicks[I]&&this.state.tooltipTicks[I].value,M=pse(this.state,x,I,O),B=this.state.tooltipTicks[I].coordinate,G=(this.state.offset.top+k)/2,W=L==="horizontal",z=W?{x:B,y:G}:{y:B,x:G},q=this.state.formattedGraphicalItems.find(function(Z){var j=Z.item;return j.type.name==="Scatter"});q&&(z=rt(rt({},z),q.props.points[I].tooltipPosition),M=q.props.points[I].tooltipPayload);var ee={activeTooltipIndex:I,isTooltipActive:!0,activeLabel:O,activePayload:M,activeCoordinate:z};this.setState(ee),this.renderCursor(D),this.accessibilityManager.setIndex(I)}}}},{key:"getSnapshotBeforeUpdate",value:function(y,C){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==C.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==y.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==y.margin){var x,k;this.accessibilityManager.setDetails({offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0}})}return null}},{key:"componentDidUpdate",value:function(y){Uie([Td(y.children,Gm)],[Td(this.props.children,Gm)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var y=Td(this.props.children,Gm);if(y&&typeof y.props.shared=="boolean"){var C=y.props.shared?"axis":"item";return a.indexOf(C)>=0?C:s}return s}},{key:"getMouseInfo",value:function(y){if(!this.container)return null;var C=this.container,x=C.getBoundingClientRect(),k=D_n(x),L={chartX:Math.round(y.pageX-k.left),chartY:Math.round(y.pageY-k.top)},D=x.width/C.offsetWidth||1,I=this.inRange(L.chartX,L.chartY,D);if(!I)return null;var O=this.state,M=O.xAxisMap,B=O.yAxisMap,G=this.getTooltipEventType();if(G!=="axis"&&M&&B){var W=Cv(M).scale,z=Cv(B).scale,q=W&&W.invert?W.invert(L.chartX):null,ee=z&&z.invert?z.invert(L.chartY):null;return rt(rt({},L),{},{xValue:q,yValue:ee})}var Z=uAe(this.state,this.props.data,this.props.layout,I);return Z?rt(rt({},L),Z):null}},{key:"inRange",value:function(y,C){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,k=this.props.layout,L=y/x,D=C/x;if(k==="horizontal"||k==="vertical"){var I=this.state.offset,O=L>=I.left&&L<=I.left+I.width&&D>=I.top&&D<=I.top+I.height;return O?{x:L,y:D}:null}var M=this.state,B=M.angleAxisMap,G=M.radiusAxisMap;if(B&&G){var W=Cv(B);return HDe({x:L,y:D},W)}return null}},{key:"parseEventsOfWrapper",value:function(){var y=this.props.children,C=this.getTooltipEventType(),x=Td(y,Gm),k={};x&&C==="axis"&&(x.props.trigger==="click"?k={onClick:this.handleClick}:k={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var L=H7(this.props,this.handleOuterEvent);return rt(rt({},L),k)}},{key:"addListener",value:function(){lG.on(cG,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){lG.removeListener(cG,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(y,C,x){for(var k=this.state.formattedGraphicalItems,L=0,D=k.length;L{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(hTn);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(_se,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(_se,{...i,ref:e,children:t})});zqe.displayName="Slot";var _se=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=gTn(t);return E.cloneElement(t,{...fTn(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});_se.displayName="SlotClone";var dTn=({children:n})=>ae.jsx(ae.Fragment,{children:n});function hTn(n){return E.isValidElement(n)&&n.type===dTn}function fTn(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function gTn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function pTn(n){const e=E.useRef({value:n,previous:n});return E.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}var mTn=[" ","Enter","ArrowUp","ArrowDown"],_Tn=[" ","Enter"],JO="Select",[jV,qV,vTn]=eae(JO),[W2,tVn]=Ac(JO,[vTn,c1]),KV=c1(),[bTn,p1]=W2(JO),[yTn,wTn]=W2(JO),Uqe=n=>{const{__scopeSelect:e,children:t,open:i,defaultOpen:r,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:h,required:f,form:g}=n,p=KV(e),[m,_]=E.useState(null),[v,y]=E.useState(null),[C,x]=E.useState(!1),k=$P(c),[L=!1,D]=Kp({prop:i,defaultProp:r,onChange:s}),[I,O]=Kp({prop:o,defaultProp:a,onChange:l}),M=E.useRef(null),B=m?g||!!m.closest("form"):!0,[G,W]=E.useState(new Set),z=Array.from(G).map(q=>q.props.value).join(";");return ae.jsx(UH,{...p,children:ae.jsxs(bTn,{required:f,scope:e,trigger:m,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:C,onValueNodeHasChildrenChange:x,contentId:Ud(),value:I,onValueChange:O,open:L,onOpenChange:D,dir:k,triggerPointerDownPosRef:M,disabled:h,children:[ae.jsx(jV.Provider,{scope:e,children:ae.jsx(yTn,{scope:n.__scopeSelect,onNativeOptionAdd:E.useCallback(q=>{W(ee=>new Set(ee).add(q))},[]),onNativeOptionRemove:E.useCallback(q=>{W(ee=>{const Z=new Set(ee);return Z.delete(q),Z})},[]),children:t})}),B?ae.jsxs(mKe,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:d,value:I,onChange:q=>O(q.target.value),disabled:h,form:g,children:[I===void 0?ae.jsx("option",{value:""}):null,Array.from(G)]},z):null]})})};Uqe.displayName=JO;var jqe="SelectTrigger",qqe=E.forwardRef((n,e)=>{const{__scopeSelect:t,disabled:i=!1,...r}=n,s=KV(t),o=p1(jqe,t),a=o.disabled||i,l=gi(e,o.onTriggerChange),c=qV(t),u=E.useRef("touch"),[d,h,f]=_Ke(p=>{const m=c().filter(y=>!y.disabled),_=m.find(y=>y.value===o.value),v=vKe(m,p,_);v!==void 0&&o.onValueChange(v.value)}),g=p=>{a||(o.onOpenChange(!0),f()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return ae.jsx(BO,{asChild:!0,...s,children:ae.jsx(Pn.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":pKe(o.value)?"":void 0,...r,ref:l,onClick:Kt(r.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&g(p)}),onPointerDown:Kt(r.onPointerDown,p=>{u.current=p.pointerType;const m=p.target;m.hasPointerCapture(p.pointerId)&&m.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:Kt(r.onKeyDown,p=>{const m=d.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&h(p.key),!(m&&p.key===" ")&&mTn.includes(p.key)&&(g(),p.preventDefault())})})})});qqe.displayName=jqe;var Kqe="SelectValue",Gqe=E.forwardRef((n,e)=>{const{__scopeSelect:t,className:i,style:r,children:s,placeholder:o="",...a}=n,l=p1(Kqe,t),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,d=gi(e,l.onValueNodeChange);return es(()=>{c(u)},[c,u]),ae.jsx(Pn.span,{...a,ref:d,style:{pointerEvents:"none"},children:pKe(l.value)?ae.jsx(ae.Fragment,{children:o}):s})});Gqe.displayName=Kqe;var CTn="SelectIcon",Yqe=E.forwardRef((n,e)=>{const{__scopeSelect:t,children:i,...r}=n;return ae.jsx(Pn.span,{"aria-hidden":!0,...r,ref:e,children:i||"▼"})});Yqe.displayName=CTn;var xTn="SelectPortal",Zqe=n=>ae.jsx(y2,{asChild:!0,...n});Zqe.displayName=xTn;var cC="SelectContent",Xqe=E.forwardRef((n,e)=>{const t=p1(cC,n.__scopeSelect),[i,r]=E.useState();if(es(()=>{r(new DocumentFragment)},[]),!t.open){const s=i;return s?h0.createPortal(ae.jsx(Qqe,{scope:n.__scopeSelect,children:ae.jsx(jV.Slot,{scope:n.__scopeSelect,children:ae.jsx("div",{children:n.children})})}),s):null}return ae.jsx(Jqe,{...n,ref:e})});Xqe.displayName=cC;var Ff=10,[Qqe,m1]=W2(cC),STn="SelectContentImpl",Jqe=E.forwardRef((n,e)=>{const{__scopeSelect:t,position:i="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:f,sticky:g,hideWhenDetached:p,avoidCollisions:m,..._}=n,v=p1(cC,t),[y,C]=E.useState(null),[x,k]=E.useState(null),L=gi(e,Re=>C(Re)),[D,I]=E.useState(null),[O,M]=E.useState(null),B=qV(t),[G,W]=E.useState(!1),z=E.useRef(!1);E.useEffect(()=>{if(y)return MO(y)},[y]),WH();const q=E.useCallback(Re=>{const[_t,...Qe]=B().map(Ue=>Ue.ref.current),[pt]=Qe.slice(-1),gt=document.activeElement;for(const Ue of Re)if(Ue===gt||(Ue?.scrollIntoView({block:"nearest"}),Ue===_t&&x&&(x.scrollTop=0),Ue===pt&&x&&(x.scrollTop=x.scrollHeight),Ue?.focus(),document.activeElement!==gt))return},[B,x]),ee=E.useCallback(()=>q([D,y]),[q,D,y]);E.useEffect(()=>{G&&ee()},[G,ee]);const{onOpenChange:Z,triggerPointerDownPosRef:j}=v;E.useEffect(()=>{if(y){let Re={x:0,y:0};const _t=pt=>{Re={x:Math.abs(Math.round(pt.pageX)-(j.current?.x??0)),y:Math.abs(Math.round(pt.pageY)-(j.current?.y??0))}},Qe=pt=>{Re.x<=10&&Re.y<=10?pt.preventDefault():y.contains(pt.target)||Z(!1),document.removeEventListener("pointermove",_t),j.current=null};return j.current!==null&&(document.addEventListener("pointermove",_t),document.addEventListener("pointerup",Qe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_t),document.removeEventListener("pointerup",Qe,{capture:!0})}}},[y,Z,j]),E.useEffect(()=>{const Re=()=>Z(!1);return window.addEventListener("blur",Re),window.addEventListener("resize",Re),()=>{window.removeEventListener("blur",Re),window.removeEventListener("resize",Re)}},[Z]);const[te,le]=_Ke(Re=>{const _t=B().filter(gt=>!gt.disabled),Qe=_t.find(gt=>gt.ref.current===document.activeElement),pt=vKe(_t,Re,Qe);pt&&setTimeout(()=>pt.ref.current.focus())}),ue=E.useCallback((Re,_t,Qe)=>{const pt=!z.current&&!Qe;(v.value!==void 0&&v.value===_t||pt)&&(I(Re),pt&&(z.current=!0))},[v.value]),de=E.useCallback(()=>y?.focus(),[y]),we=E.useCallback((Re,_t,Qe)=>{const pt=!z.current&&!Qe;(v.value!==void 0&&v.value===_t||pt)&&M(Re)},[v.value]),xe=i==="popper"?vse:eKe,Me=xe===vse?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:f,sticky:g,hideWhenDetached:p,avoidCollisions:m}:{};return ae.jsx(Qqe,{scope:t,content:y,viewport:x,onViewportChange:k,itemRefCallback:ue,selectedItem:D,onItemLeave:de,itemTextRefCallback:we,focusSelectedItem:ee,selectedItemText:O,position:i,isPositioned:G,searchRef:te,children:ae.jsx(OO,{as:zqe,allowPinchZoom:!0,children:ae.jsx(PO,{asChild:!0,trapped:v.open,onMountAutoFocus:Re=>{Re.preventDefault()},onUnmountAutoFocus:Kt(r,Re=>{v.trigger?.focus({preventScroll:!0}),Re.preventDefault()}),children:ae.jsx(b2,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:Re=>Re.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:ae.jsx(xe,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:Re=>Re.preventDefault(),..._,...Me,onPlaced:()=>W(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:Kt(_.onKeyDown,Re=>{const _t=Re.ctrlKey||Re.altKey||Re.metaKey;if(Re.key==="Tab"&&Re.preventDefault(),!_t&&Re.key.length===1&&le(Re.key),["ArrowUp","ArrowDown","Home","End"].includes(Re.key)){let pt=B().filter(gt=>!gt.disabled).map(gt=>gt.ref.current);if(["ArrowUp","End"].includes(Re.key)&&(pt=pt.slice().reverse()),["ArrowUp","ArrowDown"].includes(Re.key)){const gt=Re.target,Ue=pt.indexOf(gt);pt=pt.slice(Ue+1)}setTimeout(()=>q(pt)),Re.preventDefault()}})})})})})})});Jqe.displayName=STn;var kTn="SelectItemAlignedPosition",eKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,onPlaced:i,...r}=n,s=p1(cC,t),o=m1(cC,t),[a,l]=E.useState(null),[c,u]=E.useState(null),d=gi(e,L=>u(L)),h=qV(t),f=E.useRef(!1),g=E.useRef(!0),{viewport:p,selectedItem:m,selectedItemText:_,focusSelectedItem:v}=o,y=E.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&p&&m&&_){const L=s.trigger.getBoundingClientRect(),D=c.getBoundingClientRect(),I=s.valueNode.getBoundingClientRect(),O=_.getBoundingClientRect();if(s.dir!=="rtl"){const gt=O.left-D.left,Ue=I.left-gt,wn=L.left-Ue,Xt=L.width+wn,jn=Math.max(Xt,D.width),ji=window.innerWidth-Ff,ci=mse(Ue,[Ff,Math.max(Ff,ji-jn)]);a.style.minWidth=Xt+"px",a.style.left=ci+"px"}else{const gt=D.right-O.right,Ue=window.innerWidth-I.right-gt,wn=window.innerWidth-L.right-Ue,Xt=L.width+wn,jn=Math.max(Xt,D.width),ji=window.innerWidth-Ff,ci=mse(Ue,[Ff,Math.max(Ff,ji-jn)]);a.style.minWidth=Xt+"px",a.style.right=ci+"px"}const M=h(),B=window.innerHeight-Ff*2,G=p.scrollHeight,W=window.getComputedStyle(c),z=parseInt(W.borderTopWidth,10),q=parseInt(W.paddingTop,10),ee=parseInt(W.borderBottomWidth,10),Z=parseInt(W.paddingBottom,10),j=z+q+G+Z+ee,te=Math.min(m.offsetHeight*5,j),le=window.getComputedStyle(p),ue=parseInt(le.paddingTop,10),de=parseInt(le.paddingBottom,10),we=L.top+L.height/2-Ff,xe=B-we,Me=m.offsetHeight/2,Re=m.offsetTop+Me,_t=z+q+Re,Qe=j-_t;if(_t<=we){const gt=M.length>0&&m===M[M.length-1].ref.current;a.style.bottom="0px";const Ue=c.clientHeight-p.offsetTop-p.offsetHeight,wn=Math.max(xe,Me+(gt?de:0)+Ue+ee),Xt=_t+wn;a.style.height=Xt+"px"}else{const gt=M.length>0&&m===M[0].ref.current;a.style.top="0px";const wn=Math.max(we,z+p.offsetTop+(gt?ue:0)+Me)+Qe;a.style.height=wn+"px",p.scrollTop=_t-we+p.offsetTop}a.style.margin=`${Ff}px 0`,a.style.minHeight=te+"px",a.style.maxHeight=B+"px",i?.(),requestAnimationFrame(()=>f.current=!0)}},[h,s.trigger,s.valueNode,a,c,p,m,_,s.dir,i]);es(()=>y(),[y]);const[C,x]=E.useState();es(()=>{c&&x(window.getComputedStyle(c).zIndex)},[c]);const k=E.useCallback(L=>{L&&g.current===!0&&(y(),v?.(),g.current=!1)},[y,v]);return ae.jsx(LTn,{scope:t,contentWrapper:a,shouldExpandOnScrollRef:f,onScrollButtonChange:k,children:ae.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:ae.jsx(Pn.div,{...r,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});eKe.displayName=kTn;var ETn="SelectPopperPosition",vse=E.forwardRef((n,e)=>{const{__scopeSelect:t,align:i="start",collisionPadding:r=Ff,...s}=n,o=KV(t);return ae.jsx(jH,{...o,...s,ref:e,align:i,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});vse.displayName=ETn;var[LTn,qfe]=W2(cC,{}),bse="SelectViewport",tKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,nonce:i,...r}=n,s=m1(bse,t),o=qfe(bse,t),a=gi(e,s.onViewportChange),l=E.useRef(0);return ae.jsxs(ae.Fragment,{children:[ae.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),ae.jsx(jV.Slot,{scope:t,children:ae.jsx(Pn.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:Kt(r.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=o;if(h?.current&&d){const f=Math.abs(l.current-u.scrollTop);if(f>0){const g=window.innerHeight-Ff*2,p=parseFloat(d.style.minHeight),m=parseFloat(d.style.height),_=Math.max(p,m);if(_0?C:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});tKe.displayName=bse;var nKe="SelectGroup",[TTn,DTn]=W2(nKe),iKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,...i}=n,r=Ud();return ae.jsx(TTn,{scope:t,id:r,children:ae.jsx(Pn.div,{role:"group","aria-labelledby":r,...i,ref:e})})});iKe.displayName=nKe;var rKe="SelectLabel",sKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,...i}=n,r=DTn(rKe,t);return ae.jsx(Pn.div,{id:r.id,...i,ref:e})});sKe.displayName=rKe;var HB="SelectItem",[ITn,oKe]=W2(HB),aKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,value:i,disabled:r=!1,textValue:s,...o}=n,a=p1(HB,t),l=m1(HB,t),c=a.value===i,[u,d]=E.useState(s??""),[h,f]=E.useState(!1),g=gi(e,v=>l.itemRefCallback?.(v,i,r)),p=Ud(),m=E.useRef("touch"),_=()=>{r||(a.onValueChange(i),a.onOpenChange(!1))};if(i==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return ae.jsx(ITn,{scope:t,value:i,disabled:r,textId:p,isSelected:c,onItemTextChange:E.useCallback(v=>{d(y=>y||(v?.textContent??"").trim())},[]),children:ae.jsx(jV.ItemSlot,{scope:t,value:i,disabled:r,textValue:u,children:ae.jsx(Pn.div,{role:"option","aria-labelledby":p,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:g,onFocus:Kt(o.onFocus,()=>f(!0)),onBlur:Kt(o.onBlur,()=>f(!1)),onClick:Kt(o.onClick,()=>{m.current!=="mouse"&&_()}),onPointerUp:Kt(o.onPointerUp,()=>{m.current==="mouse"&&_()}),onPointerDown:Kt(o.onPointerDown,v=>{m.current=v.pointerType}),onPointerMove:Kt(o.onPointerMove,v=>{m.current=v.pointerType,r?l.onItemLeave?.():m.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Kt(o.onPointerLeave,v=>{v.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:Kt(o.onKeyDown,v=>{l.searchRef?.current!==""&&v.key===" "||(_Tn.includes(v.key)&&_(),v.key===" "&&v.preventDefault())})})})})});aKe.displayName=HB;var eI="SelectItemText",lKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,className:i,style:r,...s}=n,o=p1(eI,t),a=m1(eI,t),l=oKe(eI,t),c=wTn(eI,t),[u,d]=E.useState(null),h=gi(e,_=>d(_),l.onItemTextChange,_=>a.itemTextRefCallback?.(_,l.value,l.disabled)),f=u?.textContent,g=E.useMemo(()=>ae.jsx("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:p,onNativeOptionRemove:m}=c;return es(()=>(p(g),()=>m(g)),[p,m,g]),ae.jsxs(ae.Fragment,{children:[ae.jsx(Pn.span,{id:l.textId,...s,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?h0.createPortal(s.children,o.valueNode):null]})});lKe.displayName=eI;var cKe="SelectItemIndicator",uKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,...i}=n;return oKe(cKe,t).isSelected?ae.jsx(Pn.span,{"aria-hidden":!0,...i,ref:e}):null});uKe.displayName=cKe;var yse="SelectScrollUpButton",dKe=E.forwardRef((n,e)=>{const t=m1(yse,n.__scopeSelect),i=qfe(yse,n.__scopeSelect),[r,s]=E.useState(!1),o=gi(e,i.onScrollButtonChange);return es(()=>{if(t.viewport&&t.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=t.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[t.viewport,t.isPositioned]),r?ae.jsx(fKe,{...n,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=t;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});dKe.displayName=yse;var wse="SelectScrollDownButton",hKe=E.forwardRef((n,e)=>{const t=m1(wse,n.__scopeSelect),i=qfe(wse,n.__scopeSelect),[r,s]=E.useState(!1),o=gi(e,i.onScrollButtonChange);return es(()=>{if(t.viewport&&t.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)l.removeEventListener("scroll",a)}},[t.viewport,t.isPositioned]),r?ae.jsx(fKe,{...n,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=t;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});hKe.displayName=wse;var fKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,onAutoScroll:i,...r}=n,s=m1("SelectScrollButton",t),o=E.useRef(null),a=qV(t),l=E.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return E.useEffect(()=>()=>l(),[l]),es(()=>{a().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),ae.jsx(Pn.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:Kt(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(i,50))}),onPointerMove:Kt(r.onPointerMove,()=>{s.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(i,50))}),onPointerLeave:Kt(r.onPointerLeave,()=>{l()})})}),ATn="SelectSeparator",gKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,...i}=n;return ae.jsx(Pn.div,{"aria-hidden":!0,...i,ref:e})});gKe.displayName=ATn;var Cse="SelectArrow",NTn=E.forwardRef((n,e)=>{const{__scopeSelect:t,...i}=n,r=KV(t),s=p1(Cse,t),o=m1(Cse,t);return s.open&&o.position==="popper"?ae.jsx(qH,{...r,...i,ref:e}):null});NTn.displayName=Cse;function pKe(n){return n===""||n===void 0}var mKe=E.forwardRef((n,e)=>{const{value:t,...i}=n,r=E.useRef(null),s=gi(e,r),o=pTn(t);return E.useEffect(()=>{const a=r.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==t&&u){const d=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(d)}},[o,t]),ae.jsx(Ihe,{asChild:!0,children:ae.jsx("select",{...i,ref:s,defaultValue:t})})});mKe.displayName="BubbleSelect";function _Ke(n){const e=Ua(n),t=E.useRef(""),i=E.useRef(0),r=E.useCallback(o=>{const a=t.current+o;e(a),function l(c){t.current=c,window.clearTimeout(i.current),c!==""&&(i.current=window.setTimeout(()=>l(""),1e3))}(a)},[e]),s=E.useCallback(()=>{t.current="",window.clearTimeout(i.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(i.current),[]),[t,r,s]}function vKe(n,e,t){const r=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=t?n.indexOf(t):-1;let o=RTn(n,Math.max(s,0));r.length===1&&(o=o.filter(c=>c!==t));const l=o.find(c=>c.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==t?l:void 0}function RTn(n,e){return n.map((t,i)=>n[(e+i)%n.length])}var nVn=Uqe,iVn=qqe,rVn=Gqe,sVn=Yqe,oVn=Zqe,aVn=Xqe,lVn=tKe,cVn=iKe,uVn=sKe,dVn=aKe,hVn=lKe,fVn=uKe,gVn=dKe,pVn=hKe,mVn=gKe;const bKe=6048e5,PTn=864e5,fAe=Symbol.for("constructDateFrom");function Xa(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&fAe in n?n[fAe](e):n instanceof Date?new n.constructor(e):new Date(e)}function Es(n,e){return Xa(e||n,n)}function Kfe(n,e,t){const i=Es(n,t?.in);return isNaN(e)?Xa(n,NaN):(e&&i.setDate(i.getDate()+e),i)}function yKe(n,e,t){const i=Es(n,t?.in);if(isNaN(e))return Xa(n,NaN);if(!e)return i;const r=i.getDate(),s=Xa(n,i.getTime());s.setMonth(i.getMonth()+e+1,0);const o=s.getDate();return r>=o?s:(i.setFullYear(s.getFullYear(),s.getMonth(),r),i)}let OTn={};function eM(){return OTn}function zb(n,e){const t=eM(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,r=Es(n,e?.in),s=r.getDay(),o=(s=s.getTime()?i+1:t.getTime()>=a.getTime()?i:i-1}function gAe(n){const e=Es(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function zC(n,...e){const t=Xa.bind(null,n||e.find(i=>typeof i=="object"));return e.map(t)}function AL(n,e){const t=Es(n,e?.in);return t.setHours(0,0,0,0),t}function CKe(n,e,t){const[i,r]=zC(t?.in,n,e),s=AL(i),o=AL(r),a=+s-gAe(s),l=+o-gAe(o);return Math.round((a-l)/PTn)}function MTn(n,e){const t=wKe(n,e),i=Xa(n,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),yP(i)}function FTn(n,e,t){return Kfe(n,e*7,t)}function BTn(n,e,t){return yKe(n,e*12,t)}function $Tn(n,e){let t,i=e?.in;return n.forEach(r=>{!i&&typeof r=="object"&&(i=Xa.bind(null,r));const s=Es(r,i);(!t||t{!i&&typeof r=="object"&&(i=Xa.bind(null,r));const s=Es(r,i);(!t||t>s||isNaN(+s))&&(t=s)}),Xa(i,t||NaN)}function HTn(n,e,t){const[i,r]=zC(t?.in,n,e);return+AL(i)==+AL(r)}function xKe(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function VTn(n){return!(!xKe(n)&&typeof n!="number"||isNaN(+Es(n)))}function zTn(n,e,t){const[i,r]=zC(t?.in,n,e),s=i.getFullYear()-r.getFullYear(),o=i.getMonth()-r.getMonth();return s*12+o}function UTn(n,e){const t=Es(n,e?.in),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t}function jTn(n,e){const[t,i]=zC(n,e.start,e.end);return{start:t,end:i}}function qTn(n,e){const{start:t,end:i}=jTn(e?.in,n);let r=+t>+i;const s=r?+t:+i,o=r?i:t;o.setHours(0,0,0,0),o.setDate(1);let a=1;const l=[];for(;+o<=s;)l.push(Xa(t,o)),o.setMonth(o.getMonth()+a);return r?l.reverse():l}function KTn(n,e){const t=Es(n,e?.in);return t.setDate(1),t.setHours(0,0,0,0),t}function GTn(n,e){const t=Es(n,e?.in),i=t.getFullYear();return t.setFullYear(i+1,0,0),t.setHours(23,59,59,999),t}function SKe(n,e){const t=Es(n,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function kKe(n,e){const t=eM(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,r=Es(n,e?.in),s=r.getDay(),o=(s{let i;const r=ZTn[n];return typeof r=="string"?i=r:e===1?i=r.one:i=r.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function Vk(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const QTn={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},JTn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},eDn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},tDn={date:Vk({formats:QTn,defaultWidth:"full"}),time:Vk({formats:JTn,defaultWidth:"full"}),dateTime:Vk({formats:eDn,defaultWidth:"full"})},nDn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},iDn=(n,e,t,i)=>nDn[n];function Sp(n){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let r;if(i==="formatting"&&n.formattingValues){const o=n.defaultFormattingWidth||n.defaultWidth,a=t?.width?String(t.width):o;r=n.formattingValues[a]||n.formattingValues[o]}else{const o=n.defaultWidth,a=t?.width?String(t.width):n.defaultWidth;r=n.values[a]||n.values[o]}const s=n.argumentCallback?n.argumentCallback(e):e;return r[s]}}const rDn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},sDn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},oDn={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},aDn={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},lDn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},cDn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},uDn=(n,e)=>{const t=Number(n),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},dDn={ordinalNumber:uDn,era:Sp({values:rDn,defaultWidth:"wide"}),quarter:Sp({values:sDn,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Sp({values:oDn,defaultWidth:"wide"}),day:Sp({values:aDn,defaultWidth:"wide"}),dayPeriod:Sp({values:lDn,defaultWidth:"wide",formattingValues:cDn,defaultFormattingWidth:"wide"})};function kp(n){return(e,t={})=>{const i=t.width,r=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],s=e.match(r);if(!s)return null;const o=s[0],a=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?fDn(a,d=>d.test(o)):hDn(a,d=>d.test(o));let c;c=n.valueCallback?n.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;const u=e.slice(o.length);return{value:c,rest:u}}}function hDn(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function fDn(n,e){for(let t=0;t{const i=e.match(n.matchPattern);if(!i)return null;const r=i[0],s=e.match(n.parsePattern);if(!s)return null;let o=n.valueCallback?n.valueCallback(s[0]):s[0];o=t.valueCallback?t.valueCallback(o):o;const a=e.slice(r.length);return{value:o,rest:a}}}const gDn=/^(\d+)(th|st|nd|rd)?/i,pDn=/\d+/i,mDn={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},_Dn={any:[/^b/i,/^(a|c)/i]},vDn={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},bDn={any:[/1/i,/2/i,/3/i,/4/i]},yDn={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},wDn={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},CDn={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},xDn={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},SDn={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},kDn={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},EDn={ordinalNumber:EKe({matchPattern:gDn,parsePattern:pDn,valueCallback:n=>parseInt(n,10)}),era:kp({matchPatterns:mDn,defaultMatchWidth:"wide",parsePatterns:_Dn,defaultParseWidth:"any"}),quarter:kp({matchPatterns:vDn,defaultMatchWidth:"wide",parsePatterns:bDn,defaultParseWidth:"any",valueCallback:n=>n+1}),month:kp({matchPatterns:yDn,defaultMatchWidth:"wide",parsePatterns:wDn,defaultParseWidth:"any"}),day:kp({matchPatterns:CDn,defaultMatchWidth:"wide",parsePatterns:xDn,defaultParseWidth:"any"}),dayPeriod:kp({matchPatterns:SDn,defaultMatchWidth:"any",parsePatterns:kDn,defaultParseWidth:"any"})},Gfe={code:"en-US",formatDistance:XTn,formatLong:tDn,formatRelative:iDn,localize:dDn,match:EDn,options:{weekStartsOn:0,firstWeekContainsDate:1}};function LDn(n,e){const t=Es(n,e?.in);return CKe(t,SKe(t))+1}function LKe(n,e){const t=Es(n,e?.in),i=+yP(t)-+MTn(t);return Math.round(i/bKe)+1}function TKe(n,e){const t=Es(n,e?.in),i=t.getFullYear(),r=eM(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=Xa(e?.in||n,0);o.setFullYear(i+1,0,s),o.setHours(0,0,0,0);const a=zb(o,e),l=Xa(e?.in||n,0);l.setFullYear(i,0,s),l.setHours(0,0,0,0);const c=zb(l,e);return+t>=+a?i+1:+t>=+c?i:i-1}function TDn(n,e){const t=eM(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,r=TKe(n,e),s=Xa(e?.in||n,0);return s.setFullYear(r,0,i),s.setHours(0,0,0,0),zb(s,e)}function DKe(n,e){const t=Es(n,e?.in),i=+zb(t,e)-+TDn(t,e);return Math.round(i/bKe)+1}function gs(n,e){const t=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return t+i}const K0={y(n,e){const t=n.getFullYear(),i=t>0?t:1-t;return gs(e==="yy"?i%100:i,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):gs(t+1,2)},d(n,e){return gs(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(n,e){return gs(n.getHours()%12||12,e.length)},H(n,e){return gs(n.getHours(),e.length)},m(n,e){return gs(n.getMinutes(),e.length)},s(n,e){return gs(n.getSeconds(),e.length)},S(n,e){const t=e.length,i=n.getMilliseconds(),r=Math.trunc(i*Math.pow(10,t-3));return gs(r,e.length)}},jx={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},pAe={G:function(n,e,t){const i=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(i,{width:"abbreviated"});case"GGGGG":return t.era(i,{width:"narrow"});case"GGGG":default:return t.era(i,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const i=n.getFullYear(),r=i>0?i:1-i;return t.ordinalNumber(r,{unit:"year"})}return K0.y(n,e)},Y:function(n,e,t,i){const r=TKe(n,i),s=r>0?r:1-r;if(e==="YY"){const o=s%100;return gs(o,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):gs(s,e.length)},R:function(n,e){const t=wKe(n);return gs(t,e.length)},u:function(n,e){const t=n.getFullYear();return gs(t,e.length)},Q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return gs(i,2);case"Qo":return t.ordinalNumber(i,{unit:"quarter"});case"QQQ":return t.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return gs(i,2);case"qo":return t.ordinalNumber(i,{unit:"quarter"});case"qqq":return t.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,e,t){const i=n.getMonth();switch(e){case"M":case"MM":return K0.M(n,e);case"Mo":return t.ordinalNumber(i+1,{unit:"month"});case"MMM":return t.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(i,{width:"wide",context:"formatting"})}},L:function(n,e,t){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return gs(i+1,2);case"Lo":return t.ordinalNumber(i+1,{unit:"month"});case"LLL":return t.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(i,{width:"wide",context:"standalone"})}},w:function(n,e,t,i){const r=DKe(n,i);return e==="wo"?t.ordinalNumber(r,{unit:"week"}):gs(r,e.length)},I:function(n,e,t){const i=LKe(n);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):gs(i,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):K0.d(n,e)},D:function(n,e,t){const i=LDn(n);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):gs(i,e.length)},E:function(n,e,t){const i=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(i,{width:"short",context:"formatting"});case"EEEE":default:return t.day(i,{width:"wide",context:"formatting"})}},e:function(n,e,t,i){const r=n.getDay(),s=(r-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return gs(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(r,{width:"short",context:"formatting"});case"eeee":default:return t.day(r,{width:"wide",context:"formatting"})}},c:function(n,e,t,i){const r=n.getDay(),s=(r-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return gs(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(r,{width:"narrow",context:"standalone"});case"cccccc":return t.day(r,{width:"short",context:"standalone"});case"cccc":default:return t.day(r,{width:"wide",context:"standalone"})}},i:function(n,e,t){const i=n.getDay(),r=i===0?7:i;switch(e){case"i":return String(r);case"ii":return gs(r,e.length);case"io":return t.ordinalNumber(r,{unit:"day"});case"iii":return t.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(i,{width:"short",context:"formatting"});case"iiii":default:return t.day(i,{width:"wide",context:"formatting"})}},a:function(n,e,t){const r=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(n,e,t){const i=n.getHours();let r;switch(i===12?r=jx.noon:i===0?r=jx.midnight:r=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(n,e,t){const i=n.getHours();let r;switch(i>=17?r=jx.evening:i>=12?r=jx.afternoon:i>=4?r=jx.morning:r=jx.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return K0.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):K0.H(n,e)},K:function(n,e,t){const i=n.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):gs(i,e.length)},k:function(n,e,t){let i=n.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):gs(i,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):K0.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):K0.s(n,e)},S:function(n,e){return K0.S(n,e)},X:function(n,e,t){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return _Ae(i);case"XXXX":case"XX":return ry(i);case"XXXXX":case"XXX":default:return ry(i,":")}},x:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"x":return _Ae(i);case"xxxx":case"xx":return ry(i);case"xxxxx":case"xxx":default:return ry(i,":")}},O:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+mAe(i,":");case"OOOO":default:return"GMT"+ry(i,":")}},z:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+mAe(i,":");case"zzzz":default:return"GMT"+ry(i,":")}},t:function(n,e,t){const i=Math.trunc(+n/1e3);return gs(i,e.length)},T:function(n,e,t){return gs(+n,e.length)}};function mAe(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=Math.trunc(i/60),s=i%60;return s===0?t+String(r):t+String(r)+e+gs(s,2)}function _Ae(n,e){return n%60===0?(n>0?"-":"+")+gs(Math.abs(n)/60,2):ry(n,e)}function ry(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=gs(Math.trunc(i/60),2),s=gs(i%60,2);return t+r+e+s}const vAe=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},IKe=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},DDn=(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],i=t[1],r=t[2];if(!r)return vAe(n,e);let s;switch(i){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",vAe(i,e)).replace("{{time}}",IKe(r,e))},IDn={p:IKe,P:DDn},ADn=/^D+$/,NDn=/^Y+$/,RDn=["D","DD","YY","YYYY"];function PDn(n){return ADn.test(n)}function ODn(n){return NDn.test(n)}function MDn(n,e,t){const i=FDn(n,e,t);if(console.warn(i),RDn.includes(n))throw new RangeError(i)}function FDn(n,e,t){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const BDn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$Dn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,WDn=/^'([^]*?)'?$/,HDn=/''/g,VDn=/[a-zA-Z]/;function zDn(n,e,t){const i=eM(),r=t?.locale??i.locale??Gfe,s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,a=Es(n,t?.in);if(!VTn(a))throw new RangeError("Invalid time value");let l=e.match($Dn).map(u=>{const d=u[0];if(d==="p"||d==="P"){const h=IDn[d];return h(u,r.formatLong)}return u}).join("").match(BDn).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:UDn(u)};if(pAe[d])return{isToken:!0,value:u};if(d.match(VDn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});r.localize.preprocessor&&(l=r.localize.preprocessor(a,l));const c={firstWeekContainsDate:s,weekStartsOn:o,locale:r};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!t?.useAdditionalWeekYearTokens&&ODn(d)||!t?.useAdditionalDayOfYearTokens&&PDn(d))&&MDn(d,e,String(n));const h=pAe[d[0]];return h(a,d,r.localize,c)}).join("")}function UDn(n){const e=n.match(WDn);return e?e[1].replace(HDn,"'"):n}function jDn(n,e){const t=Es(n,e?.in),i=t.getFullYear(),r=t.getMonth(),s=Xa(t,0);return s.setFullYear(i,r+1,0),s.setHours(0,0,0,0),s.getDate()}function qDn(n,e){return Es(n,e?.in).getMonth()}function KDn(n,e){return Es(n,e?.in).getFullYear()}function GDn(n,e){return+Es(n)>+Es(e)}function YDn(n,e){return+Es(n)<+Es(e)}function ZDn(n,e,t){const[i,r]=zC(t?.in,n,e);return+zb(i,t)==+zb(r,t)}function XDn(n,e,t){const[i,r]=zC(t?.in,n,e);return i.getFullYear()===r.getFullYear()&&i.getMonth()===r.getMonth()}function QDn(n,e,t){const[i,r]=zC(t?.in,n,e);return i.getFullYear()===r.getFullYear()}function _Vn(n,e,t){return Kfe(n,-e,t)}function JDn(n,e,t){const i=Es(n,t?.in),r=i.getFullYear(),s=i.getDate(),o=Xa(n,0);o.setFullYear(r,e,15),o.setHours(0,0,0,0);const a=jDn(o);return i.setMonth(e,Math.min(s,a)),i}function eIn(n,e,t){const i=Es(n,t?.in);return isNaN(+i)?Xa(n,NaN):(i.setFullYear(e),i)}function vVn(n){return AL(Date.now(),n)}const tIn={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},nIn=(n,e,t)=>{let i;const r=tIn[n];return typeof r=="string"?i=r:e===1?i=r.one:i=r.other.replace("{{count}}",String(e)),t?.addSuffix?t.comparison&&t.comparison>0?i+"内":i+"前":i},iIn={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},rIn={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},sIn={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},oIn={date:Vk({formats:iIn,defaultWidth:"full"}),time:Vk({formats:rIn,defaultWidth:"full"}),dateTime:Vk({formats:sIn,defaultWidth:"full"})};function bAe(n,e,t){const i="eeee p";return ZDn(n,e,t)?i:n.getTime()>e.getTime()?"'下个'"+i:"'上个'"+i}const aIn={lastWeek:bAe,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:bAe,other:"PP p"},lIn=(n,e,t,i)=>{const r=aIn[n];return typeof r=="function"?r(e,t,i):r},cIn={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},uIn={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},dIn={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},hIn={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},fIn={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},gIn={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},pIn=(n,e)=>{const t=Number(n);switch(e?.unit){case"date":return t.toString()+"日";case"hour":return t.toString()+"时";case"minute":return t.toString()+"分";case"second":return t.toString()+"秒";default:return"第 "+t.toString()}},mIn={ordinalNumber:pIn,era:Sp({values:cIn,defaultWidth:"wide"}),quarter:Sp({values:uIn,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Sp({values:dIn,defaultWidth:"wide"}),day:Sp({values:hIn,defaultWidth:"wide"}),dayPeriod:Sp({values:fIn,defaultWidth:"wide",formattingValues:gIn,defaultFormattingWidth:"wide"})},_In=/^(第\s*)?\d+(日|时|分|秒)?/i,vIn=/\d+/i,bIn={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},yIn={any:[/^(前)/i,/^(公元)/i]},wIn={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},CIn={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},xIn={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},SIn={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},kIn={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},EIn={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},LIn={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},TIn={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},DIn={ordinalNumber:EKe({matchPattern:_In,parsePattern:vIn,valueCallback:n=>parseInt(n,10)}),era:kp({matchPatterns:bIn,defaultMatchWidth:"wide",parsePatterns:yIn,defaultParseWidth:"any"}),quarter:kp({matchPatterns:wIn,defaultMatchWidth:"wide",parsePatterns:CIn,defaultParseWidth:"any",valueCallback:n=>n+1}),month:kp({matchPatterns:xIn,defaultMatchWidth:"wide",parsePatterns:SIn,defaultParseWidth:"any"}),day:kp({matchPatterns:kIn,defaultMatchWidth:"wide",parsePatterns:EIn,defaultParseWidth:"any"}),dayPeriod:kp({matchPatterns:LIn,defaultMatchWidth:"any",parsePatterns:TIn,defaultParseWidth:"any"})},bVn={code:"zh-CN",formatDistance:nIn,formatLong:oIn,formatRelative:lIn,localize:mIn,match:DIn,options:{weekStartsOn:1,firstWeekContainsDate:4}},IIn={},tI={};function gA(n,e){try{const i=(IIn[n]||=new Intl.DateTimeFormat("en-GB",{timeZone:n,hour:"numeric",timeZoneName:"longOffset"}).format)(e).split("GMT")[1]||"";return i in tI?tI[i]:yAe(i,i.split(":"))}catch{if(n in tI)return tI[n];const t=n?.match(AIn);return t?yAe(n,t.slice(1)):NaN}}const AIn=/([+-]\d\d):?(\d\d)?/;function yAe(n,e){const t=+e[0],i=+(e[1]||0);return tI[n]=t>0?t*60+i:t*60-i}class Np extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(gA(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),AKe(this),xse(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new Np(...t,e):new Np(Date.now(),e)}withTimeZone(e){return new Np(+this,e)}getTimezoneOffset(){return-gA(this.timeZone,this)}setTime(e){return Date.prototype.setTime.apply(this,arguments),xse(this),+this}[Symbol.for("constructDateFrom")](e){return new Np(+new Date(e),this.timeZone)}}const wAe=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!wAe.test(n))return;const e=n.replace(wAe,"$1UTC");Np.prototype[e]&&(n.startsWith("get")?Np.prototype[n]=function(){return this.internal[e]()}:(Np.prototype[n]=function(){return Date.prototype[e].apply(this.internal,arguments),NIn(this),+this},Np.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),xse(this),+this}))});function xse(n){n.internal.setTime(+n),n.internal.setUTCMinutes(n.internal.getUTCMinutes()-n.getTimezoneOffset())}function NIn(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),AKe(n)}function AKe(n){const e=gA(n.timeZone,n),t=new Date(+n);t.setUTCHours(t.getUTCHours()-1);const i=-new Date(+n).getTimezoneOffset(),r=-new Date(+t).getTimezoneOffset(),s=i-r,o=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();s&&o&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+s);const a=i-e;a&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+a);const l=gA(n.timeZone,n),u=-new Date(+n).getTimezoneOffset()-l,d=l!==e,h=u-a;if(d&&h){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+h);const f=gA(n.timeZone,n),g=l-f;g&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+g),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+g))}}class ac extends Np{static tz(e,...t){return t.length?new ac(...t,e):new ac(Date.now(),e)}toISOString(){const[e,t,i]=this.tzComponents(),r=`${e}${t}:${i}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,i,r]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${i} ${t} ${r}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,i,r]=this.tzComponents();return`${e} GMT${t}${i}${r} (${RIn(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",i=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),r=String(Math.abs(e)%60).padStart(2,"0");return[t,i,r]}withTimeZone(e){return new ac(+this,e)}[Symbol.for("constructDateFrom")](e){return new ac(+new Date(e),this.timeZone)}}function RIn(n,e){return new Intl.DateTimeFormat("en-GB",{timeZone:n,timeZoneName:"long"}).format(e).slice(12)}var Fn;(function(n){n.Root="root",n.Chevron="chevron",n.Day="day",n.DayButton="day_button",n.CaptionLabel="caption_label",n.Dropdowns="dropdowns",n.Dropdown="dropdown",n.DropdownRoot="dropdown_root",n.Footer="footer",n.MonthGrid="month_grid",n.MonthCaption="month_caption",n.MonthsDropdown="months_dropdown",n.Month="month",n.Months="months",n.Nav="nav",n.NextMonthButton="button_next",n.PreviousMonthButton="button_previous",n.Week="week",n.Weeks="weeks",n.Weekday="weekday",n.Weekdays="weekdays",n.WeekNumber="week_number",n.WeekNumberHeader="week_number_header",n.YearsDropdown="years_dropdown"})(Fn||(Fn={}));var vo;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(vo||(vo={}));var lg;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(lg||(lg={}));var Dd;(function(n){n.weeks_before_enter="weeks_before_enter",n.weeks_before_exit="weeks_before_exit",n.weeks_after_enter="weeks_after_enter",n.weeks_after_exit="weeks_after_exit",n.caption_after_enter="caption_after_enter",n.caption_after_exit="caption_after_exit",n.caption_before_enter="caption_before_enter",n.caption_before_exit="caption_before_exit"})(Dd||(Dd={}));const CAe=5,PIn=4;function OIn(n,e){const t=e.startOfMonth(n),i=t.getDay()>0?t.getDay():7,r=e.addDays(n,-i+1),s=e.addDays(r,CAe*7-1);return e.getMonth(n)===e.getMonth(s)?CAe:PIn}function NKe(n,e){const t=e.startOfMonth(n),i=t.getDay();return i===1?t:i===0?e.addDays(t,-1*6):e.addDays(t,-1*(i-1))}function MIn(n,e){const t=NKe(n,e),i=OIn(n,e);return e.addDays(t,i*7-1)}class E0{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ac.tz(this.options.timeZone):new this.Date,this.newDate=(i,r,s)=>this.overrides?.newDate?this.overrides.newDate(i,r,s):this.options.timeZone?new ac(i,r,s,this.options.timeZone):new Date(i,r,s),this.addDays=(i,r)=>this.overrides?.addDays?this.overrides.addDays(i,r):Kfe(i,r),this.addMonths=(i,r)=>this.overrides?.addMonths?this.overrides.addMonths(i,r):yKe(i,r),this.addWeeks=(i,r)=>this.overrides?.addWeeks?this.overrides.addWeeks(i,r):FTn(i,r),this.addYears=(i,r)=>this.overrides?.addYears?this.overrides.addYears(i,r):BTn(i,r),this.differenceInCalendarDays=(i,r)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(i,r):CKe(i,r),this.differenceInCalendarMonths=(i,r)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(i,r):zTn(i,r),this.eachMonthOfInterval=i=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(i):qTn(i),this.endOfBroadcastWeek=i=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(i):MIn(i,this),this.endOfISOWeek=i=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(i):YTn(i),this.endOfMonth=i=>this.overrides?.endOfMonth?this.overrides.endOfMonth(i):UTn(i),this.endOfWeek=(i,r)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(i,r):kKe(i,this.options),this.endOfYear=i=>this.overrides?.endOfYear?this.overrides.endOfYear(i):GTn(i),this.format=(i,r,s)=>{const o=this.overrides?.format?this.overrides.format(i,r,this.options):zDn(i,r,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=i=>this.overrides?.getISOWeek?this.overrides.getISOWeek(i):LKe(i),this.getMonth=(i,r)=>this.overrides?.getMonth?this.overrides.getMonth(i,this.options):qDn(i,this.options),this.getYear=(i,r)=>this.overrides?.getYear?this.overrides.getYear(i,this.options):KDn(i,this.options),this.getWeek=(i,r)=>this.overrides?.getWeek?this.overrides.getWeek(i,this.options):DKe(i,this.options),this.isAfter=(i,r)=>this.overrides?.isAfter?this.overrides.isAfter(i,r):GDn(i,r),this.isBefore=(i,r)=>this.overrides?.isBefore?this.overrides.isBefore(i,r):YDn(i,r),this.isDate=i=>this.overrides?.isDate?this.overrides.isDate(i):xKe(i),this.isSameDay=(i,r)=>this.overrides?.isSameDay?this.overrides.isSameDay(i,r):HTn(i,r),this.isSameMonth=(i,r)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(i,r):XDn(i,r),this.isSameYear=(i,r)=>this.overrides?.isSameYear?this.overrides.isSameYear(i,r):QDn(i,r),this.max=i=>this.overrides?.max?this.overrides.max(i):$Tn(i),this.min=i=>this.overrides?.min?this.overrides.min(i):WTn(i),this.setMonth=(i,r)=>this.overrides?.setMonth?this.overrides.setMonth(i,r):JDn(i,r),this.setYear=(i,r)=>this.overrides?.setYear?this.overrides.setYear(i,r):eIn(i,r),this.startOfBroadcastWeek=(i,r)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(i,this):NKe(i,this),this.startOfDay=i=>this.overrides?.startOfDay?this.overrides.startOfDay(i):AL(i),this.startOfISOWeek=i=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(i):yP(i),this.startOfMonth=i=>this.overrides?.startOfMonth?this.overrides.startOfMonth(i):KTn(i),this.startOfWeek=(i,r)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(i,this.options):zb(i,this.options),this.startOfYear=i=>this.overrides?.startOfYear?this.overrides.startOfYear(i):SKe(i),this.options={locale:Gfe,...e},this.overrides=t}getDigitMap(){const{numerals:e="latn"}=this.options,t=new Intl.NumberFormat("en-US",{numberingSystem:e}),i={};for(let r=0;r<10;r++)i[r.toString()]=t.format(r);return i}replaceDigits(e){const t=this.getDigitMap();return e.replace(/\d/g,i=>t[i]||i)}formatNumber(e){return this.replaceDigits(e.toString())}}const pm=new E0;class RKe{constructor(e,t,i=pm){this.date=e,this.displayMonth=t,this.outside=!!(t&&!i.isSameMonth(e,t)),this.dateLib=i}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class FIn{constructor(e,t){this.date=e,this.weeks=t}}class BIn{constructor(e,t){this.days=t,this.weekNumber=e}}function C_(n,e,t=!1,i=pm){let{from:r,to:s}=n;const{differenceInCalendarDays:o,isSameDay:a}=i;return r&&s?(o(s,r)<0&&([r,s]=[s,r]),o(e,r)>=(t?1:0)&&o(s,e)>=(t?1:0)):!t&&s?a(s,e):!t&&r?a(r,e):!1}function PKe(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function Yfe(n){return!!(n&&typeof n=="object"&&"from"in n)}function OKe(n){return!!(n&&typeof n=="object"&&"after"in n)}function MKe(n){return!!(n&&typeof n=="object"&&"before"in n)}function FKe(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function BKe(n,e){return Array.isArray(n)&&n.every(e.isDate)}function x_(n,e,t=pm){const i=Array.isArray(e)?e:[e],{isSameDay:r,differenceInCalendarDays:s,isAfter:o}=t;return i.some(a=>{if(typeof a=="boolean")return a;if(t.isDate(a))return r(n,a);if(BKe(a,t))return a.includes(n);if(Yfe(a))return C_(a,n,!1,t);if(FKe(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(n.getDay()):a.dayOfWeek===n.getDay();if(PKe(a)){const l=s(a.before,n),c=s(a.after,n),u=l>0,d=c<0;return o(a.before,a.after)?d&&u:u||d}return OKe(a)?s(n,a.after)>0:MKe(a)?s(a.before,n)>0:typeof a=="function"?a(n):!1})}function $In(n,e,t,i,r){const{disabled:s,hidden:o,modifiers:a,showOutsideDays:l,broadcastCalendar:c,today:u}=e,{isSameDay:d,isSameMonth:h,startOfMonth:f,isBefore:g,endOfMonth:p,isAfter:m}=r,_=t&&f(t),v=i&&p(i),y={[vo.focused]:[],[vo.outside]:[],[vo.disabled]:[],[vo.hidden]:[],[vo.today]:[]},C={};for(const x of n){const{date:k,displayMonth:L}=x,D=!!(L&&!h(k,L)),I=!!(_&&g(k,_)),O=!!(v&&m(k,v)),M=!!(s&&x_(k,s,r)),B=!!(o&&x_(k,o,r))||I||O||!c&&!l&&D||c&&l===!1&&D,G=d(k,u??r.today());D&&y.outside.push(x),M&&y.disabled.push(x),B&&y.hidden.push(x),G&&y.today.push(x),a&&Object.keys(a).forEach(W=>{const z=a?.[W];z&&x_(k,z,r)&&(C[W]?C[W].push(x):C[W]=[x])})}return x=>{const k={[vo.focused]:!1,[vo.disabled]:!1,[vo.hidden]:!1,[vo.outside]:!1,[vo.today]:!1},L={};for(const D in y){const I=y[D];k[D]=I.some(O=>O===x)}for(const D in C)L[D]=C[D].some(I=>I===x);return{...k,...L}}}function WIn(n,e,t={}){return Object.entries(n).filter(([,r])=>r===!0).reduce((r,[s])=>(t[s]?r.push(t[s]):e[vo[s]]?r.push(e[vo[s]]):e[lg[s]]&&r.push(e[lg[s]]),r),[e[Fn.Day]])}function HIn(n){return U.createElement("button",{...n})}function VIn(n){return U.createElement("span",{...n})}function zIn(n){const{size:e=24,orientation:t="left",className:i}=n;return U.createElement("svg",{className:i,width:e,height:e,viewBox:"0 0 24 24"},t==="up"&&U.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),t==="down"&&U.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),t==="left"&&U.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),t==="right"&&U.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function UIn(n){const{day:e,modifiers:t,...i}=n;return U.createElement("td",{...i})}function jIn(n){const{day:e,modifiers:t,...i}=n,r=U.useRef(null);return U.useEffect(()=>{t.focused&&r.current?.focus()},[t.focused]),U.createElement("button",{ref:r,...i})}function qIn(n){const{options:e,className:t,components:i,classNames:r,...s}=n,o=[r[Fn.Dropdown],t].join(" "),a=e?.find(({value:l})=>l===s.value);return U.createElement("span",{"data-disabled":s.disabled,className:r[Fn.DropdownRoot]},U.createElement(i.Select,{className:o,...s},e?.map(({value:l,label:c,disabled:u})=>U.createElement(i.Option,{key:l,value:l,disabled:u},c))),U.createElement("span",{className:r[Fn.CaptionLabel],"aria-hidden":!0},a?.label,U.createElement(i.Chevron,{orientation:"down",size:18,className:r[Fn.Chevron]})))}function KIn(n){return U.createElement("div",{...n})}function GIn(n){return U.createElement("div",{...n})}function YIn(n){const{calendarMonth:e,displayIndex:t,...i}=n;return U.createElement("div",{...i},n.children)}function ZIn(n){const{calendarMonth:e,displayIndex:t,...i}=n;return U.createElement("div",{...i})}function XIn(n){return U.createElement("table",{...n})}function QIn(n){return U.createElement("div",{...n})}const $Ke=E.createContext(void 0);function tM(){const n=E.useContext($Ke);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function JIn(n){const{components:e}=tM();return U.createElement(e.Dropdown,{...n})}function eAn(n){const{onPreviousClick:e,onNextClick:t,previousMonth:i,nextMonth:r,...s}=n,{components:o,classNames:a,labels:{labelPrevious:l,labelNext:c}}=tM(),u=E.useCallback(h=>{r&&t?.(h)},[r,t]),d=E.useCallback(h=>{i&&e?.(h)},[i,e]);return U.createElement("nav",{...s},U.createElement(o.PreviousMonthButton,{type:"button",className:a[Fn.PreviousMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:d},U.createElement(o.Chevron,{disabled:i?void 0:!0,className:a[Fn.Chevron],orientation:"left"})),U.createElement(o.NextMonthButton,{type:"button",className:a[Fn.NextMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:u},U.createElement(o.Chevron,{disabled:r?void 0:!0,orientation:"right",className:a[Fn.Chevron]})))}function tAn(n){const{components:e}=tM();return U.createElement(e.Button,{...n})}function nAn(n){return U.createElement("option",{...n})}function iAn(n){const{components:e}=tM();return U.createElement(e.Button,{...n})}function rAn(n){const{rootRef:e,...t}=n;return U.createElement("div",{...t,ref:e})}function sAn(n){return U.createElement("select",{...n})}function oAn(n){const{week:e,...t}=n;return U.createElement("tr",{...t})}function aAn(n){return U.createElement("th",{...n})}function lAn(n){return U.createElement("thead",{"aria-hidden":!0},U.createElement("tr",{...n}))}function cAn(n){const{week:e,...t}=n;return U.createElement("th",{...t})}function uAn(n){return U.createElement("th",{...n})}function dAn(n){return U.createElement("tbody",{...n})}function hAn(n){const{components:e}=tM();return U.createElement(e.Dropdown,{...n})}const fAn=Object.freeze(Object.defineProperty({__proto__:null,Button:HIn,CaptionLabel:VIn,Chevron:zIn,Day:UIn,DayButton:jIn,Dropdown:qIn,DropdownNav:KIn,Footer:GIn,Month:YIn,MonthCaption:ZIn,MonthGrid:XIn,Months:QIn,MonthsDropdown:JIn,Nav:eAn,NextMonthButton:tAn,Option:nAn,PreviousMonthButton:iAn,Root:rAn,Select:sAn,Week:oAn,WeekNumber:cAn,WeekNumberHeader:uAn,Weekday:aAn,Weekdays:lAn,Weeks:dAn,YearsDropdown:hAn},Symbol.toStringTag,{value:"Module"}));function gAn(n){return{...fAn,...n}}function pAn(n){const e={"data-mode":n.mode??void 0,"data-required":"required"in n?n.required:void 0,"data-multiple-months":n.numberOfMonths&&n.numberOfMonths>1||void 0,"data-week-numbers":n.showWeekNumber||void 0,"data-broadcast-calendar":n.broadcastCalendar||void 0,"data-nav-layout":n.navLayout||void 0};return Object.entries(n).forEach(([t,i])=>{t.startsWith("data-")&&(e[t]=i)}),e}function mAn(){const n={};for(const e in Fn)n[Fn[e]]=`rdp-${Fn[e]}`;for(const e in vo)n[vo[e]]=`rdp-${vo[e]}`;for(const e in lg)n[lg[e]]=`rdp-${lg[e]}`;for(const e in Dd)n[Dd[e]]=`rdp-${Dd[e]}`;return n}function WKe(n,e,t){return(t??new E0(e)).format(n,"LLLL y")}const _An=WKe;function vAn(n,e,t){return(t??new E0(e)).format(n,"d")}function bAn(n,e=pm){return e.format(n,"LLLL")}function yAn(n,e=pm){return n<10?e.formatNumber(`0${n.toLocaleString()}`):e.formatNumber(`${n.toLocaleString()}`)}function wAn(){return""}function CAn(n,e,t){return(t??new E0(e)).format(n,"cccccc")}function HKe(n,e=pm){return e.format(n,"yyyy")}const xAn=HKe,SAn=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:WKe,formatDay:vAn,formatMonthCaption:_An,formatMonthDropdown:bAn,formatWeekNumber:yAn,formatWeekNumberHeader:wAn,formatWeekdayName:CAn,formatYearCaption:xAn,formatYearDropdown:HKe},Symbol.toStringTag,{value:"Module"}));function kAn(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...SAn,...n}}function EAn(n,e,t,i,r){const{startOfMonth:s,startOfYear:o,endOfYear:a,eachMonthOfInterval:l,getMonth:c}=r;return l({start:o(n),end:a(n)}).map(h=>{const f=i.formatMonthDropdown(h,r),g=c(h),p=e&&hs(t)||!1;return{value:g,label:f,disabled:p}})}function LAn(n,e={},t={}){let i={...e?.[Fn.Day]};return Object.entries(n).filter(([,r])=>r===!0).forEach(([r])=>{i={...i,...t?.[r]}}),i}function TAn(n,e,t){const i=n.today(),r=e?n.startOfISOWeek(i):n.startOfWeek(i),s=[];for(let o=0;o<7;o++){const a=n.addDays(r,o);s.push(a)}return s}function DAn(n,e,t,i){if(!n||!e)return;const{startOfYear:r,endOfYear:s,addYears:o,getYear:a,isBefore:l,isSameYear:c}=i,u=r(n),d=s(e),h=[];let f=u;for(;l(f,d)||c(f,d);)h.push(f),f=o(f,1);return h.map(g=>{const p=t.formatYearDropdown(g,i);return{value:a(g),label:p,disabled:!1}})}function VKe(n,e,t){return(t??new E0(e)).format(n,"LLLL y")}const IAn=VKe;function AAn(n,e,t,i){let r=(i??new E0(t)).format(n,"PPPP");return e?.today&&(r=`Today, ${r}`),r}function zKe(n,e,t,i){let r=(i??new E0(t)).format(n,"PPPP");return e.today&&(r=`Today, ${r}`),e.selected&&(r=`${r}, selected`),r}const NAn=zKe;function RAn(){return""}function PAn(n){return"Choose the Month"}function OAn(n){return"Go to the Next Month"}function MAn(n){return"Go to the Previous Month"}function FAn(n,e,t){return(t??new E0(e)).format(n,"cccc")}function BAn(n,e){return`Week ${n}`}function $An(n){return"Week Number"}function WAn(n){return"Choose the Year"}const HAn=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:IAn,labelDay:NAn,labelDayButton:zKe,labelGrid:VKe,labelGridcell:AAn,labelMonthDropdown:PAn,labelNav:RAn,labelNext:OAn,labelPrevious:MAn,labelWeekNumber:BAn,labelWeekNumberHeader:$An,labelWeekday:FAn,labelYearDropdown:WAn},Symbol.toStringTag,{value:"Module"})),nM=n=>n instanceof HTMLElement?n:null,dG=n=>[...n.querySelectorAll("[data-animated-month]")??[]],VAn=n=>nM(n.querySelector("[data-animated-month]")),hG=n=>nM(n.querySelector("[data-animated-caption]")),fG=n=>nM(n.querySelector("[data-animated-weeks]")),zAn=n=>nM(n.querySelector("[data-animated-nav]")),UAn=n=>nM(n.querySelector("[data-animated-weekdays]"));function jAn(n,e,{classNames:t,months:i,focused:r,dateLib:s}){const o=E.useRef(null),a=E.useRef(i),l=E.useRef(!1);E.useLayoutEffect(()=>{const c=a.current;if(a.current=i,!e||!n.current||!(n.current instanceof HTMLElement)||i.length===0||c.length===0||i.length!==c.length)return;const u=s.isSameMonth(i[0].date,c[0].date),d=s.isAfter(i[0].date,c[0].date),h=d?t[Dd.caption_after_enter]:t[Dd.caption_before_enter],f=d?t[Dd.weeks_after_enter]:t[Dd.weeks_before_enter],g=o.current,p=n.current.cloneNode(!0);if(p instanceof HTMLElement?(dG(p).forEach(y=>{if(!(y instanceof HTMLElement))return;const C=VAn(y);C&&y.contains(C)&&y.removeChild(C);const x=hG(y);x&&x.classList.remove(h);const k=fG(y);k&&k.classList.remove(f)}),o.current=p):o.current=null,l.current||u||r)return;const m=g instanceof HTMLElement?dG(g):[],_=dG(n.current);if(_.every(v=>v instanceof HTMLElement)&&m&&m.every(v=>v instanceof HTMLElement)){l.current=!0,n.current.style.isolation="isolate";const v=zAn(n.current);v&&(v.style.zIndex="1"),_.forEach((y,C)=>{const x=m[C];if(!x)return;y.style.position="relative",y.style.overflow="hidden";const k=hG(y);k&&k.classList.add(h);const L=fG(y);L&&L.classList.add(f);const D=()=>{l.current=!1,n.current&&(n.current.style.isolation=""),v&&(v.style.zIndex=""),k&&k.classList.remove(h),L&&L.classList.remove(f),y.style.position="",y.style.overflow="",y.contains(x)&&y.removeChild(x)};x.style.pointerEvents="none",x.style.position="absolute",x.style.overflow="hidden",x.setAttribute("aria-hidden","true");const I=UAn(x);I&&(I.style.opacity="0");const O=hG(x);O&&(O.classList.add(d?t[Dd.caption_before_exit]:t[Dd.caption_after_exit]),O.addEventListener("animationend",D));const M=fG(x);M&&M.classList.add(d?t[Dd.weeks_before_exit]:t[Dd.weeks_after_exit]),y.insertBefore(x,y.firstChild)})}})}function qAn(n,e,t,i){const r=n[0],s=n[n.length-1],{ISOWeek:o,fixedWeeks:a,broadcastCalendar:l}=t??{},{addDays:c,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:h,endOfISOWeek:f,endOfMonth:g,endOfWeek:p,isAfter:m,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=i,C=l?_(r,i):o?v(r):y(r),x=l?h(s):o?f(g(s)):p(g(s)),k=u(x,C),L=d(s,r)+1,D=[];for(let M=0;M<=k;M++){const B=c(C,M);if(e&&m(B,e))break;D.push(B)}const O=(l?35:42)*L;if(a&&D.length{const r=i.weeks.reduce((s,o)=>[...s,...o.days],e);return[...t,...r]},e)}function GAn(n,e,t,i){const{numberOfMonths:r=1}=t,s=[];for(let o=0;oe)break;s.push(a)}return s}function xAe(n,e,t,i){const{month:r,defaultMonth:s,today:o=i.today(),numberOfMonths:a=1}=n;let l=r||s||o;const{differenceInCalendarMonths:c,addMonths:u,startOfMonth:d}=i;if(t&&c(t,l){const _=t.broadcastCalendar?d(m,i):t.ISOWeek?h(m):f(m),v=t.broadcastCalendar?s(m):t.ISOWeek?o(a(m)):l(a(m)),y=e.filter(L=>L>=_&&L<=v),C=t.broadcastCalendar?35:42;if(t.fixedWeeks&&y.length{const I=C-y.length;return D>v&&D<=r(v,I)});y.push(...L)}const x=y.reduce((L,D)=>{const I=t.ISOWeek?c(D):u(D),O=L.find(B=>B.weekNumber===I),M=new RKe(D,m,i);return O?O.days.push(M):L.push(new BIn(I,[M])),L},[]),k=new FIn(m,x);return p.push(k),p},[]);return t.reverseMonths?g.reverse():g}function ZAn(n,e){let{startMonth:t,endMonth:i}=n;const{startOfYear:r,startOfDay:s,startOfMonth:o,endOfMonth:a,addYears:l,endOfYear:c,newDate:u,today:d}=e,{fromYear:h,toYear:f,fromMonth:g,toMonth:p}=n;!t&&g&&(t=g),!t&&h&&(t=e.newDate(h,0,1)),!i&&p&&(i=p),!i&&f&&(i=u(f,11,31));const m=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return t?t=o(t):h?t=u(h,0,1):!t&&m&&(t=r(l(n.today??d(),-100))),i?i=a(i):f?i=u(f,11,31):!i&&m&&(i=c(n.today??d())),[t&&s(t),i&&s(i)]}function XAn(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:r,numberOfMonths:s=1}=t,{startOfMonth:o,addMonths:a,differenceInCalendarMonths:l}=i,c=r?s:1,u=o(n);if(!e)return a(u,c);if(!(l(e,n)[...t,...i.weeks],e)}function GV(n,e){const[t,i]=E.useState(n);return[e===void 0?t:e,i]}function eNn(n,e){const[t,i]=ZAn(n,e),{startOfMonth:r,endOfMonth:s}=e,o=xAe(n,t,i,e),[a,l]=GV(o,n.month?o:void 0);E.useEffect(()=>{const k=xAe(n,t,i,e);l(k)},[n.timeZone]);const c=GAn(a,i,n,e),u=qAn(c,n.endMonth?s(n.endMonth):void 0,n,e),d=YAn(c,u,n,e),h=JAn(d),f=KAn(d),g=QAn(a,t,n,e),p=XAn(a,i,n,e),{disableNavigation:m,onMonthChange:_}=n,v=k=>h.some(L=>L.days.some(D=>D.isEqualTo(k))),y=k=>{if(m)return;let L=r(k);t&&Lr(i)&&(L=r(i)),l(L),_?.(L)};return{months:d,weeks:h,days:f,navStart:t,navEnd:i,previousMonth:g,nextMonth:p,goToMonth:y,goToDay:k=>{v(k)||y(k.date)}}}var lp;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(lp||(lp={}));function SAe(n){return!n[vo.disabled]&&!n[vo.hidden]&&!n[vo.outside]}function tNn(n,e,t,i){let r,s=-1;for(const o of n){const a=e(o);SAe(a)&&(a[vo.focused]&&sSAe(e(o)))),r}function nNn(n,e,t,i,r,s,o){const{ISOWeek:a,broadcastCalendar:l}=s,{addDays:c,addMonths:u,addWeeks:d,addYears:h,endOfBroadcastWeek:f,endOfISOWeek:g,endOfWeek:p,max:m,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:C}=o;let k={day:c,week:d,month:u,year:h,startOfWeek:L=>l?v(L,o):a?y(L):C(L),endOfWeek:L=>l?f(L):a?g(L):p(L)}[n](t,e==="after"?1:-1);return e==="before"&&i?k=m([i,k]):e==="after"&&r&&(k=_([r,k])),k}function UKe(n,e,t,i,r,s,o,a=0){if(a>365)return;const l=nNn(n,e,t.date,i,r,s,o),c=!!(s.disabled&&x_(l,s.disabled,o)),u=!!(s.hidden&&x_(l,s.hidden,o)),d=l,h=new RKe(l,d,o);return!c&&!u?h:UKe(n,e,h,i,r,s,o,a+1)}function iNn(n,e,t,i,r){const{autoFocus:s}=n,[o,a]=E.useState(),l=tNn(e.days,t,i||(()=>!1),o),[c,u]=E.useState(s?l:void 0);return{isFocusTarget:p=>!!l?.isEqualTo(p),setFocused:u,focused:c,blur:()=>{a(c),u(void 0)},moveFocus:(p,m)=>{if(!c)return;const _=UKe(p,m,c,e.navStart,e.navEnd,n,r);_&&(e.goToDay(_),u(_))}}}function rNn(n,e){const{selected:t,required:i,onSelect:r}=n,[s,o]=GV(t,r?t:void 0),a=r?t:s,{isSameDay:l}=e,c=f=>a?.some(g=>l(g,f))??!1,{min:u,max:d}=n;return{selected:a,select:(f,g,p)=>{let m=[...a??[]];if(c(f)){if(a?.length===u||i&&a?.length===1)return;m=a?.filter(_=>!l(_,f))}else a?.length===d?m=[f]:m=[...m,f];return r||o(m),r?.(m,f,g,p),m},isSelected:c}}function sNn(n,e,t=0,i=0,r=!1,s=pm){const{from:o,to:a}=e||{},{isSameDay:l,isAfter:c,isBefore:u}=s;let d;if(!o&&!a)d={from:n,to:t>0?void 0:n};else if(o&&!a)l(o,n)?r?d={from:o,to:void 0}:d=void 0:u(n,o)?d={from:n,to:o}:d={from:o,to:n};else if(o&&a)if(l(o,n)&&l(a,n))r?d={from:o,to:a}:d=void 0;else if(l(o,n))d={from:o,to:t>0?void 0:n};else if(l(a,n))d={from:n,to:t>0?void 0:n};else if(u(n,o))d={from:n,to:a};else if(c(n,o))d={from:o,to:n};else if(c(n,a))d={from:o,to:n};else throw new Error("Invalid range");if(d?.from&&d?.to){const h=s.differenceInCalendarDays(d.to,d.from);i>0&&h>i?d={from:n,to:void 0}:t>1&&htypeof a!="function").some(a=>typeof a=="boolean"?a:t.isDate(a)?C_(n,a,!1,t):BKe(a,t)?a.some(l=>C_(n,l,!1,t)):Yfe(a)?a.from&&a.to?kAe(n,{from:a.from,to:a.to},t):!1:FKe(a)?oNn(n,a.dayOfWeek,t):PKe(a)?t.isAfter(a.before,a.after)?kAe(n,{from:t.addDays(a.after,1),to:t.addDays(a.before,-1)},t):x_(n.from,a,t)||x_(n.to,a,t):OKe(a)||MKe(a)?x_(n.from,a,t)||x_(n.to,a,t):!1))return!0;const o=i.filter(a=>typeof a=="function");if(o.length){let a=n.from;const l=t.differenceInCalendarDays(n.to,n.from);for(let c=0;c<=l;c++){if(o.some(u=>u(a)))return!0;a=t.addDays(a,1)}}return!1}function lNn(n,e){const{disabled:t,excludeDisabled:i,selected:r,required:s,onSelect:o}=n,[a,l]=GV(r,o?r:void 0),c=o?r:a;return{selected:c,select:(h,f,g)=>{const{min:p,max:m}=n,_=h?sNn(h,c,p,m,s,e):void 0;return i&&t&&_?.from&&_.to&&aNn({from:_.from,to:_.to},t,e)&&(_.from=h,_.to=void 0),o||l(_),o?.(_,h,f,g),_},isSelected:h=>c&&C_(c,h,!1,e)}}function cNn(n,e){const{selected:t,required:i,onSelect:r}=n,[s,o]=GV(t,r?t:void 0),a=r?t:s,{isSameDay:l}=e;return{selected:a,select:(d,h,f)=>{let g=d;return!i&&a&&a&&l(d,a)&&(g=void 0),r||o(g),r?.(g,d,h,f),g},isSelected:d=>a?l(a,d):!1}}function uNn(n,e){const t=cNn(n,e),i=rNn(n,e),r=lNn(n,e);switch(n.mode){case"single":return t;case"multiple":return i;case"range":return r;default:return}}function yVn(n){let e=n;e.timeZone&&(e={...n},e.today&&(e.today=new ac(e.today,e.timeZone)),e.month&&(e.month=new ac(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new ac(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new ac(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new ac(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new ac(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(Ft=>new ac(Ft,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new ac(e.selected.from,e.timeZone):void 0,to:e.selected.to?new ac(e.selected.to,e.timeZone):void 0}));const{components:t,formatters:i,labels:r,dateLib:s,locale:o,classNames:a}=E.useMemo(()=>{const Ft={...Gfe,...e.locale};return{dateLib:new E0({locale:Ft,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:gAn(e.components),formatters:kAn(e.formatters),labels:{...HAn,...e.labels},locale:Ft,classNames:{...mAn(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:l,mode:c,navLayout:u,numberOfMonths:d=1,onDayBlur:h,onDayClick:f,onDayFocus:g,onDayKeyDown:p,onDayMouseEnter:m,onDayMouseLeave:_,onNextClick:v,onPrevClick:y,showWeekNumber:C,styles:x}=e,{formatCaption:k,formatDay:L,formatMonthDropdown:D,formatWeekNumber:I,formatWeekNumberHeader:O,formatWeekdayName:M,formatYearDropdown:B}=i,G=eNn(e,s),{days:W,months:z,navStart:q,navEnd:ee,previousMonth:Z,nextMonth:j,goToMonth:te}=G,le=$In(W,e,q,ee,s),{isSelected:ue,select:de,selected:we}=uNn(e,s)??{},{blur:xe,focused:Me,isFocusTarget:Re,moveFocus:_t,setFocused:Qe}=iNn(e,G,le,ue??(()=>!1),s),{labelDayButton:pt,labelGridcell:gt,labelGrid:Ue,labelMonthDropdown:wn,labelNav:Xt,labelPrevious:jn,labelNext:ji,labelWeekday:ci,labelWeekNumber:ye,labelWeekNumberHeader:Ie,labelYearDropdown:Ve}=r,wt=E.useMemo(()=>TAn(s,e.ISOWeek),[s,e.ISOWeek]),vt=c!==void 0||f!==void 0,nt=E.useCallback(()=>{Z&&(te(Z),y?.(Z))},[Z,te,y]),$t=E.useCallback(()=>{j&&(te(j),v?.(j))},[te,j,v]),an=E.useCallback((Ft,qn)=>pi=>{pi.preventDefault(),pi.stopPropagation(),Qe(Ft),de?.(Ft.date,qn,pi),f?.(Ft.date,qn,pi)},[de,f,Qe]),Pi=E.useCallback((Ft,qn)=>pi=>{Qe(Ft),g?.(Ft.date,qn,pi)},[g,Qe]),Xn=E.useCallback((Ft,qn)=>pi=>{xe(),h?.(Ft.date,qn,pi)},[xe,h]),Qi=E.useCallback((Ft,qn)=>pi=>{const bn={ArrowLeft:[pi.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[pi.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[pi.shiftKey?"year":"week","after"],ArrowUp:[pi.shiftKey?"year":"week","before"],PageUp:[pi.shiftKey?"year":"month","before"],PageDown:[pi.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(bn[pi.key]){pi.preventDefault(),pi.stopPropagation();const[dn,bi]=bn[pi.key];_t(dn,bi)}p?.(Ft.date,qn,pi)},[_t,p,e.dir]),qs=E.useCallback((Ft,qn)=>pi=>{m?.(Ft.date,qn,pi)},[m]),Pr=E.useCallback((Ft,qn)=>pi=>{_?.(Ft.date,qn,pi)},[_]),Or=E.useCallback(Ft=>qn=>{const pi=Number(qn.target.value),bn=s.setMonth(s.startOfMonth(Ft),pi);te(bn)},[s,te]),cr=E.useCallback(Ft=>qn=>{const pi=Number(qn.target.value),bn=s.setYear(s.startOfMonth(Ft),pi);te(bn)},[s,te]),{className:us,style:qi}=E.useMemo(()=>({className:[a[Fn.Root],e.className].filter(Boolean).join(" "),style:{...x?.[Fn.Root],...e.style}}),[a,e.className,e.style,x]),Er=pAn(e),oo=E.useRef(null);jAn(oo,!!e.animate,{classNames:a,months:z,focused:Me,dateLib:s});const As={dayPickerProps:e,selected:we,select:de,isSelected:ue,months:z,nextMonth:j,previousMonth:Z,goToMonth:te,getModifiers:le,components:t,classNames:a,styles:x,labels:r,formatters:i};return U.createElement($Ke.Provider,{value:As},U.createElement(t.Root,{rootRef:e.animate?oo:void 0,className:us,style:qi,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],...Er},U.createElement(t.Months,{className:a[Fn.Months],style:x?.[Fn.Months]},!e.hideNavigation&&!u&&U.createElement(t.Nav,{"data-animated-nav":e.animate?"true":void 0,className:a[Fn.Nav],style:x?.[Fn.Nav],"aria-label":Xt(),onPreviousClick:nt,onNextClick:$t,previousMonth:Z,nextMonth:j}),z.map((Ft,qn)=>{const pi=EAn(Ft.date,q,ee,i,s),bn=DAn(q,ee,i,s);return U.createElement(t.Month,{"data-animated-month":e.animate?"true":void 0,className:a[Fn.Month],style:x?.[Fn.Month],key:qn,displayIndex:qn,calendarMonth:Ft},u==="around"&&!e.hideNavigation&&qn===0&&U.createElement(t.PreviousMonthButton,{type:"button",className:a[Fn.PreviousMonthButton],tabIndex:Z?void 0:-1,"aria-disabled":Z?void 0:!0,"aria-label":jn(Z),onClick:nt,"data-animated-button":e.animate?"true":void 0},U.createElement(t.Chevron,{disabled:Z?void 0:!0,className:a[Fn.Chevron],orientation:e.dir==="rtl"?"right":"left"})),U.createElement(t.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:a[Fn.MonthCaption],style:x?.[Fn.MonthCaption],calendarMonth:Ft,displayIndex:qn},l?.startsWith("dropdown")?U.createElement(t.DropdownNav,{className:a[Fn.Dropdowns],style:x?.[Fn.Dropdowns]},l==="dropdown"||l==="dropdown-months"?U.createElement(t.MonthsDropdown,{className:a[Fn.MonthsDropdown],"aria-label":wn(),classNames:a,components:t,disabled:!!e.disableNavigation,onChange:Or(Ft.date),options:pi,style:x?.[Fn.Dropdown],value:s.getMonth(Ft.date)}):U.createElement("span",null,D(Ft.date,s)),l==="dropdown"||l==="dropdown-years"?U.createElement(t.YearsDropdown,{className:a[Fn.YearsDropdown],"aria-label":Ve(s.options),classNames:a,components:t,disabled:!!e.disableNavigation,onChange:cr(Ft.date),options:bn,style:x?.[Fn.Dropdown],value:s.getYear(Ft.date)}):U.createElement("span",null,B(Ft.date,s)),U.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},k(Ft.date,s.options,s))):U.createElement(t.CaptionLabel,{className:a[Fn.CaptionLabel],role:"status","aria-live":"polite"},k(Ft.date,s.options,s))),u==="around"&&!e.hideNavigation&&qn===d-1&&U.createElement(t.NextMonthButton,{type:"button",className:a[Fn.NextMonthButton],tabIndex:j?void 0:-1,"aria-disabled":j?void 0:!0,"aria-label":ji(j),onClick:$t,"data-animated-button":e.animate?"true":void 0},U.createElement(t.Chevron,{disabled:j?void 0:!0,className:a[Fn.Chevron],orientation:e.dir==="rtl"?"left":"right"})),qn===d-1&&u==="after"&&!e.hideNavigation&&U.createElement(t.Nav,{"data-animated-nav":e.animate?"true":void 0,className:a[Fn.Nav],style:x?.[Fn.Nav],"aria-label":Xt(),onPreviousClick:nt,onNextClick:$t,previousMonth:Z,nextMonth:j}),U.createElement(t.MonthGrid,{role:"grid","aria-multiselectable":c==="multiple"||c==="range","aria-label":Ue(Ft.date,s.options,s)||void 0,className:a[Fn.MonthGrid],style:x?.[Fn.MonthGrid]},!e.hideWeekdays&&U.createElement(t.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:a[Fn.Weekdays],style:x?.[Fn.Weekdays]},C&&U.createElement(t.WeekNumberHeader,{"aria-label":Ie(s.options),className:a[Fn.WeekNumberHeader],style:x?.[Fn.WeekNumberHeader],scope:"col"},O()),wt.map((dn,bi)=>U.createElement(t.Weekday,{"aria-label":ci(dn,s.options,s),className:a[Fn.Weekday],key:bi,style:x?.[Fn.Weekday],scope:"col"},M(dn,s.options,s)))),U.createElement(t.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:a[Fn.Weeks],style:x?.[Fn.Weeks]},Ft.weeks.map((dn,bi)=>U.createElement(t.Week,{className:a[Fn.Week],key:dn.weekNumber,style:x?.[Fn.Week],week:dn},C&&U.createElement(t.WeekNumber,{week:dn,style:x?.[Fn.WeekNumber],"aria-label":ye(dn.weekNumber,{locale:o}),className:a[Fn.WeekNumber],scope:"row",role:"rowheader"},I(dn.weekNumber,s)),dn.days.map(mi=>{const{date:Yi}=mi,Wn=le(mi);if(Wn[vo.focused]=!Wn.hidden&&!!Me?.isEqualTo(mi),Wn[lg.selected]=ue?.(Yi)||Wn.selected,Yfe(we)){const{from:H,to:Y}=we;Wn[lg.range_start]=!!(H&&Y&&s.isSameDay(Yi,H)),Wn[lg.range_end]=!!(H&&Y&&s.isSameDay(Yi,Y)),Wn[lg.range_middle]=C_(we,Yi,!0,s)}const pn=LAn(Wn,x,e.modifiersStyles),re=WIn(Wn,a,e.modifiersClassNames),oe=!vt&&!Wn.hidden?gt(Yi,Wn,s.options,s):void 0;return U.createElement(t.Day,{key:`${s.format(Yi,"yyyy-MM-dd")}_${s.format(mi.displayMonth,"yyyy-MM")}`,day:mi,modifiers:Wn,className:re.join(" "),style:pn,role:"gridcell","aria-selected":Wn.selected||void 0,"aria-label":oe,"data-day":s.format(Yi,"yyyy-MM-dd"),"data-month":mi.outside?s.format(Yi,"yyyy-MM"):void 0,"data-selected":Wn.selected||void 0,"data-disabled":Wn.disabled||void 0,"data-hidden":Wn.hidden||void 0,"data-outside":mi.outside||void 0,"data-focused":Wn.focused||void 0,"data-today":Wn.today||void 0},!Wn.hidden&&vt?U.createElement(t.DayButton,{className:a[Fn.DayButton],style:x?.[Fn.DayButton],type:"button",day:mi,modifiers:Wn,disabled:Wn.disabled||void 0,tabIndex:Re(mi)?0:-1,"aria-label":pt(Yi,Wn,s.options,s),onClick:an(mi,Wn),onBlur:Xn(mi,Wn),onFocus:Pi(mi,Wn),onKeyDown:Qi(mi,Wn),onMouseEnter:qs(mi,Wn),onMouseLeave:Pr(mi,Wn)},L(Yi,s.options,s)):!Wn.hidden&&L(mi.date,s.options,s))}))))))})),e.footer&&U.createElement(t.Footer,{className:a[Fn.Footer],style:x?.[Fn.Footer],role:"status","aria-live":"polite"},e.footer)))}function dNn(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var Zfe=n=>{const{present:e,children:t}=n,i=hNn(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,fNn(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};Zfe.displayName="Presence";function hNn(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=dNn(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=sF(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=sF(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=sF(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=sF(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function sF(n){return n?.animationName||"none"}function fNn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var jKe=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(pNn);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(Sse,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(Sse,{...i,ref:e,children:t})});jKe.displayName="Slot";var Sse=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=_Nn(t);return E.cloneElement(t,{...mNn(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});Sse.displayName="SlotClone";var gNn=({children:n})=>ae.jsx(ae.Fragment,{children:n});function pNn(n){return E.isValidElement(n)&&n.type===gNn}function mNn(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function _Nn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Xfe="Popover",[qKe,wVn]=Ac(Xfe,[c1]),iM=c1(),[vNn,_1]=qKe(Xfe),KKe=n=>{const{__scopePopover:e,children:t,open:i,defaultOpen:r,onOpenChange:s,modal:o=!1}=n,a=iM(e),l=E.useRef(null),[c,u]=E.useState(!1),[d=!1,h]=Kp({prop:i,defaultProp:r,onChange:s});return ae.jsx(UH,{...a,children:ae.jsx(vNn,{scope:e,contentId:Ud(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:E.useCallback(()=>h(f=>!f),[h]),hasCustomAnchor:c,onCustomAnchorAdd:E.useCallback(()=>u(!0),[]),onCustomAnchorRemove:E.useCallback(()=>u(!1),[]),modal:o,children:t})})};KKe.displayName=Xfe;var GKe="PopoverAnchor",bNn=E.forwardRef((n,e)=>{const{__scopePopover:t,...i}=n,r=_1(GKe,t),s=iM(t),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=r;return E.useEffect(()=>(o(),()=>a()),[o,a]),ae.jsx(BO,{...s,...i,ref:e})});bNn.displayName=GKe;var YKe="PopoverTrigger",ZKe=E.forwardRef((n,e)=>{const{__scopePopover:t,...i}=n,r=_1(YKe,t),s=iM(t),o=gi(e,r.triggerRef),a=ae.jsx(Pn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":tGe(r.open),...i,ref:o,onClick:Kt(n.onClick,r.onOpenToggle)});return r.hasCustomAnchor?a:ae.jsx(BO,{asChild:!0,...s,children:a})});ZKe.displayName=YKe;var Qfe="PopoverPortal",[yNn,wNn]=qKe(Qfe,{forceMount:void 0}),XKe=n=>{const{__scopePopover:e,forceMount:t,children:i,container:r}=n,s=_1(Qfe,e);return ae.jsx(yNn,{scope:e,forceMount:t,children:ae.jsx(Zfe,{present:t||s.open,children:ae.jsx(y2,{asChild:!0,container:r,children:i})})})};XKe.displayName=Qfe;var NL="PopoverContent",QKe=E.forwardRef((n,e)=>{const t=wNn(NL,n.__scopePopover),{forceMount:i=t.forceMount,...r}=n,s=_1(NL,n.__scopePopover);return ae.jsx(Zfe,{present:i||s.open,children:s.modal?ae.jsx(CNn,{...r,ref:e}):ae.jsx(xNn,{...r,ref:e})})});QKe.displayName=NL;var CNn=E.forwardRef((n,e)=>{const t=_1(NL,n.__scopePopover),i=E.useRef(null),r=gi(e,i),s=E.useRef(!1);return E.useEffect(()=>{const o=i.current;if(o)return MO(o)},[]),ae.jsx(OO,{as:jKe,allowPinchZoom:!0,children:ae.jsx(JKe,{...n,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kt(n.onCloseAutoFocus,o=>{o.preventDefault(),s.current||t.triggerRef.current?.focus()}),onPointerDownOutside:Kt(n.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Kt(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),xNn=E.forwardRef((n,e)=>{const t=_1(NL,n.__scopePopover),i=E.useRef(!1),r=E.useRef(!1);return ae.jsx(JKe,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{n.onCloseAutoFocus?.(s),s.defaultPrevented||(i.current||t.triggerRef.current?.focus(),s.preventDefault()),i.current=!1,r.current=!1},onInteractOutside:s=>{n.onInteractOutside?.(s),s.defaultPrevented||(i.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=s.target;t.triggerRef.current?.contains(o)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),JKe=E.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:i,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=n,h=_1(NL,t),f=iM(t);return WH(),ae.jsx(PO,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:r,onUnmountAutoFocus:s,children:ae.jsx(b2,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:ae.jsx(jH,{"data-state":tGe(h.open),role:"dialog",id:h.contentId,...f,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),eGe="PopoverClose",SNn=E.forwardRef((n,e)=>{const{__scopePopover:t,...i}=n,r=_1(eGe,t);return ae.jsx(Pn.button,{type:"button",...i,ref:e,onClick:Kt(n.onClick,()=>r.onOpenChange(!1))})});SNn.displayName=eGe;var kNn="PopoverArrow",ENn=E.forwardRef((n,e)=>{const{__scopePopover:t,...i}=n,r=iM(t);return ae.jsx(qH,{...r,...i,ref:e})});ENn.displayName=kNn;function tGe(n){return n?"open":"closed"}var CVn=KKe,xVn=ZKe,SVn=XKe,kVn=QKe;function LNn(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var rM=n=>{const{present:e,children:t}=n,i=TNn(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,DNn(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};rM.displayName="Presence";function TNn(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=LNn(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=oF(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=oF(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=oF(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=oF(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function oF(n){return n?.animationName||"none"}function DNn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function INn(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var Jfe="ScrollArea",[nGe,EVn]=Ac(Jfe),[ANn,bf]=nGe(Jfe),iGe=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:i="hover",dir:r,scrollHideDelay:s=600,...o}=n,[a,l]=E.useState(null),[c,u]=E.useState(null),[d,h]=E.useState(null),[f,g]=E.useState(null),[p,m]=E.useState(null),[_,v]=E.useState(0),[y,C]=E.useState(0),[x,k]=E.useState(!1),[L,D]=E.useState(!1),I=gi(e,M=>l(M)),O=$P(r);return ae.jsx(ANn,{scope:t,type:i,dir:O,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:u,content:d,onContentChange:h,scrollbarX:f,onScrollbarXChange:g,scrollbarXEnabled:x,onScrollbarXEnabledChange:k,scrollbarY:p,onScrollbarYChange:m,scrollbarYEnabled:L,onScrollbarYEnabledChange:D,onCornerWidthChange:v,onCornerHeightChange:C,children:ae.jsx(Pn.div,{dir:O,...o,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":y+"px",...n.style}})})});iGe.displayName=Jfe;var rGe="ScrollAreaViewport",sGe=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:i,nonce:r,...s}=n,o=bf(rGe,t),a=E.useRef(null),l=gi(e,a,o.onViewportChange);return ae.jsxs(ae.Fragment,{children:[ae.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),ae.jsx(Pn.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...n.style},children:ae.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:i})})]})});sGe.displayName=rGe;var mm="ScrollAreaScrollbar",NNn=E.forwardRef((n,e)=>{const{forceMount:t,...i}=n,r=bf(mm,n.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=r,a=n.orientation==="horizontal";return E.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),r.type==="hover"?ae.jsx(RNn,{...i,ref:e,forceMount:t}):r.type==="scroll"?ae.jsx(PNn,{...i,ref:e,forceMount:t}):r.type==="auto"?ae.jsx(oGe,{...i,ref:e,forceMount:t}):r.type==="always"?ae.jsx(ege,{...i,ref:e}):null});NNn.displayName=mm;var RNn=E.forwardRef((n,e)=>{const{forceMount:t,...i}=n,r=bf(mm,n.__scopeScrollArea),[s,o]=E.useState(!1);return E.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},u=()=>{l=window.setTimeout(()=>o(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[r.scrollArea,r.scrollHideDelay]),ae.jsx(rM,{present:t||s,children:ae.jsx(oGe,{"data-state":s?"visible":"hidden",...i,ref:e})})}),PNn=E.forwardRef((n,e)=>{const{forceMount:t,...i}=n,r=bf(mm,n.__scopeScrollArea),s=n.orientation==="horizontal",o=ZV(()=>l("SCROLL_END"),100),[a,l]=INn("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return E.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),E.useEffect(()=>{const c=r.viewport,u=s?"scrollLeft":"scrollTop";if(c){let d=c[u];const h=()=>{const f=c[u];d!==f&&(l("SCROLL"),o()),d=f};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[r.viewport,s,l,o]),ae.jsx(rM,{present:t||a!=="hidden",children:ae.jsx(ege,{"data-state":a==="hidden"?"hidden":"visible",...i,ref:e,onPointerEnter:Kt(n.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Kt(n.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),oGe=E.forwardRef((n,e)=>{const t=bf(mm,n.__scopeScrollArea),{forceMount:i,...r}=n,[s,o]=E.useState(!1),a=n.orientation==="horizontal",l=ZV(()=>{if(t.viewport){const c=t.viewport.offsetWidth{const{orientation:t="vertical",...i}=n,r=bf(mm,n.__scopeScrollArea),s=E.useRef(null),o=E.useRef(0),[a,l]=E.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=uGe(a.viewport,a.content),u={...i,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function d(h,f){return HNn(h,o.current,a,f)}return t==="horizontal"?ae.jsx(ONn,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const h=r.viewport.scrollLeft,f=EAe(h,a,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:h=>{r.viewport&&(r.viewport.scrollLeft=h)},onDragScroll:h=>{r.viewport&&(r.viewport.scrollLeft=d(h,r.dir))}}):t==="vertical"?ae.jsx(MNn,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const h=r.viewport.scrollTop,f=EAe(h,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:h=>{r.viewport&&(r.viewport.scrollTop=h)},onDragScroll:h=>{r.viewport&&(r.viewport.scrollTop=d(h))}}):null}),ONn=E.forwardRef((n,e)=>{const{sizes:t,onSizesChange:i,...r}=n,s=bf(mm,n.__scopeScrollArea),[o,a]=E.useState(),l=E.useRef(null),c=gi(e,l,s.onScrollbarXChange);return E.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),ae.jsx(lGe,{"data-orientation":"horizontal",...r,ref:c,sizes:t,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":YV(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.x),onDragScroll:u=>n.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(s.viewport){const h=s.viewport.scrollLeft+u.deltaX;n.onWheelScroll(h),hGe(h,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&i({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:zB(o.paddingLeft),paddingEnd:zB(o.paddingRight)}})}})}),MNn=E.forwardRef((n,e)=>{const{sizes:t,onSizesChange:i,...r}=n,s=bf(mm,n.__scopeScrollArea),[o,a]=E.useState(),l=E.useRef(null),c=gi(e,l,s.onScrollbarYChange);return E.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),ae.jsx(lGe,{"data-orientation":"vertical",...r,ref:c,sizes:t,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":YV(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.y),onDragScroll:u=>n.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(s.viewport){const h=s.viewport.scrollTop+u.deltaY;n.onWheelScroll(h),hGe(h,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&i({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:zB(o.paddingTop),paddingEnd:zB(o.paddingBottom)}})}})}),[FNn,aGe]=nGe(mm),lGe=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:i,hasThumb:r,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...h}=n,f=bf(mm,t),[g,p]=E.useState(null),m=gi(e,I=>p(I)),_=E.useRef(null),v=E.useRef(""),y=f.viewport,C=i.content-i.viewport,x=Ua(u),k=Ua(l),L=ZV(d,10);function D(I){if(_.current){const O=I.clientX-_.current.left,M=I.clientY-_.current.top;c({x:O,y:M})}}return E.useEffect(()=>{const I=O=>{const M=O.target;g?.contains(M)&&x(O,C)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[y,g,C,x]),E.useEffect(k,[i,k]),RL(g,L),RL(f.content,L),ae.jsx(FNn,{scope:t,scrollbar:g,hasThumb:r,onThumbChange:Ua(s),onThumbPointerUp:Ua(o),onThumbPositionChange:k,onThumbPointerDown:Ua(a),children:ae.jsx(Pn.div,{...h,ref:m,style:{position:"absolute",...h.style},onPointerDown:Kt(n.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),_.current=g.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),D(I))}),onPointerMove:Kt(n.onPointerMove,D),onPointerUp:Kt(n.onPointerUp,I=>{const O=I.target;O.hasPointerCapture(I.pointerId)&&O.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=v.current,f.viewport&&(f.viewport.style.scrollBehavior=""),_.current=null})})})}),VB="ScrollAreaThumb",BNn=E.forwardRef((n,e)=>{const{forceMount:t,...i}=n,r=aGe(VB,n.__scopeScrollArea);return ae.jsx(rM,{present:t||r.hasThumb,children:ae.jsx($Nn,{ref:e,...i})})}),$Nn=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:i,...r}=n,s=bf(VB,t),o=aGe(VB,t),{onThumbPositionChange:a}=o,l=gi(e,d=>o.onThumbChange(d)),c=E.useRef(void 0),u=ZV(()=>{c.current&&(c.current(),c.current=void 0)},100);return E.useEffect(()=>{const d=s.viewport;if(d){const h=()=>{if(u(),!c.current){const f=VNn(d,a);c.current=f,a()}};return a(),d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}},[s.viewport,u,a]),ae.jsx(Pn.div,{"data-state":o.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:Kt(n.onPointerDownCapture,d=>{const f=d.target.getBoundingClientRect(),g=d.clientX-f.left,p=d.clientY-f.top;o.onThumbPointerDown({x:g,y:p})}),onPointerUp:Kt(n.onPointerUp,o.onThumbPointerUp)})});BNn.displayName=VB;var tge="ScrollAreaCorner",cGe=E.forwardRef((n,e)=>{const t=bf(tge,n.__scopeScrollArea),i=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&i?ae.jsx(WNn,{...n,ref:e}):null});cGe.displayName=tge;var WNn=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,...i}=n,r=bf(tge,t),[s,o]=E.useState(0),[a,l]=E.useState(0),c=!!(s&&a);return RL(r.scrollbarX,()=>{const u=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(u),l(u)}),RL(r.scrollbarY,()=>{const u=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(u),o(u)}),c?ae.jsx(Pn.div,{...i,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function zB(n){return n?parseInt(n,10):0}function uGe(n,e){const t=n/e;return isNaN(t)?0:t}function YV(n){const e=uGe(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,i=(n.scrollbar.size-t)*e;return Math.max(i,18)}function HNn(n,e,t,i="ltr"){const r=YV(t),s=r/2,o=e||s,a=r-o,l=t.scrollbar.paddingStart+o,c=t.scrollbar.size-t.scrollbar.paddingEnd-a,u=t.content-t.viewport,d=i==="ltr"?[0,u]:[u*-1,0];return dGe([l,c],d)(n)}function EAe(n,e,t="ltr"){const i=YV(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,o=e.content-e.viewport,a=s-i,l=t==="ltr"?[0,o]:[o*-1,0],c=mse(n,l);return dGe([0,o],[0,a])(c)}function dGe(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const i=(e[1]-e[0])/(n[1]-n[0]);return e[0]+i*(t-n[0])}}function hGe(n,e){return n>0&&n{})=>{let t={left:n.scrollLeft,top:n.scrollTop},i=0;return function r(){const s={left:n.scrollLeft,top:n.scrollTop},o=t.left!==s.left,a=t.top!==s.top;(o||a)&&e(),t=s,i=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(i)};function ZV(n,e){const t=Ua(n),i=E.useRef(0);return E.useEffect(()=>()=>window.clearTimeout(i.current),[]),E.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(t,e)},[t,e])}function RL(n,e){const t=Ua(e);es(()=>{let i=0;if(n){const r=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(t)});return r.observe(n),()=>{window.cancelAnimationFrame(i),r.unobserve(n)}}},[n,t])}var LVn=iGe,TVn=sGe,DVn=cGe,nge="Progress",ige=100,[zNn,IVn]=Ac(nge),[UNn,jNn]=zNn(nge),fGe=E.forwardRef((n,e)=>{const{__scopeProgress:t,value:i=null,max:r,getValueLabel:s=qNn,...o}=n;(r||r===0)&&!LAe(r)&&console.error(KNn(`${r}`,"Progress"));const a=LAe(r)?r:ige;i!==null&&!TAe(i,a)&&console.error(GNn(`${i}`,"Progress"));const l=TAe(i,a)?i:null,c=UB(l)?s(l,a):void 0;return ae.jsx(UNn,{scope:t,value:l,max:a,children:ae.jsx(Pn.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":UB(l)?l:void 0,"aria-valuetext":c,role:"progressbar","data-state":mGe(l,a),"data-value":l??void 0,"data-max":a,...o,ref:e})})});fGe.displayName=nge;var gGe="ProgressIndicator",pGe=E.forwardRef((n,e)=>{const{__scopeProgress:t,...i}=n,r=jNn(gGe,t);return ae.jsx(Pn.div,{"data-state":mGe(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...i,ref:e})});pGe.displayName=gGe;function qNn(n,e){return`${Math.round(n/e*100)}%`}function mGe(n,e){return n==null?"indeterminate":n===e?"complete":"loading"}function UB(n){return typeof n=="number"}function LAe(n){return UB(n)&&!isNaN(n)&&n>0}function TAe(n,e){return UB(n)&&!isNaN(n)&&n<=e&&n>=0}function KNn(n,e){return`Invalid prop \`max\` of value \`${n}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${ige}\`.`}function GNn(n,e){return`Invalid prop \`value\` of value \`${n}\` supplied to \`${e}\`. The \`value\` prop must be: +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $qe(n,e){if(n){if(typeof n=="string")return gse(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return gse(n,e)}}function Z2n(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function X2n(n){if(Array.isArray(n))return gse(n)}function gse(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t0?o:e&&e.length&&Ut(r)&&Ut(s)?e.slice(r,s+1):[]};function Vqe(n){return n==="number"?[0,"auto"]:void 0}var pse=function(e,t,i,r){var s=e.graphicalItems,o=e.tooltipAxis,a=UV(t,e);return i<0||!s||!s.length||i>=a.length?null:s.reduce(function(l,c){var u,d=(u=c.props.data)!==null&&u!==void 0?u:t;d&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=i&&(d=d.slice(e.dataStartIndex,e.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var f=d===void 0?a:d;h=W7(f,o.dataKey,r)}else h=d&&d[i]||a[i];return h?[].concat(IL(l),[Ije(c,h)]):l},[])},uAe=function(e,t,i,r){var s=r||{x:e.chartX,y:e.chartY},o=tTn(s,i),a=e.orderedTooltipTicks,l=e.tooltipAxis,c=e.tooltipTicks,u=iyn(o,a,c,l);if(u>=0&&c){var d=c[u]&&c[u].value,h=pse(e,t,u,d),f=nTn(i,a,u,s);return{activeTooltipIndex:u,activeLabel:d,activePayload:h,activeCoordinate:f}}return null},iTn=function(e,t){var i=t.axes,r=t.graphicalItems,s=t.axisType,o=t.axisIdKey,a=t.stackGroups,l=t.dataStartIndex,c=t.dataEndIndex,u=e.layout,d=e.children,h=e.stackOffset,f=Lje(u,s);return i.reduce(function(g,p){var m,_=p.type.defaultProps!==void 0?rt(rt({},p.type.defaultProps),p.props):p.props,v=_.type,y=_.dataKey,C=_.allowDataOverflow,x=_.allowDuplicatedCategory,k=_.scale,L=_.ticks,D=_.includeHidden,I=_[o];if(g[I])return g;var O=UV(e.data,{graphicalItems:r.filter(function(ue){var de,we=o in ue.props?ue.props[o]:(de=ue.type.defaultProps)===null||de===void 0?void 0:de[o];return we===I}),dataStartIndex:l,dataEndIndex:c}),M=O.length,B,G,W;D2n(_.domain,C,v)&&(B=Dre(_.domain,null,C),f&&(v==="number"||k!=="auto")&&(W=cA(O,y,"category")));var z=Vqe(v);if(!B||B.length===0){var q,ee=(q=_.domain)!==null&&q!==void 0?q:z;if(y){if(B=cA(O,y,v),v==="category"&&f){var Z=jon(B);x&&Z?(G=B,B=SB(0,M)):x||(B=BDe(ee,B,p).reduce(function(ue,de){return ue.indexOf(de)>=0?ue:[].concat(IL(ue),[de])},[]))}else if(v==="category")x?B=B.filter(function(ue){return ue!==""&&!Di(ue)}):B=BDe(ee,B,p).reduce(function(ue,de){return ue.indexOf(de)>=0||de===""||Di(de)?ue:[].concat(IL(ue),[de])},[]);else if(v==="number"){var j=lyn(O,r.filter(function(ue){var de,we,xe=o in ue.props?ue.props[o]:(de=ue.type.defaultProps)===null||de===void 0?void 0:de[o],Me="hide"in ue.props?ue.props.hide:(we=ue.type.defaultProps)===null||we===void 0?void 0:we.hide;return xe===I&&(D||!Me)}),y,s,u);j&&(B=j)}f&&(v==="number"||k!=="auto")&&(W=cA(O,y,"category"))}else f?B=SB(0,M):a&&a[I]&&a[I].hasStack&&v==="number"?B=h==="expand"?[0,1]:Dje(a[I].stackGroups,l,c):B=Eje(O,r.filter(function(ue){var de=o in ue.props?ue.props[o]:ue.type.defaultProps[o],we="hide"in ue.props?ue.props.hide:ue.type.defaultProps.hide;return de===I&&(D||!we)}),v,u,!0);if(v==="number")B=hse(d,B,I,s,L),ee&&(B=Dre(ee,B,C));else if(v==="category"&&ee){var te=ee,le=B.every(function(ue){return te.indexOf(ue)>=0});le&&(B=te)}}return rt(rt({},g),{},ii({},I,rt(rt({},_),{},{axisType:s,domain:B,categoricalDomain:W,duplicateDomain:G,originalDomain:(m=_.domain)!==null&&m!==void 0?m:z,isCategorical:f,layout:u})))},{})},rTn=function(e,t){var i=t.graphicalItems,r=t.Axis,s=t.axisType,o=t.axisIdKey,a=t.stackGroups,l=t.dataStartIndex,c=t.dataEndIndex,u=e.layout,d=e.children,h=UV(e.data,{graphicalItems:i,dataStartIndex:l,dataEndIndex:c}),f=h.length,g=Lje(u,s),p=-1;return i.reduce(function(m,_){var v=_.type.defaultProps!==void 0?rt(rt({},_.type.defaultProps),_.props):_.props,y=v[o],C=Vqe("number");if(!m[y]){p++;var x;return g?x=SB(0,f):a&&a[y]&&a[y].hasStack?(x=Dje(a[y].stackGroups,l,c),x=hse(d,x,y,s)):(x=Dre(C,Eje(h,i.filter(function(k){var L,D,I=o in k.props?k.props[o]:(L=k.type.defaultProps)===null||L===void 0?void 0:L[o],O="hide"in k.props?k.props.hide:(D=k.type.defaultProps)===null||D===void 0?void 0:D.hide;return I===y&&!O}),"number",u),r.defaultProps.allowDataOverflow),x=hse(d,x,y,s)),rt(rt({},m),{},ii({},y,rt(rt({axisType:s},r.defaultProps),{},{hide:!0,orientation:ef(J2n,"".concat(s,".").concat(p%2),null),domain:x,originalDomain:C,isCategorical:g,layout:u})))}return m},{})},sTn=function(e,t){var i=t.axisType,r=i===void 0?"xAxis":i,s=t.AxisComp,o=t.graphicalItems,a=t.stackGroups,l=t.dataStartIndex,c=t.dataEndIndex,u=e.children,d="".concat(r,"Id"),h=td(u,s),f={};return h.length?f=iTn(e,{axes:h,graphicalItems:o,axisType:r,axisIdKey:d,stackGroups:a,dataStartIndex:l,dataEndIndex:c}):o&&o.length&&(f=rTn(e,{Axis:s,graphicalItems:o,axisType:r,axisIdKey:d,stackGroups:a,dataStartIndex:l,dataEndIndex:c})),f},oTn=function(e){var t=Cv(e),i=w_(t,!1,!0);return{tooltipTicks:i,orderedTooltipTicks:ofe(i,function(r){return r.coordinate}),tooltipAxis:t,tooltipAxisBandSize:pB(t,i)}},dAe=function(e){var t=e.children,i=e.defaultShowTooltip,r=Td(t,_L),s=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(s=r.props.startIndex),r.props.endIndex>=0&&(o=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:s,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!i}},aTn=function(e){return!e||!e.length?!1:e.some(function(t){var i=F_(t&&t.type);return i&&i.indexOf("Bar")>=0})},hAe=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},lTn=function(e,t){var i=e.props,r=e.graphicalItems,s=e.xAxisMap,o=s===void 0?{}:s,a=e.yAxisMap,l=a===void 0?{}:a,c=i.width,u=i.height,d=i.children,h=i.margin||{},f=Td(d,_L),g=Td(d,$k),p=Object.keys(l).reduce(function(x,k){var L=l[k],D=L.orientation;return!L.mirror&&!L.hide?rt(rt({},x),{},ii({},D,x[D]+L.width)):x},{left:h.left||0,right:h.right||0}),m=Object.keys(o).reduce(function(x,k){var L=o[k],D=L.orientation;return!L.mirror&&!L.hide?rt(rt({},x),{},ii({},D,ef(x,"".concat(D))+L.height)):x},{top:h.top||0,bottom:h.bottom||0}),_=rt(rt({},m),p),v=_.bottom;f&&(_.bottom+=f.props.height||_L.defaultProps.height),g&&t&&(_=oyn(_,r,i,t));var y=c-_.left-_.right,C=u-_.top-_.bottom;return rt(rt({brushBottom:v},_),{},{width:Math.max(y,0),height:Math.max(C,0)})},cTn=function(e,t){if(t==="xAxis")return e[t].width;if(t==="yAxis")return e[t].height},uTn=function(e){var t=e.chartName,i=e.GraphicalChild,r=e.defaultTooltipEventType,s=r===void 0?"axis":r,o=e.validateTooltipEventTypes,a=o===void 0?["axis"]:o,l=e.axisComponents,c=e.legendContent,u=e.formatAxisMap,d=e.defaultProps,h=function(_,v){var y=v.graphicalItems,C=v.stackGroups,x=v.offset,k=v.updateId,L=v.dataStartIndex,D=v.dataEndIndex,I=_.barSize,O=_.layout,M=_.barGap,B=_.barCategoryGap,G=_.maxBarSize,W=hAe(O),z=W.numericAxisName,q=W.cateAxisName,ee=aTn(y),Z=[];return y.forEach(function(j,te){var le=UV(_.data,{graphicalItems:[j],dataStartIndex:L,dataEndIndex:D}),ue=j.type.defaultProps!==void 0?rt(rt({},j.type.defaultProps),j.props):j.props,de=ue.dataKey,we=ue.maxBarSize,xe=ue["".concat(z,"Id")],Me=ue["".concat(q,"Id")],Re={},_t=l.reduce(function(wt,vt){var nt=v["".concat(vt.axisType,"Map")],$t=ue["".concat(vt.axisType,"Id")];nt&&nt[$t]||vt.axisType==="zAxis"||aC();var an=nt[$t];return rt(rt({},wt),{},ii(ii({},vt.axisType,an),"".concat(vt.axisType,"Ticks"),w_(an)))},Re),Qe=_t[q],pt=_t["".concat(q,"Ticks")],gt=C&&C[xe]&&C[xe].hasStack&&yyn(j,C[xe].stackGroups),Ue=F_(j.type).indexOf("Bar")>=0,wn=pB(Qe,pt),Xt=[],jn=ee&&ryn({barSize:I,stackGroups:C,totalSize:cTn(_t,q)});if(Ue){var ji,ci,ye=Di(we)?G:we,Ie=(ji=(ci=pB(Qe,pt,!0))!==null&&ci!==void 0?ci:ye)!==null&&ji!==void 0?ji:0;Xt=syn({barGap:M,barCategoryGap:B,bandSize:Ie!==wn?Ie:wn,sizeList:jn[Me],maxBarSize:ye}),Ie!==wn&&(Xt=Xt.map(function(wt){return rt(rt({},wt),{},{position:rt(rt({},wt.position),{},{offset:wt.position.offset-Ie/2})})}))}var Ve=j&&j.type&&j.type.getComposedData;Ve&&Z.push({props:rt(rt({},Ve(rt(rt({},_t),{},{displayedData:le,props:_,dataKey:de,item:j,bandSize:wn,barPosition:Xt,offset:x,stackedData:gt,layout:O,dataStartIndex:L,dataEndIndex:D}))),{},ii(ii(ii({key:j.key||"item-".concat(te)},z,_t[z]),q,_t[q]),"animationId",k)),childIndex:ian(j,_.children),item:j})}),Z},f=function(_,v){var y=_.props,C=_.dataStartIndex,x=_.dataEndIndex,k=_.updateId;if(!N2e({props:y}))return null;var L=y.children,D=y.layout,I=y.stackOffset,O=y.data,M=y.reverseStackOrder,B=hAe(D),G=B.numericAxisName,W=B.cateAxisName,z=td(L,i),q=_yn(O,z,"".concat(G,"Id"),"".concat(W,"Id"),I,M),ee=l.reduce(function(ue,de){var we="".concat(de.axisType,"Map");return rt(rt({},ue),{},ii({},we,sTn(y,rt(rt({},de),{},{graphicalItems:z,stackGroups:de.axisType===G&&q,dataStartIndex:C,dataEndIndex:x}))))},{}),Z=lTn(rt(rt({},ee),{},{props:y,graphicalItems:z}),v?.legendBBox);Object.keys(ee).forEach(function(ue){ee[ue]=u(y,ee[ue],Z,ue.replace("Map",""),t)});var j=ee["".concat(W,"Map")],te=oTn(j),le=h(y,rt(rt({},ee),{},{dataStartIndex:C,dataEndIndex:x,updateId:k,graphicalItems:z,stackGroups:q,offset:Z}));return rt(rt({formattedGraphicalItems:le,graphicalItems:z,offset:Z,stackGroups:q},te),ee)},g=function(m){function _(v){var y,C,x;return V2n(this,_),x=j2n(this,_,[v]),ii(x,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ii(x,"accessibilityManager",new T2n),ii(x,"handleLegendBBoxUpdate",function(k){if(k){var L=x.state,D=L.dataStartIndex,I=L.dataEndIndex,O=L.updateId;x.setState(rt({legendBBox:k},f({props:x.props,dataStartIndex:D,dataEndIndex:I,updateId:O},rt(rt({},x.state),{},{legendBBox:k}))))}}),ii(x,"handleReceiveSyncEvent",function(k,L,D){if(x.props.syncId===k){if(D===x.eventEmitterSymbol&&typeof x.props.syncMethod!="function")return;x.applySyncEvent(L)}}),ii(x,"handleBrushChange",function(k){var L=k.startIndex,D=k.endIndex;if(L!==x.state.dataStartIndex||D!==x.state.dataEndIndex){var I=x.state.updateId;x.setState(function(){return rt({dataStartIndex:L,dataEndIndex:D},f({props:x.props,dataStartIndex:L,dataEndIndex:D,updateId:I},x.state))}),x.triggerSyncEvent({dataStartIndex:L,dataEndIndex:D})}}),ii(x,"handleMouseEnter",function(k){var L=x.getMouseInfo(k);if(L){var D=rt(rt({},L),{},{isTooltipActive:!0});x.setState(D),x.triggerSyncEvent(D);var I=x.props.onMouseEnter;Ri(I)&&I(D,k)}}),ii(x,"triggeredAfterMouseMove",function(k){var L=x.getMouseInfo(k),D=L?rt(rt({},L),{},{isTooltipActive:!0}):{isTooltipActive:!1};x.setState(D),x.triggerSyncEvent(D);var I=x.props.onMouseMove;Ri(I)&&I(D,k)}),ii(x,"handleItemMouseEnter",function(k){x.setState(function(){return{isTooltipActive:!0,activeItem:k,activePayload:k.tooltipPayload,activeCoordinate:k.tooltipPosition||{x:k.cx,y:k.cy}}})}),ii(x,"handleItemMouseLeave",function(){x.setState(function(){return{isTooltipActive:!1}})}),ii(x,"handleMouseMove",function(k){k.persist(),x.throttleTriggeredAfterMouseMove(k)}),ii(x,"handleMouseLeave",function(k){x.throttleTriggeredAfterMouseMove.cancel();var L={isTooltipActive:!1};x.setState(L),x.triggerSyncEvent(L);var D=x.props.onMouseLeave;Ri(D)&&D(L,k)}),ii(x,"handleOuterEvent",function(k){var L=nan(k),D=ef(x.props,"".concat(L));if(L&&Ri(D)){var I,O;/.*touch.*/i.test(L)?O=x.getMouseInfo(k.changedTouches[0]):O=x.getMouseInfo(k),D((I=O)!==null&&I!==void 0?I:{},k)}}),ii(x,"handleClick",function(k){var L=x.getMouseInfo(k);if(L){var D=rt(rt({},L),{},{isTooltipActive:!0});x.setState(D),x.triggerSyncEvent(D);var I=x.props.onClick;Ri(I)&&I(D,k)}}),ii(x,"handleMouseDown",function(k){var L=x.props.onMouseDown;if(Ri(L)){var D=x.getMouseInfo(k);L(D,k)}}),ii(x,"handleMouseUp",function(k){var L=x.props.onMouseUp;if(Ri(L)){var D=x.getMouseInfo(k);L(D,k)}}),ii(x,"handleTouchMove",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&x.throttleTriggeredAfterMouseMove(k.changedTouches[0])}),ii(x,"handleTouchStart",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&x.handleMouseDown(k.changedTouches[0])}),ii(x,"handleTouchEnd",function(k){k.changedTouches!=null&&k.changedTouches.length>0&&x.handleMouseUp(k.changedTouches[0])}),ii(x,"handleDoubleClick",function(k){var L=x.props.onDoubleClick;if(Ri(L)){var D=x.getMouseInfo(k);L(D,k)}}),ii(x,"handleContextMenu",function(k){var L=x.props.onContextMenu;if(Ri(L)){var D=x.getMouseInfo(k);L(D,k)}}),ii(x,"triggerSyncEvent",function(k){x.props.syncId!==void 0&&lG.emit(cG,x.props.syncId,k,x.eventEmitterSymbol)}),ii(x,"applySyncEvent",function(k){var L=x.props,D=L.layout,I=L.syncMethod,O=x.state.updateId,M=k.dataStartIndex,B=k.dataEndIndex;if(k.dataStartIndex!==void 0||k.dataEndIndex!==void 0)x.setState(rt({dataStartIndex:M,dataEndIndex:B},f({props:x.props,dataStartIndex:M,dataEndIndex:B,updateId:O},x.state)));else if(k.activeTooltipIndex!==void 0){var G=k.chartX,W=k.chartY,z=k.activeTooltipIndex,q=x.state,ee=q.offset,Z=q.tooltipTicks;if(!ee)return;if(typeof I=="function")z=I(Z,k);else if(I==="value"){z=-1;for(var j=0;j=0){var gt,Ue;if(G.dataKey&&!G.allowDuplicatedCategory){var wn=typeof G.dataKey=="function"?pt:"payload.".concat(G.dataKey.toString());gt=W7(j,wn,z),Ue=te&&le&&W7(le,wn,z)}else gt=j?.[W],Ue=te&&le&&le[W];if(Me||xe){var Xt=k.props.activeIndex!==void 0?k.props.activeIndex:W;return[E.cloneElement(k,rt(rt(rt({},I.props),_t),{},{activeIndex:Xt})),null,null]}if(!Di(gt))return[Qe].concat(IL(x.renderActivePoints({item:I,activePoint:gt,basePoint:Ue,childIndex:W,isRange:te})))}else{var jn,ji=(jn=x.getItemByXY(x.state.activeCoordinate))!==null&&jn!==void 0?jn:{graphicalItem:Qe},ci=ji.graphicalItem,ye=ci.item,Ie=ye===void 0?k:ye,Ve=ci.childIndex,wt=rt(rt(rt({},I.props),_t),{},{activeIndex:Ve});return[E.cloneElement(Ie,wt),null,null]}return te?[Qe,null,null]:[Qe,null]}),ii(x,"renderCustomized",function(k,L,D){return E.cloneElement(k,rt(rt({key:"recharts-customized-".concat(D)},x.props),x.state))}),ii(x,"renderMap",{CartesianGrid:{handler:r5,once:!0},ReferenceArea:{handler:x.renderReferenceElement},ReferenceLine:{handler:r5},ReferenceDot:{handler:x.renderReferenceElement},XAxis:{handler:r5},YAxis:{handler:r5},Brush:{handler:x.renderBrush,once:!0},Bar:{handler:x.renderGraphicChild},Line:{handler:x.renderGraphicChild},Area:{handler:x.renderGraphicChild},Radar:{handler:x.renderGraphicChild},RadialBar:{handler:x.renderGraphicChild},Scatter:{handler:x.renderGraphicChild},Pie:{handler:x.renderGraphicChild},Funnel:{handler:x.renderGraphicChild},Tooltip:{handler:x.renderCursor,once:!0},PolarGrid:{handler:x.renderPolarGrid,once:!0},PolarAngleAxis:{handler:x.renderPolarAxis},PolarRadiusAxis:{handler:x.renderPolarAxis},Customized:{handler:x.renderCustomized}}),x.clipPathId="".concat((y=v.id)!==null&&y!==void 0?y:$C("recharts"),"-clip"),x.throttleTriggeredAfterMouseMove=SUe(x.triggeredAfterMouseMove,(C=v.throttleDelay)!==null&&C!==void 0?C:1e3/60),x.state={},x}return G2n(_,m),U2n(_,[{key:"componentDidMount",value:function(){var y,C;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(y=this.props.margin.left)!==null&&y!==void 0?y:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var y=this.props,C=y.children,x=y.data,k=y.height,L=y.layout,D=Td(C,Gm);if(D){var I=D.props.defaultIndex;if(!(typeof I!="number"||I<0||I>this.state.tooltipTicks.length-1)){var O=this.state.tooltipTicks[I]&&this.state.tooltipTicks[I].value,M=pse(this.state,x,I,O),B=this.state.tooltipTicks[I].coordinate,G=(this.state.offset.top+k)/2,W=L==="horizontal",z=W?{x:B,y:G}:{y:B,x:G},q=this.state.formattedGraphicalItems.find(function(Z){var j=Z.item;return j.type.name==="Scatter"});q&&(z=rt(rt({},z),q.props.points[I].tooltipPosition),M=q.props.points[I].tooltipPayload);var ee={activeTooltipIndex:I,isTooltipActive:!0,activeLabel:O,activePayload:M,activeCoordinate:z};this.setState(ee),this.renderCursor(D),this.accessibilityManager.setIndex(I)}}}},{key:"getSnapshotBeforeUpdate",value:function(y,C){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==C.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==y.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==y.margin){var x,k;this.accessibilityManager.setDetails({offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0}})}return null}},{key:"componentDidUpdate",value:function(y){Uie([Td(y.children,Gm)],[Td(this.props.children,Gm)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var y=Td(this.props.children,Gm);if(y&&typeof y.props.shared=="boolean"){var C=y.props.shared?"axis":"item";return a.indexOf(C)>=0?C:s}return s}},{key:"getMouseInfo",value:function(y){if(!this.container)return null;var C=this.container,x=C.getBoundingClientRect(),k=D_n(x),L={chartX:Math.round(y.pageX-k.left),chartY:Math.round(y.pageY-k.top)},D=x.width/C.offsetWidth||1,I=this.inRange(L.chartX,L.chartY,D);if(!I)return null;var O=this.state,M=O.xAxisMap,B=O.yAxisMap,G=this.getTooltipEventType();if(G!=="axis"&&M&&B){var W=Cv(M).scale,z=Cv(B).scale,q=W&&W.invert?W.invert(L.chartX):null,ee=z&&z.invert?z.invert(L.chartY):null;return rt(rt({},L),{},{xValue:q,yValue:ee})}var Z=uAe(this.state,this.props.data,this.props.layout,I);return Z?rt(rt({},L),Z):null}},{key:"inRange",value:function(y,C){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,k=this.props.layout,L=y/x,D=C/x;if(k==="horizontal"||k==="vertical"){var I=this.state.offset,O=L>=I.left&&L<=I.left+I.width&&D>=I.top&&D<=I.top+I.height;return O?{x:L,y:D}:null}var M=this.state,B=M.angleAxisMap,G=M.radiusAxisMap;if(B&&G){var W=Cv(B);return HDe({x:L,y:D},W)}return null}},{key:"parseEventsOfWrapper",value:function(){var y=this.props.children,C=this.getTooltipEventType(),x=Td(y,Gm),k={};x&&C==="axis"&&(x.props.trigger==="click"?k={onClick:this.handleClick}:k={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var L=H7(this.props,this.handleOuterEvent);return rt(rt({},L),k)}},{key:"addListener",value:function(){lG.on(cG,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){lG.removeListener(cG,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(y,C,x){for(var k=this.state.formattedGraphicalItems,L=0,D=k.length;L{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(hTn);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(_se,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(_se,{...i,ref:e,children:t})});zqe.displayName="Slot";var _se=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=gTn(t);return E.cloneElement(t,{...fTn(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});_se.displayName="SlotClone";var dTn=({children:n})=>ae.jsx(ae.Fragment,{children:n});function hTn(n){return E.isValidElement(n)&&n.type===dTn}function fTn(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function gTn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function pTn(n){const e=E.useRef({value:n,previous:n});return E.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}var mTn=[" ","Enter","ArrowUp","ArrowDown"],_Tn=[" ","Enter"],JO="Select",[jV,qV,vTn]=eae(JO),[W2,iVn]=Ac(JO,[vTn,c1]),KV=c1(),[bTn,p1]=W2(JO),[yTn,wTn]=W2(JO),Uqe=n=>{const{__scopeSelect:e,children:t,open:i,defaultOpen:r,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:h,required:f,form:g}=n,p=KV(e),[m,_]=E.useState(null),[v,y]=E.useState(null),[C,x]=E.useState(!1),k=$P(c),[L=!1,D]=Kp({prop:i,defaultProp:r,onChange:s}),[I,O]=Kp({prop:o,defaultProp:a,onChange:l}),M=E.useRef(null),B=m?g||!!m.closest("form"):!0,[G,W]=E.useState(new Set),z=Array.from(G).map(q=>q.props.value).join(";");return ae.jsx(UH,{...p,children:ae.jsxs(bTn,{required:f,scope:e,trigger:m,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:C,onValueNodeHasChildrenChange:x,contentId:Ud(),value:I,onValueChange:O,open:L,onOpenChange:D,dir:k,triggerPointerDownPosRef:M,disabled:h,children:[ae.jsx(jV.Provider,{scope:e,children:ae.jsx(yTn,{scope:n.__scopeSelect,onNativeOptionAdd:E.useCallback(q=>{W(ee=>new Set(ee).add(q))},[]),onNativeOptionRemove:E.useCallback(q=>{W(ee=>{const Z=new Set(ee);return Z.delete(q),Z})},[]),children:t})}),B?ae.jsxs(mKe,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:d,value:I,onChange:q=>O(q.target.value),disabled:h,form:g,children:[I===void 0?ae.jsx("option",{value:""}):null,Array.from(G)]},z):null]})})};Uqe.displayName=JO;var jqe="SelectTrigger",qqe=E.forwardRef((n,e)=>{const{__scopeSelect:t,disabled:i=!1,...r}=n,s=KV(t),o=p1(jqe,t),a=o.disabled||i,l=gi(e,o.onTriggerChange),c=qV(t),u=E.useRef("touch"),[d,h,f]=_Ke(p=>{const m=c().filter(y=>!y.disabled),_=m.find(y=>y.value===o.value),v=vKe(m,p,_);v!==void 0&&o.onValueChange(v.value)}),g=p=>{a||(o.onOpenChange(!0),f()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return ae.jsx(BO,{asChild:!0,...s,children:ae.jsx(Pn.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":pKe(o.value)?"":void 0,...r,ref:l,onClick:Kt(r.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&g(p)}),onPointerDown:Kt(r.onPointerDown,p=>{u.current=p.pointerType;const m=p.target;m.hasPointerCapture(p.pointerId)&&m.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:Kt(r.onKeyDown,p=>{const m=d.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&h(p.key),!(m&&p.key===" ")&&mTn.includes(p.key)&&(g(),p.preventDefault())})})})});qqe.displayName=jqe;var Kqe="SelectValue",Gqe=E.forwardRef((n,e)=>{const{__scopeSelect:t,className:i,style:r,children:s,placeholder:o="",...a}=n,l=p1(Kqe,t),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,d=gi(e,l.onValueNodeChange);return es(()=>{c(u)},[c,u]),ae.jsx(Pn.span,{...a,ref:d,style:{pointerEvents:"none"},children:pKe(l.value)?ae.jsx(ae.Fragment,{children:o}):s})});Gqe.displayName=Kqe;var CTn="SelectIcon",Yqe=E.forwardRef((n,e)=>{const{__scopeSelect:t,children:i,...r}=n;return ae.jsx(Pn.span,{"aria-hidden":!0,...r,ref:e,children:i||"▼"})});Yqe.displayName=CTn;var xTn="SelectPortal",Zqe=n=>ae.jsx(y2,{asChild:!0,...n});Zqe.displayName=xTn;var cC="SelectContent",Xqe=E.forwardRef((n,e)=>{const t=p1(cC,n.__scopeSelect),[i,r]=E.useState();if(es(()=>{r(new DocumentFragment)},[]),!t.open){const s=i;return s?h0.createPortal(ae.jsx(Qqe,{scope:n.__scopeSelect,children:ae.jsx(jV.Slot,{scope:n.__scopeSelect,children:ae.jsx("div",{children:n.children})})}),s):null}return ae.jsx(Jqe,{...n,ref:e})});Xqe.displayName=cC;var Ff=10,[Qqe,m1]=W2(cC),STn="SelectContentImpl",Jqe=E.forwardRef((n,e)=>{const{__scopeSelect:t,position:i="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:f,sticky:g,hideWhenDetached:p,avoidCollisions:m,..._}=n,v=p1(cC,t),[y,C]=E.useState(null),[x,k]=E.useState(null),L=gi(e,Re=>C(Re)),[D,I]=E.useState(null),[O,M]=E.useState(null),B=qV(t),[G,W]=E.useState(!1),z=E.useRef(!1);E.useEffect(()=>{if(y)return MO(y)},[y]),WH();const q=E.useCallback(Re=>{const[_t,...Qe]=B().map(Ue=>Ue.ref.current),[pt]=Qe.slice(-1),gt=document.activeElement;for(const Ue of Re)if(Ue===gt||(Ue?.scrollIntoView({block:"nearest"}),Ue===_t&&x&&(x.scrollTop=0),Ue===pt&&x&&(x.scrollTop=x.scrollHeight),Ue?.focus(),document.activeElement!==gt))return},[B,x]),ee=E.useCallback(()=>q([D,y]),[q,D,y]);E.useEffect(()=>{G&&ee()},[G,ee]);const{onOpenChange:Z,triggerPointerDownPosRef:j}=v;E.useEffect(()=>{if(y){let Re={x:0,y:0};const _t=pt=>{Re={x:Math.abs(Math.round(pt.pageX)-(j.current?.x??0)),y:Math.abs(Math.round(pt.pageY)-(j.current?.y??0))}},Qe=pt=>{Re.x<=10&&Re.y<=10?pt.preventDefault():y.contains(pt.target)||Z(!1),document.removeEventListener("pointermove",_t),j.current=null};return j.current!==null&&(document.addEventListener("pointermove",_t),document.addEventListener("pointerup",Qe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_t),document.removeEventListener("pointerup",Qe,{capture:!0})}}},[y,Z,j]),E.useEffect(()=>{const Re=()=>Z(!1);return window.addEventListener("blur",Re),window.addEventListener("resize",Re),()=>{window.removeEventListener("blur",Re),window.removeEventListener("resize",Re)}},[Z]);const[te,le]=_Ke(Re=>{const _t=B().filter(gt=>!gt.disabled),Qe=_t.find(gt=>gt.ref.current===document.activeElement),pt=vKe(_t,Re,Qe);pt&&setTimeout(()=>pt.ref.current.focus())}),ue=E.useCallback((Re,_t,Qe)=>{const pt=!z.current&&!Qe;(v.value!==void 0&&v.value===_t||pt)&&(I(Re),pt&&(z.current=!0))},[v.value]),de=E.useCallback(()=>y?.focus(),[y]),we=E.useCallback((Re,_t,Qe)=>{const pt=!z.current&&!Qe;(v.value!==void 0&&v.value===_t||pt)&&M(Re)},[v.value]),xe=i==="popper"?vse:eKe,Me=xe===vse?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:f,sticky:g,hideWhenDetached:p,avoidCollisions:m}:{};return ae.jsx(Qqe,{scope:t,content:y,viewport:x,onViewportChange:k,itemRefCallback:ue,selectedItem:D,onItemLeave:de,itemTextRefCallback:we,focusSelectedItem:ee,selectedItemText:O,position:i,isPositioned:G,searchRef:te,children:ae.jsx(OO,{as:zqe,allowPinchZoom:!0,children:ae.jsx(PO,{asChild:!0,trapped:v.open,onMountAutoFocus:Re=>{Re.preventDefault()},onUnmountAutoFocus:Kt(r,Re=>{v.trigger?.focus({preventScroll:!0}),Re.preventDefault()}),children:ae.jsx(b2,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:Re=>Re.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:ae.jsx(xe,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:Re=>Re.preventDefault(),..._,...Me,onPlaced:()=>W(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:Kt(_.onKeyDown,Re=>{const _t=Re.ctrlKey||Re.altKey||Re.metaKey;if(Re.key==="Tab"&&Re.preventDefault(),!_t&&Re.key.length===1&&le(Re.key),["ArrowUp","ArrowDown","Home","End"].includes(Re.key)){let pt=B().filter(gt=>!gt.disabled).map(gt=>gt.ref.current);if(["ArrowUp","End"].includes(Re.key)&&(pt=pt.slice().reverse()),["ArrowUp","ArrowDown"].includes(Re.key)){const gt=Re.target,Ue=pt.indexOf(gt);pt=pt.slice(Ue+1)}setTimeout(()=>q(pt)),Re.preventDefault()}})})})})})})});Jqe.displayName=STn;var kTn="SelectItemAlignedPosition",eKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,onPlaced:i,...r}=n,s=p1(cC,t),o=m1(cC,t),[a,l]=E.useState(null),[c,u]=E.useState(null),d=gi(e,L=>u(L)),h=qV(t),f=E.useRef(!1),g=E.useRef(!0),{viewport:p,selectedItem:m,selectedItemText:_,focusSelectedItem:v}=o,y=E.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&p&&m&&_){const L=s.trigger.getBoundingClientRect(),D=c.getBoundingClientRect(),I=s.valueNode.getBoundingClientRect(),O=_.getBoundingClientRect();if(s.dir!=="rtl"){const gt=O.left-D.left,Ue=I.left-gt,wn=L.left-Ue,Xt=L.width+wn,jn=Math.max(Xt,D.width),ji=window.innerWidth-Ff,ci=mse(Ue,[Ff,Math.max(Ff,ji-jn)]);a.style.minWidth=Xt+"px",a.style.left=ci+"px"}else{const gt=D.right-O.right,Ue=window.innerWidth-I.right-gt,wn=window.innerWidth-L.right-Ue,Xt=L.width+wn,jn=Math.max(Xt,D.width),ji=window.innerWidth-Ff,ci=mse(Ue,[Ff,Math.max(Ff,ji-jn)]);a.style.minWidth=Xt+"px",a.style.right=ci+"px"}const M=h(),B=window.innerHeight-Ff*2,G=p.scrollHeight,W=window.getComputedStyle(c),z=parseInt(W.borderTopWidth,10),q=parseInt(W.paddingTop,10),ee=parseInt(W.borderBottomWidth,10),Z=parseInt(W.paddingBottom,10),j=z+q+G+Z+ee,te=Math.min(m.offsetHeight*5,j),le=window.getComputedStyle(p),ue=parseInt(le.paddingTop,10),de=parseInt(le.paddingBottom,10),we=L.top+L.height/2-Ff,xe=B-we,Me=m.offsetHeight/2,Re=m.offsetTop+Me,_t=z+q+Re,Qe=j-_t;if(_t<=we){const gt=M.length>0&&m===M[M.length-1].ref.current;a.style.bottom="0px";const Ue=c.clientHeight-p.offsetTop-p.offsetHeight,wn=Math.max(xe,Me+(gt?de:0)+Ue+ee),Xt=_t+wn;a.style.height=Xt+"px"}else{const gt=M.length>0&&m===M[0].ref.current;a.style.top="0px";const wn=Math.max(we,z+p.offsetTop+(gt?ue:0)+Me)+Qe;a.style.height=wn+"px",p.scrollTop=_t-we+p.offsetTop}a.style.margin=`${Ff}px 0`,a.style.minHeight=te+"px",a.style.maxHeight=B+"px",i?.(),requestAnimationFrame(()=>f.current=!0)}},[h,s.trigger,s.valueNode,a,c,p,m,_,s.dir,i]);es(()=>y(),[y]);const[C,x]=E.useState();es(()=>{c&&x(window.getComputedStyle(c).zIndex)},[c]);const k=E.useCallback(L=>{L&&g.current===!0&&(y(),v?.(),g.current=!1)},[y,v]);return ae.jsx(LTn,{scope:t,contentWrapper:a,shouldExpandOnScrollRef:f,onScrollButtonChange:k,children:ae.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:ae.jsx(Pn.div,{...r,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});eKe.displayName=kTn;var ETn="SelectPopperPosition",vse=E.forwardRef((n,e)=>{const{__scopeSelect:t,align:i="start",collisionPadding:r=Ff,...s}=n,o=KV(t);return ae.jsx(jH,{...o,...s,ref:e,align:i,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});vse.displayName=ETn;var[LTn,qfe]=W2(cC,{}),bse="SelectViewport",tKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,nonce:i,...r}=n,s=m1(bse,t),o=qfe(bse,t),a=gi(e,s.onViewportChange),l=E.useRef(0);return ae.jsxs(ae.Fragment,{children:[ae.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),ae.jsx(jV.Slot,{scope:t,children:ae.jsx(Pn.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:Kt(r.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=o;if(h?.current&&d){const f=Math.abs(l.current-u.scrollTop);if(f>0){const g=window.innerHeight-Ff*2,p=parseFloat(d.style.minHeight),m=parseFloat(d.style.height),_=Math.max(p,m);if(_0?C:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});tKe.displayName=bse;var nKe="SelectGroup",[TTn,DTn]=W2(nKe),iKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,...i}=n,r=Ud();return ae.jsx(TTn,{scope:t,id:r,children:ae.jsx(Pn.div,{role:"group","aria-labelledby":r,...i,ref:e})})});iKe.displayName=nKe;var rKe="SelectLabel",sKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,...i}=n,r=DTn(rKe,t);return ae.jsx(Pn.div,{id:r.id,...i,ref:e})});sKe.displayName=rKe;var HB="SelectItem",[ITn,oKe]=W2(HB),aKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,value:i,disabled:r=!1,textValue:s,...o}=n,a=p1(HB,t),l=m1(HB,t),c=a.value===i,[u,d]=E.useState(s??""),[h,f]=E.useState(!1),g=gi(e,v=>l.itemRefCallback?.(v,i,r)),p=Ud(),m=E.useRef("touch"),_=()=>{r||(a.onValueChange(i),a.onOpenChange(!1))};if(i==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return ae.jsx(ITn,{scope:t,value:i,disabled:r,textId:p,isSelected:c,onItemTextChange:E.useCallback(v=>{d(y=>y||(v?.textContent??"").trim())},[]),children:ae.jsx(jV.ItemSlot,{scope:t,value:i,disabled:r,textValue:u,children:ae.jsx(Pn.div,{role:"option","aria-labelledby":p,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:g,onFocus:Kt(o.onFocus,()=>f(!0)),onBlur:Kt(o.onBlur,()=>f(!1)),onClick:Kt(o.onClick,()=>{m.current!=="mouse"&&_()}),onPointerUp:Kt(o.onPointerUp,()=>{m.current==="mouse"&&_()}),onPointerDown:Kt(o.onPointerDown,v=>{m.current=v.pointerType}),onPointerMove:Kt(o.onPointerMove,v=>{m.current=v.pointerType,r?l.onItemLeave?.():m.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Kt(o.onPointerLeave,v=>{v.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:Kt(o.onKeyDown,v=>{l.searchRef?.current!==""&&v.key===" "||(_Tn.includes(v.key)&&_(),v.key===" "&&v.preventDefault())})})})})});aKe.displayName=HB;var eI="SelectItemText",lKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,className:i,style:r,...s}=n,o=p1(eI,t),a=m1(eI,t),l=oKe(eI,t),c=wTn(eI,t),[u,d]=E.useState(null),h=gi(e,_=>d(_),l.onItemTextChange,_=>a.itemTextRefCallback?.(_,l.value,l.disabled)),f=u?.textContent,g=E.useMemo(()=>ae.jsx("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:p,onNativeOptionRemove:m}=c;return es(()=>(p(g),()=>m(g)),[p,m,g]),ae.jsxs(ae.Fragment,{children:[ae.jsx(Pn.span,{id:l.textId,...s,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?h0.createPortal(s.children,o.valueNode):null]})});lKe.displayName=eI;var cKe="SelectItemIndicator",uKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,...i}=n;return oKe(cKe,t).isSelected?ae.jsx(Pn.span,{"aria-hidden":!0,...i,ref:e}):null});uKe.displayName=cKe;var yse="SelectScrollUpButton",dKe=E.forwardRef((n,e)=>{const t=m1(yse,n.__scopeSelect),i=qfe(yse,n.__scopeSelect),[r,s]=E.useState(!1),o=gi(e,i.onScrollButtonChange);return es(()=>{if(t.viewport&&t.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=t.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[t.viewport,t.isPositioned]),r?ae.jsx(fKe,{...n,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=t;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});dKe.displayName=yse;var wse="SelectScrollDownButton",hKe=E.forwardRef((n,e)=>{const t=m1(wse,n.__scopeSelect),i=qfe(wse,n.__scopeSelect),[r,s]=E.useState(!1),o=gi(e,i.onScrollButtonChange);return es(()=>{if(t.viewport&&t.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)l.removeEventListener("scroll",a)}},[t.viewport,t.isPositioned]),r?ae.jsx(fKe,{...n,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=t;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});hKe.displayName=wse;var fKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,onAutoScroll:i,...r}=n,s=m1("SelectScrollButton",t),o=E.useRef(null),a=qV(t),l=E.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return E.useEffect(()=>()=>l(),[l]),es(()=>{a().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),ae.jsx(Pn.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:Kt(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(i,50))}),onPointerMove:Kt(r.onPointerMove,()=>{s.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(i,50))}),onPointerLeave:Kt(r.onPointerLeave,()=>{l()})})}),ATn="SelectSeparator",gKe=E.forwardRef((n,e)=>{const{__scopeSelect:t,...i}=n;return ae.jsx(Pn.div,{"aria-hidden":!0,...i,ref:e})});gKe.displayName=ATn;var Cse="SelectArrow",NTn=E.forwardRef((n,e)=>{const{__scopeSelect:t,...i}=n,r=KV(t),s=p1(Cse,t),o=m1(Cse,t);return s.open&&o.position==="popper"?ae.jsx(qH,{...r,...i,ref:e}):null});NTn.displayName=Cse;function pKe(n){return n===""||n===void 0}var mKe=E.forwardRef((n,e)=>{const{value:t,...i}=n,r=E.useRef(null),s=gi(e,r),o=pTn(t);return E.useEffect(()=>{const a=r.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==t&&u){const d=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(d)}},[o,t]),ae.jsx(Ihe,{asChild:!0,children:ae.jsx("select",{...i,ref:s,defaultValue:t})})});mKe.displayName="BubbleSelect";function _Ke(n){const e=Ua(n),t=E.useRef(""),i=E.useRef(0),r=E.useCallback(o=>{const a=t.current+o;e(a),function l(c){t.current=c,window.clearTimeout(i.current),c!==""&&(i.current=window.setTimeout(()=>l(""),1e3))}(a)},[e]),s=E.useCallback(()=>{t.current="",window.clearTimeout(i.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(i.current),[]),[t,r,s]}function vKe(n,e,t){const r=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=t?n.indexOf(t):-1;let o=RTn(n,Math.max(s,0));r.length===1&&(o=o.filter(c=>c!==t));const l=o.find(c=>c.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==t?l:void 0}function RTn(n,e){return n.map((t,i)=>n[(e+i)%n.length])}var rVn=Uqe,sVn=qqe,oVn=Gqe,aVn=Yqe,lVn=Zqe,cVn=Xqe,uVn=tKe,dVn=iKe,hVn=sKe,fVn=aKe,gVn=lKe,pVn=uKe,mVn=dKe,_Vn=hKe,vVn=gKe;const bKe=6048e5,PTn=864e5,fAe=Symbol.for("constructDateFrom");function Xa(n,e){return typeof n=="function"?n(e):n&&typeof n=="object"&&fAe in n?n[fAe](e):n instanceof Date?new n.constructor(e):new Date(e)}function Es(n,e){return Xa(e||n,n)}function Kfe(n,e,t){const i=Es(n,t?.in);return isNaN(e)?Xa(n,NaN):(e&&i.setDate(i.getDate()+e),i)}function yKe(n,e,t){const i=Es(n,t?.in);if(isNaN(e))return Xa(n,NaN);if(!e)return i;const r=i.getDate(),s=Xa(n,i.getTime());s.setMonth(i.getMonth()+e+1,0);const o=s.getDate();return r>=o?s:(i.setFullYear(s.getFullYear(),s.getMonth(),r),i)}let OTn={};function eM(){return OTn}function zb(n,e){const t=eM(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,r=Es(n,e?.in),s=r.getDay(),o=(s=s.getTime()?i+1:t.getTime()>=a.getTime()?i:i-1}function gAe(n){const e=Es(n),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+n-+t}function zC(n,...e){const t=Xa.bind(null,n||e.find(i=>typeof i=="object"));return e.map(t)}function AL(n,e){const t=Es(n,e?.in);return t.setHours(0,0,0,0),t}function CKe(n,e,t){const[i,r]=zC(t?.in,n,e),s=AL(i),o=AL(r),a=+s-gAe(s),l=+o-gAe(o);return Math.round((a-l)/PTn)}function MTn(n,e){const t=wKe(n,e),i=Xa(n,0);return i.setFullYear(t,0,4),i.setHours(0,0,0,0),yP(i)}function FTn(n,e,t){return Kfe(n,e*7,t)}function BTn(n,e,t){return yKe(n,e*12,t)}function $Tn(n,e){let t,i=e?.in;return n.forEach(r=>{!i&&typeof r=="object"&&(i=Xa.bind(null,r));const s=Es(r,i);(!t||t{!i&&typeof r=="object"&&(i=Xa.bind(null,r));const s=Es(r,i);(!t||t>s||isNaN(+s))&&(t=s)}),Xa(i,t||NaN)}function HTn(n,e,t){const[i,r]=zC(t?.in,n,e);return+AL(i)==+AL(r)}function xKe(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function VTn(n){return!(!xKe(n)&&typeof n!="number"||isNaN(+Es(n)))}function zTn(n,e,t){const[i,r]=zC(t?.in,n,e),s=i.getFullYear()-r.getFullYear(),o=i.getMonth()-r.getMonth();return s*12+o}function UTn(n,e){const t=Es(n,e?.in),i=t.getMonth();return t.setFullYear(t.getFullYear(),i+1,0),t.setHours(23,59,59,999),t}function jTn(n,e){const[t,i]=zC(n,e.start,e.end);return{start:t,end:i}}function qTn(n,e){const{start:t,end:i}=jTn(e?.in,n);let r=+t>+i;const s=r?+t:+i,o=r?i:t;o.setHours(0,0,0,0),o.setDate(1);let a=1;const l=[];for(;+o<=s;)l.push(Xa(t,o)),o.setMonth(o.getMonth()+a);return r?l.reverse():l}function KTn(n,e){const t=Es(n,e?.in);return t.setDate(1),t.setHours(0,0,0,0),t}function GTn(n,e){const t=Es(n,e?.in),i=t.getFullYear();return t.setFullYear(i+1,0,0),t.setHours(23,59,59,999),t}function SKe(n,e){const t=Es(n,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function kKe(n,e){const t=eM(),i=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,r=Es(n,e?.in),s=r.getDay(),o=(s{let i;const r=ZTn[n];return typeof r=="string"?i=r:e===1?i=r.one:i=r.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+i:i+" ago":i};function Vk(n){return(e={})=>{const t=e.width?String(e.width):n.defaultWidth;return n.formats[t]||n.formats[n.defaultWidth]}}const QTn={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},JTn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},eDn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},tDn={date:Vk({formats:QTn,defaultWidth:"full"}),time:Vk({formats:JTn,defaultWidth:"full"}),dateTime:Vk({formats:eDn,defaultWidth:"full"})},nDn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},iDn=(n,e,t,i)=>nDn[n];function Sp(n){return(e,t)=>{const i=t?.context?String(t.context):"standalone";let r;if(i==="formatting"&&n.formattingValues){const o=n.defaultFormattingWidth||n.defaultWidth,a=t?.width?String(t.width):o;r=n.formattingValues[a]||n.formattingValues[o]}else{const o=n.defaultWidth,a=t?.width?String(t.width):n.defaultWidth;r=n.values[a]||n.values[o]}const s=n.argumentCallback?n.argumentCallback(e):e;return r[s]}}const rDn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},sDn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},oDn={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},aDn={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},lDn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},cDn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},uDn=(n,e)=>{const t=Number(n),i=t%100;if(i>20||i<10)switch(i%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},dDn={ordinalNumber:uDn,era:Sp({values:rDn,defaultWidth:"wide"}),quarter:Sp({values:sDn,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Sp({values:oDn,defaultWidth:"wide"}),day:Sp({values:aDn,defaultWidth:"wide"}),dayPeriod:Sp({values:lDn,defaultWidth:"wide",formattingValues:cDn,defaultFormattingWidth:"wide"})};function kp(n){return(e,t={})=>{const i=t.width,r=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],s=e.match(r);if(!s)return null;const o=s[0],a=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(a)?fDn(a,d=>d.test(o)):hDn(a,d=>d.test(o));let c;c=n.valueCallback?n.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;const u=e.slice(o.length);return{value:c,rest:u}}}function hDn(n,e){for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&e(n[t]))return t}function fDn(n,e){for(let t=0;t{const i=e.match(n.matchPattern);if(!i)return null;const r=i[0],s=e.match(n.parsePattern);if(!s)return null;let o=n.valueCallback?n.valueCallback(s[0]):s[0];o=t.valueCallback?t.valueCallback(o):o;const a=e.slice(r.length);return{value:o,rest:a}}}const gDn=/^(\d+)(th|st|nd|rd)?/i,pDn=/\d+/i,mDn={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},_Dn={any:[/^b/i,/^(a|c)/i]},vDn={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},bDn={any:[/1/i,/2/i,/3/i,/4/i]},yDn={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},wDn={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},CDn={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},xDn={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},SDn={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},kDn={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},EDn={ordinalNumber:EKe({matchPattern:gDn,parsePattern:pDn,valueCallback:n=>parseInt(n,10)}),era:kp({matchPatterns:mDn,defaultMatchWidth:"wide",parsePatterns:_Dn,defaultParseWidth:"any"}),quarter:kp({matchPatterns:vDn,defaultMatchWidth:"wide",parsePatterns:bDn,defaultParseWidth:"any",valueCallback:n=>n+1}),month:kp({matchPatterns:yDn,defaultMatchWidth:"wide",parsePatterns:wDn,defaultParseWidth:"any"}),day:kp({matchPatterns:CDn,defaultMatchWidth:"wide",parsePatterns:xDn,defaultParseWidth:"any"}),dayPeriod:kp({matchPatterns:SDn,defaultMatchWidth:"any",parsePatterns:kDn,defaultParseWidth:"any"})},Gfe={code:"en-US",formatDistance:XTn,formatLong:tDn,formatRelative:iDn,localize:dDn,match:EDn,options:{weekStartsOn:0,firstWeekContainsDate:1}};function LDn(n,e){const t=Es(n,e?.in);return CKe(t,SKe(t))+1}function LKe(n,e){const t=Es(n,e?.in),i=+yP(t)-+MTn(t);return Math.round(i/bKe)+1}function TKe(n,e){const t=Es(n,e?.in),i=t.getFullYear(),r=eM(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=Xa(e?.in||n,0);o.setFullYear(i+1,0,s),o.setHours(0,0,0,0);const a=zb(o,e),l=Xa(e?.in||n,0);l.setFullYear(i,0,s),l.setHours(0,0,0,0);const c=zb(l,e);return+t>=+a?i+1:+t>=+c?i:i-1}function TDn(n,e){const t=eM(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,r=TKe(n,e),s=Xa(e?.in||n,0);return s.setFullYear(r,0,i),s.setHours(0,0,0,0),zb(s,e)}function DKe(n,e){const t=Es(n,e?.in),i=+zb(t,e)-+TDn(t,e);return Math.round(i/bKe)+1}function gs(n,e){const t=n<0?"-":"",i=Math.abs(n).toString().padStart(e,"0");return t+i}const K0={y(n,e){const t=n.getFullYear(),i=t>0?t:1-t;return gs(e==="yy"?i%100:i,e.length)},M(n,e){const t=n.getMonth();return e==="M"?String(t+1):gs(t+1,2)},d(n,e){return gs(n.getDate(),e.length)},a(n,e){const t=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(n,e){return gs(n.getHours()%12||12,e.length)},H(n,e){return gs(n.getHours(),e.length)},m(n,e){return gs(n.getMinutes(),e.length)},s(n,e){return gs(n.getSeconds(),e.length)},S(n,e){const t=e.length,i=n.getMilliseconds(),r=Math.trunc(i*Math.pow(10,t-3));return gs(r,e.length)}},jx={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},pAe={G:function(n,e,t){const i=n.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(i,{width:"abbreviated"});case"GGGGG":return t.era(i,{width:"narrow"});case"GGGG":default:return t.era(i,{width:"wide"})}},y:function(n,e,t){if(e==="yo"){const i=n.getFullYear(),r=i>0?i:1-i;return t.ordinalNumber(r,{unit:"year"})}return K0.y(n,e)},Y:function(n,e,t,i){const r=TKe(n,i),s=r>0?r:1-r;if(e==="YY"){const o=s%100;return gs(o,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):gs(s,e.length)},R:function(n,e){const t=wKe(n);return gs(t,e.length)},u:function(n,e){const t=n.getFullYear();return gs(t,e.length)},Q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"Q":return String(i);case"QQ":return gs(i,2);case"Qo":return t.ordinalNumber(i,{unit:"quarter"});case"QQQ":return t.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(i,{width:"wide",context:"formatting"})}},q:function(n,e,t){const i=Math.ceil((n.getMonth()+1)/3);switch(e){case"q":return String(i);case"qq":return gs(i,2);case"qo":return t.ordinalNumber(i,{unit:"quarter"});case"qqq":return t.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(i,{width:"wide",context:"standalone"})}},M:function(n,e,t){const i=n.getMonth();switch(e){case"M":case"MM":return K0.M(n,e);case"Mo":return t.ordinalNumber(i+1,{unit:"month"});case"MMM":return t.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(i,{width:"wide",context:"formatting"})}},L:function(n,e,t){const i=n.getMonth();switch(e){case"L":return String(i+1);case"LL":return gs(i+1,2);case"Lo":return t.ordinalNumber(i+1,{unit:"month"});case"LLL":return t.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(i,{width:"wide",context:"standalone"})}},w:function(n,e,t,i){const r=DKe(n,i);return e==="wo"?t.ordinalNumber(r,{unit:"week"}):gs(r,e.length)},I:function(n,e,t){const i=LKe(n);return e==="Io"?t.ordinalNumber(i,{unit:"week"}):gs(i,e.length)},d:function(n,e,t){return e==="do"?t.ordinalNumber(n.getDate(),{unit:"date"}):K0.d(n,e)},D:function(n,e,t){const i=LDn(n);return e==="Do"?t.ordinalNumber(i,{unit:"dayOfYear"}):gs(i,e.length)},E:function(n,e,t){const i=n.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(i,{width:"short",context:"formatting"});case"EEEE":default:return t.day(i,{width:"wide",context:"formatting"})}},e:function(n,e,t,i){const r=n.getDay(),s=(r-i.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return gs(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(r,{width:"short",context:"formatting"});case"eeee":default:return t.day(r,{width:"wide",context:"formatting"})}},c:function(n,e,t,i){const r=n.getDay(),s=(r-i.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return gs(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(r,{width:"narrow",context:"standalone"});case"cccccc":return t.day(r,{width:"short",context:"standalone"});case"cccc":default:return t.day(r,{width:"wide",context:"standalone"})}},i:function(n,e,t){const i=n.getDay(),r=i===0?7:i;switch(e){case"i":return String(r);case"ii":return gs(r,e.length);case"io":return t.ordinalNumber(r,{unit:"day"});case"iii":return t.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(i,{width:"short",context:"formatting"});case"iiii":default:return t.day(i,{width:"wide",context:"formatting"})}},a:function(n,e,t){const r=n.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(n,e,t){const i=n.getHours();let r;switch(i===12?r=jx.noon:i===0?r=jx.midnight:r=i/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(n,e,t){const i=n.getHours();let r;switch(i>=17?r=jx.evening:i>=12?r=jx.afternoon:i>=4?r=jx.morning:r=jx.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(n,e,t){if(e==="ho"){let i=n.getHours()%12;return i===0&&(i=12),t.ordinalNumber(i,{unit:"hour"})}return K0.h(n,e)},H:function(n,e,t){return e==="Ho"?t.ordinalNumber(n.getHours(),{unit:"hour"}):K0.H(n,e)},K:function(n,e,t){const i=n.getHours()%12;return e==="Ko"?t.ordinalNumber(i,{unit:"hour"}):gs(i,e.length)},k:function(n,e,t){let i=n.getHours();return i===0&&(i=24),e==="ko"?t.ordinalNumber(i,{unit:"hour"}):gs(i,e.length)},m:function(n,e,t){return e==="mo"?t.ordinalNumber(n.getMinutes(),{unit:"minute"}):K0.m(n,e)},s:function(n,e,t){return e==="so"?t.ordinalNumber(n.getSeconds(),{unit:"second"}):K0.s(n,e)},S:function(n,e){return K0.S(n,e)},X:function(n,e,t){const i=n.getTimezoneOffset();if(i===0)return"Z";switch(e){case"X":return _Ae(i);case"XXXX":case"XX":return ry(i);case"XXXXX":case"XXX":default:return ry(i,":")}},x:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"x":return _Ae(i);case"xxxx":case"xx":return ry(i);case"xxxxx":case"xxx":default:return ry(i,":")}},O:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+mAe(i,":");case"OOOO":default:return"GMT"+ry(i,":")}},z:function(n,e,t){const i=n.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+mAe(i,":");case"zzzz":default:return"GMT"+ry(i,":")}},t:function(n,e,t){const i=Math.trunc(+n/1e3);return gs(i,e.length)},T:function(n,e,t){return gs(+n,e.length)}};function mAe(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=Math.trunc(i/60),s=i%60;return s===0?t+String(r):t+String(r)+e+gs(s,2)}function _Ae(n,e){return n%60===0?(n>0?"-":"+")+gs(Math.abs(n)/60,2):ry(n,e)}function ry(n,e=""){const t=n>0?"-":"+",i=Math.abs(n),r=gs(Math.trunc(i/60),2),s=gs(i%60,2);return t+r+e+s}const vAe=(n,e)=>{switch(n){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},IKe=(n,e)=>{switch(n){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},DDn=(n,e)=>{const t=n.match(/(P+)(p+)?/)||[],i=t[1],r=t[2];if(!r)return vAe(n,e);let s;switch(i){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",vAe(i,e)).replace("{{time}}",IKe(r,e))},IDn={p:IKe,P:DDn},ADn=/^D+$/,NDn=/^Y+$/,RDn=["D","DD","YY","YYYY"];function PDn(n){return ADn.test(n)}function ODn(n){return NDn.test(n)}function MDn(n,e,t){const i=FDn(n,e,t);if(console.warn(i),RDn.includes(n))throw new RangeError(i)}function FDn(n,e,t){const i=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${e}\`) for formatting ${i} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const BDn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$Dn=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,WDn=/^'([^]*?)'?$/,HDn=/''/g,VDn=/[a-zA-Z]/;function zDn(n,e,t){const i=eM(),r=t?.locale??i.locale??Gfe,s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,a=Es(n,t?.in);if(!VTn(a))throw new RangeError("Invalid time value");let l=e.match($Dn).map(u=>{const d=u[0];if(d==="p"||d==="P"){const h=IDn[d];return h(u,r.formatLong)}return u}).join("").match(BDn).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:UDn(u)};if(pAe[d])return{isToken:!0,value:u};if(d.match(VDn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});r.localize.preprocessor&&(l=r.localize.preprocessor(a,l));const c={firstWeekContainsDate:s,weekStartsOn:o,locale:r};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!t?.useAdditionalWeekYearTokens&&ODn(d)||!t?.useAdditionalDayOfYearTokens&&PDn(d))&&MDn(d,e,String(n));const h=pAe[d[0]];return h(a,d,r.localize,c)}).join("")}function UDn(n){const e=n.match(WDn);return e?e[1].replace(HDn,"'"):n}function jDn(n,e){const t=Es(n,e?.in),i=t.getFullYear(),r=t.getMonth(),s=Xa(t,0);return s.setFullYear(i,r+1,0),s.setHours(0,0,0,0),s.getDate()}function qDn(n,e){return Es(n,e?.in).getMonth()}function KDn(n,e){return Es(n,e?.in).getFullYear()}function GDn(n,e){return+Es(n)>+Es(e)}function YDn(n,e){return+Es(n)<+Es(e)}function ZDn(n,e,t){const[i,r]=zC(t?.in,n,e);return+zb(i,t)==+zb(r,t)}function XDn(n,e,t){const[i,r]=zC(t?.in,n,e);return i.getFullYear()===r.getFullYear()&&i.getMonth()===r.getMonth()}function QDn(n,e,t){const[i,r]=zC(t?.in,n,e);return i.getFullYear()===r.getFullYear()}function bVn(n,e,t){return Kfe(n,-e,t)}function JDn(n,e,t){const i=Es(n,t?.in),r=i.getFullYear(),s=i.getDate(),o=Xa(n,0);o.setFullYear(r,e,15),o.setHours(0,0,0,0);const a=jDn(o);return i.setMonth(e,Math.min(s,a)),i}function eIn(n,e,t){const i=Es(n,t?.in);return isNaN(+i)?Xa(n,NaN):(i.setFullYear(e),i)}function yVn(n){return AL(Date.now(),n)}const tIn={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},nIn=(n,e,t)=>{let i;const r=tIn[n];return typeof r=="string"?i=r:e===1?i=r.one:i=r.other.replace("{{count}}",String(e)),t?.addSuffix?t.comparison&&t.comparison>0?i+"内":i+"前":i},iIn={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},rIn={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},sIn={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},oIn={date:Vk({formats:iIn,defaultWidth:"full"}),time:Vk({formats:rIn,defaultWidth:"full"}),dateTime:Vk({formats:sIn,defaultWidth:"full"})};function bAe(n,e,t){const i="eeee p";return ZDn(n,e,t)?i:n.getTime()>e.getTime()?"'下个'"+i:"'上个'"+i}const aIn={lastWeek:bAe,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:bAe,other:"PP p"},lIn=(n,e,t,i)=>{const r=aIn[n];return typeof r=="function"?r(e,t,i):r},cIn={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},uIn={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},dIn={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},hIn={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},fIn={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},gIn={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},pIn=(n,e)=>{const t=Number(n);switch(e?.unit){case"date":return t.toString()+"日";case"hour":return t.toString()+"时";case"minute":return t.toString()+"分";case"second":return t.toString()+"秒";default:return"第 "+t.toString()}},mIn={ordinalNumber:pIn,era:Sp({values:cIn,defaultWidth:"wide"}),quarter:Sp({values:uIn,defaultWidth:"wide",argumentCallback:n=>n-1}),month:Sp({values:dIn,defaultWidth:"wide"}),day:Sp({values:hIn,defaultWidth:"wide"}),dayPeriod:Sp({values:fIn,defaultWidth:"wide",formattingValues:gIn,defaultFormattingWidth:"wide"})},_In=/^(第\s*)?\d+(日|时|分|秒)?/i,vIn=/\d+/i,bIn={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},yIn={any:[/^(前)/i,/^(公元)/i]},wIn={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},CIn={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},xIn={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},SIn={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},kIn={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},EIn={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},LIn={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},TIn={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},DIn={ordinalNumber:EKe({matchPattern:_In,parsePattern:vIn,valueCallback:n=>parseInt(n,10)}),era:kp({matchPatterns:bIn,defaultMatchWidth:"wide",parsePatterns:yIn,defaultParseWidth:"any"}),quarter:kp({matchPatterns:wIn,defaultMatchWidth:"wide",parsePatterns:CIn,defaultParseWidth:"any",valueCallback:n=>n+1}),month:kp({matchPatterns:xIn,defaultMatchWidth:"wide",parsePatterns:SIn,defaultParseWidth:"any"}),day:kp({matchPatterns:kIn,defaultMatchWidth:"wide",parsePatterns:EIn,defaultParseWidth:"any"}),dayPeriod:kp({matchPatterns:LIn,defaultMatchWidth:"any",parsePatterns:TIn,defaultParseWidth:"any"})},wVn={code:"zh-CN",formatDistance:nIn,formatLong:oIn,formatRelative:lIn,localize:mIn,match:DIn,options:{weekStartsOn:1,firstWeekContainsDate:4}},IIn={},tI={};function gA(n,e){try{const i=(IIn[n]||=new Intl.DateTimeFormat("en-GB",{timeZone:n,hour:"numeric",timeZoneName:"longOffset"}).format)(e).split("GMT")[1]||"";return i in tI?tI[i]:yAe(i,i.split(":"))}catch{if(n in tI)return tI[n];const t=n?.match(AIn);return t?yAe(n,t.slice(1)):NaN}}const AIn=/([+-]\d\d):?(\d\d)?/;function yAe(n,e){const t=+e[0],i=+(e[1]||0);return tI[n]=t>0?t*60+i:t*60-i}class Np extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(gA(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),AKe(this),xse(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new Np(...t,e):new Np(Date.now(),e)}withTimeZone(e){return new Np(+this,e)}getTimezoneOffset(){return-gA(this.timeZone,this)}setTime(e){return Date.prototype.setTime.apply(this,arguments),xse(this),+this}[Symbol.for("constructDateFrom")](e){return new Np(+new Date(e),this.timeZone)}}const wAe=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!wAe.test(n))return;const e=n.replace(wAe,"$1UTC");Np.prototype[e]&&(n.startsWith("get")?Np.prototype[n]=function(){return this.internal[e]()}:(Np.prototype[n]=function(){return Date.prototype[e].apply(this.internal,arguments),NIn(this),+this},Np.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),xse(this),+this}))});function xse(n){n.internal.setTime(+n),n.internal.setUTCMinutes(n.internal.getUTCMinutes()-n.getTimezoneOffset())}function NIn(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),AKe(n)}function AKe(n){const e=gA(n.timeZone,n),t=new Date(+n);t.setUTCHours(t.getUTCHours()-1);const i=-new Date(+n).getTimezoneOffset(),r=-new Date(+t).getTimezoneOffset(),s=i-r,o=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();s&&o&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+s);const a=i-e;a&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+a);const l=gA(n.timeZone,n),u=-new Date(+n).getTimezoneOffset()-l,d=l!==e,h=u-a;if(d&&h){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+h);const f=gA(n.timeZone,n),g=l-f;g&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+g),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+g))}}class ac extends Np{static tz(e,...t){return t.length?new ac(...t,e):new ac(Date.now(),e)}toISOString(){const[e,t,i]=this.tzComponents(),r=`${e}${t}:${i}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,i,r]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${i} ${t} ${r}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,i,r]=this.tzComponents();return`${e} GMT${t}${i}${r} (${RIn(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",i=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),r=String(Math.abs(e)%60).padStart(2,"0");return[t,i,r]}withTimeZone(e){return new ac(+this,e)}[Symbol.for("constructDateFrom")](e){return new ac(+new Date(e),this.timeZone)}}function RIn(n,e){return new Intl.DateTimeFormat("en-GB",{timeZone:n,timeZoneName:"long"}).format(e).slice(12)}var Fn;(function(n){n.Root="root",n.Chevron="chevron",n.Day="day",n.DayButton="day_button",n.CaptionLabel="caption_label",n.Dropdowns="dropdowns",n.Dropdown="dropdown",n.DropdownRoot="dropdown_root",n.Footer="footer",n.MonthGrid="month_grid",n.MonthCaption="month_caption",n.MonthsDropdown="months_dropdown",n.Month="month",n.Months="months",n.Nav="nav",n.NextMonthButton="button_next",n.PreviousMonthButton="button_previous",n.Week="week",n.Weeks="weeks",n.Weekday="weekday",n.Weekdays="weekdays",n.WeekNumber="week_number",n.WeekNumberHeader="week_number_header",n.YearsDropdown="years_dropdown"})(Fn||(Fn={}));var vo;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(vo||(vo={}));var lg;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(lg||(lg={}));var Dd;(function(n){n.weeks_before_enter="weeks_before_enter",n.weeks_before_exit="weeks_before_exit",n.weeks_after_enter="weeks_after_enter",n.weeks_after_exit="weeks_after_exit",n.caption_after_enter="caption_after_enter",n.caption_after_exit="caption_after_exit",n.caption_before_enter="caption_before_enter",n.caption_before_exit="caption_before_exit"})(Dd||(Dd={}));const CAe=5,PIn=4;function OIn(n,e){const t=e.startOfMonth(n),i=t.getDay()>0?t.getDay():7,r=e.addDays(n,-i+1),s=e.addDays(r,CAe*7-1);return e.getMonth(n)===e.getMonth(s)?CAe:PIn}function NKe(n,e){const t=e.startOfMonth(n),i=t.getDay();return i===1?t:i===0?e.addDays(t,-1*6):e.addDays(t,-1*(i-1))}function MIn(n,e){const t=NKe(n,e),i=OIn(n,e);return e.addDays(t,i*7-1)}class E0{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?ac.tz(this.options.timeZone):new this.Date,this.newDate=(i,r,s)=>this.overrides?.newDate?this.overrides.newDate(i,r,s):this.options.timeZone?new ac(i,r,s,this.options.timeZone):new Date(i,r,s),this.addDays=(i,r)=>this.overrides?.addDays?this.overrides.addDays(i,r):Kfe(i,r),this.addMonths=(i,r)=>this.overrides?.addMonths?this.overrides.addMonths(i,r):yKe(i,r),this.addWeeks=(i,r)=>this.overrides?.addWeeks?this.overrides.addWeeks(i,r):FTn(i,r),this.addYears=(i,r)=>this.overrides?.addYears?this.overrides.addYears(i,r):BTn(i,r),this.differenceInCalendarDays=(i,r)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(i,r):CKe(i,r),this.differenceInCalendarMonths=(i,r)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(i,r):zTn(i,r),this.eachMonthOfInterval=i=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(i):qTn(i),this.endOfBroadcastWeek=i=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(i):MIn(i,this),this.endOfISOWeek=i=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(i):YTn(i),this.endOfMonth=i=>this.overrides?.endOfMonth?this.overrides.endOfMonth(i):UTn(i),this.endOfWeek=(i,r)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(i,r):kKe(i,this.options),this.endOfYear=i=>this.overrides?.endOfYear?this.overrides.endOfYear(i):GTn(i),this.format=(i,r,s)=>{const o=this.overrides?.format?this.overrides.format(i,r,this.options):zDn(i,r,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=i=>this.overrides?.getISOWeek?this.overrides.getISOWeek(i):LKe(i),this.getMonth=(i,r)=>this.overrides?.getMonth?this.overrides.getMonth(i,this.options):qDn(i,this.options),this.getYear=(i,r)=>this.overrides?.getYear?this.overrides.getYear(i,this.options):KDn(i,this.options),this.getWeek=(i,r)=>this.overrides?.getWeek?this.overrides.getWeek(i,this.options):DKe(i,this.options),this.isAfter=(i,r)=>this.overrides?.isAfter?this.overrides.isAfter(i,r):GDn(i,r),this.isBefore=(i,r)=>this.overrides?.isBefore?this.overrides.isBefore(i,r):YDn(i,r),this.isDate=i=>this.overrides?.isDate?this.overrides.isDate(i):xKe(i),this.isSameDay=(i,r)=>this.overrides?.isSameDay?this.overrides.isSameDay(i,r):HTn(i,r),this.isSameMonth=(i,r)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(i,r):XDn(i,r),this.isSameYear=(i,r)=>this.overrides?.isSameYear?this.overrides.isSameYear(i,r):QDn(i,r),this.max=i=>this.overrides?.max?this.overrides.max(i):$Tn(i),this.min=i=>this.overrides?.min?this.overrides.min(i):WTn(i),this.setMonth=(i,r)=>this.overrides?.setMonth?this.overrides.setMonth(i,r):JDn(i,r),this.setYear=(i,r)=>this.overrides?.setYear?this.overrides.setYear(i,r):eIn(i,r),this.startOfBroadcastWeek=(i,r)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(i,this):NKe(i,this),this.startOfDay=i=>this.overrides?.startOfDay?this.overrides.startOfDay(i):AL(i),this.startOfISOWeek=i=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(i):yP(i),this.startOfMonth=i=>this.overrides?.startOfMonth?this.overrides.startOfMonth(i):KTn(i),this.startOfWeek=(i,r)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(i,this.options):zb(i,this.options),this.startOfYear=i=>this.overrides?.startOfYear?this.overrides.startOfYear(i):SKe(i),this.options={locale:Gfe,...e},this.overrides=t}getDigitMap(){const{numerals:e="latn"}=this.options,t=new Intl.NumberFormat("en-US",{numberingSystem:e}),i={};for(let r=0;r<10;r++)i[r.toString()]=t.format(r);return i}replaceDigits(e){const t=this.getDigitMap();return e.replace(/\d/g,i=>t[i]||i)}formatNumber(e){return this.replaceDigits(e.toString())}}const pm=new E0;class RKe{constructor(e,t,i=pm){this.date=e,this.displayMonth=t,this.outside=!!(t&&!i.isSameMonth(e,t)),this.dateLib=i}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class FIn{constructor(e,t){this.date=e,this.weeks=t}}class BIn{constructor(e,t){this.days=t,this.weekNumber=e}}function C_(n,e,t=!1,i=pm){let{from:r,to:s}=n;const{differenceInCalendarDays:o,isSameDay:a}=i;return r&&s?(o(s,r)<0&&([r,s]=[s,r]),o(e,r)>=(t?1:0)&&o(s,e)>=(t?1:0)):!t&&s?a(s,e):!t&&r?a(r,e):!1}function PKe(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function Yfe(n){return!!(n&&typeof n=="object"&&"from"in n)}function OKe(n){return!!(n&&typeof n=="object"&&"after"in n)}function MKe(n){return!!(n&&typeof n=="object"&&"before"in n)}function FKe(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function BKe(n,e){return Array.isArray(n)&&n.every(e.isDate)}function x_(n,e,t=pm){const i=Array.isArray(e)?e:[e],{isSameDay:r,differenceInCalendarDays:s,isAfter:o}=t;return i.some(a=>{if(typeof a=="boolean")return a;if(t.isDate(a))return r(n,a);if(BKe(a,t))return a.includes(n);if(Yfe(a))return C_(a,n,!1,t);if(FKe(a))return Array.isArray(a.dayOfWeek)?a.dayOfWeek.includes(n.getDay()):a.dayOfWeek===n.getDay();if(PKe(a)){const l=s(a.before,n),c=s(a.after,n),u=l>0,d=c<0;return o(a.before,a.after)?d&&u:u||d}return OKe(a)?s(n,a.after)>0:MKe(a)?s(a.before,n)>0:typeof a=="function"?a(n):!1})}function $In(n,e,t,i,r){const{disabled:s,hidden:o,modifiers:a,showOutsideDays:l,broadcastCalendar:c,today:u}=e,{isSameDay:d,isSameMonth:h,startOfMonth:f,isBefore:g,endOfMonth:p,isAfter:m}=r,_=t&&f(t),v=i&&p(i),y={[vo.focused]:[],[vo.outside]:[],[vo.disabled]:[],[vo.hidden]:[],[vo.today]:[]},C={};for(const x of n){const{date:k,displayMonth:L}=x,D=!!(L&&!h(k,L)),I=!!(_&&g(k,_)),O=!!(v&&m(k,v)),M=!!(s&&x_(k,s,r)),B=!!(o&&x_(k,o,r))||I||O||!c&&!l&&D||c&&l===!1&&D,G=d(k,u??r.today());D&&y.outside.push(x),M&&y.disabled.push(x),B&&y.hidden.push(x),G&&y.today.push(x),a&&Object.keys(a).forEach(W=>{const z=a?.[W];z&&x_(k,z,r)&&(C[W]?C[W].push(x):C[W]=[x])})}return x=>{const k={[vo.focused]:!1,[vo.disabled]:!1,[vo.hidden]:!1,[vo.outside]:!1,[vo.today]:!1},L={};for(const D in y){const I=y[D];k[D]=I.some(O=>O===x)}for(const D in C)L[D]=C[D].some(I=>I===x);return{...k,...L}}}function WIn(n,e,t={}){return Object.entries(n).filter(([,r])=>r===!0).reduce((r,[s])=>(t[s]?r.push(t[s]):e[vo[s]]?r.push(e[vo[s]]):e[lg[s]]&&r.push(e[lg[s]]),r),[e[Fn.Day]])}function HIn(n){return U.createElement("button",{...n})}function VIn(n){return U.createElement("span",{...n})}function zIn(n){const{size:e=24,orientation:t="left",className:i}=n;return U.createElement("svg",{className:i,width:e,height:e,viewBox:"0 0 24 24"},t==="up"&&U.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),t==="down"&&U.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),t==="left"&&U.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),t==="right"&&U.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function UIn(n){const{day:e,modifiers:t,...i}=n;return U.createElement("td",{...i})}function jIn(n){const{day:e,modifiers:t,...i}=n,r=U.useRef(null);return U.useEffect(()=>{t.focused&&r.current?.focus()},[t.focused]),U.createElement("button",{ref:r,...i})}function qIn(n){const{options:e,className:t,components:i,classNames:r,...s}=n,o=[r[Fn.Dropdown],t].join(" "),a=e?.find(({value:l})=>l===s.value);return U.createElement("span",{"data-disabled":s.disabled,className:r[Fn.DropdownRoot]},U.createElement(i.Select,{className:o,...s},e?.map(({value:l,label:c,disabled:u})=>U.createElement(i.Option,{key:l,value:l,disabled:u},c))),U.createElement("span",{className:r[Fn.CaptionLabel],"aria-hidden":!0},a?.label,U.createElement(i.Chevron,{orientation:"down",size:18,className:r[Fn.Chevron]})))}function KIn(n){return U.createElement("div",{...n})}function GIn(n){return U.createElement("div",{...n})}function YIn(n){const{calendarMonth:e,displayIndex:t,...i}=n;return U.createElement("div",{...i},n.children)}function ZIn(n){const{calendarMonth:e,displayIndex:t,...i}=n;return U.createElement("div",{...i})}function XIn(n){return U.createElement("table",{...n})}function QIn(n){return U.createElement("div",{...n})}const $Ke=E.createContext(void 0);function tM(){const n=E.useContext($Ke);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function JIn(n){const{components:e}=tM();return U.createElement(e.Dropdown,{...n})}function eAn(n){const{onPreviousClick:e,onNextClick:t,previousMonth:i,nextMonth:r,...s}=n,{components:o,classNames:a,labels:{labelPrevious:l,labelNext:c}}=tM(),u=E.useCallback(h=>{r&&t?.(h)},[r,t]),d=E.useCallback(h=>{i&&e?.(h)},[i,e]);return U.createElement("nav",{...s},U.createElement(o.PreviousMonthButton,{type:"button",className:a[Fn.PreviousMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:d},U.createElement(o.Chevron,{disabled:i?void 0:!0,className:a[Fn.Chevron],orientation:"left"})),U.createElement(o.NextMonthButton,{type:"button",className:a[Fn.NextMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:u},U.createElement(o.Chevron,{disabled:r?void 0:!0,orientation:"right",className:a[Fn.Chevron]})))}function tAn(n){const{components:e}=tM();return U.createElement(e.Button,{...n})}function nAn(n){return U.createElement("option",{...n})}function iAn(n){const{components:e}=tM();return U.createElement(e.Button,{...n})}function rAn(n){const{rootRef:e,...t}=n;return U.createElement("div",{...t,ref:e})}function sAn(n){return U.createElement("select",{...n})}function oAn(n){const{week:e,...t}=n;return U.createElement("tr",{...t})}function aAn(n){return U.createElement("th",{...n})}function lAn(n){return U.createElement("thead",{"aria-hidden":!0},U.createElement("tr",{...n}))}function cAn(n){const{week:e,...t}=n;return U.createElement("th",{...t})}function uAn(n){return U.createElement("th",{...n})}function dAn(n){return U.createElement("tbody",{...n})}function hAn(n){const{components:e}=tM();return U.createElement(e.Dropdown,{...n})}const fAn=Object.freeze(Object.defineProperty({__proto__:null,Button:HIn,CaptionLabel:VIn,Chevron:zIn,Day:UIn,DayButton:jIn,Dropdown:qIn,DropdownNav:KIn,Footer:GIn,Month:YIn,MonthCaption:ZIn,MonthGrid:XIn,Months:QIn,MonthsDropdown:JIn,Nav:eAn,NextMonthButton:tAn,Option:nAn,PreviousMonthButton:iAn,Root:rAn,Select:sAn,Week:oAn,WeekNumber:cAn,WeekNumberHeader:uAn,Weekday:aAn,Weekdays:lAn,Weeks:dAn,YearsDropdown:hAn},Symbol.toStringTag,{value:"Module"}));function gAn(n){return{...fAn,...n}}function pAn(n){const e={"data-mode":n.mode??void 0,"data-required":"required"in n?n.required:void 0,"data-multiple-months":n.numberOfMonths&&n.numberOfMonths>1||void 0,"data-week-numbers":n.showWeekNumber||void 0,"data-broadcast-calendar":n.broadcastCalendar||void 0,"data-nav-layout":n.navLayout||void 0};return Object.entries(n).forEach(([t,i])=>{t.startsWith("data-")&&(e[t]=i)}),e}function mAn(){const n={};for(const e in Fn)n[Fn[e]]=`rdp-${Fn[e]}`;for(const e in vo)n[vo[e]]=`rdp-${vo[e]}`;for(const e in lg)n[lg[e]]=`rdp-${lg[e]}`;for(const e in Dd)n[Dd[e]]=`rdp-${Dd[e]}`;return n}function WKe(n,e,t){return(t??new E0(e)).format(n,"LLLL y")}const _An=WKe;function vAn(n,e,t){return(t??new E0(e)).format(n,"d")}function bAn(n,e=pm){return e.format(n,"LLLL")}function yAn(n,e=pm){return n<10?e.formatNumber(`0${n.toLocaleString()}`):e.formatNumber(`${n.toLocaleString()}`)}function wAn(){return""}function CAn(n,e,t){return(t??new E0(e)).format(n,"cccccc")}function HKe(n,e=pm){return e.format(n,"yyyy")}const xAn=HKe,SAn=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:WKe,formatDay:vAn,formatMonthCaption:_An,formatMonthDropdown:bAn,formatWeekNumber:yAn,formatWeekNumberHeader:wAn,formatWeekdayName:CAn,formatYearCaption:xAn,formatYearDropdown:HKe},Symbol.toStringTag,{value:"Module"}));function kAn(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...SAn,...n}}function EAn(n,e,t,i,r){const{startOfMonth:s,startOfYear:o,endOfYear:a,eachMonthOfInterval:l,getMonth:c}=r;return l({start:o(n),end:a(n)}).map(h=>{const f=i.formatMonthDropdown(h,r),g=c(h),p=e&&hs(t)||!1;return{value:g,label:f,disabled:p}})}function LAn(n,e={},t={}){let i={...e?.[Fn.Day]};return Object.entries(n).filter(([,r])=>r===!0).forEach(([r])=>{i={...i,...t?.[r]}}),i}function TAn(n,e,t){const i=n.today(),r=e?n.startOfISOWeek(i):n.startOfWeek(i),s=[];for(let o=0;o<7;o++){const a=n.addDays(r,o);s.push(a)}return s}function DAn(n,e,t,i){if(!n||!e)return;const{startOfYear:r,endOfYear:s,addYears:o,getYear:a,isBefore:l,isSameYear:c}=i,u=r(n),d=s(e),h=[];let f=u;for(;l(f,d)||c(f,d);)h.push(f),f=o(f,1);return h.map(g=>{const p=t.formatYearDropdown(g,i);return{value:a(g),label:p,disabled:!1}})}function VKe(n,e,t){return(t??new E0(e)).format(n,"LLLL y")}const IAn=VKe;function AAn(n,e,t,i){let r=(i??new E0(t)).format(n,"PPPP");return e?.today&&(r=`Today, ${r}`),r}function zKe(n,e,t,i){let r=(i??new E0(t)).format(n,"PPPP");return e.today&&(r=`Today, ${r}`),e.selected&&(r=`${r}, selected`),r}const NAn=zKe;function RAn(){return""}function PAn(n){return"Choose the Month"}function OAn(n){return"Go to the Next Month"}function MAn(n){return"Go to the Previous Month"}function FAn(n,e,t){return(t??new E0(e)).format(n,"cccc")}function BAn(n,e){return`Week ${n}`}function $An(n){return"Week Number"}function WAn(n){return"Choose the Year"}const HAn=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:IAn,labelDay:NAn,labelDayButton:zKe,labelGrid:VKe,labelGridcell:AAn,labelMonthDropdown:PAn,labelNav:RAn,labelNext:OAn,labelPrevious:MAn,labelWeekNumber:BAn,labelWeekNumberHeader:$An,labelWeekday:FAn,labelYearDropdown:WAn},Symbol.toStringTag,{value:"Module"})),nM=n=>n instanceof HTMLElement?n:null,dG=n=>[...n.querySelectorAll("[data-animated-month]")??[]],VAn=n=>nM(n.querySelector("[data-animated-month]")),hG=n=>nM(n.querySelector("[data-animated-caption]")),fG=n=>nM(n.querySelector("[data-animated-weeks]")),zAn=n=>nM(n.querySelector("[data-animated-nav]")),UAn=n=>nM(n.querySelector("[data-animated-weekdays]"));function jAn(n,e,{classNames:t,months:i,focused:r,dateLib:s}){const o=E.useRef(null),a=E.useRef(i),l=E.useRef(!1);E.useLayoutEffect(()=>{const c=a.current;if(a.current=i,!e||!n.current||!(n.current instanceof HTMLElement)||i.length===0||c.length===0||i.length!==c.length)return;const u=s.isSameMonth(i[0].date,c[0].date),d=s.isAfter(i[0].date,c[0].date),h=d?t[Dd.caption_after_enter]:t[Dd.caption_before_enter],f=d?t[Dd.weeks_after_enter]:t[Dd.weeks_before_enter],g=o.current,p=n.current.cloneNode(!0);if(p instanceof HTMLElement?(dG(p).forEach(y=>{if(!(y instanceof HTMLElement))return;const C=VAn(y);C&&y.contains(C)&&y.removeChild(C);const x=hG(y);x&&x.classList.remove(h);const k=fG(y);k&&k.classList.remove(f)}),o.current=p):o.current=null,l.current||u||r)return;const m=g instanceof HTMLElement?dG(g):[],_=dG(n.current);if(_.every(v=>v instanceof HTMLElement)&&m&&m.every(v=>v instanceof HTMLElement)){l.current=!0,n.current.style.isolation="isolate";const v=zAn(n.current);v&&(v.style.zIndex="1"),_.forEach((y,C)=>{const x=m[C];if(!x)return;y.style.position="relative",y.style.overflow="hidden";const k=hG(y);k&&k.classList.add(h);const L=fG(y);L&&L.classList.add(f);const D=()=>{l.current=!1,n.current&&(n.current.style.isolation=""),v&&(v.style.zIndex=""),k&&k.classList.remove(h),L&&L.classList.remove(f),y.style.position="",y.style.overflow="",y.contains(x)&&y.removeChild(x)};x.style.pointerEvents="none",x.style.position="absolute",x.style.overflow="hidden",x.setAttribute("aria-hidden","true");const I=UAn(x);I&&(I.style.opacity="0");const O=hG(x);O&&(O.classList.add(d?t[Dd.caption_before_exit]:t[Dd.caption_after_exit]),O.addEventListener("animationend",D));const M=fG(x);M&&M.classList.add(d?t[Dd.weeks_before_exit]:t[Dd.weeks_after_exit]),y.insertBefore(x,y.firstChild)})}})}function qAn(n,e,t,i){const r=n[0],s=n[n.length-1],{ISOWeek:o,fixedWeeks:a,broadcastCalendar:l}=t??{},{addDays:c,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:h,endOfISOWeek:f,endOfMonth:g,endOfWeek:p,isAfter:m,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=i,C=l?_(r,i):o?v(r):y(r),x=l?h(s):o?f(g(s)):p(g(s)),k=u(x,C),L=d(s,r)+1,D=[];for(let M=0;M<=k;M++){const B=c(C,M);if(e&&m(B,e))break;D.push(B)}const O=(l?35:42)*L;if(a&&D.length{const r=i.weeks.reduce((s,o)=>[...s,...o.days],e);return[...t,...r]},e)}function GAn(n,e,t,i){const{numberOfMonths:r=1}=t,s=[];for(let o=0;oe)break;s.push(a)}return s}function xAe(n,e,t,i){const{month:r,defaultMonth:s,today:o=i.today(),numberOfMonths:a=1}=n;let l=r||s||o;const{differenceInCalendarMonths:c,addMonths:u,startOfMonth:d}=i;if(t&&c(t,l){const _=t.broadcastCalendar?d(m,i):t.ISOWeek?h(m):f(m),v=t.broadcastCalendar?s(m):t.ISOWeek?o(a(m)):l(a(m)),y=e.filter(L=>L>=_&&L<=v),C=t.broadcastCalendar?35:42;if(t.fixedWeeks&&y.length{const I=C-y.length;return D>v&&D<=r(v,I)});y.push(...L)}const x=y.reduce((L,D)=>{const I=t.ISOWeek?c(D):u(D),O=L.find(B=>B.weekNumber===I),M=new RKe(D,m,i);return O?O.days.push(M):L.push(new BIn(I,[M])),L},[]),k=new FIn(m,x);return p.push(k),p},[]);return t.reverseMonths?g.reverse():g}function ZAn(n,e){let{startMonth:t,endMonth:i}=n;const{startOfYear:r,startOfDay:s,startOfMonth:o,endOfMonth:a,addYears:l,endOfYear:c,newDate:u,today:d}=e,{fromYear:h,toYear:f,fromMonth:g,toMonth:p}=n;!t&&g&&(t=g),!t&&h&&(t=e.newDate(h,0,1)),!i&&p&&(i=p),!i&&f&&(i=u(f,11,31));const m=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return t?t=o(t):h?t=u(h,0,1):!t&&m&&(t=r(l(n.today??d(),-100))),i?i=a(i):f?i=u(f,11,31):!i&&m&&(i=c(n.today??d())),[t&&s(t),i&&s(i)]}function XAn(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:r,numberOfMonths:s=1}=t,{startOfMonth:o,addMonths:a,differenceInCalendarMonths:l}=i,c=r?s:1,u=o(n);if(!e)return a(u,c);if(!(l(e,n)[...t,...i.weeks],e)}function GV(n,e){const[t,i]=E.useState(n);return[e===void 0?t:e,i]}function eNn(n,e){const[t,i]=ZAn(n,e),{startOfMonth:r,endOfMonth:s}=e,o=xAe(n,t,i,e),[a,l]=GV(o,n.month?o:void 0);E.useEffect(()=>{const k=xAe(n,t,i,e);l(k)},[n.timeZone]);const c=GAn(a,i,n,e),u=qAn(c,n.endMonth?s(n.endMonth):void 0,n,e),d=YAn(c,u,n,e),h=JAn(d),f=KAn(d),g=QAn(a,t,n,e),p=XAn(a,i,n,e),{disableNavigation:m,onMonthChange:_}=n,v=k=>h.some(L=>L.days.some(D=>D.isEqualTo(k))),y=k=>{if(m)return;let L=r(k);t&&Lr(i)&&(L=r(i)),l(L),_?.(L)};return{months:d,weeks:h,days:f,navStart:t,navEnd:i,previousMonth:g,nextMonth:p,goToMonth:y,goToDay:k=>{v(k)||y(k.date)}}}var lp;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(lp||(lp={}));function SAe(n){return!n[vo.disabled]&&!n[vo.hidden]&&!n[vo.outside]}function tNn(n,e,t,i){let r,s=-1;for(const o of n){const a=e(o);SAe(a)&&(a[vo.focused]&&sSAe(e(o)))),r}function nNn(n,e,t,i,r,s,o){const{ISOWeek:a,broadcastCalendar:l}=s,{addDays:c,addMonths:u,addWeeks:d,addYears:h,endOfBroadcastWeek:f,endOfISOWeek:g,endOfWeek:p,max:m,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:C}=o;let k={day:c,week:d,month:u,year:h,startOfWeek:L=>l?v(L,o):a?y(L):C(L),endOfWeek:L=>l?f(L):a?g(L):p(L)}[n](t,e==="after"?1:-1);return e==="before"&&i?k=m([i,k]):e==="after"&&r&&(k=_([r,k])),k}function UKe(n,e,t,i,r,s,o,a=0){if(a>365)return;const l=nNn(n,e,t.date,i,r,s,o),c=!!(s.disabled&&x_(l,s.disabled,o)),u=!!(s.hidden&&x_(l,s.hidden,o)),d=l,h=new RKe(l,d,o);return!c&&!u?h:UKe(n,e,h,i,r,s,o,a+1)}function iNn(n,e,t,i,r){const{autoFocus:s}=n,[o,a]=E.useState(),l=tNn(e.days,t,i||(()=>!1),o),[c,u]=E.useState(s?l:void 0);return{isFocusTarget:p=>!!l?.isEqualTo(p),setFocused:u,focused:c,blur:()=>{a(c),u(void 0)},moveFocus:(p,m)=>{if(!c)return;const _=UKe(p,m,c,e.navStart,e.navEnd,n,r);_&&(e.goToDay(_),u(_))}}}function rNn(n,e){const{selected:t,required:i,onSelect:r}=n,[s,o]=GV(t,r?t:void 0),a=r?t:s,{isSameDay:l}=e,c=f=>a?.some(g=>l(g,f))??!1,{min:u,max:d}=n;return{selected:a,select:(f,g,p)=>{let m=[...a??[]];if(c(f)){if(a?.length===u||i&&a?.length===1)return;m=a?.filter(_=>!l(_,f))}else a?.length===d?m=[f]:m=[...m,f];return r||o(m),r?.(m,f,g,p),m},isSelected:c}}function sNn(n,e,t=0,i=0,r=!1,s=pm){const{from:o,to:a}=e||{},{isSameDay:l,isAfter:c,isBefore:u}=s;let d;if(!o&&!a)d={from:n,to:t>0?void 0:n};else if(o&&!a)l(o,n)?r?d={from:o,to:void 0}:d=void 0:u(n,o)?d={from:n,to:o}:d={from:o,to:n};else if(o&&a)if(l(o,n)&&l(a,n))r?d={from:o,to:a}:d=void 0;else if(l(o,n))d={from:o,to:t>0?void 0:n};else if(l(a,n))d={from:n,to:t>0?void 0:n};else if(u(n,o))d={from:n,to:a};else if(c(n,o))d={from:o,to:n};else if(c(n,a))d={from:o,to:n};else throw new Error("Invalid range");if(d?.from&&d?.to){const h=s.differenceInCalendarDays(d.to,d.from);i>0&&h>i?d={from:n,to:void 0}:t>1&&htypeof a!="function").some(a=>typeof a=="boolean"?a:t.isDate(a)?C_(n,a,!1,t):BKe(a,t)?a.some(l=>C_(n,l,!1,t)):Yfe(a)?a.from&&a.to?kAe(n,{from:a.from,to:a.to},t):!1:FKe(a)?oNn(n,a.dayOfWeek,t):PKe(a)?t.isAfter(a.before,a.after)?kAe(n,{from:t.addDays(a.after,1),to:t.addDays(a.before,-1)},t):x_(n.from,a,t)||x_(n.to,a,t):OKe(a)||MKe(a)?x_(n.from,a,t)||x_(n.to,a,t):!1))return!0;const o=i.filter(a=>typeof a=="function");if(o.length){let a=n.from;const l=t.differenceInCalendarDays(n.to,n.from);for(let c=0;c<=l;c++){if(o.some(u=>u(a)))return!0;a=t.addDays(a,1)}}return!1}function lNn(n,e){const{disabled:t,excludeDisabled:i,selected:r,required:s,onSelect:o}=n,[a,l]=GV(r,o?r:void 0),c=o?r:a;return{selected:c,select:(h,f,g)=>{const{min:p,max:m}=n,_=h?sNn(h,c,p,m,s,e):void 0;return i&&t&&_?.from&&_.to&&aNn({from:_.from,to:_.to},t,e)&&(_.from=h,_.to=void 0),o||l(_),o?.(_,h,f,g),_},isSelected:h=>c&&C_(c,h,!1,e)}}function cNn(n,e){const{selected:t,required:i,onSelect:r}=n,[s,o]=GV(t,r?t:void 0),a=r?t:s,{isSameDay:l}=e;return{selected:a,select:(d,h,f)=>{let g=d;return!i&&a&&a&&l(d,a)&&(g=void 0),r||o(g),r?.(g,d,h,f),g},isSelected:d=>a?l(a,d):!1}}function uNn(n,e){const t=cNn(n,e),i=rNn(n,e),r=lNn(n,e);switch(n.mode){case"single":return t;case"multiple":return i;case"range":return r;default:return}}function CVn(n){let e=n;e.timeZone&&(e={...n},e.today&&(e.today=new ac(e.today,e.timeZone)),e.month&&(e.month=new ac(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new ac(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new ac(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new ac(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new ac(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(Ft=>new ac(Ft,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new ac(e.selected.from,e.timeZone):void 0,to:e.selected.to?new ac(e.selected.to,e.timeZone):void 0}));const{components:t,formatters:i,labels:r,dateLib:s,locale:o,classNames:a}=E.useMemo(()=>{const Ft={...Gfe,...e.locale};return{dateLib:new E0({locale:Ft,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:gAn(e.components),formatters:kAn(e.formatters),labels:{...HAn,...e.labels},locale:Ft,classNames:{...mAn(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:l,mode:c,navLayout:u,numberOfMonths:d=1,onDayBlur:h,onDayClick:f,onDayFocus:g,onDayKeyDown:p,onDayMouseEnter:m,onDayMouseLeave:_,onNextClick:v,onPrevClick:y,showWeekNumber:C,styles:x}=e,{formatCaption:k,formatDay:L,formatMonthDropdown:D,formatWeekNumber:I,formatWeekNumberHeader:O,formatWeekdayName:M,formatYearDropdown:B}=i,G=eNn(e,s),{days:W,months:z,navStart:q,navEnd:ee,previousMonth:Z,nextMonth:j,goToMonth:te}=G,le=$In(W,e,q,ee,s),{isSelected:ue,select:de,selected:we}=uNn(e,s)??{},{blur:xe,focused:Me,isFocusTarget:Re,moveFocus:_t,setFocused:Qe}=iNn(e,G,le,ue??(()=>!1),s),{labelDayButton:pt,labelGridcell:gt,labelGrid:Ue,labelMonthDropdown:wn,labelNav:Xt,labelPrevious:jn,labelNext:ji,labelWeekday:ci,labelWeekNumber:ye,labelWeekNumberHeader:Ie,labelYearDropdown:Ve}=r,wt=E.useMemo(()=>TAn(s,e.ISOWeek),[s,e.ISOWeek]),vt=c!==void 0||f!==void 0,nt=E.useCallback(()=>{Z&&(te(Z),y?.(Z))},[Z,te,y]),$t=E.useCallback(()=>{j&&(te(j),v?.(j))},[te,j,v]),an=E.useCallback((Ft,qn)=>pi=>{pi.preventDefault(),pi.stopPropagation(),Qe(Ft),de?.(Ft.date,qn,pi),f?.(Ft.date,qn,pi)},[de,f,Qe]),Pi=E.useCallback((Ft,qn)=>pi=>{Qe(Ft),g?.(Ft.date,qn,pi)},[g,Qe]),Xn=E.useCallback((Ft,qn)=>pi=>{xe(),h?.(Ft.date,qn,pi)},[xe,h]),Qi=E.useCallback((Ft,qn)=>pi=>{const bn={ArrowLeft:[pi.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[pi.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[pi.shiftKey?"year":"week","after"],ArrowUp:[pi.shiftKey?"year":"week","before"],PageUp:[pi.shiftKey?"year":"month","before"],PageDown:[pi.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(bn[pi.key]){pi.preventDefault(),pi.stopPropagation();const[dn,bi]=bn[pi.key];_t(dn,bi)}p?.(Ft.date,qn,pi)},[_t,p,e.dir]),qs=E.useCallback((Ft,qn)=>pi=>{m?.(Ft.date,qn,pi)},[m]),Pr=E.useCallback((Ft,qn)=>pi=>{_?.(Ft.date,qn,pi)},[_]),Or=E.useCallback(Ft=>qn=>{const pi=Number(qn.target.value),bn=s.setMonth(s.startOfMonth(Ft),pi);te(bn)},[s,te]),cr=E.useCallback(Ft=>qn=>{const pi=Number(qn.target.value),bn=s.setYear(s.startOfMonth(Ft),pi);te(bn)},[s,te]),{className:us,style:qi}=E.useMemo(()=>({className:[a[Fn.Root],e.className].filter(Boolean).join(" "),style:{...x?.[Fn.Root],...e.style}}),[a,e.className,e.style,x]),Er=pAn(e),oo=E.useRef(null);jAn(oo,!!e.animate,{classNames:a,months:z,focused:Me,dateLib:s});const As={dayPickerProps:e,selected:we,select:de,isSelected:ue,months:z,nextMonth:j,previousMonth:Z,goToMonth:te,getModifiers:le,components:t,classNames:a,styles:x,labels:r,formatters:i};return U.createElement($Ke.Provider,{value:As},U.createElement(t.Root,{rootRef:e.animate?oo:void 0,className:us,style:qi,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],...Er},U.createElement(t.Months,{className:a[Fn.Months],style:x?.[Fn.Months]},!e.hideNavigation&&!u&&U.createElement(t.Nav,{"data-animated-nav":e.animate?"true":void 0,className:a[Fn.Nav],style:x?.[Fn.Nav],"aria-label":Xt(),onPreviousClick:nt,onNextClick:$t,previousMonth:Z,nextMonth:j}),z.map((Ft,qn)=>{const pi=EAn(Ft.date,q,ee,i,s),bn=DAn(q,ee,i,s);return U.createElement(t.Month,{"data-animated-month":e.animate?"true":void 0,className:a[Fn.Month],style:x?.[Fn.Month],key:qn,displayIndex:qn,calendarMonth:Ft},u==="around"&&!e.hideNavigation&&qn===0&&U.createElement(t.PreviousMonthButton,{type:"button",className:a[Fn.PreviousMonthButton],tabIndex:Z?void 0:-1,"aria-disabled":Z?void 0:!0,"aria-label":jn(Z),onClick:nt,"data-animated-button":e.animate?"true":void 0},U.createElement(t.Chevron,{disabled:Z?void 0:!0,className:a[Fn.Chevron],orientation:e.dir==="rtl"?"right":"left"})),U.createElement(t.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:a[Fn.MonthCaption],style:x?.[Fn.MonthCaption],calendarMonth:Ft,displayIndex:qn},l?.startsWith("dropdown")?U.createElement(t.DropdownNav,{className:a[Fn.Dropdowns],style:x?.[Fn.Dropdowns]},l==="dropdown"||l==="dropdown-months"?U.createElement(t.MonthsDropdown,{className:a[Fn.MonthsDropdown],"aria-label":wn(),classNames:a,components:t,disabled:!!e.disableNavigation,onChange:Or(Ft.date),options:pi,style:x?.[Fn.Dropdown],value:s.getMonth(Ft.date)}):U.createElement("span",null,D(Ft.date,s)),l==="dropdown"||l==="dropdown-years"?U.createElement(t.YearsDropdown,{className:a[Fn.YearsDropdown],"aria-label":Ve(s.options),classNames:a,components:t,disabled:!!e.disableNavigation,onChange:cr(Ft.date),options:bn,style:x?.[Fn.Dropdown],value:s.getYear(Ft.date)}):U.createElement("span",null,B(Ft.date,s)),U.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},k(Ft.date,s.options,s))):U.createElement(t.CaptionLabel,{className:a[Fn.CaptionLabel],role:"status","aria-live":"polite"},k(Ft.date,s.options,s))),u==="around"&&!e.hideNavigation&&qn===d-1&&U.createElement(t.NextMonthButton,{type:"button",className:a[Fn.NextMonthButton],tabIndex:j?void 0:-1,"aria-disabled":j?void 0:!0,"aria-label":ji(j),onClick:$t,"data-animated-button":e.animate?"true":void 0},U.createElement(t.Chevron,{disabled:j?void 0:!0,className:a[Fn.Chevron],orientation:e.dir==="rtl"?"left":"right"})),qn===d-1&&u==="after"&&!e.hideNavigation&&U.createElement(t.Nav,{"data-animated-nav":e.animate?"true":void 0,className:a[Fn.Nav],style:x?.[Fn.Nav],"aria-label":Xt(),onPreviousClick:nt,onNextClick:$t,previousMonth:Z,nextMonth:j}),U.createElement(t.MonthGrid,{role:"grid","aria-multiselectable":c==="multiple"||c==="range","aria-label":Ue(Ft.date,s.options,s)||void 0,className:a[Fn.MonthGrid],style:x?.[Fn.MonthGrid]},!e.hideWeekdays&&U.createElement(t.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:a[Fn.Weekdays],style:x?.[Fn.Weekdays]},C&&U.createElement(t.WeekNumberHeader,{"aria-label":Ie(s.options),className:a[Fn.WeekNumberHeader],style:x?.[Fn.WeekNumberHeader],scope:"col"},O()),wt.map((dn,bi)=>U.createElement(t.Weekday,{"aria-label":ci(dn,s.options,s),className:a[Fn.Weekday],key:bi,style:x?.[Fn.Weekday],scope:"col"},M(dn,s.options,s)))),U.createElement(t.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:a[Fn.Weeks],style:x?.[Fn.Weeks]},Ft.weeks.map((dn,bi)=>U.createElement(t.Week,{className:a[Fn.Week],key:dn.weekNumber,style:x?.[Fn.Week],week:dn},C&&U.createElement(t.WeekNumber,{week:dn,style:x?.[Fn.WeekNumber],"aria-label":ye(dn.weekNumber,{locale:o}),className:a[Fn.WeekNumber],scope:"row",role:"rowheader"},I(dn.weekNumber,s)),dn.days.map(mi=>{const{date:Yi}=mi,Wn=le(mi);if(Wn[vo.focused]=!Wn.hidden&&!!Me?.isEqualTo(mi),Wn[lg.selected]=ue?.(Yi)||Wn.selected,Yfe(we)){const{from:H,to:Y}=we;Wn[lg.range_start]=!!(H&&Y&&s.isSameDay(Yi,H)),Wn[lg.range_end]=!!(H&&Y&&s.isSameDay(Yi,Y)),Wn[lg.range_middle]=C_(we,Yi,!0,s)}const pn=LAn(Wn,x,e.modifiersStyles),re=WIn(Wn,a,e.modifiersClassNames),oe=!vt&&!Wn.hidden?gt(Yi,Wn,s.options,s):void 0;return U.createElement(t.Day,{key:`${s.format(Yi,"yyyy-MM-dd")}_${s.format(mi.displayMonth,"yyyy-MM")}`,day:mi,modifiers:Wn,className:re.join(" "),style:pn,role:"gridcell","aria-selected":Wn.selected||void 0,"aria-label":oe,"data-day":s.format(Yi,"yyyy-MM-dd"),"data-month":mi.outside?s.format(Yi,"yyyy-MM"):void 0,"data-selected":Wn.selected||void 0,"data-disabled":Wn.disabled||void 0,"data-hidden":Wn.hidden||void 0,"data-outside":mi.outside||void 0,"data-focused":Wn.focused||void 0,"data-today":Wn.today||void 0},!Wn.hidden&&vt?U.createElement(t.DayButton,{className:a[Fn.DayButton],style:x?.[Fn.DayButton],type:"button",day:mi,modifiers:Wn,disabled:Wn.disabled||void 0,tabIndex:Re(mi)?0:-1,"aria-label":pt(Yi,Wn,s.options,s),onClick:an(mi,Wn),onBlur:Xn(mi,Wn),onFocus:Pi(mi,Wn),onKeyDown:Qi(mi,Wn),onMouseEnter:qs(mi,Wn),onMouseLeave:Pr(mi,Wn)},L(Yi,s.options,s)):!Wn.hidden&&L(mi.date,s.options,s))}))))))})),e.footer&&U.createElement(t.Footer,{className:a[Fn.Footer],style:x?.[Fn.Footer],role:"status","aria-live":"polite"},e.footer)))}function dNn(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var Zfe=n=>{const{present:e,children:t}=n,i=hNn(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,fNn(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};Zfe.displayName="Presence";function hNn(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=dNn(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=s5(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=s5(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=s5(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=s5(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function s5(n){return n?.animationName||"none"}function fNn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var jKe=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(pNn);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(Sse,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(Sse,{...i,ref:e,children:t})});jKe.displayName="Slot";var Sse=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=_Nn(t);return E.cloneElement(t,{...mNn(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});Sse.displayName="SlotClone";var gNn=({children:n})=>ae.jsx(ae.Fragment,{children:n});function pNn(n){return E.isValidElement(n)&&n.type===gNn}function mNn(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function _Nn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var Xfe="Popover",[qKe,xVn]=Ac(Xfe,[c1]),iM=c1(),[vNn,_1]=qKe(Xfe),KKe=n=>{const{__scopePopover:e,children:t,open:i,defaultOpen:r,onOpenChange:s,modal:o=!1}=n,a=iM(e),l=E.useRef(null),[c,u]=E.useState(!1),[d=!1,h]=Kp({prop:i,defaultProp:r,onChange:s});return ae.jsx(UH,{...a,children:ae.jsx(vNn,{scope:e,contentId:Ud(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:E.useCallback(()=>h(f=>!f),[h]),hasCustomAnchor:c,onCustomAnchorAdd:E.useCallback(()=>u(!0),[]),onCustomAnchorRemove:E.useCallback(()=>u(!1),[]),modal:o,children:t})})};KKe.displayName=Xfe;var GKe="PopoverAnchor",bNn=E.forwardRef((n,e)=>{const{__scopePopover:t,...i}=n,r=_1(GKe,t),s=iM(t),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=r;return E.useEffect(()=>(o(),()=>a()),[o,a]),ae.jsx(BO,{...s,...i,ref:e})});bNn.displayName=GKe;var YKe="PopoverTrigger",ZKe=E.forwardRef((n,e)=>{const{__scopePopover:t,...i}=n,r=_1(YKe,t),s=iM(t),o=gi(e,r.triggerRef),a=ae.jsx(Pn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":tGe(r.open),...i,ref:o,onClick:Kt(n.onClick,r.onOpenToggle)});return r.hasCustomAnchor?a:ae.jsx(BO,{asChild:!0,...s,children:a})});ZKe.displayName=YKe;var Qfe="PopoverPortal",[yNn,wNn]=qKe(Qfe,{forceMount:void 0}),XKe=n=>{const{__scopePopover:e,forceMount:t,children:i,container:r}=n,s=_1(Qfe,e);return ae.jsx(yNn,{scope:e,forceMount:t,children:ae.jsx(Zfe,{present:t||s.open,children:ae.jsx(y2,{asChild:!0,container:r,children:i})})})};XKe.displayName=Qfe;var NL="PopoverContent",QKe=E.forwardRef((n,e)=>{const t=wNn(NL,n.__scopePopover),{forceMount:i=t.forceMount,...r}=n,s=_1(NL,n.__scopePopover);return ae.jsx(Zfe,{present:i||s.open,children:s.modal?ae.jsx(CNn,{...r,ref:e}):ae.jsx(xNn,{...r,ref:e})})});QKe.displayName=NL;var CNn=E.forwardRef((n,e)=>{const t=_1(NL,n.__scopePopover),i=E.useRef(null),r=gi(e,i),s=E.useRef(!1);return E.useEffect(()=>{const o=i.current;if(o)return MO(o)},[]),ae.jsx(OO,{as:jKe,allowPinchZoom:!0,children:ae.jsx(JKe,{...n,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kt(n.onCloseAutoFocus,o=>{o.preventDefault(),s.current||t.triggerRef.current?.focus()}),onPointerDownOutside:Kt(n.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Kt(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),xNn=E.forwardRef((n,e)=>{const t=_1(NL,n.__scopePopover),i=E.useRef(!1),r=E.useRef(!1);return ae.jsx(JKe,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{n.onCloseAutoFocus?.(s),s.defaultPrevented||(i.current||t.triggerRef.current?.focus(),s.preventDefault()),i.current=!1,r.current=!1},onInteractOutside:s=>{n.onInteractOutside?.(s),s.defaultPrevented||(i.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=s.target;t.triggerRef.current?.contains(o)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),JKe=E.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:i,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=n,h=_1(NL,t),f=iM(t);return WH(),ae.jsx(PO,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:r,onUnmountAutoFocus:s,children:ae.jsx(b2,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:ae.jsx(jH,{"data-state":tGe(h.open),role:"dialog",id:h.contentId,...f,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),eGe="PopoverClose",SNn=E.forwardRef((n,e)=>{const{__scopePopover:t,...i}=n,r=_1(eGe,t);return ae.jsx(Pn.button,{type:"button",...i,ref:e,onClick:Kt(n.onClick,()=>r.onOpenChange(!1))})});SNn.displayName=eGe;var kNn="PopoverArrow",ENn=E.forwardRef((n,e)=>{const{__scopePopover:t,...i}=n,r=iM(t);return ae.jsx(qH,{...r,...i,ref:e})});ENn.displayName=kNn;function tGe(n){return n?"open":"closed"}var SVn=KKe,kVn=ZKe,EVn=XKe,LVn=QKe;function LNn(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var rM=n=>{const{present:e,children:t}=n,i=TNn(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=gi(i.ref,DNn(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};rM.displayName="Presence";function TNn(n){const[e,t]=E.useState(),i=E.useRef({}),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=LNn(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=o5(i.current);s.current=a==="mounted"?c:"none"},[a]),es(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=o5(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),es(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=o5(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=o5(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{c&&(i.current=getComputedStyle(c)),t(c)},[])}}function o5(n){return n?.animationName||"none"}function DNn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function INn(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var Jfe="ScrollArea",[nGe,TVn]=Ac(Jfe),[ANn,bf]=nGe(Jfe),iGe=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:i="hover",dir:r,scrollHideDelay:s=600,...o}=n,[a,l]=E.useState(null),[c,u]=E.useState(null),[d,h]=E.useState(null),[f,g]=E.useState(null),[p,m]=E.useState(null),[_,v]=E.useState(0),[y,C]=E.useState(0),[x,k]=E.useState(!1),[L,D]=E.useState(!1),I=gi(e,M=>l(M)),O=$P(r);return ae.jsx(ANn,{scope:t,type:i,dir:O,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:u,content:d,onContentChange:h,scrollbarX:f,onScrollbarXChange:g,scrollbarXEnabled:x,onScrollbarXEnabledChange:k,scrollbarY:p,onScrollbarYChange:m,scrollbarYEnabled:L,onScrollbarYEnabledChange:D,onCornerWidthChange:v,onCornerHeightChange:C,children:ae.jsx(Pn.div,{dir:O,...o,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":y+"px",...n.style}})})});iGe.displayName=Jfe;var rGe="ScrollAreaViewport",sGe=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:i,nonce:r,...s}=n,o=bf(rGe,t),a=E.useRef(null),l=gi(e,a,o.onViewportChange);return ae.jsxs(ae.Fragment,{children:[ae.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),ae.jsx(Pn.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...n.style},children:ae.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:i})})]})});sGe.displayName=rGe;var mm="ScrollAreaScrollbar",NNn=E.forwardRef((n,e)=>{const{forceMount:t,...i}=n,r=bf(mm,n.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=r,a=n.orientation==="horizontal";return E.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),r.type==="hover"?ae.jsx(RNn,{...i,ref:e,forceMount:t}):r.type==="scroll"?ae.jsx(PNn,{...i,ref:e,forceMount:t}):r.type==="auto"?ae.jsx(oGe,{...i,ref:e,forceMount:t}):r.type==="always"?ae.jsx(ege,{...i,ref:e}):null});NNn.displayName=mm;var RNn=E.forwardRef((n,e)=>{const{forceMount:t,...i}=n,r=bf(mm,n.__scopeScrollArea),[s,o]=E.useState(!1);return E.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},u=()=>{l=window.setTimeout(()=>o(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[r.scrollArea,r.scrollHideDelay]),ae.jsx(rM,{present:t||s,children:ae.jsx(oGe,{"data-state":s?"visible":"hidden",...i,ref:e})})}),PNn=E.forwardRef((n,e)=>{const{forceMount:t,...i}=n,r=bf(mm,n.__scopeScrollArea),s=n.orientation==="horizontal",o=ZV(()=>l("SCROLL_END"),100),[a,l]=INn("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return E.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),E.useEffect(()=>{const c=r.viewport,u=s?"scrollLeft":"scrollTop";if(c){let d=c[u];const h=()=>{const f=c[u];d!==f&&(l("SCROLL"),o()),d=f};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[r.viewport,s,l,o]),ae.jsx(rM,{present:t||a!=="hidden",children:ae.jsx(ege,{"data-state":a==="hidden"?"hidden":"visible",...i,ref:e,onPointerEnter:Kt(n.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Kt(n.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),oGe=E.forwardRef((n,e)=>{const t=bf(mm,n.__scopeScrollArea),{forceMount:i,...r}=n,[s,o]=E.useState(!1),a=n.orientation==="horizontal",l=ZV(()=>{if(t.viewport){const c=t.viewport.offsetWidth{const{orientation:t="vertical",...i}=n,r=bf(mm,n.__scopeScrollArea),s=E.useRef(null),o=E.useRef(0),[a,l]=E.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=uGe(a.viewport,a.content),u={...i,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function d(h,f){return HNn(h,o.current,a,f)}return t==="horizontal"?ae.jsx(ONn,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const h=r.viewport.scrollLeft,f=EAe(h,a,r.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:h=>{r.viewport&&(r.viewport.scrollLeft=h)},onDragScroll:h=>{r.viewport&&(r.viewport.scrollLeft=d(h,r.dir))}}):t==="vertical"?ae.jsx(MNn,{...u,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const h=r.viewport.scrollTop,f=EAe(h,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:h=>{r.viewport&&(r.viewport.scrollTop=h)},onDragScroll:h=>{r.viewport&&(r.viewport.scrollTop=d(h))}}):null}),ONn=E.forwardRef((n,e)=>{const{sizes:t,onSizesChange:i,...r}=n,s=bf(mm,n.__scopeScrollArea),[o,a]=E.useState(),l=E.useRef(null),c=gi(e,l,s.onScrollbarXChange);return E.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),ae.jsx(lGe,{"data-orientation":"horizontal",...r,ref:c,sizes:t,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":YV(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.x),onDragScroll:u=>n.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(s.viewport){const h=s.viewport.scrollLeft+u.deltaX;n.onWheelScroll(h),hGe(h,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&i({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:zB(o.paddingLeft),paddingEnd:zB(o.paddingRight)}})}})}),MNn=E.forwardRef((n,e)=>{const{sizes:t,onSizesChange:i,...r}=n,s=bf(mm,n.__scopeScrollArea),[o,a]=E.useState(),l=E.useRef(null),c=gi(e,l,s.onScrollbarYChange);return E.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),ae.jsx(lGe,{"data-orientation":"vertical",...r,ref:c,sizes:t,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":YV(t)+"px",...n.style},onThumbPointerDown:u=>n.onThumbPointerDown(u.y),onDragScroll:u=>n.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(s.viewport){const h=s.viewport.scrollTop+u.deltaY;n.onWheelScroll(h),hGe(h,d)&&u.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&i({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:zB(o.paddingTop),paddingEnd:zB(o.paddingBottom)}})}})}),[FNn,aGe]=nGe(mm),lGe=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:i,hasThumb:r,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...h}=n,f=bf(mm,t),[g,p]=E.useState(null),m=gi(e,I=>p(I)),_=E.useRef(null),v=E.useRef(""),y=f.viewport,C=i.content-i.viewport,x=Ua(u),k=Ua(l),L=ZV(d,10);function D(I){if(_.current){const O=I.clientX-_.current.left,M=I.clientY-_.current.top;c({x:O,y:M})}}return E.useEffect(()=>{const I=O=>{const M=O.target;g?.contains(M)&&x(O,C)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[y,g,C,x]),E.useEffect(k,[i,k]),RL(g,L),RL(f.content,L),ae.jsx(FNn,{scope:t,scrollbar:g,hasThumb:r,onThumbChange:Ua(s),onThumbPointerUp:Ua(o),onThumbPositionChange:k,onThumbPointerDown:Ua(a),children:ae.jsx(Pn.div,{...h,ref:m,style:{position:"absolute",...h.style},onPointerDown:Kt(n.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),_.current=g.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),D(I))}),onPointerMove:Kt(n.onPointerMove,D),onPointerUp:Kt(n.onPointerUp,I=>{const O=I.target;O.hasPointerCapture(I.pointerId)&&O.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=v.current,f.viewport&&(f.viewport.style.scrollBehavior=""),_.current=null})})})}),VB="ScrollAreaThumb",BNn=E.forwardRef((n,e)=>{const{forceMount:t,...i}=n,r=aGe(VB,n.__scopeScrollArea);return ae.jsx(rM,{present:t||r.hasThumb,children:ae.jsx($Nn,{ref:e,...i})})}),$Nn=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:i,...r}=n,s=bf(VB,t),o=aGe(VB,t),{onThumbPositionChange:a}=o,l=gi(e,d=>o.onThumbChange(d)),c=E.useRef(void 0),u=ZV(()=>{c.current&&(c.current(),c.current=void 0)},100);return E.useEffect(()=>{const d=s.viewport;if(d){const h=()=>{if(u(),!c.current){const f=VNn(d,a);c.current=f,a()}};return a(),d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}},[s.viewport,u,a]),ae.jsx(Pn.div,{"data-state":o.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:Kt(n.onPointerDownCapture,d=>{const f=d.target.getBoundingClientRect(),g=d.clientX-f.left,p=d.clientY-f.top;o.onThumbPointerDown({x:g,y:p})}),onPointerUp:Kt(n.onPointerUp,o.onThumbPointerUp)})});BNn.displayName=VB;var tge="ScrollAreaCorner",cGe=E.forwardRef((n,e)=>{const t=bf(tge,n.__scopeScrollArea),i=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&i?ae.jsx(WNn,{...n,ref:e}):null});cGe.displayName=tge;var WNn=E.forwardRef((n,e)=>{const{__scopeScrollArea:t,...i}=n,r=bf(tge,t),[s,o]=E.useState(0),[a,l]=E.useState(0),c=!!(s&&a);return RL(r.scrollbarX,()=>{const u=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(u),l(u)}),RL(r.scrollbarY,()=>{const u=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(u),o(u)}),c?ae.jsx(Pn.div,{...i,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function zB(n){return n?parseInt(n,10):0}function uGe(n,e){const t=n/e;return isNaN(t)?0:t}function YV(n){const e=uGe(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,i=(n.scrollbar.size-t)*e;return Math.max(i,18)}function HNn(n,e,t,i="ltr"){const r=YV(t),s=r/2,o=e||s,a=r-o,l=t.scrollbar.paddingStart+o,c=t.scrollbar.size-t.scrollbar.paddingEnd-a,u=t.content-t.viewport,d=i==="ltr"?[0,u]:[u*-1,0];return dGe([l,c],d)(n)}function EAe(n,e,t="ltr"){const i=YV(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,o=e.content-e.viewport,a=s-i,l=t==="ltr"?[0,o]:[o*-1,0],c=mse(n,l);return dGe([0,o],[0,a])(c)}function dGe(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const i=(e[1]-e[0])/(n[1]-n[0]);return e[0]+i*(t-n[0])}}function hGe(n,e){return n>0&&n{})=>{let t={left:n.scrollLeft,top:n.scrollTop},i=0;return function r(){const s={left:n.scrollLeft,top:n.scrollTop},o=t.left!==s.left,a=t.top!==s.top;(o||a)&&e(),t=s,i=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(i)};function ZV(n,e){const t=Ua(n),i=E.useRef(0);return E.useEffect(()=>()=>window.clearTimeout(i.current),[]),E.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(t,e)},[t,e])}function RL(n,e){const t=Ua(e);es(()=>{let i=0;if(n){const r=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(t)});return r.observe(n),()=>{window.cancelAnimationFrame(i),r.unobserve(n)}}},[n,t])}var DVn=iGe,IVn=sGe,AVn=cGe,nge="Progress",ige=100,[zNn,NVn]=Ac(nge),[UNn,jNn]=zNn(nge),fGe=E.forwardRef((n,e)=>{const{__scopeProgress:t,value:i=null,max:r,getValueLabel:s=qNn,...o}=n;(r||r===0)&&!LAe(r)&&console.error(KNn(`${r}`,"Progress"));const a=LAe(r)?r:ige;i!==null&&!TAe(i,a)&&console.error(GNn(`${i}`,"Progress"));const l=TAe(i,a)?i:null,c=UB(l)?s(l,a):void 0;return ae.jsx(UNn,{scope:t,value:l,max:a,children:ae.jsx(Pn.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":UB(l)?l:void 0,"aria-valuetext":c,role:"progressbar","data-state":mGe(l,a),"data-value":l??void 0,"data-max":a,...o,ref:e})})});fGe.displayName=nge;var gGe="ProgressIndicator",pGe=E.forwardRef((n,e)=>{const{__scopeProgress:t,...i}=n,r=jNn(gGe,t);return ae.jsx(Pn.div,{"data-state":mGe(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...i,ref:e})});pGe.displayName=gGe;function qNn(n,e){return`${Math.round(n/e*100)}%`}function mGe(n,e){return n==null?"indeterminate":n===e?"complete":"loading"}function UB(n){return typeof n=="number"}function LAe(n){return UB(n)&&!isNaN(n)&&n>0}function TAe(n,e){return UB(n)&&!isNaN(n)&&n<=e&&n>=0}function KNn(n,e){return`Invalid prop \`max\` of value \`${n}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${ige}\`.`}function GNn(n,e){return`Invalid prop \`value\` of value \`${n}\` supplied to \`${e}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${ige} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. -Defaulting to \`null\`.`}var AVn=fGe,NVn=pGe;/** +Defaulting to \`null\`.`}var RVn=fGe,PVn=pGe;/** * table-core * * Copyright (c) TanStack @@ -2118,10 +2128,10 @@ Defaulting to \`null\`.`}var AVn=fGe,NVn=pGe;/** * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function RVn(){return{accessor:(n,e)=>typeof n=="function"?{...e,accessorFn:n}:{...e,accessorKey:n},display:n=>n,group:n=>n}}function jv(n,e){return typeof n=="function"?n(e):n}function oh(n,e){return t=>{e.setState(i=>({...i,[n]:jv(t,i[n])}))}}function XV(n){return n instanceof Function}function YNn(n){return Array.isArray(n)&&n.every(e=>typeof e=="number")}function ZNn(n,e){const t=[],i=r=>{r.forEach(s=>{t.push(s);const o=e(s);o!=null&&o.length&&i(o)})};return i(n),t}function Kn(n,e,t){let i=[],r;return s=>{let o;t.key&&t.debug&&(o=Date.now());const a=n(s);if(!(a.length!==i.length||a.some((u,d)=>i[d]!==u)))return r;i=a;let c;if(t.key&&t.debug&&(c=Date.now()),r=e(...a),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const u=Math.round((Date.now()-o)*100)/100,d=Math.round((Date.now()-c)*100)/100,h=d/16,f=(g,p)=>{for(g=String(g);g.lengthtypeof n=="function"?{...e,accessorFn:n}:{...e,accessorKey:n},display:n=>n,group:n=>n}}function jv(n,e){return typeof n=="function"?n(e):n}function oh(n,e){return t=>{e.setState(i=>({...i,[n]:jv(t,i[n])}))}}function XV(n){return n instanceof Function}function YNn(n){return Array.isArray(n)&&n.every(e=>typeof e=="number")}function ZNn(n,e){const t=[],i=r=>{r.forEach(s=>{t.push(s);const o=e(s);o!=null&&o.length&&i(o)})};return i(n),t}function Kn(n,e,t){let i=[],r;return s=>{let o;t.key&&t.debug&&(o=Date.now());const a=n(s);if(!(a.length!==i.length||a.some((u,d)=>i[d]!==u)))return r;i=a;let c;if(t.key&&t.debug&&(c=Date.now()),r=e(...a),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const u=Math.round((Date.now()-o)*100)/100,d=Math.round((Date.now()-c)*100)/100,h=d/16,f=(g,p)=>{for(g=String(g);g.length{var r;return(r=n?.debugAll)!=null?r:n[e]},key:!1,onChange:i}}function XNn(n,e,t,i){const r=()=>{var o;return(o=s.getValue())!=null?o:n.options.renderFallbackValue},s={id:`${e.id}_${t.id}`,row:e,column:t,getValue:()=>e.getValue(i),renderValue:r,getContext:Kn(()=>[n,t,e,s],(o,a,l,c)=>({table:o,column:a,row:l,cell:c,getValue:c.getValue,renderValue:c.renderValue}),Gn(n.options,"debugCells"))};return n._features.forEach(o=>{o.createCell==null||o.createCell(s,t,e,n)},{}),s}function QNn(n,e,t,i){var r,s;const a={...n._getDefaultColumnDef(),...e},l=a.accessorKey;let c=(r=(s=a.id)!=null?s:l?typeof String.prototype.replaceAll=="function"?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)!=null?r:typeof a.header=="string"?a.header:void 0,u;if(a.accessorFn?u=a.accessorFn:l&&(l.includes(".")?u=h=>{let f=h;for(const p of l.split(".")){var g;f=(g=f)==null?void 0:g[p]}return f}:u=h=>h[a.accessorKey]),!c)throw new Error;let d={id:`${String(c)}`,accessorFn:u,parent:i,depth:t,columnDef:a,columns:[],getFlatColumns:Kn(()=>[!0],()=>{var h;return[d,...(h=d.columns)==null?void 0:h.flatMap(f=>f.getFlatColumns())]},Gn(n.options,"debugColumns")),getLeafColumns:Kn(()=>[n._getOrderColumnsFn()],h=>{var f;if((f=d.columns)!=null&&f.length){let g=d.columns.flatMap(p=>p.getLeafColumns());return h(g)}return[d]},Gn(n.options,"debugColumns"))};for(const h of n._features)h.createColumn==null||h.createColumn(d,n);return d}const nc="debugHeaders";function DAe(n,e,t){var i;let s={id:(i=t.id)!=null?i:e.id,column:e,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const o=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),o.push(l)};return a(s),o},getContext:()=>({table:n,header:s,column:e})};return n._features.forEach(o=>{o.createHeader==null||o.createHeader(s,n)}),s}const JNn={createTable:n=>{n.getHeaderGroups=Kn(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(e,t,i,r)=>{var s,o;const a=(s=i?.map(d=>t.find(h=>h.id===d)).filter(Boolean))!=null?s:[],l=(o=r?.map(d=>t.find(h=>h.id===d)).filter(Boolean))!=null?o:[],c=t.filter(d=>!(i!=null&&i.includes(d.id))&&!(r!=null&&r.includes(d.id)));return aF(e,[...a,...c,...l],n)},Gn(n.options,nc)),n.getCenterHeaderGroups=Kn(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(e,t,i,r)=>(t=t.filter(s=>!(i!=null&&i.includes(s.id))&&!(r!=null&&r.includes(s.id))),aF(e,t,n,"center")),Gn(n.options,nc)),n.getLeftHeaderGroups=Kn(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left],(e,t,i)=>{var r;const s=(r=i?.map(o=>t.find(a=>a.id===o)).filter(Boolean))!=null?r:[];return aF(e,s,n,"left")},Gn(n.options,nc)),n.getRightHeaderGroups=Kn(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.right],(e,t,i)=>{var r;const s=(r=i?.map(o=>t.find(a=>a.id===o)).filter(Boolean))!=null?r:[];return aF(e,s,n,"right")},Gn(n.options,nc)),n.getFooterGroups=Kn(()=>[n.getHeaderGroups()],e=>[...e].reverse(),Gn(n.options,nc)),n.getLeftFooterGroups=Kn(()=>[n.getLeftHeaderGroups()],e=>[...e].reverse(),Gn(n.options,nc)),n.getCenterFooterGroups=Kn(()=>[n.getCenterHeaderGroups()],e=>[...e].reverse(),Gn(n.options,nc)),n.getRightFooterGroups=Kn(()=>[n.getRightHeaderGroups()],e=>[...e].reverse(),Gn(n.options,nc)),n.getFlatHeaders=Kn(()=>[n.getHeaderGroups()],e=>e.map(t=>t.headers).flat(),Gn(n.options,nc)),n.getLeftFlatHeaders=Kn(()=>[n.getLeftHeaderGroups()],e=>e.map(t=>t.headers).flat(),Gn(n.options,nc)),n.getCenterFlatHeaders=Kn(()=>[n.getCenterHeaderGroups()],e=>e.map(t=>t.headers).flat(),Gn(n.options,nc)),n.getRightFlatHeaders=Kn(()=>[n.getRightHeaderGroups()],e=>e.map(t=>t.headers).flat(),Gn(n.options,nc)),n.getCenterLeafHeaders=Kn(()=>[n.getCenterFlatHeaders()],e=>e.filter(t=>{var i;return!((i=t.subHeaders)!=null&&i.length)}),Gn(n.options,nc)),n.getLeftLeafHeaders=Kn(()=>[n.getLeftFlatHeaders()],e=>e.filter(t=>{var i;return!((i=t.subHeaders)!=null&&i.length)}),Gn(n.options,nc)),n.getRightLeafHeaders=Kn(()=>[n.getRightFlatHeaders()],e=>e.filter(t=>{var i;return!((i=t.subHeaders)!=null&&i.length)}),Gn(n.options,nc)),n.getLeafHeaders=Kn(()=>[n.getLeftHeaderGroups(),n.getCenterHeaderGroups(),n.getRightHeaderGroups()],(e,t,i)=>{var r,s,o,a,l,c;return[...(r=(s=e[0])==null?void 0:s.headers)!=null?r:[],...(o=(a=t[0])==null?void 0:a.headers)!=null?o:[],...(l=(c=i[0])==null?void 0:c.headers)!=null?l:[]].map(u=>u.getLeafHeaders()).flat()},Gn(n.options,nc))}};function aF(n,e,t,i){var r,s;let o=0;const a=function(h,f){f===void 0&&(f=1),o=Math.max(o,f),h.filter(g=>g.getIsVisible()).forEach(g=>{var p;(p=g.columns)!=null&&p.length&&a(g.columns,f+1)},0)};a(n);let l=[];const c=(h,f)=>{const g={depth:f,id:[i,`${f}`].filter(Boolean).join("_"),headers:[]},p=[];h.forEach(m=>{const _=[...p].reverse()[0],v=m.column.depth===g.depth;let y,C=!1;if(v&&m.column.parent?y=m.column.parent:(y=m.column,C=!0),_&&_?.column===y)_.subHeaders.push(m);else{const x=DAe(t,y,{id:[i,f,y.id,m?.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${p.filter(k=>k.column===y).length}`:void 0,depth:f,index:p.length});x.subHeaders.push(m),p.push(x)}g.headers.push(m),m.headerGroup=g}),l.push(g),f>0&&c(p,f-1)},u=e.map((h,f)=>DAe(t,h,{depth:o,index:f}));c(u,o-1),l.reverse();const d=h=>h.filter(g=>g.column.getIsVisible()).map(g=>{let p=0,m=0,_=[0];g.subHeaders&&g.subHeaders.length?(_=[],d(g.subHeaders).forEach(y=>{let{colSpan:C,rowSpan:x}=y;p+=C,_.push(x)})):p=1;const v=Math.min(..._);return m=m+v,g.colSpan=p,g.rowSpan=m,{colSpan:p,rowSpan:m}});return d((r=(s=l[0])==null?void 0:s.headers)!=null?r:[]),l}const rge=(n,e,t,i,r,s,o)=>{let a={id:e,index:i,original:t,depth:r,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];const c=n.getColumn(l);if(c!=null&&c.accessorFn)return a._valuesCache[l]=c.accessorFn(a.original,i),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];const c=n.getColumn(l);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=c.columnDef.getUniqueValues(a.original,i),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var c;return(c=a.getValue(l))!=null?c:n.options.renderFallbackValue},subRows:[],getLeafRows:()=>ZNn(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?n.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],c=a;for(;;){const u=c.getParentRow();if(!u)break;l.push(u),c=u}return l.reverse()},getAllCells:Kn(()=>[n.getAllLeafColumns()],l=>l.map(c=>XNn(n,a,c,c.id)),Gn(n.options,"debugRows")),_getAllCellsByColumnId:Kn(()=>[a.getAllCells()],l=>l.reduce((c,u)=>(c[u.column.id]=u,c),{}),Gn(n.options,"debugRows"))};for(let l=0;l{n._getFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,n.id),n.getFacetedRowModel=()=>n._getFacetedRowModel?n._getFacetedRowModel():e.getPreFilteredRowModel(),n._getFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,n.id),n.getFacetedUniqueValues=()=>n._getFacetedUniqueValues?n._getFacetedUniqueValues():new Map,n._getFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,n.id),n.getFacetedMinMaxValues=()=>{if(n._getFacetedMinMaxValues)return n._getFacetedMinMaxValues()}}},_Ge=(n,e,t)=>{var i,r;const s=t==null||(i=t.toString())==null?void 0:i.toLowerCase();return!!(!((r=n.getValue(e))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(s))};_Ge.autoRemove=n=>wg(n);const vGe=(n,e,t)=>{var i;return!!(!((i=n.getValue(e))==null||(i=i.toString())==null)&&i.includes(t))};vGe.autoRemove=n=>wg(n);const bGe=(n,e,t)=>{var i;return((i=n.getValue(e))==null||(i=i.toString())==null?void 0:i.toLowerCase())===t?.toLowerCase()};bGe.autoRemove=n=>wg(n);const yGe=(n,e,t)=>{var i;return(i=n.getValue(e))==null?void 0:i.includes(t)};yGe.autoRemove=n=>wg(n)||!(n!=null&&n.length);const wGe=(n,e,t)=>!t.some(i=>{var r;return!((r=n.getValue(e))!=null&&r.includes(i))});wGe.autoRemove=n=>wg(n)||!(n!=null&&n.length);const CGe=(n,e,t)=>t.some(i=>{var r;return(r=n.getValue(e))==null?void 0:r.includes(i)});CGe.autoRemove=n=>wg(n)||!(n!=null&&n.length);const xGe=(n,e,t)=>n.getValue(e)===t;xGe.autoRemove=n=>wg(n);const SGe=(n,e,t)=>n.getValue(e)==t;SGe.autoRemove=n=>wg(n);const sge=(n,e,t)=>{let[i,r]=t;const s=n.getValue(e);return s>=i&&s<=r};sge.resolveFilterValue=n=>{let[e,t]=n,i=typeof e!="number"?parseFloat(e):e,r=typeof t!="number"?parseFloat(t):t,s=e===null||Number.isNaN(i)?-1/0:i,o=t===null||Number.isNaN(r)?1/0:r;if(s>o){const a=s;s=o,o=a}return[s,o]};sge.autoRemove=n=>wg(n)||wg(n[0])&&wg(n[1]);const Ym={includesString:_Ge,includesStringSensitive:vGe,equalsString:bGe,arrIncludes:yGe,arrIncludesAll:wGe,arrIncludesSome:CGe,equals:xGe,weakEquals:SGe,inNumberRange:sge};function wg(n){return n==null||n===""}const tRn={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:n=>({columnFilters:[],...n}),getDefaultOptions:n=>({onColumnFiltersChange:oh("columnFilters",n),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(n,e)=>{n.getAutoFilterFn=()=>{const t=e.getCoreRowModel().flatRows[0],i=t?.getValue(n.id);return typeof i=="string"?Ym.includesString:typeof i=="number"?Ym.inNumberRange:typeof i=="boolean"||i!==null&&typeof i=="object"?Ym.equals:Array.isArray(i)?Ym.arrIncludes:Ym.weakEquals},n.getFilterFn=()=>{var t,i;return XV(n.columnDef.filterFn)?n.columnDef.filterFn:n.columnDef.filterFn==="auto"?n.getAutoFilterFn():(t=(i=e.options.filterFns)==null?void 0:i[n.columnDef.filterFn])!=null?t:Ym[n.columnDef.filterFn]},n.getCanFilter=()=>{var t,i,r;return((t=n.columnDef.enableColumnFilter)!=null?t:!0)&&((i=e.options.enableColumnFilters)!=null?i:!0)&&((r=e.options.enableFilters)!=null?r:!0)&&!!n.accessorFn},n.getIsFiltered=()=>n.getFilterIndex()>-1,n.getFilterValue=()=>{var t;return(t=e.getState().columnFilters)==null||(t=t.find(i=>i.id===n.id))==null?void 0:t.value},n.getFilterIndex=()=>{var t,i;return(t=(i=e.getState().columnFilters)==null?void 0:i.findIndex(r=>r.id===n.id))!=null?t:-1},n.setFilterValue=t=>{e.setColumnFilters(i=>{const r=n.getFilterFn(),s=i?.find(u=>u.id===n.id),o=jv(t,s?s.value:void 0);if(IAe(r,o,n)){var a;return(a=i?.filter(u=>u.id!==n.id))!=null?a:[]}const l={id:n.id,value:o};if(s){var c;return(c=i?.map(u=>u.id===n.id?l:u))!=null?c:[]}return i!=null&&i.length?[...i,l]:[l]})}},createRow:(n,e)=>{n.columnFilters={},n.columnFiltersMeta={}},createTable:n=>{n.setColumnFilters=e=>{const t=n.getAllLeafColumns(),i=r=>{var s;return(s=jv(e,r))==null?void 0:s.filter(o=>{const a=t.find(l=>l.id===o.id);if(a){const l=a.getFilterFn();if(IAe(l,o.value,a))return!1}return!0})};n.options.onColumnFiltersChange==null||n.options.onColumnFiltersChange(i)},n.resetColumnFilters=e=>{var t,i;n.setColumnFilters(e?[]:(t=(i=n.initialState)==null?void 0:i.columnFilters)!=null?t:[])},n.getPreFilteredRowModel=()=>n.getCoreRowModel(),n.getFilteredRowModel=()=>(!n._getFilteredRowModel&&n.options.getFilteredRowModel&&(n._getFilteredRowModel=n.options.getFilteredRowModel(n)),n.options.manualFiltering||!n._getFilteredRowModel?n.getPreFilteredRowModel():n._getFilteredRowModel())}};function IAe(n,e,t){return(n&&n.autoRemove?n.autoRemove(e,t):!1)||typeof e>"u"||typeof e=="string"&&!e}const nRn=(n,e,t)=>t.reduce((i,r)=>{const s=r.getValue(n);return i+(typeof s=="number"?s:0)},0),iRn=(n,e,t)=>{let i;return t.forEach(r=>{const s=r.getValue(n);s!=null&&(i>s||i===void 0&&s>=s)&&(i=s)}),i},rRn=(n,e,t)=>{let i;return t.forEach(r=>{const s=r.getValue(n);s!=null&&(i=s)&&(i=s)}),i},sRn=(n,e,t)=>{let i,r;return t.forEach(s=>{const o=s.getValue(n);o!=null&&(i===void 0?o>=o&&(i=r=o):(i>o&&(i=o),r{let t=0,i=0;if(e.forEach(r=>{let s=r.getValue(n);s!=null&&(s=+s)>=s&&(++t,i+=s)}),t)return i/t},aRn=(n,e)=>{if(!e.length)return;const t=e.map(s=>s.getValue(n));if(!YNn(t))return;if(t.length===1)return t[0];const i=Math.floor(t.length/2),r=t.sort((s,o)=>s-o);return t.length%2!==0?r[i]:(r[i-1]+r[i])/2},lRn=(n,e)=>Array.from(new Set(e.map(t=>t.getValue(n))).values()),cRn=(n,e)=>new Set(e.map(t=>t.getValue(n))).size,uRn=(n,e)=>e.length,gG={sum:nRn,min:iRn,max:rRn,extent:sRn,mean:oRn,median:aRn,unique:lRn,uniqueCount:cRn,count:uRn},dRn={getDefaultColumnDef:()=>({aggregatedCell:n=>{var e,t;return(e=(t=n.getValue())==null||t.toString==null?void 0:t.toString())!=null?e:null},aggregationFn:"auto"}),getInitialState:n=>({grouping:[],...n}),getDefaultOptions:n=>({onGroupingChange:oh("grouping",n),groupedColumnMode:"reorder"}),createColumn:(n,e)=>{n.toggleGrouping=()=>{e.setGrouping(t=>t!=null&&t.includes(n.id)?t.filter(i=>i!==n.id):[...t??[],n.id])},n.getCanGroup=()=>{var t,i;return((t=n.columnDef.enableGrouping)!=null?t:!0)&&((i=e.options.enableGrouping)!=null?i:!0)&&(!!n.accessorFn||!!n.columnDef.getGroupingValue)},n.getIsGrouped=()=>{var t;return(t=e.getState().grouping)==null?void 0:t.includes(n.id)},n.getGroupedIndex=()=>{var t;return(t=e.getState().grouping)==null?void 0:t.indexOf(n.id)},n.getToggleGroupingHandler=()=>{const t=n.getCanGroup();return()=>{t&&n.toggleGrouping()}},n.getAutoAggregationFn=()=>{const t=e.getCoreRowModel().flatRows[0],i=t?.getValue(n.id);if(typeof i=="number")return gG.sum;if(Object.prototype.toString.call(i)==="[object Date]")return gG.extent},n.getAggregationFn=()=>{var t,i;if(!n)throw new Error;return XV(n.columnDef.aggregationFn)?n.columnDef.aggregationFn:n.columnDef.aggregationFn==="auto"?n.getAutoAggregationFn():(t=(i=e.options.aggregationFns)==null?void 0:i[n.columnDef.aggregationFn])!=null?t:gG[n.columnDef.aggregationFn]}},createTable:n=>{n.setGrouping=e=>n.options.onGroupingChange==null?void 0:n.options.onGroupingChange(e),n.resetGrouping=e=>{var t,i;n.setGrouping(e?[]:(t=(i=n.initialState)==null?void 0:i.grouping)!=null?t:[])},n.getPreGroupedRowModel=()=>n.getFilteredRowModel(),n.getGroupedRowModel=()=>(!n._getGroupedRowModel&&n.options.getGroupedRowModel&&(n._getGroupedRowModel=n.options.getGroupedRowModel(n)),n.options.manualGrouping||!n._getGroupedRowModel?n.getPreGroupedRowModel():n._getGroupedRowModel())},createRow:(n,e)=>{n.getIsGrouped=()=>!!n.groupingColumnId,n.getGroupingValue=t=>{if(n._groupingValuesCache.hasOwnProperty(t))return n._groupingValuesCache[t];const i=e.getColumn(t);return i!=null&&i.columnDef.getGroupingValue?(n._groupingValuesCache[t]=i.columnDef.getGroupingValue(n.original),n._groupingValuesCache[t]):n.getValue(t)},n._groupingValuesCache={}},createCell:(n,e,t,i)=>{n.getIsGrouped=()=>e.getIsGrouped()&&e.id===t.groupingColumnId,n.getIsPlaceholder=()=>!n.getIsGrouped()&&e.getIsGrouped(),n.getIsAggregated=()=>{var r;return!n.getIsGrouped()&&!n.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function hRn(n,e,t){if(!(e!=null&&e.length)||!t)return n;const i=n.filter(s=>!e.includes(s.id));return t==="remove"?i:[...e.map(s=>n.find(o=>o.id===s)).filter(Boolean),...i]}const fRn={getInitialState:n=>({columnOrder:[],...n}),getDefaultOptions:n=>({onColumnOrderChange:oh("columnOrder",n)}),createColumn:(n,e)=>{n.getIndex=Kn(t=>[pA(e,t)],t=>t.findIndex(i=>i.id===n.id),Gn(e.options,"debugColumns")),n.getIsFirstColumn=t=>{var i;return((i=pA(e,t)[0])==null?void 0:i.id)===n.id},n.getIsLastColumn=t=>{var i;const r=pA(e,t);return((i=r[r.length-1])==null?void 0:i.id)===n.id}},createTable:n=>{n.setColumnOrder=e=>n.options.onColumnOrderChange==null?void 0:n.options.onColumnOrderChange(e),n.resetColumnOrder=e=>{var t;n.setColumnOrder(e?[]:(t=n.initialState.columnOrder)!=null?t:[])},n._getOrderColumnsFn=Kn(()=>[n.getState().columnOrder,n.getState().grouping,n.options.groupedColumnMode],(e,t,i)=>r=>{let s=[];if(!(e!=null&&e.length))s=r;else{const o=[...e],a=[...r];for(;a.length&&o.length;){const l=o.shift(),c=a.findIndex(u=>u.id===l);c>-1&&s.push(a.splice(c,1)[0])}s=[...s,...a]}return hRn(s,t,i)},Gn(n.options,"debugTable"))}},pG=()=>({left:[],right:[]}),gRn={getInitialState:n=>({columnPinning:pG(),...n}),getDefaultOptions:n=>({onColumnPinningChange:oh("columnPinning",n)}),createColumn:(n,e)=>{n.pin=t=>{const i=n.getLeafColumns().map(r=>r.id).filter(Boolean);e.setColumnPinning(r=>{var s,o;if(t==="right"){var a,l;return{left:((a=r?.left)!=null?a:[]).filter(d=>!(i!=null&&i.includes(d))),right:[...((l=r?.right)!=null?l:[]).filter(d=>!(i!=null&&i.includes(d))),...i]}}if(t==="left"){var c,u;return{left:[...((c=r?.left)!=null?c:[]).filter(d=>!(i!=null&&i.includes(d))),...i],right:((u=r?.right)!=null?u:[]).filter(d=>!(i!=null&&i.includes(d)))}}return{left:((s=r?.left)!=null?s:[]).filter(d=>!(i!=null&&i.includes(d))),right:((o=r?.right)!=null?o:[]).filter(d=>!(i!=null&&i.includes(d)))}})},n.getCanPin=()=>n.getLeafColumns().some(i=>{var r,s,o;return((r=i.columnDef.enablePinning)!=null?r:!0)&&((s=(o=e.options.enableColumnPinning)!=null?o:e.options.enablePinning)!=null?s:!0)}),n.getIsPinned=()=>{const t=n.getLeafColumns().map(a=>a.id),{left:i,right:r}=e.getState().columnPinning,s=t.some(a=>i?.includes(a)),o=t.some(a=>r?.includes(a));return s?"left":o?"right":!1},n.getPinnedIndex=()=>{var t,i;const r=n.getIsPinned();return r?(t=(i=e.getState().columnPinning)==null||(i=i[r])==null?void 0:i.indexOf(n.id))!=null?t:-1:0}},createRow:(n,e)=>{n.getCenterVisibleCells=Kn(()=>[n._getAllVisibleCells(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,i,r)=>{const s=[...i??[],...r??[]];return t.filter(o=>!s.includes(o.column.id))},Gn(e.options,"debugRows")),n.getLeftVisibleCells=Kn(()=>[n._getAllVisibleCells(),e.getState().columnPinning.left],(t,i)=>(i??[]).map(s=>t.find(o=>o.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),Gn(e.options,"debugRows")),n.getRightVisibleCells=Kn(()=>[n._getAllVisibleCells(),e.getState().columnPinning.right],(t,i)=>(i??[]).map(s=>t.find(o=>o.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),Gn(e.options,"debugRows"))},createTable:n=>{n.setColumnPinning=e=>n.options.onColumnPinningChange==null?void 0:n.options.onColumnPinningChange(e),n.resetColumnPinning=e=>{var t,i;return n.setColumnPinning(e?pG():(t=(i=n.initialState)==null?void 0:i.columnPinning)!=null?t:pG())},n.getIsSomeColumnsPinned=e=>{var t;const i=n.getState().columnPinning;if(!e){var r,s;return!!((r=i.left)!=null&&r.length||(s=i.right)!=null&&s.length)}return!!((t=i[e])!=null&&t.length)},n.getLeftLeafColumns=Kn(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left],(e,t)=>(t??[]).map(i=>e.find(r=>r.id===i)).filter(Boolean),Gn(n.options,"debugColumns")),n.getRightLeafColumns=Kn(()=>[n.getAllLeafColumns(),n.getState().columnPinning.right],(e,t)=>(t??[]).map(i=>e.find(r=>r.id===i)).filter(Boolean),Gn(n.options,"debugColumns")),n.getCenterLeafColumns=Kn(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(e,t,i)=>{const r=[...t??[],...i??[]];return e.filter(s=>!r.includes(s.id))},Gn(n.options,"debugColumns"))}},lF={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},mG=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),pRn={getDefaultColumnDef:()=>lF,getInitialState:n=>({columnSizing:{},columnSizingInfo:mG(),...n}),getDefaultOptions:n=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:oh("columnSizing",n),onColumnSizingInfoChange:oh("columnSizingInfo",n)}),createColumn:(n,e)=>{n.getSize=()=>{var t,i,r;const s=e.getState().columnSizing[n.id];return Math.min(Math.max((t=n.columnDef.minSize)!=null?t:lF.minSize,(i=s??n.columnDef.size)!=null?i:lF.size),(r=n.columnDef.maxSize)!=null?r:lF.maxSize)},n.getStart=Kn(t=>[t,pA(e,t),e.getState().columnSizing],(t,i)=>i.slice(0,n.getIndex(t)).reduce((r,s)=>r+s.getSize(),0),Gn(e.options,"debugColumns")),n.getAfter=Kn(t=>[t,pA(e,t),e.getState().columnSizing],(t,i)=>i.slice(n.getIndex(t)+1).reduce((r,s)=>r+s.getSize(),0),Gn(e.options,"debugColumns")),n.resetSize=()=>{e.setColumnSizing(t=>{let{[n.id]:i,...r}=t;return r})},n.getCanResize=()=>{var t,i;return((t=n.columnDef.enableResizing)!=null?t:!0)&&((i=e.options.enableColumnResizing)!=null?i:!0)},n.getIsResizing=()=>e.getState().columnSizingInfo.isResizingColumn===n.id},createHeader:(n,e)=>{n.getSize=()=>{let t=0;const i=r=>{if(r.subHeaders.length)r.subHeaders.forEach(i);else{var s;t+=(s=r.column.getSize())!=null?s:0}};return i(n),t},n.getStart=()=>{if(n.index>0){const t=n.headerGroup.headers[n.index-1];return t.getStart()+t.getSize()}return 0},n.getResizeHandler=t=>{const i=e.getColumn(n.column.id),r=i?.getCanResize();return s=>{if(!i||!r||(s.persist==null||s.persist(),_G(s)&&s.touches&&s.touches.length>1))return;const o=n.getSize(),a=n?n.getLeafHeaders().map(_=>[_.column.id,_.column.getSize()]):[[i.id,i.getSize()]],l=_G(s)?Math.round(s.touches[0].clientX):s.clientX,c={},u=(_,v)=>{typeof v=="number"&&(e.setColumnSizingInfo(y=>{var C,x;const k=e.options.columnResizeDirection==="rtl"?-1:1,L=(v-((C=y?.startOffset)!=null?C:0))*k,D=Math.max(L/((x=y?.startSize)!=null?x:0),-.999999);return y.columnSizingStart.forEach(I=>{let[O,M]=I;c[O]=Math.round(Math.max(M+M*D,0)*100)/100}),{...y,deltaOffset:L,deltaPercentage:D}}),(e.options.columnResizeMode==="onChange"||_==="end")&&e.setColumnSizing(y=>({...y,...c})))},d=_=>u("move",_),h=_=>{u("end",_),e.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f=t||typeof document<"u"?document:null,g={moveHandler:_=>d(_.clientX),upHandler:_=>{f?.removeEventListener("mousemove",g.moveHandler),f?.removeEventListener("mouseup",g.upHandler),h(_.clientX)}},p={moveHandler:_=>(_.cancelable&&(_.preventDefault(),_.stopPropagation()),d(_.touches[0].clientX),!1),upHandler:_=>{var v;f?.removeEventListener("touchmove",p.moveHandler),f?.removeEventListener("touchend",p.upHandler),_.cancelable&&(_.preventDefault(),_.stopPropagation()),h((v=_.touches[0])==null?void 0:v.clientX)}},m=mRn()?{passive:!1}:!1;_G(s)?(f?.addEventListener("touchmove",p.moveHandler,m),f?.addEventListener("touchend",p.upHandler,m)):(f?.addEventListener("mousemove",g.moveHandler,m),f?.addEventListener("mouseup",g.upHandler,m)),e.setColumnSizingInfo(_=>({..._,startOffset:l,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:i.id}))}}},createTable:n=>{n.setColumnSizing=e=>n.options.onColumnSizingChange==null?void 0:n.options.onColumnSizingChange(e),n.setColumnSizingInfo=e=>n.options.onColumnSizingInfoChange==null?void 0:n.options.onColumnSizingInfoChange(e),n.resetColumnSizing=e=>{var t;n.setColumnSizing(e?{}:(t=n.initialState.columnSizing)!=null?t:{})},n.resetHeaderSizeInfo=e=>{var t;n.setColumnSizingInfo(e?mG():(t=n.initialState.columnSizingInfo)!=null?t:mG())},n.getTotalSize=()=>{var e,t;return(e=(t=n.getHeaderGroups()[0])==null?void 0:t.headers.reduce((i,r)=>i+r.getSize(),0))!=null?e:0},n.getLeftTotalSize=()=>{var e,t;return(e=(t=n.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((i,r)=>i+r.getSize(),0))!=null?e:0},n.getCenterTotalSize=()=>{var e,t;return(e=(t=n.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((i,r)=>i+r.getSize(),0))!=null?e:0},n.getRightTotalSize=()=>{var e,t;return(e=(t=n.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((i,r)=>i+r.getSize(),0))!=null?e:0}}};let cF=null;function mRn(){if(typeof cF=="boolean")return cF;let n=!1;try{const e={get passive(){return n=!0,!1}},t=()=>{};window.addEventListener("test",t,e),window.removeEventListener("test",t)}catch{n=!1}return cF=n,cF}function _G(n){return n.type==="touchstart"}const _Rn={getInitialState:n=>({columnVisibility:{},...n}),getDefaultOptions:n=>({onColumnVisibilityChange:oh("columnVisibility",n)}),createColumn:(n,e)=>{n.toggleVisibility=t=>{n.getCanHide()&&e.setColumnVisibility(i=>({...i,[n.id]:t??!n.getIsVisible()}))},n.getIsVisible=()=>{var t,i;const r=n.columns;return(t=r.length?r.some(s=>s.getIsVisible()):(i=e.getState().columnVisibility)==null?void 0:i[n.id])!=null?t:!0},n.getCanHide=()=>{var t,i;return((t=n.columnDef.enableHiding)!=null?t:!0)&&((i=e.options.enableHiding)!=null?i:!0)},n.getToggleVisibilityHandler=()=>t=>{n.toggleVisibility==null||n.toggleVisibility(t.target.checked)}},createRow:(n,e)=>{n._getAllVisibleCells=Kn(()=>[n.getAllCells(),e.getState().columnVisibility],t=>t.filter(i=>i.column.getIsVisible()),Gn(e.options,"debugRows")),n.getVisibleCells=Kn(()=>[n.getLeftVisibleCells(),n.getCenterVisibleCells(),n.getRightVisibleCells()],(t,i,r)=>[...t,...i,...r],Gn(e.options,"debugRows"))},createTable:n=>{const e=(t,i)=>Kn(()=>[i(),i().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),Gn(n.options,"debugColumns"));n.getVisibleFlatColumns=e("getVisibleFlatColumns",()=>n.getAllFlatColumns()),n.getVisibleLeafColumns=e("getVisibleLeafColumns",()=>n.getAllLeafColumns()),n.getLeftVisibleLeafColumns=e("getLeftVisibleLeafColumns",()=>n.getLeftLeafColumns()),n.getRightVisibleLeafColumns=e("getRightVisibleLeafColumns",()=>n.getRightLeafColumns()),n.getCenterVisibleLeafColumns=e("getCenterVisibleLeafColumns",()=>n.getCenterLeafColumns()),n.setColumnVisibility=t=>n.options.onColumnVisibilityChange==null?void 0:n.options.onColumnVisibilityChange(t),n.resetColumnVisibility=t=>{var i;n.setColumnVisibility(t?{}:(i=n.initialState.columnVisibility)!=null?i:{})},n.toggleAllColumnsVisible=t=>{var i;t=(i=t)!=null?i:!n.getIsAllColumnsVisible(),n.setColumnVisibility(n.getAllLeafColumns().reduce((r,s)=>({...r,[s.id]:t||!(s.getCanHide!=null&&s.getCanHide())}),{}))},n.getIsAllColumnsVisible=()=>!n.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),n.getIsSomeColumnsVisible=()=>n.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),n.getToggleAllColumnsVisibilityHandler=()=>t=>{var i;n.toggleAllColumnsVisible((i=t.target)==null?void 0:i.checked)}}};function pA(n,e){return e?e==="center"?n.getCenterVisibleLeafColumns():e==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns()}const vRn={createTable:n=>{n._getGlobalFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,"__global__"),n.getGlobalFacetedRowModel=()=>n.options.manualFiltering||!n._getGlobalFacetedRowModel?n.getPreFilteredRowModel():n._getGlobalFacetedRowModel(),n._getGlobalFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,"__global__"),n.getGlobalFacetedUniqueValues=()=>n._getGlobalFacetedUniqueValues?n._getGlobalFacetedUniqueValues():new Map,n._getGlobalFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,"__global__"),n.getGlobalFacetedMinMaxValues=()=>{if(n._getGlobalFacetedMinMaxValues)return n._getGlobalFacetedMinMaxValues()}}},bRn={getInitialState:n=>({globalFilter:void 0,...n}),getDefaultOptions:n=>({onGlobalFilterChange:oh("globalFilter",n),globalFilterFn:"auto",getColumnCanGlobalFilter:e=>{var t;const i=(t=n.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[e.id])==null?void 0:t.getValue();return typeof i=="string"||typeof i=="number"}}),createColumn:(n,e)=>{n.getCanGlobalFilter=()=>{var t,i,r,s;return((t=n.columnDef.enableGlobalFilter)!=null?t:!0)&&((i=e.options.enableGlobalFilter)!=null?i:!0)&&((r=e.options.enableFilters)!=null?r:!0)&&((s=e.options.getColumnCanGlobalFilter==null?void 0:e.options.getColumnCanGlobalFilter(n))!=null?s:!0)&&!!n.accessorFn}},createTable:n=>{n.getGlobalAutoFilterFn=()=>Ym.includesString,n.getGlobalFilterFn=()=>{var e,t;const{globalFilterFn:i}=n.options;return XV(i)?i:i==="auto"?n.getGlobalAutoFilterFn():(e=(t=n.options.filterFns)==null?void 0:t[i])!=null?e:Ym[i]},n.setGlobalFilter=e=>{n.options.onGlobalFilterChange==null||n.options.onGlobalFilterChange(e)},n.resetGlobalFilter=e=>{n.setGlobalFilter(e?void 0:n.initialState.globalFilter)}}},yRn={getInitialState:n=>({expanded:{},...n}),getDefaultOptions:n=>({onExpandedChange:oh("expanded",n),paginateExpandedRows:!0}),createTable:n=>{let e=!1,t=!1;n._autoResetExpanded=()=>{var i,r;if(!e){n._queue(()=>{e=!0});return}if((i=(r=n.options.autoResetAll)!=null?r:n.options.autoResetExpanded)!=null?i:!n.options.manualExpanding){if(t)return;t=!0,n._queue(()=>{n.resetExpanded(),t=!1})}},n.setExpanded=i=>n.options.onExpandedChange==null?void 0:n.options.onExpandedChange(i),n.toggleAllRowsExpanded=i=>{i??!n.getIsAllRowsExpanded()?n.setExpanded(!0):n.setExpanded({})},n.resetExpanded=i=>{var r,s;n.setExpanded(i?{}:(r=(s=n.initialState)==null?void 0:s.expanded)!=null?r:{})},n.getCanSomeRowsExpand=()=>n.getPrePaginationRowModel().flatRows.some(i=>i.getCanExpand()),n.getToggleAllRowsExpandedHandler=()=>i=>{i.persist==null||i.persist(),n.toggleAllRowsExpanded()},n.getIsSomeRowsExpanded=()=>{const i=n.getState().expanded;return i===!0||Object.values(i).some(Boolean)},n.getIsAllRowsExpanded=()=>{const i=n.getState().expanded;return typeof i=="boolean"?i===!0:!(!Object.keys(i).length||n.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},n.getExpandedDepth=()=>{let i=0;return(n.getState().expanded===!0?Object.keys(n.getRowModel().rowsById):Object.keys(n.getState().expanded)).forEach(s=>{const o=s.split(".");i=Math.max(i,o.length)}),i},n.getPreExpandedRowModel=()=>n.getSortedRowModel(),n.getExpandedRowModel=()=>(!n._getExpandedRowModel&&n.options.getExpandedRowModel&&(n._getExpandedRowModel=n.options.getExpandedRowModel(n)),n.options.manualExpanding||!n._getExpandedRowModel?n.getPreExpandedRowModel():n._getExpandedRowModel())},createRow:(n,e)=>{n.toggleExpanded=t=>{e.setExpanded(i=>{var r;const s=i===!0?!0:!!(i!=null&&i[n.id]);let o={};if(i===!0?Object.keys(e.getRowModel().rowsById).forEach(a=>{o[a]=!0}):o=i,t=(r=t)!=null?r:!s,!s&&t)return{...o,[n.id]:!0};if(s&&!t){const{[n.id]:a,...l}=o;return l}return i})},n.getIsExpanded=()=>{var t;const i=e.getState().expanded;return!!((t=e.options.getIsRowExpanded==null?void 0:e.options.getIsRowExpanded(n))!=null?t:i===!0||i?.[n.id])},n.getCanExpand=()=>{var t,i,r;return(t=e.options.getRowCanExpand==null?void 0:e.options.getRowCanExpand(n))!=null?t:((i=e.options.enableExpanding)!=null?i:!0)&&!!((r=n.subRows)!=null&&r.length)},n.getIsAllParentsExpanded=()=>{let t=!0,i=n;for(;t&&i.parentId;)i=e.getRow(i.parentId,!0),t=i.getIsExpanded();return t},n.getToggleExpandedHandler=()=>{const t=n.getCanExpand();return()=>{t&&n.toggleExpanded()}}}},kse=0,Ese=10,vG=()=>({pageIndex:kse,pageSize:Ese}),wRn={getInitialState:n=>({...n,pagination:{...vG(),...n?.pagination}}),getDefaultOptions:n=>({onPaginationChange:oh("pagination",n)}),createTable:n=>{let e=!1,t=!1;n._autoResetPageIndex=()=>{var i,r;if(!e){n._queue(()=>{e=!0});return}if((i=(r=n.options.autoResetAll)!=null?r:n.options.autoResetPageIndex)!=null?i:!n.options.manualPagination){if(t)return;t=!0,n._queue(()=>{n.resetPageIndex(),t=!1})}},n.setPagination=i=>{const r=s=>jv(i,s);return n.options.onPaginationChange==null?void 0:n.options.onPaginationChange(r)},n.resetPagination=i=>{var r;n.setPagination(i?vG():(r=n.initialState.pagination)!=null?r:vG())},n.setPageIndex=i=>{n.setPagination(r=>{let s=jv(i,r.pageIndex);const o=typeof n.options.pageCount>"u"||n.options.pageCount===-1?Number.MAX_SAFE_INTEGER:n.options.pageCount-1;return s=Math.max(0,Math.min(s,o)),{...r,pageIndex:s}})},n.resetPageIndex=i=>{var r,s;n.setPageIndex(i?kse:(r=(s=n.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?r:kse)},n.resetPageSize=i=>{var r,s;n.setPageSize(i?Ese:(r=(s=n.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?r:Ese)},n.setPageSize=i=>{n.setPagination(r=>{const s=Math.max(1,jv(i,r.pageSize)),o=r.pageSize*r.pageIndex,a=Math.floor(o/s);return{...r,pageIndex:a,pageSize:s}})},n.setPageCount=i=>n.setPagination(r=>{var s;let o=jv(i,(s=n.options.pageCount)!=null?s:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...r,pageCount:o}}),n.getPageOptions=Kn(()=>[n.getPageCount()],i=>{let r=[];return i&&i>0&&(r=[...new Array(i)].fill(null).map((s,o)=>o)),r},Gn(n.options,"debugTable")),n.getCanPreviousPage=()=>n.getState().pagination.pageIndex>0,n.getCanNextPage=()=>{const{pageIndex:i}=n.getState().pagination,r=n.getPageCount();return r===-1?!0:r===0?!1:in.setPageIndex(i=>i-1),n.nextPage=()=>n.setPageIndex(i=>i+1),n.firstPage=()=>n.setPageIndex(0),n.lastPage=()=>n.setPageIndex(n.getPageCount()-1),n.getPrePaginationRowModel=()=>n.getExpandedRowModel(),n.getPaginationRowModel=()=>(!n._getPaginationRowModel&&n.options.getPaginationRowModel&&(n._getPaginationRowModel=n.options.getPaginationRowModel(n)),n.options.manualPagination||!n._getPaginationRowModel?n.getPrePaginationRowModel():n._getPaginationRowModel()),n.getPageCount=()=>{var i;return(i=n.options.pageCount)!=null?i:Math.ceil(n.getRowCount()/n.getState().pagination.pageSize)},n.getRowCount=()=>{var i;return(i=n.options.rowCount)!=null?i:n.getPrePaginationRowModel().rows.length}}},bG=()=>({top:[],bottom:[]}),CRn={getInitialState:n=>({rowPinning:bG(),...n}),getDefaultOptions:n=>({onRowPinningChange:oh("rowPinning",n)}),createRow:(n,e)=>{n.pin=(t,i,r)=>{const s=i?n.getLeafRows().map(l=>{let{id:c}=l;return c}):[],o=r?n.getParentRows().map(l=>{let{id:c}=l;return c}):[],a=new Set([...o,n.id,...s]);e.setRowPinning(l=>{var c,u;if(t==="bottom"){var d,h;return{top:((d=l?.top)!=null?d:[]).filter(p=>!(a!=null&&a.has(p))),bottom:[...((h=l?.bottom)!=null?h:[]).filter(p=>!(a!=null&&a.has(p))),...Array.from(a)]}}if(t==="top"){var f,g;return{top:[...((f=l?.top)!=null?f:[]).filter(p=>!(a!=null&&a.has(p))),...Array.from(a)],bottom:((g=l?.bottom)!=null?g:[]).filter(p=>!(a!=null&&a.has(p)))}}return{top:((c=l?.top)!=null?c:[]).filter(p=>!(a!=null&&a.has(p))),bottom:((u=l?.bottom)!=null?u:[]).filter(p=>!(a!=null&&a.has(p)))}})},n.getCanPin=()=>{var t;const{enableRowPinning:i,enablePinning:r}=e.options;return typeof i=="function"?i(n):(t=i??r)!=null?t:!0},n.getIsPinned=()=>{const t=[n.id],{top:i,bottom:r}=e.getState().rowPinning,s=t.some(a=>i?.includes(a)),o=t.some(a=>r?.includes(a));return s?"top":o?"bottom":!1},n.getPinnedIndex=()=>{var t,i;const r=n.getIsPinned();if(!r)return-1;const s=(t=r==="top"?e.getTopRows():e.getBottomRows())==null?void 0:t.map(o=>{let{id:a}=o;return a});return(i=s?.indexOf(n.id))!=null?i:-1}},createTable:n=>{n.setRowPinning=e=>n.options.onRowPinningChange==null?void 0:n.options.onRowPinningChange(e),n.resetRowPinning=e=>{var t,i;return n.setRowPinning(e?bG():(t=(i=n.initialState)==null?void 0:i.rowPinning)!=null?t:bG())},n.getIsSomeRowsPinned=e=>{var t;const i=n.getState().rowPinning;if(!e){var r,s;return!!((r=i.top)!=null&&r.length||(s=i.bottom)!=null&&s.length)}return!!((t=i[e])!=null&&t.length)},n._getPinnedRows=(e,t,i)=>{var r;return((r=n.options.keepPinnedRows)==null||r?(t??[]).map(o=>{const a=n.getRow(o,!0);return a.getIsAllParentsExpanded()?a:null}):(t??[]).map(o=>e.find(a=>a.id===o))).filter(Boolean).map(o=>({...o,position:i}))},n.getTopRows=Kn(()=>[n.getRowModel().rows,n.getState().rowPinning.top],(e,t)=>n._getPinnedRows(e,t,"top"),Gn(n.options,"debugRows")),n.getBottomRows=Kn(()=>[n.getRowModel().rows,n.getState().rowPinning.bottom],(e,t)=>n._getPinnedRows(e,t,"bottom"),Gn(n.options,"debugRows")),n.getCenterRows=Kn(()=>[n.getRowModel().rows,n.getState().rowPinning.top,n.getState().rowPinning.bottom],(e,t,i)=>{const r=new Set([...t??[],...i??[]]);return e.filter(s=>!r.has(s.id))},Gn(n.options,"debugRows"))}},xRn={getInitialState:n=>({rowSelection:{},...n}),getDefaultOptions:n=>({onRowSelectionChange:oh("rowSelection",n),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:n=>{n.setRowSelection=e=>n.options.onRowSelectionChange==null?void 0:n.options.onRowSelectionChange(e),n.resetRowSelection=e=>{var t;return n.setRowSelection(e?{}:(t=n.initialState.rowSelection)!=null?t:{})},n.toggleAllRowsSelected=e=>{n.setRowSelection(t=>{e=typeof e<"u"?e:!n.getIsAllRowsSelected();const i={...t},r=n.getPreGroupedRowModel().flatRows;return e?r.forEach(s=>{s.getCanSelect()&&(i[s.id]=!0)}):r.forEach(s=>{delete i[s.id]}),i})},n.toggleAllPageRowsSelected=e=>n.setRowSelection(t=>{const i=typeof e<"u"?e:!n.getIsAllPageRowsSelected(),r={...t};return n.getRowModel().rows.forEach(s=>{Lse(r,s.id,i,!0,n)}),r}),n.getPreSelectedRowModel=()=>n.getCoreRowModel(),n.getSelectedRowModel=Kn(()=>[n.getState().rowSelection,n.getCoreRowModel()],(e,t)=>Object.keys(e).length?yG(n,t):{rows:[],flatRows:[],rowsById:{}},Gn(n.options,"debugTable")),n.getFilteredSelectedRowModel=Kn(()=>[n.getState().rowSelection,n.getFilteredRowModel()],(e,t)=>Object.keys(e).length?yG(n,t):{rows:[],flatRows:[],rowsById:{}},Gn(n.options,"debugTable")),n.getGroupedSelectedRowModel=Kn(()=>[n.getState().rowSelection,n.getSortedRowModel()],(e,t)=>Object.keys(e).length?yG(n,t):{rows:[],flatRows:[],rowsById:{}},Gn(n.options,"debugTable")),n.getIsAllRowsSelected=()=>{const e=n.getFilteredRowModel().flatRows,{rowSelection:t}=n.getState();let i=!!(e.length&&Object.keys(t).length);return i&&e.some(r=>r.getCanSelect()&&!t[r.id])&&(i=!1),i},n.getIsAllPageRowsSelected=()=>{const e=n.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=n.getState();let i=!!e.length;return i&&e.some(r=>!t[r.id])&&(i=!1),i},n.getIsSomeRowsSelected=()=>{var e;const t=Object.keys((e=n.getState().rowSelection)!=null?e:{}).length;return t>0&&t{const e=n.getPaginationRowModel().flatRows;return n.getIsAllPageRowsSelected()?!1:e.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},n.getToggleAllRowsSelectedHandler=()=>e=>{n.toggleAllRowsSelected(e.target.checked)},n.getToggleAllPageRowsSelectedHandler=()=>e=>{n.toggleAllPageRowsSelected(e.target.checked)}},createRow:(n,e)=>{n.toggleSelected=(t,i)=>{const r=n.getIsSelected();e.setRowSelection(s=>{var o;if(t=typeof t<"u"?t:!r,n.getCanSelect()&&r===t)return s;const a={...s};return Lse(a,n.id,t,(o=i?.selectChildren)!=null?o:!0,e),a})},n.getIsSelected=()=>{const{rowSelection:t}=e.getState();return oge(n,t)},n.getIsSomeSelected=()=>{const{rowSelection:t}=e.getState();return Tse(n,t)==="some"},n.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=e.getState();return Tse(n,t)==="all"},n.getCanSelect=()=>{var t;return typeof e.options.enableRowSelection=="function"?e.options.enableRowSelection(n):(t=e.options.enableRowSelection)!=null?t:!0},n.getCanSelectSubRows=()=>{var t;return typeof e.options.enableSubRowSelection=="function"?e.options.enableSubRowSelection(n):(t=e.options.enableSubRowSelection)!=null?t:!0},n.getCanMultiSelect=()=>{var t;return typeof e.options.enableMultiRowSelection=="function"?e.options.enableMultiRowSelection(n):(t=e.options.enableMultiRowSelection)!=null?t:!0},n.getToggleSelectedHandler=()=>{const t=n.getCanSelect();return i=>{var r;t&&n.toggleSelected((r=i.target)==null?void 0:r.checked)}}}},Lse=(n,e,t,i,r)=>{var s;const o=r.getRow(e,!0);t?(o.getCanMultiSelect()||Object.keys(n).forEach(a=>delete n[a]),o.getCanSelect()&&(n[e]=!0)):delete n[e],i&&(s=o.subRows)!=null&&s.length&&o.getCanSelectSubRows()&&o.subRows.forEach(a=>Lse(n,a.id,t,i,r))};function yG(n,e){const t=n.getState().rowSelection,i=[],r={},s=function(o,a){return o.map(l=>{var c;const u=oge(l,t);if(u&&(i.push(l),r[l.id]=l),(c=l.subRows)!=null&&c.length&&(l={...l,subRows:s(l.subRows)}),u)return l}).filter(Boolean)};return{rows:s(e.rows),flatRows:i,rowsById:r}}function oge(n,e){var t;return(t=e[n.id])!=null?t:!1}function Tse(n,e,t){var i;if(!((i=n.subRows)!=null&&i.length))return!1;let r=!0,s=!1;return n.subRows.forEach(o=>{if(!(s&&!r)&&(o.getCanSelect()&&(oge(o,e)?s=!0:r=!1),o.subRows&&o.subRows.length)){const a=Tse(o,e);a==="all"?s=!0:(a==="some"&&(s=!0),r=!1)}}),r?"all":s?"some":!1}const Dse=/([0-9]+)/gm,SRn=(n,e,t)=>kGe(Ub(n.getValue(t)).toLowerCase(),Ub(e.getValue(t)).toLowerCase()),kRn=(n,e,t)=>kGe(Ub(n.getValue(t)),Ub(e.getValue(t))),ERn=(n,e,t)=>age(Ub(n.getValue(t)).toLowerCase(),Ub(e.getValue(t)).toLowerCase()),LRn=(n,e,t)=>age(Ub(n.getValue(t)),Ub(e.getValue(t))),TRn=(n,e,t)=>{const i=n.getValue(t),r=e.getValue(t);return i>r?1:iage(n.getValue(t),e.getValue(t));function age(n,e){return n===e?0:n>e?1:-1}function Ub(n){return typeof n=="number"?isNaN(n)||n===1/0||n===-1/0?"":String(n):typeof n=="string"?n:""}function kGe(n,e){const t=n.split(Dse).filter(Boolean),i=e.split(Dse).filter(Boolean);for(;t.length&&i.length;){const r=t.shift(),s=i.shift(),o=parseInt(r,10),a=parseInt(s,10),l=[o,a].sort();if(isNaN(l[0])){if(r>s)return 1;if(s>r)return-1;continue}if(isNaN(l[1]))return isNaN(o)?-1:1;if(o>a)return 1;if(a>o)return-1}return t.length-i.length}const uD={alphanumeric:SRn,alphanumericCaseSensitive:kRn,text:ERn,textCaseSensitive:LRn,datetime:TRn,basic:DRn},IRn={getInitialState:n=>({sorting:[],...n}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:n=>({onSortingChange:oh("sorting",n),isMultiSortEvent:e=>e.shiftKey}),createColumn:(n,e)=>{n.getAutoSortingFn=()=>{const t=e.getFilteredRowModel().flatRows.slice(10);let i=!1;for(const r of t){const s=r?.getValue(n.id);if(Object.prototype.toString.call(s)==="[object Date]")return uD.datetime;if(typeof s=="string"&&(i=!0,s.split(Dse).length>1))return uD.alphanumeric}return i?uD.text:uD.basic},n.getAutoSortDir=()=>{const t=e.getFilteredRowModel().flatRows[0];return typeof t?.getValue(n.id)=="string"?"asc":"desc"},n.getSortingFn=()=>{var t,i;if(!n)throw new Error;return XV(n.columnDef.sortingFn)?n.columnDef.sortingFn:n.columnDef.sortingFn==="auto"?n.getAutoSortingFn():(t=(i=e.options.sortingFns)==null?void 0:i[n.columnDef.sortingFn])!=null?t:uD[n.columnDef.sortingFn]},n.toggleSorting=(t,i)=>{const r=n.getNextSortingOrder(),s=typeof t<"u"&&t!==null;e.setSorting(o=>{const a=o?.find(f=>f.id===n.id),l=o?.findIndex(f=>f.id===n.id);let c=[],u,d=s?t:r==="desc";if(o!=null&&o.length&&n.getCanMultiSort()&&i?a?u="toggle":u="add":o!=null&&o.length&&l!==o.length-1?u="replace":a?u="toggle":u="replace",u==="toggle"&&(s||r||(u="remove")),u==="add"){var h;c=[...o,{id:n.id,desc:d}],c.splice(0,c.length-((h=e.options.maxMultiSortColCount)!=null?h:Number.MAX_SAFE_INTEGER))}else u==="toggle"?c=o.map(f=>f.id===n.id?{...f,desc:d}:f):u==="remove"?c=o.filter(f=>f.id!==n.id):c=[{id:n.id,desc:d}];return c})},n.getFirstSortDir=()=>{var t,i;return((t=(i=n.columnDef.sortDescFirst)!=null?i:e.options.sortDescFirst)!=null?t:n.getAutoSortDir()==="desc")?"desc":"asc"},n.getNextSortingOrder=t=>{var i,r;const s=n.getFirstSortDir(),o=n.getIsSorted();return o?o!==s&&((i=e.options.enableSortingRemoval)==null||i)&&(!(t&&(r=e.options.enableMultiRemove)!=null)||r)?!1:o==="desc"?"asc":"desc":s},n.getCanSort=()=>{var t,i;return((t=n.columnDef.enableSorting)!=null?t:!0)&&((i=e.options.enableSorting)!=null?i:!0)&&!!n.accessorFn},n.getCanMultiSort=()=>{var t,i;return(t=(i=n.columnDef.enableMultiSort)!=null?i:e.options.enableMultiSort)!=null?t:!!n.accessorFn},n.getIsSorted=()=>{var t;const i=(t=e.getState().sorting)==null?void 0:t.find(r=>r.id===n.id);return i?i.desc?"desc":"asc":!1},n.getSortIndex=()=>{var t,i;return(t=(i=e.getState().sorting)==null?void 0:i.findIndex(r=>r.id===n.id))!=null?t:-1},n.clearSorting=()=>{e.setSorting(t=>t!=null&&t.length?t.filter(i=>i.id!==n.id):[])},n.getToggleSortingHandler=()=>{const t=n.getCanSort();return i=>{t&&(i.persist==null||i.persist(),n.toggleSorting==null||n.toggleSorting(void 0,n.getCanMultiSort()?e.options.isMultiSortEvent==null?void 0:e.options.isMultiSortEvent(i):!1))}}},createTable:n=>{n.setSorting=e=>n.options.onSortingChange==null?void 0:n.options.onSortingChange(e),n.resetSorting=e=>{var t,i;n.setSorting(e?[]:(t=(i=n.initialState)==null?void 0:i.sorting)!=null?t:[])},n.getPreSortedRowModel=()=>n.getGroupedRowModel(),n.getSortedRowModel=()=>(!n._getSortedRowModel&&n.options.getSortedRowModel&&(n._getSortedRowModel=n.options.getSortedRowModel(n)),n.options.manualSorting||!n._getSortedRowModel?n.getPreSortedRowModel():n._getSortedRowModel())}},ARn=[JNn,_Rn,fRn,gRn,eRn,tRn,vRn,bRn,IRn,dRn,yRn,wRn,CRn,xRn,pRn];function NRn(n){var e,t;const i=[...ARn,...(e=n._features)!=null?e:[]];let r={_features:i};const s=r._features.reduce((h,f)=>Object.assign(h,f.getDefaultOptions==null?void 0:f.getDefaultOptions(r)),{}),o=h=>r.options.mergeOptions?r.options.mergeOptions(s,h):{...s,...h};let l={...{},...(t=n.initialState)!=null?t:{}};r._features.forEach(h=>{var f;l=(f=h.getInitialState==null?void 0:h.getInitialState(l))!=null?f:l});const c=[];let u=!1;const d={_features:i,options:{...s,...n},initialState:l,_queue:h=>{c.push(h),u||(u=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();u=!1}).catch(f=>setTimeout(()=>{throw f})))},reset:()=>{r.setState(r.initialState)},setOptions:h=>{const f=jv(h,r.options);r.options=o(f)},getState:()=>r.options.state,setState:h=>{r.options.onStateChange==null||r.options.onStateChange(h)},_getRowId:(h,f,g)=>{var p;return(p=r.options.getRowId==null?void 0:r.options.getRowId(h,f,g))!=null?p:`${g?[g.id,f].join("."):f}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(h,f)=>{let g=(f?r.getPrePaginationRowModel():r.getRowModel()).rowsById[h];if(!g&&(g=r.getCoreRowModel().rowsById[h],!g))throw new Error;return g},_getDefaultColumnDef:Kn(()=>[r.options.defaultColumn],h=>{var f;return h=(f=h)!=null?f:{},{header:g=>{const p=g.header.column.columnDef;return p.accessorKey?p.accessorKey:p.accessorFn?p.id:null},cell:g=>{var p,m;return(p=(m=g.renderValue())==null||m.toString==null?void 0:m.toString())!=null?p:null},...r._features.reduce((g,p)=>Object.assign(g,p.getDefaultColumnDef==null?void 0:p.getDefaultColumnDef()),{}),...h}},Gn(n,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:Kn(()=>[r._getColumnDefs()],h=>{const f=function(g,p,m){return m===void 0&&(m=0),g.map(_=>{const v=QNn(r,_,m,p),y=_;return v.columns=y.columns?f(y.columns,v,m+1):[],v})};return f(h)},Gn(n,"debugColumns")),getAllFlatColumns:Kn(()=>[r.getAllColumns()],h=>h.flatMap(f=>f.getFlatColumns()),Gn(n,"debugColumns")),_getAllFlatColumnsById:Kn(()=>[r.getAllFlatColumns()],h=>h.reduce((f,g)=>(f[g.id]=g,f),{}),Gn(n,"debugColumns")),getAllLeafColumns:Kn(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(h,f)=>{let g=h.flatMap(p=>p.getLeafColumns());return f(g)},Gn(n,"debugColumns")),getColumn:h=>r._getAllFlatColumnsById()[h]};Object.assign(r,d);for(let h=0;hKn(()=>[n.options.data],e=>{const t={rows:[],flatRows:[],rowsById:{}},i=function(r,s,o){s===void 0&&(s=0);const a=[];for(let c=0;cn._autoResetPageIndex()))}function RRn(n){const e=[],t=i=>{var r;e.push(i),(r=i.subRows)!=null&&r.length&&i.getIsExpanded()&&i.subRows.forEach(t)};return n.rows.forEach(t),{rows:e,flatRows:n.flatRows,rowsById:n.rowsById}}function EGe(n,e,t){return t.options.filterFromLeafRows?PRn(n,e,t):ORn(n,e,t)}function PRn(n,e,t){var i;const r=[],s={},o=(i=t.options.maxLeafRowFilterDepth)!=null?i:100,a=function(l,c){c===void 0&&(c=0);const u=[];for(let h=0;hKn(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter,n.getFilteredRowModel()],(t,i,r)=>{if(!t.rows.length||!(i!=null&&i.length)&&!r)return t;const s=[...i.map(a=>a.id).filter(a=>a!==e),r?"__global__":void 0].filter(Boolean),o=a=>{for(let l=0;lKn(()=>{var t;return[(t=n.getColumn(e))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return new Map;let i=new Map;for(let s=0;sKn(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter],(e,t,i)=>{if(!e.rows.length||!(t!=null&&t.length)&&!i){for(let h=0;h{var f;const g=n.getColumn(h.id);if(!g)return;const p=g.getFilterFn();p&&r.push({id:h.id,filterFn:p,resolvedValue:(f=p.resolveFilterValue==null?void 0:p.resolveFilterValue(h.value))!=null?f:h.value})});const o=(t??[]).map(h=>h.id),a=n.getGlobalFilterFn(),l=n.getAllLeafColumns().filter(h=>h.getCanGlobalFilter());i&&a&&l.length&&(o.push("__global__"),l.forEach(h=>{var f;s.push({id:h.id,filterFn:a,resolvedValue:(f=a.resolveFilterValue==null?void 0:a.resolveFilterValue(i))!=null?f:i})}));let c,u;for(let h=0;h{f.columnFiltersMeta[p]=m})}if(s.length){for(let g=0;g{f.columnFiltersMeta[p]=m})){f.columnFilters.__global__=!0;break}}f.columnFilters.__global__!==!0&&(f.columnFilters.__global__=!1)}}const d=h=>{for(let f=0;fn._autoResetPageIndex()))}function BVn(n){return e=>Kn(()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded],(t,i)=>{if(!i.rows.length)return i;const{pageSize:r,pageIndex:s}=t;let{rows:o,flatRows:a,rowsById:l}=i;const c=r*s,u=c+r;o=o.slice(c,u);let d;e.options.paginateExpandedRows?d={rows:o,flatRows:a,rowsById:l}:d=RRn({rows:o,flatRows:a,rowsById:l}),d.flatRows=[];const h=f=>{d.flatRows.push(f),f.subRows.length&&f.subRows.forEach(h)};return d.rows.forEach(h),d},Gn(e.options,"debugTable"))}function $Vn(){return n=>Kn(()=>[n.getState().sorting,n.getPreSortedRowModel()],(e,t)=>{if(!t.rows.length||!(e!=null&&e.length))return t;const i=n.getState().sorting,r=[],s=i.filter(l=>{var c;return(c=n.getColumn(l.id))==null?void 0:c.getCanSort()}),o={};s.forEach(l=>{const c=n.getColumn(l.id);c&&(o[l.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});const a=l=>{const c=l.map(u=>({...u}));return c.sort((u,d)=>{for(let f=0;f{var d;r.push(u),(d=u.subRows)!=null&&d.length&&(u.subRows=a(u.subRows))}),c};return{rows:a(t.rows),flatRows:r,rowsById:t.rowsById}},Gn(n.options,"debugTable","getSortedRowModel",()=>n._autoResetPageIndex()))}/** + color: hsl(${Math.max(0,Math.min(120-120*h,120))}deg 100% 31%);`,t?.key)}return r}}function Gn(n,e,t,i){return{debug:()=>{var r;return(r=n?.debugAll)!=null?r:n[e]},key:!1,onChange:i}}function XNn(n,e,t,i){const r=()=>{var o;return(o=s.getValue())!=null?o:n.options.renderFallbackValue},s={id:`${e.id}_${t.id}`,row:e,column:t,getValue:()=>e.getValue(i),renderValue:r,getContext:Kn(()=>[n,t,e,s],(o,a,l,c)=>({table:o,column:a,row:l,cell:c,getValue:c.getValue,renderValue:c.renderValue}),Gn(n.options,"debugCells"))};return n._features.forEach(o=>{o.createCell==null||o.createCell(s,t,e,n)},{}),s}function QNn(n,e,t,i){var r,s;const a={...n._getDefaultColumnDef(),...e},l=a.accessorKey;let c=(r=(s=a.id)!=null?s:l?typeof String.prototype.replaceAll=="function"?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)!=null?r:typeof a.header=="string"?a.header:void 0,u;if(a.accessorFn?u=a.accessorFn:l&&(l.includes(".")?u=h=>{let f=h;for(const p of l.split(".")){var g;f=(g=f)==null?void 0:g[p]}return f}:u=h=>h[a.accessorKey]),!c)throw new Error;let d={id:`${String(c)}`,accessorFn:u,parent:i,depth:t,columnDef:a,columns:[],getFlatColumns:Kn(()=>[!0],()=>{var h;return[d,...(h=d.columns)==null?void 0:h.flatMap(f=>f.getFlatColumns())]},Gn(n.options,"debugColumns")),getLeafColumns:Kn(()=>[n._getOrderColumnsFn()],h=>{var f;if((f=d.columns)!=null&&f.length){let g=d.columns.flatMap(p=>p.getLeafColumns());return h(g)}return[d]},Gn(n.options,"debugColumns"))};for(const h of n._features)h.createColumn==null||h.createColumn(d,n);return d}const nc="debugHeaders";function DAe(n,e,t){var i;let s={id:(i=t.id)!=null?i:e.id,column:e,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const o=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),o.push(l)};return a(s),o},getContext:()=>({table:n,header:s,column:e})};return n._features.forEach(o=>{o.createHeader==null||o.createHeader(s,n)}),s}const JNn={createTable:n=>{n.getHeaderGroups=Kn(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(e,t,i,r)=>{var s,o;const a=(s=i?.map(d=>t.find(h=>h.id===d)).filter(Boolean))!=null?s:[],l=(o=r?.map(d=>t.find(h=>h.id===d)).filter(Boolean))!=null?o:[],c=t.filter(d=>!(i!=null&&i.includes(d.id))&&!(r!=null&&r.includes(d.id)));return a5(e,[...a,...c,...l],n)},Gn(n.options,nc)),n.getCenterHeaderGroups=Kn(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(e,t,i,r)=>(t=t.filter(s=>!(i!=null&&i.includes(s.id))&&!(r!=null&&r.includes(s.id))),a5(e,t,n,"center")),Gn(n.options,nc)),n.getLeftHeaderGroups=Kn(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left],(e,t,i)=>{var r;const s=(r=i?.map(o=>t.find(a=>a.id===o)).filter(Boolean))!=null?r:[];return a5(e,s,n,"left")},Gn(n.options,nc)),n.getRightHeaderGroups=Kn(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.right],(e,t,i)=>{var r;const s=(r=i?.map(o=>t.find(a=>a.id===o)).filter(Boolean))!=null?r:[];return a5(e,s,n,"right")},Gn(n.options,nc)),n.getFooterGroups=Kn(()=>[n.getHeaderGroups()],e=>[...e].reverse(),Gn(n.options,nc)),n.getLeftFooterGroups=Kn(()=>[n.getLeftHeaderGroups()],e=>[...e].reverse(),Gn(n.options,nc)),n.getCenterFooterGroups=Kn(()=>[n.getCenterHeaderGroups()],e=>[...e].reverse(),Gn(n.options,nc)),n.getRightFooterGroups=Kn(()=>[n.getRightHeaderGroups()],e=>[...e].reverse(),Gn(n.options,nc)),n.getFlatHeaders=Kn(()=>[n.getHeaderGroups()],e=>e.map(t=>t.headers).flat(),Gn(n.options,nc)),n.getLeftFlatHeaders=Kn(()=>[n.getLeftHeaderGroups()],e=>e.map(t=>t.headers).flat(),Gn(n.options,nc)),n.getCenterFlatHeaders=Kn(()=>[n.getCenterHeaderGroups()],e=>e.map(t=>t.headers).flat(),Gn(n.options,nc)),n.getRightFlatHeaders=Kn(()=>[n.getRightHeaderGroups()],e=>e.map(t=>t.headers).flat(),Gn(n.options,nc)),n.getCenterLeafHeaders=Kn(()=>[n.getCenterFlatHeaders()],e=>e.filter(t=>{var i;return!((i=t.subHeaders)!=null&&i.length)}),Gn(n.options,nc)),n.getLeftLeafHeaders=Kn(()=>[n.getLeftFlatHeaders()],e=>e.filter(t=>{var i;return!((i=t.subHeaders)!=null&&i.length)}),Gn(n.options,nc)),n.getRightLeafHeaders=Kn(()=>[n.getRightFlatHeaders()],e=>e.filter(t=>{var i;return!((i=t.subHeaders)!=null&&i.length)}),Gn(n.options,nc)),n.getLeafHeaders=Kn(()=>[n.getLeftHeaderGroups(),n.getCenterHeaderGroups(),n.getRightHeaderGroups()],(e,t,i)=>{var r,s,o,a,l,c;return[...(r=(s=e[0])==null?void 0:s.headers)!=null?r:[],...(o=(a=t[0])==null?void 0:a.headers)!=null?o:[],...(l=(c=i[0])==null?void 0:c.headers)!=null?l:[]].map(u=>u.getLeafHeaders()).flat()},Gn(n.options,nc))}};function a5(n,e,t,i){var r,s;let o=0;const a=function(h,f){f===void 0&&(f=1),o=Math.max(o,f),h.filter(g=>g.getIsVisible()).forEach(g=>{var p;(p=g.columns)!=null&&p.length&&a(g.columns,f+1)},0)};a(n);let l=[];const c=(h,f)=>{const g={depth:f,id:[i,`${f}`].filter(Boolean).join("_"),headers:[]},p=[];h.forEach(m=>{const _=[...p].reverse()[0],v=m.column.depth===g.depth;let y,C=!1;if(v&&m.column.parent?y=m.column.parent:(y=m.column,C=!0),_&&_?.column===y)_.subHeaders.push(m);else{const x=DAe(t,y,{id:[i,f,y.id,m?.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${p.filter(k=>k.column===y).length}`:void 0,depth:f,index:p.length});x.subHeaders.push(m),p.push(x)}g.headers.push(m),m.headerGroup=g}),l.push(g),f>0&&c(p,f-1)},u=e.map((h,f)=>DAe(t,h,{depth:o,index:f}));c(u,o-1),l.reverse();const d=h=>h.filter(g=>g.column.getIsVisible()).map(g=>{let p=0,m=0,_=[0];g.subHeaders&&g.subHeaders.length?(_=[],d(g.subHeaders).forEach(y=>{let{colSpan:C,rowSpan:x}=y;p+=C,_.push(x)})):p=1;const v=Math.min(..._);return m=m+v,g.colSpan=p,g.rowSpan=m,{colSpan:p,rowSpan:m}});return d((r=(s=l[0])==null?void 0:s.headers)!=null?r:[]),l}const rge=(n,e,t,i,r,s,o)=>{let a={id:e,index:i,original:t,depth:r,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];const c=n.getColumn(l);if(c!=null&&c.accessorFn)return a._valuesCache[l]=c.accessorFn(a.original,i),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];const c=n.getColumn(l);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=c.columnDef.getUniqueValues(a.original,i),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var c;return(c=a.getValue(l))!=null?c:n.options.renderFallbackValue},subRows:[],getLeafRows:()=>ZNn(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?n.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],c=a;for(;;){const u=c.getParentRow();if(!u)break;l.push(u),c=u}return l.reverse()},getAllCells:Kn(()=>[n.getAllLeafColumns()],l=>l.map(c=>XNn(n,a,c,c.id)),Gn(n.options,"debugRows")),_getAllCellsByColumnId:Kn(()=>[a.getAllCells()],l=>l.reduce((c,u)=>(c[u.column.id]=u,c),{}),Gn(n.options,"debugRows"))};for(let l=0;l{n._getFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,n.id),n.getFacetedRowModel=()=>n._getFacetedRowModel?n._getFacetedRowModel():e.getPreFilteredRowModel(),n._getFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,n.id),n.getFacetedUniqueValues=()=>n._getFacetedUniqueValues?n._getFacetedUniqueValues():new Map,n._getFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,n.id),n.getFacetedMinMaxValues=()=>{if(n._getFacetedMinMaxValues)return n._getFacetedMinMaxValues()}}},_Ge=(n,e,t)=>{var i,r;const s=t==null||(i=t.toString())==null?void 0:i.toLowerCase();return!!(!((r=n.getValue(e))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(s))};_Ge.autoRemove=n=>wg(n);const vGe=(n,e,t)=>{var i;return!!(!((i=n.getValue(e))==null||(i=i.toString())==null)&&i.includes(t))};vGe.autoRemove=n=>wg(n);const bGe=(n,e,t)=>{var i;return((i=n.getValue(e))==null||(i=i.toString())==null?void 0:i.toLowerCase())===t?.toLowerCase()};bGe.autoRemove=n=>wg(n);const yGe=(n,e,t)=>{var i;return(i=n.getValue(e))==null?void 0:i.includes(t)};yGe.autoRemove=n=>wg(n)||!(n!=null&&n.length);const wGe=(n,e,t)=>!t.some(i=>{var r;return!((r=n.getValue(e))!=null&&r.includes(i))});wGe.autoRemove=n=>wg(n)||!(n!=null&&n.length);const CGe=(n,e,t)=>t.some(i=>{var r;return(r=n.getValue(e))==null?void 0:r.includes(i)});CGe.autoRemove=n=>wg(n)||!(n!=null&&n.length);const xGe=(n,e,t)=>n.getValue(e)===t;xGe.autoRemove=n=>wg(n);const SGe=(n,e,t)=>n.getValue(e)==t;SGe.autoRemove=n=>wg(n);const sge=(n,e,t)=>{let[i,r]=t;const s=n.getValue(e);return s>=i&&s<=r};sge.resolveFilterValue=n=>{let[e,t]=n,i=typeof e!="number"?parseFloat(e):e,r=typeof t!="number"?parseFloat(t):t,s=e===null||Number.isNaN(i)?-1/0:i,o=t===null||Number.isNaN(r)?1/0:r;if(s>o){const a=s;s=o,o=a}return[s,o]};sge.autoRemove=n=>wg(n)||wg(n[0])&&wg(n[1]);const Ym={includesString:_Ge,includesStringSensitive:vGe,equalsString:bGe,arrIncludes:yGe,arrIncludesAll:wGe,arrIncludesSome:CGe,equals:xGe,weakEquals:SGe,inNumberRange:sge};function wg(n){return n==null||n===""}const tRn={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:n=>({columnFilters:[],...n}),getDefaultOptions:n=>({onColumnFiltersChange:oh("columnFilters",n),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(n,e)=>{n.getAutoFilterFn=()=>{const t=e.getCoreRowModel().flatRows[0],i=t?.getValue(n.id);return typeof i=="string"?Ym.includesString:typeof i=="number"?Ym.inNumberRange:typeof i=="boolean"||i!==null&&typeof i=="object"?Ym.equals:Array.isArray(i)?Ym.arrIncludes:Ym.weakEquals},n.getFilterFn=()=>{var t,i;return XV(n.columnDef.filterFn)?n.columnDef.filterFn:n.columnDef.filterFn==="auto"?n.getAutoFilterFn():(t=(i=e.options.filterFns)==null?void 0:i[n.columnDef.filterFn])!=null?t:Ym[n.columnDef.filterFn]},n.getCanFilter=()=>{var t,i,r;return((t=n.columnDef.enableColumnFilter)!=null?t:!0)&&((i=e.options.enableColumnFilters)!=null?i:!0)&&((r=e.options.enableFilters)!=null?r:!0)&&!!n.accessorFn},n.getIsFiltered=()=>n.getFilterIndex()>-1,n.getFilterValue=()=>{var t;return(t=e.getState().columnFilters)==null||(t=t.find(i=>i.id===n.id))==null?void 0:t.value},n.getFilterIndex=()=>{var t,i;return(t=(i=e.getState().columnFilters)==null?void 0:i.findIndex(r=>r.id===n.id))!=null?t:-1},n.setFilterValue=t=>{e.setColumnFilters(i=>{const r=n.getFilterFn(),s=i?.find(u=>u.id===n.id),o=jv(t,s?s.value:void 0);if(IAe(r,o,n)){var a;return(a=i?.filter(u=>u.id!==n.id))!=null?a:[]}const l={id:n.id,value:o};if(s){var c;return(c=i?.map(u=>u.id===n.id?l:u))!=null?c:[]}return i!=null&&i.length?[...i,l]:[l]})}},createRow:(n,e)=>{n.columnFilters={},n.columnFiltersMeta={}},createTable:n=>{n.setColumnFilters=e=>{const t=n.getAllLeafColumns(),i=r=>{var s;return(s=jv(e,r))==null?void 0:s.filter(o=>{const a=t.find(l=>l.id===o.id);if(a){const l=a.getFilterFn();if(IAe(l,o.value,a))return!1}return!0})};n.options.onColumnFiltersChange==null||n.options.onColumnFiltersChange(i)},n.resetColumnFilters=e=>{var t,i;n.setColumnFilters(e?[]:(t=(i=n.initialState)==null?void 0:i.columnFilters)!=null?t:[])},n.getPreFilteredRowModel=()=>n.getCoreRowModel(),n.getFilteredRowModel=()=>(!n._getFilteredRowModel&&n.options.getFilteredRowModel&&(n._getFilteredRowModel=n.options.getFilteredRowModel(n)),n.options.manualFiltering||!n._getFilteredRowModel?n.getPreFilteredRowModel():n._getFilteredRowModel())}};function IAe(n,e,t){return(n&&n.autoRemove?n.autoRemove(e,t):!1)||typeof e>"u"||typeof e=="string"&&!e}const nRn=(n,e,t)=>t.reduce((i,r)=>{const s=r.getValue(n);return i+(typeof s=="number"?s:0)},0),iRn=(n,e,t)=>{let i;return t.forEach(r=>{const s=r.getValue(n);s!=null&&(i>s||i===void 0&&s>=s)&&(i=s)}),i},rRn=(n,e,t)=>{let i;return t.forEach(r=>{const s=r.getValue(n);s!=null&&(i=s)&&(i=s)}),i},sRn=(n,e,t)=>{let i,r;return t.forEach(s=>{const o=s.getValue(n);o!=null&&(i===void 0?o>=o&&(i=r=o):(i>o&&(i=o),r{let t=0,i=0;if(e.forEach(r=>{let s=r.getValue(n);s!=null&&(s=+s)>=s&&(++t,i+=s)}),t)return i/t},aRn=(n,e)=>{if(!e.length)return;const t=e.map(s=>s.getValue(n));if(!YNn(t))return;if(t.length===1)return t[0];const i=Math.floor(t.length/2),r=t.sort((s,o)=>s-o);return t.length%2!==0?r[i]:(r[i-1]+r[i])/2},lRn=(n,e)=>Array.from(new Set(e.map(t=>t.getValue(n))).values()),cRn=(n,e)=>new Set(e.map(t=>t.getValue(n))).size,uRn=(n,e)=>e.length,gG={sum:nRn,min:iRn,max:rRn,extent:sRn,mean:oRn,median:aRn,unique:lRn,uniqueCount:cRn,count:uRn},dRn={getDefaultColumnDef:()=>({aggregatedCell:n=>{var e,t;return(e=(t=n.getValue())==null||t.toString==null?void 0:t.toString())!=null?e:null},aggregationFn:"auto"}),getInitialState:n=>({grouping:[],...n}),getDefaultOptions:n=>({onGroupingChange:oh("grouping",n),groupedColumnMode:"reorder"}),createColumn:(n,e)=>{n.toggleGrouping=()=>{e.setGrouping(t=>t!=null&&t.includes(n.id)?t.filter(i=>i!==n.id):[...t??[],n.id])},n.getCanGroup=()=>{var t,i;return((t=n.columnDef.enableGrouping)!=null?t:!0)&&((i=e.options.enableGrouping)!=null?i:!0)&&(!!n.accessorFn||!!n.columnDef.getGroupingValue)},n.getIsGrouped=()=>{var t;return(t=e.getState().grouping)==null?void 0:t.includes(n.id)},n.getGroupedIndex=()=>{var t;return(t=e.getState().grouping)==null?void 0:t.indexOf(n.id)},n.getToggleGroupingHandler=()=>{const t=n.getCanGroup();return()=>{t&&n.toggleGrouping()}},n.getAutoAggregationFn=()=>{const t=e.getCoreRowModel().flatRows[0],i=t?.getValue(n.id);if(typeof i=="number")return gG.sum;if(Object.prototype.toString.call(i)==="[object Date]")return gG.extent},n.getAggregationFn=()=>{var t,i;if(!n)throw new Error;return XV(n.columnDef.aggregationFn)?n.columnDef.aggregationFn:n.columnDef.aggregationFn==="auto"?n.getAutoAggregationFn():(t=(i=e.options.aggregationFns)==null?void 0:i[n.columnDef.aggregationFn])!=null?t:gG[n.columnDef.aggregationFn]}},createTable:n=>{n.setGrouping=e=>n.options.onGroupingChange==null?void 0:n.options.onGroupingChange(e),n.resetGrouping=e=>{var t,i;n.setGrouping(e?[]:(t=(i=n.initialState)==null?void 0:i.grouping)!=null?t:[])},n.getPreGroupedRowModel=()=>n.getFilteredRowModel(),n.getGroupedRowModel=()=>(!n._getGroupedRowModel&&n.options.getGroupedRowModel&&(n._getGroupedRowModel=n.options.getGroupedRowModel(n)),n.options.manualGrouping||!n._getGroupedRowModel?n.getPreGroupedRowModel():n._getGroupedRowModel())},createRow:(n,e)=>{n.getIsGrouped=()=>!!n.groupingColumnId,n.getGroupingValue=t=>{if(n._groupingValuesCache.hasOwnProperty(t))return n._groupingValuesCache[t];const i=e.getColumn(t);return i!=null&&i.columnDef.getGroupingValue?(n._groupingValuesCache[t]=i.columnDef.getGroupingValue(n.original),n._groupingValuesCache[t]):n.getValue(t)},n._groupingValuesCache={}},createCell:(n,e,t,i)=>{n.getIsGrouped=()=>e.getIsGrouped()&&e.id===t.groupingColumnId,n.getIsPlaceholder=()=>!n.getIsGrouped()&&e.getIsGrouped(),n.getIsAggregated=()=>{var r;return!n.getIsGrouped()&&!n.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function hRn(n,e,t){if(!(e!=null&&e.length)||!t)return n;const i=n.filter(s=>!e.includes(s.id));return t==="remove"?i:[...e.map(s=>n.find(o=>o.id===s)).filter(Boolean),...i]}const fRn={getInitialState:n=>({columnOrder:[],...n}),getDefaultOptions:n=>({onColumnOrderChange:oh("columnOrder",n)}),createColumn:(n,e)=>{n.getIndex=Kn(t=>[pA(e,t)],t=>t.findIndex(i=>i.id===n.id),Gn(e.options,"debugColumns")),n.getIsFirstColumn=t=>{var i;return((i=pA(e,t)[0])==null?void 0:i.id)===n.id},n.getIsLastColumn=t=>{var i;const r=pA(e,t);return((i=r[r.length-1])==null?void 0:i.id)===n.id}},createTable:n=>{n.setColumnOrder=e=>n.options.onColumnOrderChange==null?void 0:n.options.onColumnOrderChange(e),n.resetColumnOrder=e=>{var t;n.setColumnOrder(e?[]:(t=n.initialState.columnOrder)!=null?t:[])},n._getOrderColumnsFn=Kn(()=>[n.getState().columnOrder,n.getState().grouping,n.options.groupedColumnMode],(e,t,i)=>r=>{let s=[];if(!(e!=null&&e.length))s=r;else{const o=[...e],a=[...r];for(;a.length&&o.length;){const l=o.shift(),c=a.findIndex(u=>u.id===l);c>-1&&s.push(a.splice(c,1)[0])}s=[...s,...a]}return hRn(s,t,i)},Gn(n.options,"debugTable"))}},pG=()=>({left:[],right:[]}),gRn={getInitialState:n=>({columnPinning:pG(),...n}),getDefaultOptions:n=>({onColumnPinningChange:oh("columnPinning",n)}),createColumn:(n,e)=>{n.pin=t=>{const i=n.getLeafColumns().map(r=>r.id).filter(Boolean);e.setColumnPinning(r=>{var s,o;if(t==="right"){var a,l;return{left:((a=r?.left)!=null?a:[]).filter(d=>!(i!=null&&i.includes(d))),right:[...((l=r?.right)!=null?l:[]).filter(d=>!(i!=null&&i.includes(d))),...i]}}if(t==="left"){var c,u;return{left:[...((c=r?.left)!=null?c:[]).filter(d=>!(i!=null&&i.includes(d))),...i],right:((u=r?.right)!=null?u:[]).filter(d=>!(i!=null&&i.includes(d)))}}return{left:((s=r?.left)!=null?s:[]).filter(d=>!(i!=null&&i.includes(d))),right:((o=r?.right)!=null?o:[]).filter(d=>!(i!=null&&i.includes(d)))}})},n.getCanPin=()=>n.getLeafColumns().some(i=>{var r,s,o;return((r=i.columnDef.enablePinning)!=null?r:!0)&&((s=(o=e.options.enableColumnPinning)!=null?o:e.options.enablePinning)!=null?s:!0)}),n.getIsPinned=()=>{const t=n.getLeafColumns().map(a=>a.id),{left:i,right:r}=e.getState().columnPinning,s=t.some(a=>i?.includes(a)),o=t.some(a=>r?.includes(a));return s?"left":o?"right":!1},n.getPinnedIndex=()=>{var t,i;const r=n.getIsPinned();return r?(t=(i=e.getState().columnPinning)==null||(i=i[r])==null?void 0:i.indexOf(n.id))!=null?t:-1:0}},createRow:(n,e)=>{n.getCenterVisibleCells=Kn(()=>[n._getAllVisibleCells(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,i,r)=>{const s=[...i??[],...r??[]];return t.filter(o=>!s.includes(o.column.id))},Gn(e.options,"debugRows")),n.getLeftVisibleCells=Kn(()=>[n._getAllVisibleCells(),e.getState().columnPinning.left],(t,i)=>(i??[]).map(s=>t.find(o=>o.column.id===s)).filter(Boolean).map(s=>({...s,position:"left"})),Gn(e.options,"debugRows")),n.getRightVisibleCells=Kn(()=>[n._getAllVisibleCells(),e.getState().columnPinning.right],(t,i)=>(i??[]).map(s=>t.find(o=>o.column.id===s)).filter(Boolean).map(s=>({...s,position:"right"})),Gn(e.options,"debugRows"))},createTable:n=>{n.setColumnPinning=e=>n.options.onColumnPinningChange==null?void 0:n.options.onColumnPinningChange(e),n.resetColumnPinning=e=>{var t,i;return n.setColumnPinning(e?pG():(t=(i=n.initialState)==null?void 0:i.columnPinning)!=null?t:pG())},n.getIsSomeColumnsPinned=e=>{var t;const i=n.getState().columnPinning;if(!e){var r,s;return!!((r=i.left)!=null&&r.length||(s=i.right)!=null&&s.length)}return!!((t=i[e])!=null&&t.length)},n.getLeftLeafColumns=Kn(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left],(e,t)=>(t??[]).map(i=>e.find(r=>r.id===i)).filter(Boolean),Gn(n.options,"debugColumns")),n.getRightLeafColumns=Kn(()=>[n.getAllLeafColumns(),n.getState().columnPinning.right],(e,t)=>(t??[]).map(i=>e.find(r=>r.id===i)).filter(Boolean),Gn(n.options,"debugColumns")),n.getCenterLeafColumns=Kn(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(e,t,i)=>{const r=[...t??[],...i??[]];return e.filter(s=>!r.includes(s.id))},Gn(n.options,"debugColumns"))}},l5={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},mG=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),pRn={getDefaultColumnDef:()=>l5,getInitialState:n=>({columnSizing:{},columnSizingInfo:mG(),...n}),getDefaultOptions:n=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:oh("columnSizing",n),onColumnSizingInfoChange:oh("columnSizingInfo",n)}),createColumn:(n,e)=>{n.getSize=()=>{var t,i,r;const s=e.getState().columnSizing[n.id];return Math.min(Math.max((t=n.columnDef.minSize)!=null?t:l5.minSize,(i=s??n.columnDef.size)!=null?i:l5.size),(r=n.columnDef.maxSize)!=null?r:l5.maxSize)},n.getStart=Kn(t=>[t,pA(e,t),e.getState().columnSizing],(t,i)=>i.slice(0,n.getIndex(t)).reduce((r,s)=>r+s.getSize(),0),Gn(e.options,"debugColumns")),n.getAfter=Kn(t=>[t,pA(e,t),e.getState().columnSizing],(t,i)=>i.slice(n.getIndex(t)+1).reduce((r,s)=>r+s.getSize(),0),Gn(e.options,"debugColumns")),n.resetSize=()=>{e.setColumnSizing(t=>{let{[n.id]:i,...r}=t;return r})},n.getCanResize=()=>{var t,i;return((t=n.columnDef.enableResizing)!=null?t:!0)&&((i=e.options.enableColumnResizing)!=null?i:!0)},n.getIsResizing=()=>e.getState().columnSizingInfo.isResizingColumn===n.id},createHeader:(n,e)=>{n.getSize=()=>{let t=0;const i=r=>{if(r.subHeaders.length)r.subHeaders.forEach(i);else{var s;t+=(s=r.column.getSize())!=null?s:0}};return i(n),t},n.getStart=()=>{if(n.index>0){const t=n.headerGroup.headers[n.index-1];return t.getStart()+t.getSize()}return 0},n.getResizeHandler=t=>{const i=e.getColumn(n.column.id),r=i?.getCanResize();return s=>{if(!i||!r||(s.persist==null||s.persist(),_G(s)&&s.touches&&s.touches.length>1))return;const o=n.getSize(),a=n?n.getLeafHeaders().map(_=>[_.column.id,_.column.getSize()]):[[i.id,i.getSize()]],l=_G(s)?Math.round(s.touches[0].clientX):s.clientX,c={},u=(_,v)=>{typeof v=="number"&&(e.setColumnSizingInfo(y=>{var C,x;const k=e.options.columnResizeDirection==="rtl"?-1:1,L=(v-((C=y?.startOffset)!=null?C:0))*k,D=Math.max(L/((x=y?.startSize)!=null?x:0),-.999999);return y.columnSizingStart.forEach(I=>{let[O,M]=I;c[O]=Math.round(Math.max(M+M*D,0)*100)/100}),{...y,deltaOffset:L,deltaPercentage:D}}),(e.options.columnResizeMode==="onChange"||_==="end")&&e.setColumnSizing(y=>({...y,...c})))},d=_=>u("move",_),h=_=>{u("end",_),e.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f=t||typeof document<"u"?document:null,g={moveHandler:_=>d(_.clientX),upHandler:_=>{f?.removeEventListener("mousemove",g.moveHandler),f?.removeEventListener("mouseup",g.upHandler),h(_.clientX)}},p={moveHandler:_=>(_.cancelable&&(_.preventDefault(),_.stopPropagation()),d(_.touches[0].clientX),!1),upHandler:_=>{var v;f?.removeEventListener("touchmove",p.moveHandler),f?.removeEventListener("touchend",p.upHandler),_.cancelable&&(_.preventDefault(),_.stopPropagation()),h((v=_.touches[0])==null?void 0:v.clientX)}},m=mRn()?{passive:!1}:!1;_G(s)?(f?.addEventListener("touchmove",p.moveHandler,m),f?.addEventListener("touchend",p.upHandler,m)):(f?.addEventListener("mousemove",g.moveHandler,m),f?.addEventListener("mouseup",g.upHandler,m)),e.setColumnSizingInfo(_=>({..._,startOffset:l,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:i.id}))}}},createTable:n=>{n.setColumnSizing=e=>n.options.onColumnSizingChange==null?void 0:n.options.onColumnSizingChange(e),n.setColumnSizingInfo=e=>n.options.onColumnSizingInfoChange==null?void 0:n.options.onColumnSizingInfoChange(e),n.resetColumnSizing=e=>{var t;n.setColumnSizing(e?{}:(t=n.initialState.columnSizing)!=null?t:{})},n.resetHeaderSizeInfo=e=>{var t;n.setColumnSizingInfo(e?mG():(t=n.initialState.columnSizingInfo)!=null?t:mG())},n.getTotalSize=()=>{var e,t;return(e=(t=n.getHeaderGroups()[0])==null?void 0:t.headers.reduce((i,r)=>i+r.getSize(),0))!=null?e:0},n.getLeftTotalSize=()=>{var e,t;return(e=(t=n.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((i,r)=>i+r.getSize(),0))!=null?e:0},n.getCenterTotalSize=()=>{var e,t;return(e=(t=n.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((i,r)=>i+r.getSize(),0))!=null?e:0},n.getRightTotalSize=()=>{var e,t;return(e=(t=n.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((i,r)=>i+r.getSize(),0))!=null?e:0}}};let c5=null;function mRn(){if(typeof c5=="boolean")return c5;let n=!1;try{const e={get passive(){return n=!0,!1}},t=()=>{};window.addEventListener("test",t,e),window.removeEventListener("test",t)}catch{n=!1}return c5=n,c5}function _G(n){return n.type==="touchstart"}const _Rn={getInitialState:n=>({columnVisibility:{},...n}),getDefaultOptions:n=>({onColumnVisibilityChange:oh("columnVisibility",n)}),createColumn:(n,e)=>{n.toggleVisibility=t=>{n.getCanHide()&&e.setColumnVisibility(i=>({...i,[n.id]:t??!n.getIsVisible()}))},n.getIsVisible=()=>{var t,i;const r=n.columns;return(t=r.length?r.some(s=>s.getIsVisible()):(i=e.getState().columnVisibility)==null?void 0:i[n.id])!=null?t:!0},n.getCanHide=()=>{var t,i;return((t=n.columnDef.enableHiding)!=null?t:!0)&&((i=e.options.enableHiding)!=null?i:!0)},n.getToggleVisibilityHandler=()=>t=>{n.toggleVisibility==null||n.toggleVisibility(t.target.checked)}},createRow:(n,e)=>{n._getAllVisibleCells=Kn(()=>[n.getAllCells(),e.getState().columnVisibility],t=>t.filter(i=>i.column.getIsVisible()),Gn(e.options,"debugRows")),n.getVisibleCells=Kn(()=>[n.getLeftVisibleCells(),n.getCenterVisibleCells(),n.getRightVisibleCells()],(t,i,r)=>[...t,...i,...r],Gn(e.options,"debugRows"))},createTable:n=>{const e=(t,i)=>Kn(()=>[i(),i().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(s=>s.getIsVisible==null?void 0:s.getIsVisible()),Gn(n.options,"debugColumns"));n.getVisibleFlatColumns=e("getVisibleFlatColumns",()=>n.getAllFlatColumns()),n.getVisibleLeafColumns=e("getVisibleLeafColumns",()=>n.getAllLeafColumns()),n.getLeftVisibleLeafColumns=e("getLeftVisibleLeafColumns",()=>n.getLeftLeafColumns()),n.getRightVisibleLeafColumns=e("getRightVisibleLeafColumns",()=>n.getRightLeafColumns()),n.getCenterVisibleLeafColumns=e("getCenterVisibleLeafColumns",()=>n.getCenterLeafColumns()),n.setColumnVisibility=t=>n.options.onColumnVisibilityChange==null?void 0:n.options.onColumnVisibilityChange(t),n.resetColumnVisibility=t=>{var i;n.setColumnVisibility(t?{}:(i=n.initialState.columnVisibility)!=null?i:{})},n.toggleAllColumnsVisible=t=>{var i;t=(i=t)!=null?i:!n.getIsAllColumnsVisible(),n.setColumnVisibility(n.getAllLeafColumns().reduce((r,s)=>({...r,[s.id]:t||!(s.getCanHide!=null&&s.getCanHide())}),{}))},n.getIsAllColumnsVisible=()=>!n.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),n.getIsSomeColumnsVisible=()=>n.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),n.getToggleAllColumnsVisibilityHandler=()=>t=>{var i;n.toggleAllColumnsVisible((i=t.target)==null?void 0:i.checked)}}};function pA(n,e){return e?e==="center"?n.getCenterVisibleLeafColumns():e==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns()}const vRn={createTable:n=>{n._getGlobalFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,"__global__"),n.getGlobalFacetedRowModel=()=>n.options.manualFiltering||!n._getGlobalFacetedRowModel?n.getPreFilteredRowModel():n._getGlobalFacetedRowModel(),n._getGlobalFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,"__global__"),n.getGlobalFacetedUniqueValues=()=>n._getGlobalFacetedUniqueValues?n._getGlobalFacetedUniqueValues():new Map,n._getGlobalFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,"__global__"),n.getGlobalFacetedMinMaxValues=()=>{if(n._getGlobalFacetedMinMaxValues)return n._getGlobalFacetedMinMaxValues()}}},bRn={getInitialState:n=>({globalFilter:void 0,...n}),getDefaultOptions:n=>({onGlobalFilterChange:oh("globalFilter",n),globalFilterFn:"auto",getColumnCanGlobalFilter:e=>{var t;const i=(t=n.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[e.id])==null?void 0:t.getValue();return typeof i=="string"||typeof i=="number"}}),createColumn:(n,e)=>{n.getCanGlobalFilter=()=>{var t,i,r,s;return((t=n.columnDef.enableGlobalFilter)!=null?t:!0)&&((i=e.options.enableGlobalFilter)!=null?i:!0)&&((r=e.options.enableFilters)!=null?r:!0)&&((s=e.options.getColumnCanGlobalFilter==null?void 0:e.options.getColumnCanGlobalFilter(n))!=null?s:!0)&&!!n.accessorFn}},createTable:n=>{n.getGlobalAutoFilterFn=()=>Ym.includesString,n.getGlobalFilterFn=()=>{var e,t;const{globalFilterFn:i}=n.options;return XV(i)?i:i==="auto"?n.getGlobalAutoFilterFn():(e=(t=n.options.filterFns)==null?void 0:t[i])!=null?e:Ym[i]},n.setGlobalFilter=e=>{n.options.onGlobalFilterChange==null||n.options.onGlobalFilterChange(e)},n.resetGlobalFilter=e=>{n.setGlobalFilter(e?void 0:n.initialState.globalFilter)}}},yRn={getInitialState:n=>({expanded:{},...n}),getDefaultOptions:n=>({onExpandedChange:oh("expanded",n),paginateExpandedRows:!0}),createTable:n=>{let e=!1,t=!1;n._autoResetExpanded=()=>{var i,r;if(!e){n._queue(()=>{e=!0});return}if((i=(r=n.options.autoResetAll)!=null?r:n.options.autoResetExpanded)!=null?i:!n.options.manualExpanding){if(t)return;t=!0,n._queue(()=>{n.resetExpanded(),t=!1})}},n.setExpanded=i=>n.options.onExpandedChange==null?void 0:n.options.onExpandedChange(i),n.toggleAllRowsExpanded=i=>{i??!n.getIsAllRowsExpanded()?n.setExpanded(!0):n.setExpanded({})},n.resetExpanded=i=>{var r,s;n.setExpanded(i?{}:(r=(s=n.initialState)==null?void 0:s.expanded)!=null?r:{})},n.getCanSomeRowsExpand=()=>n.getPrePaginationRowModel().flatRows.some(i=>i.getCanExpand()),n.getToggleAllRowsExpandedHandler=()=>i=>{i.persist==null||i.persist(),n.toggleAllRowsExpanded()},n.getIsSomeRowsExpanded=()=>{const i=n.getState().expanded;return i===!0||Object.values(i).some(Boolean)},n.getIsAllRowsExpanded=()=>{const i=n.getState().expanded;return typeof i=="boolean"?i===!0:!(!Object.keys(i).length||n.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},n.getExpandedDepth=()=>{let i=0;return(n.getState().expanded===!0?Object.keys(n.getRowModel().rowsById):Object.keys(n.getState().expanded)).forEach(s=>{const o=s.split(".");i=Math.max(i,o.length)}),i},n.getPreExpandedRowModel=()=>n.getSortedRowModel(),n.getExpandedRowModel=()=>(!n._getExpandedRowModel&&n.options.getExpandedRowModel&&(n._getExpandedRowModel=n.options.getExpandedRowModel(n)),n.options.manualExpanding||!n._getExpandedRowModel?n.getPreExpandedRowModel():n._getExpandedRowModel())},createRow:(n,e)=>{n.toggleExpanded=t=>{e.setExpanded(i=>{var r;const s=i===!0?!0:!!(i!=null&&i[n.id]);let o={};if(i===!0?Object.keys(e.getRowModel().rowsById).forEach(a=>{o[a]=!0}):o=i,t=(r=t)!=null?r:!s,!s&&t)return{...o,[n.id]:!0};if(s&&!t){const{[n.id]:a,...l}=o;return l}return i})},n.getIsExpanded=()=>{var t;const i=e.getState().expanded;return!!((t=e.options.getIsRowExpanded==null?void 0:e.options.getIsRowExpanded(n))!=null?t:i===!0||i?.[n.id])},n.getCanExpand=()=>{var t,i,r;return(t=e.options.getRowCanExpand==null?void 0:e.options.getRowCanExpand(n))!=null?t:((i=e.options.enableExpanding)!=null?i:!0)&&!!((r=n.subRows)!=null&&r.length)},n.getIsAllParentsExpanded=()=>{let t=!0,i=n;for(;t&&i.parentId;)i=e.getRow(i.parentId,!0),t=i.getIsExpanded();return t},n.getToggleExpandedHandler=()=>{const t=n.getCanExpand();return()=>{t&&n.toggleExpanded()}}}},kse=0,Ese=10,vG=()=>({pageIndex:kse,pageSize:Ese}),wRn={getInitialState:n=>({...n,pagination:{...vG(),...n?.pagination}}),getDefaultOptions:n=>({onPaginationChange:oh("pagination",n)}),createTable:n=>{let e=!1,t=!1;n._autoResetPageIndex=()=>{var i,r;if(!e){n._queue(()=>{e=!0});return}if((i=(r=n.options.autoResetAll)!=null?r:n.options.autoResetPageIndex)!=null?i:!n.options.manualPagination){if(t)return;t=!0,n._queue(()=>{n.resetPageIndex(),t=!1})}},n.setPagination=i=>{const r=s=>jv(i,s);return n.options.onPaginationChange==null?void 0:n.options.onPaginationChange(r)},n.resetPagination=i=>{var r;n.setPagination(i?vG():(r=n.initialState.pagination)!=null?r:vG())},n.setPageIndex=i=>{n.setPagination(r=>{let s=jv(i,r.pageIndex);const o=typeof n.options.pageCount>"u"||n.options.pageCount===-1?Number.MAX_SAFE_INTEGER:n.options.pageCount-1;return s=Math.max(0,Math.min(s,o)),{...r,pageIndex:s}})},n.resetPageIndex=i=>{var r,s;n.setPageIndex(i?kse:(r=(s=n.initialState)==null||(s=s.pagination)==null?void 0:s.pageIndex)!=null?r:kse)},n.resetPageSize=i=>{var r,s;n.setPageSize(i?Ese:(r=(s=n.initialState)==null||(s=s.pagination)==null?void 0:s.pageSize)!=null?r:Ese)},n.setPageSize=i=>{n.setPagination(r=>{const s=Math.max(1,jv(i,r.pageSize)),o=r.pageSize*r.pageIndex,a=Math.floor(o/s);return{...r,pageIndex:a,pageSize:s}})},n.setPageCount=i=>n.setPagination(r=>{var s;let o=jv(i,(s=n.options.pageCount)!=null?s:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...r,pageCount:o}}),n.getPageOptions=Kn(()=>[n.getPageCount()],i=>{let r=[];return i&&i>0&&(r=[...new Array(i)].fill(null).map((s,o)=>o)),r},Gn(n.options,"debugTable")),n.getCanPreviousPage=()=>n.getState().pagination.pageIndex>0,n.getCanNextPage=()=>{const{pageIndex:i}=n.getState().pagination,r=n.getPageCount();return r===-1?!0:r===0?!1:in.setPageIndex(i=>i-1),n.nextPage=()=>n.setPageIndex(i=>i+1),n.firstPage=()=>n.setPageIndex(0),n.lastPage=()=>n.setPageIndex(n.getPageCount()-1),n.getPrePaginationRowModel=()=>n.getExpandedRowModel(),n.getPaginationRowModel=()=>(!n._getPaginationRowModel&&n.options.getPaginationRowModel&&(n._getPaginationRowModel=n.options.getPaginationRowModel(n)),n.options.manualPagination||!n._getPaginationRowModel?n.getPrePaginationRowModel():n._getPaginationRowModel()),n.getPageCount=()=>{var i;return(i=n.options.pageCount)!=null?i:Math.ceil(n.getRowCount()/n.getState().pagination.pageSize)},n.getRowCount=()=>{var i;return(i=n.options.rowCount)!=null?i:n.getPrePaginationRowModel().rows.length}}},bG=()=>({top:[],bottom:[]}),CRn={getInitialState:n=>({rowPinning:bG(),...n}),getDefaultOptions:n=>({onRowPinningChange:oh("rowPinning",n)}),createRow:(n,e)=>{n.pin=(t,i,r)=>{const s=i?n.getLeafRows().map(l=>{let{id:c}=l;return c}):[],o=r?n.getParentRows().map(l=>{let{id:c}=l;return c}):[],a=new Set([...o,n.id,...s]);e.setRowPinning(l=>{var c,u;if(t==="bottom"){var d,h;return{top:((d=l?.top)!=null?d:[]).filter(p=>!(a!=null&&a.has(p))),bottom:[...((h=l?.bottom)!=null?h:[]).filter(p=>!(a!=null&&a.has(p))),...Array.from(a)]}}if(t==="top"){var f,g;return{top:[...((f=l?.top)!=null?f:[]).filter(p=>!(a!=null&&a.has(p))),...Array.from(a)],bottom:((g=l?.bottom)!=null?g:[]).filter(p=>!(a!=null&&a.has(p)))}}return{top:((c=l?.top)!=null?c:[]).filter(p=>!(a!=null&&a.has(p))),bottom:((u=l?.bottom)!=null?u:[]).filter(p=>!(a!=null&&a.has(p)))}})},n.getCanPin=()=>{var t;const{enableRowPinning:i,enablePinning:r}=e.options;return typeof i=="function"?i(n):(t=i??r)!=null?t:!0},n.getIsPinned=()=>{const t=[n.id],{top:i,bottom:r}=e.getState().rowPinning,s=t.some(a=>i?.includes(a)),o=t.some(a=>r?.includes(a));return s?"top":o?"bottom":!1},n.getPinnedIndex=()=>{var t,i;const r=n.getIsPinned();if(!r)return-1;const s=(t=r==="top"?e.getTopRows():e.getBottomRows())==null?void 0:t.map(o=>{let{id:a}=o;return a});return(i=s?.indexOf(n.id))!=null?i:-1}},createTable:n=>{n.setRowPinning=e=>n.options.onRowPinningChange==null?void 0:n.options.onRowPinningChange(e),n.resetRowPinning=e=>{var t,i;return n.setRowPinning(e?bG():(t=(i=n.initialState)==null?void 0:i.rowPinning)!=null?t:bG())},n.getIsSomeRowsPinned=e=>{var t;const i=n.getState().rowPinning;if(!e){var r,s;return!!((r=i.top)!=null&&r.length||(s=i.bottom)!=null&&s.length)}return!!((t=i[e])!=null&&t.length)},n._getPinnedRows=(e,t,i)=>{var r;return((r=n.options.keepPinnedRows)==null||r?(t??[]).map(o=>{const a=n.getRow(o,!0);return a.getIsAllParentsExpanded()?a:null}):(t??[]).map(o=>e.find(a=>a.id===o))).filter(Boolean).map(o=>({...o,position:i}))},n.getTopRows=Kn(()=>[n.getRowModel().rows,n.getState().rowPinning.top],(e,t)=>n._getPinnedRows(e,t,"top"),Gn(n.options,"debugRows")),n.getBottomRows=Kn(()=>[n.getRowModel().rows,n.getState().rowPinning.bottom],(e,t)=>n._getPinnedRows(e,t,"bottom"),Gn(n.options,"debugRows")),n.getCenterRows=Kn(()=>[n.getRowModel().rows,n.getState().rowPinning.top,n.getState().rowPinning.bottom],(e,t,i)=>{const r=new Set([...t??[],...i??[]]);return e.filter(s=>!r.has(s.id))},Gn(n.options,"debugRows"))}},xRn={getInitialState:n=>({rowSelection:{},...n}),getDefaultOptions:n=>({onRowSelectionChange:oh("rowSelection",n),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:n=>{n.setRowSelection=e=>n.options.onRowSelectionChange==null?void 0:n.options.onRowSelectionChange(e),n.resetRowSelection=e=>{var t;return n.setRowSelection(e?{}:(t=n.initialState.rowSelection)!=null?t:{})},n.toggleAllRowsSelected=e=>{n.setRowSelection(t=>{e=typeof e<"u"?e:!n.getIsAllRowsSelected();const i={...t},r=n.getPreGroupedRowModel().flatRows;return e?r.forEach(s=>{s.getCanSelect()&&(i[s.id]=!0)}):r.forEach(s=>{delete i[s.id]}),i})},n.toggleAllPageRowsSelected=e=>n.setRowSelection(t=>{const i=typeof e<"u"?e:!n.getIsAllPageRowsSelected(),r={...t};return n.getRowModel().rows.forEach(s=>{Lse(r,s.id,i,!0,n)}),r}),n.getPreSelectedRowModel=()=>n.getCoreRowModel(),n.getSelectedRowModel=Kn(()=>[n.getState().rowSelection,n.getCoreRowModel()],(e,t)=>Object.keys(e).length?yG(n,t):{rows:[],flatRows:[],rowsById:{}},Gn(n.options,"debugTable")),n.getFilteredSelectedRowModel=Kn(()=>[n.getState().rowSelection,n.getFilteredRowModel()],(e,t)=>Object.keys(e).length?yG(n,t):{rows:[],flatRows:[],rowsById:{}},Gn(n.options,"debugTable")),n.getGroupedSelectedRowModel=Kn(()=>[n.getState().rowSelection,n.getSortedRowModel()],(e,t)=>Object.keys(e).length?yG(n,t):{rows:[],flatRows:[],rowsById:{}},Gn(n.options,"debugTable")),n.getIsAllRowsSelected=()=>{const e=n.getFilteredRowModel().flatRows,{rowSelection:t}=n.getState();let i=!!(e.length&&Object.keys(t).length);return i&&e.some(r=>r.getCanSelect()&&!t[r.id])&&(i=!1),i},n.getIsAllPageRowsSelected=()=>{const e=n.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=n.getState();let i=!!e.length;return i&&e.some(r=>!t[r.id])&&(i=!1),i},n.getIsSomeRowsSelected=()=>{var e;const t=Object.keys((e=n.getState().rowSelection)!=null?e:{}).length;return t>0&&t{const e=n.getPaginationRowModel().flatRows;return n.getIsAllPageRowsSelected()?!1:e.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},n.getToggleAllRowsSelectedHandler=()=>e=>{n.toggleAllRowsSelected(e.target.checked)},n.getToggleAllPageRowsSelectedHandler=()=>e=>{n.toggleAllPageRowsSelected(e.target.checked)}},createRow:(n,e)=>{n.toggleSelected=(t,i)=>{const r=n.getIsSelected();e.setRowSelection(s=>{var o;if(t=typeof t<"u"?t:!r,n.getCanSelect()&&r===t)return s;const a={...s};return Lse(a,n.id,t,(o=i?.selectChildren)!=null?o:!0,e),a})},n.getIsSelected=()=>{const{rowSelection:t}=e.getState();return oge(n,t)},n.getIsSomeSelected=()=>{const{rowSelection:t}=e.getState();return Tse(n,t)==="some"},n.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=e.getState();return Tse(n,t)==="all"},n.getCanSelect=()=>{var t;return typeof e.options.enableRowSelection=="function"?e.options.enableRowSelection(n):(t=e.options.enableRowSelection)!=null?t:!0},n.getCanSelectSubRows=()=>{var t;return typeof e.options.enableSubRowSelection=="function"?e.options.enableSubRowSelection(n):(t=e.options.enableSubRowSelection)!=null?t:!0},n.getCanMultiSelect=()=>{var t;return typeof e.options.enableMultiRowSelection=="function"?e.options.enableMultiRowSelection(n):(t=e.options.enableMultiRowSelection)!=null?t:!0},n.getToggleSelectedHandler=()=>{const t=n.getCanSelect();return i=>{var r;t&&n.toggleSelected((r=i.target)==null?void 0:r.checked)}}}},Lse=(n,e,t,i,r)=>{var s;const o=r.getRow(e,!0);t?(o.getCanMultiSelect()||Object.keys(n).forEach(a=>delete n[a]),o.getCanSelect()&&(n[e]=!0)):delete n[e],i&&(s=o.subRows)!=null&&s.length&&o.getCanSelectSubRows()&&o.subRows.forEach(a=>Lse(n,a.id,t,i,r))};function yG(n,e){const t=n.getState().rowSelection,i=[],r={},s=function(o,a){return o.map(l=>{var c;const u=oge(l,t);if(u&&(i.push(l),r[l.id]=l),(c=l.subRows)!=null&&c.length&&(l={...l,subRows:s(l.subRows)}),u)return l}).filter(Boolean)};return{rows:s(e.rows),flatRows:i,rowsById:r}}function oge(n,e){var t;return(t=e[n.id])!=null?t:!1}function Tse(n,e,t){var i;if(!((i=n.subRows)!=null&&i.length))return!1;let r=!0,s=!1;return n.subRows.forEach(o=>{if(!(s&&!r)&&(o.getCanSelect()&&(oge(o,e)?s=!0:r=!1),o.subRows&&o.subRows.length)){const a=Tse(o,e);a==="all"?s=!0:(a==="some"&&(s=!0),r=!1)}}),r?"all":s?"some":!1}const Dse=/([0-9]+)/gm,SRn=(n,e,t)=>kGe(Ub(n.getValue(t)).toLowerCase(),Ub(e.getValue(t)).toLowerCase()),kRn=(n,e,t)=>kGe(Ub(n.getValue(t)),Ub(e.getValue(t))),ERn=(n,e,t)=>age(Ub(n.getValue(t)).toLowerCase(),Ub(e.getValue(t)).toLowerCase()),LRn=(n,e,t)=>age(Ub(n.getValue(t)),Ub(e.getValue(t))),TRn=(n,e,t)=>{const i=n.getValue(t),r=e.getValue(t);return i>r?1:iage(n.getValue(t),e.getValue(t));function age(n,e){return n===e?0:n>e?1:-1}function Ub(n){return typeof n=="number"?isNaN(n)||n===1/0||n===-1/0?"":String(n):typeof n=="string"?n:""}function kGe(n,e){const t=n.split(Dse).filter(Boolean),i=e.split(Dse).filter(Boolean);for(;t.length&&i.length;){const r=t.shift(),s=i.shift(),o=parseInt(r,10),a=parseInt(s,10),l=[o,a].sort();if(isNaN(l[0])){if(r>s)return 1;if(s>r)return-1;continue}if(isNaN(l[1]))return isNaN(o)?-1:1;if(o>a)return 1;if(a>o)return-1}return t.length-i.length}const uD={alphanumeric:SRn,alphanumericCaseSensitive:kRn,text:ERn,textCaseSensitive:LRn,datetime:TRn,basic:DRn},IRn={getInitialState:n=>({sorting:[],...n}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:n=>({onSortingChange:oh("sorting",n),isMultiSortEvent:e=>e.shiftKey}),createColumn:(n,e)=>{n.getAutoSortingFn=()=>{const t=e.getFilteredRowModel().flatRows.slice(10);let i=!1;for(const r of t){const s=r?.getValue(n.id);if(Object.prototype.toString.call(s)==="[object Date]")return uD.datetime;if(typeof s=="string"&&(i=!0,s.split(Dse).length>1))return uD.alphanumeric}return i?uD.text:uD.basic},n.getAutoSortDir=()=>{const t=e.getFilteredRowModel().flatRows[0];return typeof t?.getValue(n.id)=="string"?"asc":"desc"},n.getSortingFn=()=>{var t,i;if(!n)throw new Error;return XV(n.columnDef.sortingFn)?n.columnDef.sortingFn:n.columnDef.sortingFn==="auto"?n.getAutoSortingFn():(t=(i=e.options.sortingFns)==null?void 0:i[n.columnDef.sortingFn])!=null?t:uD[n.columnDef.sortingFn]},n.toggleSorting=(t,i)=>{const r=n.getNextSortingOrder(),s=typeof t<"u"&&t!==null;e.setSorting(o=>{const a=o?.find(f=>f.id===n.id),l=o?.findIndex(f=>f.id===n.id);let c=[],u,d=s?t:r==="desc";if(o!=null&&o.length&&n.getCanMultiSort()&&i?a?u="toggle":u="add":o!=null&&o.length&&l!==o.length-1?u="replace":a?u="toggle":u="replace",u==="toggle"&&(s||r||(u="remove")),u==="add"){var h;c=[...o,{id:n.id,desc:d}],c.splice(0,c.length-((h=e.options.maxMultiSortColCount)!=null?h:Number.MAX_SAFE_INTEGER))}else u==="toggle"?c=o.map(f=>f.id===n.id?{...f,desc:d}:f):u==="remove"?c=o.filter(f=>f.id!==n.id):c=[{id:n.id,desc:d}];return c})},n.getFirstSortDir=()=>{var t,i;return((t=(i=n.columnDef.sortDescFirst)!=null?i:e.options.sortDescFirst)!=null?t:n.getAutoSortDir()==="desc")?"desc":"asc"},n.getNextSortingOrder=t=>{var i,r;const s=n.getFirstSortDir(),o=n.getIsSorted();return o?o!==s&&((i=e.options.enableSortingRemoval)==null||i)&&(!(t&&(r=e.options.enableMultiRemove)!=null)||r)?!1:o==="desc"?"asc":"desc":s},n.getCanSort=()=>{var t,i;return((t=n.columnDef.enableSorting)!=null?t:!0)&&((i=e.options.enableSorting)!=null?i:!0)&&!!n.accessorFn},n.getCanMultiSort=()=>{var t,i;return(t=(i=n.columnDef.enableMultiSort)!=null?i:e.options.enableMultiSort)!=null?t:!!n.accessorFn},n.getIsSorted=()=>{var t;const i=(t=e.getState().sorting)==null?void 0:t.find(r=>r.id===n.id);return i?i.desc?"desc":"asc":!1},n.getSortIndex=()=>{var t,i;return(t=(i=e.getState().sorting)==null?void 0:i.findIndex(r=>r.id===n.id))!=null?t:-1},n.clearSorting=()=>{e.setSorting(t=>t!=null&&t.length?t.filter(i=>i.id!==n.id):[])},n.getToggleSortingHandler=()=>{const t=n.getCanSort();return i=>{t&&(i.persist==null||i.persist(),n.toggleSorting==null||n.toggleSorting(void 0,n.getCanMultiSort()?e.options.isMultiSortEvent==null?void 0:e.options.isMultiSortEvent(i):!1))}}},createTable:n=>{n.setSorting=e=>n.options.onSortingChange==null?void 0:n.options.onSortingChange(e),n.resetSorting=e=>{var t,i;n.setSorting(e?[]:(t=(i=n.initialState)==null?void 0:i.sorting)!=null?t:[])},n.getPreSortedRowModel=()=>n.getGroupedRowModel(),n.getSortedRowModel=()=>(!n._getSortedRowModel&&n.options.getSortedRowModel&&(n._getSortedRowModel=n.options.getSortedRowModel(n)),n.options.manualSorting||!n._getSortedRowModel?n.getPreSortedRowModel():n._getSortedRowModel())}},ARn=[JNn,_Rn,fRn,gRn,eRn,tRn,vRn,bRn,IRn,dRn,yRn,wRn,CRn,xRn,pRn];function NRn(n){var e,t;const i=[...ARn,...(e=n._features)!=null?e:[]];let r={_features:i};const s=r._features.reduce((h,f)=>Object.assign(h,f.getDefaultOptions==null?void 0:f.getDefaultOptions(r)),{}),o=h=>r.options.mergeOptions?r.options.mergeOptions(s,h):{...s,...h};let l={...{},...(t=n.initialState)!=null?t:{}};r._features.forEach(h=>{var f;l=(f=h.getInitialState==null?void 0:h.getInitialState(l))!=null?f:l});const c=[];let u=!1;const d={_features:i,options:{...s,...n},initialState:l,_queue:h=>{c.push(h),u||(u=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();u=!1}).catch(f=>setTimeout(()=>{throw f})))},reset:()=>{r.setState(r.initialState)},setOptions:h=>{const f=jv(h,r.options);r.options=o(f)},getState:()=>r.options.state,setState:h=>{r.options.onStateChange==null||r.options.onStateChange(h)},_getRowId:(h,f,g)=>{var p;return(p=r.options.getRowId==null?void 0:r.options.getRowId(h,f,g))!=null?p:`${g?[g.id,f].join("."):f}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(h,f)=>{let g=(f?r.getPrePaginationRowModel():r.getRowModel()).rowsById[h];if(!g&&(g=r.getCoreRowModel().rowsById[h],!g))throw new Error;return g},_getDefaultColumnDef:Kn(()=>[r.options.defaultColumn],h=>{var f;return h=(f=h)!=null?f:{},{header:g=>{const p=g.header.column.columnDef;return p.accessorKey?p.accessorKey:p.accessorFn?p.id:null},cell:g=>{var p,m;return(p=(m=g.renderValue())==null||m.toString==null?void 0:m.toString())!=null?p:null},...r._features.reduce((g,p)=>Object.assign(g,p.getDefaultColumnDef==null?void 0:p.getDefaultColumnDef()),{}),...h}},Gn(n,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:Kn(()=>[r._getColumnDefs()],h=>{const f=function(g,p,m){return m===void 0&&(m=0),g.map(_=>{const v=QNn(r,_,m,p),y=_;return v.columns=y.columns?f(y.columns,v,m+1):[],v})};return f(h)},Gn(n,"debugColumns")),getAllFlatColumns:Kn(()=>[r.getAllColumns()],h=>h.flatMap(f=>f.getFlatColumns()),Gn(n,"debugColumns")),_getAllFlatColumnsById:Kn(()=>[r.getAllFlatColumns()],h=>h.reduce((f,g)=>(f[g.id]=g,f),{}),Gn(n,"debugColumns")),getAllLeafColumns:Kn(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(h,f)=>{let g=h.flatMap(p=>p.getLeafColumns());return f(g)},Gn(n,"debugColumns")),getColumn:h=>r._getAllFlatColumnsById()[h]};Object.assign(r,d);for(let h=0;hKn(()=>[n.options.data],e=>{const t={rows:[],flatRows:[],rowsById:{}},i=function(r,s,o){s===void 0&&(s=0);const a=[];for(let c=0;cn._autoResetPageIndex()))}function RRn(n){const e=[],t=i=>{var r;e.push(i),(r=i.subRows)!=null&&r.length&&i.getIsExpanded()&&i.subRows.forEach(t)};return n.rows.forEach(t),{rows:e,flatRows:n.flatRows,rowsById:n.rowsById}}function EGe(n,e,t){return t.options.filterFromLeafRows?PRn(n,e,t):ORn(n,e,t)}function PRn(n,e,t){var i;const r=[],s={},o=(i=t.options.maxLeafRowFilterDepth)!=null?i:100,a=function(l,c){c===void 0&&(c=0);const u=[];for(let h=0;hKn(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter,n.getFilteredRowModel()],(t,i,r)=>{if(!t.rows.length||!(i!=null&&i.length)&&!r)return t;const s=[...i.map(a=>a.id).filter(a=>a!==e),r?"__global__":void 0].filter(Boolean),o=a=>{for(let l=0;lKn(()=>{var t;return[(t=n.getColumn(e))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return new Map;let i=new Map;for(let s=0;sKn(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter],(e,t,i)=>{if(!e.rows.length||!(t!=null&&t.length)&&!i){for(let h=0;h{var f;const g=n.getColumn(h.id);if(!g)return;const p=g.getFilterFn();p&&r.push({id:h.id,filterFn:p,resolvedValue:(f=p.resolveFilterValue==null?void 0:p.resolveFilterValue(h.value))!=null?f:h.value})});const o=(t??[]).map(h=>h.id),a=n.getGlobalFilterFn(),l=n.getAllLeafColumns().filter(h=>h.getCanGlobalFilter());i&&a&&l.length&&(o.push("__global__"),l.forEach(h=>{var f;s.push({id:h.id,filterFn:a,resolvedValue:(f=a.resolveFilterValue==null?void 0:a.resolveFilterValue(i))!=null?f:i})}));let c,u;for(let h=0;h{f.columnFiltersMeta[p]=m})}if(s.length){for(let g=0;g{f.columnFiltersMeta[p]=m})){f.columnFilters.__global__=!0;break}}f.columnFilters.__global__!==!0&&(f.columnFilters.__global__=!1)}}const d=h=>{for(let f=0;fn._autoResetPageIndex()))}function WVn(n){return e=>Kn(()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded],(t,i)=>{if(!i.rows.length)return i;const{pageSize:r,pageIndex:s}=t;let{rows:o,flatRows:a,rowsById:l}=i;const c=r*s,u=c+r;o=o.slice(c,u);let d;e.options.paginateExpandedRows?d={rows:o,flatRows:a,rowsById:l}:d=RRn({rows:o,flatRows:a,rowsById:l}),d.flatRows=[];const h=f=>{d.flatRows.push(f),f.subRows.length&&f.subRows.forEach(h)};return d.rows.forEach(h),d},Gn(e.options,"debugTable"))}function HVn(){return n=>Kn(()=>[n.getState().sorting,n.getPreSortedRowModel()],(e,t)=>{if(!t.rows.length||!(e!=null&&e.length))return t;const i=n.getState().sorting,r=[],s=i.filter(l=>{var c;return(c=n.getColumn(l.id))==null?void 0:c.getCanSort()}),o={};s.forEach(l=>{const c=n.getColumn(l.id);c&&(o[l.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});const a=l=>{const c=l.map(u=>({...u}));return c.sort((u,d)=>{for(let f=0;f{var d;r.push(u),(d=u.subRows)!=null&&d.length&&(u.subRows=a(u.subRows))}),c};return{rows:a(t.rows),flatRows:r,rowsById:t.rowsById}},Gn(n.options,"debugTable","getSortedRowModel",()=>n._autoResetPageIndex()))}/** * react-table * * Copyright (c) TanStack @@ -2130,14 +2140,14 @@ Defaulting to \`null\`.`}var AVn=fGe,NVn=pGe;/** * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function WVn(n,e){return n?MRn(n)?E.createElement(n,e):n:null}function MRn(n){return FRn(n)||typeof n=="function"||BRn(n)}function FRn(n){return typeof n=="function"&&(()=>{const e=Object.getPrototypeOf(n);return e.prototype&&e.prototype.isReactComponent})()}function BRn(n){return typeof n=="object"&&typeof n.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(n.$$typeof.description)}function HVn(n){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...n},[t]=E.useState(()=>({current:NRn(e)})),[i,r]=E.useState(()=>t.current.initialState);return t.current.setOptions(s=>({...s,...n,state:{...i,...n.state},onStateChange:o=>{r(o),n.onStateChange==null||n.onStateChange(o)}})),t.current}function $Rn(n){const e=E.useRef({value:n,previous:n});return E.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}function WRn(n){const[e,t]=E.useState(void 0);return es(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else t(void 0)},[n]),e}var lge="Switch",[HRn,VVn]=Ac(lge),[VRn,zRn]=HRn(lge),LGe=E.forwardRef((n,e)=>{const{__scopeSwitch:t,name:i,checked:r,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=n,[h,f]=E.useState(null),g=gi(e,y=>f(y)),p=E.useRef(!1),m=h?u||!!h.closest("form"):!0,[_=!1,v]=Kp({prop:r,defaultProp:s,onChange:c});return ae.jsxs(VRn,{scope:t,checked:_,disabled:a,children:[ae.jsx(Pn.button,{type:"button",role:"switch","aria-checked":_,"aria-required":o,"data-state":IGe(_),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:g,onClick:Kt(n.onClick,y=>{v(C=>!C),m&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})}),m&&ae.jsx(URn,{control:h,bubbles:!p.current,name:i,value:l,checked:_,required:o,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});LGe.displayName=lge;var TGe="SwitchThumb",DGe=E.forwardRef((n,e)=>{const{__scopeSwitch:t,...i}=n,r=zRn(TGe,t);return ae.jsx(Pn.span,{"data-state":IGe(r.checked),"data-disabled":r.disabled?"":void 0,...i,ref:e})});DGe.displayName=TGe;var URn=n=>{const{control:e,checked:t,bubbles:i=!0,...r}=n,s=E.useRef(null),o=$Rn(t),a=WRn(e);return E.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==t&&d){const h=new Event("click",{bubbles:i});d.call(l,t),l.dispatchEvent(h)}},[o,t,i]),ae.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:s,style:{...n.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function IGe(n){return n?"checked":"unchecked"}var zVn=LGe,UVn=DGe;const AGe=Object.freeze({left:0,top:0,width:16,height:16}),jB=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),cge=Object.freeze({...AGe,...jB}),Ise=Object.freeze({...cge,body:"",hidden:!1});function jRn(n,e){const t={};!n.hFlip!=!e.hFlip&&(t.hFlip=!0),!n.vFlip!=!e.vFlip&&(t.vFlip=!0);const i=((n.rotate||0)+(e.rotate||0))%4;return i&&(t.rotate=i),t}function AAe(n,e){const t=jRn(n,e);for(const i in Ise)i in jB?i in n&&!(i in t)&&(t[i]=jB[i]):i in e?t[i]=e[i]:i in n&&(t[i]=n[i]);return t}function qRn(n,e){const t=n.icons,i=n.aliases||Object.create(null),r=Object.create(null);function s(o){if(t[o])return r[o]=[];if(!(o in r)){r[o]=null;const a=i[o]&&i[o].parent,l=a&&s(a);l&&(r[o]=[a].concat(l))}return r[o]}return Object.keys(t).concat(Object.keys(i)).forEach(s),r}function KRn(n,e,t){const i=n.icons,r=n.aliases||Object.create(null);let s={};function o(a){s=AAe(i[a]||r[a],s)}return o(e),t.forEach(o),AAe(n,s)}function NGe(n,e){const t=[];if(typeof n!="object"||typeof n.icons!="object")return t;n.not_found instanceof Array&&n.not_found.forEach(r=>{e(r,null),t.push(r)});const i=qRn(n);for(const r in i){const s=i[r];s&&(e(r,KRn(n,r,s)),t.push(r))}return t}const GRn={provider:"",aliases:{},not_found:{},...AGe};function wG(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function RGe(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!wG(n,GRn))return null;const t=e.icons;for(const r in t){const s=t[r];if(!r||typeof s.body!="string"||!wG(s,Ise))return null}const i=e.aliases||Object.create(null);for(const r in i){const s=i[r],o=s.parent;if(!r||typeof o!="string"||!t[o]&&!i[o]||!wG(s,Ise))return null}return e}const PGe=/^[a-z0-9]+(-[a-z0-9]+)*$/,QV=(n,e,t,i="")=>{const r=n.split(":");if(n.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;i=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const a=r.pop(),l=r.pop(),c={provider:r.length>0?r[0]:i,prefix:l,name:a};return e&&!R5(c)?null:c}const s=r[0],o=s.split("-");if(o.length>1){const a={provider:i,prefix:o.shift(),name:o.join("-")};return e&&!R5(a)?null:a}if(t&&i===""){const a={provider:i,prefix:"",name:s};return e&&!R5(a,t)?null:a}return null},R5=(n,e)=>n?!!((e&&n.prefix===""||n.prefix)&&n.name):!1,NAe=Object.create(null);function YRn(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function uC(n,e){const t=NAe[n]||(NAe[n]=Object.create(null));return t[e]||(t[e]=YRn(n,e))}function uge(n,e){return RGe(e)?NGe(e,(t,i)=>{i?n.icons[t]=i:n.missing.add(t)}):[]}function ZRn(n,e,t){try{if(typeof t.body=="string")return n.icons[e]={...t},!0}catch{}return!1}let wP=!1;function OGe(n){return typeof n=="boolean"&&(wP=n),wP}function RAe(n){const e=typeof n=="string"?QV(n,!0,wP):n;if(e){const t=uC(e.provider,e.prefix),i=e.name;return t.icons[i]||(t.missing.has(i)?null:void 0)}}function XRn(n,e){const t=QV(n,!0,wP);if(!t)return!1;const i=uC(t.provider,t.prefix);return e?ZRn(i,t.name,e):(i.missing.add(t.name),!0)}function QRn(n,e){if(typeof n!="object")return!1;if(typeof e!="string"&&(e=n.provider||""),wP&&!e&&!n.prefix){let r=!1;return RGe(n)&&(n.prefix="",NGe(n,(s,o)=>{XRn(s,o)&&(r=!0)})),r}const t=n.prefix;if(!R5({provider:e,prefix:t,name:"a"}))return!1;const i=uC(e,t);return!!uge(i,n)}const MGe=Object.freeze({width:null,height:null}),FGe=Object.freeze({...MGe,...jB}),JRn=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ePn=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function PAe(n,e,t){if(e===1)return n;if(t=t||100,typeof n=="number")return Math.ceil(n*e*t)/t;if(typeof n!="string")return n;const i=n.split(JRn);if(i===null||!i.length)return n;const r=[];let s=i.shift(),o=ePn.test(s);for(;;){if(o){const a=parseFloat(s);isNaN(a)?r.push(s):r.push(Math.ceil(a*e*t)/t)}else r.push(s);if(s=i.shift(),s===void 0)return r.join("");o=!o}}function tPn(n,e="defs"){let t="";const i=n.indexOf("<"+e);for(;i>=0;){const r=n.indexOf(">",i),s=n.indexOf("",s);if(o===-1)break;t+=n.slice(r+1,s).trim(),n=n.slice(0,i).trim()+n.slice(o+1)}return{defs:t,content:n}}function nPn(n,e){return n?""+n+""+e:e}function iPn(n,e,t){const i=tPn(n);return nPn(i.defs,e+i.content+t)}const rPn=n=>n==="unset"||n==="undefined"||n==="none";function sPn(n,e){const t={...cge,...n},i={...FGe,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let s=t.body;[t,i].forEach(p=>{const m=[],_=p.hFlip,v=p.vFlip;let y=p.rotate;_?v?y+=2:(m.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),m.push("scale(-1 1)"),r.top=r.left=0):v&&(m.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),m.push("scale(1 -1)"),r.top=r.left=0);let C;switch(y<0&&(y-=Math.floor(y/4)*4),y=y%4,y){case 1:C=r.height/2+r.top,m.unshift("rotate(90 "+C.toString()+" "+C.toString()+")");break;case 2:m.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:C=r.width/2+r.left,m.unshift("rotate(-90 "+C.toString()+" "+C.toString()+")");break}y%2===1&&(r.left!==r.top&&(C=r.left,r.left=r.top,r.top=C),r.width!==r.height&&(C=r.width,r.width=r.height,r.height=C)),m.length&&(s=iPn(s,'',""))});const o=i.width,a=i.height,l=r.width,c=r.height;let u,d;o===null?(d=a===null?"1em":a==="auto"?c:a,u=PAe(d,l/c)):(u=o==="auto"?l:o,d=a===null?PAe(u,c/l):a==="auto"?c:a);const h={},f=(p,m)=>{rPn(m)||(h[p]=m.toString())};f("width",u),f("height",d);const g=[r.left,r.top,l,c];return h.viewBox=g.join(" "),{attributes:h,viewBox:g,body:s}}const oPn=/\sid="(\S+)"/g,aPn="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let lPn=0;function cPn(n,e=aPn){const t=[];let i;for(;i=oPn.exec(n);)t.push(i[1]);if(!t.length)return n;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(s=>{const o=typeof e=="function"?e(s):e+(lPn++).toString(),a=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),n=n.replace(new RegExp(r,"g"),""),n}const Ase=Object.create(null);function uPn(n,e){Ase[n]=e}function Nse(n){return Ase[n]||Ase[""]}function dge(n){let e;if(typeof n.resources=="string")e=[n.resources];else if(e=n.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:n.path||"/",maxURL:n.maxURL||500,rotate:n.rotate||750,timeout:n.timeout||5e3,random:n.random===!0,index:n.index||0,dataAfterTimeout:n.dataAfterTimeout!==!1}}const hge=Object.create(null),dD=["https://api.simplesvg.com","https://api.unisvg.com"],P5=[];for(;dD.length>0;)dD.length===1||Math.random()>.5?P5.push(dD.shift()):P5.push(dD.pop());hge[""]=dge({resources:["https://api.iconify.design"].concat(P5)});function dPn(n,e){const t=dge(e);return t===null?!1:(hge[n]=t,!0)}function fge(n){return hge[n]}const hPn=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let OAe=hPn();function fPn(n,e){const t=fge(n);if(!t)return 0;let i;if(!t.maxURL)i=0;else{let r=0;t.resources.forEach(o=>{r=Math.max(r,o.length)});const s=e+".json?icons=";i=t.maxURL-r-t.path.length-s.length}return i}function gPn(n){return n===404}const pPn=(n,e,t)=>{const i=[],r=fPn(n,e),s="icons";let o={type:s,provider:n,prefix:e,icons:[]},a=0;return t.forEach((l,c)=>{a+=l.length+1,a>=r&&c>0&&(i.push(o),o={type:s,provider:n,prefix:e,icons:[]},a=l.length),o.icons.push(l)}),i.push(o),i};function mPn(n){if(typeof n=="string"){const e=fge(n);if(e)return e.path}return"/"}const _Pn=(n,e,t)=>{if(!OAe){t("abort",424);return}let i=mPn(e.provider);switch(e.type){case"icons":{const s=e.prefix,a=e.icons.join(","),l=new URLSearchParams({icons:a});i+=s+".json?"+l.toString();break}case"custom":{const s=e.uri;i+=s.slice(0,1)==="/"?s.slice(1):s;break}default:t("abort",400);return}let r=503;OAe(n+i).then(s=>{const o=s.status;if(o!==200){setTimeout(()=>{t(gPn(o)?"abort":"next",o)});return}return r=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?t("abort",s):t("next",r)});return}setTimeout(()=>{t("success",s)})}).catch(()=>{t("next",r)})},vPn={prepare:pPn,send:_Pn};function bPn(n){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);n.sort((r,s)=>r.provider!==s.provider?r.provider.localeCompare(s.provider):r.prefix!==s.prefix?r.prefix.localeCompare(s.prefix):r.name.localeCompare(s.name));let i={provider:"",prefix:"",name:""};return n.forEach(r=>{if(i.name===r.name&&i.prefix===r.prefix&&i.provider===r.provider)return;i=r;const s=r.provider,o=r.prefix,a=r.name,l=t[s]||(t[s]=Object.create(null)),c=l[o]||(l[o]=uC(s,o));let u;a in c.icons?u=e.loaded:o===""||c.missing.has(a)?u=e.missing:u=e.pending;const d={provider:s,prefix:o,name:a};u.push(d)}),e}function BGe(n,e){n.forEach(t=>{const i=t.loaderCallbacks;i&&(t.loaderCallbacks=i.filter(r=>r.id!==e))})}function yPn(n){n.pendingCallbacksFlag||(n.pendingCallbacksFlag=!0,setTimeout(()=>{n.pendingCallbacksFlag=!1;const e=n.loaderCallbacks?n.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const i=n.provider,r=n.prefix;e.forEach(s=>{const o=s.icons,a=o.pending.length;o.pending=o.pending.filter(l=>{if(l.prefix!==r)return!0;const c=l.name;if(n.icons[c])o.loaded.push({provider:i,prefix:r,name:c});else if(n.missing.has(c))o.missing.push({provider:i,prefix:r,name:c});else return t=!0,!0;return!1}),o.pending.length!==a&&(t||BGe([n],s.id),s.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),s.abort))})}))}let wPn=0;function CPn(n,e,t){const i=wPn++,r=BGe.bind(null,t,i);if(!e.pending.length)return r;const s={id:i,icons:e,callback:n,abort:r};return t.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(s)}),r}function xPn(n,e=!0,t=!1){const i=[];return n.forEach(r=>{const s=typeof r=="string"?QV(r,e,t):r;s&&i.push(s)}),i}var SPn={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function kPn(n,e,t,i){const r=n.resources.length,s=n.random?Math.floor(Math.random()*r):n.index;let o;if(n.random){let k=n.resources.slice(0);for(o=[];k.length>1;){const L=Math.floor(Math.random()*k.length);o.push(k[L]),k=k.slice(0,L).concat(k.slice(L+1))}o=o.concat(k)}else o=n.resources.slice(s).concat(n.resources.slice(0,s));const a=Date.now();let l="pending",c=0,u,d=null,h=[],f=[];typeof i=="function"&&f.push(i);function g(){d&&(clearTimeout(d),d=null)}function p(){l==="pending"&&(l="aborted"),g(),h.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),h=[]}function m(k,L){L&&(f=[]),typeof k=="function"&&f.push(k)}function _(){return{startTime:a,payload:e,status:l,queriesSent:c,queriesPending:h.length,subscribe:m,abort:p}}function v(){l="failed",f.forEach(k=>{k(void 0,u)})}function y(){h.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),h=[]}function C(k,L,D){const I=L!=="success";switch(h=h.filter(O=>O!==k),l){case"pending":break;case"failed":if(I||!n.dataAfterTimeout)return;break;default:return}if(L==="abort"){u=D,v();return}if(I){u=D,h.length||(o.length?x():v());return}if(g(),y(),!n.random){const O=n.resources.indexOf(k.resource);O!==-1&&O!==n.index&&(n.index=O)}l="completed",f.forEach(O=>{O(D)})}function x(){if(l!=="pending")return;g();const k=o.shift();if(k===void 0){if(h.length){d=setTimeout(()=>{g(),l==="pending"&&(y(),v())},n.timeout);return}v();return}const L={status:"pending",resource:k,callback:(D,I)=>{C(L,D,I)}};h.push(L),c++,d=setTimeout(x,n.rotate),t(k,e,L.callback)}return setTimeout(x),_}function $Ge(n){const e={...SPn,...n};let t=[];function i(){t=t.filter(a=>a().status==="pending")}function r(a,l,c){const u=kPn(e,a,l,(d,h)=>{i(),c&&c(d,h)});return t.push(u),u}function s(a){return t.find(l=>a(l))||null}return{query:r,find:s,setIndex:a=>{e.index=a},getIndex:()=>e.index,cleanup:i}}function MAe(){}const CG=Object.create(null);function EPn(n){if(!CG[n]){const e=fge(n);if(!e)return;const t=$Ge(e),i={config:e,redundancy:t};CG[n]=i}return CG[n]}function LPn(n,e,t){let i,r;if(typeof n=="string"){const s=Nse(n);if(!s)return t(void 0,424),MAe;r=s.send;const o=EPn(n);o&&(i=o.redundancy)}else{const s=dge(n);if(s){i=$Ge(s);const o=n.resources?n.resources[0]:"",a=Nse(o);a&&(r=a.send)}}return!i||!r?(t(void 0,424),MAe):i.query(e,r,t)().abort}const FAe="iconify2",CP="iconify",WGe=CP+"-count",BAe=CP+"-version",HGe=36e5,TPn=168,DPn=50;function Rse(n,e){try{return n.getItem(e)}catch{}}function gge(n,e,t){try{return n.setItem(e,t),!0}catch{}}function $Ae(n,e){try{n.removeItem(e)}catch{}}function Pse(n,e){return gge(n,WGe,e.toString())}function Ose(n){return parseInt(Rse(n,WGe))||0}const JV={local:!0,session:!0},VGe={local:new Set,session:new Set};let pge=!1;function IPn(n){pge=n}let uF=typeof window>"u"?{}:window;function zGe(n){const e=n+"Storage";try{if(uF&&uF[e]&&typeof uF[e].length=="number")return uF[e]}catch{}JV[n]=!1}function UGe(n,e){const t=zGe(n);if(!t)return;const i=Rse(t,BAe);if(i!==FAe){if(i){const a=Ose(t);for(let l=0;l{const l=CP+a.toString(),c=Rse(t,l);if(typeof c=="string"){try{const u=JSON.parse(c);if(typeof u=="object"&&typeof u.cached=="number"&&u.cached>r&&typeof u.provider=="string"&&typeof u.data=="object"&&typeof u.data.prefix=="string"&&e(u,a))return!0}catch{}$Ae(t,l)}};let o=Ose(t);for(let a=o-1;a>=0;a--)s(a)||(a===o-1?(o--,Pse(t,o)):VGe[n].add(a))}function jGe(){if(!pge){IPn(!0);for(const n in JV)UGe(n,e=>{const t=e.data,i=e.provider,r=t.prefix,s=uC(i,r);if(!uge(s,t).length)return!1;const o=t.lastModified||-1;return s.lastModifiedCached=s.lastModifiedCached?Math.min(s.lastModifiedCached,o):o,!0})}}function APn(n,e){const t=n.lastModifiedCached;if(t&&t>=e)return t===e;if(n.lastModifiedCached=e,t)for(const i in JV)UGe(i,r=>{const s=r.data;return r.provider!==n.provider||s.prefix!==n.prefix||s.lastModified===e});return!0}function NPn(n,e){pge||jGe();function t(i){let r;if(!JV[i]||!(r=zGe(i)))return;const s=VGe[i];let o;if(s.size)s.delete(o=Array.from(s).shift());else if(o=Ose(r),o>=DPn||!Pse(r,o+1))return;const a={cached:Math.floor(Date.now()/HGe),provider:n.provider,data:e};return gge(r,CP+o.toString(),JSON.stringify(a))}e.lastModified&&!APn(n,e.lastModified)||Object.keys(e.icons).length&&(e.not_found&&(e=Object.assign({},e),delete e.not_found),t("local")||t("session"))}function RPn(){}function PPn(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,yPn(n)}))}function OPn(n){const e=[],t=[];return n.forEach(i=>{(i.match(PGe)?e:t).push(i)}),{valid:e,invalid:t}}function hD(n,e,t,i){function r(){const s=n.pendingIcons;e.forEach(o=>{s&&s.delete(o),n.icons[o]||n.missing.add(o)})}if(t&&typeof t=="object")try{if(!uge(n,t).length){r();return}i&&NPn(n,t)}catch(s){console.error(s)}r(),PPn(n)}function WAe(n,e){n instanceof Promise?n.then(t=>{e(t)}).catch(()=>{e(null)}):e(n)}function MPn(n,e){n.iconsToLoad?n.iconsToLoad=n.iconsToLoad.concat(e).sort():n.iconsToLoad=e,n.iconsQueueFlag||(n.iconsQueueFlag=!0,setTimeout(()=>{n.iconsQueueFlag=!1;const{provider:t,prefix:i}=n,r=n.iconsToLoad;if(delete n.iconsToLoad,!r||!r.length)return;const s=n.loadIcon;if(n.loadIcons&&(r.length>1||!s)){WAe(n.loadIcons(r,i,t),u=>{hD(n,r,u,!1)});return}if(s){r.forEach(u=>{const d=s(u,i,t);WAe(d,h=>{const f=h?{prefix:i,icons:{[u]:h}}:null;hD(n,[u],f,!1)})});return}const{valid:o,invalid:a}=OPn(r);if(a.length&&hD(n,a,null,!1),!o.length)return;const l=i.match(PGe)?Nse(t):null;if(!l){hD(n,o,null,!1);return}l.prepare(t,i,o).forEach(u=>{LPn(t,u,d=>{hD(n,u.icons,d,!0)})})}))}const FPn=(n,e)=>{const t=xPn(n,!0,OGe()),i=bPn(t);if(!i.pending.length){let l=!0;return setTimeout(()=>{l&&e(i.loaded,i.missing,i.pending,RPn)}),()=>{l=!1}}const r=Object.create(null),s=[];let o,a;return i.pending.forEach(l=>{const{provider:c,prefix:u}=l;if(u===a&&c===o)return;o=c,a=u,s.push(uC(c,u));const d=r[c]||(r[c]=Object.create(null));d[u]||(d[u]=[])}),i.pending.forEach(l=>{const{provider:c,prefix:u,name:d}=l,h=uC(c,u),f=h.pendingIcons||(h.pendingIcons=new Set);f.has(d)||(f.add(d),r[c][u].push(d))}),s.forEach(l=>{const c=r[l.provider][l.prefix];c.length&&MPn(l,c)}),CPn(e,i,s)};function BPn(n,e){const t={...n};for(const i in e){const r=e[i],s=typeof r;i in MGe?(r===null||r&&(s==="string"||s==="number"))&&(t[i]=r):s===typeof t[i]&&(t[i]=i==="rotate"?r%4:r)}return t}const $Pn=/[\s,]+/;function WPn(n,e){e.split($Pn).forEach(t=>{switch(t.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0;break}})}function HPn(n,e=0){const t=n.replace(/^-?[0-9.]*/,"");function i(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(n);return isNaN(r)?0:i(r)}else if(t!==n){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let s=parseFloat(n.slice(0,n.length-t.length));return isNaN(s)?0:(s=s/r,s%1===0?i(s):0)}}return e}function VPn(n,e){let t=n.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in e)t+=" "+i+'="'+e[i]+'"';return'"+n+""}function zPn(n){return n.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function UPn(n){return"data:image/svg+xml,"+zPn(n)}function jPn(n){return'url("'+UPn(n)+'")'}let mA;function qPn(){try{mA=window.trustedTypes.createPolicy("iconify",{createHTML:n=>n})}catch{mA=null}}function KPn(n){return mA===void 0&&qPn(),mA?mA.createHTML(n):n}const qGe={...FGe,inline:!1},GPn={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},YPn={display:"inline-block"},Mse={backgroundColor:"currentColor"},KGe={backgroundColor:"transparent"},HAe={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},VAe={WebkitMask:Mse,mask:Mse,background:KGe};for(const n in VAe){const e=VAe[n];for(const t in HAe)e[n+t]=HAe[t]}const ZPn={...qGe,inline:!0};function zAe(n){return n+(n.match(/^[-0-9.]+$/)?"px":"")}const XPn=(n,e,t)=>{const i=e.inline?ZPn:qGe,r=BPn(i,e),s=e.mode||"svg",o={},a=e.style||{},l={...s==="svg"?GPn:{}};if(t){const m=QV(t,!1,!0);if(m){const _=["iconify"],v=["provider","prefix"];for(const y of v)m[y]&&_.push("iconify--"+m[y]);l.className=_.join(" ")}}for(let m in e){const _=e[m];if(_!==void 0)switch(m){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":break;case"_ref":l.ref=_;break;case"className":l[m]=(l[m]?l[m]+" ":"")+_;break;case"inline":case"hFlip":case"vFlip":r[m]=_===!0||_==="true"||_===1;break;case"flip":typeof _=="string"&&WPn(r,_);break;case"color":o.color=_;break;case"rotate":typeof _=="string"?r[m]=HPn(_):typeof _=="number"&&(r[m]=_);break;case"ariaHidden":case"aria-hidden":_!==!0&&_!=="true"&&delete l["aria-hidden"];break;default:i[m]===void 0&&(l[m]=_)}}const c=sPn(n,r),u=c.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),s==="svg"){l.style={...o,...a},Object.assign(l,u);let m=0,_=e.id;return typeof _=="string"&&(_=_.replace(/-/g,"_")),l.dangerouslySetInnerHTML={__html:KPn(cPn(c.body,_?()=>_+"ID"+m++:"iconifyReact"))},E.createElement("svg",l)}const{body:d,width:h,height:f}=n,g=s==="mask"||(s==="bg"?!1:d.indexOf("currentColor")!==-1),p=VPn(d,{...u,width:h+"",height:f+""});return l.style={...o,"--svg":jPn(p),width:zAe(u.width),height:zAe(u.height),...YPn,...g?Mse:KGe,...a},E.createElement("span",l)};OGe(!0);uPn("",vPn);if(typeof document<"u"&&typeof window<"u"){jGe();const n=window;if(n.IconifyPreload!==void 0){const e=n.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(i=>{try{(typeof i!="object"||i===null||i instanceof Array||typeof i.icons!="object"||typeof i.prefix!="string"||!QRn(i))&&console.error(t)}catch{console.error(t)}})}if(n.IconifyProviders!==void 0){const e=n.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const i="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;dPn(t,r)||console.error(i)}catch{console.error(i)}}}}function GGe(n){const[e,t]=E.useState(!!n.ssr),[i,r]=E.useState({});function s(f){if(f){const g=n.icon;if(typeof g=="object")return{name:"",data:g};const p=RAe(g);if(p)return{name:g,data:p}}return{name:""}}const[o,a]=E.useState(s(!!n.ssr));function l(){const f=i.callback;f&&(f(),r({}))}function c(f){if(JSON.stringify(o)!==JSON.stringify(f))return l(),a(f),!0}function u(){var f;const g=n.icon;if(typeof g=="object"){c({name:"",data:g});return}const p=RAe(g);if(c({name:g,data:p}))if(p===void 0){const m=FPn([g],u);r({callback:m})}else p&&((f=n.onLoad)===null||f===void 0||f.call(n,g))}E.useEffect(()=>(t(!0),l),[]),E.useEffect(()=>{e&&u()},[n.icon,e]);const{name:d,data:h}=o;return h?XPn({...cge,...h},n,d):n.children?n.children:E.createElement("span",{})}const jVn=E.forwardRef((n,e)=>GGe({...n,_ref:e}));E.forwardRef((n,e)=>GGe({inline:!0,...n,_ref:e}));var QPn=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(JPn);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(Fse,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(Fse,{...i,ref:e,children:t})});QPn.displayName="Slot";var Fse=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=tOn(t);return E.cloneElement(t,{...eOn(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});Fse.displayName="SlotClone";var YGe=({children:n})=>ae.jsx(ae.Fragment,{children:n});function JPn(n){return E.isValidElement(n)&&n.type===YGe}function eOn(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function tOn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var ZGe="AlertDialog",[nOn,qVn]=Ac(ZGe,[JWe]),L0=JWe(),XGe=n=>{const{__scopeAlertDialog:e,...t}=n,i=L0(e);return ae.jsx(oQt,{...i,...t,modal:!0})};XGe.displayName=ZGe;var iOn="AlertDialogTrigger",QGe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,r=L0(t);return ae.jsx(aQt,{...r,...i,ref:e})});QGe.displayName=iOn;var rOn="AlertDialogPortal",JGe=n=>{const{__scopeAlertDialog:e,...t}=n,i=L0(e);return ae.jsx(lQt,{...i,...t})};JGe.displayName=rOn;var sOn="AlertDialogOverlay",eYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,r=L0(t);return ae.jsx(cQt,{...r,...i,ref:e})});eYe.displayName=sOn;var zk="AlertDialogContent",[oOn,aOn]=nOn(zk),tYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,children:i,...r}=n,s=L0(t),o=E.useRef(null),a=gi(e,o),l=E.useRef(null);return ae.jsx(nQt,{contentName:zk,titleName:nYe,docsSlug:"alert-dialog",children:ae.jsx(oOn,{scope:t,cancelRef:l,children:ae.jsxs(uQt,{role:"alertdialog",...s,...r,ref:a,onOpenAutoFocus:Kt(r.onOpenAutoFocus,c=>{c.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[ae.jsx(YGe,{children:i}),ae.jsx(cOn,{contentRef:o})]})})})});tYe.displayName=zk;var nYe="AlertDialogTitle",iYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,r=L0(t);return ae.jsx(dQt,{...r,...i,ref:e})});iYe.displayName=nYe;var rYe="AlertDialogDescription",sYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,r=L0(t);return ae.jsx(hQt,{...r,...i,ref:e})});sYe.displayName=rYe;var lOn="AlertDialogAction",oYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,r=L0(t);return ae.jsx(pHe,{...r,...i,ref:e})});oYe.displayName=lOn;var aYe="AlertDialogCancel",lYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,{cancelRef:r}=aOn(aYe,t),s=L0(t),o=gi(e,r);return ae.jsx(pHe,{...s,...i,ref:o})});lYe.displayName=aYe;var cOn=({contentRef:n})=>{const e=`\`${zk}\` requires a description for the component to be accessible for screen reader users. + */function VVn(n,e){return n?MRn(n)?E.createElement(n,e):n:null}function MRn(n){return FRn(n)||typeof n=="function"||BRn(n)}function FRn(n){return typeof n=="function"&&(()=>{const e=Object.getPrototypeOf(n);return e.prototype&&e.prototype.isReactComponent})()}function BRn(n){return typeof n=="object"&&typeof n.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(n.$$typeof.description)}function zVn(n){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...n},[t]=E.useState(()=>({current:NRn(e)})),[i,r]=E.useState(()=>t.current.initialState);return t.current.setOptions(s=>({...s,...n,state:{...i,...n.state},onStateChange:o=>{r(o),n.onStateChange==null||n.onStateChange(o)}})),t.current}function $Rn(n){const e=E.useRef({value:n,previous:n});return E.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}function WRn(n){const[e,t]=E.useState(void 0);return es(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else t(void 0)},[n]),e}var lge="Switch",[HRn,UVn]=Ac(lge),[VRn,zRn]=HRn(lge),LGe=E.forwardRef((n,e)=>{const{__scopeSwitch:t,name:i,checked:r,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=n,[h,f]=E.useState(null),g=gi(e,y=>f(y)),p=E.useRef(!1),m=h?u||!!h.closest("form"):!0,[_=!1,v]=Kp({prop:r,defaultProp:s,onChange:c});return ae.jsxs(VRn,{scope:t,checked:_,disabled:a,children:[ae.jsx(Pn.button,{type:"button",role:"switch","aria-checked":_,"aria-required":o,"data-state":IGe(_),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:g,onClick:Kt(n.onClick,y=>{v(C=>!C),m&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})}),m&&ae.jsx(URn,{control:h,bubbles:!p.current,name:i,value:l,checked:_,required:o,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});LGe.displayName=lge;var TGe="SwitchThumb",DGe=E.forwardRef((n,e)=>{const{__scopeSwitch:t,...i}=n,r=zRn(TGe,t);return ae.jsx(Pn.span,{"data-state":IGe(r.checked),"data-disabled":r.disabled?"":void 0,...i,ref:e})});DGe.displayName=TGe;var URn=n=>{const{control:e,checked:t,bubbles:i=!0,...r}=n,s=E.useRef(null),o=$Rn(t),a=WRn(e);return E.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==t&&d){const h=new Event("click",{bubbles:i});d.call(l,t),l.dispatchEvent(h)}},[o,t,i]),ae.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:s,style:{...n.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function IGe(n){return n?"checked":"unchecked"}var jVn=LGe,qVn=DGe;const AGe=Object.freeze({left:0,top:0,width:16,height:16}),jB=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),cge=Object.freeze({...AGe,...jB}),Ise=Object.freeze({...cge,body:"",hidden:!1});function jRn(n,e){const t={};!n.hFlip!=!e.hFlip&&(t.hFlip=!0),!n.vFlip!=!e.vFlip&&(t.vFlip=!0);const i=((n.rotate||0)+(e.rotate||0))%4;return i&&(t.rotate=i),t}function AAe(n,e){const t=jRn(n,e);for(const i in Ise)i in jB?i in n&&!(i in t)&&(t[i]=jB[i]):i in e?t[i]=e[i]:i in n&&(t[i]=n[i]);return t}function qRn(n,e){const t=n.icons,i=n.aliases||Object.create(null),r=Object.create(null);function s(o){if(t[o])return r[o]=[];if(!(o in r)){r[o]=null;const a=i[o]&&i[o].parent,l=a&&s(a);l&&(r[o]=[a].concat(l))}return r[o]}return Object.keys(t).concat(Object.keys(i)).forEach(s),r}function KRn(n,e,t){const i=n.icons,r=n.aliases||Object.create(null);let s={};function o(a){s=AAe(i[a]||r[a],s)}return o(e),t.forEach(o),AAe(n,s)}function NGe(n,e){const t=[];if(typeof n!="object"||typeof n.icons!="object")return t;n.not_found instanceof Array&&n.not_found.forEach(r=>{e(r,null),t.push(r)});const i=qRn(n);for(const r in i){const s=i[r];s&&(e(r,KRn(n,r,s)),t.push(r))}return t}const GRn={provider:"",aliases:{},not_found:{},...AGe};function wG(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function RGe(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!wG(n,GRn))return null;const t=e.icons;for(const r in t){const s=t[r];if(!r||typeof s.body!="string"||!wG(s,Ise))return null}const i=e.aliases||Object.create(null);for(const r in i){const s=i[r],o=s.parent;if(!r||typeof o!="string"||!t[o]&&!i[o]||!wG(s,Ise))return null}return e}const PGe=/^[a-z0-9]+(-[a-z0-9]+)*$/,QV=(n,e,t,i="")=>{const r=n.split(":");if(n.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;i=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const a=r.pop(),l=r.pop(),c={provider:r.length>0?r[0]:i,prefix:l,name:a};return e&&!RF(c)?null:c}const s=r[0],o=s.split("-");if(o.length>1){const a={provider:i,prefix:o.shift(),name:o.join("-")};return e&&!RF(a)?null:a}if(t&&i===""){const a={provider:i,prefix:"",name:s};return e&&!RF(a,t)?null:a}return null},RF=(n,e)=>n?!!((e&&n.prefix===""||n.prefix)&&n.name):!1,NAe=Object.create(null);function YRn(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function uC(n,e){const t=NAe[n]||(NAe[n]=Object.create(null));return t[e]||(t[e]=YRn(n,e))}function uge(n,e){return RGe(e)?NGe(e,(t,i)=>{i?n.icons[t]=i:n.missing.add(t)}):[]}function ZRn(n,e,t){try{if(typeof t.body=="string")return n.icons[e]={...t},!0}catch{}return!1}let wP=!1;function OGe(n){return typeof n=="boolean"&&(wP=n),wP}function RAe(n){const e=typeof n=="string"?QV(n,!0,wP):n;if(e){const t=uC(e.provider,e.prefix),i=e.name;return t.icons[i]||(t.missing.has(i)?null:void 0)}}function XRn(n,e){const t=QV(n,!0,wP);if(!t)return!1;const i=uC(t.provider,t.prefix);return e?ZRn(i,t.name,e):(i.missing.add(t.name),!0)}function QRn(n,e){if(typeof n!="object")return!1;if(typeof e!="string"&&(e=n.provider||""),wP&&!e&&!n.prefix){let r=!1;return RGe(n)&&(n.prefix="",NGe(n,(s,o)=>{XRn(s,o)&&(r=!0)})),r}const t=n.prefix;if(!RF({provider:e,prefix:t,name:"a"}))return!1;const i=uC(e,t);return!!uge(i,n)}const MGe=Object.freeze({width:null,height:null}),FGe=Object.freeze({...MGe,...jB}),JRn=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ePn=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function PAe(n,e,t){if(e===1)return n;if(t=t||100,typeof n=="number")return Math.ceil(n*e*t)/t;if(typeof n!="string")return n;const i=n.split(JRn);if(i===null||!i.length)return n;const r=[];let s=i.shift(),o=ePn.test(s);for(;;){if(o){const a=parseFloat(s);isNaN(a)?r.push(s):r.push(Math.ceil(a*e*t)/t)}else r.push(s);if(s=i.shift(),s===void 0)return r.join("");o=!o}}function tPn(n,e="defs"){let t="";const i=n.indexOf("<"+e);for(;i>=0;){const r=n.indexOf(">",i),s=n.indexOf("",s);if(o===-1)break;t+=n.slice(r+1,s).trim(),n=n.slice(0,i).trim()+n.slice(o+1)}return{defs:t,content:n}}function nPn(n,e){return n?""+n+""+e:e}function iPn(n,e,t){const i=tPn(n);return nPn(i.defs,e+i.content+t)}const rPn=n=>n==="unset"||n==="undefined"||n==="none";function sPn(n,e){const t={...cge,...n},i={...FGe,...e},r={left:t.left,top:t.top,width:t.width,height:t.height};let s=t.body;[t,i].forEach(p=>{const m=[],_=p.hFlip,v=p.vFlip;let y=p.rotate;_?v?y+=2:(m.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),m.push("scale(-1 1)"),r.top=r.left=0):v&&(m.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),m.push("scale(1 -1)"),r.top=r.left=0);let C;switch(y<0&&(y-=Math.floor(y/4)*4),y=y%4,y){case 1:C=r.height/2+r.top,m.unshift("rotate(90 "+C.toString()+" "+C.toString()+")");break;case 2:m.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:C=r.width/2+r.left,m.unshift("rotate(-90 "+C.toString()+" "+C.toString()+")");break}y%2===1&&(r.left!==r.top&&(C=r.left,r.left=r.top,r.top=C),r.width!==r.height&&(C=r.width,r.width=r.height,r.height=C)),m.length&&(s=iPn(s,'',""))});const o=i.width,a=i.height,l=r.width,c=r.height;let u,d;o===null?(d=a===null?"1em":a==="auto"?c:a,u=PAe(d,l/c)):(u=o==="auto"?l:o,d=a===null?PAe(u,c/l):a==="auto"?c:a);const h={},f=(p,m)=>{rPn(m)||(h[p]=m.toString())};f("width",u),f("height",d);const g=[r.left,r.top,l,c];return h.viewBox=g.join(" "),{attributes:h,viewBox:g,body:s}}const oPn=/\sid="(\S+)"/g,aPn="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let lPn=0;function cPn(n,e=aPn){const t=[];let i;for(;i=oPn.exec(n);)t.push(i[1]);if(!t.length)return n;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(s=>{const o=typeof e=="function"?e(s):e+(lPn++).toString(),a=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=n.replace(new RegExp('([#;"])('+a+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),n=n.replace(new RegExp(r,"g"),""),n}const Ase=Object.create(null);function uPn(n,e){Ase[n]=e}function Nse(n){return Ase[n]||Ase[""]}function dge(n){let e;if(typeof n.resources=="string")e=[n.resources];else if(e=n.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:n.path||"/",maxURL:n.maxURL||500,rotate:n.rotate||750,timeout:n.timeout||5e3,random:n.random===!0,index:n.index||0,dataAfterTimeout:n.dataAfterTimeout!==!1}}const hge=Object.create(null),dD=["https://api.simplesvg.com","https://api.unisvg.com"],PF=[];for(;dD.length>0;)dD.length===1||Math.random()>.5?PF.push(dD.shift()):PF.push(dD.pop());hge[""]=dge({resources:["https://api.iconify.design"].concat(PF)});function dPn(n,e){const t=dge(e);return t===null?!1:(hge[n]=t,!0)}function fge(n){return hge[n]}const hPn=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let OAe=hPn();function fPn(n,e){const t=fge(n);if(!t)return 0;let i;if(!t.maxURL)i=0;else{let r=0;t.resources.forEach(o=>{r=Math.max(r,o.length)});const s=e+".json?icons=";i=t.maxURL-r-t.path.length-s.length}return i}function gPn(n){return n===404}const pPn=(n,e,t)=>{const i=[],r=fPn(n,e),s="icons";let o={type:s,provider:n,prefix:e,icons:[]},a=0;return t.forEach((l,c)=>{a+=l.length+1,a>=r&&c>0&&(i.push(o),o={type:s,provider:n,prefix:e,icons:[]},a=l.length),o.icons.push(l)}),i.push(o),i};function mPn(n){if(typeof n=="string"){const e=fge(n);if(e)return e.path}return"/"}const _Pn=(n,e,t)=>{if(!OAe){t("abort",424);return}let i=mPn(e.provider);switch(e.type){case"icons":{const s=e.prefix,a=e.icons.join(","),l=new URLSearchParams({icons:a});i+=s+".json?"+l.toString();break}case"custom":{const s=e.uri;i+=s.slice(0,1)==="/"?s.slice(1):s;break}default:t("abort",400);return}let r=503;OAe(n+i).then(s=>{const o=s.status;if(o!==200){setTimeout(()=>{t(gPn(o)?"abort":"next",o)});return}return r=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?t("abort",s):t("next",r)});return}setTimeout(()=>{t("success",s)})}).catch(()=>{t("next",r)})},vPn={prepare:pPn,send:_Pn};function bPn(n){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);n.sort((r,s)=>r.provider!==s.provider?r.provider.localeCompare(s.provider):r.prefix!==s.prefix?r.prefix.localeCompare(s.prefix):r.name.localeCompare(s.name));let i={provider:"",prefix:"",name:""};return n.forEach(r=>{if(i.name===r.name&&i.prefix===r.prefix&&i.provider===r.provider)return;i=r;const s=r.provider,o=r.prefix,a=r.name,l=t[s]||(t[s]=Object.create(null)),c=l[o]||(l[o]=uC(s,o));let u;a in c.icons?u=e.loaded:o===""||c.missing.has(a)?u=e.missing:u=e.pending;const d={provider:s,prefix:o,name:a};u.push(d)}),e}function BGe(n,e){n.forEach(t=>{const i=t.loaderCallbacks;i&&(t.loaderCallbacks=i.filter(r=>r.id!==e))})}function yPn(n){n.pendingCallbacksFlag||(n.pendingCallbacksFlag=!0,setTimeout(()=>{n.pendingCallbacksFlag=!1;const e=n.loaderCallbacks?n.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const i=n.provider,r=n.prefix;e.forEach(s=>{const o=s.icons,a=o.pending.length;o.pending=o.pending.filter(l=>{if(l.prefix!==r)return!0;const c=l.name;if(n.icons[c])o.loaded.push({provider:i,prefix:r,name:c});else if(n.missing.has(c))o.missing.push({provider:i,prefix:r,name:c});else return t=!0,!0;return!1}),o.pending.length!==a&&(t||BGe([n],s.id),s.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),s.abort))})}))}let wPn=0;function CPn(n,e,t){const i=wPn++,r=BGe.bind(null,t,i);if(!e.pending.length)return r;const s={id:i,icons:e,callback:n,abort:r};return t.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(s)}),r}function xPn(n,e=!0,t=!1){const i=[];return n.forEach(r=>{const s=typeof r=="string"?QV(r,e,t):r;s&&i.push(s)}),i}var SPn={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function kPn(n,e,t,i){const r=n.resources.length,s=n.random?Math.floor(Math.random()*r):n.index;let o;if(n.random){let k=n.resources.slice(0);for(o=[];k.length>1;){const L=Math.floor(Math.random()*k.length);o.push(k[L]),k=k.slice(0,L).concat(k.slice(L+1))}o=o.concat(k)}else o=n.resources.slice(s).concat(n.resources.slice(0,s));const a=Date.now();let l="pending",c=0,u,d=null,h=[],f=[];typeof i=="function"&&f.push(i);function g(){d&&(clearTimeout(d),d=null)}function p(){l==="pending"&&(l="aborted"),g(),h.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),h=[]}function m(k,L){L&&(f=[]),typeof k=="function"&&f.push(k)}function _(){return{startTime:a,payload:e,status:l,queriesSent:c,queriesPending:h.length,subscribe:m,abort:p}}function v(){l="failed",f.forEach(k=>{k(void 0,u)})}function y(){h.forEach(k=>{k.status==="pending"&&(k.status="aborted")}),h=[]}function C(k,L,D){const I=L!=="success";switch(h=h.filter(O=>O!==k),l){case"pending":break;case"failed":if(I||!n.dataAfterTimeout)return;break;default:return}if(L==="abort"){u=D,v();return}if(I){u=D,h.length||(o.length?x():v());return}if(g(),y(),!n.random){const O=n.resources.indexOf(k.resource);O!==-1&&O!==n.index&&(n.index=O)}l="completed",f.forEach(O=>{O(D)})}function x(){if(l!=="pending")return;g();const k=o.shift();if(k===void 0){if(h.length){d=setTimeout(()=>{g(),l==="pending"&&(y(),v())},n.timeout);return}v();return}const L={status:"pending",resource:k,callback:(D,I)=>{C(L,D,I)}};h.push(L),c++,d=setTimeout(x,n.rotate),t(k,e,L.callback)}return setTimeout(x),_}function $Ge(n){const e={...SPn,...n};let t=[];function i(){t=t.filter(a=>a().status==="pending")}function r(a,l,c){const u=kPn(e,a,l,(d,h)=>{i(),c&&c(d,h)});return t.push(u),u}function s(a){return t.find(l=>a(l))||null}return{query:r,find:s,setIndex:a=>{e.index=a},getIndex:()=>e.index,cleanup:i}}function MAe(){}const CG=Object.create(null);function EPn(n){if(!CG[n]){const e=fge(n);if(!e)return;const t=$Ge(e),i={config:e,redundancy:t};CG[n]=i}return CG[n]}function LPn(n,e,t){let i,r;if(typeof n=="string"){const s=Nse(n);if(!s)return t(void 0,424),MAe;r=s.send;const o=EPn(n);o&&(i=o.redundancy)}else{const s=dge(n);if(s){i=$Ge(s);const o=n.resources?n.resources[0]:"",a=Nse(o);a&&(r=a.send)}}return!i||!r?(t(void 0,424),MAe):i.query(e,r,t)().abort}const FAe="iconify2",CP="iconify",WGe=CP+"-count",BAe=CP+"-version",HGe=36e5,TPn=168,DPn=50;function Rse(n,e){try{return n.getItem(e)}catch{}}function gge(n,e,t){try{return n.setItem(e,t),!0}catch{}}function $Ae(n,e){try{n.removeItem(e)}catch{}}function Pse(n,e){return gge(n,WGe,e.toString())}function Ose(n){return parseInt(Rse(n,WGe))||0}const JV={local:!0,session:!0},VGe={local:new Set,session:new Set};let pge=!1;function IPn(n){pge=n}let u5=typeof window>"u"?{}:window;function zGe(n){const e=n+"Storage";try{if(u5&&u5[e]&&typeof u5[e].length=="number")return u5[e]}catch{}JV[n]=!1}function UGe(n,e){const t=zGe(n);if(!t)return;const i=Rse(t,BAe);if(i!==FAe){if(i){const a=Ose(t);for(let l=0;l{const l=CP+a.toString(),c=Rse(t,l);if(typeof c=="string"){try{const u=JSON.parse(c);if(typeof u=="object"&&typeof u.cached=="number"&&u.cached>r&&typeof u.provider=="string"&&typeof u.data=="object"&&typeof u.data.prefix=="string"&&e(u,a))return!0}catch{}$Ae(t,l)}};let o=Ose(t);for(let a=o-1;a>=0;a--)s(a)||(a===o-1?(o--,Pse(t,o)):VGe[n].add(a))}function jGe(){if(!pge){IPn(!0);for(const n in JV)UGe(n,e=>{const t=e.data,i=e.provider,r=t.prefix,s=uC(i,r);if(!uge(s,t).length)return!1;const o=t.lastModified||-1;return s.lastModifiedCached=s.lastModifiedCached?Math.min(s.lastModifiedCached,o):o,!0})}}function APn(n,e){const t=n.lastModifiedCached;if(t&&t>=e)return t===e;if(n.lastModifiedCached=e,t)for(const i in JV)UGe(i,r=>{const s=r.data;return r.provider!==n.provider||s.prefix!==n.prefix||s.lastModified===e});return!0}function NPn(n,e){pge||jGe();function t(i){let r;if(!JV[i]||!(r=zGe(i)))return;const s=VGe[i];let o;if(s.size)s.delete(o=Array.from(s).shift());else if(o=Ose(r),o>=DPn||!Pse(r,o+1))return;const a={cached:Math.floor(Date.now()/HGe),provider:n.provider,data:e};return gge(r,CP+o.toString(),JSON.stringify(a))}e.lastModified&&!APn(n,e.lastModified)||Object.keys(e.icons).length&&(e.not_found&&(e=Object.assign({},e),delete e.not_found),t("local")||t("session"))}function RPn(){}function PPn(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,yPn(n)}))}function OPn(n){const e=[],t=[];return n.forEach(i=>{(i.match(PGe)?e:t).push(i)}),{valid:e,invalid:t}}function hD(n,e,t,i){function r(){const s=n.pendingIcons;e.forEach(o=>{s&&s.delete(o),n.icons[o]||n.missing.add(o)})}if(t&&typeof t=="object")try{if(!uge(n,t).length){r();return}i&&NPn(n,t)}catch(s){console.error(s)}r(),PPn(n)}function WAe(n,e){n instanceof Promise?n.then(t=>{e(t)}).catch(()=>{e(null)}):e(n)}function MPn(n,e){n.iconsToLoad?n.iconsToLoad=n.iconsToLoad.concat(e).sort():n.iconsToLoad=e,n.iconsQueueFlag||(n.iconsQueueFlag=!0,setTimeout(()=>{n.iconsQueueFlag=!1;const{provider:t,prefix:i}=n,r=n.iconsToLoad;if(delete n.iconsToLoad,!r||!r.length)return;const s=n.loadIcon;if(n.loadIcons&&(r.length>1||!s)){WAe(n.loadIcons(r,i,t),u=>{hD(n,r,u,!1)});return}if(s){r.forEach(u=>{const d=s(u,i,t);WAe(d,h=>{const f=h?{prefix:i,icons:{[u]:h}}:null;hD(n,[u],f,!1)})});return}const{valid:o,invalid:a}=OPn(r);if(a.length&&hD(n,a,null,!1),!o.length)return;const l=i.match(PGe)?Nse(t):null;if(!l){hD(n,o,null,!1);return}l.prepare(t,i,o).forEach(u=>{LPn(t,u,d=>{hD(n,u.icons,d,!0)})})}))}const FPn=(n,e)=>{const t=xPn(n,!0,OGe()),i=bPn(t);if(!i.pending.length){let l=!0;return setTimeout(()=>{l&&e(i.loaded,i.missing,i.pending,RPn)}),()=>{l=!1}}const r=Object.create(null),s=[];let o,a;return i.pending.forEach(l=>{const{provider:c,prefix:u}=l;if(u===a&&c===o)return;o=c,a=u,s.push(uC(c,u));const d=r[c]||(r[c]=Object.create(null));d[u]||(d[u]=[])}),i.pending.forEach(l=>{const{provider:c,prefix:u,name:d}=l,h=uC(c,u),f=h.pendingIcons||(h.pendingIcons=new Set);f.has(d)||(f.add(d),r[c][u].push(d))}),s.forEach(l=>{const c=r[l.provider][l.prefix];c.length&&MPn(l,c)}),CPn(e,i,s)};function BPn(n,e){const t={...n};for(const i in e){const r=e[i],s=typeof r;i in MGe?(r===null||r&&(s==="string"||s==="number"))&&(t[i]=r):s===typeof t[i]&&(t[i]=i==="rotate"?r%4:r)}return t}const $Pn=/[\s,]+/;function WPn(n,e){e.split($Pn).forEach(t=>{switch(t.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0;break}})}function HPn(n,e=0){const t=n.replace(/^-?[0-9.]*/,"");function i(r){for(;r<0;)r+=4;return r%4}if(t===""){const r=parseInt(n);return isNaN(r)?0:i(r)}else if(t!==n){let r=0;switch(t){case"%":r=25;break;case"deg":r=90}if(r){let s=parseFloat(n.slice(0,n.length-t.length));return isNaN(s)?0:(s=s/r,s%1===0?i(s):0)}}return e}function VPn(n,e){let t=n.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in e)t+=" "+i+'="'+e[i]+'"';return'"+n+""}function zPn(n){return n.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(//g,"%3E").replace(/\s+/g," ")}function UPn(n){return"data:image/svg+xml,"+zPn(n)}function jPn(n){return'url("'+UPn(n)+'")'}let mA;function qPn(){try{mA=window.trustedTypes.createPolicy("iconify",{createHTML:n=>n})}catch{mA=null}}function KPn(n){return mA===void 0&&qPn(),mA?mA.createHTML(n):n}const qGe={...FGe,inline:!1},GPn={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},YPn={display:"inline-block"},Mse={backgroundColor:"currentColor"},KGe={backgroundColor:"transparent"},HAe={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},VAe={WebkitMask:Mse,mask:Mse,background:KGe};for(const n in VAe){const e=VAe[n];for(const t in HAe)e[n+t]=HAe[t]}const ZPn={...qGe,inline:!0};function zAe(n){return n+(n.match(/^[-0-9.]+$/)?"px":"")}const XPn=(n,e,t)=>{const i=e.inline?ZPn:qGe,r=BPn(i,e),s=e.mode||"svg",o={},a=e.style||{},l={...s==="svg"?GPn:{}};if(t){const m=QV(t,!1,!0);if(m){const _=["iconify"],v=["provider","prefix"];for(const y of v)m[y]&&_.push("iconify--"+m[y]);l.className=_.join(" ")}}for(let m in e){const _=e[m];if(_!==void 0)switch(m){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":break;case"_ref":l.ref=_;break;case"className":l[m]=(l[m]?l[m]+" ":"")+_;break;case"inline":case"hFlip":case"vFlip":r[m]=_===!0||_==="true"||_===1;break;case"flip":typeof _=="string"&&WPn(r,_);break;case"color":o.color=_;break;case"rotate":typeof _=="string"?r[m]=HPn(_):typeof _=="number"&&(r[m]=_);break;case"ariaHidden":case"aria-hidden":_!==!0&&_!=="true"&&delete l["aria-hidden"];break;default:i[m]===void 0&&(l[m]=_)}}const c=sPn(n,r),u=c.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),s==="svg"){l.style={...o,...a},Object.assign(l,u);let m=0,_=e.id;return typeof _=="string"&&(_=_.replace(/-/g,"_")),l.dangerouslySetInnerHTML={__html:KPn(cPn(c.body,_?()=>_+"ID"+m++:"iconifyReact"))},E.createElement("svg",l)}const{body:d,width:h,height:f}=n,g=s==="mask"||(s==="bg"?!1:d.indexOf("currentColor")!==-1),p=VPn(d,{...u,width:h+"",height:f+""});return l.style={...o,"--svg":jPn(p),width:zAe(u.width),height:zAe(u.height),...YPn,...g?Mse:KGe,...a},E.createElement("span",l)};OGe(!0);uPn("",vPn);if(typeof document<"u"&&typeof window<"u"){jGe();const n=window;if(n.IconifyPreload!==void 0){const e=n.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(i=>{try{(typeof i!="object"||i===null||i instanceof Array||typeof i.icons!="object"||typeof i.prefix!="string"||!QRn(i))&&console.error(t)}catch{console.error(t)}})}if(n.IconifyProviders!==void 0){const e=n.IconifyProviders;if(typeof e=="object"&&e!==null)for(let t in e){const i="IconifyProviders["+t+"] is invalid.";try{const r=e[t];if(typeof r!="object"||!r||r.resources===void 0)continue;dPn(t,r)||console.error(i)}catch{console.error(i)}}}}function GGe(n){const[e,t]=E.useState(!!n.ssr),[i,r]=E.useState({});function s(f){if(f){const g=n.icon;if(typeof g=="object")return{name:"",data:g};const p=RAe(g);if(p)return{name:g,data:p}}return{name:""}}const[o,a]=E.useState(s(!!n.ssr));function l(){const f=i.callback;f&&(f(),r({}))}function c(f){if(JSON.stringify(o)!==JSON.stringify(f))return l(),a(f),!0}function u(){var f;const g=n.icon;if(typeof g=="object"){c({name:"",data:g});return}const p=RAe(g);if(c({name:g,data:p}))if(p===void 0){const m=FPn([g],u);r({callback:m})}else p&&((f=n.onLoad)===null||f===void 0||f.call(n,g))}E.useEffect(()=>(t(!0),l),[]),E.useEffect(()=>{e&&u()},[n.icon,e]);const{name:d,data:h}=o;return h?XPn({...cge,...h},n,d):n.children?n.children:E.createElement("span",{})}const KVn=E.forwardRef((n,e)=>GGe({...n,_ref:e}));E.forwardRef((n,e)=>GGe({inline:!0,...n,_ref:e}));var QPn=E.forwardRef((n,e)=>{const{children:t,...i}=n,r=E.Children.toArray(t),s=r.find(JPn);if(s){const o=s.props.children,a=r.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return ae.jsx(Fse,{...i,ref:e,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return ae.jsx(Fse,{...i,ref:e,children:t})});QPn.displayName="Slot";var Fse=E.forwardRef((n,e)=>{const{children:t,...i}=n;if(E.isValidElement(t)){const r=tOn(t);return E.cloneElement(t,{...eOn(i,t.props),ref:e?Pg(e,r):r})}return E.Children.count(t)>1?E.Children.only(null):null});Fse.displayName="SlotClone";var YGe=({children:n})=>ae.jsx(ae.Fragment,{children:n});function JPn(n){return E.isValidElement(n)&&n.type===YGe}function eOn(n,e){const t={...e};for(const i in e){const r=n[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?t[i]=(...a)=>{s(...a),r(...a)}:r&&(t[i]=r):i==="style"?t[i]={...r,...s}:i==="className"&&(t[i]=[r,s].filter(Boolean).join(" "))}return{...n,...t}}function tOn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var ZGe="AlertDialog",[nOn,GVn]=Ac(ZGe,[JWe]),L0=JWe(),XGe=n=>{const{__scopeAlertDialog:e,...t}=n,i=L0(e);return ae.jsx(oQt,{...i,...t,modal:!0})};XGe.displayName=ZGe;var iOn="AlertDialogTrigger",QGe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,r=L0(t);return ae.jsx(aQt,{...r,...i,ref:e})});QGe.displayName=iOn;var rOn="AlertDialogPortal",JGe=n=>{const{__scopeAlertDialog:e,...t}=n,i=L0(e);return ae.jsx(lQt,{...i,...t})};JGe.displayName=rOn;var sOn="AlertDialogOverlay",eYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,r=L0(t);return ae.jsx(cQt,{...r,...i,ref:e})});eYe.displayName=sOn;var zk="AlertDialogContent",[oOn,aOn]=nOn(zk),tYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,children:i,...r}=n,s=L0(t),o=E.useRef(null),a=gi(e,o),l=E.useRef(null);return ae.jsx(nQt,{contentName:zk,titleName:nYe,docsSlug:"alert-dialog",children:ae.jsx(oOn,{scope:t,cancelRef:l,children:ae.jsxs(uQt,{role:"alertdialog",...s,...r,ref:a,onOpenAutoFocus:Kt(r.onOpenAutoFocus,c=>{c.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[ae.jsx(YGe,{children:i}),ae.jsx(cOn,{contentRef:o})]})})})});tYe.displayName=zk;var nYe="AlertDialogTitle",iYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,r=L0(t);return ae.jsx(dQt,{...r,...i,ref:e})});iYe.displayName=nYe;var rYe="AlertDialogDescription",sYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,r=L0(t);return ae.jsx(hQt,{...r,...i,ref:e})});sYe.displayName=rYe;var lOn="AlertDialogAction",oYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,r=L0(t);return ae.jsx(pHe,{...r,...i,ref:e})});oYe.displayName=lOn;var aYe="AlertDialogCancel",lYe=E.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...i}=n,{cancelRef:r}=aOn(aYe,t),s=L0(t),o=gi(e,r);return ae.jsx(pHe,{...s,...i,ref:o})});lYe.displayName=aYe;var cOn=({contentRef:n})=>{const e=`\`${zk}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${zk}\` by passing a \`${rYe}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${zk}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return E.useEffect(()=>{document.getElementById(n.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,n]),null},KVn=XGe,GVn=QGe,YVn=JGe,ZVn=eYe,XVn=tYe,QVn=oYe,JVn=lYe,ezn=iYe,tzn=sYe;function mge(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var UC=mge();function cYe(n){UC=n}var _A={exec:()=>null};function ls(n,e=""){let t=typeof n=="string"?n:n.source,i={replace:(r,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(nu.caret,"$1"),t=t.replace(r,o),i},getRegex:()=>new RegExp(t,e)};return i}var nu={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},uOn=/^(?:[ \t]*(?:\n|$))+/,dOn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,hOn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,sM=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,fOn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_ge=/(?:[*+-]|\d{1,9}[.)])/,uYe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,dYe=ls(uYe).replace(/bull/g,_ge).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),gOn=ls(uYe).replace(/bull/g,_ge).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),vge=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pOn=/^[^\n]+/,bge=/(?!\s*\])(?:\\.|[^\[\]\\])+/,mOn=ls(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",bge).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_On=ls(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,_ge).getRegex(),ez="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",yge=/|$))/,vOn=ls("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",yge).replace("tag",ez).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),hYe=ls(vge).replace("hr",sM).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ez).getRegex(),bOn=ls(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",hYe).getRegex(),wge={blockquote:bOn,code:dOn,def:mOn,fences:hOn,heading:fOn,hr:sM,html:vOn,lheading:dYe,list:_On,newline:uOn,paragraph:hYe,table:_A,text:pOn},UAe=ls("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",sM).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ez).getRegex(),yOn={...wge,lheading:gOn,table:UAe,paragraph:ls(vge).replace("hr",sM).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",UAe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ez).getRegex()},wOn={...wge,html:ls(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yge).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_A,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ls(vge).replace("hr",sM).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",dYe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},COn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,xOn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fYe=/^( {2,}|\\)\n(?!\s*$)/,SOn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,mYe=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,DOn=ls(mYe,"u").replace(/punct/g,tz).getRegex(),IOn=ls(mYe,"u").replace(/punct/g,pYe).getRegex(),_Ye="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",AOn=ls(_Ye,"gu").replace(/notPunctSpace/g,gYe).replace(/punctSpace/g,Cge).replace(/punct/g,tz).getRegex(),NOn=ls(_Ye,"gu").replace(/notPunctSpace/g,LOn).replace(/punctSpace/g,EOn).replace(/punct/g,pYe).getRegex(),ROn=ls("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,gYe).replace(/punctSpace/g,Cge).replace(/punct/g,tz).getRegex(),POn=ls(/\\(punct)/,"gu").replace(/punct/g,tz).getRegex(),OOn=ls(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),MOn=ls(yge).replace("(?:-->|$)","-->").getRegex(),FOn=ls("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",MOn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qB=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,BOn=ls(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",qB).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),vYe=ls(/^!?\[(label)\]\[(ref)\]/).replace("label",qB).replace("ref",bge).getRegex(),bYe=ls(/^!?\[(ref)\](?:\[\])?/).replace("ref",bge).getRegex(),$On=ls("reflink|nolink(?!\\()","g").replace("reflink",vYe).replace("nolink",bYe).getRegex(),xge={_backpedal:_A,anyPunctuation:POn,autolink:OOn,blockSkip:TOn,br:fYe,code:xOn,del:_A,emStrongLDelim:DOn,emStrongRDelimAst:AOn,emStrongRDelimUnd:ROn,escape:COn,link:BOn,nolink:bYe,punctuation:kOn,reflink:vYe,reflinkSearch:$On,tag:FOn,text:SOn,url:_A},WOn={...xge,link:ls(/^!?\[(label)\]\((.*?)\)/).replace("label",qB).getRegex(),reflink:ls(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qB).getRegex()},Bse={...xge,emStrongRDelimAst:NOn,emStrongLDelim:IOn,url:ls(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},jAe=n=>VOn[n];function sp(n,e){if(e){if(nu.escapeTest.test(n))return n.replace(nu.escapeReplace,jAe)}else if(nu.escapeTestNoEncode.test(n))return n.replace(nu.escapeReplaceNoEncode,jAe);return n}function qAe(n){try{n=encodeURI(n).replace(nu.percentDecode,"%")}catch{return null}return n}function KAe(n,e){let t=n.replace(nu.findPipe,(s,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),i=t.split(nu.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length0?-2:-1}function GAe(n,e,t,i,r){let s=e.href,o=e.title||null,a=n[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,l}function UOn(n,e,t){let i=n.match(t.other.indentCodeCompensation);if(i===null)return e;let r=i[1];return e.split(` +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return E.useEffect(()=>{document.getElementById(n.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,n]),null},YVn=XGe,ZVn=QGe,XVn=JGe,QVn=eYe,JVn=tYe,ezn=oYe,tzn=lYe,nzn=iYe,izn=sYe;function mge(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var UC=mge();function cYe(n){UC=n}var _A={exec:()=>null};function ls(n,e=""){let t=typeof n=="string"?n:n.source,i={replace:(r,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(nu.caret,"$1"),t=t.replace(r,o),i},getRegex:()=>new RegExp(t,e)};return i}var nu={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},uOn=/^(?:[ \t]*(?:\n|$))+/,dOn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,hOn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,sM=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,fOn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_ge=/(?:[*+-]|\d{1,9}[.)])/,uYe=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,dYe=ls(uYe).replace(/bull/g,_ge).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),gOn=ls(uYe).replace(/bull/g,_ge).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),vge=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pOn=/^[^\n]+/,bge=/(?!\s*\])(?:\\.|[^\[\]\\])+/,mOn=ls(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",bge).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_On=ls(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,_ge).getRegex(),ez="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",yge=/|$))/,vOn=ls("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",yge).replace("tag",ez).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),hYe=ls(vge).replace("hr",sM).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ez).getRegex(),bOn=ls(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",hYe).getRegex(),wge={blockquote:bOn,code:dOn,def:mOn,fences:hOn,heading:fOn,hr:sM,html:vOn,lheading:dYe,list:_On,newline:uOn,paragraph:hYe,table:_A,text:pOn},UAe=ls("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",sM).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ez).getRegex(),yOn={...wge,lheading:gOn,table:UAe,paragraph:ls(vge).replace("hr",sM).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",UAe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",ez).getRegex()},wOn={...wge,html:ls(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yge).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_A,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ls(vge).replace("hr",sM).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",dYe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},COn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,xOn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fYe=/^( {2,}|\\)\n(?!\s*$)/,SOn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,mYe=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,DOn=ls(mYe,"u").replace(/punct/g,tz).getRegex(),IOn=ls(mYe,"u").replace(/punct/g,pYe).getRegex(),_Ye="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",AOn=ls(_Ye,"gu").replace(/notPunctSpace/g,gYe).replace(/punctSpace/g,Cge).replace(/punct/g,tz).getRegex(),NOn=ls(_Ye,"gu").replace(/notPunctSpace/g,LOn).replace(/punctSpace/g,EOn).replace(/punct/g,pYe).getRegex(),ROn=ls("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,gYe).replace(/punctSpace/g,Cge).replace(/punct/g,tz).getRegex(),POn=ls(/\\(punct)/,"gu").replace(/punct/g,tz).getRegex(),OOn=ls(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),MOn=ls(yge).replace("(?:-->|$)","-->").getRegex(),FOn=ls("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",MOn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qB=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,BOn=ls(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",qB).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),vYe=ls(/^!?\[(label)\]\[(ref)\]/).replace("label",qB).replace("ref",bge).getRegex(),bYe=ls(/^!?\[(ref)\](?:\[\])?/).replace("ref",bge).getRegex(),$On=ls("reflink|nolink(?!\\()","g").replace("reflink",vYe).replace("nolink",bYe).getRegex(),xge={_backpedal:_A,anyPunctuation:POn,autolink:OOn,blockSkip:TOn,br:fYe,code:xOn,del:_A,emStrongLDelim:DOn,emStrongRDelimAst:AOn,emStrongRDelimUnd:ROn,escape:COn,link:BOn,nolink:bYe,punctuation:kOn,reflink:vYe,reflinkSearch:$On,tag:FOn,text:SOn,url:_A},WOn={...xge,link:ls(/^!?\[(label)\]\((.*?)\)/).replace("label",qB).getRegex(),reflink:ls(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",qB).getRegex()},Bse={...xge,emStrongRDelimAst:NOn,emStrongLDelim:IOn,url:ls(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},jAe=n=>VOn[n];function sp(n,e){if(e){if(nu.escapeTest.test(n))return n.replace(nu.escapeReplace,jAe)}else if(nu.escapeTestNoEncode.test(n))return n.replace(nu.escapeReplaceNoEncode,jAe);return n}function qAe(n){try{n=encodeURI(n).replace(nu.percentDecode,"%")}catch{return null}return n}function KAe(n,e){let t=n.replace(nu.findPipe,(s,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),i=t.split(nu.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length0?-2:-1}function GAe(n,e,t,i,r){let s=e.href,o=e.title||null,a=n[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,l}function UOn(n,e,t){let i=n.match(t.other.indentCodeCompensation);if(i===null)return e;let r=i[1];return e.split(` `).map(s=>{let o=s.match(t.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=r.length?s.slice(r.length):s}).join(` `)}var KB=class{options;rules;lexer;constructor(n){this.options=n||UC}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:gD(t,` `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],i=UOn(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let i=gD(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:gD(e[0],` @@ -2161,7 +2171,7 @@ ${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo `+h}!f&&!h.trim()&&(f=!0),c+=k+` `,n=n.substring(k.length+1),d=L.slice(g)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let p=null,m;this.options.gfm&&(p=this.rules.other.listIsTask.exec(u),p&&(m=p[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:c,task:!!p,checked:m,loose:!1,text:u,tokens:[]}),r.raw+=c}let a=r.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let l=0;ld.type==="space"),u=c.length>0&&c.some(d=>this.rules.other.anyLine.test(d.raw));r.loose=u}if(r.loose)for(let l=0;l({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[l]})));return s}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===` -`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=gD(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=zOn(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let i=e[2],r="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(i);s&&(i=s[1],r=s[3])}else r=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?i=i.slice(1):i=i.slice(1,-1)),GAe(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let i=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[i.toLowerCase()];if(!r){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return GAe(t,r,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let i=this.rules.inline.emStrongLDelim.exec(n);if(!(!i||i[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!t||this.rules.inline.punctuation.exec(t))){let r=[...i[0]].length-1,s,o,a=r,l=0,c=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*n.length+r);(i=c.exec(e))!=null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s)continue;if(o=[...s].length,i[3]||i[4]){a+=o;continue}else if((i[5]||i[6])&&r%3&&!((r+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...i[0]][0].length,d=n.slice(0,r+i.index+u+o);if(Math.min(r,o)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return i&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n){let e=this.rules.inline.del.exec(n);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,i;return e[2]==="@"?(t=e[1],i="mailto:"+t):(t=e[1],i=t),{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,i;if(e[2]==="@")t=e[0],i="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},S_=class $se{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||UC,this.options.tokenizer=this.options.tokenizer||new KB,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:nu,block:dF.normal,inline:fD.normal};this.options.pedantic?(t.block=dF.pedantic,t.inline=fD.pedantic):this.options.gfm&&(t.block=dF.gfm,this.options.breaks?t.inline=fD.breaks:t.inline=fD.gfm),this.tokenizer.rules=t}static get rules(){return{block:dF,inline:fD}}static lex(e,t){return new $se(t).lex(e)}static lexInline(e,t){return new $se(t).inlineTokens(e)}lex(e){e=e.replace(nu.carriageReturn,` +`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=gD(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=zOn(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let i=e[2],r="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(i);s&&(i=s[1],r=s[3])}else r=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?i=i.slice(1):i=i.slice(1,-1)),GAe(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let i=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[i.toLowerCase()];if(!r){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return GAe(t,r,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let i=this.rules.inline.emStrongLDelim.exec(n);if(!(!i||i[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!t||this.rules.inline.punctuation.exec(t))){let r=[...i[0]].length-1,s,o,a=r,l=0,c=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*n.length+r);(i=c.exec(e))!=null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s)continue;if(o=[...s].length,i[3]||i[4]){a+=o;continue}else if((i[5]||i[6])&&r%3&&!((r+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...i[0]][0].length,d=n.slice(0,r+i.index+u+o);if(Math.min(r,o)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return i&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n){let e=this.rules.inline.del.exec(n);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,i;return e[2]==="@"?(t=e[1],i="mailto:"+t):(t=e[1],i=t),{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,i;if(e[2]==="@")t=e[0],i="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},S_=class $se{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||UC,this.options.tokenizer=this.options.tokenizer||new KB,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:nu,block:d5.normal,inline:fD.normal};this.options.pedantic?(t.block=d5.pedantic,t.inline=fD.pedantic):this.options.gfm&&(t.block=d5.gfm,this.options.breaks?t.inline=fD.breaks:t.inline=fD.gfm),this.tokenizer.rules=t}static get rules(){return{block:d5,inline:fD}}static lex(e,t){return new $se(t).lex(e)}static lexInline(e,t){return new $se(t).inlineTokens(e)}lex(e){e=e.replace(nu.carriageReturn,` `),this.blockTokens(e,this.tokens);for(let t=0;t(r=o.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let o=t.at(-1);r.raw.length===1&&o!==void 0?o.raw+=` `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=` `+r.raw,o.text+=` @@ -2190,14 +2200,14 @@ ${this.parser.parse(n)} ${n} `}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+` `}strong({tokens:n}){return`${this.parser.parseInline(n)}`}em({tokens:n}){return`${this.parser.parseInline(n)}`}codespan({text:n}){return`${sp(n,!0)}`}br(n){return"
"}del({tokens:n}){return`${this.parser.parseInline(n)}`}link({href:n,title:e,tokens:t}){let i=this.parser.parseInline(t),r=qAe(n);if(r===null)return i;n=r;let s='
",s}image({href:n,title:e,text:t,tokens:i}){i&&(t=this.parser.parseInline(i,this.parser.textRenderer));let r=qAe(n);if(r===null)return sp(t);n=r;let s=`${t}{let o=r[s].flat(1/0);t=t.concat(this.walkTokens(o,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let i={...t};if(i.async=this.defaults.async||i.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let s=e.renderers[r.name];s?e.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[r.level];s?s.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),i.extensions=e),t.renderer){let r=this.defaults.renderer||new GB(this.defaults);for(let s in t.renderer){if(!(s in r))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=t.renderer[o],l=r[o];r[o]=(...c)=>{let u=a.apply(r,c);return u===!1&&(u=l.apply(r,c)),u||""}}i.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new KB(this.defaults);for(let s in t.tokenizer){if(!(s in r))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=t.tokenizer[o],l=r[o];r[o]=(...c)=>{let u=a.apply(r,c);return u===!1&&(u=l.apply(r,c)),u}}i.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new O5;for(let s in t.hooks){if(!(s in r))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=t.hooks[o],l=r[o];O5.passThroughHooks.has(s)?r[o]=c=>{if(this.defaults.async)return Promise.resolve(a.call(r,c)).then(d=>l.call(r,d));let u=a.call(r,c);return l.call(r,u)}:r[o]=(...c)=>{let u=a.apply(r,c);return u===!1&&(u=l.apply(r,c)),u}}i.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,s=t.walkTokens;i.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return S_.lex(n,e??this.defaults)}parser(n,e){return k_.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let i={...t},r={...this.defaults,...i},s=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=n);let o=r.hooks?r.hooks.provideLexer():n?S_.lex:S_.lexInline,a=r.hooks?r.hooks.provideParser():n?k_.parse:k_.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(e):e).then(l=>o(l,r)).then(l=>r.hooks?r.hooks.processAllTokens(l):l).then(l=>r.walkTokens?Promise.all(this.walkTokens(l,r.walkTokens)).then(()=>l):l).then(l=>a(l,r)).then(l=>r.hooks?r.hooks.postprocess(l):l).catch(s);try{r.hooks&&(e=r.hooks.preprocess(e));let l=o(e,r);r.hooks&&(l=r.hooks.processAllTokens(l)),r.walkTokens&&this.walkTokens(l,r.walkTokens);let c=a(l,r);return r.hooks&&(c=r.hooks.postprocess(c)),c}catch(l){return s(l)}}}onError(n,e){return t=>{if(t.message+=` -Please report this to https://github.com/markedjs/marked.`,n){let i="

An error occurred:

"+sp(t.message+"",!0)+"
";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},dC=new jOn;function ks(n,e){return dC.parse(n,e)}ks.options=ks.setOptions=function(n){return dC.setOptions(n),ks.defaults=dC.defaults,cYe(ks.defaults),ks};ks.getDefaults=mge;ks.defaults=UC;ks.use=function(...n){return dC.use(...n),ks.defaults=dC.defaults,cYe(ks.defaults),ks};ks.walkTokens=function(n,e){return dC.walkTokens(n,e)};ks.parseInline=dC.parseInline;ks.Parser=k_;ks.parser=k_.parse;ks.Renderer=GB;ks.TextRenderer=Sge;ks.Lexer=S_;ks.lexer=S_.lex;ks.Tokenizer=KB;ks.Hooks=O5;ks.parse=ks;ks.options;ks.setOptions;ks.use;ks.walkTokens;ks.parseInline;k_.parse;S_.lex;function hp(){return hp=Object.assign?Object.assign.bind():function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:0,t=(El[n[e+0]]+El[n[e+1]]+El[n[e+2]]+El[n[e+3]]+"-"+El[n[e+4]]+El[n[e+5]]+"-"+El[n[e+6]]+El[n[e+7]]+"-"+El[n[e+8]]+El[n[e+9]]+"-"+El[n[e+10]]+El[n[e+11]]+El[n[e+12]]+El[n[e+13]]+El[n[e+14]]+El[n[e+15]]).toLowerCase();if(!YOn(t))throw TypeError("Stringified UUID is invalid");return t}function yYe(n,e,t){n=n||{};var i=n.random||(n.rng||KOn)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,ZOn(i)}function oa(n){return E.createElement("i",{className:"rmel-iconfont rmel-icon-"+n.type})}function XOn(n){return E.createElement("div",{className:"rc-md-navigation "+(n.visible?"visible":"in-visible")},E.createElement("div",{className:"navigation-nav left"},E.createElement("div",{className:"button-wrap"},n.left)),E.createElement("div",{className:"navigation-nav right"},E.createElement("div",{className:"button-wrap"},n.right)))}function QOn(n){return E.createElement("div",{className:"tool-bar",style:n.style},n.children)}var wYe=function(n){Is(e,n);function e(){for(var t,i=arguments.length,r=new Array(i),s=0;s"u")){var i="enUS";if(navigator.language){var r=navigator.language.split("-");i=r[0],r.length!==1&&(i+=r[r.length-1].toUpperCase())}if(navigator.browserLanguage){var s=navigator.browserLanguage.split("-");i=s[0],s[1]&&(i+=s[1].toUpperCase())}this.current!==i&&this.isAvailable(i)&&(this.current=i,qv.emit(qv.EVENT_LANG_CHANGE,this,i,this.langs[i]))}},e.isAvailable=function(i){return typeof this.langs[i]<"u"},e.add=function(i,r){this.langs[i]=r},e.setCurrent=function(i){if(!this.isAvailable(i))throw new Error("Language "+i+" is not exists");this.current!==i&&(this.current=i,qv.emit(qv.EVENT_LANG_CHANGE,this,i,this.langs[i]))},e.get=function(i,r){var s=this.langs[this.current][i]||"";return r&&Object.keys(r).forEach(function(o){s=s.replace(new RegExp("\\{"+o+"\\}","g"),r[o])}),s},e.getCurrent=function(){return this.current},n}(),Ls=new tMn;function xP(n){"@babel/helpers - typeof";return xP=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},xP(n)}function nMn(n,e){if(xP(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(xP(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function iMn(n){var e=nMn(n,"string");return xP(e)=="symbol"?e:e+""}function rMn(n,e){for(var t=0;t=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +`+this.renderer.text(a);t?i+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):i+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}parseInline(e,t=this.renderer){let i="";for(let r=0;r{let o=r[s].flat(1/0);t=t.concat(this.walkTokens(o,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let i={...t};if(i.async=this.defaults.async||i.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let s=e.renderers[r.name];s?e.renderers[r.name]=function(...o){let a=r.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[r.level];s?s.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),i.extensions=e),t.renderer){let r=this.defaults.renderer||new GB(this.defaults);for(let s in t.renderer){if(!(s in r))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=t.renderer[o],l=r[o];r[o]=(...c)=>{let u=a.apply(r,c);return u===!1&&(u=l.apply(r,c)),u||""}}i.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new KB(this.defaults);for(let s in t.tokenizer){if(!(s in r))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=t.tokenizer[o],l=r[o];r[o]=(...c)=>{let u=a.apply(r,c);return u===!1&&(u=l.apply(r,c)),u}}i.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new OF;for(let s in t.hooks){if(!(s in r))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=t.hooks[o],l=r[o];OF.passThroughHooks.has(s)?r[o]=c=>{if(this.defaults.async)return Promise.resolve(a.call(r,c)).then(d=>l.call(r,d));let u=a.call(r,c);return l.call(r,u)}:r[o]=(...c)=>{let u=a.apply(r,c);return u===!1&&(u=l.apply(r,c)),u}}i.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,s=t.walkTokens;i.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),r&&(a=a.concat(r.call(this,o))),a}}this.defaults={...this.defaults,...i}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return S_.lex(n,e??this.defaults)}parser(n,e){return k_.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let i={...t},r={...this.defaults,...i},s=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=n);let o=r.hooks?r.hooks.provideLexer():n?S_.lex:S_.lexInline,a=r.hooks?r.hooks.provideParser():n?k_.parse:k_.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(e):e).then(l=>o(l,r)).then(l=>r.hooks?r.hooks.processAllTokens(l):l).then(l=>r.walkTokens?Promise.all(this.walkTokens(l,r.walkTokens)).then(()=>l):l).then(l=>a(l,r)).then(l=>r.hooks?r.hooks.postprocess(l):l).catch(s);try{r.hooks&&(e=r.hooks.preprocess(e));let l=o(e,r);r.hooks&&(l=r.hooks.processAllTokens(l)),r.walkTokens&&this.walkTokens(l,r.walkTokens);let c=a(l,r);return r.hooks&&(c=r.hooks.postprocess(c)),c}catch(l){return s(l)}}}onError(n,e){return t=>{if(t.message+=` +Please report this to https://github.com/markedjs/marked.`,n){let i="

An error occurred:

"+sp(t.message+"",!0)+"
";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},dC=new jOn;function ks(n,e){return dC.parse(n,e)}ks.options=ks.setOptions=function(n){return dC.setOptions(n),ks.defaults=dC.defaults,cYe(ks.defaults),ks};ks.getDefaults=mge;ks.defaults=UC;ks.use=function(...n){return dC.use(...n),ks.defaults=dC.defaults,cYe(ks.defaults),ks};ks.walkTokens=function(n,e){return dC.walkTokens(n,e)};ks.parseInline=dC.parseInline;ks.Parser=k_;ks.parser=k_.parse;ks.Renderer=GB;ks.TextRenderer=Sge;ks.Lexer=S_;ks.lexer=S_.lex;ks.Tokenizer=KB;ks.Hooks=OF;ks.parse=ks;ks.options;ks.setOptions;ks.use;ks.walkTokens;ks.parseInline;k_.parse;S_.lex;function hp(){return hp=Object.assign?Object.assign.bind():function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:0,t=(El[n[e+0]]+El[n[e+1]]+El[n[e+2]]+El[n[e+3]]+"-"+El[n[e+4]]+El[n[e+5]]+"-"+El[n[e+6]]+El[n[e+7]]+"-"+El[n[e+8]]+El[n[e+9]]+"-"+El[n[e+10]]+El[n[e+11]]+El[n[e+12]]+El[n[e+13]]+El[n[e+14]]+El[n[e+15]]).toLowerCase();if(!YOn(t))throw TypeError("Stringified UUID is invalid");return t}function yYe(n,e,t){n=n||{};var i=n.random||(n.rng||KOn)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,ZOn(i)}function oa(n){return E.createElement("i",{className:"rmel-iconfont rmel-icon-"+n.type})}function XOn(n){return E.createElement("div",{className:"rc-md-navigation "+(n.visible?"visible":"in-visible")},E.createElement("div",{className:"navigation-nav left"},E.createElement("div",{className:"button-wrap"},n.left)),E.createElement("div",{className:"navigation-nav right"},E.createElement("div",{className:"button-wrap"},n.right)))}function QOn(n){return E.createElement("div",{className:"tool-bar",style:n.style},n.children)}var wYe=function(n){Is(e,n);function e(){for(var t,i=arguments.length,r=new Array(i),s=0;s"u")){var i="enUS";if(navigator.language){var r=navigator.language.split("-");i=r[0],r.length!==1&&(i+=r[r.length-1].toUpperCase())}if(navigator.browserLanguage){var s=navigator.browserLanguage.split("-");i=s[0],s[1]&&(i+=s[1].toUpperCase())}this.current!==i&&this.isAvailable(i)&&(this.current=i,qv.emit(qv.EVENT_LANG_CHANGE,this,i,this.langs[i]))}},e.isAvailable=function(i){return typeof this.langs[i]<"u"},e.add=function(i,r){this.langs[i]=r},e.setCurrent=function(i){if(!this.isAvailable(i))throw new Error("Language "+i+" is not exists");this.current!==i&&(this.current=i,qv.emit(qv.EVENT_LANG_CHANGE,this,i,this.langs[i]))},e.get=function(i,r){var s=this.langs[this.current][i]||"";return r&&Object.keys(r).forEach(function(o){s=s.replace(new RegExp("\\{"+o+"\\}","g"),r[o])}),s},e.getCurrent=function(){return this.current},n}(),Ls=new tMn;function xP(n){"@babel/helpers - typeof";return xP=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},xP(n)}function nMn(n,e){if(xP(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(xP(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function iMn(n){var e=nMn(n,"string");return xP(e)=="symbol"?e:e+""}function rMn(n,e){for(var t=0;t=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aMn(n,e){if(n){if(typeof n=="string")return YAe(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return YAe(n,e)}}function YAe(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t0)for(var a=oMn(t),l;!(l=a()).done;){var c=l.value;if(typeof o[c]<"u"&&!o[c])return!1}else if(o.metaKey||o.ctrlKey||o.shiftKey||o.altKey)return!1;return o.key?o.key===r:o.keyCode===i}function SG(n,e){var t=n.split(` `),i=n.substr(0,e).split(` `),r=i.length,s=i[i.length-1].length,o=t[i.length-1],a=i.length>1?i[i.length-2]:null,l=t.length>i.length?t[i.length]:null;return{line:r,col:s,beforeText:n.substr(0,e),afterText:n.substr(e),curLine:o,prevLine:a,nextLine:l}}var nS={bold:["**","**"],italic:["*","*"],underline:["++","++"],strikethrough:["~~","~~"],quote:[` > `,` -`],inlinecode:["`","`"],code:["\n```\n","\n```\n"]};for(var fF=1;fF<=6;fF++)nS["h"+fF]=[` -`+lMn("#",fF)+" ",` +`],inlinecode:["`","`"],code:["\n```\n","\n```\n"]};for(var f5=1;f5<=6;f5++)nS["h"+f5]=[` +`+lMn("#",f5)+" ",` `];function uMn(n){for(var e=n.row,t=e===void 0?2:e,i=n.col,r=i===void 0?2:i,s=["|"],o=["|"],a=["|"],l="",c=1;c<=r;c++)s.push(" Head |"),a.push(" --- |"),o.push(" Data |");for(var u=1;u<=t;u++)l+=` `+o.join("");return s.join("")+` `+a.join("")+l}function ZAe(n,e){var t=e;if(t.substr(0,1)!==` @@ -2236,5 +2246,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `),s+=(r.nesting===-1?" `:">",s};H2.prototype.renderInline=function(n,e,t){let i="";const r=this.rules;for(let s=0,o=n.length;s=0&&(i=this.attrs[t][1]),i};zg.prototype.attrJoin=function(e,t){const i=this.attrIndex(e);i<0?this.attrPush([e,t]):this.attrs[i][1]=this.attrs[i][1]+" "+t};function YYe(n,e,t){this.src=n,this.env=t,this.tokens=[],this.inlineMode=!1,this.md=e}YYe.prototype.Token=zg;const h4n=/\r\n?|\n/g,f4n=/\0/g;function g4n(n){let e;e=n.src.replace(h4n,` -`),e=e.replace(f4n,"�"),n.src=e}function p4n(n){let e;n.inlineMode?(e=new n.Token("inline","",0),e.content=n.src,e.map=[0,1],e.children=[],n.tokens.push(e)):n.md.block.parse(n.src,n.md,n.env,n.tokens)}function m4n(n){const e=n.tokens;for(let t=0,i=e.length;t\s]/i.test(n)}function v4n(n){return/^<\/a\s*>/i.test(n)}function b4n(n){const e=n.tokens;if(n.md.options.linkify)for(let t=0,i=e.length;t=0;o--){const a=r[o];if(a.type==="link_close"){for(o--;r[o].level!==a.level&&r[o].type!=="link_open";)o--;continue}if(a.type==="html_inline"&&(_4n(a.content)&&s>0&&s--,v4n(a.content)&&s++),!(s>0)&&a.type==="text"&&n.md.linkify.test(a.content)){const l=a.content;let c=n.md.linkify.match(l);const u=[];let d=a.level,h=0;c.length>0&&c[0].index===0&&o>0&&r[o-1].type==="text_special"&&(c=c.slice(1));for(let f=0;fh){const x=new n.Token("text","",0);x.content=l.slice(h,_),x.level=d,u.push(x)}const v=new n.Token("link_open","a",1);v.attrs=[["href",p]],v.level=d++,v.markup="linkify",v.info="auto",u.push(v);const y=new n.Token("text","",0);y.content=m,y.level=d,u.push(y);const C=new n.Token("link_close","a",-1);C.level=--d,C.markup="linkify",C.info="auto",u.push(C),h=c[f].lastIndex}if(h=0;t--){const i=n[t];i.type==="text"&&!e&&(i.content=i.content.replace(w4n,x4n)),i.type==="link_open"&&i.info==="auto"&&e--,i.type==="link_close"&&i.info==="auto"&&e++}}function k4n(n){let e=0;for(let t=n.length-1;t>=0;t--){const i=n[t];i.type==="text"&&!e&&ZYe.test(i.content)&&(i.content=i.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),i.type==="link_open"&&i.info==="auto"&&e--,i.type==="link_close"&&i.info==="auto"&&e++}}function E4n(n){let e;if(n.md.options.typographer)for(e=n.tokens.length-1;e>=0;e--)n.tokens[e].type==="inline"&&(y4n.test(n.tokens[e].content)&&S4n(n.tokens[e].children),ZYe.test(n.tokens[e].content)&&k4n(n.tokens[e].children))}const L4n=/['"]/,oNe=/['"]/g,aNe="’";function gF(n,e,t){return n.slice(0,e)+t+n.slice(e+1)}function T4n(n,e){let t;const i=[];for(let r=0;r=0&&!(i[t].level<=o);t--);if(i.length=t+1,s.type!=="text")continue;let a=s.content,l=0,c=a.length;e:for(;l=0)g=a.charCodeAt(u.index-1);else for(t=r-1;t>=0&&!(n[t].type==="softbreak"||n[t].type==="hardbreak");t--)if(n[t].content){g=n[t].content.charCodeAt(n[t].content.length-1);break}let p=32;if(l=48&&g<=57&&(h=d=!1),d&&h&&(d=m,h=_),!d&&!h){f&&(s.content=gF(s.content,u.index,aNe));continue}if(h)for(t=i.length-1;t>=0;t--){let C=i[t];if(i[t].level=0;e--)n.tokens[e].type!=="inline"||!L4n.test(n.tokens[e].content)||T4n(n.tokens[e].children,n)}function I4n(n){let e,t;const i=n.tokens,r=i.length;for(let s=0;s0&&this.level++,this.tokens.push(i),i};vm.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};vm.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;et;)if(!Us(this.src.charCodeAt(--e)))return e+1;return e};vm.prototype.skipChars=function(e,t){for(let i=this.src.length;ei;)if(t!==this.src.charCodeAt(--e))return e+1;return e};vm.prototype.getLines=function(e,t,i,r){if(e>=t)return"";const s=new Array(t-e);for(let o=0,a=e;ai?s[o]=new Array(l-i+1).join(" ")+this.src.slice(u,d):s[o]=this.src.slice(u,d)}return s.join("")};vm.prototype.Token=zg;const A4n=65536;function DG(n,e){const t=n.bMarks[e]+n.tShift[e],i=n.eMarks[e];return n.src.slice(t,i)}function lNe(n){const e=[],t=n.length;let i=0,r=n.charCodeAt(i),s=!1,o=0,a="";for(;it)return!1;let r=e+1;if(n.sCount[r]=4)return!1;let s=n.bMarks[r]+n.tShift[r];if(s>=n.eMarks[r])return!1;const o=n.src.charCodeAt(s++);if(o!==124&&o!==45&&o!==58||s>=n.eMarks[r])return!1;const a=n.src.charCodeAt(s++);if(a!==124&&a!==45&&a!==58&&!Us(a)||o===45&&Us(a))return!1;for(;s=4)return!1;c=lNe(l),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop();const d=c.length;if(d===0||d!==u.length)return!1;if(i)return!0;const h=n.parentType;n.parentType="table";const f=n.md.block.ruler.getRules("blockquote"),g=n.push("table_open","table",1),p=[e,0];g.map=p;const m=n.push("thead_open","thead",1);m.map=[e,e+1];const _=n.push("tr_open","tr",1);_.map=[e,e+1];for(let C=0;C=4||(c=lNe(l),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop(),y+=d-c.length,y>A4n))break;if(r===e+2){const k=n.push("tbody_open","tbody",1);k.map=v=[e+2,0]}const x=n.push("tr_open","tr",1);x.map=[r,r+1];for(let k=0;k=4){i++,r=i;continue}break}n.line=r;const s=n.push("code_block","code",0);return s.content=n.getLines(e,r,4+n.blkIndent,!1)+` -`,s.map=[e,n.line],!0}function P4n(n,e,t,i){let r=n.bMarks[e]+n.tShift[e],s=n.eMarks[e];if(n.sCount[e]-n.blkIndent>=4||r+3>s)return!1;const o=n.src.charCodeAt(r);if(o!==126&&o!==96)return!1;let a=r;r=n.skipChars(r,o);let l=r-a;if(l<3)return!1;const c=n.src.slice(a,r),u=n.src.slice(r,s);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(i)return!0;let d=e,h=!1;for(;d++,!(d>=t||(r=a=n.bMarks[d]+n.tShift[d],s=n.eMarks[d],r=4)&&(r=n.skipChars(r,o),!(r-a=4||n.src.charCodeAt(r)!==62)return!1;if(i)return!0;const a=[],l=[],c=[],u=[],d=n.md.block.ruler.getRules("blockquote"),h=n.parentType;n.parentType="blockquote";let f=!1,g;for(g=e;g=s)break;if(n.src.charCodeAt(r++)===62&&!y){let x=n.sCount[g]+1,k,L;n.src.charCodeAt(r)===32?(r++,x++,L=!1,k=!0):n.src.charCodeAt(r)===9?(k=!0,(n.bsCount[g]+x)%4===3?(r++,x++,L=!1):L=!0):k=!1;let D=x;for(a.push(n.bMarks[g]),n.bMarks[g]=r;r=s,l.push(n.bsCount[g]),n.bsCount[g]=n.sCount[g]+1+(k?1:0),c.push(n.sCount[g]),n.sCount[g]=D-x,u.push(n.tShift[g]),n.tShift[g]=r-n.bMarks[g];continue}if(f)break;let C=!1;for(let x=0,k=d.length;x";const _=[e,0];m.map=_,n.md.block.tokenize(n,e,g);const v=n.push("blockquote_close","blockquote",-1);v.markup=">",n.lineMax=o,n.parentType=h,_[1]=n.line;for(let y=0;y=4)return!1;let s=n.bMarks[e]+n.tShift[e];const o=n.src.charCodeAt(s++);if(o!==42&&o!==45&&o!==95)return!1;let a=1;for(;s=i)return-1;let s=n.src.charCodeAt(r++);if(s<48||s>57)return-1;for(;;){if(r>=i)return-1;if(s=n.src.charCodeAt(r++),s>=48&&s<=57){if(r-t>=10)return-1;continue}if(s===41||s===46)break;return-1}return r=4||n.listIndent>=0&&n.sCount[l]-n.listIndent>=4&&n.sCount[l]=n.blkIndent&&(u=!0);let d,h,f;if((f=uNe(n,l))>=0){if(d=!0,o=n.bMarks[l]+n.tShift[l],h=Number(n.src.slice(o,f-1)),u&&h!==1)return!1}else if((f=cNe(n,l))>=0)d=!1;else return!1;if(u&&n.skipSpaces(f)>=n.eMarks[l])return!1;if(i)return!0;const g=n.src.charCodeAt(f-1),p=n.tokens.length;d?(a=n.push("ordered_list_open","ol",1),h!==1&&(a.attrs=[["start",h]])):a=n.push("bullet_list_open","ul",1);const m=[l,0];a.map=m,a.markup=String.fromCharCode(g);let _=!1;const v=n.md.block.ruler.getRules("list"),y=n.parentType;for(n.parentType="list";l=r?L=1:L=x-C,L>4&&(L=1);const D=C+L;a=n.push("list_item_open","li",1),a.markup=String.fromCharCode(g);const I=[l,0];a.map=I,d&&(a.info=n.src.slice(o,f-1));const O=n.tight,M=n.tShift[l],B=n.sCount[l],G=n.listIndent;if(n.listIndent=n.blkIndent,n.blkIndent=D,n.tight=!0,n.tShift[l]=k-n.bMarks[l],n.sCount[l]=x,k>=r&&n.isEmpty(l+1)?n.line=Math.min(n.line+2,t):n.md.block.tokenize(n,l,t,!0),(!n.tight||_)&&(c=!1),_=n.line-l>1&&n.isEmpty(n.line-1),n.blkIndent=n.listIndent,n.listIndent=G,n.tShift[l]=M,n.sCount[l]=B,n.tight=O,a=n.push("list_item_close","li",-1),a.markup=String.fromCharCode(g),l=n.line,I[1]=l,l>=t||n.sCount[l]=4)break;let W=!1;for(let z=0,q=v.length;z=4||n.src.charCodeAt(r)!==91)return!1;function a(v){const y=n.lineMax;if(v>=y||n.isEmpty(v))return null;let C=!1;if(n.sCount[v]-n.blkIndent>3&&(C=!0),n.sCount[v]<0&&(C=!0),!C){const L=n.md.block.ruler.getRules("reference"),D=n.parentType;n.parentType="reference";let I=!1;for(let O=0,M=L.length;O"u"&&(n.env.references={}),typeof n.env.references[_]>"u"&&(n.env.references[_]={title:m,href:d}),n.line=o),!0):!1}const W4n=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],H4n="[a-zA-Z_:][a-zA-Z0-9:._-]*",V4n="[^\"'=<>`\\x00-\\x20]+",z4n="'[^']*'",U4n='"[^"]*"',j4n="(?:"+V4n+"|"+z4n+"|"+U4n+")",q4n="(?:\\s+"+H4n+"(?:\\s*=\\s*"+j4n+")?)",XYe="<[A-Za-z][A-Za-z0-9\\-]*"+q4n+"*\\s*\\/?>",QYe="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",K4n="",G4n="<[?][\\s\\S]*?[?]>",Y4n="]*>",Z4n="",X4n=new RegExp("^(?:"+XYe+"|"+QYe+"|"+K4n+"|"+G4n+"|"+Y4n+"|"+Z4n+")"),Q4n=new RegExp("^(?:"+XYe+"|"+QYe+")"),qx=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(Q4n.source+"\\s*$"),/^$/,!1]];function J4n(n,e,t,i){let r=n.bMarks[e]+n.tShift[e],s=n.eMarks[e];if(n.sCount[e]-n.blkIndent>=4||!n.md.options.html||n.src.charCodeAt(r)!==60)return!1;let o=n.src.slice(r,s),a=0;for(;a=4)return!1;let o=n.src.charCodeAt(r);if(o!==35||r>=s)return!1;let a=1;for(o=n.src.charCodeAt(++r);o===35&&r6||rr&&Us(n.src.charCodeAt(l-1))&&(s=l),n.line=e+1;const c=n.push("heading_open","h"+String(a),1);c.markup="########".slice(0,a),c.map=[e,n.line];const u=n.push("inline","",0);u.content=n.src.slice(r,s).trim(),u.map=[e,n.line],u.children=[];const d=n.push("heading_close","h"+String(a),-1);return d.markup="########".slice(0,a),!0}function t3n(n,e,t){const i=n.md.block.ruler.getRules("paragraph");if(n.sCount[e]-n.blkIndent>=4)return!1;const r=n.parentType;n.parentType="paragraph";let s=0,o,a=e+1;for(;a3)continue;if(n.sCount[a]>=n.blkIndent){let f=n.bMarks[a]+n.tShift[a];const g=n.eMarks[a];if(f=g))){s=o===61?1:2;break}}if(n.sCount[a]<0)continue;let h=!1;for(let f=0,g=i.length;f3||n.sCount[s]<0)continue;let c=!1;for(let u=0,d=i.length;u=t||n.sCount[o]=s){n.line=t;break}const l=n.line;let c=!1;for(let u=0;u=n.line)throw new Error("block rule didn't increment state.line");break}if(!c)throw new Error("none of the block rules matched");n.tight=!a,n.isEmpty(n.line-1)&&(a=!0),o=n.line,o0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],r={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(i),this.tokens_meta.push(r),i};aM.prototype.scanDelims=function(n,e){const t=this.posMax,i=this.src.charCodeAt(n),r=n>0?this.src.charCodeAt(n-1):32;let s=n;for(;s0)return!1;const t=n.pos,i=n.posMax;if(t+3>i||n.src.charCodeAt(t)!==58||n.src.charCodeAt(t+1)!==47||n.src.charCodeAt(t+2)!==47)return!1;const r=n.pending.match(s3n);if(!r)return!1;const s=r[1],o=n.md.linkify.matchAtStart(n.src.slice(t-s.length));if(!o)return!1;let a=o.url;if(a.length<=s.length)return!1;a=a.replace(/\*+$/,"");const l=n.md.normalizeLink(a);if(!n.md.validateLink(l))return!1;if(!e){n.pending=n.pending.slice(0,-s.length);const c=n.push("link_open","a",1);c.attrs=[["href",l]],c.markup="linkify",c.info="auto";const u=n.push("text","",0);u.content=n.md.normalizeLinkText(a);const d=n.push("link_close","a",-1);d.markup="linkify",d.info="auto"}return n.pos+=a.length-s.length,!0}function a3n(n,e){let t=n.pos;if(n.src.charCodeAt(t)!==10)return!1;const i=n.pending.length-1,r=n.posMax;if(!e)if(i>=0&&n.pending.charCodeAt(i)===32)if(i>=1&&n.pending.charCodeAt(i-1)===32){let s=i-1;for(;s>=1&&n.pending.charCodeAt(s-1)===32;)s--;n.pending=n.pending.slice(0,s),n.push("hardbreak","br",0)}else n.pending=n.pending.slice(0,-1),n.push("softbreak","br",0);else n.push("softbreak","br",0);for(t++;t?@[]^_`{|}~-".split("").forEach(function(n){Oge[n.charCodeAt(0)]=1});function l3n(n,e){let t=n.pos;const i=n.posMax;if(n.src.charCodeAt(t)!==92||(t++,t>=i))return!1;let r=n.src.charCodeAt(t);if(r===10){for(e||n.push("hardbreak","br",0),t++;t=55296&&r<=56319&&t+1=56320&&a<=57343&&(s+=n.src[t+1],t++)}const o="\\"+s;if(!e){const a=n.push("text_special","",0);r<256&&Oge[r]!==0?a.content=s:a.content=o,a.markup=o,a.info="escape"}return n.pos=t+1,!0}function c3n(n,e){let t=n.pos;if(n.src.charCodeAt(t)!==96)return!1;const r=t;t++;const s=n.posMax;for(;t=0;i--){const r=e[i];if(r.marker!==95&&r.marker!==42||r.end===-1)continue;const s=e[r.end],o=i>0&&e[i-1].end===r.end+1&&e[i-1].marker===r.marker&&e[i-1].token===r.token-1&&e[r.end+1].token===s.token+1,a=String.fromCharCode(r.marker),l=n.tokens[r.token];l.type=o?"strong_open":"em_open",l.tag=o?"strong":"em",l.nesting=1,l.markup=o?a+a:a,l.content="";const c=n.tokens[s.token];c.type=o?"strong_close":"em_close",c.tag=o?"strong":"em",c.nesting=-1,c.markup=o?a+a:a,c.content="",o&&(n.tokens[e[i-1].token].content="",n.tokens[e[r.end+1].token].content="",i--)}}function f3n(n){const e=n.tokens_meta,t=n.tokens_meta.length;hNe(n,n.delimiters);for(let i=0;i=d)return!1;if(l=g,r=n.md.helpers.parseLinkDestination(n.src,g,n.posMax),r.ok){for(o=n.md.normalizeLink(r.str),n.md.validateLink(o)?g=r.pos:o="",l=g;g=d||n.src.charCodeAt(g)!==41)&&(c=!0),g++}if(c){if(typeof n.env.references>"u")return!1;if(g=0?i=n.src.slice(l,g++):g=f+1):g=f+1,i||(i=n.src.slice(h,f)),s=n.env.references[iz(i)],!s)return n.pos=u,!1;o=s.href,a=s.title}if(!e){n.pos=h,n.posMax=f;const p=n.push("link_open","a",1),m=[["href",o]];p.attrs=m,a&&m.push(["title",a]),n.linkLevel++,n.md.inline.tokenize(n),n.linkLevel--,n.push("link_close","a",-1)}return n.pos=g,n.posMax=d,!0}function p3n(n,e){let t,i,r,s,o,a,l,c,u="";const d=n.pos,h=n.posMax;if(n.src.charCodeAt(n.pos)!==33||n.src.charCodeAt(n.pos+1)!==91)return!1;const f=n.pos+2,g=n.md.helpers.parseLinkLabel(n,n.pos+1,!1);if(g<0)return!1;if(s=g+1,s=h)return!1;for(c=s,a=n.md.helpers.parseLinkDestination(n.src,s,n.posMax),a.ok&&(u=n.md.normalizeLink(a.str),n.md.validateLink(u)?s=a.pos:u=""),c=s;s=h||n.src.charCodeAt(s)!==41)return n.pos=d,!1;s++}else{if(typeof n.env.references>"u")return!1;if(s=0?r=n.src.slice(c,s++):s=g+1):s=g+1,r||(r=n.src.slice(f,g)),o=n.env.references[iz(r)],!o)return n.pos=d,!1;u=o.href,l=o.title}if(!e){i=n.src.slice(f,g);const p=[];n.md.inline.parse(i,n.md,n.env,p);const m=n.push("image","img",0),_=[["src",u],["alt",""]];m.attrs=_,m.children=p,m.content=i,l&&_.push(["title",l])}return n.pos=s,n.posMax=h,!0}const m3n=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,_3n=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function v3n(n,e){let t=n.pos;if(n.src.charCodeAt(t)!==60)return!1;const i=n.pos,r=n.posMax;for(;;){if(++t>=r)return!1;const o=n.src.charCodeAt(t);if(o===60)return!1;if(o===62)break}const s=n.src.slice(i+1,t);if(_3n.test(s)){const o=n.md.normalizeLink(s);if(!n.md.validateLink(o))return!1;if(!e){const a=n.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const l=n.push("text","",0);l.content=n.md.normalizeLinkText(s);const c=n.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return n.pos+=s.length+2,!0}if(m3n.test(s)){const o=n.md.normalizeLink("mailto:"+s);if(!n.md.validateLink(o))return!1;if(!e){const a=n.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const l=n.push("text","",0);l.content=n.md.normalizeLinkText(s);const c=n.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return n.pos+=s.length+2,!0}return!1}function b3n(n){return/^\s]/i.test(n)}function y3n(n){return/^<\/a\s*>/i.test(n)}function w3n(n){const e=n|32;return e>=97&&e<=122}function C3n(n,e){if(!n.md.options.html)return!1;const t=n.posMax,i=n.pos;if(n.src.charCodeAt(i)!==60||i+2>=t)return!1;const r=n.src.charCodeAt(i+1);if(r!==33&&r!==63&&r!==47&&!w3n(r))return!1;const s=n.src.slice(i).match(X4n);if(!s)return!1;if(!e){const o=n.push("html_inline","",0);o.content=s[0],b3n(o.content)&&n.linkLevel++,y3n(o.content)&&n.linkLevel--}return n.pos+=s[0].length,!0}const x3n=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,S3n=/^&([a-z][a-z0-9]{1,31});/i;function k3n(n,e){const t=n.pos,i=n.posMax;if(n.src.charCodeAt(t)!==38||t+1>=i)return!1;if(n.src.charCodeAt(t+1)===35){const s=n.src.slice(t).match(x3n);if(s){if(!e){const o=s[1][0].toLowerCase()==="x"?parseInt(s[1].slice(1),16):parseInt(s[1],10),a=n.push("text_special","",0);a.content=Rge(o)?ZB(o):ZB(65533),a.markup=s[0],a.info="entity"}return n.pos+=s[0].length,!0}}else{const s=n.src.slice(t).match(S3n);if(s){const o=qYe(s[0]);if(o!==s[0]){if(!e){const a=n.push("text_special","",0);a.content=o,a.markup=s[0],a.info="entity"}return n.pos+=s[0].length,!0}}}return!1}function fNe(n){const e={},t=n.length;if(!t)return;let i=0,r=-2;const s=[];for(let o=0;ol;c-=s[c]+1){const d=n[c];if(d.marker===a.marker&&d.open&&d.end<0){let h=!1;if((d.close||a.open)&&(d.length+a.length)%3===0&&(d.length%3!==0||a.length%3!==0)&&(h=!0),!h){const f=c>0&&!n[c-1].open?s[c-1]+1:0;s[o]=o-c+f,s[c]=f,a.open=!1,d.end=o,d.close=!1,u=-1,r=-2;break}}}u!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=u)}}function E3n(n){const e=n.tokens_meta,t=n.tokens_meta.length;fNe(n.delimiters);for(let i=0;i0&&i++,r[e].type==="text"&&e+1=n.pos)throw new Error("inline rule didn't increment state.pos");break}}else n.pos=n.posMax;o||n.pos++,s[e]=n.pos};lM.prototype.tokenize=function(n){const e=this.ruler.getRules(""),t=e.length,i=n.posMax,r=n.md.options.maxNesting;for(;n.pos=n.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(n.pos>=i)break;continue}n.pending+=n.src[n.pos++]}n.pending&&n.pushPending()};lM.prototype.parse=function(n,e,t,i){const r=new this.State(n,e,t,i);this.tokenize(r);const s=this.ruler2.getRules(""),o=s.length;for(let a=0;a|$))",e.tpl_email_fuzzy="(^|"+t+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function jse(n){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(i){n[i]=t[i]})}),n}function sz(n){return Object.prototype.toString.call(n)}function D3n(n){return sz(n)==="[object String]"}function I3n(n){return sz(n)==="[object Object]"}function A3n(n){return sz(n)==="[object RegExp]"}function gNe(n){return sz(n)==="[object Function]"}function N3n(n){return n.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const tZe={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function R3n(n){return Object.keys(n||{}).reduce(function(e,t){return e||tZe.hasOwnProperty(t)},!1)}const P3n={"http:":{validate:function(n,e,t){const i=n.slice(e);return t.re.http||(t.re.http=new RegExp("^\\/\\/"+t.re.src_auth+t.re.src_host_port_strict+t.re.src_path,"i")),t.re.http.test(i)?i.match(t.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(n,e,t){const i=n.slice(e);return t.re.no_http||(t.re.no_http=new RegExp("^"+t.re.src_auth+"(?:localhost|(?:(?:"+t.re.src_domain+")\\.)+"+t.re.src_domain_root+")"+t.re.src_port+t.re.src_host_terminator+t.re.src_path,"i")),t.re.no_http.test(i)?e>=3&&n[e-3]===":"||e>=3&&n[e-3]==="/"?0:i.match(t.re.no_http)[0].length:0}},"mailto:":{validate:function(n,e,t){const i=n.slice(e);return t.re.mailto||(t.re.mailto=new RegExp("^"+t.re.src_email_name+"@"+t.re.src_host_strict,"i")),t.re.mailto.test(i)?i.match(t.re.mailto)[0].length:0}}},O3n="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",M3n="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function F3n(n){n.__index__=-1,n.__text_cache__=""}function B3n(n){return function(e,t){const i=e.slice(t);return n.test(i)?i.match(n)[0].length:0}}function pNe(){return function(n,e){e.normalize(n)}}function XB(n){const e=n.re=T3n(n.__opts__),t=n.__tlds__.slice();n.onCompile(),n.__tlds_replaced__||t.push(O3n),t.push(e.src_xn),e.src_tlds=t.join("|");function i(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(i(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(i(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(i(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(i(e.tpl_host_fuzzy_test),"i");const r=[];n.__compiled__={};function s(a,l){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+l)}Object.keys(n.__schemas__).forEach(function(a){const l=n.__schemas__[a];if(l===null)return;const c={validate:null,link:null};if(n.__compiled__[a]=c,I3n(l)){A3n(l.validate)?c.validate=B3n(l.validate):gNe(l.validate)?c.validate=l.validate:s(a,l),gNe(l.normalize)?c.normalize=l.normalize:l.normalize?s(a,l):c.normalize=pNe();return}if(D3n(l)){r.push(a);return}s(a,l)}),r.forEach(function(a){n.__compiled__[n.__schemas__[a]]&&(n.__compiled__[a].validate=n.__compiled__[n.__schemas__[a]].validate,n.__compiled__[a].normalize=n.__compiled__[n.__schemas__[a]].normalize)}),n.__compiled__[""]={validate:null,normalize:pNe()};const o=Object.keys(n.__compiled__).filter(function(a){return a.length>0&&n.__compiled__[a]}).map(N3n).join("|");n.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","i"),n.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","ig"),n.re.schema_at_start=RegExp("^"+n.re.schema_search.source,"i"),n.re.pretest=RegExp("("+n.re.schema_test.source+")|("+n.re.host_fuzzy_test.source+")|@","i"),F3n(n)}function $3n(n,e){const t=n.__index__,i=n.__last_index__,r=n.__text_cache__.slice(t,i);this.schema=n.__schema__.toLowerCase(),this.index=t+e,this.lastIndex=i+e,this.raw=r,this.text=r,this.url=r}function qse(n,e){const t=new $3n(n,e);return n.__compiled__[t.schema].normalize(t,n),t}function ah(n,e){if(!(this instanceof ah))return new ah(n,e);e||R3n(n)&&(e=n,n={}),this.__opts__=jse({},tZe,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=jse({},P3n,n),this.__compiled__={},this.__tlds__=M3n,this.__tlds_replaced__=!1,this.re={},XB(this)}ah.prototype.add=function(e,t){return this.__schemas__[e]=t,XB(this),this};ah.prototype.set=function(e){return this.__opts__=jse(this.__opts__,e),this};ah.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let t,i,r,s,o,a,l,c,u;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(t=l.exec(e))!==null;)if(s=this.testSchemaAt(e,t[2],l.lastIndex),s){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+s;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c=0&&(r=e.match(this.re.email_fuzzy))!==null&&(o=r.index+r[1].length,a=r.index+r[0].length,(this.__index__<0||othis.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=a))),this.__index__>=0};ah.prototype.pretest=function(e){return this.re.pretest.test(e)};ah.prototype.testSchemaAt=function(e,t,i){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,i,this):0};ah.prototype.match=function(e){const t=[];let i=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(qse(this,i)),i=this.__last_index__);let r=i?e.slice(i):e;for(;this.test(r);)t.push(qse(this,i)),r=r.slice(this.__last_index__),i+=this.__last_index__;return t.length?t:null};ah.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const t=this.re.schema_at_start.exec(e);if(!t)return null;const i=this.testSchemaAt(e,t[2],t[0].length);return i?(this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i,qse(this,0)):null};ah.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(i,r,s){return i!==s[r-1]}).reverse(),XB(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,XB(this),this)};ah.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};ah.prototype.onCompile=function(){};const Uk=2147483647,Rp=36,Mge=1,LP=26,W3n=38,H3n=700,nZe=72,iZe=128,rZe="-",V3n=/^xn--/,z3n=/[^\0-\x7F]/,U3n=/[\x2E\u3002\uFF0E\uFF61]/g,j3n={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},NG=Rp-Mge,Pp=Math.floor,RG=String.fromCharCode;function lv(n){throw new RangeError(j3n[n])}function q3n(n,e){const t=[];let i=n.length;for(;i--;)t[i]=e(n[i]);return t}function sZe(n,e){const t=n.split("@");let i="";t.length>1&&(i=t[0]+"@",n=t[1]),n=n.replace(U3n,".");const r=n.split("."),s=q3n(r,e).join(".");return i+s}function oZe(n){const e=[];let t=0;const i=n.length;for(;t=55296&&r<=56319&&tString.fromCodePoint(...n),G3n=function(n){return n>=48&&n<58?26+(n-48):n>=65&&n<91?n-65:n>=97&&n<123?n-97:Rp},mNe=function(n,e){return n+22+75*(n<26)-((e!=0)<<5)},aZe=function(n,e,t){let i=0;for(n=t?Pp(n/H3n):n>>1,n+=Pp(n/e);n>NG*LP>>1;i+=Rp)n=Pp(n/NG);return Pp(i+(NG+1)*n/(n+W3n))},lZe=function(n){const e=[],t=n.length;let i=0,r=iZe,s=nZe,o=n.lastIndexOf(rZe);o<0&&(o=0);for(let a=0;a=128&&lv("not-basic"),e.push(n.charCodeAt(a));for(let a=o>0?o+1:0;a=t&&lv("invalid-input");const h=G3n(n.charCodeAt(a++));h>=Rp&&lv("invalid-input"),h>Pp((Uk-i)/u)&&lv("overflow"),i+=h*u;const f=d<=s?Mge:d>=s+LP?LP:d-s;if(hPp(Uk/g)&&lv("overflow"),u*=g}const c=e.length+1;s=aZe(i-l,c,l==0),Pp(i/c)>Uk-r&&lv("overflow"),r+=Pp(i/c),i%=c,e.splice(i++,0,r)}return String.fromCodePoint(...e)},cZe=function(n){const e=[];n=oZe(n);const t=n.length;let i=iZe,r=0,s=nZe;for(const l of n)l<128&&e.push(RG(l));const o=e.length;let a=o;for(o&&e.push(rZe);a=i&&uPp((Uk-r)/c)&&lv("overflow"),r+=(l-i)*c,i=l;for(const u of n)if(uUk&&lv("overflow"),u===i){let d=r;for(let h=Rp;;h+=Rp){const f=h<=s?Mge:h>=s+LP?LP:h-s;if(d=0))try{e.hostname=uZe.toASCII(e.hostname)}catch{}return oM(Dge(e))}function sFn(n){const e=Ige(n,!0);if(e.hostname&&(!e.protocol||dZe.indexOf(e.protocol)>=0))try{e.hostname=uZe.toUnicode(e.hostname)}catch{}return PL(Dge(e),PL.defaultChars+"%")}function Rg(n,e){if(!(this instanceof Rg))return new Rg(n,e);e||Nge(n)||(e=n||{},n="default"),this.inline=new lM,this.block=new rz,this.core=new Pge,this.renderer=new H2,this.linkify=new ah,this.validateLink=iFn,this.normalizeLink=rFn,this.normalizeLinkText=sFn,this.utils=a4n,this.helpers=nz({},d4n),this.options={},this.configure(n),e&&this.set(e)}Rg.prototype.set=function(n){return nz(this.options,n),this};Rg.prototype.configure=function(n){const e=this;if(Nge(n)){const t=n;if(n=eFn[t],!n)throw new Error('Wrong `markdown-it` preset "'+t+'", check name')}if(!n)throw new Error("Wrong `markdown-it` preset, can't be empty");return n.options&&e.set(n.options),n.components&&Object.keys(n.components).forEach(function(t){n.components[t].rules&&e[t].ruler.enableOnly(n.components[t].rules),n.components[t].rules2&&e[t].ruler2.enableOnly(n.components[t].rules2)}),this};Rg.prototype.enable=function(n,e){let t=[];Array.isArray(n)||(n=[n]),["core","block","inline"].forEach(function(r){t=t.concat(this[r].ruler.enable(n,!0))},this),t=t.concat(this.inline.ruler2.enable(n,!0));const i=n.filter(function(r){return t.indexOf(r)<0});if(i.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+i);return this};Rg.prototype.disable=function(n,e){let t=[];Array.isArray(n)||(n=[n]),["core","block","inline"].forEach(function(r){t=t.concat(this[r].ruler.disable(n,!0))},this),t=t.concat(this.inline.ruler2.disable(n,!0));const i=n.filter(function(r){return t.indexOf(r)<0});if(i.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+i);return this};Rg.prototype.use=function(n){const e=[this].concat(Array.prototype.slice.call(arguments,1));return n.apply(n,e),this};Rg.prototype.parse=function(n,e){if(typeof n!="string")throw new Error("Input data should be a String");const t=new this.core.State(n,this,e);return this.core.process(t),t.tokens};Rg.prototype.render=function(n,e){return e=e||{},this.renderer.render(this.parse(n,e),this.options,e)};Rg.prototype.parseInline=function(n,e){const t=new this.core.State(n,this,e);return t.inlineMode=!0,this.core.process(t),t.tokens};Rg.prototype.renderInline=function(n,e){return e=e||{},this.renderer.render(this.parseInline(n,e),this.options,e)};var hZe={exports:{}};(function(n){(function(e){var t=function(N){var F,V=new Float64Array(16);if(N)for(F=0;F>24&255,N[F+1]=V>>16&255,N[F+2]=V>>8&255,N[F+3]=V&255,N[F+4]=A>>24&255,N[F+5]=A>>16&255,N[F+6]=A>>8&255,N[F+7]=A&255}function p(N,F,V,A,K){var ge,pe=0;for(ge=0;ge>>8)-1}function m(N,F,V,A){return p(N,F,V,A,16)}function _(N,F,V,A){return p(N,F,V,A,32)}function v(N,F,V,A){for(var K=A[0]&255|(A[1]&255)<<8|(A[2]&255)<<16|(A[3]&255)<<24,ge=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,pe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,Ee=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,Be=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,ht=A[4]&255|(A[5]&255)<<8|(A[6]&255)<<16|(A[7]&255)<<24,bt=F[0]&255|(F[1]&255)<<8|(F[2]&255)<<16|(F[3]&255)<<24,hn=F[4]&255|(F[5]&255)<<8|(F[6]&255)<<16|(F[7]&255)<<24,Fe=F[8]&255|(F[9]&255)<<8|(F[10]&255)<<16|(F[11]&255)<<24,_e=F[12]&255|(F[13]&255)<<8|(F[14]&255)<<16|(F[15]&255)<<24,Ze=A[8]&255|(A[9]&255)<<8|(A[10]&255)<<16|(A[11]&255)<<24,ct=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,Ht=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Zt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,nn=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,ln=A[12]&255|(A[13]&255)<<8|(A[14]&255)<<16|(A[15]&255)<<24,Wt=K,on=ge,It=pe,Ct=Ee,Rt=Be,qt=ht,Ye=bt,Oe=hn,mt=Fe,at=_e,lt=Ze,kt=ct,Mn=Ht,Si=Zt,ki=nn,hi=ln,be,Wi=0;Wi<20;Wi+=2)be=Wt+Mn|0,Rt^=be<<7|be>>>25,be=Rt+Wt|0,mt^=be<<9|be>>>23,be=mt+Rt|0,Mn^=be<<13|be>>>19,be=Mn+mt|0,Wt^=be<<18|be>>>14,be=qt+on|0,at^=be<<7|be>>>25,be=at+qt|0,Si^=be<<9|be>>>23,be=Si+at|0,on^=be<<13|be>>>19,be=on+Si|0,qt^=be<<18|be>>>14,be=lt+Ye|0,ki^=be<<7|be>>>25,be=ki+lt|0,It^=be<<9|be>>>23,be=It+ki|0,Ye^=be<<13|be>>>19,be=Ye+It|0,lt^=be<<18|be>>>14,be=hi+kt|0,Ct^=be<<7|be>>>25,be=Ct+hi|0,Oe^=be<<9|be>>>23,be=Oe+Ct|0,kt^=be<<13|be>>>19,be=kt+Oe|0,hi^=be<<18|be>>>14,be=Wt+Ct|0,on^=be<<7|be>>>25,be=on+Wt|0,It^=be<<9|be>>>23,be=It+on|0,Ct^=be<<13|be>>>19,be=Ct+It|0,Wt^=be<<18|be>>>14,be=qt+Rt|0,Ye^=be<<7|be>>>25,be=Ye+qt|0,Oe^=be<<9|be>>>23,be=Oe+Ye|0,Rt^=be<<13|be>>>19,be=Rt+Oe|0,qt^=be<<18|be>>>14,be=lt+at|0,kt^=be<<7|be>>>25,be=kt+lt|0,mt^=be<<9|be>>>23,be=mt+kt|0,at^=be<<13|be>>>19,be=at+mt|0,lt^=be<<18|be>>>14,be=hi+ki|0,Mn^=be<<7|be>>>25,be=Mn+hi|0,Si^=be<<9|be>>>23,be=Si+Mn|0,ki^=be<<13|be>>>19,be=ki+Si|0,hi^=be<<18|be>>>14;Wt=Wt+K|0,on=on+ge|0,It=It+pe|0,Ct=Ct+Ee|0,Rt=Rt+Be|0,qt=qt+ht|0,Ye=Ye+bt|0,Oe=Oe+hn|0,mt=mt+Fe|0,at=at+_e|0,lt=lt+Ze|0,kt=kt+ct|0,Mn=Mn+Ht|0,Si=Si+Zt|0,ki=ki+nn|0,hi=hi+ln|0,N[0]=Wt>>>0&255,N[1]=Wt>>>8&255,N[2]=Wt>>>16&255,N[3]=Wt>>>24&255,N[4]=on>>>0&255,N[5]=on>>>8&255,N[6]=on>>>16&255,N[7]=on>>>24&255,N[8]=It>>>0&255,N[9]=It>>>8&255,N[10]=It>>>16&255,N[11]=It>>>24&255,N[12]=Ct>>>0&255,N[13]=Ct>>>8&255,N[14]=Ct>>>16&255,N[15]=Ct>>>24&255,N[16]=Rt>>>0&255,N[17]=Rt>>>8&255,N[18]=Rt>>>16&255,N[19]=Rt>>>24&255,N[20]=qt>>>0&255,N[21]=qt>>>8&255,N[22]=qt>>>16&255,N[23]=qt>>>24&255,N[24]=Ye>>>0&255,N[25]=Ye>>>8&255,N[26]=Ye>>>16&255,N[27]=Ye>>>24&255,N[28]=Oe>>>0&255,N[29]=Oe>>>8&255,N[30]=Oe>>>16&255,N[31]=Oe>>>24&255,N[32]=mt>>>0&255,N[33]=mt>>>8&255,N[34]=mt>>>16&255,N[35]=mt>>>24&255,N[36]=at>>>0&255,N[37]=at>>>8&255,N[38]=at>>>16&255,N[39]=at>>>24&255,N[40]=lt>>>0&255,N[41]=lt>>>8&255,N[42]=lt>>>16&255,N[43]=lt>>>24&255,N[44]=kt>>>0&255,N[45]=kt>>>8&255,N[46]=kt>>>16&255,N[47]=kt>>>24&255,N[48]=Mn>>>0&255,N[49]=Mn>>>8&255,N[50]=Mn>>>16&255,N[51]=Mn>>>24&255,N[52]=Si>>>0&255,N[53]=Si>>>8&255,N[54]=Si>>>16&255,N[55]=Si>>>24&255,N[56]=ki>>>0&255,N[57]=ki>>>8&255,N[58]=ki>>>16&255,N[59]=ki>>>24&255,N[60]=hi>>>0&255,N[61]=hi>>>8&255,N[62]=hi>>>16&255,N[63]=hi>>>24&255}function y(N,F,V,A){for(var K=A[0]&255|(A[1]&255)<<8|(A[2]&255)<<16|(A[3]&255)<<24,ge=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,pe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,Ee=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,Be=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,ht=A[4]&255|(A[5]&255)<<8|(A[6]&255)<<16|(A[7]&255)<<24,bt=F[0]&255|(F[1]&255)<<8|(F[2]&255)<<16|(F[3]&255)<<24,hn=F[4]&255|(F[5]&255)<<8|(F[6]&255)<<16|(F[7]&255)<<24,Fe=F[8]&255|(F[9]&255)<<8|(F[10]&255)<<16|(F[11]&255)<<24,_e=F[12]&255|(F[13]&255)<<8|(F[14]&255)<<16|(F[15]&255)<<24,Ze=A[8]&255|(A[9]&255)<<8|(A[10]&255)<<16|(A[11]&255)<<24,ct=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,Ht=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Zt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,nn=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,ln=A[12]&255|(A[13]&255)<<8|(A[14]&255)<<16|(A[15]&255)<<24,Wt=K,on=ge,It=pe,Ct=Ee,Rt=Be,qt=ht,Ye=bt,Oe=hn,mt=Fe,at=_e,lt=Ze,kt=ct,Mn=Ht,Si=Zt,ki=nn,hi=ln,be,Wi=0;Wi<20;Wi+=2)be=Wt+Mn|0,Rt^=be<<7|be>>>25,be=Rt+Wt|0,mt^=be<<9|be>>>23,be=mt+Rt|0,Mn^=be<<13|be>>>19,be=Mn+mt|0,Wt^=be<<18|be>>>14,be=qt+on|0,at^=be<<7|be>>>25,be=at+qt|0,Si^=be<<9|be>>>23,be=Si+at|0,on^=be<<13|be>>>19,be=on+Si|0,qt^=be<<18|be>>>14,be=lt+Ye|0,ki^=be<<7|be>>>25,be=ki+lt|0,It^=be<<9|be>>>23,be=It+ki|0,Ye^=be<<13|be>>>19,be=Ye+It|0,lt^=be<<18|be>>>14,be=hi+kt|0,Ct^=be<<7|be>>>25,be=Ct+hi|0,Oe^=be<<9|be>>>23,be=Oe+Ct|0,kt^=be<<13|be>>>19,be=kt+Oe|0,hi^=be<<18|be>>>14,be=Wt+Ct|0,on^=be<<7|be>>>25,be=on+Wt|0,It^=be<<9|be>>>23,be=It+on|0,Ct^=be<<13|be>>>19,be=Ct+It|0,Wt^=be<<18|be>>>14,be=qt+Rt|0,Ye^=be<<7|be>>>25,be=Ye+qt|0,Oe^=be<<9|be>>>23,be=Oe+Ye|0,Rt^=be<<13|be>>>19,be=Rt+Oe|0,qt^=be<<18|be>>>14,be=lt+at|0,kt^=be<<7|be>>>25,be=kt+lt|0,mt^=be<<9|be>>>23,be=mt+kt|0,at^=be<<13|be>>>19,be=at+mt|0,lt^=be<<18|be>>>14,be=hi+ki|0,Mn^=be<<7|be>>>25,be=Mn+hi|0,Si^=be<<9|be>>>23,be=Si+Mn|0,ki^=be<<13|be>>>19,be=ki+Si|0,hi^=be<<18|be>>>14;N[0]=Wt>>>0&255,N[1]=Wt>>>8&255,N[2]=Wt>>>16&255,N[3]=Wt>>>24&255,N[4]=qt>>>0&255,N[5]=qt>>>8&255,N[6]=qt>>>16&255,N[7]=qt>>>24&255,N[8]=lt>>>0&255,N[9]=lt>>>8&255,N[10]=lt>>>16&255,N[11]=lt>>>24&255,N[12]=hi>>>0&255,N[13]=hi>>>8&255,N[14]=hi>>>16&255,N[15]=hi>>>24&255,N[16]=Ye>>>0&255,N[17]=Ye>>>8&255,N[18]=Ye>>>16&255,N[19]=Ye>>>24&255,N[20]=Oe>>>0&255,N[21]=Oe>>>8&255,N[22]=Oe>>>16&255,N[23]=Oe>>>24&255,N[24]=mt>>>0&255,N[25]=mt>>>8&255,N[26]=mt>>>16&255,N[27]=mt>>>24&255,N[28]=at>>>0&255,N[29]=at>>>8&255,N[30]=at>>>16&255,N[31]=at>>>24&255}function C(N,F,V,A){v(N,F,V,A)}function x(N,F,V,A){y(N,F,V,A)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function L(N,F,V,A,K,ge,pe){var Ee=new Uint8Array(16),Be=new Uint8Array(64),ht,bt;for(bt=0;bt<16;bt++)Ee[bt]=0;for(bt=0;bt<8;bt++)Ee[bt]=ge[bt];for(;K>=64;){for(C(Be,Ee,pe,k),bt=0;bt<64;bt++)N[F+bt]=V[A+bt]^Be[bt];for(ht=1,bt=8;bt<16;bt++)ht=ht+(Ee[bt]&255)|0,Ee[bt]=ht&255,ht>>>=8;K-=64,F+=64,A+=64}if(K>0)for(C(Be,Ee,pe,k),bt=0;bt=64;){for(C(pe,ge,K,k),Be=0;Be<64;Be++)N[F+Be]=pe[Be];for(Ee=1,Be=8;Be<16;Be++)Ee=Ee+(ge[Be]&255)|0,ge[Be]=Ee&255,Ee>>>=8;V-=64,F+=64}if(V>0)for(C(pe,ge,K,k),Be=0;Be>>13|V<<3)&8191,A=N[4]&255|(N[5]&255)<<8,this.r[2]=(V>>>10|A<<6)&7939,K=N[6]&255|(N[7]&255)<<8,this.r[3]=(A>>>7|K<<9)&8191,ge=N[8]&255|(N[9]&255)<<8,this.r[4]=(K>>>4|ge<<12)&255,this.r[5]=ge>>>1&8190,pe=N[10]&255|(N[11]&255)<<8,this.r[6]=(ge>>>14|pe<<2)&8191,Ee=N[12]&255|(N[13]&255)<<8,this.r[7]=(pe>>>11|Ee<<5)&8065,Be=N[14]&255|(N[15]&255)<<8,this.r[8]=(Ee>>>8|Be<<8)&8191,this.r[9]=Be>>>5&127,this.pad[0]=N[16]&255|(N[17]&255)<<8,this.pad[1]=N[18]&255|(N[19]&255)<<8,this.pad[2]=N[20]&255|(N[21]&255)<<8,this.pad[3]=N[22]&255|(N[23]&255)<<8,this.pad[4]=N[24]&255|(N[25]&255)<<8,this.pad[5]=N[26]&255|(N[27]&255)<<8,this.pad[6]=N[28]&255|(N[29]&255)<<8,this.pad[7]=N[30]&255|(N[31]&255)<<8};M.prototype.blocks=function(N,F,V){for(var A=this.fin?0:2048,K,ge,pe,Ee,Be,ht,bt,hn,Fe,_e,Ze,ct,Ht,Zt,nn,ln,Wt,on,It,Ct=this.h[0],Rt=this.h[1],qt=this.h[2],Ye=this.h[3],Oe=this.h[4],mt=this.h[5],at=this.h[6],lt=this.h[7],kt=this.h[8],Mn=this.h[9],Si=this.r[0],ki=this.r[1],hi=this.r[2],be=this.r[3],Wi=this.r[4],ur=this.r[5],dr=this.r[6],Ei=this.r[7],hr=this.r[8],tr=this.r[9];V>=16;)K=N[F+0]&255|(N[F+1]&255)<<8,Ct+=K&8191,ge=N[F+2]&255|(N[F+3]&255)<<8,Rt+=(K>>>13|ge<<3)&8191,pe=N[F+4]&255|(N[F+5]&255)<<8,qt+=(ge>>>10|pe<<6)&8191,Ee=N[F+6]&255|(N[F+7]&255)<<8,Ye+=(pe>>>7|Ee<<9)&8191,Be=N[F+8]&255|(N[F+9]&255)<<8,Oe+=(Ee>>>4|Be<<12)&8191,mt+=Be>>>1&8191,ht=N[F+10]&255|(N[F+11]&255)<<8,at+=(Be>>>14|ht<<2)&8191,bt=N[F+12]&255|(N[F+13]&255)<<8,lt+=(ht>>>11|bt<<5)&8191,hn=N[F+14]&255|(N[F+15]&255)<<8,kt+=(bt>>>8|hn<<8)&8191,Mn+=hn>>>5|A,Fe=0,_e=Fe,_e+=Ct*Si,_e+=Rt*(5*tr),_e+=qt*(5*hr),_e+=Ye*(5*Ei),_e+=Oe*(5*dr),Fe=_e>>>13,_e&=8191,_e+=mt*(5*ur),_e+=at*(5*Wi),_e+=lt*(5*be),_e+=kt*(5*hi),_e+=Mn*(5*ki),Fe+=_e>>>13,_e&=8191,Ze=Fe,Ze+=Ct*ki,Ze+=Rt*Si,Ze+=qt*(5*tr),Ze+=Ye*(5*hr),Ze+=Oe*(5*Ei),Fe=Ze>>>13,Ze&=8191,Ze+=mt*(5*dr),Ze+=at*(5*ur),Ze+=lt*(5*Wi),Ze+=kt*(5*be),Ze+=Mn*(5*hi),Fe+=Ze>>>13,Ze&=8191,ct=Fe,ct+=Ct*hi,ct+=Rt*ki,ct+=qt*Si,ct+=Ye*(5*tr),ct+=Oe*(5*hr),Fe=ct>>>13,ct&=8191,ct+=mt*(5*Ei),ct+=at*(5*dr),ct+=lt*(5*ur),ct+=kt*(5*Wi),ct+=Mn*(5*be),Fe+=ct>>>13,ct&=8191,Ht=Fe,Ht+=Ct*be,Ht+=Rt*hi,Ht+=qt*ki,Ht+=Ye*Si,Ht+=Oe*(5*tr),Fe=Ht>>>13,Ht&=8191,Ht+=mt*(5*hr),Ht+=at*(5*Ei),Ht+=lt*(5*dr),Ht+=kt*(5*ur),Ht+=Mn*(5*Wi),Fe+=Ht>>>13,Ht&=8191,Zt=Fe,Zt+=Ct*Wi,Zt+=Rt*be,Zt+=qt*hi,Zt+=Ye*ki,Zt+=Oe*Si,Fe=Zt>>>13,Zt&=8191,Zt+=mt*(5*tr),Zt+=at*(5*hr),Zt+=lt*(5*Ei),Zt+=kt*(5*dr),Zt+=Mn*(5*ur),Fe+=Zt>>>13,Zt&=8191,nn=Fe,nn+=Ct*ur,nn+=Rt*Wi,nn+=qt*be,nn+=Ye*hi,nn+=Oe*ki,Fe=nn>>>13,nn&=8191,nn+=mt*Si,nn+=at*(5*tr),nn+=lt*(5*hr),nn+=kt*(5*Ei),nn+=Mn*(5*dr),Fe+=nn>>>13,nn&=8191,ln=Fe,ln+=Ct*dr,ln+=Rt*ur,ln+=qt*Wi,ln+=Ye*be,ln+=Oe*hi,Fe=ln>>>13,ln&=8191,ln+=mt*ki,ln+=at*Si,ln+=lt*(5*tr),ln+=kt*(5*hr),ln+=Mn*(5*Ei),Fe+=ln>>>13,ln&=8191,Wt=Fe,Wt+=Ct*Ei,Wt+=Rt*dr,Wt+=qt*ur,Wt+=Ye*Wi,Wt+=Oe*be,Fe=Wt>>>13,Wt&=8191,Wt+=mt*hi,Wt+=at*ki,Wt+=lt*Si,Wt+=kt*(5*tr),Wt+=Mn*(5*hr),Fe+=Wt>>>13,Wt&=8191,on=Fe,on+=Ct*hr,on+=Rt*Ei,on+=qt*dr,on+=Ye*ur,on+=Oe*Wi,Fe=on>>>13,on&=8191,on+=mt*be,on+=at*hi,on+=lt*ki,on+=kt*Si,on+=Mn*(5*tr),Fe+=on>>>13,on&=8191,It=Fe,It+=Ct*tr,It+=Rt*hr,It+=qt*Ei,It+=Ye*dr,It+=Oe*ur,Fe=It>>>13,It&=8191,It+=mt*Wi,It+=at*be,It+=lt*hi,It+=kt*ki,It+=Mn*Si,Fe+=It>>>13,It&=8191,Fe=(Fe<<2)+Fe|0,Fe=Fe+_e|0,_e=Fe&8191,Fe=Fe>>>13,Ze+=Fe,Ct=_e,Rt=Ze,qt=ct,Ye=Ht,Oe=Zt,mt=nn,at=ln,lt=Wt,kt=on,Mn=It,F+=16,V-=16;this.h[0]=Ct,this.h[1]=Rt,this.h[2]=qt,this.h[3]=Ye,this.h[4]=Oe,this.h[5]=mt,this.h[6]=at,this.h[7]=lt,this.h[8]=kt,this.h[9]=Mn},M.prototype.finish=function(N,F){var V=new Uint16Array(10),A,K,ge,pe;if(this.leftover){for(pe=this.leftover,this.buffer[pe++]=1;pe<16;pe++)this.buffer[pe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(A=this.h[1]>>>13,this.h[1]&=8191,pe=2;pe<10;pe++)this.h[pe]+=A,A=this.h[pe]>>>13,this.h[pe]&=8191;for(this.h[0]+=A*5,A=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=A,A=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=A,V[0]=this.h[0]+5,A=V[0]>>>13,V[0]&=8191,pe=1;pe<10;pe++)V[pe]=this.h[pe]+A,A=V[pe]>>>13,V[pe]&=8191;for(V[9]-=8192,K=(A^1)-1,pe=0;pe<10;pe++)V[pe]&=K;for(K=~K,pe=0;pe<10;pe++)this.h[pe]=this.h[pe]&K|V[pe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,ge=this.h[0]+this.pad[0],this.h[0]=ge&65535,pe=1;pe<8;pe++)ge=(this.h[pe]+this.pad[pe]|0)+(ge>>>16)|0,this.h[pe]=ge&65535;N[F+0]=this.h[0]>>>0&255,N[F+1]=this.h[0]>>>8&255,N[F+2]=this.h[1]>>>0&255,N[F+3]=this.h[1]>>>8&255,N[F+4]=this.h[2]>>>0&255,N[F+5]=this.h[2]>>>8&255,N[F+6]=this.h[3]>>>0&255,N[F+7]=this.h[3]>>>8&255,N[F+8]=this.h[4]>>>0&255,N[F+9]=this.h[4]>>>8&255,N[F+10]=this.h[5]>>>0&255,N[F+11]=this.h[5]>>>8&255,N[F+12]=this.h[6]>>>0&255,N[F+13]=this.h[6]>>>8&255,N[F+14]=this.h[7]>>>0&255,N[F+15]=this.h[7]>>>8&255},M.prototype.update=function(N,F,V){var A,K;if(this.leftover){for(K=16-this.leftover,K>V&&(K=V),A=0;A=16&&(K=V-V%16,this.blocks(N,F,K),F+=K,V-=K),V){for(A=0;A>16&1),ge[V-1]&=65535;ge[15]=pe[15]-32767-(ge[14]>>16&1),K=ge[15]>>16&1,ge[14]&=65535,Z(pe,ge,1-K)}for(V=0;V<16;V++)N[2*V]=pe[V]&255,N[2*V+1]=pe[V]>>8}function te(N,F){var V=new Uint8Array(32),A=new Uint8Array(32);return j(V,N),j(A,F),_(V,0,A,0)}function le(N){var F=new Uint8Array(32);return j(F,N),F[0]&1}function ue(N,F){var V;for(V=0;V<16;V++)N[V]=F[2*V]+(F[2*V+1]<<8);N[15]&=32767}function de(N,F,V){for(var A=0;A<16;A++)N[A]=F[A]+V[A]}function we(N,F,V){for(var A=0;A<16;A++)N[A]=F[A]-V[A]}function xe(N,F,V){var A,K,ge=0,pe=0,Ee=0,Be=0,ht=0,bt=0,hn=0,Fe=0,_e=0,Ze=0,ct=0,Ht=0,Zt=0,nn=0,ln=0,Wt=0,on=0,It=0,Ct=0,Rt=0,qt=0,Ye=0,Oe=0,mt=0,at=0,lt=0,kt=0,Mn=0,Si=0,ki=0,hi=0,be=V[0],Wi=V[1],ur=V[2],dr=V[3],Ei=V[4],hr=V[5],tr=V[6],Ks=V[7],Mr=V[8],ds=V[9],Gs=V[10],Ys=V[11],Ho=V[12],Aa=V[13],Na=V[14],Ra=V[15];A=F[0],ge+=A*be,pe+=A*Wi,Ee+=A*ur,Be+=A*dr,ht+=A*Ei,bt+=A*hr,hn+=A*tr,Fe+=A*Ks,_e+=A*Mr,Ze+=A*ds,ct+=A*Gs,Ht+=A*Ys,Zt+=A*Ho,nn+=A*Aa,ln+=A*Na,Wt+=A*Ra,A=F[1],pe+=A*be,Ee+=A*Wi,Be+=A*ur,ht+=A*dr,bt+=A*Ei,hn+=A*hr,Fe+=A*tr,_e+=A*Ks,Ze+=A*Mr,ct+=A*ds,Ht+=A*Gs,Zt+=A*Ys,nn+=A*Ho,ln+=A*Aa,Wt+=A*Na,on+=A*Ra,A=F[2],Ee+=A*be,Be+=A*Wi,ht+=A*ur,bt+=A*dr,hn+=A*Ei,Fe+=A*hr,_e+=A*tr,Ze+=A*Ks,ct+=A*Mr,Ht+=A*ds,Zt+=A*Gs,nn+=A*Ys,ln+=A*Ho,Wt+=A*Aa,on+=A*Na,It+=A*Ra,A=F[3],Be+=A*be,ht+=A*Wi,bt+=A*ur,hn+=A*dr,Fe+=A*Ei,_e+=A*hr,Ze+=A*tr,ct+=A*Ks,Ht+=A*Mr,Zt+=A*ds,nn+=A*Gs,ln+=A*Ys,Wt+=A*Ho,on+=A*Aa,It+=A*Na,Ct+=A*Ra,A=F[4],ht+=A*be,bt+=A*Wi,hn+=A*ur,Fe+=A*dr,_e+=A*Ei,Ze+=A*hr,ct+=A*tr,Ht+=A*Ks,Zt+=A*Mr,nn+=A*ds,ln+=A*Gs,Wt+=A*Ys,on+=A*Ho,It+=A*Aa,Ct+=A*Na,Rt+=A*Ra,A=F[5],bt+=A*be,hn+=A*Wi,Fe+=A*ur,_e+=A*dr,Ze+=A*Ei,ct+=A*hr,Ht+=A*tr,Zt+=A*Ks,nn+=A*Mr,ln+=A*ds,Wt+=A*Gs,on+=A*Ys,It+=A*Ho,Ct+=A*Aa,Rt+=A*Na,qt+=A*Ra,A=F[6],hn+=A*be,Fe+=A*Wi,_e+=A*ur,Ze+=A*dr,ct+=A*Ei,Ht+=A*hr,Zt+=A*tr,nn+=A*Ks,ln+=A*Mr,Wt+=A*ds,on+=A*Gs,It+=A*Ys,Ct+=A*Ho,Rt+=A*Aa,qt+=A*Na,Ye+=A*Ra,A=F[7],Fe+=A*be,_e+=A*Wi,Ze+=A*ur,ct+=A*dr,Ht+=A*Ei,Zt+=A*hr,nn+=A*tr,ln+=A*Ks,Wt+=A*Mr,on+=A*ds,It+=A*Gs,Ct+=A*Ys,Rt+=A*Ho,qt+=A*Aa,Ye+=A*Na,Oe+=A*Ra,A=F[8],_e+=A*be,Ze+=A*Wi,ct+=A*ur,Ht+=A*dr,Zt+=A*Ei,nn+=A*hr,ln+=A*tr,Wt+=A*Ks,on+=A*Mr,It+=A*ds,Ct+=A*Gs,Rt+=A*Ys,qt+=A*Ho,Ye+=A*Aa,Oe+=A*Na,mt+=A*Ra,A=F[9],Ze+=A*be,ct+=A*Wi,Ht+=A*ur,Zt+=A*dr,nn+=A*Ei,ln+=A*hr,Wt+=A*tr,on+=A*Ks,It+=A*Mr,Ct+=A*ds,Rt+=A*Gs,qt+=A*Ys,Ye+=A*Ho,Oe+=A*Aa,mt+=A*Na,at+=A*Ra,A=F[10],ct+=A*be,Ht+=A*Wi,Zt+=A*ur,nn+=A*dr,ln+=A*Ei,Wt+=A*hr,on+=A*tr,It+=A*Ks,Ct+=A*Mr,Rt+=A*ds,qt+=A*Gs,Ye+=A*Ys,Oe+=A*Ho,mt+=A*Aa,at+=A*Na,lt+=A*Ra,A=F[11],Ht+=A*be,Zt+=A*Wi,nn+=A*ur,ln+=A*dr,Wt+=A*Ei,on+=A*hr,It+=A*tr,Ct+=A*Ks,Rt+=A*Mr,qt+=A*ds,Ye+=A*Gs,Oe+=A*Ys,mt+=A*Ho,at+=A*Aa,lt+=A*Na,kt+=A*Ra,A=F[12],Zt+=A*be,nn+=A*Wi,ln+=A*ur,Wt+=A*dr,on+=A*Ei,It+=A*hr,Ct+=A*tr,Rt+=A*Ks,qt+=A*Mr,Ye+=A*ds,Oe+=A*Gs,mt+=A*Ys,at+=A*Ho,lt+=A*Aa,kt+=A*Na,Mn+=A*Ra,A=F[13],nn+=A*be,ln+=A*Wi,Wt+=A*ur,on+=A*dr,It+=A*Ei,Ct+=A*hr,Rt+=A*tr,qt+=A*Ks,Ye+=A*Mr,Oe+=A*ds,mt+=A*Gs,at+=A*Ys,lt+=A*Ho,kt+=A*Aa,Mn+=A*Na,Si+=A*Ra,A=F[14],ln+=A*be,Wt+=A*Wi,on+=A*ur,It+=A*dr,Ct+=A*Ei,Rt+=A*hr,qt+=A*tr,Ye+=A*Ks,Oe+=A*Mr,mt+=A*ds,at+=A*Gs,lt+=A*Ys,kt+=A*Ho,Mn+=A*Aa,Si+=A*Na,ki+=A*Ra,A=F[15],Wt+=A*be,on+=A*Wi,It+=A*ur,Ct+=A*dr,Rt+=A*Ei,qt+=A*hr,Ye+=A*tr,Oe+=A*Ks,mt+=A*Mr,at+=A*ds,lt+=A*Gs,kt+=A*Ys,Mn+=A*Ho,Si+=A*Aa,ki+=A*Na,hi+=A*Ra,ge+=38*on,pe+=38*It,Ee+=38*Ct,Be+=38*Rt,ht+=38*qt,bt+=38*Ye,hn+=38*Oe,Fe+=38*mt,_e+=38*at,Ze+=38*lt,ct+=38*kt,Ht+=38*Mn,Zt+=38*Si,nn+=38*ki,ln+=38*hi,K=1,A=ge+K+65535,K=Math.floor(A/65536),ge=A-K*65536,A=pe+K+65535,K=Math.floor(A/65536),pe=A-K*65536,A=Ee+K+65535,K=Math.floor(A/65536),Ee=A-K*65536,A=Be+K+65535,K=Math.floor(A/65536),Be=A-K*65536,A=ht+K+65535,K=Math.floor(A/65536),ht=A-K*65536,A=bt+K+65535,K=Math.floor(A/65536),bt=A-K*65536,A=hn+K+65535,K=Math.floor(A/65536),hn=A-K*65536,A=Fe+K+65535,K=Math.floor(A/65536),Fe=A-K*65536,A=_e+K+65535,K=Math.floor(A/65536),_e=A-K*65536,A=Ze+K+65535,K=Math.floor(A/65536),Ze=A-K*65536,A=ct+K+65535,K=Math.floor(A/65536),ct=A-K*65536,A=Ht+K+65535,K=Math.floor(A/65536),Ht=A-K*65536,A=Zt+K+65535,K=Math.floor(A/65536),Zt=A-K*65536,A=nn+K+65535,K=Math.floor(A/65536),nn=A-K*65536,A=ln+K+65535,K=Math.floor(A/65536),ln=A-K*65536,A=Wt+K+65535,K=Math.floor(A/65536),Wt=A-K*65536,ge+=K-1+37*(K-1),K=1,A=ge+K+65535,K=Math.floor(A/65536),ge=A-K*65536,A=pe+K+65535,K=Math.floor(A/65536),pe=A-K*65536,A=Ee+K+65535,K=Math.floor(A/65536),Ee=A-K*65536,A=Be+K+65535,K=Math.floor(A/65536),Be=A-K*65536,A=ht+K+65535,K=Math.floor(A/65536),ht=A-K*65536,A=bt+K+65535,K=Math.floor(A/65536),bt=A-K*65536,A=hn+K+65535,K=Math.floor(A/65536),hn=A-K*65536,A=Fe+K+65535,K=Math.floor(A/65536),Fe=A-K*65536,A=_e+K+65535,K=Math.floor(A/65536),_e=A-K*65536,A=Ze+K+65535,K=Math.floor(A/65536),Ze=A-K*65536,A=ct+K+65535,K=Math.floor(A/65536),ct=A-K*65536,A=Ht+K+65535,K=Math.floor(A/65536),Ht=A-K*65536,A=Zt+K+65535,K=Math.floor(A/65536),Zt=A-K*65536,A=nn+K+65535,K=Math.floor(A/65536),nn=A-K*65536,A=ln+K+65535,K=Math.floor(A/65536),ln=A-K*65536,A=Wt+K+65535,K=Math.floor(A/65536),Wt=A-K*65536,ge+=K-1+37*(K-1),N[0]=ge,N[1]=pe,N[2]=Ee,N[3]=Be,N[4]=ht,N[5]=bt,N[6]=hn,N[7]=Fe,N[8]=_e,N[9]=Ze,N[10]=ct,N[11]=Ht,N[12]=Zt,N[13]=nn,N[14]=ln,N[15]=Wt}function Me(N,F){xe(N,F,F)}function Re(N,F){var V=t(),A;for(A=0;A<16;A++)V[A]=F[A];for(A=253;A>=0;A--)Me(V,V),A!==2&&A!==4&&xe(V,V,F);for(A=0;A<16;A++)N[A]=V[A]}function _t(N,F){var V=t(),A;for(A=0;A<16;A++)V[A]=F[A];for(A=250;A>=0;A--)Me(V,V),A!==1&&xe(V,V,F);for(A=0;A<16;A++)N[A]=V[A]}function Qe(N,F,V){var A=new Uint8Array(32),K=new Float64Array(80),ge,pe,Ee=t(),Be=t(),ht=t(),bt=t(),hn=t(),Fe=t();for(pe=0;pe<31;pe++)A[pe]=F[pe];for(A[31]=F[31]&127|64,A[0]&=248,ue(K,V),pe=0;pe<16;pe++)Be[pe]=K[pe],bt[pe]=Ee[pe]=ht[pe]=0;for(Ee[0]=bt[0]=1,pe=254;pe>=0;--pe)ge=A[pe>>>3]>>>(pe&7)&1,Z(Ee,Be,ge),Z(ht,bt,ge),de(hn,Ee,ht),we(Ee,Ee,ht),de(ht,Be,bt),we(Be,Be,bt),Me(bt,hn),Me(Fe,Ee),xe(Ee,ht,Ee),xe(ht,Be,hn),de(hn,Ee,ht),we(Ee,Ee,ht),Me(Be,Ee),we(ht,bt,Fe),xe(Ee,ht,l),de(Ee,Ee,bt),xe(ht,ht,Ee),xe(Ee,bt,Fe),xe(bt,Be,K),Me(Be,hn),Z(Ee,Be,ge),Z(ht,bt,ge);for(pe=0;pe<16;pe++)K[pe+16]=Ee[pe],K[pe+32]=ht[pe],K[pe+48]=Be[pe],K[pe+64]=bt[pe];var _e=K.subarray(32),Ze=K.subarray(16);return Re(_e,_e),xe(Ze,Ze,_e),j(N,Ze),0}function pt(N,F){return Qe(N,F,s)}function gt(N,F){return i(F,32),pt(N,F)}function Ue(N,F,V){var A=new Uint8Array(32);return Qe(A,V,F),x(N,r,A,k)}var wn=W,Xt=z;function jn(N,F,V,A,K,ge){var pe=new Uint8Array(32);return Ue(pe,K,ge),wn(N,F,V,A,pe)}function ji(N,F,V,A,K,ge){var pe=new Uint8Array(32);return Ue(pe,K,ge),Xt(N,F,V,A,pe)}var ci=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ye(N,F,V,A){for(var K=new Int32Array(16),ge=new Int32Array(16),pe,Ee,Be,ht,bt,hn,Fe,_e,Ze,ct,Ht,Zt,nn,ln,Wt,on,It,Ct,Rt,qt,Ye,Oe,mt,at,lt,kt,Mn=N[0],Si=N[1],ki=N[2],hi=N[3],be=N[4],Wi=N[5],ur=N[6],dr=N[7],Ei=F[0],hr=F[1],tr=F[2],Ks=F[3],Mr=F[4],ds=F[5],Gs=F[6],Ys=F[7],Ho=0;A>=128;){for(Rt=0;Rt<16;Rt++)qt=8*Rt+Ho,K[Rt]=V[qt+0]<<24|V[qt+1]<<16|V[qt+2]<<8|V[qt+3],ge[Rt]=V[qt+4]<<24|V[qt+5]<<16|V[qt+6]<<8|V[qt+7];for(Rt=0;Rt<80;Rt++)if(pe=Mn,Ee=Si,Be=ki,ht=hi,bt=be,hn=Wi,Fe=ur,_e=dr,Ze=Ei,ct=hr,Ht=tr,Zt=Ks,nn=Mr,ln=ds,Wt=Gs,on=Ys,Ye=dr,Oe=Ys,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=(be>>>14|Mr<<18)^(be>>>18|Mr<<14)^(Mr>>>9|be<<23),Oe=(Mr>>>14|be<<18)^(Mr>>>18|be<<14)^(be>>>9|Mr<<23),mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,Ye=be&Wi^~be&ur,Oe=Mr&ds^~Mr&Gs,mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,Ye=ci[Rt*2],Oe=ci[Rt*2+1],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,Ye=K[Rt%16],Oe=ge[Rt%16],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,It=lt&65535|kt<<16,Ct=mt&65535|at<<16,Ye=It,Oe=Ct,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=(Mn>>>28|Ei<<4)^(Ei>>>2|Mn<<30)^(Ei>>>7|Mn<<25),Oe=(Ei>>>28|Mn<<4)^(Mn>>>2|Ei<<30)^(Mn>>>7|Ei<<25),mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,Ye=Mn&Si^Mn&ki^Si&ki,Oe=Ei&hr^Ei&tr^hr&tr,mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,_e=lt&65535|kt<<16,on=mt&65535|at<<16,Ye=ht,Oe=Zt,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=It,Oe=Ct,mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,ht=lt&65535|kt<<16,Zt=mt&65535|at<<16,Si=pe,ki=Ee,hi=Be,be=ht,Wi=bt,ur=hn,dr=Fe,Mn=_e,hr=Ze,tr=ct,Ks=Ht,Mr=Zt,ds=nn,Gs=ln,Ys=Wt,Ei=on,Rt%16===15)for(qt=0;qt<16;qt++)Ye=K[qt],Oe=ge[qt],mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=K[(qt+9)%16],Oe=ge[(qt+9)%16],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,It=K[(qt+1)%16],Ct=ge[(qt+1)%16],Ye=(It>>>1|Ct<<31)^(It>>>8|Ct<<24)^It>>>7,Oe=(Ct>>>1|It<<31)^(Ct>>>8|It<<24)^(Ct>>>7|It<<25),mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,It=K[(qt+14)%16],Ct=ge[(qt+14)%16],Ye=(It>>>19|Ct<<13)^(Ct>>>29|It<<3)^It>>>6,Oe=(Ct>>>19|It<<13)^(It>>>29|Ct<<3)^(Ct>>>6|It<<26),mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,K[qt]=lt&65535|kt<<16,ge[qt]=mt&65535|at<<16;Ye=Mn,Oe=Ei,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[0],Oe=F[0],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[0]=Mn=lt&65535|kt<<16,F[0]=Ei=mt&65535|at<<16,Ye=Si,Oe=hr,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[1],Oe=F[1],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[1]=Si=lt&65535|kt<<16,F[1]=hr=mt&65535|at<<16,Ye=ki,Oe=tr,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[2],Oe=F[2],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[2]=ki=lt&65535|kt<<16,F[2]=tr=mt&65535|at<<16,Ye=hi,Oe=Ks,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[3],Oe=F[3],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[3]=hi=lt&65535|kt<<16,F[3]=Ks=mt&65535|at<<16,Ye=be,Oe=Mr,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[4],Oe=F[4],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[4]=be=lt&65535|kt<<16,F[4]=Mr=mt&65535|at<<16,Ye=Wi,Oe=ds,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[5],Oe=F[5],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[5]=Wi=lt&65535|kt<<16,F[5]=ds=mt&65535|at<<16,Ye=ur,Oe=Gs,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[6],Oe=F[6],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[6]=ur=lt&65535|kt<<16,F[6]=Gs=mt&65535|at<<16,Ye=dr,Oe=Ys,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[7],Oe=F[7],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[7]=dr=lt&65535|kt<<16,F[7]=Ys=mt&65535|at<<16,Ho+=128,A-=128}return A}function Ie(N,F,V){var A=new Int32Array(8),K=new Int32Array(8),ge=new Uint8Array(256),pe,Ee=V;for(A[0]=1779033703,A[1]=3144134277,A[2]=1013904242,A[3]=2773480762,A[4]=1359893119,A[5]=2600822924,A[6]=528734635,A[7]=1541459225,K[0]=4089235720,K[1]=2227873595,K[2]=4271175723,K[3]=1595750129,K[4]=2917565137,K[5]=725511199,K[6]=4215389547,K[7]=327033209,ye(A,K,F,V),V%=128,pe=0;pe=0;--K)A=V[K/8|0]>>(K&7)&1,wt(N,F,A),Ve(F,N),Ve(N,N),wt(N,F,A)}function $t(N,F){var V=[t(),t(),t(),t()];q(V[0],d),q(V[1],h),q(V[2],a),xe(V[3],d,h),nt(N,V,F)}function an(N,F,V){var A=new Uint8Array(64),K=[t(),t(),t(),t()],ge;for(V||i(F,32),Ie(A,F,32),A[0]&=248,A[31]&=127,A[31]|=64,$t(K,A),vt(N,K),ge=0;ge<32;ge++)F[ge+32]=N[ge];return 0}var Pi=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Xn(N,F){var V,A,K,ge;for(A=63;A>=32;--A){for(V=0,K=A-32,ge=A-12;K>4)*Pi[K],V=F[K]>>8,F[K]&=255;for(K=0;K<32;K++)F[K]-=V*Pi[K];for(A=0;A<32;A++)F[A+1]+=F[A]>>8,N[A]=F[A]&255}function Qi(N){var F=new Float64Array(64),V;for(V=0;V<64;V++)F[V]=N[V];for(V=0;V<64;V++)N[V]=0;Xn(N,F)}function qs(N,F,V,A){var K=new Uint8Array(64),ge=new Uint8Array(64),pe=new Uint8Array(64),Ee,Be,ht=new Float64Array(64),bt=[t(),t(),t(),t()];Ie(K,A,32),K[0]&=248,K[31]&=127,K[31]|=64;var hn=V+64;for(Ee=0;Ee>7&&we(N[0],o,N[0]),xe(N[3],N[0],N[1]),0)}function Or(N,F,V,A){var K,ge=new Uint8Array(32),pe=new Uint8Array(64),Ee=[t(),t(),t(),t()],Be=[t(),t(),t(),t()];if(V<64||Pr(Be,A))return-1;for(K=0;K=0},e.sign.keyPair=function(){var N=new Uint8Array(Yi),F=new Uint8Array(Wn);return an(N,F),{publicKey:N,secretKey:F}},e.sign.keyPair.fromSecretKey=function(N){if(Y(N),N.length!==Wn)throw new Error("bad secret key size");for(var F=new Uint8Array(Yi),V=0;V"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(i){return Buffer.from(i).toString("base64")},e.decodeBase64=function(i){return t(i),new Uint8Array(Array.prototype.slice.call(Buffer.from(i,"base64"),0))}):(e.encodeBase64=function(i){return new Buffer(i).toString("base64")},e.decodeBase64=function(i){return t(i),new Uint8Array(Array.prototype.slice.call(new Buffer(i,"base64"),0))}):(e.encodeBase64=function(i){var r,s=[],o=i.length;for(r=0;r{let t=!1;const i=n.map(r=>{const s=_Ne(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r{const{scope:h,children:f,...g}=d,p=h?.[n]?.[l]||a,m=E.useMemo(()=>g,Object.values(g));return ae.jsx(p.Provider,{value:m,children:f})};c.displayName=s+"Provider";function u(d,h){const f=h?.[n]?.[l]||a,g=E.useContext(f);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const r=()=>{const s=t.map(o=>E.createContext(o));return function(a){const l=a?.[n]||s;return E.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return r.scopeName=n,[i,lFn(r,...e)]}function lFn(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const i=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function vNe(n,e,{checkForDefaultPrevented:t=!0}={}){return function(r){if(n?.(r),t===!1||!r.defaultPrevented)return e?.(r)}}var cFn=globalThis?.document?E.useLayoutEffect:()=>{},uFn=JB[" useInsertionEffect ".trim().toString()]||cFn;function dFn({prop:n,defaultProp:e,onChange:t=()=>{},caller:i}){const[r,s,o]=hFn({defaultProp:e,onChange:t}),a=n!==void 0,l=a?n:r;{const u=E.useRef(n!==void 0);E.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${i} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,i])}const c=E.useCallback(u=>{if(a){const d=fFn(u)?u(n):u;d!==n&&o.current?.(d)}else s(u)},[a,n,s,o]);return[l,c]}function hFn({defaultProp:n,onChange:e}){const[t,i]=E.useState(n),r=E.useRef(t),s=E.useRef(e);return uFn(()=>{s.current=e},[e]),E.useEffect(()=>{r.current!==t&&(s.current?.(t),r.current=t)},[t,r]),[t,i,s]}function fFn(n){return typeof n=="function"}function gFn(n){const e=E.useRef({value:n,previous:n});return E.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}var pFn=globalThis?.document?E.useLayoutEffect:()=>{};function mFn(n){const[e,t]=E.useState(void 0);return pFn(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else t(void 0)},[n]),e}function bNe(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function _Fn(...n){return e=>{let t=!1;const i=n.map(r=>{const s=bNe(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r{};function bFn(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var pZe=n=>{const{present:e,children:t}=n,i=yFn(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=vFn(i.ref,wFn(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};pZe.displayName="Presence";function yFn(n){const[e,t]=E.useState(),i=E.useRef(null),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=bFn(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=mF(i.current);s.current=a==="mounted"?c:"none"},[a]),yNe(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=mF(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),yNe(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=mF(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=mF(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{i.current=c?getComputedStyle(c):null,t(c)},[])}}function mF(n){return n?.animationName||"none"}function wFn(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var CFn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fge=CFn.reduce((n,e)=>{const t=eOe(`Primitive.${e}`),i=E.forwardRef((r,s)=>{const{asChild:o,...a}=r,l=o?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),ae.jsx(l,{...a,ref:s})});return i.displayName=`Primitive.${e}`,{...n,[e]:i}},{}),oz="Checkbox",[xFn,rzn]=aFn(oz),[SFn,Bge]=xFn(oz);function kFn(n){const{__scopeCheckbox:e,checked:t,children:i,defaultChecked:r,disabled:s,form:o,name:a,onCheckedChange:l,required:c,value:u="on",internal_do_not_use_render:d}=n,[h,f]=dFn({prop:t,defaultProp:r??!1,onChange:l,caller:oz}),[g,p]=E.useState(null),[m,_]=E.useState(null),v=E.useRef(!1),y=g?!!o||!!g.closest("form"):!0,C={checked:h,disabled:s,setChecked:f,control:g,setControl:p,name:a,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:c,defaultChecked:hb(r)?!1:r,isFormControl:y,bubbleInput:m,setBubbleInput:_};return ae.jsx(SFn,{scope:e,...C,children:TFn(d)?d(C):i})}var mZe="CheckboxTrigger",_Ze=E.forwardRef(({__scopeCheckbox:n,onKeyDown:e,onClick:t,...i},r)=>{const{control:s,value:o,disabled:a,checked:l,required:c,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:f,bubbleInput:g}=Bge(mZe,n),p=gZe(r,u),m=E.useRef(l);return E.useEffect(()=>{const _=s?.form;if(_){const v=()=>d(m.current);return _.addEventListener("reset",v),()=>_.removeEventListener("reset",v)}},[s,d]),ae.jsx(Fge.button,{type:"button",role:"checkbox","aria-checked":hb(l)?"mixed":l,"aria-required":c,"data-state":wZe(l),"data-disabled":a?"":void 0,disabled:a,value:o,...i,ref:p,onKeyDown:vNe(e,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:vNe(t,_=>{d(v=>hb(v)?!0:!v),g&&f&&(h.current=_.isPropagationStopped(),h.current||_.stopPropagation())})})});_Ze.displayName=mZe;var EFn=E.forwardRef((n,e)=>{const{__scopeCheckbox:t,name:i,checked:r,defaultChecked:s,required:o,disabled:a,value:l,onCheckedChange:c,form:u,...d}=n;return ae.jsx(kFn,{__scopeCheckbox:t,checked:r,defaultChecked:s,disabled:a,required:o,onCheckedChange:c,name:i,form:u,value:l,internal_do_not_use_render:({isFormControl:h})=>ae.jsxs(ae.Fragment,{children:[ae.jsx(_Ze,{...d,ref:e,__scopeCheckbox:t}),h&&ae.jsx(yZe,{__scopeCheckbox:t})]})})});EFn.displayName=oz;var vZe="CheckboxIndicator",LFn=E.forwardRef((n,e)=>{const{__scopeCheckbox:t,forceMount:i,...r}=n,s=Bge(vZe,t);return ae.jsx(pZe,{present:i||hb(s.checked)||s.checked===!0,children:ae.jsx(Fge.span,{"data-state":wZe(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e,style:{pointerEvents:"none",...n.style}})})});LFn.displayName=vZe;var bZe="CheckboxBubbleInput",yZe=E.forwardRef(({__scopeCheckbox:n,...e},t)=>{const{control:i,hasConsumerStoppedPropagationRef:r,checked:s,defaultChecked:o,required:a,disabled:l,name:c,value:u,form:d,bubbleInput:h,setBubbleInput:f}=Bge(bZe,n),g=gZe(t,f),p=gFn(s),m=mFn(i);E.useEffect(()=>{const v=h;if(!v)return;const y=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(y,"checked").set,k=!r.current;if(p!==s&&x){const L=new Event("click",{bubbles:k});v.indeterminate=hb(s),x.call(v,hb(s)?!1:s),v.dispatchEvent(L)}},[h,p,s,r]);const _=E.useRef(hb(s)?!1:s);return ae.jsx(Fge.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??_.current,required:a,disabled:l,name:c,value:u,form:d,...e,tabIndex:-1,ref:g,style:{...e.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});yZe.displayName=bZe;function TFn(n){return typeof n=="function"}function hb(n){return n==="indeterminate"}function wZe(n){return hb(n)?"indeterminate":n?"checked":"unchecked"}export{uQt as $,AFn as A,c$n as B,C5n as C,u$n as D,l$n as E,w5n as F,yu as G,BVt as H,i5n as I,L5n as J,Xme as K,N5n as L,U as M,F5n as N,IFn as O,OFn as P,O5n as Q,y5n as R,BFn as S,R5n as T,NFn as U,z5n as V,e5n as W,JFn as X,MFn as Y,oQt as Z,cQt as _,$Fn as a,QHn as a$,pHe as a0,iWn as a1,dQt as a2,hQt as a3,aQt as a4,lQt as a5,IWn as a6,eWn as a7,AWn as a8,wWn as a9,HFn as aA,CHn as aB,XFn as aC,l5n as aD,YFn as aE,t5n as aF,d5n as aG,u5n as aH,r5n as aI,c5n as aJ,jFn as aK,zFn as aL,QFn as aM,n5n as aN,v5n as aO,_5n as aP,p5n as aQ,b5n as aR,o5n as aS,KFn as aT,GHn as aU,cWn as aV,IHn as aW,a5n as aX,f5n as aY,ZHn as aZ,XHn as a_,CWn as aa,kWn as ab,EWn as ac,TWn as ad,Z$n as ae,LWn as af,sWn as ag,SWn as ah,DWn as ai,bWn as aj,yWn as ak,xWn as al,mWn as am,pWn as an,GFn as ao,RWn as ap,Zen as aq,Xen as ar,OWn as as,$Wn as at,MWn as au,FWn as av,RFn as aw,qFn as ax,ZFn as ay,h5n as az,nat as b,WVn as b$,FFn as b0,nVn as b1,rVn as b2,iVn as b3,sVn as b4,Q$n as b5,gVn as b6,tWn as b7,pVn as b8,oVn as b9,VC as bA,B2 as bB,bVn as bC,HWn as bD,jWn as bE,yHn as bF,qWn as bG,UHn as bH,HHn as bI,lHn as bJ,$Hn as bK,LVn as bL,TVn as bM,DVn as bN,NNn as bO,BNn as bP,wHn as bQ,WWn as bR,UWn as bS,VWn as bT,vVn as bU,Kfe as bV,AVn as bW,NVn as bX,oWn as bY,J$n as bZ,aWn as b_,aVn as ba,lVn as bb,uVn as bc,dVn as bd,fVn as be,hVn as bf,mVn as bg,cVn as bh,mAn as bi,yVn as bj,ZWn as bk,XWn as bl,YWn as bm,SVn as bn,kVn as bo,CVn as bp,xVn as bq,_Vn as br,zDn as bs,KWn as bt,JHn as bu,eVn as bv,Ufe as bw,jfe as bx,dLn as by,Gm as bz,mr as c,xHn as c$,dHn as c0,HVn as c1,bHn as c2,MHn as c3,DHn as c4,aHn as c5,hHn as c6,FHn as c7,vHn as c8,WHn as c9,YVn as cA,lWn as cB,dWn as cC,FVn as cD,$Vn as cE,rut as cF,uut as cG,Jct as cH,ks as cI,PHn as cJ,NHn as cK,EHn as cL,_Hn as cM,jHn as cN,Rg as cO,Wo as cP,pHn as cQ,OVn as cR,MVn as cS,hWn as cT,iC as cU,BWn as cV,nzn as cW,izn as cX,AHn as cY,iHn as cZ,cHn as c_,nHn as ca,RVn as cb,PVn as cc,BVn as cd,JWn as ce,QWn as cf,UFn as cg,m5n as ch,s5n as ci,VFn as cj,g5n as ck,zVn as cl,UVn as cm,LHn as cn,SHn as co,jVn as cp,eHn as cq,zWn as cr,ZVn as cs,XVn as ct,ezn as cu,tzn as cv,QVn as cw,JVn as cx,KVn as cy,GVn as cz,PP as d,oHn as d0,RHn as d1,gHn as d2,VHn as d3,EFn as d4,LFn as d5,nWn as d6,gWn as d7,X$n as d8,rWn as d9,fWn as da,uHn as db,PFn as dc,x5n as dd,BHn as de,uVe as df,uWn as dg,tHn as dh,GWn as di,kHn as dj,THn as dk,rHn as dl,SNn as dm,mHn as dn,zHn as dp,OHn as dq,fHn as dr,qHn as ds,sHn as dt,D5n as e,v$ as f,P5n as g,A5n as h,W5n as i,ae as j,H5n as k,Ga as l,V5n as m,e4e as n,a$n as o,T5n as p,S5n as q,E as r,k5n as s,WFn as t,qPe as u,B5n as v,$5n as w,U5n as x,j5n as y,E5n as z}; +`),e=e.replace(f4n,"�"),n.src=e}function p4n(n){let e;n.inlineMode?(e=new n.Token("inline","",0),e.content=n.src,e.map=[0,1],e.children=[],n.tokens.push(e)):n.md.block.parse(n.src,n.md,n.env,n.tokens)}function m4n(n){const e=n.tokens;for(let t=0,i=e.length;t\s]/i.test(n)}function v4n(n){return/^<\/a\s*>/i.test(n)}function b4n(n){const e=n.tokens;if(n.md.options.linkify)for(let t=0,i=e.length;t=0;o--){const a=r[o];if(a.type==="link_close"){for(o--;r[o].level!==a.level&&r[o].type!=="link_open";)o--;continue}if(a.type==="html_inline"&&(_4n(a.content)&&s>0&&s--,v4n(a.content)&&s++),!(s>0)&&a.type==="text"&&n.md.linkify.test(a.content)){const l=a.content;let c=n.md.linkify.match(l);const u=[];let d=a.level,h=0;c.length>0&&c[0].index===0&&o>0&&r[o-1].type==="text_special"&&(c=c.slice(1));for(let f=0;fh){const x=new n.Token("text","",0);x.content=l.slice(h,_),x.level=d,u.push(x)}const v=new n.Token("link_open","a",1);v.attrs=[["href",p]],v.level=d++,v.markup="linkify",v.info="auto",u.push(v);const y=new n.Token("text","",0);y.content=m,y.level=d,u.push(y);const C=new n.Token("link_close","a",-1);C.level=--d,C.markup="linkify",C.info="auto",u.push(C),h=c[f].lastIndex}if(h=0;t--){const i=n[t];i.type==="text"&&!e&&(i.content=i.content.replace(w4n,x4n)),i.type==="link_open"&&i.info==="auto"&&e--,i.type==="link_close"&&i.info==="auto"&&e++}}function k4n(n){let e=0;for(let t=n.length-1;t>=0;t--){const i=n[t];i.type==="text"&&!e&&ZYe.test(i.content)&&(i.content=i.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),i.type==="link_open"&&i.info==="auto"&&e--,i.type==="link_close"&&i.info==="auto"&&e++}}function E4n(n){let e;if(n.md.options.typographer)for(e=n.tokens.length-1;e>=0;e--)n.tokens[e].type==="inline"&&(y4n.test(n.tokens[e].content)&&S4n(n.tokens[e].children),ZYe.test(n.tokens[e].content)&&k4n(n.tokens[e].children))}const L4n=/['"]/,oNe=/['"]/g,aNe="’";function g5(n,e,t){return n.slice(0,e)+t+n.slice(e+1)}function T4n(n,e){let t;const i=[];for(let r=0;r=0&&!(i[t].level<=o);t--);if(i.length=t+1,s.type!=="text")continue;let a=s.content,l=0,c=a.length;e:for(;l=0)g=a.charCodeAt(u.index-1);else for(t=r-1;t>=0&&!(n[t].type==="softbreak"||n[t].type==="hardbreak");t--)if(n[t].content){g=n[t].content.charCodeAt(n[t].content.length-1);break}let p=32;if(l=48&&g<=57&&(h=d=!1),d&&h&&(d=m,h=_),!d&&!h){f&&(s.content=g5(s.content,u.index,aNe));continue}if(h)for(t=i.length-1;t>=0;t--){let C=i[t];if(i[t].level=0;e--)n.tokens[e].type!=="inline"||!L4n.test(n.tokens[e].content)||T4n(n.tokens[e].children,n)}function I4n(n){let e,t;const i=n.tokens,r=i.length;for(let s=0;s0&&this.level++,this.tokens.push(i),i};vm.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};vm.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;et;)if(!Us(this.src.charCodeAt(--e)))return e+1;return e};vm.prototype.skipChars=function(e,t){for(let i=this.src.length;ei;)if(t!==this.src.charCodeAt(--e))return e+1;return e};vm.prototype.getLines=function(e,t,i,r){if(e>=t)return"";const s=new Array(t-e);for(let o=0,a=e;ai?s[o]=new Array(l-i+1).join(" ")+this.src.slice(u,d):s[o]=this.src.slice(u,d)}return s.join("")};vm.prototype.Token=zg;const A4n=65536;function DG(n,e){const t=n.bMarks[e]+n.tShift[e],i=n.eMarks[e];return n.src.slice(t,i)}function lNe(n){const e=[],t=n.length;let i=0,r=n.charCodeAt(i),s=!1,o=0,a="";for(;it)return!1;let r=e+1;if(n.sCount[r]=4)return!1;let s=n.bMarks[r]+n.tShift[r];if(s>=n.eMarks[r])return!1;const o=n.src.charCodeAt(s++);if(o!==124&&o!==45&&o!==58||s>=n.eMarks[r])return!1;const a=n.src.charCodeAt(s++);if(a!==124&&a!==45&&a!==58&&!Us(a)||o===45&&Us(a))return!1;for(;s=4)return!1;c=lNe(l),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop();const d=c.length;if(d===0||d!==u.length)return!1;if(i)return!0;const h=n.parentType;n.parentType="table";const f=n.md.block.ruler.getRules("blockquote"),g=n.push("table_open","table",1),p=[e,0];g.map=p;const m=n.push("thead_open","thead",1);m.map=[e,e+1];const _=n.push("tr_open","tr",1);_.map=[e,e+1];for(let C=0;C=4||(c=lNe(l),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop(),y+=d-c.length,y>A4n))break;if(r===e+2){const k=n.push("tbody_open","tbody",1);k.map=v=[e+2,0]}const x=n.push("tr_open","tr",1);x.map=[r,r+1];for(let k=0;k=4){i++,r=i;continue}break}n.line=r;const s=n.push("code_block","code",0);return s.content=n.getLines(e,r,4+n.blkIndent,!1)+` +`,s.map=[e,n.line],!0}function P4n(n,e,t,i){let r=n.bMarks[e]+n.tShift[e],s=n.eMarks[e];if(n.sCount[e]-n.blkIndent>=4||r+3>s)return!1;const o=n.src.charCodeAt(r);if(o!==126&&o!==96)return!1;let a=r;r=n.skipChars(r,o);let l=r-a;if(l<3)return!1;const c=n.src.slice(a,r),u=n.src.slice(r,s);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(i)return!0;let d=e,h=!1;for(;d++,!(d>=t||(r=a=n.bMarks[d]+n.tShift[d],s=n.eMarks[d],r=4)&&(r=n.skipChars(r,o),!(r-a=4||n.src.charCodeAt(r)!==62)return!1;if(i)return!0;const a=[],l=[],c=[],u=[],d=n.md.block.ruler.getRules("blockquote"),h=n.parentType;n.parentType="blockquote";let f=!1,g;for(g=e;g=s)break;if(n.src.charCodeAt(r++)===62&&!y){let x=n.sCount[g]+1,k,L;n.src.charCodeAt(r)===32?(r++,x++,L=!1,k=!0):n.src.charCodeAt(r)===9?(k=!0,(n.bsCount[g]+x)%4===3?(r++,x++,L=!1):L=!0):k=!1;let D=x;for(a.push(n.bMarks[g]),n.bMarks[g]=r;r=s,l.push(n.bsCount[g]),n.bsCount[g]=n.sCount[g]+1+(k?1:0),c.push(n.sCount[g]),n.sCount[g]=D-x,u.push(n.tShift[g]),n.tShift[g]=r-n.bMarks[g];continue}if(f)break;let C=!1;for(let x=0,k=d.length;x";const _=[e,0];m.map=_,n.md.block.tokenize(n,e,g);const v=n.push("blockquote_close","blockquote",-1);v.markup=">",n.lineMax=o,n.parentType=h,_[1]=n.line;for(let y=0;y=4)return!1;let s=n.bMarks[e]+n.tShift[e];const o=n.src.charCodeAt(s++);if(o!==42&&o!==45&&o!==95)return!1;let a=1;for(;s=i)return-1;let s=n.src.charCodeAt(r++);if(s<48||s>57)return-1;for(;;){if(r>=i)return-1;if(s=n.src.charCodeAt(r++),s>=48&&s<=57){if(r-t>=10)return-1;continue}if(s===41||s===46)break;return-1}return r=4||n.listIndent>=0&&n.sCount[l]-n.listIndent>=4&&n.sCount[l]=n.blkIndent&&(u=!0);let d,h,f;if((f=uNe(n,l))>=0){if(d=!0,o=n.bMarks[l]+n.tShift[l],h=Number(n.src.slice(o,f-1)),u&&h!==1)return!1}else if((f=cNe(n,l))>=0)d=!1;else return!1;if(u&&n.skipSpaces(f)>=n.eMarks[l])return!1;if(i)return!0;const g=n.src.charCodeAt(f-1),p=n.tokens.length;d?(a=n.push("ordered_list_open","ol",1),h!==1&&(a.attrs=[["start",h]])):a=n.push("bullet_list_open","ul",1);const m=[l,0];a.map=m,a.markup=String.fromCharCode(g);let _=!1;const v=n.md.block.ruler.getRules("list"),y=n.parentType;for(n.parentType="list";l=r?L=1:L=x-C,L>4&&(L=1);const D=C+L;a=n.push("list_item_open","li",1),a.markup=String.fromCharCode(g);const I=[l,0];a.map=I,d&&(a.info=n.src.slice(o,f-1));const O=n.tight,M=n.tShift[l],B=n.sCount[l],G=n.listIndent;if(n.listIndent=n.blkIndent,n.blkIndent=D,n.tight=!0,n.tShift[l]=k-n.bMarks[l],n.sCount[l]=x,k>=r&&n.isEmpty(l+1)?n.line=Math.min(n.line+2,t):n.md.block.tokenize(n,l,t,!0),(!n.tight||_)&&(c=!1),_=n.line-l>1&&n.isEmpty(n.line-1),n.blkIndent=n.listIndent,n.listIndent=G,n.tShift[l]=M,n.sCount[l]=B,n.tight=O,a=n.push("list_item_close","li",-1),a.markup=String.fromCharCode(g),l=n.line,I[1]=l,l>=t||n.sCount[l]=4)break;let W=!1;for(let z=0,q=v.length;z=4||n.src.charCodeAt(r)!==91)return!1;function a(v){const y=n.lineMax;if(v>=y||n.isEmpty(v))return null;let C=!1;if(n.sCount[v]-n.blkIndent>3&&(C=!0),n.sCount[v]<0&&(C=!0),!C){const L=n.md.block.ruler.getRules("reference"),D=n.parentType;n.parentType="reference";let I=!1;for(let O=0,M=L.length;O"u"&&(n.env.references={}),typeof n.env.references[_]>"u"&&(n.env.references[_]={title:m,href:d}),n.line=o),!0):!1}const W4n=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],H4n="[a-zA-Z_:][a-zA-Z0-9:._-]*",V4n="[^\"'=<>`\\x00-\\x20]+",z4n="'[^']*'",U4n='"[^"]*"',j4n="(?:"+V4n+"|"+z4n+"|"+U4n+")",q4n="(?:\\s+"+H4n+"(?:\\s*=\\s*"+j4n+")?)",XYe="<[A-Za-z][A-Za-z0-9\\-]*"+q4n+"*\\s*\\/?>",QYe="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",K4n="",G4n="<[?][\\s\\S]*?[?]>",Y4n="]*>",Z4n="",X4n=new RegExp("^(?:"+XYe+"|"+QYe+"|"+K4n+"|"+G4n+"|"+Y4n+"|"+Z4n+")"),Q4n=new RegExp("^(?:"+XYe+"|"+QYe+")"),qx=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(Q4n.source+"\\s*$"),/^$/,!1]];function J4n(n,e,t,i){let r=n.bMarks[e]+n.tShift[e],s=n.eMarks[e];if(n.sCount[e]-n.blkIndent>=4||!n.md.options.html||n.src.charCodeAt(r)!==60)return!1;let o=n.src.slice(r,s),a=0;for(;a=4)return!1;let o=n.src.charCodeAt(r);if(o!==35||r>=s)return!1;let a=1;for(o=n.src.charCodeAt(++r);o===35&&r6||rr&&Us(n.src.charCodeAt(l-1))&&(s=l),n.line=e+1;const c=n.push("heading_open","h"+String(a),1);c.markup="########".slice(0,a),c.map=[e,n.line];const u=n.push("inline","",0);u.content=n.src.slice(r,s).trim(),u.map=[e,n.line],u.children=[];const d=n.push("heading_close","h"+String(a),-1);return d.markup="########".slice(0,a),!0}function t3n(n,e,t){const i=n.md.block.ruler.getRules("paragraph");if(n.sCount[e]-n.blkIndent>=4)return!1;const r=n.parentType;n.parentType="paragraph";let s=0,o,a=e+1;for(;a3)continue;if(n.sCount[a]>=n.blkIndent){let f=n.bMarks[a]+n.tShift[a];const g=n.eMarks[a];if(f=g))){s=o===61?1:2;break}}if(n.sCount[a]<0)continue;let h=!1;for(let f=0,g=i.length;f3||n.sCount[s]<0)continue;let c=!1;for(let u=0,d=i.length;u=t||n.sCount[o]=s){n.line=t;break}const l=n.line;let c=!1;for(let u=0;u=n.line)throw new Error("block rule didn't increment state.line");break}if(!c)throw new Error("none of the block rules matched");n.tight=!a,n.isEmpty(n.line-1)&&(a=!0),o=n.line,o0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],r={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(i),this.tokens_meta.push(r),i};aM.prototype.scanDelims=function(n,e){const t=this.posMax,i=this.src.charCodeAt(n),r=n>0?this.src.charCodeAt(n-1):32;let s=n;for(;s0)return!1;const t=n.pos,i=n.posMax;if(t+3>i||n.src.charCodeAt(t)!==58||n.src.charCodeAt(t+1)!==47||n.src.charCodeAt(t+2)!==47)return!1;const r=n.pending.match(s3n);if(!r)return!1;const s=r[1],o=n.md.linkify.matchAtStart(n.src.slice(t-s.length));if(!o)return!1;let a=o.url;if(a.length<=s.length)return!1;a=a.replace(/\*+$/,"");const l=n.md.normalizeLink(a);if(!n.md.validateLink(l))return!1;if(!e){n.pending=n.pending.slice(0,-s.length);const c=n.push("link_open","a",1);c.attrs=[["href",l]],c.markup="linkify",c.info="auto";const u=n.push("text","",0);u.content=n.md.normalizeLinkText(a);const d=n.push("link_close","a",-1);d.markup="linkify",d.info="auto"}return n.pos+=a.length-s.length,!0}function a3n(n,e){let t=n.pos;if(n.src.charCodeAt(t)!==10)return!1;const i=n.pending.length-1,r=n.posMax;if(!e)if(i>=0&&n.pending.charCodeAt(i)===32)if(i>=1&&n.pending.charCodeAt(i-1)===32){let s=i-1;for(;s>=1&&n.pending.charCodeAt(s-1)===32;)s--;n.pending=n.pending.slice(0,s),n.push("hardbreak","br",0)}else n.pending=n.pending.slice(0,-1),n.push("softbreak","br",0);else n.push("softbreak","br",0);for(t++;t?@[]^_`{|}~-".split("").forEach(function(n){Oge[n.charCodeAt(0)]=1});function l3n(n,e){let t=n.pos;const i=n.posMax;if(n.src.charCodeAt(t)!==92||(t++,t>=i))return!1;let r=n.src.charCodeAt(t);if(r===10){for(e||n.push("hardbreak","br",0),t++;t=55296&&r<=56319&&t+1=56320&&a<=57343&&(s+=n.src[t+1],t++)}const o="\\"+s;if(!e){const a=n.push("text_special","",0);r<256&&Oge[r]!==0?a.content=s:a.content=o,a.markup=o,a.info="escape"}return n.pos=t+1,!0}function c3n(n,e){let t=n.pos;if(n.src.charCodeAt(t)!==96)return!1;const r=t;t++;const s=n.posMax;for(;t=0;i--){const r=e[i];if(r.marker!==95&&r.marker!==42||r.end===-1)continue;const s=e[r.end],o=i>0&&e[i-1].end===r.end+1&&e[i-1].marker===r.marker&&e[i-1].token===r.token-1&&e[r.end+1].token===s.token+1,a=String.fromCharCode(r.marker),l=n.tokens[r.token];l.type=o?"strong_open":"em_open",l.tag=o?"strong":"em",l.nesting=1,l.markup=o?a+a:a,l.content="";const c=n.tokens[s.token];c.type=o?"strong_close":"em_close",c.tag=o?"strong":"em",c.nesting=-1,c.markup=o?a+a:a,c.content="",o&&(n.tokens[e[i-1].token].content="",n.tokens[e[r.end+1].token].content="",i--)}}function f3n(n){const e=n.tokens_meta,t=n.tokens_meta.length;hNe(n,n.delimiters);for(let i=0;i=d)return!1;if(l=g,r=n.md.helpers.parseLinkDestination(n.src,g,n.posMax),r.ok){for(o=n.md.normalizeLink(r.str),n.md.validateLink(o)?g=r.pos:o="",l=g;g=d||n.src.charCodeAt(g)!==41)&&(c=!0),g++}if(c){if(typeof n.env.references>"u")return!1;if(g=0?i=n.src.slice(l,g++):g=f+1):g=f+1,i||(i=n.src.slice(h,f)),s=n.env.references[iz(i)],!s)return n.pos=u,!1;o=s.href,a=s.title}if(!e){n.pos=h,n.posMax=f;const p=n.push("link_open","a",1),m=[["href",o]];p.attrs=m,a&&m.push(["title",a]),n.linkLevel++,n.md.inline.tokenize(n),n.linkLevel--,n.push("link_close","a",-1)}return n.pos=g,n.posMax=d,!0}function p3n(n,e){let t,i,r,s,o,a,l,c,u="";const d=n.pos,h=n.posMax;if(n.src.charCodeAt(n.pos)!==33||n.src.charCodeAt(n.pos+1)!==91)return!1;const f=n.pos+2,g=n.md.helpers.parseLinkLabel(n,n.pos+1,!1);if(g<0)return!1;if(s=g+1,s=h)return!1;for(c=s,a=n.md.helpers.parseLinkDestination(n.src,s,n.posMax),a.ok&&(u=n.md.normalizeLink(a.str),n.md.validateLink(u)?s=a.pos:u=""),c=s;s=h||n.src.charCodeAt(s)!==41)return n.pos=d,!1;s++}else{if(typeof n.env.references>"u")return!1;if(s=0?r=n.src.slice(c,s++):s=g+1):s=g+1,r||(r=n.src.slice(f,g)),o=n.env.references[iz(r)],!o)return n.pos=d,!1;u=o.href,l=o.title}if(!e){i=n.src.slice(f,g);const p=[];n.md.inline.parse(i,n.md,n.env,p);const m=n.push("image","img",0),_=[["src",u],["alt",""]];m.attrs=_,m.children=p,m.content=i,l&&_.push(["title",l])}return n.pos=s,n.posMax=h,!0}const m3n=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,_3n=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function v3n(n,e){let t=n.pos;if(n.src.charCodeAt(t)!==60)return!1;const i=n.pos,r=n.posMax;for(;;){if(++t>=r)return!1;const o=n.src.charCodeAt(t);if(o===60)return!1;if(o===62)break}const s=n.src.slice(i+1,t);if(_3n.test(s)){const o=n.md.normalizeLink(s);if(!n.md.validateLink(o))return!1;if(!e){const a=n.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const l=n.push("text","",0);l.content=n.md.normalizeLinkText(s);const c=n.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return n.pos+=s.length+2,!0}if(m3n.test(s)){const o=n.md.normalizeLink("mailto:"+s);if(!n.md.validateLink(o))return!1;if(!e){const a=n.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const l=n.push("text","",0);l.content=n.md.normalizeLinkText(s);const c=n.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return n.pos+=s.length+2,!0}return!1}function b3n(n){return/^\s]/i.test(n)}function y3n(n){return/^<\/a\s*>/i.test(n)}function w3n(n){const e=n|32;return e>=97&&e<=122}function C3n(n,e){if(!n.md.options.html)return!1;const t=n.posMax,i=n.pos;if(n.src.charCodeAt(i)!==60||i+2>=t)return!1;const r=n.src.charCodeAt(i+1);if(r!==33&&r!==63&&r!==47&&!w3n(r))return!1;const s=n.src.slice(i).match(X4n);if(!s)return!1;if(!e){const o=n.push("html_inline","",0);o.content=s[0],b3n(o.content)&&n.linkLevel++,y3n(o.content)&&n.linkLevel--}return n.pos+=s[0].length,!0}const x3n=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,S3n=/^&([a-z][a-z0-9]{1,31});/i;function k3n(n,e){const t=n.pos,i=n.posMax;if(n.src.charCodeAt(t)!==38||t+1>=i)return!1;if(n.src.charCodeAt(t+1)===35){const s=n.src.slice(t).match(x3n);if(s){if(!e){const o=s[1][0].toLowerCase()==="x"?parseInt(s[1].slice(1),16):parseInt(s[1],10),a=n.push("text_special","",0);a.content=Rge(o)?ZB(o):ZB(65533),a.markup=s[0],a.info="entity"}return n.pos+=s[0].length,!0}}else{const s=n.src.slice(t).match(S3n);if(s){const o=qYe(s[0]);if(o!==s[0]){if(!e){const a=n.push("text_special","",0);a.content=o,a.markup=s[0],a.info="entity"}return n.pos+=s[0].length,!0}}}return!1}function fNe(n){const e={},t=n.length;if(!t)return;let i=0,r=-2;const s=[];for(let o=0;ol;c-=s[c]+1){const d=n[c];if(d.marker===a.marker&&d.open&&d.end<0){let h=!1;if((d.close||a.open)&&(d.length+a.length)%3===0&&(d.length%3!==0||a.length%3!==0)&&(h=!0),!h){const f=c>0&&!n[c-1].open?s[c-1]+1:0;s[o]=o-c+f,s[c]=f,a.open=!1,d.end=o,d.close=!1,u=-1,r=-2;break}}}u!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=u)}}function E3n(n){const e=n.tokens_meta,t=n.tokens_meta.length;fNe(n.delimiters);for(let i=0;i0&&i++,r[e].type==="text"&&e+1=n.pos)throw new Error("inline rule didn't increment state.pos");break}}else n.pos=n.posMax;o||n.pos++,s[e]=n.pos};lM.prototype.tokenize=function(n){const e=this.ruler.getRules(""),t=e.length,i=n.posMax,r=n.md.options.maxNesting;for(;n.pos=n.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(n.pos>=i)break;continue}n.pending+=n.src[n.pos++]}n.pending&&n.pushPending()};lM.prototype.parse=function(n,e,t,i){const r=new this.State(n,e,t,i);this.tokenize(r);const s=this.ruler2.getRules(""),o=s.length;for(let a=0;a|$))",e.tpl_email_fuzzy="(^|"+t+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function jse(n){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(i){n[i]=t[i]})}),n}function sz(n){return Object.prototype.toString.call(n)}function D3n(n){return sz(n)==="[object String]"}function I3n(n){return sz(n)==="[object Object]"}function A3n(n){return sz(n)==="[object RegExp]"}function gNe(n){return sz(n)==="[object Function]"}function N3n(n){return n.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const tZe={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function R3n(n){return Object.keys(n||{}).reduce(function(e,t){return e||tZe.hasOwnProperty(t)},!1)}const P3n={"http:":{validate:function(n,e,t){const i=n.slice(e);return t.re.http||(t.re.http=new RegExp("^\\/\\/"+t.re.src_auth+t.re.src_host_port_strict+t.re.src_path,"i")),t.re.http.test(i)?i.match(t.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(n,e,t){const i=n.slice(e);return t.re.no_http||(t.re.no_http=new RegExp("^"+t.re.src_auth+"(?:localhost|(?:(?:"+t.re.src_domain+")\\.)+"+t.re.src_domain_root+")"+t.re.src_port+t.re.src_host_terminator+t.re.src_path,"i")),t.re.no_http.test(i)?e>=3&&n[e-3]===":"||e>=3&&n[e-3]==="/"?0:i.match(t.re.no_http)[0].length:0}},"mailto:":{validate:function(n,e,t){const i=n.slice(e);return t.re.mailto||(t.re.mailto=new RegExp("^"+t.re.src_email_name+"@"+t.re.src_host_strict,"i")),t.re.mailto.test(i)?i.match(t.re.mailto)[0].length:0}}},O3n="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",M3n="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function F3n(n){n.__index__=-1,n.__text_cache__=""}function B3n(n){return function(e,t){const i=e.slice(t);return n.test(i)?i.match(n)[0].length:0}}function pNe(){return function(n,e){e.normalize(n)}}function XB(n){const e=n.re=T3n(n.__opts__),t=n.__tlds__.slice();n.onCompile(),n.__tlds_replaced__||t.push(O3n),t.push(e.src_xn),e.src_tlds=t.join("|");function i(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(i(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(i(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(i(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(i(e.tpl_host_fuzzy_test),"i");const r=[];n.__compiled__={};function s(a,l){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+l)}Object.keys(n.__schemas__).forEach(function(a){const l=n.__schemas__[a];if(l===null)return;const c={validate:null,link:null};if(n.__compiled__[a]=c,I3n(l)){A3n(l.validate)?c.validate=B3n(l.validate):gNe(l.validate)?c.validate=l.validate:s(a,l),gNe(l.normalize)?c.normalize=l.normalize:l.normalize?s(a,l):c.normalize=pNe();return}if(D3n(l)){r.push(a);return}s(a,l)}),r.forEach(function(a){n.__compiled__[n.__schemas__[a]]&&(n.__compiled__[a].validate=n.__compiled__[n.__schemas__[a]].validate,n.__compiled__[a].normalize=n.__compiled__[n.__schemas__[a]].normalize)}),n.__compiled__[""]={validate:null,normalize:pNe()};const o=Object.keys(n.__compiled__).filter(function(a){return a.length>0&&n.__compiled__[a]}).map(N3n).join("|");n.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","i"),n.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","ig"),n.re.schema_at_start=RegExp("^"+n.re.schema_search.source,"i"),n.re.pretest=RegExp("("+n.re.schema_test.source+")|("+n.re.host_fuzzy_test.source+")|@","i"),F3n(n)}function $3n(n,e){const t=n.__index__,i=n.__last_index__,r=n.__text_cache__.slice(t,i);this.schema=n.__schema__.toLowerCase(),this.index=t+e,this.lastIndex=i+e,this.raw=r,this.text=r,this.url=r}function qse(n,e){const t=new $3n(n,e);return n.__compiled__[t.schema].normalize(t,n),t}function ah(n,e){if(!(this instanceof ah))return new ah(n,e);e||R3n(n)&&(e=n,n={}),this.__opts__=jse({},tZe,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=jse({},P3n,n),this.__compiled__={},this.__tlds__=M3n,this.__tlds_replaced__=!1,this.re={},XB(this)}ah.prototype.add=function(e,t){return this.__schemas__[e]=t,XB(this),this};ah.prototype.set=function(e){return this.__opts__=jse(this.__opts__,e),this};ah.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let t,i,r,s,o,a,l,c,u;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(t=l.exec(e))!==null;)if(s=this.testSchemaAt(e,t[2],l.lastIndex),s){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+s;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c=0&&(r=e.match(this.re.email_fuzzy))!==null&&(o=r.index+r[1].length,a=r.index+r[0].length,(this.__index__<0||othis.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=a))),this.__index__>=0};ah.prototype.pretest=function(e){return this.re.pretest.test(e)};ah.prototype.testSchemaAt=function(e,t,i){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,i,this):0};ah.prototype.match=function(e){const t=[];let i=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(qse(this,i)),i=this.__last_index__);let r=i?e.slice(i):e;for(;this.test(r);)t.push(qse(this,i)),r=r.slice(this.__last_index__),i+=this.__last_index__;return t.length?t:null};ah.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const t=this.re.schema_at_start.exec(e);if(!t)return null;const i=this.testSchemaAt(e,t[2],t[0].length);return i?(this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i,qse(this,0)):null};ah.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(i,r,s){return i!==s[r-1]}).reverse(),XB(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,XB(this),this)};ah.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};ah.prototype.onCompile=function(){};const Uk=2147483647,Rp=36,Mge=1,LP=26,W3n=38,H3n=700,nZe=72,iZe=128,rZe="-",V3n=/^xn--/,z3n=/[^\0-\x7F]/,U3n=/[\x2E\u3002\uFF0E\uFF61]/g,j3n={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},NG=Rp-Mge,Pp=Math.floor,RG=String.fromCharCode;function lv(n){throw new RangeError(j3n[n])}function q3n(n,e){const t=[];let i=n.length;for(;i--;)t[i]=e(n[i]);return t}function sZe(n,e){const t=n.split("@");let i="";t.length>1&&(i=t[0]+"@",n=t[1]),n=n.replace(U3n,".");const r=n.split("."),s=q3n(r,e).join(".");return i+s}function oZe(n){const e=[];let t=0;const i=n.length;for(;t=55296&&r<=56319&&tString.fromCodePoint(...n),G3n=function(n){return n>=48&&n<58?26+(n-48):n>=65&&n<91?n-65:n>=97&&n<123?n-97:Rp},mNe=function(n,e){return n+22+75*(n<26)-((e!=0)<<5)},aZe=function(n,e,t){let i=0;for(n=t?Pp(n/H3n):n>>1,n+=Pp(n/e);n>NG*LP>>1;i+=Rp)n=Pp(n/NG);return Pp(i+(NG+1)*n/(n+W3n))},lZe=function(n){const e=[],t=n.length;let i=0,r=iZe,s=nZe,o=n.lastIndexOf(rZe);o<0&&(o=0);for(let a=0;a=128&&lv("not-basic"),e.push(n.charCodeAt(a));for(let a=o>0?o+1:0;a=t&&lv("invalid-input");const h=G3n(n.charCodeAt(a++));h>=Rp&&lv("invalid-input"),h>Pp((Uk-i)/u)&&lv("overflow"),i+=h*u;const f=d<=s?Mge:d>=s+LP?LP:d-s;if(hPp(Uk/g)&&lv("overflow"),u*=g}const c=e.length+1;s=aZe(i-l,c,l==0),Pp(i/c)>Uk-r&&lv("overflow"),r+=Pp(i/c),i%=c,e.splice(i++,0,r)}return String.fromCodePoint(...e)},cZe=function(n){const e=[];n=oZe(n);const t=n.length;let i=iZe,r=0,s=nZe;for(const l of n)l<128&&e.push(RG(l));const o=e.length;let a=o;for(o&&e.push(rZe);a=i&&uPp((Uk-r)/c)&&lv("overflow"),r+=(l-i)*c,i=l;for(const u of n)if(uUk&&lv("overflow"),u===i){let d=r;for(let h=Rp;;h+=Rp){const f=h<=s?Mge:h>=s+LP?LP:h-s;if(d=0))try{e.hostname=uZe.toASCII(e.hostname)}catch{}return oM(Dge(e))}function s5n(n){const e=Ige(n,!0);if(e.hostname&&(!e.protocol||dZe.indexOf(e.protocol)>=0))try{e.hostname=uZe.toUnicode(e.hostname)}catch{}return PL(Dge(e),PL.defaultChars+"%")}function Rg(n,e){if(!(this instanceof Rg))return new Rg(n,e);e||Nge(n)||(e=n||{},n="default"),this.inline=new lM,this.block=new rz,this.core=new Pge,this.renderer=new H2,this.linkify=new ah,this.validateLink=i5n,this.normalizeLink=r5n,this.normalizeLinkText=s5n,this.utils=a4n,this.helpers=nz({},d4n),this.options={},this.configure(n),e&&this.set(e)}Rg.prototype.set=function(n){return nz(this.options,n),this};Rg.prototype.configure=function(n){const e=this;if(Nge(n)){const t=n;if(n=e5n[t],!n)throw new Error('Wrong `markdown-it` preset "'+t+'", check name')}if(!n)throw new Error("Wrong `markdown-it` preset, can't be empty");return n.options&&e.set(n.options),n.components&&Object.keys(n.components).forEach(function(t){n.components[t].rules&&e[t].ruler.enableOnly(n.components[t].rules),n.components[t].rules2&&e[t].ruler2.enableOnly(n.components[t].rules2)}),this};Rg.prototype.enable=function(n,e){let t=[];Array.isArray(n)||(n=[n]),["core","block","inline"].forEach(function(r){t=t.concat(this[r].ruler.enable(n,!0))},this),t=t.concat(this.inline.ruler2.enable(n,!0));const i=n.filter(function(r){return t.indexOf(r)<0});if(i.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+i);return this};Rg.prototype.disable=function(n,e){let t=[];Array.isArray(n)||(n=[n]),["core","block","inline"].forEach(function(r){t=t.concat(this[r].ruler.disable(n,!0))},this),t=t.concat(this.inline.ruler2.disable(n,!0));const i=n.filter(function(r){return t.indexOf(r)<0});if(i.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+i);return this};Rg.prototype.use=function(n){const e=[this].concat(Array.prototype.slice.call(arguments,1));return n.apply(n,e),this};Rg.prototype.parse=function(n,e){if(typeof n!="string")throw new Error("Input data should be a String");const t=new this.core.State(n,this,e);return this.core.process(t),t.tokens};Rg.prototype.render=function(n,e){return e=e||{},this.renderer.render(this.parse(n,e),this.options,e)};Rg.prototype.parseInline=function(n,e){const t=new this.core.State(n,this,e);return t.inlineMode=!0,this.core.process(t),t.tokens};Rg.prototype.renderInline=function(n,e){return e=e||{},this.renderer.render(this.parseInline(n,e),this.options,e)};var hZe={exports:{}};(function(n){(function(e){var t=function(N){var F,V=new Float64Array(16);if(N)for(F=0;F>24&255,N[F+1]=V>>16&255,N[F+2]=V>>8&255,N[F+3]=V&255,N[F+4]=A>>24&255,N[F+5]=A>>16&255,N[F+6]=A>>8&255,N[F+7]=A&255}function p(N,F,V,A,K){var ge,pe=0;for(ge=0;ge>>8)-1}function m(N,F,V,A){return p(N,F,V,A,16)}function _(N,F,V,A){return p(N,F,V,A,32)}function v(N,F,V,A){for(var K=A[0]&255|(A[1]&255)<<8|(A[2]&255)<<16|(A[3]&255)<<24,ge=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,pe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,Ee=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,Be=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,ht=A[4]&255|(A[5]&255)<<8|(A[6]&255)<<16|(A[7]&255)<<24,bt=F[0]&255|(F[1]&255)<<8|(F[2]&255)<<16|(F[3]&255)<<24,hn=F[4]&255|(F[5]&255)<<8|(F[6]&255)<<16|(F[7]&255)<<24,Fe=F[8]&255|(F[9]&255)<<8|(F[10]&255)<<16|(F[11]&255)<<24,_e=F[12]&255|(F[13]&255)<<8|(F[14]&255)<<16|(F[15]&255)<<24,Ze=A[8]&255|(A[9]&255)<<8|(A[10]&255)<<16|(A[11]&255)<<24,ct=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,Ht=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Zt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,nn=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,ln=A[12]&255|(A[13]&255)<<8|(A[14]&255)<<16|(A[15]&255)<<24,Wt=K,on=ge,It=pe,Ct=Ee,Rt=Be,qt=ht,Ye=bt,Oe=hn,mt=Fe,at=_e,lt=Ze,kt=ct,Mn=Ht,Si=Zt,ki=nn,hi=ln,be,Wi=0;Wi<20;Wi+=2)be=Wt+Mn|0,Rt^=be<<7|be>>>25,be=Rt+Wt|0,mt^=be<<9|be>>>23,be=mt+Rt|0,Mn^=be<<13|be>>>19,be=Mn+mt|0,Wt^=be<<18|be>>>14,be=qt+on|0,at^=be<<7|be>>>25,be=at+qt|0,Si^=be<<9|be>>>23,be=Si+at|0,on^=be<<13|be>>>19,be=on+Si|0,qt^=be<<18|be>>>14,be=lt+Ye|0,ki^=be<<7|be>>>25,be=ki+lt|0,It^=be<<9|be>>>23,be=It+ki|0,Ye^=be<<13|be>>>19,be=Ye+It|0,lt^=be<<18|be>>>14,be=hi+kt|0,Ct^=be<<7|be>>>25,be=Ct+hi|0,Oe^=be<<9|be>>>23,be=Oe+Ct|0,kt^=be<<13|be>>>19,be=kt+Oe|0,hi^=be<<18|be>>>14,be=Wt+Ct|0,on^=be<<7|be>>>25,be=on+Wt|0,It^=be<<9|be>>>23,be=It+on|0,Ct^=be<<13|be>>>19,be=Ct+It|0,Wt^=be<<18|be>>>14,be=qt+Rt|0,Ye^=be<<7|be>>>25,be=Ye+qt|0,Oe^=be<<9|be>>>23,be=Oe+Ye|0,Rt^=be<<13|be>>>19,be=Rt+Oe|0,qt^=be<<18|be>>>14,be=lt+at|0,kt^=be<<7|be>>>25,be=kt+lt|0,mt^=be<<9|be>>>23,be=mt+kt|0,at^=be<<13|be>>>19,be=at+mt|0,lt^=be<<18|be>>>14,be=hi+ki|0,Mn^=be<<7|be>>>25,be=Mn+hi|0,Si^=be<<9|be>>>23,be=Si+Mn|0,ki^=be<<13|be>>>19,be=ki+Si|0,hi^=be<<18|be>>>14;Wt=Wt+K|0,on=on+ge|0,It=It+pe|0,Ct=Ct+Ee|0,Rt=Rt+Be|0,qt=qt+ht|0,Ye=Ye+bt|0,Oe=Oe+hn|0,mt=mt+Fe|0,at=at+_e|0,lt=lt+Ze|0,kt=kt+ct|0,Mn=Mn+Ht|0,Si=Si+Zt|0,ki=ki+nn|0,hi=hi+ln|0,N[0]=Wt>>>0&255,N[1]=Wt>>>8&255,N[2]=Wt>>>16&255,N[3]=Wt>>>24&255,N[4]=on>>>0&255,N[5]=on>>>8&255,N[6]=on>>>16&255,N[7]=on>>>24&255,N[8]=It>>>0&255,N[9]=It>>>8&255,N[10]=It>>>16&255,N[11]=It>>>24&255,N[12]=Ct>>>0&255,N[13]=Ct>>>8&255,N[14]=Ct>>>16&255,N[15]=Ct>>>24&255,N[16]=Rt>>>0&255,N[17]=Rt>>>8&255,N[18]=Rt>>>16&255,N[19]=Rt>>>24&255,N[20]=qt>>>0&255,N[21]=qt>>>8&255,N[22]=qt>>>16&255,N[23]=qt>>>24&255,N[24]=Ye>>>0&255,N[25]=Ye>>>8&255,N[26]=Ye>>>16&255,N[27]=Ye>>>24&255,N[28]=Oe>>>0&255,N[29]=Oe>>>8&255,N[30]=Oe>>>16&255,N[31]=Oe>>>24&255,N[32]=mt>>>0&255,N[33]=mt>>>8&255,N[34]=mt>>>16&255,N[35]=mt>>>24&255,N[36]=at>>>0&255,N[37]=at>>>8&255,N[38]=at>>>16&255,N[39]=at>>>24&255,N[40]=lt>>>0&255,N[41]=lt>>>8&255,N[42]=lt>>>16&255,N[43]=lt>>>24&255,N[44]=kt>>>0&255,N[45]=kt>>>8&255,N[46]=kt>>>16&255,N[47]=kt>>>24&255,N[48]=Mn>>>0&255,N[49]=Mn>>>8&255,N[50]=Mn>>>16&255,N[51]=Mn>>>24&255,N[52]=Si>>>0&255,N[53]=Si>>>8&255,N[54]=Si>>>16&255,N[55]=Si>>>24&255,N[56]=ki>>>0&255,N[57]=ki>>>8&255,N[58]=ki>>>16&255,N[59]=ki>>>24&255,N[60]=hi>>>0&255,N[61]=hi>>>8&255,N[62]=hi>>>16&255,N[63]=hi>>>24&255}function y(N,F,V,A){for(var K=A[0]&255|(A[1]&255)<<8|(A[2]&255)<<16|(A[3]&255)<<24,ge=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,pe=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,Ee=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,Be=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,ht=A[4]&255|(A[5]&255)<<8|(A[6]&255)<<16|(A[7]&255)<<24,bt=F[0]&255|(F[1]&255)<<8|(F[2]&255)<<16|(F[3]&255)<<24,hn=F[4]&255|(F[5]&255)<<8|(F[6]&255)<<16|(F[7]&255)<<24,Fe=F[8]&255|(F[9]&255)<<8|(F[10]&255)<<16|(F[11]&255)<<24,_e=F[12]&255|(F[13]&255)<<8|(F[14]&255)<<16|(F[15]&255)<<24,Ze=A[8]&255|(A[9]&255)<<8|(A[10]&255)<<16|(A[11]&255)<<24,ct=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,Ht=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,Zt=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,nn=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,ln=A[12]&255|(A[13]&255)<<8|(A[14]&255)<<16|(A[15]&255)<<24,Wt=K,on=ge,It=pe,Ct=Ee,Rt=Be,qt=ht,Ye=bt,Oe=hn,mt=Fe,at=_e,lt=Ze,kt=ct,Mn=Ht,Si=Zt,ki=nn,hi=ln,be,Wi=0;Wi<20;Wi+=2)be=Wt+Mn|0,Rt^=be<<7|be>>>25,be=Rt+Wt|0,mt^=be<<9|be>>>23,be=mt+Rt|0,Mn^=be<<13|be>>>19,be=Mn+mt|0,Wt^=be<<18|be>>>14,be=qt+on|0,at^=be<<7|be>>>25,be=at+qt|0,Si^=be<<9|be>>>23,be=Si+at|0,on^=be<<13|be>>>19,be=on+Si|0,qt^=be<<18|be>>>14,be=lt+Ye|0,ki^=be<<7|be>>>25,be=ki+lt|0,It^=be<<9|be>>>23,be=It+ki|0,Ye^=be<<13|be>>>19,be=Ye+It|0,lt^=be<<18|be>>>14,be=hi+kt|0,Ct^=be<<7|be>>>25,be=Ct+hi|0,Oe^=be<<9|be>>>23,be=Oe+Ct|0,kt^=be<<13|be>>>19,be=kt+Oe|0,hi^=be<<18|be>>>14,be=Wt+Ct|0,on^=be<<7|be>>>25,be=on+Wt|0,It^=be<<9|be>>>23,be=It+on|0,Ct^=be<<13|be>>>19,be=Ct+It|0,Wt^=be<<18|be>>>14,be=qt+Rt|0,Ye^=be<<7|be>>>25,be=Ye+qt|0,Oe^=be<<9|be>>>23,be=Oe+Ye|0,Rt^=be<<13|be>>>19,be=Rt+Oe|0,qt^=be<<18|be>>>14,be=lt+at|0,kt^=be<<7|be>>>25,be=kt+lt|0,mt^=be<<9|be>>>23,be=mt+kt|0,at^=be<<13|be>>>19,be=at+mt|0,lt^=be<<18|be>>>14,be=hi+ki|0,Mn^=be<<7|be>>>25,be=Mn+hi|0,Si^=be<<9|be>>>23,be=Si+Mn|0,ki^=be<<13|be>>>19,be=ki+Si|0,hi^=be<<18|be>>>14;N[0]=Wt>>>0&255,N[1]=Wt>>>8&255,N[2]=Wt>>>16&255,N[3]=Wt>>>24&255,N[4]=qt>>>0&255,N[5]=qt>>>8&255,N[6]=qt>>>16&255,N[7]=qt>>>24&255,N[8]=lt>>>0&255,N[9]=lt>>>8&255,N[10]=lt>>>16&255,N[11]=lt>>>24&255,N[12]=hi>>>0&255,N[13]=hi>>>8&255,N[14]=hi>>>16&255,N[15]=hi>>>24&255,N[16]=Ye>>>0&255,N[17]=Ye>>>8&255,N[18]=Ye>>>16&255,N[19]=Ye>>>24&255,N[20]=Oe>>>0&255,N[21]=Oe>>>8&255,N[22]=Oe>>>16&255,N[23]=Oe>>>24&255,N[24]=mt>>>0&255,N[25]=mt>>>8&255,N[26]=mt>>>16&255,N[27]=mt>>>24&255,N[28]=at>>>0&255,N[29]=at>>>8&255,N[30]=at>>>16&255,N[31]=at>>>24&255}function C(N,F,V,A){v(N,F,V,A)}function x(N,F,V,A){y(N,F,V,A)}var k=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function L(N,F,V,A,K,ge,pe){var Ee=new Uint8Array(16),Be=new Uint8Array(64),ht,bt;for(bt=0;bt<16;bt++)Ee[bt]=0;for(bt=0;bt<8;bt++)Ee[bt]=ge[bt];for(;K>=64;){for(C(Be,Ee,pe,k),bt=0;bt<64;bt++)N[F+bt]=V[A+bt]^Be[bt];for(ht=1,bt=8;bt<16;bt++)ht=ht+(Ee[bt]&255)|0,Ee[bt]=ht&255,ht>>>=8;K-=64,F+=64,A+=64}if(K>0)for(C(Be,Ee,pe,k),bt=0;bt=64;){for(C(pe,ge,K,k),Be=0;Be<64;Be++)N[F+Be]=pe[Be];for(Ee=1,Be=8;Be<16;Be++)Ee=Ee+(ge[Be]&255)|0,ge[Be]=Ee&255,Ee>>>=8;V-=64,F+=64}if(V>0)for(C(pe,ge,K,k),Be=0;Be>>13|V<<3)&8191,A=N[4]&255|(N[5]&255)<<8,this.r[2]=(V>>>10|A<<6)&7939,K=N[6]&255|(N[7]&255)<<8,this.r[3]=(A>>>7|K<<9)&8191,ge=N[8]&255|(N[9]&255)<<8,this.r[4]=(K>>>4|ge<<12)&255,this.r[5]=ge>>>1&8190,pe=N[10]&255|(N[11]&255)<<8,this.r[6]=(ge>>>14|pe<<2)&8191,Ee=N[12]&255|(N[13]&255)<<8,this.r[7]=(pe>>>11|Ee<<5)&8065,Be=N[14]&255|(N[15]&255)<<8,this.r[8]=(Ee>>>8|Be<<8)&8191,this.r[9]=Be>>>5&127,this.pad[0]=N[16]&255|(N[17]&255)<<8,this.pad[1]=N[18]&255|(N[19]&255)<<8,this.pad[2]=N[20]&255|(N[21]&255)<<8,this.pad[3]=N[22]&255|(N[23]&255)<<8,this.pad[4]=N[24]&255|(N[25]&255)<<8,this.pad[5]=N[26]&255|(N[27]&255)<<8,this.pad[6]=N[28]&255|(N[29]&255)<<8,this.pad[7]=N[30]&255|(N[31]&255)<<8};M.prototype.blocks=function(N,F,V){for(var A=this.fin?0:2048,K,ge,pe,Ee,Be,ht,bt,hn,Fe,_e,Ze,ct,Ht,Zt,nn,ln,Wt,on,It,Ct=this.h[0],Rt=this.h[1],qt=this.h[2],Ye=this.h[3],Oe=this.h[4],mt=this.h[5],at=this.h[6],lt=this.h[7],kt=this.h[8],Mn=this.h[9],Si=this.r[0],ki=this.r[1],hi=this.r[2],be=this.r[3],Wi=this.r[4],ur=this.r[5],dr=this.r[6],Ei=this.r[7],hr=this.r[8],tr=this.r[9];V>=16;)K=N[F+0]&255|(N[F+1]&255)<<8,Ct+=K&8191,ge=N[F+2]&255|(N[F+3]&255)<<8,Rt+=(K>>>13|ge<<3)&8191,pe=N[F+4]&255|(N[F+5]&255)<<8,qt+=(ge>>>10|pe<<6)&8191,Ee=N[F+6]&255|(N[F+7]&255)<<8,Ye+=(pe>>>7|Ee<<9)&8191,Be=N[F+8]&255|(N[F+9]&255)<<8,Oe+=(Ee>>>4|Be<<12)&8191,mt+=Be>>>1&8191,ht=N[F+10]&255|(N[F+11]&255)<<8,at+=(Be>>>14|ht<<2)&8191,bt=N[F+12]&255|(N[F+13]&255)<<8,lt+=(ht>>>11|bt<<5)&8191,hn=N[F+14]&255|(N[F+15]&255)<<8,kt+=(bt>>>8|hn<<8)&8191,Mn+=hn>>>5|A,Fe=0,_e=Fe,_e+=Ct*Si,_e+=Rt*(5*tr),_e+=qt*(5*hr),_e+=Ye*(5*Ei),_e+=Oe*(5*dr),Fe=_e>>>13,_e&=8191,_e+=mt*(5*ur),_e+=at*(5*Wi),_e+=lt*(5*be),_e+=kt*(5*hi),_e+=Mn*(5*ki),Fe+=_e>>>13,_e&=8191,Ze=Fe,Ze+=Ct*ki,Ze+=Rt*Si,Ze+=qt*(5*tr),Ze+=Ye*(5*hr),Ze+=Oe*(5*Ei),Fe=Ze>>>13,Ze&=8191,Ze+=mt*(5*dr),Ze+=at*(5*ur),Ze+=lt*(5*Wi),Ze+=kt*(5*be),Ze+=Mn*(5*hi),Fe+=Ze>>>13,Ze&=8191,ct=Fe,ct+=Ct*hi,ct+=Rt*ki,ct+=qt*Si,ct+=Ye*(5*tr),ct+=Oe*(5*hr),Fe=ct>>>13,ct&=8191,ct+=mt*(5*Ei),ct+=at*(5*dr),ct+=lt*(5*ur),ct+=kt*(5*Wi),ct+=Mn*(5*be),Fe+=ct>>>13,ct&=8191,Ht=Fe,Ht+=Ct*be,Ht+=Rt*hi,Ht+=qt*ki,Ht+=Ye*Si,Ht+=Oe*(5*tr),Fe=Ht>>>13,Ht&=8191,Ht+=mt*(5*hr),Ht+=at*(5*Ei),Ht+=lt*(5*dr),Ht+=kt*(5*ur),Ht+=Mn*(5*Wi),Fe+=Ht>>>13,Ht&=8191,Zt=Fe,Zt+=Ct*Wi,Zt+=Rt*be,Zt+=qt*hi,Zt+=Ye*ki,Zt+=Oe*Si,Fe=Zt>>>13,Zt&=8191,Zt+=mt*(5*tr),Zt+=at*(5*hr),Zt+=lt*(5*Ei),Zt+=kt*(5*dr),Zt+=Mn*(5*ur),Fe+=Zt>>>13,Zt&=8191,nn=Fe,nn+=Ct*ur,nn+=Rt*Wi,nn+=qt*be,nn+=Ye*hi,nn+=Oe*ki,Fe=nn>>>13,nn&=8191,nn+=mt*Si,nn+=at*(5*tr),nn+=lt*(5*hr),nn+=kt*(5*Ei),nn+=Mn*(5*dr),Fe+=nn>>>13,nn&=8191,ln=Fe,ln+=Ct*dr,ln+=Rt*ur,ln+=qt*Wi,ln+=Ye*be,ln+=Oe*hi,Fe=ln>>>13,ln&=8191,ln+=mt*ki,ln+=at*Si,ln+=lt*(5*tr),ln+=kt*(5*hr),ln+=Mn*(5*Ei),Fe+=ln>>>13,ln&=8191,Wt=Fe,Wt+=Ct*Ei,Wt+=Rt*dr,Wt+=qt*ur,Wt+=Ye*Wi,Wt+=Oe*be,Fe=Wt>>>13,Wt&=8191,Wt+=mt*hi,Wt+=at*ki,Wt+=lt*Si,Wt+=kt*(5*tr),Wt+=Mn*(5*hr),Fe+=Wt>>>13,Wt&=8191,on=Fe,on+=Ct*hr,on+=Rt*Ei,on+=qt*dr,on+=Ye*ur,on+=Oe*Wi,Fe=on>>>13,on&=8191,on+=mt*be,on+=at*hi,on+=lt*ki,on+=kt*Si,on+=Mn*(5*tr),Fe+=on>>>13,on&=8191,It=Fe,It+=Ct*tr,It+=Rt*hr,It+=qt*Ei,It+=Ye*dr,It+=Oe*ur,Fe=It>>>13,It&=8191,It+=mt*Wi,It+=at*be,It+=lt*hi,It+=kt*ki,It+=Mn*Si,Fe+=It>>>13,It&=8191,Fe=(Fe<<2)+Fe|0,Fe=Fe+_e|0,_e=Fe&8191,Fe=Fe>>>13,Ze+=Fe,Ct=_e,Rt=Ze,qt=ct,Ye=Ht,Oe=Zt,mt=nn,at=ln,lt=Wt,kt=on,Mn=It,F+=16,V-=16;this.h[0]=Ct,this.h[1]=Rt,this.h[2]=qt,this.h[3]=Ye,this.h[4]=Oe,this.h[5]=mt,this.h[6]=at,this.h[7]=lt,this.h[8]=kt,this.h[9]=Mn},M.prototype.finish=function(N,F){var V=new Uint16Array(10),A,K,ge,pe;if(this.leftover){for(pe=this.leftover,this.buffer[pe++]=1;pe<16;pe++)this.buffer[pe]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(A=this.h[1]>>>13,this.h[1]&=8191,pe=2;pe<10;pe++)this.h[pe]+=A,A=this.h[pe]>>>13,this.h[pe]&=8191;for(this.h[0]+=A*5,A=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=A,A=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=A,V[0]=this.h[0]+5,A=V[0]>>>13,V[0]&=8191,pe=1;pe<10;pe++)V[pe]=this.h[pe]+A,A=V[pe]>>>13,V[pe]&=8191;for(V[9]-=8192,K=(A^1)-1,pe=0;pe<10;pe++)V[pe]&=K;for(K=~K,pe=0;pe<10;pe++)this.h[pe]=this.h[pe]&K|V[pe];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,ge=this.h[0]+this.pad[0],this.h[0]=ge&65535,pe=1;pe<8;pe++)ge=(this.h[pe]+this.pad[pe]|0)+(ge>>>16)|0,this.h[pe]=ge&65535;N[F+0]=this.h[0]>>>0&255,N[F+1]=this.h[0]>>>8&255,N[F+2]=this.h[1]>>>0&255,N[F+3]=this.h[1]>>>8&255,N[F+4]=this.h[2]>>>0&255,N[F+5]=this.h[2]>>>8&255,N[F+6]=this.h[3]>>>0&255,N[F+7]=this.h[3]>>>8&255,N[F+8]=this.h[4]>>>0&255,N[F+9]=this.h[4]>>>8&255,N[F+10]=this.h[5]>>>0&255,N[F+11]=this.h[5]>>>8&255,N[F+12]=this.h[6]>>>0&255,N[F+13]=this.h[6]>>>8&255,N[F+14]=this.h[7]>>>0&255,N[F+15]=this.h[7]>>>8&255},M.prototype.update=function(N,F,V){var A,K;if(this.leftover){for(K=16-this.leftover,K>V&&(K=V),A=0;A=16&&(K=V-V%16,this.blocks(N,F,K),F+=K,V-=K),V){for(A=0;A>16&1),ge[V-1]&=65535;ge[15]=pe[15]-32767-(ge[14]>>16&1),K=ge[15]>>16&1,ge[14]&=65535,Z(pe,ge,1-K)}for(V=0;V<16;V++)N[2*V]=pe[V]&255,N[2*V+1]=pe[V]>>8}function te(N,F){var V=new Uint8Array(32),A=new Uint8Array(32);return j(V,N),j(A,F),_(V,0,A,0)}function le(N){var F=new Uint8Array(32);return j(F,N),F[0]&1}function ue(N,F){var V;for(V=0;V<16;V++)N[V]=F[2*V]+(F[2*V+1]<<8);N[15]&=32767}function de(N,F,V){for(var A=0;A<16;A++)N[A]=F[A]+V[A]}function we(N,F,V){for(var A=0;A<16;A++)N[A]=F[A]-V[A]}function xe(N,F,V){var A,K,ge=0,pe=0,Ee=0,Be=0,ht=0,bt=0,hn=0,Fe=0,_e=0,Ze=0,ct=0,Ht=0,Zt=0,nn=0,ln=0,Wt=0,on=0,It=0,Ct=0,Rt=0,qt=0,Ye=0,Oe=0,mt=0,at=0,lt=0,kt=0,Mn=0,Si=0,ki=0,hi=0,be=V[0],Wi=V[1],ur=V[2],dr=V[3],Ei=V[4],hr=V[5],tr=V[6],Ks=V[7],Mr=V[8],ds=V[9],Gs=V[10],Ys=V[11],Ho=V[12],Aa=V[13],Na=V[14],Ra=V[15];A=F[0],ge+=A*be,pe+=A*Wi,Ee+=A*ur,Be+=A*dr,ht+=A*Ei,bt+=A*hr,hn+=A*tr,Fe+=A*Ks,_e+=A*Mr,Ze+=A*ds,ct+=A*Gs,Ht+=A*Ys,Zt+=A*Ho,nn+=A*Aa,ln+=A*Na,Wt+=A*Ra,A=F[1],pe+=A*be,Ee+=A*Wi,Be+=A*ur,ht+=A*dr,bt+=A*Ei,hn+=A*hr,Fe+=A*tr,_e+=A*Ks,Ze+=A*Mr,ct+=A*ds,Ht+=A*Gs,Zt+=A*Ys,nn+=A*Ho,ln+=A*Aa,Wt+=A*Na,on+=A*Ra,A=F[2],Ee+=A*be,Be+=A*Wi,ht+=A*ur,bt+=A*dr,hn+=A*Ei,Fe+=A*hr,_e+=A*tr,Ze+=A*Ks,ct+=A*Mr,Ht+=A*ds,Zt+=A*Gs,nn+=A*Ys,ln+=A*Ho,Wt+=A*Aa,on+=A*Na,It+=A*Ra,A=F[3],Be+=A*be,ht+=A*Wi,bt+=A*ur,hn+=A*dr,Fe+=A*Ei,_e+=A*hr,Ze+=A*tr,ct+=A*Ks,Ht+=A*Mr,Zt+=A*ds,nn+=A*Gs,ln+=A*Ys,Wt+=A*Ho,on+=A*Aa,It+=A*Na,Ct+=A*Ra,A=F[4],ht+=A*be,bt+=A*Wi,hn+=A*ur,Fe+=A*dr,_e+=A*Ei,Ze+=A*hr,ct+=A*tr,Ht+=A*Ks,Zt+=A*Mr,nn+=A*ds,ln+=A*Gs,Wt+=A*Ys,on+=A*Ho,It+=A*Aa,Ct+=A*Na,Rt+=A*Ra,A=F[5],bt+=A*be,hn+=A*Wi,Fe+=A*ur,_e+=A*dr,Ze+=A*Ei,ct+=A*hr,Ht+=A*tr,Zt+=A*Ks,nn+=A*Mr,ln+=A*ds,Wt+=A*Gs,on+=A*Ys,It+=A*Ho,Ct+=A*Aa,Rt+=A*Na,qt+=A*Ra,A=F[6],hn+=A*be,Fe+=A*Wi,_e+=A*ur,Ze+=A*dr,ct+=A*Ei,Ht+=A*hr,Zt+=A*tr,nn+=A*Ks,ln+=A*Mr,Wt+=A*ds,on+=A*Gs,It+=A*Ys,Ct+=A*Ho,Rt+=A*Aa,qt+=A*Na,Ye+=A*Ra,A=F[7],Fe+=A*be,_e+=A*Wi,Ze+=A*ur,ct+=A*dr,Ht+=A*Ei,Zt+=A*hr,nn+=A*tr,ln+=A*Ks,Wt+=A*Mr,on+=A*ds,It+=A*Gs,Ct+=A*Ys,Rt+=A*Ho,qt+=A*Aa,Ye+=A*Na,Oe+=A*Ra,A=F[8],_e+=A*be,Ze+=A*Wi,ct+=A*ur,Ht+=A*dr,Zt+=A*Ei,nn+=A*hr,ln+=A*tr,Wt+=A*Ks,on+=A*Mr,It+=A*ds,Ct+=A*Gs,Rt+=A*Ys,qt+=A*Ho,Ye+=A*Aa,Oe+=A*Na,mt+=A*Ra,A=F[9],Ze+=A*be,ct+=A*Wi,Ht+=A*ur,Zt+=A*dr,nn+=A*Ei,ln+=A*hr,Wt+=A*tr,on+=A*Ks,It+=A*Mr,Ct+=A*ds,Rt+=A*Gs,qt+=A*Ys,Ye+=A*Ho,Oe+=A*Aa,mt+=A*Na,at+=A*Ra,A=F[10],ct+=A*be,Ht+=A*Wi,Zt+=A*ur,nn+=A*dr,ln+=A*Ei,Wt+=A*hr,on+=A*tr,It+=A*Ks,Ct+=A*Mr,Rt+=A*ds,qt+=A*Gs,Ye+=A*Ys,Oe+=A*Ho,mt+=A*Aa,at+=A*Na,lt+=A*Ra,A=F[11],Ht+=A*be,Zt+=A*Wi,nn+=A*ur,ln+=A*dr,Wt+=A*Ei,on+=A*hr,It+=A*tr,Ct+=A*Ks,Rt+=A*Mr,qt+=A*ds,Ye+=A*Gs,Oe+=A*Ys,mt+=A*Ho,at+=A*Aa,lt+=A*Na,kt+=A*Ra,A=F[12],Zt+=A*be,nn+=A*Wi,ln+=A*ur,Wt+=A*dr,on+=A*Ei,It+=A*hr,Ct+=A*tr,Rt+=A*Ks,qt+=A*Mr,Ye+=A*ds,Oe+=A*Gs,mt+=A*Ys,at+=A*Ho,lt+=A*Aa,kt+=A*Na,Mn+=A*Ra,A=F[13],nn+=A*be,ln+=A*Wi,Wt+=A*ur,on+=A*dr,It+=A*Ei,Ct+=A*hr,Rt+=A*tr,qt+=A*Ks,Ye+=A*Mr,Oe+=A*ds,mt+=A*Gs,at+=A*Ys,lt+=A*Ho,kt+=A*Aa,Mn+=A*Na,Si+=A*Ra,A=F[14],ln+=A*be,Wt+=A*Wi,on+=A*ur,It+=A*dr,Ct+=A*Ei,Rt+=A*hr,qt+=A*tr,Ye+=A*Ks,Oe+=A*Mr,mt+=A*ds,at+=A*Gs,lt+=A*Ys,kt+=A*Ho,Mn+=A*Aa,Si+=A*Na,ki+=A*Ra,A=F[15],Wt+=A*be,on+=A*Wi,It+=A*ur,Ct+=A*dr,Rt+=A*Ei,qt+=A*hr,Ye+=A*tr,Oe+=A*Ks,mt+=A*Mr,at+=A*ds,lt+=A*Gs,kt+=A*Ys,Mn+=A*Ho,Si+=A*Aa,ki+=A*Na,hi+=A*Ra,ge+=38*on,pe+=38*It,Ee+=38*Ct,Be+=38*Rt,ht+=38*qt,bt+=38*Ye,hn+=38*Oe,Fe+=38*mt,_e+=38*at,Ze+=38*lt,ct+=38*kt,Ht+=38*Mn,Zt+=38*Si,nn+=38*ki,ln+=38*hi,K=1,A=ge+K+65535,K=Math.floor(A/65536),ge=A-K*65536,A=pe+K+65535,K=Math.floor(A/65536),pe=A-K*65536,A=Ee+K+65535,K=Math.floor(A/65536),Ee=A-K*65536,A=Be+K+65535,K=Math.floor(A/65536),Be=A-K*65536,A=ht+K+65535,K=Math.floor(A/65536),ht=A-K*65536,A=bt+K+65535,K=Math.floor(A/65536),bt=A-K*65536,A=hn+K+65535,K=Math.floor(A/65536),hn=A-K*65536,A=Fe+K+65535,K=Math.floor(A/65536),Fe=A-K*65536,A=_e+K+65535,K=Math.floor(A/65536),_e=A-K*65536,A=Ze+K+65535,K=Math.floor(A/65536),Ze=A-K*65536,A=ct+K+65535,K=Math.floor(A/65536),ct=A-K*65536,A=Ht+K+65535,K=Math.floor(A/65536),Ht=A-K*65536,A=Zt+K+65535,K=Math.floor(A/65536),Zt=A-K*65536,A=nn+K+65535,K=Math.floor(A/65536),nn=A-K*65536,A=ln+K+65535,K=Math.floor(A/65536),ln=A-K*65536,A=Wt+K+65535,K=Math.floor(A/65536),Wt=A-K*65536,ge+=K-1+37*(K-1),K=1,A=ge+K+65535,K=Math.floor(A/65536),ge=A-K*65536,A=pe+K+65535,K=Math.floor(A/65536),pe=A-K*65536,A=Ee+K+65535,K=Math.floor(A/65536),Ee=A-K*65536,A=Be+K+65535,K=Math.floor(A/65536),Be=A-K*65536,A=ht+K+65535,K=Math.floor(A/65536),ht=A-K*65536,A=bt+K+65535,K=Math.floor(A/65536),bt=A-K*65536,A=hn+K+65535,K=Math.floor(A/65536),hn=A-K*65536,A=Fe+K+65535,K=Math.floor(A/65536),Fe=A-K*65536,A=_e+K+65535,K=Math.floor(A/65536),_e=A-K*65536,A=Ze+K+65535,K=Math.floor(A/65536),Ze=A-K*65536,A=ct+K+65535,K=Math.floor(A/65536),ct=A-K*65536,A=Ht+K+65535,K=Math.floor(A/65536),Ht=A-K*65536,A=Zt+K+65535,K=Math.floor(A/65536),Zt=A-K*65536,A=nn+K+65535,K=Math.floor(A/65536),nn=A-K*65536,A=ln+K+65535,K=Math.floor(A/65536),ln=A-K*65536,A=Wt+K+65535,K=Math.floor(A/65536),Wt=A-K*65536,ge+=K-1+37*(K-1),N[0]=ge,N[1]=pe,N[2]=Ee,N[3]=Be,N[4]=ht,N[5]=bt,N[6]=hn,N[7]=Fe,N[8]=_e,N[9]=Ze,N[10]=ct,N[11]=Ht,N[12]=Zt,N[13]=nn,N[14]=ln,N[15]=Wt}function Me(N,F){xe(N,F,F)}function Re(N,F){var V=t(),A;for(A=0;A<16;A++)V[A]=F[A];for(A=253;A>=0;A--)Me(V,V),A!==2&&A!==4&&xe(V,V,F);for(A=0;A<16;A++)N[A]=V[A]}function _t(N,F){var V=t(),A;for(A=0;A<16;A++)V[A]=F[A];for(A=250;A>=0;A--)Me(V,V),A!==1&&xe(V,V,F);for(A=0;A<16;A++)N[A]=V[A]}function Qe(N,F,V){var A=new Uint8Array(32),K=new Float64Array(80),ge,pe,Ee=t(),Be=t(),ht=t(),bt=t(),hn=t(),Fe=t();for(pe=0;pe<31;pe++)A[pe]=F[pe];for(A[31]=F[31]&127|64,A[0]&=248,ue(K,V),pe=0;pe<16;pe++)Be[pe]=K[pe],bt[pe]=Ee[pe]=ht[pe]=0;for(Ee[0]=bt[0]=1,pe=254;pe>=0;--pe)ge=A[pe>>>3]>>>(pe&7)&1,Z(Ee,Be,ge),Z(ht,bt,ge),de(hn,Ee,ht),we(Ee,Ee,ht),de(ht,Be,bt),we(Be,Be,bt),Me(bt,hn),Me(Fe,Ee),xe(Ee,ht,Ee),xe(ht,Be,hn),de(hn,Ee,ht),we(Ee,Ee,ht),Me(Be,Ee),we(ht,bt,Fe),xe(Ee,ht,l),de(Ee,Ee,bt),xe(ht,ht,Ee),xe(Ee,bt,Fe),xe(bt,Be,K),Me(Be,hn),Z(Ee,Be,ge),Z(ht,bt,ge);for(pe=0;pe<16;pe++)K[pe+16]=Ee[pe],K[pe+32]=ht[pe],K[pe+48]=Be[pe],K[pe+64]=bt[pe];var _e=K.subarray(32),Ze=K.subarray(16);return Re(_e,_e),xe(Ze,Ze,_e),j(N,Ze),0}function pt(N,F){return Qe(N,F,s)}function gt(N,F){return i(F,32),pt(N,F)}function Ue(N,F,V){var A=new Uint8Array(32);return Qe(A,V,F),x(N,r,A,k)}var wn=W,Xt=z;function jn(N,F,V,A,K,ge){var pe=new Uint8Array(32);return Ue(pe,K,ge),wn(N,F,V,A,pe)}function ji(N,F,V,A,K,ge){var pe=new Uint8Array(32);return Ue(pe,K,ge),Xt(N,F,V,A,pe)}var ci=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ye(N,F,V,A){for(var K=new Int32Array(16),ge=new Int32Array(16),pe,Ee,Be,ht,bt,hn,Fe,_e,Ze,ct,Ht,Zt,nn,ln,Wt,on,It,Ct,Rt,qt,Ye,Oe,mt,at,lt,kt,Mn=N[0],Si=N[1],ki=N[2],hi=N[3],be=N[4],Wi=N[5],ur=N[6],dr=N[7],Ei=F[0],hr=F[1],tr=F[2],Ks=F[3],Mr=F[4],ds=F[5],Gs=F[6],Ys=F[7],Ho=0;A>=128;){for(Rt=0;Rt<16;Rt++)qt=8*Rt+Ho,K[Rt]=V[qt+0]<<24|V[qt+1]<<16|V[qt+2]<<8|V[qt+3],ge[Rt]=V[qt+4]<<24|V[qt+5]<<16|V[qt+6]<<8|V[qt+7];for(Rt=0;Rt<80;Rt++)if(pe=Mn,Ee=Si,Be=ki,ht=hi,bt=be,hn=Wi,Fe=ur,_e=dr,Ze=Ei,ct=hr,Ht=tr,Zt=Ks,nn=Mr,ln=ds,Wt=Gs,on=Ys,Ye=dr,Oe=Ys,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=(be>>>14|Mr<<18)^(be>>>18|Mr<<14)^(Mr>>>9|be<<23),Oe=(Mr>>>14|be<<18)^(Mr>>>18|be<<14)^(be>>>9|Mr<<23),mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,Ye=be&Wi^~be&ur,Oe=Mr&ds^~Mr&Gs,mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,Ye=ci[Rt*2],Oe=ci[Rt*2+1],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,Ye=K[Rt%16],Oe=ge[Rt%16],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,It=lt&65535|kt<<16,Ct=mt&65535|at<<16,Ye=It,Oe=Ct,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=(Mn>>>28|Ei<<4)^(Ei>>>2|Mn<<30)^(Ei>>>7|Mn<<25),Oe=(Ei>>>28|Mn<<4)^(Mn>>>2|Ei<<30)^(Mn>>>7|Ei<<25),mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,Ye=Mn&Si^Mn&ki^Si&ki,Oe=Ei&hr^Ei&tr^hr&tr,mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,_e=lt&65535|kt<<16,on=mt&65535|at<<16,Ye=ht,Oe=Zt,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=It,Oe=Ct,mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,ht=lt&65535|kt<<16,Zt=mt&65535|at<<16,Si=pe,ki=Ee,hi=Be,be=ht,Wi=bt,ur=hn,dr=Fe,Mn=_e,hr=Ze,tr=ct,Ks=Ht,Mr=Zt,ds=nn,Gs=ln,Ys=Wt,Ei=on,Rt%16===15)for(qt=0;qt<16;qt++)Ye=K[qt],Oe=ge[qt],mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=K[(qt+9)%16],Oe=ge[(qt+9)%16],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,It=K[(qt+1)%16],Ct=ge[(qt+1)%16],Ye=(It>>>1|Ct<<31)^(It>>>8|Ct<<24)^It>>>7,Oe=(Ct>>>1|It<<31)^(Ct>>>8|It<<24)^(Ct>>>7|It<<25),mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,It=K[(qt+14)%16],Ct=ge[(qt+14)%16],Ye=(It>>>19|Ct<<13)^(Ct>>>29|It<<3)^It>>>6,Oe=(Ct>>>19|It<<13)^(It>>>29|Ct<<3)^(Ct>>>6|It<<26),mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,K[qt]=lt&65535|kt<<16,ge[qt]=mt&65535|at<<16;Ye=Mn,Oe=Ei,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[0],Oe=F[0],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[0]=Mn=lt&65535|kt<<16,F[0]=Ei=mt&65535|at<<16,Ye=Si,Oe=hr,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[1],Oe=F[1],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[1]=Si=lt&65535|kt<<16,F[1]=hr=mt&65535|at<<16,Ye=ki,Oe=tr,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[2],Oe=F[2],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[2]=ki=lt&65535|kt<<16,F[2]=tr=mt&65535|at<<16,Ye=hi,Oe=Ks,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[3],Oe=F[3],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[3]=hi=lt&65535|kt<<16,F[3]=Ks=mt&65535|at<<16,Ye=be,Oe=Mr,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[4],Oe=F[4],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[4]=be=lt&65535|kt<<16,F[4]=Mr=mt&65535|at<<16,Ye=Wi,Oe=ds,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[5],Oe=F[5],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[5]=Wi=lt&65535|kt<<16,F[5]=ds=mt&65535|at<<16,Ye=ur,Oe=Gs,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[6],Oe=F[6],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[6]=ur=lt&65535|kt<<16,F[6]=Gs=mt&65535|at<<16,Ye=dr,Oe=Ys,mt=Oe&65535,at=Oe>>>16,lt=Ye&65535,kt=Ye>>>16,Ye=N[7],Oe=F[7],mt+=Oe&65535,at+=Oe>>>16,lt+=Ye&65535,kt+=Ye>>>16,at+=mt>>>16,lt+=at>>>16,kt+=lt>>>16,N[7]=dr=lt&65535|kt<<16,F[7]=Ys=mt&65535|at<<16,Ho+=128,A-=128}return A}function Ie(N,F,V){var A=new Int32Array(8),K=new Int32Array(8),ge=new Uint8Array(256),pe,Ee=V;for(A[0]=1779033703,A[1]=3144134277,A[2]=1013904242,A[3]=2773480762,A[4]=1359893119,A[5]=2600822924,A[6]=528734635,A[7]=1541459225,K[0]=4089235720,K[1]=2227873595,K[2]=4271175723,K[3]=1595750129,K[4]=2917565137,K[5]=725511199,K[6]=4215389547,K[7]=327033209,ye(A,K,F,V),V%=128,pe=0;pe=0;--K)A=V[K/8|0]>>(K&7)&1,wt(N,F,A),Ve(F,N),Ve(N,N),wt(N,F,A)}function $t(N,F){var V=[t(),t(),t(),t()];q(V[0],d),q(V[1],h),q(V[2],a),xe(V[3],d,h),nt(N,V,F)}function an(N,F,V){var A=new Uint8Array(64),K=[t(),t(),t(),t()],ge;for(V||i(F,32),Ie(A,F,32),A[0]&=248,A[31]&=127,A[31]|=64,$t(K,A),vt(N,K),ge=0;ge<32;ge++)F[ge+32]=N[ge];return 0}var Pi=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Xn(N,F){var V,A,K,ge;for(A=63;A>=32;--A){for(V=0,K=A-32,ge=A-12;K>4)*Pi[K],V=F[K]>>8,F[K]&=255;for(K=0;K<32;K++)F[K]-=V*Pi[K];for(A=0;A<32;A++)F[A+1]+=F[A]>>8,N[A]=F[A]&255}function Qi(N){var F=new Float64Array(64),V;for(V=0;V<64;V++)F[V]=N[V];for(V=0;V<64;V++)N[V]=0;Xn(N,F)}function qs(N,F,V,A){var K=new Uint8Array(64),ge=new Uint8Array(64),pe=new Uint8Array(64),Ee,Be,ht=new Float64Array(64),bt=[t(),t(),t(),t()];Ie(K,A,32),K[0]&=248,K[31]&=127,K[31]|=64;var hn=V+64;for(Ee=0;Ee>7&&we(N[0],o,N[0]),xe(N[3],N[0],N[1]),0)}function Or(N,F,V,A){var K,ge=new Uint8Array(32),pe=new Uint8Array(64),Ee=[t(),t(),t(),t()],Be=[t(),t(),t(),t()];if(V<64||Pr(Be,A))return-1;for(K=0;K=0},e.sign.keyPair=function(){var N=new Uint8Array(Yi),F=new Uint8Array(Wn);return an(N,F),{publicKey:N,secretKey:F}},e.sign.keyPair.fromSecretKey=function(N){if(Y(N),N.length!==Wn)throw new Error("bad secret key size");for(var F=new Uint8Array(Yi),V=0;V"u"?typeof Buffer.from<"u"?(e.encodeBase64=function(i){return Buffer.from(i).toString("base64")},e.decodeBase64=function(i){return t(i),new Uint8Array(Array.prototype.slice.call(Buffer.from(i,"base64"),0))}):(e.encodeBase64=function(i){return new Buffer(i).toString("base64")},e.decodeBase64=function(i){return t(i),new Uint8Array(Array.prototype.slice.call(new Buffer(i,"base64"),0))}):(e.encodeBase64=function(i){var r,s=[],o=i.length;for(r=0;r{let t=!1;const i=n.map(r=>{const s=_Ne(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r{const{scope:h,children:f,...g}=d,p=h?.[n]?.[l]||a,m=E.useMemo(()=>g,Object.values(g));return ae.jsx(p.Provider,{value:m,children:f})};c.displayName=s+"Provider";function u(d,h){const f=h?.[n]?.[l]||a,g=E.useContext(f);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const r=()=>{const s=t.map(o=>E.createContext(o));return function(a){const l=a?.[n]||s;return E.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return r.scopeName=n,[i,l5n(r,...e)]}function l5n(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const i=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function vNe(n,e,{checkForDefaultPrevented:t=!0}={}){return function(r){if(n?.(r),t===!1||!r.defaultPrevented)return e?.(r)}}var c5n=globalThis?.document?E.useLayoutEffect:()=>{},u5n=JB[" useInsertionEffect ".trim().toString()]||c5n;function d5n({prop:n,defaultProp:e,onChange:t=()=>{},caller:i}){const[r,s,o]=h5n({defaultProp:e,onChange:t}),a=n!==void 0,l=a?n:r;{const u=E.useRef(n!==void 0);E.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${i} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,i])}const c=E.useCallback(u=>{if(a){const d=f5n(u)?u(n):u;d!==n&&o.current?.(d)}else s(u)},[a,n,s,o]);return[l,c]}function h5n({defaultProp:n,onChange:e}){const[t,i]=E.useState(n),r=E.useRef(t),s=E.useRef(e);return u5n(()=>{s.current=e},[e]),E.useEffect(()=>{r.current!==t&&(s.current?.(t),r.current=t)},[t,r]),[t,i,s]}function f5n(n){return typeof n=="function"}function g5n(n){const e=E.useRef({value:n,previous:n});return E.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}var p5n=globalThis?.document?E.useLayoutEffect:()=>{};function m5n(n){const[e,t]=E.useState(void 0);return p5n(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return i.observe(n,{box:"border-box"}),()=>i.unobserve(n)}else t(void 0)},[n]),e}function bNe(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function _5n(...n){return e=>{let t=!1;const i=n.map(r=>{const s=bNe(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r{};function b5n(n,e){return E.useReducer((t,i)=>e[t][i]??t,n)}var pZe=n=>{const{present:e,children:t}=n,i=y5n(e),r=typeof t=="function"?t({present:i.isPresent}):E.Children.only(t),s=v5n(i.ref,w5n(r));return typeof t=="function"||i.isPresent?E.cloneElement(r,{ref:s}):null};pZe.displayName="Presence";function y5n(n){const[e,t]=E.useState(),i=E.useRef(null),r=E.useRef(n),s=E.useRef("none"),o=n?"mounted":"unmounted",[a,l]=b5n(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const c=m5(i.current);s.current=a==="mounted"?c:"none"},[a]),yNe(()=>{const c=i.current,u=r.current;if(u!==n){const h=s.current,f=m5(c);n?l("MOUNT"):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,l]),yNe(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=f=>{const p=m5(i.current).includes(f.animationName);if(f.target===e&&p&&(l("ANIMATION_END"),!r.current)){const m=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=m)})}},h=f=>{f.target===e&&(s.current=m5(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(c=>{i.current=c?getComputedStyle(c):null,t(c)},[])}}function m5(n){return n?.animationName||"none"}function w5n(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var C5n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fge=C5n.reduce((n,e)=>{const t=eOe(`Primitive.${e}`),i=E.forwardRef((r,s)=>{const{asChild:o,...a}=r,l=o?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),ae.jsx(l,{...a,ref:s})});return i.displayName=`Primitive.${e}`,{...n,[e]:i}},{}),oz="Checkbox",[x5n,ozn]=a5n(oz),[S5n,Bge]=x5n(oz);function k5n(n){const{__scopeCheckbox:e,checked:t,children:i,defaultChecked:r,disabled:s,form:o,name:a,onCheckedChange:l,required:c,value:u="on",internal_do_not_use_render:d}=n,[h,f]=d5n({prop:t,defaultProp:r??!1,onChange:l,caller:oz}),[g,p]=E.useState(null),[m,_]=E.useState(null),v=E.useRef(!1),y=g?!!o||!!g.closest("form"):!0,C={checked:h,disabled:s,setChecked:f,control:g,setControl:p,name:a,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:c,defaultChecked:hb(r)?!1:r,isFormControl:y,bubbleInput:m,setBubbleInput:_};return ae.jsx(S5n,{scope:e,...C,children:T5n(d)?d(C):i})}var mZe="CheckboxTrigger",_Ze=E.forwardRef(({__scopeCheckbox:n,onKeyDown:e,onClick:t,...i},r)=>{const{control:s,value:o,disabled:a,checked:l,required:c,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:f,bubbleInput:g}=Bge(mZe,n),p=gZe(r,u),m=E.useRef(l);return E.useEffect(()=>{const _=s?.form;if(_){const v=()=>d(m.current);return _.addEventListener("reset",v),()=>_.removeEventListener("reset",v)}},[s,d]),ae.jsx(Fge.button,{type:"button",role:"checkbox","aria-checked":hb(l)?"mixed":l,"aria-required":c,"data-state":wZe(l),"data-disabled":a?"":void 0,disabled:a,value:o,...i,ref:p,onKeyDown:vNe(e,_=>{_.key==="Enter"&&_.preventDefault()}),onClick:vNe(t,_=>{d(v=>hb(v)?!0:!v),g&&f&&(h.current=_.isPropagationStopped(),h.current||_.stopPropagation())})})});_Ze.displayName=mZe;var E5n=E.forwardRef((n,e)=>{const{__scopeCheckbox:t,name:i,checked:r,defaultChecked:s,required:o,disabled:a,value:l,onCheckedChange:c,form:u,...d}=n;return ae.jsx(k5n,{__scopeCheckbox:t,checked:r,defaultChecked:s,disabled:a,required:o,onCheckedChange:c,name:i,form:u,value:l,internal_do_not_use_render:({isFormControl:h})=>ae.jsxs(ae.Fragment,{children:[ae.jsx(_Ze,{...d,ref:e,__scopeCheckbox:t}),h&&ae.jsx(yZe,{__scopeCheckbox:t})]})})});E5n.displayName=oz;var vZe="CheckboxIndicator",L5n=E.forwardRef((n,e)=>{const{__scopeCheckbox:t,forceMount:i,...r}=n,s=Bge(vZe,t);return ae.jsx(pZe,{present:i||hb(s.checked)||s.checked===!0,children:ae.jsx(Fge.span,{"data-state":wZe(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e,style:{pointerEvents:"none",...n.style}})})});L5n.displayName=vZe;var bZe="CheckboxBubbleInput",yZe=E.forwardRef(({__scopeCheckbox:n,...e},t)=>{const{control:i,hasConsumerStoppedPropagationRef:r,checked:s,defaultChecked:o,required:a,disabled:l,name:c,value:u,form:d,bubbleInput:h,setBubbleInput:f}=Bge(bZe,n),g=gZe(t,f),p=g5n(s),m=m5n(i);E.useEffect(()=>{const v=h;if(!v)return;const y=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(y,"checked").set,k=!r.current;if(p!==s&&x){const L=new Event("click",{bubbles:k});v.indeterminate=hb(s),x.call(v,hb(s)?!1:s),v.dispatchEvent(L)}},[h,p,s,r]);const _=E.useRef(hb(s)?!1:s);return ae.jsx(Fge.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??_.current,required:a,disabled:l,name:c,value:u,form:d,...e,tabIndex:-1,ref:g,style:{...e.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});yZe.displayName=bZe;function T5n(n){return typeof n=="function"}function hb(n){return n==="indeterminate"}function wZe(n){return hb(n)?"indeterminate":n?"checked":"unchecked"}export{uQt as $,A5n as A,c$n as B,CFn as C,u$n as D,l$n as E,wFn as F,yu as G,BVt as H,iFn as I,LFn as J,Xme as K,NFn as L,U as M,FFn as N,I5n as O,O5n as P,OFn as Q,yFn as R,B5n as S,RFn as T,N5n as U,zFn as V,eFn as W,J5n as X,M5n as Y,oQt as Z,cQt as _,$5n as a,eVn as a$,pHe as a0,iWn as a1,dQt as a2,hQt as a3,aQt as a4,lQt as a5,IWn as a6,eWn as a7,AWn as a8,wWn as a9,H5n as aA,SHn as aB,X5n as aC,lFn as aD,Y5n as aE,tFn as aF,dFn as aG,uFn as aH,rFn as aI,cFn as aJ,j5n as aK,z5n as aL,Q5n as aM,nFn as aN,vFn as aO,_Fn as aP,pFn as aQ,bFn as aR,oFn as aS,K5n as aT,ZHn as aU,cWn as aV,NHn as aW,aFn as aX,fFn as aY,QHn as aZ,JHn as a_,CWn as aa,kWn as ab,EWn as ac,TWn as ad,Z$n as ae,LWn as af,sWn as ag,SWn as ah,DWn as ai,bWn as aj,yWn as ak,xWn as al,mWn as am,pWn as an,G5n as ao,RWn as ap,Zen as aq,Xen as ar,OWn as as,$Wn as at,MWn as au,FWn as av,R5n as aw,q5n as ax,Z5n as ay,hFn as az,nat as b,VVn as b$,F5n as b0,rVn as b1,oVn as b2,sVn as b3,aVn as b4,Q$n as b5,mVn as b6,tWn as b7,_Vn as b8,lVn as b9,VC as bA,B2 as bB,wVn as bC,HWn as bD,jWn as bE,CHn as bF,qWn as bG,qHn as bH,zHn as bI,uHn as bJ,HHn as bK,DVn as bL,IVn as bM,AVn as bN,NNn as bO,BNn as bP,xHn as bQ,WWn as bR,UWn as bS,VWn as bT,yVn as bU,Kfe as bV,RVn as bW,PVn as bX,oWn as bY,J$n as bZ,aWn as b_,cVn as ba,uVn as bb,hVn as bc,fVn as bd,pVn as be,gVn as bf,vVn as bg,dVn as bh,mAn as bi,CVn as bj,ZWn as bk,XWn as bl,YWn as bm,EVn as bn,LVn as bo,SVn as bp,kVn as bq,bVn as br,zDn as bs,KWn as bt,tVn as bu,nVn as bv,Ufe as bw,jfe as bx,dLn as by,Gm as bz,mr as c,RHn as c$,fHn as c0,zVn as c1,wHn as c2,BHn as c3,AHn as c4,cHn as c5,gHn as c6,$Hn as c7,yHn as c8,VHn as c9,XVn as cA,lWn as cB,dWn as cC,$Vn as cD,HVn as cE,rut as cF,uut as cG,Jct as cH,ks as cI,MHn as cJ,eHn as cK,PHn as cL,THn as cM,bHn as cN,KHn as cO,Rg as cP,Wo as cQ,_Hn as cR,FVn as cS,BVn as cT,hWn as cU,iC as cV,QWn as cW,GWn as cX,BWn as cY,rzn as cZ,szn as c_,rHn as ca,OVn as cb,MVn as cc,WVn as cd,tHn as ce,JWn as cf,U5n as cg,mFn as ch,sFn as ci,V5n as cj,gFn as ck,jVn as cl,qVn as cm,DHn as cn,EHn as co,KVn as cp,nHn as cq,zWn as cr,QVn as cs,JVn as ct,nzn as cu,izn as cv,ezn as cw,tzn as cx,YVn as cy,ZVn as cz,PP as d,sHn as d0,dHn as d1,kHn as d2,lHn as d3,OHn as d4,mHn as d5,UHn as d6,E5n as d7,L5n as d8,nWn as d9,gWn as da,X$n as db,rWn as dc,fWn as dd,hHn as de,P5n as df,xFn as dg,WHn as dh,uVe as di,uWn as dj,iHn as dk,LHn as dl,IHn as dm,oHn as dn,SNn as dp,vHn as dq,jHn as dr,FHn as ds,pHn as dt,GHn as du,aHn as dv,DFn as e,v$ as f,PFn as g,AFn as h,WFn as i,ae as j,HFn as k,Ga as l,VFn as m,e4e as n,a$n as o,TFn as p,SFn as q,E as r,kFn as s,W5n as t,qPe as u,BFn as v,$Fn as w,UFn as x,jFn as y,EFn as z}; diff --git a/public/assets/admin/index.html b/public/assets/admin/index.html index 4f75d40..d7e9f89 100644 --- a/public/assets/admin/index.html +++ b/public/assets/admin/index.html @@ -16,7 +16,7 @@ title: 'Xboard', version: '1.0.0', logo: 'https://xboard.io/i6mages/logo.png', - secure_path: '/afbced4e', + secure_path: '/ea25d015', } diff --git a/public/assets/admin/locales/en-US.js b/public/assets/admin/locales/en-US.js index 575e1c3..5df18ef 100644 --- a/public/assets/admin/locales/en-US.js +++ b/public/assets/admin/locales/en-US.js @@ -196,6 +196,7 @@ window.XBOARD_TRANSLATIONS['en-US'] = { }, "button": { "install": "Install", + "upgrade": "Upgrade", "config": "Configure", "enable": "Enable", "disable": "Disable", @@ -224,6 +225,11 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "description": "Are you sure you want to uninstall this plugin? Plugin data will be cleared after uninstallation.", "button": "Uninstall" }, + "upgrade": { + "title": "Upgrade Plugin", + "description": "Are you sure you want to upgrade this plugin? The plugin will be temporarily unavailable during the upgrade process.", + "button": "Upgrade" + }, "config": { "title": "Configuration", "description": "Modify plugin configuration", @@ -237,6 +243,8 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "messages": { "installSuccess": "Plugin installed successfully", "installError": "Failed to install plugin", + "upgradeSuccess": "Plugin upgraded successfully", + "upgradeError": "Failed to upgrade plugin", "uninstallSuccess": "Plugin uninstalled successfully", "uninstallError": "Failed to uninstall plugin", "enableSuccess": "Plugin enabled successfully", @@ -2033,8 +2041,31 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "shadowsocks": { "cipher": { "label": "Encryption Method", - "placeholder": "Select encryption method" + "placeholder": "Select encryption method", + "search_placeholder": "Search or enter custom encryption method...", + "description": "Select preset encryption method or enter custom encryption method", + "preset_group": "Preset Encryption Methods", + "custom_group": "Custom Encryption Method", + "current_value": "Current Value", + "use_custom": "Use", + "no_results": "No matching encryption method found", + "custom_hint": "You can directly enter a custom encryption method, such as: aes-256-cfb", + "custom_label": "Custom" }, + "plugin": { + "label": "Plugin", + "placeholder": "Select plugin", + "obfs_hint": "Hint: Configuration format like obfs=http;obfs-host=www.bing.com;path=/", + "v2ray_hint": "Hint: WebSocket mode format is mode=websocket;host=mydomain.me;path=/;tls=true, QUIC mode format is mode=quic;host=mydomain.me" + }, + "plugin_opts": { + "label": "Plugin Options", + "description": "Enter plugin options in key=value;key2=value2 format", + "placeholder": "Example: mode=tls;host=bing.com" + }, + "client_fingerprint": "Client Fingerprint", + "client_fingerprint_placeholder": "Select client fingerprint", + "client_fingerprint_description": "Client spoofing fingerprint to reduce detection risk", "obfs": { "label": "Obfuscation", "placeholder": "Select obfuscation method", @@ -2676,6 +2707,7 @@ window.XBOARD_TRANSLATIONS['en-US'] = { "three_yearly": "Three Years", "onetime": "One Time", "reset_traffic": "Reset Traffic", + "no_price": "No Price", "unit": { "month": "/month", "quarter": "/quarter", diff --git a/public/assets/admin/locales/ko-KR.js b/public/assets/admin/locales/ko-KR.js index 7aec68e..157368e 100644 --- a/public/assets/admin/locales/ko-KR.js +++ b/public/assets/admin/locales/ko-KR.js @@ -162,7 +162,6 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "orderManagement": "주문 관리", "couponManagement": "쿠폰 관리", "userManagement": "사용자 관리", - "trafficResetLogs": "트래픽 재설정 로그", "ticketManagement": "티켓 관리" }, "plugin": { @@ -414,42 +413,20 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "description": "허용된 이메일 접미사를 한 줄에 하나씩 입력하세요" } }, - "captcha": { + "recaptcha": { "enable": { - "label": "캡차 활성화", - "description": "활성화하면 사용자는 등록 시 캡차 인증을 통과해야 합니다." + "label": "reCAPTCHA 활성화", + "description": "활성화하면 사용자는 등록 시 reCAPTCHA 인증을 통과해야 합니다." }, - "type": { - "label": "캡차 유형", - "description": "사용할 캡차 서비스 유형을 선택하세요", - "options": { - "recaptcha": "Google reCAPTCHA v2", - "turnstile": "Cloudflare Turnstile" - } + "key": { + "label": "reCAPTCHA 키", + "placeholder": "reCAPTCHA 키 입력", + "description": "reCAPTCHA 키를 입력하세요" }, - "recaptcha": { - "key": { - "label": "reCAPTCHA 키", - "placeholder": "reCAPTCHA 키 입력", - "description": "reCAPTCHA 키를 입력하세요" - }, - "siteKey": { - "label": "reCAPTCHA 사이트 키", - "placeholder": "reCAPTCHA 사이트 키 입력", - "description": "reCAPTCHA 사이트 키를 입력하세요" - } - }, - "turnstile": { - "secretKey": { - "label": "Turnstile 키", - "placeholder": "Turnstile 키 입력", - "description": "Cloudflare Turnstile 키를 입력하세요" - }, - "siteKey": { - "label": "Turnstile 사이트 키", - "placeholder": "Turnstile 사이트 키 입력", - "description": "Cloudflare Turnstile 사이트 키를 입력하세요" - } + "siteKey": { + "label": "reCAPTCHA 사이트 키", + "placeholder": "reCAPTCHA 사이트 키 입력", + "description": "reCAPTCHA 사이트 키를 입력하세요" } }, "registerLimit": { @@ -464,8 +441,8 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { }, "expire": { "label": "제한 기간", - "placeholder": "제한 기간을 분 단위로 입력", - "description": "등록 제한 기간(분)" + "placeholder": "제한 기간을 시간 단위로 입력", + "description": "등록 제한 기간(시간)" } }, "passwordLimit": { @@ -480,8 +457,8 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { }, "expire": { "label": "잠금 기간", - "placeholder": "잠금 기간을 분 단위로 입력", - "description": "계정 잠금 기간(분)" + "placeholder": "잠금 기간을 시간 단위로 입력", + "description": "계정 잠금 기간(시간)" } } } @@ -819,10 +796,6 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "surge": { "title": "Surge 템플릿", "description": "Surge의 구독 템플릿 형식 설정" - }, - "surfboard": { - "title": "Surfboard 템플릿", - "description": "Surfboard의 구독 템플릿 형식 설정" } } }, @@ -887,7 +860,6 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "save": "저장", "cancel": "취소", "confirm": "확인", - "close": "닫기", "delete": { "success": "삭제되었습니다", "failed": "삭제에 실패했습니다" @@ -1050,21 +1022,7 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "result": "결과", "duration": "소요 시간", "attempts": "시도 횟수", - "nextRetry": "다음 재시도", - "failedJobsDetailTitle": "실패한 작업 세부 정보", - "viewFailedJobs": "실패한 작업 보기", - "jobDetailTitle": "작업 세부 정보", - "time": "시간", - "queue": "대기열", - "name": "작업 이름", - "exception": "예외", - "noFailedJobs": "실패한 작업 없음", - "connection": "연결", - "payload": "작업 페이로드", - "viewDetail": "세부 정보 보기", - "action": "작업", - "noRecentOrder": "최근 주문 없음", - "viewAll": "모두 보기" + "nextRetry": "다음 재시도" }, "actions": { "retry": "재시도", @@ -1074,86 +1032,7 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { }, "empty": "대기열에 작업 없음", "loading": "대기열 상태 로딩 중...", - "error": "대기열 상태 로드 실패", - "recentOrders": { - "title": "최근 주문" - }, - "jobs": { - "title": "작업 현황", - "failedJobsDetailTitle": "실패한 작업 세부 정보", - "viewFailedJobs": "실패한 작업 보기", - "jobDetailTitle": "작업 세부 정보", - "time": "시간", - "queue": "대기열", - "name": "작업 이름", - "exception": "예외", - "noFailedJobs": "실패한 작업 없음", - "connection": "연결", - "payload": "작업 페이로드", - "viewDetail": "세부 정보 보기", - "action": "작업" - } - }, - "systemLog": { - "title": "시스템 로그", - "description": "시스템 운영 로그 조회", - "viewAll": "모두 보기", - "level": "레벨", - "time": "시간", - "message": "메시지", - "logTitle": "제목", - "method": "요청 방법", - "action": "작업", - "context": "컨텍스트", - "search": "로그 검색...", - "noLogs": "로그 없음", - "noInfoLogs": "정보 로그 없음", - "noWarningLogs": "경고 로그 없음", - "noErrorLogs": "오류 로그 없음", - "noSearchResults": "일치하는 로그가 없습니다", - "detailTitle": "로그 세부 정보", - "viewDetail": "세부 정보 보기", - "host": "호스트", - "ip": "IP 주소", - "uri": "URI", - "requestData": "요청 데이터", - "exception": "예외", - "totalLogs": "총 로그 수", - "tabs": { - "all": "전체", - "info": "정보", - "warning": "경고", - "error": "오류" - }, - "filter": { - "searchAndLevel": "필터 결과: \\\"{{keyword}}\\\"를 포함하고 레벨이 \\\"{{level}}\\\"인 로그 {{count}}개", - "searchOnly": "검색 결과: \\\"{{keyword}}\\\"를 포함하는 로그 {{count}}개", - "levelOnly": "필터 결과: 레벨이 \\\"{{level}}\\\"인 로그 {{count}}개", - "reset": "필터 초기화" - }, - "clearLogs": "로그 삭제", - "clearDays": "삭제 일수", - "clearDaysDesc": "며칠 전 로그를 삭제할지 (0-365일, 0은 오늘)", - "clearLevel": "로그 레벨", - "clearLimit": "배치 제한", - "clearLimitDesc": "배치 삭제 수량 제한 (100-10000건)", - "clearPreview": "삭제 미리보기", - "getStats": "통계 가져오기", - "cutoffDate": "마감일", - "willClear": "삭제 예정", - "logsUnit": "개 로그", - "clearWarning": "이 작업은 되돌릴 수 없습니다. 신중하게 진행해 주세요!", - "clearing": "삭제 중...", - "confirmClear": "삭제 확인", - "clearSuccess": "삭제 완료! {{count}}개 로그 삭제됨", - "clearFailed": "삭제 실패", - "getStatsFailed": "삭제 통계 가져오기 실패", - "clearLogsFailed": "로그 삭제 실패" - }, - "common": { - "refresh": "새로고침", - "close": "닫기", - "pagination": "{{current}}/{{total}} 페이지, 총 {{count}}개 항목" + "error": "대기열 상태 로드 실패" }, "search": { "placeholder": "메뉴 및 기능 검색...", @@ -1273,8 +1152,6 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "basicInfo": "기본 정보", "amountInfo": "금액 정보", "timeInfo": "시간 정보", - "commissionInfo": "수수료 정보", - "commissionStatusActive": "활성", "addOrder": "주문 추가", "assignOrder": "주문 할당", "fields": { @@ -1288,12 +1165,7 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "refundAmount": "환불 금액", "deductionAmount": "차감 금액", "createdAt": "생성 시간", - "updatedAt": "업데이트 시간", - "commissionStatus": "수수료 상태", - "commissionAmount": "수수료 금액", - "actualCommissionAmount": "실제 수수료", - "inviteUser": "초대자", - "inviteUserId": "초대자 ID" + "updatedAt": "업데이트 시간" }, "placeholders": { "email": "사용자 이메일을 입력해주세요", @@ -1410,17 +1282,6 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { }, "error": { "saveFailed": "쿠폰 저장 실패" - }, - "timeRange": { - "quickSet": "빠른 설정", - "presets": { - "1week": "1주", - "2weeks": "2주", - "1month": "1개월", - "3months": "3개월", - "6months": "6개월", - "1year": "1년" - } } }, "period": { @@ -1645,17 +1506,6 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "tooltip": "이 노드를 구독할 수 있는 그룹", "empty": "--" }, - "loadStatus": { - "title": "부하 상태", - "tooltip": "서버 리소스 사용량", - "noData": "데이터 없음", - "details": "시스템 부하 세부정보", - "cpu": "CPU 사용률", - "memory": "메모리 사용량", - "swap": "스왑 사용량", - "disk": "디스크 사용량", - "lastUpdate": "마지막 업데이트" - }, "type": "유형", "actions": "작업", "copyAddress": "연결 주소 복사", @@ -1698,9 +1548,7 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { }, "rate": { "label": "요금", - "error": "요금은 필수입니다", - "error_numeric": "요금은 숫자여야 합니다", - "error_gte_zero": "요금은 0보다 크거나 같아야 합니다" + "error": "올바른 요금을 입력해주세요" }, "code": { "label": "사용자 지정 노드 ID", @@ -1719,21 +1567,18 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { }, "host": { "label": "노드 주소", - "placeholder": "도메인 또는 IP를 입력해주세요", - "error": "노드 주소는 필수입니다" + "placeholder": "도메인 또는 IP를 입력해주세요" }, "port": { "label": "연결 포트", "placeholder": "사용자 연결 포트", "tooltip": "사용자가 실제로 연결하는 포트로, 클라이언트 설정에 입력해야 하는 포트 번호입니다. 중계 또는 터널을 사용하는 경우 서버가 실제로 수신하는 포트와 다를 수 있습니다.", - "sync": "서버 포트와 동기화", - "error": "연결 포트는 필수입니다" + "sync": "서버 포트와 동기화" }, "server_port": { "label": "서버 포트", - "placeholder": "서버 포트 입력", - "error": "서버 포트는 필수입니다", - "tooltip": "서버의 실제 수신 포트입니다." + "placeholder": "서버 수신 포트", + "tooltip": "서버가 실제로 수신하는 포트로, 서버에서 실제로 열린 포트입니다. 중계 또는 터널을 사용하는 경우 사용자 연결 포트와 다를 수 있습니다." }, "parent": { "label": "상위 노드", @@ -1895,83 +1740,6 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "empty": "사용 가능한 ALPN 프로토콜이 없습니다" } } - }, - "socks": { - "version": { - "label": "프로토콜 버전", - "placeholder": "SOCKS 버전 선택" - }, - "tls": { - "label": "TLS", - "placeholder": "보안을 선택해주세요", - "disabled": "비활성화", - "enabled": "활성화" - }, - "tls_settings": { - "server_name": { - "label": "서버 이름 표시(SNI)", - "placeholder": "사용하지 않는 경우 비워두세요" - }, - "allow_insecure": "안전하지 않은 연결 허용?" - }, - "network": { - "label": "전송 프로토콜", - "placeholder": "전송 프로토콜 선택" - } - }, - "naive": { - "tls_settings": { - "server_name": { - "label": "서버 이름 표시(SNI)", - "placeholder": "사용하지 않는 경우 비워두세요" - }, - "allow_insecure": "안전하지 않은 연결 허용?" - }, - "tls": { - "label": "TLS", - "placeholder": "보안을 선택해주세요", - "disabled": "비활성화", - "enabled": "활성화", - "server_name": { - "label": "서버 이름 표시(SNI)", - "placeholder": "노드 주소와 인증서가 다를 때 인증서 확인에 사용" - }, - "allow_insecure": "안전하지 않은 연결 허용" - } - }, - "http": { - "tls_settings": { - "server_name": { - "label": "서버 이름 표시(SNI)", - "placeholder": "사용하지 않는 경우 비워두세요" - }, - "allow_insecure": "안전하지 않은 연결 허용?" - }, - "tls": { - "label": "TLS", - "placeholder": "보안을 선택해주세요", - "disabled": "비활성화", - "enabled": "활성화", - "server_name": { - "label": "서버 이름 표시(SNI)", - "placeholder": "노드 주소와 인증서가 다를 때 인증서 확인에 사용" - }, - "allow_insecure": "안전하지 않은 연결 허용" - } - }, - "mieru": { - "transport": { - "label": "전송 프로토콜", - "placeholder": "전송 프로토콜 선택" - }, - "multiplexing": { - "label": "다중화", - "placeholder": "다중화 수준 선택", - "MULTIPLEXING_OFF": "비활성화", - "MULTIPLEXING_LOW": "낮음", - "MULTIPLEXING_MIDDLE": "중간", - "MULTIPLEXING_HIGH": "높음" - } } } }, @@ -2028,7 +1796,6 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "orders": "주문 내역", "invites": "초대 내역", "traffic_records": "트래픽 기록", - "reset_traffic": "트래픽 재설정", "delete": "삭제", "delete_confirm_title": "사용자 삭제 확인", "delete_confirm_description": "이 작업은 사용자 {{email}}와 관련된 모든 데이터(주문, 쿠폰, 트래픽 기록, 지원 티켓 등)를 영구적으로 삭제합니다. 이 작업은 취소할 수 없습니다. 계속하시겠습니까?" @@ -2105,8 +1872,7 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "generate_count_placeholder": "일괄 생성할 수량 입력", "cancel": "취소", "submit": "생성", - "success": "생성 완료", - "download_csv": "CSV 파일로 내보내기" + "success": "생성 완료" } }, "edit": { @@ -2165,7 +1931,6 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "title": "작업", "send_email": "이메일 보내기", "export_csv": "CSV 내보내기", - "traffic_reset_stats": "트래픽 재설정 통계", "batch_ban": "일괄 차단", "confirm_ban": { "title": "일괄 차단 확인", @@ -2193,117 +1958,6 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = { "required_fields": "모든 필수 항목을 입력해주세요" } }, - "traffic_reset": { - "title": "트래픽 재설정", - "description": "사용자 {{email}}의 트래픽 사용량 재설정", - "tabs": { - "reset": "트래픽 재설정", - "history": "재설정 기록" - }, - "user_info": "사용자 정보", - "warning": { - "title": "중요 안내", - "irreversible": "트래픽 재설정 작업은 되돌릴 수 없습니다. 신중하게 진행해주세요", - "reset_to_zero": "재설정 후 사용자의 업로드 및 다운로드 트래픽이 0으로 초기화됩니다", - "logged": "모든 재설정 작업은 시스템 로그에 기록됩니다" - }, - "reason": { - "label": "재설정 사유", - "placeholder": "트래픽 재설정 사유를 입력해주세요 (선택사항)", - "optional": "이 필드는 선택사항이며 재설정 사유를 기록하는 데 사용됩니다" - }, - "confirm_reset": "재설정 확인", - "resetting": "재설정 중...", - "reset_success": "트래픽 재설정 성공", - "reset_failed": "트래픽 재설정 실패", - "history": { - "summary": "재설정 개요", - "reset_count": "재설정 횟수", - "last_reset": "마지막 재설정", - "next_reset": "다음 재설정", - "never": "재설정된 적 없음", - "no_schedule": "예약된 재설정 없음", - "records": "재설정 기록", - "recent_records": "최근 10번의 재설정 기록", - "no_records": "재설정 기록이 없습니다", - "reset_time": "재설정 시간", - "traffic_cleared": "삭제된 트래픽" - }, - "stats": { - "title": "트래픽 재설정 통계", - "description": "시스템 트래픽 재설정 통계 정보 보기", - "time_range": "통계 시간 범위", - "total_resets": "총 재설정 횟수", - "auto_resets": "자동 재설정", - "manual_resets": "수동 재설정", - "cron_resets": "예약 재설정", - "in_period": "최근 {{days}}일", - "breakdown": "재설정 유형별 분석", - "breakdown_description": "다양한 재설정 작업 유형의 백분율 분석", - "auto_percentage": "자동 재설정 비율", - "manual_percentage": "수동 재설정 비율", - "cron_percentage": "예약 재설정 비율", - "days_options": { - "week": "지난 주", - "month": "지난 달", - "quarter": "지난 분기", - "year": "지난 해" - } - } - }, - "traffic_reset_logs": { - "title": "트래픽 재설정 로그", - "description": "시스템의 모든 트래픽 재설정 작업에 대한 상세 기록 보기", - "columns": { - "id": "로그 ID", - "user": "사용자", - "reset_type": "재설정 유형", - "trigger_source": "트리거 소스", - "cleared_traffic": "삭제된 트래픽", - "cleared": "삭제됨", - "upload": "업로드", - "download": "다운로드", - "reset_time": "재설정 시간", - "log_time": "로그 시간" - }, - "filters": { - "search_user": "사용자 이메일 검색...", - "reset_type": "재설정 유형", - "trigger_source": "트리거 소스", - "all_types": "모든 유형", - "all_sources": "모든 소스", - "start_date": "시작 날짜", - "end_date": "종료 날짜", - "apply_date": "필터 적용", - "reset": "필터 초기화", - "filter_title": "필터 옵션", - "filter_description": "특정 트래픽 재설정 기록을 찾기 위한 필터 조건을 설정하세요", - "reset_types": { - "monthly": "월별 재설정", - "first_day_month": "매월 1일 재설정", - "yearly": "연별 재설정", - "first_day_year": "매년 1월 1일 재설정", - "manual": "수동 재설정" - }, - "trigger_sources": { - "auto": "자동 트리거", - "manual": "수동 트리거", - "cron": "예약 작업" - } - }, - "actions": { - "export": "로그 내보내기", - "exporting": "내보내는 중...", - "export_success": "내보내기 성공", - "export_failed": "내보내기 실패" - }, - "trigger_descriptions": { - "manual": "관리자가 수동으로 실행한 트래픽 재설정", - "cron": "시스템 예약 작업에 의한 자동 실행", - "auto": "시스템이 조건에 따라 자동 트리거", - "other": "기타 방법으로 트리거" - } - }, "send_mail": { "title": "이메일 보내기", "description": "선택하거나 필터링된 사용자에게 이메일 보내기", diff --git a/public/assets/admin/locales/zh-CN.js b/public/assets/admin/locales/zh-CN.js index 85287f4..b61c09f 100644 --- a/public/assets/admin/locales/zh-CN.js +++ b/public/assets/admin/locales/zh-CN.js @@ -196,6 +196,7 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { }, "button": { "install": "安装", + "upgrade": "升级", "config": "配置", "enable": "启用", "disable": "禁用", @@ -224,6 +225,11 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "description": "确定要卸载此插件吗?卸载后插件数据将被清除。", "button": "卸载" }, + "upgrade": { + "title": "升级插件", + "description": "确定要升级此插件吗?升级过程中插件将暂时不可用。", + "button": "升级" + }, "config": { "title": "配置", "description": "修改插件配置", @@ -237,6 +243,8 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "messages": { "installSuccess": "插件安装成功", "installError": "插件安装失败", + "upgradeSuccess": "插件升级成功", + "upgradeError": "插件升级失败", "uninstallSuccess": "插件卸载成功", "uninstallError": "插件卸载失败", "enableSuccess": "插件启用成功", @@ -2106,8 +2114,31 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "shadowsocks": { "cipher": { "label": "加密算法", - "placeholder": "选择加密算法" + "placeholder": "选择加密算法", + "search_placeholder": "搜索或输入自定义加密方式...", + "description": "选择预设加密方式或输入自定义加密方式", + "preset_group": "预设加密方式", + "custom_group": "自定义加密方式", + "current_value": "当前值", + "use_custom": "使用", + "no_results": "未找到匹配的加密方式", + "custom_hint": "你可以直接输入自定义的加密方式,如:aes-256-cfb", + "custom_label": "自定义" }, + "plugin": { + "label": "插件", + "placeholder": "选择插件", + "obfs_hint": "提示:配置格式如 obfs=http;obfs-host=www.bing.com;path=/", + "v2ray_hint": "提示:WebSocket模式格式为 mode=websocket;host=mydomain.me;path=/;tls=true,QUIC模式格式为 mode=quic;host=mydomain.me" + }, + "plugin_opts": { + "label": "插件选项", + "description": "按照 key=value;key2=value2 格式输入插件选项", + "placeholder": "例如: mode=tls;host=bing.com" + }, + "client_fingerprint": "客户端指纹", + "client_fingerprint_placeholder": "选择客户端指纹", + "client_fingerprint_description": "客户端伪装指纹,用于降低被识别风险", "obfs": { "label": "混淆", "placeholder": "选择混淆方式", @@ -2749,6 +2780,7 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = { "three_yearly": "三年付", "onetime": "流量包", "reset_traffic": "重置包", + "no_price": "无价格", "unit": { "month": "元/月", "quarter": "元/季",